diff
stringlengths
41
2.03M
msg
stringlengths
1
1.5k
repo
stringlengths
5
40
sha
stringlengths
40
40
time
stringlengths
20
20
mmm a / buildroot / share / sublime / MarlinFirmware . sublime - project <nl> ppp b / buildroot / share / sublime / MarlinFirmware . sublime - project <nl> <nl> " folder_exclude_patterns " : <nl> [ <nl> " . pio * " , <nl> - " Marlin / lib " , <nl> + " lib " , <nl> " datatmp " , <nl> " Marlin / * / src " , <nl> " . vscode " <nl> mmm a / platformio . ini <nl> ppp b / platformio . ini <nl> build_flags = - fmax - errors = 5 <nl> - ggdb <nl> lib_deps = <nl> https : / / github . com / MarlinFirmware / U8glib - HAL / archive / dev . zip <nl> - LiquidCrystal_I2C @ 1 . 1 . 2 <nl> + LiquidCrystal @ 1 . 3 . 4 <nl> TMC2130Stepper <nl> https : / / github . com / teemuatlut / TMC2208Stepper / archive / v0 . 1 . 1 . zip <nl> Adafruit NeoPixel @ 1 . 1 . 3 <nl>
Try LiquidCrystal @ 1 . 3 . 4
MarlinFirmware/Marlin
928e50e724400f4c2a332b710cce272188e73dfd
2018-06-12T05:40:50Z
mmm a / cmake / packages / nsis . cmake <nl> ppp b / cmake / packages / nsis . cmake <nl> if ( NOT $ { SYMSRVDIR } STREQUAL " " ) <nl> message ( " Storing symbols : " ) <nl> add_custom_command ( TARGET $ { BIN_ARANGOD } POST_BUILD <nl> WORKING_DIRECTORY $ { PROJECT_BINARY_DIR } <nl> - COMMAND " find - name \ * pdb | grep - v Release | grep - v Debug | grep - v 3rdParty | grep - v vc120 . pdb > pdbfiles_list . txt " <nl> + COMMAND " find - name \ \ * pdb | grep - v Release | grep - v Debug | grep - v 3rdParty | grep - v vc120 . pdb > pdbfiles_list . txt " <nl> COMMAND " symstore . exe add / f ' @ $ { PROJECT_BINARY_DIR } / pdbfiles_list . txt ' / s ' $ { SYMSRVDIR } ' / t ArangoDB / compress " ) <nl> endif ( ) <nl> mmm a / cmake / packages / rpm . cmake <nl> ppp b / cmake / packages / rpm . cmake <nl> set ( CPACK_TEMPORARY_DIRECTORY " $ { PROJECT_BINARY_DIR } / _CPack_Packages / $ { C <nl> set ( CPACK_TEMPORARY_PACKAGE_FILE_NAME " $ { CPACK_TEMPORARY_DIRECTORY } / $ { CPACK_PACKAGE_FILE_NAME } . rpm " ) <nl> <nl> set ( CMAKE_RUNTIME_OUTPUT_DIRECTORY_X $ { PROJECT_BINARY_DIR } / bin ) <nl> - include ( cmake / dump_vars . cmake ) <nl> include ( arangosh / dbg . cmake ) <nl> include ( arangod / dbg . cmake ) <nl> <nl>
fix packaging scripts
arangodb/arangodb
90246c038ae58e56fdbfa712509cd1683a0be28c
2017-01-09T17:03:45Z
mmm a / modules / control / common / control_gflags . cc <nl> ppp b / modules / control / common / control_gflags . cc <nl> DEFINE_bool ( query_forward_time_point_only , false , <nl> <nl> DEFINE_bool ( enable_feedback_augment_on_high_speed , false , <nl> " Enable augmented control on lateral error on high speed " ) ; <nl> + <nl> + DEFINE_bool ( <nl> + enable_gear_dirve_negative_speed_protection , false , <nl> + " Enable estop to prevent following negative speed during gear drive " ) ; <nl> mmm a / modules / control / common / control_gflags . h <nl> ppp b / modules / control / common / control_gflags . h <nl> DECLARE_bool ( query_time_nearest_point_only ) ; <nl> DECLARE_bool ( query_forward_time_point_only ) ; <nl> <nl> DECLARE_bool ( enable_feedback_augment_on_high_speed ) ; <nl> + <nl> + DECLARE_bool ( enable_gear_dirve_negative_speed_protection ) ; <nl> mmm a / modules / control / control_component . cc <nl> ppp b / modules / control / control_component . cc <nl> Status ControlComponent : : ProduceControlCommand ( <nl> local_view_ . trajectory . header ( ) . ShortDebugString ( ) ; <nl> } <nl> <nl> - / / chassis : : gear_drive & & trajectory point speed is negative <nl> - const double kEpsilon = 0 . 001 ; <nl> - auto first_trajectory_point = local_view_ . trajectory . trajectory_point ( 0 ) ; <nl> - if ( local_view_ . chassis . gear_location ( ) = = Chassis : : GEAR_DRIVE & & <nl> - first_trajectory_point . v ( ) < - 1 * kEpsilon ) { <nl> - estop_ = true ; <nl> - estop_reason_ = " estop for negative speed when gear_drive " ; <nl> + if ( FLAGS_enable_gear_dirve_negative_speed_protection ) { <nl> + const double kEpsilon = 0 . 001 ; <nl> + auto first_trajectory_point = local_view_ . trajectory . trajectory_point ( 0 ) ; <nl> + if ( local_view_ . chassis . gear_location ( ) = = Chassis : : GEAR_DRIVE & & <nl> + first_trajectory_point . v ( ) < - 1 * kEpsilon ) { <nl> + estop_ = true ; <nl> + estop_reason_ = " estop for negative speed when gear_drive " ; <nl> + } <nl> } <nl> <nl> if ( ! estop_ ) { <nl>
control : add gflags for negative speed protection during gear drive
ApolloAuto/apollo
3ed34f5b5989d5bb1b1d8c6ec24f361f3ef8edca
2019-06-26T01:24:41Z
mmm a / include / swift / SIL / SILBuilder . h <nl> ppp b / include / swift / SIL / SILBuilder . h <nl> class SILBuilder { <nl> getSILDebugLocation ( Loc ) , valueType , operand , F , OpenedArchetypes ) ) ; <nl> } <nl> <nl> - AllocBoxInst * createAllocBox ( SILLocation Loc , SILType ElementType , <nl> + AllocBoxInst * createAllocBox ( SILLocation Loc , CanSILBoxType BoxType , <nl> SILDebugVariable Var = SILDebugVariable ( ) ) { <nl> Loc . markAsPrologue ( ) ; <nl> - return insert ( AllocBoxInst : : create ( getSILDebugLocation ( Loc ) , ElementType , F , <nl> + return insert ( AllocBoxInst : : create ( getSILDebugLocation ( Loc ) , BoxType , F , <nl> OpenedArchetypes , Var ) ) ; <nl> } <nl> <nl> mmm a / include / swift / SIL / SILCloner . h <nl> ppp b / include / swift / SIL / SILCloner . h <nl> SILCloner < ImplClass > : : visitAllocBoxInst ( AllocBoxInst * Inst ) { <nl> getBuilder ( ) . setCurrentDebugScope ( getOpScope ( Inst - > getDebugScope ( ) ) ) ; <nl> doPostProcess ( Inst , <nl> getBuilder ( ) . createAllocBox ( getOpLocation ( Inst - > getLoc ( ) ) , <nl> - getOpType ( Inst - > getElementType ( ) ) ) ) ; <nl> + this - > getOpType ( Inst - > getType ( ) ) . template castTo < SILBoxType > ( ) ) ) ; <nl> } <nl> <nl> template < typename ImplClass > <nl> mmm a / include / swift / SIL / SILInstruction . h <nl> ppp b / include / swift / SIL / SILInstruction . h <nl> class AllocBoxInst final <nl> <nl> TailAllocatedDebugVariable VarInfo ; <nl> <nl> - AllocBoxInst ( SILDebugLocation DebugLoc , SILType ElementType , <nl> + AllocBoxInst ( SILDebugLocation DebugLoc , CanSILBoxType BoxType , <nl> ArrayRef < SILValue > TypeDependentOperands , SILFunction & F , <nl> SILDebugVariable Var ) ; <nl> <nl> - static AllocBoxInst * create ( SILDebugLocation Loc , SILType elementType , <nl> + static AllocBoxInst * create ( SILDebugLocation Loc , CanSILBoxType boxType , <nl> SILFunction & F , <nl> SILOpenedArchetypesState & OpenedArchetypes , <nl> SILDebugVariable Var ) ; <nl> mmm a / lib / Parse / ParseSIL . cpp <nl> ppp b / lib / Parse / ParseSIL . cpp <nl> bool SILParser : : parseSILInstruction ( SILBasicBlock * BB , SILBuilder & B ) { <nl> return true ; <nl> if ( parseSILDebugLocation ( InstLoc , B ) ) <nl> return true ; <nl> - ResultVal = B . createAllocBox ( InstLoc , Ty , VarInfo ) ; <nl> + ResultVal = B . createAllocBox ( InstLoc , Ty . castTo < SILBoxType > ( ) , VarInfo ) ; <nl> break ; <nl> } <nl> case ValueKind : : ApplyInst : <nl> mmm a / lib / SIL / SILInstructions . cpp <nl> ppp b / lib / SIL / SILInstructions . cpp <nl> AllocRefDynamicInst : : create ( SILDebugLocation DebugLoc , SILFunction & F , <nl> AllocRefDynamicInst ( DebugLoc , ty , objc , ElementTypes , AllOperands ) ; <nl> } <nl> <nl> - AllocBoxInst : : AllocBoxInst ( SILDebugLocation Loc , SILType ElementType , <nl> + AllocBoxInst : : AllocBoxInst ( SILDebugLocation Loc , CanSILBoxType BoxType , <nl> ArrayRef < SILValue > TypeDependentOperands , <nl> SILFunction & F , SILDebugVariable Var ) <nl> : AllocationInst ( ValueKind : : AllocBoxInst , Loc , <nl> - SILType : : getPrimitiveObjectType ( <nl> - SILBoxType : : get ( ElementType . getSwiftRValueType ( ) ) ) ) , <nl> + SILType : : getPrimitiveObjectType ( BoxType ) ) , <nl> NumOperands ( TypeDependentOperands . size ( ) ) , <nl> VarInfo ( Var , getTrailingObjects < char > ( ) ) { <nl> TrailingOperandsList : : InitOperandsList ( getAllOperands ( ) . begin ( ) , this , <nl> TypeDependentOperands ) ; <nl> } <nl> <nl> - AllocBoxInst * AllocBoxInst : : create ( SILDebugLocation Loc , SILType ElementType , <nl> + AllocBoxInst * AllocBoxInst : : create ( SILDebugLocation Loc , <nl> + CanSILBoxType BoxType , <nl> SILFunction & F , <nl> SILOpenedArchetypesState & OpenedArchetypes , <nl> SILDebugVariable Var ) { <nl> SmallVector < SILValue , 8 > TypeDependentOperands ; <nl> collectTypeDependentOperands ( TypeDependentOperands , OpenedArchetypes , F , <nl> - ElementType . getSwiftRValueType ( ) ) ; <nl> + BoxType ) ; <nl> void * Buffer = allocateDebugVarCarryingInst < AllocBoxInst > ( <nl> F . getModule ( ) , Var , TypeDependentOperands ) ; <nl> return : : new ( Buffer ) <nl> - AllocBoxInst ( Loc , ElementType , TypeDependentOperands , F , Var ) ; <nl> + AllocBoxInst ( Loc , BoxType , TypeDependentOperands , F , Var ) ; <nl> } <nl> <nl> / / / getDecl - Return the underlying variable declaration associated with this <nl> mmm a / lib / SIL / SILPrinter . cpp <nl> ppp b / lib / SIL / SILPrinter . cpp <nl> class SILPrinter : public SILVisitor < SILPrinter > { <nl> } <nl> <nl> void visitAllocBoxInst ( AllocBoxInst * ABI ) { <nl> - * this < < ABI - > getElementType ( ) ; <nl> + * this < < ABI - > getType ( ) ; <nl> printDebugVar ( ABI - > getVarInfo ( ) ) ; <nl> } <nl> <nl> mmm a / lib / SILGen / SILGenApply . cpp <nl> ppp b / lib / SILGen / SILGenApply . cpp <nl> ManagedValue SILGenFunction : : emitInjectEnum ( SILLocation loc , <nl> / / throws , we know to deallocate the uninitialized box . <nl> if ( element - > isIndirect ( ) | | <nl> element - > getParentEnum ( ) - > isIndirect ( ) ) { <nl> - auto * box = B . createAllocBox ( loc , payloadTL . getLoweredType ( ) ) ; <nl> + auto boxTy = SILBoxType : : get ( payloadTL . getLoweredType ( ) . getSwiftRValueType ( ) ) ; <nl> + auto * box = B . createAllocBox ( loc , boxTy ) ; <nl> auto * addr = B . createProjectBox ( loc , box , 0 ) ; <nl> <nl> CleanupHandle initCleanup = enterDestroyCleanup ( box ) ; <nl> mmm a / lib / SILGen / SILGenDecl . cpp <nl> ppp b / lib / SILGen / SILGenDecl . cpp <nl> class LocalVariableInitialization : public SingleBufferInitialization { <nl> assert ( ! SGF . VarLocs . count ( decl ) & & " Already have an entry for this decl ? " ) ; <nl> <nl> SILType lType = SGF . getLoweredType ( decl - > getType ( ) - > getRValueType ( ) ) ; <nl> + auto boxType = SILBoxType : : get ( lType . getSwiftRValueType ( ) ) ; <nl> <nl> / / The variable may have its lifetime extended by a closure , heap - allocate <nl> / / it using a box . <nl> AllocBoxInst * allocBox = <nl> - SGF . B . createAllocBox ( decl , lType , { decl - > isLet ( ) , ArgNo } ) ; <nl> + SGF . B . createAllocBox ( decl , boxType , { decl - > isLet ( ) , ArgNo } ) ; <nl> SILValue addr = SGF . B . createProjectBox ( decl , allocBox , 0 ) ; <nl> <nl> / / Mark the memory as uninitialized , so DI will track it for us . <nl> mmm a / lib / SILGen / SILGenFunction . cpp <nl> ppp b / lib / SILGen / SILGenFunction . cpp <nl> void SILGenFunction : : emitCaptures ( SILLocation loc , <nl> / / since we could conceivably forward the copied value into the <nl> / / closure context and pass it down to the partially applied function <nl> / / in - place . <nl> - AllocBoxInst * allocBox = <nl> - B . createAllocBox ( loc , vl . value - > getType ( ) . getObjectType ( ) ) ; <nl> + auto boxTy = SILBoxType : : get ( vl . value - > getType ( ) . getSwiftRValueType ( ) ) ; <nl> + <nl> + AllocBoxInst * allocBox = B . createAllocBox ( loc , boxTy ) ; <nl> ProjectBoxInst * boxAddress = B . createProjectBox ( loc , allocBox , 0 ) ; <nl> B . createCopyAddr ( loc , vl . value , boxAddress , IsNotTake , IsInitialization ) ; <nl> capturedArgs . push_back ( emitManagedRValueWithCleanup ( allocBox ) ) ; <nl> mmm a / lib / Serialization / DeserializeSIL . cpp <nl> ppp b / lib / Serialization / DeserializeSIL . cpp <nl> bool SILDeserializer : : readSILInstruction ( SILFunction * Fn , SILBasicBlock * BB , <nl> case ValueKind : : DebugValueAddrInst : <nl> llvm_unreachable ( " not supported " ) ; <nl> <nl> + case ValueKind : : AllocBoxInst : <nl> + assert ( RecordKind = = SIL_ONE_TYPE & & " Layout should be OneType . " ) ; <nl> + ResultVal = Builder . createAllocBox ( Loc , <nl> + cast < SILBoxType > ( MF - > getType ( TyID ) - > getCanonicalType ( ) ) ) ; <nl> + break ; <nl> + <nl> # define ONETYPE_INST ( ID ) \ <nl> case ValueKind : : ID # # Inst : \ <nl> assert ( RecordKind = = SIL_ONE_TYPE & & " Layout should be OneType . " ) ; \ <nl> ResultVal = Builder . create # # ID ( Loc , \ <nl> getSILType ( MF - > getType ( TyID ) , ( SILValueCategory ) TyCategory ) ) ; \ <nl> break ; <nl> - ONETYPE_INST ( AllocBox ) <nl> ONETYPE_INST ( AllocStack ) <nl> ONETYPE_INST ( Metatype ) <nl> # undef ONETYPE_INST <nl> mmm a / lib / Serialization / SerializeSIL . cpp <nl> ppp b / lib / Serialization / SerializeSIL . cpp <nl> void SILSerializer : : writeSILInstruction ( const SILInstruction & SI ) { <nl> } <nl> case ValueKind : : AllocBoxInst : { <nl> const AllocBoxInst * ABI = cast < AllocBoxInst > ( & SI ) ; <nl> - writeOneTypeLayout ( ABI - > getKind ( ) , ABI - > getElementType ( ) ) ; <nl> + writeOneTypeLayout ( ABI - > getKind ( ) , ABI - > getType ( ) ) ; <nl> break ; <nl> } <nl> case ValueKind : : AllocRefInst : <nl> mmm a / test / IRGen / dynamic_lookup . sil <nl> ppp b / test / IRGen / dynamic_lookup . sil <nl> bb0 ( % 0 : $ X ) : <nl> / / CHECK : define { { ( protected ) ? } } void @ dynamic_lookup_br ( % objc_object * ) <nl> sil @ dynamic_lookup_br : $ @ convention ( thin ) ( AnyObject ) - > ( ) { <nl> bb0 ( % 0 : $ AnyObject ) : <nl> - % 1 = alloc_box $ AnyObject <nl> + % 1 = alloc_box $ @ box AnyObject <nl> % 1a = project_box % 1 : $ @ box AnyObject , 0 <nl> store % 0 to % 1a : $ * AnyObject <nl> - % 3 = alloc_box $ Optional < ( ) - > ( ) > <nl> + % 3 = alloc_box $ @ box Optional < ( ) - > ( ) > <nl> % 4 = load % 1a : $ * AnyObject <nl> strong_retain % 4 : $ AnyObject <nl> % 6 = open_existential_ref % 4 : $ AnyObject to $ @ opened ( " 01234567 - 89ab - cdef - 0123 - 000000000000 " ) AnyObject <nl> bb3 : <nl> <nl> sil @ _T1t23dynamic_lookup_propertyFT1xPSo13AnyObject__T_ : $ @ convention ( thin ) ( AnyObject ) - > ( ) { <nl> bb0 ( % 0 : $ AnyObject ) : <nl> - % 1 = alloc_box $ AnyObject <nl> + % 1 = alloc_box $ @ box AnyObject <nl> % 1a = project_box % 1 : $ @ box AnyObject , 0 <nl> store % 0 to % 1a : $ * AnyObject <nl> % 6 = load % 1a : $ * AnyObject / / users : % 24 , % 8 , % 7 <nl> bb3 : <nl> / / CHECK - LABEL : define { { ( protected ) ? } } void @ _T1t16opt_to_subscriptFT3objPSo13AnyObject_1iSi_T_ ( % objc_object * , { { ( i32 | i64 ) } } ) <nl> sil @ _T1t16opt_to_subscriptFT3objPSo13AnyObject_1iSi_T_ : $ @ convention ( thin ) ( AnyObject , Int ) - > ( ) { <nl> bb0 ( % 0 : $ AnyObject , % 1 : $ Int ) : <nl> - % 2 = alloc_box $ AnyObject <nl> + % 2 = alloc_box $ @ box AnyObject <nl> % 2a = project_box % 2 : $ @ box AnyObject , 0 <nl> - % 3 = alloc_box $ Int <nl> + % 3 = alloc_box $ @ box Int <nl> % 3a = project_box % 3 : $ @ box Int , 0 <nl> store % 0 to % 2a : $ * AnyObject <nl> store % 1 to % 3a : $ * Int <nl> mmm a / test / IRGen / partial_apply . sil <nl> ppp b / test / IRGen / partial_apply . sil <nl> sil @ empty_box : $ @ convention ( thin ) ( ) - > ( ) { <nl> entry : <nl> / / CHECK : store % swift . refcounted * null <nl> / / CHECK : store % swift . opaque * undef <nl> - % b = alloc_box $ ( ) <nl> + % b = alloc_box $ @ box ( ) <nl> % ba = project_box % b : $ @ box ( ) , 0 <nl> % f = function_ref @ partial_empty_box : $ @ convention ( thin ) ( @ owned @ box ( ) , @ inout ( ) ) - > ( ) <nl> % g = partial_apply % f ( % b , % ba ) : $ @ convention ( thin ) ( @ owned @ box ( ) , @ inout ( ) ) - > ( ) <nl> mmm a / test / IRGen / typed_boxes . sil <nl> ppp b / test / IRGen / typed_boxes . sil <nl> import Builtin <nl> sil @ pod_box_8_8_a : $ @ convention ( thin ) ( ) - > ( ) { <nl> entry : <nl> / / CHECK : [ [ BOX : % . * ] ] = call noalias % swift . refcounted * @ swift_rt_swift_allocObject ( % swift . type * { { . * } } [ [ POD_8_8_METADATA : @ metadata [ 0 - 9 . ] * ] ] , { { . * } } [ [ WORD : i [ 0 - 9 ] + ] ] 24 , [ [ WORD ] ] 7 ) <nl> - % a = alloc_box $ Builtin . Int64 <nl> + % a = alloc_box $ @ box Builtin . Int64 <nl> / / CHECK - 32 : [ [ BOX_RAW : % . * ] ] = bitcast % swift . refcounted * [ [ BOX ] ] to [ [ POD_8_8_LAYOUT : < \ { % swift . refcounted , \ [ 4 x i8 \ ] , \ [ 8 x i8 \ ] \ } > ] ] * <nl> / / CHECK - 32 : [ [ BOX_DATA : % . * ] ] = getelementptr inbounds [ [ POD_8_8_LAYOUT ] ] , [ [ POD_8_8_LAYOUT ] ] * [ [ BOX_RAW ] ] , i32 0 , i32 2 <nl> / / CHECK - 64 : [ [ BOX_RAW : % . * ] ] = bitcast % swift . refcounted * [ [ BOX ] ] to [ [ POD_8_8_LAYOUT : < \ { % swift . refcounted , \ [ 8 x i8 \ ] \ } > ] ] * <nl> entry : <nl> sil @ pod_box_8_8_b : $ @ convention ( thin ) ( ) - > ( ) { <nl> entry : <nl> / / CHECK : [ [ BOX : % . * ] ] = call noalias % swift . refcounted * @ swift_rt_swift_allocObject ( % swift . type * { { . * } } [ [ POD_8_8_METADATA ] ] , { { . * } } [ [ WORD ] ] 24 , [ [ WORD ] ] 7 ) <nl> - % a = alloc_box $ Builtin . FPIEEE64 <nl> + % a = alloc_box $ @ box Builtin . FPIEEE64 <nl> / / CHECK - 32 : [ [ BOX_RAW : % . * ] ] = bitcast % swift . refcounted * [ [ BOX ] ] to [ [ POD_8_8_LAYOUT : < \ { % swift . refcounted , \ [ 4 x i8 \ ] , \ [ 8 x i8 \ ] \ } > ] ] * <nl> / / CHECK - 32 : [ [ BOX_DATA : % . * ] ] = getelementptr inbounds [ [ POD_8_8_LAYOUT ] ] , [ [ POD_8_8_LAYOUT ] ] * [ [ BOX_RAW ] ] , i32 0 , i32 2 <nl> / / CHECK - 64 : [ [ BOX_RAW : % . * ] ] = bitcast % swift . refcounted * [ [ BOX ] ] to [ [ POD_8_8_LAYOUT : < \ { % swift . refcounted , \ [ 8 x i8 \ ] \ } > ] ] * <nl> struct OverAligned { <nl> sil @ pod_box_32_32 : $ @ convention ( thin ) ( ) - > ( ) { <nl> entry : <nl> / / CHECK : [ [ BOX : % . * ] ] = call noalias % swift . refcounted * @ swift_rt_swift_allocObject ( % swift . type * { { . * } } [ [ POD_32_32_METADATA : @ metadata [ 0 - 9 . ] * ] ] , { { . * } } [ [ WORD ] ] 64 , [ [ WORD ] ] 31 ) <nl> - % a = alloc_box $ OverAligned <nl> + % a = alloc_box $ @ box OverAligned <nl> / / CHECK - 32 : [ [ BOX_RAW : % . * ] ] = bitcast % swift . refcounted * [ [ BOX ] ] to [ [ POD_32_32_LAYOUT : < \ { % swift . refcounted , \ [ 20 x i8 \ ] , \ [ 32 x i8 \ ] \ } > ] ] * <nl> / / CHECK - 64 : [ [ BOX_RAW : % . * ] ] = bitcast % swift . refcounted * [ [ BOX ] ] to [ [ POD_32_32_LAYOUT : < \ { % swift . refcounted , \ [ 16 x i8 \ ] , \ [ 32 x i8 \ ] \ } > ] ] * <nl> / / CHECK : [ [ BOX_DATA : % . * ] ] = getelementptr inbounds [ [ POD_32_32_LAYOUT ] ] , [ [ POD_32_32_LAYOUT ] ] * [ [ BOX_RAW ] ] , i32 0 , i32 2 <nl> sil @ rc_box_a : $ @ convention ( thin ) ( ) - > ( ) { <nl> entry : <nl> / / CHECK - 32 : [ [ BOX : % . * ] ] = call noalias % swift . refcounted * @ swift_rt_swift_allocObject ( % swift . type * { { . * } } [ [ NATIVE_RC_METADATA : @ metadata [ 0 - 9 . ] * ] ] , { { . * } } [ [ WORD ] ] 16 , [ [ WORD ] ] 3 ) <nl> / / CHECK - 64 : [ [ BOX : % . * ] ] = call noalias % swift . refcounted * @ swift_rt_swift_allocObject ( % swift . type * { { . * } } [ [ NATIVE_RC_METADATA : @ metadata [ 0 - 9 . ] * ] ] , { { . * } } [ [ WORD ] ] 24 , [ [ WORD ] ] 7 ) <nl> - % a = alloc_box $ C <nl> + % a = alloc_box $ @ box C <nl> / / CHECK : bitcast % swift . refcounted * * { { % . * } } to % C11typed_boxes1C * * <nl> % b = project_box % a : $ @ box C , 0 <nl> dealloc_box % a : $ @ box C <nl> entry : <nl> / / TODO : Should reuse metadata <nl> / / CHECK - 32 : [ [ BOX : % . * ] ] = call noalias % swift . refcounted * @ swift_rt_swift_allocObject ( % swift . type * { { . * } } [ [ NATIVE_RC_METADATA ] ] , { { . * } } [ [ WORD ] ] 16 , [ [ WORD ] ] 3 ) <nl> / / CHECK - 64 : [ [ BOX : % . * ] ] = call noalias % swift . refcounted * @ swift_rt_swift_allocObject ( % swift . type * { { . * } } [ [ NATIVE_RC_METADATA ] ] , { { . * } } [ [ WORD ] ] 24 , [ [ WORD ] ] 7 ) <nl> - % a = alloc_box $ D <nl> + % a = alloc_box $ @ box D <nl> / / CHECK : bitcast % swift . refcounted * * { { % . * } } to % C11typed_boxes1D * * <nl> % b = project_box % a : $ @ box D , 0 <nl> dealloc_box % a : $ @ box D <nl> sil @ unknown_rc_box : $ @ convention ( thin ) ( ) - > ( ) { <nl> entry : <nl> / / CHECK - 32 : [ [ BOX : % . * ] ] = call noalias % swift . refcounted * @ swift_rt_swift_allocObject ( % swift . type * { { . * } } [ [ UNKNOWN_RC_METADATA : @ metadata [ 0 - 9 . ] * ] ] , { { . * } } [ [ WORD ] ] 16 , [ [ WORD ] ] 3 ) <nl> / / CHECK - 64 : [ [ BOX : % . * ] ] = call noalias % swift . refcounted * @ swift_rt_swift_allocObject ( % swift . type * { { . * } } [ [ UNKNOWN_RC_METADATA : @ metadata [ 0 - 9 . ] * ] ] , { { . * } } [ [ WORD ] ] 24 , [ [ WORD ] ] 7 ) <nl> - % a = alloc_box $ Builtin . UnknownObject <nl> + % a = alloc_box $ @ box Builtin . UnknownObject <nl> % b = project_box % a : $ @ box Builtin . UnknownObject , 0 <nl> dealloc_box % a : $ @ box Builtin . UnknownObject <nl> return undef : $ ( ) <nl> struct Fixed { <nl> <nl> sil @ fixed_box : $ @ convention ( thin ) ( ) - > ( ) { <nl> entry : <nl> - % a = alloc_box $ Fixed <nl> + % a = alloc_box $ @ box Fixed <nl> % b = project_box % a : $ @ box Fixed , 0 <nl> dealloc_box % a : $ @ box Fixed <nl> return undef : $ ( ) <nl> entry : <nl> / / CHECK : [ [ ALLOC : % . * ] ] = call { % swift . refcounted * , % swift . opaque * } @ swift_allocBox ( % swift . type * [ [ METADATA ] ] ) <nl> / / CHECK : [ [ BOX : % . * ] ] = extractvalue { % swift . refcounted * , % swift . opaque * } [ [ ALLOC ] ] , 0 <nl> / / CHECK : [ [ PTR : % . * ] ] = extractvalue { % swift . refcounted * , % swift . opaque * } [ [ ALLOC ] ] , 1 <nl> - % a = alloc_box $ Dyn < T > <nl> + % a = alloc_box $ @ box Dyn < T > <nl> / / CHECK : [ [ CAST_PTR : % . * ] ] = bitcast % swift . opaque * [ [ PTR ] ] to % V11typed_boxes3Dyn * <nl> % b = project_box % a : $ @ box Dyn < T > , 0 <nl> % f = function_ref @ take_dyn : $ @ convention ( thin ) < T > ( @ in Dyn < T > ) - > ( ) <nl> entry : <nl> / / CHECK : [ [ ALLOC : % . * ] ] = call { % swift . refcounted * , % swift . opaque * } @ swift_allocBox ( % swift . type * % T ) <nl> / / CHECK : [ [ BOX : % . * ] ] = extractvalue { % swift . refcounted * , % swift . opaque * } [ [ ALLOC ] ] , 0 <nl> / / CHECK : [ [ PTR : % . * ] ] = extractvalue { % swift . refcounted * , % swift . opaque * } [ [ ALLOC ] ] , 1 <nl> - % a = alloc_box $ T <nl> + % a = alloc_box $ @ box T <nl> % b = project_box % a : $ @ box T , 0 <nl> % f = function_ref @ take_t : $ @ convention ( thin ) < T > ( @ in T ) - > ( ) <nl> / / CHECK : call void @ take_t ( % swift . opaque * { { [ ^ , ] * } } [ [ PTR ] ] , { { . * } } ) <nl> mmm a / test / Reflection / box_descriptors . sil <nl> ppp b / test / Reflection / box_descriptors . sil <nl> class C < T > { } <nl> sil_vtable C { } <nl> <nl> sil @ make_some_boxes : $ @ convention ( thin ) < T > ( ) - > ( @ box Int , @ box ( Int , Int ) , @ box C < T > ) { <nl> - % a = alloc_box $ Int <nl> - % b = alloc_box $ ( Int , Int ) <nl> - % c = alloc_box $ C < T > <nl> + % a = alloc_box $ @ box Int <nl> + % b = alloc_box $ @ box ( Int , Int ) <nl> + % c = alloc_box $ @ box C < T > <nl> % result = tuple ( % a : $ @ box Int , % b : $ @ box ( Int , Int ) , % c : $ @ box C < T > ) <nl> return % result : $ ( @ box Int , @ box ( Int , Int ) , @ box C < T > ) <nl> } <nl> mmm a / test / Reflection / capture_descriptors . sil <nl> ppp b / test / Reflection / capture_descriptors . sil <nl> bb0 ( % i : $ Int , % b : $ @ box Int , % m : $ @ thin Int . Type , % p : $ @ thick P . Type ) : <nl> sil @ concrete_caller1 : $ @ convention ( thin ) ( Int , @ thick P . Type ) - > @ owned @ callee_owned ( ) - > ( ) { <nl> bb0 ( % i : $ Int , % p : $ @ thick P . Type ) : <nl> % f = function_ref @ concrete_callee1 : $ @ convention ( thin ) ( Int , @ owned @ box Int , @ thin Int . Type , @ thick P . Type ) - > ( ) <nl> - % b = alloc_box $ Int <nl> + % b = alloc_box $ @ box Int <nl> % m = metatype $ @ thin Int . Type <nl> % c = partial_apply % f ( % i , % b , % m , % p ) : $ @ convention ( thin ) ( Int , @ owned @ box Int , @ thin Int . Type , @ thick P . Type ) - > ( ) <nl> return % c : $ @ callee_owned ( ) - > ( ) <nl> sil @ concrete_caller2 : $ @ convention ( thin ) ( ) - > @ owned @ callee_owned ( ) - > ( ) { <nl> bb0 : <nl> % f = function_ref @ generic_callee2 : $ @ convention ( thin ) < T , U > ( @ in T , @ owned @ box U ) - > ( ) <nl> % i = alloc_stack $ Int <nl> - % b = alloc_box $ String <nl> + % b = alloc_box $ @ box String <nl> % c = partial_apply % f < Int , String > ( % i , % b ) : $ @ convention ( thin ) < T , U > ( @ in T , @ owned @ box U ) - > ( ) <nl> dealloc_stack % i : $ * Int <nl> return % c : $ @ callee_owned ( ) - > ( ) <nl> mmm a / test / SIL / Parser / apply_with_substitution . sil <nl> ppp b / test / SIL / Parser / apply_with_substitution . sil <nl> import Swift <nl> / / CHECK - LABEL : sil @ _TF4test3fooFT1fGSqFT_T___T_ : $ @ convention ( thin ) ( @ owned Optional < @ callee_owned ( @ in ( ) ) - > @ out ( ) > ) - > ( ) <nl> sil @ _TF4test3fooFT1fGSqFT_T___T_ : $ @ convention ( thin ) ( @ owned Optional < @ callee_owned ( @ in ( ) ) - > @ out ( ) > ) - > ( ) { <nl> bb0 ( % 0 : $ Optional < @ callee_owned ( @ in ( ) ) - > @ out ( ) > ) : <nl> - % 1 = alloc_box $ Optional < @ callee_owned ( @ in ( ) ) - > @ out ( ) > / / var f / / users : % 2 , % 6 , % 32 <nl> + % 1 = alloc_box $ @ box Optional < @ callee_owned ( @ in ( ) ) - > @ out ( ) > / / var f / / users : % 2 , % 6 , % 32 <nl> % 1a = project_box % 1 : $ @ box Optional < @ callee_owned ( @ in ( ) ) - > @ out ( ) > , 0 <nl> store % 0 to % 1a : $ * Optional < @ callee_owned ( @ in ( ) ) - > @ out ( ) > / / id : % 2 <nl> % 3 = alloc_stack $ Optional < ( ) > / / users : % 22 , % 28 , % 30 , % 31 <nl> mmm a / test / SIL / Parser / basic . sil <nl> ppp b / test / SIL / Parser / basic . sil <nl> bb0 : / / CHECK : bb0 : <nl> % 0 = tuple ( ) / / CHECK : % 0 = tuple ( ) <nl> br bb1 / / CHECK : br bb1 <nl> bb1 : <nl> - % b = alloc_box $ Int / / CHECK : % 2 = alloc_box $ Int <nl> + % b = alloc_box $ @ box Int / / CHECK : % 2 = alloc_box $ @ box Int <nl> % c = integer_literal $ Builtin . Word , 1 <nl> / / CHECK : integer_literal $ Builtin . Word , - 1 <nl> % e = integer_literal $ Builtin . Word , - 1 <nl> bb1 : <nl> return % 5 : $ ( ) / / CHECK : return % 5 : $ ( ) <nl> bb2 : <nl> % 5 = tuple ( ) / / CHECK : % 5 = tuple ( ) <nl> - % 6 = alloc_box $ Int / / CHECK : % 6 = alloc_box $ Int <nl> + % 6 = alloc_box $ @ box Int / / CHECK : % 6 = alloc_box $ @ box Int <nl> % 7 = project_box % 6 : $ @ box Int , 0 / / CHECK : % 7 = project_box % 6 : $ @ box Int <nl> <nl> br bb1 / / CHECK : br bb1 <nl> protocol Bendable { } <nl> sil @ _T4todo18erasure_from_protoFT1xPS_8RuncibleS_8Bendable__PS0__ : $ @ convention ( thin ) ( @ in Bendable & Runcible ) - > @ out Runcible { <nl> bb0 ( % 0 : $ * Runcible , % 1 : $ * Bendable & Runcible ) : <nl> / / CHECK : alloc_box <nl> - % 2 = alloc_box $ Bendable & Runcible <nl> + % 2 = alloc_box $ @ box Bendable & Runcible <nl> % 2a = project_box % 2 : $ @ box Bendable & Runcible , 0 <nl> / / CHECK : copy_addr [ take ] { { . * } } to [ initialization ] { { . * } } : $ * Bendable & Runcible <nl> % 3 = copy_addr [ take ] % 1 to [ initialization ] % 2a : $ * Bendable & Runcible <nl> protocol ClassBound : class { <nl> / / CHECK : $ @ convention ( thin ) ( ClassBound ) - > ( ) <nl> sil @ _T4todo18class_bound_methodFT1xPS_10ClassBound__T_ : $ @ convention ( thin ) ( ClassBound ) - > ( ) { <nl> bb0 ( % 0 : $ ClassBound ) : <nl> - % 1 = alloc_box $ ClassBound / / CHECK : alloc_box <nl> + % 1 = alloc_box $ @ box ClassBound / / CHECK : alloc_box <nl> % 1a = project_box % 1 : $ @ box ClassBound , 0 <nl> % 2 = store % 0 to % 1a : $ * ClassBound / / CHECK : store <nl> % 3 = load % 1a : $ * ClassBound / / CHECK : load <nl> bb0 ( % 0 : $ Ref , % 1 : $ Val , % 2 : $ @ thin Aleph . Type ) : <nl> sil @ _TV6struct5AlephCfMS0_FT_S0_ : $ @ convention ( thin ) ( @ thin Aleph . Type ) - > Aleph { <nl> bb0 ( % 0 : $ @ thin Aleph . Type ) : <nl> % 1 = tuple ( ) <nl> - % 2 = alloc_box $ Aleph / / CHECK : alloc_box <nl> + % 2 = alloc_box $ @ box Aleph / / CHECK : alloc_box <nl> % 2a = project_box % 2 : $ @ box Aleph , 0 <nl> / / CHECK : struct_element_addr { { . * } } : $ * Aleph , # Aleph . a <nl> % 5 = struct_element_addr % 2a : $ * Aleph , # Aleph . a <nl> sil @ _T5tuple5tupleFT_TSiSf_ : $ @ convention ( thin ) ( ) - > ( Int , Float32 ) <nl> / / CHECK : $ @ convention ( thin ) ( Int , Float ) - > ( ) <nl> sil @ _T5tuple13tuple_elementFT1xTSiSf__T_ : $ @ convention ( thin ) ( Int , Float ) - > ( ) { <nl> bb0 ( % 0 : $ Int , % 1 : $ Float ) : <nl> - % 2 = alloc_box $ ( Int , Float ) <nl> + % 2 = alloc_box $ @ box ( Int , Float ) <nl> % 2a = project_box % 2 : $ @ box ( Int , Float ) , 0 <nl> / / CHECK : tuple ( { { % . * } } : $ Int , { { % . * } } : $ Float ) <nl> % 3 = tuple ( % 0 : $ Int , % 1 : $ Float ) <nl> class M { <nl> / / CHECK : $ @ convention ( method ) ( Int , M ) - > ( ) <nl> sil @ _TC3ref1C3foofS0_FT1xSi_T_ : $ @ convention ( method ) ( Int , M ) - > ( ) { <nl> bb0 ( % 0 : $ Int , % 1 : $ M ) : <nl> - % 2 = alloc_box $ Int / / CHECK : alloc_box $ Int <nl> + % 2 = alloc_box $ @ box Int / / CHECK : alloc_box $ @ box Int <nl> % 2a = project_box % 2 : $ @ box Int , 0 <nl> % 3 = store % 0 to % 2a : $ * Int <nl> - % 4 = alloc_box $ M / / CHECK : alloc_box $ M <nl> + % 4 = alloc_box $ @ box M / / CHECK : alloc_box $ @ box M <nl> % 4a = project_box % 4 : $ @ box M , 0 <nl> % 5 = store % 1 to % 4a : $ * M <nl> % 6 = load % 2a : $ * Int / / CHECK : load { { . * } } : $ * Int <nl> class E : B { } <nl> / / CHECK : $ @ convention ( thin ) ( B ) - > Builtin . Int1 <nl> sil @ _T4null3isaFT1bCS_1B_Sb : $ @ convention ( thin ) ( B ) - > Builtin . Int1 { <nl> bb0 ( % 0 : $ B ) : <nl> - % 1 = alloc_box $ B / / CHECK : alloc_box <nl> + % 1 = alloc_box $ @ box B / / CHECK : alloc_box <nl> % 1a = project_box % 1 : $ @ box B , 0 <nl> % 2 = store % 0 to % 1a : $ * B <nl> % 3 = load % 1a : $ * B / / CHECK : load <nl> sil @ _TSS32_convertFromBuiltinStringLiteralfMSSFT5valueBp17utf8CodeUnitCountBi64 <nl> <nl> sil @ _T5index5gep64FT1pBp1iBi64__Bp : $ @ convention ( thin ) ( Builtin . RawPointer , Builtin . Word ) - > Builtin . RawPointer { <nl> bb0 ( % 0 : $ Builtin . RawPointer , % 1 : $ Builtin . Word ) : <nl> - % 2 = alloc_box $ Builtin . RawPointer / / CHECK : alloc_box <nl> + % 2 = alloc_box $ @ box Builtin . RawPointer / / CHECK : alloc_box <nl> % 2a = project_box % 2 : $ @ box Builtin . RawPointer , 0 <nl> - % 3 = alloc_box $ Builtin . Word / / CHECK : alloc_box <nl> + % 3 = alloc_box $ @ box Builtin . Word / / CHECK : alloc_box <nl> % 3a = project_box % 3 : $ @ box Builtin . Word , 0 <nl> % 4 = store % 0 to % 2a : $ * Builtin . RawPointer <nl> % 5 = store % 1 to % 3a : $ * Builtin . Word <nl> class SomeSubclass : SomeClass { } <nl> <nl> sil @ test_class_metatype : $ @ convention ( thin ) ( SomeClass , SomeSubclass ) - > ( @ thick SomeClass . Type , @ thick SomeClass . Type ) { <nl> bb0 ( % 0 : $ SomeClass , % 1 : $ SomeSubclass ) : <nl> - % 2 = alloc_box $ SomeClass / / CHECK : alloc_box <nl> + % 2 = alloc_box $ @ box SomeClass / / CHECK : alloc_box <nl> % 2a = project_box % 2 : $ @ box SomeClass , 0 <nl> - % 3 = alloc_box $ SomeSubclass / / CHECK : alloc_box <nl> + % 3 = alloc_box $ @ box SomeSubclass / / CHECK : alloc_box <nl> % 3a = project_box % 3 : $ @ box SomeSubclass , 0 <nl> % 4 = store % 0 to % 2a : $ * SomeClass <nl> % 5 = store % 1 to % 3a : $ * SomeSubclass <nl> bb0 ( % 0 : $ SomeClass , % 1 : $ SomeSubclass ) : <nl> <nl> sil @ test_value_metatype : $ @ convention ( thin ) < T > ( @ in T ) - > ( @ thick T . Type , @ thick T . Type ) { <nl> bb0 ( % 0 : $ * T ) : <nl> - % 1 = alloc_box $ T / / CHECK : alloc_box <nl> + % 1 = alloc_box $ @ box T / / CHECK : alloc_box <nl> % 1a = project_box % 1 : $ @ box T , 0 <nl> % 2 = copy_addr [ take ] % 0 to [ initialization ] % 1a : $ * T <nl> % 3 = metatype $ @ thick T . Type / / CHECK : metatype <nl> bb0 ( % 0 : $ * T ) : <nl> <nl> sil @ test_existential_metatype : $ @ convention ( thin ) ( @ in SomeProtocol ) - > @ thick SomeProtocol . Type { <nl> bb0 ( % 0 : $ * SomeProtocol ) : <nl> - % 1 = alloc_box $ SomeProtocol / / CHECK : alloc_box <nl> + % 1 = alloc_box $ @ box SomeProtocol / / CHECK : alloc_box <nl> % 1a = project_box % 1 : $ @ box SomeProtocol , 0 <nl> % 2 = copy_addr [ take ] % 0 to [ initialization ] % 1a : $ * SomeProtocol <nl> % 4 = alloc_stack $ SomeProtocol / / CHECK : alloc_stack <nl> bb3 ( % 4 : $ Int ) : <nl> / / CHECK - LABEL : sil @ test_builtin <nl> sil @ test_builtin : $ @ convention ( thin ) ( Builtin . Int1 , Builtin . Int1 ) - > Builtin . Int1 { <nl> bb0 ( % 0 : $ Builtin . Int1 , % 1 : $ Builtin . Int1 ) : <nl> - % 2 = alloc_box $ Builtin . Int1 <nl> + % 2 = alloc_box $ @ box Builtin . Int1 <nl> % 2a = project_box % 2 : $ @ box Builtin . Int1 , 0 <nl> - % 3 = alloc_box $ Builtin . Int1 <nl> + % 3 = alloc_box $ @ box Builtin . Int1 <nl> % 3a = project_box % 3 : $ @ box Builtin . Int1 , 0 <nl> store % 0 to % 2a : $ * Builtin . Int1 <nl> store % 1 to % 3a : $ * Builtin . Int1 <nl> bb0 : <nl> / / CHECK - LABEL : sil @ test_dealloc_box <nl> sil @ test_dealloc_box : $ @ convention ( thin ) ( ) - > ( ) { <nl> bb0 : <nl> - % 0 = alloc_box $ Class1 <nl> + % 0 = alloc_box $ @ box Class1 <nl> dealloc_box % 0 : $ @ box Class1 <nl> % 2 = tuple ( ) <nl> return % 2 : $ ( ) <nl> sil @ closure0 : $ @ convention ( thin ) ( @ box Int , @ inout Int ) - > ( ) <nl> <nl> sil @ closure_test : $ @ convention ( thin ) ( ) - > ( ) { <nl> bb0 : <nl> - % 0 = alloc_box $ Int / / users : % 10 , % 8 , % 8 , % 7 , % 4 <nl> + % 0 = alloc_box $ @ box Int / / users : % 10 , % 8 , % 8 , % 7 , % 4 <nl> % 0a = project_box % 0 : $ @ box Int , 0 <nl> <nl> % 5 = function_ref @ takes_closure : $ @ convention ( thin ) ( @ callee_owned ( ) - > ( ) ) - > ( ) <nl> sil @ _T6switch1cFT_T_ : $ @ convention ( thin ) ( ) - > ( ) <nl> / / CHECK - LABEL : sil @ test_switch_union : $ @ convention ( thin ) ( MaybePair ) - > ( ) <nl> sil @ test_switch_union : $ @ convention ( thin ) ( MaybePair ) - > ( ) { <nl> bb0 ( % 0 : $ MaybePair ) : <nl> - % 1 = alloc_box $ MaybePair <nl> + % 1 = alloc_box $ @ box MaybePair <nl> % 1a = project_box % 1 : $ @ box MaybePair , 0 <nl> store % 0 to % 1a : $ * MaybePair <nl> % 3 = load % 1a : $ * MaybePair <nl> struct Spoon : Bendable { <nl> / / CHECK - LABEL : sil @ test_init_existential : $ @ convention ( thin ) ( Spoon ) - > @ out Bendable <nl> sil @ test_init_existential : $ @ convention ( thin ) ( Spoon ) - > @ out Bendable { <nl> bb0 ( % 0 : $ * Bendable , % 1 : $ Spoon ) : <nl> - % 2 = alloc_box $ Spoon <nl> + % 2 = alloc_box $ @ box Spoon <nl> % 2a = project_box % 2 : $ @ box Spoon , 0 <nl> store % 1 to % 2a : $ * Spoon <nl> / / CHECK : init_existential_addr % { { . * } } : $ * Bendable , $ Spoon <nl> bb0 ( % 0 : $ * Bendable , % 1 : $ Spoon ) : <nl> / / CHECK - LABEL : sil @ test_existential_ref : $ @ convention ( thin ) ( ConcreteClass ) - > ClassP <nl> sil @ test_existential_ref : $ @ convention ( thin ) ( ConcreteClass ) - > ClassP { <nl> bb0 ( % 0 : $ ConcreteClass ) : <nl> - % 1 = alloc_box $ ConcreteClass <nl> + % 1 = alloc_box $ @ box ConcreteClass <nl> % 1a = project_box % 1 : $ @ box ConcreteClass , 0 <nl> store % 0 to % 1a : $ * ConcreteClass <nl> % 3 = load % 1a : $ * ConcreteClass <nl> class X { <nl> / / CHECK - LABEL : sil @ test_dynamic_lookup_br : $ @ convention ( thin ) ( AnyObject ) - > ( ) <nl> sil @ test_dynamic_lookup_br : $ @ convention ( thin ) ( AnyObject ) - > ( ) { <nl> bb0 ( % 0 : $ AnyObject ) : <nl> - % 1 = alloc_box $ AnyObject <nl> + % 1 = alloc_box $ @ box AnyObject <nl> % 1a = project_box % 1 : $ @ box AnyObject , 0 <nl> store % 0 to % 1a : $ * AnyObject <nl> - % 3 = alloc_box $ Optional < ( ) - > ( ) > <nl> + % 3 = alloc_box $ @ box Optional < ( ) - > ( ) > <nl> % 4 = load % 1a : $ * AnyObject <nl> strong_retain % 4 : $ AnyObject <nl> % 6 = open_existential_ref % 4 : $ AnyObject to $ @ opened ( " 01234567 - 89ab - cdef - 0123 - 222222222222 " ) AnyObject <nl> bb3 : <nl> <nl> / / CHECK - LABEL : sil @ test_mark_fn_escape <nl> sil @ test_mark_fn_escape : $ ( ) - > ( ) { <nl> - % b = alloc_box $ Int <nl> + % b = alloc_box $ @ box Int <nl> % ba = project_box % b : $ @ box Int , 0 <nl> - % c = alloc_box $ Int <nl> + % c = alloc_box $ @ box Int <nl> % ca = project_box % c : $ @ box Int , 0 <nl> <nl> / / CHECK : mark_function_escape { { . * } } : $ * Int <nl> mmm a / test / SIL / Parser / bound_generic . sil <nl> ppp b / test / SIL / Parser / bound_generic . sil <nl> import Swift <nl> / / CHECK - LABEL : sil @ _TF9optional3fooFT1fGSqFT_T___T_ : $ @ convention ( thin ) ( @ owned Optional < @ callee_owned ( @ in ( ) ) - > @ out ( ) > ) - > ( ) <nl> sil @ _TF9optional3fooFT1fGSqFT_T___T_ : $ @ convention ( thin ) ( @ owned Optional < @ callee_owned ( @ in ( ) ) - > ( @ out ( ) ) > ) - > ( ) { <nl> bb0 ( % 0 : $ Optional < @ callee_owned ( @ in ( ) ) - > ( @ out ( ) ) > ) : <nl> - % 1 = alloc_box $ Optional < @ callee_owned ( @ in ( ) ) - > ( @ out ( ) ) > <nl> + % 1 = alloc_box $ @ box Optional < @ callee_owned ( @ in ( ) ) - > ( @ out ( ) ) > <nl> % 1a = project_box % 1 : $ @ box Optional < @ callee_owned ( @ in ( ) ) - > ( @ out ( ) ) > , 0 <nl> store % 0 to % 1a : $ * Optional < @ callee_owned ( @ in ( ) ) - > ( @ out ( ) ) > <nl> % 3 = alloc_stack $ Optional < ( ) > <nl> new file mode 100644 <nl> index 000000000000 . . 33fba422382d <nl> mmm / dev / null <nl> ppp b / test / SIL / Parser / box_types . sil <nl> <nl> + / / RUN : % target - swift - frontend - emit - sil % s | % FileCheck % s <nl> + <nl> + import Builtin <nl> + <nl> + / / CHECK - LABEL : sil @ boxes : $ @ convention ( thin ) ( @ box Builtin . Int32 , @ box Builtin . Int32 ) - > ( ) { <nl> + sil @ boxes : $ @ convention ( thin ) ( @ box Builtin . Int32 , @ box Builtin . Int32 ) - > ( ) { <nl> + / / CHECK : bb0 ( % 0 : $ @ box Builtin . Int32 , % 1 : $ @ box Builtin . Int32 ) : <nl> + bb0 ( % 0 : $ @ box Builtin . Int32 , % 1 : $ @ box Builtin . Int32 ) : <nl> + return undef : $ ( ) <nl> + } <nl> mmm a / test / SIL / Parser / global_init_attribute . sil <nl> ppp b / test / SIL / Parser / global_init_attribute . sil <nl> import Swift <nl> <nl> sil [ global_init ] @ _TF1gau5MyVarSi : $ @ convention ( thin ) ( ) - > Builtin . RawPointer { <nl> bb0 : <nl> - % b = alloc_box $ Int <nl> + % b = alloc_box $ @ box Int <nl> % ba = project_box % b : $ @ box Int , 0 <nl> % p = address_to_pointer % ba : $ * Int to $ Builtin . RawPointer <nl> return % p : $ Builtin . RawPointer <nl> mmm a / test / SIL / Parser / overloaded_member . sil <nl> ppp b / test / SIL / Parser / overloaded_member . sil <nl> struct A { <nl> / / CHECK - LABEL : sil @ _TFCSo1XcfMS_FT1aV11peer_method1A_S_ <nl> sil @ _TFCSo1XcfMS_FT1aV11peer_method1A_S_ : $ @ convention ( method ) ( A , @ owned X ) - > @ owned X { <nl> bb0 ( % 0 : $ A , % 1 : $ X ) : <nl> - % 2 = alloc_box $ X <nl> + % 2 = alloc_box $ @ box X <nl> % 2a = project_box % 2 : $ @ box X , 0 <nl> - % 3 = alloc_box $ A <nl> + % 3 = alloc_box $ @ box A <nl> % 3a = project_box % 3 : $ @ box A , 0 <nl> store % 0 to % 3a : $ * A <nl> % 5 = mark_uninitialized [ delegatingself ] % 1 : $ X <nl> mmm a / test / SIL / Parser / typed_boxes . sil <nl> ppp b / test / SIL / Parser / typed_boxes . sil <nl> import Swift <nl> / / CHECK - LABEL : sil @ alloc_dealloc : $ @ convention ( thin ) ( Int ) - > ( ) { <nl> sil @ alloc_dealloc : $ @ convention ( thin ) ( Int ) - > ( ) { <nl> entry ( % x : $ Int ) : <nl> - / / CHECK : [ [ B : % . * ] ] = alloc_box $ Int <nl> - % b = alloc_box $ Int <nl> + / / CHECK : [ [ B : % . * ] ] = alloc_box $ @ box Int <nl> + % b = alloc_box $ @ box Int <nl> / / CHECK : [ [ PB : % . * ] ] = project_box [ [ B ] ] : $ @ box Int , 0 <nl> % ba = project_box % b : $ @ box Int , 0 <nl> / / CHECK : store [ [ X : % . * ] ] to [ [ PB ] ] : $ * Int <nl> mmm a / test / SILGen / address_only_types . swift <nl> ppp b / test / SILGen / address_only_types . swift <nl> func address_only_assignment_from_temp ( _ dest : inout Unloadable ) { <nl> func address_only_assignment_from_lv ( _ dest : inout Unloadable , v : Unloadable ) { <nl> var v = v <nl> / / CHECK : bb0 ( [ [ DEST : % [ 0 - 9 ] + ] ] : $ * Unloadable , [ [ VARG : % [ 0 - 9 ] + ] ] : $ * Unloadable ) : <nl> - / / CHECK : [ [ VBOX : % . * ] ] = alloc_box $ Unloadable <nl> + / / CHECK : [ [ VBOX : % . * ] ] = alloc_box $ @ box Unloadable <nl> / / CHECK : [ [ PBOX : % [ 0 - 9 ] + ] ] = project_box [ [ VBOX ] ] <nl> / / CHECK : copy_addr [ [ VARG ] ] to [ initialization ] [ [ PBOX ] ] : $ * Unloadable <nl> dest = v <nl> func address_only_assignment_from_lv_to_property ( _ v : Unloadable ) { <nl> func address_only_var ( ) - > Unloadable { <nl> / / CHECK : bb0 ( [ [ RET : % [ 0 - 9 ] + ] ] : $ * Unloadable ) : <nl> var x = some_address_only_function_1 ( ) <nl> - / / CHECK : [ [ XBOX : % [ 0 - 9 ] + ] ] = alloc_box $ Unloadable <nl> + / / CHECK : [ [ XBOX : % [ 0 - 9 ] + ] ] = alloc_box $ @ box Unloadable <nl> / / CHECK : [ [ XPB : % . * ] ] = project_box [ [ XBOX ] ] <nl> / / CHECK : apply { { % . * } } ( [ [ XPB ] ] ) <nl> return x <nl> mmm a / test / SILGen / boxed_existentials . swift <nl> ppp b / test / SILGen / boxed_existentials . swift <nl> func test_property_of_lvalue ( _ x : Error ) - > String { <nl> return x . _domain <nl> } <nl> / / CHECK - LABEL : sil hidden @ _TF18boxed_existentials23test_property_of_lvalueFPs5Error_SS <nl> - / / CHECK : [ [ VAR : % . * ] ] = alloc_box $ Error <nl> + / / CHECK : [ [ VAR : % . * ] ] = alloc_box $ @ box Error <nl> / / CHECK - NEXT : [ [ PVAR : % . * ] ] = project_box [ [ VAR ] ] <nl> / / CHECK - NEXT : copy_value % 0 : $ Error <nl> / / CHECK - NEXT : store % 0 to [ init ] [ [ PVAR ] ] <nl> func plusOneError ( ) - > Error { } <nl> func test_open_existential_semantics ( _ guaranteed : Error , <nl> _ immediate : Error ) { <nl> var immediate = immediate <nl> - / / CHECK : [ [ IMMEDIATE_BOX : % . * ] ] = alloc_box $ Error <nl> + / / CHECK : [ [ IMMEDIATE_BOX : % . * ] ] = alloc_box $ @ box Error <nl> / / CHECK : [ [ PB : % . * ] ] = project_box [ [ IMMEDIATE_BOX ] ] <nl> - / / GUARANTEED : [ [ IMMEDIATE_BOX : % . * ] ] = alloc_box $ Error <nl> + / / GUARANTEED : [ [ IMMEDIATE_BOX : % . * ] ] = alloc_box $ @ box Error <nl> / / GUARANTEED : [ [ PB : % . * ] ] = project_box [ [ IMMEDIATE_BOX ] ] <nl> <nl> / / CHECK - NOT : copy_value % 0 <nl> func test_open_existential_semantics ( _ guaranteed : Error , <nl> / / CHECK : bb0 ( [ [ OUT : % . * ] ] : $ * Any , [ [ GUAR : % . * ] ] : $ Error , <nl> func erasure_to_any ( _ guaranteed : Error , _ immediate : Error ) - > Any { <nl> var immediate = immediate <nl> - / / CHECK : [ [ IMMEDIATE_BOX : % . * ] ] = alloc_box $ Error <nl> + / / CHECK : [ [ IMMEDIATE_BOX : % . * ] ] = alloc_box $ @ box Error <nl> / / CHECK : [ [ PB : % . * ] ] = project_box [ [ IMMEDIATE_BOX ] ] <nl> if true { <nl> / / CHECK - NOT : copy_value [ [ GUAR ] ] <nl> mmm a / test / SILGen / class_bound_protocols . swift <nl> ppp b / test / SILGen / class_bound_protocols . swift <nl> class ConcreteSubclass : ConcreteClass { } <nl> func class_bound_generic < T : ClassBound > ( x : T ) - > T { <nl> var x = x <nl> / / CHECK : bb0 ( [ [ X : % . * ] ] : $ T ) : <nl> - / / CHECK : [ [ X_ADDR : % . * ] ] = alloc_box $ T <nl> + / / CHECK : [ [ X_ADDR : % . * ] ] = alloc_box $ @ box T <nl> / / CHECK : [ [ PB : % . * ] ] = project_box [ [ X_ADDR ] ] <nl> / / CHECK : store [ [ X ] ] to [ init ] [ [ PB ] ] <nl> return x <nl> func class_bound_generic < T : ClassBound > ( x : T ) - > T { <nl> func class_bound_generic_2 < T : ClassBound & NotClassBound > ( x : T ) - > T { <nl> var x = x <nl> / / CHECK : bb0 ( [ [ X : % . * ] ] : $ T ) : <nl> - / / CHECK : [ [ X_ADDR : % . * ] ] = alloc_box $ T <nl> + / / CHECK : [ [ X_ADDR : % . * ] ] = alloc_box $ @ box T <nl> / / CHECK : [ [ PB : % . * ] ] = project_box [ [ X_ADDR ] ] <nl> / / CHECK : store [ [ X ] ] to [ init ] [ [ PB ] ] <nl> return x <nl> func class_bound_generic_2 < T : ClassBound & NotClassBound > ( x : T ) - > T { <nl> func class_bound_protocol ( x : ClassBound ) - > ClassBound { <nl> var x = x <nl> / / CHECK : bb0 ( [ [ X : % . * ] ] : $ ClassBound ) : <nl> - / / CHECK : [ [ X_ADDR : % . * ] ] = alloc_box $ ClassBound <nl> + / / CHECK : [ [ X_ADDR : % . * ] ] = alloc_box $ @ box ClassBound <nl> / / CHECK : [ [ PB : % . * ] ] = project_box [ [ X_ADDR ] ] <nl> / / CHECK : store [ [ X ] ] to [ init ] [ [ PB ] ] <nl> return x <nl> func class_bound_protocol_composition ( x : ClassBound & NotClassBound ) <nl> - > ClassBound & NotClassBound { <nl> var x = x <nl> / / CHECK : bb0 ( [ [ X : % . * ] ] : $ ClassBound & NotClassBound ) : <nl> - / / CHECK : [ [ X_ADDR : % . * ] ] = alloc_box $ ClassBound & NotClassBound <nl> + / / CHECK : [ [ X_ADDR : % . * ] ] = alloc_box $ @ box ( ClassBound & NotClassBound ) <nl> / / CHECK : [ [ PB : % . * ] ] = project_box [ [ X_ADDR ] ] <nl> / / CHECK : store [ [ X ] ] to [ init ] [ [ PB ] ] <nl> return x <nl> mmm a / test / SILGen / closures . swift <nl> ppp b / test / SILGen / closures . swift <nl> func return_local_generic_function_with_captures < A , R > ( _ a : A ) - > ( A ) - > R { <nl> func read_only_capture ( _ x : Int ) - > Int { <nl> var x = x <nl> / / CHECK : bb0 ( [ [ X : % [ 0 - 9 ] + ] ] : $ Int ) : <nl> - / / CHECK : [ [ XBOX : % [ 0 - 9 ] + ] ] = alloc_box $ Int <nl> + / / CHECK : [ [ XBOX : % [ 0 - 9 ] + ] ] = alloc_box $ @ box Int <nl> <nl> func cap ( ) - > Int { <nl> return x <nl> func read_only_capture ( _ x : Int ) - > Int { <nl> func write_to_capture ( _ x : Int ) - > Int { <nl> var x = x <nl> / / CHECK : bb0 ( [ [ X : % [ 0 - 9 ] + ] ] : $ Int ) : <nl> - / / CHECK : [ [ XBOX : % [ 0 - 9 ] + ] ] = alloc_box $ Int <nl> - / / CHECK : [ [ X2BOX : % [ 0 - 9 ] + ] ] = alloc_box $ Int <nl> + / / CHECK : [ [ XBOX : % [ 0 - 9 ] + ] ] = alloc_box $ @ box Int <nl> + / / CHECK : [ [ X2BOX : % [ 0 - 9 ] + ] ] = alloc_box $ @ box Int <nl> / / CHECK : [ [ PB : % . * ] ] = project_box [ [ X2BOX ] ] <nl> var x2 = x <nl> <nl> func multiple_closure_refs ( _ x : Int ) - > ( ( ) - > Int , ( ) - > Int ) { <nl> / / CHECK - LABEL : sil hidden @ _TF8closures18capture_local_func <nl> func capture_local_func ( _ x : Int ) - > ( ) - > ( ) - > Int { <nl> var x = x <nl> - / / CHECK : [ [ XBOX : % [ 0 - 9 ] + ] ] = alloc_box $ Int <nl> + / / CHECK : [ [ XBOX : % [ 0 - 9 ] + ] ] = alloc_box $ @ box Int <nl> <nl> func aleph ( ) - > Int { return x } <nl> <nl> func capture_local_func ( _ x : Int ) - > ( ) - > ( ) - > Int { <nl> func anon_read_only_capture ( _ x : Int ) - > Int { <nl> var x = x <nl> / / CHECK : bb0 ( [ [ X : % [ 0 - 9 ] + ] ] : $ Int ) : <nl> - / / CHECK : [ [ XBOX : % [ 0 - 9 ] + ] ] = alloc_box $ Int <nl> + / / CHECK : [ [ XBOX : % [ 0 - 9 ] + ] ] = alloc_box $ @ box Int <nl> / / CHECK : [ [ PB : % . * ] ] = project_box [ [ XBOX ] ] <nl> <nl> return ( { x } ) ( ) <nl> func anon_read_only_capture ( _ x : Int ) - > Int { <nl> func small_closure_capture ( _ x : Int ) - > Int { <nl> var x = x <nl> / / CHECK : bb0 ( [ [ X : % [ 0 - 9 ] + ] ] : $ Int ) : <nl> - / / CHECK : [ [ XBOX : % [ 0 - 9 ] + ] ] = alloc_box $ Int <nl> + / / CHECK : [ [ XBOX : % [ 0 - 9 ] + ] ] = alloc_box $ @ box Int <nl> / / CHECK : [ [ PB : % . * ] ] = project_box [ [ XBOX ] ] <nl> <nl> return { x } ( ) <nl> func small_closure_capture ( _ x : Int ) - > Int { <nl> / / CHECK - LABEL : sil hidden @ _TF8closures35small_closure_capture_with_argument <nl> func small_closure_capture_with_argument ( _ x : Int ) - > ( _ y : Int ) - > Int { <nl> var x = x <nl> - / / CHECK : [ [ XBOX : % [ 0 - 9 ] + ] ] = alloc_box $ Int <nl> + / / CHECK : [ [ XBOX : % [ 0 - 9 ] + ] ] = alloc_box $ @ box Int <nl> <nl> return { x + $ 0 } <nl> / / - - func expression <nl> func uncaptured_locals ( _ x : Int ) - > ( Int , Int ) { <nl> var x = x <nl> / / - - locals without captures are stack - allocated <nl> / / CHECK : bb0 ( [ [ XARG : % [ 0 - 9 ] + ] ] : $ Int ) : <nl> - / / CHECK : [ [ XADDR : % [ 0 - 9 ] + ] ] = alloc_box $ Int <nl> + / / CHECK : [ [ XADDR : % [ 0 - 9 ] + ] ] = alloc_box $ @ box Int <nl> / / CHECK : [ [ PB : % . * ] ] = project_box [ [ XADDR ] ] <nl> / / CHECK : store [ [ XARG ] ] to [ trivial ] [ [ PB ] ] <nl> <nl> var y = zero <nl> - / / CHECK : [ [ YADDR : % [ 0 - 9 ] + ] ] = alloc_box $ Int <nl> + / / CHECK : [ [ YADDR : % [ 0 - 9 ] + ] ] = alloc_box $ @ box Int <nl> return ( x , y ) <nl> <nl> } <nl> class SuperSub : SuperBase { <nl> } <nl> <nl> / / CHECK - LABEL : sil hidden @ _TFC8closures24UnownedSelfNestedCapture13nestedCapture { { . * } } : $ @ convention ( method ) ( @ guaranteed UnownedSelfNestedCapture ) - > ( ) <nl> - / / CHECK : [ [ OUTER_SELF_CAPTURE : % . * ] ] = alloc_box $ @ sil_unowned UnownedSelfNestedCapture <nl> + / / CHECK : [ [ OUTER_SELF_CAPTURE : % . * ] ] = alloc_box $ @ box @ sil_unowned UnownedSelfNestedCapture <nl> / / CHECK : [ [ PB : % . * ] ] = project_box [ [ OUTER_SELF_CAPTURE ] ] <nl> / / CHECK : [ [ UNOWNED_SELF : % . * ] ] = ref_to_unowned [ [ SELF_PARAM : % . * ] ] : <nl> / / - - TODO : A lot of fussy r / r traffic and owned / unowned conversions here . <nl> mmm a / test / SILGen / complete_object_init . swift <nl> ppp b / test / SILGen / complete_object_init . swift <nl> struct X { } <nl> class A { <nl> / / CHECK - LABEL : sil hidden @ _TFC20complete_object_init1Ac { { . * } } : $ @ convention ( method ) ( @ owned A ) - > @ owned A <nl> / / CHECK : bb0 ( [ [ SELF_PARAM : % [ 0 - 9 ] + ] ] : $ A ) : <nl> - / / CHECK : [ [ SELF_BOX : % [ 0 - 9 ] + ] ] = alloc_box $ A <nl> + / / CHECK : [ [ SELF_BOX : % [ 0 - 9 ] + ] ] = alloc_box $ @ box A <nl> / / CHECK : [ [ PB : % . * ] ] = project_box [ [ SELF_BOX ] ] <nl> / / CHECK : [ [ SELF : % [ 0 - 9 ] + ] ] = mark_uninitialized [ delegatingself ] [ [ PB ] ] : $ * A <nl> / / CHECK : store [ [ SELF_PARAM ] ] to [ [ SELF ] ] : $ * A <nl> mmm a / test / SILGen / copy_lvalue_peepholes . swift <nl> ppp b / test / SILGen / copy_lvalue_peepholes . swift <nl> var zero = getInt ( ) <nl> func getInt ( ) - > Int { return zero } <nl> <nl> / / CHECK - LABEL : sil hidden @ _TF21copy_lvalue_peepholes20init_var_from_lvalue <nl> - / / CHECK : [ [ X : % . * ] ] = alloc_box $ Builtin . Int64 <nl> + / / CHECK : [ [ X : % . * ] ] = alloc_box $ @ box Builtin . Int64 <nl> / / CHECK : [ [ PBX : % . * ] ] = project_box [ [ X ] ] <nl> - / / CHECK : [ [ Y : % . * ] ] = alloc_box $ Builtin . Int64 <nl> + / / CHECK : [ [ Y : % . * ] ] = alloc_box $ @ box Builtin . Int64 <nl> / / CHECK : [ [ PBY : % . * ] ] = project_box [ [ Y ] ] <nl> / / CHECK : copy_addr [ [ PBX ] ] to [ initialization ] [ [ PBY ] ] : $ * Builtin . Int64 <nl> func init_var_from_lvalue ( x : Int ) { <nl> func init_var_from_lvalue ( x : Int ) { <nl> } <nl> <nl> / / CHECK - LABEL : sil hidden @ _TF21copy_lvalue_peepholes22assign_var_from_lvalue <nl> - / / CHECK : [ [ Y : % . * ] ] = alloc_box $ Builtin . Int64 <nl> + / / CHECK : [ [ Y : % . * ] ] = alloc_box $ @ box Builtin . Int64 <nl> / / CHECK : [ [ PBY : % . * ] ] = project_box [ [ Y ] ] <nl> / / CHECK : copy_addr [ [ PBY ] ] to % 0 <nl> func assign_var_from_lvalue ( x : inout Int , y : Int ) { <nl> mmm a / test / SILGen / decls . swift <nl> ppp b / test / SILGen / decls . swift <nl> func MRV ( ) - > ( Int , Float , ( ) , Double ) { } <nl> / / CHECK - LABEL : sil hidden @ _TF5decls14tuple_patternsFT_T_ <nl> func tuple_patterns ( ) { <nl> var ( a , b ) : ( Int , Float ) <nl> - / / CHECK : [ [ AADDR1 : % [ 0 - 9 ] + ] ] = alloc_box $ Int <nl> + / / CHECK : [ [ AADDR1 : % [ 0 - 9 ] + ] ] = alloc_box $ @ box Int <nl> / / CHECK : [ [ PBA : % . * ] ] = project_box [ [ AADDR1 ] ] <nl> / / CHECK : [ [ AADDR : % [ 0 - 9 ] + ] ] = mark_uninitialized [ var ] [ [ PBA ] ] <nl> - / / CHECK : [ [ BADDR1 : % [ 0 - 9 ] + ] ] = alloc_box $ Float <nl> + / / CHECK : [ [ BADDR1 : % [ 0 - 9 ] + ] ] = alloc_box $ @ box Float <nl> / / CHECK : [ [ PBB : % . * ] ] = project_box [ [ BADDR1 ] ] <nl> / / CHECK : [ [ BADDR : % [ 0 - 9 ] + ] ] = mark_uninitialized [ var ] [ [ PBB ] ] <nl> <nl> var ( c , d ) = ( a , b ) <nl> - / / CHECK : [ [ CADDR : % [ 0 - 9 ] + ] ] = alloc_box $ Int <nl> + / / CHECK : [ [ CADDR : % [ 0 - 9 ] + ] ] = alloc_box $ @ box Int <nl> / / CHECK : [ [ PBC : % . * ] ] = project_box [ [ CADDR ] ] <nl> - / / CHECK : [ [ DADDR : % [ 0 - 9 ] + ] ] = alloc_box $ Float <nl> + / / CHECK : [ [ DADDR : % [ 0 - 9 ] + ] ] = alloc_box $ @ box Float <nl> / / CHECK : [ [ PBD : % . * ] ] = project_box [ [ DADDR ] ] <nl> / / CHECK : copy_addr [ [ AADDR ] ] to [ initialization ] [ [ PBC ] ] <nl> / / CHECK : copy_addr [ [ BADDR ] ] to [ initialization ] [ [ PBD ] ] <nl> <nl> - / / CHECK : [ [ EADDR : % [ 0 - 9 ] + ] ] = alloc_box $ Int <nl> + / / CHECK : [ [ EADDR : % [ 0 - 9 ] + ] ] = alloc_box $ @ box Int <nl> / / CHECK : [ [ PBE : % . * ] ] = project_box [ [ EADDR ] ] <nl> - / / CHECK : [ [ FADDR : % [ 0 - 9 ] + ] ] = alloc_box $ Float <nl> + / / CHECK : [ [ FADDR : % [ 0 - 9 ] + ] ] = alloc_box $ @ box Float <nl> / / CHECK : [ [ PBF : % . * ] ] = project_box [ [ FADDR ] ] <nl> - / / CHECK : [ [ GADDR : % [ 0 - 9 ] + ] ] = alloc_box $ ( ) <nl> - / / CHECK : [ [ HADDR : % [ 0 - 9 ] + ] ] = alloc_box $ Double <nl> + / / CHECK : [ [ GADDR : % [ 0 - 9 ] + ] ] = alloc_box $ @ box ( ) <nl> + / / CHECK : [ [ HADDR : % [ 0 - 9 ] + ] ] = alloc_box $ @ box Double <nl> / / CHECK : [ [ PBH : % . * ] ] = project_box [ [ HADDR ] ] <nl> / / CHECK : [ [ EFGH : % [ 0 - 9 ] + ] ] = apply <nl> / / CHECK : [ [ E : % [ 0 - 9 ] + ] ] = tuple_extract { { . * } } , 0 <nl> func tuple_patterns ( ) { <nl> / / CHECK : store [ [ H ] ] to [ trivial ] [ [ PBH ] ] <nl> var ( e , f , g , h ) : ( Int , Float , ( ) , Double ) = MRV ( ) <nl> <nl> - / / CHECK : [ [ IADDR : % [ 0 - 9 ] + ] ] = alloc_box $ Int <nl> + / / CHECK : [ [ IADDR : % [ 0 - 9 ] + ] ] = alloc_box $ @ box Int <nl> / / CHECK : [ [ PBI : % . * ] ] = project_box [ [ IADDR ] ] <nl> - / / CHECK - NOT : alloc_box $ Float <nl> + / / CHECK - NOT : alloc_box $ @ box Float <nl> / / CHECK : copy_addr [ [ AADDR ] ] to [ initialization ] [ [ PBI ] ] <nl> / / CHECK : [ [ B : % [ 0 - 9 ] + ] ] = load [ [ BADDR ] ] <nl> / / CHECK - NOT : store [ [ B ] ] <nl> var ( i , _ ) = ( a , b ) <nl> <nl> - / / CHECK : [ [ JADDR : % [ 0 - 9 ] + ] ] = alloc_box $ Int <nl> + / / CHECK : [ [ JADDR : % [ 0 - 9 ] + ] ] = alloc_box $ @ box Int <nl> / / CHECK : [ [ PBJ : % . * ] ] = project_box [ [ JADDR ] ] <nl> - / / CHECK - NOT : alloc_box $ Float <nl> - / / CHECK : [ [ KADDR : % [ 0 - 9 ] + ] ] = alloc_box $ ( ) <nl> - / / CHECK - NOT : alloc_box $ Double <nl> + / / CHECK - NOT : alloc_box $ @ box Float <nl> + / / CHECK : [ [ KADDR : % [ 0 - 9 ] + ] ] = alloc_box $ @ box ( ) <nl> + / / CHECK - NOT : alloc_box $ @ box Double <nl> / / CHECK : [ [ J_K_ : % [ 0 - 9 ] + ] ] = apply <nl> / / CHECK : [ [ J : % [ 0 - 9 ] + ] ] = tuple_extract { { . * } } , 0 <nl> / / CHECK : [ [ K : % [ 0 - 9 ] + ] ] = tuple_extract { { . * } } , 2 <nl> func tuple_patterns ( ) { <nl> <nl> / / CHECK - LABEL : sil hidden @ _TF5decls16simple_arguments <nl> / / CHECK : bb0 ( % 0 : $ Int , % 1 : $ Int ) : <nl> - / / CHECK : [ [ X : % [ 0 - 9 ] + ] ] = alloc_box $ Int <nl> + / / CHECK : [ [ X : % [ 0 - 9 ] + ] ] = alloc_box $ @ box Int <nl> / / CHECK - NEXT : [ [ PBX : % . * ] ] = project_box [ [ X ] ] <nl> / / CHECK - NEXT : store % 0 to [ trivial ] [ [ PBX ] ] <nl> - / / CHECK - NEXT : [ [ Y : % [ 0 - 9 ] + ] ] = alloc_box $ Int <nl> + / / CHECK - NEXT : [ [ Y : % [ 0 - 9 ] + ] ] = alloc_box $ @ box Int <nl> / / CHECK - NEXT : [ [ PBY : % [ 0 - 9 ] + ] ] = project_box [ [ Y ] ] <nl> / / CHECK - NEXT : store % 1 to [ trivial ] [ [ PBY ] ] <nl> func simple_arguments ( x : Int , y : Int ) - > Int { <nl> func tuple_argument ( x : ( Int , Float , ( ) ) ) { <nl> <nl> / / CHECK - LABEL : sil hidden @ _TF5decls14inout_argument <nl> / / CHECK : bb0 ( % 0 : $ * Int , % 1 : $ Int ) : <nl> - / / CHECK : [ [ X_LOCAL : % [ 0 - 9 ] + ] ] = alloc_box $ Int <nl> + / / CHECK : [ [ X_LOCAL : % [ 0 - 9 ] + ] ] = alloc_box $ @ box Int <nl> / / CHECK : [ [ PBX : % . * ] ] = project_box [ [ X_LOCAL ] ] <nl> func inout_argument ( x : inout Int , y : Int ) { <nl> var y = y <nl> func load_from_global ( ) - > Int { <nl> func store_to_global ( x : Int ) { <nl> var x = x <nl> global = x <nl> - / / CHECK : [ [ XADDR : % [ 0 - 9 ] + ] ] = alloc_box $ Int <nl> + / / CHECK : [ [ XADDR : % [ 0 - 9 ] + ] ] = alloc_box $ @ box Int <nl> / / CHECK : [ [ PBX : % . * ] ] = project_box [ [ XADDR ] ] <nl> / / CHECK : [ [ ACCESSOR : % [ 0 - 9 ] + ] ] = function_ref @ _TF5declsau6globalSi <nl> / / CHECK : [ [ PTR : % [ 0 - 9 ] + ] ] = apply [ [ ACCESSOR ] ] ( ) <nl> mmm a / test / SILGen / default_constructor . swift <nl> ppp b / test / SILGen / default_constructor . swift <nl> struct D { <nl> <nl> <nl> / / CHECK - LABEL : sil hidden @ _TFV19default_constructor1DC { { . * } } : $ @ convention ( method ) ( @ thin D . Type ) - > D <nl> - / / CHECK : [ [ THISBOX : % [ 0 - 9 ] + ] ] = alloc_box $ D <nl> + / / CHECK : [ [ THISBOX : % [ 0 - 9 ] + ] ] = alloc_box $ @ box D <nl> / / CHECK : [ [ THIS : % [ 0 - 9 ] + ] ] = mark_uninit <nl> / / CHECK : [ [ INIT : % [ 0 - 9 ] + ] ] = function_ref @ _TIvV19default_constructor1D1iSii <nl> / / CHECK : [ [ RESULT : % [ 0 - 9 ] + ] ] = apply [ [ INIT ] ] ( ) <nl> class F : E { } <nl> <nl> / / CHECK - LABEL : sil hidden @ _TFC19default_constructor1Fc { { . * } } : $ @ convention ( method ) ( @ owned F ) - > @ owned F <nl> / / CHECK : bb0 ( [ [ ORIGSELF : % [ 0 - 9 ] + ] ] : $ F ) <nl> - / / CHECK - NEXT : [ [ SELF_BOX : % [ 0 - 9 ] + ] ] = alloc_box $ F <nl> + / / CHECK - NEXT : [ [ SELF_BOX : % [ 0 - 9 ] + ] ] = alloc_box $ @ box F <nl> / / CHECK - NEXT : project_box [ [ SELF_BOX ] ] <nl> / / CHECK - NEXT : [ [ SELF : % [ 0 - 9 ] + ] ] = mark_uninitialized [ derivedself ] <nl> / / CHECK - NEXT : store [ [ ORIGSELF ] ] to [ [ SELF ] ] : $ * F <nl> mmm a / test / SILGen / dynamic_lookup . swift <nl> ppp b / test / SILGen / dynamic_lookup . swift <nl> func direct_to_protocol ( _ obj : AnyObject ) { <nl> func direct_to_static_method ( _ obj : AnyObject ) { <nl> var obj = obj <nl> / / CHECK : [ [ START : [ A - Za - z0 - 9_ ] + ] ] ( [ [ OBJ : % [ 0 - 9 ] + ] ] : $ AnyObject ) : <nl> - / / CHECK : [ [ OBJBOX : % [ 0 - 9 ] + ] ] = alloc_box $ AnyObject <nl> + / / CHECK : [ [ OBJBOX : % [ 0 - 9 ] + ] ] = alloc_box $ @ box AnyObject <nl> / / CHECK - NEXT : [ [ PBOBJ : % [ 0 - 9 ] + ] ] = project_box [ [ OBJBOX ] ] <nl> / / CHECK : store [ [ OBJ ] ] to [ init ] [ [ PBOBJ ] ] : $ * AnyObject <nl> / / CHECK - NEXT : [ [ OBJCOPY : % [ 0 - 9 ] + ] ] = load [ [ PBOBJ ] ] : $ * AnyObject <nl> func direct_to_static_method ( _ obj : AnyObject ) { <nl> func opt_to_class ( _ obj : AnyObject ) { <nl> var obj = obj <nl> / / CHECK : [ [ ENTRY : [ A - Za - z0 - 9 ] + ] ] ( [ [ PARAM : % [ 0 - 9 ] + ] ] : $ AnyObject ) <nl> - / / CHECK : [ [ EXISTBOX : % [ 0 - 9 ] + ] ] = alloc_box $ AnyObject <nl> + / / CHECK : [ [ EXISTBOX : % [ 0 - 9 ] + ] ] = alloc_box $ @ box AnyObject <nl> / / CHECK - NEXT : [ [ PBOBJ : % [ 0 - 9 ] + ] ] = project_box [ [ EXISTBOX ] ] <nl> / / CHECK : store [ [ PARAM ] ] to [ init ] [ [ PBOBJ ] ] <nl> - / / CHECK - NEXT : [ [ OPTBOX : % [ 0 - 9 ] + ] ] = alloc_box $ Optional < @ callee_owned ( ) - > ( ) > <nl> + / / CHECK - NEXT : [ [ OPTBOX : % [ 0 - 9 ] + ] ] = alloc_box $ @ box Optional < @ callee_owned ( ) - > ( ) > <nl> / / CHECK - NEXT : [ [ PBOPT : % . * ] ] = project_box [ [ OPTBOX ] ] <nl> / / CHECK - NEXT : [ [ EXISTVAL : % [ 0 - 9 ] + ] ] = load [ [ PBOBJ ] ] : $ * AnyObject <nl> / / CHECK - NEXT : copy_value [ [ EXISTVAL ] ] : $ AnyObject <nl> func forced_without_outer ( _ obj : AnyObject ) { <nl> func opt_to_static_method ( _ obj : AnyObject ) { <nl> var obj = obj <nl> / / CHECK : [ [ ENTRY : [ A - Za - z0 - 9 ] + ] ] ( [ [ OBJ : % [ 0 - 9 ] + ] ] : $ AnyObject ) : <nl> - / / CHECK : [ [ OBJBOX : % [ 0 - 9 ] + ] ] = alloc_box $ AnyObject <nl> + / / CHECK : [ [ OBJBOX : % [ 0 - 9 ] + ] ] = alloc_box $ @ box AnyObject <nl> / / CHECK - NEXT : [ [ PBOBJ : % [ 0 - 9 ] + ] ] = project_box [ [ OBJBOX ] ] <nl> / / CHECK : store [ [ OBJ ] ] to [ init ] [ [ PBOBJ ] ] : $ * AnyObject <nl> - / / CHECK - NEXT : [ [ OPTBOX : % [ 0 - 9 ] + ] ] = alloc_box $ Optional < @ callee_owned ( ) - > ( ) > <nl> + / / CHECK - NEXT : [ [ OPTBOX : % [ 0 - 9 ] + ] ] = alloc_box $ @ box Optional < @ callee_owned ( ) - > ( ) > <nl> / / CHECK - NEXT : [ [ PBO : % . * ] ] = project_box [ [ OPTBOX ] ] <nl> / / CHECK - NEXT : [ [ OBJCOPY : % [ 0 - 9 ] + ] ] = load [ [ PBOBJ ] ] : $ * AnyObject <nl> / / CHECK - NEXT : [ [ OBJMETA : % [ 0 - 9 ] + ] ] = existential_metatype $ @ thick AnyObject . Type , [ [ OBJCOPY ] ] : $ AnyObject <nl> func opt_to_static_method ( _ obj : AnyObject ) { <nl> func opt_to_property ( _ obj : AnyObject ) { <nl> var obj = obj <nl> / / CHECK : bb0 ( [ [ OBJ : % [ 0 - 9 ] + ] ] : $ AnyObject ) : <nl> - / / CHECK : [ [ OBJ_BOX : % [ 0 - 9 ] + ] ] = alloc_box $ AnyObject <nl> + / / CHECK : [ [ OBJ_BOX : % [ 0 - 9 ] + ] ] = alloc_box $ @ box AnyObject <nl> / / CHECK - NEXT : [ [ PBOBJ : % [ 0 - 9 ] + ] ] = project_box [ [ OBJ_BOX ] ] <nl> / / CHECK : store [ [ OBJ ] ] to [ init ] [ [ PBOBJ ] ] : $ * AnyObject <nl> - / / CHECK - NEXT : [ [ INT_BOX : % [ 0 - 9 ] + ] ] = alloc_box $ Int <nl> + / / CHECK - NEXT : [ [ INT_BOX : % [ 0 - 9 ] + ] ] = alloc_box $ @ box Int <nl> / / CHECK - NEXT : project_box [ [ INT_BOX ] ] <nl> / / CHECK - NEXT : [ [ OBJ : % [ 0 - 9 ] + ] ] = load [ [ PBOBJ ] ] : $ * AnyObject <nl> / / CHECK - NEXT : copy_value [ [ OBJ ] ] : $ AnyObject <nl> func direct_to_subscript ( _ obj : AnyObject , i : Int ) { <nl> var obj = obj <nl> var i = i <nl> / / CHECK : bb0 ( [ [ OBJ : % [ 0 - 9 ] + ] ] : $ AnyObject , [ [ I : % [ 0 - 9 ] + ] ] : $ Int ) : <nl> - / / CHECK : [ [ OBJ_BOX : % [ 0 - 9 ] + ] ] = alloc_box $ AnyObject <nl> + / / CHECK : [ [ OBJ_BOX : % [ 0 - 9 ] + ] ] = alloc_box $ @ box AnyObject <nl> / / CHECK - NEXT : [ [ PBOBJ : % [ 0 - 9 ] + ] ] = project_box [ [ OBJ_BOX ] ] <nl> / / CHECK : store [ [ OBJ ] ] to [ init ] [ [ PBOBJ ] ] : $ * AnyObject <nl> - / / CHECK - NEXT : [ [ I_BOX : % [ 0 - 9 ] + ] ] = alloc_box $ Int <nl> + / / CHECK - NEXT : [ [ I_BOX : % [ 0 - 9 ] + ] ] = alloc_box $ @ box Int <nl> / / CHECK - NEXT : [ [ PBI : % . * ] ] = project_box [ [ I_BOX ] ] <nl> / / CHECK - NEXT : store [ [ I ] ] to [ trivial ] [ [ PBI ] ] : $ * Int <nl> - / / CHECK - NEXT : alloc_box $ Int <nl> + / / CHECK - NEXT : alloc_box $ @ box Int <nl> / / CHECK - NEXT : project_box <nl> / / CHECK - NEXT : [ [ OBJ : % [ 0 - 9 ] + ] ] = load [ [ PBOBJ ] ] : $ * AnyObject <nl> / / CHECK - NEXT : copy_value [ [ OBJ ] ] : $ AnyObject <nl> func opt_to_subscript ( _ obj : AnyObject , i : Int ) { <nl> var obj = obj <nl> var i = i <nl> / / CHECK : bb0 ( [ [ OBJ : % [ 0 - 9 ] + ] ] : $ AnyObject , [ [ I : % [ 0 - 9 ] + ] ] : $ Int ) : <nl> - / / CHECK : [ [ OBJ_BOX : % [ 0 - 9 ] + ] ] = alloc_box $ AnyObject <nl> + / / CHECK : [ [ OBJ_BOX : % [ 0 - 9 ] + ] ] = alloc_box $ @ box AnyObject <nl> / / CHECK - NEXT : [ [ PBOBJ : % [ 0 - 9 ] + ] ] = project_box [ [ OBJ_BOX ] ] <nl> / / CHECK : store [ [ OBJ ] ] to [ init ] [ [ PBOBJ ] ] : $ * AnyObject <nl> - / / CHECK - NEXT : [ [ I_BOX : % [ 0 - 9 ] + ] ] = alloc_box $ Int <nl> + / / CHECK - NEXT : [ [ I_BOX : % [ 0 - 9 ] + ] ] = alloc_box $ @ box Int <nl> / / CHECK - NEXT : [ [ PBI : % . * ] ] = project_box [ [ I_BOX ] ] <nl> / / CHECK - NEXT : store [ [ I ] ] to [ trivial ] [ [ PBI ] ] : $ * Int <nl> / / CHECK - NEXT : [ [ OBJ : % [ 0 - 9 ] + ] ] = load [ [ PBOBJ ] ] : $ * AnyObject <nl> func opt_to_subscript ( _ obj : AnyObject , i : Int ) { <nl> func downcast ( _ obj : AnyObject ) - > X { <nl> var obj = obj <nl> / / CHECK : bb0 ( [ [ OBJ : % [ 0 - 9 ] + ] ] : $ AnyObject ) : <nl> - / / CHECK : [ [ OBJ_BOX : % [ 0 - 9 ] + ] ] = alloc_box $ AnyObject <nl> + / / CHECK : [ [ OBJ_BOX : % [ 0 - 9 ] + ] ] = alloc_box $ @ box AnyObject <nl> / / CHECK - NEXT : [ [ PBOBJ : % [ 0 - 9 ] + ] ] = project_box [ [ OBJ_BOX ] ] <nl> / / CHECK : store [ [ OBJ ] ] to [ init ] [ [ PBOBJ ] ] : $ * AnyObject <nl> / / CHECK - NEXT : [ [ OBJ : % [ 0 - 9 ] + ] ] = load [ [ PBOBJ ] ] : $ * AnyObject <nl> mmm a / test / SILGen / dynamic_self . swift <nl> ppp b / test / SILGen / dynamic_self . swift <nl> class ObjCInit { <nl> / / CHECK : sil hidden @ _TF12dynamic_self12testObjCInit { { . * } } : $ @ convention ( thin ) ( @ thick ObjCInit . Type ) - > ( ) <nl> func testObjCInit ( meta : ObjCInit . Type ) { <nl> / / CHECK : bb0 ( [ [ THICK_META : % [ 0 - 9 ] + ] ] : $ @ thick ObjCInit . Type ) : <nl> - / / CHECK : [ [ O : % [ 0 - 9 ] + ] ] = alloc_box $ ObjCInit <nl> + / / CHECK : [ [ O : % [ 0 - 9 ] + ] ] = alloc_box $ @ box ObjCInit <nl> / / CHECK : [ [ PB : % . * ] ] = project_box [ [ O ] ] <nl> / / CHECK : [ [ OBJC_META : % [ 0 - 9 ] + ] ] = thick_to_objc_metatype [ [ THICK_META ] ] : $ @ thick ObjCInit . Type to $ @ objc_metatype ObjCInit . Type <nl> / / CHECK : [ [ OBJ : % [ 0 - 9 ] + ] ] = alloc_ref_dynamic [ objc ] [ [ OBJC_META ] ] : $ @ objc_metatype ObjCInit . Type , $ ObjCInit <nl> class Z { <nl> / / Capturing ' self ' weak , so we have to pass in a metatype explicitly <nl> / / so that IRGen can recover metadata . <nl> <nl> - / / CHECK : [ [ WEAK_SELF : % . * ] ] = alloc_box $ @ sil_weak Optional < Z > <nl> + / / CHECK : [ [ WEAK_SELF : % . * ] ] = alloc_box $ @ box @ sil_weak Optional < Z > <nl> / / CHECK : [ [ FN : % . * ] ] = function_ref @ _TFFC12dynamic_self1Z23testDynamicSelfCapturesFT1xSi_DS0_U1_FT_T_ : $ @ convention ( thin ) ( @ owned @ box @ sil_weak Optional < Z > , @ thick Z . Type ) - > ( ) <nl> / / CHECK : copy_value [ [ WEAK_SELF ] ] : $ @ box @ sil_weak Optional < Z > <nl> / / CHECK - NEXT : [ [ DYNAMIC_SELF : % . * ] ] = metatype $ @ thick @ dynamic_self Z . Type <nl> mmm a / test / SILGen / dynamic_self_reference_storage . swift <nl> ppp b / test / SILGen / dynamic_self_reference_storage . swift <nl> class Foo { <nl> func dynamicSelf ( ) - > Self { <nl> / / CHECK : debug_value { { % . * } } : $ Foo <nl> let managedSelf = self <nl> - / / CHECK : alloc_box $ @ sil_unmanaged Foo <nl> + / / CHECK : alloc_box $ @ box @ sil_unmanaged Foo <nl> unowned ( unsafe ) let unmanagedSelf = self <nl> - / / CHECK : alloc_box $ @ sil_unowned Foo <nl> + / / CHECK : alloc_box $ @ box @ sil_unowned Foo <nl> unowned ( safe ) let unownedSelf = self <nl> - / / CHECK : alloc_box $ @ sil_weak Optional < Foo > <nl> + / / CHECK : alloc_box $ @ box @ sil_weak Optional < Foo > <nl> weak var weakSelf = self <nl> / / CHECK : debug_value { { % . * } } : $ Optional < Foo > <nl> let optionalSelf = Optional ( self ) <nl> <nl> - / / CHECK : alloc_box $ @ sil_unowned Foo <nl> + / / CHECK : alloc_box $ @ box @ sil_unowned Foo <nl> let f : ( ) - > ( ) = { [ unowned self ] in ( ) } <nl> - / / CHECK : alloc_box $ @ sil_weak Optional < Foo > <nl> + / / CHECK : alloc_box $ @ box @ sil_weak Optional < Foo > <nl> let g : ( ) - > ( ) = { [ weak self ] in ( ) } <nl> } <nl> } <nl> mmm a / test / SILGen / errors . swift <nl> ppp b / test / SILGen / errors . swift <nl> class BaseThrowingInit : HasThrowingInit { <nl> } <nl> } <nl> / / CHECK : sil hidden @ _TFC6errors16BaseThrowingInitc { { . * } } : $ @ convention ( method ) ( Int , Int , @ owned BaseThrowingInit ) - > ( @ owned BaseThrowingInit , @ error Error ) <nl> - / / CHECK : [ [ BOX : % . * ] ] = alloc_box $ BaseThrowingInit <nl> + / / CHECK : [ [ BOX : % . * ] ] = alloc_box $ @ box BaseThrowingInit <nl> / / CHECK : [ [ PB : % . * ] ] = project_box [ [ BOX ] ] <nl> / / CHECK : [ [ MARKED_BOX : % . * ] ] = mark_uninitialized [ derivedself ] [ [ PB ] ] <nl> / / Initialize subField . <nl> func testOptionalTry ( ) { <nl> <nl> / / CHECK - LABEL : sil hidden @ _TF6errors18testOptionalTryVarFT_T_ <nl> / / CHECK - NEXT : bb0 : <nl> - / / CHECK - NEXT : [ [ BOX : % . + ] ] = alloc_box $ Optional < Cat > <nl> + / / CHECK - NEXT : [ [ BOX : % . + ] ] = alloc_box $ @ box Optional < Cat > <nl> / / CHECK - NEXT : [ [ PB : % . * ] ] = project_box [ [ BOX ] ] <nl> / / CHECK - NEXT : [ [ BOX_DATA : % . + ] ] = init_enum_data_addr [ [ PB ] ] : $ * Optional < Cat > , # Optional . some ! enumelt . 1 <nl> / / CHECK : [ [ FN : % . + ] ] = function_ref @ _TF6errors10make_a_catFzT_CS_3Cat <nl> func testOptionalTryAddressOnly < T > ( _ obj : T ) { <nl> <nl> / / CHECK - LABEL : sil hidden @ _TF6errors29testOptionalTryAddressOnlyVar <nl> / / CHECK : bb0 ( % 0 : $ * T ) : <nl> - / / CHECK : [ [ BOX : % . + ] ] = alloc_box $ Optional < T > <nl> + / / CHECK : [ [ BOX : % . + ] ] = alloc_box $ @ box Optional < T > <nl> / / CHECK - NEXT : [ [ PB : % . * ] ] = project_box [ [ BOX ] ] <nl> / / CHECK - NEXT : [ [ BOX_DATA : % . + ] ] = init_enum_data_addr [ [ PB ] ] : $ * Optional < T > , # Optional . some ! enumelt . 1 <nl> / / CHECK : [ [ FN : % . + ] ] = function_ref @ _TF6errors11dont_return <nl> func testOptionalTryNeverFails ( ) { <nl> <nl> / / CHECK - LABEL : sil hidden @ _TF6errors28testOptionalTryNeverFailsVarFT_T_ <nl> / / CHECK : bb0 : <nl> - / / CHECK - NEXT : [ [ BOX : % . + ] ] = alloc_box $ Optional < ( ) > <nl> + / / CHECK - NEXT : [ [ BOX : % . + ] ] = alloc_box $ @ box Optional < ( ) > <nl> / / CHECK - NEXT : [ [ PB : % . * ] ] = project_box [ [ BOX ] ] <nl> / / CHECK - NEXT : = init_enum_data_addr [ [ PB ] ] : $ * Optional < ( ) > , # Optional . some ! enumelt . 1 <nl> / / CHECK - NEXT : inject_enum_addr [ [ PB ] ] : $ * Optional < ( ) > , # Optional . some ! enumelt . 1 <nl> func testOptionalTryNeverFailsAddressOnly < T > ( _ obj : T ) { <nl> <nl> / / CHECK - LABEL : sil hidden @ _TF6errors39testOptionalTryNeverFailsAddressOnlyVar <nl> / / CHECK : bb0 ( % 0 : $ * T ) : <nl> - / / CHECK : [ [ BOX : % . + ] ] = alloc_box $ Optional < T > <nl> + / / CHECK : [ [ BOX : % . + ] ] = alloc_box $ @ box Optional < T > <nl> / / CHECK - NEXT : [ [ PB : % . * ] ] = project_box [ [ BOX ] ] <nl> / / CHECK - NEXT : [ [ BOX_DATA : % . + ] ] = init_enum_data_addr [ [ PB ] ] : $ * Optional < T > , # Optional . some ! enumelt . 1 <nl> / / CHECK - NEXT : copy_addr % 0 to [ initialization ] [ [ BOX_DATA ] ] : $ * T <nl> mmm a / test / SILGen / expressions . swift <nl> ppp b / test / SILGen / expressions . swift <nl> func tuple ( ) - > ( Int , Float ) { return ( 1 , 1 . 0 ) } <nl> / / CHECK - LABEL : sil hidden @ _TF11expressions13tuple_element <nl> func tuple_element ( _ x : ( Int , Float ) ) { <nl> var x = x <nl> - / / CHECK : [ [ XADDR : % . * ] ] = alloc_box $ ( Int , Float ) <nl> + / / CHECK : [ [ XADDR : % . * ] ] = alloc_box $ @ box ( Int , Float ) <nl> / / CHECK : [ [ PB : % . * ] ] = project_box [ [ XADDR ] ] <nl> <nl> int ( x . 0 ) <nl> func if_expr ( _ a : Bool , b : Bool , x : Int , y : Int , z : Int ) - > Int { <nl> var y = y <nl> var z = z <nl> / / CHECK : bb0 ( { { . * } } ) : <nl> - / / CHECK : [ [ AB : % [ 0 - 9 ] + ] ] = alloc_box $ Bool <nl> + / / CHECK : [ [ AB : % [ 0 - 9 ] + ] ] = alloc_box $ @ box Bool <nl> / / CHECK : [ [ PBA : % . * ] ] = project_box [ [ AB ] ] <nl> - / / CHECK : [ [ BB : % [ 0 - 9 ] + ] ] = alloc_box $ Bool <nl> + / / CHECK : [ [ BB : % [ 0 - 9 ] + ] ] = alloc_box $ @ box Bool <nl> / / CHECK : [ [ PBB : % . * ] ] = project_box [ [ BB ] ] <nl> - / / CHECK : [ [ XB : % [ 0 - 9 ] + ] ] = alloc_box $ Int <nl> + / / CHECK : [ [ XB : % [ 0 - 9 ] + ] ] = alloc_box $ @ box Int <nl> / / CHECK : [ [ PBX : % . * ] ] = project_box [ [ XB ] ] <nl> - / / CHECK : [ [ YB : % [ 0 - 9 ] + ] ] = alloc_box $ Int <nl> + / / CHECK : [ [ YB : % [ 0 - 9 ] + ] ] = alloc_box $ @ box Int <nl> / / CHECK : [ [ PBY : % . * ] ] = project_box [ [ YB ] ] <nl> - / / CHECK : [ [ ZB : % [ 0 - 9 ] + ] ] = alloc_box $ Int <nl> + / / CHECK : [ [ ZB : % [ 0 - 9 ] + ] ] = alloc_box $ @ box Int <nl> / / CHECK : [ [ PBZ : % . * ] ] = project_box [ [ ZB ] ] <nl> <nl> return a <nl> mmm a / test / SILGen / extensions . swift <nl> ppp b / test / SILGen / extensions . swift <nl> struct Box < T > { <nl> } <nl> <nl> / / CHECK - LABEL : sil hidden @ _TFV10extensions3BoxCfT1tx_GS0_x_ : $ @ convention ( method ) < T > ( @ in T , @ thin Box < T > . Type ) - > @ out Box < T > <nl> - / / CHECK : [ [ SELF_BOX : % . * ] ] = alloc_box $ Box < T > <nl> + / / CHECK : [ [ SELF_BOX : % . * ] ] = alloc_box $ @ box Box < T > <nl> / / CHECK - NEXT : [ [ SELF_ADDR : % . * ] ] = project_box [ [ SELF_BOX ] ] : $ @ box Box < T > <nl> / / CHECK : [ [ SELF_PTR : % . * ] ] = mark_uninitialized [ rootself ] [ [ SELF_ADDR ] ] : $ * Box < T > <nl> / / CHECK : [ [ INIT : % . * ] ] = function_ref @ _TIvV10extensions3Box1tGSqx_i : $ @ convention ( thin ) < τ_0_0 > ( ) - > @ out Optional < τ_0_0 > <nl> mmm a / test / SILGen / foreign_errors . swift <nl> ppp b / test / SILGen / foreign_errors . swift <nl> class VeryErrorProne : ErrorProne { <nl> } <nl> } <nl> / / CHECK : sil hidden @ _TFC14foreign_errors14VeryErrorPronec { { . * } } <nl> - / / CHECK : [ [ BOX : % . * ] ] = alloc_box $ VeryErrorProne <nl> + / / CHECK : [ [ BOX : % . * ] ] = alloc_box $ @ box VeryErrorProne <nl> / / CHECK : [ [ PB : % . * ] ] = project_box [ [ BOX ] ] <nl> / / CHECK : [ [ MARKED_BOX : % . * ] ] = mark_uninitialized [ derivedself ] [ [ PB ] ] <nl> / / CHECK : [ [ T0 : % . * ] ] = load [ [ MARKED_BOX ] ] <nl> mmm a / test / SILGen / functions . swift <nl> ppp b / test / SILGen / functions . swift <nl> func calls ( _ i : Int , j : Int , k : Int ) { <nl> var j = j <nl> var k = k <nl> / / CHECK : bb0 ( % 0 : $ Builtin . Int64 , % 1 : $ Builtin . Int64 , % 2 : $ Builtin . Int64 ) : <nl> - / / CHECK : [ [ IBOX : % [ 0 - 9 ] + ] ] = alloc_box $ Builtin . Int64 <nl> + / / CHECK : [ [ IBOX : % [ 0 - 9 ] + ] ] = alloc_box $ @ box Builtin . Int64 <nl> / / CHECK : [ [ IADDR : % . * ] ] = project_box [ [ IBOX ] ] <nl> - / / CHECK : [ [ JBOX : % [ 0 - 9 ] + ] ] = alloc_box $ Builtin . Int64 <nl> + / / CHECK : [ [ JBOX : % [ 0 - 9 ] + ] ] = alloc_box $ @ box Builtin . Int64 <nl> / / CHECK : [ [ JADDR : % . * ] ] = project_box [ [ JBOX ] ] <nl> - / / CHECK : [ [ KBOX : % [ 0 - 9 ] + ] ] = alloc_box $ Builtin . Int64 <nl> + / / CHECK : [ [ KBOX : % [ 0 - 9 ] + ] ] = alloc_box $ @ box Builtin . Int64 <nl> / / CHECK : [ [ KADDR : % . * ] ] = project_box [ [ KBOX ] ] <nl> <nl> / / CHECK : [ [ FUNC : % [ 0 - 9 ] + ] ] = function_ref @ _TF9functions19standalone_function { { . * } } : $ @ convention ( thin ) ( Builtin . Int64 , Builtin . Int64 ) - > Builtin . Int64 <nl> func calls ( _ i : Int , j : Int , k : Int ) { <nl> <nl> / / - - Curry ' self ' onto struct method argument lists . <nl> <nl> - / / CHECK : [ [ ST_ADDR : % . * ] ] = alloc_box $ SomeStruct <nl> + / / CHECK : [ [ ST_ADDR : % . * ] ] = alloc_box $ @ box SomeStruct <nl> / / CHECK : [ [ CTOR : % . * ] ] = function_ref @ _TFV9functions10SomeStructC { { . * } } : $ @ convention ( method ) ( Builtin . Int64 , Builtin . Int64 , @ thin SomeStruct . Type ) - > SomeStruct <nl> / / CHECK : [ [ METATYPE : % . * ] ] = metatype $ @ thin SomeStruct . Type <nl> / / CHECK : [ [ I : % . * ] ] = load [ [ IADDR ] ] <nl> func calls ( _ i : Int , j : Int , k : Int ) { <nl> <nl> / / - - Curry ' self ' onto method argument lists dispatched using class_method . <nl> <nl> - / / CHECK : [ [ CBOX : % [ 0 - 9 ] + ] ] = alloc_box $ SomeClass <nl> + / / CHECK : [ [ CBOX : % [ 0 - 9 ] + ] ] = alloc_box $ @ box SomeClass <nl> / / CHECK : [ [ CADDR : % . * ] ] = project_box [ [ CBOX ] ] <nl> / / CHECK : [ [ FUNC : % [ 0 - 9 ] + ] ] = function_ref @ _TFC9functions9SomeClassC { { . * } } : $ @ convention ( method ) ( Builtin . Int64 , Builtin . Int64 , @ thick SomeClass . Type ) - > @ owned SomeClass <nl> / / CHECK : [ [ META : % [ 0 - 9 ] + ] ] = metatype $ @ thick SomeClass . Type <nl> func calls ( _ i : Int , j : Int , k : Int ) { <nl> / / - - Curry the projected concrete value in an existential ( or its Type ) <nl> / / - - onto protocol type methods dispatched using protocol_method . <nl> <nl> - / / CHECK : [ [ PBOX : % [ 0 - 9 ] + ] ] = alloc_box $ SomeProtocol <nl> + / / CHECK : [ [ PBOX : % [ 0 - 9 ] + ] ] = alloc_box $ @ box SomeProtocol <nl> / / CHECK : [ [ PADDR : % . * ] ] = project_box [ [ PBOX ] ] <nl> var p : SomeProtocol = ConformsToSomeProtocol ( ) <nl> <nl> func calls ( _ i : Int , j : Int , k : Int ) { <nl> <nl> / / - - Use an apply or partial_apply instruction to bind type parameters of a generic . <nl> <nl> - / / CHECK : [ [ GBOX : % [ 0 - 9 ] + ] ] = alloc_box $ SomeGeneric < Builtin . Int64 > <nl> + / / CHECK : [ [ GBOX : % [ 0 - 9 ] + ] ] = alloc_box $ @ box SomeGeneric < Builtin . Int64 > <nl> / / CHECK : [ [ GADDR : % . * ] ] = project_box [ [ GBOX ] ] <nl> / / CHECK : [ [ CTOR_GEN : % [ 0 - 9 ] + ] ] = function_ref @ _TFC9functions11SomeGenericC { { . * } } : $ @ convention ( method ) < τ_0_0 > ( @ thick SomeGeneric < τ_0_0 > . Type ) - > @ owned SomeGeneric < τ_0_0 > <nl> / / CHECK : [ [ META : % [ 0 - 9 ] + ] ] = metatype $ @ thick SomeGeneric < Builtin . Int64 > . Type <nl> func calls ( _ i : Int , j : Int , k : Int ) { <nl> / / SIL - level " thin " function values need to be able to convert to <nl> / / " thick " function values when stored , returned , or passed as arguments . <nl> <nl> - / / CHECK : [ [ FBOX : % [ 0 - 9 ] + ] ] = alloc_box $ @ callee_owned ( Builtin . Int64 , Builtin . Int64 ) - > Builtin . Int64 <nl> + / / CHECK : [ [ FBOX : % [ 0 - 9 ] + ] ] = alloc_box $ @ box @ callee_owned ( Builtin . Int64 , Builtin . Int64 ) - > Builtin . Int64 <nl> / / CHECK : [ [ FADDR : % . * ] ] = project_box [ [ FBOX ] ] <nl> / / CHECK : [ [ FUNC_THIN : % [ 0 - 9 ] + ] ] = function_ref @ _TF9functions19standalone_function { { . * } } : $ @ convention ( thin ) ( Builtin . Int64 , Builtin . Int64 ) - > Builtin . Int64 <nl> / / CHECK : [ [ FUNC_THICK : % [ 0 - 9 ] + ] ] = thin_to_thick_function [ [ FUNC_THIN ] ] <nl> mmm a / test / SILGen / generic_witness . swift <nl> ppp b / test / SILGen / generic_witness . swift <nl> func foo < B : Runcible > ( _ x : B ) { <nl> / / CHECK - LABEL : sil hidden @ _TF15generic_witness3bar { { . * } } : $ @ convention ( thin ) ( @ in Runcible ) - > ( ) <nl> func bar ( _ x : Runcible ) { <nl> var x = x <nl> - / / CHECK : [ [ BOX : % . * ] ] = alloc_box $ Runcible <nl> + / / CHECK : [ [ BOX : % . * ] ] = alloc_box $ @ box Runcible <nl> / / CHECK : [ [ TEMP : % . * ] ] = alloc_stack $ Runcible <nl> / / CHECK : [ [ EXIST : % . * ] ] = open_existential_addr [ [ TEMP ] ] : $ * Runcible to $ * [ [ OPENED : @ opened ( . * ) Runcible ] ] <nl> / / CHECK : [ [ METHOD : % . * ] ] = witness_method $ [ [ OPENED ] ] , # Runcible . runce ! 1 <nl> mmm a / test / SILGen / guaranteed_closure_context . swift <nl> ppp b / test / SILGen / guaranteed_closure_context . swift <nl> struct S { } <nl> <nl> / / CHECK - LABEL : sil hidden @ _TF26guaranteed_closure_context19guaranteed_capturesFT_T_ <nl> func guaranteed_captures ( ) { <nl> - / / CHECK : [ [ MUTABLE_TRIVIAL_BOX : % . * ] ] = alloc_box $ S <nl> + / / CHECK : [ [ MUTABLE_TRIVIAL_BOX : % . * ] ] = alloc_box $ @ box S <nl> var mutableTrivial = S ( ) <nl> - / / CHECK : [ [ MUTABLE_RETAINABLE_BOX : % . * ] ] = alloc_box $ C <nl> + / / CHECK : [ [ MUTABLE_RETAINABLE_BOX : % . * ] ] = alloc_box $ @ box C <nl> var mutableRetainable = C ( ) <nl> - / / CHECK : [ [ MUTABLE_ADDRESS_ONLY_BOX : % . * ] ] = alloc_box $ P <nl> + / / CHECK : [ [ MUTABLE_ADDRESS_ONLY_BOX : % . * ] ] = alloc_box $ @ box P <nl> var mutableAddressOnly : P = C ( ) <nl> <nl> / / CHECK : [ [ IMMUTABLE_TRIVIAL : % . * ] ] = apply { { . * } } - > S <nl> func guaranteed_captures ( ) { <nl> / / CHECK - NOT : copy_value [ [ MUTABLE_RETAINABLE_BOX ] ] <nl> / / CHECK - NOT : copy_value [ [ MUTABLE_ADDRESS_ONLY_BOX ] ] <nl> / / CHECK - NOT : copy_value [ [ IMMUTABLE_RETAINABLE ] ] <nl> - / / CHECK : [ [ IMMUTABLE_AO_BOX : % . * ] ] = alloc_box $ P <nl> + / / CHECK : [ [ IMMUTABLE_AO_BOX : % . * ] ] = alloc_box $ @ box P <nl> <nl> / / CHECK : [ [ FN : % . * ] ] = function_ref [ [ FN_NAME : @ _TFF26guaranteed_closure_context19guaranteed_capturesFT_T_L_17captureEverythingfT_T_ ] ] <nl> / / CHECK : apply [ [ FN ] ] ( [ [ MUTABLE_TRIVIAL_BOX ] ] , [ [ MUTABLE_RETAINABLE_BOX ] ] , [ [ MUTABLE_ADDRESS_ONLY_BOX ] ] , [ [ IMMUTABLE_TRIVIAL ] ] , [ [ IMMUTABLE_RETAINABLE ] ] , [ [ IMMUTABLE_AO_BOX ] ] ) <nl> func guaranteed_captures ( ) { <nl> / / CHECK : copy_value [ [ MUTABLE_RETAINABLE_BOX ] ] <nl> / / CHECK : copy_value [ [ MUTABLE_ADDRESS_ONLY_BOX ] ] <nl> / / CHECK : copy_value [ [ IMMUTABLE_RETAINABLE ] ] <nl> - / / CHECK : [ [ IMMUTABLE_AO_BOX : % . * ] ] = alloc_box $ P <nl> + / / CHECK : [ [ IMMUTABLE_AO_BOX : % . * ] ] = alloc_box $ @ box P <nl> / / CHECK : [ [ CLOSURE : % . * ] ] = partial_apply { { . * } } ( [ [ MUTABLE_TRIVIAL_BOX ] ] , [ [ MUTABLE_RETAINABLE_BOX ] ] , [ [ MUTABLE_ADDRESS_ONLY_BOX ] ] , [ [ IMMUTABLE_TRIVIAL ] ] , [ [ IMMUTABLE_RETAINABLE ] ] , [ [ IMMUTABLE_AO_BOX ] ] ) <nl> / / CHECK : apply { { . * } } [ [ CLOSURE ] ] <nl> <nl> mmm a / test / SILGen / guaranteed_self . swift <nl> ppp b / test / SILGen / guaranteed_self . swift <nl> class D : C { <nl> <nl> / / CHECK - LABEL : sil hidden @ _TFC15guaranteed_self1Dc { { . * } } : $ @ convention ( method ) ( @ owned D ) - > @ owned D <nl> / / CHECK : bb0 ( [ [ SELF : % . * ] ] : $ D ) : <nl> - / / CHECK : [ [ SELF_BOX : % . * ] ] = alloc_box $ D <nl> + / / CHECK : [ [ SELF_BOX : % . * ] ] = alloc_box $ @ box D <nl> / / CHECK - NEXT : [ [ PB : % . * ] ] = project_box [ [ SELF_BOX ] ] <nl> / / CHECK - NEXT : [ [ SELF_ADDR : % . * ] ] = mark_uninitialized [ derivedself ] [ [ PB ] ] <nl> / / CHECK - NEXT : store [ [ SELF ] ] to [ [ SELF_ADDR ] ] <nl> class LetFieldClass { <nl> / / CHECK : [ [ DESTROY_SHIP_FUN : % . * ] ] = function_ref @ _TF15guaranteed_self11destroyShipFCS_6KrakenT_ : $ @ convention ( thin ) ( @ owned Kraken ) - > ( ) <nl> / / CHECK - NEXT : copy_value [ [ KRAKEN ] ] <nl> / / CHECK - NEXT : apply [ [ DESTROY_SHIP_FUN ] ] ( [ [ KRAKEN ] ] ) <nl> - / / CHECK - NEXT : [ [ KRAKEN_BOX : % . * ] ] = alloc_box $ Kraken <nl> + / / CHECK - NEXT : [ [ KRAKEN_BOX : % . * ] ] = alloc_box $ @ box Kraken <nl> / / CHECK - NEXT : [ [ PB : % . * ] ] = project_box [ [ KRAKEN_BOX ] ] <nl> / / CHECK - NEXT : [ [ KRAKEN_ADDR : % . * ] ] = ref_element_addr [ [ CLS ] ] : $ LetFieldClass , # LetFieldClass . letk <nl> / / CHECK - NEXT : [ [ KRAKEN2 : % . * ] ] = load [ [ KRAKEN_ADDR ] ] <nl> class LetFieldClass { <nl> / / CHECK : [ [ DESTROY_SHIP_FUN : % . * ] ] = function_ref @ _TF15guaranteed_self11destroyShipFCS_6KrakenT_ : $ @ convention ( thin ) ( @ owned Kraken ) - > ( ) <nl> / / CHECK - NEXT : copy_value [ [ KRAKEN ] ] <nl> / / CHECK - NEXT : apply [ [ DESTROY_SHIP_FUN ] ] ( [ [ KRAKEN ] ] ) <nl> - / / CHECK - NEXT : [ [ KRAKEN_BOX : % . * ] ] = alloc_box $ Kraken <nl> + / / CHECK - NEXT : [ [ KRAKEN_BOX : % . * ] ] = alloc_box $ @ box Kraken <nl> / / CHECK - NEXT : [ [ PB : % . * ] ] = project_box [ [ KRAKEN_BOX ] ] <nl> / / CHECK - NEXT : [ [ KRAKEN_GETTER_FUN : % . * ] ] = class_method [ [ CLS ] ] : $ LetFieldClass , # LetFieldClass . vark ! getter . 1 : ( LetFieldClass ) - > ( ) - > Kraken , $ @ convention ( method ) ( @ guaranteed LetFieldClass ) - > @ owned Kraken <nl> / / CHECK - NEXT : [ [ KRAKEN2 : % . * ] ] = apply [ [ KRAKEN_GETTER_FUN ] ] ( [ [ CLS ] ] ) <nl> mmm a / test / SILGen / if_expr . swift <nl> ppp b / test / SILGen / if_expr . swift <nl> func consumeAddressOnly ( _ : AddressOnly ) { } <nl> / / CHECK : sil hidden @ _TF7if_expr19addr_only_ternary_1 <nl> func addr_only_ternary_1 ( x : Bool ) - > AddressOnly { <nl> / / CHECK : bb0 ( [ [ RET : % . * ] ] : $ * AddressOnly , { { . * } } ) : <nl> - / / CHECK : [ [ a : % [ 0 - 9 ] + ] ] = alloc_box $ AddressOnly , var , name " a " <nl> + / / CHECK : [ [ a : % [ 0 - 9 ] + ] ] = alloc_box $ @ box AddressOnly , var , name " a " <nl> / / CHECK : [ [ PBa : % . * ] ] = project_box [ [ a ] ] <nl> var a : AddressOnly = A ( ) <nl> - / / CHECK : [ [ b : % [ 0 - 9 ] + ] ] = alloc_box $ AddressOnly , var , name " b " <nl> + / / CHECK : [ [ b : % [ 0 - 9 ] + ] ] = alloc_box $ @ box AddressOnly , var , name " b " <nl> / / CHECK : [ [ PBb : % . * ] ] = project_box [ [ b ] ] <nl> var b : AddressOnly = B ( ) <nl> <nl> mmm a / test / SILGen / if_while_binding . swift <nl> ppp b / test / SILGen / if_while_binding . swift <nl> func if_else_chain ( ) { <nl> / / CHECK : br [ [ CONT_X : bb [ 0 - 9 ] + ] ] <nl> a ( x ) <nl> / / CHECK : [ [ NOX ] ] : <nl> - / / CHECK : alloc_box $ String , var , name " y " <nl> + / / CHECK : alloc_box $ @ box String , var , name " y " <nl> / / CHECK : switch_enum { { . * } } : $ Optional < String > , case # Optional . some ! enumelt . 1 : [ [ YESY : bb [ 0 - 9 ] + ] ] , default [ [ ELSE1 : bb [ 0 - 9 ] + ] ] <nl> / / CHECK : [ [ ELSE1 ] ] : <nl> / / CHECK : dealloc_box { { . * } } $ @ box String <nl> func if_multi ( ) { <nl> <nl> / / CHECK : [ [ CHECKBUF2 ] ] ( [ [ A : % [ 0 - 9 ] + ] ] : $ String ) : <nl> / / CHECK : debug_value [ [ A ] ] : $ String , let , name " a " <nl> - / / CHECK : [ [ B : % [ 0 - 9 ] + ] ] = alloc_box $ String , var , name " b " <nl> + / / CHECK : [ [ B : % [ 0 - 9 ] + ] ] = alloc_box $ @ box String , var , name " b " <nl> / / CHECK : [ [ PB : % [ 0 - 9 ] + ] ] = project_box [ [ B ] ] <nl> / / CHECK : switch_enum { { . * } } , case # Optional . some ! enumelt . 1 : [ [ IF_BODY : bb . * ] ] , default [ [ IF_EXIT1a : bb [ 0 - 9 ] + ] ] <nl> <nl> func if_multi_else ( ) { <nl> / / CHECK : switch_enum { { . * } } , case # Optional . some ! enumelt . 1 : [ [ CHECKBUF2 : bb . * ] ] , default [ [ ELSE : bb [ 0 - 9 ] + ] ] <nl> / / CHECK : [ [ CHECKBUF2 ] ] ( [ [ A : % [ 0 - 9 ] + ] ] : $ String ) : <nl> / / CHECK : debug_value [ [ A ] ] : $ String , let , name " a " <nl> - / / CHECK : [ [ B : % [ 0 - 9 ] + ] ] = alloc_box $ String , var , name " b " <nl> + / / CHECK : [ [ B : % [ 0 - 9 ] + ] ] = alloc_box $ @ box String , var , name " b " <nl> / / CHECK : [ [ PB : % [ 0 - 9 ] + ] ] = project_box [ [ B ] ] <nl> / / CHECK : switch_enum { { . * } } , case # Optional . some ! enumelt . 1 : [ [ IF_BODY : bb . * ] ] , default [ [ IF_EXIT1a : bb [ 0 - 9 ] + ] ] <nl> <nl> func if_multi_where ( ) { <nl> / / CHECK : switch_enum { { . * } } , case # Optional . some ! enumelt . 1 : [ [ CHECKBUF2 : bb . * ] ] , default [ [ ELSE : bb [ 0 - 9 ] + ] ] <nl> / / CHECK : [ [ CHECKBUF2 ] ] ( [ [ A : % [ 0 - 9 ] + ] ] : $ String ) : <nl> / / CHECK : debug_value [ [ A ] ] : $ String , let , name " a " <nl> - / / CHECK : [ [ BBOX : % [ 0 - 9 ] + ] ] = alloc_box $ String , var , name " b " <nl> + / / CHECK : [ [ BBOX : % [ 0 - 9 ] + ] ] = alloc_box $ @ box String , var , name " b " <nl> / / CHECK : [ [ PB : % [ 0 - 9 ] + ] ] = project_box [ [ BBOX ] ] <nl> / / CHECK : switch_enum { { . * } } , case # Optional . some ! enumelt . 1 : [ [ CHECK_WHERE : bb . * ] ] , default [ [ IF_EXIT1a : bb [ 0 - 9 ] + ] ] <nl> / / CHECK : [ [ IF_EXIT1a ] ] : <nl> mmm a / test / SILGen / implicitly_unwrapped_optional . swift <nl> ppp b / test / SILGen / implicitly_unwrapped_optional . swift <nl> func foo ( f f : ( ( ) - > ( ) ) ! ) { <nl> } <nl> / / CHECK : sil hidden @ { { . * } } foo { { . * } } : $ @ convention ( thin ) ( @ owned Optional < @ callee_owned ( ) - > ( ) > ) - > ( ) { <nl> / / CHECK : bb0 ( [ [ T0 : % . * ] ] : $ Optional < @ callee_owned ( ) - > ( ) > ) : <nl> - / / CHECK : [ [ F : % . * ] ] = alloc_box $ Optional < @ callee_owned ( ) - > ( ) > <nl> + / / CHECK : [ [ F : % . * ] ] = alloc_box $ @ box Optional < @ callee_owned ( ) - > ( ) > <nl> / / CHECK - NEXT : [ [ PF : % . * ] ] = project_box [ [ F ] ] <nl> / / CHECK : store [ [ T0 ] ] to [ init ] [ [ PF ] ] <nl> / / CHECK : [ [ T1 : % . * ] ] = select_enum_addr [ [ PF ] ] <nl> mmm a / test / SILGen / indirect_enum . swift <nl> ppp b / test / SILGen / indirect_enum . swift <nl> func TreeA_cases < T > ( _ t : T , l : TreeA < T > , r : TreeA < T > ) { <nl> let _ = TreeA < T > . Nil <nl> <nl> / / CHECK - NEXT : [ [ METATYPE : % . * ] ] = metatype $ @ thin TreeA < T > . Type <nl> - / / CHECK - NEXT : [ [ BOX : % . * ] ] = alloc_box $ T <nl> + / / CHECK - NEXT : [ [ BOX : % . * ] ] = alloc_box $ @ box T <nl> / / CHECK - NEXT : [ [ PB : % . * ] ] = project_box [ [ BOX ] ] <nl> / / CHECK - NEXT : copy_addr % 0 to [ initialization ] [ [ PB ] ] <nl> / / CHECK - NEXT : [ [ LEAF : % . * ] ] = enum $ TreeA < T > , # TreeA . Leaf ! enumelt . 1 , [ [ BOX ] ] <nl> func TreeA_cases < T > ( _ t : T , l : TreeA < T > , r : TreeA < T > ) { <nl> let _ = TreeA < T > . Leaf ( t ) <nl> <nl> / / CHECK - NEXT : [ [ METATYPE : % . * ] ] = metatype $ @ thin TreeA < T > . Type <nl> - / / CHECK - NEXT : [ [ BOX : % . * ] ] = alloc_box $ ( left : TreeA < T > , right : TreeA < T > ) <nl> + / / CHECK - NEXT : [ [ BOX : % . * ] ] = alloc_box $ @ box ( left : TreeA < T > , right : TreeA < T > ) <nl> / / CHECK - NEXT : [ [ PB : % . * ] ] = project_box [ [ BOX ] ] <nl> / / CHECK - NEXT : [ [ LEFT : % . * ] ] = tuple_element_addr [ [ PB ] ] : $ * ( left : TreeA < T > , right : TreeA < T > ) , 0 <nl> / / CHECK - NEXT : [ [ RIGHT : % . * ] ] = tuple_element_addr [ [ PB ] ] : $ * ( left : TreeA < T > , right : TreeA < T > ) , 1 <nl> func TreeA_cases < T > ( _ t : T , l : TreeA < T > , r : TreeA < T > ) { <nl> func TreeA_reabstract ( _ f : @ escaping ( Int ) - > Int ) { <nl> <nl> / / CHECK : [ [ METATYPE : % . * ] ] = metatype $ @ thin TreeA < ( Int ) - > Int > . Type <nl> - / / CHECK - NEXT : [ [ BOX : % . * ] ] = alloc_box $ @ callee_owned ( @ in Int ) - > @ out Int <nl> + / / CHECK - NEXT : [ [ BOX : % . * ] ] = alloc_box $ @ box @ callee_owned ( @ in Int ) - > @ out Int <nl> / / CHECK - NEXT : [ [ PB : % . * ] ] = project_box [ [ BOX ] ] <nl> / / CHECK - NEXT : copy_value % 0 <nl> / / CHECK : [ [ THUNK : % . * ] ] = function_ref @ _TTRXFo_dSi_dSi_XFo_iSi_iSi_ <nl> func TreeB_cases < T > ( _ t : T , l : TreeB < T > , r : TreeB < T > ) { <nl> let _ = TreeB < T > . Leaf ( t ) <nl> <nl> / / CHECK - NEXT : [ [ METATYPE : % . * ] ] = metatype $ @ thin TreeB < T > . Type <nl> - / / CHECK - NEXT : [ [ BOX : % . * ] ] = alloc_box $ ( left : TreeB < T > , right : TreeB < T > ) <nl> + / / CHECK - NEXT : [ [ BOX : % . * ] ] = alloc_box $ @ box ( left : TreeB < T > , right : TreeB < T > ) <nl> / / CHECK - NEXT : [ [ PB : % . * ] ] = project_box [ [ BOX ] ] <nl> / / CHECK - NEXT : [ [ LEFT : % . * ] ] = tuple_element_addr [ [ PB ] ] <nl> / / CHECK - NEXT : [ [ RIGHT : % . * ] ] = tuple_element_addr [ [ PB ] ] <nl> func TreeInt_cases ( _ t : Int , l : TreeInt , r : TreeInt ) { <nl> let _ = TreeInt . Leaf ( t ) <nl> <nl> / / CHECK - NEXT : [ [ METATYPE : % . * ] ] = metatype $ @ thin TreeInt . Type <nl> - / / CHECK - NEXT : [ [ BOX : % . * ] ] = alloc_box $ ( left : TreeInt , right : TreeInt ) <nl> + / / CHECK - NEXT : [ [ BOX : % . * ] ] = alloc_box $ @ box ( left : TreeInt , right : TreeInt ) <nl> / / CHECK - NEXT : [ [ PB : % . * ] ] = project_box [ [ BOX ] ] <nl> / / CHECK - NEXT : [ [ LEFT : % . * ] ] = tuple_element_addr [ [ PB ] ] <nl> / / CHECK - NEXT : [ [ RIGHT : % . * ] ] = tuple_element_addr [ [ PB ] ] <nl> mmm a / test / SILGen / init_ref_delegation . swift <nl> ppp b / test / SILGen / init_ref_delegation . swift <nl> struct S { <nl> / / CHECK - LABEL : sil hidden @ _TFV19init_ref_delegation1SC { { . * } } : $ @ convention ( method ) ( @ thin S . Type ) - > S { <nl> init ( ) { <nl> / / CHECK : bb0 ( [ [ SELF_META : % [ 0 - 9 ] + ] ] : $ @ thin S . Type ) : <nl> - / / CHECK - NEXT : [ [ SELF_BOX : % [ 0 - 9 ] + ] ] = alloc_box $ S <nl> + / / CHECK - NEXT : [ [ SELF_BOX : % [ 0 - 9 ] + ] ] = alloc_box $ @ box S <nl> / / CHECK - NEXT : [ [ PB : % . * ] ] = project_box [ [ SELF_BOX ] ] <nl> / / CHECK - NEXT : [ [ SELF : % [ 0 - 9 ] + ] ] = mark_uninitialized [ delegatingself ] [ [ PB ] ] : $ * S <nl> <nl> enum E { <nl> / / CHECK - LABEL : sil hidden @ _TFO19init_ref_delegation1EC { { . * } } : $ @ convention ( method ) ( @ thin E . Type ) - > E <nl> init ( ) { <nl> / / CHECK : bb0 ( [ [ E_META : % [ 0 - 9 ] + ] ] : $ @ thin E . Type ) : <nl> - / / CHECK : [ [ E_BOX : % [ 0 - 9 ] + ] ] = alloc_box $ E <nl> + / / CHECK : [ [ E_BOX : % [ 0 - 9 ] + ] ] = alloc_box $ @ box E <nl> / / CHECK : [ [ PB : % . * ] ] = project_box [ [ E_BOX ] ] <nl> / / CHECK : [ [ E_SELF : % [ 0 - 9 ] + ] ] = mark_uninitialized [ delegatingself ] [ [ PB ] ] : $ * E <nl> <nl> struct S2 { <nl> / / CHECK - LABEL : sil hidden @ _TFV19init_ref_delegation2S2C { { . * } } : $ @ convention ( method ) ( @ thin S2 . Type ) - > S2 <nl> init ( ) { <nl> / / CHECK : bb0 ( [ [ S2_META : % [ 0 - 9 ] + ] ] : $ @ thin S2 . Type ) : <nl> - / / CHECK : [ [ SELF_BOX : % [ 0 - 9 ] + ] ] = alloc_box $ S2 <nl> + / / CHECK : [ [ SELF_BOX : % [ 0 - 9 ] + ] ] = alloc_box $ @ box S2 <nl> / / CHECK : [ [ PB : % . * ] ] = project_box [ [ SELF_BOX ] ] <nl> / / CHECK : [ [ SELF : % [ 0 - 9 ] + ] ] = mark_uninitialized [ delegatingself ] [ [ PB ] ] : $ * S2 <nl> <nl> class C1 { <nl> / / CHECK - LABEL : sil hidden @ _TFC19init_ref_delegation2C1c { { . * } } : $ @ convention ( method ) ( X , @ owned C1 ) - > @ owned C1 <nl> convenience init ( x : X ) { <nl> / / CHECK : bb0 ( [ [ X : % [ 0 - 9 ] + ] ] : $ X , [ [ ORIG_SELF : % [ 0 - 9 ] + ] ] : $ C1 ) : <nl> - / / CHECK : [ [ SELF_BOX : % [ 0 - 9 ] + ] ] = alloc_box $ C1 <nl> + / / CHECK : [ [ SELF_BOX : % [ 0 - 9 ] + ] ] = alloc_box $ @ box C1 <nl> / / CHECK : [ [ PB : % . * ] ] = project_box [ [ SELF_BOX ] ] <nl> / / CHECK : [ [ SELF : % [ 0 - 9 ] + ] ] = mark_uninitialized [ delegatingself ] [ [ PB ] ] : $ * C1 <nl> / / CHECK : store [ [ ORIG_SELF ] ] to [ [ SELF ] ] : $ * C1 <nl> class C1 { <nl> / / CHECK - LABEL : sil hidden @ _TFC19init_ref_delegation2C2c { { . * } } : $ @ convention ( method ) ( X , @ owned C2 ) - > @ owned C2 <nl> convenience init ( x : X ) { <nl> / / CHECK : bb0 ( [ [ X : % [ 0 - 9 ] + ] ] : $ X , [ [ ORIG_SELF : % [ 0 - 9 ] + ] ] : $ C2 ) : <nl> - / / CHECK : [ [ SELF_BOX : % [ 0 - 9 ] + ] ] = alloc_box $ C2 <nl> + / / CHECK : [ [ SELF_BOX : % [ 0 - 9 ] + ] ] = alloc_box $ @ box C2 <nl> / / CHECK : [ [ PB : % . * ] ] = project_box [ [ SELF_BOX ] ] <nl> / / CHECK : [ [ UNINIT_SELF : % [ 0 - 9 ] + ] ] = mark_uninitialized [ delegatingself ] [ [ PB ] ] : $ * C2 <nl> / / CHECK : store [ [ ORIG_SELF ] ] to [ [ UNINIT_SELF ] ] : $ * C2 <nl> mmm a / test / SILGen / let_decls . swift <nl> ppp b / test / SILGen / let_decls . swift <nl> struct WeirdPropertyTest { <nl> / / CHECK - LABEL : sil hidden @ { { . * } } test_weird_property <nl> func test_weird_property ( _ v : WeirdPropertyTest , i : Int ) - > Int { <nl> var v = v <nl> - / / CHECK : [ [ VBOX : % [ 0 - 9 ] + ] ] = alloc_box $ WeirdPropertyTest <nl> + / / CHECK : [ [ VBOX : % [ 0 - 9 ] + ] ] = alloc_box $ @ box WeirdPropertyTest <nl> / / CHECK : [ [ PB : % . * ] ] = project_box [ [ VBOX ] ] <nl> / / CHECK : store % 0 to [ trivial ] [ [ PB ] ] <nl> <nl> struct LetPropertyStruct { <nl> <nl> / / CHECK - LABEL : sil hidden @ { { . * } } testLetPropertyAccessOnLValueBase <nl> / / CHECK : bb0 ( % 0 : $ LetPropertyStruct ) : <nl> - / / CHECK : [ [ ABOX : % [ 0 - 9 ] + ] ] = alloc_box $ LetPropertyStruct <nl> + / / CHECK : [ [ ABOX : % [ 0 - 9 ] + ] ] = alloc_box $ @ box LetPropertyStruct <nl> / / CHECK : [ [ A : % [ 0 - 9 ] + ] ] = project_box [ [ ABOX ] ] <nl> / / CHECK : store % 0 to [ trivial ] [ [ A ] ] : $ * LetPropertyStruct <nl> / / CHECK : [ [ STRUCT : % [ 0 - 9 ] + ] ] = load [ [ A ] ] : $ * LetPropertyStruct <nl> mmm a / test / SILGen / lifetime . swift <nl> ppp b / test / SILGen / lifetime . swift <nl> struct Val { <nl> / / CHECK - LABEL : sil hidden @ _TF8lifetime13local_valtypeFT_T_ <nl> func local_valtype ( ) { <nl> var b : Val <nl> - / / CHECK : [ [ B : % [ 0 - 9 ] + ] ] = alloc_box $ Val <nl> + / / CHECK : [ [ B : % [ 0 - 9 ] + ] ] = alloc_box $ @ box Val <nl> / / CHECK : destroy_value [ [ B ] ] <nl> / / CHECK : return <nl> } <nl> func local_valtype ( ) { <nl> / / CHECK - LABEL : sil hidden @ _TF8lifetime20local_valtype_branch <nl> func local_valtype_branch ( _ a : Bool ) { <nl> var a = a <nl> - / / CHECK : [ [ A : % [ 0 - 9 ] + ] ] = alloc_box $ Bool <nl> + / / CHECK : [ [ A : % [ 0 - 9 ] + ] ] = alloc_box $ @ box Bool <nl> <nl> if a { return } <nl> / / CHECK : cond_br <nl> func local_valtype_branch ( _ a : Bool ) { <nl> / / CHECK : br [ [ EPILOG : bb [ 0 - 9 ] + ] ] <nl> <nl> var x : Int <nl> - / / CHECK : [ [ X : % [ 0 - 9 ] + ] ] = alloc_box $ Int <nl> + / / CHECK : [ [ X : % [ 0 - 9 ] + ] ] = alloc_box $ @ box Int <nl> <nl> if a { return } <nl> / / CHECK : cond_br <nl> func local_valtype_branch ( _ a : Bool ) { <nl> / / CHECK : br [ [ EPILOG ] ] <nl> <nl> var y : Int <nl> - / / CHECK : [ [ Y : % [ 0 - 9 ] + ] ] = alloc_box $ Int <nl> + / / CHECK : [ [ Y : % [ 0 - 9 ] + ] ] = alloc_box $ @ box Int <nl> <nl> if a { break } <nl> / / CHECK : cond_br <nl> func local_valtype_branch ( _ a : Bool ) { <nl> <nl> if true { <nl> var z : Int <nl> - / / CHECK : [ [ Z : % [ 0 - 9 ] + ] ] = alloc_box $ Int <nl> + / / CHECK : [ [ Z : % [ 0 - 9 ] + ] ] = alloc_box $ @ box Int <nl> <nl> if a { break } <nl> / / CHECK : cond_br <nl> func reftype_return ( ) - > Ref { <nl> func reftype_arg ( _ a : Ref ) { <nl> var a = a <nl> / / CHECK : bb0 ( [ [ A : % [ 0 - 9 ] + ] ] : $ Ref ) : <nl> - / / CHECK : [ [ AADDR : % [ 0 - 9 ] + ] ] = alloc_box $ Ref <nl> + / / CHECK : [ [ AADDR : % [ 0 - 9 ] + ] ] = alloc_box $ @ box Ref <nl> / / CHECK : [ [ PA : % [ 0 - 9 ] + ] ] = project_box [ [ AADDR ] ] <nl> / / CHECK : store [ [ A ] ] to [ init ] [ [ PA ] ] <nl> / / CHECK : destroy_value [ [ AADDR ] ] <nl> func reftype_call_ignore_return ( ) { <nl> / / CHECK - LABEL : sil hidden @ _TF8lifetime27reftype_call_store_to_localFT_T_ <nl> func reftype_call_store_to_local ( ) { <nl> var a = reftype_func ( ) <nl> - / / CHECK : [ [ A : % [ 0 - 9 ] + ] ] = alloc_box $ Ref <nl> + / / CHECK : [ [ A : % [ 0 - 9 ] + ] ] = alloc_box $ @ box Ref <nl> / / CHECK - NEXT : [ [ PB : % . * ] ] = project_box [ [ A ] ] <nl> / / CHECK : = function_ref @ _TF8lifetime12reftype_funcFT_CS_3Ref : $ @ convention ( thin ) ( ) - > @ owned Ref <nl> / / CHECK - NEXT : [ [ R : % [ 0 - 9 ] + ] ] = apply <nl> func reftype_call_arg ( ) { <nl> func reftype_call_with_arg ( _ a : Ref ) { <nl> var a = a <nl> / / CHECK : bb0 ( [ [ A1 : % [ 0 - 9 ] + ] ] : $ Ref ) : <nl> - / / CHECK : [ [ AADDR : % [ 0 - 9 ] + ] ] = alloc_box $ Ref <nl> + / / CHECK : [ [ AADDR : % [ 0 - 9 ] + ] ] = alloc_box $ @ box Ref <nl> / / CHECK : [ [ PB : % . * ] ] = project_box [ [ AADDR ] ] <nl> / / CHECK : store [ [ A1 ] ] to [ init ] [ [ PB ] ] <nl> <nl> func reftype_call_with_arg ( _ a : Ref ) { <nl> func reftype_reassign ( _ a : inout Ref , b : Ref ) { <nl> var b = b <nl> / / CHECK : bb0 ( [ [ AADDR : % [ 0 - 9 ] + ] ] : $ * Ref , [ [ B1 : % [ 0 - 9 ] + ] ] : $ Ref ) : <nl> - / / CHECK : [ [ BADDR : % [ 0 - 9 ] + ] ] = alloc_box $ Ref <nl> + / / CHECK : [ [ BADDR : % [ 0 - 9 ] + ] ] = alloc_box $ @ box Ref <nl> / / CHECK : [ [ PBB : % . * ] ] = project_box [ [ BADDR ] ] <nl> a = b <nl> / / CHECK : destroy_value <nl> func logical_lvalue_lifetime ( _ r : RefWithProp , _ i : Int , _ v : Val ) { <nl> var r = r <nl> var i = i <nl> var v = v <nl> - / / CHECK : [ [ RADDR : % [ 0 - 9 ] + ] ] = alloc_box $ RefWithProp <nl> + / / CHECK : [ [ RADDR : % [ 0 - 9 ] + ] ] = alloc_box $ @ box RefWithProp <nl> / / CHECK : [ [ PR : % [ 0 - 9 ] + ] ] = project_box [ [ RADDR ] ] <nl> - / / CHECK : [ [ IADDR : % [ 0 - 9 ] + ] ] = alloc_box $ Int <nl> + / / CHECK : [ [ IADDR : % [ 0 - 9 ] + ] ] = alloc_box $ @ box Int <nl> / / CHECK : [ [ PI : % [ 0 - 9 ] + ] ] = project_box [ [ IADDR ] ] <nl> / / CHECK : store % 1 to [ trivial ] [ [ PI ] ] <nl> - / / CHECK : [ [ VADDR : % [ 0 - 9 ] + ] ] = alloc_box $ Val <nl> + / / CHECK : [ [ VADDR : % [ 0 - 9 ] + ] ] = alloc_box $ @ box Val <nl> / / CHECK : [ [ PV : % [ 0 - 9 ] + ] ] = project_box [ [ VADDR ] ] <nl> <nl> / / - - Reference types need to be copy_valued as property method args . <nl> class Foo < T > { <nl> / / CHECK - LABEL : sil hidden @ _TFC8lifetime3FoocfT3chiSi_GS0_x_ <nl> / / CHECK : bb0 ( [ [ CHI : % [ 0 - 9 ] + ] ] : $ Int , [ [ THISIN : % [ 0 - 9 ] + ] ] : $ Foo < T > ) : <nl> / / CHECK : [ [ THIS : % [ 0 - 9 ] + ] ] = mark_uninitialized <nl> - / / CHECK : [ [ CHIADDR : % [ 0 - 9 ] + ] ] = alloc_box $ Int <nl> + / / CHECK : [ [ CHIADDR : % [ 0 - 9 ] + ] ] = alloc_box $ @ box Int <nl> / / CHECK : [ [ PCHI : % [ 0 - 9 ] + ] ] = project_box [ [ CHIADDR ] ] <nl> / / CHECK : store [ [ CHI ] ] to [ trivial ] [ [ PCHI ] ] <nl> <nl> struct Bar { <nl> / / CHECK - LABEL : sil hidden @ _TFV8lifetime3BarC { { . * } } <nl> init ( ) { <nl> / / CHECK : bb0 ( [ [ METATYPE : % [ 0 - 9 ] + ] ] : $ @ thin Bar . Type ) : <nl> - / / CHECK : [ [ THISADDRBOX : % [ 0 - 9 ] + ] ] = alloc_box $ Bar <nl> + / / CHECK : [ [ THISADDRBOX : % [ 0 - 9 ] + ] ] = alloc_box $ @ box Bar <nl> / / CHECK : [ [ PB : % . * ] ] = project_box [ [ THISADDRBOX ] ] <nl> / / CHECK : [ [ THISADDR : % [ 0 - 9 ] + ] ] = mark_uninitialized [ rootself ] [ [ PB ] ] <nl> <nl> struct Bas < T > { <nl> init ( yy : T ) { <nl> / / CHECK : bb0 ( [ [ THISADDRPTR : % [ 0 - 9 ] + ] ] : $ * Bas < T > , [ [ YYADDR : % [ 0 - 9 ] + ] ] : $ * T , [ [ META : % [ 0 - 9 ] + ] ] : $ @ thin Bas < T > . Type ) : <nl> / / CHECK : alloc_box <nl> - / / CHECK : [ [ THISADDRBOX : % [ 0 - 9 ] + ] ] = alloc_box $ Bas <nl> + / / CHECK : [ [ THISADDRBOX : % [ 0 - 9 ] + ] ] = alloc_box $ @ box Bas <nl> / / CHECK : [ [ PB : % . * ] ] = project_box [ [ THISADDRBOX ] ] <nl> / / CHECK : [ [ THISADDR : % [ 0 - 9 ] + ] ] = mark_uninitialized [ rootself ] [ [ PB ] ] <nl> <nl> class D : B { <nl> init ( x : Int , y : Int ) { <nl> var x = x <nl> var y = y <nl> - / / CHECK : [ [ THISADDR1 : % [ 0 - 9 ] + ] ] = alloc_box $ D <nl> + / / CHECK : [ [ THISADDR1 : % [ 0 - 9 ] + ] ] = alloc_box $ @ box D <nl> / / CHECK : [ [ PTHIS : % [ 0 - 9 ] + ] ] = project_box [ [ THISADDR1 ] ] <nl> / / CHECK : [ [ THISADDR : % [ 0 - 9 ] + ] ] = mark_uninitialized [ derivedself ] [ [ PTHIS ] ] <nl> / / CHECK : store [ [ THIS ] ] to [ [ THISADDR ] ] <nl> - / / CHECK : [ [ XADDR : % [ 0 - 9 ] + ] ] = alloc_box $ Int <nl> + / / CHECK : [ [ XADDR : % [ 0 - 9 ] + ] ] = alloc_box $ @ box Int <nl> / / CHECK : [ [ PX : % [ 0 - 9 ] + ] ] = project_box [ [ XADDR ] ] <nl> / / CHECK : store [ [ X ] ] to [ trivial ] [ [ PX ] ] <nl> - / / CHECK : [ [ YADDR : % [ 0 - 9 ] + ] ] = alloc_box $ Int <nl> + / / CHECK : [ [ YADDR : % [ 0 - 9 ] + ] ] = alloc_box $ @ box Int <nl> / / CHECK : [ [ PY : % [ 0 - 9 ] + ] ] = project_box [ [ YADDR ] ] <nl> / / CHECK : store [ [ Y ] ] to [ trivial ] [ [ PY ] ] <nl> <nl> class D : B { <nl> / / CHECK - LABEL : sil hidden @ _TF8lifetime8downcast <nl> func downcast ( _ b : B ) { <nl> var b = b <nl> - / / CHECK : [ [ BADDR : % [ 0 - 9 ] + ] ] = alloc_box $ B <nl> + / / CHECK : [ [ BADDR : % [ 0 - 9 ] + ] ] = alloc_box $ @ box B <nl> / / CHECK : [ [ PB : % [ 0 - 9 ] + ] ] = project_box [ [ BADDR ] ] <nl> ( b as ! D ) . foo ( ) <nl> / / CHECK : [ [ B : % [ 0 - 9 ] + ] ] = load [ [ PB ] ] <nl> mmm a / test / SILGen / metatype_abstraction . swift <nl> ppp b / test / SILGen / metatype_abstraction . swift <nl> func genericMetatypeFromGenericMetatype < T > ( _ x : GenericMetatype < T > ) - > T . Type { <nl> return x . value <nl> } <nl> / / CHECK - LABEL : sil hidden @ _TFs34dynamicMetatypeFromGenericMetatypeFGVs15GenericMetatypeCs1C_MS0_ <nl> - / / CHECK : [ [ XBOX : % [ 0 - 9 ] + ] ] = alloc_box $ GenericMetatype < C > <nl> + / / CHECK : [ [ XBOX : % [ 0 - 9 ] + ] ] = alloc_box $ @ box GenericMetatype < C > <nl> / / CHECK : [ [ PX : % [ 0 - 9 ] + ] ] = project_box [ [ XBOX ] ] <nl> / / CHECK : [ [ ADDR : % . * ] ] = struct_element_addr [ [ PX ] ] : $ * GenericMetatype < C > , # GenericMetatype . value <nl> / / CHECK : [ [ META : % . * ] ] = load [ [ ADDR ] ] : $ * @ thick C . Type <nl> func dynamicMetatypeToGeneric ( _ x : C . Type ) { <nl> takeGeneric ( x ) <nl> } <nl> / / CHECK - LABEL : sil hidden @ _TFs32dynamicMetatypeToGenericMetatypeFMCs1CT_ <nl> - / / CHECK : [ [ XBOX : % [ 0 - 9 ] + ] ] = alloc_box $ @ thick C . Type <nl> + / / CHECK : [ [ XBOX : % [ 0 - 9 ] + ] ] = alloc_box $ @ box ( @ thick C . Type ) <nl> / / CHECK : [ [ PX : % [ 0 - 9 ] + ] ] = project_box [ [ XBOX ] ] <nl> / / CHECK : [ [ META : % . * ] ] = load [ [ PX ] ] : $ * @ thick C . Type <nl> / / CHECK : apply { { % . * } } < C > ( [ [ META ] ] ) : $ @ convention ( thin ) < τ_0_0 > ( @ thick τ_0_0 . Type ) - > ( ) <nl> mmm a / test / SILGen / newtype . swift <nl> ppp b / test / SILGen / newtype . swift <nl> func createErrorDomain ( str : String ) - > ErrorDomain { <nl> <nl> / / CHECK - RAW - LABEL : sil shared [ transparent ] [ fragile ] @ _TFVSC11ErrorDomainCfT8rawValueSS_S_ <nl> / / CHECK - RAW : bb0 ( [ [ STR : % [ 0 - 9 ] + ] ] : $ String , <nl> - / / CHECK - RAW : [ [ SELF_BOX : % [ 0 - 9 ] + ] ] = alloc_box $ ErrorDomain , var , name " self " <nl> + / / CHECK - RAW : [ [ SELF_BOX : % [ 0 - 9 ] + ] ] = alloc_box $ @ box ErrorDomain , var , name " self " <nl> / / CHECK - RAW : [ [ SELF : % [ 0 - 9 ] + ] ] = project_box [ [ SELF_BOX ] ] <nl> / / CHECK - RAW : [ [ UNINIT_SELF : % [ 0 - 9 ] + ] ] = mark_uninitialized [ rootself ] [ [ SELF ] ] <nl> / / CHECK - RAW : [ [ BRIDGE_FN : % [ 0 - 9 ] + ] ] = function_ref @ { { . * } } _bridgeToObjectiveC <nl> mmm a / test / SILGen / objc_init_ref_delegation . swift <nl> ppp b / test / SILGen / objc_init_ref_delegation . swift <nl> extension Gizmo { <nl> / / CHECK - LABEL : sil hidden @ _TFE24objc_init_ref_delegationCSo5Gizmoc <nl> convenience init ( int i : Int ) { <nl> / / CHECK : bb0 ( [ [ I : % [ 0 - 9 ] + ] ] : $ Int , [ [ ORIG_SELF : % [ 0 - 9 ] + ] ] : $ Gizmo ) : <nl> - / / CHECK : [ [ SELF_BOX : % [ 0 - 9 ] + ] ] = alloc_box $ Gizmo <nl> + / / CHECK : [ [ SELF_BOX : % [ 0 - 9 ] + ] ] = alloc_box $ @ box Gizmo <nl> / / CHECK : [ [ PB : % . * ] ] = project_box [ [ SELF_BOX ] ] <nl> / / CHECK : [ [ SELFMUI : % [ 0 - 9 ] + ] ] = mark_uninitialized [ delegatingself ] [ [ PB ] ] : $ * Gizmo <nl> / / CHECK : store [ [ ORIG_SELF ] ] to [ [ SELFMUI ] ] : $ * Gizmo <nl> mmm a / test / SILGen / objc_protocols . swift <nl> ppp b / test / SILGen / objc_protocols . swift <nl> extension InformallyFunging : NSFunging { } <nl> / / CHECK - LABEL : sil hidden @ _TF14objc_protocols28testInitializableExistential <nl> func testInitializableExistential ( _ im : Initializable . Type , i : Int ) - > Initializable { <nl> / / CHECK : bb0 ( [ [ META : % [ 0 - 9 ] + ] ] : $ @ thick Initializable . Type , [ [ I : % [ 0 - 9 ] + ] ] : $ Int ) : <nl> - / / CHECK : [ [ I2_BOX : % [ 0 - 9 ] + ] ] = alloc_box $ Initializable <nl> + / / CHECK : [ [ I2_BOX : % [ 0 - 9 ] + ] ] = alloc_box $ @ box Initializable <nl> / / CHECK : [ [ PB : % . * ] ] = project_box [ [ I2_BOX ] ] <nl> / / CHECK : [ [ ARCHETYPE_META : % [ 0 - 9 ] + ] ] = open_existential_metatype [ [ META ] ] : $ @ thick Initializable . Type to $ @ thick ( @ opened ( [ [ N : " . * " ] ] ) Initializable ) . Type <nl> / / CHECK : [ [ ARCHETYPE_META_OBJC : % [ 0 - 9 ] + ] ] = thick_to_objc_metatype [ [ ARCHETYPE_META ] ] : $ @ thick ( @ opened ( [ [ N ] ] ) Initializable ) . Type to $ @ objc_metatype ( @ opened ( [ [ N ] ] ) Initializable ) . Type <nl> mmm a / test / SILGen / objc_thunks . swift <nl> ppp b / test / SILGen / objc_thunks . swift <nl> class Hoozit : Gizmo { <nl> <nl> / / Constructor . <nl> / / CHECK - LABEL : sil hidden @ _TFC11objc_thunks6Hoozitc { { . * } } : $ @ convention ( method ) ( Int , @ owned Hoozit ) - > @ owned Hoozit { <nl> - / / CHECK : [ [ SELF_BOX : % [ 0 - 9 ] + ] ] = alloc_box $ Hoozit <nl> + / / CHECK : [ [ SELF_BOX : % [ 0 - 9 ] + ] ] = alloc_box $ @ box Hoozit <nl> / / CHECK : [ [ PB : % . * ] ] = project_box [ [ SELF_BOX ] ] <nl> / / CHECK : [ [ SELFMUI : % [ 0 - 9 ] + ] ] = mark_uninitialized [ derivedself ] [ [ PB ] ] <nl> / / CHECK : [ [ GIZMO : % [ 0 - 9 ] + ] ] = upcast [ [ SELF : % [ 0 - 9 ] + ] ] : $ Hoozit to $ Gizmo <nl> extension Hoozit { <nl> <nl> / / CHECK - LABEL : sil hidden @ _TFC11objc_thunks6Hoozitc { { . * } } : $ @ convention ( method ) ( Double , @ owned Hoozit ) - > @ owned Hoozit <nl> convenience init ( double d : Double ) { <nl> - / / CHECK : [ [ SELF_BOX : % [ 0 - 9 ] + ] ] = alloc_box $ Hoozit <nl> + / / CHECK : [ [ SELF_BOX : % [ 0 - 9 ] + ] ] = alloc_box $ @ box Hoozit <nl> / / CHECK : [ [ PB : % . * ] ] = project_box [ [ SELF_BOX ] ] <nl> / / CHECK : [ [ SELFMUI : % [ 0 - 9 ] + ] ] = mark_uninitialized [ delegatingself ] [ [ PB ] ] <nl> - / / CHECK : [ [ X_BOX : % [ 0 - 9 ] + ] ] = alloc_box $ X <nl> + / / CHECK : [ [ X_BOX : % [ 0 - 9 ] + ] ] = alloc_box $ @ box X <nl> var x = X ( ) <nl> / / CHECK : [ [ CTOR : % [ 0 - 9 ] + ] ] = class_method [ volatile ] [ [ SELF : % [ 0 - 9 ] + ] ] : $ Hoozit , # Hoozit . init ! initializer . 1 . foreign : ( Hoozit . Type ) - > ( Int ) - > Hoozit , $ @ convention ( objc_method ) ( Int , @ owned Hoozit ) - > @ owned Hoozit <nl> / / CHECK : [ [ NEW_SELF : % [ 0 - 9 ] + ] ] = apply [ [ CTOR ] ] <nl> mmm a / test / SILGen / optional - cast . swift <nl> ppp b / test / SILGen / optional - cast . swift <nl> class B : A { } <nl> <nl> <nl> / / CHECK - LABEL : sil hidden @ _TF4main3foo <nl> - / / CHECK : [ [ X : % . * ] ] = alloc_box $ Optional < B > , var , name " x " <nl> + / / CHECK : [ [ X : % . * ] ] = alloc_box $ @ box Optional < B > , var , name " x " <nl> / / CHECK - NEXT : [ [ PB : % . * ] ] = project_box [ [ X ] ] <nl> / / Check whether the temporary holds a value . <nl> / / CHECK : [ [ T1 : % . * ] ] = select_enum % 0 <nl> func foo ( _ y : A ? ) { <nl> } <nl> <nl> / / CHECK - LABEL : sil hidden @ _TF4main3bar <nl> - / / CHECK : [ [ X : % . * ] ] = alloc_box $ Optional < Optional < Optional < B > > > , var , name " x " <nl> + / / CHECK : [ [ X : % . * ] ] = alloc_box $ @ box Optional < Optional < Optional < B > > > , var , name " x " <nl> / / CHECK - NEXT : [ [ PB : % . * ] ] = project_box [ [ X ] ] <nl> <nl> / / Check for some ( . . . ) <nl> func bar ( _ y : A ? ? ? ? ) { <nl> } <nl> <nl> / / CHECK - LABEL : sil hidden @ _TF4main3baz <nl> - / / CHECK : [ [ X : % . * ] ] = alloc_box $ Optional < B > , var , name " x " <nl> + / / CHECK : [ [ X : % . * ] ] = alloc_box $ @ box Optional < B > , var , name " x " <nl> / / CHECK - NEXT : [ [ PB : % . * ] ] = project_box [ [ X ] ] <nl> / / CHECK - NEXT : copy_value % 0 <nl> / / CHECK : [ [ T1 : % . * ] ] = select_enum % 0 <nl> public struct TestAddressOnlyStruct < T > { <nl> / / CHECK - LABEL : sil hidden @ _TF4main35testContextualInitOfNonAddrOnlyTypeFGSqSi_T_ <nl> / / CHECK : bb0 ( % 0 : $ Optional < Int > ) : <nl> / / CHECK - NEXT : debug_value % 0 : $ Optional < Int > , let , name " a " <nl> - / / CHECK - NEXT : [ [ X : % . * ] ] = alloc_box $ Optional < Int > , var , name " x " <nl> + / / CHECK - NEXT : [ [ X : % . * ] ] = alloc_box $ @ box Optional < Int > , var , name " x " <nl> / / CHECK - NEXT : [ [ PB : % . * ] ] = project_box [ [ X ] ] <nl> / / CHECK - NEXT : [ [ CAST : % . * ] ] = unchecked_addr_cast [ [ PB ] ] : $ * Optional < Int > to $ * Optional < Int > <nl> / / CHECK - NEXT : store % 0 to [ trivial ] [ [ CAST ] ] : $ * Optional < Int > <nl> mmm a / test / SILGen / optional . swift <nl> ppp b / test / SILGen / optional . swift <nl> func testAddrOnlyCallResult < T > ( _ f : ( ( ) - > T ) ? ) { <nl> } <nl> / / CHECK - LABEL : sil hidden @ { { . * } } testAddrOnlyCallResult { { . * } } : $ @ convention ( thin ) < T > ( @ owned Optional < @ callee_owned ( ) - > @ out T > ) - > ( ) <nl> / / CHECK : bb0 ( [ [ T0 : % . * ] ] : $ Optional < @ callee_owned ( ) - > @ out T > ) : <nl> - / / CHECK : [ [ F : % . * ] ] = alloc_box $ Optional < @ callee_owned ( ) - > @ out T > , var , name " f " <nl> + / / CHECK : [ [ F : % . * ] ] = alloc_box $ @ box Optional < @ callee_owned ( ) - > @ out T > , var , name " f " <nl> / / CHECK - NEXT : [ [ PBF : % . * ] ] = project_box [ [ F ] ] <nl> / / CHECK : store [ [ T0 ] ] to [ init ] [ [ PBF ] ] <nl> - / / CHECK - NEXT : [ [ X : % . * ] ] = alloc_box $ Optional < T > , var , name " x " <nl> + / / CHECK - NEXT : [ [ X : % . * ] ] = alloc_box $ @ box Optional < T > , var , name " x " <nl> / / CHECK - NEXT : [ [ PBX : % . * ] ] = project_box [ [ X ] ] <nl> / / CHECK - NEXT : [ [ TEMP : % . * ] ] = init_enum_data_addr [ [ PBX ] ] <nl> / / Check whether ' f ' holds a value . <nl> mmm a / test / SILGen / pointer_conversion . swift <nl> ppp b / test / SILGen / pointer_conversion . swift <nl> func stringToPointer ( _ s : String ) { <nl> / / CHECK - LABEL : sil hidden @ _TF18pointer_conversion14inoutToPointerFT_T_ <nl> func inoutToPointer ( ) { <nl> var int = 0 <nl> - / / CHECK : [ [ INT : % . * ] ] = alloc_box $ Int <nl> + / / CHECK : [ [ INT : % . * ] ] = alloc_box $ @ box Int <nl> / / CHECK : [ [ PB : % . * ] ] = project_box [ [ INT ] ] <nl> takesMutablePointer ( & int ) <nl> / / CHECK : [ [ TAKES_MUTABLE : % . * ] ] = function_ref @ _TF18pointer_conversion19takesMutablePointer <nl> func takesPlusZeroOptionalPointer ( _ x : AutoreleasingUnsafeMutablePointer < C ? > ) { } <nl> / / CHECK - LABEL : sil hidden @ _TF18pointer_conversion19classInoutToPointerFT_T_ <nl> func classInoutToPointer ( ) { <nl> var c = C ( ) <nl> - / / CHECK : [ [ VAR : % . * ] ] = alloc_box $ C <nl> + / / CHECK : [ [ VAR : % . * ] ] = alloc_box $ @ box C <nl> / / CHECK : [ [ PB : % . * ] ] = project_box [ [ VAR ] ] <nl> takesPlusOnePointer ( & c ) <nl> / / CHECK : [ [ TAKES_PLUS_ONE : % . * ] ] = function_ref @ _TF18pointer_conversion19takesPlusOnePointer <nl> func classInoutToPointer ( ) { <nl> / / rdar : / / problem / 21505805 <nl> / / CHECK - LABEL : sil hidden @ _TF18pointer_conversion22functionInoutToPointerFT_T_ <nl> func functionInoutToPointer ( ) { <nl> - / / CHECK : [ [ BOX : % . * ] ] = alloc_box $ @ callee_owned ( ) - > ( ) <nl> + / / CHECK : [ [ BOX : % . * ] ] = alloc_box $ @ box @ callee_owned ( ) - > ( ) <nl> var f : ( ) - > ( ) = { } <nl> <nl> / / CHECK : [ [ REABSTRACT_BUF : % . * ] ] = alloc_stack $ @ callee_owned ( @ in ( ) ) - > @ out ( ) <nl> mmm a / test / SILGen / properties . swift <nl> ppp b / test / SILGen / properties . swift <nl> func getInt ( ) - > Int { return zero } <nl> / / CHECK : bb0 ( % 0 : $ Int ) : <nl> func physical_tuple_lvalue ( _ c : Int ) { <nl> var x : ( Int , Int ) <nl> - / / CHECK : [ [ BOX : % [ 0 - 9 ] + ] ] = alloc_box $ ( Int , Int ) <nl> + / / CHECK : [ [ BOX : % [ 0 - 9 ] + ] ] = alloc_box $ @ box ( Int , Int ) <nl> / / CHECK : [ [ XADDR1 : % . * ] ] = project_box [ [ BOX ] ] <nl> / / CHECK : [ [ XADDR : % [ 0 - 9 ] + ] ] = mark_uninitialized [ var ] [ [ XADDR1 ] ] <nl> x . 1 = c <nl> struct Val { <nl> / / CHECK - LABEL : sil hidden @ _TF10properties22physical_struct_lvalue <nl> func physical_struct_lvalue ( _ c : Int ) { <nl> var v : Val <nl> - / / CHECK : [ [ VADDR : % [ 0 - 9 ] + ] ] = alloc_box $ Val <nl> + / / CHECK : [ [ VADDR : % [ 0 - 9 ] + ] ] = alloc_box $ @ box Val <nl> v . y = c <nl> / / CHECK : assign % 0 to [ [ X_1 ] ] <nl> } <nl> func inout_arg ( _ x : inout Int ) { } <nl> / / CHECK - LABEL : sil hidden @ _TF10properties14physical_inout <nl> func physical_inout ( _ x : Int ) { <nl> var x = x <nl> - / / CHECK : [ [ XADDR : % [ 0 - 9 ] + ] ] = alloc_box $ Int <nl> + / / CHECK : [ [ XADDR : % [ 0 - 9 ] + ] ] = alloc_box $ @ box Int <nl> / / CHECK : [ [ PB : % . * ] ] = project_box [ [ XADDR ] ] <nl> inout_arg ( & x ) <nl> / / CHECK : [ [ INOUT_ARG : % [ 0 - 9 ] + ] ] = function_ref @ _TF10properties9inout_arg <nl> func val_subscript_get ( _ v : Val , i : Int ) - > Float { <nl> func val_subscript_set ( _ v : Val , i : Int , x : Float ) { <nl> var v = v <nl> v [ i ] = x <nl> - / / CHECK : [ [ VADDR : % [ 0 - 9 ] + ] ] = alloc_box $ Val <nl> + / / CHECK : [ [ VADDR : % [ 0 - 9 ] + ] ] = alloc_box $ @ box Val <nl> / / CHECK : [ [ PB : % . * ] ] = project_box [ [ VADDR ] ] <nl> / / CHECK : [ [ SUBSCRIPT_SET_METHOD : % [ 0 - 9 ] + ] ] = function_ref @ _TFV10properties3Vals9subscript <nl> / / CHECK : apply [ [ SUBSCRIPT_SET_METHOD ] ] ( [ [ X ] ] , [ [ I ] ] , [ [ PB ] ] ) <nl> func local_observing_property ( _ arg : Int ) { <nl> <nl> / / CHECK - LABEL : sil hidden @ { { . * } } local_observing_property <nl> / / CHECK : bb0 ( [ [ ARG : % [ 0 - 9 ] + ] ] : $ Int ) <nl> - / / CHECK : [ [ BOX : % [ 0 - 9 ] + ] ] = alloc_box $ Int <nl> + / / CHECK : [ [ BOX : % [ 0 - 9 ] + ] ] = alloc_box $ @ box Int <nl> / / CHECK : [ [ PB : % . * ] ] = project_box [ [ BOX ] ] <nl> / / CHECK : store [ [ ARG ] ] to [ trivial ] [ [ PB ] ] <nl> <nl> struct AddressOnlyReadOnlySubscript { <nl> } <nl> <nl> / / CHECK - LABEL : sil hidden @ _TF10properties43addressOnlyReadOnlySubscriptFromMutableBase <nl> - / / CHECK : [ [ BASE : % . * ] ] = alloc_box $ AddressOnlyReadOnlySubscript <nl> + / / CHECK : [ [ BASE : % . * ] ] = alloc_box $ @ box AddressOnlyReadOnlySubscript <nl> / / CHECK : copy_addr [ [ BASE : % . * ] ] to [ initialization ] [ [ COPY : % . * ] ] : <nl> / / CHECK : [ [ GETTER : % . * ] ] = function_ref @ _TFV10properties28AddressOnlyReadOnlySubscriptg9subscript <nl> / / CHECK : apply [ [ GETTER ] ] ( { { % . * } } , [ [ COPY ] ] ) <nl> struct MutatingGetterStruct { <nl> } <nl> <nl> / / CHECK - LABEL : sil hidden @ _TZFV10properties20MutatingGetterStruct4test <nl> - / / CHECK : [ [ X : % . * ] ] = alloc_box $ MutatingGetterStruct , var , name " x " <nl> + / / CHECK : [ [ X : % . * ] ] = alloc_box $ @ box MutatingGetterStruct , var , name " x " <nl> / / CHECK - NEXT : [ [ PB : % . * ] ] = project_box [ [ X ] ] <nl> / / CHECK : store { { . * } } to [ trivial ] [ [ PB ] ] : $ * MutatingGetterStruct <nl> / / CHECK : apply { { % . * } } ( [ [ PB ] ] ) : $ @ convention ( method ) ( @ inout MutatingGetterStruct ) - > Int <nl> mmm a / test / SILGen / protocol_class_refinement . swift <nl> ppp b / test / SILGen / protocol_class_refinement . swift <nl> class Base { } <nl> / / CHECK - LABEL : sil hidden @ _TF25protocol_class_refinement12getObjectUID <nl> func getObjectUID < T : ObjectUID > ( x : T ) - > ( Int , Int , Int , Int ) { <nl> var x = x <nl> - / / CHECK : [ [ XBOX : % . * ] ] = alloc_box $ T <nl> + / / CHECK : [ [ XBOX : % . * ] ] = alloc_box $ @ box T <nl> / / CHECK : [ [ PB : % . * ] ] = project_box [ [ XBOX ] ] <nl> / / - - call x . uid ( ) <nl> / / CHECK : [ [ X : % . * ] ] = load [ [ PB ] ] <nl> func getObjectUID < T : ObjectUID > ( x : T ) - > ( Int , Int , Int , Int ) { <nl> / / CHECK - LABEL : sil hidden @ _TF25protocol_class_refinement16getBaseObjectUID <nl> func getBaseObjectUID < T : UID where T : Base > ( x : T ) - > ( Int , Int , Int ) { <nl> var x = x <nl> - / / CHECK : [ [ XBOX : % . * ] ] = alloc_box $ T <nl> + / / CHECK : [ [ XBOX : % . * ] ] = alloc_box $ @ box T <nl> / / CHECK : [ [ PB : % . * ] ] = project_box [ [ XBOX ] ] <nl> / / - - call x . uid ( ) <nl> / / CHECK : [ [ X : % . * ] ] = load [ [ PB ] ] <nl> mmm a / test / SILGen / protocol_extensions . swift <nl> ppp b / test / SILGen / protocol_extensions . swift <nl> func inout_func ( _ n : inout Int ) { } <nl> / / CHECK - LABEL : sil hidden @ _TF19protocol_extensions5testDFTVS_10MetaHolder2ddMCS_1D1dS1__T_ : $ @ convention ( thin ) ( MetaHolder , @ thick D . Type , @ owned D ) - > ( ) <nl> / / CHECK : bb0 ( [ [ M : % [ 0 - 9 ] + ] ] : $ MetaHolder , [ [ DD : % [ 0 - 9 ] + ] ] : $ @ thick D . Type , [ [ D : % [ 0 - 9 ] + ] ] : $ D ) : <nl> func testD ( _ m : MetaHolder , dd : D . Type , d : D ) { <nl> - / / CHECK : [ [ D2 : % [ 0 - 9 ] + ] ] = alloc_box $ D <nl> + / / CHECK : [ [ D2 : % [ 0 - 9 ] + ] ] = alloc_box $ @ box D <nl> / / CHECK : [ [ RESULT : % . * ] ] = project_box [ [ D2 ] ] <nl> / / CHECK : [ [ FN : % [ 0 - 9 ] + ] ] = function_ref @ _TFE19protocol_extensionsPS_2P111returnsSelf { { . * } } <nl> / / CHECK : [ [ DCOPY : % [ 0 - 9 ] + ] ] = alloc_stack $ D <nl> func testExistentials1 ( _ p1 : P1 , b : Bool , i : Int64 ) { <nl> / / CHECK - LABEL : sil hidden @ _TF19protocol_extensions17testExistentials2 <nl> / / CHECK : bb0 ( [ [ P : % [ 0 - 9 ] + ] ] : $ * P1 ) : <nl> func testExistentials2 ( _ p1 : P1 ) { <nl> - / / CHECK : [ [ P1A : % [ 0 - 9 ] + ] ] = alloc_box $ P1 <nl> + / / CHECK : [ [ P1A : % [ 0 - 9 ] + ] ] = alloc_box $ @ box P1 <nl> / / CHECK : [ [ PB : % . * ] ] = project_box [ [ P1A ] ] <nl> / / CHECK : [ [ POPENED : % [ 0 - 9 ] + ] ] = open_existential_addr [ [ P ] ] : $ * P1 to $ * @ opened ( [ [ UUID : " . * " ] ] ) P1 <nl> / / CHECK : [ [ P1AINIT : % [ 0 - 9 ] + ] ] = init_existential_addr [ [ PB ] ] : $ * P1 , $ @ opened ( [ [ UUID2 : " . * " ] ] ) P1 <nl> func testExistentialsGetters ( _ p1 : P1 ) { <nl> / / CHECK : bb0 ( [ [ P : % [ 0 - 9 ] + ] ] : $ * P1 , [ [ B : % [ 0 - 9 ] + ] ] : $ Bool ) : <nl> func testExistentialSetters ( _ p1 : P1 , b : Bool ) { <nl> var p1 = p1 <nl> - / / CHECK : [ [ PBOX : % [ 0 - 9 ] + ] ] = alloc_box $ P1 <nl> + / / CHECK : [ [ PBOX : % [ 0 - 9 ] + ] ] = alloc_box $ @ box P1 <nl> / / CHECK : [ [ PBP : % [ 0 - 9 ] + ] ] = project_box [ [ PBOX ] ] <nl> / / CHECK - NEXT : copy_addr [ [ P ] ] to [ initialization ] [ [ PBP ] ] : $ * P1 <nl> / / CHECK : [ [ POPENED : % [ 0 - 9 ] + ] ] = open_existential_addr [ [ PBP ] ] : $ * P1 to $ * @ opened ( [ [ UUID : " . * " ] ] ) P1 <nl> struct HasAP1 { <nl> / / CHECK : bb0 ( [ [ HASP1 : % [ 0 - 9 ] + ] ] : $ * HasAP1 , [ [ B : % [ 0 - 9 ] + ] ] : $ Bool ) <nl> func testLogicalExistentialSetters ( _ hasAP1 : HasAP1 , _ b : Bool ) { <nl> var hasAP1 = hasAP1 <nl> - / / CHECK : [ [ HASP1_BOX : % [ 0 - 9 ] + ] ] = alloc_box $ HasAP1 <nl> + / / CHECK : [ [ HASP1_BOX : % [ 0 - 9 ] + ] ] = alloc_box $ @ box HasAP1 <nl> / / CHECK : [ [ PBHASP1 : % [ 0 - 9 ] + ] ] = project_box [ [ HASP1_BOX ] ] <nl> / / CHECK - NEXT : copy_addr [ [ HASP1 ] ] to [ initialization ] [ [ PBHASP1 ] ] : $ * HasAP1 <nl> / / CHECK : [ [ P1_COPY : % [ 0 - 9 ] + ] ] = alloc_stack $ P1 <nl> func plusOneP1 ( ) - > P1 { } <nl> func test_open_existential_semantics_opaque ( _ guaranteed : P1 , <nl> immediate : P1 ) { <nl> var immediate = immediate <nl> - / / CHECK : [ [ IMMEDIATE_BOX : % . * ] ] = alloc_box $ P1 <nl> + / / CHECK : [ [ IMMEDIATE_BOX : % . * ] ] = alloc_box $ @ box P1 <nl> / / CHECK : [ [ PB : % . * ] ] = project_box [ [ IMMEDIATE_BOX ] ] <nl> / / CHECK : [ [ VALUE : % . * ] ] = open_existential_addr % 0 <nl> / / CHECK : [ [ METHOD : % . * ] ] = function_ref <nl> func plusOneCP1 ( ) - > CP1 { } <nl> func test_open_existential_semantics_class ( _ guaranteed : CP1 , <nl> immediate : CP1 ) { <nl> var immediate = immediate <nl> - / / CHECK : [ [ IMMEDIATE_BOX : % . * ] ] = alloc_box $ CP1 <nl> + / / CHECK : [ [ IMMEDIATE_BOX : % . * ] ] = alloc_box $ @ box CP1 <nl> / / CHECK : [ [ PB : % . * ] ] = project_box [ [ IMMEDIATE_BOX ] ] <nl> <nl> / / CHECK - NOT : copy_value % 0 <nl> extension ProtoDelegatesToObjC where Self : ObjCInitClass { <nl> / / CHECK - LABEL : sil hidden @ _TFe19protocol_extensionsRxCS_13ObjCInitClassxS_20ProtoDelegatesToObjCrS1_C { { . * } } <nl> / / CHECK : bb0 ( [ [ STR : % [ 0 - 9 ] + ] ] : $ String , [ [ SELF_META : % [ 0 - 9 ] + ] ] : $ @ thick Self . Type ) : <nl> init ( string : String ) { <nl> - / / CHECK : [ [ SELF_BOX : % [ 0 - 9 ] + ] ] = alloc_box $ Self <nl> + / / CHECK : [ [ SELF_BOX : % [ 0 - 9 ] + ] ] = alloc_box $ @ box Self <nl> / / CHECK : [ [ PB : % . * ] ] = project_box [ [ SELF_BOX ] ] <nl> / / CHECK : [ [ SELF : % [ 0 - 9 ] + ] ] = mark_uninitialized [ delegatingself ] [ [ PB ] ] : $ * Self <nl> / / CHECK : [ [ SELF_META_OBJC : % [ 0 - 9 ] + ] ] = thick_to_objc_metatype [ [ SELF_META ] ] : $ @ thick Self . Type to $ @ objc_metatype Self . Type <nl> extension ProtoDelegatesToRequired where Self : RequiredInitClass { <nl> / / CHECK - LABEL : sil hidden @ _TFe19protocol_extensionsRxCS_17RequiredInitClassxS_24ProtoDelegatesToRequiredrS1_C { { . * } } <nl> / / CHECK : bb0 ( [ [ STR : % [ 0 - 9 ] + ] ] : $ String , [ [ SELF_META : % [ 0 - 9 ] + ] ] : $ @ thick Self . Type ) : <nl> init ( string : String ) { <nl> - / / CHECK : [ [ SELF_BOX : % [ 0 - 9 ] + ] ] = alloc_box $ Self <nl> + / / CHECK : [ [ SELF_BOX : % [ 0 - 9 ] + ] ] = alloc_box $ @ box Self <nl> / / CHECK : [ [ PB : % . * ] ] = project_box [ [ SELF_BOX ] ] <nl> / / CHECK : [ [ SELF : % [ 0 - 9 ] + ] ] = mark_uninitialized [ delegatingself ] [ [ PB ] ] : $ * Self <nl> / / CHECK : [ [ SELF_META_AS_CLASS_META : % [ 0 - 9 ] + ] ] = upcast [ [ SELF_META ] ] : $ @ thick Self . Type to $ @ thick RequiredInitClass . Type <nl> mmm a / test / SILGen / protocol_optional . swift <nl> ppp b / test / SILGen / protocol_optional . swift <nl> <nl> func optionalMethodGeneric < T : P1 > ( t t : T ) { <nl> var t = t <nl> / / CHECK : bb0 ( [ [ T : % [ 0 - 9 ] + ] ] : $ T ) : <nl> - / / CHECK : [ [ TBOX : % [ 0 - 9 ] + ] ] = alloc_box $ T <nl> + / / CHECK : [ [ TBOX : % [ 0 - 9 ] + ] ] = alloc_box $ @ box T <nl> / / CHECK - NEXT : [ [ PT : % [ 0 - 9 ] + ] ] = project_box [ [ TBOX ] ] <nl> / / CHECK : store [ [ T ] ] to [ init ] [ [ PT ] ] : $ * T <nl> - / / CHECK - NEXT : [ [ OPT_BOX : % [ 0 - 9 ] + ] ] = alloc_box $ Optional < @ callee_owned ( Int ) - > ( ) > <nl> + / / CHECK - NEXT : [ [ OPT_BOX : % [ 0 - 9 ] + ] ] = alloc_box $ @ box Optional < @ callee_owned ( Int ) - > ( ) > <nl> / / CHECK - NEXT : project_box [ [ OPT_BOX ] ] <nl> / / CHECK - NEXT : [ [ T : % [ 0 - 9 ] + ] ] = load [ [ PT ] ] : $ * T <nl> / / CHECK - NEXT : copy_value [ [ T ] ] : $ T <nl> func optionalMethodGeneric < T : P1 > ( t t : T ) { <nl> func optionalPropertyGeneric < T : P1 > ( t t : T ) { <nl> var t = t <nl> / / CHECK : bb0 ( [ [ T : % [ 0 - 9 ] + ] ] : $ T ) : <nl> - / / CHECK : [ [ TBOX : % [ 0 - 9 ] + ] ] = alloc_box $ T <nl> + / / CHECK : [ [ TBOX : % [ 0 - 9 ] + ] ] = alloc_box $ @ box T <nl> / / CHECK - NEXT : [ [ PT : % [ 0 - 9 ] + ] ] = project_box [ [ TBOX ] ] <nl> / / CHECK : store [ [ T ] ] to [ init ] [ [ PT ] ] : $ * T <nl> - / / CHECK - NEXT : [ [ OPT_BOX : % [ 0 - 9 ] + ] ] = alloc_box $ Optional < Int > <nl> + / / CHECK - NEXT : [ [ OPT_BOX : % [ 0 - 9 ] + ] ] = alloc_box $ @ box Optional < Int > <nl> / / CHECK - NEXT : project_box [ [ OPT_BOX ] ] <nl> / / CHECK - NEXT : [ [ T : % [ 0 - 9 ] + ] ] = load [ [ PT ] ] : $ * T <nl> / / CHECK - NEXT : copy_value [ [ T ] ] : $ T <nl> func optionalPropertyGeneric < T : P1 > ( t t : T ) { <nl> func optionalSubscriptGeneric < T : P1 > ( t t : T ) { <nl> var t = t <nl> / / CHECK : bb0 ( [ [ T : % [ 0 - 9 ] + ] ] : $ T ) : <nl> - / / CHECK : [ [ TBOX : % [ 0 - 9 ] + ] ] = alloc_box $ T <nl> + / / CHECK : [ [ TBOX : % [ 0 - 9 ] + ] ] = alloc_box $ @ box T <nl> / / CHECK - NEXT : [ [ PT : % [ 0 - 9 ] + ] ] = project_box [ [ TBOX ] ] <nl> / / CHECK : store [ [ T ] ] to [ init ] [ [ PT ] ] : $ * T <nl> - / / CHECK - NEXT : [ [ OPT_BOX : % [ 0 - 9 ] + ] ] = alloc_box $ Optional < Int > <nl> + / / CHECK - NEXT : [ [ OPT_BOX : % [ 0 - 9 ] + ] ] = alloc_box $ @ box Optional < Int > <nl> / / CHECK - NEXT : project_box [ [ OPT_BOX ] ] <nl> / / CHECK - NEXT : [ [ T : % [ 0 - 9 ] + ] ] = load [ [ PT ] ] : $ * T <nl> / / CHECK - NEXT : copy_value [ [ T ] ] : $ T <nl> mmm a / test / SILGen / reabstract_lvalue . swift <nl> ppp b / test / SILGen / reabstract_lvalue . swift <nl> func transform ( _ i : Int ) - > Double { <nl> <nl> / / CHECK - LABEL : sil hidden @ _TF17reabstract_lvalue23reabstractFunctionInOutFT_T_ : $ @ convention ( thin ) ( ) - > ( ) <nl> func reabstractFunctionInOut ( ) { <nl> - / / CHECK : [ [ BOX : % . * ] ] = alloc_box $ @ callee_owned ( Int ) - > Double <nl> + / / CHECK : [ [ BOX : % . * ] ] = alloc_box $ @ box @ callee_owned ( Int ) - > Double <nl> / / CHECK : [ [ PB : % . * ] ] = project_box [ [ BOX ] ] <nl> / / CHECK : [ [ ARG : % . * ] ] = function_ref @ _TF17reabstract_lvalue9transformFSiSd <nl> / / CHECK : [ [ THICK_ARG : % . * ] ] = thin_to_thick_function [ [ ARG ] ] <nl> mmm a / test / SILGen / sil_locations . swift <nl> ppp b / test / SILGen / sil_locations . swift <nl> func testSwitch ( ) { <nl> / / CHECK : cond_br <nl> / / <nl> var z : Int = 200 <nl> - / / CHECK : [ [ VAR_Z : % [ 0 - 9 ] + ] ] = alloc_box $ Int , var , name " z " { { . * } } line : [ [ @ LINE - 1 ] ] : 9 <nl> + / / CHECK : [ [ VAR_Z : % [ 0 - 9 ] + ] ] = alloc_box $ @ box Int , var , name " z " { { . * } } line : [ [ @ LINE - 1 ] ] : 9 <nl> / / CHECK : integer_literal $ Builtin . Int2048 , 200 , loc " { { . * } } " : [ [ @ LINE - 2 ] ] : 18 <nl> x = z <nl> / / CHECK : destroy_value [ [ VAR_Z ] ] { { . * } } , loc " { { . * } } " : [ [ @ LINE - 1 ] ] : 9 , { { . * } } : cleanup <nl> func testFor ( ) { <nl> } <nl> <nl> / / CHECK - LABEL : sil hidden @ _TF13sil_locations7testForFT_T_ <nl> - / / CHECK : [ [ VAR_Y_IN_FOR : % [ 0 - 9 ] + ] ] = alloc_box $ Int , var , name " y " , loc " { { . * } } " : [ [ @ LINE - 10 ] ] : 9 <nl> + / / CHECK : [ [ VAR_Y_IN_FOR : % [ 0 - 9 ] + ] ] = alloc_box $ @ box Int , var , name " y " , loc " { { . * } } " : [ [ @ LINE - 10 ] ] : 9 <nl> / / CHECK : integer_literal $ Builtin . Int2048 , 300 , loc " { { . * } } " : [ [ @ LINE - 11 ] ] : 18 <nl> / / CHECK : destroy_value [ [ VAR_Y_IN_FOR ] ] : $ @ box Int <nl> / / CHECK : br bb { { . * } } , loc " { { . * } } " : [ [ @ LINE - 10 ] ] : 7 <nl> mmm a / test / SILGen / statements . swift <nl> ppp b / test / SILGen / statements . swift <nl> func defer_in_generic < T > ( _ x : T ) { <nl> / / CHECK - LABEL : sil hidden @ _TF10statements13defer_mutableFSiT_ <nl> func defer_mutable ( _ x : Int ) { <nl> var x = x <nl> - / / CHECK : [ [ BOX : % . * ] ] = alloc_box $ Int <nl> + / / CHECK : [ [ BOX : % . * ] ] = alloc_box $ @ box Int <nl> / / CHECK - NEXT : project_box [ [ BOX ] ] <nl> / / CHECK - NOT : [ [ BOX ] ] <nl> / / CHECK : function_ref @ _TFF10statements13defer_mutableFSiT_L_6 $ deferfT_T_ : $ @ convention ( thin ) ( @ inout_aliasable Int ) - > ( ) <nl> mmm a / test / SILGen / super_init_refcounting . swift <nl> ppp b / test / SILGen / super_init_refcounting . swift <nl> class Foo { <nl> <nl> class Bar : Foo { <nl> / / CHECK - LABEL : sil hidden @ _TFC22super_init_refcounting3Barc <nl> - / / CHECK : [ [ SELF_VAR : % . * ] ] = alloc_box $ Bar <nl> + / / CHECK : [ [ SELF_VAR : % . * ] ] = alloc_box $ @ box Bar <nl> / / CHECK : [ [ PB : % . * ] ] = project_box [ [ SELF_VAR ] ] <nl> / / CHECK : [ [ SELF_MUI : % . * ] ] = mark_uninitialized [ derivedself ] [ [ PB ] ] <nl> / / CHECK : [ [ ORIG_SELF : % . * ] ] = load [ [ SELF_MUI ] ] <nl> class Bar : Foo { <nl> <nl> extension Foo { <nl> / / CHECK - LABEL : sil hidden @ _TFC22super_init_refcounting3Fooc <nl> - / / CHECK : [ [ SELF_VAR : % . * ] ] = alloc_box $ Foo <nl> + / / CHECK : [ [ SELF_VAR : % . * ] ] = alloc_box $ @ box Foo <nl> / / CHECK : [ [ PB : % . * ] ] = project_box [ [ SELF_VAR ] ] <nl> / / CHECK : [ [ SELF_MUI : % . * ] ] = mark_uninitialized [ delegatingself ] [ [ PB ] ] <nl> / / CHECK : [ [ ORIG_SELF : % . * ] ] = load [ [ SELF_MUI ] ] <nl> class Good : Foo { <nl> let x : Int <nl> <nl> / / CHECK - LABEL : sil hidden @ _TFC22super_init_refcounting4Goodc <nl> - / / CHECK : [ [ SELF_BOX : % . * ] ] = alloc_box $ Good <nl> + / / CHECK : [ [ SELF_BOX : % . * ] ] = alloc_box $ @ box Good <nl> / / CHECK : [ [ PB : % . * ] ] = project_box [ [ SELF_BOX ] ] <nl> / / CHECK : [ [ SELF : % . * ] ] = mark_uninitialized [ derivedself ] [ [ PB ] ] <nl> / / CHECK : store % 0 to [ [ SELF ] ] <nl> mmm a / test / SILGen / switch_fallthrough . swift <nl> ppp b / test / SILGen / switch_fallthrough . swift <nl> func test3 ( ) { <nl> / / Fallthrough should clean up nested pattern variables from the exited scope . <nl> func test4 ( ) { <nl> switch ( foo ( ) , bar ( ) ) { <nl> - / / CHECK : [ [ A : % . * ] ] = alloc_box $ ( Int , Int ) <nl> + / / CHECK : [ [ A : % . * ] ] = alloc_box $ @ box ( Int , Int ) <nl> / / CHECK : cond_br { { % . * } } , [ [ CASE1 : bb [ 0 - 9 ] + ] ] , { { bb [ 0 - 9 ] + } } <nl> case var a where runced ( ) : <nl> / / CHECK : [ [ CASE1 ] ] : <nl> func test4 ( ) { <nl> / / CHECK : br [ [ CONT : bb [ 0 - 9 ] + ] ] <nl> ( ) <nl> <nl> - / / CHECK : [ [ B : % . * ] ] = alloc_box $ Int <nl> - / / CHECK : [ [ C : % . * ] ] = alloc_box $ Int <nl> + / / CHECK : [ [ B : % . * ] ] = alloc_box $ @ box Int <nl> + / / CHECK : [ [ C : % . * ] ] = alloc_box $ @ box Int <nl> / / CHECK : cond_br { { % . * } } , [ [ CASE4 : bb [ 0 - 9 ] + ] ] , <nl> case ( var b , var c ) where ansed ( ) : <nl> / / CHECK : [ [ CASE4 ] ] : <nl> mmm a / test / SILGen / switch_var . swift <nl> ppp b / test / SILGen / switch_var . swift <nl> func cc ( x x : ( Int , Int ) ) { } <nl> func test_var_1 ( ) { <nl> / / CHECK : function_ref @ _TF10switch_var3fooFT_Si <nl> switch foo ( ) { <nl> - / / CHECK : [ [ XADDR : % . * ] ] = alloc_box $ Int <nl> + / / CHECK : [ [ XADDR : % . * ] ] = alloc_box $ @ box Int <nl> / / CHECK : [ [ X : % . * ] ] = project_box [ [ XADDR ] ] <nl> / / CHECK - NOT : br bb <nl> case var x : <nl> func test_var_1 ( ) { <nl> func test_var_2 ( ) { <nl> / / CHECK : function_ref @ _TF10switch_var3fooFT_Si <nl> switch foo ( ) { <nl> - / / CHECK : [ [ XADDR : % . * ] ] = alloc_box $ Int <nl> + / / CHECK : [ [ XADDR : % . * ] ] = alloc_box $ @ box Int <nl> / / CHECK : [ [ X : % . * ] ] = project_box [ [ XADDR ] ] <nl> / / CHECK : function_ref @ _TF10switch_var6runcedFT1xSi_Sb <nl> / / CHECK : load [ [ X ] ] <nl> func test_var_2 ( ) { <nl> / / CHECK : br [ [ CONT : bb [ 0 - 9 ] + ] ] <nl> a ( x : x ) <nl> / / CHECK : [ [ NO_CASE1 ] ] : <nl> - / / CHECK : [ [ YADDR : % . * ] ] = alloc_box $ Int <nl> + / / CHECK : [ [ YADDR : % . * ] ] = alloc_box $ @ box Int <nl> / / CHECK : [ [ Y : % . * ] ] = project_box [ [ YADDR ] ] <nl> / / CHECK : function_ref @ _TF10switch_var6fungedFT1xSi_Sb <nl> / / CHECK : load [ [ Y ] ] <nl> func test_var_2 ( ) { <nl> / / CHECK : br [ [ CASE3 : bb [ 0 - 9 ] + ] ] <nl> case var z : <nl> / / CHECK : [ [ CASE3 ] ] : <nl> - / / CHECK : [ [ ZADDR : % . * ] ] = alloc_box $ Int <nl> + / / CHECK : [ [ ZADDR : % . * ] ] = alloc_box $ @ box Int <nl> / / CHECK : [ [ Z : % . * ] ] = project_box [ [ ZADDR ] ] <nl> / / CHECK : function_ref @ _TF10switch_var1cFT1xSi_T_ <nl> / / CHECK : load [ [ Z ] ] <nl> func test_var_3 ( ) { <nl> / / CHECK : function_ref @ _TF10switch_var3fooFT_Si <nl> / / CHECK : function_ref @ _TF10switch_var3barFT_Si <nl> switch ( foo ( ) , bar ( ) ) { <nl> - / / CHECK : [ [ XADDR : % . * ] ] = alloc_box $ ( Int , Int ) <nl> + / / CHECK : [ [ XADDR : % . * ] ] = alloc_box $ @ box ( Int , Int ) <nl> / / CHECK : [ [ X : % . * ] ] = project_box [ [ XADDR ] ] <nl> / / CHECK : function_ref @ _TF10switch_var6runcedFT1xSi_Sb <nl> / / CHECK : tuple_element_addr [ [ X ] ] : { { . * } } , 0 <nl> func test_var_3 ( ) { <nl> / / CHECK : br [ [ CONT : bb [ 0 - 9 ] + ] ] <nl> aa ( x : x ) <nl> / / CHECK : [ [ NO_CASE1 ] ] : <nl> - / / CHECK : [ [ YADDR : % . * ] ] = alloc_box $ Int <nl> + / / CHECK : [ [ YADDR : % . * ] ] = alloc_box $ @ box Int <nl> / / CHECK : [ [ Y : % . * ] ] = project_box [ [ YADDR ] ] <nl> - / / CHECK : [ [ Z : % . * ] ] = alloc_box $ Int <nl> + / / CHECK : [ [ Z : % . * ] ] = alloc_box $ @ box Int <nl> / / CHECK : [ [ Z : % . * ] ] = project_box [ [ ZADDR ] ] <nl> / / CHECK : function_ref @ _TF10switch_var6fungedFT1xSi_Sb <nl> / / CHECK : load [ [ Y ] ] <nl> func test_var_3 ( ) { <nl> a ( x : y ) <nl> b ( x : z ) <nl> / / CHECK : [ [ NO_CASE2 ] ] : <nl> - / / CHECK : [ [ WADDR : % . * ] ] = alloc_box $ ( Int , Int ) <nl> + / / CHECK : [ [ WADDR : % . * ] ] = alloc_box $ @ box ( Int , Int ) <nl> / / CHECK : [ [ W : % . * ] ] = project_box [ [ WADDR ] ] <nl> / / CHECK : function_ref @ _TF10switch_var5ansedFT1xSi_Sb <nl> / / CHECK : tuple_element_addr [ [ W ] ] : { { . * } } , 0 <nl> func test_var_3 ( ) { <nl> / / CHECK : br [ [ CASE4 : bb [ 0 - 9 ] + ] ] <nl> case var v : <nl> / / CHECK : [ [ CASE4 ] ] : <nl> - / / CHECK : [ [ VADDR : % . * ] ] = alloc_box $ ( Int , Int ) <nl> + / / CHECK : [ [ VADDR : % . * ] ] = alloc_box $ @ box ( Int , Int ) <nl> / / CHECK : [ [ V : % . * ] ] = project_box [ [ VADDR ] ] <nl> / / CHECK : function_ref @ _TF10switch_var2ccFT1xTSiSi__T_ <nl> / / CHECK : load [ [ V ] ] <nl> func test_var_4 ( p p : P ) { <nl> <nl> / / CHECK : [ [ IS_X ] ] : <nl> / / CHECK : [ [ T0 : % . * ] ] = load [ [ TMP ] ] : $ * X <nl> - / / CHECK : [ [ XADDR : % . * ] ] = alloc_box $ Int <nl> + / / CHECK : [ [ XADDR : % . * ] ] = alloc_box $ @ box Int <nl> / / CHECK : [ [ X : % . * ] ] = project_box [ [ XADDR ] ] <nl> / / CHECK : store [ [ PAIR_1 ] ] to [ [ X ] ] <nl> / / CHECK : function_ref @ _TF10switch_var6runcedFT1xSi_Sb <nl> func test_var_4 ( p p : P ) { <nl> <nl> / / CHECK : [ [ IS_Y ] ] : <nl> / / CHECK : [ [ T0 : % . * ] ] = load [ [ TMP ] ] : $ * Y <nl> - / / CHECK : [ [ YADDR : % . * ] ] = alloc_box $ Int <nl> + / / CHECK : [ [ YADDR : % . * ] ] = alloc_box $ @ box Int <nl> / / CHECK : [ [ Y : % . * ] ] = project_box [ [ YADDR ] ] <nl> / / CHECK : store [ [ PAIR_1 ] ] to [ [ Y ] ] <nl> / / CHECK : function_ref @ _TF10switch_var6fungedFT1xSi_Sb <nl> func test_var_4 ( p p : P ) { <nl> / / CHECK : br [ [ NEXT ] ] <nl> <nl> / / CHECK : [ [ NEXT ] ] : <nl> - / / CHECK : [ [ ZADDR : % . * ] ] = alloc_box $ ( P , Int ) <nl> + / / CHECK : [ [ ZADDR : % . * ] ] = alloc_box $ @ box ( P , Int ) <nl> / / CHECK : [ [ Z : % . * ] ] = project_box [ [ ZADDR ] ] <nl> / / CHECK : function_ref @ _TF10switch_var5ansedFT1xSi_Sb <nl> / / CHECK : tuple_element_addr [ [ Z ] ] : { { . * } } , 1 <nl> func test_var_4 ( p p : P ) { <nl> case ( _ , var w ) : <nl> / / CHECK : [ [ CASE4 ] ] : <nl> / / CHECK : [ [ PAIR_0 : % . * ] ] = tuple_element_addr [ [ PAIR ] ] : $ * ( P , Int ) , 0 <nl> - / / CHECK : [ [ WADDR : % . * ] ] = alloc_box $ Int <nl> + / / CHECK : [ [ WADDR : % . * ] ] = alloc_box $ @ box Int <nl> / / CHECK : [ [ W : % . * ] ] = project_box [ [ WADDR ] ] <nl> / / CHECK : function_ref @ _TF10switch_var1dFT1xSi_T_ <nl> / / CHECK : load [ [ W ] ] <nl> func test_var_5 ( ) { <nl> / / CHECK : function_ref @ _TF10switch_var3fooFT_Si <nl> / / CHECK : function_ref @ _TF10switch_var3barFT_Si <nl> switch ( foo ( ) , bar ( ) ) { <nl> - / / CHECK : [ [ XADDR : % . * ] ] = alloc_box $ ( Int , Int ) <nl> + / / CHECK : [ [ XADDR : % . * ] ] = alloc_box $ @ box ( Int , Int ) <nl> / / CHECK : [ [ X : % . * ] ] = project_box [ [ XADDR ] ] <nl> / / CHECK : cond_br { { % . * } } , [ [ CASE1 : bb [ 0 - 9 ] + ] ] , [ [ NO_CASE1 : bb [ 0 - 9 ] + ] ] <nl> case var x where runced ( x : x . 0 ) : <nl> func test_var_5 ( ) { <nl> / / CHECK : br [ [ CONT : bb [ 0 - 9 ] + ] ] <nl> a ( ) <nl> / / CHECK : [ [ NO_CASE1 ] ] : <nl> - / / CHECK : [ [ YADDR : % [ 0 - 9 ] + ] ] = alloc_box $ Int <nl> + / / CHECK : [ [ YADDR : % [ 0 - 9 ] + ] ] = alloc_box $ @ box Int <nl> / / CHECK : [ [ Y : % [ 0 - 9 ] + ] ] = project_box [ [ YADDR ] ] <nl> - / / CHECK : [ [ ZADDR : % [ 0 - 9 ] + ] ] = alloc_box $ Int <nl> + / / CHECK : [ [ ZADDR : % [ 0 - 9 ] + ] ] = alloc_box $ @ box Int <nl> / / CHECK : [ [ Z : % [ 0 - 9 ] + ] ] = project_box [ [ ZADDR ] ] <nl> / / CHECK : cond_br { { % . * } } , [ [ CASE2 : bb [ 0 - 9 ] + ] ] , [ [ NO_CASE2 : bb [ 0 - 9 ] + ] ] <nl> case ( var y , var z ) where funged ( x : y ) : <nl> func test_var_5 ( ) { <nl> func test_var_return ( ) { <nl> switch ( foo ( ) , bar ( ) ) { <nl> case var x where runced ( ) : <nl> - / / CHECK : [ [ XADDR : % [ 0 - 9 ] + ] ] = alloc_box $ ( Int , Int ) <nl> + / / CHECK : [ [ XADDR : % [ 0 - 9 ] + ] ] = alloc_box $ @ box ( Int , Int ) <nl> / / CHECK : [ [ X : % [ 0 - 9 ] + ] ] = project_box [ [ XADDR ] ] <nl> / / CHECK : function_ref @ _TF10switch_var1aFT_T_ <nl> / / CHECK : destroy_value [ [ XADDR ] ] <nl> / / CHECK : br [ [ EPILOG : bb [ 0 - 9 ] + ] ] <nl> a ( ) <nl> return <nl> - / / CHECK : [ [ YADDR : % [ 0 - 9 ] + ] ] = alloc_box $ Int <nl> + / / CHECK : [ [ YADDR : % [ 0 - 9 ] + ] ] = alloc_box $ @ box Int <nl> / / CHECK : [ [ Y : % [ 0 - 9 ] + ] ] = project_box [ [ YADDR ] ] <nl> - / / CHECK : [ [ ZADDR : % [ 0 - 9 ] + ] ] = alloc_box $ Int <nl> + / / CHECK : [ [ ZADDR : % [ 0 - 9 ] + ] ] = alloc_box $ @ box Int <nl> / / CHECK : [ [ Z : % [ 0 - 9 ] + ] ] = project_box [ [ ZADDR ] ] <nl> case ( var y , var z ) where funged ( ) : <nl> / / CHECK : function_ref @ _TF10switch_var1bFT_T_ <nl> func test_var_return ( ) { <nl> b ( ) <nl> return <nl> case var w where ansed ( ) : <nl> - / / CHECK : [ [ WADDR : % [ 0 - 9 ] + ] ] = alloc_box $ ( Int , Int ) <nl> + / / CHECK : [ [ WADDR : % [ 0 - 9 ] + ] ] = alloc_box $ @ box ( Int , Int ) <nl> / / CHECK : [ [ W : % [ 0 - 9 ] + ] ] = project_box [ [ WADDR ] ] <nl> / / CHECK : function_ref @ _TF10switch_var1cFT_T_ <nl> / / CHECK - NOT : destroy_value [ [ ZADDR ] ] <nl> func test_var_return ( ) { <nl> c ( ) <nl> return <nl> case var v : <nl> - / / CHECK : [ [ VADDR : % [ 0 - 9 ] + ] ] = alloc_box $ ( Int , Int ) <nl> + / / CHECK : [ [ VADDR : % [ 0 - 9 ] + ] ] = alloc_box $ @ box ( Int , Int ) <nl> / / CHECK : [ [ V : % [ 0 - 9 ] + ] ] = project_box [ [ VADDR ] ] <nl> / / CHECK : function_ref @ _TF10switch_var1dFT_T_ <nl> / / CHECK - NOT : destroy_value [ [ ZADDR ] ] <nl> func test_mixed_let_var ( ) { <nl> / / CHECK : [ [ VAL : % . * ] ] = apply [ [ FOOS ] ] ( ) <nl> switch foos ( ) { <nl> case var x where runced ( ) : <nl> - / / CHECK : [ [ BOX : % . * ] ] = alloc_box $ String , var , name " x " <nl> + / / CHECK : [ [ BOX : % . * ] ] = alloc_box $ @ box String , var , name " x " <nl> / / CHECK : [ [ PBOX : % . * ] ] = project_box [ [ BOX ] ] <nl> / / CHECK : [ [ VAL_COPY : % . * ] ] = copy_value [ [ VAL ] ] <nl> / / CHECK : store [ [ VAL_COPY ] ] to [ [ PBOX ] ] <nl> mmm a / test / SILGen / tuples . swift <nl> ppp b / test / SILGen / tuples . swift <nl> func make_xy ( ) - > ( x : Int , y : P ) { return ( make_int ( ) , make_p ( ) ) } <nl> <nl> / / CHECK - LABEL : sil hidden @ _TF6tuples17testShuffleOpaqueFT_T_ <nl> func testShuffleOpaque ( ) { <nl> - / / CHECK : [ [ X : % . * ] ] = alloc_box $ P <nl> + / / CHECK : [ [ X : % . * ] ] = alloc_box $ @ box P <nl> / / CHECK - NEXT : [ [ PBX : % . * ] ] = project_box [ [ X ] ] <nl> - / / CHECK : [ [ Y : % . * ] ] = alloc_box $ Int <nl> + / / CHECK : [ [ Y : % . * ] ] = alloc_box $ @ box Int <nl> / / CHECK - NEXT : [ [ PBY : % . * ] ] = project_box [ [ Y ] ] <nl> <nl> / / CHECK : [ [ T0 : % . * ] ] = function_ref @ _TF6tuples7make_xyFT_T1xSi1yPS_1P__ <nl> func testShuffleOpaque ( ) { <nl> / / CHECK - NEXT : store [ [ T1 ] ] to [ trivial ] [ [ PBY ] ] <nl> var ( x , y ) : ( y : P , x : Int ) = make_xy ( ) <nl> <nl> - / / CHECK - NEXT : [ [ PAIR : % . * ] ] = alloc_box $ ( y : P , x : Int ) <nl> + / / CHECK - NEXT : [ [ PAIR : % . * ] ] = alloc_box $ @ box ( y : P , x : Int ) <nl> / / CHECK - NEXT : [ [ PBPAIR : % . * ] ] = project_box [ [ PAIR ] ] <nl> / / CHECK - NEXT : [ [ PAIR_0 : % . * ] ] = tuple_element_addr [ [ PBPAIR ] ] : $ * ( y : P , x : Int ) , 0 <nl> / / CHECK - NEXT : [ [ PAIR_1 : % . * ] ] = tuple_element_addr [ [ PBPAIR ] ] : $ * ( y : P , x : Int ) , 1 <nl> func testShuffleOpaque ( ) { <nl> <nl> / / CHECK - LABEL : testShuffleTuple <nl> func testShuffleTuple ( ) { <nl> - / / CHECK : [ [ X : % . * ] ] = alloc_box $ P <nl> + / / CHECK : [ [ X : % . * ] ] = alloc_box $ @ box P <nl> / / CHECK - NEXT : [ [ PBX : % . * ] ] = project_box [ [ X ] ] <nl> - / / CHECK : [ [ Y : % . * ] ] = alloc_box $ Int <nl> + / / CHECK : [ [ Y : % . * ] ] = alloc_box $ @ box Int <nl> / / CHECK - NEXT : [ [ PBY : % . * ] ] = project_box [ [ Y ] ] <nl> <nl> / / CHECK : [ [ T0 : % . * ] ] = function_ref @ _TF6tuples8make_intFT_Si <nl> func testShuffleTuple ( ) { <nl> / / CHECK - NEXT : apply [ [ T0 ] ] ( [ [ PBX ] ] ) <nl> var ( x , y ) : ( y : P , x : Int ) = ( x : make_int ( ) , y : make_p ( ) ) <nl> <nl> - / / CHECK - NEXT : [ [ PAIR : % . * ] ] = alloc_box $ ( y : P , x : Int ) <nl> + / / CHECK - NEXT : [ [ PAIR : % . * ] ] = alloc_box $ @ box ( y : P , x : Int ) <nl> / / CHECK - NEXT : [ [ PBPAIR : % . * ] ] = project_box [ [ PAIR ] ] <nl> / / CHECK - NEXT : [ [ PAIR_0 : % . * ] ] = tuple_element_addr [ [ PBPAIR ] ] : $ * ( y : P , x : Int ) , 0 <nl> / / CHECK - NEXT : [ [ PAIR_1 : % . * ] ] = tuple_element_addr [ [ PBPAIR ] ] : $ * ( y : P , x : Int ) , 1 <nl> mmm a / test / SILGen / types . swift <nl> ppp b / test / SILGen / types . swift <nl> struct S { <nl> var x = x <nl> / / CHECK : bb0 ( [ [ X : % [ 0 - 9 ] + ] ] : $ Int , [ [ THIS : % [ 0 - 9 ] + ] ] : $ * S ) : <nl> member = x <nl> - / / CHECK : [ [ XADDR : % [ 0 - 9 ] + ] ] = alloc_box $ Int <nl> + / / CHECK : [ [ XADDR : % [ 0 - 9 ] + ] ] = alloc_box $ @ box Int <nl> / / CHECK : [ [ X : % [ 0 - 9 ] + ] ] = project_box [ [ XADDR ] ] <nl> / / CHECK : [ [ MEMBER : % [ 0 - 9 ] + ] ] = struct_element_addr [ [ THIS ] ] : $ * S , # S . member <nl> / / CHECK : copy_addr [ [ X ] ] to [ [ MEMBER ] ] <nl> mmm a / test / SILGen / unowned . swift <nl> ppp b / test / SILGen / unowned . swift <nl> func test0 ( c c : C ) { <nl> / / CHECK : bb0 ( % 0 : $ C ) : <nl> <nl> var a : A <nl> - / / CHECK : [ [ A1 : % . * ] ] = alloc_box $ A <nl> + / / CHECK : [ [ A1 : % . * ] ] = alloc_box $ @ box A <nl> / / CHECK : [ [ PBA : % . * ] ] = project_box [ [ A1 ] ] <nl> / / CHECK : [ [ A : % . * ] ] = mark_uninitialized [ var ] [ [ PBA ] ] <nl> <nl> unowned var x = c <nl> - / / CHECK : [ [ X : % . * ] ] = alloc_box $ @ sil_unowned C <nl> + / / CHECK : [ [ X : % . * ] ] = alloc_box $ @ box @ sil_unowned C <nl> / / CHECK - NEXT : [ [ PBX : % . * ] ] = project_box [ [ X ] ] <nl> / / CHECK - NEXT : [ [ T2 : % . * ] ] = ref_to_unowned % 0 : $ C to $ @ sil_unowned C <nl> / / CHECK - NEXT : unowned_retain [ [ T2 ] ] : $ @ sil_unowned C <nl> func unowned_local ( ) - > C { <nl> / / CHECK : [ [ c : % . * ] ] = apply <nl> let c = C ( ) <nl> <nl> - / / CHECK : [ [ uc : % . * ] ] = alloc_box $ @ sil_unowned C , let , name " uc " <nl> + / / CHECK : [ [ uc : % . * ] ] = alloc_box $ @ box @ sil_unowned C , let , name " uc " <nl> / / CHECK - NEXT : [ [ PB : % . * ] ] = project_box [ [ uc ] ] <nl> / / CHECK - NEXT : [ [ tmp1 : % . * ] ] = ref_to_unowned [ [ c ] ] : $ C to $ @ sil_unowned C <nl> / / CHECK - NEXT : unowned_retain [ [ tmp1 ] ] <nl> mmm a / test / SILGen / weak . swift <nl> ppp b / test / SILGen / weak . swift <nl> struct A { <nl> func test0 ( c c : C ) { <nl> var c = c <nl> / / CHECK : bb0 ( % 0 : $ C ) : <nl> - / / CHECK : [ [ C : % . * ] ] = alloc_box $ C <nl> + / / CHECK : [ [ C : % . * ] ] = alloc_box $ @ box C <nl> / / CHECK - NEXT : [ [ PBC : % . * ] ] = project_box [ [ C ] ] <nl> <nl> var a : A <nl> - / / CHECK : [ [ A1 : % . * ] ] = alloc_box $ A <nl> + / / CHECK : [ [ A1 : % . * ] ] = alloc_box $ @ box A <nl> / / CHECK - NEXT : [ [ PBA : % . * ] ] = project_box [ [ A1 ] ] <nl> / / CHECK : [ [ A : % . * ] ] = mark_uninitialized [ var ] [ [ PBA ] ] <nl> <nl> weak var x = c <nl> - / / CHECK : [ [ X : % . * ] ] = alloc_box $ @ sil_weak Optional < C > , var , name " x " <nl> + / / CHECK : [ [ X : % . * ] ] = alloc_box $ @ box @ sil_weak Optional < C > , var , name " x " <nl> / / CHECK - NEXT : [ [ PBX : % . * ] ] = project_box [ [ X ] ] <nl> / / Implicit conversion <nl> / / CHECK - NEXT : [ [ TMP : % . * ] ] = load [ [ PBC ] ] : $ * C <nl> class CC { <nl> weak var x : CC ? <nl> <nl> / / CHECK - LABEL : sil hidden @ _TFC4weak2CCc <nl> - / / CHECK : [ [ FOO : % . * ] ] = alloc_box $ Optional < CC > <nl> + / / CHECK : [ [ FOO : % . * ] ] = alloc_box $ @ box Optional < CC > <nl> / / CHECK : [ [ PB : % . * ] ] = project_box [ [ FOO ] ] <nl> / / CHECK : [ [ X : % . * ] ] = ref_element_addr % 2 : $ CC , # CC . x <nl> / / CHECK : [ [ VALUE : % . * ] ] = load_weak [ [ X ] ] : $ * @ sil_weak Optional < CC > <nl> mmm a / test / SILOptimizer / allocbox_to_stack . sil <nl> ppp b / test / SILOptimizer / allocbox_to_stack . sil <nl> struct Bool { <nl> / / CHECK - LABEL : sil @ simple_promotion <nl> sil @ simple_promotion : $ ( Int ) - > Int { <nl> bb0 ( % 0 : $ Int ) : <nl> - % 1 = alloc_box $ Int <nl> + % 1 = alloc_box $ @ box Int <nl> % 1a = project_box % 1 : $ @ box Int , 0 <nl> % 2 = store % 0 to % 1a : $ * Int <nl> % 3 = load % 1a : $ * Int <nl> bb0 ( % 0 : $ Int ) : <nl> / / CHECK - LABEL : sil @ double_project_box <nl> sil @ double_project_box : $ ( Int ) - > ( Int , Int ) { <nl> bb0 ( % 0 : $ Int ) : <nl> - % 1 = alloc_box $ Int <nl> + % 1 = alloc_box $ @ box Int <nl> % 1a = project_box % 1 : $ @ box Int , 0 <nl> % 2 = store % 0 to % 1a : $ * Int <nl> % 3 = load % 1a : $ * Int <nl> bb0 ( % 0 : $ Int ) : <nl> / / CHECK - LABEL : sil @ init_var <nl> sil @ init_var : $ ( ) - > Int { <nl> bb0 : <nl> - % 1 = alloc_box $ Int <nl> + % 1 = alloc_box $ @ box Int <nl> % 1a = project_box % 1 : $ @ box Int , 0 <nl> % 3 = load % 1a : $ * Int <nl> % 4 = strong_release % 1 : $ @ box Int <nl> bb0 : <nl> / / CHECK - LABEL : sil @ multi_strong_release <nl> sil @ multi_strong_release : $ ( ) - > Int { <nl> bb0 : <nl> - % 1 = alloc_box $ Int <nl> + % 1 = alloc_box $ @ box Int <nl> % 1a = project_box % 1 : $ @ box Int , 0 <nl> % 2 = mark_uninitialized [ rootself ] % 1a : $ * Int <nl> % 3 = load % 2 : $ * Int <nl> sil @ struct_tuple_element_addr : $ ( Int ) - > Int { <nl> bb1 ( % 0 : $ Int ) : <nl> / / CHECK - DAG : [ [ STRUCT : % . * ] ] = alloc_stack $ TestStruct <nl> / / CHECK - DAG : [ [ TUPLE : % . * ] ] = alloc_stack $ ( Int , Int ) <nl> - % 1 = alloc_box $ TestStruct <nl> + % 1 = alloc_box $ @ box TestStruct <nl> % 1a = project_box % 1 : $ @ box TestStruct , 0 <nl> - % a = alloc_box $ ( Int , Int ) <nl> + % a = alloc_box $ @ box ( Int , Int ) <nl> % aa = project_box % a : $ @ box ( Int , Int ) , 0 <nl> <nl> % 2 = struct_element_addr % 1a : $ * TestStruct , # TestStruct . Elt <nl> sil @ callee : $ @ convention ( thin ) ( @ inout Int ) - > ( ) <nl> sil @ inout_nocapture : $ @ convention ( thin ) ( ) - > Int { <nl> bb0 : <nl> / / CHECK : alloc_stack <nl> - % 1 = alloc_box $ Int <nl> + % 1 = alloc_box $ @ box Int <nl> % 1a = project_box % 1 : $ @ box Int , 0 <nl> % 6 = function_ref @ callee : $ @ convention ( thin ) ( @ inout Int ) - > ( ) <nl> % 7 = apply % 6 ( % 1a ) : $ @ convention ( thin ) ( @ inout Int ) - > ( ) <nl> sil @ test_indirect_return : $ @ convention ( thin ) ( ) - > ( ) { <nl> bb0 : <nl> / / CHECK : alloc_stack <nl> % 1 = function_ref @ returns_protocol : $ @ convention ( thin ) ( ) - > @ out P <nl> - % 2 = alloc_box $ P <nl> + % 2 = alloc_box $ @ box P <nl> % 2a = project_box % 2 : $ @ box P , 0 <nl> % 3 = apply % 1 ( % 2a ) : $ @ convention ( thin ) ( ) - > @ out P <nl> % 5 = strong_release % 2 : $ @ box P <nl> class SomeClass { } <nl> / / CHECK - LABEL : sil @ class_promotion <nl> sil @ class_promotion : $ ( SomeClass ) - > SomeClass { <nl> bb0 ( % 0 : $ SomeClass ) : <nl> - % 1 = alloc_box $ SomeClass <nl> + % 1 = alloc_box $ @ box SomeClass <nl> % 1a = project_box % 1 : $ @ box SomeClass , 0 <nl> % 2 = store % 0 to % 1a : $ * SomeClass <nl> % 3 = load % 1a : $ * SomeClass <nl> protocol LogicValue { <nl> / / CHECK - LABEL : @ protocols <nl> sil @ protocols : $ @ convention ( thin ) ( @ in LogicValue , @ thin Bool . Type ) - > Bool { <nl> bb0 ( % 0 : $ * LogicValue , % 1 : $ @ thin Bool . Type ) : <nl> - % 2 = alloc_box $ LogicValue <nl> + % 2 = alloc_box $ @ box LogicValue <nl> % 2a = project_box % 2 : $ @ box LogicValue , 0 <nl> / / CHECK : % 2 = alloc_stack $ LogicValue <nl> copy_addr [ take ] % 0 to [ initialization ] % 2a : $ * LogicValue <nl> class Generic < T > { } <nl> sil @ dealloc_box : $ @ convention ( thin ) < T > ( ) - > ( ) { <nl> bb0 : / / CHECK - NEXT : bb0 : <nl> / / CHECK - NEXT : alloc_stack <nl> - % 1 = alloc_box $ Generic < T > <nl> + % 1 = alloc_box $ @ box Generic < T > <nl> dealloc_box % 1 : $ @ box Generic < T > <nl> <nl> % 0 = tuple ( ) / / CHECK : tuple ( ) <nl> sil @ _TC1t9SomeClassCfMS0_FT_S0_ : $ @ convention ( thin ) ( @ thick SomeClass . Type ) - > <nl> sil @ union_test : $ @ convention ( thin ) ( ) - > ( ) { <nl> bb0 : <nl> / / CHECK : [ [ UNION : % . * ] ] = alloc_stack <nl> - % 1 = alloc_box $ SomeUnion <nl> + % 1 = alloc_box $ @ box SomeUnion <nl> % 1a = project_box % 1 : $ @ box SomeUnion , 0 <nl> % 2 = function_ref @ _TO1t9SomeUnion1yfMS0_FCS_9SomeClassS0_ : $ @ convention ( thin ) ( @ owned SomeClass , @ thin SomeUnion . Type ) - > @ owned SomeUnion / / user : % 7 <nl> % 3 = metatype $ @ thin SomeUnion . Type <nl> bb0 : <nl> / / CHECK - LABEL : sil @ multiple_release_test <nl> sil @ multiple_release_test : $ @ convention ( thin ) ( Bool ) - > Bool { <nl> bb0 ( % 0 : $ Bool ) : <nl> - % 1 = alloc_box $ Bool <nl> + % 1 = alloc_box $ @ box Bool <nl> % 1a = project_box % 1 : $ @ box Bool , 0 <nl> store % 0 to % 1a : $ * Bool <nl> strong_retain % 1 : $ @ box Bool <nl> bb0 : <nl> br bb1 <nl> <nl> bb1 : <nl> - % 1 = alloc_box $ Bool <nl> + % 1 = alloc_box $ @ box Bool <nl> cond_br undef , bb2 , bb3 <nl> <nl> bb2 : <nl> extension Int : My_Incrementable { } <nl> / / CHECK - LABEL : sil @ test_mui <nl> sil @ test_mui : $ @ convention ( thin ) ( Builtin . Int1 ) - > ( ) { <nl> bb0 ( % 0 : $ Builtin . Int1 ) : <nl> - % 2 = alloc_box $ SomeClass <nl> + % 2 = alloc_box $ @ box SomeClass <nl> % 2a = project_box % 2 : $ @ box SomeClass , 0 <nl> / / CHECK : [ [ STACK : % [ 0 - 9 ] + ] ] = alloc_stack <nl> % 3 = mark_uninitialized [ var ] % 2a : $ * SomeClass <nl> sil @ _TF6struct8useStackFT1tSi_T_ : $ @ convention ( thin ) ( Int ) - > ( ) { <nl> bb0 ( % 0 : $ Int ) : <nl> debug_value % 0 : $ Int , let , name " t " / / id : % 1 <nl> / / CHECK : alloc_stack <nl> - % 2 = alloc_box $ Int , var , name " s " / / users : % 3 , % 6 , % 7 , % 7 , % 9 <nl> + % 2 = alloc_box $ @ box Int , var , name " s " / / users : % 3 , % 6 , % 7 , % 7 , % 9 <nl> % 2a = project_box % 2 : $ @ box Int , 0 <nl> store % 0 to % 2a : $ * Int / / id : % 3 <nl> / / function_ref struct . apply ( f : ( ) - > Swift . Int ) - > Swift . Int <nl> sil @ _TF6struct6useBoxFT1tSi_T_ : $ @ convention ( thin ) ( Int ) - > ( ) { <nl> bb0 ( % 0 : $ Int ) : <nl> debug_value % 0 : $ Int , let , name " t " / / id : % 1 <nl> / / CHECK : alloc_box <nl> - % 2 = alloc_box $ Int , var , name " s " / / users : % 3 , % 6 , % 7 , % 7 , % 10 <nl> + % 2 = alloc_box $ @ box Int , var , name " s " / / users : % 3 , % 6 , % 7 , % 7 , % 10 <nl> % 2a = project_box % 2 : $ @ box Int , 0 <nl> store % 0 to % 2a : $ * Int / / id : % 3 <nl> / / function_ref struct . escape ( f : ( ) - > Swift . Int ) - > ( ) - > Swift . Int <nl> sil @ closure : $ @ convention ( thin ) ( @ owned @ box Int ) - > ( ) <nl> / / CHECK - LABEL : sil @ no_final_release <nl> sil @ no_final_release : $ @ convention ( thin ) ( Int ) - > Bool { <nl> bb0 ( % 0 : $ Int ) : <nl> - % 1 = alloc_box $ Int <nl> + % 1 = alloc_box $ @ box Int <nl> % 1a = project_box % 1 : $ @ box Int , 0 <nl> store % 0 to % 1a : $ * Int <nl> / / function_ref main . ( newFoo ( Swift . Int ) - > Swift . Bool ) . ( modify # 1 ) ( ( ) ) ( ) <nl> bb0 ( % 0 : $ * T ) : <nl> % 2 = function_ref @ mightApply : $ @ convention ( thin ) < τ_0_0 where τ_0_0 : P > ( @ owned @ callee_owned ( ) - > @ out τ_0_0 ) - > ( ) <nl> % 3 = function_ref @ closure_to_specialize : $ @ convention ( thin ) < τ_0_0 where τ_0_0 : P > ( @ owned @ box τ_0_0 ) - > @ out τ_0_0 <nl> / / CHECK - NOT : alloc_box <nl> - % 4 = alloc_box $ T <nl> + % 4 = alloc_box $ @ box T <nl> % 4a = project_box % 4 : $ @ box T , 0 <nl> / / CHECK : copy_addr % 0 to [ initialization ] [ [ STACK ] ] : $ * T <nl> copy_addr % 0 to [ initialization ] % 4a : $ * T <nl> bb0 ( % 0 : $ Int , % 1 : $ * S < Q > ) : <nl> debug_value_addr % 1 : $ * S < Q > <nl> % 4 = function_ref @ outer : $ @ convention ( thin ) ( @ owned @ callee_owned ( ) - > Bool ) - > Bool <nl> % 5 = function_ref @ closure1 : $ @ convention ( thin ) < τ_0_0 where τ_0_0 : Count > ( Int , @ owned @ box S < τ_0_0 > ) - > Bool <nl> - % 6 = alloc_box $ S < Q > <nl> + % 6 = alloc_box $ @ box S < Q > <nl> % 6a = project_box % 6 : $ @ box S < Q > , 0 <nl> copy_addr % 1 to [ initialization ] % 6a : $ * S < Q > <nl> % 8 = partial_apply % 5 < Q > ( % 0 , % 6 ) : $ @ convention ( thin ) < τ_0_0 where τ_0_0 : Count > ( Int , @ owned @ box S < τ_0_0 > ) - > Bool <nl> bb0 ( % 0 : $ Int , % 1 : $ * S < T > ) : <nl> debug_value_addr % 1 : $ * S < T > <nl> % 4 = function_ref @ outer : $ @ convention ( thin ) ( @ owned @ callee_owned ( ) - > Bool ) - > Bool <nl> % 5 = function_ref @ closure1 : $ @ convention ( thin ) < τ_0_0 where τ_0_0 : Count > ( Int , @ owned @ box S < τ_0_0 > ) - > Bool <nl> - % 6 = alloc_box $ S < T > <nl> + % 6 = alloc_box $ @ box S < T > <nl> % 6a = project_box % 6 : $ @ box S < T > , 0 <nl> copy_addr % 1 to [ initialization ] % 6a : $ * S < T > <nl> % 8 = partial_apply % 5 < T > ( % 0 , % 6 ) : $ @ convention ( thin ) < τ_0_0 where τ_0_0 : Count > ( Int , @ owned @ box S < τ_0_0 > ) - > Bool <nl> bb0 ( % 0 : $ Int , % 1 : $ @ box S < T > ) : <nl> % 2 = project_box % 1 : $ @ box S < T > , 0 <nl> % 3 = function_ref @ inner : $ @ convention ( thin ) ( @ owned @ callee_owned ( ) - > Bool ) - > Bool <nl> % 4 = function_ref @ closure2 : $ @ convention ( thin ) < τ_0_0 where τ_0_0 : Count > ( Int , @ owned @ box S < τ_0_0 > ) - > Bool <nl> - % 5 = alloc_box $ S < T > <nl> + % 5 = alloc_box $ @ box S < T > <nl> % 5a = project_box % 5 : $ @ box S < T > , 0 <nl> copy_addr % 2 to [ initialization ] % 5a : $ * S < T > <nl> % 7 = partial_apply % 4 < T > ( % 0 , % 5 ) : $ @ convention ( thin ) < τ_0_0 where τ_0_0 : Count > ( Int , @ owned @ box S < τ_0_0 > ) - > Bool <nl> bb0 ( % 0 : $ * T , % 1 : $ * T ) : <nl> / / CHECK : copy_addr % 1 to [ initialization ] [ [ STACK ] ] <nl> / / CHECK : [ [ APPLIED : % . * ] ] = function_ref <nl> % 3 = function_ref @ applied : $ @ convention ( thin ) < τ_0_0 > ( @ owned @ box τ_0_0 ) - > ( ) <nl> - % 4 = alloc_box $ T <nl> + % 4 = alloc_box $ @ box T <nl> % 4a = project_box % 4 : $ @ box T , 0 <nl> copy_addr % 1 to [ initialization ] % 4a : $ * T <nl> / / CHECK : [ [ PARTIAL : % . * ] ] = partial_apply [ [ APPLIED ] ] < T > ( [ [ STACK ] ] ) <nl> mmm a / test / SILOptimizer / arcsequenceopts . sil <nl> ppp b / test / SILOptimizer / arcsequenceopts . sil <nl> bb0 ( % 0 : $ @ box Builtin . Int32 ) : <nl> / / CHECK - NEXT : return <nl> sil @ simple_alias_load_use_test : $ @ convention ( thin ) ( @ inout Builtin . Int32 ) - > ( ) { <nl> bb0 ( % 0 : $ * Builtin . Int32 ) : <nl> - % 1 = alloc_box $ Builtin . Int32 <nl> + % 1 = alloc_box $ @ box Builtin . Int32 <nl> % 1a = project_box % 1 : $ @ box Builtin . Int32 , 0 <nl> % 2 = function_ref @ user : $ @ convention ( thin ) ( @ box Builtin . Int32 ) - > ( ) <nl> strong_retain % 1 : $ @ box Builtin . Int32 <nl> bb0 ( % 0 : $ * Builtin . Int32 ) : <nl> / / CHECK - NEXT : return <nl> sil @ simple_alias_load_use_test_two_release : $ @ convention ( thin ) ( @ inout Builtin . Int32 ) - > ( ) { <nl> bb0 ( % 0 : $ * Builtin . Int32 ) : <nl> - % 1 = alloc_box $ Builtin . Int32 <nl> + % 1 = alloc_box $ @ box Builtin . Int32 <nl> % 1a = project_box % 1 : $ @ box Builtin . Int32 , 0 <nl> % 2 = function_ref @ user : $ @ convention ( thin ) ( @ box Builtin . Int32 ) - > ( ) <nl> strong_retain % 1 : $ @ box Builtin . Int32 <nl> sil @ clear_state_in_fact_of_autorelease_pool_ops : $ @ convention ( thin ) ( Builtin . R <nl> bb0 ( % 0 : $ Builtin . RawPointer ) : <nl> % 1 = function_ref @ objc_autoreleasePoolPush : $ @ convention ( thin ) ( ) - > Builtin . RawPointer <nl> % 2 = function_ref @ objc_autoreleasePoolPop : $ @ convention ( thin ) ( Builtin . RawPointer ) - > ( ) <nl> - % 3 = alloc_box $ Builtin . Int32 <nl> + % 3 = alloc_box $ @ box Builtin . Int32 <nl> strong_retain % 3 : $ @ box Builtin . Int32 <nl> apply % 1 ( ) : $ @ convention ( thin ) ( ) - > Builtin . RawPointer <nl> strong_release % 3 : $ @ box Builtin . Int32 <nl> bb0 ( % 0 : $ Builtin . RawPointer ) : <nl> / / CHECK : strong_release <nl> sil @ release_can_decrement_other_releases : $ @ convention ( thin ) ( ) - > ( ) { <nl> bb0 : <nl> - % 1 = alloc_box $ Builtin . Int32 <nl> + % 1 = alloc_box $ @ box Builtin . Int32 <nl> % 2 = alloc_stack $ @ box Builtin . Int32 <nl> store % 1 to % 2 : $ * @ box Builtin . Int32 <nl> % 4 = function_ref @ user : $ @ convention ( thin ) ( @ box Builtin . Int32 ) - > ( ) <nl> bb0 ( % 0 : $ @ box Builtin . Int32 ) : <nl> / / CHECK - NOT : strong_release <nl> sil @ alloc_box_returns_at_p1 : $ @ convention ( thin ) ( ) - > ( ) { <nl> bb0 : <nl> - % 0 = alloc_box $ Builtin . Int32 <nl> + % 0 = alloc_box $ @ box Builtin . Int32 <nl> strong_retain % 0 : $ @ box Builtin . Int32 <nl> % 3 = function_ref @ user : $ @ convention ( thin ) ( @ box Builtin . Int32 ) - > ( ) <nl> apply % 3 ( % 0 ) : $ @ convention ( thin ) ( @ box Builtin . Int32 ) - > ( ) <nl> mmm a / test / SILOptimizer / capture_promotion . sil <nl> ppp b / test / SILOptimizer / capture_promotion . sil <nl> sil @ dummy_func : $ @ convention ( thin ) ( Int , Int , Int ) - > Int <nl> sil @ test_capture_promotion : $ @ convention ( thin ) ( ) - > @ owned @ callee_owned ( ) - > Int { <nl> bb0 : <nl> % 0 = tuple ( ) <nl> - % 1 = alloc_box $ Foo <nl> + % 1 = alloc_box $ @ box Foo <nl> % 1a = project_box % 1 : $ @ box Foo , 0 <nl> % 2 = function_ref @ foo_allocating_init : $ @ convention ( thin ) ( @ thick Foo . Type ) - > @ owned Foo <nl> % 3 = metatype $ @ thick Foo . Type <nl> % 4 = apply % 2 ( % 3 ) : $ @ convention ( thin ) ( @ thick Foo . Type ) - > @ owned Foo <nl> store % 4 to % 1a : $ * Foo <nl> - % 6 = alloc_box $ Baz <nl> + % 6 = alloc_box $ @ box Baz <nl> % 6a = project_box % 6 : $ @ box Baz , 0 <nl> % 7 = function_ref @ baz_init : $ @ convention ( thin ) ( @ thin Baz . Type ) - > @ owned Baz <nl> % 8 = metatype $ @ thin Baz . Type <nl> % 9 = apply % 7 ( % 8 ) : $ @ convention ( thin ) ( @ thin Baz . Type ) - > @ owned Baz <nl> store % 9 to % 6a : $ * Baz <nl> - % 11 = alloc_box $ Int <nl> + % 11 = alloc_box $ @ box Int <nl> % 11a = project_box % 11 : $ @ box Int , 0 <nl> % 12 = function_ref @ convert_from_integer_literal : $ @ convention ( thin ) ( Builtin . Word , @ thin Int . Type ) - > Int <nl> % 13 = metatype $ @ thin Int . Type <nl> bb0 : <nl> sil @ test_capture_promotion_indirect : $ @ convention ( thin ) ( ) - > @ owned @ callee_owned ( ) - > @ out Int { <nl> bb0 : <nl> % 0 = tuple ( ) <nl> - % 1 = alloc_box $ Foo <nl> + % 1 = alloc_box $ @ box Foo <nl> % 1a = project_box % 1 : $ @ box Foo , 0 <nl> % 2 = function_ref @ foo_allocating_init : $ @ convention ( thin ) ( @ thick Foo . Type ) - > @ owned Foo <nl> % 3 = metatype $ @ thick Foo . Type <nl> % 4 = apply % 2 ( % 3 ) : $ @ convention ( thin ) ( @ thick Foo . Type ) - > @ owned Foo <nl> store % 4 to % 1a : $ * Foo <nl> - % 6 = alloc_box $ Baz <nl> + % 6 = alloc_box $ @ box Baz <nl> % 6a = project_box % 6 : $ @ box Baz , 0 <nl> % 7 = function_ref @ baz_init : $ @ convention ( thin ) ( @ thin Baz . Type ) - > @ owned Baz <nl> % 8 = metatype $ @ thin Baz . Type <nl> % 9 = apply % 7 ( % 8 ) : $ @ convention ( thin ) ( @ thin Baz . Type ) - > @ owned Baz <nl> store % 9 to % 6a : $ * Baz <nl> - % 11 = alloc_box $ Int <nl> + % 11 = alloc_box $ @ box Int <nl> % 11a = project_box % 11 : $ @ box Int , 0 <nl> % 12 = function_ref @ convert_from_integer_literal : $ @ convention ( thin ) ( Builtin . Word , @ thin Int . Type ) - > Int <nl> % 13 = metatype $ @ thin Int . Type <nl> bb0 ( % 0 : $ @ box Foo , % 2 : $ @ box Baz , % 4 : $ @ box Int ) : <nl> sil @ test_unpromotable : $ @ convention ( thin ) ( ) - > @ owned @ callee_owned ( ) - > Int { <nl> bb0 : <nl> % 0 = tuple ( ) <nl> - % 1 = alloc_box $ Foo <nl> + % 1 = alloc_box $ @ box Foo <nl> % 1a = project_box % 1 : $ @ box Foo , 0 <nl> % 2 = function_ref @ foo_allocating_init : $ @ convention ( thin ) ( @ thick Foo . Type ) - > @ owned Foo <nl> % 3 = metatype $ @ thick Foo . Type <nl> sil @ apply : $ @ convention ( thin ) ( @ owned @ callee_owned ( ) - > ( ) ) - > ( ) <nl> sil @ captureWithinGeneric : $ @ convention ( thin ) < T > ( @ inout Int , @ inout Int ) - > ( ) { <nl> / / CHECK : bb0 <nl> bb0 ( % 0 : $ * Int , % 1 : $ * Int ) : <nl> - % 2 = alloc_box $ Int <nl> + % 2 = alloc_box $ @ box Int <nl> % 2a = project_box % 2 : $ @ box Int , 0 <nl> copy_addr % 0 to [ initialization ] % 2a : $ * Int <nl> - % 4 = alloc_box $ Int <nl> + % 4 = alloc_box $ @ box Int <nl> % 4a = project_box % 4 : $ @ box Int , 0 <nl> copy_addr % 1 to [ initialization ] % 4a : $ * Int <nl> % 6 = function_ref @ apply : $ @ convention ( thin ) ( @ owned @ callee_owned ( ) - > ( ) ) - > ( ) <nl> mmm a / test / SILOptimizer / capture_promotion_generic_context . sil <nl> ppp b / test / SILOptimizer / capture_promotion_generic_context . sil <nl> sil @ call_promotable_box_from_generic : $ @ convention ( thin ) < T > ( @ in T , Int ) - > @ <nl> entry ( % 0 : $ * T , % 1 : $ Int ) : <nl> destroy_addr % 0 : $ * T <nl> % f = function_ref @ promotable_box : $ @ convention ( thin ) ( @ box Int ) - > Int <nl> - % b = alloc_box $ Int <nl> + % b = alloc_box $ @ box Int <nl> % a = project_box % b : $ @ box Int , 0 <nl> store % 1 to % a : $ * Int <nl> % k = partial_apply % f ( % b ) : $ @ convention ( thin ) ( @ box Int ) - > Int <nl> entry ( % 0 : $ * T , % 1 : $ * U , % 2 : $ Int ) : <nl> destroy_addr % 0 : $ * T <nl> destroy_addr % 1 : $ * U <nl> % f = function_ref @ generic_promotable_box : $ @ convention ( thin ) < V > ( @ in V , @ box Int ) - > Int <nl> - % b = alloc_box $ Int <nl> + % b = alloc_box $ @ box Int <nl> % a = project_box % b : $ @ box Int , 0 <nl> store % 2 to % a : $ * Int <nl> % k = partial_apply % f < U > ( % b ) : $ @ convention ( thin ) < V > ( @ in V , @ box Int ) - > Int <nl> mmm a / test / SILOptimizer / capture_promotion_reachability . sil <nl> ppp b / test / SILOptimizer / capture_promotion_reachability . sil <nl> func test_reachability_1 ( b : Builtin . Int1 , x : Builtin . Int64 , y : Builtin . Int64 ) { <nl> / / CHECK - LABEL : sil @ test_reachability_1 <nl> sil @ test_reachability_1 : $ @ convention ( thin ) ( Builtin . Int1 , Builtin . Int64 , Builtin . Int64 ) - > ( ) { <nl> bb0 ( % 0 : $ Builtin . Int1 , % 1 : $ Builtin . Int64 , % 2 : $ Builtin . Int64 ) : <nl> - % 3 = alloc_box $ Builtin . Int1 <nl> + % 3 = alloc_box $ @ box Builtin . Int1 <nl> % 3a = project_box % 3 : $ @ box Builtin . Int1 , 0 <nl> - % 4 = alloc_box $ Builtin . Int64 <nl> + % 4 = alloc_box $ @ box Builtin . Int64 <nl> % 4a = project_box % 4 : $ @ box Builtin . Int64 , 0 <nl> - % 5 = alloc_box $ Builtin . Int64 <nl> + % 5 = alloc_box $ @ box Builtin . Int64 <nl> % 5a = project_box % 5 : $ @ box Builtin . Int64 , 0 <nl> store % 0 to % 3a : $ * Builtin . Int1 <nl> store % 1 to % 4a : $ * Builtin . Int64 <nl> bb1 : <nl> br bb2 <nl> <nl> bb2 : <nl> - % 14 = alloc_box $ @ callee_owned ( ) - > Builtin . Int64 <nl> + % 14 = alloc_box $ @ box @ callee_owned ( ) - > Builtin . Int64 <nl> % 14a = project_box % 14 : $ @ box @ callee_owned ( ) - > Builtin . Int64 , 0 <nl> / / CHECK : [ [ CLOSURE0_PROMOTE0 : % . * ] ] = function_ref @ _TTSf2i__closure0 : <nl> % 15 = function_ref @ closure0 : $ @ convention ( thin ) ( @ owned @ box Builtin . Int64 ) - > Builtin . Int64 <nl> func test_reachability_2 ( b : Builtin . Int1 , x : Builtin . Int64 , y : Builtin . Int64 ) { <nl> / / CHECK - LABEL : sil @ test_reachability_2 <nl> sil @ test_reachability_2 : $ @ convention ( thin ) ( Builtin . Int1 , Builtin . Int64 , Builtin . Int64 ) - > ( ) { <nl> bb0 ( % 0 : $ Builtin . Int1 , % 1 : $ Builtin . Int64 , % 2 : $ Builtin . Int64 ) : <nl> - % 3 = alloc_box $ Builtin . Int1 <nl> + % 3 = alloc_box $ @ box Builtin . Int1 <nl> % 3a = project_box % 3 : $ @ box Builtin . Int1 , 0 <nl> - % 4 = alloc_box $ Builtin . Int64 <nl> + % 4 = alloc_box $ @ box Builtin . Int64 <nl> % 4a = project_box % 4 : $ @ box Builtin . Int64 , 0 <nl> - % 5 = alloc_box $ Builtin . Int64 <nl> + % 5 = alloc_box $ @ box Builtin . Int64 <nl> % 5a = project_box % 5 : $ @ box Builtin . Int64 , 0 <nl> store % 0 to % 3a : $ * Builtin . Int1 <nl> store % 1 to % 4a : $ * Builtin . Int64 <nl> store % 2 to % 5a : $ * Builtin . Int64 <nl> - % 9 = alloc_box $ @ callee_owned ( ) - > Builtin . Int64 <nl> + % 9 = alloc_box $ @ box @ callee_owned ( ) - > Builtin . Int64 <nl> % 9a = project_box % 9 : $ @ box @ callee_owned ( ) - > Builtin . Int64 , 0 <nl> / / CHECK : [ [ CLOSURE2 : % . * ] ] = function_ref @ closure2 : <nl> % 10 = function_ref @ closure2 : $ @ convention ( thin ) ( @ owned @ box Builtin . Int64 ) - > Builtin . Int64 <nl> func test_reachability_3 ( b : Builtin . Int1 , x : Builtin . Int64 , y : Builtin . Int64 ) { <nl> / / CHECK - LABEL : sil @ test_reachability_3 <nl> sil @ test_reachability_3 : $ @ convention ( thin ) ( Builtin . Int1 , Builtin . Int64 , Builtin . Int64 ) - > ( ) { <nl> bb0 ( % 0 : $ Builtin . Int1 , % 1 : $ Builtin . Int64 , % 2 : $ Builtin . Int64 ) : <nl> - % 3 = alloc_box $ Builtin . Int1 <nl> + % 3 = alloc_box $ @ box Builtin . Int1 <nl> % 3a = project_box % 3 : $ @ box Builtin . Int1 , 0 <nl> - % 4 = alloc_box $ Builtin . Int64 <nl> + % 4 = alloc_box $ @ box Builtin . Int64 <nl> % 4a = project_box % 4 : $ @ box Builtin . Int64 , 0 <nl> - % 5 = alloc_box $ Builtin . Int64 <nl> + % 5 = alloc_box $ @ box Builtin . Int64 <nl> % 5a = project_box % 5 : $ @ box Builtin . Int64 , 0 <nl> store % 0 to % 3a : $ * Builtin . Int1 <nl> store % 1 to % 4a : $ * Builtin . Int64 <nl> store % 2 to % 5a : $ * Builtin . Int64 <nl> - % 9 = alloc_box $ @ callee_owned ( ) - > Builtin . Int64 <nl> + % 9 = alloc_box $ @ box @ callee_owned ( ) - > Builtin . Int64 <nl> % 9a = project_box % 9 : $ @ box @ callee_owned ( ) - > Builtin . Int64 , 0 <nl> / / CHECK : [ [ CLOSURE4 : % . * ] ] = function_ref @ closure4 : <nl> % 10 = function_ref @ closure4 : $ @ convention ( thin ) ( @ owned @ box Builtin . Int64 ) - > Builtin . Int64 <nl> func test_reachability_4 ( b : Builtin . Int1 , x : Builtin . Int64 , y : Builtin . Int64 ) { <nl> / / CHECK - LABEL : sil @ test_reachability_4 <nl> sil @ test_reachability_4 : $ @ convention ( thin ) ( Builtin . Int1 , Builtin . Int64 , Builtin . Int64 ) - > ( ) { <nl> bb0 ( % 0 : $ Builtin . Int1 , % 1 : $ Builtin . Int64 , % 2 : $ Builtin . Int64 ) : <nl> - % 3 = alloc_box $ Builtin . Int1 <nl> + % 3 = alloc_box $ @ box Builtin . Int1 <nl> % 3a = project_box % 3 : $ @ box Builtin . Int1 , 0 <nl> - % 4 = alloc_box $ Builtin . Int64 <nl> + % 4 = alloc_box $ @ box Builtin . Int64 <nl> % 4a = project_box % 4 : $ @ box Builtin . Int64 , 0 <nl> - % 5 = alloc_box $ Builtin . Int64 <nl> + % 5 = alloc_box $ @ box Builtin . Int64 <nl> % 5a = project_box % 5 : $ @ box Builtin . Int64 , 0 <nl> store % 0 to % 3a : $ * Builtin . Int1 <nl> store % 1 to % 4a : $ * Builtin . Int64 <nl> store % 2 to % 5a : $ * Builtin . Int64 <nl> - % 9 = alloc_box $ @ callee_owned ( ) - > Builtin . Int64 <nl> + % 9 = alloc_box $ @ box @ callee_owned ( ) - > Builtin . Int64 <nl> % 9a = project_box % 9 : $ @ box @ callee_owned ( ) - > Builtin . Int64 , 0 <nl> / / CHECK : [ [ CLOSURE6 : % . * ] ] = function_ref @ closure6 : <nl> % 10 = function_ref @ closure6 : $ @ convention ( thin ) ( @ owned @ box Builtin . Int64 ) - > Builtin . Int64 <nl> mmm a / test / SILOptimizer / closure_specialize . sil <nl> ppp b / test / SILOptimizer / closure_specialize . sil <nl> bb0 ( % 0 : $ Int ) : <nl> / / CHECK - LABEL : sil shared @ _TFF7specgen6callerFSiT_U_FTSiSi_T_ : $ @ convention ( thin ) ( Int , Int , Int ) - > ( ) { <nl> sil shared @ _TFF7specgen6callerFSiT_U_FTSiSi_T_ : $ @ convention ( thin ) ( Int , Int , Int ) - > ( ) { <nl> bb0 ( % 0 : $ Int , % 1 : $ Int , % 2 : $ Int ) : <nl> - % 5 = alloc_box $ Int , var , name " p " / / users : % 6 , % 10 , % 14 <nl> + % 5 = alloc_box $ @ box Int , var , name " p " / / users : % 6 , % 10 , % 14 <nl> % 5a = project_box % 5 : $ @ box Int , 0 <nl> store % 0 to % 5a : $ * Int / / id : % 6 <nl> - % 7 = alloc_box $ Int , var , name " q " / / users : % 8 , % 11 , % 13 <nl> + % 7 = alloc_box $ @ box Int , var , name " q " / / users : % 8 , % 11 , % 13 <nl> % 7a = project_box % 7 : $ @ box Int , 0 <nl> store % 1 to % 7a : $ * Int / / id : % 8 <nl> / / function_ref specgen . callee ( Swift . Int , Swift . Int , Swift . Int ) - > ( ) <nl> bb0 ( % 0 : $ * Builtin . Int32 , % 1 : $ @ callee_owned ( Builtin . Int32 ) - > ( ) ) : <nl> / / CHECK - LABEL : sil @ pass_a_closure <nl> sil @ pass_a_closure : $ @ convention ( thin ) ( ) - > Builtin . Int32 { <nl> bb0 : <nl> - % 0 = alloc_box $ Builtin . Int32 , var , name " i " <nl> + % 0 = alloc_box $ @ box Builtin . Int32 , var , name " i " <nl> % 0a = project_box % 0 : $ @ box Builtin . Int32 , 0 <nl> % 1 = integer_literal $ Builtin . Int32 , 0 <nl> store % 1 to % 0a : $ * Builtin . Int32 <nl> mmm a / test / SILOptimizer / cse . sil <nl> ppp b / test / SILOptimizer / cse . sil <nl> bb0 : <nl> / / CHECK - NOT : unchecked_ref_cast <nl> sil @ removeTriviallyDeadInstructions : $ @ convention ( thin ) ( @ owned B ) - > ( ) { <nl> bb0 ( % 0 : $ B ) : <nl> - % 1 = alloc_box $ B <nl> + % 1 = alloc_box $ @ box B <nl> % 1a = project_box % 1 : $ @ box B , 0 <nl> % 2 = store % 0 to % 1a : $ * B <nl> % 3 = load % 1a : $ * B <nl> mmm a / test / SILOptimizer / dead_store_elim . sil <nl> ppp b / test / SILOptimizer / dead_store_elim . sil <nl> bb0 : <nl> / / CHECK : return <nl> sil @ store_after_store : $ @ convention ( thin ) ( @ owned B ) - > ( ) { <nl> bb0 ( % 0 : $ B ) : <nl> - % 1 = alloc_box $ B <nl> + % 1 = alloc_box $ @ box B <nl> % 1a = project_box % 1 : $ @ box B , 0 <nl> % 2 = store % 0 to % 1a : $ * B <nl> % 3 = store % 0 to % 1a : $ * B <nl> mmm a / test / SILOptimizer / definite_init . sil <nl> ppp b / test / SILOptimizer / definite_init . sil <nl> sil @ makesInt : $ @ convention ( thin ) ( ) - > Int <nl> / / CHECK - LABEL : sil @ use_before_init <nl> sil @ use_before_init : $ @ convention ( thin ) ( ) - > Int { <nl> bb0 : <nl> - % 0 = alloc_box $ Int <nl> + % 0 = alloc_box $ @ box Int <nl> % 0a = project_box % 0 : $ @ box Int , 0 <nl> % 1 = mark_uninitialized [ var ] % 0a : $ * Int / / expected - note { { variable defined here } } <nl> % 4 = load % 1 : $ * Int / / expected - error { { variable ' < unknown > ' used before being initialized } } <nl> bb0 : <nl> / / CHECK - LABEL : @ inout_uninit <nl> sil @ inout_uninit : $ @ convention ( thin ) ( ) - > ( ) { <nl> bb0 : <nl> - % 0 = alloc_box $ Int <nl> + % 0 = alloc_box $ @ box Int <nl> % 0a = project_box % 0 : $ @ box Int , 0 <nl> % 1 = mark_uninitialized [ var ] % 0a : $ * Int / / expected - note { { variable defined here } } <nl> <nl> bb0 : <nl> / / CHECK - LABEL : sil @ used_by_inout <nl> sil @ used_by_inout : $ @ convention ( thin ) ( Int ) - > ( Int , Int ) { <nl> bb0 ( % 0 : $ Int ) : <nl> - % 91 = alloc_box $ Int <nl> + % 91 = alloc_box $ @ box Int <nl> % 91a = project_box % 91 : $ @ box Int , 0 <nl> % 1 = mark_uninitialized [ var ] % 91a : $ * Int <nl> <nl> sil @ returns_generic_struct : $ @ convention ( thin ) ( ) - > @ out AddressOnlyStruct <nl> / / CHECK - LABEL : sil @ call_struct_return_function <nl> sil @ call_struct_return_function : $ @ convention ( thin ) ( ) - > Int { <nl> bb0 : <nl> - % 0 = alloc_box $ AddressOnlyStruct <nl> + % 0 = alloc_box $ @ box AddressOnlyStruct <nl> % 0a = project_box % 0 : $ @ box AddressOnlyStruct , 0 <nl> % 1 = mark_uninitialized [ var ] % 0a : $ * AddressOnlyStruct <nl> <nl> bb0 : <nl> / / CHECK - LABEL : sil @ tuple_elements1 <nl> sil @ tuple_elements1 : $ @ convention ( thin ) ( Int ) - > ( ) { <nl> bb0 ( % 0 : $ Int ) : <nl> - % 2 = alloc_box $ ( Int , Int ) <nl> + % 2 = alloc_box $ @ box ( Int , Int ) <nl> % 2a = project_box % 2 : $ @ box ( Int , Int ) , 0 <nl> % 3 = mark_uninitialized [ var ] % 2a : $ * ( Int , Int ) / / expected - note { { variable defined here } } <nl> % 4 = tuple_element_addr % 3 : $ * ( Int , Int ) , 0 <nl> bb0 ( % 0 : $ Int ) : <nl> / / CHECK - LABEL : sil @ tuple_elements2 <nl> sil @ tuple_elements2 : $ @ convention ( thin ) ( Int ) - > ( Int , Int ) { <nl> bb0 ( % 0 : $ Int ) : <nl> - % 2 = alloc_box $ ( Int , Int ) <nl> + % 2 = alloc_box $ @ box ( Int , Int ) <nl> % 2a = project_box % 2 : $ @ box ( Int , Int ) , 0 <nl> % 3 = mark_uninitialized [ var ] % 2a : $ * ( Int , Int ) / / expected - note { { variable defined here } } <nl> % 18 = tuple_element_addr % 3 : $ * ( Int , Int ) , 0 <nl> bb0 ( % 0 : $ Int ) : <nl> / / CHECK - LABEL : sil @ copy_addr1 <nl> sil @ copy_addr1 : $ @ convention ( thin ) < T > ( @ in T ) - > @ out T { <nl> bb0 ( % 0 : $ * T , % 1 : $ * T ) : <nl> - % 3 = alloc_box $ T <nl> + % 3 = alloc_box $ @ box T <nl> % 3a = project_box % 3 : $ @ box T , 0 <nl> % 4 = mark_uninitialized [ var ] % 3a : $ * T <nl> copy_addr [ take ] % 1 to [ initialization ] % 4 : $ * T <nl> bb0 ( % 0 : $ * T , % 1 : $ * T ) : <nl> / / CHECK - LABEL : sil @ copy_addr2 <nl> sil @ copy_addr2 : $ @ convention ( thin ) < T > ( @ in T ) - > @ out T { <nl> bb0 ( % 0 : $ * T , % 1 : $ * T ) : <nl> - % 3 = alloc_box $ T <nl> + % 3 = alloc_box $ @ box T <nl> % 3a = project_box % 3 : $ @ box T , 0 <nl> % 4 = mark_uninitialized [ var ] % 3a : $ * T / / expected - note { { variable defined here } } <nl> copy_addr % 4 to [ initialization ] % 0 : $ * T / / expected - error { { variable ' < unknown > ' used before being initialized } } <nl> sil @ closure0 : $ @ convention ( thin ) ( @ owned @ box Int ) - > ( ) <nl> / / CHECK - LABEL : sil @ closure_test <nl> sil @ closure_test : $ @ convention ( thin ) ( ) - > ( ) { <nl> bb0 : <nl> - % 1 = alloc_box $ Int <nl> + % 1 = alloc_box $ @ box Int <nl> % 1a = project_box % 1 : $ @ box Int , 0 <nl> % 0 = mark_uninitialized [ var ] % 1a : $ * Int / / expected - note { { variable defined here } } <nl> <nl> sil @ getSomeOptionalClass : $ @ convention ( thin ) ( ) - > Optional < SomeClass > <nl> / / CHECK - LABEL : sil @ assign_test_trivial <nl> sil @ assign_test_trivial : $ @ convention ( thin ) ( Int ) - > Int { <nl> bb0 ( % 0 : $ Int ) : <nl> - % 7 = alloc_box $ Int <nl> + % 7 = alloc_box $ @ box Int <nl> % 7a = project_box % 7 : $ @ box Int , 0 <nl> % 1 = mark_uninitialized [ var ] % 7a : $ * Int <nl> <nl> bb0 : <nl> / / Assignments of nontrivial types . The first becomes an initialize ( i . e . , <nl> / / lone store ) , the second becomes an assignment ( retain / release dance ) . <nl> <nl> - % b = alloc_box $ SomeClass <nl> + % b = alloc_box $ @ box SomeClass <nl> % ba = project_box % b : $ @ box SomeClass , 0 <nl> % c = mark_uninitialized [ var ] % ba : $ * SomeClass <nl> <nl> bb0 : <nl> / / CHECK - LABEL : sil @ assign_test_addressonly <nl> sil @ assign_test_addressonly : $ @ convention ( thin ) < T > ( @ in T ) - > @ out T { <nl> bb0 ( % 0 : $ * T , % 1 : $ * T ) : <nl> - % b = alloc_box $ T <nl> + % b = alloc_box $ @ box T <nl> % ba = project_box % b : $ @ box T , 0 <nl> % 2 = mark_uninitialized [ var ] % ba : $ * T <nl> <nl> bb0 : <nl> / / Assignments of weak pointer . The first becomes an initialize , and the <nl> / / second becomes an assignment . <nl> <nl> - % b = alloc_box $ @ sil_weak Optional < SomeClass > <nl> + % b = alloc_box $ @ box @ sil_weak Optional < SomeClass > <nl> % ba = project_box % b : $ @ box @ sil_weak Optional < SomeClass > , 0 <nl> % c = mark_uninitialized [ var ] % ba : $ * @ sil_weak Optional < SomeClass > / / expected - note { { variable defined here } } <nl> <nl> bb0 : <nl> / / Assignments of unowned pointer . The first becomes an initialize , and the <nl> / / second becomes an assignment . <nl> <nl> - % b = alloc_box $ @ sil_unowned SomeClass <nl> + % b = alloc_box $ @ box @ sil_unowned SomeClass <nl> % ba = project_box % b : $ @ box @ sil_unowned SomeClass , 0 <nl> % c = mark_uninitialized [ var ] % ba : $ * @ sil_unowned SomeClass <nl> <nl> struct ContainsNativeObject { <nl> <nl> sil @ test_struct : $ @ convention ( thin ) ( @ inout ContainsNativeObject ) - > ( ) { <nl> bb0 ( % 0 : $ * ContainsNativeObject ) : <nl> - % b = alloc_box $ ContainsNativeObject <nl> + % b = alloc_box $ @ box ContainsNativeObject <nl> % ba = project_box % b : $ @ box ContainsNativeObject , 0 <nl> % c = mark_uninitialized [ var ] % ba : $ * ContainsNativeObject <nl> % 1 = load % 0 : $ * ContainsNativeObject <nl> sil @ superinit : $ @ convention ( method ) ( @ owned RootClassWithIVars ) - > @ owned Root <nl> <nl> sil @ derived_test1 : $ @ convention ( method ) ( @ owned DerivedClassWithIVars ) - > @ owned DerivedClassWithIVars { <nl> bb0 ( % 0 : $ DerivedClassWithIVars ) : <nl> - % 1 = alloc_box $ DerivedClassWithIVars <nl> + % 1 = alloc_box $ @ box DerivedClassWithIVars <nl> % 1a = project_box % 1 : $ @ box DerivedClassWithIVars , 0 <nl> % 3 = mark_uninitialized [ derivedself ] % 1a : $ * DerivedClassWithIVars <nl> store % 0 to % 3 : $ * DerivedClassWithIVars <nl> bb0 ( % 0 : $ DerivedClassWithIVars ) : <nl> <nl> sil @ derived_test2 : $ @ convention ( method ) ( @ owned DerivedClassWithIVars ) - > @ owned DerivedClassWithIVars { <nl> bb0 ( % 0 : $ DerivedClassWithIVars ) : <nl> - % 1 = alloc_box $ DerivedClassWithIVars <nl> + % 1 = alloc_box $ @ box DerivedClassWithIVars <nl> % 1a = project_box % 1 : $ @ box DerivedClassWithIVars , 0 <nl> % 3 = mark_uninitialized [ derivedself ] % 1a : $ * DerivedClassWithIVars <nl> store % 0 to % 3 : $ * DerivedClassWithIVars <nl> bb0 ( % 0 : $ DerivedClassWithNontrivialStoredProperties ) : <nl> <nl> / / CHECK - LABEL : sil @ test_delegating_box_release <nl> / / CHECK : bb0 ( % 0 : $ RootClassWithNontrivialStoredProperties ) : <nl> - / / CHECK - NEXT : [ [ SELFBOX : % [ 0 - 9 ] + ] ] = alloc_box $ RootClassWithNontrivialStoredProperties <nl> + / / CHECK - NEXT : [ [ SELFBOX : % [ 0 - 9 ] + ] ] = alloc_box $ @ box RootClassWithNontrivialStoredProperties <nl> / / CHECK - NEXT : [ [ PB : % [ 0 - 9 ] + ] ] = project_box [ [ SELFBOX ] ] <nl> / / CHECK - NEXT : store % 0 to [ [ PB ] ] <nl> / / CHECK - NEXT : [ [ SELF : % [ 0 - 9 ] + ] ] = load [ [ PB ] ] <nl> bb0 ( % 0 : $ DerivedClassWithNontrivialStoredProperties ) : <nl> / / CHECK - NEXT : dealloc_box [ [ SELFBOX ] ] <nl> sil @ test_delegating_box_release : $ @ convention ( method ) ( @ owned RootClassWithNontrivialStoredProperties ) - > ( ) { <nl> bb0 ( % 0 : $ RootClassWithNontrivialStoredProperties ) : <nl> - % 2 = alloc_box $ RootClassWithNontrivialStoredProperties <nl> + % 2 = alloc_box $ @ box RootClassWithNontrivialStoredProperties <nl> % 2a = project_box % 2 : $ @ box RootClassWithNontrivialStoredProperties , 0 <nl> % 4 = mark_uninitialized [ delegatingself ] % 2a : $ * RootClassWithNontrivialStoredProperties <nl> store % 0 to % 4 : $ * RootClassWithNontrivialStoredProperties <nl> bb0 ( % 0 : $ RootClassWithNontrivialStoredProperties ) : <nl> <nl> / / CHECK - LABEL : sil @ test_delegating_rvalue_release <nl> / / CHECK : bb0 ( % 0 : $ RootClassWithNontrivialStoredProperties ) : <nl> - / / CHECK - NEXT : [ [ SELFBOX : % [ 0 - 9 ] + ] ] = alloc_box $ RootClassWithNontrivialStoredProperties <nl> + / / CHECK - NEXT : [ [ SELFBOX : % [ 0 - 9 ] + ] ] = alloc_box $ @ box RootClassWithNontrivialStoredProperties <nl> / / CHECK - NEXT : [ [ PB : % [ 0 - 9 ] + ] ] = project_box [ [ SELFBOX ] ] <nl> / / CHECK - NEXT : store % 0 to [ [ PB ] ] <nl> / / CHECK - NEXT : [ [ SELF : % [ 0 - 9 ] + ] ] = load [ [ PB ] ] <nl> bb0 ( % 0 : $ RootClassWithNontrivialStoredProperties ) : <nl> / / CHECK - NEXT : dealloc_box [ [ SELFBOX ] ] <nl> sil @ test_delegating_rvalue_release : $ @ convention ( method ) ( @ owned RootClassWithNontrivialStoredProperties ) - > ( ) { <nl> bb0 ( % 0 : $ RootClassWithNontrivialStoredProperties ) : <nl> - % 2 = alloc_box $ RootClassWithNontrivialStoredProperties <nl> + % 2 = alloc_box $ @ box RootClassWithNontrivialStoredProperties <nl> % 2a = project_box % 2 : $ @ box RootClassWithNontrivialStoredProperties , 0 <nl> % 4 = mark_uninitialized [ delegatingself ] % 2a : $ * RootClassWithNontrivialStoredProperties <nl> store % 0 to % 4 : $ * RootClassWithNontrivialStoredProperties <nl> bb0 ( % 0 : $ DerivedClassWithNontrivialStoredProperties ) : <nl> / / < rdar : / / problem / 18199087 > DI doesn ' t catch use of super properties lexically inside super . init call <nl> sil @ super_init_out_of_order : $ @ convention ( method ) ( @ owned DerivedClassWithIVars , Int ) - > @ owned DerivedClassWithIVars { <nl> bb0 ( % 0 : $ DerivedClassWithIVars , % i : $ Int ) : <nl> - % 1 = alloc_box $ DerivedClassWithIVars <nl> + % 1 = alloc_box $ @ box DerivedClassWithIVars <nl> % 1a = project_box % 1 : $ @ box DerivedClassWithIVars , 0 <nl> % 3 = mark_uninitialized [ derivedself ] % 1a : $ * DerivedClassWithIVars <nl> store % 0 to % 3 : $ * DerivedClassWithIVars <nl> mmm a / test / SILOptimizer / definite_init_crashes . sil <nl> ppp b / test / SILOptimizer / definite_init_crashes . sil <nl> struct Triple { <nl> / / CHECK - LABEL : sil @ TripleTest <nl> sil @ TripleTest : $ @ convention ( method ) ( Int , @ inout Triple ) - > Triple { <nl> bb0 ( % 0 : $ Int , % 1 : $ * Triple ) : <nl> - % 4 = alloc_box $ Triple <nl> + % 4 = alloc_box $ @ box Triple <nl> % 4a = project_box % 4 : $ @ box Triple , 0 <nl> % 5 = load % 1 : $ * Triple <nl> store % 5 to % 4a : $ * Triple <nl> struct Single { <nl> / / CHECK - LABEL : sil @ SingleTest <nl> sil @ SingleTest : $ @ convention ( method ) ( @ inout Single , Int ) - > Single { <nl> bb0 ( % 0 : $ * Single , % 1 : $ Int ) : <nl> - % 4 = alloc_box $ Single <nl> + % 4 = alloc_box $ @ box Single <nl> % 4a = project_box % 4 : $ @ box Single , 0 <nl> % 5 = load % 0 : $ * Single <nl> store % 5 to % 4a : $ * Single <nl> sil @ getSomeUnion : $ @ convention ( thin ) ( @ owned SomeClass , @ thin SomeUnion . Type ) <nl> sil @ test_union_release : $ @ convention ( thin ) ( ) - > ( ) { <nl> bb0 : <nl> % 0 = tuple ( ) <nl> - % 1 = alloc_box $ SomeUnion / / users : % 9 , % 8 <nl> + % 1 = alloc_box $ @ box SomeUnion / / users : % 9 , % 8 <nl> % 1a = project_box % 1 : $ @ box SomeUnion , 0 <nl> % 2 = function_ref @ getSomeUnion : $ @ convention ( thin ) ( @ owned SomeClass , @ thin SomeUnion . Type ) - > @ owned SomeUnion / / user : % 7 <nl> % 3 = metatype $ @ thin SomeUnion . Type / / user : % 7 <nl> mmm a / test / SILOptimizer / diagnose_unreachable . sil <nl> ppp b / test / SILOptimizer / diagnose_unreachable . sil <nl> bb0 : <nl> / / CHECK - LABEL : sil @ removeTriviallyDeadInstructions <nl> sil @ removeTriviallyDeadInstructions : $ @ convention ( thin ) ( @ owned B ) - > ( ) { <nl> bb0 ( % 0 : $ B ) : <nl> - % 1 = alloc_box $ B <nl> + % 1 = alloc_box $ @ box B <nl> % 1a = project_box % 1 : $ @ box B , 0 <nl> % 2 = store % 0 to % 1a : $ * B / / CHECK : store <nl> % 3 = load % 1a : $ * B <nl> mmm a / test / SILOptimizer / escape_analysis . sil <nl> ppp b / test / SILOptimizer / escape_analysis . sil <nl> sil @ call_copy_addr_content : $ @ convention ( thin ) ( ) - > ( ) { <nl> / / CHECK - NEXT : End <nl> sil @ test_partial_apply : $ @ convention ( thin ) ( Int64 , @ owned X , @ owned Y ) - > Int64 { <nl> bb0 ( % 0 : $ Int64 , % 1 : $ X , % 2 : $ Y ) : <nl> - % 3 = alloc_box $ Int64 <nl> + % 3 = alloc_box $ @ box Int64 <nl> % 4 = project_box % 3 : $ @ box Int64 , 0 <nl> store % 0 to % 4 : $ * Int64 <nl> - % 6 = alloc_box $ Y <nl> + % 6 = alloc_box $ @ box Y <nl> % 7 = project_box % 6 : $ @ box Y , 0 <nl> store % 2 to % 7 : $ * Y <nl> % 9 = function_ref @ closure1 : $ @ convention ( thin ) ( @ owned X , @ owned @ box Int64 , @ owned @ box Y ) - > Int64 <nl> bb0 ( % 0 : $ X , % 1 : $ @ box Y ) : <nl> / / CHECK - NEXT : End <nl> sil @ test_escaped_box : $ @ convention ( thin ) ( Int64 ) - > Int64 { <nl> bb0 ( % 0 : $ Int64 ) : <nl> - % 1 = alloc_box $ Int64 <nl> + % 1 = alloc_box $ @ box Int64 <nl> % 2 = project_box % 1 : $ @ box Int64 , 0 <nl> store % 0 to % 2 : $ * Int64 <nl> <nl> sil @ takebox : $ @ convention ( thin ) ( @ owned @ box Int64 ) - > ( ) <nl> / / CHECK - NEXT : End <nl> sil @ test_escaped_partial_apply : $ @ convention ( thin ) ( Int64 ) - > ( ) { <nl> bb0 ( % 0 : $ Int64 ) : <nl> - % 1 = alloc_box $ Int64 <nl> + % 1 = alloc_box $ @ box Int64 <nl> % 2 = project_box % 1 : $ @ box Int64 , 0 <nl> store % 0 to % 2 : $ * Int64 <nl> % 4 = function_ref @ closure3 : $ @ convention ( thin ) ( @ owned @ box Int64 ) - > Int64 <nl> sil @ unknown_throwing_func : $ @ convention ( thin ) ( @ owned X ) - > ( @ owned X , @ error <nl> / / CHECK - NEXT : End <nl> sil @ test_release_of_partial_apply_with_box : $ @ convention ( thin ) ( @ owned Y ) - > ( ) { <nl> bb0 ( % 0 : $ Y ) : <nl> - % 1 = alloc_box $ Y <nl> + % 1 = alloc_box $ @ box Y <nl> % 2 = project_box % 1 : $ @ box Y , 0 <nl> store % 0 to % 2 : $ * Y <nl> % 3 = function_ref @ take_y_box : $ @ convention ( thin ) ( @ owned @ box Y ) - > ( ) <nl> mmm a / test / SILOptimizer / inout_deshadow_integration . swift <nl> ppp b / test / SILOptimizer / inout_deshadow_integration . swift <nl> struct StructWithMutatingMethod { <nl> / / CHECK : } <nl> <nl> / / CHECK - LABEL : sil hidden @ _TFV26inout_deshadow_integration24StructWithMutatingMethod28testStandardLibraryOperators { { . * } } : $ @ convention ( method ) ( @ inout StructWithMutatingMethod ) - > ( ) { <nl> - / / CHECK - NOT : alloc_box $ StructWithMutatingMethod <nl> + / / CHECK - NOT : alloc_box $ @ box StructWithMutatingMethod <nl> / / CHECK - NOT : alloc_stack $ StructWithMutatingMethod <nl> / / CHECK : } <nl> <nl> mmm a / test / SILOptimizer / looprotate . sil <nl> ppp b / test / SILOptimizer / looprotate . sil <nl> sil @ looprotate : $ @ convention ( thin ) ( Int32 , @ owned Bar ) - > Int32 { <nl> bb0 ( % 0 : $ Int32 , % 25 : $ Bar ) : <nl> % 1 = struct_extract % 0 : $ Int32 , # Int32 . _value <nl> % 2 = integer_literal $ Builtin . Int32 , 0 <nl> - % 30 = alloc_box $ Bool <nl> + % 30 = alloc_box $ @ box Bool <nl> % 30a = project_box % 30 : $ @ box Bool , 0 <nl> br bb1 ( % 1 : $ Builtin . Int32 , % 2 : $ Builtin . Int32 , % 25 : $ Bar , % 30 : $ @ box Bool , % 30a : $ * Bool ) <nl> <nl> sil @ looprotate_with_opened_archetype : $ @ convention ( thin ) ( Int32 , @ in P ) - > Int <nl> bb0 ( % 0 : $ Int32 , % 25 : $ * P ) : <nl> % 1 = struct_extract % 0 : $ Int32 , # Int32 . _value <nl> % 2 = integer_literal $ Builtin . Int32 , 0 <nl> - % 30 = alloc_box $ Bool <nl> + % 30 = alloc_box $ @ box Bool <nl> % 30a = project_box % 30 : $ @ box Bool , 0 <nl> % 40 = open_existential_addr % 25 : $ * P to $ * @ opened ( " C22498FA - CABF - 11E5 - B9A9 - 685B35C48C83 " ) P <nl> br bb1 ( % 1 : $ Builtin . Int32 , % 2 : $ Builtin . Int32 , % 25 : $ * P , % 30 : $ @ box Bool , % 30a : $ * Bool ) <nl> mmm a / test / SILOptimizer / lslocation_expansion . sil <nl> ppp b / test / SILOptimizer / lslocation_expansion . sil <nl> sil @ stack_store : $ @ convention ( thin ) ( ) - > ( ) { <nl> / / CHECK - NEXT : [ [ RET0 : % . + ] ] = alloc_box <nl> sil @ store_after_store : $ @ convention ( thin ) ( @ owned B ) - > ( ) { <nl> bb0 ( % 0 : $ B ) : <nl> - % 1 = alloc_box $ B <nl> + % 1 = alloc_box $ @ box B <nl> % 1a = project_box % 1 : $ @ box B , 0 <nl> % 2 = store % 0 to % 1a : $ * B <nl> % 3 = store % 0 to % 1a : $ * B <nl> mmm a / test / SILOptimizer / lslocation_reduction . sil <nl> ppp b / test / SILOptimizer / lslocation_reduction . sil <nl> sil @ stack_store : $ @ convention ( thin ) ( ) - > ( ) { <nl> / / CHECK - NEXT : [ [ RET0 : % . + ] ] = alloc_box <nl> sil @ store_after_store : $ @ convention ( thin ) ( @ owned B ) - > ( ) { <nl> bb0 ( % 0 : $ B ) : <nl> - % 1 = alloc_box $ B <nl> + % 1 = alloc_box $ @ box B <nl> % 1a = project_box % 1 : $ @ box B , 0 <nl> % 2 = store % 0 to % 1a : $ * B <nl> % 3 = store % 0 to % 1a : $ * B <nl> mmm a / test / SILOptimizer / mandatory_inlining . sil <nl> ppp b / test / SILOptimizer / mandatory_inlining . sil <nl> sil @ fromLiteral : $ @ convention ( thin ) ( Builtin . Int128 , @ thin Int64 . Type ) - > Int6 <nl> / / CHECK - LABEL : sil [ transparent ] @ test_add : $ @ convention ( thin ) ( Int64 ) - > Int64 { <nl> sil [ transparent ] @ test_add : $ @ convention ( thin ) ( Int64 ) - > Int64 { <nl> bb0 ( % 0 : $ Int64 ) : <nl> - % 1 = alloc_box $ Int64 <nl> + % 1 = alloc_box $ @ box Int64 <nl> % 1a = project_box % 1 : $ @ box Int64 , 0 <nl> store % 0 to % 1a : $ * Int64 <nl> % 3 = function_ref @ plus : $ @ convention ( thin ) ( Int64 , Int64 ) - > Int64 <nl> bb0 ( % 0 : $ Int64 ) : <nl> / / CHECK - LABEL : sil @ inline_test_add : $ @ convention ( thin ) ( Int64 ) - > Int64 { <nl> sil @ inline_test_add : $ @ convention ( thin ) ( Int64 ) - > Int64 { <nl> / / CHECK : [ [ BB0 : . * ] ] ( [ [ VAL0 : % . * ] ] : $ Int64 ) : <nl> - / / CHECK : [ [ VAL1 : % . * ] ] = alloc_box $ Int64 <nl> + / / CHECK : [ [ VAL1 : % . * ] ] = alloc_box $ @ box Int64 <nl> / / CHECK : [ [ PB1 : % . * ] ] = project_box [ [ VAL1 ] ] <nl> / / CHECK : store [ [ VAL0 ] ] to [ [ PB1 ] ] <nl> / / CHECK : [ [ VAL3 : % . * ] ] = function_ref @ plus <nl> sil @ inline_test_add : $ @ convention ( thin ) ( Int64 ) - > Int64 { <nl> / / CHECK : [ [ VAL8 : % . * ] ] = integer_literal $ Builtin . Int128 , 10 <nl> / / CHECK : [ [ VAL9 : % . * ] ] = apply [ [ VAL6 ] ] ( [ [ VAL8 ] ] , [ [ VAL7 ] ] ) <nl> / / CHECK : [ [ VAL10 : % . * ] ] = apply [ [ VAL4 ] ] ( [ [ VAL5 ] ] , [ [ VAL9 ] ] ) <nl> - / / CHECK : [ [ VAL11 : % . * ] ] = alloc_box $ Int64 <nl> + / / CHECK : [ [ VAL11 : % . * ] ] = alloc_box $ @ box Int64 <nl> / / CHECK : [ [ PB11 : % . * ] ] = project_box [ [ VAL11 ] ] <nl> / / CHECK : store [ [ VAL10 ] ] to [ [ PB11 ] ] <nl> / / CHECK : [ [ VAL13 : % . * ] ] = function_ref @ plus <nl> sil @ inline_test_add : $ @ convention ( thin ) ( Int64 ) - > Int64 { <nl> / / CHECK : return [ [ VAL25 ] ] <nl> <nl> bb0 ( % 0 : $ Int64 ) : <nl> - % 1 = alloc_box $ Int64 <nl> + % 1 = alloc_box $ @ box Int64 <nl> % 1a = project_box % 1 : $ @ box Int64 , 0 <nl> store % 0 to % 1a : $ * Int64 <nl> % 3 = function_ref @ plus : $ @ convention ( thin ) ( Int64 , Int64 ) - > Int64 <nl> bb0 ( % 0 : $ Int64 ) : <nl> / / CHECK - LABEL : sil @ inline_twice_test_add : $ @ convention ( thin ) ( Int64 ) - > Int64 { <nl> sil @ inline_twice_test_add : $ @ convention ( thin ) ( Int64 ) - > Int64 { <nl> / / CHECK : [ [ BB0 : . * ] ] ( [ [ VAL0 : % . * ] ] : $ Int64 ) : <nl> - / / CHECK : [ [ VAL1 : % . * ] ] = alloc_box $ Int64 <nl> + / / CHECK : [ [ VAL1 : % . * ] ] = alloc_box $ @ box Int64 <nl> / / CHECK : [ [ PB1 : % . * ] ] = project_box [ [ VAL1 ] ] <nl> / / CHECK : store [ [ VAL0 ] ] to [ [ PB1 ] ] <nl> / / CHECK : [ [ VAL3 : % . * ] ] = function_ref @ plus <nl> sil @ inline_twice_test_add : $ @ convention ( thin ) ( Int64 ) - > Int64 { <nl> / / CHECK : [ [ VAL8 : % . * ] ] = integer_literal $ Builtin . Int128 , 10 <nl> / / CHECK : [ [ VAL9 : % . * ] ] = apply [ [ VAL6 ] ] ( [ [ VAL8 ] ] , [ [ VAL7 ] ] ) <nl> / / CHECK : [ [ VAL10 : % . * ] ] = apply [ [ VAL4 ] ] ( [ [ VAL5 ] ] , [ [ VAL9 ] ] ) <nl> - / / CHECK : [ [ VAL11 : % . * ] ] = alloc_box $ Int64 <nl> + / / CHECK : [ [ VAL11 : % . * ] ] = alloc_box $ @ box Int64 <nl> / / CHECK : [ [ PB11 : % . * ] ] = project_box [ [ VAL11 ] ] <nl> / / CHECK : store [ [ VAL10 ] ] to [ [ PB11 ] ] <nl> / / CHECK : [ [ VAL13 : % . * ] ] = function_ref @ plus <nl> sil @ inline_twice_test_add : $ @ convention ( thin ) ( Int64 ) - > Int64 { <nl> / / CHECK : [ [ VAL18 : % . * ] ] = apply [ [ VAL15 ] ] ( [ [ VAL17 ] ] , [ [ VAL16 ] ] ) <nl> / / CHECK : [ [ VAL19 : % . * ] ] = apply [ [ VAL13 ] ] ( [ [ VAL14 ] ] , [ [ VAL18 ] ] ) <nl> / / CHECK : strong_release [ [ VAL11 ] ] <nl> - / / CHECK : [ [ VAL21 : % . * ] ] = alloc_box $ Int64 <nl> + / / CHECK : [ [ VAL21 : % . * ] ] = alloc_box $ @ box Int64 <nl> / / CHECK : [ [ PB21 : % . * ] ] = project_box [ [ VAL21 ] ] <nl> / / CHECK : store [ [ VAL19 ] ] to [ [ PB21 ] ] <nl> / / CHECK : [ [ VAL23 : % . * ] ] = function_ref @ plus <nl> sil @ inline_twice_test_add : $ @ convention ( thin ) ( Int64 ) - > Int64 { <nl> / / CHECK : return [ [ VAL35 ] ] <nl> <nl> bb0 ( % 0 : $ Int64 ) : <nl> - % 1 = alloc_box $ Int64 <nl> + % 1 = alloc_box $ @ box Int64 <nl> % 1a = project_box % 1 : $ @ box Int64 , 0 <nl> store % 0 to % 1a : $ * Int64 <nl> % 3 = function_ref @ plus : $ @ convention ( thin ) ( Int64 , Int64 ) - > Int64 <nl> protocol SomeProtocol { <nl> / / CHECK - LABEL : sil [ transparent ] @ test_existential_metatype : $ @ convention ( thin ) ( @ in SomeProtocol ) - > @ thick SomeProtocol . Type <nl> sil [ transparent ] @ test_existential_metatype : $ @ convention ( thin ) ( @ in SomeProtocol ) - > @ thick SomeProtocol . Type { <nl> bb0 ( % 0 : $ * SomeProtocol ) : <nl> - % 1 = alloc_box $ SomeProtocol <nl> + % 1 = alloc_box $ @ box SomeProtocol <nl> % 1a = project_box % 1 : $ @ box SomeProtocol , 0 <nl> copy_addr [ take ] % 0 to [ initialization ] % 1a : $ * SomeProtocol <nl> % 4 = alloc_stack $ SomeProtocol <nl> bb0 ( % 0 : $ * SomeProtocol ) : <nl> / / CHECK - LABEL : sil @ inline_test_existential_metatype : $ @ convention ( thin ) ( @ in SomeProtocol ) - > @ thick SomeProtocol . Type <nl> sil @ inline_test_existential_metatype : $ @ convention ( thin ) ( @ in SomeProtocol ) - > @ thick SomeProtocol . Type { <nl> / / CHECK : [ [ BB0 : . * ] ] ( [ [ VAL0 : % . * ] ] : $ * SomeProtocol ) : <nl> - / / CHECK : [ [ VAL1 : % . * ] ] = alloc_box $ SomeProtocol <nl> + / / CHECK : [ [ VAL1 : % . * ] ] = alloc_box $ @ box SomeProtocol <nl> / / CHECK : [ [ PB1 : % . * ] ] = project_box [ [ VAL1 ] ] <nl> / / CHECK : copy_addr [ take ] % 0 to [ initialization ] [ [ PB1 ] ] <nl> / / CHECK : [ [ VAL4 : % . * ] ] = alloc_stack $ SomeProtocol <nl> sil @ bar : $ @ convention ( thin ) ( Float32 ) - > Bool <nl> / / CHECK - LABEL : sil [ transparent ] @ test_control_flow : $ @ convention ( thin ) ( Float , Float ) - > Float <nl> sil [ transparent ] @ test_control_flow : $ @ convention ( thin ) ( Float , Float ) - > Float { <nl> bb0 ( % 0 : $ Float , % 1 : $ Float ) : <nl> - % 2 = alloc_box $ Float <nl> + % 2 = alloc_box $ @ box Float <nl> % 2a = project_box % 2 : $ @ box Float , 0 <nl> - % 3 = alloc_box $ Float <nl> + % 3 = alloc_box $ @ box Float <nl> % 3a = project_box % 3 : $ @ box Float , 0 <nl> store % 0 to % 2a : $ * Float <nl> store % 1 to % 3a : $ * Float <nl> bb6 ( % 39 : $ Float ) : <nl> sil @ inline_test_control_flow : $ @ convention ( thin ) ( Float ) - > Float { <nl> <nl> / / CHECK : [ [ BB0 : . * ] ] ( [ [ VAL0 : % . * ] ] : $ Float ) : <nl> - / / CHECK : [ [ VAL1 : % . * ] ] = alloc_box $ Float <nl> + / / CHECK : [ [ VAL1 : % . * ] ] = alloc_box $ @ box Float <nl> / / CHECK : [ [ PB1 : % . * ] ] = project_box [ [ VAL1 ] ] <nl> / / CHECK : store [ [ VAL0 ] ] to [ [ PB1 ] ] <nl> / / CHECK : [ [ VAL3 : % . * ] ] = function_ref @ sub_floats <nl> sil @ inline_test_control_flow : $ @ convention ( thin ) ( Float ) - > Float { <nl> / / CHECK : [ [ VAL12 : % . * ] ] = metatype $ @ thin Float . Type <nl> / / CHECK : [ [ VAL13 : % . * ] ] = float_literal $ Builtin . FPIEEE64 , 0x4000000000000000 <nl> / / CHECK : [ [ VAL14 : % . * ] ] = apply [ [ VAL11 ] ] ( [ [ VAL13 ] ] , [ [ VAL12 ] ] ) <nl> - / / CHECK : [ [ VAL15 : % . * ] ] = alloc_box $ Float <nl> + / / CHECK : [ [ VAL15 : % . * ] ] = alloc_box $ @ box Float <nl> / / CHECK : [ [ PB15 : % . * ] ] = project_box [ [ VAL15 ] ] <nl> - / / CHECK : [ [ VAL16 : % . * ] ] = alloc_box $ Float <nl> + / / CHECK : [ [ VAL16 : % . * ] ] = alloc_box $ @ box Float <nl> / / CHECK : [ [ PB16 : % . * ] ] = project_box [ [ VAL16 ] ] <nl> / / CHECK : store [ [ VAL10 ] ] to [ [ PB15 ] ] <nl> / / CHECK : store [ [ VAL14 ] ] to [ [ PB16 ] ] <nl> sil @ inline_test_control_flow : $ @ convention ( thin ) ( Float ) - > Float { <nl> / / CHECK : return [ [ VAL61 ] ] <nl> <nl> bb0 ( % 0 : $ Float ) : <nl> - % 1 = alloc_box $ Float <nl> + % 1 = alloc_box $ @ box Float <nl> % 1a = project_box % 1 : $ @ box Float , 0 <nl> store % 0 to % 1a : $ * Float <nl> % 3 = function_ref @ sub_floats : $ @ convention ( thin ) ( Float , Float ) - > Float <nl> sil @ true_getter : $ @ convention ( thin ) ( ) - > Bool <nl> <nl> sil [ transparent ] @ short_circuit_or : $ @ convention ( thin ) ( Bool , @ callee_owned ( ) - > Bool ) - > Bool { <nl> bb0 ( % 0 : $ Bool , % 1 : $ @ callee_owned ( ) - > Bool ) : <nl> - % 2 = alloc_box $ Bool <nl> + % 2 = alloc_box $ @ box Bool <nl> % 2a = project_box % 2 : $ @ box Bool , 0 <nl> - % 3 = alloc_box $ @ callee_owned ( ) - > Bool <nl> + % 3 = alloc_box $ @ box @ callee_owned ( ) - > Bool <nl> % 3a = project_box % 3 : $ @ box @ callee_owned ( ) - > Bool , 0 <nl> store % 0 to % 2a : $ * Bool <nl> store % 1 to % 3a : $ * @ callee_owned ( ) - > Bool <nl> sil @ test_short_circuit : $ @ convention ( thin ) ( Bool , Bool ) - > Bool { <nl> / / CHECK : return { { . * } } <nl> <nl> bb0 ( % 0 : $ Bool , % 1 : $ Bool ) : <nl> - % 2 = alloc_box $ Bool <nl> + % 2 = alloc_box $ @ box Bool <nl> % 2a = project_box % 2 : $ @ box Bool , 0 <nl> - % 3 = alloc_box $ Bool <nl> + % 3 = alloc_box $ @ box Bool <nl> % 3a = project_box % 3 : $ @ box Bool , 0 <nl> store % 0 to % 2a : $ * Bool <nl> store % 1 to % 3a : $ * Bool <nl> sil @ test_short_circuit2 : $ @ convention ( thin ) ( Bool , Bool ) - > Bool { <nl> / / CHECK : return { { . * } } <nl> <nl> bb0 ( % 0 : $ Bool , % 1 : $ Bool ) : <nl> - % 2 = alloc_box $ Bool <nl> + % 2 = alloc_box $ @ box Bool <nl> % 2a = project_box % 2 : $ @ box Bool , 0 <nl> - % 3 = alloc_box $ Bool <nl> + % 3 = alloc_box $ @ box Bool <nl> % 3a = project_box % 3 : $ @ box Bool , 0 <nl> store % 0 to % 2a : $ * Bool <nl> store % 1 to % 3a : $ * Bool <nl> bb0 ( % 0 : $ Builtin . Int2048 , % 1 : $ @ thin Int64 . Type ) : <nl> sil @ test_with_dead_argument : $ @ convention ( thin ) ( ) - > ( ) { <nl> bb0 : <nl> % 0 = tuple ( ) <nl> - % 1 = alloc_box $ Int64 <nl> + % 1 = alloc_box $ @ box Int64 <nl> % 1a = project_box % 1 : $ @ box Int64 , 0 <nl> % 2 = function_ref @ convertFromBuiltinIntegerLiteral : $ @ convention ( thin ) ( Builtin . Int2048 , @ thin Int64 . Type ) - > Int64 <nl> % 3 = metatype $ @ thin Int64 . Type <nl> mmm a / test / SILOptimizer / mem2reg . sil <nl> ppp b / test / SILOptimizer / mem2reg . sil <nl> sil @ multiple_store_vals2 : $ @ convention ( thin ) ( Int64 ) - > Int64 { <nl> bb0 ( % 0 : $ Int64 ) : <nl> % 1 = alloc_stack $ Int64 , var , name " c " / / users : % 19 , % 2 <nl> store % 0 to % 1 : $ * Int64 / / id : % 2 <nl> - % 3 = alloc_box $ Int64 , var , name " x " / / users : % 16 , % 11 , % 6 <nl> + % 3 = alloc_box $ @ box Int64 , var , name " x " / / users : % 16 , % 11 , % 6 <nl> % 3a = project_box % 3 : $ @ box Int64 , 0 <nl> % 4 = integer_literal $ Builtin . Int64 , 2 / / users : % 9 , % 5 <nl> % 5 = struct $ Int64 ( % 4 : $ Builtin . Int64 ) / / users : % 12 , % 6 <nl> sil @ with_loads : $ @ convention ( thin ) ( Int64 ) - > Int64 { <nl> bb0 ( % 0 : $ Int64 ) : <nl> % 1 = alloc_stack $ Int64 , var , name " c " / / users : % 19 , % 2 , ( % 20 ) <nl> store % 0 to % 1 : $ * Int64 / / id : % 2 <nl> - % 3 = alloc_box $ Int64 , var , name " x " / / users : % 16 , % 11 , % 6 <nl> + % 3 = alloc_box $ @ box Int64 , var , name " x " / / users : % 16 , % 11 , % 6 <nl> % 3a = project_box % 3 : $ @ box Int64 , 0 <nl> % 4 = integer_literal $ Builtin . Int64 , 2 / / users : % 9 , % 5 <nl> % 5 = struct $ Int64 ( % 4 : $ Builtin . Int64 ) / / users : % 12 , % 6 <nl> mmm a / test / SILOptimizer / predictable_memopt . sil <nl> ppp b / test / SILOptimizer / predictable_memopt . sil <nl> import Swift <nl> / / CHECK - LABEL : sil @ simple_reg_promotion <nl> sil @ simple_reg_promotion : $ @ convention ( thin ) ( Int ) - > Int { <nl> bb0 ( % 0 : $ Int ) : / / CHECK : bb0 ( % 0 : $ Int ) : <nl> - % 1 = alloc_box $ Int <nl> + % 1 = alloc_box $ @ box Int <nl> % 1a = project_box % 1 : $ @ box Int , 0 <nl> store % 0 to % 1a : $ * Int <nl> - % 3 = alloc_box $ Int <nl> + % 3 = alloc_box $ @ box Int <nl> % 3a = project_box % 3 : $ @ box Int , 0 <nl> % 4 = load % 1a : $ * Int <nl> store % 4 to % 3a : $ * Int <nl> bb0 ( % 0 : $ Int ) : / / CHECK : bb0 ( % 0 : $ Int ) : <nl> / / CHECK - LABEL : sil @ tuple_reg_promotion <nl> sil @ tuple_reg_promotion : $ @ convention ( thin ) ( Int ) - > Int { <nl> bb0 ( % 0 : $ Int ) : / / CHECK : bb0 ( % 0 : $ Int ) : <nl> - % 1 = alloc_box $ ( Int , Int ) <nl> + % 1 = alloc_box $ @ box ( Int , Int ) <nl> % 1a = project_box % 1 : $ @ box ( Int , Int ) , 0 <nl> <nl> % a = tuple_element_addr % 1a : $ * ( Int , Int ) , 0 <nl> sil @ takes_Int_inout : $ @ convention ( thin ) ( @ inout Int ) - > ( ) <nl> sil @ used_by_inout : $ @ convention ( thin ) ( Int ) - > ( Int , Int ) { <nl> bb0 ( % 0 : $ Int ) : <nl> / / This alloc_stack can ' t be removed since it is used by an inout call . <nl> - / / CHECK : % 1 = alloc_box $ Int <nl> - % 1 = alloc_box $ Int <nl> + / / CHECK : % 1 = alloc_box $ @ box Int <nl> + % 1 = alloc_box $ @ box Int <nl> % 1a = project_box % 1 : $ @ box Int , 0 <nl> % 2 = store % 0 to % 1a : $ * Int <nl> <nl> sil @ closure0 : $ @ convention ( thin ) ( @ owned @ box Int ) - > ( ) <nl> / / CHECK - LABEL : sil @ closure_test2 <nl> sil @ closure_test2 : $ @ convention ( thin ) ( Int ) - > Int { <nl> bb0 ( % 1 : $ Int ) : <nl> - % 0 = alloc_box $ Int <nl> + % 0 = alloc_box $ @ box Int <nl> % 0a = project_box % 0 : $ @ box Int , 0 <nl> store % 1 to % 0a : $ * Int / / CHECK : store <nl> <nl> sil @ getSomeClass : $ @ convention ( thin ) ( ) - > @ owned SomeClass <nl> / / CHECK - LABEL : sil @ assign_test_trivial <nl> sil @ assign_test_trivial : $ @ convention ( thin ) ( Int ) - > Int { <nl> bb0 ( % 0 : $ Int ) : <nl> - % 1 = alloc_box $ Int <nl> + % 1 = alloc_box $ @ box Int <nl> % 1a = project_box % 1 : $ @ box Int , 0 <nl> <nl> store % 0 to % 1a : $ * Int <nl> enum IndirectCase { <nl> sil @ indirect_enum_box : $ @ convention ( thin ) ( Int ) - > IndirectCase { <nl> / / CHECK : bb0 ( [ [ X : % . * ] ] : $ Int ) : <nl> entry ( % x : $ Int ) : <nl> - / / CHECK : [ [ BOX : % . * ] ] = alloc_box $ Int <nl> - % b = alloc_box $ Int <nl> + / / CHECK : [ [ BOX : % . * ] ] = alloc_box $ @ box Int <nl> + % b = alloc_box $ @ box Int <nl> / / CHECK : [ [ PB : % . * ] ] = project_box [ [ BOX ] ] <nl> % ba = project_box % b : $ @ box Int , 0 <nl> / / CHECK : store [ [ X ] ] to [ [ PB ] ] <nl> mmm a / test / SILOptimizer / redundant_load_elim . sil <nl> ppp b / test / SILOptimizer / redundant_load_elim . sil <nl> bb0 ( % 0 : $ Agg1 ) : <nl> / / CHECK : return <nl> sil @ store_promotion : $ @ convention ( thin ) ( @ owned B ) - > ( ) { <nl> bb0 ( % 0 : $ B ) : <nl> - % 1 = alloc_box $ B <nl> + % 1 = alloc_box $ @ box B <nl> % 1a = project_box % 1 : $ @ box B , 0 <nl> % 2 = store % 0 to % 1a : $ * B <nl> % 3 = load % 1a : $ * B <nl> mmm a / test / SILOptimizer / redundant_load_elim_with_casts . sil <nl> ppp b / test / SILOptimizer / redundant_load_elim_with_casts . sil <nl> struct Wrapper { <nl> / / CHECK : return <nl> sil @ tbaa_class_alias_nonclass : $ @ convention ( thin ) ( @ owned B , @ inout Agg1 ) - > ( ) { <nl> bb0 ( % 0 : $ B , % 1 : $ * Agg1 ) : <nl> - % 2 = alloc_box $ B <nl> + % 2 = alloc_box $ @ box B <nl> % 2a = project_box % 2 : $ @ box B , 0 <nl> % 3 = load % 1 : $ * Agg1 <nl> % 4 = store % 3 to % 1 : $ * Agg1 <nl> mmm a / test / SILOptimizer / side - effect . sil <nl> ppp b / test / SILOptimizer / side - effect . sil <nl> bb0 ( % 0 : $ Int32 ) : <nl> store % 0 to % a : $ * Int32 <nl> % l1 = load % a : $ * Int32 <nl> <nl> - % b = alloc_box $ Int32 <nl> + % b = alloc_box $ @ box Int32 <nl> % ba = project_box % b : $ @ box Int32 , 0 <nl> store % 0 to % ba : $ * Int32 <nl> % l2 = load % ba : $ * Int32 <nl> mmm a / test / SILOptimizer / sil_combine . sil <nl> ppp b / test / SILOptimizer / sil_combine . sil <nl> bb0 : <nl> / / CHECK - NOT : unchecked_ref_cast <nl> sil @ removeTriviallyDeadInstructions : $ @ convention ( thin ) ( @ owned B ) - > ( ) { <nl> bb0 ( % 0 : $ B ) : <nl> - % 1 = alloc_box $ B <nl> + % 1 = alloc_box $ @ box B <nl> % 1a = project_box % 1 : $ @ box B , 0 <nl> % 2 = store % 0 to % 1a : $ * B <nl> % 3 = load % 1a : $ * B <nl> mmm a / test / SILOptimizer / sil_locations . sil <nl> ppp b / test / SILOptimizer / sil_locations . sil <nl> sil @ fromLiteral : $ @ convention ( thin ) ( Builtin . Int128 , @ thin Int64 . Type ) - > Int6 <nl> / / CHECK - LABEL : sil [ transparent ] @ test_add : $ @ convention ( thin ) ( Int64 ) - > Int64 { <nl> sil [ transparent ] @ test_add : $ @ convention ( thin ) ( Int64 ) - > Int64 { <nl> bb0 ( % 0 : $ Int64 ) : <nl> - % 1 = alloc_box $ Int64 <nl> + % 1 = alloc_box $ @ box Int64 <nl> % 1a = project_box % 1 : $ @ box Int64 , 0 <nl> store % 0 to % 1a : $ * Int64 <nl> % 3 = function_ref @ plus : $ @ convention ( thin ) ( Int64 , Int64 ) - > Int64 <nl> bb0 ( % 0 : $ Int64 ) : <nl> <nl> sil @ inline_test_add : $ @ convention ( thin ) ( Int64 ) - > Int64 { <nl> bb0 ( % 0 : $ Int64 ) : <nl> - % 1 = alloc_box $ Int64 <nl> + % 1 = alloc_box $ @ box Int64 <nl> % 1a = project_box % 1 : $ @ box Int64 , 0 <nl> store % 0 to % 1a : $ * Int64 <nl> % 3 = function_ref @ plus : $ @ convention ( thin ) ( Int64 , Int64 ) - > Int64 <nl> bb0 ( % 0 : $ Int64 ) : <nl> / / CHECK - LABEL : sil @ inline_test_add : $ @ convention ( thin ) ( Int64 ) - > Int64 { <nl> / / CHECK : [ [ VAL9 : % . * ] ] = apply { { . * } } line : 38 : 9 : sil <nl> / / CHECK : [ [ VAL10 : % . * ] ] = apply { { . * } } line : 39 : 9 : sil <nl> - / / CHECK : [ [ VAL11 : % . * ] ] = alloc_box $ Int64 , { { . * } } line : 40 : 9 : minlined <nl> + / / CHECK : [ [ VAL11 : % . * ] ] = alloc_box $ @ box Int64 , { { . * } } line : 40 : 9 : minlined <nl> / / CHECK : [ [ PB11 : % . * ] ] = project_box [ [ VAL11 ] ] { { . * } } line : 40 : 9 : minlined <nl> / / CHECK : store [ [ VAL10 ] ] to [ [ PB11 ] ] { { . * } } line : 40 : 9 : minlined <nl> / / CHECK : [ [ VAL13 : % . * ] ] = function_ref @ plus { { . * } } line : 40 : 9 : minlined <nl> mmm a / test / SILOptimizer / simplify_cfg . sil <nl> ppp b / test / SILOptimizer / simplify_cfg . sil <nl> bb2 ( % 16 : $ Error ) : <nl> / / CHECK : br bb1 ( [ [ PB ] ] : $ * Builtin . Int32 ) <nl> sil @ simplified_branch_arg_has_result_value_1 : $ @ convention ( thin ) ( @ in Builtin . Int32 ) - > Builtin . Int32 { <nl> entry ( % 0 : $ * Builtin . Int32 ) : <nl> - % b = alloc_box $ Builtin . Int32 <nl> + % b = alloc_box $ @ box Builtin . Int32 <nl> % p = project_box % b : $ @ box Builtin . Int32 , 0 <nl> % i = integer_literal $ Builtin . Int32 , 0 <nl> store % i to % p : $ * Builtin . Int32 <nl> mmm a / test / SILOptimizer / specialize . sil <nl> ppp b / test / SILOptimizer / specialize . sil <nl> bb0 ( % 0 : $ * T ) : <nl> debug_value_addr % 0 : $ * T , let , name " t " / / id : % 1 <nl> / / function_ref specialize . ( getGenericClosure < A > ( t : A ) - > ( ) - > A ) . ( tmp # 1 ) ( ( ) ) A <nl> % 2 = function_ref @ _TFF10specialize17getGenericClosureU__FT1tQ__FT_Q_L_3tmpfT_Q_ : $ @ convention ( thin ) < τ_0_0 > ( @ owned @ box τ_0_0 ) - > @ out τ_0_0 / / user : % 5 <nl> - % 3 = alloc_box $ T / / users : % 4 , % 5 , % 5 <nl> + % 3 = alloc_box $ @ box T / / users : % 4 , % 5 , % 5 <nl> % 3a = project_box % 3 : $ @ box T , 0 <nl> copy_addr % 0 to [ initialization ] % 3a : $ * T / / id : % 4 <nl> % 5 = partial_apply % 2 < T > ( % 3 ) : $ @ convention ( thin ) < τ_0_0 > ( @ owned @ box τ_0_0 ) - > @ out τ_0_0 / / user : % 7 <nl> bb0 ( % 0 : $ * U ) : <nl> debug_value_addr % 0 : $ * U , let , name " y " / / id : % 1 <nl> / / function_ref test4 . ( boo < A : test4 . P , B > ( A ) - > ( Swift . Int32 , B ) - > Swift . Int32 ) . ( closure # 1 ) <nl> % 2 = function_ref @ _TFF5test43booUS_1P___FQ_FTVs5Int32Q0__S1_U_FTS1_Q0__S1_ : $ @ convention ( thin ) < τ_0_0 , τ_0_1 where τ_0_0 : P > ( Int32 , @ in τ_0_1 , @ owned @ box τ_0_0 ) - > Int32 / / user : % 5 <nl> - % 3 = alloc_box $ U / / users : % 4 , % 5 , % 5 <nl> + % 3 = alloc_box $ @ box U / / users : % 4 , % 5 , % 5 <nl> % 3a = project_box % 3 : $ @ box U , 0 <nl> copy_addr % 0 to [ initialization ] % 3a : $ * U / / id : % 4 <nl> % 5 = partial_apply % 2 < U , T > ( % 3 ) : $ @ convention ( thin ) < τ_0_0 , τ_0_1 where τ_0_0 : P > ( Int32 , @ in τ_0_1 , @ owned @ box τ_0_0 ) - > Int32 / / user : % 7 <nl> bb0 ( % 0 : $ * T ) : <nl> debug_value_addr % 0 : $ * T , let , name " x " / / id : % 1 <nl> / / function_ref test4 . ( gen1 < A : test4 . P > ( A ) - > ( Swift . Int32 ) - > Swift . Int32 ) . ( closure # 1 ) <nl> % 2 = function_ref @ _TFF5test44gen1US_1P__FQ_FVs5Int32S1_U_FS1_S1_ : $ @ convention ( thin ) < τ_0_0 where τ_0_0 : P > ( Int32 , @ owned @ box τ_0_0 ) - > Int32 / / user : % 5 <nl> - % 3 = alloc_box $ T / / users : % 4 , % 5 , % 5 <nl> + % 3 = alloc_box $ @ box T / / users : % 4 , % 5 , % 5 <nl> % 3a = project_box % 3 : $ @ box T , 0 <nl> copy_addr % 0 to [ initialization ] % 3a : $ * T / / id : % 4 <nl> % 5 = partial_apply % 2 < T > ( % 3 ) : $ @ convention ( thin ) < τ_0_0 where τ_0_0 : P > ( Int32 , @ owned @ box τ_0_0 ) - > Int32 / / user : % 7 <nl> mmm a / test / SILOptimizer / specialize_metatypes_with_nondefault_representation . sil <nl> ppp b / test / SILOptimizer / specialize_metatypes_with_nondefault_representation . sil <nl> bb0 ( % 0 : $ * T ) : <nl> sil @ tmp2 : $ @ convention ( thin ) ( ) - > ( ) { <nl> bb0 : <nl> % 0 = function_ref @ tmp : $ @ convention ( thin ) < T > ( ) - > ( @ out T ) <nl> - % 1 = alloc_box $ @ thick AnyObject . Type <nl> + % 1 = alloc_box $ @ box @ thick AnyObject . Type <nl> % 1a = project_box % 1 : $ @ box @ thick AnyObject . Type , 0 <nl> - % 2 = alloc_box $ @ objc_metatype AnyObject . Type <nl> + % 2 = alloc_box $ @ box @ objc_metatype AnyObject . Type <nl> % 2a = project_box % 2 : $ @ box @ objc_metatype AnyObject . Type , 0 <nl> % 4 = apply % 0 < @ thick AnyObject . Type > ( % 1a ) : $ @ convention ( thin ) < T > ( ) - > ( @ out T ) <nl> % 5 = apply % 0 < @ objc_metatype AnyObject . Type > ( % 2a ) : $ @ convention ( thin ) < T > ( ) - > ( @ out T ) <nl> <nl> - % 6 = alloc_box $ @ thick Builtin . Int32 . Type <nl> + % 6 = alloc_box $ @ box @ thick Builtin . Int32 . Type <nl> % 6a = project_box % 6 : $ @ box @ thick Builtin . Int32 . Type , 0 <nl> - % 7 = alloc_box $ @ objc_metatype Builtin . Int32 . Type <nl> + % 7 = alloc_box $ @ box @ objc_metatype Builtin . Int32 . Type <nl> % 7a = project_box % 7 : $ @ box @ objc_metatype Builtin . Int32 . Type , 0 <nl> - % 8 = alloc_box $ @ thin Builtin . Int32 . Type <nl> + % 8 = alloc_box $ @ box @ thin Builtin . Int32 . Type <nl> % 8a = project_box % 8 : $ @ box @ thin Builtin . Int32 . Type , 0 <nl> % 9 = apply % 0 < @ thick Builtin . Int32 . Type > ( % 6a ) : $ @ convention ( thin ) < T > ( ) - > ( @ out T ) <nl> % 10 = apply % 0 < @ objc_metatype Builtin . Int32 . Type > ( % 7a ) : $ @ convention ( thin ) < T > ( ) - > ( @ out T ) <nl> mmm a / test / SILOptimizer / split_critical_edges . sil <nl> ppp b / test / SILOptimizer / split_critical_edges . sil <nl> bb0 ( % 0 : $ AnyObject , % 10 : $ Builtin . Int1 ) : <nl> cond_br % 10 , lookup1 , lookup2 <nl> <nl> lookup1 : <nl> - % 1 = alloc_box $ AnyObject <nl> + % 1 = alloc_box $ @ box AnyObject <nl> % 1a = project_box % 1 : $ @ box AnyObject , 0 <nl> store % 0 to % 1a : $ * AnyObject <nl> - % 3 = alloc_box $ Optional < ( ) - > ( ) > <nl> + % 3 = alloc_box $ @ box Optional < ( ) - > ( ) > <nl> % 4 = load % 1a : $ * AnyObject <nl> strong_retain % 4 : $ AnyObject <nl> % 6 = open_existential_ref % 4 : $ AnyObject to $ @ opened ( " 01234567 - 89ab - cdef - 0123 - 000000000000 " ) AnyObject <nl> lookup1 : <nl> dynamic_method_br % 7 : $ Builtin . UnknownObject , # X . f ! 1 . foreign , bb1 , bb2 <nl> <nl> lookup2 : <nl> - % 21 = alloc_box $ AnyObject <nl> + % 21 = alloc_box $ @ box AnyObject <nl> % 21a = project_box % 21 : $ @ box AnyObject , 0 <nl> store % 0 to % 21a : $ * AnyObject <nl> - % 23 = alloc_box $ Optional < ( ) - > ( ) > <nl> + % 23 = alloc_box $ @ box Optional < ( ) - > ( ) > <nl> % 24 = load % 21a : $ * AnyObject <nl> strong_retain % 24 : $ AnyObject <nl> % 26 = open_existential_ref % 24 : $ AnyObject to $ @ opened ( " 12345678 - 89ab - cdef - 0123 - 000000000000 " ) AnyObject <nl> mmm a / test / SILOptimizer / typed - access - tb - aa . sil <nl> ppp b / test / SILOptimizer / typed - access - tb - aa . sil <nl> bb0 : <nl> <nl> sil @ builtin_test : $ @ convention ( thin ) ( ) - > ( ) { <nl> bb0 : <nl> - % 0 = alloc_box $ Builtin . RawPointer <nl> - % 1 = alloc_box $ Builtin . NativeObject <nl> - % 2 = alloc_box $ Builtin . UnknownObject <nl> - % 3 = alloc_box $ Builtin . Int8 <nl> - % 4 = alloc_box $ Builtin . Int32 <nl> - % 5 = alloc_box $ Builtin . FPIEEE32 <nl> - % 6 = alloc_box $ Builtin . FPIEEE64 <nl> + % 0 = alloc_box $ @ box Builtin . RawPointer <nl> + % 1 = alloc_box $ @ box Builtin . NativeObject <nl> + % 2 = alloc_box $ @ box Builtin . UnknownObject <nl> + % 3 = alloc_box $ @ box Builtin . Int8 <nl> + % 4 = alloc_box $ @ box Builtin . Int32 <nl> + % 5 = alloc_box $ @ box Builtin . FPIEEE32 <nl> + % 6 = alloc_box $ @ box Builtin . FPIEEE64 <nl> <nl> % 7 = project_box % 0 : $ @ box Builtin . RawPointer , 0 <nl> % 8 = project_box % 1 : $ @ box Builtin . NativeObject , 0 <nl> struct STest_S3 { <nl> <nl> sil @ struct_tests : $ @ convention ( thin ) ( ) - > ( ) { <nl> <nl> - % 0 = alloc_box $ STest_S1 <nl> - % 1 = alloc_box $ STest_S2 <nl> - % 2 = alloc_box $ STest_E1 <nl> - % 3 = alloc_box $ STest_E2 <nl> - % 4 = alloc_box $ STest_C1 <nl> - % 5 = alloc_box $ STest_C2 <nl> - % 6 = alloc_box $ STest_S3 <nl> + % 0 = alloc_box $ @ box STest_S1 <nl> + % 1 = alloc_box $ @ box STest_S2 <nl> + % 2 = alloc_box $ @ box STest_E1 <nl> + % 3 = alloc_box $ @ box STest_E2 <nl> + % 4 = alloc_box $ @ box STest_C1 <nl> + % 5 = alloc_box $ @ box STest_C2 <nl> + % 6 = alloc_box $ @ box STest_S3 <nl> <nl> % 7 = project_box % 0 : $ @ box STest_S1 , 0 <nl> % 8 = project_box % 1 : $ @ box STest_S2 , 0 <nl> sil @ struct_tests : $ @ convention ( thin ) ( ) - > ( ) { <nl> % 19 = project_box % 5 : $ @ box STest_C2 , 0 <nl> % 20 = project_box % 6 : $ @ box STest_S3 , 0 <nl> <nl> - % 21 = alloc_box $ Builtin . RawPointer <nl> - % 22 = alloc_box $ Builtin . NativeObject <nl> - % 23 = alloc_box $ Builtin . UnknownObject <nl> - % 24 = alloc_box $ Builtin . Int32 <nl> - % 25 = alloc_box $ Builtin . FPIEEE32 <nl> + % 21 = alloc_box $ @ box Builtin . RawPointer <nl> + % 22 = alloc_box $ @ box Builtin . NativeObject <nl> + % 23 = alloc_box $ @ box Builtin . UnknownObject <nl> + % 24 = alloc_box $ @ box Builtin . Int32 <nl> + % 25 = alloc_box $ @ box Builtin . FPIEEE32 <nl> <nl> % 26 = project_box % 21 : $ @ box Builtin . RawPointer , 0 <nl> % 27 = project_box % 22 : $ @ box Builtin . NativeObject , 0 <nl> enum ETest_E3 { <nl> } <nl> <nl> sil @ enum_tests : $ @ convention ( thin ) ( ) - > ( ) { <nl> - % 0 = alloc_box $ ETest_S1 <nl> - % 1 = alloc_box $ ETest_S2 <nl> - % 2 = alloc_box $ ETest_E1 <nl> - % 3 = alloc_box $ ETest_E2 <nl> - % 4 = alloc_box $ ETest_C1 <nl> - % 5 = alloc_box $ ETest_C2 <nl> - % 6 = alloc_box $ ETest_E3 <nl> + % 0 = alloc_box $ @ box ETest_S1 <nl> + % 1 = alloc_box $ @ box ETest_S2 <nl> + % 2 = alloc_box $ @ box ETest_E1 <nl> + % 3 = alloc_box $ @ box ETest_E2 <nl> + % 4 = alloc_box $ @ box ETest_C1 <nl> + % 5 = alloc_box $ @ box ETest_C2 <nl> + % 6 = alloc_box $ @ box ETest_E3 <nl> <nl> % 7 = project_box % 0 : $ @ box ETest_S1 , 0 <nl> % 8 = project_box % 1 : $ @ box ETest_S2 , 0 <nl> sil @ enum_tests : $ @ convention ( thin ) ( ) - > ( ) { <nl> % 19 = project_box % 5 : $ @ box ETest_C2 , 0 <nl> % 20 = project_box % 6 : $ @ box ETest_E3 , 0 <nl> <nl> - % 21 = alloc_box $ Builtin . RawPointer <nl> - % 22 = alloc_box $ Builtin . NativeObject <nl> - % 23 = alloc_box $ Builtin . UnknownObject <nl> - % 24 = alloc_box $ Builtin . Int32 <nl> - % 25 = alloc_box $ Builtin . FPIEEE32 <nl> + % 21 = alloc_box $ @ box Builtin . RawPointer <nl> + % 22 = alloc_box $ @ box Builtin . NativeObject <nl> + % 23 = alloc_box $ @ box Builtin . UnknownObject <nl> + % 24 = alloc_box $ @ box Builtin . Int32 <nl> + % 25 = alloc_box $ @ box Builtin . FPIEEE32 <nl> <nl> % 26 = project_box % 21 : $ @ box Builtin . RawPointer , 0 <nl> % 27 = project_box % 22 : $ @ box Builtin . NativeObject , 0 <nl> class CTest_C3 : CTest_C1 { <nl> protocol AnyObject { } <nl> <nl> sil @ class_tests : $ @ convention ( thin ) ( ) - > ( ) { <nl> - % 0 = alloc_box $ CTest_C1 <nl> - % 1 = alloc_box $ CTest_C2 <nl> - % 2 = alloc_box $ CTest_C3 <nl> + % 0 = alloc_box $ @ box CTest_C1 <nl> + % 1 = alloc_box $ @ box CTest_C2 <nl> + % 2 = alloc_box $ @ box CTest_C3 <nl> <nl> % 3 = project_box % 0 : $ @ box CTest_C1 , 0 <nl> % 4 = project_box % 1 : $ @ box CTest_C2 , 0 <nl> sil @ class_tests : $ @ convention ( thin ) ( ) - > ( ) { <nl> % 7 = project_box % 1 : $ @ box CTest_C2 , 0 <nl> % 8 = project_box % 2 : $ @ box CTest_C3 , 0 <nl> <nl> - % 9 = alloc_box $ AnyObject <nl> - % 10 = alloc_box $ Builtin . RawPointer <nl> - % 11 = alloc_box $ Builtin . NativeObject <nl> - % 12 = alloc_box $ Builtin . UnknownObject <nl> - % 13 = alloc_box $ Builtin . Int8 <nl> - % 14 = alloc_box $ Builtin . Int32 <nl> - % 15 = alloc_box $ Builtin . FPIEEE32 <nl> + % 9 = alloc_box $ @ box AnyObject <nl> + % 10 = alloc_box $ @ box Builtin . RawPointer <nl> + % 11 = alloc_box $ @ box Builtin . NativeObject <nl> + % 12 = alloc_box $ @ box Builtin . UnknownObject <nl> + % 13 = alloc_box $ @ box Builtin . Int8 <nl> + % 14 = alloc_box $ @ box Builtin . Int32 <nl> + % 15 = alloc_box $ @ box Builtin . FPIEEE32 <nl> <nl> % 16 = project_box % 9 : $ @ box AnyObject , 0 <nl> % 17 = project_box % 10 : $ @ box Builtin . RawPointer , 0 <nl> enum TTest_E1 { <nl> } <nl> <nl> sil @ tuple_tests : $ @ convention ( thin ) ( ) - > ( ) { <nl> - % 0 = alloc_box $ ( Builtin . RawPointer , Builtin . Int64 ) <nl> - % 1 = alloc_box $ ( TTest_S1 , Builtin . Int64 ) <nl> - % 2 = alloc_box $ ( TTest_E1 , Builtin . Int64 ) <nl> + % 0 = alloc_box $ @ box ( Builtin . RawPointer , Builtin . Int64 ) <nl> + % 1 = alloc_box $ @ box ( TTest_S1 , Builtin . Int64 ) <nl> + % 2 = alloc_box $ @ box ( TTest_E1 , Builtin . Int64 ) <nl> <nl> % 3 = project_box % 0 : $ @ box ( Builtin . RawPointer , Builtin . Int64 ) , 0 <nl> % 4 = project_box % 1 : $ @ box ( TTest_S1 , Builtin . Int64 ) , 0 <nl> sil @ tuple_tests : $ @ convention ( thin ) ( ) - > ( ) { <nl> % 7 = project_box % 1 : $ @ box ( TTest_S1 , Builtin . Int64 ) , 0 <nl> % 8 = project_box % 2 : $ @ box ( TTest_E1 , Builtin . Int64 ) , 0 <nl> <nl> - % 9 = alloc_box $ Builtin . RawPointer <nl> - % 10 = alloc_box $ Builtin . NativeObject <nl> - % 11 = alloc_box $ Builtin . UnknownObject <nl> - % 12 = alloc_box $ Builtin . Int8 <nl> - % 13 = alloc_box $ Builtin . Int32 <nl> - % 14 = alloc_box $ Builtin . FPIEEE32 <nl> + % 9 = alloc_box $ @ box Builtin . RawPointer <nl> + % 10 = alloc_box $ @ box Builtin . NativeObject <nl> + % 11 = alloc_box $ @ box Builtin . UnknownObject <nl> + % 12 = alloc_box $ @ box Builtin . Int8 <nl> + % 13 = alloc_box $ @ box Builtin . Int32 <nl> + % 14 = alloc_box $ @ box Builtin . FPIEEE32 <nl> <nl> % 15 = project_box % 9 : $ @ box Builtin . RawPointer , 0 <nl> % 16 = project_box % 10 : $ @ box Builtin . NativeObject , 0 <nl> mmm a / test / Serialization / Inputs / def_basic . sil <nl> ppp b / test / Serialization / Inputs / def_basic . sil <nl> bb0 : / / CHECK : bb0 : <nl> % 0 = tuple ( ) / / CHECK : % 0 = tuple ( ) <nl> br bb1 / / CHECK : br bb1 <nl> bb1 : <nl> - % b = alloc_box $ Int <nl> + % b = alloc_box $ @ box Int <nl> % c = integer_literal $ Builtin . Word , 1 <nl> return % 0 : $ ( ) / / CHECK : return % 0 : $ ( ) <nl> } <nl> bb1 : <nl> return % 5 : $ ( ) <nl> bb2 : <nl> % 5 = tuple ( ) <nl> - % 6 = alloc_box $ Int <nl> + % 6 = alloc_box $ @ box Int <nl> % 7 = project_box % 6 : $ @ box Int , 0 <nl> br bb1 <nl> } <nl> protocol Bendable { } <nl> sil [ fragile ] @ _TF4todo18erasure_from_protoFT1xPS_8RuncibleS_8Bendable__PS0__ : $ @ convention ( thin ) ( @ in Bendable & Runcible ) - > ( @ out Runcible ) { <nl> bb0 ( % 0 : $ * Runcible , % 1 : $ * Bendable & Runcible ) : <nl> / / CHECK : alloc_box <nl> - % 2 = alloc_box $ Bendable & Runcible <nl> + % 2 = alloc_box $ @ box ( Bendable & Runcible ) <nl> % 2a = project_box % 2 : $ @ box Bendable & Runcible , 0 <nl> / / CHECK : copy_addr [ take ] { { . * } } to [ initialization ] { { . * } } : $ * Bendable & Runcible <nl> % 3 = copy_addr [ take ] % 1 to [ initialization ] % 2a : $ * Bendable & Runcible <nl> protocol ClassBound : class { <nl> / / CHECK - LABEL : @ _TF4todo18class_bound_methodFT1xPS_10ClassBound__T_ : $ @ convention ( thin ) ( @ owned ClassBound ) - > ( ) <nl> sil [ fragile ] @ _TF4todo18class_bound_methodFT1xPS_10ClassBound__T_ : $ @ convention ( thin ) ( @ owned ClassBound ) - > ( ) { <nl> bb0 ( % 0 : $ ClassBound ) : <nl> - % 1 = alloc_box $ ClassBound <nl> + % 1 = alloc_box $ @ box ClassBound <nl> % 1a = project_box % 1 : $ @ box ClassBound , 0 <nl> % 2 = store % 0 to % 1a : $ * ClassBound <nl> % 3 = load % 1a : $ * ClassBound <nl> bb0 ( % 0 : $ Ref , % 1 : $ Val , % 2 : $ @ thin Aleph . Type ) : <nl> sil [ fragile ] @ _TFV6struct5AlephCfMS0_FT_S0_ : $ @ convention ( thin ) ( @ thin Aleph . Type ) - > Aleph { <nl> bb0 ( % 0 : $ @ thin Aleph . Type ) : <nl> % 1 = tuple ( ) <nl> - % 2 = alloc_box $ Aleph / / CHECK : alloc_box <nl> + % 2 = alloc_box $ @ box Aleph / / CHECK : alloc_box <nl> % 2a = project_box % 2 : $ @ box Aleph , 0 <nl> / / CHECK : struct_element_addr { { . * } } : $ * Aleph , # Aleph . a <nl> % 5 = struct_element_addr % 2a : $ * Aleph , # Aleph . a <nl> sil [ fragile ] @ _TF5tuple5tupleFT_TSiSf_ : $ @ convention ( thin ) ( ) - > ( Int , Float32 <nl> / / CHECK - LABEL : @ _TF5tuple13tuple_elementFT1xTSiSf__T_ : $ @ convention ( thin ) ( Int , Float ) - > ( ) <nl> sil [ fragile ] @ _TF5tuple13tuple_elementFT1xTSiSf__T_ : $ @ convention ( thin ) ( Int , Float ) - > ( ) { <nl> bb0 ( % 0 : $ Int , % 1 : $ Float32 ) : <nl> - % 2 = alloc_box $ ( Int , Float32 ) <nl> + % 2 = alloc_box $ @ box ( Int , Float32 ) <nl> % 2a = project_box % 2 : $ @ box ( Int , Float32 ) , 0 <nl> % 3 = tuple ( % 0 : $ Int , % 1 : $ Float32 ) <nl> % 4 = store % 3 to % 2a : $ * ( Int , Float32 ) <nl> class M { <nl> / / CHECK - LABEL : @ _TFC3ref1C3foofS0_FT1xSi_T_ : $ @ convention ( method ) ( Int , @ guaranteed M ) - > ( ) <nl> sil [ fragile ] @ _TFC3ref1C3foofS0_FT1xSi_T_ : $ @ convention ( method ) ( Int , @ guaranteed M ) - > ( ) { <nl> bb0 ( % 0 : $ Int , % 1 : $ M ) : <nl> - % 2 = alloc_box $ Int <nl> + % 2 = alloc_box $ @ box Int <nl> % 2a = project_box % 2 : $ @ box Int , 0 <nl> % 3 = store % 0 to % 2a : $ * Int <nl> - % 4 = alloc_box $ M <nl> + % 4 = alloc_box $ @ box M <nl> % 4a = project_box % 4 : $ @ box M , 0 <nl> % 5 = store % 1 to % 4a : $ * M <nl> % 6 = load % 2a : $ * Int <nl> class E : B { } <nl> / / CHECK - LABEL : @ _TF4null3isaFT1bCS_1B_Sb : $ @ convention ( thin ) ( B ) - > Builtin . Int1 <nl> sil [ fragile ] @ _TF4null3isaFT1bCS_1B_Sb : $ @ convention ( thin ) ( B ) - > Builtin . Int1 { <nl> bb0 ( % 0 : $ B ) : <nl> - % 1 = alloc_box $ B <nl> + % 1 = alloc_box $ @ box B <nl> % 1a = project_box % 1 : $ @ box B , 0 <nl> % 2 = store % 0 to % 1a : $ * B <nl> % 3 = load % 1a : $ * B <nl> sil [ fragile ] @ _TFSS32_convertFromBuiltinStringLiteralfMSSFT5valueBp17utf8CodeUn <nl> / / CHECK - LABEL : @ _TF5index5gep64FT1pBp1iBi64__Bp : $ @ convention ( thin ) ( Builtin . RawPointer , Builtin . Word ) - > Builtin . RawPointer { <nl> sil [ fragile ] @ _TF5index5gep64FT1pBp1iBi64__Bp : $ @ convention ( thin ) ( Builtin . RawPointer , Builtin . Word ) - > Builtin . RawPointer { <nl> bb0 ( % 0 : $ Builtin . RawPointer , % 1 : $ Builtin . Word ) : <nl> - % 2 = alloc_box $ Builtin . RawPointer <nl> + % 2 = alloc_box $ @ box Builtin . RawPointer <nl> % 2a = project_box % 2 : $ @ box Builtin . RawPointer , 0 <nl> - % 3 = alloc_box $ Builtin . Word <nl> + % 3 = alloc_box $ @ box Builtin . Word <nl> % 3a = project_box % 3 : $ @ box Builtin . Word , 0 <nl> % 4 = store % 0 to % 2a : $ * Builtin . RawPointer <nl> % 5 = store % 1 to % 3a : $ * Builtin . Word <nl> class SomeSubclass : SomeClass { } <nl> / / CHECK - LABEL : @ test_class_metatype : $ @ convention ( thin ) ( SomeClass , SomeSubclass ) - > ( @ thick SomeClass . Type , @ thick SomeClass . Type ) { <nl> sil [ fragile ] @ test_class_metatype : $ @ convention ( thin ) ( SomeClass , SomeSubclass ) - > ( @ thick SomeClass . Type , @ thick SomeClass . Type ) { <nl> bb0 ( % 0 : $ SomeClass , % 1 : $ SomeSubclass ) : <nl> - % 2 = alloc_box $ SomeClass <nl> + % 2 = alloc_box $ @ box SomeClass <nl> % 2a = project_box % 2 : $ @ box SomeClass , 0 <nl> - % 3 = alloc_box $ SomeSubclass <nl> + % 3 = alloc_box $ @ box SomeSubclass <nl> % 3a = project_box % 3 : $ @ box SomeSubclass , 0 <nl> % 4 = store % 0 to % 2a : $ * SomeClass <nl> % 5 = store % 1 to % 3a : $ * SomeSubclass <nl> bb0 ( % 0 : $ SomeClass , % 1 : $ SomeSubclass ) : <nl> / / CHECK - LABEL : @ test_existential_metatype : $ @ convention ( thin ) ( @ in SomeProtocol ) - > @ thick SomeProtocol . Type { <nl> sil [ fragile ] @ test_existential_metatype : $ @ convention ( thin ) ( @ in SomeProtocol ) - > @ thick SomeProtocol . Type { <nl> bb0 ( % 0 : $ * SomeProtocol ) : <nl> - % 1 = alloc_box $ SomeProtocol <nl> + % 1 = alloc_box $ @ box SomeProtocol <nl> % 1a = project_box % 1 : $ @ box SomeProtocol , 0 <nl> / / CHECK : copy_addr [ take ] % 0 to [ initialization ] % { { . * } } : $ * SomeProtocol <nl> % 2 = copy_addr [ take ] % 0 to [ initialization ] % 1a : $ * SomeProtocol <nl> bb3 ( % 4 : $ Int ) : <nl> / / CHECK - LABEL : sil public_external [ fragile ] @ test_builtin_func_ref <nl> sil [ fragile ] @ test_builtin_func_ref : $ @ convention ( thin ) ( Builtin . Int1 , Builtin . Int1 ) - > Builtin . Int1 { <nl> bb0 ( % 0 : $ Builtin . Int1 , % 1 : $ Builtin . Int1 ) : <nl> - % 2 = alloc_box $ Builtin . Int1 <nl> + % 2 = alloc_box $ @ box Builtin . Int1 <nl> % 2a = project_box % 2 : $ @ box Builtin . Int1 , 0 <nl> - % 3 = alloc_box $ Builtin . Int1 <nl> + % 3 = alloc_box $ @ box Builtin . Int1 <nl> % 3a = project_box % 3 : $ @ box Builtin . Int1 , 0 <nl> store % 0 to % 2a : $ * Builtin . Int1 <nl> store % 1 to % 3a : $ * Builtin . Int1 <nl> bb0 : <nl> / / CHECK - LABEL : sil public_external [ fragile ] @ test_dealloc_box <nl> sil [ fragile ] @ test_dealloc_box : $ @ convention ( thin ) ( ) - > ( ) { <nl> bb0 : <nl> - % 0 = alloc_box $ Class1 <nl> + % 0 = alloc_box $ @ box Class1 <nl> dealloc_box % 0 : $ @ box Class1 <nl> % 2 = tuple ( ) <nl> return % 2 : $ ( ) <nl> sil [ fragile ] @ closure0 : $ @ convention ( thin ) ( @ box Int , @ inout Int ) - > ( ) <nl> <nl> sil [ fragile ] @ closure_test : $ @ convention ( thin ) ( ) - > ( ) { <nl> bb0 : <nl> - % 0 = alloc_box $ Int / / users : % 10 , % 8 , % 8 , % 7 , % 4 <nl> + % 0 = alloc_box $ @ box Int / / users : % 10 , % 8 , % 8 , % 7 , % 4 <nl> % 0a = project_box % 0 : $ @ box Int , 0 <nl> <nl> % 5 = function_ref @ takes_closure : $ @ convention ( thin ) ( @ callee_owned ( ) - > ( ) ) - > ( ) <nl> sil [ fragile ] @ _TF6switch1cFT_T_ : $ @ convention ( thin ) ( ) - > ( ) <nl> / / CHECK - LABEL : sil public_external [ fragile ] @ test_switch_union : $ @ convention ( thin ) ( MaybePair ) - > ( ) <nl> sil [ fragile ] @ test_switch_union : $ @ convention ( thin ) ( MaybePair ) - > ( ) { <nl> bb0 ( % 0 : $ MaybePair ) : <nl> - % 1 = alloc_box $ MaybePair <nl> + % 1 = alloc_box $ @ box MaybePair <nl> % 1a = project_box % 1 : $ @ box MaybePair , 0 <nl> store % 0 to % 1a : $ * MaybePair <nl> % 3 = load % 1a : $ * MaybePair <nl> struct Spoon : Bendable { <nl> / / CHECK - LABEL : sil public_external [ fragile ] @ test_init_existential : $ @ convention ( thin ) ( Spoon ) - > @ out Bendable <nl> sil [ fragile ] @ test_init_existential : $ @ convention ( thin ) ( Spoon ) - > @ out Bendable { <nl> bb0 ( % 0 : $ * Bendable , % 1 : $ Spoon ) : <nl> - % 2 = alloc_box $ Spoon <nl> + % 2 = alloc_box $ @ box Spoon <nl> % 2a = project_box % 2 : $ @ box Spoon , 0 <nl> store % 1 to % 2a : $ * Spoon <nl> / / CHECK : init_existential_addr % { { . * } } : $ * Bendable , $ Spoon <nl> bb0 ( % 0 : $ * Bendable , % 1 : $ Spoon ) : <nl> / / CHECK - LABEL : sil public_external [ fragile ] @ test_existential_ref : $ @ convention ( thin ) ( ConcreteClass ) - > ClassP <nl> sil [ fragile ] @ test_existential_ref : $ @ convention ( thin ) ( ConcreteClass ) - > ClassP { <nl> bb0 ( % 0 : $ ConcreteClass ) : <nl> - % 1 = alloc_box $ ConcreteClass <nl> + % 1 = alloc_box $ @ box ConcreteClass <nl> % 1a = project_box % 1 : $ @ box ConcreteClass , 0 <nl> store % 0 to % 1a : $ * ConcreteClass <nl> % 3 = load % 1a : $ * ConcreteClass <nl> class X { <nl> / / CHECK - LABEL : sil public_external [ fragile ] @ test_dynamic_lookup_br : $ @ convention ( thin ) ( AnyObject ) - > ( ) <nl> sil [ fragile ] @ test_dynamic_lookup_br : $ @ convention ( thin ) ( AnyObject ) - > ( ) { <nl> bb0 ( % 0 : $ AnyObject ) : <nl> - % 1 = alloc_box $ AnyObject <nl> + % 1 = alloc_box $ @ box AnyObject <nl> % 1a = project_box % 1 : $ @ box AnyObject , 0 <nl> store % 0 to % 1a : $ * AnyObject <nl> - % 3 = alloc_box $ Optional < ( ) - > ( ) > <nl> + % 3 = alloc_box $ @ box Optional < ( ) - > ( ) > <nl> % 4 = load % 1a : $ * AnyObject <nl> strong_retain % 4 : $ AnyObject <nl> / / CHECK : open_existential_ref % { { . * } } : $ AnyObject to $ @ opened ( { { . * } } ) AnyObject <nl> bb3 : <nl> <nl> / / CHECK - LABEL : sil public_external [ fragile ] @ test_mark_fn_escape <nl> sil [ fragile ] @ test_mark_fn_escape : $ @ convention ( thin ) ( ) - > ( ) { <nl> - % b = alloc_box $ Int <nl> + % b = alloc_box $ @ box Int <nl> % ba = project_box % b : $ @ box Int , 0 <nl> - % c = alloc_box $ Int <nl> + % c = alloc_box $ @ box Int <nl> % ca = project_box % c : $ @ box Int , 0 <nl> <nl> / / mark_function_escape % ba : $ * Int <nl> new file mode 100644 <nl> index 000000000000 . . b5e98579a1e4 <nl> mmm / dev / null <nl> ppp b / test / Serialization / sil_box_types . sil <nl> <nl> + / / RUN : rm - rf % t <nl> + / / RUN : mkdir % t <nl> + / / RUN : % target - build - swift - emit - module - Xfrontend - disable - diagnostic - passes - Xfrontend - sil - serialize - all - force - single - frontend - invocation - o % t / sil_box_types . swiftmodule % s <nl> + / / RUN : % target - build - swift - emit - sil - Xfrontend - sil - link - all - I % t % s | % FileCheck % s <nl> + <nl> + import Builtin <nl> + <nl> + / / CHECK - LABEL : sil @ boxes : $ @ convention ( thin ) ( @ box Builtin . Int32 , @ box Builtin . Int32 ) - > ( ) { <nl> + sil @ boxes : $ @ convention ( thin ) ( @ box Builtin . Int32 , @ box Builtin . Int32 ) - > ( ) { <nl> + / / CHECK : bb0 ( % 0 : $ @ box Builtin . Int32 , % 1 : $ @ box Builtin . Int32 ) : <nl> + entry ( % 0 : $ @ box Builtin . Int32 , % 1 : $ @ box Builtin . Int32 ) : <nl> + return undef : $ ( ) <nl> + } <nl> mmm a / test / sil - extract / basic . sil <nl> ppp b / test / sil - extract / basic . sil <nl> sil @ makesInt : $ @ convention ( thin ) ( ) - > Int64 <nl> / / CHECK : } <nl> sil @ use_before_init : $ @ convention ( thin ) ( ) - > Int64 { <nl> bb0 : <nl> - % 1 = alloc_box $ Int64 <nl> + % 1 = alloc_box $ @ box Int64 <nl> % 1a = project_box % 1 : $ @ box Int64 , 0 <nl> % 2 = load % 1a : $ * Int64 <nl> % 3 = function_ref @ inout_uninit : $ @ convention ( thin ) ( ) - > ( ) <nl> bb0 : <nl> / / CHECK - NOT : sil @ inout_uninit : $ @ convention ( thin ) ( ) - > ( ) { <nl> sil @ inout_uninit : $ @ convention ( thin ) ( ) - > ( ) { <nl> bb0 : <nl> - % 1 = alloc_box $ Int64 <nl> + % 1 = alloc_box $ @ box Int64 <nl> % 1a = project_box % 1 : $ @ box Int64 , 0 <nl> % 5 = function_ref @ takes_Int_inout : $ @ convention ( thin ) ( @ inout Int64 ) - > ( ) <nl> % 6 = apply % 5 ( % 1a ) : $ @ convention ( thin ) ( @ inout Int64 ) - > ( ) <nl>
SIL : Construct alloc_box insns with the type of the box .
apple/swift
e1e7e19248f0db10d4dddfff24974a0d41636ddf
2016-11-04T02:26:42Z
mmm a / xbmc / dialogs / GUIDialogSmartPlaylistRule . cpp <nl> ppp b / xbmc / dialogs / GUIDialogSmartPlaylistRule . cpp <nl> <nl> # include " storage / MediaManager . h " <nl> # include " utils / LabelFormatter . h " <nl> # include " utils / StringUtils . h " <nl> + # include " settings / Settings . h " <nl> <nl> # define CONTROL_FIELD 15 <nl> # define CONTROL_OPERATOR 16 <nl> void CGUIDialogSmartPlaylistRule : : OnBrowse ( ) <nl> } <nl> <nl> / / sort the items <nl> - items . Sort ( SortByLabel , SortOrderAscending , SortAttributeIgnoreArticle ) ; <nl> + items . Sort ( SortByLabel , SortOrderAscending , CSettings : : Get ( ) . GetBool ( " filelists . ignorethewhensorting " ) ? SortAttributeIgnoreArticle : SortAttributeNone ) ; <nl> <nl> CGUIDialogSelect * pDialog = ( CGUIDialogSelect * ) g_windowManager . GetWindow ( WINDOW_DIALOG_SELECT ) ; <nl> pDialog - > Reset ( ) ; <nl> mmm a / xbmc / filesystem / SmartPlaylistDirectory . cpp <nl> ppp b / xbmc / filesystem / SmartPlaylistDirectory . cpp <nl> namespace XFILE <nl> <nl> / / sort grouped list by label <nl> if ( items . Size ( ) > 1 & & ! group . empty ( ) ) <nl> - items . Sort ( SortByLabel , SortOrderAscending , SortAttributeIgnoreArticle ) ; <nl> + items . Sort ( SortByLabel , SortOrderAscending , CSettings : : Get ( ) . GetBool ( " filelists . ignorethewhensorting " ) ? SortAttributeIgnoreArticle : SortAttributeNone ) ; <nl> <nl> / / go through and set the playlist order <nl> for ( int i = 0 ; i < items . Size ( ) ; i + + ) <nl> mmm a / xbmc / interfaces / json - rpc / AudioLibrary . cpp <nl> ppp b / xbmc / interfaces / json - rpc / AudioLibrary . cpp <nl> bool CAudioLibrary : : FillFileItemList ( const CVariant & parameterObject , CFileItemL <nl> / / If we retrieved the list of songs by " artistid " <nl> / / we sort by album ( and implicitly by track number ) <nl> if ( artistID ! = - 1 ) <nl> - list . Sort ( SortByAlbum , SortOrderAscending , SortAttributeIgnoreArticle ) ; <nl> + list . Sort ( SortByAlbum , SortOrderAscending , CSettings : : Get ( ) . GetBool ( " filelists . ignorethewhensorting " ) ? SortAttributeIgnoreArticle : SortAttributeNone ) ; <nl> / / If we retrieve the list of songs by " genreid " <nl> / / we sort by artist ( and implicitly by album and track number ) <nl> else if ( genreID ! = - 1 ) <nl> - list . Sort ( SortByArtist , SortOrderAscending , SortAttributeIgnoreArticle ) ; <nl> + list . Sort ( SortByArtist , SortOrderAscending , CSettings : : Get ( ) . GetBool ( " filelists . ignorethewhensorting " ) ? SortAttributeIgnoreArticle : SortAttributeNone ) ; <nl> / / otherwise we sort by track number <nl> else <nl> list . Sort ( SortByTrackNumber , SortOrderAscending ) ; <nl> mmm a / xbmc / video / dialogs / GUIDialogVideoInfo . cpp <nl> ppp b / xbmc / video / dialogs / GUIDialogVideoInfo . cpp <nl> bool CGUIDialogVideoInfo : : GetMoviesForSet ( const CFileItem * setItem , CFileItemLis <nl> if ( dialog = = NULL ) <nl> return false ; <nl> <nl> - listItems . Sort ( SortByLabel , SortOrderAscending , SortAttributeIgnoreArticle ) ; <nl> + listItems . Sort ( SortByLabel , SortOrderAscending , CSettings : : Get ( ) . GetBool ( " filelists . ignorethewhensorting " ) ? SortAttributeIgnoreArticle : SortAttributeNone ) ; <nl> <nl> dialog - > Reset ( ) ; <nl> dialog - > SetMultiSelection ( true ) ; <nl> bool CGUIDialogVideoInfo : : GetSetForMovie ( const CFileItem * movieItem , CFileItemPt <nl> std : : string baseDir = " videodb : / / movies / sets / " ; <nl> if ( ! CDirectory : : GetDirectory ( baseDir , listItems ) ) <nl> return false ; <nl> - listItems . Sort ( SortByLabel , SortOrderAscending , SortAttributeIgnoreArticle ) ; <nl> + listItems . Sort ( SortByLabel , SortOrderAscending , CSettings : : Get ( ) . GetBool ( " filelists . ignorethewhensorting " ) ? SortAttributeIgnoreArticle : SortAttributeNone ) ; <nl> <nl> int currentSetId = 0 ; <nl> std : : string currentSetLabel ; <nl> bool CGUIDialogVideoInfo : : GetItemsForTag ( const std : : string & strHeading , const st <nl> if ( dialog = = NULL ) <nl> return false ; <nl> <nl> - listItems . Sort ( SortByLabel , SortOrderAscending , SortAttributeIgnoreArticle ) ; <nl> + listItems . Sort ( SortByLabel , SortOrderAscending , CSettings : : Get ( ) . GetBool ( " filelists . ignorethewhensorting " ) ? SortAttributeIgnoreArticle : SortAttributeNone ) ; <nl> <nl> dialog - > Reset ( ) ; <nl> dialog - > SetMultiSelection ( true ) ; <nl>
Merge pull request from phate89 / fix_ignorethe
xbmc/xbmc
f861251e1616c3d85eccd7dd35dfd5356aa05a0d
2015-06-21T06:25:49Z
mmm a / ChangeLog <nl> ppp b / ChangeLog <nl> Please see also http : / / phantomjs . org / releases . html . <nl> <nl> New features <nl> <nl> + * Added the ability to abort network requests ( issue 230 ) <nl> * Added system access to stdin , stdout , and stderr ( issue 333 ) <nl> * Added seek function to the File stream ( issue 937 ) <nl> * Implemented file read for a specified number of bytes ( issue 938 ) <nl> + * Added a callback to handle network error ( issue 954 ) <nl> <nl> Improvements <nl> <nl> * Ensured a consistent 72 dpi for Linux headless rendering ( issue 659 ) <nl> + * Improved the autocomplete internal of the interactive / REPL mode ( issue 943 ) <nl> <nl> 2012 - 12 - 21 : Version 1 . 8 . 0 <nl> <nl>
Record more changes for the upcoming 1 . 9 .
ariya/phantomjs
aa907343b9e046c3f0c4aa671de7a755706eaf72
2013-01-05T07:44:36Z
mmm a / hphp / test / run <nl> ppp b / hphp / test / run <nl> function check_for_multiple_default_binaries ( $ typechecker ) { <nl> } <nl> <nl> $ append_path = ' / hphp / hhvm / hhvm ' ; <nl> - $ path_option = ' - - hhvm - binary_path ' ; <nl> + $ path_option = ' - - hhvm - binary - path ' ; <nl> if ( $ typechecker ) { <nl> $ append_path = ' / hphp / hack / src / hh_server ' ; <nl> $ path_option = ' - - hhserver - binary - path ' ; <nl>
Fix rogue underscore that should be a dash
facebook/hhvm
e18b65fe02ad1150b2ec4ea20d4eee6b246b2938
2016-02-16T19:30:34Z
mmm a / THCTensorIndex . cu <nl> ppp b / THCTensorIndex . cu <nl> void THCudaTensor_indexSelect_long ( THCState * state , THCudaTensor * dst , THCudaTen <nl> { <nl> THAssert ( THCudaTensor_checkGPU ( state , 2 , dst , src ) ) ; <nl> <nl> + THArgCheck ( indices - > nDimension = = 1 , 3 , " Index is supposed to be a vector " ) ; <nl> + <nl> THCudaTensor * indices_ = THCudaTensor_newWithSize1d ( state , indices - > size [ 0 ] ) ; <nl> THCudaTensor_copyLong ( state , indices_ , indices ) ; <nl> <nl>
Fix - added check to avoid invalid memory access in indexSelect_long
pytorch/pytorch
e1921929addce4b1c6e4f46c3eed576f0d7f4992
2016-04-30T22:28:12Z
mmm a / xbmc / interfaces / json - rpc / AVPlaylistOperations . cpp <nl> ppp b / xbmc / interfaces / json - rpc / AVPlaylistOperations . cpp <nl> JSON_STATUS CAVPlaylistOperations : : GetItems ( const CStdString & method , ITransport <nl> <nl> JSON_STATUS CAVPlaylistOperations : : Add ( const CStdString & method , ITransportLayer * transport , IClient * client , const Value & parameterObject , Value & result ) <nl> { <nl> + int playlist = GetPlaylist ( method ) ; <nl> CFileItemList list ; <nl> - if ( ! FillFileItemList ( parameterObject [ " item " ] , list ) ) <nl> + Value params = parameterObject ; <nl> + if ( playlist = = PLAYLIST_VIDEO ) <nl> + params [ " item " ] [ " media " ] = " video " ; <nl> + else if ( playlist = = PLAYLIST_MUSIC ) <nl> + params [ " item " ] [ " media " ] = " music " ; <nl> + <nl> + if ( ! FillFileItemList ( params [ " item " ] , list ) ) <nl> return InvalidParams ; <nl> <nl> - g_application . getApplicationMessenger ( ) . PlayListPlayerAdd ( GetPlaylist ( method ) , list ) ; <nl> + g_application . getApplicationMessenger ( ) . PlayListPlayerAdd ( playlist , list ) ; <nl> <nl> NotifyAll ( ) ; <nl> return ACK ; <nl> JSON_STATUS CAVPlaylistOperations : : Add ( const CStdString & method , ITransportLayer <nl> <nl> JSON_STATUS CAVPlaylistOperations : : Insert ( const CStdString & method , ITransportLayer * transport , IClient * client , const Value & parameterObject , Value & result ) <nl> { <nl> + int playlist = GetPlaylist ( method ) ; <nl> CFileItemList list ; <nl> - if ( ! FillFileItemList ( parameterObject [ " item " ] , list ) ) <nl> + Value params = parameterObject ; <nl> + if ( playlist = = PLAYLIST_VIDEO ) <nl> + params [ " item " ] [ " media " ] = " video " ; <nl> + else if ( playlist = = PLAYLIST_MUSIC ) <nl> + params [ " item " ] [ " media " ] = " music " ; <nl> + <nl> + if ( ! FillFileItemList ( params [ " item " ] , list ) ) <nl> return InvalidParams ; <nl> <nl> g_application . getApplicationMessenger ( ) . PlayListPlayerInsert ( GetPlaylist ( method ) , list , parameterObject [ " index " ] . asInt ( ) ) ; <nl> mmm a / xbmc / interfaces / json - rpc / AudioLibrary . cpp <nl> ppp b / xbmc / interfaces / json - rpc / AudioLibrary . cpp <nl> <nl> # include " music / tags / MusicInfoTag . h " <nl> # include " music / Song . h " <nl> # include " Application . h " <nl> + # include " filesystem / Directory . h " <nl> <nl> using namespace MUSIC_INFO ; <nl> using namespace Json ; <nl> using namespace JSONRPC ; <nl> + using namespace XFILE ; <nl> <nl> JSON_STATUS CAudioLibrary : : GetArtists ( const CStdString & method , ITransportLayer * transport , IClient * client , const Value & parameterObject , Value & result ) <nl> { <nl> JSON_STATUS CAudioLibrary : : ScanForContent ( const CStdString & method , ITransportLa <nl> return ACK ; <nl> } <nl> <nl> + bool CAudioLibrary : : FillFileItem ( const CStdString & strFilename , CFileItem & item ) <nl> + { <nl> + CMusicDatabase musicdatabase ; <nl> + bool status = false ; <nl> + if ( ! strFilename . empty ( ) & & ! CDirectory : : Exists ( strFilename ) & & musicdatabase . Open ( ) ) <nl> + { <nl> + CSong song ; <nl> + if ( musicdatabase . GetSongByFileName ( strFilename , song ) ) <nl> + { <nl> + item = CFileItem ( song ) ; <nl> + status = true ; <nl> + } <nl> + <nl> + musicdatabase . Close ( ) ; <nl> + } <nl> + <nl> + return status ; <nl> + } <nl> + <nl> bool CAudioLibrary : : FillFileItemList ( const Value & parameterObject , CFileItemList & list ) <nl> { <nl> CMusicDatabase musicdatabase ; <nl> bool CAudioLibrary : : FillFileItemList ( const Value & parameterObject , CFileItemList <nl> if ( musicdatabase . Open ( ) ) <nl> { <nl> CStdString file = parameterObject [ " file " ] . asString ( ) ; <nl> - CStdString directory = parameterObject [ " directory " ] . asString ( ) ; <nl> int artistID = parameterObject [ " artistid " ] . asInt ( ) ; <nl> int albumID = parameterObject [ " albumid " ] . asInt ( ) ; <nl> int genreID = parameterObject [ " genreid " ] . asInt ( ) ; <nl> <nl> - if ( ! directory . empty ( ) ) <nl> - { <nl> - if ( ! URIUtils : : HasSlashAtEnd ( directory ) ) <nl> - URIUtils : : AddSlashAtEnd ( directory ) ; <nl> - <nl> - int count = list . Size ( ) ; <nl> - CSongMap songs ; <nl> - if ( musicdatabase . GetSongsByPath ( directory , songs ) ) <nl> - { <nl> - std : : map < CStdString , CSong > : : const_iterator iter ; <nl> - std : : map < CStdString , CSong > : : const_iterator iterEnd = songs . End ( ) ; <nl> - for ( iter = songs . Begin ( ) ; iter ! = iterEnd ; iter + + ) <nl> - list . Add ( CFileItemPtr ( new CFileItem ( iter - > second ) ) ) ; <nl> - } <nl> - <nl> - if ( list . Size ( ) > count ) <nl> - success = true ; <nl> - } <nl> - <nl> - if ( ! file . empty ( ) & & ! URIUtils : : HasSlashAtEnd ( file ) ) <nl> + CFileItem fileItem ; <nl> + if ( FillFileItem ( file , fileItem ) ) <nl> { <nl> - CSong song ; <nl> - if ( musicdatabase . GetSongByFileName ( file , song ) ) <nl> - { <nl> - list . Add ( CFileItemPtr ( new CFileItem ( song ) ) ) ; <nl> - success = true ; <nl> - } <nl> + success = true ; <nl> + list . Add ( CFileItemPtr ( new CFileItem ( fileItem ) ) ) ; <nl> } <nl> <nl> if ( artistID ! = - 1 | | albumID ! = - 1 | | genreID ! = - 1 ) <nl> mmm a / xbmc / interfaces / json - rpc / AudioLibrary . h <nl> ppp b / xbmc / interfaces / json - rpc / AudioLibrary . h <nl> namespace JSONRPC <nl> static JSON_STATUS GetGenres ( const CStdString & method , ITransportLayer * transport , IClient * client , const Json : : Value & parameterObject , Json : : Value & result ) ; <nl> static JSON_STATUS ScanForContent ( const CStdString & method , ITransportLayer * transport , IClient * client , const Json : : Value & parameterObject , Json : : Value & result ) ; <nl> <nl> + static bool FillFileItem ( const CStdString & strFilename , CFileItem & item ) ; <nl> static bool FillFileItemList ( const Json : : Value & parameterObject , CFileItemList & list ) ; <nl> } ; <nl> } <nl> mmm a / xbmc / interfaces / json - rpc / FileItemHandler . cpp <nl> ppp b / xbmc / interfaces / json - rpc / FileItemHandler . cpp <nl> <nl> # include " video / VideoInfoTag . h " <nl> # include " music / tags / MusicInfoTag . h " <nl> # include " video / VideoDatabase . h " <nl> - <nl> + # include " filesystem / Directory . h " <nl> + # include " filesystem / File . h " <nl> <nl> using namespace MUSIC_INFO ; <nl> using namespace Json ; <nl> using namespace JSONRPC ; <nl> + using namespace XFILE ; <nl> <nl> void CFileItemHandler : : FillDetails ( ISerializable * info , CFileItemPtr item , const Value & fields , Value & result ) <nl> { <nl> bool CFileItemHandler : : FillFileItemList ( const Value & parameterObject , CFileItemL <nl> CFileOperations : : FillFileItemList ( parameterObject , list ) ; <nl> <nl> CStdString file = parameterObject [ " file " ] . asString ( ) ; <nl> - if ( ! file . empty ( ) & & ! URIUtils : : HasSlashAtEnd ( file ) ) <nl> + if ( ! file . empty ( ) & & ! CDirectory : : Exists ( file ) & & ( URIUtils : : IsURL ( file ) | | CFile : : Exists ( file ) ) ) <nl> { <nl> bool added = false ; <nl> for ( unsigned int index = 0 ; index < list . Size ( ) ; index + + ) <nl> bool CFileItemHandler : : FillFileItemList ( const Value & parameterObject , CFileItemL <nl> } <nl> } <nl> <nl> - return true ; <nl> + return ( list . Size ( ) > 0 ) ; <nl> } <nl> <nl> bool CFileItemHandler : : ParseSortMethods ( const CStdString & method , const bool & ignorethe , const CStdString & order , SORT_METHOD & sortmethod , SORT_ORDER & sortorder ) <nl> mmm a / xbmc / interfaces / json - rpc / FileOperations . cpp <nl> ppp b / xbmc / interfaces / json - rpc / FileOperations . cpp <nl> <nl> * / <nl> <nl> # include " FileOperations . h " <nl> + # include " VideoLibrary . h " <nl> + # include " AudioLibrary . h " <nl> # include " settings / Settings . h " <nl> # include " MediaSource . h " <nl> # include " filesystem / Directory . h " <nl> + # include " filesystem / File . h " <nl> # include " FileItem . h " <nl> # include " settings / AdvancedSettings . h " <nl> # include " Util . h " <nl> JSON_STATUS CFileOperations : : GetDirectory ( const CStdString & method , ITransportLa <nl> if ( items [ i ] - > m_bIsFolder ) <nl> filteredDirectories . Add ( items [ i ] ) ; <nl> else <nl> - filteredFiles . Add ( items [ i ] ) ; <nl> + { <nl> + CFileItem fileItem ; <nl> + if ( FillFileItem ( items [ i ] - > m_strPath , fileItem , media ) ) <nl> + filteredFiles . Add ( CFileItemPtr ( new CFileItem ( fileItem ) ) ) ; <nl> + } <nl> } <nl> <nl> / / Check if the " fields " list exists <nl> JSON_STATUS CFileOperations : : GetDirectory ( const CStdString & method , ITransportLa <nl> } <nl> int count = result [ " limits " ] [ " total " ] . asInt ( ) ; <nl> <nl> - HandleFileItemList ( NULL , true , " files " , filteredFiles , param , result ) ; <nl> + HandleFileItemList ( " id " , true , " files " , filteredFiles , param , result ) ; <nl> for ( unsigned int index = count ; index < result [ " files " ] . size ( ) ; index + + ) <nl> { <nl> result [ " files " ] [ index ] [ " filetype " ] = " file " ; <nl> JSON_STATUS CFileOperations : : Download ( const CStdString & method , ITransportLayer <nl> return transport - > Download ( parameterObject [ " path " ] . asString ( ) . c_str ( ) , & result ) ? OK : InvalidParams ; <nl> } <nl> <nl> + bool CFileOperations : : FillFileItem ( const CStdString & strFilename , CFileItem & item , CStdString media / * = " " * / ) <nl> + { <nl> + bool status = false ; <nl> + if ( ! strFilename . empty ( ) & & ! CDirectory : : Exists ( strFilename ) & & CFile : : Exists ( strFilename ) ) <nl> + { <nl> + if ( media . Equals ( " video " ) ) <nl> + status | = CVideoLibrary : : FillFileItem ( strFilename , item ) ; <nl> + else if ( media . Equals ( " music " ) ) <nl> + status | = CAudioLibrary : : FillFileItem ( strFilename , item ) ; <nl> + <nl> + if ( ! status ) <nl> + item = CFileItem ( strFilename , false ) ; <nl> + <nl> + status = true ; <nl> + } <nl> + <nl> + return status ; <nl> + } <nl> + <nl> bool CFileOperations : : FillFileItemList ( const Value & parameterObject , CFileItemList & list ) <nl> { <nl> - if ( parameterObject . isMember ( " directory " ) & & parameterObject . isMember ( " media " ) ) <nl> + if ( parameterObject . isMember ( " directory " ) ) <nl> { <nl> - CStdString media = parameterObject [ " media " ] . asString ( ) ; <nl> + CStdString media = parameterObject . get ( " media " , " " ) . asString ( ) ; <nl> media = media . ToLower ( ) ; <nl> <nl> - if ( media . Equals ( " video " ) | | media . Equals ( " music " ) | | media . Equals ( " pictures " ) | | media . Equals ( " files " ) | | media . Equals ( " programs " ) ) <nl> + CStdString strPath = parameterObject [ " directory " ] . asString ( ) ; <nl> + if ( ! strPath . empty ( ) ) <nl> { <nl> - CDirectory directory ; <nl> CFileItemList items ; <nl> - CStdString strPath = parameterObject [ " directory " ] . asString ( ) ; <nl> - <nl> - CStdStringArray regexps ; <nl> CStdString extensions = " " ; <nl> - if ( media . Equals ( " video " ) ) <nl> - { <nl> - regexps = g_advancedSettings . m_videoExcludeFromListingRegExps ; <nl> - extensions = g_settings . m_videoExtensions ; <nl> - } <nl> - else if ( media . Equals ( " music " ) ) <nl> - { <nl> - regexps = g_advancedSettings . m_audioExcludeFromListingRegExps ; <nl> - extensions = g_settings . m_musicExtensions ; <nl> - } <nl> - else if ( media . Equals ( " pictures " ) ) <nl> + CStdStringArray regexps ; <nl> + <nl> + if ( media . Equals ( " video " ) | | media . Equals ( " music " ) | | media . Equals ( " pictures " ) ) <nl> { <nl> - regexps = g_advancedSettings . m_pictureExcludeFromListingRegExps ; <nl> - extensions = g_settings . m_pictureExtensions ; <nl> + if ( media . Equals ( " video " ) ) <nl> + { <nl> + regexps = g_advancedSettings . m_videoExcludeFromListingRegExps ; <nl> + extensions = g_settings . m_videoExtensions ; <nl> + } <nl> + else if ( media . Equals ( " music " ) ) <nl> + { <nl> + regexps = g_advancedSettings . m_audioExcludeFromListingRegExps ; <nl> + extensions = g_settings . m_musicExtensions ; <nl> + } <nl> + else if ( media . Equals ( " pictures " ) ) <nl> + { <nl> + regexps = g_advancedSettings . m_pictureExcludeFromListingRegExps ; <nl> + extensions = g_settings . m_pictureExtensions ; <nl> + } <nl> } <nl> <nl> + CDirectory directory ; <nl> if ( directory . GetDirectory ( strPath , items , extensions ) ) <nl> { <nl> CFileItemList filteredDirectories ; <nl> bool CFileOperations : : FillFileItemList ( const Value & parameterObject , CFileItemLi <nl> if ( items [ i ] - > m_bIsFolder ) <nl> filteredDirectories . Add ( items [ i ] ) ; <nl> else <nl> - list . Add ( items [ i ] ) ; <nl> + { <nl> + CFileItem fileItem ; <nl> + if ( FillFileItem ( items [ i ] - > m_strPath , fileItem , media ) ) <nl> + list . Add ( CFileItemPtr ( new CFileItem ( fileItem ) ) ) ; <nl> + } <nl> } <nl> <nl> if ( parameterObject . isMember ( " recursive " ) & & parameterObject [ " recursive " ] . isBool ( ) ) <nl> mmm a / xbmc / interfaces / json - rpc / FileOperations . h <nl> ppp b / xbmc / interfaces / json - rpc / FileOperations . h <nl> namespace JSONRPC <nl> static JSON_STATUS GetDirectory ( const CStdString & method , ITransportLayer * transport , IClient * client , const Json : : Value & parameterObject , Json : : Value & result ) ; <nl> static JSON_STATUS Download ( const CStdString & method , ITransportLayer * transport , IClient * client , const Json : : Value & parameterObject , Json : : Value & result ) ; <nl> <nl> + static bool FillFileItem ( const CStdString & strFilename , CFileItem & item , CStdString media = " " ) ; <nl> static bool FillFileItemList ( const Json : : Value & parameterObject , CFileItemList & list ) ; <nl> } ; <nl> } <nl> mmm a / xbmc / interfaces / json - rpc / ServiceDescription . h <nl> ppp b / xbmc / interfaces / json - rpc / ServiceDescription . h <nl> namespace JSONRPC <nl> " \ " params \ " : [ " <nl> " { \ " name \ " : \ " item \ " , \ " type \ " : \ " object \ " , \ " id \ " : \ " Playlist . Video . Item \ " , \ " required \ " : true , " <nl> " \ " properties \ " : { " <nl> - " \ " file \ " : { \ " type \ " : \ " string \ " } , " <nl> + " \ " file \ " : { \ " type \ " : \ " string \ " , \ " description \ " : \ " Path to a file ( not a directory ) to be added to the playlist \ " } , " <nl> + " \ " directory \ " : { \ " type \ " : \ " string \ " } , " <nl> " \ " movieid \ " : { \ " $ ref \ " : \ " Library . Id \ " } , " <nl> " \ " episodeid \ " : { \ " $ ref \ " : \ " Library . Id \ " } , " <nl> " \ " musicvideoid \ " : { \ " $ ref \ " : \ " Library . Id \ " } , " <nl> namespace JSONRPC <nl> " \ " properties \ " : { " <nl> " \ " file \ " : { \ " type \ " : \ " string \ " , \ " required \ " : true } , " <nl> " \ " label \ " : { \ " type \ " : \ " string \ " , \ " required \ " : true } , " <nl> - " \ " filetype \ " : { \ " type \ " : \ " string \ " , \ " enum \ " : [ \ " file \ " , \ " directory \ " ] , \ " required \ " : true } " <nl> + " \ " filetype \ " : { \ " type \ " : \ " string \ " , \ " enum \ " : [ \ " file \ " , \ " directory \ " ] , \ " required \ " : true } , " <nl> + " \ " id \ " : { \ " $ ref \ " : \ " Library . Id \ " } , " <nl> + " \ " type \ " : { \ " type \ " : \ " string \ " , \ " enum \ " : [ \ " unknown \ " , \ " movie \ " , \ " episode \ " , \ " musicvideo \ " , \ " song \ " ] } , " <nl> + " \ " fanart \ " : { \ " type \ " : \ " string \ " } , " <nl> + " \ " thumbnail \ " : { \ " type \ " : \ " string \ " } , " <nl> + " \ " title \ " : { \ " type \ " : \ " string \ " } , " <nl> + " \ " artist \ " : { \ " type \ " : \ " string \ " } , " <nl> + " \ " albumartist \ " : { \ " type \ " : \ " string \ " } , " <nl> + " \ " genre \ " : { \ " type \ " : \ " string \ " } , " <nl> + " \ " year \ " : { \ " type \ " : \ " integer \ " } , " <nl> + " \ " rating \ " : { \ " type \ " : \ " number \ " } , " <nl> + " \ " album \ " : { \ " type \ " : \ " string \ " } , " <nl> + " \ " track \ " : { \ " type \ " : \ " integer \ " } , " <nl> + " \ " duration \ " : { \ " type \ " : \ " integer \ " } , " <nl> + " \ " comment \ " : { \ " type \ " : \ " string \ " } , " <nl> + " \ " lyrics \ " : { \ " type \ " : \ " string \ " } , " <nl> + " \ " playcount \ " : { \ " type \ " : \ " integer \ " } , " <nl> + " \ " musicbrainztrackid \ " : { \ " type \ " : \ " string \ " } , " <nl> + " \ " musicbrainzartistid \ " : { \ " type \ " : \ " string \ " } , " <nl> + " \ " musicbrainzalbumid \ " : { \ " type \ " : \ " string \ " } , " <nl> + " \ " musicbrainzalbumartistid \ " : { \ " type \ " : \ " string \ " } , " <nl> + " \ " director \ " : { \ " type \ " : \ " string \ " } , " <nl> + " \ " trailer \ " : { \ " type \ " : \ " string \ " } , " <nl> + " \ " tagline \ " : { \ " type \ " : \ " string \ " } , " <nl> + " \ " plot \ " : { \ " type \ " : \ " string \ " } , " <nl> + " \ " plotoutline \ " : { \ " type \ " : \ " string \ " } , " <nl> + " \ " originaltitle \ " : { \ " type \ " : \ " string \ " } , " <nl> + " \ " lastplayed \ " : { \ " type \ " : \ " string \ " } , " <nl> + " \ " writer \ " : { \ " type \ " : \ " string \ " } , " <nl> + " \ " studio \ " : { \ " type \ " : \ " string \ " } , " <nl> + " \ " mpaa \ " : { \ " type \ " : \ " string \ " } , " <nl> + " \ " cast \ " : { \ " $ ref \ " : \ " Video . Cast \ " } , " <nl> + " \ " country \ " : { \ " type \ " : \ " string \ " } , " <nl> + " \ " imdbnumber \ " : { \ " type \ " : \ " string \ " } , " <nl> + " \ " premiered \ " : { \ " type \ " : \ " string \ " } , " <nl> + " \ " productioncode \ " : { \ " type \ " : \ " string \ " } , " <nl> + " \ " runtime \ " : { \ " type \ " : \ " string \ " } , " <nl> + " \ " set \ " : { \ " type \ " : \ " string \ " } , " <nl> + " \ " showlink \ " : { \ " type \ " : \ " string \ " } , " <nl> + " \ " streamDetails \ " : { \ " $ ref \ " : \ " Video . StreamDetails \ " } , " <nl> + " \ " top250 \ " : { \ " type \ " : \ " integer \ " } , " <nl> + " \ " votes \ " : { \ " type \ " : \ " string \ " } , " <nl> + " \ " writingcredits \ " : { \ " type \ " : \ " string \ " } , " <nl> + " \ " firstaired \ " : { \ " type \ " : \ " string \ " } , " <nl> + " \ " season \ " : { \ " type \ " : \ " integer \ " } , " <nl> + " \ " episode \ " : { \ " type \ " : \ " integer \ " } , " <nl> + " \ " showtitle \ " : { \ " type \ " : \ " string \ " } " <nl> " } " <nl> " } " <nl> " } " <nl> mmm a / xbmc / interfaces / json - rpc / VideoLibrary . cpp <nl> ppp b / xbmc / interfaces / json - rpc / VideoLibrary . cpp <nl> JSON_STATUS CVideoLibrary : : ScanForContent ( const CStdString & method , ITransportLa <nl> return ACK ; <nl> } <nl> <nl> + bool CVideoLibrary : : FillFileItem ( const CStdString & strFilename , CFileItem & item ) <nl> + { <nl> + CVideoDatabase videodatabase ; <nl> + bool status = false ; <nl> + if ( ! strFilename . empty ( ) & & videodatabase . Open ( ) ) <nl> + { <nl> + CVideoInfoTag details ; <nl> + if ( videodatabase . LoadVideoInfo ( strFilename , details ) ) <nl> + { <nl> + item = CFileItem ( details ) ; <nl> + status = true ; <nl> + } <nl> + <nl> + videodatabase . Close ( ) ; <nl> + } <nl> + <nl> + return status ; <nl> + } <nl> + <nl> bool CVideoLibrary : : FillFileItemList ( const Value & parameterObject , CFileItemList & list ) <nl> { <nl> CVideoDatabase videodatabase ; <nl> bool CVideoLibrary : : FillFileItemList ( const Value & parameterObject , CFileItemList <nl> int musicVideoID = parameterObject [ " musicvideoid " ] . asInt ( ) ; <nl> <nl> bool success = false ; <nl> - if ( ! file . empty ( ) ) <nl> + CFileItem fileItem ; <nl> + if ( FillFileItem ( file , fileItem ) ) <nl> { <nl> - CVideoInfoTag details ; <nl> - if ( videodatabase . LoadVideoInfo ( file , details ) ) <nl> - { <nl> - list . Add ( CFileItemPtr ( new CFileItem ( details ) ) ) ; <nl> - success = true ; <nl> - } <nl> + success = true ; <nl> + list . Add ( CFileItemPtr ( new CFileItem ( fileItem ) ) ) ; <nl> } <nl> + <nl> if ( movieID > 0 ) <nl> { <nl> CVideoInfoTag details ; <nl> mmm a / xbmc / interfaces / json - rpc / VideoLibrary . h <nl> ppp b / xbmc / interfaces / json - rpc / VideoLibrary . h <nl> namespace JSONRPC <nl> <nl> static JSON_STATUS ScanForContent ( const CStdString & method , ITransportLayer * transport , IClient * client , const Json : : Value & parameterObject , Json : : Value & result ) ; <nl> <nl> + static bool FillFileItem ( const CStdString & strFilename , CFileItem & item ) ; <nl> static bool FillFileItemList ( const Json : : Value & parameterObject , CFileItemList & list ) ; <nl> <nl> private : <nl>
jsonrpc : extended metadata handling for ( Audio | Video ) Playlist . Add / Insert and for Files . GetDirectory
xbmc/xbmc
210562f05c4d8bdfceb0225f6d715096c6165be6
2011-05-02T09:33:14Z
mmm a / js / server / tests / aql / aql - optimizer - rule - optimize - traversals - spec . js <nl> ppp b / js / server / tests / aql / aql - optimizer - rule - optimize - traversals - spec . js <nl> <nl> / * jshint globalstrict : false , strict : false , maxlen : 5000 * / <nl> - / * global describe , beforeEach , afterEach , it * / <nl> + / * global describe , before , after , it , AQL_EXPLAIN , AQL_EXECUTE , AQL_EXECUTEJSON * / <nl> ' use strict ' ; <nl> <nl> - / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / <nl> - / / / @ brief tests for optimizer rules <nl> - / / / <nl> - / / / @ file <nl> - / / / <nl> - / / / DISCLAIMER <nl> - / / / <nl> - / / / Copyright 2010 - 2012 triagens GmbH , Cologne , Germany <nl> - / / / <nl> - / / / Licensed under the Apache License , Version 2 . 0 ( the " License " ) ; <nl> - / / / you may not use this file except in compliance with the License . <nl> - / / / You may obtain a copy of the License at <nl> - / / / <nl> - / / / http : / / www . apache . org / licenses / LICENSE - 2 . 0 <nl> - / / / <nl> - / / / Unless required by applicable law or agreed to in writing , software <nl> - / / / distributed under the License is distributed on an " AS IS " BASIS , <nl> - / / / WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND , either express or implied . <nl> - / / / See the License for the specific language governing permissions and <nl> - / / / limitations under the License . <nl> - / / / <nl> - / / / Copyright holder is triAGENS GmbH , Cologne , Germany <nl> - / / / <nl> - / / / @ author Wilfried Goesgens , Michael Hackstein <nl> - / / / @ author Copyright 2014 , triAGENS GmbH , Cologne , Germany <nl> - / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / <nl> + / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / <nl> + / / / @ brief tests for optimizer rules <nl> + / / / <nl> + / / / @ file <nl> + / / / <nl> + / / / DISCLAIMER <nl> + / / / <nl> + / / / Copyright 2010 - 2012 triagens GmbH , Cologne , Germany <nl> + / / / <nl> + / / / Licensed under the Apache License , Version 2 . 0 ( the " License " ) ; <nl> + / / / you may not use this file except in compliance with the License . <nl> + / / / You may obtain a copy of the License at <nl> + / / / <nl> + / / / http : / / www . apache . org / licenses / LICENSE - 2 . 0 <nl> + / / / <nl> + / / / Unless required by applicable law or agreed to in writing , software <nl> + / / / distributed under the License is distributed on an " AS IS " BASIS , <nl> + / / / WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND , either express or implied . <nl> + / / / See the License for the specific language governing permissions and <nl> + / / / limitations under the License . <nl> + / / / <nl> + / / / Copyright holder is triAGENS GmbH , Cologne , Germany <nl> + / / / <nl> + / / / @ author Wilfried Goesgens , Michael Hackstein <nl> + / / / @ author Copyright 2014 , triAGENS GmbH , Cologne , Germany <nl> + / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / <nl> / / <nl> const expect = require ( ' chai ' ) . expect ; <nl> <nl> - const arangodb = require ( ' @ arangodb ' ) ; <nl> const helper = require ( ' @ arangodb / aql - helper ' ) ; <nl> const isEqual = helper . isEqual ; <nl> - const _ = require ( ' lodash ' ) ; <nl> - const graph_module = require ( ' @ arangodb / general - graph ' ) ; <nl> + const graphModule = require ( ' @ arangodb / general - graph ' ) ; <nl> const graphName = ' myUnittestGraph ' ; <nl> <nl> let graph ; <nl> - let opts ; <nl> + let edgeKey ; <nl> <nl> - const ruleName = " optimize - traversals " ; <nl> - / / various choices to control the optimizer : <nl> - const paramEnabled = { allPlans : true , verbosePlans : true , optimizer : { rules : [ " - all " , " + " + ruleName ] } } ; <nl> - const paramDisabled = { allPlans : true , verbosePlans : true , optimizer : { rules : [ " + all " , " - " + ruleName ] } } ; <nl> + const ruleName = ' optimize - traversals ' ; <nl> + / / various choices to control the optimizer : <nl> + const paramEnabled = { optimizer : { rules : [ ' - all ' , ' + ' + ruleName ] } } ; <nl> + const paramDisabled = { optimizer : { rules : [ ' + all ' , ' - ' + ruleName ] } } ; <nl> <nl> const cleanup = ( ) = > { <nl> try { <nl> - graph_module . _drop ( graphName , true ) ; <nl> + graphModule . _drop ( graphName , true ) ; <nl> } catch ( x ) { <nl> } <nl> - } <nl> - / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / <nl> - / / / @ brief test suite <nl> - / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / <nl> + } ; <nl> + / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / <nl> + / / / @ brief test suite <nl> + / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / <nl> <nl> - describe ( ' Rule optimize - traversals ' , ( ) = > { <nl> - <nl> - / / / @ brief set up <nl> + describe ( ' Rule optimize - traversals ' , ( ) = > { <nl> + / / / @ brief set up <nl> before ( ( ) = > { <nl> cleanup ( ) ; <nl> - graph = graph_module . _create ( graphName , [ <nl> - graph_module . _relation ( " edges " , " circles " , " circles " ) ] ) ; <nl> + graph = graphModule . _create ( graphName , [ <nl> + graphModule . _relation ( ' edges ' , ' circles ' , ' circles ' ) ] ) ; <nl> <nl> / / Add circle circles <nl> - graph . circles . save ( { " _key " : " A " , " label " : ' 1 ' } ) ; <nl> - graph . circles . save ( { " _key " : " B " , " label " : ' 2 ' } ) ; <nl> - graph . circles . save ( { " _key " : " C " , " label " : ' 3 ' } ) ; <nl> - graph . circles . save ( { " _key " : " D " , " label " : ' 4 ' } ) ; <nl> - graph . circles . save ( { " _key " : " E " , " label " : ' 5 ' } ) ; <nl> - graph . circles . save ( { " _key " : " F " , " label " : ' 6 ' } ) ; <nl> - graph . circles . save ( { " _key " : " G " , " label " : ' 7 ' } ) ; <nl> + graph . circles . save ( { ' _key ' : ' A ' , ' label ' : ' 1 ' } ) ; <nl> + graph . circles . save ( { ' _key ' : ' B ' , ' label ' : ' 2 ' } ) ; <nl> + graph . circles . save ( { ' _key ' : ' C ' , ' label ' : ' 3 ' } ) ; <nl> + graph . circles . save ( { ' _key ' : ' D ' , ' label ' : ' 4 ' } ) ; <nl> + graph . circles . save ( { ' _key ' : ' E ' , ' label ' : ' 5 ' } ) ; <nl> + graph . circles . save ( { ' _key ' : ' F ' , ' label ' : ' 6 ' } ) ; <nl> + graph . circles . save ( { ' _key ' : ' G ' , ' label ' : ' 7 ' } ) ; <nl> <nl> / / Add relevant edges <nl> - edgeKey = graph . edges . save ( " circles / A " , " circles / C " , { theFalse : false , theTruth : true , " label " : ' foo ' } ) . _key ; <nl> - graph . edges . save ( " circles / A " , " circles / B " , { theFalse : false , theTruth : true , " label " : ' bar ' } ) ; <nl> - graph . edges . save ( " circles / B " , " circles / D " , { theFalse : false , theTruth : true , " label " : ' blarg ' } ) ; <nl> - graph . edges . save ( " circles / B " , " circles / E " , { theFalse : false , theTruth : true , " label " : ' blub ' } ) ; <nl> - graph . edges . save ( " circles / C " , " circles / F " , { theFalse : false , theTruth : true , " label " : ' schubi ' } ) ; <nl> - graph . edges . save ( " circles / C " , " circles / G " , { theFalse : false , theTruth : true , " label " : ' doo ' } ) ; <nl> + edgeKey = graph . edges . save ( ' circles / A ' , ' circles / C ' , { theFalse : false , theTruth : true , ' label ' : ' foo ' } ) . _key ; <nl> + graph . edges . save ( ' circles / A ' , ' circles / B ' , { theFalse : false , theTruth : true , ' label ' : ' bar ' } ) ; <nl> + graph . edges . save ( ' circles / B ' , ' circles / D ' , { theFalse : false , theTruth : true , ' label ' : ' blarg ' } ) ; <nl> + graph . edges . save ( ' circles / B ' , ' circles / E ' , { theFalse : false , theTruth : true , ' label ' : ' blub ' } ) ; <nl> + graph . edges . save ( ' circles / C ' , ' circles / F ' , { theFalse : false , theTruth : true , ' label ' : ' schubi ' } ) ; <nl> + graph . edges . save ( ' circles / C ' , ' circles / G ' , { theFalse : false , theTruth : true , ' label ' : ' doo ' } ) ; <nl> } ) ; <nl> <nl> - / / / @ brief tear down <nl> + / / / @ brief tear down <nl> after ( cleanup ) ; <nl> <nl> it ( ' should remove unused variables ' , ( ) = > { <nl> - const queries = [ <nl> + const queries = [ <nl> [ ` FOR v , e , p IN 1 . . 5 OUTBOUND ' circles / A ' GRAPH ' $ { graphName } ' RETURN 1 ` , true , [ true , false , false ] ] , <nl> [ ` FOR v , e , p IN 1 . . 5 OUTBOUND ' circles / A ' GRAPH ' $ { graphName } ' RETURN [ v , e ] ` , true , [ true , true , false ] ] , <nl> [ ` FOR v , e , p IN 1 . . 5 OUTBOUND ' circles / A ' GRAPH ' $ { graphName } ' RETURN [ v , p ] ` , true , [ true , false , true ] ] , <nl> describe ( ' Rule optimize - traversals ' , ( ) = > { <nl> <nl> queries . forEach ( ( query ) = > { <nl> const result = AQL_EXPLAIN ( query [ 0 ] , { } , paramEnabled ) ; <nl> - assertEqual ( query [ 1 ] , result . plan . rules . indexOf ( ruleName ) ! = = - 1 , query ) ; <nl> + expect ( result . plan . rules . indexOf ( ruleName ) ! = = - 1 ) . to . equal ( query [ 1 ] , query ) ; <nl> <nl> / / check that variables were correctly optimized away <nl> let found = false ; <nl> result . plan . nodes . forEach ( function ( thisNode ) { <nl> - if ( thisNode . type = = = " TraversalNode " ) { <nl> - assertEqual ( query [ 2 ] [ 0 ] , thisNode . hasOwnProperty ( " vertexOutVariable " ) ) ; <nl> - assertEqual ( query [ 2 ] [ 1 ] , thisNode . hasOwnProperty ( " edgeOutVariable " ) ) ; <nl> - assertEqual ( query [ 2 ] [ 2 ] , thisNode . hasOwnProperty ( " pathOutVariable " ) ) ; <nl> + if ( thisNode . type = = = ' TraversalNode ' ) { <nl> + expect ( thisNode . hasOwnProperty ( ' vertexOutVariable ' ) ) . to . equal ( query [ 2 ] [ 0 ] ) ; <nl> + expect ( thisNode . hasOwnProperty ( ' edgeOutVariable ' ) ) . to . equal ( query [ 2 ] [ 1 ] ) ; <nl> + expect ( thisNode . hasOwnProperty ( ' pathOutVariable ' ) ) . to . equal ( query [ 2 ] [ 2 ] ) ; <nl> found = true ; <nl> } <nl> } ) ; <nl> - assertTrue ( found ) ; <nl> + expect ( found ) . to . be . true ; <nl> } ) ; <nl> } ) ; <nl> <nl> - <nl> it ( ' should not take effect in these queries ' , ( ) = > { <nl> - const queries = [ <nl> + const queries = [ <nl> ` FOR v , e , p IN 1 . . 5 OUTBOUND ' circles / A ' GRAPH ' $ { graphName } ' <nl> LET localScopeVar = NOOPT ( true ) FILTER p . edges [ 0 ] . theTruth = = localScopeVar <nl> RETURN { v : v , e : e , p : p } ` , <nl> describe ( ' Rule optimize - traversals ' , ( ) = > { <nl> RETURN { v : v , e : e , p : p } ` , <nl> ` FOR v , e , p IN 2 OUTBOUND ' circles / A ' GRAPH ' $ { graphName } ' <nl> FILTER NOOPT ( V8 ( CONCAT ( p . edges [ 0 ] . _key , ' ' ) ) ) = = " + edgeKey + " SORT v . _key <nl> - RETURN { v : v , e : e , p : p } ` <nl> + RETURN { v : v , e : e , p : p } ` , <nl> + ` FOR snippet IN [ ' a ' , ' b ' ] <nl> + FOR v , e , p IN 1 . . 5 OUTBOUND ' circles / A ' GRAPH ' $ { graphName } ' <nl> + FILTER p . edges [ 1 ] . label = = CONCAT ( snippet , ' ar ' ) <nl> + RETURN { v , e , p } ` <nl> ] ; <nl> <nl> - queries . forEach ( function ( query ) { <nl> + queries . forEach ( function ( query ) { <nl> const result = AQL_EXPLAIN ( query , { } , paramEnabled ) ; <nl> - assertTrue ( result . plan . rules . indexOf ( ruleName ) = = = - 1 , query ) ; <nl> + expect ( result . plan . rules . indexOf ( ruleName ) ) . to . equal ( - 1 , query ) ; <nl> } ) ; <nl> } ) ; <nl> <nl> describe ( ' Rule optimize - traversals ' , ( ) = > { <nl> FILTER p . edges [ 0 ] . theTruth = = true FILTER p . edges [ 1 ] . label = = ' bar ' <nl> RETURN { v , e , p } ` , <nl> ` FOR snippet IN [ ' a ' , ' b ' ] <nl> + LET test = CONCAT ( snippet , ' ar ' ) <nl> FOR v , e , p IN 1 . . 5 OUTBOUND ' circles / A ' GRAPH ' $ { graphName } ' <nl> - FILTER p . edges [ 1 ] . label = = CONCAT ( snippet , ' ar ' ) <nl> + FILTER p . edges [ 1 ] . label = = test <nl> RETURN { v , e , p } ` <nl> ] ; <nl> - queries . forEach ( function ( query ) { <nl> + queries . forEach ( function ( query ) { <nl> const result = AQL_EXPLAIN ( query , { } , paramEnabled ) ; <nl> - assertNotEqual ( - 1 , result . plan . rules . indexOf ( ruleName ) , query ) ; <nl> + expect ( result . plan . rules . indexOf ( ruleName ) ) . to . not . equal ( - 1 , query ) ; <nl> result . plan . nodes . forEach ( ( thisNode ) = > { <nl> - if ( thisNode . type = = = " TraversalNode " ) { <nl> - assertTrue ( thisNode . hasOwnProperty ( " condition " ) , query ) ; <nl> + if ( thisNode . type = = = ' TraversalNode ' ) { <nl> + expect ( thisNode . hasOwnProperty ( ' condition ' ) ) . to . equal ( true , query ) ; <nl> } <nl> } ) ; <nl> } ) ; <nl> } ) ; <nl> <nl> it ( ' should not modify the result ' , ( ) = > { <nl> - var queries = [ <nl> + var queries = [ <nl> ` FOR v , e , p IN 1 . . 5 OUTBOUND ' circles / A ' GRAPH ' $ { graphName } ' <nl> FILTER p . edges [ 0 ] . label = = ' foo ' <nl> RETURN { v , e , p } ` , <nl> describe ( ' Rule optimize - traversals ' , ( ) = > { <nl> RETURN { v , e , p } ` , <nl> ` FOR v , e , p IN 1 . . 5 OUTBOUND ' circles / A ' GRAPH ' $ { graphName } ' <nl> FILTER p . edges [ 1 ] . theTruth = = true FILTER p . edges [ 1 ] . label = = ' foo ' <nl> - RETURN { v , e , p } ` , <nl> + RETURN { v , e , p } ` <nl> ] ; <nl> - queries . forEach ( function ( query ) { <nl> - const planDisabled = AQL_EXPLAIN ( query , { } , paramDisabled ) ; <nl> - const planEnabled = AQL_EXPLAIN ( query , { } , paramEnabled ) ; <nl> + const opts = { allPlans : true , verbosePlans : true , optimizer : { rules : [ ' - all ' , ' + ' + ruleName ] } } ; <nl> + <nl> + queries . forEach ( function ( query ) { <nl> + const planDisabled = AQL_EXPLAIN ( query , { } , paramDisabled ) ; <nl> + const planEnabled = AQL_EXPLAIN ( query , { } , paramEnabled ) ; <nl> const resultDisabled = AQL_EXECUTE ( query , { } , paramDisabled ) . json ; <nl> - const resultEnabled = AQL_EXECUTE ( query , { } , paramEnabled ) . json ; <nl> + const resultEnabled = AQL_EXECUTE ( query , { } , paramEnabled ) . json ; <nl> <nl> - assertTrue ( isEqual ( resultDisabled , resultEnabled ) , query ) ; <nl> + expect ( isEqual ( resultDisabled , resultEnabled ) ) . to . equal ( true , query ) ; <nl> <nl> - assertEqual ( - 1 , planDisabled . plan . rules . indexOf ( ruleName ) , query ) ; <nl> - assertNotEqual ( - 1 , planEnabled . plan . rules . indexOf ( ruleName ) , query ) ; <nl> + expect ( planDisabled . plan . rules . indexOf ( ruleName ) ) . to . equal ( - 1 , query ) ; <nl> + expect ( planEnabled . plan . rules . indexOf ( ruleName ) ) . to . not . equal ( - 1 , query ) ; <nl> <nl> const plans = AQL_EXPLAIN ( query , { } , opts ) . plans ; <nl> - plans . forEach ( function ( plan ) { <nl> - const jsonResult = AQL_EXECUTEJSON ( plan , { optimizer : { rules : [ " - all " ] } } ) . json ; <nl> - assertEqual ( jsonResult , resultDisabled , query ) ; <nl> + plans . forEach ( function ( plan ) { <nl> + const jsonResult = AQL_EXECUTEJSON ( plan , { optimizer : { rules : [ ' - all ' ] } } ) . json ; <nl> + expect ( jsonResult ) . to . deep . equal ( resultDisabled , query ) ; <nl> } ) ; <nl> - <nl> } ) ; <nl> } ) ; <nl> <nl> describe ( ' Rule optimize - traversals ' , ( ) = > { <nl> ` WITH circles FOR v , e , p IN 2 OUTBOUND @ start @ @ ecol <nl> FILTER NOOPT ( CONCAT ( p . edges [ 0 ] . _key , ' ' ) ) = = @ edgeKey <nl> SORT v . _key RETURN v . _key ` , <nl> - ` WITH circles FOR v , e , p IN 2 OUTBOUND @ start @ @ ecol <nl> + ` WITH circles FOR v , e , p IN 2 OUTBOUND @ start @ @ ecol <nl> FILTER NOOPT ( V8 ( CONCAT ( p . edges [ 0 ] . _key , ' ' ) ) ) = = @ edgeKey <nl> SORT v . _key RETURN v . _key ` <nl> ] ; <nl> const bindVars = { <nl> - start : " circles / A " , <nl> - " @ ecol " : " edges " , <nl> + start : ' circles / A ' , <nl> + ' @ ecol ' : ' edges ' , <nl> edgeKey : edgeKey <nl> } ; <nl> queries . forEach ( function ( q ) { <nl> - const res = AQL_EXECUTE ( q , bindVars , paramDisabled ) . json ; <nl> - assertEqual ( res . length , 2 , " query : " + q ) ; <nl> - assertEqual ( res [ 0 ] , " F " , " query : " + q ) ; <nl> - assertEqual ( res [ 1 ] , " G " , " query : " + q ) ; <nl> + let res = AQL_EXECUTE ( q , bindVars , paramDisabled ) . json ; <nl> + expect ( res . length ) . to . equal ( 2 , ' query : ' + q ) ; <nl> + expect ( res [ 0 ] ) . to . equal ( ' F ' , ' query : ' + q ) ; <nl> + expect ( res [ 1 ] ) . to . equal ( ' G ' , ' query : ' + q ) ; <nl> + <nl> res = AQL_EXECUTE ( q , bindVars , paramEnabled ) . json ; <nl> - assertEqual ( res . length , 2 , " query ( enabled ) : " + q ) ; <nl> - assertEqual ( res [ 0 ] , " F " , " query ( enabled ) : " + q ) ; <nl> - assertEqual ( res [ 1 ] , " G " , " query ( enabled ) : " + q ) ; <nl> + <nl> + expect ( res . length ) . to . equal ( 2 , ' query ( enabled ) : ' + q ) ; <nl> + expect ( res [ 0 ] ) . to . equal ( ' F ' , ' query ( enabled ) : ' + q ) ; <nl> + expect ( res [ 1 ] ) . to . equal ( ' G ' , ' query ( enabled ) : ' + q ) ; <nl> } ) ; <nl> } ) ; <nl> <nl> it ( ' should short - circuit conditions that cannot be fulfilled ' , ( ) = > { <nl> - let queries = [ <nl> + let queries = [ <nl> ` FOR v , e , p IN 1 . . 5 OUTBOUND ' circles / A ' GRAPH ' $ { graphName } ' FILTER p . edges [ 7 ] . label = = ' foo ' RETURN { v , e , p } ` , <nl> / / indexed access starts with 0 - this is also forbidden since it will look for the 6th ! <nl> - ` FOR v , e , p IN 1 . . 5 OUTBOUND ' circles / A ' GRAPH ' $ { graphName } ' FILTER p . edges [ 5 ] . label = = ' foo ' RETURN { v , e , p } ` , <nl> + ` FOR v , e , p IN 1 . . 5 OUTBOUND ' circles / A ' GRAPH ' $ { graphName } ' FILTER p . edges [ 5 ] . label = = ' foo ' RETURN { v , e , p } ` <nl> / / " FOR v , e , p IN 1 . . 5 OUTBOUND ' circles / A ' GRAPH ' myGraph ' FILTER p . edges [ 1 ] . label = = ' foo ' AND p . edges [ 1 ] . label = = ' bar ' return { v : v , e : e , p : p } " <nl> ] ; <nl> <nl> - queries . forEach ( function ( query ) { <nl> + queries . forEach ( function ( query ) { <nl> let result = AQL_EXPLAIN ( query , { } , paramEnabled ) ; <nl> let simplePlan = helper . getCompactPlan ( result ) ; <nl> - assertNotEqual ( - 1 , result . plan . rules . indexOf ( ruleName ) , query ) ; <nl> - assertEqual ( simplePlan [ 2 ] . type , " NoResultsNode " ) ; <nl> + expect ( result . plan . rules . indexOf ( ruleName ) ) . to . not . equal ( - 1 , query ) ; <nl> + expect ( simplePlan [ 2 ] . type ) . to . equal ( ' NoResultsNode ' ) ; <nl> } ) ; <nl> } ) ; <nl> <nl> describe ( ' using condition vars ' , ( ) = > { <nl> - <nl> it ( ' taking invalid start form subquery ' , ( ) = > { <nl> const query = ` <nl> LET data = ( FOR i IN 1 . . 1 RETURN i ) <nl> describe ( ' Rule optimize - traversals ' , ( ) = > { <nl> RETURN 1 ` ; <nl> <nl> const result = AQL_EXPLAIN ( query ) ; <nl> - assertNotEqual ( - 1 , result . plan . rules . indexOf ( ruleName ) , query ) ; <nl> - assertEqual ( 0 , AQL_EXECUTE ( query ) . json . length ) ; <nl> + expect ( result . plan . rules . indexOf ( ruleName ) ) . to . not . equal ( - 1 , query ) ; <nl> + expect ( AQL_EXECUTE ( query ) . json . length ) . to . equal ( 0 ) ; <nl> } ) ; <nl> <nl> it ( ' filtering on a subquery ' , ( ) = > { <nl> describe ( ' Rule optimize - traversals ' , ( ) = > { <nl> RETURN 1 ` ; <nl> <nl> const result = AQL_EXPLAIN ( query ) ; <nl> - assertNotEqual ( - 1 , result . plan . rules . indexOf ( ruleName ) , query ) ; <nl> - assertEqual ( 0 , AQL_EXECUTE ( query ) . json . length ) ; <nl> + expect ( result . plan . rules . indexOf ( ruleName ) ) . to . not . equal ( - 1 , query ) ; <nl> + expect ( AQL_EXECUTE ( query ) . json . length ) . to . equal ( 0 ) ; <nl> } ) ; <nl> <nl> it ( ' filtering on a subquery 2 ' , ( ) = > { <nl> describe ( ' Rule optimize - traversals ' , ( ) = > { <nl> RETURN 1 ` ; <nl> <nl> const result = AQL_EXPLAIN ( query ) ; <nl> - assertNotEqual ( - 1 , result . plan . rules . indexOf ( ruleName ) , query ) ; <nl> - assertEqual ( 0 , AQL_EXECUTE ( query ) . json . length ) ; <nl> + expect ( result . plan . rules . indexOf ( ruleName ) ) . to . not . equal ( - 1 , query ) ; <nl> + expect ( AQL_EXECUTE ( query ) . json . length ) . to . equal ( 0 ) ; <nl> } ) ; <nl> - <nl> } ) ; <nl> <nl> + describe ( ' filtering on own output ' , ( ) = > { <nl> + it ( ' should filter with v on path ' , ( ) = > { <nl> + let query = ` <nl> + FOR v , e , p IN 2 OUTBOUND @ start GRAPH @ graph <nl> + FILTER v . bar = = p . edges [ 0 ] . foo <nl> + RETURN { v , e , p } <nl> + ` ; <nl> + const bindVars = { <nl> + start : ' circles / A ' , <nl> + graph : graphName <nl> + } ; <nl> + <nl> + let plan = AQL_EXPLAIN ( query , bindVars , paramEnabled ) ; <nl> + expect ( plan . plan . rules . indexOf ( ruleName ) ) . to . equal ( - 1 , query ) ; <nl> + <nl> + let result = AQL_EXECUTE ( query , bindVars ) . json ; <nl> + expect ( result . length ) . to . equal ( 4 ) ; <nl> + <nl> + query = ` <nl> + FOR v , e , p IN 2 OUTBOUND @ start GRAPH @ graph <nl> + FILTER p . edges [ 0 ] . foo = = v . bar <nl> + RETURN { v , e , p } <nl> + ` ; <nl> + <nl> + plan = AQL_EXPLAIN ( query , bindVars , paramEnabled ) ; <nl> + expect ( plan . plan . rules . indexOf ( ruleName ) ) . to . equal ( - 1 , query ) ; <nl> + <nl> + result = AQL_EXECUTE ( query , bindVars ) . json ; <nl> + expect ( result . length ) . to . equal ( 4 ) ; <nl> + } ) ; <nl> + <nl> + it ( ' should filter with e on path ' , ( ) = > { <nl> + let query = ` <nl> + FOR v , e , p IN 2 OUTBOUND @ start GRAPH @ graph <nl> + FILTER e . bar = = p . edges [ 0 ] . foo <nl> + RETURN { v , e , p } <nl> + ` ; <nl> + const bindVars = { <nl> + start : ' circles / A ' , <nl> + graph : graphName <nl> + } ; <nl> + let plan = AQL_EXPLAIN ( query , bindVars , paramEnabled ) ; <nl> + expect ( plan . plan . rules . indexOf ( ruleName ) ) . to . equal ( - 1 , query ) ; <nl> + <nl> + let result = AQL_EXECUTE ( query , bindVars ) . json ; <nl> + expect ( result . length ) . to . equal ( 4 ) ; <nl> + <nl> + query = ` <nl> + FOR v , e , p IN 2 OUTBOUND @ start GRAPH @ graph <nl> + FILTER p . edges [ 0 ] . foo = = e . bar <nl> + RETURN { v , e , p } <nl> + ` ; <nl> + <nl> + plan = AQL_EXPLAIN ( query , bindVars , paramEnabled ) ; <nl> + expect ( plan . plan . rules . indexOf ( ruleName ) ) . to . equal ( - 1 , query ) ; <nl> + <nl> + result = AQL_EXECUTE ( query , bindVars ) . json ; <nl> + expect ( result . length ) . to . equal ( 4 ) ; <nl> + } ) ; <nl> + <nl> + it ( ' should filter with path . edges on path . edges ' , ( ) = > { <nl> + let query = ` <nl> + FOR v , e , p IN 2 OUTBOUND @ start GRAPH @ graph <nl> + FILTER p . edges [ 1 ] . foo = = p . edges [ 0 ] . foo <nl> + RETURN { v , e , p } <nl> + ` ; <nl> + const bindVars = { <nl> + start : ' circles / A ' , <nl> + graph : graphName <nl> + } ; <nl> + <nl> + let plan = AQL_EXPLAIN ( query , bindVars , paramEnabled ) ; <nl> + expect ( plan . plan . rules . indexOf ( ruleName ) ) . to . equal ( - 1 , query ) ; <nl> + <nl> + let result = AQL_EXECUTE ( query , bindVars ) . json ; <nl> + expect ( result . length ) . to . equal ( 4 ) ; <nl> + <nl> + query = ` <nl> + FOR v , e , p IN 2 OUTBOUND @ start GRAPH @ graph <nl> + FILTER p . edges [ 0 ] . foo = = p . edges [ 1 ] . foo <nl> + RETURN { v , e , p } <nl> + ` ; <nl> + <nl> + result = AQL_EXECUTE ( query , bindVars ) . json ; <nl> + expect ( result . length ) . to . equal ( 4 ) ; <nl> + } ) ; <nl> + <nl> + it ( ' should filter with path . vertices on path . vertices ' , ( ) = > { <nl> + let query = ` <nl> + FOR v , e , p IN 2 OUTBOUND @ start GRAPH @ graph <nl> + FILTER p . vertices [ 1 ] . foo = = p . vertices [ 0 ] . foo <nl> + RETURN { v , e , p } <nl> + ` ; <nl> + const bindVars = { <nl> + start : ' circles / A ' , <nl> + graph : graphName <nl> + } ; <nl> + let plan = AQL_EXPLAIN ( query , bindVars , paramEnabled ) ; <nl> + expect ( plan . plan . rules . indexOf ( ruleName ) ) . to . equal ( - 1 , query ) ; <nl> + <nl> + let result = AQL_EXECUTE ( query , bindVars ) . json ; <nl> + expect ( result . length ) . to . equal ( 4 ) ; <nl> + <nl> + query = ` <nl> + FOR v , e , p IN 2 OUTBOUND @ start GRAPH @ graph <nl> + FILTER p . vertices [ 0 ] . foo = = p . vertices [ 1 ] . foo <nl> + RETURN { v , e , p } <nl> + ` ; <nl> + <nl> + plan = AQL_EXPLAIN ( query , bindVars , paramEnabled ) ; <nl> + expect ( plan . plan . rules . indexOf ( ruleName ) ) . to . equal ( - 1 , query ) ; <nl> + <nl> + result = AQL_EXECUTE ( query , bindVars ) . json ; <nl> + expect ( result . length ) . to . equal ( 4 ) ; <nl> + } ) ; <nl> + <nl> + it ( ' should filter with path . vertices on path . edges ' , ( ) = > { <nl> + let query = ` <nl> + FOR v , e , p IN 2 OUTBOUND @ start GRAPH @ graph <nl> + FILTER p . vertices [ 1 ] . foo = = p . edges [ 0 ] . foo <nl> + RETURN { v , e , p } <nl> + ` ; <nl> + const bindVars = { <nl> + start : ' circles / A ' , <nl> + graph : graphName <nl> + } ; <nl> + <nl> + let plan = AQL_EXPLAIN ( query , bindVars , paramEnabled ) ; <nl> + expect ( plan . plan . rules . indexOf ( ruleName ) ) . to . equal ( - 1 , query ) ; <nl> + <nl> + let result = AQL_EXECUTE ( query , bindVars ) . json ; <nl> + expect ( result . length ) . to . equal ( 4 ) ; <nl> + <nl> + query = ` <nl> + FOR v , e , p IN 2 OUTBOUND @ start GRAPH @ graph <nl> + FILTER p . edges [ 0 ] . foo = = p . vertices [ 1 ] . foo <nl> + RETURN { v , e , p } <nl> + ` ; <nl> + <nl> + plan = AQL_EXPLAIN ( query , bindVars , paramEnabled ) ; <nl> + expect ( plan . plan . rules . indexOf ( ruleName ) ) . to . equal ( - 1 , query ) ; <nl> + <nl> + result = AQL_EXECUTE ( query , bindVars ) . json ; <nl> + expect ( result . length ) . to . equal ( 4 ) ; <nl> + } ) ; <nl> + } ) ; <nl> } ) ; <nl>
Added new traversal optimizer test .
arangodb/arangodb
6aeb23ef2a119a68afb1d5890708446d39408022
2017-01-27T18:52:43Z
mmm a / include / swift / Parse / LibSyntaxGenerator . h <nl> ppp b / include / swift / Parse / LibSyntaxGenerator . h <nl> class LibSyntaxGenerator { <nl> <nl> auto Recorded = Recorder . recordToken ( Kind , Range , LeadingTriviaPieces , <nl> TrailingTriviaPieces ) ; <nl> - auto Raw = static_cast < RawSyntax * > ( Recorded . takeOpaqueNode ( ) ) ; <nl> + RC < RawSyntax > Raw { static_cast < RawSyntax * > ( Recorded . takeOpaqueNode ( ) ) } ; <nl> + Raw - > Release ( ) ; / / - 1 since it ' s transfer of ownership . <nl> return make < TokenSyntax > ( Raw ) ; <nl> } <nl> <nl> class LibSyntaxGenerator { <nl> auto Children = Node . getDeferredChildren ( ) ; <nl> <nl> auto Recorded = Recorder . recordRawSyntax ( Kind , Children ) ; <nl> - RC < RawSyntax > Raw { static_cast < RawSyntax * > ( Recorded . takeOpaqueNode ( ) ) } ; <nl> + RC < RawSyntax > Raw { static_cast < RawSyntax * > ( Recorded . takeOpaqueNode ( ) ) } ; <nl> Raw - > Release ( ) ; / / - 1 since it ' s transfer of ownership . <nl> return make < SyntaxNode > ( Raw ) ; <nl> } <nl>
[ SyntaxParse ] Release created token in LibSyntaxGenerator : : createToken ( )
apple/swift
aa65455f4924504a3606cae145499fc27fa70eda
2019-09-28T06:52:39Z
mmm a / include / internal / catch_commandline . hpp <nl> ppp b / include / internal / catch_commandline . hpp <nl> namespace Catch { <nl> throw std : : runtime_error ( " colour mode must be one of : auto , yes or no " ) ; <nl> } <nl> inline void setWaitForKeypress ( ConfigData & config , std : : string const & keypress ) { <nl> - auto keypressLc = toLower ( keypress ) ; <nl> + std : : string keypressLc = toLower ( keypress ) ; <nl> if ( keypressLc = = " start " ) <nl> config . waitForKeypress = WaitForKeypress : : BeforeStart ; <nl> else if ( keypressLc = = " exit " ) <nl>
Removed inadvertent use of auto merged from dev - modernise
catchorg/Catch2
61c5675c11008491fa217d9129297b9580d23196
2017-08-15T18:34:10Z
mmm a / include / rapidjson / schema . h <nl> ppp b / include / rapidjson / schema . h <nl> class ISchemaValidator { <nl> } ; <nl> <nl> / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / <nl> - / / ISchemaValidatorFactory <nl> + / / ISchemaStateFactory <nl> <nl> template < typename SchemaType > <nl> - class ISchemaValidatorFactory { <nl> + class ISchemaStateFactory { <nl> public : <nl> - virtual ~ ISchemaValidatorFactory ( ) { } <nl> - virtual ISchemaValidator * CreateSchemaValidator ( const SchemaType & ) const = 0 ; <nl> + virtual ~ ISchemaStateFactory ( ) { } <nl> + virtual ISchemaValidator * CreateSchemaValidator ( const SchemaType & ) = 0 ; <nl> + virtual void DestroySchemaValidator ( ISchemaValidator * validator ) = 0 ; <nl> } ; <nl> <nl> / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / <nl> class Hasher { <nl> template < typename SchemaDocumentType > <nl> struct SchemaValidationContext { <nl> typedef Schema < SchemaDocumentType > SchemaType ; <nl> - typedef ISchemaValidatorFactory < SchemaType > SchemaValidatorFactoryType ; <nl> + typedef ISchemaStateFactory < SchemaType > SchemaValidatorFactoryType ; <nl> typedef GenericValue < UTF8 < > , CrtAllocator > HashCodeArray ; <nl> typedef typename SchemaType : : ValueType ValueType ; <nl> typedef typename ValueType : : Ch Ch ; <nl> struct SchemaValidationContext { <nl> kPatternValidatorWithAdditionalProperty <nl> } ; <nl> <nl> - struct SchemaValidatorArray { <nl> - SchemaValidatorArray ( ) : validators ( ) , count ( ) { } <nl> - ~ SchemaValidatorArray ( ) { <nl> - for ( SizeType i = 0 ; i < count ; i + + ) <nl> - delete validators [ i ] ; <nl> - delete [ ] validators ; <nl> - } <nl> - <nl> - ISchemaValidator * * validators ; <nl> - SizeType count ; <nl> - } ; <nl> - <nl> - SchemaValidationContext ( const SchemaValidatorFactoryType * f , CrtAllocator * a , const SchemaType * s ) : <nl> + SchemaValidationContext ( SchemaValidatorFactoryType * f , const SchemaType * s ) : <nl> factory ( f ) , <nl> - allocator ( a ) , <nl> schema ( s ) , <nl> valueSchema ( ) , <nl> invalidKeyword ( ) , <nl> hasher ( ) , <nl> + validators ( ) , <nl> + validatorCount ( ) , <nl> + patternPropertiesValidators ( ) , <nl> + patternPropertiesValidatorCount ( ) , <nl> patternPropertiesSchemas ( ) , <nl> - notValidator ( ) , <nl> patternPropertiesSchemaCount ( ) , <nl> valuePatternValidatorType ( kPatternValidatorOnly ) , <nl> objectDependencies ( ) , <nl> struct SchemaValidationContext { <nl> <nl> ~ SchemaValidationContext ( ) { <nl> delete hasher ; <nl> - delete notValidator ; <nl> + if ( validators ) { <nl> + for ( SizeType i = 0 ; i < validatorCount ; i + + ) <nl> + factory - > DestroySchemaValidator ( validators [ i ] ) ; <nl> + delete [ ] validators ; <nl> + } <nl> + if ( patternPropertiesValidators ) { <nl> + for ( SizeType i = 0 ; i < patternPropertiesValidatorCount ; i + + ) <nl> + factory - > DestroySchemaValidator ( patternPropertiesValidators [ i ] ) ; <nl> + delete [ ] patternPropertiesValidators ; <nl> + } <nl> delete [ ] patternPropertiesSchemas ; <nl> delete [ ] objectDependencies ; <nl> } <nl> <nl> - const SchemaValidatorFactoryType * factory ; <nl> - CrtAllocator * allocator ; / / For allocating memory for context <nl> + SchemaValidatorFactoryType * factory ; <nl> const SchemaType * schema ; <nl> const SchemaType * valueSchema ; <nl> const Ch * invalidKeyword ; <nl> HasherType * hasher ; <nl> - SchemaValidatorArray allOfValidators ; <nl> - SchemaValidatorArray anyOfValidators ; <nl> - SchemaValidatorArray oneOfValidators ; <nl> - SchemaValidatorArray dependencyValidators ; <nl> - SchemaValidatorArray patternPropertiesValidators ; <nl> + ISchemaValidator * * validators ; <nl> + SizeType validatorCount ; <nl> + ISchemaValidator * * patternPropertiesValidators ; <nl> + SizeType patternPropertiesValidatorCount ; <nl> const SchemaType * * patternPropertiesSchemas ; <nl> - ISchemaValidator * notValidator ; <nl> + / / ISchemaValidator * notValidator ; <nl> SizeType patternPropertiesSchemaCount ; <nl> PatternValidatorType valuePatternValidatorType ; <nl> PatternValidatorType objectPatternValidatorType ; <nl> class Schema { <nl> enumCount_ ( ) , <nl> not_ ( ) , <nl> type_ ( ( 1 < < kTotalSchemaType ) - 1 ) , / / typeless <nl> + validatorCount_ ( ) , <nl> properties_ ( ) , <nl> additionalPropertiesSchema_ ( ) , <nl> patternProperties_ ( ) , <nl> class Schema { <nl> AssignIfExist ( anyOf_ , document , p , value , GetAnyOfString ( ) ) ; <nl> AssignIfExist ( oneOf_ , document , p , value , GetOneOfString ( ) ) ; <nl> <nl> - if ( const ValueType * v = GetMember ( value , GetNotString ( ) ) ) <nl> + if ( const ValueType * v = GetMember ( value , GetNotString ( ) ) ) { <nl> document - > CreateSchema ( & not_ , p . Append ( GetNotString ( ) ) , * v ) ; <nl> + notValidatorIndex_ = validatorCount_ ; <nl> + validatorCount_ + + ; <nl> + } <nl> <nl> / / Object <nl> <nl> class Schema { <nl> else if ( itr - > value . IsObject ( ) ) { <nl> hasSchemaDependencies_ = true ; <nl> document - > CreateSchema ( & properties_ [ sourceIndex ] . dependenciesSchema , q . Append ( itr - > name ) , itr - > value ) ; <nl> + properties_ [ sourceIndex ] . dependenciesValidatorIndex = validatorCount_ ; <nl> + validatorCount_ + + ; <nl> } <nl> } <nl> } <nl> class Schema { <nl> } <nl> <nl> bool EndValue ( Context & context ) const { <nl> - if ( context . patternPropertiesValidators . count > 0 ) { <nl> + if ( context . patternPropertiesValidatorCount > 0 ) { <nl> bool otherValid = false ; <nl> - SizeType count = context . patternPropertiesValidators . count ; <nl> + SizeType count = context . patternPropertiesValidatorCount ; <nl> if ( context . objectPatternValidatorType ! = Context : : kPatternValidatorOnly ) <nl> - otherValid = context . patternPropertiesValidators . validators [ - - count ] - > IsValid ( ) ; <nl> + otherValid = context . patternPropertiesValidators [ - - count ] - > IsValid ( ) ; <nl> <nl> bool patternValid = true ; <nl> for ( SizeType i = 0 ; i < count ; i + + ) <nl> - if ( ! context . patternPropertiesValidators . validators [ i ] - > IsValid ( ) ) { <nl> + if ( ! context . patternPropertiesValidators [ i ] - > IsValid ( ) ) { <nl> patternValid = false ; <nl> break ; <nl> } <nl> class Schema { <nl> } <nl> <nl> if ( allOf_ . schemas ) <nl> - for ( SizeType i = 0 ; i < allOf_ . count ; i + + ) <nl> - if ( ! context . allOfValidators . validators [ i ] - > IsValid ( ) ) <nl> + for ( SizeType i = allOf_ . begin ; i < allOf_ . begin + allOf_ . count ; i + + ) <nl> + if ( ! context . validators [ i ] - > IsValid ( ) ) <nl> RAPIDJSON_INVALID_KEYWORD_RETURN ( GetAllOfString ( ) ) ; <nl> <nl> if ( anyOf_ . schemas ) { <nl> - for ( SizeType i = 0 ; i < anyOf_ . count ; i + + ) <nl> - if ( context . anyOfValidators . validators [ i ] - > IsValid ( ) ) <nl> + for ( SizeType i = anyOf_ . begin ; i < anyOf_ . begin + anyOf_ . count ; i + + ) <nl> + if ( context . validators [ i ] - > IsValid ( ) ) <nl> goto foundAny ; <nl> RAPIDJSON_INVALID_KEYWORD_RETURN ( GetAnyOfString ( ) ) ; <nl> foundAny : ; <nl> class Schema { <nl> <nl> if ( oneOf_ . schemas ) { <nl> bool oneValid = false ; <nl> - for ( SizeType i = 0 ; i < oneOf_ . count ; i + + ) <nl> - if ( context . oneOfValidators . validators [ i ] - > IsValid ( ) ) { <nl> + for ( SizeType i = oneOf_ . begin ; i < oneOf_ . begin + oneOf_ . count ; i + + ) <nl> + if ( context . validators [ i ] - > IsValid ( ) ) { <nl> if ( oneValid ) <nl> RAPIDJSON_INVALID_KEYWORD_RETURN ( GetOneOfString ( ) ) ; <nl> else <nl> class Schema { <nl> RAPIDJSON_INVALID_KEYWORD_RETURN ( GetOneOfString ( ) ) ; <nl> } <nl> <nl> - if ( not_ & & context . notValidator - > IsValid ( ) ) <nl> + if ( not_ & & context . validators [ notValidatorIndex_ ] - > IsValid ( ) ) <nl> RAPIDJSON_INVALID_KEYWORD_RETURN ( GetNotString ( ) ) ; <nl> <nl> return true ; <nl> class Schema { <nl> RAPIDJSON_INVALID_KEYWORD_RETURN ( GetDependenciesString ( ) ) ; <nl> } <nl> else if ( properties_ [ sourceIndex ] . dependenciesSchema ) <nl> - if ( ! context . dependencyValidators . validators [ sourceIndex ] - > IsValid ( ) ) <nl> + if ( ! context . validators [ properties_ [ sourceIndex ] . dependenciesValidatorIndex ] - > IsValid ( ) ) <nl> RAPIDJSON_INVALID_KEYWORD_RETURN ( GetDependenciesString ( ) ) ; <nl> } <nl> } <nl> class Schema { <nl> SchemaArray ( ) : schemas ( ) , count ( ) { } <nl> ~ SchemaArray ( ) { AllocatorType : : Free ( schemas ) ; } <nl> const SchemaType * * schemas ; <nl> + SizeType begin ; / / begin index of context . validators <nl> SizeType count ; <nl> } ; <nl> <nl> class Schema { <nl> memset ( out . schemas , 0 , sizeof ( Schema * ) * out . count ) ; <nl> for ( SizeType i = 0 ; i < out . count ; i + + ) <nl> document - > CreateSchema ( & out . schemas [ i ] , q . Append ( i ) , ( * v ) [ i ] ) ; <nl> + out . begin = validatorCount_ ; <nl> + validatorCount_ + = out . count ; <nl> } <nl> } <nl> } <nl> class Schema { <nl> if ( enum_ | | context . arrayUniqueness ) <nl> context . hasher = new HasherType ; <nl> <nl> - if ( allOf_ . schemas ) <nl> - CreateSchemaValidators ( context , context . allOfValidators , allOf_ ) ; <nl> + if ( validatorCount_ ) { <nl> + RAPIDJSON_ASSERT ( context . validators = = 0 ) ; <nl> + context . validators = new ISchemaValidator * [ validatorCount_ ] ; <nl> + context . validatorCount = validatorCount_ ; <nl> + if ( allOf_ . schemas ) <nl> + CreateSchemaValidators ( context , allOf_ ) ; <nl> <nl> - if ( anyOf_ . schemas ) <nl> - CreateSchemaValidators ( context , context . anyOfValidators , anyOf_ ) ; <nl> - <nl> - if ( oneOf_ . schemas ) <nl> - CreateSchemaValidators ( context , context . oneOfValidators , oneOf_ ) ; <nl> - <nl> - if ( not_ & & ! context . notValidator ) <nl> - context . notValidator = context . factory - > CreateSchemaValidator ( * not_ ) ; <nl> - <nl> - if ( hasSchemaDependencies_ & & ! context . dependencyValidators . validators ) { <nl> - context . dependencyValidators . validators = new ISchemaValidator * [ propertyCount_ ] ; <nl> - context . dependencyValidators . count = propertyCount_ ; <nl> - for ( SizeType i = 0 ; i < propertyCount_ ; i + + ) <nl> - context . dependencyValidators . validators [ i ] = properties_ [ i ] . dependenciesSchema ? context . factory - > CreateSchemaValidator ( * properties_ [ i ] . dependenciesSchema ) : 0 ; <nl> + if ( anyOf_ . schemas ) <nl> + CreateSchemaValidators ( context , anyOf_ ) ; <nl> + <nl> + if ( oneOf_ . schemas ) <nl> + CreateSchemaValidators ( context , oneOf_ ) ; <nl> + <nl> + if ( not_ ) <nl> + context . validators [ notValidatorIndex_ ] = context . factory - > CreateSchemaValidator ( * not_ ) ; <nl> + <nl> + if ( hasSchemaDependencies_ ) { <nl> + for ( SizeType i = 0 ; i < propertyCount_ ; i + + ) <nl> + if ( properties_ [ i ] . dependenciesSchema ) <nl> + context . validators [ properties_ [ i ] . dependenciesValidatorIndex ] = context . factory - > CreateSchemaValidator ( * properties_ [ i ] . dependenciesSchema ) ; <nl> + } <nl> } <nl> + <nl> return true ; <nl> } <nl> <nl> - void CreateSchemaValidators ( Context & context , typename Context : : SchemaValidatorArray & validators , const SchemaArray & schemas ) const { <nl> - if ( ! validators . validators ) { <nl> - validators . validators = new ISchemaValidator * [ schemas . count ] ; <nl> - validators . count = schemas . count ; <nl> - for ( SizeType i = 0 ; i < schemas . count ; i + + ) <nl> - validators . validators [ i ] = context . factory - > CreateSchemaValidator ( * schemas . schemas [ i ] ) ; <nl> - } <nl> + void CreateSchemaValidators ( Context & context , const SchemaArray & schemas ) const { <nl> + for ( SizeType i = 0 ; i < schemas . count ; i + + ) <nl> + context . validators [ schemas . begin + i ] = context . factory - > CreateSchemaValidator ( * schemas . schemas [ i ] ) ; <nl> } <nl> <nl> / / O ( n ) <nl> class Schema { <nl> } <nl> <nl> struct Property { <nl> - Property ( ) : schema ( ) , dependenciesSchema ( ) , dependencies ( ) , required ( false ) { } <nl> + Property ( ) : schema ( ) , dependenciesSchema ( ) , dependenciesValidatorIndex ( ) , dependencies ( ) , required ( false ) { } <nl> ~ Property ( ) { AllocatorType : : Free ( dependencies ) ; } <nl> SValue name ; <nl> const SchemaType * schema ; <nl> const SchemaType * dependenciesSchema ; <nl> + SizeType dependenciesValidatorIndex ; <nl> bool * dependencies ; <nl> bool required ; <nl> } ; <nl> class Schema { <nl> SchemaArray oneOf_ ; <nl> const SchemaType * not_ ; <nl> unsigned type_ ; / / bitmask of kSchemaType <nl> + SizeType validatorCount_ ; <nl> + SizeType notValidatorIndex_ ; <nl> <nl> Property * properties_ ; <nl> const SchemaType * additionalPropertiesSchema_ ; <nl> typedef IGenericRemoteSchemaDocumentProvider < SchemaDocument > IRemoteSchemaDocume <nl> <nl> template < typename SchemaDocumentType , typename OutputHandler = BaseReaderHandler < typename SchemaDocumentType : : SchemaType : : EncodingType > , typename StateAllocator = CrtAllocator > <nl> class GenericSchemaValidator : <nl> - public internal : : ISchemaValidatorFactory < typename SchemaDocumentType : : SchemaType > , <nl> + public internal : : ISchemaStateFactory < typename SchemaDocumentType : : SchemaType > , <nl> public internal : : ISchemaValidator <nl> { <nl> public : <nl> class GenericSchemaValidator : <nl> root_ ( schemaDocument . GetRoot ( ) ) , <nl> outputHandler_ ( nullOutputHandler_ ) , <nl> schemaStack_ ( allocator , schemaStackCapacity ) , <nl> - documentStack_ ( allocator , documentStackCapacity ) , <nl> - valid_ ( true ) <nl> - # if RAPIDJSON_SCHEMA_VERBOSE <nl> - , depth_ ( 0 ) <nl> - # endif <nl> - { <nl> - } <nl> - <nl> - GenericSchemaValidator ( <nl> - const SchemaDocumentType & schemaDocument , <nl> - OutputHandler & outputHandler , <nl> - StateAllocator * allocator = 0 , <nl> - size_t schemaStackCapacity = kDefaultSchemaStackCapacity , <nl> - size_t documentStackCapacity = kDefaultDocumentStackCapacity ) <nl> - : <nl> - schemaDocument_ ( & schemaDocument ) , <nl> - root_ ( schemaDocument . GetRoot ( ) ) , <nl> - outputHandler_ ( outputHandler ) , <nl> - schemaStack_ ( allocator , schemaStackCapacity ) , <nl> - documentStack_ ( allocator , documentStackCapacity ) , <nl> + documentStack_ ( & GetStateAllocator ( ) , documentStackCapacity ) , <nl> valid_ ( true ) <nl> # if RAPIDJSON_SCHEMA_VERBOSE <nl> , depth_ ( 0 ) <nl> class GenericSchemaValidator : <nl> return documentStack_ . Empty ( ) ? PointerType ( ) : PointerType ( documentStack_ . template Bottom < Ch > ( ) , documentStack_ . GetSize ( ) / sizeof ( Ch ) ) ; <nl> } <nl> <nl> + StateAllocator & GetStateAllocator ( ) { <nl> + return schemaStack_ . GetAllocator ( ) ; <nl> + } <nl> + <nl> # if RAPIDJSON_SCHEMA_VERBOSE <nl> # define RAPIDJSON_SCHEMA_HANDLE_BEGIN_VERBOSE_ ( ) \ <nl> RAPIDJSON_MULTILINEMACRO_BEGIN \ <nl> RAPIDJSON_MULTILINEMACRO_END <nl> for ( Context * context = schemaStack_ . template Bottom < Context > ( ) ; context ! = schemaStack_ . template End < Context > ( ) ; context + + ) { \ <nl> if ( context - > hasher ) \ <nl> context - > hasher - > method arg2 ; \ <nl> - if ( context - > allOfValidators . validators ) \ <nl> - for ( SizeType i_ = 0 ; i_ < context - > allOfValidators . count ; i_ + + ) \ <nl> - static_cast < GenericSchemaValidator * > ( context - > allOfValidators . validators [ i_ ] ) - > method arg2 ; \ <nl> - if ( context - > anyOfValidators . validators ) \ <nl> - for ( SizeType i_ = 0 ; i_ < context - > anyOfValidators . count ; i_ + + ) \ <nl> - static_cast < GenericSchemaValidator * > ( context - > anyOfValidators . validators [ i_ ] ) - > method arg2 ; \ <nl> - if ( context - > oneOfValidators . validators ) \ <nl> - for ( SizeType i_ = 0 ; i_ < context - > oneOfValidators . count ; i_ + + ) \ <nl> - static_cast < GenericSchemaValidator * > ( context - > oneOfValidators . validators [ i_ ] ) - > method arg2 ; \ <nl> - if ( context - > notValidator ) \ <nl> - static_cast < GenericSchemaValidator * > ( context - > notValidator ) - > method arg2 ; \ <nl> - if ( context - > dependencyValidators . validators ) \ <nl> - for ( SizeType i_ = 0 ; i_ < context - > dependencyValidators . count ; i_ + + ) \ <nl> - if ( context - > dependencyValidators . validators [ i_ ] ) \ <nl> - static_cast < GenericSchemaValidator * > ( context - > dependencyValidators . validators [ i_ ] ) - > method arg2 ; \ <nl> - if ( context - > patternPropertiesValidators . validators ) \ <nl> - for ( SizeType i_ = 0 ; i_ < context - > patternPropertiesValidators . count ; i_ + + ) \ <nl> - if ( context - > patternPropertiesValidators . validators [ i_ ] ) \ <nl> - static_cast < GenericSchemaValidator * > ( context - > patternPropertiesValidators . validators [ i_ ] ) - > method arg2 ; \ <nl> + if ( context - > validators ) \ <nl> + for ( SizeType i_ = 0 ; i_ < context - > validatorCount ; i_ + + ) \ <nl> + static_cast < GenericSchemaValidator * > ( context - > validators [ i_ ] ) - > method arg2 ; \ <nl> + if ( context - > patternPropertiesValidators ) \ <nl> + for ( SizeType i_ = 0 ; i_ < context - > patternPropertiesValidatorCount ; i_ + + ) \ <nl> + static_cast < GenericSchemaValidator * > ( context - > patternPropertiesValidators [ i_ ] ) - > method arg2 ; \ <nl> } <nl> <nl> # define RAPIDJSON_SCHEMA_HANDLE_END_ ( method , arg2 ) \ <nl> RAPIDJSON_MULTILINEMACRO_END <nl> # undef RAPIDJSON_SCHEMA_HANDLE_PARALLEL_ <nl> # undef RAPIDJSON_SCHEMA_HANDLE_VALUE_ <nl> <nl> - / / Implementation of ISchemaValidatorFactory < SchemaType > <nl> - virtual ISchemaValidator * CreateSchemaValidator ( const SchemaType & root ) const { <nl> + / / Implementation of ISchemaStateFactory < SchemaType > <nl> + virtual ISchemaValidator * CreateSchemaValidator ( const SchemaType & root ) { <nl> return new GenericSchemaValidator ( * schemaDocument_ , root <nl> # if RAPIDJSON_SCHEMA_VERBOSE <nl> , depth_ + 1 <nl> # endif <nl> ) ; <nl> + <nl> + / / GenericSchemaValidator * validator = GetStateAllocator ( ) . Malloc ( sizeof ( GenericSchemaValidator ) ) ; <nl> + / / new ( validator ) GenericSchemaValidator ( * schemaDocument_ , root <nl> + / / # if RAPIDJSON_SCHEMA_VERBOSE <nl> + / / , depth_ + 1 <nl> + / / # endif <nl> + / / ) ; <nl> + / / return validator ; <nl> + } <nl> + <nl> + virtual void DestroySchemaValidator ( ISchemaValidator * validator ) { <nl> + delete validator ; <nl> + / / validator - > ~ ISchemaValidator ( ) ; <nl> + / / StateAllocator : : Free ( validator ) ; <nl> } <nl> <nl> private : <nl> RAPIDJSON_MULTILINEMACRO_END <nl> <nl> if ( count > 0 ) { <nl> CurrentContext ( ) . objectPatternValidatorType = patternValidatorType ; <nl> - typename Context : : SchemaValidatorArray & va = CurrentContext ( ) . patternPropertiesValidators ; <nl> - va . validators = new ISchemaValidator * [ count ] ; <nl> + ISchemaValidator * * & va = CurrentContext ( ) . patternPropertiesValidators ; <nl> + SizeType & validatorCount = CurrentContext ( ) . patternPropertiesValidatorCount ; <nl> + va = new ISchemaValidator * [ count ] ; <nl> for ( SizeType i = 0 ; i < count ; i + + ) <nl> - va . validators [ va . count + + ] = CreateSchemaValidator ( * sa [ i ] ) ; <nl> + va [ validatorCount + + ] = CreateSchemaValidator ( * sa [ i ] ) ; <nl> } <nl> <nl> CurrentContext ( ) . arrayUniqueness = valueUniqueness ; <nl> RAPIDJSON_MULTILINEMACRO_END <nl> for ( typename Context : : HashCodeArray : : ConstValueIterator itr = context . arrayElementHashCodes . Begin ( ) ; itr ! = context . arrayElementHashCodes . End ( ) ; + + itr ) <nl> if ( itr - > GetUint64 ( ) = = h ) <nl> RAPIDJSON_INVALID_KEYWORD_RETURN ( SchemaType : : GetUniqueItemsString ( ) ) ; <nl> - context . arrayElementHashCodes . PushBack ( h , * context . allocator ) ; <nl> + context . arrayElementHashCodes . PushBack ( h , GetStateAllocator ( ) ) ; <nl> } <nl> } <nl> <nl> RAPIDJSON_MULTILINEMACRO_END <nl> * documentStack_ . template Push < Ch > ( ) = buffer [ i ] ; <nl> } <nl> <nl> - void PushSchema ( const SchemaType & schema ) { new ( schemaStack_ . template Push < Context > ( ) ) Context ( this , & contextAllocator_ , & schema ) ; } <nl> + void PushSchema ( const SchemaType & schema ) { new ( schemaStack_ . template Push < Context > ( ) ) Context ( this , & schema ) ; } <nl> void PopSchema ( ) { schemaStack_ . template Pop < Context > ( 1 ) - > ~ Context ( ) ; } <nl> const SchemaType & CurrentSchema ( ) const { return * schemaStack_ . template Top < Context > ( ) - > schema ; } <nl> Context & CurrentContext ( ) { return * schemaStack_ . template Top < Context > ( ) ; } <nl> RAPIDJSON_MULTILINEMACRO_END <nl> const SchemaType & root_ ; <nl> BaseReaderHandler < EncodingType > nullOutputHandler_ ; <nl> OutputHandler & outputHandler_ ; <nl> - CrtAllocator contextAllocator_ ; <nl> internal : : Stack < StateAllocator > schemaStack_ ; / / ! < stack to store the current path of schema ( BaseSchemaType * ) <nl> internal : : Stack < StateAllocator > documentStack_ ; / / ! < stack to store the current path of validating document ( Ch ) <nl> bool valid_ ; <nl>
Refactor : aggregate parallel validators
Tencent/rapidjson
7ef7ba13f01568ba85e916ff0211cf3dc846acb7
2015-05-17T05:07:12Z
mmm a / package . json <nl> ppp b / package . json <nl> <nl> { <nl> " name " : " css - layout " , <nl> - " version " : " 0 . 0 . 3 " , <nl> + " version " : " 0 . 0 . 4 " , <nl> " description " : " Reimplementation of CSS layout using pure JavaScript " , <nl> " main " : " dist / css - layout . js " , <nl> " scripts " : { <nl>
0 . 0 . 4
facebook/yoga
0a80d403517ac205516f868b649d467adba9b202
2015-08-21T08:10:17Z
mmm a / src / bitcoin - tx . cpp <nl> ppp b / src / bitcoin - tx . cpp <nl> static int CommandLineRawTx ( int argc , char * argv [ ] ) <nl> if ( strHexTx = = " - " ) / / " - " implies standard input <nl> strHexTx = readStdin ( ) ; <nl> <nl> - if ( ! DecodeHexTx ( txDecodeTmp , strHexTx ) ) <nl> + if ( ! DecodeHexTx ( txDecodeTmp , strHexTx , true ) ) <nl> throw runtime_error ( " invalid transaction encoding " ) ; <nl> <nl> startArg = 2 ; <nl> mmm a / src / test / data / bitcoin - util - test . json <nl> ppp b / src / test / data / bitcoin - util - test . json <nl> <nl> " output_cmp " : " txcreate2 . json " , <nl> " description " : " Creates a new transaction with a single empty output script ( output in json ) " <nl> } , <nl> + { " exec " : " . / bitcoin - tx " , <nl> + " args " : [ " 01000000000100000000000000000000000000 " ] , <nl> + " output_cmp " : " txcreate2 . hex " , <nl> + " description " : " Parses a transation with no inputs and a single output script " <nl> + } , <nl> + { " exec " : " . / bitcoin - tx " , <nl> + " args " : [ " - json " , " 01000000000100000000000000000000000000 " ] , <nl> + " output_cmp " : " txcreate2 . json " , <nl> + " description " : " Parses a transation with no inputs and a single output script ( output in json ) " <nl> + } , <nl> { " exec " : " . / bitcoin - tx " , <nl> " args " : <nl> [ " - create " , <nl>
Merge : allow bitcoin - tx to parse partial transactions
bitcoin/bitcoin
210891143ba000708989aa64903c8d3c383e04e1
2016-11-21T14:33:19Z
deleted file mode 100644 <nl> index b8c89a39dc . . 0000000000 <nl> mmm a / change / react - native - windows - 2019 - 10 - 15 - 17 - 00 - 10 - popup - shadow - fix . json <nl> ppp / dev / null <nl> <nl> - { <nl> - " type " : " prerelease " , <nl> - " comment " : " Extend flyout shadow fix to Popups " , <nl> - " packageName " : " react - native - windows " , <nl> - " email " : " kenander @ microsoft . com " , <nl> - " commit " : " 2e896420694fe6b89d3a0a46450b9ea6c887b058 " , <nl> - " date " : " 2019 - 10 - 16T00 : 00 : 10 . 032Z " , <nl> - " file " : " F : \ \ react - native - windows \ \ change \ \ react - native - windows - 2019 - 10 - 15 - 17 - 00 - 10 - popup - shadow - fix . json " <nl> - } <nl> \ No newline at end of file <nl> mmm a / packages / E2ETest / package . json <nl> ppp b / packages / E2ETest / package . json <nl> <nl> " dependencies " : { <nl> " react " : " 16 . 8 . 6 " , <nl> " react - native " : " https : / / github . com / microsoft / react - native / archive / v0 . 60 . 0 - microsoft . 7 . tar . gz " , <nl> - " react - native - windows " : " 0 . 60 . 0 - vnext . 31 " , <nl> + " react - native - windows " : " 0 . 60 . 0 - vnext . 32 " , <nl> " react - native - windows - extended " : " 0 . 60 . 6 " , <nl> " rnpm - plugin - windows " : " ^ 0 . 3 . 6 " <nl> } , <nl> mmm a / packages / microsoft - reactnative - sampleapps / package . json <nl> ppp b / packages / microsoft - reactnative - sampleapps / package . json <nl> <nl> " dependencies " : { <nl> " react " : " 16 . 8 . 6 " , <nl> " react - native " : " https : / / github . com / microsoft / react - native / archive / v0 . 60 . 0 - microsoft . 7 . tar . gz " , <nl> - " react - native - windows " : " 0 . 60 . 0 - vnext . 31 " , <nl> + " react - native - windows " : " 0 . 60 . 0 - vnext . 32 " , <nl> " react - native - windows - extended " : " 0 . 60 . 6 " , <nl> " rnpm - plugin - windows " : " ^ 0 . 3 . 6 " <nl> } , <nl> mmm a / packages / playground / package . json <nl> ppp b / packages / playground / package . json <nl> <nl> " dependencies " : { <nl> " react " : " 16 . 8 . 6 " , <nl> " react - native " : " https : / / github . com / microsoft / react - native / archive / v0 . 60 . 0 - microsoft . 7 . tar . gz " , <nl> - " react - native - windows " : " 0 . 60 . 0 - vnext . 31 " , <nl> + " react - native - windows " : " 0 . 60 . 0 - vnext . 32 " , <nl> " react - native - windows - extended " : " 0 . 60 . 6 " , <nl> " rnpm - plugin - windows " : " ^ 0 . 3 . 6 " <nl> } , <nl> mmm a / packages / react - native - windows - extended / package . json <nl> ppp b / packages / react - native - windows - extended / package . json <nl> <nl> " license " : " MIT " , <nl> " private " : false , <nl> " dependencies " : { <nl> - " react - native - windows " : " 0 . 60 . 0 - vnext . 31 " <nl> + " react - native - windows " : " 0 . 60 . 0 - vnext . 32 " <nl> } , <nl> " devDependencies " : { <nl> " @ react - native - community / eslint - config " : " ^ 0 . 0 . 5 " , <nl> mmm a / vnext / CHANGELOG . json <nl> ppp b / vnext / CHANGELOG . json <nl> <nl> { <nl> " name " : " react - native - windows " , <nl> " entries " : [ <nl> + { <nl> + " date " : " Wed , 16 Oct 2019 02 : 19 : 39 GMT " , <nl> + " tag " : " react - native - windows_v0 . 60 . 0 - vnext . 32 " , <nl> + " version " : " 0 . 60 . 0 - vnext . 32 " , <nl> + " comments " : { <nl> + " prerelease " : [ <nl> + { <nl> + " comment " : " Extend flyout shadow fix to Popups " , <nl> + " author " : " kenander @ microsoft . com " , <nl> + " commit " : " 2e896420694fe6b89d3a0a46450b9ea6c887b058 " <nl> + } <nl> + ] <nl> + } <nl> + } , <nl> { <nl> " date " : " Tue , 15 Oct 2019 23 : 45 : 52 GMT " , <nl> " tag " : " react - native - windows_v0 . 60 . 0 - vnext . 31 " , <nl> mmm a / vnext / CHANGELOG . md <nl> ppp b / vnext / CHANGELOG . md <nl> <nl> # Change Log - react - native - windows <nl> <nl> - This log was last generated on Tue , 15 Oct 2019 23 : 45 : 52 GMT and should not be manually modified . <nl> + This log was last generated on Wed , 16 Oct 2019 02 : 19 : 39 GMT and should not be manually modified . <nl> <nl> + # # 0 . 60 . 0 - vnext . 32 <nl> + Wed , 16 Oct 2019 02 : 19 : 39 GMT <nl> + <nl> + # # # Changes <nl> + <nl> + - Extend flyout shadow fix to Popups ( kenander @ microsoft . com ) <nl> # # 0 . 60 . 0 - vnext . 31 <nl> Tue , 15 Oct 2019 23 : 45 : 52 GMT <nl> <nl> mmm a / vnext / package . json <nl> ppp b / vnext / package . json <nl> <nl> { <nl> " name " : " react - native - windows " , <nl> - " version " : " 0 . 60 . 0 - vnext . 31 " , <nl> + " version " : " 0 . 60 . 0 - vnext . 32 " , <nl> " license " : " MIT " , <nl> " repository " : { <nl> " type " : " git " , <nl>
applying package updates * * * NO_CI * * *
microsoft/react-native-windows
2c5c252aa83f2d4ac1056da87af5d25b942620ab
2019-10-16T02:19:39Z
mmm a / Marlin / src / pins / pins_BIQU_SKR_V1 . 1 . h <nl> ppp b / Marlin / src / pins / pins_BIQU_SKR_V1 . 1 . h <nl> <nl> # endif <nl> <nl> # endif / / ULTRA_LCD <nl> + <nl> + / / <nl> + / / SD Support ( as with the AZTEEG_X5_MINI_WIFI ) <nl> + / / <nl> + / / # define USB_SD_DISABLED / / Disable host access to SD card as mass storage device through USB <nl> + # define USB_SD_ONBOARD / / Enable host access to SD card as mass storage device through USB <nl> + <nl> + / / # define LPC_SD_LCD / / Marlin uses the SD drive attached to the LCD <nl> + # define LPC_SD_ONBOARD / / Marlin uses the SD drive on the control board . There is no SD detect pin <nl> + / / for the onboard card . Init card from LCD menu or send M21 whenever printer <nl> + / / is powered on to enable SD access . <nl> + <nl> + # if ENABLED ( LPC_SD_LCD ) <nl> + <nl> + # define SCK_PIN P0_15 <nl> + # define MISO_PIN P0_17 <nl> + # define MOSI_PIN P0_18 <nl> + # define SS_PIN P1_23 / / Chip select for SD card used by Marlin <nl> + # define ONBOARD_SD_CS P0_06 / / Chip select for " System " SD card <nl> + <nl> + # elif ENABLED ( LPC_SD_ONBOARD ) <nl> + <nl> + # if ENABLED ( USB_SD_ONBOARD ) <nl> + / / When sharing the SD card with a PC we want the menu options to <nl> + / / mount / unmount the card and refresh it . So we disable card detect . <nl> + # define SHARED_SD_CARD <nl> + # undef SD_DETECT_PIN / / there is also no detect pin for the onboard card <nl> + # endif <nl> + # define SCK_PIN P0_07 <nl> + # define MISO_PIN P0_08 <nl> + # define MOSI_PIN P0_09 <nl> + # define SS_PIN P0_06 / / Chip select for SD card used by Marlin <nl> + # define ONBOARD_SD_CS P0_06 / / Chip select for " System " SD card <nl> + <nl> + # endif <nl>
Update LPC SD pins for BIQU SKR ( )
MarlinFirmware/Marlin
7f244f9b9cdce9580af6ee2a1926131805977364
2019-01-03T16:44:00Z
mmm a / src / base / CMakeLists . txt <nl> ppp b / src / base / CMakeLists . txt <nl> <nl> find_package ( ZLIB REQUIRED ) <nl> <nl> set ( QBT_BASE_HEADERS <nl> + bittorrent / addtorrentparams . h <nl> bittorrent / cachestatus . h <nl> bittorrent / infohash . h <nl> bittorrent / magneturi . h <nl> mmm a / src / base / base . pri <nl> ppp b / src / base / base . pri <nl> HEADERS + = \ <nl> $ $ PWD / net / reverseresolution . h \ <nl> $ $ PWD / net / smtp . h \ <nl> $ $ PWD / net / private / geoipdatabase . h \ <nl> + $ $ PWD / bittorrent / addtorrentparams . h \ <nl> $ $ PWD / bittorrent / infohash . h \ <nl> $ $ PWD / bittorrent / session . h \ <nl> $ $ PWD / bittorrent / sessionstatus . h \ <nl> new file mode 100644 <nl> index 0000000000 . . 2f82303f9f <nl> mmm / dev / null <nl> ppp b / src / base / bittorrent / addtorrentparams . h <nl> <nl> + / * <nl> + * Bittorrent Client using Qt and libtorrent . <nl> + * Copyright ( C ) 2015 Vladimir Golovnev < glassez @ yandex . ru > <nl> + * <nl> + * This program is free software ; you can redistribute it and / or <nl> + * modify it under the terms of the GNU General Public License <nl> + * as published by the Free Software Foundation ; either version 2 <nl> + * of the License , or ( at your option ) any later version . <nl> + * <nl> + * This program is distributed in the hope that it will be useful , <nl> + * but WITHOUT ANY WARRANTY ; without even the implied warranty of <nl> + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE . See the <nl> + * GNU General Public License for more details . <nl> + * <nl> + * You should have received a copy of the GNU General Public License <nl> + * along with this program ; if not , write to the Free Software <nl> + * Foundation , Inc . , 51 Franklin Street , Fifth Floor , Boston , MA 02110 - 1301 , USA . <nl> + * <nl> + * In addition , as a special exception , the copyright holders give permission to <nl> + * link this program with the OpenSSL project ' s " OpenSSL " library ( or with <nl> + * modified versions of it that use the same license as the " OpenSSL " library ) , <nl> + * and distribute the linked executables . You must obey the GNU General Public <nl> + * License in all respects for all of the code used other than " OpenSSL " . If you <nl> + * modify file ( s ) , you may extend this exception to your version of the file ( s ) , <nl> + * but you are not obligated to do so . If you do not wish to do so , delete this <nl> + * exception statement from your version . <nl> + * / <nl> + <nl> + # pragma once <nl> + <nl> + # include < QString > <nl> + # include < QVector > <nl> + <nl> + # include " . . / tristatebool . h " <nl> + <nl> + namespace BitTorrent <nl> + { <nl> + struct AddTorrentParams <nl> + { <nl> + QString name ; <nl> + QString category ; <nl> + QString savePath ; <nl> + bool disableTempPath = false ; / / e . g . for imported torrents <nl> + bool sequential = false ; <nl> + TriStateBool addForced ; <nl> + TriStateBool addPaused ; <nl> + QVector < int > filePriorities ; / / used if TorrentInfo is set <nl> + bool ignoreShareRatio = false ; <nl> + bool skipChecking = false ; <nl> + TriStateBool createSubfolder ; <nl> + } ; <nl> + } <nl> mmm a / src / base / bittorrent / session . h <nl> ppp b / src / base / bittorrent / session . h <nl> <nl> # include " base / settingvalue . h " <nl> # include " base / tristatebool . h " <nl> # include " base / types . h " <nl> + # include " addtorrentparams . h " <nl> # include " torrentinfo . h " <nl> <nl> namespace libtorrent <nl> namespace BitTorrent <nl> class TrackerEntry ; <nl> struct AddTorrentData ; <nl> <nl> - struct AddTorrentParams <nl> - { <nl> - QString name ; <nl> - QString category ; <nl> - QString savePath ; <nl> - bool disableTempPath = false ; / / e . g . for imported torrents <nl> - bool sequential = false ; <nl> - TriStateBool addForced ; <nl> - TriStateBool addPaused ; <nl> - QVector < int > filePriorities ; / / used if TorrentInfo is set <nl> - bool ignoreShareRatio = false ; <nl> - bool skipChecking = false ; <nl> - TriStateBool createSubfolder ; <nl> - } ; <nl> - <nl> struct TorrentStatusReport <nl> { <nl> uint nbDownloading = 0 ; <nl>
Move AddTorrentParams to its own header ( )
qbittorrent/qBittorrent
93df0ef1d10116deff7b637e14061ccb89a837af
2017-04-29T08:49:40Z
new file mode 100644 <nl> index 000000000000 . . 1a6ca22a8e61 <nl> mmm / dev / null <nl> ppp b / jstests / replsets / reconfig_without_increased_queues . js <nl> <nl> + / * <nl> + * Test which configures various configs ( hidden / priorities / no - chaining ) that replExec queues <nl> + * stay at reasonable / stable levels after repeated reconfigs / stepdowns <nl> + * / <nl> + ( function ( ) { <nl> + " use strict " ; <nl> + var numNodes = 5 ; <nl> + var maxQueueSizeExpected = 7 ; <nl> + var replTest = new ReplSetTest ( { name : ' testSet ' , nodes : numNodes } ) ; <nl> + var nodes = replTest . startSet ( ) ; <nl> + replTest . initiate ( ) ; <nl> + <nl> + var primary = replTest . getPrimary ( ) ; <nl> + <nl> + var testQueues = function ( ) { <nl> + / * Example stats under executor <nl> + " counters " : { <nl> + " eventCreated " : 2 , <nl> + " eventWait " : 2 , <nl> + " cancels " : 17 , <nl> + " waits " : 490 , <nl> + " scheduledNetCmd " : 90 , <nl> + " scheduledDBWork " : 2 , <nl> + " scheduledXclWork " : 0 , <nl> + " scheduledWorkAt " : 120 , <nl> + " scheduledWork " : 494 , <nl> + " schedulingFailures " : 0 <nl> + } , <nl> + " queues " : { <nl> + " networkInProgress " : 0 , <nl> + " dbWorkInProgress " : 0 , <nl> + " exclusiveInProgress " : 0 , <nl> + " sleepers " : 3 , <nl> + " ready " : 0 , <nl> + " free " : 4 <nl> + } , <nl> + <nl> + * / <nl> + assert . soon ( function ( ) { <nl> + primary = replTest . getPrimary ( ) ; <nl> + var stats = replTest . nodes . map ( m = > m . getDB ( " admin " ) . serverStatus ( ) ) ; <nl> + try { <nl> + stats . forEach ( s = > { <nl> + var executorStats = s . metrics . repl . executor ; <nl> + printjson ( s . host ) ; <nl> + printjson ( executorStats ) ; <nl> + var queues = executorStats . queues ; <nl> + assert . lt ( queues . sleepers , maxQueueSizeExpected , " sleepers " ) ; <nl> + assert . lt ( queues . ready , maxQueueSizeExpected , " ready " ) ; <nl> + assert . lt ( queues . networkInProgress , maxQueueSizeExpected , " networkInProgress " ) ; <nl> + } ) ; <nl> + } catch ( e ) { <nl> + return false ; <nl> + } <nl> + return true ; <nl> + } , " queues too high " , 13 * 1000 / * 13 secs * / ) ; / / what we are looking for has a 10s timeout . <nl> + } <nl> + <nl> + var reconfig = function ( newConfig ) { <nl> + newConfig . version + = 1 ; <nl> + try { <nl> + assert . commandWorked ( replTest . getPrimary ( ) . adminCommand ( { replSetReconfig : newConfig } ) ) ; <nl> + } <nl> + catch ( e ) { <nl> + if ( tojson ( e ) . indexOf ( " error doing query : failed " ) < 0 ) { <nl> + throw e ; <nl> + } <nl> + } <nl> + } <nl> + <nl> + replTest . awaitSecondaryNodes ( ) ; <nl> + <nl> + / / * * Setup different priorities <nl> + var c = replTest . conf ( ) ; <nl> + c . members [ 0 ] . priority = 99 ; <nl> + c . members [ 1 ] . priority = 2 ; <nl> + c . members [ 2 ] . priority = 0 ; <nl> + reconfig ( c ) ; <nl> + <nl> + for ( var i = 0 ; i < 50 ; i + + ) { <nl> + reconfig ( c ) ; <nl> + testQueues ( ) ; <nl> + } <nl> + <nl> + / / * * Setup different priorities <nl> + var c = replTest . conf ( ) ; <nl> + c . members [ 2 ] . hidden = true ; <nl> + c . members [ 3 ] . priority = 1000 ; <nl> + c . members [ 4 ] . priority = 1000 ; <nl> + reconfig ( c ) ; <nl> + <nl> + for ( var i = 0 ; i < 50 ; i + + ) { <nl> + reconfig ( c ) ; <nl> + testQueues ( ) ; <nl> + } <nl> + <nl> + replTest . stopSet ( ) ; <nl> + } ( ) ) ; <nl> mmm a / src / mongo / db / repl / replication_coordinator_impl_heartbeat . cpp <nl> ppp b / src / mongo / db / repl / replication_coordinator_impl_heartbeat . cpp <nl> void ReplicationCoordinatorImpl : : _startHeartbeats_inlock ( <nl> void ReplicationCoordinatorImpl : : _handleLivenessTimeout ( <nl> const ReplicationExecutor : : CallbackArgs & cbData ) { <nl> stdx : : lock_guard < stdx : : mutex > lk ( _mutex ) ; <nl> - _handleLivenessTimeoutCbh = CallbackHandle ( ) ; <nl> + / / Only reset the callback handle if it matches , otherwise more will be coming through <nl> + if ( cbData . myHandle = = _handleLivenessTimeoutCbh ) { <nl> + _handleLivenessTimeoutCbh = CallbackHandle ( ) ; <nl> + } else { <nl> + warning ( ) < < " The liveness timeout does not match callback handle , so not resetting it . " ; <nl> + } <nl> if ( ! cbData . status . isOK ( ) ) { <nl> return ; <nl> } <nl> mmm a / src / mongo / db / repl / replication_executor . cpp <nl> ppp b / src / mongo / db / repl / replication_executor . cpp <nl> ReplicationExecutor : : Callback : : Callback ( ReplicationExecutor * executor , <nl> <nl> ReplicationExecutor : : Callback : : ~ Callback ( ) { } <nl> <nl> + bool ReplicationExecutor : : Callback : : isCanceled ( ) const { <nl> + stdx : : unique_lock < stdx : : mutex > lk ( _executor - > _mutex ) ; <nl> + return _isCanceled ; <nl> + } <nl> + <nl> void ReplicationExecutor : : Callback : : cancel ( ) { <nl> stdx : : unique_lock < stdx : : mutex > lk ( _executor - > _mutex ) ; <nl> _isCanceled = true ; <nl> mmm a / src / mongo / db / repl / replication_executor . h <nl> ppp b / src / mongo / db / repl / replication_executor . h <nl> class ReplicationExecutor : : Callback : public executor : : TaskExecutor : : CallbackSta <nl> <nl> void cancel ( ) override ; <nl> void waitForCompletion ( ) override ; <nl> - bool isCanceled ( ) const override { <nl> - return _isCanceled ; <nl> - } <nl> + bool isCanceled ( ) const override ; <nl> <nl> private : <nl> ReplicationExecutor * _executor ; <nl>
SERVER - 21795 : Do not reschedule more than one liveness timeout callback at a time
mongodb/mongo
5ab583935e048522d2129ab11f6c485a59dee7df
2015-12-14T17:35:09Z
mmm a / src / arguments . h <nl> ppp b / src / arguments . h <nl> double ClobberDoubleRegisters ( double x1 , double x2 , double x3 , double x4 ) ; <nl> <nl> / / TODO ( cbruni ) : add global flag to check whether any tracing events have been <nl> / / enabled . <nl> + / / TODO ( cbruni ) : Convert the IsContext CHECK back to a DCHECK . <nl> # define RUNTIME_FUNCTION_RETURNS_TYPE ( Type , Name ) \ <nl> static INLINE ( Type __RT_impl_ # # Name ( Arguments args , Isolate * isolate ) ) ; \ <nl> \ <nl> double ClobberDoubleRegisters ( double x1 , double x2 , double x3 , double x4 ) ; <nl> } \ <nl> \ <nl> Type Name ( int args_length , Object * * args_object , Isolate * isolate ) { \ <nl> - DCHECK ( isolate - > context ( ) = = nullptr | | isolate - > context ( ) - > IsContext ( ) ) ; \ <nl> + CHECK ( isolate - > context ( ) = = nullptr | | isolate - > context ( ) - > IsContext ( ) ) ; \ <nl> CLOBBER_DOUBLE_REGISTERS ( ) ; \ <nl> if ( FLAG_runtime_call_stats ) { \ <nl> return Stats_ # # Name ( args_length , args_object , isolate ) ; \ <nl> mmm a / src / builtins / builtins - utils . h <nl> ppp b / src / builtins / builtins - utils . h <nl> class BuiltinArguments : public Arguments { <nl> / / through the BuiltinArguments object args . <nl> / / TODO ( cbruni ) : add global flag to check whether any tracing events have been <nl> / / enabled . <nl> - # define BUILTIN ( name ) \ <nl> - MUST_USE_RESULT static Object * Builtin_Impl_ # # name ( BuiltinArguments args , \ <nl> - Isolate * isolate ) ; \ <nl> - \ <nl> - V8_NOINLINE static Object * Builtin_Impl_Stats_ # # name ( \ <nl> - int args_length , Object * * args_object , Isolate * isolate ) { \ <nl> - BuiltinArguments args ( args_length , args_object ) ; \ <nl> - RuntimeCallTimerScope timer ( isolate , & RuntimeCallStats : : Builtin_ # # name ) ; \ <nl> - TRACE_EVENT0 ( TRACE_DISABLED_BY_DEFAULT ( " v8 . runtime " ) , \ <nl> - " V8 . Builtin_ " # name ) ; \ <nl> - return Builtin_Impl_ # # name ( args , isolate ) ; \ <nl> - } \ <nl> - \ <nl> - MUST_USE_RESULT Object * Builtin_ # # name ( \ <nl> - int args_length , Object * * args_object , Isolate * isolate ) { \ <nl> - DCHECK ( isolate - > context ( ) = = nullptr | | isolate - > context ( ) - > IsContext ( ) ) ; \ <nl> - if ( FLAG_runtime_call_stats ) { \ <nl> - return Builtin_Impl_Stats_ # # name ( args_length , args_object , isolate ) ; \ <nl> - } \ <nl> - BuiltinArguments args ( args_length , args_object ) ; \ <nl> - return Builtin_Impl_ # # name ( args , isolate ) ; \ <nl> - } \ <nl> - \ <nl> - MUST_USE_RESULT static Object * Builtin_Impl_ # # name ( BuiltinArguments args , \ <nl> + / / TODO ( cbruni ) : Convert the IsContext CHECK back to a DCHECK . <nl> + # define BUILTIN ( name ) \ <nl> + MUST_USE_RESULT static Object * Builtin_Impl_ # # name ( BuiltinArguments args , \ <nl> + Isolate * isolate ) ; \ <nl> + \ <nl> + V8_NOINLINE static Object * Builtin_Impl_Stats_ # # name ( \ <nl> + int args_length , Object * * args_object , Isolate * isolate ) { \ <nl> + BuiltinArguments args ( args_length , args_object ) ; \ <nl> + RuntimeCallTimerScope timer ( isolate , & RuntimeCallStats : : Builtin_ # # name ) ; \ <nl> + TRACE_EVENT0 ( TRACE_DISABLED_BY_DEFAULT ( " v8 . runtime " ) , \ <nl> + " V8 . Builtin_ " # name ) ; \ <nl> + return Builtin_Impl_ # # name ( args , isolate ) ; \ <nl> + } \ <nl> + \ <nl> + MUST_USE_RESULT Object * Builtin_ # # name ( \ <nl> + int args_length , Object * * args_object , Isolate * isolate ) { \ <nl> + CHECK ( isolate - > context ( ) = = nullptr | | isolate - > context ( ) - > IsContext ( ) ) ; \ <nl> + if ( FLAG_runtime_call_stats ) { \ <nl> + return Builtin_Impl_Stats_ # # name ( args_length , args_object , isolate ) ; \ <nl> + } \ <nl> + BuiltinArguments args ( args_length , args_object ) ; \ <nl> + return Builtin_Impl_ # # name ( args , isolate ) ; \ <nl> + } \ <nl> + \ <nl> + MUST_USE_RESULT static Object * Builtin_Impl_ # # name ( BuiltinArguments args , \ <nl> Isolate * isolate ) <nl> <nl> / / mmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmm - <nl>
[ runtime ] temporarily transform IsContext check from DCHECK to CHECK
v8/v8
ec94ad400dc257af396efa3b1899bc3168347d82
2016-07-19T15:26:14Z
diff - - git a / Documentation / Documents / Configuration Files . md b / Documentation / Documents / Configuration Files . md <nl> mmm a / Documentation / Documents / Configuration Files . md <nl> ppp b / Documentation / Documents / Configuration Files . md <nl> stderr = c : \ cntk \ log \ cntk # “ _mnistTrain_mnistTest . log ” would be appended <nl> traceLevel = 0 # larger values mean more output <nl> ` ` ` <nl> <nl> - The * * traceLevel * * parameter is uniformly used by the code in CNTK to specify how much extra output ( verbosity ) is desired . The default value is 0 ( zero ) and specifies minimal output , the higher the number the more output can be expected . Currently 0 - limited output , 1 - medium ouput , 2 - verbose output are the only values supported . <nl> + The * * traceLevel * * parameter is uniformly used by the code in CNTK to specify how much extra output ( verbosity ) is desired . The default value is 0 ( zero ) and specifies minimal output , the higher the number the more output can be expected . Currently 0 - limited output , 1 - medium output , 2 - verbose output are the only values supported . <nl> <nl> # # # Top Level Parameters <nl> <nl> mmm a / Examples / Evaluation / CNTKLibraryCSEvalCPUOnlyExamples / CNTKLibraryCSEvalExamples . cs <nl> ppp b / Examples / Evaluation / CNTKLibraryCSEvalCPUOnlyExamples / CNTKLibraryCSEvalExamples . cs <nl> public static void EvaluationSingleImage ( DeviceDescriptor device ) <nl> var inputVal = Value . CreateBatch ( inputVar . Shape , resizedCHW , device ) ; <nl> inputDataMap . Add ( inputVar , inputVal ) ; <nl> <nl> - / / Create ouput data map . Using null as Value to indicate using system allocated memory . <nl> + / / Create output data map . Using null as Value to indicate using system allocated memory . <nl> / / Alternatively , create a Value object and add it to the data map . <nl> outputDataMap . Add ( outputVar , null ) ; <nl> <nl> public static void EvaluationBatchOfImages ( DeviceDescriptor device ) <nl> / / Create input data map . <nl> inputDataMap . Add ( inputVar , inputVal ) ; <nl> <nl> - / / Create ouput data map . Using null as Value to indicate using system allocated memory . <nl> + / / Create output data map . Using null as Value to indicate using system allocated memory . <nl> / / Alternatively , create a Value object and add it to the data map . <nl> outputDataMap . Add ( outputVar , null ) ; <nl> <nl> public static void EvaluateMultipleImagesInParallel ( DeviceDescriptor device ) <nl> var inputVal = Value . CreateBatch ( inputVar . Shape , resizedCHW , device ) ; <nl> inputDataMap . Add ( inputVar , inputVal ) ; <nl> <nl> - / / Create ouput data map . Using null as Value to indicate using system allocated memory . <nl> + / / Create output data map . Using null as Value to indicate using system allocated memory . <nl> / / Alternatively , create a Value object and add it to the data map . <nl> outputDataMap . Add ( outputVar , null ) ; <nl> <nl> public static void LoadModelFromMemory ( DeviceDescriptor device ) <nl> var inputVal = Value . CreateBatch ( inputVar . Shape , resizedCHW , device ) ; <nl> inputDataMap . Add ( inputVar , inputVal ) ; <nl> <nl> - / / Create ouput data map . Using null as Value to indicate using system allocated memory . <nl> + / / Create output data map . Using null as Value to indicate using system allocated memory . <nl> / / Alternatively , create a Value object and add it to the data map . <nl> outputDataMap . Add ( outputVar , null ) ; <nl> <nl> public static void EvaluationSingleSequenceUsingOneHot ( DeviceDescriptor device ) <nl> / / Prepare output <nl> Variable outputVar = modelFunc . Output ; <nl> <nl> - / / Create ouput data map . Using null as Value to indicate using system allocated memory . <nl> + / / Create output data map . Using null as Value to indicate using system allocated memory . <nl> var outputDataMap = new Dictionary < Variable , Value > ( ) ; <nl> outputDataMap . Add ( outputVar , null ) ; <nl> <nl> public static void EvaluationBatchOfSequencesUsingOneHot ( DeviceDescriptor device <nl> <nl> / / Prepare output <nl> Variable outputVar = modelFunc . Output ; <nl> - / / Create ouput data map . Using null as Value to indicate using system allocated memory . <nl> + / / Create output data map . Using null as Value to indicate using system allocated memory . <nl> var outputDataMap = new Dictionary < Variable , Value > ( ) ; <nl> outputDataMap . Add ( outputVar , null ) ; <nl> <nl> public static void EvaluationSingleSequenceUsingSparse ( DeviceDescriptor device ) <nl> / / Prepare output <nl> Variable outputVar = modelFunc . Output ; <nl> <nl> - / / Create ouput data map . Using null as Value to indicate using system allocated memory . <nl> + / / Create output data map . Using null as Value to indicate using system allocated memory . <nl> var outputDataMap = new Dictionary < Variable , Value > ( ) ; <nl> outputDataMap . Add ( outputVar , null ) ; <nl> <nl> mmm a / Source / CNTK / BrainScript / BrainScriptParser . cpp <nl> ppp b / Source / CNTK / BrainScript / BrainScriptParser . cpp <nl> class CodeSource <nl> return currentLine [ cursor . charPos ] ; <nl> } <nl> <nl> - / / we chan also return the address of the current character , e . g . for passing it to a C stdlib funcion such as wcstod ( ) <nl> + / / we chan also return the address of the current character , e . g . for passing it to a C stdlib function such as wcstod ( ) <nl> const wchar_t * GotCharPtr ( ) const <nl> { <nl> return currentLine + cursor . charPos ; <nl> mmm a / Source / Common / Eval . cpp <nl> ppp b / Source / Common / Eval . cpp <nl> void Eval < ElemType > : : GetNodeDimensions ( std : : map < std : : wstring , size_t > & dimension <nl> } <nl> <nl> / / StartEvaluateMinibatchLoop - Prepare network for Evaluate ( ) calls . <nl> - / / ouputNodeName - name of node that will be evaluated <nl> + / / outputNodeName - name of node that will be evaluated <nl> template < class ElemType > <nl> void Eval < ElemType > : : StartEvaluateMinibatchLoop ( const std : : wstring & outputNodeName ) <nl> { <nl> mmm a / Source / Common / Include / Eval . h <nl> ppp b / Source / Common / Include / Eval . h <nl> class Eval : public IEvaluateModel < ElemType > <nl> virtual void GetNodeDimensions ( std : : map < std : : wstring , size_t > & dimensions , NodeGroup nodeGroup ) ; <nl> <nl> / / StartEvaluateMinibatchLoop - Prepare network for Evaluate ( ) calls . <nl> - / / ouputNodeName - name of node that will be evaluated <nl> + / / outputNodeName - name of node that will be evaluated <nl> virtual void StartEvaluateMinibatchLoop ( const std : : wstring & outputNodeName ) ; <nl> <nl> / / Evaluate - Evaluate using the model with the given inputs and outputs <nl> mmm a / Source / ComputationNetworkLib / LinearAlgebraNodes . h <nl> ppp b / Source / ComputationNetworkLib / LinearAlgebraNodes . h <nl> template class MinusNode < double > ; <nl> / / mmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmm - - <nl> / / ElementTimesNode ( factor1 , factor2 ) <nl> / / This allows broadcasting , and can thus also scale with a row , a column , or a scalar , <nl> - / / as well as mutliplying with a diagonal matrix ( if represented as a column vector ) . <nl> + / / as well as multiplying with a diagonal matrix ( if represented as a column vector ) . <nl> / / mmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmm - - <nl> <nl> template < class ElemType > <nl> mmm a / Source / ComputationNetworkLib / ReshapingNodes . h <nl> ppp b / Source / ComputationNetworkLib / ReshapingNodes . h <nl> class CropNode : public ComputationNode < ElemType > , public TransformerNode <nl> / / Helper structure to store input / output views which define parts of input and output we work with . <nl> struct CroppedIOViews <nl> { <nl> - CroppedIOViews ( CropNode * cropNode , MatrixGetter matrixGetter , TensorShape inputShapeCropped , TensorShape ouputShape ) : <nl> + CroppedIOViews ( CropNode * cropNode , MatrixGetter matrixGetter , TensorShape inputShapeCropped , TensorShape outputShape ) : <nl> / / Input view is derived from first input . <nl> inputViewCropped ( ( cropNode - > Input ( 0 ) . get ( ) - > * matrixGetter ) ( ) , inputShapeCropped ) , <nl> / / Output view corresponds to single output . <nl> - outputView ( ( cropNode - > * matrixGetter ) ( ) , ouputShape ) <nl> + outputView ( ( cropNode - > * matrixGetter ) ( ) , outputShape ) <nl> { } <nl> <nl> TensorView < ElemType > inputViewCropped ; <nl> mmm a / Source / EvalDll / CNTKEval . cpp <nl> ppp b / Source / EvalDll / CNTKEval . cpp <nl> void CNTKEval < ElemType > : : GetNodeDimensions ( std : : map < std : : wstring , size_t > & dimen <nl> } <nl> <nl> / / StartEvaluateMinibatchLoop - Prepare network for Evaluate ( ) calls . <nl> - / / ouputNodeName - name of node that will be evaluated <nl> + / / outputNodeName - name of node that will be evaluated <nl> template < typename ElemType > <nl> void CNTKEval < ElemType > : : StartEvaluateMinibatchLoop ( const std : : wstring & outputNodeName ) <nl> { <nl> mmm a / Source / Extensibility / EvalWrapper / EvalWrapperAssemblyInfo . cpp <nl> ppp b / Source / Extensibility / EvalWrapper / EvalWrapperAssemblyInfo . cpp <nl> <nl> / / EvalWrapperAssemblyInfo . cpp - - Provides Strong Name for EvalWrapper assembly . <nl> / / <nl> / / Note that the key pair ( including secret key ) is stored in the same folder as this source file . <nl> - / / The Strong Name serves for identity puposes and for the applications that require it . <nl> + / / The Strong Name serves for identity purposes and for the applications that require it . <nl> / / The Strong Name does NOT enable trust scenario . Use the compiled and Authenticode signed dll version of this assembly <nl> / / provided with the CNTK NuGet package if you need trust . See CNTK Releases web page for NuGet package name and location : <nl> / / https : / / github . com / Microsoft / CNTK / releases <nl> <nl> using namespace System ; <nl> using namespace System : : Reflection ; <nl> <nl> - [ assembly : AssemblyKeyFile ( " EvalWrapperKeyPair . snk " ) ] ; <nl> \ No newline at end of file <nl> + [ assembly : AssemblyKeyFile ( " EvalWrapperKeyPair . snk " ) ] ; <nl> mmm a / Source / Math / CPUMatrixImpl . h <nl> ppp b / Source / Math / CPUMatrixImpl . h <nl> static void TensorOpWithFn ( ElemType beta , array < ElemType * , N > pointers , ElemType <nl> CaseTensorOpWithFnAndReduction ( Max ) ; <nl> CaseTensorOpWithFnAndReduction ( ElementwiseProduct ) ; <nl> default : <nl> - LogicError ( " Specified ElementWiseOperator op % d not suported as reduction operation . " , ( int ) reductionOp ) ; <nl> + LogicError ( " Specified ElementWiseOperator op % d not supported as reduction operation . " , ( int ) reductionOp ) ; <nl> } <nl> } <nl> <nl> mmm a / Source / Readers / ImageReader / ImageDeserializerBase . h <nl> ppp b / Source / Readers / ImageReader / ImageDeserializerBase . h <nl> namespace Microsoft { namespace MSR { namespace CNTK { <nl> class ImageDeserializerBase : public DataDeserializerBase <nl> { <nl> public : <nl> - / / Number of mutlicrop versions to produce . <nl> + / / Number of multicrop versions to produce . <nl> / / Currently the default value of 10 is used as in AlexNet paper , <nl> / / Possibly we should make this configurable . <nl> const static uint8_t NumMultiViewCopies = 10 ; <nl> mmm a / Tests / EndToEndTests / CNTKv2Library / EndToEndTests / FrameMode . cpp <nl> ppp b / Tests / EndToEndTests / CNTKv2Library / EndToEndTests / FrameMode . cpp <nl> namespace <nl> struct FeedForwardClassifier <nl> { <nl> size_t inputDim ; <nl> - size_t ouputDim ; <nl> + size_t outputDim ; <nl> Variable features ; <nl> Variable labels ; <nl> FunctionPtr output ; <nl> namespace <nl> { <nl> return TextFormatMinibatchSource ( g_inputFile , <nl> { { g_featureStreamName , classifier . inputDim } , <nl> - { g_labelsStreamName , classifier . ouputDim } } , <nl> + { g_labelsStreamName , classifier . outputDim } } , <nl> totalNumberOfSamples , true ) ; <nl> } <nl> <nl> mmm a / Tutorials / CNTK_200_GuidedTour . ipynb <nl> ppp b / Tutorials / CNTK_200_GuidedTour . ipynb <nl> <nl> " In our examples above , we use the ` train ( ) ` function to train , and ` test ( ) ` for evaluating . \ n " , <nl> " In this section , we want to walk you through the advanced options of ` train ( ) ` : \ n " , <nl> " \ n " , <nl> - " 1 . * * Distributed Training * * on mutliple GPUs using MPI . \ n " , <nl> + " 1 . * * Distributed Training * * on multiple GPUs using MPI . \ n " , <nl> " 2 . Callbacks for * * Progress Tracking * * , * * TensorBoard visualization * * , * * Checkpointing * * , * * Cross - validation * * - based training control , and * * Testing * * for the final model . \ n " , <nl> " \ n " , <nl> " # # # 1 . Distributed Training \ n " , <nl> mmm a / Tutorials / FunctionalAPI / CNTK_200_GuidedTour . ipynb <nl> ppp b / Tutorials / FunctionalAPI / CNTK_200_GuidedTour . ipynb <nl> <nl> " In our examples above , we use the ` train ( ) ` function to train , and ` test ( ) ` for evaluating . \ n " , <nl> " In this section , we want to walk you through the advanced options of ` train ( ) ` : \ n " , <nl> " \ n " , <nl> - " 1 . * * Distributed Training * * on mutliple GPUs using MPI . \ n " , <nl> + " 1 . * * Distributed Training * * on multiple GPUs using MPI . \ n " , <nl> " 2 . Callbacks for * * Progress Tracking * * , * * TensorBoard visualization * * , * * Checkpointing * * , * * Cross - validation * * - based training contro , and * * Testing * * for the final model . \ n " , <nl> " \ n " , <nl> " # # # 1 . Distributed Training \ n " , <nl> mmm a / bindings / csharp / CNTKLibraryManagedDll / CNTKLibraryManagedDll - CPUOnly - AssemblyInfo . cs <nl> ppp b / bindings / csharp / CNTKLibraryManagedDll / CNTKLibraryManagedDll - CPUOnly - AssemblyInfo . cs <nl> <nl> / / CNTKLibraryManagedDll - CPUONly - AssemblyInfo . cpp - - Provides Strong Name for CNTKLibraryManagedDll ( CPUOnly flavor ) assembly . <nl> / / <nl> / / Note that the key pair ( including secret key ) is stored in the same folder as this source file . <nl> - / / The Strong Name serves for identity puposes and for the applications that require it . <nl> + / / The Strong Name serves for identity purposes and for the applications that require it . <nl> / / The Strong Name does NOT enable trust scenario . Use the compiled and Authenticode signed dll version of this assembly <nl> / / provided with the CNTK NuGet package if you need trust . See CNTK Releases web page for NuGet package name and location : <nl> / / https : / / github . com / Microsoft / CNTK / releases <nl> mmm a / bindings / csharp / CNTKLibraryManagedDll / CNTKLibraryManagedDll - GPU - AssemblyInfo . cs <nl> ppp b / bindings / csharp / CNTKLibraryManagedDll / CNTKLibraryManagedDll - GPU - AssemblyInfo . cs <nl> <nl> / / CNTKLibraryManagedDll - GPU - AssemblyInfo . cpp - - Provides Strong Name for CNTKLibraryManagedDll ( GPU flavor ) assembly . <nl> / / <nl> / / Note that the key pair ( including secret key ) is stored in the same folder as this source file . <nl> - / / The Strong Name serves for identity puposes and for the applications that require it . <nl> + / / The Strong Name serves for identity purposes and for the applications that require it . <nl> / / The Strong Name does NOT enable trust scenario . Use the compiled and Authenticode signed dll version of this assembly <nl> / / provided with the CNTK NuGet package if you need trust . See CNTK Releases web page for NuGet package name and location : <nl> / / https : / / github . com / Microsoft / CNTK / releases <nl> mmm a / bindings / python / cntk / core . py <nl> ppp b / bindings / python / cntk / core . py <nl> def from_dense ( np_array , device = None , read_only = False , borrow = False ) : <nl> np_array ( numpy . ndarray ) : NumPy array <nl> device ( : class : ` ~ cntk . device . DeviceDescriptor ` ) : device this value <nl> should be put on <nl> - borrow ( bool , default False ) : whether nd_arrary memory can be <nl> + borrow ( bool , default False ) : whether nd_array memory can be <nl> borrowed internally to speed up the data creation <nl> read_only ( bool , optional ) : whether the data can be modified or <nl> not ( default False ) <nl> def from_csr ( csr_array , device = None , read_only = False , borrow = False , shape = None ) : <nl> should be put on <nl> read_only ( bool , optional ) : whether the data can be modified or <nl> not ( default False ) <nl> - borrow ( bool , default False ) : whether nd_arrary memory can be <nl> + borrow ( bool , default False ) : whether nd_array memory can be <nl> borrowed internally to speed up the data creation <nl> shape ( tuple , default None ) : shape of the created NDArrayView . <nl> If unspecified , the created NDArrayView has the same shape as the csr_matrix . <nl> def from_data ( data , device = None , read_only = False , borrow = False ) : <nl> should be put on <nl> read_only ( bool , optional ) : whether the data can be modified or <nl> not ( default False ) <nl> - borrow ( bool , default False ) : whether nd_arrary memory can be <nl> + borrow ( bool , default False ) : whether nd_array memory can be <nl> borrowed internally to speed up the data creation <nl> <nl> Returns : <nl> mmm a / bindings / python / cntk / layers / layers . py <nl> ppp b / bindings / python / cntk / layers / layers . py <nl> def Dense ( shape , activation = default_override_or ( identity ) , init = default_override <nl> input_rank ( int , defaults to ` None ` ) : number of inferred axes to add to W ( ` map_rank ` must not be given ) <nl> map_rank ( int , defaults to ` None ` ) : expand W to leave exactly ` map_rank ` axes ( ` input_rank ` must not be given ) <nl> bias ( bool , optional , defaults to ` True ` ) : the layer will have no bias if ` False ` is passed here <nl> - init_bias ( scalar or NumPy array or : mod : ` cntk . initializer ` , defualts to 0 ) : initial value of weights ` b ` <nl> + init_bias ( scalar or NumPy array or : mod : ` cntk . initializer ` , defaults to 0 ) : initial value of weights ` b ` <nl> name ( str , defaults to ' ' ) : the name of the function instance in the network <nl> <nl> Returns : <nl> mmm a / bindings / python / cntk / ops / functions . py <nl> ppp b / bindings / python / cntk / ops / functions . py <nl> def eval ( self , arguments = None , outputs = None , device = None , as_numpy = True ) : <nl> passing input data . <nl> <nl> Returns : <nl> - dict or NumPy Array : Dict with keys of ouput variable names and values of <nl> + dict or NumPy Array : Dict with keys of output variable names and values of <nl> output variable . A single NumPy array if there is only one output value . <nl> ' ' ' <nl> if outputs is None : <nl>
Fix typos
microsoft/CNTK
dd1bc6bdb5ab6122375a01b45e046225ace21451
2017-06-10T10:54:18Z
mmm a / src / common / common_funcs . h <nl> ppp b / src / common / common_funcs . h <nl> <nl> # define Crash ( ) exit ( 1 ) <nl> # endif <nl> <nl> - / / GCC 4 . 8 defines all the rotate functions now <nl> - / / Small issue with GCC ' s lrotl / lrotr intrinsics is they are still 32bit while we require 64bit <nl> - # ifdef _rotl <nl> - # define rotl _rotl <nl> - # else <nl> - inline u32 rotl ( u32 x , int shift ) { <nl> - shift & = 31 ; <nl> - if ( ! shift ) <nl> - return x ; <nl> - return ( x < < shift ) | ( x > > ( 32 - shift ) ) ; <nl> - } <nl> - # endif <nl> - <nl> - # ifdef _rotr <nl> - # define rotr _rotr <nl> - # else <nl> - inline u32 rotr ( u32 x , int shift ) { <nl> - shift & = 31 ; <nl> - if ( ! shift ) <nl> - return x ; <nl> - return ( x > > shift ) | ( x < < ( 32 - shift ) ) ; <nl> - } <nl> - # endif <nl> - <nl> - inline u64 _rotl64 ( u64 x , unsigned int shift ) { <nl> - unsigned int n = shift % 64 ; <nl> - return ( x < < n ) | ( x > > ( 64 - n ) ) ; <nl> - } <nl> - <nl> - inline u64 _rotr64 ( u64 x , unsigned int shift ) { <nl> - unsigned int n = shift % 64 ; <nl> - return ( x > > n ) | ( x < < ( 64 - n ) ) ; <nl> - } <nl> - <nl> # else / / _MSC_VER <nl> <nl> / / Locale Cross - Compatibility <nl> __declspec ( dllimport ) void __stdcall DebugBreak ( void ) ; <nl> } <nl> # define Crash ( ) DebugBreak ( ) <nl> <nl> - / / cstdlib provides these on MSVC <nl> - # define rotr _rotr <nl> - # define rotl _rotl <nl> - <nl> # endif / / _MSC_VER ndef <nl> <nl> / / Generic function to get last error message . <nl>
Merge pull request from lioncash / unused
yuzu-emu/yuzu
d6c7a05239d5b133ba4755a03615246052e41af8
2018-07-19T18:43:41Z
mmm a / ports / pcre / portfile . cmake <nl> ppp b / ports / pcre / portfile . cmake <nl> vcpkg_configure_cmake ( <nl> SOURCE_PATH $ { SOURCE_PATH } <nl> OPTIONS - DPCRE_BUILD_TESTS = NO <nl> - DPCRE_BUILD_PCREGREP = NO <nl> + - DPCRE_BUILD_PCRE32 = YES <nl> + - DPCRE_BUILD_PCRE16 = YES <nl> # OPTIONS - DUSE_THIS_IN_ALL_BUILDS = 1 - DUSE_THIS_TOO = 2 <nl> # OPTIONS_RELEASE - DOPTIMIZE = 1 <nl> # OPTIONS_DEBUG - DDEBUGGABLE = 1 <nl>
build UTF32 and UTF8 versions
microsoft/vcpkg
8ad5300c7543ba5315519609fc94820ed4ee14de
2016-10-20T00:16:08Z
deleted file mode 100644 <nl> index e69de29bb2d . . 00000000000 <nl>
Removed useless file [ # CLICKHOUSE - 2 ]
ClickHouse/ClickHouse
493b67d051d13ff0ea0d0b7cb05b3ae56200f890
2018-06-28T15:59:39Z
mmm a / src / dbg / debugger . cpp <nl> ppp b / src / dbg / debugger . cpp <nl> static void cbAttachDebugger ( ) <nl> cmddirectexec ( StringUtils : : sprintf ( " resumethread % p " , tidToResume ) . c_str ( ) ) ; <nl> tidToResume = 0 ; <nl> } <nl> - varset ( " $ hp " , ( duint ) fdProcessInfo - > hProcess , true ) ; <nl> varset ( " $ pid " , fdProcessInfo - > dwProcessId , true ) ; <nl> } <nl> <nl> static void debugLoopFunction ( void * lpParameter , bool attach ) <nl> } <nl> <nl> / / set script variables <nl> - varset ( " $ hp " , ( duint ) fdProcessInfo - > hProcess , true ) ; <nl> varset ( " $ pid " , fdProcessInfo - > dwProcessId , true ) ; <nl> <nl> if ( ! OpenProcessToken ( fdProcessInfo - > hProcess , TOKEN_ALL_ACCESS , & hProcessToken ) ) <nl>
Remove 2 occurrences of ' varset ( " $ hp " , fdProcessInfo - > hProcess ) ' , one of which was being called with the initial handle from CreateProcess ( ) . cbCreateProcess is now the only place where this variable is set , for both types of debug sessions ( attaching or creating )
x64dbg/x64dbg
2f3f28746dc38aeedfa47af3c6b94278ec8d72c0
2017-11-28T16:29:50Z
mmm a / lib / IDE / CodeCompletion . cpp <nl> ppp b / lib / IDE / CodeCompletion . cpp <nl> class ArchetypeTransformer { <nl> DeclContext * DC ; <nl> Type BaseTy ; <nl> llvm : : DenseMap < TypeBase * , Type > Cache ; <nl> - llvm : : DenseMap < Identifier , Type > TypeParams ; <nl> + TypeSubstitutionMap Map ; <nl> <nl> public : <nl> - ArchetypeTransformer ( DeclContext * DC , Type Ty ) : DC ( DC ) , <nl> - BaseTy ( Ty - > getRValueType ( ) ) { <nl> - if ( ! BaseTy - > getNominalOrBoundGenericNominal ( ) ) <nl> + ArchetypeTransformer ( DeclContext * DC , Type Ty ) : DC ( DC ) , BaseTy ( Ty - > getRValueType ( ) ) { <nl> + auto D = BaseTy - > getNominalOrBoundGenericNominal ( ) ; <nl> + if ( ! D ) <nl> return ; <nl> - SmallVector < swift : : Substitution , 3 > Scrach ; <nl> - for ( auto Sub : BaseTy - > getDesugaredType ( ) - > gatherAllSubstitutions ( <nl> - DC - > getParentModule ( ) , Scrach , <nl> - DC - > getASTContext ( ) . getLazyResolver ( ) ) ) { <nl> - if ( Sub . getReplacement ( ) - > isCanonical ( ) ) <nl> - TypeParams [ Sub . getArchetype ( ) - > getName ( ) ] = Sub . getReplacement ( ) ; <nl> + SmallVector < Type , 3 > Scrach ; <nl> + auto Params = D - > getGenericParamTypes ( ) ; <nl> + auto Args = BaseTy - > getAllGenericArgs ( Scrach ) ; <nl> + assert ( Params . size ( ) = = Args . size ( ) ) ; <nl> + for ( unsigned I = 0 , N = Params . size ( ) ; I < N ; I + + ) { <nl> + Map [ Params [ I ] - > getCanonicalType ( ) - > castTo < GenericTypeParamType > ( ) ] = Args [ I ] ; <nl> } <nl> } <nl> <nl> class ArchetypeTransformer { <nl> Result = MT ; <nl> } <nl> } <nl> - } else if ( TypeParams . count ( RootArc - > getName ( ) ) ! = 0 & & <nl> - ! RootArc - > getParent ( ) ) { <nl> - Result = TypeParams [ RootArc - > getName ( ) ] ; <nl> + } else { <nl> + Result = Ty . subst ( DC - > getParentModule ( ) , Map , SubstFlags : : IgnoreMissing ) ; <nl> } <nl> <nl> auto ATT = dyn_cast < ArchetypeType > ( Result . getPointer ( ) ) ; <nl>
[ CodeComplete ] Start using TypeSubstitutionMap to transform generic type parameters . NFC
apple/swift
fd94ce676f825e98fbe16e31c988bc7faff153dd
2015-10-15T20:57:22Z
mmm a / dlib / dnn / core . h <nl> ppp b / dlib / dnn / core . h <nl> <nl> # include < iterator > <nl> # include < memory > <nl> # include < type_traits > <nl> - # include < dlib / statistics . h > <nl> - # include < dlib / rand . h > <nl> + # include " . . / statistics . h " <nl> + # include " . . / rand . h " <nl> # include < utility > <nl> <nl> <nl> mmm a / dlib / dnn / core_abstract . h <nl> ppp b / dlib / dnn / core_abstract . h <nl> <nl> # include " solvers_abstract . h " <nl> # include < memory > <nl> # include < type_traits > <nl> - # include < dlib / statistics . h > <nl> - # include < dlib / rand . h > <nl> + # include " . . / rand . h " <nl> <nl> <nl> namespace dlib <nl> mmm a / dlib / dnn / input . h <nl> ppp b / dlib / dnn / input . h <nl> <nl> # ifndef DLIB_DNn_INPUT_H_ <nl> # define DLIB_DNn_INPUT_H_ <nl> <nl> - # include < dlib / matrix . h > <nl> - # include < dlib / pixel . h > <nl> + # include " . . / matrix . h " <nl> + # include " . . / pixel . h " <nl> <nl> <nl> namespace dlib <nl> mmm a / dlib / dnn / layers . h <nl> ppp b / dlib / dnn / layers . h <nl> <nl> # include " core . h " <nl> # include < iostream > <nl> # include < string > <nl> - # include < dlib / rand . h > <nl> - # include < dlib / string . h > <nl> + # include " . . / rand . h " <nl> + # include " . . / string . h " <nl> <nl> <nl> namespace dlib <nl> mmm a / dlib / dnn / loss . h <nl> ppp b / dlib / dnn / loss . h <nl> <nl> # define DLIB_DNn_LOSS_H_ <nl> <nl> # include " core . h " <nl> - # include < dlib / matrix . h > <nl> + # include " . . / matrix . h " <nl> <nl> namespace dlib <nl> { <nl> mmm a / dlib / dnn / tensor . h <nl> ppp b / dlib / dnn / tensor . h <nl> <nl> <nl> # include < memory > <nl> # include < cstring > <nl> - # include < dlib / matrix . h > <nl> + # include " . . / matrix . h " <nl> <nl> namespace dlib <nl> { <nl>
Fixed # includes .
davisking/dlib
163da43efc03f429b06bdcd1ae3bd7166c88067b
2015-09-23T13:07:45Z
mmm a / torch / csrc / jit / runtime / operator . h <nl> ppp b / torch / csrc / jit / runtime / operator . h <nl> c10 : : optional < Operator > OperatorGenerator ( <nl> Func & & op , <nl> AliasAnalysisKind alias_analysis ) { <nl> return c10 : : optional < Operator > ( Operator ( <nl> - std : : string ( schema_str ) , <nl> - std : : forward < Func > ( op ) , <nl> - alias_analysis ) ) ; <nl> + std : : string ( schema_str ) , std : : forward < Func > ( op ) , alias_analysis ) ) ; <nl> } <nl> <nl> template < typename Func > <nl>
[ Codemod ] [ FBSourceClangFormatLinter ] Daily ` arc lint - - take CLANGFORMAT `
pytorch/pytorch
26161e8ab6c9c2a5a0c5816c832b6479979bb931
2020-08-28T12:38:13Z
mmm a / src / csharp / Grpc . Core . Tests / ChannelTest . cs <nl> ppp b / src / csharp / Grpc . Core . Tests / ChannelTest . cs <nl> <nl> # endregion <nl> <nl> using System ; <nl> + using System . Threading . Tasks ; <nl> using Grpc . Core ; <nl> using Grpc . Core . Internal ; <nl> using Grpc . Core . Utils ; <nl> public void Shutdown_AllowedOnlyOnce ( ) <nl> channel . ShutdownAsync ( ) . Wait ( ) ; <nl> Assert . ThrowsAsync ( typeof ( InvalidOperationException ) , async ( ) = > await channel . ShutdownAsync ( ) ) ; <nl> } <nl> + <nl> + [ Test ] <nl> + public async Task ShutdownTokenCancelledAfterShutdown ( ) <nl> + { <nl> + var channel = new Channel ( " localhost " , ChannelCredentials . Insecure ) ; <nl> + Assert . IsFalse ( channel . ShutdownToken . IsCancellationRequested ) ; <nl> + var shutdownTask = channel . ShutdownAsync ( ) ; <nl> + Assert . IsTrue ( channel . ShutdownToken . IsCancellationRequested ) ; <nl> + await shutdownTask ; <nl> + } <nl> + <nl> + [ Test ] <nl> + public async Task StateIsFatalFailureAfterShutdown ( ) <nl> + { <nl> + var channel = new Channel ( " localhost " , ChannelCredentials . Insecure ) ; <nl> + await channel . ShutdownAsync ( ) ; <nl> + Assert . AreEqual ( ChannelState . FatalFailure , channel . State ) ; <nl> + } <nl> + <nl> + [ Test ] <nl> + public async Task ShutdownFinishesWaitForStateChangedAsync ( ) <nl> + { <nl> + var channel = new Channel ( " localhost " , ChannelCredentials . Insecure ) ; <nl> + var stateChangedTask = channel . WaitForStateChangedAsync ( ChannelState . Idle ) ; <nl> + var shutdownTask = channel . ShutdownAsync ( ) ; <nl> + await stateChangedTask ; <nl> + await shutdownTask ; <nl> + } <nl> + <nl> + [ Test ] <nl> + public async Task OperationsThrowAfterShutdown ( ) <nl> + { <nl> + var channel = new Channel ( " localhost " , ChannelCredentials . Insecure ) ; <nl> + await channel . ShutdownAsync ( ) ; <nl> + Assert . ThrowsAsync ( typeof ( ObjectDisposedException ) , async ( ) = > await channel . WaitForStateChangedAsync ( ChannelState . Idle ) ) ; <nl> + Assert . Throws ( typeof ( ObjectDisposedException ) , ( ) = > { var x = channel . ResolvedTarget ; } ) ; <nl> + Assert . ThrowsAsync ( typeof ( TaskCanceledException ) , async ( ) = > await channel . ConnectAsync ( ) ) ; <nl> + } <nl> } <nl> } <nl> mmm a / src / csharp / Grpc . Core / Channel . cs <nl> ppp b / src / csharp / Grpc . Core / Channel . cs <nl> <nl> using System ; <nl> using System . Collections . Generic ; <nl> using System . Linq ; <nl> + using System . Threading ; <nl> using System . Threading . Tasks ; <nl> <nl> using Grpc . Core . Internal ; <nl> public class Channel <nl> <nl> readonly object myLock = new object ( ) ; <nl> readonly AtomicCounter activeCallCounter = new AtomicCounter ( ) ; <nl> + readonly CancellationTokenSource shutdownTokenSource = new CancellationTokenSource ( ) ; <nl> <nl> readonly string target ; <nl> readonly GrpcEnvironment environment ; <nl> public Channel ( string target , ChannelCredentials credentials , IEnumerable < Channe <nl> <nl> / / / < summary > <nl> / / / Gets current connectivity state of this channel . <nl> + / / / After channel is has been shutdown , < c > ChannelState . FatalFailure < / c > will be returned . <nl> / / / < / summary > <nl> public ChannelState State <nl> { <nl> get <nl> { <nl> - return handle . CheckConnectivityState ( false ) ; <nl> + return GetConnectivityState ( false ) ; <nl> } <nl> } <nl> <nl> public string Target <nl> } <nl> } <nl> <nl> + / / / < summary > <nl> + / / / Returns a token that gets cancelled once < c > ShutdownAsync < / c > is invoked . <nl> + / / / < / summary > <nl> + public CancellationToken ShutdownToken <nl> + { <nl> + get <nl> + { <nl> + return this . shutdownTokenSource . Token ; <nl> + } <nl> + } <nl> + <nl> / / / < summary > <nl> / / / Allows explicitly requesting channel to connect without starting an RPC . <nl> / / / Returned task completes once state Ready was seen . If the deadline is reached , <nl> public string Target <nl> / / / < param name = " deadline " > The deadline . < c > null < / c > indicates no deadline . < / param > <nl> public async Task ConnectAsync ( DateTime ? deadline = null ) <nl> { <nl> - var currentState = handle . CheckConnectivityState ( true ) ; <nl> + var currentState = GetConnectivityState ( true ) ; <nl> while ( currentState ! = ChannelState . Ready ) <nl> { <nl> if ( currentState = = ChannelState . FatalFailure ) <nl> public async Task ConnectAsync ( DateTime ? deadline = null ) <nl> throw new OperationCanceledException ( " Channel has reached FatalFailure state . " ) ; <nl> } <nl> await WaitForStateChangedAsync ( currentState , deadline ) . ConfigureAwait ( false ) ; <nl> - currentState = handle . CheckConnectivityState ( false ) ; <nl> + currentState = GetConnectivityState ( false ) ; <nl> } <nl> } <nl> <nl> public async Task ShutdownAsync ( ) <nl> shutdownRequested = true ; <nl> } <nl> <nl> + shutdownTokenSource . Cancel ( ) ; <nl> + <nl> var activeCallCount = activeCallCounter . Count ; <nl> if ( activeCallCount > 0 ) <nl> { <nl> internal void RemoveCallReference ( object call ) <nl> activeCallCounter . Decrement ( ) ; <nl> } <nl> <nl> + private ChannelState GetConnectivityState ( bool tryToConnect ) <nl> + { <nl> + try <nl> + { <nl> + return handle . CheckConnectivityState ( tryToConnect ) ; <nl> + } <nl> + catch ( ObjectDisposedException ) <nl> + { <nl> + return ChannelState . FatalFailure ; <nl> + } <nl> + } <nl> + <nl> private static void EnsureUserAgentChannelOption ( Dictionary < string , ChannelOption > options ) <nl> { <nl> var key = ChannelOptions . PrimaryUserAgentString ; <nl>
Merge pull request from jtattermusch / csharp_channel_shutdown_improvements
grpc/grpc
26dd2b8d6b298b7225f317b66a05646aaefb6a48
2016-05-12T17:13:45Z
mmm a / src / arch / runtime / runtime . cc <nl> ppp b / src / arch / runtime / runtime . cc <nl> <nl> # include " arch / runtime / thread_pool . hpp " <nl> # include " do_on_thread . hpp " <nl> <nl> - <nl> + / / RSI : inline <nl> int get_thread_id ( ) { <nl> return linux_thread_pool_t : : thread_id ; <nl> } <nl> mmm a / src / clustering / immediate_consistency / branch / multistore . cc <nl> ppp b / src / clustering / immediate_consistency / branch / multistore . cc <nl> multistore_ptr_t < protocol_t > : : read ( DEBUG_ONLY ( const metainfo_checker_t < protocol_ <nl> order_token_t order_token , <nl> object_buffer_t < fifo_enforcer_sink_t : : exit_read_t > * external_token , <nl> signal_t * interruptor ) THROWS_ONLY ( interrupted_exc_t ) { <nl> + / / RSI : for each store , check if region is empty before creating internal read tokens <nl> scoped_array_t < fifo_enforcer_read_token_t > internal_tokens ; <nl> switch_read_tokens ( external_token , interruptor , & order_token , & internal_tokens ) ; <nl> <nl> mmm a / src / clustering / reactor / namespace_interface . cc <nl> ppp b / src / clustering / reactor / namespace_interface . cc <nl> void cluster_namespace_interface_t < protocol_t > : : dispatch_immediate_op ( <nl> <nl> std : : vector < op_response_type > results ( masters_to_contact . size ( ) ) ; <nl> std : : vector < std : : string > failures ( masters_to_contact . size ( ) ) ; <nl> + / / RSI : don ' t use pmap <nl> pmap ( masters_to_contact . size ( ) , boost : : bind ( <nl> & cluster_namespace_interface_t : : template perform_immediate_op < op_type , fifo_enforcer_token_type , op_response_type > , this , <nl> how_to_run_query , & masters_to_contact , & op , & results , & failures , order_token , _1 , interruptor ) ) ; <nl>
some RSI comments as placeholders for more optimizations
rethinkdb/rethinkdb
46bd65be8ade63030699aa1c6e3cc30198cb03df
2012-08-27T19:59:16Z
mmm a / Makefile <nl> ppp b / Makefile <nl> repos = templates . rpo <nl> executables = parse termemu <nl> <nl> CXX = g + + <nl> - CXXFLAGS = - g - - std = c + + 0x - pedantic - Werror - Wall - Wextra - Weffc + + - fno - implicit - templates - fno - default - inline - pipe - D_FILE_OFFSET_BITS = 64 - D_XOPEN_SOURCE = 500 - D_GNU_SOURCE <nl> + CXXFLAGS = - g - O2 - - std = c + + 0x - pedantic - Werror - Wall - Wextra - Weffc + + - fno - implicit - templates - fno - default - inline - pipe - D_FILE_OFFSET_BITS = 64 - D_XOPEN_SOURCE = 500 - D_GNU_SOURCE <nl> LIBS = - lutil <nl> <nl> all : $ ( executables ) <nl>
Use optimization
mobile-shell/mosh
5a20f61184c50bb3e84a8c406ead0c782253a4ab
2011-02-12T22:13:31Z
new file mode 100644 <nl> index 0000000000 . . 2a300d6f2e <nl> mmm / dev / null <nl> ppp b / code / sorting / bucket_sort / bucket_sort . m <nl> <nl> + / * Part of Cosmos by OpenGenus Foundation * / <nl> + <nl> + / / <nl> + / / bucket_sort . m <nl> + / / Created by DaiPei on 2017 / 10 / 14 . <nl> + / / <nl> + <nl> + # import < Foundation / Foundation . h > <nl> + <nl> + # define DEFAULT_STEP 5 <nl> + <nl> + @ interface BucketSort : NSObject <nl> + <nl> + - ( void ) sort : ( NSMutableArray < NSNumber * > * ) array ; <nl> + - ( void ) sort : ( NSMutableArray < NSNumber * > * ) array withStep : ( NSUInteger ) step ; <nl> + <nl> + @ end <nl> + <nl> + @ implementation BucketSort <nl> + <nl> + - ( void ) sort : ( NSMutableArray < NSNumber * > * ) array { <nl> + [ self sort : array withStep : DEFAULT_STEP ] ; <nl> + } <nl> + <nl> + - ( void ) sort : ( NSMutableArray < NSNumber * > * ) array withStep : ( NSUInteger ) step { <nl> + / / find the max value <nl> + NSNumber * max = @ ( INTMAX_MIN ) ; <nl> + NSNumber * min = @ ( INTMAX_MAX ) ; <nl> + for ( int i = 0 ; i < array . count ; i + + ) { <nl> + if ( [ array [ i ] compare : max ] = = NSOrderedDescending ) { <nl> + max = array [ i ] ; <nl> + } <nl> + if ( [ array [ i ] compare : min ] = = NSOrderedAscending ) { <nl> + min = array [ i ] ; <nl> + } <nl> + } <nl> + / / calculate buckets count <nl> + NSUInteger n = ( max . integerValue - min . integerValue ) / step + 1 ; <nl> + NSMutableArray < NSMutableArray * > * buckets = [ NSMutableArray arrayWithCapacity : n ] ; <nl> + for ( int i = 0 ; i < n ; i + + ) { <nl> + [ buckets addObject : [ NSMutableArray array ] ] ; <nl> + } <nl> + / / put value to buckets <nl> + for ( int i = 0 ; i < array . count ; i + + ) { <nl> + NSUInteger j = ( array [ i ] . integerValue - min . integerValue ) / step ; <nl> + [ buckets [ j ] addObject : array [ i ] ] ; <nl> + } <nl> + / / sort value in each bucket <nl> + for ( int i = 0 ; i < n ; i + + ) { <nl> + [ self sortCore : buckets [ i ] ] ; <nl> + } <nl> + / / put sorted value back to origin array <nl> + NSUInteger index = 0 ; <nl> + for ( int i = 0 ; i < n ; i + + ) { <nl> + NSMutableArray * bucket = buckets [ i ] ; <nl> + for ( int j = 0 ; j < bucket . count ; j + + ) { <nl> + array [ index + + ] = bucket [ j ] ; <nl> + } <nl> + } <nl> + } <nl> + <nl> + - ( void ) sortCore : ( NSMutableArray < NSNumber * > * ) array { <nl> + for ( int i = 0 ; i + 1 < array . count ; i + + ) { <nl> + int p = i ; <nl> + for ( int j = i + 1 ; j < array . count ; j + + ) { <nl> + if ( [ array [ j ] compare : array [ p ] ] = = NSOrderedAscending ) { <nl> + p = j ; <nl> + } <nl> + } <nl> + [ self swap : array at : i and : p ] ; <nl> + } <nl> + } <nl> + <nl> + - ( void ) swap : ( NSMutableArray < NSNumber * > * ) array at : ( NSUInteger ) indexA and : ( NSUInteger ) indexB { <nl> + NSNumber * tmp = array [ indexA ] ; <nl> + array [ indexA ] = array [ indexB ] ; <nl> + array [ indexB ] = tmp ; <nl> + } <nl> + <nl> + @ end <nl> + <nl> + int main ( int argc , const char * argv [ ] ) { <nl> + @ autoreleasepool { <nl> + NSMutableArray * array = [ NSMutableArray arrayWithCapacity : 10 ] ; <nl> + for ( int i = 0 ; i < 100 ; i + + ) { <nl> + int ran = arc4random ( ) % 100 - 50 ; <nl> + [ array addObject : @ ( ran ) ] ; <nl> + } <nl> + NSLog ( @ " before : % @ " , array ) ; <nl> + BucketSort * bs = [ [ BucketSort alloc ] init ] ; <nl> + [ bs sort : array withStep : 10 ] ; <nl> + NSLog ( @ " after : % @ " , array ) ; <nl> + } <nl> + return 0 ; <nl> + } <nl>
add bucket sort in Objective - C
OpenGenus/cosmos
dc852f6f0999b012e60ad185c85e3c932dedada7
2017-10-14T03:26:27Z
mmm a / docs / root / intro / deprecated . rst <nl> ppp b / docs / root / intro / deprecated . rst <nl> Version 1 . 12 . 0 ( pending ) <nl> < envoy_api_msg_config . filter . network . http_connection_manager . v2 . HttpConnectionManager > ` <nl> has been deprecated in favor of the ` traffic_direction ` field in <nl> : ref : ` Listener < envoy_api_msg_Listener > ` . The latter takes priority if <nl> - specified . <nl> + specified . Note that the default value ` INGRESS ` of the ` operation_name ` <nl> + field is not detected as being set , so the deprecation warning is not <nl> + triggered for it . <nl> <nl> Version 1 . 11 . 0 ( July 11 , 2019 ) <nl> = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = <nl>
docs : minor deprecation note ( )
envoyproxy/envoy
4d19edabbc7e2efbe217909d85620e835c948dcc
2019-09-17T21:15:37Z
mmm a / src / mongo / db / repl / elect_cmd_runner_test . cpp <nl> ppp b / src / mongo / db / repl / elect_cmd_runner_test . cpp <nl> namespace { <nl> ASSERT_EQUALS ( electCmdRunner . getReceivedVotes ( ) , 1 ) ; <nl> } <nl> <nl> + class ElectScatterGatherTest : public mongo : : unittest : : Test { <nl> + public : <nl> + virtual void start ( const BSONObj & configObj ) { <nl> + int selfConfigIndex = 0 ; <nl> + <nl> + ReplicaSetConfig config ; <nl> + config . initialize ( configObj ) ; <nl> + <nl> + std : : vector < HostAndPort > hosts ; <nl> + for ( ReplicaSetConfig : : MemberIterator mem = + + config . membersBegin ( ) ; <nl> + mem ! = config . membersEnd ( ) ; <nl> + + + mem ) { <nl> + hosts . push_back ( mem - > getHostAndPort ( ) ) ; <nl> + } <nl> + <nl> + _checker . reset ( new ElectCmdRunner : : Algorithm ( config , <nl> + selfConfigIndex , <nl> + hosts , <nl> + 1954878951734LL ) ) ; <nl> + } <nl> + <nl> + virtual void tearDown ( ) { <nl> + _checker . reset ( NULL ) ; <nl> + } <nl> + <nl> + protected : <nl> + bool hasReceivedSufficientResponses ( ) { <nl> + return _checker - > hasReceivedSufficientResponses ( ) ; <nl> + } <nl> + <nl> + int getReceivedVotes ( ) { <nl> + return _checker - > getReceivedVotes ( ) ; <nl> + } <nl> + <nl> + void processResponse ( const RemoteCommandRequest & request , const ResponseStatus & response ) { <nl> + _checker - > processResponse ( request , response ) ; <nl> + } <nl> + <nl> + RemoteCommandRequest requestFrom ( std : : string hostname ) { <nl> + return RemoteCommandRequest ( HostAndPort ( hostname ) , <nl> + " " , / / the non - hostname fields do not matter for Elect <nl> + BSONObj ( ) , <nl> + Milliseconds ( 0 ) ) ; <nl> + } <nl> + <nl> + ResponseStatus badResponseStatus ( ) { <nl> + return ResponseStatus ( ErrorCodes : : NodeNotFound , " not on my watch " ) ; <nl> + } <nl> + <nl> + ResponseStatus wrongTypeForVoteField ( ) { <nl> + return ResponseStatus ( NetworkInterfaceMock : : Response ( BSON ( " vote " < < std : : string ( " yea " ) ) , <nl> + Milliseconds ( 10 ) ) ) ; <nl> + } <nl> + <nl> + ResponseStatus voteYea ( ) { <nl> + return ResponseStatus ( NetworkInterfaceMock : : Response ( BSON ( " vote " < < 1 ) , <nl> + Milliseconds ( 10 ) ) ) ; <nl> + } <nl> + <nl> + ResponseStatus voteNay ( ) { <nl> + return ResponseStatus ( NetworkInterfaceMock : : Response ( BSON ( " vote " < < - 10000 ) , <nl> + Milliseconds ( 10 ) ) ) ; <nl> + } <nl> + <nl> + ResponseStatus abstainFromVoting ( ) { <nl> + return ResponseStatus ( NetworkInterfaceMock : : Response ( BSON ( " vote " < < 0 ) , <nl> + Milliseconds ( 10 ) ) ) ; <nl> + } <nl> + <nl> + BSONObj basicThreeNodeConfig ( ) { <nl> + return BSON ( " _id " < < " rs0 " < < <nl> + " version " < < 1 < < <nl> + " members " < < BSON_ARRAY ( <nl> + BSON ( " _id " < < 0 < < " host " < < " host0 " ) < < <nl> + BSON ( " _id " < < 1 < < " host " < < " host1 " ) < < <nl> + BSON ( " _id " < < 2 < < " host " < < " host2 " ) ) ) ; <nl> + } <nl> + <nl> + private : <nl> + scoped_ptr < ElectCmdRunner : : Algorithm > _checker ; <nl> + } ; <nl> + <nl> + TEST_F ( ElectScatterGatherTest , NodeRespondsWithBadVoteType ) { <nl> + start ( basicThreeNodeConfig ( ) ) ; <nl> + ASSERT_FALSE ( hasReceivedSufficientResponses ( ) ) ; <nl> + <nl> + processResponse ( requestFrom ( " host2 " ) , wrongTypeForVoteField ( ) ) ; <nl> + ASSERT_TRUE ( hasReceivedSufficientResponses ( ) ) ; <nl> + ASSERT_EQUALS ( 1 , getReceivedVotes ( ) ) ; / / 1 because we have 1 vote and voted for ourself <nl> + } <nl> + <nl> + TEST_F ( ElectScatterGatherTest , NodeRespondsWithBadStatus ) { <nl> + start ( basicThreeNodeConfig ( ) ) ; <nl> + ASSERT_FALSE ( hasReceivedSufficientResponses ( ) ) ; <nl> + <nl> + processResponse ( requestFrom ( " host2 " ) , badResponseStatus ( ) ) ; <nl> + ASSERT_FALSE ( hasReceivedSufficientResponses ( ) ) ; <nl> + <nl> + processResponse ( requestFrom ( " host3 " ) , abstainFromVoting ( ) ) ; <nl> + ASSERT_TRUE ( hasReceivedSufficientResponses ( ) ) ; <nl> + ASSERT_EQUALS ( 1 , getReceivedVotes ( ) ) ; / / 1 because we have 1 vote and voted for ourself <nl> + } <nl> + <nl> + TEST_F ( ElectScatterGatherTest , FirstNodeRespondsWithYea ) { <nl> + start ( basicThreeNodeConfig ( ) ) ; <nl> + ASSERT_FALSE ( hasReceivedSufficientResponses ( ) ) ; <nl> + <nl> + processResponse ( requestFrom ( " host2 " ) , voteYea ( ) ) ; <nl> + ASSERT_TRUE ( hasReceivedSufficientResponses ( ) ) ; <nl> + ASSERT_EQUALS ( 2 , getReceivedVotes ( ) ) ; <nl> + } <nl> + <nl> + TEST_F ( ElectScatterGatherTest , FirstNodeRespondsWithNaySecondWithYea ) { <nl> + start ( basicThreeNodeConfig ( ) ) ; <nl> + ASSERT_FALSE ( hasReceivedSufficientResponses ( ) ) ; <nl> + <nl> + processResponse ( requestFrom ( " host2 " ) , voteNay ( ) ) ; <nl> + ASSERT_FALSE ( hasReceivedSufficientResponses ( ) ) ; <nl> + <nl> + processResponse ( requestFrom ( " host3 " ) , voteYea ( ) ) ; <nl> + ASSERT_TRUE ( hasReceivedSufficientResponses ( ) ) ; <nl> + ASSERT_EQUALS ( - 9998 , getReceivedVotes ( ) ) ; <nl> + } <nl> + <nl> + TEST_F ( ElectScatterGatherTest , BothNodesAbstainFromVoting ) { <nl> + start ( basicThreeNodeConfig ( ) ) ; <nl> + ASSERT_FALSE ( hasReceivedSufficientResponses ( ) ) ; <nl> + <nl> + processResponse ( requestFrom ( " host2 " ) , abstainFromVoting ( ) ) ; <nl> + ASSERT_FALSE ( hasReceivedSufficientResponses ( ) ) ; <nl> + <nl> + processResponse ( requestFrom ( " host3 " ) , abstainFromVoting ( ) ) ; <nl> + ASSERT_TRUE ( hasReceivedSufficientResponses ( ) ) ; <nl> + ASSERT_EQUALS ( 1 , getReceivedVotes ( ) ) ; <nl> + } <nl> + <nl> } / / namespace <nl> } / / namespace repl <nl> } / / namespace mongo <nl>
SERVER - 15250 tests for ElectCmdRunner ' s ScatterGatherAlgorithm
mongodb/mongo
3d18f1de1d12f6093ff807e1178f82fa91b9a53e
2014-09-30T12:08:41Z
mmm a / dbms / src / Storages / StorageDictionary . cpp <nl> ppp b / dbms / src / Storages / StorageDictionary . cpp <nl> <nl> # include < Parsers / ASTLiteral . h > <nl> # include < common / logger_useful . h > <nl> # include < Common / typeid_cast . h > <nl> + # include < Processors / Sources / SourceFromInputStream . h > <nl> + # include < Processors / Pipe . h > <nl> <nl> <nl> namespace DB <nl> StorageDictionary : : StorageDictionary ( <nl> } <nl> } <nl> <nl> - BlockInputStreams StorageDictionary : : read ( <nl> + Pipes StorageDictionary : : readWithProcessors ( <nl> const Names & column_names , <nl> const SelectQueryInfo & / * query_info * / , <nl> const Context & context , <nl> BlockInputStreams StorageDictionary : : read ( <nl> const unsigned / * threads * / ) <nl> { <nl> auto dictionary = context . getExternalDictionariesLoader ( ) . getDictionary ( dictionary_name ) ; <nl> - return BlockInputStreams { dictionary - > getBlockInputStream ( column_names , max_block_size ) } ; <nl> + auto stream = dictionary - > getBlockInputStream ( column_names , max_block_size ) ; <nl> + auto source = std : : make_shared < SourceFromInputStream > ( stream ) ; <nl> + / / / TODO : update dictionary interface for processors . <nl> + Pipes pipes ; <nl> + pipes . emplace_back ( std : : move ( source ) ) ; <nl> + return pipes ; <nl> } <nl> <nl> NamesAndTypesList StorageDictionary : : getNamesAndTypes ( const DictionaryStructure & dictionary_structure ) <nl> mmm a / dbms / src / Storages / StorageDictionary . h <nl> ppp b / dbms / src / Storages / StorageDictionary . h <nl> class StorageDictionary : public ext : : shared_ptr_helper < StorageDictionary > , publ <nl> public : <nl> std : : string getName ( ) const override { return " Dictionary " ; } <nl> <nl> - BlockInputStreams read ( const Names & column_names , <nl> + Pipes readWithProcessors ( const Names & column_names , <nl> const SelectQueryInfo & query_info , <nl> const Context & context , <nl> QueryProcessingStage : : Enum processed_stage , <nl> size_t max_block_size = DEFAULT_BLOCK_SIZE , <nl> unsigned threads = 1 ) override ; <nl> <nl> + bool supportProcessorsPipeline ( ) const override { return true ; } <nl> + <nl> static NamesAndTypesList getNamesAndTypes ( const DictionaryStructure & dictionary_structure ) ; <nl> <nl> template < typename ForwardIterator > <nl>
Processors support for StorageDictionary .
ClickHouse/ClickHouse
240f1e3e96d41fadd14a39fd7315c9f5927c4cce
2020-01-31T08:14:20Z
mmm a / include / v8 - platform . h <nl> ppp b / include / v8 - platform . h <nl> class Platform { <nl> <nl> virtual ~ Platform ( ) = default ; <nl> <nl> - / * * <nl> - * Enables the embedder to respond in cases where V8 can ' t allocate large <nl> - * blocks of memory . V8 retries the failed allocation once after calling this <nl> - * method . On success , execution continues ; otherwise V8 exits with a fatal <nl> - * error . <nl> - * Embedder overrides of this function must NOT call back into V8 . <nl> - * / <nl> - virtual void OnCriticalMemoryPressure ( ) { } <nl> - <nl> / * * <nl> * Gets the number of threads that are used to execute background tasks . Is <nl> * used to estimate the number of tasks a work package should be split into . <nl> mmm a / src / allocation . cc <nl> ppp b / src / allocation . cc <nl> <nl> namespace v8 { <nl> namespace internal { <nl> <nl> - namespace { <nl> - <nl> - void * AlignedAllocInternal ( size_t size , size_t alignment ) { <nl> - void * ptr ; <nl> - # if V8_OS_WIN <nl> - ptr = _aligned_malloc ( size , alignment ) ; <nl> - # elif V8_LIBC_BIONIC <nl> - / / posix_memalign is not exposed in some Android versions , so we fall back to <nl> - / / memalign . See http : / / code . google . com / p / android / issues / detail ? id = 35391 . <nl> - ptr = memalign ( alignment , size ) ; <nl> - # else <nl> - if ( posix_memalign ( & ptr , alignment , size ) ) ptr = nullptr ; <nl> - # endif <nl> - return ptr ; <nl> - } <nl> - <nl> - } / / namespace <nl> - <nl> void * Malloced : : New ( size_t size ) { <nl> void * result = malloc ( size ) ; <nl> - if ( result = = nullptr ) { <nl> - V8 : : GetCurrentPlatform ( ) - > OnCriticalMemoryPressure ( ) ; <nl> - result = malloc ( size ) ; <nl> - if ( result = = nullptr ) { <nl> - V8 : : FatalProcessOutOfMemory ( " Malloced operator new " ) ; <nl> - } <nl> + if ( result = = NULL ) { <nl> + V8 : : FatalProcessOutOfMemory ( " Malloced operator new " ) ; <nl> } <nl> return result ; <nl> } <nl> char * StrNDup ( const char * str , int n ) { <nl> void * AlignedAlloc ( size_t size , size_t alignment ) { <nl> DCHECK_LE ( V8_ALIGNOF ( void * ) , alignment ) ; <nl> DCHECK ( base : : bits : : IsPowerOfTwo ( alignment ) ) ; <nl> - void * ptr = AlignedAllocInternal ( size , alignment ) ; <nl> - if ( ptr = = nullptr ) { <nl> - V8 : : GetCurrentPlatform ( ) - > OnCriticalMemoryPressure ( ) ; <nl> - ptr = AlignedAllocInternal ( size , alignment ) ; <nl> - if ( ptr = = nullptr ) { <nl> - V8 : : FatalProcessOutOfMemory ( " AlignedAlloc " ) ; <nl> - } <nl> - } <nl> + void * ptr ; <nl> + # if V8_OS_WIN <nl> + ptr = _aligned_malloc ( size , alignment ) ; <nl> + # elif V8_LIBC_BIONIC <nl> + / / posix_memalign is not exposed in some Android versions , so we fall back to <nl> + / / memalign . See http : / / code . google . com / p / android / issues / detail ? id = 35391 . <nl> + ptr = memalign ( alignment , size ) ; <nl> + # else <nl> + if ( posix_memalign ( & ptr , alignment , size ) ) ptr = NULL ; <nl> + # endif <nl> + if ( ptr = = NULL ) V8 : : FatalProcessOutOfMemory ( " AlignedAlloc " ) ; <nl> return ptr ; <nl> } <nl> <nl> void AlignedFree ( void * ptr ) { <nl> # endif <nl> } <nl> <nl> - bool AllocVirtualMemory ( size_t size , void * hint , base : : VirtualMemory * result ) { <nl> - base : : VirtualMemory first_try ( size , hint ) ; <nl> - if ( first_try . IsReserved ( ) ) { <nl> - result - > TakeControl ( & first_try ) ; <nl> - return true ; <nl> - } <nl> - <nl> - V8 : : GetCurrentPlatform ( ) - > OnCriticalMemoryPressure ( ) ; <nl> - base : : VirtualMemory second_try ( size , hint ) ; <nl> - result - > TakeControl ( & second_try ) ; <nl> - return result - > IsReserved ( ) ; <nl> - } <nl> - <nl> - bool AlignedAllocVirtualMemory ( size_t size , size_t alignment , void * hint , <nl> - base : : VirtualMemory * result ) { <nl> - base : : VirtualMemory first_try ( size , alignment , hint ) ; <nl> - if ( first_try . IsReserved ( ) ) { <nl> - result - > TakeControl ( & first_try ) ; <nl> - return true ; <nl> - } <nl> - <nl> - V8 : : GetCurrentPlatform ( ) - > OnCriticalMemoryPressure ( ) ; <nl> - base : : VirtualMemory second_try ( size , alignment , hint ) ; <nl> - result - > TakeControl ( & second_try ) ; <nl> - return result - > IsReserved ( ) ; <nl> - } <nl> - <nl> } / / namespace internal <nl> } / / namespace v8 <nl> mmm a / src / allocation . h <nl> ppp b / src / allocation . h <nl> <nl> # ifndef V8_ALLOCATION_H_ <nl> # define V8_ALLOCATION_H_ <nl> <nl> - # include " include / v8 - platform . h " <nl> # include " src / base / compiler - specific . h " <nl> - # include " src / base / platform / platform . h " <nl> # include " src / globals . h " <nl> - # include " src / v8 . h " <nl> <nl> namespace v8 { <nl> namespace internal { <nl> <nl> - / / This file defines memory allocation functions . If a first attempt at an <nl> - / / allocation fails , these functions call back into the embedder , then attempt <nl> - / / the allocation a second time . The embedder callback must not reenter V8 . <nl> - <nl> - / / Called when allocation routines fail to allocate , even with a possible retry . <nl> - / / This function should not return , but should terminate the current processing . <nl> + / / Called when allocation routines fail to allocate . <nl> + / / This function should not return , but should terminate the current <nl> + / / processing . <nl> V8_EXPORT_PRIVATE void FatalProcessOutOfMemory ( const char * message ) ; <nl> <nl> / / Superclass for classes managed with new & delete . <nl> class V8_EXPORT_PRIVATE Malloced { <nl> static void Delete ( void * p ) ; <nl> } ; <nl> <nl> + / / DEPRECATED <nl> + / / TODO ( leszeks ) : Delete this during a quiet period <nl> + # define BASE_EMBEDDED <nl> + <nl> + <nl> + / / Superclass for classes only using static method functions . <nl> + / / The subclass of AllStatic cannot be instantiated at all . <nl> + class AllStatic { <nl> + # ifdef DEBUG <nl> + public : <nl> + AllStatic ( ) = delete ; <nl> + # endif <nl> + } ; <nl> + <nl> + <nl> template < typename T > <nl> T * NewArray ( size_t size ) { <nl> - T * result = new ( std : : nothrow ) T [ size ] ; <nl> - if ( result = = nullptr ) { <nl> - V8 : : GetCurrentPlatform ( ) - > OnCriticalMemoryPressure ( ) ; <nl> - result = new ( std : : nothrow ) T [ size ] ; <nl> - if ( result = = nullptr ) FatalProcessOutOfMemory ( " NewArray " ) ; <nl> - } <nl> + T * result = new T [ size ] ; <nl> + if ( result = = NULL ) FatalProcessOutOfMemory ( " NewArray " ) ; <nl> return result ; <nl> } <nl> <nl> + <nl> template < typename T > <nl> void DeleteArray ( T * array ) { <nl> delete [ ] array ; <nl> class FreeStoreAllocationPolicy { <nl> void * AlignedAlloc ( size_t size , size_t alignment ) ; <nl> void AlignedFree ( void * ptr ) ; <nl> <nl> - bool AllocVirtualMemory ( size_t size , void * hint , base : : VirtualMemory * result ) ; <nl> - bool AlignedAllocVirtualMemory ( size_t size , size_t alignment , void * hint , <nl> - base : : VirtualMemory * result ) ; <nl> - <nl> } / / namespace internal <nl> } / / namespace v8 <nl> <nl> mmm a / src / base / DEPS <nl> ppp b / src / base / DEPS <nl> <nl> include_rules = [ <nl> " - include " , <nl> " + include / v8config . h " , <nl> + " + include / v8stdint . h " , <nl> " - src " , <nl> " + src / base " , <nl> ] <nl> mmm a / src / globals . h <nl> ppp b / src / globals . h <nl> const int kStackSpaceRequiredForCompilation = 40 ; <nl> # define V8_SFI_HAS_UNIQUE_ID 1 <nl> # endif <nl> <nl> - / / Superclass for classes only using static method functions . <nl> - / / The subclass of AllStatic cannot be instantiated at all . <nl> - class AllStatic { <nl> - # ifdef DEBUG <nl> - public : <nl> - AllStatic ( ) = delete ; <nl> - # endif <nl> - } ; <nl> - <nl> - / / DEPRECATED <nl> - / / TODO ( leszeks ) : Delete this during a quiet period <nl> - # define BASE_EMBEDDED <nl> - <nl> typedef uint8_t byte ; <nl> typedef byte * Address ; <nl> <nl> mmm a / src / heap / sequential - marking - deque . cc <nl> ppp b / src / heap / sequential - marking - deque . cc <nl> namespace v8 { <nl> namespace internal { <nl> <nl> void SequentialMarkingDeque : : SetUp ( ) { <nl> - base : : VirtualMemory reservation ; <nl> - if ( ! AllocVirtualMemory ( kMaxSize , heap_ - > GetRandomMmapAddr ( ) , & reservation ) ) { <nl> + base : : VirtualMemory reservation ( kMaxSize , heap_ - > GetRandomMmapAddr ( ) ) ; <nl> + if ( ! reservation . IsReserved ( ) ) { <nl> V8 : : FatalProcessOutOfMemory ( " SequentialMarkingDeque : : SetUp " ) ; <nl> } <nl> backing_store_committed_size_ = 0 ; <nl> mmm a / src / heap / spaces . cc <nl> ppp b / src / heap / spaces . cc <nl> <nl> namespace v8 { <nl> namespace internal { <nl> <nl> + <nl> / / mmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmm - <nl> / / HeapObjectIterator <nl> <nl> bool CodeRange : : SetUp ( size_t requested ) { <nl> <nl> DCHECK ( ! kRequiresCodeRange | | requested < = kMaximalCodeRangeSize ) ; <nl> <nl> - base : : VirtualMemory reservation ; <nl> - if ( ! AlignedAllocVirtualMemory ( <nl> - requested , <nl> - Max ( kCodeRangeAreaAlignment , <nl> - static_cast < size_t > ( base : : OS : : AllocateAlignment ( ) ) ) , <nl> - base : : OS : : GetRandomMmapAddr ( ) , & reservation ) ) { <nl> - return false ; <nl> - } <nl> + base : : VirtualMemory reservation ( <nl> + requested , <nl> + Max ( kCodeRangeAreaAlignment , <nl> + static_cast < size_t > ( base : : OS : : AllocateAlignment ( ) ) ) , <nl> + base : : OS : : GetRandomMmapAddr ( ) ) ; <nl> + if ( ! reservation . IsReserved ( ) ) return false ; <nl> <nl> / / We are sure that we have mapped a block of requested addresses . <nl> DCHECK ( reservation . size ( ) = = requested ) ; <nl> void MemoryAllocator : : FreeMemory ( Address base , size_t size , <nl> Address MemoryAllocator : : ReserveAlignedMemory ( size_t size , size_t alignment , <nl> void * hint , <nl> base : : VirtualMemory * controller ) { <nl> - base : : VirtualMemory reservation ; <nl> - if ( ! AlignedAllocVirtualMemory ( size , alignment , hint , & reservation ) ) <nl> - return nullptr ; <nl> + base : : VirtualMemory reservation ( size , alignment , hint ) ; <nl> <nl> + if ( ! reservation . IsReserved ( ) ) return nullptr ; <nl> const Address base = <nl> RoundUp ( static_cast < Address > ( reservation . address ( ) ) , alignment ) ; <nl> if ( base + size ! = reservation . end ( ) ) { <nl> mmm a / src / heap / store - buffer . cc <nl> ppp b / src / heap / store - buffer . cc <nl> void StoreBuffer : : SetUp ( ) { <nl> / / Allocate 3x the buffer size , so that we can start the new store buffer <nl> / / aligned to 2x the size . This lets us use a bit test to detect the end of <nl> / / the area . <nl> - base : : VirtualMemory reservation ; <nl> - if ( ! AllocVirtualMemory ( kStoreBufferSize * 3 , heap_ - > GetRandomMmapAddr ( ) , <nl> - & reservation ) ) { <nl> - V8 : : FatalProcessOutOfMemory ( " StoreBuffer : : SetUp " ) ; <nl> - } <nl> + base : : VirtualMemory reservation ( kStoreBufferSize * 3 , <nl> + heap_ - > GetRandomMmapAddr ( ) ) ; <nl> uintptr_t start_as_int = reinterpret_cast < uintptr_t > ( reservation . address ( ) ) ; <nl> start_ [ 0 ] = <nl> reinterpret_cast < Address * > ( RoundUp ( start_as_int , kStoreBufferSize ) ) ; <nl> mmm a / src / v8 . h <nl> ppp b / src / v8 . h <nl> <nl> # define V8_V8_H_ <nl> <nl> # include " include / v8 . h " <nl> + # include " src / allocation . h " <nl> # include " src / globals . h " <nl> <nl> namespace v8 { <nl> mmm a / src / zone / accounting - allocator . cc <nl> ppp b / src / zone / accounting - allocator . cc <nl> Segment * AccountingAllocator : : GetSegment ( size_t bytes ) { <nl> <nl> Segment * AccountingAllocator : : AllocateSegment ( size_t bytes ) { <nl> void * memory = malloc ( bytes ) ; <nl> - if ( memory = = nullptr ) { <nl> - V8 : : GetCurrentPlatform ( ) - > OnCriticalMemoryPressure ( ) ; <nl> - memory = malloc ( bytes ) ; <nl> - } <nl> - if ( memory ! = nullptr ) { <nl> + if ( memory ) { <nl> base : : AtomicWord current = <nl> base : : Relaxed_AtomicIncrement ( & current_memory_usage_ , bytes ) ; <nl> base : : AtomicWord max = base : : Relaxed_Load ( & max_memory_usage_ ) ; <nl> mmm a / test / cctest / BUILD . gn <nl> ppp b / test / cctest / BUILD . gn <nl> v8_executable ( " cctest " ) { <nl> " test - access - checks . cc " , <nl> " test - accessor - assembler . cc " , <nl> " test - accessors . cc " , <nl> - " test - allocation . cc " , <nl> " test - api - accessors . cc " , <nl> " test - api - interceptors . cc " , <nl> " test - api . cc " , <nl> mmm a / test / cctest / cctest . gyp <nl> ppp b / test / cctest / cctest . gyp <nl> <nl> ' test - access - checks . cc ' , <nl> ' test - accessor - assembler . cc ' , <nl> ' test - accessors . cc ' , <nl> - ' test - allocation . cc ' , <nl> ' test - api . cc ' , <nl> ' test - api . h ' , <nl> ' test - api - accessors . cc ' , <nl> deleted file mode 100644 <nl> index c656d67f4d8 . . 00000000000 <nl> mmm a / test / cctest / test - allocation . cc <nl> ppp / dev / null <nl> <nl> - / / Copyright 2017 the V8 project authors . All rights reserved . <nl> - / / Use of this source code is governed by a BSD - style license that can be <nl> - / / found in the LICENSE file . <nl> - # include < stdlib . h > <nl> - # include < string . h > <nl> - <nl> - # include " src / v8 . h " <nl> - <nl> - # include " test / cctest / cctest . h " <nl> - <nl> - using v8 : : internal : : AccountingAllocator ; <nl> - <nl> - using v8 : : IdleTask ; <nl> - using v8 : : Isolate ; <nl> - using v8 : : Task ; <nl> - <nl> - # include " src / allocation . h " <nl> - # include " src / zone / accounting - allocator . h " <nl> - <nl> - / / ASAN isn ' t configured to return NULL , so skip all of these tests . <nl> - # ifndef V8_USE_ADDRESS_SANITIZER <nl> - <nl> - namespace { <nl> - <nl> - / / Minimal implementation of platform that can receive OOM callbacks . <nl> - class MockAllocationPlatform : public v8 : : Platform { <nl> - public : <nl> - MockAllocationPlatform ( ) { current_platform = this ; } <nl> - virtual ~ MockAllocationPlatform ( ) { } <nl> - <nl> - void OnCriticalMemoryPressure ( ) override { oom_callback_called = true ; } <nl> - <nl> - void CallOnBackgroundThread ( Task * task , <nl> - ExpectedRuntime expected_runtime ) override { } <nl> - <nl> - void CallOnForegroundThread ( Isolate * isolate , Task * task ) override { } <nl> - <nl> - void CallDelayedOnForegroundThread ( Isolate * isolate , Task * task , <nl> - double delay_in_seconds ) override { } <nl> - <nl> - double MonotonicallyIncreasingTime ( ) override { return 0 . 0 ; } <nl> - <nl> - void CallIdleOnForegroundThread ( Isolate * isolate , IdleTask * task ) override { } <nl> - <nl> - bool IdleTasksEnabled ( Isolate * isolate ) override { return false ; } <nl> - <nl> - v8 : : TracingController * GetTracingController ( ) override { <nl> - return & tracing_controller_ ; <nl> - } <nl> - <nl> - bool PendingIdleTask ( ) { return false ; } <nl> - <nl> - void PerformIdleTask ( double idle_time_in_seconds ) { } <nl> - <nl> - bool PendingDelayedTask ( ) { return false ; } <nl> - <nl> - void PerformDelayedTask ( ) { } <nl> - <nl> - static MockAllocationPlatform * current_platform ; <nl> - bool oom_callback_called = false ; <nl> - <nl> - private : <nl> - v8 : : TracingController tracing_controller_ ; <nl> - <nl> - DISALLOW_COPY_AND_ASSIGN ( MockAllocationPlatform ) ; <nl> - } ; <nl> - <nl> - MockAllocationPlatform * MockAllocationPlatform : : current_platform = nullptr ; <nl> - <nl> - bool DidCallOnCriticalMemoryPressure ( ) { <nl> - return MockAllocationPlatform : : current_platform & & <nl> - MockAllocationPlatform : : current_platform - > oom_callback_called ; <nl> - } <nl> - <nl> - / / No OS should be able to malloc / new this number of bytes . Generate enough <nl> - / / random values in the address space to get a very large fraction of it . Using <nl> - / / even larger values is that overflow from rounding or padding can cause the <nl> - / / allocations to succeed somehow . <nl> - size_t GetHugeMemoryAmount ( ) { <nl> - static size_t huge_memory = 0 ; <nl> - if ( ! huge_memory ) { <nl> - for ( int i = 0 ; i < 100 ; i + + ) { <nl> - huge_memory | = bit_cast < size_t > ( v8 : : base : : OS : : GetRandomMmapAddr ( ) ) ; <nl> - } <nl> - / / Make it larger than the available address space . <nl> - huge_memory * = 2 ; <nl> - CHECK_NE ( 0 , huge_memory ) ; <nl> - } <nl> - return huge_memory ; <nl> - } <nl> - <nl> - void OnMallocedOperatorNewOOM ( const char * location , const char * message ) { <nl> - / / exit ( 0 ) if the OOM callback was called and location matches expectation . <nl> - if ( DidCallOnCriticalMemoryPressure ( ) ) <nl> - exit ( strcmp ( location , " Malloced operator new " ) ) ; <nl> - exit ( 1 ) ; <nl> - } <nl> - <nl> - void OnNewArrayOOM ( const char * location , const char * message ) { <nl> - / / exit ( 0 ) if the OOM callback was called and location matches expectation . <nl> - if ( DidCallOnCriticalMemoryPressure ( ) ) exit ( strcmp ( location , " NewArray " ) ) ; <nl> - exit ( 1 ) ; <nl> - } <nl> - <nl> - void OnAlignedAllocOOM ( const char * location , const char * message ) { <nl> - / / exit ( 0 ) if the OOM callback was called and location matches expectation . <nl> - if ( DidCallOnCriticalMemoryPressure ( ) ) exit ( strcmp ( location , " AlignedAlloc " ) ) ; <nl> - exit ( 1 ) ; <nl> - } <nl> - <nl> - } / / namespace <nl> - <nl> - TEST ( AccountingAllocatorOOM ) { <nl> - / / TODO ( bbudge ) Implement a TemporaryPlatformScope to simplify test code . <nl> - v8 : : Platform * old_platform = i : : V8 : : GetCurrentPlatform ( ) ; <nl> - MockAllocationPlatform platform ; <nl> - i : : V8 : : SetPlatformForTesting ( & platform ) ; <nl> - <nl> - v8 : : internal : : AccountingAllocator allocator ; <nl> - CHECK ( ! platform . oom_callback_called ) ; <nl> - v8 : : internal : : Segment * result = allocator . GetSegment ( GetHugeMemoryAmount ( ) ) ; <nl> - / / On a few systems , allocation somehow succeeds . <nl> - CHECK_EQ ( result = = nullptr , platform . oom_callback_called ) ; <nl> - <nl> - i : : V8 : : SetPlatformForTesting ( old_platform ) ; <nl> - } <nl> - <nl> - TEST ( MallocedOperatorNewOOM ) { <nl> - v8 : : Platform * old_platform = i : : V8 : : GetCurrentPlatform ( ) ; <nl> - MockAllocationPlatform platform ; <nl> - i : : V8 : : SetPlatformForTesting ( & platform ) ; <nl> - <nl> - CHECK ( ! platform . oom_callback_called ) ; <nl> - CcTest : : isolate ( ) - > SetFatalErrorHandler ( OnMallocedOperatorNewOOM ) ; <nl> - / / On failure , this won ' t return , since a Malloced : : New failure is fatal . <nl> - / / In that case , behavior is checked in OnMallocedOperatorNewOOM before exit . <nl> - void * result = v8 : : internal : : Malloced : : New ( GetHugeMemoryAmount ( ) ) ; <nl> - / / On a few systems , allocation somehow succeeds . <nl> - CHECK_EQ ( result = = nullptr , platform . oom_callback_called ) ; <nl> - <nl> - i : : V8 : : SetPlatformForTesting ( old_platform ) ; <nl> - } <nl> - <nl> - TEST ( NewArrayOOM ) { <nl> - v8 : : Platform * old_platform = i : : V8 : : GetCurrentPlatform ( ) ; <nl> - MockAllocationPlatform platform ; <nl> - i : : V8 : : SetPlatformForTesting ( & platform ) ; <nl> - <nl> - CHECK ( ! platform . oom_callback_called ) ; <nl> - CcTest : : isolate ( ) - > SetFatalErrorHandler ( OnNewArrayOOM ) ; <nl> - / / On failure , this won ' t return , since a NewArray failure is fatal . <nl> - / / In that case , behavior is checked in OnNewArrayOOM before exit . <nl> - int8_t * result = v8 : : internal : : NewArray < int8_t > ( GetHugeMemoryAmount ( ) ) ; <nl> - / / On a few systems , allocation somehow succeeds . <nl> - CHECK_EQ ( result = = nullptr , platform . oom_callback_called ) ; <nl> - <nl> - i : : V8 : : SetPlatformForTesting ( old_platform ) ; <nl> - } <nl> - <nl> - TEST ( AlignedAllocOOM ) { <nl> - v8 : : Platform * old_platform = i : : V8 : : GetCurrentPlatform ( ) ; <nl> - MockAllocationPlatform platform ; <nl> - i : : V8 : : SetPlatformForTesting ( & platform ) ; <nl> - <nl> - CHECK ( ! platform . oom_callback_called ) ; <nl> - CcTest : : isolate ( ) - > SetFatalErrorHandler ( OnAlignedAllocOOM ) ; <nl> - / / On failure , this won ' t return , since an AlignedAlloc failure is fatal . <nl> - / / In that case , behavior is checked in OnAlignedAllocOOM before exit . <nl> - void * result = v8 : : internal : : AlignedAlloc ( GetHugeMemoryAmount ( ) , <nl> - v8 : : base : : OS : : AllocateAlignment ( ) ) ; <nl> - / / On a few systems , allocation somehow succeeds . <nl> - CHECK_EQ ( result = = nullptr , platform . oom_callback_called ) ; <nl> - <nl> - i : : V8 : : SetPlatformForTesting ( old_platform ) ; <nl> - } <nl> - <nl> - TEST ( AllocVirtualMemoryOOM ) { <nl> - v8 : : Platform * old_platform = i : : V8 : : GetCurrentPlatform ( ) ; <nl> - MockAllocationPlatform platform ; <nl> - i : : V8 : : SetPlatformForTesting ( & platform ) ; <nl> - <nl> - CHECK ( ! platform . oom_callback_called ) ; <nl> - v8 : : base : : VirtualMemory result ; <nl> - bool success = <nl> - v8 : : internal : : AllocVirtualMemory ( GetHugeMemoryAmount ( ) , nullptr , & result ) ; <nl> - / / On a few systems , allocation somehow succeeds . <nl> - CHECK_IMPLIES ( success , result . IsReserved ( ) ) ; <nl> - CHECK_IMPLIES ( ! success , ! result . IsReserved ( ) & & platform . oom_callback_called ) ; <nl> - <nl> - i : : V8 : : SetPlatformForTesting ( old_platform ) ; <nl> - } <nl> - <nl> - TEST ( AlignedAllocVirtualMemoryOOM ) { <nl> - v8 : : Platform * old_platform = i : : V8 : : GetCurrentPlatform ( ) ; <nl> - MockAllocationPlatform platform ; <nl> - i : : V8 : : SetPlatformForTesting ( & platform ) ; <nl> - <nl> - CHECK ( ! platform . oom_callback_called ) ; <nl> - v8 : : base : : VirtualMemory result ; <nl> - bool success = v8 : : internal : : AlignedAllocVirtualMemory ( <nl> - GetHugeMemoryAmount ( ) , v8 : : base : : OS : : AllocateAlignment ( ) , nullptr , <nl> - & result ) ; <nl> - / / On a few systems , allocation somehow succeeds . <nl> - CHECK_IMPLIES ( success , result . IsReserved ( ) ) ; <nl> - CHECK_IMPLIES ( ! success , ! result . IsReserved ( ) & & platform . oom_callback_called ) ; <nl> - <nl> - i : : V8 : : SetPlatformForTesting ( old_platform ) ; <nl> - } <nl> - <nl> - # endif / / V8_USE_ADDRESS_SANITIZER <nl>
Revert " [ Memory ] Add an OnCriticalMemoryPressure method to V8 : : Platform . "
v8/v8
53db05840e7d3046ae78b2e0326f2c1d7d4f300c
2017-07-29T04:47:49Z
mmm a / modules / gpu / src / cuda / matrix_reductions . cu <nl> ppp b / modules / gpu / src / cuda / matrix_reductions . cu <nl> <nl> <nl> # if ! defined CUDA_DISABLER <nl> <nl> - # include " internal_shared . hpp " <nl> + # include " opencv2 / gpu / device / common . hpp " <nl> # include " opencv2 / gpu / device / limits . hpp " <nl> # include " opencv2 / gpu / device / saturate_cast . hpp " <nl> + # include " opencv2 / gpu / device / vec_traits . hpp " <nl> # include " opencv2 / gpu / device / vec_math . hpp " <nl> + # include " opencv2 / gpu / device / reduce . hpp " <nl> + # include " opencv2 / gpu / device / functional . hpp " <nl> + # include " opencv2 / gpu / device / utility . hpp " <nl> + # include " opencv2 / gpu / device / type_traits . hpp " <nl> <nl> - namespace cv { namespace gpu { namespace device <nl> + using namespace cv : : gpu ; <nl> + using namespace cv : : gpu : : device ; <nl> + <nl> + namespace <nl> { <nl> - namespace matrix_reductions <nl> + template < int cn > struct Unroll ; <nl> + template < > struct Unroll < 1 > <nl> { <nl> - / / Performs reduction in shared memory <nl> - template < int size , typename T > <nl> - __device__ void sumInSmem ( volatile T * data , const uint tid ) <nl> + template < int BLOCK_SIZE , typename R > <nl> + static __device__ __forceinline__ volatile R * smem_tuple ( R * smem ) <nl> { <nl> - T sum = data [ tid ] ; <nl> - <nl> - if ( size > = 512 ) { if ( tid < 256 ) { data [ tid ] = sum = sum + data [ tid + 256 ] ; } __syncthreads ( ) ; } <nl> - if ( size > = 256 ) { if ( tid < 128 ) { data [ tid ] = sum = sum + data [ tid + 128 ] ; } __syncthreads ( ) ; } <nl> - if ( size > = 128 ) { if ( tid < 64 ) { data [ tid ] = sum = sum + data [ tid + 64 ] ; } __syncthreads ( ) ; } <nl> + return smem ; <nl> + } <nl> <nl> - if ( tid < 32 ) <nl> - { <nl> - if ( size > = 64 ) data [ tid ] = sum = sum + data [ tid + 32 ] ; <nl> - if ( size > = 32 ) data [ tid ] = sum = sum + data [ tid + 16 ] ; <nl> - if ( size > = 16 ) data [ tid ] = sum = sum + data [ tid + 8 ] ; <nl> - if ( size > = 8 ) data [ tid ] = sum = sum + data [ tid + 4 ] ; <nl> - if ( size > = 4 ) data [ tid ] = sum = sum + data [ tid + 2 ] ; <nl> - if ( size > = 2 ) data [ tid ] = sum = sum + data [ tid + 1 ] ; <nl> - } <nl> + template < typename R > <nl> + static __device__ __forceinline__ R & tie ( R & val ) <nl> + { <nl> + return val ; <nl> } <nl> <nl> - struct Mask8U <nl> + template < class Op > <nl> + static __device__ __forceinline__ const Op & op ( const Op & op ) <nl> + { <nl> + return op ; <nl> + } <nl> + } ; <nl> + template < > struct Unroll < 2 > <nl> + { <nl> + template < int BLOCK_SIZE , typename R > <nl> + static __device__ __forceinline__ thrust : : tuple < volatile R * , volatile R * > smem_tuple ( R * smem ) <nl> { <nl> - explicit Mask8U ( PtrStepb mask_ ) : mask ( mask_ ) { } <nl> + return cv : : gpu : : device : : smem_tuple ( smem , smem + BLOCK_SIZE ) ; <nl> + } <nl> <nl> - __device__ __forceinline__ bool operator ( ) ( int y , int x ) const <nl> - { <nl> - return mask . ptr ( y ) [ x ] ; <nl> - } <nl> + template < typename R > <nl> + static __device__ __forceinline__ thrust : : tuple < typename VecTraits < R > : : elem_type & , typename VecTraits < R > : : elem_type & > tie ( R & val ) <nl> + { <nl> + return thrust : : tie ( val . x , val . y ) ; <nl> + } <nl> <nl> - PtrStepb mask ; <nl> - } ; <nl> + template < class Op > <nl> + static __device__ __forceinline__ const thrust : : tuple < Op , Op > op ( const Op & op ) <nl> + { <nl> + return thrust : : make_tuple ( op , op ) ; <nl> + } <nl> + } ; <nl> + template < > struct Unroll < 3 > <nl> + { <nl> + template < int BLOCK_SIZE , typename R > <nl> + static __device__ __forceinline__ thrust : : tuple < volatile R * , volatile R * , volatile R * > smem_tuple ( R * smem ) <nl> + { <nl> + return cv : : gpu : : device : : smem_tuple ( smem , smem + BLOCK_SIZE , smem + 2 * BLOCK_SIZE ) ; <nl> + } <nl> <nl> - struct MaskTrue <nl> + template < typename R > <nl> + static __device__ __forceinline__ thrust : : tuple < typename VecTraits < R > : : elem_type & , typename VecTraits < R > : : elem_type & , typename VecTraits < R > : : elem_type & > tie ( R & val ) <nl> { <nl> - __device__ __forceinline__ bool operator ( ) ( int y , int x ) const <nl> - { <nl> - return true ; <nl> - } <nl> - __device__ __forceinline__ MaskTrue ( ) { } <nl> - __device__ __forceinline__ MaskTrue ( const MaskTrue & mask_ ) { } <nl> - } ; <nl> + return thrust : : tie ( val . x , val . y , val . z ) ; <nl> + } <nl> <nl> - / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / <nl> - / / Min max <nl> - <nl> - / / To avoid shared bank conflicts we convert each value into value of <nl> - / / appropriate type ( 32 bits minimum ) <nl> - template < typename T > struct MinMaxTypeTraits { } ; <nl> - template < > struct MinMaxTypeTraits < uchar > { typedef int best_type ; } ; <nl> - template < > struct MinMaxTypeTraits < char > { typedef int best_type ; } ; <nl> - template < > struct MinMaxTypeTraits < ushort > { typedef int best_type ; } ; <nl> - template < > struct MinMaxTypeTraits < short > { typedef int best_type ; } ; <nl> - template < > struct MinMaxTypeTraits < int > { typedef int best_type ; } ; <nl> - template < > struct MinMaxTypeTraits < float > { typedef float best_type ; } ; <nl> - template < > struct MinMaxTypeTraits < double > { typedef double best_type ; } ; <nl> - <nl> - namespace minmax <nl> + template < class Op > <nl> + static __device__ __forceinline__ const thrust : : tuple < Op , Op , Op > op ( const Op & op ) <nl> { <nl> - __constant__ int ctwidth ; <nl> - __constant__ int ctheight ; <nl> + return thrust : : make_tuple ( op , op , op ) ; <nl> + } <nl> + } ; <nl> + template < > struct Unroll < 4 > <nl> + { <nl> + template < int BLOCK_SIZE , typename R > <nl> + static __device__ __forceinline__ thrust : : tuple < volatile R * , volatile R * , volatile R * , volatile R * > smem_tuple ( R * smem ) <nl> + { <nl> + return cv : : gpu : : device : : smem_tuple ( smem , smem + BLOCK_SIZE , smem + 2 * BLOCK_SIZE , smem + 3 * BLOCK_SIZE ) ; <nl> + } <nl> <nl> - / / Global counter of blocks finished its work <nl> - __device__ uint blocks_finished = 0 ; <nl> + template < typename R > <nl> + static __device__ __forceinline__ thrust : : tuple < typename VecTraits < R > : : elem_type & , typename VecTraits < R > : : elem_type & , typename VecTraits < R > : : elem_type & , typename VecTraits < R > : : elem_type & > tie ( R & val ) <nl> + { <nl> + return thrust : : tie ( val . x , val . y , val . z , val . w ) ; <nl> + } <nl> <nl> + template < class Op > <nl> + static __device__ __forceinline__ const thrust : : tuple < Op , Op , Op , Op > op ( const Op & op ) <nl> + { <nl> + return thrust : : make_tuple ( op , op , op , op ) ; <nl> + } <nl> + } ; <nl> + } <nl> <nl> - / / Estimates good thread configuration <nl> - / / - threads variable satisfies to threads . x * threads . y = = 256 <nl> - void estimateThreadCfg ( int cols , int rows , dim3 & threads , dim3 & grid ) <nl> - { <nl> - threads = dim3 ( 32 , 8 ) ; <nl> - grid = dim3 ( divUp ( cols , threads . x * 8 ) , divUp ( rows , threads . y * 32 ) ) ; <nl> - grid . x = std : : min ( grid . x , threads . x ) ; <nl> - grid . y = std : : min ( grid . y , threads . y ) ; <nl> - } <nl> + / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / <nl> + / / sum <nl> <nl> + namespace sum <nl> + { <nl> + __device__ unsigned int blocks_finished = 0 ; <nl> <nl> - / / Returns required buffer sizes <nl> - void getBufSizeRequired ( int cols , int rows , int elem_size , int & bufcols , int & bufrows ) <nl> - { <nl> - dim3 threads , grid ; <nl> - estimateThreadCfg ( cols , rows , threads , grid ) ; <nl> - bufcols = grid . x * grid . y * elem_size ; <nl> - bufrows = 2 ; <nl> - } <nl> + template < typename R , int cn > struct AtomicAdd ; <nl> + template < typename R > struct AtomicAdd < R , 1 > <nl> + { <nl> + static __device__ void run ( R * ptr , R val ) <nl> + { <nl> + : : atomicAdd ( ptr , val ) ; <nl> + } <nl> + } ; <nl> + template < typename R > struct AtomicAdd < R , 2 > <nl> + { <nl> + typedef typename TypeVec < R , 2 > : : vec_type val_type ; <nl> <nl> + static __device__ void run ( R * ptr , val_type val ) <nl> + { <nl> + : : atomicAdd ( ptr , val . x ) ; <nl> + : : atomicAdd ( ptr + 1 , val . y ) ; <nl> + } <nl> + } ; <nl> + template < typename R > struct AtomicAdd < R , 3 > <nl> + { <nl> + typedef typename TypeVec < R , 3 > : : vec_type val_type ; <nl> <nl> - / / Estimates device constants which are used in the kernels using specified thread configuration <nl> - void setKernelConsts ( int cols , int rows , const dim3 & threads , const dim3 & grid ) <nl> - { <nl> - int twidth = divUp ( divUp ( cols , grid . x ) , threads . x ) ; <nl> - int theight = divUp ( divUp ( rows , grid . y ) , threads . y ) ; <nl> - cudaSafeCall ( cudaMemcpyToSymbol ( ctwidth , & twidth , sizeof ( ctwidth ) ) ) ; <nl> - cudaSafeCall ( cudaMemcpyToSymbol ( ctheight , & theight , sizeof ( ctheight ) ) ) ; <nl> - } <nl> + static __device__ void run ( R * ptr , val_type val ) <nl> + { <nl> + : : atomicAdd ( ptr , val . x ) ; <nl> + : : atomicAdd ( ptr + 1 , val . y ) ; <nl> + : : atomicAdd ( ptr + 2 , val . z ) ; <nl> + } <nl> + } ; <nl> + template < typename R > struct AtomicAdd < R , 4 > <nl> + { <nl> + typedef typename TypeVec < R , 4 > : : vec_type val_type ; <nl> <nl> + static __device__ void run ( R * ptr , val_type val ) <nl> + { <nl> + : : atomicAdd ( ptr , val . x ) ; <nl> + : : atomicAdd ( ptr + 1 , val . y ) ; <nl> + : : atomicAdd ( ptr + 2 , val . z ) ; <nl> + : : atomicAdd ( ptr + 3 , val . w ) ; <nl> + } <nl> + } ; <nl> <nl> - / / Does min and max in shared memory <nl> - template < typename T > <nl> - __device__ __forceinline__ void merge ( uint tid , uint offset , volatile T * minval , volatile T * maxval ) <nl> - { <nl> - minval [ tid ] = : : min ( minval [ tid ] , minval [ tid + offset ] ) ; <nl> - maxval [ tid ] = : : max ( maxval [ tid ] , maxval [ tid + offset ] ) ; <nl> - } <nl> + template < int BLOCK_SIZE , typename R , int cn > <nl> + struct GlobalReduce <nl> + { <nl> + typedef typename TypeVec < R , cn > : : vec_type result_type ; <nl> <nl> + static __device__ void run ( result_type & sum , result_type * result , int tid , int bid , R * smem ) <nl> + { <nl> + # if __CUDA_ARCH__ > = 200 <nl> + if ( tid = = 0 ) <nl> + AtomicAdd < R , cn > : : run ( ( R * ) result , sum ) ; <nl> + # else <nl> + __shared__ bool is_last ; <nl> <nl> - template < int size , typename T > <nl> - __device__ void findMinMaxInSmem ( volatile T * minval , volatile T * maxval , const uint tid ) <nl> + if ( tid = = 0 ) <nl> { <nl> - if ( size > = 512 ) { if ( tid < 256 ) { merge ( tid , 256 , minval , maxval ) ; } __syncthreads ( ) ; } <nl> - if ( size > = 256 ) { if ( tid < 128 ) { merge ( tid , 128 , minval , maxval ) ; } __syncthreads ( ) ; } <nl> - if ( size > = 128 ) { if ( tid < 64 ) { merge ( tid , 64 , minval , maxval ) ; } __syncthreads ( ) ; } <nl> + result [ bid ] = sum ; <nl> <nl> - if ( tid < 32 ) <nl> - { <nl> - if ( size > = 64 ) merge ( tid , 32 , minval , maxval ) ; <nl> - if ( size > = 32 ) merge ( tid , 16 , minval , maxval ) ; <nl> - if ( size > = 16 ) merge ( tid , 8 , minval , maxval ) ; <nl> - if ( size > = 8 ) merge ( tid , 4 , minval , maxval ) ; <nl> - if ( size > = 4 ) merge ( tid , 2 , minval , maxval ) ; <nl> - if ( size > = 2 ) merge ( tid , 1 , minval , maxval ) ; <nl> - } <nl> + __threadfence ( ) ; <nl> + <nl> + unsigned int ticket = : : atomicAdd ( & blocks_finished , 1 ) ; <nl> + is_last = ( ticket = = gridDim . x * gridDim . y - 1 ) ; <nl> } <nl> <nl> + __syncthreads ( ) ; <nl> <nl> - template < int nthreads , typename T , typename Mask > <nl> - __global__ void minMaxKernel ( const PtrStepSzb src , Mask mask , T * minval , T * maxval ) <nl> + if ( is_last ) <nl> { <nl> - typedef typename MinMaxTypeTraits < T > : : best_type best_type ; <nl> - __shared__ best_type sminval [ nthreads ] ; <nl> - __shared__ best_type smaxval [ nthreads ] ; <nl> - <nl> - uint x0 = blockIdx . x * blockDim . x * ctwidth + threadIdx . x ; <nl> - uint y0 = blockIdx . y * blockDim . y * ctheight + threadIdx . y ; <nl> - uint tid = threadIdx . y * blockDim . x + threadIdx . x ; <nl> - <nl> - T mymin = numeric_limits < T > : : max ( ) ; <nl> - T mymax = numeric_limits < T > : : is_signed ? - numeric_limits < T > : : max ( ) : numeric_limits < T > : : min ( ) ; <nl> - uint y_end = : : min ( y0 + ( ctheight - 1 ) * blockDim . y + 1 , src . rows ) ; <nl> - uint x_end = : : min ( x0 + ( ctwidth - 1 ) * blockDim . x + 1 , src . cols ) ; <nl> - for ( uint y = y0 ; y < y_end ; y + = blockDim . y ) <nl> - { <nl> - const T * src_row = ( const T * ) src . ptr ( y ) ; <nl> - for ( uint x = x0 ; x < x_end ; x + = blockDim . x ) <nl> - { <nl> - T val = src_row [ x ] ; <nl> - if ( mask ( y , x ) ) <nl> - { <nl> - mymin = : : min ( mymin , val ) ; <nl> - mymax = : : max ( mymax , val ) ; <nl> - } <nl> - } <nl> - } <nl> - <nl> - sminval [ tid ] = mymin ; <nl> - smaxval [ tid ] = mymax ; <nl> - __syncthreads ( ) ; <nl> + sum = tid < gridDim . x * gridDim . y ? result [ tid ] : VecTraits < result_type > : : all ( 0 ) ; <nl> <nl> - findMinMaxInSmem < nthreads , best_type > ( sminval , smaxval , tid ) ; <nl> + device : : reduce < BLOCK_SIZE > ( Unroll < cn > : : template smem_tuple < BLOCK_SIZE > ( smem ) , Unroll < cn > : : tie ( sum ) , tid , Unroll < cn > : : op ( plus < R > ( ) ) ) ; <nl> <nl> if ( tid = = 0 ) <nl> { <nl> - minval [ blockIdx . y * gridDim . x + blockIdx . x ] = ( T ) sminval [ 0 ] ; <nl> - maxval [ blockIdx . y * gridDim . x + blockIdx . x ] = ( T ) smaxval [ 0 ] ; <nl> + result [ 0 ] = sum ; <nl> + blocks_finished = 0 ; <nl> } <nl> - <nl> - # if defined ( __CUDA_ARCH__ ) & & ( __CUDA_ARCH__ > = 110 ) <nl> - __shared__ bool is_last ; <nl> - <nl> - if ( tid = = 0 ) <nl> - { <nl> - minval [ blockIdx . y * gridDim . x + blockIdx . x ] = ( T ) sminval [ 0 ] ; <nl> - maxval [ blockIdx . y * gridDim . x + blockIdx . x ] = ( T ) smaxval [ 0 ] ; <nl> - __threadfence ( ) ; <nl> - <nl> - uint ticket = atomicInc ( & blocks_finished , gridDim . x * gridDim . y ) ; <nl> - is_last = ticket = = gridDim . x * gridDim . y - 1 ; <nl> - } <nl> - <nl> - __syncthreads ( ) ; <nl> - <nl> - if ( is_last ) <nl> - { <nl> - uint idx = : : min ( tid , gridDim . x * gridDim . y - 1 ) ; <nl> - <nl> - sminval [ tid ] = minval [ idx ] ; <nl> - smaxval [ tid ] = maxval [ idx ] ; <nl> - __syncthreads ( ) ; <nl> - <nl> - findMinMaxInSmem < nthreads , best_type > ( sminval , smaxval , tid ) ; <nl> - <nl> - if ( tid = = 0 ) <nl> - { <nl> - minval [ 0 ] = ( T ) sminval [ 0 ] ; <nl> - maxval [ 0 ] = ( T ) smaxval [ 0 ] ; <nl> - blocks_finished = 0 ; <nl> - } <nl> - } <nl> - # else <nl> - if ( tid = = 0 ) <nl> - { <nl> - minval [ blockIdx . y * gridDim . x + blockIdx . x ] = ( T ) sminval [ 0 ] ; <nl> - maxval [ blockIdx . y * gridDim . x + blockIdx . x ] = ( T ) smaxval [ 0 ] ; <nl> - } <nl> - # endif <nl> - } <nl> - <nl> - <nl> - template < typename T > <nl> - void minMaxMaskCaller ( const PtrStepSzb src , const PtrStepb mask , double * minval , double * maxval , PtrStepb buf ) <nl> - { <nl> - dim3 threads , grid ; <nl> - estimateThreadCfg ( src . cols , src . rows , threads , grid ) ; <nl> - setKernelConsts ( src . cols , src . rows , threads , grid ) ; <nl> - <nl> - T * minval_buf = ( T * ) buf . ptr ( 0 ) ; <nl> - T * maxval_buf = ( T * ) buf . ptr ( 1 ) ; <nl> - <nl> - minMaxKernel < 256 , T , Mask8U > < < < grid , threads > > > ( src , Mask8U ( mask ) , minval_buf , maxval_buf ) ; <nl> - cudaSafeCall ( cudaGetLastError ( ) ) ; <nl> - <nl> - cudaSafeCall ( cudaDeviceSynchronize ( ) ) ; <nl> - <nl> - T minval_ , maxval_ ; <nl> - cudaSafeCall ( cudaMemcpy ( & minval_ , minval_buf , sizeof ( T ) , cudaMemcpyDeviceToHost ) ) ; <nl> - cudaSafeCall ( cudaMemcpy ( & maxval_ , maxval_buf , sizeof ( T ) , cudaMemcpyDeviceToHost ) ) ; <nl> - * minval = minval_ ; <nl> - * maxval = maxval_ ; <nl> } <nl> + # endif <nl> + } <nl> + } ; <nl> + template < int BLOCK_SIZE , int cn > <nl> + struct GlobalReduce < BLOCK_SIZE , double , cn > <nl> + { <nl> + typedef typename TypeVec < double , cn > : : vec_type result_type ; <nl> <nl> - template void minMaxMaskCaller < uchar > ( const PtrStepSzb , const PtrStepb , double * , double * , PtrStepb ) ; <nl> - template void minMaxMaskCaller < char > ( const PtrStepSzb , const PtrStepb , double * , double * , PtrStepb ) ; <nl> - template void minMaxMaskCaller < ushort > ( const PtrStepSzb , const PtrStepb , double * , double * , PtrStepb ) ; <nl> - template void minMaxMaskCaller < short > ( const PtrStepSzb , const PtrStepb , double * , double * , PtrStepb ) ; <nl> - template void minMaxMaskCaller < int > ( const PtrStepSzb , const PtrStepb , double * , double * , PtrStepb ) ; <nl> - template void minMaxMaskCaller < float > ( const PtrStepSzb , const PtrStepb , double * , double * , PtrStepb ) ; <nl> - template void minMaxMaskCaller < double > ( const PtrStepSzb , const PtrStepb , double * , double * , PtrStepb ) ; <nl> - <nl> + static __device__ void run ( result_type & sum , result_type * result , int tid , int bid , double * smem ) <nl> + { <nl> + __shared__ bool is_last ; <nl> <nl> - template < typename T > <nl> - void minMaxCaller ( const PtrStepSzb src , double * minval , double * maxval , PtrStepb buf ) <nl> + if ( tid = = 0 ) <nl> { <nl> - dim3 threads , grid ; <nl> - estimateThreadCfg ( src . cols , src . rows , threads , grid ) ; <nl> - setKernelConsts ( src . cols , src . rows , threads , grid ) ; <nl> - <nl> - T * minval_buf = ( T * ) buf . ptr ( 0 ) ; <nl> - T * maxval_buf = ( T * ) buf . ptr ( 1 ) ; <nl> - <nl> - minMaxKernel < 256 , T , MaskTrue > < < < grid , threads > > > ( src , MaskTrue ( ) , minval_buf , maxval_buf ) ; <nl> - cudaSafeCall ( cudaGetLastError ( ) ) ; <nl> + result [ bid ] = sum ; <nl> <nl> - cudaSafeCall ( cudaDeviceSynchronize ( ) ) ; <nl> + __threadfence ( ) ; <nl> <nl> - T minval_ , maxval_ ; <nl> - cudaSafeCall ( cudaMemcpy ( & minval_ , minval_buf , sizeof ( T ) , cudaMemcpyDeviceToHost ) ) ; <nl> - cudaSafeCall ( cudaMemcpy ( & maxval_ , maxval_buf , sizeof ( T ) , cudaMemcpyDeviceToHost ) ) ; <nl> - * minval = minval_ ; <nl> - * maxval = maxval_ ; <nl> + unsigned int ticket = : : atomicAdd ( & blocks_finished , 1 ) ; <nl> + is_last = ( ticket = = gridDim . x * gridDim . y - 1 ) ; <nl> } <nl> <nl> - template void minMaxCaller < uchar > ( const PtrStepSzb , double * , double * , PtrStepb ) ; <nl> - template void minMaxCaller < char > ( const PtrStepSzb , double * , double * , PtrStepb ) ; <nl> - template void minMaxCaller < ushort > ( const PtrStepSzb , double * , double * , PtrStepb ) ; <nl> - template void minMaxCaller < short > ( const PtrStepSzb , double * , double * , PtrStepb ) ; <nl> - template void minMaxCaller < int > ( const PtrStepSzb , double * , double * , PtrStepb ) ; <nl> - template void minMaxCaller < float > ( const PtrStepSzb , double * , double * , PtrStepb ) ; <nl> - template void minMaxCaller < double > ( const PtrStepSzb , double * , double * , PtrStepb ) ; <nl> - <nl> + __syncthreads ( ) ; <nl> <nl> - template < int nthreads , typename T > <nl> - __global__ void minMaxPass2Kernel ( T * minval , T * maxval , int size ) <nl> + if ( is_last ) <nl> { <nl> - typedef typename MinMaxTypeTraits < T > : : best_type best_type ; <nl> - __shared__ best_type sminval [ nthreads ] ; <nl> - __shared__ best_type smaxval [ nthreads ] ; <nl> - <nl> - uint tid = threadIdx . y * blockDim . x + threadIdx . x ; <nl> - uint idx = : : min ( tid , size - 1 ) ; <nl> - <nl> - sminval [ tid ] = minval [ idx ] ; <nl> - smaxval [ tid ] = maxval [ idx ] ; <nl> - __syncthreads ( ) ; <nl> + sum = tid < gridDim . x * gridDim . y ? result [ tid ] : VecTraits < result_type > : : all ( 0 ) ; <nl> <nl> - findMinMaxInSmem < nthreads , best_type > ( sminval , smaxval , tid ) ; <nl> + device : : reduce < BLOCK_SIZE > ( Unroll < cn > : : template smem_tuple < BLOCK_SIZE > ( smem ) , Unroll < cn > : : tie ( sum ) , tid , Unroll < cn > : : op ( plus < double > ( ) ) ) ; <nl> <nl> if ( tid = = 0 ) <nl> { <nl> - minval [ 0 ] = ( T ) sminval [ 0 ] ; <nl> - maxval [ 0 ] = ( T ) smaxval [ 0 ] ; <nl> + result [ 0 ] = sum ; <nl> + blocks_finished = 0 ; <nl> } <nl> } <nl> + } <nl> + } ; <nl> <nl> + template < int BLOCK_SIZE , typename src_type , typename result_type , class Op > <nl> + __global__ void kernel ( const PtrStepSz < src_type > src , result_type * result , const Op op , const int twidth , const int theight ) <nl> + { <nl> + typedef typename VecTraits < src_type > : : elem_type T ; <nl> + typedef typename VecTraits < result_type > : : elem_type R ; <nl> + const int cn = VecTraits < src_type > : : cn ; <nl> <nl> - template < typename T > <nl> - void minMaxMaskMultipassCaller ( const PtrStepSzb src , const PtrStepb mask , double * minval , double * maxval , PtrStepb buf ) <nl> - { <nl> - dim3 threads , grid ; <nl> - estimateThreadCfg ( src . cols , src . rows , threads , grid ) ; <nl> - setKernelConsts ( src . cols , src . rows , threads , grid ) ; <nl> - <nl> - T * minval_buf = ( T * ) buf . ptr ( 0 ) ; <nl> - T * maxval_buf = ( T * ) buf . ptr ( 1 ) ; <nl> - <nl> - minMaxKernel < 256 , T , Mask8U > < < < grid , threads > > > ( src , Mask8U ( mask ) , minval_buf , maxval_buf ) ; <nl> - cudaSafeCall ( cudaGetLastError ( ) ) ; <nl> - minMaxPass2Kernel < 256 , T > < < < 1 , 256 > > > ( minval_buf , maxval_buf , grid . x * grid . y ) ; <nl> - cudaSafeCall ( cudaGetLastError ( ) ) ; <nl> - <nl> - cudaSafeCall ( cudaDeviceSynchronize ( ) ) ; <nl> - <nl> - T minval_ , maxval_ ; <nl> - cudaSafeCall ( cudaMemcpy ( & minval_ , minval_buf , sizeof ( T ) , cudaMemcpyDeviceToHost ) ) ; <nl> - cudaSafeCall ( cudaMemcpy ( & maxval_ , maxval_buf , sizeof ( T ) , cudaMemcpyDeviceToHost ) ) ; <nl> - * minval = minval_ ; <nl> - * maxval = maxval_ ; <nl> - } <nl> - <nl> - template void minMaxMaskMultipassCaller < uchar > ( const PtrStepSzb , const PtrStepb , double * , double * , PtrStepb ) ; <nl> - template void minMaxMaskMultipassCaller < char > ( const PtrStepSzb , const PtrStepb , double * , double * , PtrStepb ) ; <nl> - template void minMaxMaskMultipassCaller < ushort > ( const PtrStepSzb , const PtrStepb , double * , double * , PtrStepb ) ; <nl> - template void minMaxMaskMultipassCaller < short > ( const PtrStepSzb , const PtrStepb , double * , double * , PtrStepb ) ; <nl> - template void minMaxMaskMultipassCaller < int > ( const PtrStepSzb , const PtrStepb , double * , double * , PtrStepb ) ; <nl> - template void minMaxMaskMultipassCaller < float > ( const PtrStepSzb , const PtrStepb , double * , double * , PtrStepb ) ; <nl> - <nl> - <nl> - template < typename T > <nl> - void minMaxMultipassCaller ( const PtrStepSzb src , double * minval , double * maxval , PtrStepb buf ) <nl> - { <nl> - dim3 threads , grid ; <nl> - estimateThreadCfg ( src . cols , src . rows , threads , grid ) ; <nl> - setKernelConsts ( src . cols , src . rows , threads , grid ) ; <nl> - <nl> - T * minval_buf = ( T * ) buf . ptr ( 0 ) ; <nl> - T * maxval_buf = ( T * ) buf . ptr ( 1 ) ; <nl> - <nl> - minMaxKernel < 256 , T , MaskTrue > < < < grid , threads > > > ( src , MaskTrue ( ) , minval_buf , maxval_buf ) ; <nl> - cudaSafeCall ( cudaGetLastError ( ) ) ; <nl> - minMaxPass2Kernel < 256 , T > < < < 1 , 256 > > > ( minval_buf , maxval_buf , grid . x * grid . y ) ; <nl> - cudaSafeCall ( cudaGetLastError ( ) ) ; <nl> - <nl> - cudaSafeCall ( cudaDeviceSynchronize ( ) ) ; <nl> + __shared__ R smem [ BLOCK_SIZE * cn ] ; <nl> <nl> - T minval_ , maxval_ ; <nl> - cudaSafeCall ( cudaMemcpy ( & minval_ , minval_buf , sizeof ( T ) , cudaMemcpyDeviceToHost ) ) ; <nl> - cudaSafeCall ( cudaMemcpy ( & maxval_ , maxval_buf , sizeof ( T ) , cudaMemcpyDeviceToHost ) ) ; <nl> - * minval = minval_ ; <nl> - * maxval = maxval_ ; <nl> - } <nl> + const int x0 = blockIdx . x * blockDim . x * twidth + threadIdx . x ; <nl> + const int y0 = blockIdx . y * blockDim . y * theight + threadIdx . y ; <nl> <nl> - template void minMaxMultipassCaller < uchar > ( const PtrStepSzb , double * , double * , PtrStepb ) ; <nl> - template void minMaxMultipassCaller < char > ( const PtrStepSzb , double * , double * , PtrStepb ) ; <nl> - template void minMaxMultipassCaller < ushort > ( const PtrStepSzb , double * , double * , PtrStepb ) ; <nl> - template void minMaxMultipassCaller < short > ( const PtrStepSzb , double * , double * , PtrStepb ) ; <nl> - template void minMaxMultipassCaller < int > ( const PtrStepSzb , double * , double * , PtrStepb ) ; <nl> - template void minMaxMultipassCaller < float > ( const PtrStepSzb , double * , double * , PtrStepb ) ; <nl> - } / / namespace minmax <nl> + const int tid = threadIdx . y * blockDim . x + threadIdx . x ; <nl> + const int bid = blockIdx . y * gridDim . x + blockIdx . x ; <nl> <nl> - / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / <nl> - / / minMaxLoc <nl> + result_type sum = VecTraits < result_type > : : all ( 0 ) ; <nl> <nl> - namespace minmaxloc <nl> + for ( int i = 0 , y = y0 ; i < theight & & y < src . rows ; + + i , y + = blockDim . y ) <nl> { <nl> - __constant__ int ctwidth ; <nl> - __constant__ int ctheight ; <nl> + const src_type * ptr = src . ptr ( y ) ; <nl> <nl> - / / Global counter of blocks finished its work <nl> - __device__ uint blocks_finished = 0 ; <nl> - <nl> - <nl> - / / Estimates good thread configuration <nl> - / / - threads variable satisfies to threads . x * threads . y = = 256 <nl> - void estimateThreadCfg ( int cols , int rows , dim3 & threads , dim3 & grid ) <nl> + for ( int j = 0 , x = x0 ; j < twidth & & x < src . cols ; + + j , x + = blockDim . x ) <nl> { <nl> - threads = dim3 ( 32 , 8 ) ; <nl> - grid = dim3 ( divUp ( cols , threads . x * 8 ) , divUp ( rows , threads . y * 32 ) ) ; <nl> - grid . x = std : : min ( grid . x , threads . x ) ; <nl> - grid . y = std : : min ( grid . y , threads . y ) ; <nl> - } <nl> - <nl> + const src_type srcVal = ptr [ x ] ; <nl> <nl> - / / Returns required buffer sizes <nl> - void getBufSizeRequired ( int cols , int rows , int elem_size , int & b1cols , <nl> - int & b1rows , int & b2cols , int & b2rows ) <nl> - { <nl> - dim3 threads , grid ; <nl> - estimateThreadCfg ( cols , rows , threads , grid ) ; <nl> - b1cols = grid . x * grid . y * elem_size ; / / For values <nl> - b1rows = 2 ; <nl> - b2cols = grid . x * grid . y * sizeof ( int ) ; / / For locations <nl> - b2rows = 2 ; <nl> + sum = sum + op ( saturate_cast < result_type > ( srcVal ) ) ; <nl> } <nl> + } <nl> <nl> + device : : reduce < BLOCK_SIZE > ( Unroll < cn > : : template smem_tuple < BLOCK_SIZE > ( smem ) , Unroll < cn > : : tie ( sum ) , tid , Unroll < cn > : : op ( plus < R > ( ) ) ) ; <nl> <nl> - / / Estimates device constants which are used in the kernels using specified thread configuration <nl> - void setKernelConsts ( int cols , int rows , const dim3 & threads , const dim3 & grid ) <nl> - { <nl> - int twidth = divUp ( divUp ( cols , grid . x ) , threads . x ) ; <nl> - int theight = divUp ( divUp ( rows , grid . y ) , threads . y ) ; <nl> - cudaSafeCall ( cudaMemcpyToSymbol ( ctwidth , & twidth , sizeof ( ctwidth ) ) ) ; <nl> - cudaSafeCall ( cudaMemcpyToSymbol ( ctheight , & theight , sizeof ( ctheight ) ) ) ; <nl> - } <nl> + GlobalReduce < BLOCK_SIZE , R , cn > : : run ( sum , result , tid , bid , smem ) ; <nl> + } <nl> <nl> + const int threads_x = 32 ; <nl> + const int threads_y = 8 ; <nl> <nl> - template < typename T > <nl> - __device__ void merge ( uint tid , uint offset , volatile T * minval , volatile T * maxval , <nl> - volatile uint * minloc , volatile uint * maxloc ) <nl> - { <nl> - T val = minval [ tid + offset ] ; <nl> - if ( val < minval [ tid ] ) <nl> - { <nl> - minval [ tid ] = val ; <nl> - minloc [ tid ] = minloc [ tid + offset ] ; <nl> - } <nl> - val = maxval [ tid + offset ] ; <nl> - if ( val > maxval [ tid ] ) <nl> - { <nl> - maxval [ tid ] = val ; <nl> - maxloc [ tid ] = maxloc [ tid + offset ] ; <nl> - } <nl> - } <nl> + void getLaunchCfg ( int cols , int rows , dim3 & block , dim3 & grid ) <nl> + { <nl> + block = dim3 ( threads_x , threads_y ) ; <nl> <nl> + grid = dim3 ( divUp ( cols , block . x * block . y ) , <nl> + divUp ( rows , block . y * block . x ) ) ; <nl> <nl> - template < int size , typename T > <nl> - __device__ void findMinMaxLocInSmem ( volatile T * minval , volatile T * maxval , volatile uint * minloc , <nl> - volatile uint * maxloc , const uint tid ) <nl> - { <nl> - if ( size > = 512 ) { if ( tid < 256 ) { merge ( tid , 256 , minval , maxval , minloc , maxloc ) ; } __syncthreads ( ) ; } <nl> - if ( size > = 256 ) { if ( tid < 128 ) { merge ( tid , 128 , minval , maxval , minloc , maxloc ) ; } __syncthreads ( ) ; } <nl> - if ( size > = 128 ) { if ( tid < 64 ) { merge ( tid , 64 , minval , maxval , minloc , maxloc ) ; } __syncthreads ( ) ; } <nl> + grid . x = : : min ( grid . x , block . x ) ; <nl> + grid . y = : : min ( grid . y , block . y ) ; <nl> + } <nl> <nl> - if ( tid < 32 ) <nl> - { <nl> - if ( size > = 64 ) merge ( tid , 32 , minval , maxval , minloc , maxloc ) ; <nl> - if ( size > = 32 ) merge ( tid , 16 , minval , maxval , minloc , maxloc ) ; <nl> - if ( size > = 16 ) merge ( tid , 8 , minval , maxval , minloc , maxloc ) ; <nl> - if ( size > = 8 ) merge ( tid , 4 , minval , maxval , minloc , maxloc ) ; <nl> - if ( size > = 4 ) merge ( tid , 2 , minval , maxval , minloc , maxloc ) ; <nl> - if ( size > = 2 ) merge ( tid , 1 , minval , maxval , minloc , maxloc ) ; <nl> - } <nl> - } <nl> + void getBufSize ( int cols , int rows , int cn , int & bufcols , int & bufrows ) <nl> + { <nl> + dim3 block , grid ; <nl> + getLaunchCfg ( cols , rows , block , grid ) ; <nl> <nl> + bufcols = grid . x * grid . y * sizeof ( double ) * cn ; <nl> + bufrows = 1 ; <nl> + } <nl> <nl> - template < int nthreads , typename T , typename Mask > <nl> - __global__ void minMaxLocKernel ( const PtrStepSzb src , Mask mask , T * minval , T * maxval , <nl> - uint * minloc , uint * maxloc ) <nl> - { <nl> - typedef typename MinMaxTypeTraits < T > : : best_type best_type ; <nl> - __shared__ best_type sminval [ nthreads ] ; <nl> - __shared__ best_type smaxval [ nthreads ] ; <nl> - __shared__ uint sminloc [ nthreads ] ; <nl> - __shared__ uint smaxloc [ nthreads ] ; <nl> - <nl> - uint x0 = blockIdx . x * blockDim . x * ctwidth + threadIdx . x ; <nl> - uint y0 = blockIdx . y * blockDim . y * ctheight + threadIdx . y ; <nl> - uint tid = threadIdx . y * blockDim . x + threadIdx . x ; <nl> - <nl> - T mymin = numeric_limits < T > : : max ( ) ; <nl> - T mymax = numeric_limits < T > : : is_signed ? - numeric_limits < T > : : max ( ) : numeric_limits < T > : : min ( ) ; <nl> - uint myminloc = 0 ; <nl> - uint mymaxloc = 0 ; <nl> - uint y_end = : : min ( y0 + ( ctheight - 1 ) * blockDim . y + 1 , src . rows ) ; <nl> - uint x_end = : : min ( x0 + ( ctwidth - 1 ) * blockDim . x + 1 , src . cols ) ; <nl> - <nl> - for ( uint y = y0 ; y < y_end ; y + = blockDim . y ) <nl> - { <nl> - const T * ptr = ( const T * ) src . ptr ( y ) ; <nl> - for ( uint x = x0 ; x < x_end ; x + = blockDim . x ) <nl> - { <nl> - if ( mask ( y , x ) ) <nl> - { <nl> - T val = ptr [ x ] ; <nl> - if ( val < = mymin ) { mymin = val ; myminloc = y * src . cols + x ; } <nl> - if ( val > = mymax ) { mymax = val ; mymaxloc = y * src . cols + x ; } <nl> - } <nl> - } <nl> - } <nl> + template < typename T , typename R , int cn , template < typename > class Op > <nl> + void caller ( PtrStepSzb src_ , void * buf_ , double * out ) <nl> + { <nl> + typedef typename TypeVec < T , cn > : : vec_type src_type ; <nl> + typedef typename TypeVec < R , cn > : : vec_type result_type ; <nl> <nl> - sminval [ tid ] = mymin ; <nl> - smaxval [ tid ] = mymax ; <nl> - sminloc [ tid ] = myminloc ; <nl> - smaxloc [ tid ] = mymaxloc ; <nl> - __syncthreads ( ) ; <nl> + PtrStepSz < src_type > src ( src_ ) ; <nl> + result_type * buf = ( result_type * ) buf_ ; <nl> <nl> - findMinMaxLocInSmem < nthreads , best_type > ( sminval , smaxval , sminloc , smaxloc , tid ) ; <nl> + dim3 block , grid ; <nl> + getLaunchCfg ( src . cols , src . rows , block , grid ) ; <nl> <nl> - # if defined ( __CUDA_ARCH__ ) & & ( __CUDA_ARCH__ > = 110 ) <nl> - __shared__ bool is_last ; <nl> + const int twidth = divUp ( divUp ( src . cols , grid . x ) , block . x ) ; <nl> + const int theight = divUp ( divUp ( src . rows , grid . y ) , block . y ) ; <nl> <nl> - if ( tid = = 0 ) <nl> - { <nl> - minval [ blockIdx . y * gridDim . x + blockIdx . x ] = ( T ) sminval [ 0 ] ; <nl> - maxval [ blockIdx . y * gridDim . x + blockIdx . x ] = ( T ) smaxval [ 0 ] ; <nl> - minloc [ blockIdx . y * gridDim . x + blockIdx . x ] = sminloc [ 0 ] ; <nl> - maxloc [ blockIdx . y * gridDim . x + blockIdx . x ] = smaxloc [ 0 ] ; <nl> - __threadfence ( ) ; <nl> - <nl> - uint ticket = atomicInc ( & blocks_finished , gridDim . x * gridDim . y ) ; <nl> - is_last = ticket = = gridDim . x * gridDim . y - 1 ; <nl> - } <nl> + Op < result_type > op ; <nl> <nl> - __syncthreads ( ) ; <nl> + kernel < threads_x * threads_y > < < < grid , block > > > ( src , buf , op , twidth , theight ) ; <nl> + cudaSafeCall ( cudaGetLastError ( ) ) ; <nl> <nl> - if ( is_last ) <nl> - { <nl> - uint idx = : : min ( tid , gridDim . x * gridDim . y - 1 ) ; <nl> + cudaSafeCall ( cudaDeviceSynchronize ( ) ) ; <nl> <nl> - sminval [ tid ] = minval [ idx ] ; <nl> - smaxval [ tid ] = maxval [ idx ] ; <nl> - sminloc [ tid ] = minloc [ idx ] ; <nl> - smaxloc [ tid ] = maxloc [ idx ] ; <nl> - __syncthreads ( ) ; <nl> + R result [ 4 ] = { 0 , 0 , 0 , 0 } ; <nl> + cudaSafeCall ( cudaMemcpy ( & result , buf , sizeof ( result_type ) , cudaMemcpyDeviceToHost ) ) ; <nl> <nl> - findMinMaxLocInSmem < nthreads , best_type > ( sminval , smaxval , sminloc , smaxloc , tid ) ; <nl> + out [ 0 ] = result [ 0 ] ; <nl> + out [ 1 ] = result [ 1 ] ; <nl> + out [ 2 ] = result [ 2 ] ; <nl> + out [ 3 ] = result [ 3 ] ; <nl> + } <nl> <nl> - if ( tid = = 0 ) <nl> - { <nl> - minval [ 0 ] = ( T ) sminval [ 0 ] ; <nl> - maxval [ 0 ] = ( T ) smaxval [ 0 ] ; <nl> - minloc [ 0 ] = sminloc [ 0 ] ; <nl> - maxloc [ 0 ] = smaxloc [ 0 ] ; <nl> - blocks_finished = 0 ; <nl> - } <nl> - } <nl> - # else <nl> - if ( tid = = 0 ) <nl> - { <nl> - minval [ blockIdx . y * gridDim . x + blockIdx . x ] = ( T ) sminval [ 0 ] ; <nl> - maxval [ blockIdx . y * gridDim . x + blockIdx . x ] = ( T ) smaxval [ 0 ] ; <nl> - minloc [ blockIdx . y * gridDim . x + blockIdx . x ] = sminloc [ 0 ] ; <nl> - maxloc [ blockIdx . y * gridDim . x + blockIdx . x ] = smaxloc [ 0 ] ; <nl> - } <nl> - # endif <nl> - } <nl> + template < typename T > struct SumType ; <nl> + template < > struct SumType < uchar > { typedef unsigned int R ; } ; <nl> + template < > struct SumType < schar > { typedef int R ; } ; <nl> + template < > struct SumType < ushort > { typedef unsigned int R ; } ; <nl> + template < > struct SumType < short > { typedef int R ; } ; <nl> + template < > struct SumType < int > { typedef int R ; } ; <nl> + template < > struct SumType < float > { typedef float R ; } ; <nl> + template < > struct SumType < double > { typedef double R ; } ; <nl> <nl> + template < typename T , int cn > <nl> + void run ( PtrStepSzb src , void * buf , double * out ) <nl> + { <nl> + typedef typename SumType < T > : : R R ; <nl> + caller < T , R , cn , identity > ( src , buf , out ) ; <nl> + } <nl> + <nl> + template void run < uchar , 1 > ( PtrStepSzb src , void * buf , double * out ) ; <nl> + template void run < uchar , 2 > ( PtrStepSzb src , void * buf , double * out ) ; <nl> + template void run < uchar , 3 > ( PtrStepSzb src , void * buf , double * out ) ; <nl> + template void run < uchar , 4 > ( PtrStepSzb src , void * buf , double * out ) ; <nl> + <nl> + template void run < schar , 1 > ( PtrStepSzb src , void * buf , double * out ) ; <nl> + template void run < schar , 2 > ( PtrStepSzb src , void * buf , double * out ) ; <nl> + template void run < schar , 3 > ( PtrStepSzb src , void * buf , double * out ) ; <nl> + template void run < schar , 4 > ( PtrStepSzb src , void * buf , double * out ) ; <nl> + <nl> + template void run < ushort , 1 > ( PtrStepSzb src , void * buf , double * out ) ; <nl> + template void run < ushort , 2 > ( PtrStepSzb src , void * buf , double * out ) ; <nl> + template void run < ushort , 3 > ( PtrStepSzb src , void * buf , double * out ) ; <nl> + template void run < ushort , 4 > ( PtrStepSzb src , void * buf , double * out ) ; <nl> + <nl> + template void run < short , 1 > ( PtrStepSzb src , void * buf , double * out ) ; <nl> + template void run < short , 2 > ( PtrStepSzb src , void * buf , double * out ) ; <nl> + template void run < short , 3 > ( PtrStepSzb src , void * buf , double * out ) ; <nl> + template void run < short , 4 > ( PtrStepSzb src , void * buf , double * out ) ; <nl> + <nl> + template void run < int , 1 > ( PtrStepSzb src , void * buf , double * out ) ; <nl> + template void run < int , 2 > ( PtrStepSzb src , void * buf , double * out ) ; <nl> + template void run < int , 3 > ( PtrStepSzb src , void * buf , double * out ) ; <nl> + template void run < int , 4 > ( PtrStepSzb src , void * buf , double * out ) ; <nl> + <nl> + template void run < float , 1 > ( PtrStepSzb src , void * buf , double * out ) ; <nl> + template void run < float , 2 > ( PtrStepSzb src , void * buf , double * out ) ; <nl> + template void run < float , 3 > ( PtrStepSzb src , void * buf , double * out ) ; <nl> + template void run < float , 4 > ( PtrStepSzb src , void * buf , double * out ) ; <nl> + <nl> + template void run < double , 1 > ( PtrStepSzb src , void * buf , double * out ) ; <nl> + template void run < double , 2 > ( PtrStepSzb src , void * buf , double * out ) ; <nl> + template void run < double , 3 > ( PtrStepSzb src , void * buf , double * out ) ; <nl> + template void run < double , 4 > ( PtrStepSzb src , void * buf , double * out ) ; <nl> + <nl> + template < typename T , int cn > <nl> + void runAbs ( PtrStepSzb src , void * buf , double * out ) <nl> + { <nl> + typedef typename SumType < T > : : R R ; <nl> + caller < T , R , cn , abs_func > ( src , buf , out ) ; <nl> + } <nl> + <nl> + template void runAbs < uchar , 1 > ( PtrStepSzb src , void * buf , double * out ) ; <nl> + template void runAbs < uchar , 2 > ( PtrStepSzb src , void * buf , double * out ) ; <nl> + template void runAbs < uchar , 3 > ( PtrStepSzb src , void * buf , double * out ) ; <nl> + template void runAbs < uchar , 4 > ( PtrStepSzb src , void * buf , double * out ) ; <nl> + <nl> + template void runAbs < schar , 1 > ( PtrStepSzb src , void * buf , double * out ) ; <nl> + template void runAbs < schar , 2 > ( PtrStepSzb src , void * buf , double * out ) ; <nl> + template void runAbs < schar , 3 > ( PtrStepSzb src , void * buf , double * out ) ; <nl> + template void runAbs < schar , 4 > ( PtrStepSzb src , void * buf , double * out ) ; <nl> + <nl> + template void runAbs < ushort , 1 > ( PtrStepSzb src , void * buf , double * out ) ; <nl> + template void runAbs < ushort , 2 > ( PtrStepSzb src , void * buf , double * out ) ; <nl> + template void runAbs < ushort , 3 > ( PtrStepSzb src , void * buf , double * out ) ; <nl> + template void runAbs < ushort , 4 > ( PtrStepSzb src , void * buf , double * out ) ; <nl> + <nl> + template void runAbs < short , 1 > ( PtrStepSzb src , void * buf , double * out ) ; <nl> + template void runAbs < short , 2 > ( PtrStepSzb src , void * buf , double * out ) ; <nl> + template void runAbs < short , 3 > ( PtrStepSzb src , void * buf , double * out ) ; <nl> + template void runAbs < short , 4 > ( PtrStepSzb src , void * buf , double * out ) ; <nl> + <nl> + template void runAbs < int , 1 > ( PtrStepSzb src , void * buf , double * out ) ; <nl> + template void runAbs < int , 2 > ( PtrStepSzb src , void * buf , double * out ) ; <nl> + template void runAbs < int , 3 > ( PtrStepSzb src , void * buf , double * out ) ; <nl> + template void runAbs < int , 4 > ( PtrStepSzb src , void * buf , double * out ) ; <nl> + <nl> + template void runAbs < float , 1 > ( PtrStepSzb src , void * buf , double * out ) ; <nl> + template void runAbs < float , 2 > ( PtrStepSzb src , void * buf , double * out ) ; <nl> + template void runAbs < float , 3 > ( PtrStepSzb src , void * buf , double * out ) ; <nl> + template void runAbs < float , 4 > ( PtrStepSzb src , void * buf , double * out ) ; <nl> + <nl> + template void runAbs < double , 1 > ( PtrStepSzb src , void * buf , double * out ) ; <nl> + template void runAbs < double , 2 > ( PtrStepSzb src , void * buf , double * out ) ; <nl> + template void runAbs < double , 3 > ( PtrStepSzb src , void * buf , double * out ) ; <nl> + template void runAbs < double , 4 > ( PtrStepSzb src , void * buf , double * out ) ; <nl> + <nl> + template < typename T > struct Sqr : unary_function < T , T > <nl> + { <nl> + __device__ __forceinline__ T operator ( ) ( T x ) const <nl> + { <nl> + return x * x ; <nl> + } <nl> + } ; <nl> <nl> - template < typename T > <nl> - void minMaxLocMaskCaller ( const PtrStepSzb src , const PtrStepb mask , double * minval , double * maxval , <nl> - int minloc [ 2 ] , int maxloc [ 2 ] , PtrStepb valbuf , PtrStepb locbuf ) <nl> - { <nl> - dim3 threads , grid ; <nl> - estimateThreadCfg ( src . cols , src . rows , threads , grid ) ; <nl> - setKernelConsts ( src . cols , src . rows , threads , grid ) ; <nl> - <nl> - T * minval_buf = ( T * ) valbuf . ptr ( 0 ) ; <nl> - T * maxval_buf = ( T * ) valbuf . ptr ( 1 ) ; <nl> - uint * minloc_buf = ( uint * ) locbuf . ptr ( 0 ) ; <nl> - uint * maxloc_buf = ( uint * ) locbuf . ptr ( 1 ) ; <nl> - <nl> - minMaxLocKernel < 256 , T , Mask8U > < < < grid , threads > > > ( src , Mask8U ( mask ) , minval_buf , maxval_buf , <nl> - minloc_buf , maxloc_buf ) ; <nl> - cudaSafeCall ( cudaGetLastError ( ) ) ; <nl> - <nl> - cudaSafeCall ( cudaDeviceSynchronize ( ) ) ; <nl> - <nl> - T minval_ , maxval_ ; <nl> - cudaSafeCall ( cudaMemcpy ( & minval_ , minval_buf , sizeof ( T ) , cudaMemcpyDeviceToHost ) ) ; <nl> - cudaSafeCall ( cudaMemcpy ( & maxval_ , maxval_buf , sizeof ( T ) , cudaMemcpyDeviceToHost ) ) ; <nl> - * minval = minval_ ; <nl> - * maxval = maxval_ ; <nl> - <nl> - uint minloc_ , maxloc_ ; <nl> - cudaSafeCall ( cudaMemcpy ( & minloc_ , minloc_buf , sizeof ( int ) , cudaMemcpyDeviceToHost ) ) ; <nl> - cudaSafeCall ( cudaMemcpy ( & maxloc_ , maxloc_buf , sizeof ( int ) , cudaMemcpyDeviceToHost ) ) ; <nl> - minloc [ 1 ] = minloc_ / src . cols ; minloc [ 0 ] = minloc_ - minloc [ 1 ] * src . cols ; <nl> - maxloc [ 1 ] = maxloc_ / src . cols ; maxloc [ 0 ] = maxloc_ - maxloc [ 1 ] * src . cols ; <nl> - } <nl> + template < typename T , int cn > <nl> + void runSqr ( PtrStepSzb src , void * buf , double * out ) <nl> + { <nl> + caller < T , double , cn , Sqr > ( src , buf , out ) ; <nl> + } <nl> + <nl> + template void runSqr < uchar , 1 > ( PtrStepSzb src , void * buf , double * out ) ; <nl> + template void runSqr < uchar , 2 > ( PtrStepSzb src , void * buf , double * out ) ; <nl> + template void runSqr < uchar , 3 > ( PtrStepSzb src , void * buf , double * out ) ; <nl> + template void runSqr < uchar , 4 > ( PtrStepSzb src , void * buf , double * out ) ; <nl> + <nl> + template void runSqr < schar , 1 > ( PtrStepSzb src , void * buf , double * out ) ; <nl> + template void runSqr < schar , 2 > ( PtrStepSzb src , void * buf , double * out ) ; <nl> + template void runSqr < schar , 3 > ( PtrStepSzb src , void * buf , double * out ) ; <nl> + template void runSqr < schar , 4 > ( PtrStepSzb src , void * buf , double * out ) ; <nl> + <nl> + template void runSqr < ushort , 1 > ( PtrStepSzb src , void * buf , double * out ) ; <nl> + template void runSqr < ushort , 2 > ( PtrStepSzb src , void * buf , double * out ) ; <nl> + template void runSqr < ushort , 3 > ( PtrStepSzb src , void * buf , double * out ) ; <nl> + template void runSqr < ushort , 4 > ( PtrStepSzb src , void * buf , double * out ) ; <nl> + <nl> + template void runSqr < short , 1 > ( PtrStepSzb src , void * buf , double * out ) ; <nl> + template void runSqr < short , 2 > ( PtrStepSzb src , void * buf , double * out ) ; <nl> + template void runSqr < short , 3 > ( PtrStepSzb src , void * buf , double * out ) ; <nl> + template void runSqr < short , 4 > ( PtrStepSzb src , void * buf , double * out ) ; <nl> + <nl> + template void runSqr < int , 1 > ( PtrStepSzb src , void * buf , double * out ) ; <nl> + template void runSqr < int , 2 > ( PtrStepSzb src , void * buf , double * out ) ; <nl> + template void runSqr < int , 3 > ( PtrStepSzb src , void * buf , double * out ) ; <nl> + template void runSqr < int , 4 > ( PtrStepSzb src , void * buf , double * out ) ; <nl> + <nl> + template void runSqr < float , 1 > ( PtrStepSzb src , void * buf , double * out ) ; <nl> + template void runSqr < float , 2 > ( PtrStepSzb src , void * buf , double * out ) ; <nl> + template void runSqr < float , 3 > ( PtrStepSzb src , void * buf , double * out ) ; <nl> + template void runSqr < float , 4 > ( PtrStepSzb src , void * buf , double * out ) ; <nl> + <nl> + template void runSqr < double , 1 > ( PtrStepSzb src , void * buf , double * out ) ; <nl> + template void runSqr < double , 2 > ( PtrStepSzb src , void * buf , double * out ) ; <nl> + template void runSqr < double , 3 > ( PtrStepSzb src , void * buf , double * out ) ; <nl> + template void runSqr < double , 4 > ( PtrStepSzb src , void * buf , double * out ) ; <nl> + } <nl> + <nl> + / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / <nl> + / / minMax <nl> + <nl> + namespace minMax <nl> + { <nl> + __device__ unsigned int blocks_finished = 0 ; <nl> + <nl> + / / To avoid shared bank conflicts we convert each value into value of <nl> + / / appropriate type ( 32 bits minimum ) <nl> + template < typename T > struct MinMaxTypeTraits ; <nl> + template < > struct MinMaxTypeTraits < uchar > { typedef int best_type ; } ; <nl> + template < > struct MinMaxTypeTraits < schar > { typedef int best_type ; } ; <nl> + template < > struct MinMaxTypeTraits < ushort > { typedef int best_type ; } ; <nl> + template < > struct MinMaxTypeTraits < short > { typedef int best_type ; } ; <nl> + template < > struct MinMaxTypeTraits < int > { typedef int best_type ; } ; <nl> + template < > struct MinMaxTypeTraits < float > { typedef float best_type ; } ; <nl> + template < > struct MinMaxTypeTraits < double > { typedef double best_type ; } ; <nl> + <nl> + template < int BLOCK_SIZE , typename R > <nl> + struct GlobalReduce <nl> + { <nl> + static __device__ void run ( R & mymin , R & mymax , R * minval , R * maxval , int tid , int bid , R * sminval , R * smaxval ) <nl> + { <nl> + __shared__ bool is_last ; <nl> <nl> - template void minMaxLocMaskCaller < uchar > ( const PtrStepSzb , const PtrStepb , double * , double * , int [ 2 ] , int [ 2 ] , PtrStepb , PtrStepb ) ; <nl> - template void minMaxLocMaskCaller < char > ( const PtrStepSzb , const PtrStepb , double * , double * , int [ 2 ] , int [ 2 ] , PtrStepb , PtrStepb ) ; <nl> - template void minMaxLocMaskCaller < ushort > ( const PtrStepSzb , const PtrStepb , double * , double * , int [ 2 ] , int [ 2 ] , PtrStepb , PtrStepb ) ; <nl> - template void minMaxLocMaskCaller < short > ( const PtrStepSzb , const PtrStepb , double * , double * , int [ 2 ] , int [ 2 ] , PtrStepb , PtrStepb ) ; <nl> - template void minMaxLocMaskCaller < int > ( const PtrStepSzb , const PtrStepb , double * , double * , int [ 2 ] , int [ 2 ] , PtrStepb , PtrStepb ) ; <nl> - template void minMaxLocMaskCaller < float > ( const PtrStepSzb , const PtrStepb , double * , double * , int [ 2 ] , int [ 2 ] , PtrStepb , PtrStepb ) ; <nl> - template void minMaxLocMaskCaller < double > ( const PtrStepSzb , const PtrStepb , double * , double * , int [ 2 ] , int [ 2 ] , PtrStepb , PtrStepb ) ; <nl> + if ( tid = = 0 ) <nl> + { <nl> + minval [ bid ] = mymin ; <nl> + maxval [ bid ] = mymax ; <nl> <nl> + __threadfence ( ) ; <nl> <nl> - template < typename T > <nl> - void minMaxLocCaller ( const PtrStepSzb src , double * minval , double * maxval , <nl> - int minloc [ 2 ] , int maxloc [ 2 ] , PtrStepb valbuf , PtrStepb locbuf ) <nl> - { <nl> - dim3 threads , grid ; <nl> - estimateThreadCfg ( src . cols , src . rows , threads , grid ) ; <nl> - setKernelConsts ( src . cols , src . rows , threads , grid ) ; <nl> - <nl> - T * minval_buf = ( T * ) valbuf . ptr ( 0 ) ; <nl> - T * maxval_buf = ( T * ) valbuf . ptr ( 1 ) ; <nl> - uint * minloc_buf = ( uint * ) locbuf . ptr ( 0 ) ; <nl> - uint * maxloc_buf = ( uint * ) locbuf . ptr ( 1 ) ; <nl> - <nl> - minMaxLocKernel < 256 , T , MaskTrue > < < < grid , threads > > > ( src , MaskTrue ( ) , minval_buf , maxval_buf , <nl> - minloc_buf , maxloc_buf ) ; <nl> - cudaSafeCall ( cudaGetLastError ( ) ) ; <nl> - <nl> - cudaSafeCall ( cudaDeviceSynchronize ( ) ) ; <nl> - <nl> - T minval_ , maxval_ ; <nl> - cudaSafeCall ( cudaMemcpy ( & minval_ , minval_buf , sizeof ( T ) , cudaMemcpyDeviceToHost ) ) ; <nl> - cudaSafeCall ( cudaMemcpy ( & maxval_ , maxval_buf , sizeof ( T ) , cudaMemcpyDeviceToHost ) ) ; <nl> - * minval = minval_ ; <nl> - * maxval = maxval_ ; <nl> - <nl> - uint minloc_ , maxloc_ ; <nl> - cudaSafeCall ( cudaMemcpy ( & minloc_ , minloc_buf , sizeof ( int ) , cudaMemcpyDeviceToHost ) ) ; <nl> - cudaSafeCall ( cudaMemcpy ( & maxloc_ , maxloc_buf , sizeof ( int ) , cudaMemcpyDeviceToHost ) ) ; <nl> - minloc [ 1 ] = minloc_ / src . cols ; minloc [ 0 ] = minloc_ - minloc [ 1 ] * src . cols ; <nl> - maxloc [ 1 ] = maxloc_ / src . cols ; maxloc [ 0 ] = maxloc_ - maxloc [ 1 ] * src . cols ; <nl> + unsigned int ticket = : : atomicAdd ( & blocks_finished , 1 ) ; <nl> + is_last = ( ticket = = gridDim . x * gridDim . y - 1 ) ; <nl> } <nl> <nl> - template void minMaxLocCaller < uchar > ( const PtrStepSzb , double * , double * , int [ 2 ] , int [ 2 ] , PtrStepb , PtrStepb ) ; <nl> - template void minMaxLocCaller < char > ( const PtrStepSzb , double * , double * , int [ 2 ] , int [ 2 ] , PtrStepb , PtrStepb ) ; <nl> - template void minMaxLocCaller < ushort > ( const PtrStepSzb , double * , double * , int [ 2 ] , int [ 2 ] , PtrStepb , PtrStepb ) ; <nl> - template void minMaxLocCaller < short > ( const PtrStepSzb , double * , double * , int [ 2 ] , int [ 2 ] , PtrStepb , PtrStepb ) ; <nl> - template void minMaxLocCaller < int > ( const PtrStepSzb , double * , double * , int [ 2 ] , int [ 2 ] , PtrStepb , PtrStepb ) ; <nl> - template void minMaxLocCaller < float > ( const PtrStepSzb , double * , double * , int [ 2 ] , int [ 2 ] , PtrStepb , PtrStepb ) ; <nl> - template void minMaxLocCaller < double > ( const PtrStepSzb , double * , double * , int [ 2 ] , int [ 2 ] , PtrStepb , PtrStepb ) ; <nl> - <nl> + __syncthreads ( ) ; <nl> <nl> - / / This kernel will be used only when compute capability is 1 . 0 <nl> - template < int nthreads , typename T > <nl> - __global__ void minMaxLocPass2Kernel ( T * minval , T * maxval , uint * minloc , uint * maxloc , int size ) <nl> + if ( is_last ) <nl> { <nl> - typedef typename MinMaxTypeTraits < T > : : best_type best_type ; <nl> - __shared__ best_type sminval [ nthreads ] ; <nl> - __shared__ best_type smaxval [ nthreads ] ; <nl> - __shared__ uint sminloc [ nthreads ] ; <nl> - __shared__ uint smaxloc [ nthreads ] ; <nl> + int idx = : : min ( tid , gridDim . x * gridDim . y - 1 ) ; <nl> <nl> - uint tid = threadIdx . y * blockDim . x + threadIdx . x ; <nl> - uint idx = : : min ( tid , size - 1 ) ; <nl> + mymin = minval [ idx ] ; <nl> + mymax = maxval [ idx ] ; <nl> <nl> - sminval [ tid ] = minval [ idx ] ; <nl> - smaxval [ tid ] = maxval [ idx ] ; <nl> - sminloc [ tid ] = minloc [ idx ] ; <nl> - smaxloc [ tid ] = maxloc [ idx ] ; <nl> - __syncthreads ( ) ; <nl> - <nl> - findMinMaxLocInSmem < nthreads , best_type > ( sminval , smaxval , sminloc , smaxloc , tid ) ; <nl> + const minimum < R > minOp ; <nl> + const maximum < R > maxOp ; <nl> + device : : reduce < BLOCK_SIZE > ( smem_tuple ( sminval , smaxval ) , thrust : : tie ( mymin , mymax ) , tid , thrust : : make_tuple ( minOp , maxOp ) ) ; <nl> <nl> if ( tid = = 0 ) <nl> { <nl> - minval [ 0 ] = ( T ) sminval [ 0 ] ; <nl> - maxval [ 0 ] = ( T ) smaxval [ 0 ] ; <nl> - minloc [ 0 ] = sminloc [ 0 ] ; <nl> - maxloc [ 0 ] = smaxloc [ 0 ] ; <nl> - } <nl> - } <nl> - <nl> - <nl> - template < typename T > <nl> - void minMaxLocMaskMultipassCaller ( const PtrStepSzb src , const PtrStepb mask , double * minval , double * maxval , <nl> - int minloc [ 2 ] , int maxloc [ 2 ] , PtrStepb valbuf , PtrStepb locbuf ) <nl> - { <nl> - dim3 threads , grid ; <nl> - estimateThreadCfg ( src . cols , src . rows , threads , grid ) ; <nl> - setKernelConsts ( src . cols , src . rows , threads , grid ) ; <nl> - <nl> - T * minval_buf = ( T * ) valbuf . ptr ( 0 ) ; <nl> - T * maxval_buf = ( T * ) valbuf . ptr ( 1 ) ; <nl> - uint * minloc_buf = ( uint * ) locbuf . ptr ( 0 ) ; <nl> - uint * maxloc_buf = ( uint * ) locbuf . ptr ( 1 ) ; <nl> - <nl> - minMaxLocKernel < 256 , T , Mask8U > < < < grid , threads > > > ( src , Mask8U ( mask ) , minval_buf , maxval_buf , <nl> - minloc_buf , maxloc_buf ) ; <nl> - cudaSafeCall ( cudaGetLastError ( ) ) ; <nl> - minMaxLocPass2Kernel < 256 , T > < < < 1 , 256 > > > ( minval_buf , maxval_buf , minloc_buf , maxloc_buf , grid . x * grid . y ) ; <nl> - cudaSafeCall ( cudaGetLastError ( ) ) ; <nl> - <nl> - cudaSafeCall ( cudaDeviceSynchronize ( ) ) ; <nl> - <nl> - T minval_ , maxval_ ; <nl> - cudaSafeCall ( cudaMemcpy ( & minval_ , minval_buf , sizeof ( T ) , cudaMemcpyDeviceToHost ) ) ; <nl> - cudaSafeCall ( cudaMemcpy ( & maxval_ , maxval_buf , sizeof ( T ) , cudaMemcpyDeviceToHost ) ) ; <nl> - * minval = minval_ ; <nl> - * maxval = maxval_ ; <nl> - <nl> - uint minloc_ , maxloc_ ; <nl> - cudaSafeCall ( cudaMemcpy ( & minloc_ , minloc_buf , sizeof ( int ) , cudaMemcpyDeviceToHost ) ) ; <nl> - cudaSafeCall ( cudaMemcpy ( & maxloc_ , maxloc_buf , sizeof ( int ) , cudaMemcpyDeviceToHost ) ) ; <nl> - minloc [ 1 ] = minloc_ / src . cols ; minloc [ 0 ] = minloc_ - minloc [ 1 ] * src . cols ; <nl> - maxloc [ 1 ] = maxloc_ / src . cols ; maxloc [ 0 ] = maxloc_ - maxloc [ 1 ] * src . cols ; <nl> - } <nl> - <nl> - template void minMaxLocMaskMultipassCaller < uchar > ( const PtrStepSzb , const PtrStepb , double * , double * , int [ 2 ] , int [ 2 ] , PtrStepb , PtrStepb ) ; <nl> - template void minMaxLocMaskMultipassCaller < char > ( const PtrStepSzb , const PtrStepb , double * , double * , int [ 2 ] , int [ 2 ] , PtrStepb , PtrStepb ) ; <nl> - template void minMaxLocMaskMultipassCaller < ushort > ( const PtrStepSzb , const PtrStepb , double * , double * , int [ 2 ] , int [ 2 ] , PtrStepb , PtrStepb ) ; <nl> - template void minMaxLocMaskMultipassCaller < short > ( const PtrStepSzb , const PtrStepb , double * , double * , int [ 2 ] , int [ 2 ] , PtrStepb , PtrStepb ) ; <nl> - template void minMaxLocMaskMultipassCaller < int > ( const PtrStepSzb , const PtrStepb , double * , double * , int [ 2 ] , int [ 2 ] , PtrStepb , PtrStepb ) ; <nl> - template void minMaxLocMaskMultipassCaller < float > ( const PtrStepSzb , const PtrStepb , double * , double * , int [ 2 ] , int [ 2 ] , PtrStepb , PtrStepb ) ; <nl> + minval [ 0 ] = mymin ; <nl> + maxval [ 0 ] = mymax ; <nl> <nl> - <nl> - template < typename T > <nl> - void minMaxLocMultipassCaller ( const PtrStepSzb src , double * minval , double * maxval , <nl> - int minloc [ 2 ] , int maxloc [ 2 ] , PtrStepb valbuf , PtrStepb locbuf ) <nl> - { <nl> - dim3 threads , grid ; <nl> - estimateThreadCfg ( src . cols , src . rows , threads , grid ) ; <nl> - setKernelConsts ( src . cols , src . rows , threads , grid ) ; <nl> - <nl> - T * minval_buf = ( T * ) valbuf . ptr ( 0 ) ; <nl> - T * maxval_buf = ( T * ) valbuf . ptr ( 1 ) ; <nl> - uint * minloc_buf = ( uint * ) locbuf . ptr ( 0 ) ; <nl> - uint * maxloc_buf = ( uint * ) locbuf . ptr ( 1 ) ; <nl> - <nl> - minMaxLocKernel < 256 , T , MaskTrue > < < < grid , threads > > > ( src , MaskTrue ( ) , minval_buf , maxval_buf , <nl> - minloc_buf , maxloc_buf ) ; <nl> - cudaSafeCall ( cudaGetLastError ( ) ) ; <nl> - minMaxLocPass2Kernel < 256 , T > < < < 1 , 256 > > > ( minval_buf , maxval_buf , minloc_buf , maxloc_buf , grid . x * grid . y ) ; <nl> - cudaSafeCall ( cudaGetLastError ( ) ) ; <nl> - <nl> - cudaSafeCall ( cudaDeviceSynchronize ( ) ) ; <nl> - <nl> - T minval_ , maxval_ ; <nl> - cudaSafeCall ( cudaMemcpy ( & minval_ , minval_buf , sizeof ( T ) , cudaMemcpyDeviceToHost ) ) ; <nl> - cudaSafeCall ( cudaMemcpy ( & maxval_ , maxval_buf , sizeof ( T ) , cudaMemcpyDeviceToHost ) ) ; <nl> - * minval = minval_ ; <nl> - * maxval = maxval_ ; <nl> - <nl> - uint minloc_ , maxloc_ ; <nl> - cudaSafeCall ( cudaMemcpy ( & minloc_ , minloc_buf , sizeof ( int ) , cudaMemcpyDeviceToHost ) ) ; <nl> - cudaSafeCall ( cudaMemcpy ( & maxloc_ , maxloc_buf , sizeof ( int ) , cudaMemcpyDeviceToHost ) ) ; <nl> - minloc [ 1 ] = minloc_ / src . cols ; minloc [ 0 ] = minloc_ - minloc [ 1 ] * src . cols ; <nl> - maxloc [ 1 ] = maxloc_ / src . cols ; maxloc [ 0 ] = maxloc_ - maxloc [ 1 ] * src . cols ; <nl> + blocks_finished = 0 ; <nl> + } <nl> } <nl> - <nl> - template void minMaxLocMultipassCaller < uchar > ( const PtrStepSzb , double * , double * , int [ 2 ] , int [ 2 ] , PtrStepb , PtrStepb ) ; <nl> - template void minMaxLocMultipassCaller < char > ( const PtrStepSzb , double * , double * , int [ 2 ] , int [ 2 ] , PtrStepb , PtrStepb ) ; <nl> - template void minMaxLocMultipassCaller < ushort > ( const PtrStepSzb , double * , double * , int [ 2 ] , int [ 2 ] , PtrStepb , PtrStepb ) ; <nl> - template void minMaxLocMultipassCaller < short > ( const PtrStepSzb , double * , double * , int [ 2 ] , int [ 2 ] , PtrStepb , PtrStepb ) ; <nl> - template void minMaxLocMultipassCaller < int > ( const PtrStepSzb , double * , double * , int [ 2 ] , int [ 2 ] , PtrStepb , PtrStepb ) ; <nl> - template void minMaxLocMultipassCaller < float > ( const PtrStepSzb , double * , double * , int [ 2 ] , int [ 2 ] , PtrStepb , PtrStepb ) ; <nl> - } / / namespace minmaxloc <nl> - <nl> - / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / <nl> - / / countNonZero <nl> - <nl> - namespace countnonzero <nl> + } <nl> + } ; <nl> + template < int BLOCK_SIZE > <nl> + struct GlobalReduce < BLOCK_SIZE , int > <nl> + { <nl> + static __device__ void run ( int & mymin , int & mymax , int * minval , int * maxval , int tid , int bid , int * sminval , int * smaxval ) <nl> { <nl> - __constant__ int ctwidth ; <nl> - __constant__ int ctheight ; <nl> - <nl> - __device__ uint blocks_finished = 0 ; <nl> - <nl> - void estimateThreadCfg ( int cols , int rows , dim3 & threads , dim3 & grid ) <nl> + # if __CUDA_ARCH__ > = 200 <nl> + if ( tid = = 0 ) <nl> { <nl> - threads = dim3 ( 32 , 8 ) ; <nl> - grid = dim3 ( divUp ( cols , threads . x * 8 ) , divUp ( rows , threads . y * 32 ) ) ; <nl> - grid . x = std : : min ( grid . x , threads . x ) ; <nl> - grid . y = std : : min ( grid . y , threads . y ) ; <nl> + : : atomicMin ( minval , mymin ) ; <nl> + : : atomicMax ( maxval , mymax ) ; <nl> } <nl> + # else <nl> + __shared__ bool is_last ; <nl> <nl> - <nl> - void getBufSizeRequired ( int cols , int rows , int & bufcols , int & bufrows ) <nl> + if ( tid = = 0 ) <nl> { <nl> - dim3 threads , grid ; <nl> - estimateThreadCfg ( cols , rows , threads , grid ) ; <nl> - bufcols = grid . x * grid . y * sizeof ( int ) ; <nl> - bufrows = 1 ; <nl> - } <nl> + minval [ bid ] = mymin ; <nl> + maxval [ bid ] = mymax ; <nl> <nl> + __threadfence ( ) ; <nl> <nl> - void setKernelConsts ( int cols , int rows , const dim3 & threads , const dim3 & grid ) <nl> - { <nl> - int twidth = divUp ( divUp ( cols , grid . x ) , threads . x ) ; <nl> - int theight = divUp ( divUp ( rows , grid . y ) , threads . y ) ; <nl> - cudaSafeCall ( cudaMemcpyToSymbol ( ctwidth , & twidth , sizeof ( twidth ) ) ) ; <nl> - cudaSafeCall ( cudaMemcpyToSymbol ( ctheight , & theight , sizeof ( theight ) ) ) ; <nl> + unsigned int ticket = : : atomicAdd ( & blocks_finished , 1 ) ; <nl> + is_last = ( ticket = = gridDim . x * gridDim . y - 1 ) ; <nl> } <nl> <nl> + __syncthreads ( ) ; <nl> <nl> - template < int nthreads , typename T > <nl> - __global__ void countNonZeroKernel ( const PtrStepSzb src , volatile uint * count ) <nl> + if ( is_last ) <nl> { <nl> - __shared__ uint scount [ nthreads ] ; <nl> + int idx = : : min ( tid , gridDim . x * gridDim . y - 1 ) ; <nl> <nl> - uint x0 = blockIdx . x * blockDim . x * ctwidth + threadIdx . x ; <nl> - uint y0 = blockIdx . y * blockDim . y * ctheight + threadIdx . y ; <nl> - uint tid = threadIdx . y * blockDim . x + threadIdx . x ; <nl> + mymin = minval [ idx ] ; <nl> + mymax = maxval [ idx ] ; <nl> <nl> - uint cnt = 0 ; <nl> - for ( uint y = 0 ; y < ctheight & & y0 + y * blockDim . y < src . rows ; + + y ) <nl> - { <nl> - const T * ptr = ( const T * ) src . ptr ( y0 + y * blockDim . y ) ; <nl> - for ( uint x = 0 ; x < ctwidth & & x0 + x * blockDim . x < src . cols ; + + x ) <nl> - cnt + = ptr [ x0 + x * blockDim . x ] ! = 0 ; <nl> - } <nl> - <nl> - scount [ tid ] = cnt ; <nl> - __syncthreads ( ) ; <nl> - <nl> - sumInSmem < nthreads , uint > ( scount , tid ) ; <nl> - <nl> - # if defined ( __CUDA_ARCH__ ) & & ( __CUDA_ARCH__ > = 110 ) <nl> - __shared__ bool is_last ; <nl> + const minimum < int > minOp ; <nl> + const maximum < int > maxOp ; <nl> + device : : reduce < BLOCK_SIZE > ( smem_tuple ( sminval , smaxval ) , thrust : : tie ( mymin , mymax ) , tid , thrust : : make_tuple ( minOp , maxOp ) ) ; <nl> <nl> if ( tid = = 0 ) <nl> { <nl> - count [ blockIdx . y * gridDim . x + blockIdx . x ] = scount [ 0 ] ; <nl> - __threadfence ( ) ; <nl> - <nl> - uint ticket = atomicInc ( & blocks_finished , gridDim . x * gridDim . y ) ; <nl> - is_last = ticket = = gridDim . x * gridDim . y - 1 ; <nl> - } <nl> - <nl> - __syncthreads ( ) ; <nl> - <nl> - if ( is_last ) <nl> - { <nl> - scount [ tid ] = tid < gridDim . x * gridDim . y ? count [ tid ] : 0 ; <nl> - __syncthreads ( ) ; <nl> + minval [ 0 ] = mymin ; <nl> + maxval [ 0 ] = mymax ; <nl> <nl> - sumInSmem < nthreads , uint > ( scount , tid ) ; <nl> - <nl> - if ( tid = = 0 ) <nl> - { <nl> - count [ 0 ] = scount [ 0 ] ; <nl> - blocks_finished = 0 ; <nl> - } <nl> + blocks_finished = 0 ; <nl> } <nl> - # else <nl> - if ( tid = = 0 ) count [ blockIdx . y * gridDim . x + blockIdx . x ] = scount [ 0 ] ; <nl> - # endif <nl> - } <nl> - <nl> - <nl> - template < typename T > <nl> - int countNonZeroCaller ( const PtrStepSzb src , PtrStepb buf ) <nl> - { <nl> - dim3 threads , grid ; <nl> - estimateThreadCfg ( src . cols , src . rows , threads , grid ) ; <nl> - setKernelConsts ( src . cols , src . rows , threads , grid ) ; <nl> - <nl> - uint * count_buf = ( uint * ) buf . ptr ( 0 ) ; <nl> - <nl> - countNonZeroKernel < 256 , T > < < < grid , threads > > > ( src , count_buf ) ; <nl> - cudaSafeCall ( cudaGetLastError ( ) ) ; <nl> - <nl> - cudaSafeCall ( cudaDeviceSynchronize ( ) ) ; <nl> - <nl> - uint count ; <nl> - cudaSafeCall ( cudaMemcpy ( & count , count_buf , sizeof ( int ) , cudaMemcpyDeviceToHost ) ) ; <nl> - <nl> - return count ; <nl> - } <nl> - <nl> - template int countNonZeroCaller < uchar > ( const PtrStepSzb , PtrStepb ) ; <nl> - template int countNonZeroCaller < char > ( const PtrStepSzb , PtrStepb ) ; <nl> - template int countNonZeroCaller < ushort > ( const PtrStepSzb , PtrStepb ) ; <nl> - template int countNonZeroCaller < short > ( const PtrStepSzb , PtrStepb ) ; <nl> - template int countNonZeroCaller < int > ( const PtrStepSzb , PtrStepb ) ; <nl> - template int countNonZeroCaller < float > ( const PtrStepSzb , PtrStepb ) ; <nl> - template int countNonZeroCaller < double > ( const PtrStepSzb , PtrStepb ) ; <nl> - <nl> - <nl> - template < int nthreads , typename T > <nl> - __global__ void countNonZeroPass2Kernel ( uint * count , int size ) <nl> - { <nl> - __shared__ uint scount [ nthreads ] ; <nl> - uint tid = threadIdx . y * blockDim . x + threadIdx . x ; <nl> - <nl> - scount [ tid ] = tid < size ? count [ tid ] : 0 ; <nl> - __syncthreads ( ) ; <nl> - <nl> - sumInSmem < nthreads , uint > ( scount , tid ) ; <nl> - <nl> - if ( tid = = 0 ) <nl> - count [ 0 ] = scount [ 0 ] ; <nl> } <nl> + # endif <nl> + } <nl> + } ; <nl> <nl> + template < int BLOCK_SIZE , typename T , typename R , class Mask > <nl> + __global__ void kernel ( const PtrStepSz < T > src , const Mask mask , R * minval , R * maxval , const int twidth , const int theight ) <nl> + { <nl> + __shared__ R sminval [ BLOCK_SIZE ] ; <nl> + __shared__ R smaxval [ BLOCK_SIZE ] ; <nl> <nl> - template < typename T > <nl> - int countNonZeroMultipassCaller ( const PtrStepSzb src , PtrStepb buf ) <nl> - { <nl> - dim3 threads , grid ; <nl> - estimateThreadCfg ( src . cols , src . rows , threads , grid ) ; <nl> - setKernelConsts ( src . cols , src . rows , threads , grid ) ; <nl> - <nl> - uint * count_buf = ( uint * ) buf . ptr ( 0 ) ; <nl> - <nl> - countNonZeroKernel < 256 , T > < < < grid , threads > > > ( src , count_buf ) ; <nl> - cudaSafeCall ( cudaGetLastError ( ) ) ; <nl> - countNonZeroPass2Kernel < 256 , T > < < < 1 , 256 > > > ( count_buf , grid . x * grid . y ) ; <nl> - cudaSafeCall ( cudaGetLastError ( ) ) ; <nl> - <nl> - cudaSafeCall ( cudaDeviceSynchronize ( ) ) ; <nl> - <nl> - uint count ; <nl> - cudaSafeCall ( cudaMemcpy ( & count , count_buf , sizeof ( int ) , cudaMemcpyDeviceToHost ) ) ; <nl> - <nl> - return count ; <nl> - } <nl> - <nl> - template int countNonZeroMultipassCaller < uchar > ( const PtrStepSzb , PtrStepb ) ; <nl> - template int countNonZeroMultipassCaller < char > ( const PtrStepSzb , PtrStepb ) ; <nl> - template int countNonZeroMultipassCaller < ushort > ( const PtrStepSzb , PtrStepb ) ; <nl> - template int countNonZeroMultipassCaller < short > ( const PtrStepSzb , PtrStepb ) ; <nl> - template int countNonZeroMultipassCaller < int > ( const PtrStepSzb , PtrStepb ) ; <nl> - template int countNonZeroMultipassCaller < float > ( const PtrStepSzb , PtrStepb ) ; <nl> + const int x0 = blockIdx . x * blockDim . x * twidth + threadIdx . x ; <nl> + const int y0 = blockIdx . y * blockDim . y * theight + threadIdx . y ; <nl> <nl> - } / / namespace countnonzero <nl> + const int tid = threadIdx . y * blockDim . x + threadIdx . x ; <nl> + const int bid = blockIdx . y * gridDim . x + blockIdx . x ; <nl> <nl> + R mymin = numeric_limits < R > : : max ( ) ; <nl> + R mymax = - numeric_limits < R > : : max ( ) ; <nl> <nl> - / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / <nl> - / / Sum <nl> + const minimum < R > minOp ; <nl> + const maximum < R > maxOp ; <nl> <nl> - namespace sum <nl> + for ( int i = 0 , y = y0 ; i < theight & & y < src . rows ; + + i , y + = blockDim . y ) <nl> { <nl> - template < typename T > struct SumType { } ; <nl> - template < > struct SumType < uchar > { typedef uint R ; } ; <nl> - template < > struct SumType < char > { typedef int R ; } ; <nl> - template < > struct SumType < ushort > { typedef uint R ; } ; <nl> - template < > struct SumType < short > { typedef int R ; } ; <nl> - template < > struct SumType < int > { typedef int R ; } ; <nl> - template < > struct SumType < float > { typedef float R ; } ; <nl> - template < > struct SumType < double > { typedef double R ; } ; <nl> - <nl> - template < typename R > <nl> - struct IdentityOp { static __device__ __forceinline__ R call ( R x ) { return x ; } } ; <nl> + const T * ptr = src . ptr ( y ) ; <nl> <nl> - template < typename R > <nl> - struct AbsOp { static __device__ __forceinline__ R call ( R x ) { return : : abs ( x ) ; } } ; <nl> - <nl> - template < > <nl> - struct AbsOp < uint > { static __device__ __forceinline__ uint call ( uint x ) { return x ; } } ; <nl> - <nl> - template < typename R > <nl> - struct SqrOp { static __device__ __forceinline__ R call ( R x ) { return x * x ; } } ; <nl> - <nl> - __constant__ int ctwidth ; <nl> - __constant__ int ctheight ; <nl> - __device__ uint blocks_finished = 0 ; <nl> - <nl> - const int threads_x = 32 ; <nl> - const int threads_y = 8 ; <nl> - <nl> - void estimateThreadCfg ( int cols , int rows , dim3 & threads , dim3 & grid ) <nl> + for ( int j = 0 , x = x0 ; j < twidth & & x < src . cols ; + + j , x + = blockDim . x ) <nl> { <nl> - threads = dim3 ( threads_x , threads_y ) ; <nl> - grid = dim3 ( divUp ( cols , threads . x * threads . y ) , <nl> - divUp ( rows , threads . y * threads . x ) ) ; <nl> - grid . x = std : : min ( grid . x , threads . x ) ; <nl> - grid . y = std : : min ( grid . y , threads . y ) ; <nl> - } <nl> - <nl> - <nl> - void getBufSizeRequired ( int cols , int rows , int cn , int & bufcols , int & bufrows ) <nl> - { <nl> - dim3 threads , grid ; <nl> - estimateThreadCfg ( cols , rows , threads , grid ) ; <nl> - bufcols = grid . x * grid . y * sizeof ( double ) * cn ; <nl> - bufrows = 1 ; <nl> - } <nl> - <nl> - <nl> - void setKernelConsts ( int cols , int rows , const dim3 & threads , const dim3 & grid ) <nl> - { <nl> - int twidth = divUp ( divUp ( cols , grid . x ) , threads . x ) ; <nl> - int theight = divUp ( divUp ( rows , grid . y ) , threads . y ) ; <nl> - cudaSafeCall ( cudaMemcpyToSymbol ( ctwidth , & twidth , sizeof ( twidth ) ) ) ; <nl> - cudaSafeCall ( cudaMemcpyToSymbol ( ctheight , & theight , sizeof ( theight ) ) ) ; <nl> - } <nl> - <nl> - template < typename T , typename R , typename Op , int nthreads > <nl> - __global__ void sumKernel ( const PtrStepSzb src , R * result ) <nl> - { <nl> - __shared__ R smem [ nthreads ] ; <nl> - <nl> - const int x0 = blockIdx . x * blockDim . x * ctwidth + threadIdx . x ; <nl> - const int y0 = blockIdx . y * blockDim . y * ctheight + threadIdx . y ; <nl> - const int tid = threadIdx . y * blockDim . x + threadIdx . x ; <nl> - const int bid = blockIdx . y * gridDim . x + blockIdx . x ; <nl> - <nl> - R sum = 0 ; <nl> - for ( int y = 0 ; y < ctheight & & y0 + y * blockDim . y < src . rows ; + + y ) <nl> + if ( mask ( y , x ) ) <nl> { <nl> - const T * ptr = ( const T * ) src . ptr ( y0 + y * blockDim . y ) ; <nl> - for ( int x = 0 ; x < ctwidth & & x0 + x * blockDim . x < src . cols ; + + x ) <nl> - sum + = Op : : call ( ptr [ x0 + x * blockDim . x ] ) ; <nl> - } <nl> - <nl> - smem [ tid ] = sum ; <nl> - __syncthreads ( ) ; <nl> + const R srcVal = ptr [ x ] ; <nl> <nl> - sumInSmem < nthreads , R > ( smem , tid ) ; <nl> - <nl> - # if defined ( __CUDA_ARCH__ ) & & ( __CUDA_ARCH__ > = 110 ) <nl> - __shared__ bool is_last ; <nl> - <nl> - if ( tid = = 0 ) <nl> - { <nl> - result [ bid ] = smem [ 0 ] ; <nl> - __threadfence ( ) ; <nl> - <nl> - uint ticket = atomicInc ( & blocks_finished , gridDim . x * gridDim . y ) ; <nl> - is_last = ( ticket = = gridDim . x * gridDim . y - 1 ) ; <nl> - } <nl> - <nl> - __syncthreads ( ) ; <nl> - <nl> - if ( is_last ) <nl> - { <nl> - smem [ tid ] = tid < gridDim . x * gridDim . y ? result [ tid ] : 0 ; <nl> - __syncthreads ( ) ; <nl> - <nl> - sumInSmem < nthreads , R > ( smem , tid ) ; <nl> - <nl> - if ( tid = = 0 ) <nl> - { <nl> - result [ 0 ] = smem [ 0 ] ; <nl> - blocks_finished = 0 ; <nl> - } <nl> + mymin = minOp ( mymin , srcVal ) ; <nl> + mymax = maxOp ( mymax , srcVal ) ; <nl> } <nl> - # else <nl> - if ( tid = = 0 ) result [ bid ] = smem [ 0 ] ; <nl> - # endif <nl> } <nl> + } <nl> <nl> + device : : reduce < BLOCK_SIZE > ( smem_tuple ( sminval , smaxval ) , thrust : : tie ( mymin , mymax ) , tid , thrust : : make_tuple ( minOp , maxOp ) ) ; <nl> <nl> - template < typename T , typename R , int nthreads > <nl> - __global__ void sumPass2Kernel ( R * result , int size ) <nl> - { <nl> - __shared__ R smem [ nthreads ] ; <nl> - int tid = threadIdx . y * blockDim . x + threadIdx . x ; <nl> - <nl> - smem [ tid ] = tid < size ? result [ tid ] : 0 ; <nl> - __syncthreads ( ) ; <nl> - <nl> - sumInSmem < nthreads , R > ( smem , tid ) ; <nl> + GlobalReduce < BLOCK_SIZE , R > : : run ( mymin , mymax , minval , maxval , tid , bid , sminval , smaxval ) ; <nl> + } <nl> <nl> - if ( tid = = 0 ) <nl> - result [ 0 ] = smem [ 0 ] ; <nl> - } <nl> + const int threads_x = 32 ; <nl> + const int threads_y = 8 ; <nl> <nl> + void getLaunchCfg ( int cols , int rows , dim3 & block , dim3 & grid ) <nl> + { <nl> + block = dim3 ( threads_x , threads_y ) ; <nl> <nl> - template < typename T , typename R , typename Op , int nthreads > <nl> - __global__ void sumKernel_C2 ( const PtrStepSzb src , typename TypeVec < R , 2 > : : vec_type * result ) <nl> - { <nl> - typedef typename TypeVec < T , 2 > : : vec_type SrcType ; <nl> - typedef typename TypeVec < R , 2 > : : vec_type DstType ; <nl> + grid = dim3 ( divUp ( cols , block . x * block . y ) , <nl> + divUp ( rows , block . y * block . x ) ) ; <nl> <nl> - __shared__ R smem [ nthreads * 2 ] ; <nl> + grid . x = : : min ( grid . x , block . x ) ; <nl> + grid . y = : : min ( grid . y , block . y ) ; <nl> + } <nl> <nl> - const int x0 = blockIdx . x * blockDim . x * ctwidth + threadIdx . x ; <nl> - const int y0 = blockIdx . y * blockDim . y * ctheight + threadIdx . y ; <nl> - const int tid = threadIdx . y * blockDim . x + threadIdx . x ; <nl> - const int bid = blockIdx . y * gridDim . x + blockIdx . x ; <nl> + void getBufSize ( int cols , int rows , int & bufcols , int & bufrows ) <nl> + { <nl> + dim3 block , grid ; <nl> + getLaunchCfg ( cols , rows , block , grid ) ; <nl> <nl> - SrcType val ; <nl> - DstType sum = VecTraits < DstType > : : all ( 0 ) ; <nl> - for ( int y = 0 ; y < ctheight & & y0 + y * blockDim . y < src . rows ; + + y ) <nl> - { <nl> - const SrcType * ptr = ( const SrcType * ) src . ptr ( y0 + y * blockDim . y ) ; <nl> - for ( int x = 0 ; x < ctwidth & & x0 + x * blockDim . x < src . cols ; + + x ) <nl> - { <nl> - val = ptr [ x0 + x * blockDim . x ] ; <nl> - sum = sum + VecTraits < DstType > : : make ( Op : : call ( val . x ) , Op : : call ( val . y ) ) ; <nl> - } <nl> - } <nl> + bufcols = grid . x * grid . y * sizeof ( double ) ; <nl> + bufrows = 2 ; <nl> + } <nl> <nl> - smem [ tid ] = sum . x ; <nl> - smem [ tid + nthreads ] = sum . y ; <nl> - __syncthreads ( ) ; <nl> + __global__ void setDefaultKernel ( int * minval_buf , int * maxval_buf ) <nl> + { <nl> + * minval_buf = numeric_limits < int > : : max ( ) ; <nl> + * maxval_buf = numeric_limits < int > : : min ( ) ; <nl> + } <nl> <nl> - sumInSmem < nthreads , R > ( smem , tid ) ; <nl> - sumInSmem < nthreads , R > ( smem + nthreads , tid ) ; <nl> + template < typename R > <nl> + void setDefault ( R * , R * ) <nl> + { <nl> + } <nl> + void setDefault ( int * minval_buf , int * maxval_buf ) <nl> + { <nl> + setDefaultKernel < < < 1 , 1 > > > ( minval_buf , maxval_buf ) ; <nl> + } <nl> <nl> - # if defined ( __CUDA_ARCH__ ) & & ( __CUDA_ARCH__ > = 110 ) <nl> - __shared__ bool is_last ; <nl> + template < typename T > <nl> + void run ( const PtrStepSzb src , const PtrStepb mask , double * minval , double * maxval , PtrStepb buf ) <nl> + { <nl> + typedef typename MinMaxTypeTraits < T > : : best_type R ; <nl> <nl> - if ( tid = = 0 ) <nl> - { <nl> - DstType res ; <nl> - res . x = smem [ 0 ] ; <nl> - res . y = smem [ nthreads ] ; <nl> - result [ bid ] = res ; <nl> - __threadfence ( ) ; <nl> - <nl> - uint ticket = atomicInc ( & blocks_finished , gridDim . x * gridDim . y ) ; <nl> - is_last = ( ticket = = gridDim . x * gridDim . y - 1 ) ; <nl> - } <nl> + dim3 block , grid ; <nl> + getLaunchCfg ( src . cols , src . rows , block , grid ) ; <nl> <nl> - __syncthreads ( ) ; <nl> + const int twidth = divUp ( divUp ( src . cols , grid . x ) , block . x ) ; <nl> + const int theight = divUp ( divUp ( src . rows , grid . y ) , block . y ) ; <nl> <nl> - if ( is_last ) <nl> - { <nl> - DstType res = tid < gridDim . x * gridDim . y ? result [ tid ] : VecTraits < DstType > : : all ( 0 ) ; <nl> - smem [ tid ] = res . x ; <nl> - smem [ tid + nthreads ] = res . y ; <nl> - __syncthreads ( ) ; <nl> + R * minval_buf = ( R * ) buf . ptr ( 0 ) ; <nl> + R * maxval_buf = ( R * ) buf . ptr ( 1 ) ; <nl> <nl> - sumInSmem < nthreads , R > ( smem , tid ) ; <nl> - sumInSmem < nthreads , R > ( smem + nthreads , tid ) ; <nl> + setDefault ( minval_buf , maxval_buf ) ; <nl> <nl> - if ( tid = = 0 ) <nl> - { <nl> - res . x = smem [ 0 ] ; <nl> - res . y = smem [ nthreads ] ; <nl> - result [ 0 ] = res ; <nl> - blocks_finished = 0 ; <nl> - } <nl> - } <nl> - # else <nl> - if ( tid = = 0 ) <nl> - { <nl> - DstType res ; <nl> - res . x = smem [ 0 ] ; <nl> - res . y = smem [ nthreads ] ; <nl> - result [ bid ] = res ; <nl> - } <nl> - # endif <nl> - } <nl> + if ( mask . data ) <nl> + kernel < threads_x * threads_y > < < < grid , block > > > ( ( PtrStepSz < T > ) src , SingleMask ( mask ) , minval_buf , maxval_buf , twidth , theight ) ; <nl> + else <nl> + kernel < threads_x * threads_y > < < < grid , block > > > ( ( PtrStepSz < T > ) src , WithOutMask ( ) , minval_buf , maxval_buf , twidth , theight ) ; <nl> <nl> + cudaSafeCall ( cudaGetLastError ( ) ) ; <nl> <nl> - template < typename T , typename R , int nthreads > <nl> - __global__ void sumPass2Kernel_C2 ( typename TypeVec < R , 2 > : : vec_type * result , int size ) <nl> - { <nl> - typedef typename TypeVec < R , 2 > : : vec_type DstType ; <nl> + cudaSafeCall ( cudaDeviceSynchronize ( ) ) ; <nl> <nl> - __shared__ R smem [ nthreads * 2 ] ; <nl> + R minval_ , maxval_ ; <nl> + cudaSafeCall ( cudaMemcpy ( & minval_ , minval_buf , sizeof ( R ) , cudaMemcpyDeviceToHost ) ) ; <nl> + cudaSafeCall ( cudaMemcpy ( & maxval_ , maxval_buf , sizeof ( R ) , cudaMemcpyDeviceToHost ) ) ; <nl> + * minval = minval_ ; <nl> + * maxval = maxval_ ; <nl> + } <nl> <nl> - const int tid = threadIdx . y * blockDim . x + threadIdx . x ; <nl> + template void run < uchar > ( const PtrStepSzb src , const PtrStepb mask , double * minval , double * maxval , PtrStepb buf ) ; <nl> + template void run < schar > ( const PtrStepSzb src , const PtrStepb mask , double * minval , double * maxval , PtrStepb buf ) ; <nl> + template void run < ushort > ( const PtrStepSzb src , const PtrStepb mask , double * minval , double * maxval , PtrStepb buf ) ; <nl> + template void run < short > ( const PtrStepSzb src , const PtrStepb mask , double * minval , double * maxval , PtrStepb buf ) ; <nl> + template void run < int > ( const PtrStepSzb src , const PtrStepb mask , double * minval , double * maxval , PtrStepb buf ) ; <nl> + template void run < float > ( const PtrStepSzb src , const PtrStepb mask , double * minval , double * maxval , PtrStepb buf ) ; <nl> + template void run < double > ( const PtrStepSzb src , const PtrStepb mask , double * minval , double * maxval , PtrStepb buf ) ; <nl> + } <nl> <nl> - DstType res = tid < size ? result [ tid ] : VecTraits < DstType > : : all ( 0 ) ; <nl> - smem [ tid ] = res . x ; <nl> - smem [ tid + nthreads ] = res . y ; <nl> - __syncthreads ( ) ; <nl> + / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / <nl> + / / minMaxLoc <nl> <nl> - sumInSmem < nthreads , R > ( smem , tid ) ; <nl> - sumInSmem < nthreads , R > ( smem + nthreads , tid ) ; <nl> + namespace minMaxLoc <nl> + { <nl> + __device__ unsigned int blocks_finished = 0 ; <nl> + <nl> + / / To avoid shared bank conflicts we convert each value into value of <nl> + / / appropriate type ( 32 bits minimum ) <nl> + template < typename T > struct MinMaxTypeTraits ; <nl> + template < > struct MinMaxTypeTraits < uchar > { typedef int best_type ; } ; <nl> + template < > struct MinMaxTypeTraits < schar > { typedef int best_type ; } ; <nl> + template < > struct MinMaxTypeTraits < ushort > { typedef int best_type ; } ; <nl> + template < > struct MinMaxTypeTraits < short > { typedef int best_type ; } ; <nl> + template < > struct MinMaxTypeTraits < int > { typedef int best_type ; } ; <nl> + template < > struct MinMaxTypeTraits < float > { typedef float best_type ; } ; <nl> + template < > struct MinMaxTypeTraits < double > { typedef double best_type ; } ; <nl> + <nl> + template < int BLOCK_SIZE , typename T , class Mask > <nl> + __global__ void kernel ( const PtrStepSz < T > src , const Mask mask , T * minval , T * maxval , unsigned int * minloc , unsigned int * maxloc , const int twidth , const int theight ) <nl> + { <nl> + typedef typename MinMaxTypeTraits < T > : : best_type work_type ; <nl> <nl> - if ( tid = = 0 ) <nl> - { <nl> - res . x = smem [ 0 ] ; <nl> - res . y = smem [ nthreads ] ; <nl> - result [ 0 ] = res ; <nl> - } <nl> - } <nl> + __shared__ work_type sminval [ BLOCK_SIZE ] ; <nl> + __shared__ work_type smaxval [ BLOCK_SIZE ] ; <nl> + __shared__ unsigned int sminloc [ BLOCK_SIZE ] ; <nl> + __shared__ unsigned int smaxloc [ BLOCK_SIZE ] ; <nl> + __shared__ bool is_last ; <nl> <nl> + const int x0 = blockIdx . x * blockDim . x * twidth + threadIdx . x ; <nl> + const int y0 = blockIdx . y * blockDim . y * theight + threadIdx . y ; <nl> <nl> - template < typename T , typename R , typename Op , int nthreads > <nl> - __global__ void sumKernel_C3 ( const PtrStepSzb src , typename TypeVec < R , 3 > : : vec_type * result ) <nl> - { <nl> - typedef typename TypeVec < T , 3 > : : vec_type SrcType ; <nl> - typedef typename TypeVec < R , 3 > : : vec_type DstType ; <nl> + const int tid = threadIdx . y * blockDim . x + threadIdx . x ; <nl> + const int bid = blockIdx . y * gridDim . x + blockIdx . x ; <nl> <nl> - __shared__ R smem [ nthreads * 3 ] ; <nl> + work_type mymin = numeric_limits < work_type > : : max ( ) ; <nl> + work_type mymax = - numeric_limits < work_type > : : max ( ) ; <nl> + unsigned int myminloc = 0 ; <nl> + unsigned int mymaxloc = 0 ; <nl> <nl> - const int x0 = blockIdx . x * blockDim . x * ctwidth + threadIdx . x ; <nl> - const int y0 = blockIdx . y * blockDim . y * ctheight + threadIdx . y ; <nl> - const int tid = threadIdx . y * blockDim . x + threadIdx . x ; <nl> - const int bid = blockIdx . y * gridDim . x + blockIdx . x ; <nl> + for ( int i = 0 , y = y0 ; i < theight & & y < src . rows ; + + i , y + = blockDim . y ) <nl> + { <nl> + const T * ptr = src . ptr ( y ) ; <nl> <nl> - SrcType val ; <nl> - DstType sum = VecTraits < DstType > : : all ( 0 ) ; <nl> - for ( int y = 0 ; y < ctheight & & y0 + y * blockDim . y < src . rows ; + + y ) <nl> + for ( int j = 0 , x = x0 ; j < twidth & & x < src . cols ; + + j , x + = blockDim . x ) <nl> + { <nl> + if ( mask ( y , x ) ) <nl> { <nl> - const SrcType * ptr = ( const SrcType * ) src . ptr ( y0 + y * blockDim . y ) ; <nl> - for ( int x = 0 ; x < ctwidth & & x0 + x * blockDim . x < src . cols ; + + x ) <nl> + const work_type srcVal = ptr [ x ] ; <nl> + <nl> + if ( srcVal < mymin ) <nl> { <nl> - val = ptr [ x0 + x * blockDim . x ] ; <nl> - sum = sum + VecTraits < DstType > : : make ( Op : : call ( val . x ) , Op : : call ( val . y ) , Op : : call ( val . z ) ) ; <nl> + mymin = srcVal ; <nl> + myminloc = y * src . cols + x ; <nl> } <nl> - } <nl> - <nl> - smem [ tid ] = sum . x ; <nl> - smem [ tid + nthreads ] = sum . y ; <nl> - smem [ tid + 2 * nthreads ] = sum . z ; <nl> - __syncthreads ( ) ; <nl> - <nl> - sumInSmem < nthreads , R > ( smem , tid ) ; <nl> - sumInSmem < nthreads , R > ( smem + nthreads , tid ) ; <nl> - sumInSmem < nthreads , R > ( smem + 2 * nthreads , tid ) ; <nl> - <nl> - # if defined ( __CUDA_ARCH__ ) & & __CUDA_ARCH__ > = 110 <nl> - __shared__ bool is_last ; <nl> - <nl> - if ( tid = = 0 ) <nl> - { <nl> - DstType res ; <nl> - res . x = smem [ 0 ] ; <nl> - res . y = smem [ nthreads ] ; <nl> - res . z = smem [ 2 * nthreads ] ; <nl> - result [ bid ] = res ; <nl> - __threadfence ( ) ; <nl> - <nl> - uint ticket = atomicInc ( & blocks_finished , gridDim . x * gridDim . y ) ; <nl> - is_last = ( ticket = = gridDim . x * gridDim . y - 1 ) ; <nl> - } <nl> - <nl> - __syncthreads ( ) ; <nl> - <nl> - if ( is_last ) <nl> - { <nl> - DstType res = tid < gridDim . x * gridDim . y ? result [ tid ] : VecTraits < DstType > : : all ( 0 ) ; <nl> - smem [ tid ] = res . x ; <nl> - smem [ tid + nthreads ] = res . y ; <nl> - smem [ tid + 2 * nthreads ] = res . z ; <nl> - __syncthreads ( ) ; <nl> <nl> - sumInSmem < nthreads , R > ( smem , tid ) ; <nl> - sumInSmem < nthreads , R > ( smem + nthreads , tid ) ; <nl> - sumInSmem < nthreads , R > ( smem + 2 * nthreads , tid ) ; <nl> - <nl> - if ( tid = = 0 ) <nl> + if ( srcVal > mymax ) <nl> { <nl> - res . x = smem [ 0 ] ; <nl> - res . y = smem [ nthreads ] ; <nl> - res . z = smem [ 2 * nthreads ] ; <nl> - result [ 0 ] = res ; <nl> - blocks_finished = 0 ; <nl> + mymax = srcVal ; <nl> + mymaxloc = y * src . cols + x ; <nl> } <nl> } <nl> - # else <nl> - if ( tid = = 0 ) <nl> - { <nl> - DstType res ; <nl> - res . x = smem [ 0 ] ; <nl> - res . y = smem [ nthreads ] ; <nl> - res . z = smem [ 2 * nthreads ] ; <nl> - result [ bid ] = res ; <nl> - } <nl> - # endif <nl> - } <nl> - <nl> - <nl> - template < typename T , typename R , int nthreads > <nl> - __global__ void sumPass2Kernel_C3 ( typename TypeVec < R , 3 > : : vec_type * result , int size ) <nl> - { <nl> - typedef typename TypeVec < R , 3 > : : vec_type DstType ; <nl> - <nl> - __shared__ R smem [ nthreads * 3 ] ; <nl> - <nl> - const int tid = threadIdx . y * blockDim . x + threadIdx . x ; <nl> - <nl> - DstType res = tid < size ? result [ tid ] : VecTraits < DstType > : : all ( 0 ) ; <nl> - smem [ tid ] = res . x ; <nl> - smem [ tid + nthreads ] = res . y ; <nl> - smem [ tid + 2 * nthreads ] = res . z ; <nl> - __syncthreads ( ) ; <nl> - <nl> - sumInSmem < nthreads , R > ( smem , tid ) ; <nl> - sumInSmem < nthreads , R > ( smem + nthreads , tid ) ; <nl> - sumInSmem < nthreads , R > ( smem + 2 * nthreads , tid ) ; <nl> - <nl> - if ( tid = = 0 ) <nl> - { <nl> - res . x = smem [ 0 ] ; <nl> - res . y = smem [ nthreads ] ; <nl> - res . z = smem [ 2 * nthreads ] ; <nl> - result [ 0 ] = res ; <nl> - } <nl> } <nl> + } <nl> <nl> - template < typename T , typename R , typename Op , int nthreads > <nl> - __global__ void sumKernel_C4 ( const PtrStepSzb src , typename TypeVec < R , 4 > : : vec_type * result ) <nl> - { <nl> - typedef typename TypeVec < T , 4 > : : vec_type SrcType ; <nl> - typedef typename TypeVec < R , 4 > : : vec_type DstType ; <nl> + reduceKeyVal < BLOCK_SIZE > ( smem_tuple ( sminval , smaxval ) , thrust : : tie ( mymin , mymax ) , <nl> + smem_tuple ( sminloc , smaxloc ) , thrust : : tie ( myminloc , mymaxloc ) , <nl> + tid , <nl> + thrust : : make_tuple ( less < work_type > ( ) , greater < work_type > ( ) ) ) ; <nl> <nl> - __shared__ R smem [ nthreads * 4 ] ; <nl> + if ( tid = = 0 ) <nl> + { <nl> + minval [ bid ] = ( T ) mymin ; <nl> + maxval [ bid ] = ( T ) mymax ; <nl> + minloc [ bid ] = myminloc ; <nl> + maxloc [ bid ] = mymaxloc ; <nl> <nl> - const int x0 = blockIdx . x * blockDim . x * ctwidth + threadIdx . x ; <nl> - const int y0 = blockIdx . y * blockDim . y * ctheight + threadIdx . y ; <nl> - const int tid = threadIdx . y * blockDim . x + threadIdx . x ; <nl> - const int bid = blockIdx . y * gridDim . x + blockIdx . x ; <nl> + __threadfence ( ) ; <nl> <nl> - SrcType val ; <nl> - DstType sum = VecTraits < DstType > : : all ( 0 ) ; <nl> - for ( int y = 0 ; y < ctheight & & y0 + y * blockDim . y < src . rows ; + + y ) <nl> - { <nl> - const SrcType * ptr = ( const SrcType * ) src . ptr ( y0 + y * blockDim . y ) ; <nl> - for ( int x = 0 ; x < ctwidth & & x0 + x * blockDim . x < src . cols ; + + x ) <nl> - { <nl> - val = ptr [ x0 + x * blockDim . x ] ; <nl> - sum = sum + VecTraits < DstType > : : make ( Op : : call ( val . x ) , Op : : call ( val . y ) , <nl> - Op : : call ( val . z ) , Op : : call ( val . w ) ) ; <nl> - } <nl> - } <nl> + unsigned int ticket = : : atomicInc ( & blocks_finished , gridDim . x * gridDim . y ) ; <nl> + is_last = ( ticket = = gridDim . x * gridDim . y - 1 ) ; <nl> + } <nl> <nl> - smem [ tid ] = sum . x ; <nl> - smem [ tid + nthreads ] = sum . y ; <nl> - smem [ tid + 2 * nthreads ] = sum . z ; <nl> - smem [ tid + 3 * nthreads ] = sum . w ; <nl> - __syncthreads ( ) ; <nl> + __syncthreads ( ) ; <nl> <nl> - sumInSmem < nthreads , R > ( smem , tid ) ; <nl> - sumInSmem < nthreads , R > ( smem + nthreads , tid ) ; <nl> - sumInSmem < nthreads , R > ( smem + 2 * nthreads , tid ) ; <nl> - sumInSmem < nthreads , R > ( smem + 3 * nthreads , tid ) ; <nl> + if ( is_last ) <nl> + { <nl> + unsigned int idx = : : min ( tid , gridDim . x * gridDim . y - 1 ) ; <nl> <nl> - # if defined ( __CUDA_ARCH__ ) & & ( __CUDA_ARCH__ > = 110 ) <nl> - __shared__ bool is_last ; <nl> + mymin = minval [ idx ] ; <nl> + mymax = maxval [ idx ] ; <nl> + myminloc = minloc [ idx ] ; <nl> + mymaxloc = maxloc [ idx ] ; <nl> <nl> - if ( tid = = 0 ) <nl> - { <nl> - DstType res ; <nl> - res . x = smem [ 0 ] ; <nl> - res . y = smem [ nthreads ] ; <nl> - res . z = smem [ 2 * nthreads ] ; <nl> - res . w = smem [ 3 * nthreads ] ; <nl> - result [ bid ] = res ; <nl> - __threadfence ( ) ; <nl> - <nl> - uint ticket = atomicInc ( & blocks_finished , gridDim . x * gridDim . y ) ; <nl> - is_last = ( ticket = = gridDim . x * gridDim . y - 1 ) ; <nl> - } <nl> + reduceKeyVal < BLOCK_SIZE > ( smem_tuple ( sminval , smaxval ) , thrust : : tie ( mymin , mymax ) , <nl> + smem_tuple ( sminloc , smaxloc ) , thrust : : tie ( myminloc , mymaxloc ) , <nl> + tid , <nl> + thrust : : make_tuple ( less < work_type > ( ) , greater < work_type > ( ) ) ) ; <nl> <nl> - __syncthreads ( ) ; <nl> + if ( tid = = 0 ) <nl> + { <nl> + minval [ 0 ] = ( T ) mymin ; <nl> + maxval [ 0 ] = ( T ) mymax ; <nl> + minloc [ 0 ] = myminloc ; <nl> + maxloc [ 0 ] = mymaxloc ; <nl> <nl> - if ( is_last ) <nl> - { <nl> - DstType res = tid < gridDim . x * gridDim . y ? result [ tid ] : VecTraits < DstType > : : all ( 0 ) ; <nl> - smem [ tid ] = res . x ; <nl> - smem [ tid + nthreads ] = res . y ; <nl> - smem [ tid + 2 * nthreads ] = res . z ; <nl> - smem [ tid + 3 * nthreads ] = res . w ; <nl> - __syncthreads ( ) ; <nl> - <nl> - sumInSmem < nthreads , R > ( smem , tid ) ; <nl> - sumInSmem < nthreads , R > ( smem + nthreads , tid ) ; <nl> - sumInSmem < nthreads , R > ( smem + 2 * nthreads , tid ) ; <nl> - sumInSmem < nthreads , R > ( smem + 3 * nthreads , tid ) ; <nl> - <nl> - if ( tid = = 0 ) <nl> - { <nl> - res . x = smem [ 0 ] ; <nl> - res . y = smem [ nthreads ] ; <nl> - res . z = smem [ 2 * nthreads ] ; <nl> - res . w = smem [ 3 * nthreads ] ; <nl> - result [ 0 ] = res ; <nl> - blocks_finished = 0 ; <nl> - } <nl> - } <nl> - # else <nl> - if ( tid = = 0 ) <nl> - { <nl> - DstType res ; <nl> - res . x = smem [ 0 ] ; <nl> - res . y = smem [ nthreads ] ; <nl> - res . z = smem [ 2 * nthreads ] ; <nl> - res . w = smem [ 3 * nthreads ] ; <nl> - result [ bid ] = res ; <nl> - } <nl> - # endif <nl> + blocks_finished = 0 ; <nl> } <nl> + } <nl> + } <nl> <nl> + const int threads_x = 32 ; <nl> + const int threads_y = 8 ; <nl> <nl> - template < typename T , typename R , int nthreads > <nl> - __global__ void sumPass2Kernel_C4 ( typename TypeVec < R , 4 > : : vec_type * result , int size ) <nl> - { <nl> - typedef typename TypeVec < R , 4 > : : vec_type DstType ; <nl> - <nl> - __shared__ R smem [ nthreads * 4 ] ; <nl> + void getLaunchCfg ( int cols , int rows , dim3 & block , dim3 & grid ) <nl> + { <nl> + block = dim3 ( threads_x , threads_y ) ; <nl> <nl> - const int tid = threadIdx . y * blockDim . x + threadIdx . x ; <nl> + grid = dim3 ( divUp ( cols , block . x * block . y ) , <nl> + divUp ( rows , block . y * block . x ) ) ; <nl> <nl> - DstType res = tid < size ? result [ tid ] : VecTraits < DstType > : : all ( 0 ) ; <nl> - smem [ tid ] = res . x ; <nl> - smem [ tid + nthreads ] = res . y ; <nl> - smem [ tid + 2 * nthreads ] = res . z ; <nl> - smem [ tid + 3 * nthreads ] = res . w ; <nl> - __syncthreads ( ) ; <nl> + grid . x = : : min ( grid . x , block . x ) ; <nl> + grid . y = : : min ( grid . y , block . y ) ; <nl> + } <nl> <nl> - sumInSmem < nthreads , R > ( smem , tid ) ; <nl> - sumInSmem < nthreads , R > ( smem + nthreads , tid ) ; <nl> - sumInSmem < nthreads , R > ( smem + 2 * nthreads , tid ) ; <nl> - sumInSmem < nthreads , R > ( smem + 3 * nthreads , tid ) ; <nl> + void getBufSize ( int cols , int rows , size_t elem_size , int & b1cols , int & b1rows , int & b2cols , int & b2rows ) <nl> + { <nl> + dim3 block , grid ; <nl> + getLaunchCfg ( cols , rows , block , grid ) ; <nl> <nl> - if ( tid = = 0 ) <nl> - { <nl> - res . x = smem [ 0 ] ; <nl> - res . y = smem [ nthreads ] ; <nl> - res . z = smem [ 2 * nthreads ] ; <nl> - res . w = smem [ 3 * nthreads ] ; <nl> - result [ 0 ] = res ; <nl> - } <nl> - } <nl> + / / For values <nl> + b1cols = grid . x * grid . y * elem_size ; <nl> + b1rows = 2 ; <nl> <nl> - template < typename T > <nl> - void sumMultipassCaller ( const PtrStepSzb src , PtrStepb buf , double * sum , int cn ) <nl> - { <nl> - typedef typename SumType < T > : : R R ; <nl> + / / For locations <nl> + b2cols = grid . x * grid . y * sizeof ( int ) ; <nl> + b2rows = 2 ; <nl> + } <nl> <nl> - dim3 threads , grid ; <nl> - estimateThreadCfg ( src . cols , src . rows , threads , grid ) ; <nl> - setKernelConsts ( src . cols , src . rows , threads , grid ) ; <nl> + template < typename T > <nl> + void run ( const PtrStepSzb src , const PtrStepb mask , double * minval , double * maxval , int * minloc , int * maxloc , PtrStepb valbuf , PtrStep < unsigned int > locbuf ) <nl> + { <nl> + dim3 block , grid ; <nl> + getLaunchCfg ( src . cols , src . rows , block , grid ) ; <nl> + <nl> + const int twidth = divUp ( divUp ( src . cols , grid . x ) , block . x ) ; <nl> + const int theight = divUp ( divUp ( src . rows , grid . y ) , block . y ) ; <nl> + <nl> + T * minval_buf = ( T * ) valbuf . ptr ( 0 ) ; <nl> + T * maxval_buf = ( T * ) valbuf . ptr ( 1 ) ; <nl> + unsigned int * minloc_buf = locbuf . ptr ( 0 ) ; <nl> + unsigned int * maxloc_buf = locbuf . ptr ( 1 ) ; <nl> + <nl> + if ( mask . data ) <nl> + kernel < threads_x * threads_y > < < < grid , block > > > ( ( PtrStepSz < T > ) src , SingleMask ( mask ) , minval_buf , maxval_buf , minloc_buf , maxloc_buf , twidth , theight ) ; <nl> + else <nl> + kernel < threads_x * threads_y > < < < grid , block > > > ( ( PtrStepSz < T > ) src , WithOutMask ( ) , minval_buf , maxval_buf , minloc_buf , maxloc_buf , twidth , theight ) ; <nl> + <nl> + cudaSafeCall ( cudaGetLastError ( ) ) ; <nl> + <nl> + cudaSafeCall ( cudaDeviceSynchronize ( ) ) ; <nl> + <nl> + T minval_ , maxval_ ; <nl> + cudaSafeCall ( cudaMemcpy ( & minval_ , minval_buf , sizeof ( T ) , cudaMemcpyDeviceToHost ) ) ; <nl> + cudaSafeCall ( cudaMemcpy ( & maxval_ , maxval_buf , sizeof ( T ) , cudaMemcpyDeviceToHost ) ) ; <nl> + * minval = minval_ ; <nl> + * maxval = maxval_ ; <nl> + <nl> + unsigned int minloc_ , maxloc_ ; <nl> + cudaSafeCall ( cudaMemcpy ( & minloc_ , minloc_buf , sizeof ( unsigned int ) , cudaMemcpyDeviceToHost ) ) ; <nl> + cudaSafeCall ( cudaMemcpy ( & maxloc_ , maxloc_buf , sizeof ( unsigned int ) , cudaMemcpyDeviceToHost ) ) ; <nl> + minloc [ 1 ] = minloc_ / src . cols ; minloc [ 0 ] = minloc_ - minloc [ 1 ] * src . cols ; <nl> + maxloc [ 1 ] = maxloc_ / src . cols ; maxloc [ 0 ] = maxloc_ - maxloc [ 1 ] * src . cols ; <nl> + } <nl> + <nl> + template void run < uchar > ( const PtrStepSzb src , const PtrStepb mask , double * minval , double * maxval , int * minloc , int * maxloc , PtrStepb valbuf , PtrStep < unsigned int > locbuf ) ; <nl> + template void run < schar > ( const PtrStepSzb src , const PtrStepb mask , double * minval , double * maxval , int * minloc , int * maxloc , PtrStepb valbuf , PtrStep < unsigned int > locbuf ) ; <nl> + template void run < ushort > ( const PtrStepSzb src , const PtrStepb mask , double * minval , double * maxval , int * minloc , int * maxloc , PtrStepb valbuf , PtrStep < unsigned int > locbuf ) ; <nl> + template void run < short > ( const PtrStepSzb src , const PtrStepb mask , double * minval , double * maxval , int * minloc , int * maxloc , PtrStepb valbuf , PtrStep < unsigned int > locbuf ) ; <nl> + template void run < int > ( const PtrStepSzb src , const PtrStepb mask , double * minval , double * maxval , int * minloc , int * maxloc , PtrStepb valbuf , PtrStep < unsigned int > locbuf ) ; <nl> + template void run < float > ( const PtrStepSzb src , const PtrStepb mask , double * minval , double * maxval , int * minloc , int * maxloc , PtrStepb valbuf , PtrStep < unsigned int > locbuf ) ; <nl> + template void run < double > ( const PtrStepSzb src , const PtrStepb mask , double * minval , double * maxval , int * minloc , int * maxloc , PtrStepb valbuf , PtrStep < unsigned int > locbuf ) ; <nl> + } <nl> + <nl> + / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / <nl> + / / countNonZero <nl> + <nl> + namespace countNonZero <nl> + { <nl> + __device__ unsigned int blocks_finished = 0 ; <nl> <nl> - switch ( cn ) <nl> - { <nl> - case 1 : <nl> - sumKernel < T , R , IdentityOp < R > , threads_x * threads_y > < < < grid , threads > > > ( <nl> - src , ( typename TypeVec < R , 1 > : : vec_type * ) buf . ptr ( 0 ) ) ; <nl> - cudaSafeCall ( cudaGetLastError ( ) ) ; <nl> - <nl> - sumPass2Kernel < T , R , threads_x * threads_y > < < < 1 , threads_x * threads_y > > > ( <nl> - ( typename TypeVec < R , 1 > : : vec_type * ) buf . ptr ( 0 ) , grid . x * grid . y ) ; <nl> - cudaSafeCall ( cudaGetLastError ( ) ) ; <nl> - <nl> - break ; <nl> - case 2 : <nl> - sumKernel_C2 < T , R , IdentityOp < R > , threads_x * threads_y > < < < grid , threads > > > ( <nl> - src , ( typename TypeVec < R , 2 > : : vec_type * ) buf . ptr ( 0 ) ) ; <nl> - cudaSafeCall ( cudaGetLastError ( ) ) ; <nl> - <nl> - sumPass2Kernel_C2 < T , R , threads_x * threads_y > < < < 1 , threads_x * threads_y > > > ( <nl> - ( typename TypeVec < R , 2 > : : vec_type * ) buf . ptr ( 0 ) , grid . x * grid . y ) ; <nl> - cudaSafeCall ( cudaGetLastError ( ) ) ; <nl> - <nl> - break ; <nl> - case 3 : <nl> - sumKernel_C3 < T , R , IdentityOp < R > , threads_x * threads_y > < < < grid , threads > > > ( <nl> - src , ( typename TypeVec < R , 3 > : : vec_type * ) buf . ptr ( 0 ) ) ; <nl> - cudaSafeCall ( cudaGetLastError ( ) ) ; <nl> - <nl> - sumPass2Kernel_C3 < T , R , threads_x * threads_y > < < < 1 , threads_x * threads_y > > > ( <nl> - ( typename TypeVec < R , 3 > : : vec_type * ) buf . ptr ( 0 ) , grid . x * grid . y ) ; <nl> - cudaSafeCall ( cudaGetLastError ( ) ) ; <nl> - <nl> - break ; <nl> - case 4 : <nl> - sumKernel_C4 < T , R , IdentityOp < R > , threads_x * threads_y > < < < grid , threads > > > ( <nl> - src , ( typename TypeVec < R , 4 > : : vec_type * ) buf . ptr ( 0 ) ) ; <nl> - cudaSafeCall ( cudaGetLastError ( ) ) ; <nl> - <nl> - sumPass2Kernel_C4 < T , R , threads_x * threads_y > < < < 1 , threads_x * threads_y > > > ( <nl> - ( typename TypeVec < R , 4 > : : vec_type * ) buf . ptr ( 0 ) , grid . x * grid . y ) ; <nl> - cudaSafeCall ( cudaGetLastError ( ) ) ; <nl> - <nl> - break ; <nl> - } <nl> - cudaSafeCall ( cudaDeviceSynchronize ( ) ) ; <nl> + template < int BLOCK_SIZE , typename T > <nl> + __global__ void kernel ( const PtrStepSz < T > src , unsigned int * count , const int twidth , const int theight ) <nl> + { <nl> + __shared__ unsigned int scount [ BLOCK_SIZE ] ; <nl> + __shared__ bool is_last ; <nl> <nl> - R result [ 4 ] = { 0 , 0 , 0 , 0 } ; <nl> - cudaSafeCall ( cudaMemcpy ( & result , buf . ptr ( 0 ) , sizeof ( R ) * cn , cudaMemcpyDeviceToHost ) ) ; <nl> + const int x0 = blockIdx . x * blockDim . x * twidth + threadIdx . x ; <nl> + const int y0 = blockIdx . y * blockDim . y * theight + threadIdx . y ; <nl> <nl> - sum [ 0 ] = result [ 0 ] ; <nl> - sum [ 1 ] = result [ 1 ] ; <nl> - sum [ 2 ] = result [ 2 ] ; <nl> - sum [ 3 ] = result [ 3 ] ; <nl> - } <nl> + const int tid = threadIdx . y * blockDim . x + threadIdx . x ; <nl> + const int bid = blockIdx . y * gridDim . x + blockIdx . x ; <nl> <nl> - template void sumMultipassCaller < uchar > ( const PtrStepSzb , PtrStepb , double * , int ) ; <nl> - template void sumMultipassCaller < char > ( const PtrStepSzb , PtrStepb , double * , int ) ; <nl> - template void sumMultipassCaller < ushort > ( const PtrStepSzb , PtrStepb , double * , int ) ; <nl> - template void sumMultipassCaller < short > ( const PtrStepSzb , PtrStepb , double * , int ) ; <nl> - template void sumMultipassCaller < int > ( const PtrStepSzb , PtrStepb , double * , int ) ; <nl> - template void sumMultipassCaller < float > ( const PtrStepSzb , PtrStepb , double * , int ) ; <nl> + unsigned int mycount = 0 ; <nl> <nl> + for ( int i = 0 , y = y0 ; i < theight & & y < src . rows ; + + i , y + = blockDim . y ) <nl> + { <nl> + const T * ptr = src . ptr ( y ) ; <nl> <nl> - template < typename T > <nl> - void sumCaller ( const PtrStepSzb src , PtrStepb buf , double * sum , int cn ) <nl> + for ( int j = 0 , x = x0 ; j < twidth & & x < src . cols ; + + j , x + = blockDim . x ) <nl> { <nl> - typedef typename SumType < T > : : R R ; <nl> - <nl> - dim3 threads , grid ; <nl> - estimateThreadCfg ( src . cols , src . rows , threads , grid ) ; <nl> - setKernelConsts ( src . cols , src . rows , threads , grid ) ; <nl> - <nl> - switch ( cn ) <nl> - { <nl> - case 1 : <nl> - sumKernel < T , R , IdentityOp < R > , threads_x * threads_y > < < < grid , threads > > > ( <nl> - src , ( typename TypeVec < R , 1 > : : vec_type * ) buf . ptr ( 0 ) ) ; <nl> - break ; <nl> - case 2 : <nl> - sumKernel_C2 < T , R , IdentityOp < R > , threads_x * threads_y > < < < grid , threads > > > ( <nl> - src , ( typename TypeVec < R , 2 > : : vec_type * ) buf . ptr ( 0 ) ) ; <nl> - break ; <nl> - case 3 : <nl> - sumKernel_C3 < T , R , IdentityOp < R > , threads_x * threads_y > < < < grid , threads > > > ( <nl> - src , ( typename TypeVec < R , 3 > : : vec_type * ) buf . ptr ( 0 ) ) ; <nl> - break ; <nl> - case 4 : <nl> - sumKernel_C4 < T , R , IdentityOp < R > , threads_x * threads_y > < < < grid , threads > > > ( <nl> - src , ( typename TypeVec < R , 4 > : : vec_type * ) buf . ptr ( 0 ) ) ; <nl> - break ; <nl> - } <nl> - cudaSafeCall ( cudaGetLastError ( ) ) ; <nl> - <nl> - cudaSafeCall ( cudaDeviceSynchronize ( ) ) ; <nl> + const T srcVal = ptr [ x ] ; <nl> <nl> - R result [ 4 ] = { 0 , 0 , 0 , 0 } ; <nl> - cudaSafeCall ( cudaMemcpy ( & result , buf . ptr ( 0 ) , sizeof ( R ) * cn , cudaMemcpyDeviceToHost ) ) ; <nl> - <nl> - sum [ 0 ] = result [ 0 ] ; <nl> - sum [ 1 ] = result [ 1 ] ; <nl> - sum [ 2 ] = result [ 2 ] ; <nl> - sum [ 3 ] = result [ 3 ] ; <nl> + mycount + = ( srcVal ! = 0 ) ; <nl> } <nl> + } <nl> <nl> - template void sumCaller < uchar > ( const PtrStepSzb , PtrStepb , double * , int ) ; <nl> - template void sumCaller < char > ( const PtrStepSzb , PtrStepb , double * , int ) ; <nl> - template void sumCaller < ushort > ( const PtrStepSzb , PtrStepb , double * , int ) ; <nl> - template void sumCaller < short > ( const PtrStepSzb , PtrStepb , double * , int ) ; <nl> - template void sumCaller < int > ( const PtrStepSzb , PtrStepb , double * , int ) ; <nl> - template void sumCaller < float > ( const PtrStepSzb , PtrStepb , double * , int ) ; <nl> - <nl> + device : : reduce < BLOCK_SIZE > ( scount , mycount , tid , plus < unsigned int > ( ) ) ; <nl> <nl> - template < typename T > <nl> - void absSumMultipassCaller ( const PtrStepSzb src , PtrStepb buf , double * sum , int cn ) <nl> - { <nl> - typedef typename SumType < T > : : R R ; <nl> + # if __CUDA_ARCH__ > = 200 <nl> + if ( tid = = 0 ) <nl> + : : atomicAdd ( count , mycount ) ; <nl> + # else <nl> + if ( tid = = 0 ) <nl> + { <nl> + count [ bid ] = mycount ; <nl> <nl> - dim3 threads , grid ; <nl> - estimateThreadCfg ( src . cols , src . rows , threads , grid ) ; <nl> - setKernelConsts ( src . cols , src . rows , threads , grid ) ; <nl> + __threadfence ( ) ; <nl> <nl> - switch ( cn ) <nl> - { <nl> - case 1 : <nl> - sumKernel < T , R , AbsOp < R > , threads_x * threads_y > < < < grid , threads > > > ( <nl> - src , ( typename TypeVec < R , 1 > : : vec_type * ) buf . ptr ( 0 ) ) ; <nl> - cudaSafeCall ( cudaGetLastError ( ) ) ; <nl> - <nl> - sumPass2Kernel < T , R , threads_x * threads_y > < < < 1 , threads_x * threads_y > > > ( <nl> - ( typename TypeVec < R , 1 > : : vec_type * ) buf . ptr ( 0 ) , grid . x * grid . y ) ; <nl> - cudaSafeCall ( cudaGetLastError ( ) ) ; <nl> - <nl> - break ; <nl> - case 2 : <nl> - sumKernel_C2 < T , R , AbsOp < R > , threads_x * threads_y > < < < grid , threads > > > ( <nl> - src , ( typename TypeVec < R , 2 > : : vec_type * ) buf . ptr ( 0 ) ) ; <nl> - cudaSafeCall ( cudaGetLastError ( ) ) ; <nl> - <nl> - sumPass2Kernel_C2 < T , R , threads_x * threads_y > < < < 1 , threads_x * threads_y > > > ( <nl> - ( typename TypeVec < R , 2 > : : vec_type * ) buf . ptr ( 0 ) , grid . x * grid . y ) ; <nl> - cudaSafeCall ( cudaGetLastError ( ) ) ; <nl> - <nl> - break ; <nl> - case 3 : <nl> - sumKernel_C3 < T , R , AbsOp < R > , threads_x * threads_y > < < < grid , threads > > > ( <nl> - src , ( typename TypeVec < R , 3 > : : vec_type * ) buf . ptr ( 0 ) ) ; <nl> - cudaSafeCall ( cudaGetLastError ( ) ) ; <nl> - <nl> - sumPass2Kernel_C3 < T , R , threads_x * threads_y > < < < 1 , threads_x * threads_y > > > ( <nl> - ( typename TypeVec < R , 3 > : : vec_type * ) buf . ptr ( 0 ) , grid . x * grid . y ) ; <nl> - cudaSafeCall ( cudaGetLastError ( ) ) ; <nl> - <nl> - break ; <nl> - case 4 : <nl> - sumKernel_C4 < T , R , AbsOp < R > , threads_x * threads_y > < < < grid , threads > > > ( <nl> - src , ( typename TypeVec < R , 4 > : : vec_type * ) buf . ptr ( 0 ) ) ; <nl> - cudaSafeCall ( cudaGetLastError ( ) ) ; <nl> - <nl> - sumPass2Kernel_C4 < T , R , threads_x * threads_y > < < < 1 , threads_x * threads_y > > > ( <nl> - ( typename TypeVec < R , 4 > : : vec_type * ) buf . ptr ( 0 ) , grid . x * grid . y ) ; <nl> - cudaSafeCall ( cudaGetLastError ( ) ) ; <nl> - <nl> - break ; <nl> - } <nl> - cudaSafeCall ( cudaDeviceSynchronize ( ) ) ; <nl> - <nl> - R result [ 4 ] = { 0 , 0 , 0 , 0 } ; <nl> - cudaSafeCall ( cudaMemcpy ( result , buf . ptr ( 0 ) , sizeof ( R ) * cn , cudaMemcpyDeviceToHost ) ) ; <nl> + unsigned int ticket = : : atomicInc ( & blocks_finished , gridDim . x * gridDim . y ) ; <nl> + is_last = ( ticket = = gridDim . x * gridDim . y - 1 ) ; <nl> + } <nl> <nl> - sum [ 0 ] = result [ 0 ] ; <nl> - sum [ 1 ] = result [ 1 ] ; <nl> - sum [ 2 ] = result [ 2 ] ; <nl> - sum [ 3 ] = result [ 3 ] ; <nl> - } <nl> + __syncthreads ( ) ; <nl> <nl> - template void absSumMultipassCaller < uchar > ( const PtrStepSzb , PtrStepb , double * , int ) ; <nl> - template void absSumMultipassCaller < char > ( const PtrStepSzb , PtrStepb , double * , int ) ; <nl> - template void absSumMultipassCaller < ushort > ( const PtrStepSzb , PtrStepb , double * , int ) ; <nl> - template void absSumMultipassCaller < short > ( const PtrStepSzb , PtrStepb , double * , int ) ; <nl> - template void absSumMultipassCaller < int > ( const PtrStepSzb , PtrStepb , double * , int ) ; <nl> - template void absSumMultipassCaller < float > ( const PtrStepSzb , PtrStepb , double * , int ) ; <nl> + if ( is_last ) <nl> + { <nl> + mycount = tid < gridDim . x * gridDim . y ? count [ tid ] : 0 ; <nl> <nl> + device : : reduce < BLOCK_SIZE > ( scount , mycount , tid , plus < unsigned int > ( ) ) ; <nl> <nl> - template < typename T > <nl> - void absSumCaller ( const PtrStepSzb src , PtrStepb buf , double * sum , int cn ) <nl> + if ( tid = = 0 ) <nl> { <nl> - typedef typename SumType < T > : : R R ; <nl> - <nl> - dim3 threads , grid ; <nl> - estimateThreadCfg ( src . cols , src . rows , threads , grid ) ; <nl> - setKernelConsts ( src . cols , src . rows , threads , grid ) ; <nl> - <nl> - switch ( cn ) <nl> - { <nl> - case 1 : <nl> - sumKernel < T , R , AbsOp < R > , threads_x * threads_y > < < < grid , threads > > > ( <nl> - src , ( typename TypeVec < R , 1 > : : vec_type * ) buf . ptr ( 0 ) ) ; <nl> - break ; <nl> - case 2 : <nl> - sumKernel_C2 < T , R , AbsOp < R > , threads_x * threads_y > < < < grid , threads > > > ( <nl> - src , ( typename TypeVec < R , 2 > : : vec_type * ) buf . ptr ( 0 ) ) ; <nl> - break ; <nl> - case 3 : <nl> - sumKernel_C3 < T , R , AbsOp < R > , threads_x * threads_y > < < < grid , threads > > > ( <nl> - src , ( typename TypeVec < R , 3 > : : vec_type * ) buf . ptr ( 0 ) ) ; <nl> - break ; <nl> - case 4 : <nl> - sumKernel_C4 < T , R , AbsOp < R > , threads_x * threads_y > < < < grid , threads > > > ( <nl> - src , ( typename TypeVec < R , 4 > : : vec_type * ) buf . ptr ( 0 ) ) ; <nl> - break ; <nl> - } <nl> - cudaSafeCall ( cudaGetLastError ( ) ) ; <nl> - <nl> - cudaSafeCall ( cudaDeviceSynchronize ( ) ) ; <nl> - <nl> - R result [ 4 ] = { 0 , 0 , 0 , 0 } ; <nl> - cudaSafeCall ( cudaMemcpy ( result , buf . ptr ( 0 ) , sizeof ( R ) * cn , cudaMemcpyDeviceToHost ) ) ; <nl> + count [ 0 ] = mycount ; <nl> <nl> - sum [ 0 ] = result [ 0 ] ; <nl> - sum [ 1 ] = result [ 1 ] ; <nl> - sum [ 2 ] = result [ 2 ] ; <nl> - sum [ 3 ] = result [ 3 ] ; <nl> + blocks_finished = 0 ; <nl> } <nl> + } <nl> + # endif <nl> + } <nl> <nl> - template void absSumCaller < uchar > ( const PtrStepSzb , PtrStepb , double * , int ) ; <nl> - template void absSumCaller < char > ( const PtrStepSzb , PtrStepb , double * , int ) ; <nl> - template void absSumCaller < ushort > ( const PtrStepSzb , PtrStepb , double * , int ) ; <nl> - template void absSumCaller < short > ( const PtrStepSzb , PtrStepb , double * , int ) ; <nl> - template void absSumCaller < int > ( const PtrStepSzb , PtrStepb , double * , int ) ; <nl> - template void absSumCaller < float > ( const PtrStepSzb , PtrStepb , double * , int ) ; <nl> - <nl> + const int threads_x = 32 ; <nl> + const int threads_y = 8 ; <nl> <nl> - template < typename T > <nl> - void sqrSumMultipassCaller ( const PtrStepSzb src , PtrStepb buf , double * sum , int cn ) <nl> - { <nl> - typedef typename SumType < T > : : R R ; <nl> + void getLaunchCfg ( int cols , int rows , dim3 & block , dim3 & grid ) <nl> + { <nl> + block = dim3 ( threads_x , threads_y ) ; <nl> <nl> - dim3 threads , grid ; <nl> - estimateThreadCfg ( src . cols , src . rows , threads , grid ) ; <nl> - setKernelConsts ( src . cols , src . rows , threads , grid ) ; <nl> + grid = dim3 ( divUp ( cols , block . x * block . y ) , <nl> + divUp ( rows , block . y * block . x ) ) ; <nl> <nl> - switch ( cn ) <nl> - { <nl> - case 1 : <nl> - sumKernel < T , R , SqrOp < R > , threads_x * threads_y > < < < grid , threads > > > ( <nl> - src , ( typename TypeVec < R , 1 > : : vec_type * ) buf . ptr ( 0 ) ) ; <nl> - cudaSafeCall ( cudaGetLastError ( ) ) ; <nl> - <nl> - sumPass2Kernel < T , R , threads_x * threads_y > < < < 1 , threads_x * threads_y > > > ( <nl> - ( typename TypeVec < R , 1 > : : vec_type * ) buf . ptr ( 0 ) , grid . x * grid . y ) ; <nl> - cudaSafeCall ( cudaGetLastError ( ) ) ; <nl> - <nl> - break ; <nl> - case 2 : <nl> - sumKernel_C2 < T , R , SqrOp < R > , threads_x * threads_y > < < < grid , threads > > > ( <nl> - src , ( typename TypeVec < R , 2 > : : vec_type * ) buf . ptr ( 0 ) ) ; <nl> - cudaSafeCall ( cudaGetLastError ( ) ) ; <nl> - <nl> - sumPass2Kernel_C2 < T , R , threads_x * threads_y > < < < 1 , threads_x * threads_y > > > ( <nl> - ( typename TypeVec < R , 2 > : : vec_type * ) buf . ptr ( 0 ) , grid . x * grid . y ) ; <nl> - cudaSafeCall ( cudaGetLastError ( ) ) ; <nl> - <nl> - break ; <nl> - case 3 : <nl> - sumKernel_C3 < T , R , SqrOp < R > , threads_x * threads_y > < < < grid , threads > > > ( <nl> - src , ( typename TypeVec < R , 3 > : : vec_type * ) buf . ptr ( 0 ) ) ; <nl> - cudaSafeCall ( cudaGetLastError ( ) ) ; <nl> - <nl> - sumPass2Kernel_C3 < T , R , threads_x * threads_y > < < < 1 , threads_x * threads_y > > > ( <nl> - ( typename TypeVec < R , 3 > : : vec_type * ) buf . ptr ( 0 ) , grid . x * grid . y ) ; <nl> - cudaSafeCall ( cudaGetLastError ( ) ) ; <nl> - <nl> - break ; <nl> - case 4 : <nl> - sumKernel_C4 < T , R , SqrOp < R > , threads_x * threads_y > < < < grid , threads > > > ( <nl> - src , ( typename TypeVec < R , 4 > : : vec_type * ) buf . ptr ( 0 ) ) ; <nl> - cudaSafeCall ( cudaGetLastError ( ) ) ; <nl> - <nl> - sumPass2Kernel_C4 < T , R , threads_x * threads_y > < < < 1 , threads_x * threads_y > > > ( <nl> - ( typename TypeVec < R , 4 > : : vec_type * ) buf . ptr ( 0 ) , grid . x * grid . y ) ; <nl> - cudaSafeCall ( cudaGetLastError ( ) ) ; <nl> - <nl> - break ; <nl> - } <nl> - cudaSafeCall ( cudaDeviceSynchronize ( ) ) ; <nl> + grid . x = : : min ( grid . x , block . x ) ; <nl> + grid . y = : : min ( grid . y , block . y ) ; <nl> + } <nl> <nl> - R result [ 4 ] = { 0 , 0 , 0 , 0 } ; <nl> - cudaSafeCall ( cudaMemcpy ( result , buf . ptr ( 0 ) , sizeof ( R ) * cn , cudaMemcpyDeviceToHost ) ) ; <nl> + void getBufSize ( int cols , int rows , int & bufcols , int & bufrows ) <nl> + { <nl> + dim3 block , grid ; <nl> + getLaunchCfg ( cols , rows , block , grid ) ; <nl> <nl> - sum [ 0 ] = result [ 0 ] ; <nl> - sum [ 1 ] = result [ 1 ] ; <nl> - sum [ 2 ] = result [ 2 ] ; <nl> - sum [ 3 ] = result [ 3 ] ; <nl> - } <nl> + bufcols = grid . x * grid . y * sizeof ( int ) ; <nl> + bufrows = 1 ; <nl> + } <nl> <nl> - template void sqrSumMultipassCaller < uchar > ( const PtrStepSzb , PtrStepb , double * , int ) ; <nl> - template void sqrSumMultipassCaller < char > ( const PtrStepSzb , PtrStepb , double * , int ) ; <nl> - template void sqrSumMultipassCaller < ushort > ( const PtrStepSzb , PtrStepb , double * , int ) ; <nl> - template void sqrSumMultipassCaller < short > ( const PtrStepSzb , PtrStepb , double * , int ) ; <nl> - template void sqrSumMultipassCaller < int > ( const PtrStepSzb , PtrStepb , double * , int ) ; <nl> - template void sqrSumMultipassCaller < float > ( const PtrStepSzb , PtrStepb , double * , int ) ; <nl> + template < typename T > <nl> + int run ( const PtrStepSzb src , PtrStep < unsigned int > buf ) <nl> + { <nl> + dim3 block , grid ; <nl> + getLaunchCfg ( src . cols , src . rows , block , grid ) ; <nl> <nl> + const int twidth = divUp ( divUp ( src . cols , grid . x ) , block . x ) ; <nl> + const int theight = divUp ( divUp ( src . rows , grid . y ) , block . y ) ; <nl> <nl> - template < typename T > <nl> - void sqrSumCaller ( const PtrStepSzb src , PtrStepb buf , double * sum , int cn ) <nl> - { <nl> - typedef double R ; <nl> + unsigned int * count_buf = buf . ptr ( 0 ) ; <nl> <nl> - dim3 threads , grid ; <nl> - estimateThreadCfg ( src . cols , src . rows , threads , grid ) ; <nl> - setKernelConsts ( src . cols , src . rows , threads , grid ) ; <nl> + cudaSafeCall ( cudaMemset ( count_buf , 0 , sizeof ( unsigned int ) ) ) ; <nl> <nl> - switch ( cn ) <nl> - { <nl> - case 1 : <nl> - sumKernel < T , R , SqrOp < R > , threads_x * threads_y > < < < grid , threads > > > ( <nl> - src , ( typename TypeVec < R , 1 > : : vec_type * ) buf . ptr ( 0 ) ) ; <nl> - break ; <nl> - case 2 : <nl> - sumKernel_C2 < T , R , SqrOp < R > , threads_x * threads_y > < < < grid , threads > > > ( <nl> - src , ( typename TypeVec < R , 2 > : : vec_type * ) buf . ptr ( 0 ) ) ; <nl> - break ; <nl> - case 3 : <nl> - sumKernel_C3 < T , R , SqrOp < R > , threads_x * threads_y > < < < grid , threads > > > ( <nl> - src , ( typename TypeVec < R , 3 > : : vec_type * ) buf . ptr ( 0 ) ) ; <nl> - break ; <nl> - case 4 : <nl> - sumKernel_C4 < T , R , SqrOp < R > , threads_x * threads_y > < < < grid , threads > > > ( <nl> - src , ( typename TypeVec < R , 4 > : : vec_type * ) buf . ptr ( 0 ) ) ; <nl> - break ; <nl> - } <nl> - cudaSafeCall ( cudaGetLastError ( ) ) ; <nl> + kernel < threads_x * threads_y > < < < grid , block > > > ( ( PtrStepSz < T > ) src , count_buf , twidth , theight ) ; <nl> + cudaSafeCall ( cudaGetLastError ( ) ) ; <nl> <nl> - cudaSafeCall ( cudaDeviceSynchronize ( ) ) ; <nl> + cudaSafeCall ( cudaDeviceSynchronize ( ) ) ; <nl> <nl> - R result [ 4 ] = { 0 , 0 , 0 , 0 } ; <nl> - cudaSafeCall ( cudaMemcpy ( result , buf . ptr ( 0 ) , sizeof ( R ) * cn , cudaMemcpyDeviceToHost ) ) ; <nl> + unsigned int count ; <nl> + cudaSafeCall ( cudaMemcpy ( & count , count_buf , sizeof ( unsigned int ) , cudaMemcpyDeviceToHost ) ) ; <nl> <nl> - sum [ 0 ] = result [ 0 ] ; <nl> - sum [ 1 ] = result [ 1 ] ; <nl> - sum [ 2 ] = result [ 2 ] ; <nl> - sum [ 3 ] = result [ 3 ] ; <nl> - } <nl> + return count ; <nl> + } <nl> <nl> - template void sqrSumCaller < uchar > ( const PtrStepSzb , PtrStepb , double * , int ) ; <nl> - template void sqrSumCaller < char > ( const PtrStepSzb , PtrStepb , double * , int ) ; <nl> - template void sqrSumCaller < ushort > ( const PtrStepSzb , PtrStepb , double * , int ) ; <nl> - template void sqrSumCaller < short > ( const PtrStepSzb , PtrStepb , double * , int ) ; <nl> - template void sqrSumCaller < int > ( const PtrStepSzb , PtrStepb , double * , int ) ; <nl> - template void sqrSumCaller < float > ( const PtrStepSzb , PtrStepb , double * , int ) ; <nl> - } / / namespace sum <nl> + template int run < uchar > ( const PtrStepSzb src , PtrStep < unsigned int > buf ) ; <nl> + template int run < schar > ( const PtrStepSzb src , PtrStep < unsigned int > buf ) ; <nl> + template int run < ushort > ( const PtrStepSzb src , PtrStep < unsigned int > buf ) ; <nl> + template int run < short > ( const PtrStepSzb src , PtrStep < unsigned int > buf ) ; <nl> + template int run < int > ( const PtrStepSzb src , PtrStep < unsigned int > buf ) ; <nl> + template int run < float > ( const PtrStepSzb src , PtrStep < unsigned int > buf ) ; <nl> + template int run < double > ( const PtrStepSzb src , PtrStep < unsigned int > buf ) ; <nl> + } <nl> <nl> - / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / <nl> - / / reduce <nl> + / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / <nl> + / / reduce <nl> <nl> - template < typename S > struct SumReductor <nl> + namespace reduce <nl> + { <nl> + struct Sum <nl> + { <nl> + template < typename T > <nl> + __device__ __forceinline__ T startValue ( ) const <nl> { <nl> - __device__ __forceinline__ S startValue ( ) const <nl> - { <nl> - return 0 ; <nl> - } <nl> - <nl> - __device__ __forceinline__ SumReductor ( const SumReductor & other ) { } <nl> - __device__ __forceinline__ SumReductor ( ) { } <nl> - <nl> - __device__ __forceinline__ S operator ( ) ( volatile S a , volatile S b ) const <nl> - { <nl> - return a + b ; <nl> - } <nl> - <nl> - __device__ __forceinline__ S result ( S r , double ) const <nl> - { <nl> - return r ; <nl> - } <nl> - } ; <nl> + return VecTraits < T > : : all ( 0 ) ; <nl> + } <nl> <nl> - template < typename S > struct AvgReductor <nl> + template < typename T > <nl> + __device__ __forceinline__ T operator ( ) ( T a , T b ) const <nl> { <nl> - __device__ __forceinline__ S startValue ( ) const <nl> - { <nl> - return 0 ; <nl> - } <nl> + return a + b ; <nl> + } <nl> <nl> - __device__ __forceinline__ AvgReductor ( const AvgReductor & other ) { } <nl> - __device__ __forceinline__ AvgReductor ( ) { } <nl> + template < typename T > <nl> + __device__ __forceinline__ T result ( T r , double ) const <nl> + { <nl> + return r ; <nl> + } <nl> <nl> - __device__ __forceinline__ S operator ( ) ( volatile S a , volatile S b ) const <nl> - { <nl> - return a + b ; <nl> - } <nl> + __device__ __forceinline__ Sum ( ) { } <nl> + __device__ __forceinline__ Sum ( const Sum & ) { } <nl> + } ; <nl> <nl> - __device__ __forceinline__ double result ( S r , double sz ) const <nl> - { <nl> - return r / sz ; <nl> - } <nl> - } ; <nl> + struct Avg <nl> + { <nl> + template < typename T > <nl> + __device__ __forceinline__ T startValue ( ) const <nl> + { <nl> + return VecTraits < T > : : all ( 0 ) ; <nl> + } <nl> <nl> - template < typename S > struct MinReductor <nl> + template < typename T > <nl> + __device__ __forceinline__ T operator ( ) ( T a , T b ) const <nl> { <nl> - __device__ __forceinline__ S startValue ( ) const <nl> - { <nl> - return numeric_limits < S > : : max ( ) ; <nl> - } <nl> + return a + b ; <nl> + } <nl> <nl> - __device__ __forceinline__ MinReductor ( const MinReductor & other ) { } <nl> - __device__ __forceinline__ MinReductor ( ) { } <nl> + template < typename T > <nl> + __device__ __forceinline__ typename TypeVec < double , VecTraits < T > : : cn > : : vec_type result ( T r , double sz ) const <nl> + { <nl> + return r / sz ; <nl> + } <nl> <nl> - template < typename T > __device__ __forceinline__ T operator ( ) ( volatile T a , volatile T b ) const <nl> - { <nl> - return saturate_cast < T > ( : : min ( a , b ) ) ; <nl> - } <nl> - __device__ __forceinline__ float operator ( ) ( volatile float a , volatile float b ) const <nl> - { <nl> - return : : fmin ( a , b ) ; <nl> - } <nl> + __device__ __forceinline__ Avg ( ) { } <nl> + __device__ __forceinline__ Avg ( const Avg & ) { } <nl> + } ; <nl> <nl> - __device__ __forceinline__ S result ( S r , double ) const <nl> - { <nl> - return r ; <nl> - } <nl> - } ; <nl> + struct Min <nl> + { <nl> + template < typename T > <nl> + __device__ __forceinline__ T startValue ( ) const <nl> + { <nl> + return VecTraits < T > : : all ( numeric_limits < typename VecTraits < T > : : elem_type > : : max ( ) ) ; <nl> + } <nl> <nl> - template < typename S > struct MaxReductor <nl> + template < typename T > <nl> + __device__ __forceinline__ T operator ( ) ( T a , T b ) const <nl> { <nl> - __device__ __forceinline__ S startValue ( ) const <nl> - { <nl> - return numeric_limits < S > : : min ( ) ; <nl> - } <nl> + minimum < T > minOp ; <nl> + return minOp ( a , b ) ; <nl> + } <nl> <nl> - __device__ __forceinline__ MaxReductor ( const MaxReductor & other ) { } <nl> - __device__ __forceinline__ MaxReductor ( ) { } <nl> + template < typename T > <nl> + __device__ __forceinline__ T result ( T r , double ) const <nl> + { <nl> + return r ; <nl> + } <nl> <nl> - template < typename T > __device__ __forceinline__ int operator ( ) ( volatile T a , volatile T b ) const <nl> - { <nl> - return : : max ( a , b ) ; <nl> - } <nl> - __device__ __forceinline__ float operator ( ) ( volatile float a , volatile float b ) const <nl> - { <nl> - return : : fmax ( a , b ) ; <nl> - } <nl> + __device__ __forceinline__ Min ( ) { } <nl> + __device__ __forceinline__ Min ( const Min & ) { } <nl> + } ; <nl> <nl> - __device__ __forceinline__ S result ( S r , double ) const <nl> - { <nl> - return r ; <nl> - } <nl> - } ; <nl> + struct Max <nl> + { <nl> + template < typename T > <nl> + __device__ __forceinline__ T startValue ( ) const <nl> + { <nl> + return VecTraits < T > : : all ( - numeric_limits < typename VecTraits < T > : : elem_type > : : max ( ) ) ; <nl> + } <nl> <nl> - template < class Op , typename T , typename S , typename D > __global__ void reduceRows ( const PtrStepSz < T > src , D * dst , const Op op ) <nl> + template < typename T > <nl> + __device__ __forceinline__ T operator ( ) ( T a , T b ) const <nl> { <nl> - __shared__ S smem [ 16 * 16 ] ; <nl> + maximum < T > maxOp ; <nl> + return maxOp ( a , b ) ; <nl> + } <nl> <nl> - const int x = blockIdx . x * 16 + threadIdx . x ; <nl> + template < typename T > <nl> + __device__ __forceinline__ T result ( T r , double ) const <nl> + { <nl> + return r ; <nl> + } <nl> <nl> - S myVal = op . startValue ( ) ; <nl> + __device__ __forceinline__ Max ( ) { } <nl> + __device__ __forceinline__ Max ( const Max & ) { } <nl> + } ; <nl> <nl> - if ( x < src . cols ) <nl> - { <nl> - for ( int y = threadIdx . y ; y < src . rows ; y + = 16 ) <nl> - myVal = op ( myVal , src . ptr ( y ) [ x ] ) ; <nl> - } <nl> + / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / <nl> <nl> - smem [ threadIdx . x * 16 + threadIdx . y ] = myVal ; <nl> - __syncthreads ( ) ; <nl> + template < typename T , typename S , typename D , class Op > <nl> + __global__ void rowsKernel ( const PtrStepSz < T > src , D * dst , const Op op ) <nl> + { <nl> + __shared__ S smem [ 16 * 16 ] ; <nl> <nl> - if ( threadIdx . x < 8 ) <nl> - { <nl> - volatile S * srow = smem + threadIdx . y * 16 ; <nl> - srow [ threadIdx . x ] = op ( srow [ threadIdx . x ] , srow [ threadIdx . x + 8 ] ) ; <nl> - srow [ threadIdx . x ] = op ( srow [ threadIdx . x ] , srow [ threadIdx . x + 4 ] ) ; <nl> - srow [ threadIdx . x ] = op ( srow [ threadIdx . x ] , srow [ threadIdx . x + 2 ] ) ; <nl> - srow [ threadIdx . x ] = op ( srow [ threadIdx . x ] , srow [ threadIdx . x + 1 ] ) ; <nl> - } <nl> - __syncthreads ( ) ; <nl> + const int x = blockIdx . x * 16 + threadIdx . x ; <nl> <nl> - if ( threadIdx . y = = 0 & & x < src . cols ) <nl> - dst [ x ] = saturate_cast < D > ( op . result ( smem [ threadIdx . x * 16 ] , src . rows ) ) ; <nl> - } <nl> + S myVal = op . template startValue < S > ( ) ; <nl> <nl> - template < template < typename > class Op , typename T , typename S , typename D > void reduceRows_caller ( const PtrStepSz < T > & src , PtrStepSz < D > dst , cudaStream_t stream ) <nl> + if ( x < src . cols ) <nl> { <nl> - const dim3 block ( 16 , 16 ) ; <nl> - const dim3 grid ( divUp ( src . cols , block . x ) ) ; <nl> - <nl> - Op < S > op ; <nl> - reduceRows < Op < S > , T , S , D > < < < grid , block , 0 , stream > > > ( src , dst . data , op ) ; <nl> - cudaSafeCall ( cudaGetLastError ( ) ) ; <nl> - <nl> - if ( stream = = 0 ) <nl> - cudaSafeCall ( cudaDeviceSynchronize ( ) ) ; <nl> - <nl> + for ( int y = threadIdx . y ; y < src . rows ; y + = 16 ) <nl> + { <nl> + S srcVal = src ( y , x ) ; <nl> + myVal = op ( myVal , srcVal ) ; <nl> + } <nl> } <nl> <nl> - template < typename T , typename S , typename D > void reduceRows_gpu ( const PtrStepSzb & src , const PtrStepSzb & dst , int reduceOp , cudaStream_t stream ) <nl> - { <nl> - typedef void ( * caller_t ) ( const PtrStepSz < T > & src , PtrStepSz < D > dst , cudaStream_t stream ) ; <nl> + smem [ threadIdx . x * 16 + threadIdx . y ] = myVal ; <nl> <nl> - static const caller_t callers [ ] = <nl> - { <nl> - reduceRows_caller < SumReductor , T , S , D > , <nl> - reduceRows_caller < AvgReductor , T , S , D > , <nl> - reduceRows_caller < MaxReductor , T , S , D > , <nl> - reduceRows_caller < MinReductor , T , S , D > <nl> - } ; <nl> + __syncthreads ( ) ; <nl> <nl> - callers [ reduceOp ] ( static_cast < PtrStepSz < T > > ( src ) , static_cast < PtrStepSz < D > > ( dst ) , stream ) ; <nl> - } <nl> + volatile S * srow = smem + threadIdx . y * 16 ; <nl> <nl> - template void reduceRows_gpu < uchar , int , uchar > ( const PtrStepSzb & src , const PtrStepSzb & dst , int reduceOp , cudaStream_t stream ) ; <nl> - template void reduceRows_gpu < uchar , int , int > ( const PtrStepSzb & src , const PtrStepSzb & dst , int reduceOp , cudaStream_t stream ) ; <nl> - template void reduceRows_gpu < uchar , int , float > ( const PtrStepSzb & src , const PtrStepSzb & dst , int reduceOp , cudaStream_t stream ) ; <nl> + myVal = srow [ threadIdx . x ] ; <nl> + device : : reduce < 16 > ( srow , myVal , threadIdx . x , op ) ; <nl> <nl> - template void reduceRows_gpu < ushort , int , ushort > ( const PtrStepSzb & src , const PtrStepSzb & dst , int reduceOp , cudaStream_t stream ) ; <nl> - template void reduceRows_gpu < ushort , int , int > ( const PtrStepSzb & src , const PtrStepSzb & dst , int reduceOp , cudaStream_t stream ) ; <nl> - template void reduceRows_gpu < ushort , int , float > ( const PtrStepSzb & src , const PtrStepSzb & dst , int reduceOp , cudaStream_t stream ) ; <nl> + if ( threadIdx . x = = 0 ) <nl> + srow [ 0 ] = myVal ; <nl> <nl> - template void reduceRows_gpu < short , int , short > ( const PtrStepSzb & src , const PtrStepSzb & dst , int reduceOp , cudaStream_t stream ) ; <nl> - template void reduceRows_gpu < short , int , int > ( const PtrStepSzb & src , const PtrStepSzb & dst , int reduceOp , cudaStream_t stream ) ; <nl> - template void reduceRows_gpu < short , int , float > ( const PtrStepSzb & src , const PtrStepSzb & dst , int reduceOp , cudaStream_t stream ) ; <nl> + __syncthreads ( ) ; <nl> <nl> - template void reduceRows_gpu < int , int , int > ( const PtrStepSzb & src , const PtrStepSzb & dst , int reduceOp , cudaStream_t stream ) ; <nl> - template void reduceRows_gpu < int , int , float > ( const PtrStepSzb & src , const PtrStepSzb & dst , int reduceOp , cudaStream_t stream ) ; <nl> + if ( threadIdx . y = = 0 & & x < src . cols ) <nl> + dst [ x ] = ( D ) op . result ( smem [ threadIdx . x * 16 ] , src . rows ) ; <nl> + } <nl> <nl> - template void reduceRows_gpu < float , float , float > ( const PtrStepSzb & src , const PtrStepSzb & dst , int reduceOp , cudaStream_t stream ) ; <nl> + template < typename T , typename S , typename D , class Op > <nl> + void rowsCaller ( PtrStepSz < T > src , D * dst , cudaStream_t stream ) <nl> + { <nl> + const dim3 block ( 16 , 16 ) ; <nl> + const dim3 grid ( divUp ( src . cols , block . x ) ) ; <nl> <nl> + Op op ; <nl> + rowsKernel < T , S , D , Op > < < < grid , block , 0 , stream > > > ( src , dst , op ) ; <nl> + cudaSafeCall ( cudaGetLastError ( ) ) ; <nl> <nl> + if ( stream = = 0 ) <nl> + cudaSafeCall ( cudaDeviceSynchronize ( ) ) ; <nl> + } <nl> <nl> - template < int cn , class Op , typename T , typename S , typename D > __global__ void reduceCols ( const PtrStepSz < T > src , D * dst , const Op op ) <nl> + template < typename T , typename S , typename D > <nl> + void rows ( PtrStepSzb src , void * dst , int op , cudaStream_t stream ) <nl> + { <nl> + typedef void ( * func_t ) ( PtrStepSz < T > src , D * dst , cudaStream_t stream ) ; <nl> + static const func_t funcs [ ] = <nl> { <nl> - __shared__ S smem [ 256 * cn ] ; <nl> + rowsCaller < T , S , D , Sum > , <nl> + rowsCaller < T , S , D , Avg > , <nl> + rowsCaller < T , S , D , Max > , <nl> + rowsCaller < T , S , D , Min > <nl> + } ; <nl> <nl> - const int y = blockIdx . x ; <nl> + funcs [ op ] ( ( PtrStepSz < T > ) src , ( D * ) dst , stream ) ; <nl> + } <nl> <nl> - const T * src_row = src . ptr ( y ) ; <nl> + template void rows < unsigned char , int , unsigned char > ( PtrStepSzb src , void * dst , int op , cudaStream_t stream ) ; <nl> + template void rows < unsigned char , int , int > ( PtrStepSzb src , void * dst , int op , cudaStream_t stream ) ; <nl> + template void rows < unsigned char , float , float > ( PtrStepSzb src , void * dst , int op , cudaStream_t stream ) ; <nl> + template void rows < unsigned char , double , double > ( PtrStepSzb src , void * dst , int op , cudaStream_t stream ) ; <nl> <nl> - S myVal [ cn ] ; <nl> + template void rows < unsigned short , int , unsigned short > ( PtrStepSzb src , void * dst , int op , cudaStream_t stream ) ; <nl> + template void rows < unsigned short , int , int > ( PtrStepSzb src , void * dst , int op , cudaStream_t stream ) ; <nl> + template void rows < unsigned short , float , float > ( PtrStepSzb src , void * dst , int op , cudaStream_t stream ) ; <nl> + template void rows < unsigned short , double , double > ( PtrStepSzb src , void * dst , int op , cudaStream_t stream ) ; <nl> <nl> - # pragma unroll <nl> - for ( int c = 0 ; c < cn ; + + c ) <nl> - myVal [ c ] = op . startValue ( ) ; <nl> + template void rows < short , int , short > ( PtrStepSzb src , void * dst , int op , cudaStream_t stream ) ; <nl> + template void rows < short , int , int > ( PtrStepSzb src , void * dst , int op , cudaStream_t stream ) ; <nl> + template void rows < short , float , float > ( PtrStepSzb src , void * dst , int op , cudaStream_t stream ) ; <nl> + template void rows < short , double , double > ( PtrStepSzb src , void * dst , int op , cudaStream_t stream ) ; <nl> <nl> - # if defined ( __CUDA_ARCH__ ) & & __CUDA_ARCH__ > = 200 <nl> + template void rows < int , int , int > ( PtrStepSzb src , void * dst , int op , cudaStream_t stream ) ; <nl> + template void rows < int , float , float > ( PtrStepSzb src , void * dst , int op , cudaStream_t stream ) ; <nl> + template void rows < int , double , double > ( PtrStepSzb src , void * dst , int op , cudaStream_t stream ) ; <nl> <nl> - / / For cc > = 2 . 0 prefer L1 cache <nl> - for ( int x = threadIdx . x ; x < src . cols ; x + = 256 ) <nl> - { <nl> - # pragma unroll <nl> - for ( int c = 0 ; c < cn ; + + c ) <nl> - myVal [ c ] = op ( myVal [ c ] , src_row [ x * cn + c ] ) ; <nl> - } <nl> + template void rows < float , float , float > ( PtrStepSzb src , void * dst , int op , cudaStream_t stream ) ; <nl> + template void rows < float , double , double > ( PtrStepSzb src , void * dst , int op , cudaStream_t stream ) ; <nl> <nl> - # else / / __CUDA_ARCH__ > = 200 <nl> + template void rows < double , double , double > ( PtrStepSzb src , void * dst , int op , cudaStream_t stream ) ; <nl> <nl> - / / For older arch use shared memory for cache <nl> - for ( int x = 0 ; x < src . cols ; x + = 256 ) <nl> - { <nl> - # pragma unroll <nl> - for ( int c = 0 ; c < cn ; + + c ) <nl> - { <nl> - smem [ c * 256 + threadIdx . x ] = op . startValue ( ) ; <nl> - const int load_x = x * cn + c * 256 + threadIdx . x ; <nl> - if ( load_x < src . cols * cn ) <nl> - smem [ c * 256 + threadIdx . x ] = src_row [ load_x ] ; <nl> - } <nl> - __syncthreads ( ) ; <nl> + / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / <nl> <nl> - # pragma unroll <nl> - for ( int c = 0 ; c < cn ; + + c ) <nl> - myVal [ c ] = op ( myVal [ c ] , smem [ threadIdx . x * cn + c ] ) ; <nl> - __syncthreads ( ) ; <nl> - } <nl> + template < int BLOCK_SIZE , typename T , typename S , typename D , int cn , class Op > <nl> + __global__ void colsKernel ( const PtrStepSz < typename TypeVec < T , cn > : : vec_type > src , typename TypeVec < D , cn > : : vec_type * dst , const Op op ) <nl> + { <nl> + typedef typename TypeVec < T , cn > : : vec_type src_type ; <nl> + typedef typename TypeVec < S , cn > : : vec_type work_type ; <nl> + typedef typename TypeVec < D , cn > : : vec_type dst_type ; <nl> <nl> - # endif / / __CUDA_ARCH__ > = 200 <nl> + __shared__ S smem [ BLOCK_SIZE * cn ] ; <nl> <nl> - # pragma unroll <nl> - for ( int c = 0 ; c < cn ; + + c ) <nl> - smem [ c * 256 + threadIdx . x ] = myVal [ c ] ; <nl> - __syncthreads ( ) ; <nl> + const int y = blockIdx . x ; <nl> <nl> - if ( threadIdx . x < 128 ) <nl> - { <nl> - # pragma unroll <nl> - for ( int c = 0 ; c < cn ; + + c ) <nl> - smem [ c * 256 + threadIdx . x ] = op ( smem [ c * 256 + threadIdx . x ] , smem [ c * 256 + threadIdx . x + 128 ] ) ; <nl> - } <nl> - __syncthreads ( ) ; <nl> + const src_type * srcRow = src . ptr ( y ) ; <nl> <nl> - if ( threadIdx . x < 64 ) <nl> - { <nl> - # pragma unroll <nl> - for ( int c = 0 ; c < cn ; + + c ) <nl> - smem [ c * 256 + threadIdx . x ] = op ( smem [ c * 256 + threadIdx . x ] , smem [ c * 256 + threadIdx . x + 64 ] ) ; <nl> - } <nl> - __syncthreads ( ) ; <nl> + work_type myVal = op . template startValue < work_type > ( ) ; <nl> <nl> - volatile S * sdata = smem ; <nl> + for ( int x = threadIdx . x ; x < src . cols ; x + = BLOCK_SIZE ) <nl> + myVal = op ( myVal , saturate_cast < work_type > ( srcRow [ x ] ) ) ; <nl> <nl> - if ( threadIdx . x < 32 ) <nl> - { <nl> - # pragma unroll <nl> - for ( int c = 0 ; c < cn ; + + c ) <nl> - { <nl> - sdata [ c * 256 + threadIdx . x ] = op ( sdata [ c * 256 + threadIdx . x ] , sdata [ c * 256 + threadIdx . x + 32 ] ) ; <nl> - sdata [ c * 256 + threadIdx . x ] = op ( sdata [ c * 256 + threadIdx . x ] , sdata [ c * 256 + threadIdx . x + 16 ] ) ; <nl> - sdata [ c * 256 + threadIdx . x ] = op ( sdata [ c * 256 + threadIdx . x ] , sdata [ c * 256 + threadIdx . x + 8 ] ) ; <nl> - sdata [ c * 256 + threadIdx . x ] = op ( sdata [ c * 256 + threadIdx . x ] , sdata [ c * 256 + threadIdx . x + 4 ] ) ; <nl> - sdata [ c * 256 + threadIdx . x ] = op ( sdata [ c * 256 + threadIdx . x ] , sdata [ c * 256 + threadIdx . x + 2 ] ) ; <nl> - sdata [ c * 256 + threadIdx . x ] = op ( sdata [ c * 256 + threadIdx . x ] , sdata [ c * 256 + threadIdx . x + 1 ] ) ; <nl> - } <nl> - } <nl> - __syncthreads ( ) ; <nl> + device : : reduce < BLOCK_SIZE > ( Unroll < cn > : : template smem_tuple < BLOCK_SIZE > ( smem ) , Unroll < cn > : : tie ( myVal ) , threadIdx . x , Unroll < cn > : : op ( op ) ) ; <nl> <nl> - if ( threadIdx . x < cn ) <nl> - dst [ y * cn + threadIdx . x ] = saturate_cast < D > ( op . result ( smem [ threadIdx . x * 256 ] , src . cols ) ) ; <nl> - } <nl> + if ( threadIdx . x = = 0 ) <nl> + dst [ y ] = saturate_cast < dst_type > ( op . result ( myVal , src . cols ) ) ; <nl> + } <nl> <nl> - template < int cn , template < typename > class Op , typename T , typename S , typename D > void reduceCols_caller ( const PtrStepSz < T > & src , PtrStepSz < D > dst , cudaStream_t stream ) <nl> - { <nl> - const dim3 block ( 256 ) ; <nl> - const dim3 grid ( src . rows ) ; <nl> + template < typename T , typename S , typename D , int cn , class Op > void colsCaller ( PtrStepSzb src , void * dst , cudaStream_t stream ) <nl> + { <nl> + const int BLOCK_SIZE = 256 ; <nl> <nl> - Op < S > op ; <nl> - reduceCols < cn , Op < S > , T , S , D > < < < grid , block , 0 , stream > > > ( src , dst . data , op ) ; <nl> - cudaSafeCall ( cudaGetLastError ( ) ) ; <nl> + const dim3 block ( BLOCK_SIZE ) ; <nl> + const dim3 grid ( src . rows ) ; <nl> <nl> - if ( stream = = 0 ) <nl> - cudaSafeCall ( cudaDeviceSynchronize ( ) ) ; <nl> + Op op ; <nl> + colsKernel < BLOCK_SIZE , T , S , D , cn , Op > < < < grid , block , 0 , stream > > > ( ( PtrStepSz < typename TypeVec < T , cn > : : vec_type > ) src , ( typename TypeVec < D , cn > : : vec_type * ) dst , op ) ; <nl> + cudaSafeCall ( cudaGetLastError ( ) ) ; <nl> <nl> - } <nl> + if ( stream = = 0 ) <nl> + cudaSafeCall ( cudaDeviceSynchronize ( ) ) ; <nl> <nl> - template < typename T , typename S , typename D > void reduceCols_gpu ( const PtrStepSzb & src , int cn , const PtrStepSzb & dst , int reduceOp , cudaStream_t stream ) <nl> + } <nl> + <nl> + template < typename T , typename S , typename D > void cols ( PtrStepSzb src , void * dst , int cn , int op , cudaStream_t stream ) <nl> + { <nl> + typedef void ( * func_t ) ( PtrStepSzb src , void * dst , cudaStream_t stream ) ; <nl> + static const func_t funcs [ 5 ] [ 4 ] = <nl> { <nl> - typedef void ( * caller_t ) ( const PtrStepSz < T > & src , PtrStepSz < D > dst , cudaStream_t stream ) ; <nl> + { 0 , 0 , 0 , 0 } , <nl> + { colsCaller < T , S , D , 1 , Sum > , colsCaller < T , S , D , 1 , Avg > , colsCaller < T , S , D , 1 , Max > , colsCaller < T , S , D , 1 , Min > } , <nl> + { colsCaller < T , S , D , 2 , Sum > , colsCaller < T , S , D , 2 , Avg > , colsCaller < T , S , D , 2 , Max > , colsCaller < T , S , D , 2 , Min > } , <nl> + { colsCaller < T , S , D , 3 , Sum > , colsCaller < T , S , D , 3 , Avg > , colsCaller < T , S , D , 3 , Max > , colsCaller < T , S , D , 3 , Min > } , <nl> + { colsCaller < T , S , D , 4 , Sum > , colsCaller < T , S , D , 4 , Avg > , colsCaller < T , S , D , 4 , Max > , colsCaller < T , S , D , 4 , Min > } , <nl> + } ; <nl> <nl> - static const caller_t callers [ 4 ] [ 4 ] = <nl> - { <nl> - { reduceCols_caller < 1 , SumReductor , T , S , D > , reduceCols_caller < 1 , AvgReductor , T , S , D > , reduceCols_caller < 1 , MaxReductor , T , S , D > , reduceCols_caller < 1 , MinReductor , T , S , D > } , <nl> - { reduceCols_caller < 2 , SumReductor , T , S , D > , reduceCols_caller < 2 , AvgReductor , T , S , D > , reduceCols_caller < 2 , MaxReductor , T , S , D > , reduceCols_caller < 2 , MinReductor , T , S , D > } , <nl> - { reduceCols_caller < 3 , SumReductor , T , S , D > , reduceCols_caller < 3 , AvgReductor , T , S , D > , reduceCols_caller < 3 , MaxReductor , T , S , D > , reduceCols_caller < 3 , MinReductor , T , S , D > } , <nl> - { reduceCols_caller < 4 , SumReductor , T , S , D > , reduceCols_caller < 4 , AvgReductor , T , S , D > , reduceCols_caller < 4 , MaxReductor , T , S , D > , reduceCols_caller < 4 , MinReductor , T , S , D > } , <nl> - } ; <nl> + funcs [ cn ] [ op ] ( src , dst , stream ) ; <nl> + } <nl> <nl> - callers [ cn - 1 ] [ reduceOp ] ( static_cast < PtrStepSz < T > > ( src ) , static_cast < PtrStepSz < D > > ( dst ) , stream ) ; <nl> - } <nl> + template void cols < unsigned char , int , unsigned char > ( PtrStepSzb src , void * dst , int cn , int op , cudaStream_t stream ) ; <nl> + template void cols < unsigned char , int , int > ( PtrStepSzb src , void * dst , int cn , int op , cudaStream_t stream ) ; <nl> + template void cols < unsigned char , float , float > ( PtrStepSzb src , void * dst , int cn , int op , cudaStream_t stream ) ; <nl> + template void cols < unsigned char , double , double > ( PtrStepSzb src , void * dst , int cn , int op , cudaStream_t stream ) ; <nl> <nl> - template void reduceCols_gpu < uchar , int , uchar > ( const PtrStepSzb & src , int cn , const PtrStepSzb & dst , int reduceOp , cudaStream_t stream ) ; <nl> - template void reduceCols_gpu < uchar , int , int > ( const PtrStepSzb & src , int cn , const PtrStepSzb & dst , int reduceOp , cudaStream_t stream ) ; <nl> - template void reduceCols_gpu < uchar , int , float > ( const PtrStepSzb & src , int cn , const PtrStepSzb & dst , int reduceOp , cudaStream_t stream ) ; <nl> + template void cols < unsigned short , int , unsigned short > ( PtrStepSzb src , void * dst , int cn , int op , cudaStream_t stream ) ; <nl> + template void cols < unsigned short , int , int > ( PtrStepSzb src , void * dst , int cn , int op , cudaStream_t stream ) ; <nl> + template void cols < unsigned short , float , float > ( PtrStepSzb src , void * dst , int cn , int op , cudaStream_t stream ) ; <nl> + template void cols < unsigned short , double , double > ( PtrStepSzb src , void * dst , int cn , int op , cudaStream_t stream ) ; <nl> <nl> - template void reduceCols_gpu < ushort , int , ushort > ( const PtrStepSzb & src , int cn , const PtrStepSzb & dst , int reduceOp , cudaStream_t stream ) ; <nl> - template void reduceCols_gpu < ushort , int , int > ( const PtrStepSzb & src , int cn , const PtrStepSzb & dst , int reduceOp , cudaStream_t stream ) ; <nl> - template void reduceCols_gpu < ushort , int , float > ( const PtrStepSzb & src , int cn , const PtrStepSzb & dst , int reduceOp , cudaStream_t stream ) ; <nl> + template void cols < short , int , short > ( PtrStepSzb src , void * dst , int cn , int op , cudaStream_t stream ) ; <nl> + template void cols < short , int , int > ( PtrStepSzb src , void * dst , int cn , int op , cudaStream_t stream ) ; <nl> + template void cols < short , float , float > ( PtrStepSzb src , void * dst , int cn , int op , cudaStream_t stream ) ; <nl> + template void cols < short , double , double > ( PtrStepSzb src , void * dst , int cn , int op , cudaStream_t stream ) ; <nl> <nl> - template void reduceCols_gpu < short , int , short > ( const PtrStepSzb & src , int cn , const PtrStepSzb & dst , int reduceOp , cudaStream_t stream ) ; <nl> - template void reduceCols_gpu < short , int , int > ( const PtrStepSzb & src , int cn , const PtrStepSzb & dst , int reduceOp , cudaStream_t stream ) ; <nl> - template void reduceCols_gpu < short , int , float > ( const PtrStepSzb & src , int cn , const PtrStepSzb & dst , int reduceOp , cudaStream_t stream ) ; <nl> + template void cols < int , int , int > ( PtrStepSzb src , void * dst , int cn , int op , cudaStream_t stream ) ; <nl> + template void cols < int , float , float > ( PtrStepSzb src , void * dst , int cn , int op , cudaStream_t stream ) ; <nl> + template void cols < int , double , double > ( PtrStepSzb src , void * dst , int cn , int op , cudaStream_t stream ) ; <nl> <nl> - template void reduceCols_gpu < int , int , int > ( const PtrStepSzb & src , int cn , const PtrStepSzb & dst , int reduceOp , cudaStream_t stream ) ; <nl> - template void reduceCols_gpu < int , int , float > ( const PtrStepSzb & src , int cn , const PtrStepSzb & dst , int reduceOp , cudaStream_t stream ) ; <nl> + template void cols < float , float , float > ( PtrStepSzb src , void * dst , int cn , int op , cudaStream_t stream ) ; <nl> + template void cols < float , double , double > ( PtrStepSzb src , void * dst , int cn , int op , cudaStream_t stream ) ; <nl> <nl> - template void reduceCols_gpu < float , float , float > ( const PtrStepSzb & src , int cn , const PtrStepSzb & dst , int reduceOp , cudaStream_t stream ) ; <nl> - } / / namespace mattrix_reductions <nl> - } } } / / namespace cv { namespace gpu { namespace device <nl> + template void cols < double , double , double > ( PtrStepSzb src , void * dst , int cn , int op , cudaStream_t stream ) ; <nl> + } <nl> <nl> - # endif / * CUDA_DISABLER * / <nl> \ No newline at end of file <nl> + # endif / * CUDA_DISABLER * / <nl> mmm a / modules / gpu / src / matrix_reductions . cpp <nl> ppp b / modules / gpu / src / matrix_reductions . cpp <nl> double cv : : gpu : : norm ( const GpuMat & src1 , const GpuMat & src2 , int normType ) <nl> / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / <nl> / / Sum <nl> <nl> - namespace cv { namespace gpu { namespace device <nl> + namespace sum <nl> { <nl> - namespace matrix_reductions <nl> - { <nl> - namespace sum <nl> - { <nl> - template < typename T > <nl> - void sumCaller ( const PtrStepSzb src , PtrStepb buf , double * sum , int cn ) ; <nl> - <nl> - template < typename T > <nl> - void sumMultipassCaller ( const PtrStepSzb src , PtrStepb buf , double * sum , int cn ) ; <nl> - <nl> - template < typename T > <nl> - void absSumCaller ( const PtrStepSzb src , PtrStepb buf , double * sum , int cn ) ; <nl> + void getBufSize ( int cols , int rows , int cn , int & bufcols , int & bufrows ) ; <nl> <nl> - template < typename T > <nl> - void absSumMultipassCaller ( const PtrStepSzb src , PtrStepb buf , double * sum , int cn ) ; <nl> + template < typename T , int cn > <nl> + void run ( PtrStepSzb src , void * buf , double * sum ) ; <nl> <nl> - template < typename T > <nl> - void sqrSumCaller ( const PtrStepSzb src , PtrStepb buf , double * sum , int cn ) ; <nl> + template < typename T , int cn > <nl> + void runAbs ( PtrStepSzb src , void * buf , double * sum ) ; <nl> <nl> - template < typename T > <nl> - void sqrSumMultipassCaller ( const PtrStepSzb src , PtrStepb buf , double * sum , int cn ) ; <nl> - <nl> - void getBufSizeRequired ( int cols , int rows , int cn , int & bufcols , int & bufrows ) ; <nl> - } <nl> - } <nl> - } } } <nl> + template < typename T , int cn > <nl> + void runSqr ( PtrStepSzb src , void * buf , double * sum ) ; <nl> + } <nl> <nl> Scalar cv : : gpu : : sum ( const GpuMat & src ) <nl> { <nl> Scalar cv : : gpu : : sum ( const GpuMat & src ) <nl> return sum ( src , buf ) ; <nl> } <nl> <nl> - <nl> Scalar cv : : gpu : : sum ( const GpuMat & src , GpuMat & buf ) <nl> { <nl> - using namespace cv : : gpu : : device : : matrix_reductions : : sum ; <nl> - <nl> - typedef void ( * Caller ) ( const PtrStepSzb , PtrStepb , double * , int ) ; <nl> - <nl> - static Caller multipass_callers [ ] = <nl> + typedef void ( * func_t ) ( PtrStepSzb src , void * buf , double * sum ) ; <nl> + static const func_t funcs [ 7 ] [ 5 ] = <nl> { <nl> - sumMultipassCaller < unsigned char > , sumMultipassCaller < char > , <nl> - sumMultipassCaller < unsigned short > , sumMultipassCaller < short > , <nl> - sumMultipassCaller < int > , sumMultipassCaller < float > <nl> + { 0 , : : sum : : run < uchar , 1 > , : : sum : : run < uchar , 2 > , : : sum : : run < uchar , 3 > , : : sum : : run < uchar , 4 > } , <nl> + { 0 , : : sum : : run < schar , 1 > , : : sum : : run < schar , 2 > , : : sum : : run < schar , 3 > , : : sum : : run < schar , 4 > } , <nl> + { 0 , : : sum : : run < ushort , 1 > , : : sum : : run < ushort , 2 > , : : sum : : run < ushort , 3 > , : : sum : : run < ushort , 4 > } , <nl> + { 0 , : : sum : : run < short , 1 > , : : sum : : run < short , 2 > , : : sum : : run < short , 3 > , : : sum : : run < short , 4 > } , <nl> + { 0 , : : sum : : run < int , 1 > , : : sum : : run < int , 2 > , : : sum : : run < int , 3 > , : : sum : : run < int , 4 > } , <nl> + { 0 , : : sum : : run < float , 1 > , : : sum : : run < float , 2 > , : : sum : : run < float , 3 > , : : sum : : run < float , 4 > } , <nl> + { 0 , : : sum : : run < double , 1 > , : : sum : : run < double , 2 > , : : sum : : run < double , 3 > , : : sum : : run < double , 4 > } <nl> } ; <nl> <nl> - static Caller singlepass_callers [ ] = { <nl> - sumCaller < unsigned char > , sumCaller < char > , <nl> - sumCaller < unsigned short > , sumCaller < short > , <nl> - sumCaller < int > , sumCaller < float > <nl> - } ; <nl> - <nl> - CV_Assert ( src . depth ( ) < = CV_32F ) ; <nl> + if ( src . depth ( ) = = CV_64F ) <nl> + { <nl> + if ( ! TargetArchs : : builtWith ( NATIVE_DOUBLE ) | | ! DeviceInfo ( ) . supports ( NATIVE_DOUBLE ) ) <nl> + CV_Error ( CV_StsUnsupportedFormat , " The device doesn ' t support double " ) ; <nl> + } <nl> <nl> Size buf_size ; <nl> - getBufSizeRequired ( src . cols , src . rows , src . channels ( ) , buf_size . width , buf_size . height ) ; <nl> + : : sum : : getBufSize ( src . cols , src . rows , src . channels ( ) , buf_size . width , buf_size . height ) ; <nl> ensureSizeIsEnough ( buf_size , CV_8U , buf ) ; <nl> + buf . setTo ( Scalar : : all ( 0 ) ) ; <nl> <nl> - Caller * callers = multipass_callers ; <nl> - if ( TargetArchs : : builtWith ( GLOBAL_ATOMICS ) & & DeviceInfo ( ) . supports ( GLOBAL_ATOMICS ) ) <nl> - callers = singlepass_callers ; <nl> - <nl> - Caller caller = callers [ src . depth ( ) ] ; <nl> + const func_t func = funcs [ src . depth ( ) ] [ src . channels ( ) ] ; <nl> <nl> double result [ 4 ] ; <nl> - caller ( src , buf , result , src . channels ( ) ) ; <nl> + func ( src , buf . data , result ) ; <nl> + <nl> return Scalar ( result [ 0 ] , result [ 1 ] , result [ 2 ] , result [ 3 ] ) ; <nl> } <nl> <nl> - <nl> Scalar cv : : gpu : : absSum ( const GpuMat & src ) <nl> { <nl> GpuMat buf ; <nl> return absSum ( src , buf ) ; <nl> } <nl> <nl> - <nl> Scalar cv : : gpu : : absSum ( const GpuMat & src , GpuMat & buf ) <nl> { <nl> - using namespace cv : : gpu : : device : : matrix_reductions : : sum ; <nl> - <nl> - typedef void ( * Caller ) ( const PtrStepSzb , PtrStepb , double * , int ) ; <nl> - <nl> - static Caller multipass_callers [ ] = <nl> - { <nl> - absSumMultipassCaller < unsigned char > , absSumMultipassCaller < char > , <nl> - absSumMultipassCaller < unsigned short > , absSumMultipassCaller < short > , <nl> - absSumMultipassCaller < int > , absSumMultipassCaller < float > <nl> - } ; <nl> - <nl> - static Caller singlepass_callers [ ] = <nl> + typedef void ( * func_t ) ( PtrStepSzb src , void * buf , double * sum ) ; <nl> + static const func_t funcs [ 7 ] [ 5 ] = <nl> { <nl> - absSumCaller < unsigned char > , absSumCaller < char > , <nl> - absSumCaller < unsigned short > , absSumCaller < short > , <nl> - absSumCaller < int > , absSumCaller < float > <nl> + { 0 , : : sum : : runAbs < uchar , 1 > , : : sum : : runAbs < uchar , 2 > , : : sum : : runAbs < uchar , 3 > , : : sum : : runAbs < uchar , 4 > } , <nl> + { 0 , : : sum : : runAbs < schar , 1 > , : : sum : : runAbs < schar , 2 > , : : sum : : runAbs < schar , 3 > , : : sum : : runAbs < schar , 4 > } , <nl> + { 0 , : : sum : : runAbs < ushort , 1 > , : : sum : : runAbs < ushort , 2 > , : : sum : : runAbs < ushort , 3 > , : : sum : : runAbs < ushort , 4 > } , <nl> + { 0 , : : sum : : runAbs < short , 1 > , : : sum : : runAbs < short , 2 > , : : sum : : runAbs < short , 3 > , : : sum : : runAbs < short , 4 > } , <nl> + { 0 , : : sum : : runAbs < int , 1 > , : : sum : : runAbs < int , 2 > , : : sum : : runAbs < int , 3 > , : : sum : : runAbs < int , 4 > } , <nl> + { 0 , : : sum : : runAbs < float , 1 > , : : sum : : runAbs < float , 2 > , : : sum : : runAbs < float , 3 > , : : sum : : runAbs < float , 4 > } , <nl> + { 0 , : : sum : : runAbs < double , 1 > , : : sum : : runAbs < double , 2 > , : : sum : : runAbs < double , 3 > , : : sum : : runAbs < double , 4 > } <nl> } ; <nl> <nl> - CV_Assert ( src . depth ( ) < = CV_32F ) ; <nl> - <nl> Size buf_size ; <nl> - getBufSizeRequired ( src . cols , src . rows , src . channels ( ) , buf_size . width , buf_size . height ) ; <nl> + : : sum : : getBufSize ( src . cols , src . rows , src . channels ( ) , buf_size . width , buf_size . height ) ; <nl> ensureSizeIsEnough ( buf_size , CV_8U , buf ) ; <nl> + buf . setTo ( Scalar : : all ( 0 ) ) ; <nl> <nl> - Caller * callers = multipass_callers ; <nl> - if ( TargetArchs : : builtWith ( GLOBAL_ATOMICS ) & & DeviceInfo ( ) . supports ( GLOBAL_ATOMICS ) ) <nl> - callers = singlepass_callers ; <nl> - <nl> - Caller caller = callers [ src . depth ( ) ] ; <nl> + const func_t func = funcs [ src . depth ( ) ] [ src . channels ( ) ] ; <nl> <nl> double result [ 4 ] ; <nl> - caller ( src , buf , result , src . channels ( ) ) ; <nl> + func ( src , buf . data , result ) ; <nl> + <nl> return Scalar ( result [ 0 ] , result [ 1 ] , result [ 2 ] , result [ 3 ] ) ; <nl> } <nl> <nl> - <nl> Scalar cv : : gpu : : sqrSum ( const GpuMat & src ) <nl> { <nl> GpuMat buf ; <nl> return sqrSum ( src , buf ) ; <nl> } <nl> <nl> - <nl> Scalar cv : : gpu : : sqrSum ( const GpuMat & src , GpuMat & buf ) <nl> { <nl> - using namespace cv : : gpu : : device : : matrix_reductions : : sum ; <nl> - <nl> - typedef void ( * Caller ) ( const PtrStepSzb , PtrStepb , double * , int ) ; <nl> - <nl> - static Caller multipass_callers [ ] = <nl> + typedef void ( * func_t ) ( PtrStepSzb src , void * buf , double * sum ) ; <nl> + static const func_t funcs [ 7 ] [ 5 ] = <nl> { <nl> - sqrSumMultipassCaller < unsigned char > , sqrSumMultipassCaller < char > , <nl> - sqrSumMultipassCaller < unsigned short > , sqrSumMultipassCaller < short > , <nl> - sqrSumMultipassCaller < int > , sqrSumMultipassCaller < float > <nl> + { 0 , : : sum : : runSqr < uchar , 1 > , : : sum : : runSqr < uchar , 2 > , : : sum : : runSqr < uchar , 3 > , : : sum : : runSqr < uchar , 4 > } , <nl> + { 0 , : : sum : : runSqr < schar , 1 > , : : sum : : runSqr < schar , 2 > , : : sum : : runSqr < schar , 3 > , : : sum : : runSqr < schar , 4 > } , <nl> + { 0 , : : sum : : runSqr < ushort , 1 > , : : sum : : runSqr < ushort , 2 > , : : sum : : runSqr < ushort , 3 > , : : sum : : runSqr < ushort , 4 > } , <nl> + { 0 , : : sum : : runSqr < short , 1 > , : : sum : : runSqr < short , 2 > , : : sum : : runSqr < short , 3 > , : : sum : : runSqr < short , 4 > } , <nl> + { 0 , : : sum : : runSqr < int , 1 > , : : sum : : runSqr < int , 2 > , : : sum : : runSqr < int , 3 > , : : sum : : runSqr < int , 4 > } , <nl> + { 0 , : : sum : : runSqr < float , 1 > , : : sum : : runSqr < float , 2 > , : : sum : : runSqr < float , 3 > , : : sum : : runSqr < float , 4 > } , <nl> + { 0 , : : sum : : runSqr < double , 1 > , : : sum : : runSqr < double , 2 > , : : sum : : runSqr < double , 3 > , : : sum : : runSqr < double , 4 > } <nl> } ; <nl> <nl> - static Caller singlepass_callers [ 7 ] = <nl> - { <nl> - sqrSumCaller < unsigned char > , sqrSumCaller < char > , <nl> - sqrSumCaller < unsigned short > , sqrSumCaller < short > , <nl> - sqrSumCaller < int > , sqrSumCaller < float > <nl> - } ; <nl> - <nl> - CV_Assert ( src . depth ( ) < = CV_32F ) ; <nl> - <nl> - Caller * callers = multipass_callers ; <nl> - if ( TargetArchs : : builtWith ( GLOBAL_ATOMICS ) & & DeviceInfo ( ) . supports ( GLOBAL_ATOMICS ) ) <nl> - callers = singlepass_callers ; <nl> - <nl> Size buf_size ; <nl> - getBufSizeRequired ( src . cols , src . rows , src . channels ( ) , buf_size . width , buf_size . height ) ; <nl> + : : sum : : getBufSize ( src . cols , src . rows , src . channels ( ) , buf_size . width , buf_size . height ) ; <nl> ensureSizeIsEnough ( buf_size , CV_8U , buf ) ; <nl> + buf . setTo ( Scalar : : all ( 0 ) ) ; <nl> <nl> - Caller caller = callers [ src . depth ( ) ] ; <nl> + const func_t func = funcs [ src . depth ( ) ] [ src . channels ( ) ] ; <nl> <nl> double result [ 4 ] ; <nl> - caller ( src , buf , result , src . channels ( ) ) ; <nl> + func ( src , buf . data , result ) ; <nl> + <nl> return Scalar ( result [ 0 ] , result [ 1 ] , result [ 2 ] , result [ 3 ] ) ; <nl> } <nl> <nl> / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / <nl> - / / Find min or max <nl> + / / minMax <nl> <nl> - namespace cv { namespace gpu { namespace device <nl> + namespace minMax <nl> { <nl> - namespace matrix_reductions <nl> - { <nl> - namespace minmax <nl> - { <nl> - void getBufSizeRequired ( int cols , int rows , int elem_size , int & bufcols , int & bufrows ) ; <nl> - <nl> - template < typename T > <nl> - void minMaxCaller ( const PtrStepSzb src , double * minval , double * maxval , PtrStepb buf ) ; <nl> - <nl> - template < typename T > <nl> - void minMaxMaskCaller ( const PtrStepSzb src , const PtrStepb mask , double * minval , double * maxval , PtrStepb buf ) ; <nl> - <nl> - template < typename T > <nl> - void minMaxMultipassCaller ( const PtrStepSzb src , double * minval , double * maxval , PtrStepb buf ) ; <nl> - <nl> - template < typename T > <nl> - void minMaxMaskMultipassCaller ( const PtrStepSzb src , const PtrStepb mask , double * minval , double * maxval , PtrStepb buf ) ; <nl> - } <nl> - } <nl> - } } } <nl> + void getBufSize ( int cols , int rows , int & bufcols , int & bufrows ) ; <nl> <nl> + template < typename T > <nl> + void run ( const PtrStepSzb src , const PtrStepb mask , double * minval , double * maxval , PtrStepb buf ) ; <nl> + } <nl> <nl> void cv : : gpu : : minMax ( const GpuMat & src , double * minVal , double * maxVal , const GpuMat & mask ) <nl> { <nl> void cv : : gpu : : minMax ( const GpuMat & src , double * minVal , double * maxVal , const Gp <nl> minMax ( src , minVal , maxVal , mask , buf ) ; <nl> } <nl> <nl> - <nl> void cv : : gpu : : minMax ( const GpuMat & src , double * minVal , double * maxVal , const GpuMat & mask , GpuMat & buf ) <nl> { <nl> - using namespace : : cv : : gpu : : device : : matrix_reductions : : minmax ; <nl> - <nl> - typedef void ( * Caller ) ( const PtrStepSzb , double * , double * , PtrStepb ) ; <nl> - typedef void ( * MaskedCaller ) ( const PtrStepSzb , const PtrStepb , double * , double * , PtrStepb ) ; <nl> - <nl> - static Caller multipass_callers [ ] = <nl> - { <nl> - minMaxMultipassCaller < unsigned char > , minMaxMultipassCaller < char > , <nl> - minMaxMultipassCaller < unsigned short > , minMaxMultipassCaller < short > , <nl> - minMaxMultipassCaller < int > , minMaxMultipassCaller < float > , 0 <nl> - } ; <nl> - <nl> - static Caller singlepass_callers [ ] = <nl> - { <nl> - minMaxCaller < unsigned char > , minMaxCaller < char > , <nl> - minMaxCaller < unsigned short > , minMaxCaller < short > , <nl> - minMaxCaller < int > , minMaxCaller < float > , minMaxCaller < double > <nl> - } ; <nl> - <nl> - static MaskedCaller masked_multipass_callers [ ] = <nl> - { <nl> - minMaxMaskMultipassCaller < unsigned char > , minMaxMaskMultipassCaller < char > , <nl> - minMaxMaskMultipassCaller < unsigned short > , minMaxMaskMultipassCaller < short > , <nl> - minMaxMaskMultipassCaller < int > , minMaxMaskMultipassCaller < float > , 0 <nl> - } ; <nl> - <nl> - static MaskedCaller masked_singlepass_callers [ ] = <nl> + typedef void ( * func_t ) ( const PtrStepSzb src , const PtrStepb mask , double * minval , double * maxval , PtrStepb buf ) ; <nl> + static const func_t funcs [ ] = <nl> { <nl> - minMaxMaskCaller < unsigned char > , minMaxMaskCaller < char > , <nl> - minMaxMaskCaller < unsigned short > , minMaxMaskCaller < short > , <nl> - minMaxMaskCaller < int > , minMaxMaskCaller < float > , minMaxMaskCaller < double > <nl> + : : minMax : : run < uchar > , <nl> + : : minMax : : run < schar > , <nl> + : : minMax : : run < ushort > , <nl> + : : minMax : : run < short > , <nl> + : : minMax : : run < int > , <nl> + : : minMax : : run < float > , <nl> + : : minMax : : run < double > <nl> } ; <nl> <nl> - CV_Assert ( src . depth ( ) < = CV_64F ) ; <nl> - CV_Assert ( src . channels ( ) = = 1 ) ; <nl> - CV_Assert ( mask . empty ( ) | | ( mask . type ( ) = = CV_8U & & src . size ( ) = = mask . size ( ) ) ) ; <nl> + CV_Assert ( src . channels ( ) = = 1 ) ; <nl> + CV_Assert ( mask . empty ( ) | | ( mask . size ( ) = = src . size ( ) & & mask . type ( ) = = CV_8U ) ) ; <nl> <nl> if ( src . depth ( ) = = CV_64F ) <nl> { <nl> void cv : : gpu : : minMax ( const GpuMat & src , double * minVal , double * maxVal , const Gp <nl> CV_Error ( CV_StsUnsupportedFormat , " The device doesn ' t support double " ) ; <nl> } <nl> <nl> - double minVal_ ; if ( ! minVal ) minVal = & minVal_ ; <nl> - double maxVal_ ; if ( ! maxVal ) maxVal = & maxVal_ ; <nl> - <nl> Size buf_size ; <nl> - getBufSizeRequired ( src . cols , src . rows , static_cast < int > ( src . elemSize ( ) ) , buf_size . width , buf_size . height ) ; <nl> + : : minMax : : getBufSize ( src . cols , src . rows , buf_size . width , buf_size . height ) ; <nl> ensureSizeIsEnough ( buf_size , CV_8U , buf ) ; <nl> <nl> - if ( mask . empty ( ) ) <nl> - { <nl> - Caller * callers = multipass_callers ; <nl> - if ( TargetArchs : : builtWith ( GLOBAL_ATOMICS ) & & DeviceInfo ( ) . supports ( GLOBAL_ATOMICS ) ) <nl> - callers = singlepass_callers ; <nl> - <nl> - Caller caller = callers [ src . type ( ) ] ; <nl> - CV_Assert ( caller ! = 0 ) ; <nl> - caller ( src , minVal , maxVal , buf ) ; <nl> - } <nl> - else <nl> - { <nl> - MaskedCaller * callers = masked_multipass_callers ; <nl> - if ( TargetArchs : : builtWith ( GLOBAL_ATOMICS ) & & DeviceInfo ( ) . supports ( GLOBAL_ATOMICS ) ) <nl> - callers = masked_singlepass_callers ; <nl> + const func_t func = funcs [ src . depth ( ) ] ; <nl> <nl> - MaskedCaller caller = callers [ src . type ( ) ] ; <nl> - CV_Assert ( caller ! = 0 ) ; <nl> - caller ( src , mask , minVal , maxVal , buf ) ; <nl> - } <nl> + double temp1 , temp2 ; <nl> + func ( src , mask , minVal ? minVal : & temp1 , maxVal ? maxVal : & temp2 , buf ) ; <nl> } <nl> <nl> - <nl> / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / <nl> - / / Locate min and max <nl> + / / minMaxLoc <nl> <nl> - namespace cv { namespace gpu { namespace device <nl> + namespace minMaxLoc <nl> { <nl> - namespace matrix_reductions <nl> - { <nl> - namespace minmaxloc <nl> - { <nl> - void getBufSizeRequired ( int cols , int rows , int elem_size , int & b1cols , <nl> - int & b1rows , int & b2cols , int & b2rows ) ; <nl> - <nl> - template < typename T > <nl> - void minMaxLocCaller ( const PtrStepSzb src , double * minval , double * maxval , <nl> - int minloc [ 2 ] , int maxloc [ 2 ] , PtrStepb valBuf , PtrStepb locBuf ) ; <nl> - <nl> - template < typename T > <nl> - void minMaxLocMaskCaller ( const PtrStepSzb src , const PtrStepb mask , double * minval , double * maxval , <nl> - int minloc [ 2 ] , int maxloc [ 2 ] , PtrStepb valBuf , PtrStepb locBuf ) ; <nl> - <nl> - template < typename T > <nl> - void minMaxLocMultipassCaller ( const PtrStepSzb src , double * minval , double * maxval , <nl> - int minloc [ 2 ] , int maxloc [ 2 ] , PtrStepb valBuf , PtrStepb locBuf ) ; <nl> + void getBufSize ( int cols , int rows , size_t elem_size , int & b1cols , int & b1rows , int & b2cols , int & b2rows ) ; <nl> <nl> - template < typename T > <nl> - void minMaxLocMaskMultipassCaller ( const PtrStepSzb src , const PtrStepb mask , double * minval , double * maxval , <nl> - int minloc [ 2 ] , int maxloc [ 2 ] , PtrStepb valBuf , PtrStepb locBuf ) ; <nl> - } <nl> - } <nl> - } } } <nl> + template < typename T > <nl> + void run ( const PtrStepSzb src , const PtrStepb mask , double * minval , double * maxval , int * minloc , int * maxloc , PtrStepb valbuf , PtrStep < unsigned int > locbuf ) ; <nl> + } <nl> <nl> void cv : : gpu : : minMaxLoc ( const GpuMat & src , double * minVal , double * maxVal , Point * minLoc , Point * maxLoc , const GpuMat & mask ) <nl> { <nl> void cv : : gpu : : minMaxLoc ( const GpuMat & src , double * minVal , double * maxVal , Point <nl> void cv : : gpu : : minMaxLoc ( const GpuMat & src , double * minVal , double * maxVal , Point * minLoc , Point * maxLoc , <nl> const GpuMat & mask , GpuMat & valBuf , GpuMat & locBuf ) <nl> { <nl> - using namespace : : cv : : gpu : : device : : matrix_reductions : : minmaxloc ; <nl> - <nl> - typedef void ( * Caller ) ( const PtrStepSzb , double * , double * , int [ 2 ] , int [ 2 ] , PtrStepb , PtrStepb ) ; <nl> - typedef void ( * MaskedCaller ) ( const PtrStepSzb , const PtrStepb , double * , double * , int [ 2 ] , int [ 2 ] , PtrStepb , PtrStepb ) ; <nl> - <nl> - static Caller multipass_callers [ ] = <nl> - { <nl> - minMaxLocMultipassCaller < unsigned char > , minMaxLocMultipassCaller < char > , <nl> - minMaxLocMultipassCaller < unsigned short > , minMaxLocMultipassCaller < short > , <nl> - minMaxLocMultipassCaller < int > , minMaxLocMultipassCaller < float > , 0 <nl> - } ; <nl> - <nl> - static Caller singlepass_callers [ ] = <nl> + typedef void ( * func_t ) ( const PtrStepSzb src , const PtrStepb mask , double * minval , double * maxval , int * minloc , int * maxloc , PtrStepb valbuf , PtrStep < unsigned int > locbuf ) ; <nl> + static const func_t funcs [ ] = <nl> { <nl> - minMaxLocCaller < unsigned char > , minMaxLocCaller < char > , <nl> - minMaxLocCaller < unsigned short > , minMaxLocCaller < short > , <nl> - minMaxLocCaller < int > , minMaxLocCaller < float > , minMaxLocCaller < double > <nl> + : : minMaxLoc : : run < uchar > , <nl> + : : minMaxLoc : : run < schar > , <nl> + : : minMaxLoc : : run < ushort > , <nl> + : : minMaxLoc : : run < short > , <nl> + : : minMaxLoc : : run < int > , <nl> + : : minMaxLoc : : run < float > , <nl> + : : minMaxLoc : : run < double > <nl> } ; <nl> <nl> - static MaskedCaller masked_multipass_callers [ ] = <nl> - { <nl> - minMaxLocMaskMultipassCaller < unsigned char > , minMaxLocMaskMultipassCaller < char > , <nl> - minMaxLocMaskMultipassCaller < unsigned short > , minMaxLocMaskMultipassCaller < short > , <nl> - minMaxLocMaskMultipassCaller < int > , minMaxLocMaskMultipassCaller < float > , 0 <nl> - } ; <nl> - <nl> - static MaskedCaller masked_singlepass_callers [ ] = <nl> - { <nl> - minMaxLocMaskCaller < unsigned char > , minMaxLocMaskCaller < char > , <nl> - minMaxLocMaskCaller < unsigned short > , minMaxLocMaskCaller < short > , <nl> - minMaxLocMaskCaller < int > , minMaxLocMaskCaller < float > , minMaxLocMaskCaller < double > <nl> - } ; <nl> - <nl> - CV_Assert ( src . depth ( ) < = CV_64F ) ; <nl> - CV_Assert ( src . channels ( ) = = 1 ) ; <nl> - CV_Assert ( mask . empty ( ) | | ( mask . type ( ) = = CV_8U & & src . size ( ) = = mask . size ( ) ) ) ; <nl> + CV_Assert ( src . channels ( ) = = 1 ) ; <nl> + CV_Assert ( mask . empty ( ) | | ( mask . size ( ) = = src . size ( ) & & mask . type ( ) = = CV_8U ) ) ; <nl> <nl> if ( src . depth ( ) = = CV_64F ) <nl> { <nl> void cv : : gpu : : minMaxLoc ( const GpuMat & src , double * minVal , double * maxVal , Point <nl> CV_Error ( CV_StsUnsupportedFormat , " The device doesn ' t support double " ) ; <nl> } <nl> <nl> - double minVal_ ; if ( ! minVal ) minVal = & minVal_ ; <nl> - double maxVal_ ; if ( ! maxVal ) maxVal = & maxVal_ ; <nl> - int minLoc_ [ 2 ] ; <nl> - int maxLoc_ [ 2 ] ; <nl> - <nl> Size valbuf_size , locbuf_size ; <nl> - getBufSizeRequired ( src . cols , src . rows , static_cast < int > ( src . elemSize ( ) ) , valbuf_size . width , <nl> - valbuf_size . height , locbuf_size . width , locbuf_size . height ) ; <nl> + : : minMaxLoc : : getBufSize ( src . cols , src . rows , src . elemSize ( ) , valbuf_size . width , valbuf_size . height , locbuf_size . width , locbuf_size . height ) ; <nl> ensureSizeIsEnough ( valbuf_size , CV_8U , valBuf ) ; <nl> ensureSizeIsEnough ( locbuf_size , CV_8U , locBuf ) ; <nl> <nl> - if ( mask . empty ( ) ) <nl> - { <nl> - Caller * callers = multipass_callers ; <nl> - if ( TargetArchs : : builtWith ( GLOBAL_ATOMICS ) & & DeviceInfo ( ) . supports ( GLOBAL_ATOMICS ) ) <nl> - callers = singlepass_callers ; <nl> - <nl> - Caller caller = callers [ src . type ( ) ] ; <nl> - CV_Assert ( caller ! = 0 ) ; <nl> - caller ( src , minVal , maxVal , minLoc_ , maxLoc_ , valBuf , locBuf ) ; <nl> - } <nl> - else <nl> - { <nl> - MaskedCaller * callers = masked_multipass_callers ; <nl> - if ( TargetArchs : : builtWith ( GLOBAL_ATOMICS ) & & DeviceInfo ( ) . supports ( GLOBAL_ATOMICS ) ) <nl> - callers = masked_singlepass_callers ; <nl> - <nl> - MaskedCaller caller = callers [ src . type ( ) ] ; <nl> - CV_Assert ( caller ! = 0 ) ; <nl> - caller ( src , mask , minVal , maxVal , minLoc_ , maxLoc_ , valBuf , locBuf ) ; <nl> - } <nl> + const func_t func = funcs [ src . depth ( ) ] ; <nl> <nl> - if ( minLoc ) { minLoc - > x = minLoc_ [ 0 ] ; minLoc - > y = minLoc_ [ 1 ] ; } <nl> - if ( maxLoc ) { maxLoc - > x = maxLoc_ [ 0 ] ; maxLoc - > y = maxLoc_ [ 1 ] ; } <nl> + double temp1 , temp2 ; <nl> + Point temp3 , temp4 ; <nl> + func ( src , mask , minVal ? minVal : & temp1 , maxVal ? maxVal : & temp2 , minLoc ? & minLoc - > x : & temp3 . x , maxLoc ? & maxLoc - > x : & temp4 . x , valBuf , locBuf ) ; <nl> } <nl> <nl> / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / <nl> - / / Count non - zero elements <nl> + / / countNonZero <nl> <nl> - namespace cv { namespace gpu { namespace device <nl> + namespace countNonZero <nl> { <nl> - namespace matrix_reductions <nl> - { <nl> - namespace countnonzero <nl> - { <nl> - void getBufSizeRequired ( int cols , int rows , int & bufcols , int & bufrows ) ; <nl> + void getBufSize ( int cols , int rows , int & bufcols , int & bufrows ) ; <nl> <nl> - template < typename T > <nl> - int countNonZeroCaller ( const PtrStepSzb src , PtrStepb buf ) ; <nl> - <nl> - template < typename T > <nl> - int countNonZeroMultipassCaller ( const PtrStepSzb src , PtrStepb buf ) ; <nl> - } <nl> - } <nl> - } } } <nl> + template < typename T > <nl> + int run ( const PtrStepSzb src , PtrStep < unsigned int > buf ) ; <nl> + } <nl> <nl> int cv : : gpu : : countNonZero ( const GpuMat & src ) <nl> { <nl> int cv : : gpu : : countNonZero ( const GpuMat & src ) <nl> return countNonZero ( src , buf ) ; <nl> } <nl> <nl> - <nl> int cv : : gpu : : countNonZero ( const GpuMat & src , GpuMat & buf ) <nl> { <nl> - using namespace : : cv : : gpu : : device : : matrix_reductions : : countnonzero ; <nl> - <nl> - typedef int ( * Caller ) ( const PtrStepSzb src , PtrStepb buf ) ; <nl> - <nl> - static Caller multipass_callers [ 7 ] = <nl> + typedef int ( * func_t ) ( const PtrStepSzb src , PtrStep < unsigned int > buf ) ; <nl> + static const func_t funcs [ ] = <nl> { <nl> - countNonZeroMultipassCaller < unsigned char > , countNonZeroMultipassCaller < char > , <nl> - countNonZeroMultipassCaller < unsigned short > , countNonZeroMultipassCaller < short > , <nl> - countNonZeroMultipassCaller < int > , countNonZeroMultipassCaller < float > , 0 <nl> + : : countNonZero : : run < uchar > , <nl> + : : countNonZero : : run < schar > , <nl> + : : countNonZero : : run < ushort > , <nl> + : : countNonZero : : run < short > , <nl> + : : countNonZero : : run < int > , <nl> + : : countNonZero : : run < float > , <nl> + : : countNonZero : : run < double > <nl> } ; <nl> <nl> - static Caller singlepass_callers [ 7 ] = <nl> - { <nl> - countNonZeroCaller < unsigned char > , countNonZeroCaller < char > , <nl> - countNonZeroCaller < unsigned short > , countNonZeroCaller < short > , <nl> - countNonZeroCaller < int > , countNonZeroCaller < float > , countNonZeroCaller < double > } ; <nl> - <nl> - CV_Assert ( src . depth ( ) < = CV_64F ) ; <nl> CV_Assert ( src . channels ( ) = = 1 ) ; <nl> <nl> if ( src . depth ( ) = = CV_64F ) <nl> int cv : : gpu : : countNonZero ( const GpuMat & src , GpuMat & buf ) <nl> } <nl> <nl> Size buf_size ; <nl> - getBufSizeRequired ( src . cols , src . rows , buf_size . width , buf_size . height ) ; <nl> + : : countNonZero : : getBufSize ( src . cols , src . rows , buf_size . width , buf_size . height ) ; <nl> ensureSizeIsEnough ( buf_size , CV_8U , buf ) ; <nl> <nl> - Caller * callers = multipass_callers ; <nl> - if ( TargetArchs : : builtWith ( GLOBAL_ATOMICS ) & & DeviceInfo ( ) . supports ( GLOBAL_ATOMICS ) ) <nl> - callers = singlepass_callers ; <nl> + const func_t func = funcs [ src . depth ( ) ] ; <nl> <nl> - Caller caller = callers [ src . type ( ) ] ; <nl> - CV_Assert ( caller ! = 0 ) ; <nl> - return caller ( src , buf ) ; <nl> + return func ( src , buf ) ; <nl> } <nl> <nl> / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / <nl> / / reduce <nl> <nl> - namespace cv { namespace gpu { namespace device <nl> + namespace reduce <nl> { <nl> - namespace matrix_reductions <nl> - { <nl> - template < typename T , typename S , typename D > void reduceRows_gpu ( const PtrStepSzb & src , const PtrStepSzb & dst , int reduceOp , cudaStream_t stream ) ; <nl> - template < typename T , typename S , typename D > void reduceCols_gpu ( const PtrStepSzb & src , int cn , const PtrStepSzb & dst , int reduceOp , cudaStream_t stream ) ; <nl> - } <nl> - } } } <nl> + template < typename T , typename S , typename D > <nl> + void rows ( PtrStepSzb src , void * dst , int op , cudaStream_t stream ) ; <nl> + <nl> + template < typename T , typename S , typename D > <nl> + void cols ( PtrStepSzb src , void * dst , int cn , int op , cudaStream_t stream ) ; <nl> + } <nl> <nl> void cv : : gpu : : reduce ( const GpuMat & src , GpuMat & dst , int dim , int reduceOp , int dtype , Stream & stream ) <nl> { <nl> - using namespace : : cv : : gpu : : device : : matrix_reductions ; <nl> - <nl> - CV_Assert ( src . depth ( ) < = CV_32F & & src . channels ( ) < = 4 & & dtype < = CV_32F ) ; <nl> - CV_Assert ( dim = = 0 | | dim = = 1 ) ; <nl> - CV_Assert ( reduceOp = = CV_REDUCE_SUM | | reduceOp = = CV_REDUCE_AVG | | reduceOp = = CV_REDUCE_MAX | | reduceOp = = CV_REDUCE_MIN ) ; <nl> + CV_Assert ( src . channels ( ) < = 4 ) ; <nl> + CV_Assert ( dim = = 0 | | dim = = 1 ) ; <nl> + CV_Assert ( reduceOp = = CV_REDUCE_SUM | | reduceOp = = CV_REDUCE_AVG | | reduceOp = = CV_REDUCE_MAX | | reduceOp = = CV_REDUCE_MIN ) ; <nl> <nl> if ( dtype < 0 ) <nl> dtype = src . depth ( ) ; <nl> <nl> - dst . create ( 1 , dim = = 0 ? src . cols : src . rows , CV_MAKETYPE ( dtype , src . channels ( ) ) ) ; <nl> + dst . create ( 1 , dim = = 0 ? src . cols : src . rows , CV_MAKE_TYPE ( CV_MAT_DEPTH ( dtype ) , src . channels ( ) ) ) ; <nl> <nl> if ( dim = = 0 ) <nl> { <nl> - typedef void ( * caller_t ) ( const PtrStepSzb & src , const PtrStepSzb & dst , int reduceOp , cudaStream_t stream ) ; <nl> - <nl> - static const caller_t callers [ 6 ] [ 6 ] = <nl> + typedef void ( * func_t ) ( PtrStepSzb src , void * dst , int op , cudaStream_t stream ) ; <nl> + static const func_t funcs [ 7 ] [ 7 ] = <nl> { <nl> { <nl> - reduceRows_gpu < unsigned char , int , unsigned char > , <nl> - 0 / * reduceRows_gpu < unsigned char , int , signed char > * / , <nl> - 0 / * reduceRows_gpu < unsigned char , int , unsigned short > * / , <nl> - 0 / * reduceRows_gpu < unsigned char , int , short > * / , <nl> - reduceRows_gpu < unsigned char , int , int > , <nl> - reduceRows_gpu < unsigned char , int , float > <nl> + : : reduce : : rows < unsigned char , int , unsigned char > , <nl> + 0 / * : : reduce : : rows < unsigned char , int , signed char > * / , <nl> + 0 / * : : reduce : : rows < unsigned char , int , unsigned short > * / , <nl> + 0 / * : : reduce : : rows < unsigned char , int , short > * / , <nl> + : : reduce : : rows < unsigned char , int , int > , <nl> + : : reduce : : rows < unsigned char , float , float > , <nl> + : : reduce : : rows < unsigned char , double , double > <nl> + } , <nl> + { <nl> + 0 / * : : reduce : : rows < signed char , int , unsigned char > * / , <nl> + 0 / * : : reduce : : rows < signed char , int , signed char > * / , <nl> + 0 / * : : reduce : : rows < signed char , int , unsigned short > * / , <nl> + 0 / * : : reduce : : rows < signed char , int , short > * / , <nl> + 0 / * : : reduce : : rows < signed char , int , int > * / , <nl> + 0 / * : : reduce : : rows < signed char , float , float > * / , <nl> + 0 / * : : reduce : : rows < signed char , double , double > * / <nl> } , <nl> { <nl> - 0 / * reduceRows_gpu < signed char , int , unsigned char > * / , <nl> - 0 / * reduceRows_gpu < signed char , int , signed char > * / , <nl> - 0 / * reduceRows_gpu < signed char , int , unsigned short > * / , <nl> - 0 / * reduceRows_gpu < signed char , int , short > * / , <nl> - 0 / * reduceRows_gpu < signed char , int , int > * / , <nl> - 0 / * reduceRows_gpu < signed char , int , float > * / <nl> + 0 / * : : reduce : : rows < unsigned short , int , unsigned char > * / , <nl> + 0 / * : : reduce : : rows < unsigned short , int , signed char > * / , <nl> + : : reduce : : rows < unsigned short , int , unsigned short > , <nl> + 0 / * : : reduce : : rows < unsigned short , int , short > * / , <nl> + : : reduce : : rows < unsigned short , int , int > , <nl> + : : reduce : : rows < unsigned short , float , float > , <nl> + : : reduce : : rows < unsigned short , double , double > <nl> } , <nl> { <nl> - 0 / * reduceRows_gpu < unsigned short , int , unsigned char > * / , <nl> - 0 / * reduceRows_gpu < unsigned short , int , signed char > * / , <nl> - reduceRows_gpu < unsigned short , int , unsigned short > , <nl> - 0 / * reduceRows_gpu < unsigned short , int , short > * / , <nl> - reduceRows_gpu < unsigned short , int , int > , <nl> - reduceRows_gpu < unsigned short , int , float > <nl> + 0 / * : : reduce : : rows < short , int , unsigned char > * / , <nl> + 0 / * : : reduce : : rows < short , int , signed char > * / , <nl> + 0 / * : : reduce : : rows < short , int , unsigned short > * / , <nl> + : : reduce : : rows < short , int , short > , <nl> + : : reduce : : rows < short , int , int > , <nl> + : : reduce : : rows < short , float , float > , <nl> + : : reduce : : rows < short , double , double > <nl> } , <nl> { <nl> - 0 / * reduceRows_gpu < short , int , unsigned char > * / , <nl> - 0 / * reduceRows_gpu < short , int , signed char > * / , <nl> - 0 / * reduceRows_gpu < short , int , unsigned short > * / , <nl> - reduceRows_gpu < short , int , short > , <nl> - reduceRows_gpu < short , int , int > , <nl> - reduceRows_gpu < short , int , float > <nl> + 0 / * : : reduce : : rows < int , int , unsigned char > * / , <nl> + 0 / * : : reduce : : rows < int , int , signed char > * / , <nl> + 0 / * : : reduce : : rows < int , int , unsigned short > * / , <nl> + 0 / * : : reduce : : rows < int , int , short > * / , <nl> + : : reduce : : rows < int , int , int > , <nl> + : : reduce : : rows < int , float , float > , <nl> + : : reduce : : rows < int , double , double > <nl> } , <nl> { <nl> - 0 / * reduceRows_gpu < int , int , unsigned char > * / , <nl> - 0 / * reduceRows_gpu < int , int , signed char > * / , <nl> - 0 / * reduceRows_gpu < int , int , unsigned short > * / , <nl> - 0 / * reduceRows_gpu < int , int , short > * / , <nl> - reduceRows_gpu < int , int , int > , <nl> - reduceRows_gpu < int , int , float > <nl> + 0 / * : : reduce : : rows < float , float , unsigned char > * / , <nl> + 0 / * : : reduce : : rows < float , float , signed char > * / , <nl> + 0 / * : : reduce : : rows < float , float , unsigned short > * / , <nl> + 0 / * : : reduce : : rows < float , float , short > * / , <nl> + 0 / * : : reduce : : rows < float , float , int > * / , <nl> + : : reduce : : rows < float , float , float > , <nl> + : : reduce : : rows < float , double , double > <nl> } , <nl> { <nl> - 0 / * reduceRows_gpu < float , float , unsigned char > * / , <nl> - 0 / * reduceRows_gpu < float , float , signed char > * / , <nl> - 0 / * reduceRows_gpu < float , float , unsigned short > * / , <nl> - 0 / * reduceRows_gpu < float , float , short > * / , <nl> - 0 / * reduceRows_gpu < float , float , int > * / , <nl> - reduceRows_gpu < float , float , float > <nl> + 0 / * : : reduce : : rows < double , double , unsigned char > * / , <nl> + 0 / * : : reduce : : rows < double , double , signed char > * / , <nl> + 0 / * : : reduce : : rows < double , double , unsigned short > * / , <nl> + 0 / * : : reduce : : rows < double , double , short > * / , <nl> + 0 / * : : reduce : : rows < double , double , int > * / , <nl> + 0 / * : : reduce : : rows < double , double , float > * / , <nl> + : : reduce : : rows < double , double , double > <nl> } <nl> } ; <nl> <nl> - const caller_t func = callers [ src . depth ( ) ] [ dst . depth ( ) ] ; <nl> + const func_t func = funcs [ src . depth ( ) ] [ dst . depth ( ) ] ; <nl> <nl> if ( ! func ) <nl> CV_Error ( CV_StsUnsupportedFormat , " Unsupported combination of input and output array formats " ) ; <nl> <nl> - func ( src . reshape ( 1 ) , dst . reshape ( 1 ) , reduceOp , StreamAccessor : : getStream ( stream ) ) ; <nl> + func ( src . reshape ( 1 ) , dst . data , reduceOp , StreamAccessor : : getStream ( stream ) ) ; <nl> } <nl> else <nl> { <nl> - typedef void ( * caller_t ) ( const PtrStepSzb & src , int cn , const PtrStepSzb & dst , int reduceOp , cudaStream_t stream ) ; <nl> - <nl> - static const caller_t callers [ 6 ] [ 6 ] = <nl> + typedef void ( * func_t ) ( PtrStepSzb src , void * dst , int cn , int op , cudaStream_t stream ) ; <nl> + static const func_t funcs [ 7 ] [ 7 ] = <nl> { <nl> { <nl> - reduceCols_gpu < unsigned char , int , unsigned char > , <nl> - 0 / * reduceCols_gpu < unsigned char , int , signed char > * / , <nl> - 0 / * reduceCols_gpu < unsigned char , int , unsigned short > * / , <nl> - 0 / * reduceCols_gpu < unsigned char , int , short > * / , <nl> - reduceCols_gpu < unsigned char , int , int > , <nl> - reduceCols_gpu < unsigned char , int , float > <nl> + : : reduce : : cols < unsigned char , int , unsigned char > , <nl> + 0 / * : : reduce : : cols < unsigned char , int , signed char > * / , <nl> + 0 / * : : reduce : : cols < unsigned char , int , unsigned short > * / , <nl> + 0 / * : : reduce : : cols < unsigned char , int , short > * / , <nl> + : : reduce : : cols < unsigned char , int , int > , <nl> + : : reduce : : cols < unsigned char , float , float > , <nl> + : : reduce : : cols < unsigned char , double , double > <nl> + } , <nl> + { <nl> + 0 / * : : reduce : : cols < signed char , int , unsigned char > * / , <nl> + 0 / * : : reduce : : cols < signed char , int , signed char > * / , <nl> + 0 / * : : reduce : : cols < signed char , int , unsigned short > * / , <nl> + 0 / * : : reduce : : cols < signed char , int , short > * / , <nl> + 0 / * : : reduce : : cols < signed char , int , int > * / , <nl> + 0 / * : : reduce : : cols < signed char , float , float > * / , <nl> + 0 / * : : reduce : : cols < signed char , double , double > * / <nl> } , <nl> { <nl> - 0 / * reduceCols_gpu < signed char , int , unsigned char > * / , <nl> - 0 / * reduceCols_gpu < signed char , int , signed char > * / , <nl> - 0 / * reduceCols_gpu < signed char , int , unsigned short > * / , <nl> - 0 / * reduceCols_gpu < signed char , int , short > * / , <nl> - 0 / * reduceCols_gpu < signed char , int , int > * / , <nl> - 0 / * reduceCols_gpu < signed char , int , float > * / <nl> + 0 / * : : reduce : : cols < unsigned short , int , unsigned char > * / , <nl> + 0 / * : : reduce : : cols < unsigned short , int , signed char > * / , <nl> + : : reduce : : cols < unsigned short , int , unsigned short > , <nl> + 0 / * : : reduce : : cols < unsigned short , int , short > * / , <nl> + : : reduce : : cols < unsigned short , int , int > , <nl> + : : reduce : : cols < unsigned short , float , float > , <nl> + : : reduce : : cols < unsigned short , double , double > <nl> } , <nl> { <nl> - 0 / * reduceCols_gpu < unsigned short , int , unsigned char > * / , <nl> - 0 / * reduceCols_gpu < unsigned short , int , signed char > * / , <nl> - reduceCols_gpu < unsigned short , int , unsigned short > , <nl> - 0 / * reduceCols_gpu < unsigned short , int , short > * / , <nl> - reduceCols_gpu < unsigned short , int , int > , <nl> - reduceCols_gpu < unsigned short , int , float > <nl> + 0 / * : : reduce : : cols < short , int , unsigned char > * / , <nl> + 0 / * : : reduce : : cols < short , int , signed char > * / , <nl> + 0 / * : : reduce : : cols < short , int , unsigned short > * / , <nl> + : : reduce : : cols < short , int , short > , <nl> + : : reduce : : cols < short , int , int > , <nl> + : : reduce : : cols < short , float , float > , <nl> + : : reduce : : cols < short , double , double > <nl> } , <nl> { <nl> - 0 / * reduceCols_gpu < short , int , unsigned char > * / , <nl> - 0 / * reduceCols_gpu < short , int , signed char > * / , <nl> - 0 / * reduceCols_gpu < short , int , unsigned short > * / , <nl> - reduceCols_gpu < short , int , short > , <nl> - reduceCols_gpu < short , int , int > , <nl> - reduceCols_gpu < short , int , float > <nl> + 0 / * : : reduce : : cols < int , int , unsigned char > * / , <nl> + 0 / * : : reduce : : cols < int , int , signed char > * / , <nl> + 0 / * : : reduce : : cols < int , int , unsigned short > * / , <nl> + 0 / * : : reduce : : cols < int , int , short > * / , <nl> + : : reduce : : cols < int , int , int > , <nl> + : : reduce : : cols < int , float , float > , <nl> + : : reduce : : cols < int , double , double > <nl> } , <nl> { <nl> - 0 / * reduceCols_gpu < int , int , unsigned char > * / , <nl> - 0 / * reduceCols_gpu < int , int , signed char > * / , <nl> - 0 / * reduceCols_gpu < int , int , unsigned short > * / , <nl> - 0 / * reduceCols_gpu < int , int , short > * / , <nl> - reduceCols_gpu < int , int , int > , <nl> - reduceCols_gpu < int , int , float > <nl> + 0 / * : : reduce : : cols < float , float , unsigned char > * / , <nl> + 0 / * : : reduce : : cols < float , float , signed char > * / , <nl> + 0 / * : : reduce : : cols < float , float , unsigned short > * / , <nl> + 0 / * : : reduce : : cols < float , float , short > * / , <nl> + 0 / * : : reduce : : cols < float , float , int > * / , <nl> + : : reduce : : cols < float , float , float > , <nl> + : : reduce : : cols < float , double , double > <nl> } , <nl> { <nl> - 0 / * reduceCols_gpu < float , unsigned char > * / , <nl> - 0 / * reduceCols_gpu < float , signed char > * / , <nl> - 0 / * reduceCols_gpu < float , unsigned short > * / , <nl> - 0 / * reduceCols_gpu < float , short > * / , <nl> - 0 / * reduceCols_gpu < float , int > * / , <nl> - reduceCols_gpu < float , float , float > <nl> + 0 / * : : reduce : : cols < double , double , unsigned char > * / , <nl> + 0 / * : : reduce : : cols < double , double , signed char > * / , <nl> + 0 / * : : reduce : : cols < double , double , unsigned short > * / , <nl> + 0 / * : : reduce : : cols < double , double , short > * / , <nl> + 0 / * : : reduce : : cols < double , double , int > * / , <nl> + 0 / * : : reduce : : cols < double , double , float > * / , <nl> + : : reduce : : cols < double , double , double > <nl> } <nl> } ; <nl> <nl> - const caller_t func = callers [ src . depth ( ) ] [ dst . depth ( ) ] ; <nl> + const func_t func = funcs [ src . depth ( ) ] [ dst . depth ( ) ] ; <nl> <nl> if ( ! func ) <nl> CV_Error ( CV_StsUnsupportedFormat , " Unsupported combination of input and output array formats " ) ; <nl> <nl> - func ( src , src . channels ( ) , dst , reduceOp , StreamAccessor : : getStream ( stream ) ) ; <nl> + func ( src , dst . data , src . channels ( ) , reduceOp , StreamAccessor : : getStream ( stream ) ) ; <nl> } <nl> } <nl> <nl> mmm a / modules / gpu / test / test_core . cpp <nl> ppp b / modules / gpu / test / test_core . cpp <nl> TEST_P ( Sum , Sqr ) <nl> INSTANTIATE_TEST_CASE_P ( GPU_Core , Sum , testing : : Combine ( <nl> ALL_DEVICES , <nl> DIFFERENT_SIZES , <nl> - TYPES ( CV_8U , CV_32F , 1 , 4 ) , <nl> + TYPES ( CV_8U , CV_64F , 1 , 4 ) , <nl> WHOLE_SUBMAT ) ) ; <nl> <nl> / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / <nl> PARAM_TEST_CASE ( Reduce , cv : : gpu : : DeviceInfo , cv : : Size , MatDepth , Channels , Reduc <nl> cv : : gpu : : setDevice ( devInfo . deviceID ( ) ) ; <nl> <nl> type = CV_MAKE_TYPE ( depth , channels ) ; <nl> - dst_depth = ( reduceOp = = CV_REDUCE_MAX | | reduceOp = = CV_REDUCE_MIN ) ? depth : CV_32F ; <nl> + <nl> + if ( reduceOp = = CV_REDUCE_MAX | | reduceOp = = CV_REDUCE_MIN ) <nl> + dst_depth = depth ; <nl> + else if ( reduceOp = = CV_REDUCE_SUM ) <nl> + dst_depth = depth = = CV_8U ? CV_32S : depth < CV_64F ? CV_32F : depth ; <nl> + else <nl> + dst_depth = depth < CV_32F ? CV_32F : depth ; <nl> + <nl> dst_type = CV_MAKE_TYPE ( dst_depth , channels ) ; <nl> } <nl> <nl> INSTANTIATE_TEST_CASE_P ( GPU_Core , Reduce , testing : : Combine ( <nl> testing : : Values ( MatDepth ( CV_8U ) , <nl> MatDepth ( CV_16U ) , <nl> MatDepth ( CV_16S ) , <nl> - MatDepth ( CV_32F ) ) , <nl> + MatDepth ( CV_32F ) , <nl> + MatDepth ( CV_64F ) ) , <nl> ALL_CHANNELS , <nl> ALL_REDUCE_CODES , <nl> WHOLE_SUBMAT ) ) ; <nl>
matrix reduction
opencv/opencv
e8f9762ef373be508692d2d692d5c5a97ad533f9
2012-11-26T07:37:50Z
mmm a / bson / bsonobj . h <nl> ppp b / bson / bsonobj . h <nl> namespace mongo { <nl> <nl> OWNED CASE <nl> If the BSONObj owns the buffer , the buffer can be shared among several BSONObj ' s ( by assignment ) . <nl> - it during ~ BSONObj ( ) destruction . In this case the buffer is basically implemented as a shared_ptr . <nl> + In this case the buffer is basically implemented as a shared_ptr . <nl> Since BSONObj ' s are typically immutable , this works well . <nl> <nl> UNOWNED CASE <nl>
commennt
mongodb/mongo
7ca8b464eb4892fc361d6c59cd0bb2e32be1fdc6
2010-11-30T13:36:00Z
mmm a / validation - test / compiler_crashers_2_fixed / rdar71816041 . swift <nl> ppp b / validation - test / compiler_crashers_2_fixed / rdar71816041 . swift <nl> <nl> / / RUN : % target - swift - frontend - emit - ir - primary - file % s - enable - experimental - concurrency <nl> + / / REQUIRES : concurrency <nl> <nl> func getIntAndString ( ) async - > ( Int , String ) { ( 5 , " 1 " ) } <nl> <nl>
[ Testing ] Add missing REQUIRES
apple/swift
0e650c1c89bc00eba5953fb0e249ff185e3e0c24
2020-12-01T11:39:13Z
mmm a / src / launcher . cpp <nl> ppp b / src / launcher . cpp <nl> void Launcher : : openFile ( const std : : string & file ) <nl> <nl> # elif defined ALLEGRO_MACOSX <nl> <nl> - system ( ( " open " + file ) . c_str ( ) ) ; <nl> + system ( ( " open \ " " + file + " \ " " ) . c_str ( ) ) ; <nl> <nl> # else / / Linux <nl> <nl>
Added quotes in Launcher : : openFile ( ) to open URLs with ' & ' character .
aseprite/aseprite
a6b164d88b037137cf928b5fd45f2da26baa9cad
2010-07-07T02:45:41Z
mmm a / mk / support . mk <nl> ppp b / mk / support . mk <nl> $ ( V8_SRC_DIR ) : <nl> <nl> $ ( V8_INT_LIB ) : $ ( V8_INT_DIR ) <nl> $ P MAKE v8 <nl> - $ ( EXTERN_MAKE ) - C $ ( V8_INT_DIR ) native CXXFLAGS = - Wno - array - bounds $ ( SUPPORT_LOG_REDIRECT ) <nl> + $ ( EXTERN_MAKE ) - C $ ( V8_INT_DIR ) native CXXFLAGS = " $ $ CXXFLAGS - Wno - error " $ ( SUPPORT_LOG_REDIRECT ) <nl> $ P AR $ @ <nl> find $ ( V8_INT_DIR ) - iname " * . o " | grep - v ' \ / preparser_lib \ / ' | xargs ar cqs $ ( V8_INT_LIB ) ; <nl> <nl>
Pass CXXFLAGS to v8 build
rethinkdb/rethinkdb
00817661df91dfc319631b5ef53b7e5aa13ce348
2014-01-20T20:50:38Z
new file mode 100644 <nl> index 000000000000 . . a4b1b0766924 <nl> mmm / dev / null <nl> ppp b / xbmc / windowing / egl / EGLNativeTypeRaspberryPI . cpp <nl> <nl> + / * <nl> + * Copyright ( C ) 2011 - 2012 Team XBMC <nl> + * http : / / www . xbmc . org <nl> + * <nl> + * This Program is free software ; you can redistribute it and / or modify <nl> + * it under the terms of the GNU General Public License as published by <nl> + * the Free Software Foundation ; either version 2 , or ( at your option ) <nl> + * any later version . <nl> + * <nl> + * This Program is distributed in the hope that it will be useful , <nl> + * but WITHOUT ANY WARRANTY ; without even the implied warranty of <nl> + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE . See the <nl> + * GNU General Public License for more details . <nl> + * <nl> + * You should have received a copy of the GNU General Public License <nl> + * along with XBMC ; see the file COPYING . If not , see <nl> + * < http : / / www . gnu . org / licenses / > . <nl> + * <nl> + * / <nl> + # include " system . h " <nl> + <nl> + # include " EGLNativeTypeRaspberryPI . h " <nl> + # include " utils / log . h " <nl> + # include " guilib / gui3d . h " <nl> + # include " linux / DllBCM . h " <nl> + <nl> + # ifndef __VIDEOCORE4__ <nl> + # define __VIDEOCORE4__ <nl> + # endif <nl> + <nl> + # define __VCCOREVER__ 0x04000000 <nl> + <nl> + # define IS_WIDESCREEN ( m ) ( m = = 3 | | m = = 7 | | m = = 9 | | \ <nl> + m = = 11 | | m = = 13 | | m = = 15 | | m = = 18 | | m = = 22 | | \ <nl> + m = = 24 | | m = = 26 | | m = = 28 | | m = = 30 | | m = = 36 | | \ <nl> + m = = 38 | | m = = 43 | | m = = 45 | | m = = 49 | | m = = 51 | | \ <nl> + m = = 53 | | m = = 55 | | m = = 57 | | m = = 59 ) <nl> + <nl> + # define MAKEFLAGS ( group , mode , interlace , mode3d ) \ <nl> + ( ( ( mode ) < < 24 ) | ( ( group ) < < 16 ) | \ <nl> + ( ( interlace ) ! = 0 ? D3DPRESENTFLAG_INTERLACED : D3DPRESENTFLAG_PROGRESSIVE ) | \ <nl> + ( ( ( group ) = = HDMI_RES_GROUP_CEA & & IS_WIDESCREEN ( mode ) ) ? D3DPRESENTFLAG_WIDESCREEN : 0 ) | \ <nl> + ( ( mode3d ) ! = 0 ? D3DPRESENTFLAG_MODE3DSBS : 0 ) ) <nl> + <nl> + # define GETFLAGS_INTERLACE ( f ) ( ( ( f ) & D3DPRESENTFLAG_INTERLACED ) ! = 0 ) <nl> + # define GETFLAGS_WIDESCREEN ( f ) ( ( ( f ) & D3DPRESENTFLAG_WIDESCREEN ) ! = 0 ) <nl> + # define GETFLAGS_GROUP ( f ) ( ( HDMI_RES_GROUP_T ) ( ( ( f ) > > 16 ) & 0xff ) ) <nl> + # define GETFLAGS_MODE ( f ) ( ( ( f ) > > 24 ) & 0xff ) <nl> + # define GETFLAGS_MODE3D ( f ) ( ( ( f ) & D3DPRESENTFLAG_MODE3DSBS ) ! = 0 ) <nl> + <nl> + # define TV_MAX_SUPPORTED_MODES 60 <nl> + <nl> + / / # ifndef DEBUG_PRINT <nl> + / / # define DEBUG_PRINT 1 <nl> + / / # endif <nl> + <nl> + # if defined ( DEBUG_PRINT ) <nl> + # define DLOG ( fmt , args . . . ) printf ( fmt , # # args ) <nl> + # else <nl> + # define DLOG ( fmt , args . . . ) <nl> + # endif <nl> + <nl> + <nl> + CEGLNativeTypeRaspberryPI : : CEGLNativeTypeRaspberryPI ( ) <nl> + { <nl> + # if defined ( TARGET_RASPBERRY_PI ) <nl> + m_DllBcmHost = NULL ; <nl> + m_nativeWindow = NULL ; <nl> + # endif <nl> + } <nl> + <nl> + CEGLNativeTypeRaspberryPI : : ~ CEGLNativeTypeRaspberryPI ( ) <nl> + { <nl> + # if defined ( TARGET_RASPBERRY_PI ) <nl> + delete m_DllBcmHost ; <nl> + if ( m_nativeWindow ) <nl> + free ( m_nativeWindow ) ; <nl> + # endif <nl> + } <nl> + <nl> + bool CEGLNativeTypeRaspberryPI : : CheckCompatibility ( ) <nl> + { <nl> + # if defined ( TARGET_RASPBERRY_PI ) <nl> + DLOG ( " CEGLNativeTypeRaspberryPI : : CheckCompatibility \ n " ) ; <nl> + return true ; <nl> + # else <nl> + return false ; <nl> + # endif <nl> + } <nl> + <nl> + void CEGLNativeTypeRaspberryPI : : Initialize ( ) <nl> + { <nl> + # if defined ( TARGET_RASPBERRY_PI ) <nl> + m_DllBcmHost = NULL ; <nl> + m_dispman_element = DISPMANX_NO_HANDLE ; <nl> + m_dispman_element2 = DISPMANX_NO_HANDLE ; <nl> + m_dispman_display = DISPMANX_NO_HANDLE ; <nl> + <nl> + m_width = 1280 ; <nl> + m_height = 720 ; <nl> + m_initDesktopRes = true ; <nl> + <nl> + m_DllBcmHost = new DllBcmHost ; <nl> + m_DllBcmHost - > Load ( ) ; <nl> + # endif <nl> + } <nl> + <nl> + void CEGLNativeTypeRaspberryPI : : Destroy ( ) <nl> + { <nl> + # if defined ( TARGET_RASPBERRY_PI ) <nl> + if ( m_DllBcmHost & & m_DllBcmHost - > IsLoaded ( ) ) <nl> + m_DllBcmHost - > Unload ( ) ; <nl> + delete m_DllBcmHost ; <nl> + m_DllBcmHost = NULL ; <nl> + # endif <nl> + } <nl> + <nl> + bool CEGLNativeTypeRaspberryPI : : CreateNativeDisplay ( ) <nl> + { <nl> + m_nativeDisplay = EGL_DEFAULT_DISPLAY ; <nl> + return true ; <nl> + } <nl> + <nl> + bool CEGLNativeTypeRaspberryPI : : CreateNativeWindow ( ) <nl> + { <nl> + # if defined ( TARGET_RASPBERRY_PI ) <nl> + if ( ! m_nativeWindow ) <nl> + m_nativeWindow = ( EGLNativeWindowType ) calloc ( 1 , sizeof ( EGL_DISPMANX_WINDOW_T ) ) ; <nl> + DLOG ( " CEGLNativeTypeRaspberryPI : : CEGLNativeTypeRaspberryPI \ n " ) ; <nl> + return true ; <nl> + # else <nl> + return false ; <nl> + # endif <nl> + } <nl> + <nl> + bool CEGLNativeTypeRaspberryPI : : GetNativeDisplay ( EGLNativeDisplayType * * nativeDisplay ) const <nl> + { <nl> + * nativeDisplay = ( EGLNativeDisplayType * ) & m_nativeDisplay ; <nl> + return true ; <nl> + } <nl> + <nl> + bool CEGLNativeTypeRaspberryPI : : GetNativeWindow ( EGLNativeWindowType * * nativeWindow ) const <nl> + { <nl> + * nativeWindow = ( EGLNativeWindowType * ) & m_nativeWindow ; <nl> + DLOG ( " CEGLNativeTypeRaspberryPI : : GetNativeWindow \ n " ) ; <nl> + return true ; <nl> + } <nl> + <nl> + bool CEGLNativeTypeRaspberryPI : : DestroyNativeDisplay ( ) <nl> + { <nl> + DLOG ( " CEGLNativeTypeRaspberryPI : : DestroyNativeDisplay \ n " ) ; <nl> + return true ; <nl> + } <nl> + <nl> + bool CEGLNativeTypeRaspberryPI : : DestroyNativeWindow ( ) <nl> + { <nl> + # if defined ( TARGET_RASPBERRY_PI ) <nl> + DestroyDispmaxWindow ( ) ; <nl> + free ( m_nativeWindow ) ; <nl> + m_nativeWindow = NULL ; <nl> + DLOG ( " CEGLNativeTypeRaspberryPI : : DestroyNativeWindow \ n " ) ; <nl> + return true ; <nl> + # else <nl> + return false ; <nl> + # endif <nl> + } <nl> + <nl> + bool CEGLNativeTypeRaspberryPI : : GetNativeResolution ( RESOLUTION_INFO * res ) const <nl> + { <nl> + # if defined ( TARGET_RASPBERRY_PI ) <nl> + * res = m_desktopRes ; <nl> + <nl> + DLOG ( " CEGLNativeTypeRaspberryPI : : GetNativeResolution % s \ n " , res - > strMode . c_str ( ) ) ; <nl> + return true ; <nl> + # else <nl> + return false ; <nl> + # endif <nl> + } <nl> + <nl> + bool CEGLNativeTypeRaspberryPI : : SetNativeResolution ( const RESOLUTION_INFO & res ) <nl> + { <nl> + # if defined ( TARGET_RASPBERRY_PI ) <nl> + bool bFound = false ; <nl> + <nl> + if ( ! m_DllBcmHost | | ! m_nativeWindow ) <nl> + return false ; <nl> + <nl> + DestroyDispmaxWindow ( ) ; <nl> + <nl> + RESOLUTION_INFO resSearch ; <nl> + <nl> + int best_score = 0 ; <nl> + <nl> + for ( size_t i = 0 ; i < m_res . size ( ) ; i + + ) <nl> + { <nl> + if ( m_res [ i ] . iScreenWidth = = res . iScreenWidth & & m_res [ i ] . iScreenHeight = = res . iScreenHeight & & m_res [ i ] . fRefreshRate = = res . fRefreshRate ) <nl> + { <nl> + int score = 0 ; <nl> + <nl> + / * prefere progressive over interlaced * / <nl> + if ( ! GETFLAGS_INTERLACE ( m_res [ i ] . dwFlags ) ) <nl> + score = 1 ; <nl> + <nl> + if ( score > = best_score ) <nl> + { <nl> + resSearch = m_res [ i ] ; <nl> + bFound = true ; <nl> + } <nl> + } <nl> + } <nl> + <nl> + if ( bFound & & ! m_fixedMode ) <nl> + { <nl> + sem_init ( & m_tv_synced , 0 , 0 ) ; <nl> + m_DllBcmHost - > vc_tv_register_callback ( CallbackTvServiceCallback , this ) ; <nl> + <nl> + int success = m_DllBcmHost - > vc_tv_hdmi_power_on_explicit ( HDMI_MODE_HDMI , GETFLAGS_GROUP ( resSearch . dwFlags ) , GETFLAGS_MODE ( resSearch . dwFlags ) ) ; <nl> + <nl> + if ( success = = 0 ) <nl> + { <nl> + CLog : : Log ( LOGDEBUG , " EGL set HDMI mode ( % d , % d , % d ) = % d \ n " , <nl> + GETFLAGS_MODE3D ( resSearch . dwFlags ) ? HDMI_MODE_3D : HDMI_MODE_HDMI , GETFLAGS_GROUP ( resSearch . dwFlags ) , <nl> + GETFLAGS_MODE ( resSearch . dwFlags ) , success ) ; <nl> + sem_wait ( & m_tv_synced ) ; <nl> + } <nl> + else <nl> + { <nl> + CLog : : Log ( LOGERROR , " EGL failed to set HDMI mode ( % d , % d , % d ) = % d \ n " , <nl> + GETFLAGS_MODE3D ( resSearch . dwFlags ) ? HDMI_MODE_3D : HDMI_MODE_HDMI , GETFLAGS_GROUP ( resSearch . dwFlags ) , <nl> + GETFLAGS_MODE ( resSearch . dwFlags ) , success ) ; <nl> + } <nl> + m_DllBcmHost - > vc_tv_unregister_callback ( CallbackTvServiceCallback ) ; <nl> + sem_destroy ( & m_tv_synced ) ; <nl> + <nl> + m_desktopRes = resSearch ; <nl> + } <nl> + <nl> + m_dispman_display = m_DllBcmHost - > vc_dispmanx_display_open ( 0 ) ; <nl> + <nl> + m_width = res . iWidth ; <nl> + m_height = res . iHeight ; <nl> + <nl> + VC_RECT_T dst_rect ; <nl> + VC_RECT_T src_rect ; <nl> + <nl> + dst_rect . x = 0 ; <nl> + dst_rect . y = 0 ; <nl> + dst_rect . width = res . iScreenWidth ; <nl> + dst_rect . height = res . iScreenHeight ; <nl> + <nl> + src_rect . x = 0 ; <nl> + src_rect . y = 0 ; <nl> + src_rect . width = m_width < < 16 ; <nl> + src_rect . height = m_height < < 16 ; <nl> + <nl> + VC_DISPMANX_ALPHA_T alpha ; <nl> + memset ( & alpha , 0x0 , sizeof ( VC_DISPMANX_ALPHA_T ) ) ; <nl> + alpha . flags = DISPMANX_FLAGS_ALPHA_FROM_SOURCE ; <nl> + <nl> + DISPMANX_CLAMP_T clamp ; <nl> + memset ( & clamp , 0x0 , sizeof ( DISPMANX_CLAMP_T ) ) ; <nl> + <nl> + DISPMANX_TRANSFORM_T transform = DISPMANX_NO_ROTATE ; <nl> + DISPMANX_UPDATE_HANDLE_T dispman_update = m_DllBcmHost - > vc_dispmanx_update_start ( 0 ) ; <nl> + <nl> + CLog : : Log ( LOGDEBUG , " EGL set resolution % dx % d - > % dx % d @ % . 2f fps \ n " , <nl> + m_width , m_height , dst_rect . width , dst_rect . height , bFound ? resSearch . fRefreshRate : res . fRefreshRate ) ; <nl> + <nl> + / / The trick for SBS is that we stick two dispman elements together <nl> + / / and the PI firmware knows that we are in SBS mode and it renders the gui in SBS <nl> + if ( bFound & & ( resSearch . dwFlags & D3DPRESENTFLAG_MODE3DSBS ) ) <nl> + { <nl> + / / right side <nl> + dst_rect . x = res . iScreenWidth ; <nl> + dst_rect . width = res . iScreenWidth ; <nl> + <nl> + m_dispman_element2 = m_DllBcmHost - > vc_dispmanx_element_add ( dispman_update , <nl> + m_dispman_display , <nl> + 1 , / / layer <nl> + & dst_rect , <nl> + ( DISPMANX_RESOURCE_HANDLE_T ) 0 , / / src <nl> + & src_rect , <nl> + DISPMANX_PROTECTION_NONE , <nl> + & alpha , / / alpha <nl> + & clamp , / / clamp <nl> + transform ) ; / / transform <nl> + assert ( m_dispman_element2 ! = DISPMANX_NO_HANDLE ) ; <nl> + assert ( m_dispman_element2 ! = ( unsigned ) DISPMANX_INVALID ) ; <nl> + <nl> + / / left side - fall through <nl> + dst_rect . x = 0 ; <nl> + dst_rect . width = res . iScreenWidth ; <nl> + } <nl> + <nl> + m_dispman_element = m_DllBcmHost - > vc_dispmanx_element_add ( dispman_update , <nl> + m_dispman_display , <nl> + 1 , / / layer <nl> + & dst_rect , <nl> + ( DISPMANX_RESOURCE_HANDLE_T ) 0 , / / src <nl> + & src_rect , <nl> + DISPMANX_PROTECTION_NONE , <nl> + & alpha , / / alphe <nl> + & clamp , / / clamp <nl> + transform ) ; / / transform <nl> + <nl> + assert ( m_dispman_element ! = DISPMANX_NO_HANDLE ) ; <nl> + assert ( m_dispman_element ! = ( unsigned ) DISPMANX_INVALID ) ; <nl> + <nl> + memset ( m_nativeWindow , 0 , sizeof ( EGL_DISPMANX_WINDOW_T ) ) ; <nl> + <nl> + EGL_DISPMANX_WINDOW_T * nativeWindow = ( EGL_DISPMANX_WINDOW_T * ) m_nativeWindow ; <nl> + <nl> + nativeWindow - > element = m_dispman_element ; <nl> + nativeWindow - > width = m_width ; <nl> + nativeWindow - > height = m_height ; <nl> + <nl> + m_DllBcmHost - > vc_dispmanx_display_set_background ( dispman_update , m_dispman_display , 0x00 , 0x00 , 0x00 ) ; <nl> + m_DllBcmHost - > vc_dispmanx_update_submit_sync ( dispman_update ) ; <nl> + <nl> + DLOG ( " CEGLNativeTypeRaspberryPI : : SetNativeResolution \ n " ) ; <nl> + <nl> + return true ; <nl> + # else <nl> + return false ; <nl> + # endif <nl> + } <nl> + <nl> + bool CEGLNativeTypeRaspberryPI : : ProbeResolutions ( std : : vector < RESOLUTION_INFO > & resolutions ) <nl> + { <nl> + # if defined ( TARGET_RASPBERRY_PI ) <nl> + resolutions . clear ( ) ; <nl> + m_res . clear ( ) ; <nl> + <nl> + if ( ! m_DllBcmHost ) <nl> + return false ; <nl> + <nl> + m_fixedMode = false ; <nl> + <nl> + / * read initial desktop resolution before probe resolutions . <nl> + * probing will replace the desktop resolution when it finds the same one . <nl> + * we raplace it because probing will generate more detailed <nl> + * resolution flags we don ' t get with vc_tv_get_state . <nl> + * / <nl> + <nl> + if ( m_initDesktopRes ) <nl> + { <nl> + TV_GET_STATE_RESP_T tv_state ; <nl> + <nl> + / / get current display settings state <nl> + memset ( & tv_state , 0 , sizeof ( TV_GET_STATE_RESP_T ) ) ; <nl> + m_DllBcmHost - > vc_tv_get_state ( & tv_state ) ; <nl> + <nl> + m_desktopRes . iScreen = 0 ; <nl> + m_desktopRes . bFullScreen = true ; <nl> + m_desktopRes . iWidth = tv_state . width ; <nl> + m_desktopRes . iHeight = tv_state . height ; <nl> + m_desktopRes . iScreenWidth = tv_state . width ; <nl> + m_desktopRes . iScreenHeight = tv_state . height ; <nl> + m_desktopRes . dwFlags = tv_state . scan_mode ? D3DPRESENTFLAG_INTERLACED : D3DPRESENTFLAG_PROGRESSIVE ; <nl> + m_desktopRes . fRefreshRate = ( float ) tv_state . frame_rate ; <nl> + m_desktopRes . strMode . Format ( " % dx % d " , tv_state . width , tv_state . height ) ; <nl> + if ( ( float ) tv_state . frame_rate > 1 ) <nl> + { <nl> + m_desktopRes . strMode . Format ( " % s @ % . 2f % s - Full Screen " , m_desktopRes . strMode , ( float ) tv_state . frame_rate , <nl> + m_desktopRes . dwFlags & D3DPRESENTFLAG_INTERLACED ? " i " : " " ) ; <nl> + } <nl> + m_initDesktopRes = false ; <nl> + <nl> + int gui_width = m_desktopRes . iWidth ; <nl> + int gui_height = m_desktopRes . iHeight ; <nl> + <nl> + ClampToGUIDisplayLimits ( gui_width , gui_height ) ; <nl> + <nl> + m_desktopRes . iWidth = gui_width ; <nl> + m_desktopRes . iHeight = gui_height ; <nl> + <nl> + m_desktopRes . iSubtitles = ( int ) ( 0 . 965 * m_desktopRes . iHeight ) ; <nl> + <nl> + CLog : : Log ( LOGDEBUG , " EGL initial desktop resolution % s \ n " , m_desktopRes . strMode . c_str ( ) ) ; <nl> + } <nl> + <nl> + <nl> + GetSupportedModes ( HDMI_RES_GROUP_CEA , resolutions ) ; <nl> + GetSupportedModes ( HDMI_RES_GROUP_DMT , resolutions ) ; <nl> + GetSupportedModes ( HDMI_RES_GROUP_CEA_3D , resolutions ) ; <nl> + <nl> + if ( resolutions . size ( ) = = 0 ) <nl> + { <nl> + TV_GET_STATE_RESP_T tv ; <nl> + m_DllBcmHost - > vc_tv_get_state ( & tv ) ; <nl> + <nl> + RESOLUTION_INFO res ; <nl> + CLog : : Log ( LOGDEBUG , " EGL probe resolution % dx % d @ % f % s : % x \ n " , <nl> + m_desktopRes . iWidth , m_desktopRes . iHeight , m_desktopRes . fRefreshRate , <nl> + m_desktopRes . dwFlags & D3DPRESENTFLAG_INTERLACED ? " i " : " p " ) ; <nl> + <nl> + m_res . push_back ( m_desktopRes ) ; <nl> + resolutions . push_back ( m_desktopRes ) ; <nl> + } <nl> + <nl> + if ( resolutions . size ( ) < 2 ) <nl> + m_fixedMode = true ; <nl> + <nl> + DLOG ( " CEGLNativeTypeRaspberryPI : : ProbeResolutions \ n " ) ; <nl> + return true ; <nl> + # else <nl> + return false ; <nl> + # endif <nl> + } <nl> + <nl> + bool CEGLNativeTypeRaspberryPI : : GetPreferredResolution ( RESOLUTION_INFO * res ) const <nl> + { <nl> + DLOG ( " CEGLNativeTypeRaspberryPI : : GetPreferredResolution \ n " ) ; <nl> + return false ; <nl> + } <nl> + <nl> + bool CEGLNativeTypeRaspberryPI : : ShowWindow ( bool show ) <nl> + { <nl> + DLOG ( " CEGLNativeTypeRaspberryPI : : ShowWindow \ n " ) ; <nl> + return false ; <nl> + } <nl> + <nl> + # if defined ( TARGET_RASPBERRY_PI ) <nl> + void CEGLNativeTypeRaspberryPI : : DestroyDispmaxWindow ( ) <nl> + { <nl> + if ( ! m_DllBcmHost ) <nl> + return ; <nl> + <nl> + DISPMANX_UPDATE_HANDLE_T dispman_update = m_DllBcmHost - > vc_dispmanx_update_start ( 0 ) ; <nl> + <nl> + if ( m_dispman_element ! = DISPMANX_NO_HANDLE ) <nl> + { <nl> + m_DllBcmHost - > vc_dispmanx_element_remove ( dispman_update , m_dispman_element ) ; <nl> + m_dispman_element = DISPMANX_NO_HANDLE ; <nl> + } <nl> + if ( m_dispman_element2 ! = DISPMANX_NO_HANDLE ) <nl> + { <nl> + m_DllBcmHost - > vc_dispmanx_element_remove ( dispman_update , m_dispman_element2 ) ; <nl> + m_dispman_element2 = DISPMANX_NO_HANDLE ; <nl> + } <nl> + m_DllBcmHost - > vc_dispmanx_update_submit_sync ( dispman_update ) ; <nl> + <nl> + if ( m_dispman_display ! = DISPMANX_NO_HANDLE ) <nl> + { <nl> + m_DllBcmHost - > vc_dispmanx_display_close ( m_dispman_display ) ; <nl> + m_dispman_display = DISPMANX_NO_HANDLE ; <nl> + } <nl> + DLOG ( " CEGLNativeTypeRaspberryPI : : DestroyDispmaxWindow \ n " ) ; <nl> + } <nl> + <nl> + void CEGLNativeTypeRaspberryPI : : GetSupportedModes ( HDMI_RES_GROUP_T group , std : : vector < RESOLUTION_INFO > & resolutions ) <nl> + { <nl> + if ( ! m_DllBcmHost ) <nl> + return ; <nl> + <nl> + / / Supported HDMI CEA / DMT resolutions , first one will be preferred resolution <nl> + TV_SUPPORTED_MODE_T supported_modes [ TV_MAX_SUPPORTED_MODES ] ; <nl> + int32_t num_modes ; <nl> + HDMI_RES_GROUP_T prefer_group ; <nl> + uint32_t prefer_mode ; <nl> + int i ; <nl> + <nl> + num_modes = m_DllBcmHost - > vc_tv_hdmi_get_supported_modes ( group , <nl> + supported_modes , TV_MAX_SUPPORTED_MODES , & prefer_group , & prefer_mode ) ; <nl> + <nl> + CLog : : Log ( LOGDEBUG , " EGL get supported modes ( % d ) = % d , prefer_group = % x , prefer_mode = % x \ n " , <nl> + group , num_modes , prefer_group , prefer_mode ) ; <nl> + <nl> + if ( num_modes > 0 & & prefer_group ! = HDMI_RES_GROUP_INVALID ) <nl> + { <nl> + TV_SUPPORTED_MODE_T * tv = supported_modes ; <nl> + for ( i = 0 ; i < num_modes ; i + + , tv + + ) <nl> + { <nl> + / / treat 3D modes as half - width SBS <nl> + unsigned int width = ( group = = HDMI_RES_GROUP_CEA_3D ) ? tv - > width > > 1 : tv - > width ; <nl> + RESOLUTION_INFO res ; <nl> + CLog : : Log ( LOGDEBUG , " EGL mode % d : % dx % d @ % d % s % s : % x \ n " , i , width , tv - > height , tv - > frame_rate , <nl> + tv - > native ? " N " : " " , tv - > scan_mode ? " I " : " " , tv - > code ) ; <nl> + <nl> + res . iScreen = 0 ; <nl> + res . bFullScreen = true ; <nl> + res . dwFlags = MAKEFLAGS ( group , tv - > code , tv - > scan_mode , group = = HDMI_RES_GROUP_CEA_3D ) ; <nl> + res . fRefreshRate = ( float ) tv - > frame_rate ; <nl> + res . fPixelRatio = 1 . 0f ; <nl> + res . iWidth = width ; <nl> + res . iHeight = tv - > height ; <nl> + res . iScreenWidth = width ; <nl> + res . iScreenHeight = tv - > height ; <nl> + res . strMode . Format ( " % dx % d " , width , tv - > height ) ; <nl> + if ( ( float ) tv - > frame_rate > 1 ) <nl> + { <nl> + res . strMode . Format ( " % dx % d @ % . 2f % s - Full Screen " , res . iScreenWidth , res . iScreenHeight , res . fRefreshRate , <nl> + res . dwFlags & D3DPRESENTFLAG_INTERLACED ? " i " : " " ) ; <nl> + } <nl> + <nl> + int gui_width = res . iWidth ; <nl> + int gui_height = res . iHeight ; <nl> + <nl> + ClampToGUIDisplayLimits ( gui_width , gui_height ) ; <nl> + <nl> + res . iWidth = gui_width ; <nl> + res . iHeight = gui_height ; <nl> + <nl> + res . iSubtitles = ( int ) ( 0 . 965 * res . iHeight ) ; <nl> + <nl> + resolutions . push_back ( res ) ; <nl> + <nl> + / * replace initial desktop resolution with probed hdmi resolution * / <nl> + if ( m_desktopRes . iWidth = = res . iWidth & & m_desktopRes . iHeight = = res . iHeight & & <nl> + m_desktopRes . iScreenWidth = = res . iScreenWidth & & m_desktopRes . iScreenHeight = = res . iScreenHeight & & <nl> + m_desktopRes . fRefreshRate = = res . fRefreshRate ) <nl> + { <nl> + m_desktopRes = res ; <nl> + CLog : : Log ( LOGDEBUG , " EGL desktop replacement resolution % dx % d @ % d % s % s : % x \ n " , <nl> + width , tv - > height , tv - > frame_rate , tv - > native ? " N " : " " , tv - > scan_mode ? " I " : " " , tv - > code ) ; <nl> + } <nl> + <nl> + m_res . push_back ( res ) ; <nl> + } <nl> + } <nl> + } <nl> + <nl> + void CEGLNativeTypeRaspberryPI : : TvServiceCallback ( uint32_t reason , uint32_t param1 , uint32_t param2 ) <nl> + { <nl> + CLog : : Log ( LOGDEBUG , " EGL tv_service_callback ( % d , % d , % d ) \ n " , reason , param1 , param2 ) ; <nl> + switch ( reason ) <nl> + { <nl> + case VC_HDMI_UNPLUGGED : <nl> + break ; <nl> + case VC_HDMI_STANDBY : <nl> + break ; <nl> + case VC_SDTV_NTSC : <nl> + case VC_SDTV_PAL : <nl> + case VC_HDMI_HDMI : <nl> + case VC_HDMI_DVI : <nl> + / / Signal we are ready now <nl> + sem_post ( & m_tv_synced ) ; <nl> + break ; <nl> + default : <nl> + break ; <nl> + } <nl> + } <nl> + <nl> + void CEGLNativeTypeRaspberryPI : : CallbackTvServiceCallback ( void * userdata , uint32_t reason , uint32_t param1 , uint32_t param2 ) <nl> + { <nl> + CEGLNativeTypeRaspberryPI * callback = static_cast < CEGLNativeTypeRaspberryPI * > ( userdata ) ; <nl> + callback - > TvServiceCallback ( reason , param1 , param2 ) ; <nl> + } <nl> + <nl> + bool CEGLNativeTypeRaspberryPI : : ClampToGUIDisplayLimits ( int & width , int & height ) <nl> + { <nl> + const int max_width = 1280 , max_height = 720 ; <nl> + float ar = ( float ) width / ( float ) height ; <nl> + / / bigger than maximum , so need to clamp <nl> + if ( width > max_width | | height > max_height ) { <nl> + / / wider than max , so clamp width first <nl> + if ( ar > ( float ) max_width / ( float ) max_height ) <nl> + { <nl> + width = max_width ; <nl> + height = ( float ) max_width / ar + 0 . 5f ; <nl> + / / taller than max , so clamp height first <nl> + } else { <nl> + height = max_height ; <nl> + width = ( float ) max_height * ar + 0 . 5f ; <nl> + } <nl> + return true ; <nl> + } <nl> + <nl> + return false ; <nl> + } <nl> + <nl> + # endif <nl> + <nl> new file mode 100644 <nl> index 000000000000 . . 73440e22eb15 <nl> mmm / dev / null <nl> ppp b / xbmc / windowing / egl / EGLNativeTypeRaspberryPI . h <nl> <nl> + # pragma once <nl> + <nl> + / * <nl> + * Copyright ( C ) 2011 - 2012 Team XBMC <nl> + * http : / / www . xbmc . org <nl> + * <nl> + * This Program is free software ; you can redistribute it and / or modify <nl> + * it under the terms of the GNU General Public License as published by <nl> + * the Free Software Foundation ; either version 2 , or ( at your option ) <nl> + * any later version . <nl> + * <nl> + * This Program is distributed in the hope that it will be useful , <nl> + * but WITHOUT ANY WARRANTY ; without even the implied warranty of <nl> + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE . See the <nl> + * GNU General Public License for more details . <nl> + * <nl> + * You should have received a copy of the GNU General Public License <nl> + * along with XBMC ; see the file COPYING . If not , see <nl> + * < http : / / www . gnu . org / licenses / > . <nl> + * <nl> + * / <nl> + <nl> + # include " EGLNativeType . h " <nl> + # include < semaphore . h > <nl> + <nl> + class DllBcmHost ; <nl> + class CEGLNativeTypeRaspberryPI : public CEGLNativeType <nl> + { <nl> + public : <nl> + CEGLNativeTypeRaspberryPI ( ) ; <nl> + virtual ~ CEGLNativeTypeRaspberryPI ( ) ; <nl> + virtual std : : string GetNativeName ( ) const { return " raspberrypi " ; } ; <nl> + virtual bool CheckCompatibility ( ) ; <nl> + virtual void Initialize ( ) ; <nl> + virtual void Destroy ( ) ; <nl> + virtual int GetQuirks ( ) { return EGL_QUIRK_NONE ; } ; <nl> + <nl> + virtual bool CreateNativeDisplay ( ) ; <nl> + virtual bool CreateNativeWindow ( ) ; <nl> + virtual bool GetNativeDisplay ( EGLNativeDisplayType * * nativeDisplay ) const ; <nl> + virtual bool GetNativeWindow ( EGLNativeWindowType * * nativeWindow ) const ; <nl> + <nl> + virtual bool DestroyNativeWindow ( ) ; <nl> + virtual bool DestroyNativeDisplay ( ) ; <nl> + <nl> + virtual bool GetNativeResolution ( RESOLUTION_INFO * res ) const ; <nl> + virtual bool SetNativeResolution ( const RESOLUTION_INFO & res ) ; <nl> + virtual bool ProbeResolutions ( std : : vector < RESOLUTION_INFO > & resolutions ) ; <nl> + virtual bool GetPreferredResolution ( RESOLUTION_INFO * res ) const ; <nl> + <nl> + virtual bool ShowWindow ( bool show ) ; <nl> + # if defined ( TARGET_RASPBERRY_PI ) <nl> + private : <nl> + DllBcmHost * m_DllBcmHost ; <nl> + DISPMANX_ELEMENT_HANDLE_T m_dispman_display ; <nl> + DISPMANX_ELEMENT_HANDLE_T m_dispman_element ; <nl> + DISPMANX_ELEMENT_HANDLE_T m_dispman_element2 ; <nl> + TV_GET_STATE_RESP_T m_tv_state ; <nl> + sem_t m_tv_synced ; <nl> + bool m_fixedMode ; <nl> + std : : vector < RESOLUTION_INFO > m_res ; <nl> + RESOLUTION_INFO m_desktopRes ; <nl> + int m_width ; <nl> + int m_height ; <nl> + int m_initDesktopRes ; <nl> + <nl> + void GetSupportedModes ( HDMI_RES_GROUP_T group , std : : vector < RESOLUTION_INFO > & resolutions ) ; <nl> + void TvServiceCallback ( uint32_t reason , uint32_t param1 , uint32_t param2 ) ; <nl> + static void CallbackTvServiceCallback ( void * userdata , uint32_t reason , uint32_t param1 , uint32_t param2 ) ; <nl> + <nl> + void DestroyDispmaxWindow ( ) ; <nl> + bool ClampToGUIDisplayLimits ( int & width , int & height ) ; <nl> + # endif <nl> + } ; <nl> mmm a / xbmc / windowing / egl / EGLWrapper . cpp <nl> ppp b / xbmc / windowing / egl / EGLWrapper . cpp <nl> <nl> # include " utils / log . h " <nl> # include " EGLNativeTypeAndroid . h " <nl> # include " EGLNativeTypeAmlogic . h " <nl> + # include " EGLNativeTypeRaspberryPI . h " <nl> # include " EGLWrapper . h " <nl> <nl> # define CheckError ( ) m_result = eglGetError ( ) ; if ( m_result ! = EGL_SUCCESS ) CLog : : Log ( LOGERROR , " EGL error in % s : % x " , __FUNCTION__ , m_result ) ; <nl> bool CEGLWrapper : : Initialize ( const std : : string & implementation ) <nl> } <nl> } <nl> <nl> + if ( ! ret ) <nl> + { <nl> + delete nativeGuess ; <nl> + nativeGuess = new CEGLNativeTypeRaspberryPI ; <nl> + if ( nativeGuess - > CheckCompatibility ( ) ) <nl> + { <nl> + if ( implementation = = nativeGuess - > GetNativeName ( ) | | implementation = = " auto " ) <nl> + { <nl> + m_nativeTypes = nativeGuess ; <nl> + ret = true ; <nl> + } <nl> + } <nl> + } <nl> + <nl> if ( ret & & m_nativeTypes ) <nl> m_nativeTypes - > Initialize ( ) ; <nl> <nl> mmm a / xbmc / windowing / egl / Makefile <nl> ppp b / xbmc / windowing / egl / Makefile <nl> INCLUDES = - I . <nl> SRCS = WinSystemEGL . cpp <nl> SRCS + = EGLNativeTypeAmlogic . cpp <nl> SRCS + = EGLNativeTypeAndroid . cpp <nl> + SRCS + = EGLNativeTypeRaspberryPI . cpp <nl> SRCS + = EGLWrapper . cpp <nl> <nl> LIB = windowing_egl . a <nl>
egl : add rbp implementation . Thanks Gimli
xbmc/xbmc
8dd8c649f25110a52d57d06a338d530ec85d2d6b
2012-10-10T21:16:58Z
mmm a / BUILD . gn <nl> ppp b / BUILD . gn <nl> declare_args ( ) { <nl> v8_random_seed = " 314159265 " <nl> v8_toolset_for_shell = " host " <nl> <nl> - if ( v8_use_snapshot & & v8_use_external_startup_data ) { <nl> - snapshot_target = " : v8_external_snapshot " <nl> - } else if ( v8_use_snapshot ) { <nl> - snapshot_target = " : v8_snapshot " <nl> - } else { <nl> - assert ( ! v8_use_external_startup_data ) <nl> - snapshot_target = " : v8_nosnapshot " <nl> - } <nl> - <nl> # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # <nl> # Configurations <nl> # <nl> action ( " run_mksnapshot " ) { <nl> # Source Sets ( aka static libraries ) <nl> # <nl> <nl> + source_set ( " v8_maybe_snapshot " ) { <nl> + if ( v8_use_snapshot & & v8_use_external_startup_data ) { <nl> + public_deps = [ " : v8_external_snapshot " ] <nl> + } else if ( v8_use_snapshot ) { <nl> + public_deps = [ " : v8_snapshot " ] <nl> + } else { <nl> + assert ( ! v8_use_external_startup_data ) <nl> + public_deps = [ " : v8_nosnapshot " ] <nl> + } <nl> + } <nl> + <nl> v8_source_set ( " v8_nosnapshot " ) { <nl> visibility = [ " : * " ] # Only targets in this file can depend on this . <nl> <nl> v8_source_set ( " fuzzer_support " ) { <nl> configs = [ " : internal_config_base " ] <nl> <nl> deps = [ <nl> - snapshot_target , <nl> + " : v8_maybe_snapshot " , <nl> ] <nl> <nl> public_deps = [ <nl> if ( current_toolchain = = v8_snapshot_toolchain ) { <nl> # Public targets <nl> # <nl> <nl> + want_v8_shell = ( <nl> + ( current_toolchain = = host_toolchain & & v8_toolset_for_shell = = " host " ) | | <nl> + ( current_toolchain = = v8_snapshot_toolchain & & <nl> + v8_toolset_for_shell = = " host " ) | | <nl> + ( current_toolchain ! = host_toolchain & & v8_toolset_for_shell = = " target " ) ) <nl> + <nl> + group ( " gn_all " ) { <nl> + testonly = true <nl> + <nl> + deps = [ <nl> + " : d8 " , <nl> + ] <nl> + <nl> + if ( want_v8_shell ) { <nl> + deps + = [ <nl> + " : v8_shell " , <nl> + ] <nl> + } <nl> + <nl> + if ( host_os ! = " mac " | | ! is_android ) { <nl> + # These items don ' t compile for Android on Mac . <nl> + deps + = [ <nl> + " test / unittests : unittests " , <nl> + ] <nl> + } <nl> + } <nl> + <nl> if ( is_component_build ) { <nl> component ( " v8 " ) { <nl> sources = [ <nl> if ( is_component_build ) { <nl> <nl> public_deps = [ <nl> " : v8_base " , <nl> - snapshot_target , <nl> + " : v8_maybe_snapshot " , <nl> ] <nl> <nl> configs - = [ " / / build / config / compiler : chromium_code " ] <nl> if ( is_component_build ) { <nl> group ( " v8 " ) { <nl> public_deps = [ <nl> " : v8_base " , <nl> - snapshot_target , <nl> + " : v8_maybe_snapshot " , <nl> ] <nl> public_configs = [ " : external_config " ] <nl> } <nl> executable ( " d8 " ) { <nl> } <nl> } <nl> <nl> - if ( ( current_toolchain = = host_toolchain & & v8_toolset_for_shell = = " host " ) | | <nl> - ( current_toolchain = = v8_snapshot_toolchain & & <nl> - v8_toolset_for_shell = = " host " ) | | <nl> - ( current_toolchain ! = host_toolchain & & v8_toolset_for_shell = = " target " ) ) { <nl> + if ( want_v8_shell ) { <nl> executable ( " v8_shell " ) { <nl> sources = [ <nl> " samples / shell . cc " , <nl> new file mode 100644 <nl> index 00000000000 . . 5d22f0135e1 <nl> mmm / dev / null <nl> ppp b / build_overrides / gtest . gni <nl> <nl> + # Copyright 2016 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> + # Exclude support for registering main function in multi - process tests . <nl> + gtest_include_multiprocess = false <nl> + <nl> + # Exclude support for platform - specific operations across unit tests . <nl> + gtest_include_platform_test = true <nl> + <nl> + # Exclude support for testing Objective C code on OS X and iOS . <nl> + gtest_include_objc_support = true <nl> + <nl> + # Exclude support for flushing coverage files on iOS . <nl> + gtest_include_ios_coverage = true <nl> new file mode 100644 <nl> index 00000000000 . . f7c6094b1df <nl> mmm / dev / null <nl> ppp b / test / unittests / BUILD . gn <nl> <nl> + # Copyright 2016 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> + import ( " . . / . . / gni / v8 . gni " ) <nl> + <nl> + executable ( " unittests " ) { <nl> + testonly = true <nl> + <nl> + sources = [ <nl> + " base / atomic - utils - unittest . cc " , <nl> + " base / bits - unittest . cc " , <nl> + " base / cpu - unittest . cc " , <nl> + " base / division - by - constant - unittest . cc " , <nl> + " base / flags - unittest . cc " , <nl> + " base / functional - unittest . cc " , <nl> + " base / iterator - unittest . cc " , <nl> + " base / logging - unittest . cc " , <nl> + " base / platform / condition - variable - unittest . cc " , <nl> + " base / platform / mutex - unittest . cc " , <nl> + " base / platform / platform - unittest . cc " , <nl> + " base / platform / semaphore - unittest . cc " , <nl> + " base / platform / time - unittest . cc " , <nl> + " base / sys - info - unittest . cc " , <nl> + " base / utils / random - number - generator - unittest . cc " , <nl> + " cancelable - tasks - unittest . cc " , <nl> + " char - predicates - unittest . cc " , <nl> + " compiler / branch - elimination - unittest . cc " , <nl> + " compiler / coalesced - live - ranges - unittest . cc " , <nl> + " compiler / common - operator - reducer - unittest . cc " , <nl> + " compiler / common - operator - unittest . cc " , <nl> + " compiler / compiler - test - utils . h " , <nl> + " compiler / control - equivalence - unittest . cc " , <nl> + " compiler / control - flow - optimizer - unittest . cc " , <nl> + " compiler / dead - code - elimination - unittest . cc " , <nl> + " compiler / diamond - unittest . cc " , <nl> + " compiler / effect - control - linearizer - unittest . cc " , <nl> + " compiler / escape - analysis - unittest . cc " , <nl> + " compiler / graph - reducer - unittest . cc " , <nl> + " compiler / graph - reducer - unittest . h " , <nl> + " compiler / graph - trimmer - unittest . cc " , <nl> + " compiler / graph - unittest . cc " , <nl> + " compiler / graph - unittest . h " , <nl> + " compiler / instruction - selector - unittest . cc " , <nl> + " compiler / instruction - selector - unittest . h " , <nl> + " compiler / instruction - sequence - unittest . cc " , <nl> + " compiler / instruction - sequence - unittest . h " , <nl> + " compiler / int64 - lowering - unittest . cc " , <nl> + " compiler / js - builtin - reducer - unittest . cc " , <nl> + " compiler / js - create - lowering - unittest . cc " , <nl> + " compiler / js - intrinsic - lowering - unittest . cc " , <nl> + " compiler / js - operator - unittest . cc " , <nl> + " compiler / js - typed - lowering - unittest . cc " , <nl> + " compiler / linkage - tail - call - unittest . cc " , <nl> + " compiler / live - range - unittest . cc " , <nl> + " compiler / liveness - analyzer - unittest . cc " , <nl> + " compiler / load - elimination - unittest . cc " , <nl> + " compiler / loop - peeling - unittest . cc " , <nl> + " compiler / machine - operator - reducer - unittest . cc " , <nl> + " compiler / machine - operator - unittest . cc " , <nl> + " compiler / move - optimizer - unittest . cc " , <nl> + " compiler / node - cache - unittest . cc " , <nl> + " compiler / node - matchers - unittest . cc " , <nl> + " compiler / node - properties - unittest . cc " , <nl> + " compiler / node - test - utils . cc " , <nl> + " compiler / node - test - utils . h " , <nl> + " compiler / node - unittest . cc " , <nl> + " compiler / opcodes - unittest . cc " , <nl> + " compiler / register - allocator - unittest . cc " , <nl> + " compiler / schedule - unittest . cc " , <nl> + " compiler / scheduler - rpo - unittest . cc " , <nl> + " compiler / scheduler - unittest . cc " , <nl> + " compiler / simplified - operator - reducer - unittest . cc " , <nl> + " compiler / simplified - operator - unittest . cc " , <nl> + " compiler / state - values - utils - unittest . cc " , <nl> + " compiler / tail - call - optimization - unittest . cc " , <nl> + " compiler / typer - unittest . cc " , <nl> + " compiler / value - numbering - reducer - unittest . cc " , <nl> + " compiler / zone - pool - unittest . cc " , <nl> + " counters - unittest . cc " , <nl> + " heap / bitmap - unittest . cc " , <nl> + " heap / gc - idle - time - handler - unittest . cc " , <nl> + " heap / gc - tracer - unittest . cc " , <nl> + " heap / heap - unittest . cc " , <nl> + " heap / memory - reducer - unittest . cc " , <nl> + " heap / scavenge - job - unittest . cc " , <nl> + " heap / slot - set - unittest . cc " , <nl> + " interpreter / bytecode - array - builder - unittest . cc " , <nl> + " interpreter / bytecode - array - iterator - unittest . cc " , <nl> + " interpreter / bytecode - array - writer - unittest . cc " , <nl> + " interpreter / bytecode - peephole - optimizer - unittest . cc " , <nl> + " interpreter / bytecode - pipeline - unittest . cc " , <nl> + " interpreter / bytecode - register - allocator - unittest . cc " , <nl> + " interpreter / bytecodes - unittest . cc " , <nl> + " interpreter / constant - array - builder - unittest . cc " , <nl> + " interpreter / interpreter - assembler - unittest . cc " , <nl> + " interpreter / interpreter - assembler - unittest . h " , <nl> + " interpreter / source - position - table - unittest . cc " , <nl> + " libplatform / default - platform - unittest . cc " , <nl> + " libplatform / task - queue - unittest . cc " , <nl> + " libplatform / worker - thread - unittest . cc " , <nl> + " locked - queue - unittest . cc " , <nl> + " run - all - unittests . cc " , <nl> + " test - utils . cc " , <nl> + " test - utils . h " , <nl> + " wasm / ast - decoder - unittest . cc " , <nl> + " wasm / decoder - unittest . cc " , <nl> + " wasm / encoder - unittest . cc " , <nl> + " wasm / leb - helper - unittest . cc " , <nl> + " wasm / loop - assignment - analysis - unittest . cc " , <nl> + " wasm / module - decoder - unittest . cc " , <nl> + " wasm / switch - logic - unittest . cc " , <nl> + " wasm / wasm - macro - gen - unittest . cc " , <nl> + ] <nl> + <nl> + if ( v8_target_arch = = " arm " ) { <nl> + sources + = [ " compiler / arm / instruction - selector - arm - unittest . cc " ] <nl> + } else if ( v8_target_arch = = " arm64 " ) { <nl> + sources + = [ " compiler / arm64 / instruction - selector - arm64 - unittest . cc " ] <nl> + } else if ( v8_target_arch = = " ia32 " ) { <nl> + sources + = [ " compiler / ia32 / instruction - selector - ia32 - unittest . cc " ] <nl> + } else if ( v8_target_arch = = " mips " ) { <nl> + sources + = [ " compiler / mips / instruction - selector - mips - unittest . cc " ] <nl> + } else if ( v8_target_arch = = " mipsel " ) { <nl> + sources + = [ " compiler / mipsel / instruction - selector - mipsel - unittest . cc " ] <nl> + } else if ( v8_target_arch = = " mips64 " ) { <nl> + sources + = [ " compiler / mips64 / instruction - selector - mips64 - unittest . cc " ] <nl> + } else if ( v8_target_arch = = " mips64el " ) { <nl> + sources + = [ " compiler / mips64el / instruction - selector - mips64el - unittest . cc " ] <nl> + } else if ( v8_target_arch = = " x64 " ) { <nl> + sources + = [ " compiler / x64 / instruction - selector - x64 - unittest . cc " ] <nl> + } else if ( v8_target_arch = = " ppc " | | v8_target_arch = = " ppc64 " ) { <nl> + sources + = [ " compiler / ppc / instruction - selector - ppc - unittest . cc " ] <nl> + } else if ( v8_target_arch = = " s390 " | | v8_target_arch = = " s390x " ) { <nl> + sources + = [ " compiler / s390 / instruction - selector - s390 - unittest . cc " ] <nl> + } <nl> + <nl> + configs - = [ " / / build / config / compiler : chromium_code " ] <nl> + configs + = [ " / / build / config / compiler : no_chromium_code " ] <nl> + configs + = [ <nl> + " . . / . . : internal_config_base " , <nl> + " . . / . . : features " , <nl> + " . . / . . : toolchain " , <nl> + ] <nl> + <nl> + # TODO ( machenbach ) : Translate from gyp . <nl> + # [ ' OS = = " aix " ' , { <nl> + # ' ldflags ' : [ ' - Wl , - bbigtoc ' ] , <nl> + # } ] , <nl> + <nl> + deps = [ <nl> + " . . / . . : v8_libplatform " , <nl> + " / / build / config / sanitizers : deps " , <nl> + " / / build / win : default_exe_manifest " , <nl> + " / / testing / gmock " , <nl> + " / / testing / gtest " , <nl> + ] <nl> + <nl> + if ( is_component_build ) { <nl> + # compiler - unittests can ' t be built against a shared library , so we <nl> + # need to depend on the underlying static target in that case . <nl> + deps + = [ " . . / . . : v8_maybe_snapshot " ] <nl> + } else { <nl> + deps + = [ " . . / . . : v8 " ] <nl> + } <nl> + } <nl>
[ gn ] Add unittests
v8/v8
143b3d167d7014525d049d3ab53c73cf2592243c
2016-05-30T11:36:25Z
mmm a / CMake / HPHPSetup . cmake <nl> ppp b / CMake / HPHPSetup . cmake <nl> include_directories ( " $ { TP_DIR } / timelib " ) <nl> include_directories ( " $ { TP_DIR } / libafdt / src " ) <nl> include_directories ( " $ { TP_DIR } / libmbfl " ) <nl> include_directories ( " $ { TP_DIR } / libmbfl / mbfl " ) <nl> - include_directories ( " $ { TP_DIR } / libmbfl / filter " ) <nl> + include_directories ( " $ { TP_DIR } / libmbfl / filters " ) <nl> + include_directories ( " $ { TP_DIR } / proxygen / src " ) <nl> if ( ENABLE_MCROUTER ) <nl> - include_directories ( " $ { TP_DIR } / mcrouter " ) <nl> + include_directories ( " $ { TP_DIR } / mcrouter / src " ) <nl> endif ( ) <nl> <nl> add_definitions ( - DNO_LIB_GFLAGS ) <nl> include_directories ( " $ { TP_DIR } / folly " ) <nl> - include_directories ( " $ { TP_DIR } / thrift " ) <nl> + include_directories ( " $ { TP_DIR } / folly / src " ) <nl> + include_directories ( " $ { TP_DIR } / thrift / src " ) <nl> include_directories ( $ { TP_DIR } ) <nl> <nl> include_directories ( $ { HPHP_HOME } / hphp ) <nl>
Reduce HHVM ' s dependence on the symlinks in third - party
facebook/hhvm
5a244c1a1d075a5c78484da6b4981009c49ac37f
2015-07-29T05:57:06Z
mmm a / lib / SILOptimizer / IPO / LetPropertiesOpts . cpp <nl> ppp b / lib / SILOptimizer / IPO / LetPropertiesOpts . cpp <nl> void LetPropertiesOpt : : optimizeLetPropertyAccess ( VarDecl * Property , <nl> } ; <nl> <nl> / / Look for any instructions accessing let properties . <nl> - if ( isa < RefElementAddrInst > ( Load ) | | isa < StructElementAddrInst > ( Load ) <nl> - | | isa < BeginAccessInst > ( Load ) ) { <nl> + if ( isa < RefElementAddrInst > ( Load ) | | isa < StructElementAddrInst > ( Load ) | | <nl> + isa < BeginAccessInst > ( Load ) | | isa < BeginBorrowInst > ( Load ) ) { <nl> auto proj = cast < SingleValueInstruction > ( Load ) ; <nl> <nl> / / Copy the initializer into the function <nl> void LetPropertiesOpt : : optimizeLetPropertyAccess ( VarDecl * Property , <nl> + + UI ; <nl> <nl> / / A nested begin_access will be mapped as a separate " Load " . <nl> - if ( isa < BeginAccessInst > ( User ) ) <nl> + if ( isa < BeginAccessInst > ( User ) | | isa < BeginBorrowInst > ( User ) ) <nl> continue ; <nl> <nl> if ( ! canReplaceLoadSequence ( User ) ) <nl> bool LetPropertiesOpt : : isConstantLetProperty ( VarDecl * Property ) { <nl> LLVM_DEBUG ( llvm : : dbgs ( ) < < " Property ' " < < * Property <nl> < < " ' has no unknown uses \ n " ) ; <nl> <nl> - / / Only properties of simple types can be optimized . <nl> - <nl> - / / FIXME : Expansion <nl> - auto & TL = Module - > Types . getTypeLowering ( Property - > getType ( ) , <nl> - TypeExpansionContext : : minimal ( ) ) ; <nl> - if ( ! TL . isTrivial ( ) ) { <nl> - LLVM_DEBUG ( llvm : : dbgs ( ) < < " Property ' " < < * Property <nl> - < < " ' is not of trivial type \ n " ) ; <nl> - SkipProcessing . insert ( Property ) ; <nl> - return false ; <nl> - } <nl> - <nl> PotentialConstantLetProperty . insert ( Property ) ; <nl> <nl> return true ; <nl> LetPropertiesOpt : : analyzeInitValue ( SILInstruction * I , VarDecl * Property ) { <nl> & & " Store instruction should store into a proper let property " ) ; <nl> ( void ) Dest ; <nl> value = SI - > getSrc ( ) ; <nl> + } else if ( auto * copyAddr = dyn_cast < CopyAddrInst > ( I ) ) { <nl> + value = copyAddr - > getSrc ( ) ; <nl> } <nl> <nl> / / Check if it ' s just a copy from another instance of the struct . <nl> void LetPropertiesOpt : : collectPropertyAccess ( SILInstruction * I , <nl> < < * Property < < " ' : \ n " ; <nl> llvm : : dbgs ( ) < < " The instructions are : \ n " ; I - > dumpInContext ( ) ) ; <nl> <nl> - if ( isa < RefElementAddrInst > ( I ) | | isa < StructElementAddrInst > ( I ) <nl> - | | isa < BeginAccessInst > ( I ) ) { <nl> + if ( isa < RefElementAddrInst > ( I ) | | isa < StructElementAddrInst > ( I ) | | <nl> + isa < BeginAccessInst > ( I ) | | isa < CopyAddrInst > ( I ) | | <nl> + isa < BeginBorrowInst > ( I ) ) { <nl> / / Check if there is a store to this property . <nl> auto projection = cast < SingleValueInstruction > ( I ) ; <nl> for ( auto Use : getNonDebugUses ( projection ) ) { <nl> void LetPropertiesOpt : : collectPropertyAccess ( SILInstruction * I , <nl> <nl> / / Each begin_access is analyzed as a separate property access . Do not <nl> / / consider a begin_access a use of the current projection . <nl> - if ( isa < BeginAccessInst > ( User ) ) <nl> + if ( isa < BeginAccessInst > ( User ) | | isa < BeginBorrowInst > ( I ) ) <nl> + continue ; <nl> + <nl> + if ( auto * copyAddr = dyn_cast < CopyAddrInst > ( User ) ) { <nl> + if ( copyAddr - > getSrc ( ) ! = projection | | <nl> + ! analyzeInitValue ( copyAddr , Property ) ) { <nl> + SkipProcessing . insert ( Property ) ; <nl> + return ; <nl> + } <nl> continue ; <nl> + } <nl> <nl> if ( auto * SI = dyn_cast < StoreInst > ( User ) ) { <nl> / / There is a store into this property . <nl> void LetPropertiesOpt : : run ( SILModuleTransform * T ) { <nl> / / properties . <nl> bool NonRemovable = ! F . shouldOptimize ( ) ; <nl> <nl> - / / FIXME : We should be able to handle ownership . <nl> - NonRemovable & = ! F . hasOwnership ( ) ; <nl> - <nl> for ( auto & BB : F ) { <nl> for ( auto & I : BB ) <nl> / / Look for any instructions accessing let properties . <nl> mmm a / test / SILOptimizer / let_properties_opts . sil <nl> ppp b / test / SILOptimizer / let_properties_opts . sil <nl> struct Point { <nl> var x : Int64 <nl> var y : Int64 <nl> } <nl> - class HasCenter { <nl> <nl> + class HasCenter { <nl> let centerPoint : Point = Point ( x : 0 , y : 0 ) <nl> - <nl> public func getCenter ( ) - > Int64 <nl> } <nl> <nl> - sil hidden @ $ s19let_properties_opts5PointV1x1yACSi_SitcfC : $ @ convention ( method ) ( Int64 , Int64 , @ thin Point . Type ) - > Point { <nl> + sil hidden [ ossa ] @ $ s19let_properties_opts5PointV1x1yACSi_SitcfC : $ @ convention ( method ) ( Int64 , Int64 , @ thin Point . Type ) - > Point { <nl> bb0 ( % 0 : $ Int64 , % 1 : $ Int64 , % 2 : $ @ thin Point . Type ) : <nl> % 3 = struct $ Point ( % 0 : $ Int64 , % 1 : $ Int64 ) <nl> return % 3 : $ Point <nl> } <nl> <nl> / / variable initialization expression of HasCenter . centerPoint <nl> - sil hidden [ transparent ] @ $ s19let_properties_opts9HasCenterC11centerPointAA0E0Vvpfi : $ @ convention ( thin ) ( ) - > Point { <nl> + sil hidden [ transparent ] [ ossa ] @ $ s19let_properties_opts9HasCenterC11centerPointAA0E0Vvpfi : $ @ convention ( thin ) ( ) - > Point { <nl> bb0 : <nl> % 0 = integer_literal $ Builtin . Int64 , 0 <nl> % 1 = struct $ Int64 ( % 0 : $ Builtin . Int64 ) <nl> bb0 : <nl> } <nl> <nl> / / HasCenter . centerPoint . getter <nl> - / / CHECK - LABEL : sil hidden [ transparent ] @ $ s19let_properties_opts9HasCenterC11centerPointAA0E0Vvg : $ @ convention ( method ) ( @ guaranteed HasCenter ) - > Point { <nl> - / / CHECK : bb0 ( % 0 : $ HasCenter ) : <nl> + / / CHECK - LABEL : sil hidden [ transparent ] [ ossa ] @ $ s19let_properties_opts9HasCenterC11centerPointAA0E0Vvg : $ @ convention ( method ) ( @ guaranteed HasCenter ) - > Point { <nl> + / / CHECK : bb0 ( % 0 : @ guaranteed $ HasCenter ) : <nl> / / CHECK : [ [ LIT : % . * ] ] = integer_literal $ Builtin . Int64 , 0 <nl> / / CHECK : [ [ INT : % . * ] ] = struct $ Int64 ( [ [ LIT ] ] : $ Builtin . Int64 ) <nl> / / CHECK : [ [ PNT : % . * ] ] = struct $ Point ( [ [ INT ] ] : $ Int64 , [ [ INT ] ] : $ Int64 ) <nl> / / CHECK : return [ [ PNT ] ] : $ Point <nl> / / CHECK - LABEL : } / / end sil function ' $ s19let_properties_opts9HasCenterC11centerPointAA0E0Vvg ' <nl> - sil hidden [ transparent ] @ $ s19let_properties_opts9HasCenterC11centerPointAA0E0Vvg : $ @ convention ( method ) ( @ guaranteed HasCenter ) - > Point { <nl> - bb0 ( % 0 : $ HasCenter ) : <nl> + sil hidden [ transparent ] [ ossa ] @ $ s19let_properties_opts9HasCenterC11centerPointAA0E0Vvg : $ @ convention ( method ) ( @ guaranteed HasCenter ) - > Point { <nl> + bb0 ( % 0 : @ guaranteed $ HasCenter ) : <nl> % 1 = ref_element_addr % 0 : $ HasCenter , # HasCenter . centerPoint <nl> - % 2 = load % 1 : $ * Point <nl> + % 2 = load [ trivial ] % 1 : $ * Point <nl> return % 2 : $ Point <nl> } <nl> <nl> / / HasCenter . getCenter ( ) <nl> - / / CHECK - LABEL : sil hidden @ $ s19let_properties_opts9HasCenterC9getCenterSiyF : $ @ convention ( method ) ( @ guaranteed HasCenter ) - > Int64 { <nl> + / / CHECK - LABEL : sil hidden [ ossa ] @ $ s19let_properties_opts9HasCenterC9getCenterSiyF : $ @ convention ( method ) ( @ guaranteed HasCenter ) - > Int64 { <nl> / / CHECK : [ [ LIT : % . * ] ] = integer_literal $ Builtin . Int64 , 0 <nl> / / CHECK : [ [ INT : % . * ] ] = struct $ Int64 ( [ [ LIT ] ] : $ Builtin . Int64 ) <nl> / / CHECK : [ [ PNT : % . * ] ] = struct $ Point ( [ [ INT ] ] : $ Int64 , [ [ INT ] ] : $ Int64 ) <nl> / / CHECK : [ [ X : % . * ] ] = struct_extract [ [ PNT ] ] : $ Point , # Point . x <nl> / / CHECK : return [ [ X ] ] : $ Int64 <nl> / / CHECK - LABEL : } / / end sil function ' $ s19let_properties_opts9HasCenterC9getCenterSiyF ' <nl> - sil hidden @ $ s19let_properties_opts9HasCenterC9getCenterSiyF : $ @ convention ( method ) ( @ guaranteed HasCenter ) - > Int64 { <nl> - bb0 ( % 0 : $ HasCenter ) : <nl> + sil hidden [ ossa ] @ $ s19let_properties_opts9HasCenterC9getCenterSiyF : $ @ convention ( method ) ( @ guaranteed HasCenter ) - > Int64 { <nl> + bb0 ( % 0 : @ guaranteed $ HasCenter ) : <nl> % 1 = ref_element_addr % 0 : $ HasCenter , # HasCenter . centerPoint <nl> % 2 = struct_element_addr % 1 : $ * Point , # Point . x <nl> - % 3 = load % 2 : $ * Int64 <nl> + % 3 = load [ trivial ] % 2 : $ * Int64 <nl> return % 3 : $ Int64 <nl> } <nl> <nl> / / HasCenter . init ( ) <nl> - sil hidden @ $ s19let_properties_opts9HasCenterCACycfc : $ @ convention ( method ) ( @ owned HasCenter ) - > @ owned HasCenter { <nl> - bb0 ( % 0 : $ HasCenter ) : <nl> + sil hidden [ ossa ] @ $ s19let_properties_opts9HasCenterCACycfc : $ @ convention ( method ) ( @ owned HasCenter ) - > @ owned HasCenter { <nl> + bb0 ( % 0 : @ owned $ HasCenter ) : <nl> % 1 = integer_literal $ Builtin . Int64 , 0 <nl> - % 2 = struct $ Int64 ( % 1 : $ Builtin . Int64 ) <nl> - % 3 = struct $ Point ( % 2 : $ Int64 , % 2 : $ Int64 ) <nl> - % 4 = ref_element_addr % 0 : $ HasCenter , # HasCenter . centerPoint <nl> - store % 3 to % 4 : $ * Point <nl> - return % 0 : $ HasCenter <nl> + % 3 = struct $ Int64 ( % 1 : $ Builtin . Int64 ) <nl> + % 4 = struct $ Point ( % 3 : $ Int64 , % 3 : $ Int64 ) <nl> + % 5 = begin_borrow % 0 : $ HasCenter <nl> + % 6 = ref_element_addr % 5 : $ HasCenter , # HasCenter . centerPoint <nl> + store % 4 to [ trivial ] % 6 : $ * Point <nl> + end_borrow % 5 : $ HasCenter <nl> + % 9 = copy_value % 0 : $ HasCenter <nl> + destroy_value % 0 : $ HasCenter <nl> + return % 9 : $ HasCenter <nl> } <nl> new file mode 100644 <nl> index 000000000000 . . 7e8fc3e90b39 <nl> mmm / dev / null <nl> ppp b / test / SILOptimizer / let_properties_opts_non_trivial . sil <nl> <nl> + / / RUN : % target - sil - opt - let - properties - opt - enable - sil - verify - all % s | % FileCheck % s <nl> + <nl> + sil_stage canonical <nl> + <nl> + import Builtin <nl> + import Swift <nl> + <nl> + class Point { <nl> + let x : Int64 = 0 <nl> + let y : Int64 = 0 <nl> + } <nl> + <nl> + class HasCenter { <nl> + let centerPoint : Point = Point ( ) <nl> + public func getCenter ( ) - > Int64 <nl> + } <nl> + <nl> + / / Point . init ( ) <nl> + sil hidden [ ossa ] @ $ s19let_properties_opts5PointCACycfc : $ @ convention ( method ) ( @ owned Point ) - > @ owned Point { <nl> + bb0 ( % 0 : @ owned $ Point ) : <nl> + % 1 = integer_literal $ Builtin . Int64 , 0 <nl> + % 2 = struct $ Int64 ( % 1 : $ Builtin . Int64 ) <nl> + <nl> + % 3 = begin_borrow % 0 : $ Point <nl> + % 6 = ref_element_addr % 3 : $ Point , # Point . x <nl> + store % 2 to [ trivial ] % 6 : $ * Int64 <nl> + end_borrow % 3 : $ Point <nl> + <nl> + % 9 = begin_borrow % 0 : $ Point <nl> + % 12 = ref_element_addr % 9 : $ Point , # Point . y <nl> + store % 2 to [ trivial ] % 12 : $ * Int64 <nl> + end_borrow % 9 : $ Point <nl> + <nl> + % 15 = copy_value % 0 : $ Point <nl> + destroy_value % 0 : $ Point <nl> + return % 15 : $ Point <nl> + } <nl> + <nl> + / / HasCenter . init ( ) <nl> + sil hidden [ ossa ] @ $ s19let_properties_opts9HasCenterCACycfc : $ @ convention ( method ) ( @ owned HasCenter ) - > @ owned HasCenter { <nl> + / / % 0 / / users : % 2 , % 1 <nl> + bb0 ( % 0 : @ owned $ HasCenter ) : <nl> + % 1 = alloc_ref $ Point <nl> + / / function_ref Point . init ( ) <nl> + % 2 = function_ref @ $ s19let_properties_opts5PointCACycfc : $ @ convention ( method ) ( @ owned Point ) - > @ owned Point <nl> + % 3 = apply % 2 ( % 1 ) : $ @ convention ( method ) ( @ owned Point ) - > @ owned Point <nl> + <nl> + % 5 = begin_borrow % 0 : $ HasCenter / / users : % 8 , % 6 <nl> + % 6 = ref_element_addr % 5 : $ HasCenter , # HasCenter . centerPoint / / user : % 7 <nl> + <nl> + store % 3 to [ init ] % 6 : $ * Point / / id : % 7 <nl> + end_borrow % 5 : $ HasCenter / / id : % 8 <nl> + <nl> + % 9 = copy_value % 0 : $ HasCenter / / user : % 11 <nl> + destroy_value % 0 : $ HasCenter / / id : % 10 <nl> + return % 9 : $ HasCenter / / id : % 11 <nl> + } / / end sil function ' $ s19let_properties_opts9HasCenterCACycfc ' <nl> + <nl> + / / HasCenter . centerPoint . getter <nl> + sil hidden [ transparent ] [ ossa ] @ $ s19let_properties_opts9HasCenterC11centerPointAA0G0Cvg : $ @ convention ( method ) ( @ guaranteed HasCenter ) - > @ owned Point { <nl> + / / % 0 / / users : % 2 , % 1 <nl> + bb0 ( % 0 : @ guaranteed $ HasCenter ) : <nl> + debug_value % 0 : $ HasCenter , let , name " self " , argno 1 / / id : % 1 <nl> + % 2 = ref_element_addr % 0 : $ HasCenter , # HasCenter . centerPoint / / user : % 3 <nl> + % 3 = load [ copy ] % 2 : $ * Point / / user : % 4 <nl> + return % 3 : $ Point / / id : % 4 <nl> + } / / end sil function ' $ s19let_properties_opts9HasCenterC11centerPointAA0G0Cvg ' <nl> + <nl> + / / HasCenter . getCenter ( ) <nl> + / / CHECK - LABEL : sil hidden [ ossa ] @ $ s19let_properties_opts9HasCenterC03getE0s5Int64VyF : $ @ convention ( method ) ( @ guaranteed HasCenter ) - > Int64 { <nl> + / / CHECK : [ [ LIT : % . * ] ] = integer_literal $ Builtin . Int64 , 0 <nl> + / / CHECK : [ [ INT : % . * ] ] = struct $ Int64 ( [ [ LIT ] ] : $ Builtin . Int64 ) <nl> + / / CHECK : return [ [ INT ] ] : $ Int64 <nl> + / / CHECK - LABEL : } / / end sil function ' $ s19let_properties_opts9HasCenterC03getE0s5Int64VyF ' <nl> + sil hidden [ ossa ] @ $ s19let_properties_opts9HasCenterC03getE0s5Int64VyF : $ @ convention ( method ) ( @ guaranteed HasCenter ) - > Int64 { <nl> + / / % 0 / / users : % 2 , % 1 <nl> + bb0 ( % 0 : @ guaranteed $ HasCenter ) : <nl> + debug_value % 0 : $ HasCenter , let , name " self " , argno 1 / / id : % 1 <nl> + % 2 = ref_element_addr % 0 : $ HasCenter , # HasCenter . centerPoint / / user : % 3 <nl> + % 3 = load [ copy ] % 2 : $ * Point / / users : % 8 , % 4 <nl> + % 4 = begin_borrow % 3 : $ Point / / users : % 7 , % 5 <nl> + % 5 = ref_element_addr % 4 : $ Point , # Point . x / / user : % 6 <nl> + % 6 = load [ trivial ] % 5 : $ * Int64 / / user : % 9 <nl> + end_borrow % 4 : $ Point / / id : % 7 <nl> + destroy_value % 3 : $ Point / / id : % 8 <nl> + return % 6 : $ Int64 / / id : % 9 <nl> + } / / end sil function ' $ s19let_properties_opts9HasCenterC03getE0s5Int64VyF ' <nl>
Merge remote - tracking branch ' origin / master ' into master - next
apple/swift
6fa9940fc4043a4b5b2d5cb6be89ec71da4cf8b2
2020-02-28T02:40:07Z
mmm a / tests / performance / push_down_limit . xml <nl> ppp b / tests / performance / push_down_limit . xml <nl> <nl> - < test > <nl> + < test max_ignored_relative_change = " 0 . 3 " > <nl> < query > select number from ( select number from numbers ( 150000000 ) order by - number ) limit 10 < / query > <nl> < query > select number from ( select number from numbers_mt ( 1500000000 ) order by - number ) limit 10 < / query > <nl> < / test > <nl>
Merge
ClickHouse/ClickHouse
8504efde772ffb7b08f56b6c52f77c2b257778ee
2020-11-10T15:12:49Z
mmm a / fdbmonitor / fdbmonitor . cpp <nl> ppp b / fdbmonitor / fdbmonitor . cpp <nl> <nl> # include < sys / time . h > <nl> # include < stdlib . h > <nl> <nl> + # include < cinttypes > <nl> # include < unordered_map > <nl> # include < unordered_set > <nl> # include < vector > <nl> struct Command { <nl> Command ( ) : argv ( NULL ) { } <nl> Command ( const CSimpleIni & ini , std : : string _section , uint64_t id , fdb_fd_set fds , int * maxfd ) : section ( _section ) , argv ( NULL ) , fork_retry_time ( - 1 ) , quiet ( false ) , delete_envvars ( NULL ) , fds ( fds ) , deconfigured ( false ) , kill_on_configuration_change ( true ) { <nl> char _ssection [ strlen ( section . c_str ( ) ) + 22 ] ; <nl> - snprintf ( _ssection , strlen ( section . c_str ( ) ) + 22 , " % s . % llu " , section . c_str ( ) , id ) ; <nl> + snprintf ( _ssection , strlen ( section . c_str ( ) ) + 22 , " % s . % " PRIu64 , section . c_str ( ) , id ) ; <nl> ssection = _ssection ; <nl> <nl> for ( auto p : pipes ) { <nl>
fdbmonitor : fix some print / scan format warnings
apple/foundationdb
0b263fd856f0bbe516d0581a437f99297d04aaf5
2019-05-06T20:35:29Z
mmm a / dbms / include / DB / Columns / ColumnFixedString . h <nl> ppp b / dbms / include / DB / Columns / ColumnFixedString . h <nl> class ColumnFixedString : public IColumn <nl> bool operator ( ) ( size_t lhs , size_t rhs ) const <nl> { <nl> / / / TODO : memcmp тормозит . <nl> - return positive = = ( 0 > memcmp ( & parent . chars [ lhs * parent . n ] , & parent . chars [ rhs * parent . n ] , parent . n ) ) ; <nl> + int res = memcmp ( & parent . chars [ lhs * parent . n ] , & parent . chars [ rhs * parent . n ] , parent . n ) ; <nl> + return positive ? ( res < 0 ) : ( res > 0 ) ; <nl> } <nl> } ; <nl> <nl> mmm a / dbms / include / DB / Columns / ColumnString . h <nl> ppp b / dbms / include / DB / Columns / ColumnString . h <nl> class ColumnString : public IColumn <nl> less ( const ColumnString & parent_ ) : parent ( parent_ ) { } <nl> bool operator ( ) ( size_t lhs , size_t rhs ) const <nl> { <nl> - return positive = = ( 0 > strcmp ( <nl> + int res = strcmp ( <nl> reinterpret_cast < const char * > ( & parent . chars [ parent . offsetAt ( lhs ) ] ) , <nl> - reinterpret_cast < const char * > ( & parent . chars [ parent . offsetAt ( rhs ) ] ) ) ) ; <nl> + reinterpret_cast < const char * > ( & parent . chars [ parent . offsetAt ( rhs ) ] ) ) ; <nl> + <nl> + return positive ? ( res < 0 ) : ( res > 0 ) ; <nl> } <nl> } ; <nl> <nl> class ColumnString : public IColumn <nl> <nl> bool operator ( ) ( size_t lhs , size_t rhs ) const <nl> { <nl> - return positive = = ( 0 > collator . compare ( <nl> + int res = collator . compare ( <nl> reinterpret_cast < const char * > ( & parent . chars [ parent . offsetAt ( lhs ) ] ) , parent . sizeAt ( lhs ) , <nl> - reinterpret_cast < const char * > ( & parent . chars [ parent . offsetAt ( rhs ) ] ) , parent . sizeAt ( rhs ) ) ) ; <nl> + reinterpret_cast < const char * > ( & parent . chars [ parent . offsetAt ( rhs ) ] ) , parent . sizeAt ( rhs ) ) ; <nl> + <nl> + return positive ? ( res < 0 ) : ( res > 0 ) ; <nl> } <nl> } ; <nl> <nl>
dbms : fixed segfault when ORDER BY one string or fixed string DESC [ # METR - 11277 ] .
ClickHouse/ClickHouse
0d2ac52f266409e46e519cd72450a80a3b15e691
2014-05-23T02:18:01Z
mmm a / hphp / hack / src / client / clientLsp . ml <nl> ppp b / hphp / hack / src / client / clientLsp . ml <nl> type env = { <nl> use_ffp_autocomplete : bool ; ( * Flag to turn on the ( experimental ) FFP based autocomplete * ) <nl> } <nl> <nl> + ( * This LSP server uses progress to indicate its lazy initialization : the * ) <nl> + ( * lifetime of each progress indicator starts with do_initialize and ends * ) <nl> + ( * when the hello message is received from hh_server . That will happen upon * ) <nl> + ( * first initialization , and also in case the persistent connection is lost * ) <nl> + ( * it will happen when it ' s subsequently regained . In any case , the lifetimes * ) <nl> + ( * of our progress notifications are non - overlapping , so we can use a single * ) <nl> + ( * constant id for all of them . * ) <nl> + let progress_id_initialize = 1 <nl> + <nl> + <nl> ( * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * ) <nl> ( * * Conversions - ad - hoc ones written as needed them , not systematic * * ) <nl> ( * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * ) <nl> module In_init_env = struct <nl> type t = { <nl> conn : server_conn ; <nl> start_time : float ; <nl> - last_progress_report_time : float ; <nl> busy_dialog_cancel : ( unit - > unit ) option ; ( * " hack server is busy " dialog * ) <nl> file_edits : ClientMessageQueue . client_message ImmQueue . t ; <nl> tail_env : Tail . env ; <nl> let get_root ( ) : Path . t option = <nl> Some ( ClientArgsUtils . get_root path ) <nl> <nl> <nl> + let supports_progress ( ) : bool = <nl> + let open Lsp . Initialize in <nl> + Option . value_map ! initialize_params <nl> + ~ default : false ~ f : ( fun params - > params . client_capabilities . window . progress ) <nl> + <nl> + <nl> + let supports_actionRequired ( ) : bool = <nl> + let open Lsp . Initialize in <nl> + Option . value_map ! initialize_params <nl> + ~ default : false ~ f : ( fun params - > params . client_capabilities . window . actionRequired ) <nl> + <nl> + <nl> let rpc <nl> ( server_conn : server_conn ) <nl> ( command : ' a ServerCommandTypes . t ) <nl> let do_diagnostics_flush <nl> <nl> let report_progress <nl> ( ienv : In_init_env . t ) <nl> - : In_init_env . t = <nl> + : unit = <nl> ( * Our goal behind progress reporting is to let the user know when things * ) <nl> ( * won ' t be instantaneous , and to show that things are working as expected . * ) <nl> - ( * We eagerly show a " please wait " dialog box after a few seconds into * ) <nl> - ( * progress reporting . And we ' ll log to the console every 10 seconds . When * ) <nl> - ( * it completes , if any progress has so far been shown to the user , then * ) <nl> - ( * we ' ll log completion to the console . Except if it took a long time , like * ) <nl> - ( * 60 seconds or more , we ' ll show completion with a dialog box instead . * ) <nl> - ( * * ) <nl> + ( * We already eagerly showed a " please wait " dialog box as soon as we gave * ) <nl> + ( * do_initialize learned that it hadn ' t gotten a " hello " back immediately * ) <nl> + ( * from the server . This report_progress is called once a second and will * ) <nl> + ( * update the busy - tooltip . And once we do get the " hello " , either close * ) <nl> + ( * the busy indicator ( if the client supports one ) , or log to the console * ) <nl> + ( * ( if the client doesn ' t ) , or show a completion dialog box ( if we ' d taken * ) <nl> + ( * 30 seconds or more ) . * ) <nl> let open In_init_env in <nl> - let time = Unix . time ( ) in <nl> - let ienv = ref ienv in <nl> - <nl> - let delay_in_secs = int_of_float ( time - . ! ienv . start_time ) in <nl> - if ( delay_in_secs mod 10 = 0 & & time - . ! ienv . last_progress_report_time > = 5 . 0 ) then begin <nl> - ienv : = { ! ienv with last_progress_report_time = time } ; <nl> - let _load_state_not_found , tail_msg = <nl> - ClientConnect . open_and_get_tail_msg ! ienv . start_time ! ienv . tail_env in <nl> - let msg = Printf . sprintf " Still waiting after % i seconds : % s . . . " delay_in_secs tail_msg in <nl> - print_logMessage MessageType . LogMessage msg | > notify stdout " window / logMessage " <nl> - end ; <nl> - ! ienv <nl> + if supports_progress ( ) then begin <nl> + let time = Unix . time ( ) in <nl> + let delay_in_secs = int_of_float ( time - . ienv . start_time ) in <nl> + ( * TODO : better to report time that hh_server has spent initializing * ) <nl> + let load_state_not_found , tail_msg = <nl> + ClientConnect . open_and_get_tail_msg ienv . start_time ienv . tail_env in <nl> + let msg = if load_state_not_found then <nl> + Printf . sprintf <nl> + " hh_server initializing ( load - state not found - will take a while ) : % s [ % i seconds ] " <nl> + tail_msg delay_in_secs <nl> + else <nl> + Printf . sprintf <nl> + " hh_server initializing : % s [ % i seconds ] " <nl> + tail_msg delay_in_secs <nl> + in <nl> + print_progress progress_id_initialize ( Some msg ) | > notify stdout " window / progress " <nl> + end <nl> <nl> <nl> let report_progress_end <nl> let report_progress_end <nl> in <nl> ( * dismiss the " busy . . . " dialog if present * ) <nl> Option . call ~ f : ienv . busy_dialog_cancel ( ) ; <nl> + ( * dismiss the " hh_server initializing " spinner if present * ) <nl> + if supports_progress ( ) then <nl> + print_progress progress_id_initialize None | > notify stdout " window / progress " ; <nl> ( * and alert the user that hack is ready , either by console log or by dialog * ) <nl> let time = Unix . time ( ) in <nl> let seconds = int_of_float ( time - . ienv . start_time ) in <nl> - let msg = Printf . sprintf " Hack is now ready , after % i seconds . " seconds in <nl> - if ( time - . ienv . start_time < 60 . 0 ) then begin <nl> - print_logMessage MessageType . InfoMessage msg | > notify stdout " window / logMessage " ; <nl> - Main_loop menv <nl> - end else begin <nl> + let msg = Printf . sprintf " hh_server is now ready , after % i seconds . " seconds in <nl> + if ( time - . ienv . start_time > 30 . 0 ) then begin <nl> let clear_cancel_flag state = match state with <nl> | Main_loop menv - > Main_loop { menv with ready_dialog_cancel = None } <nl> | _ - > state <nl> let report_progress_end <nl> let req = print_showMessageRequest MessageType . InfoMessage msg [ ] in <nl> let cancel = request stdout handle_result handle_error " window / showMessageRequest " req in <nl> Main_loop { menv with ready_dialog_cancel = Some cancel ; } <nl> - end <nl> + end else if ( not ( supports_progress ( ) ) ) then begin <nl> + print_logMessage MessageType . InfoMessage msg | > notify stdout " window / logMessage " ; <nl> + Main_loop menv <nl> + end else <nl> + Main_loop menv <nl> <nl> <nl> let do_initialize_after_hello <nl> let do_initialize ( ) <nl> let handle_result ~ state ~ result : _ = clear_cancel_flag state in <nl> let handle_error ~ state ~ code : _ ~ message : _ ~ data : _ = clear_cancel_flag state in <nl> let req = print_showMessageRequest MessageType . InfoMessage <nl> - " Waiting for Hack server to be ready . See console for further details . " [ ] in <nl> + " Waiting for Hack server to be ready . . . " [ ] in <nl> let cancel = request stdout handle_result handle_error " window / showMessageRequest " req in <nl> + if supports_progress ( ) then begin <nl> + let progress = " hh_server initializing " in <nl> + print_progress progress_id_initialize ( Some progress ) | > notify stdout " window / progress " <nl> + end ; <nl> let ienv = <nl> { In_init_env . <nl> conn = server_conn ; <nl> start_time ; <nl> - last_progress_report_time = start_time ; <nl> busy_dialog_cancel = Some cancel ; <nl> file_edits = ImmQueue . empty ; <nl> tail_env = Tail . create_env log_file ; <nl> let handle_event <nl> <nl> ( * idle tick while waiting for server to complete initialization * ) <nl> | In_init ienv , Tick - > <nl> - state : = In_init ( report_progress ienv ) ; <nl> + report_progress ienv ; <nl> None <nl> <nl> ( * server completes initialization * ) <nl> mmm a / hphp / hack / src / ide_rpc / lsp . ml <nl> ppp b / hphp / hack / src / ide_rpc / lsp . ml <nl> module Initialize = struct <nl> and client_capabilities = { <nl> workspace : workspaceClientCapabilities ; <nl> textDocument : textDocumentClientCapabilities ; <nl> + window : windowClientCapabilities ; <nl> ( * omitted : experimental * ) <nl> } <nl> <nl> and workspaceClientCapabilities = { <nl> - applyEdit : bool ; ( * the client supports appling batch edits * ) <nl> + applyEdit : bool ; ( * client supports appling batch edits * ) <nl> workspaceEdit : workspaceEdit ; <nl> ( * omitted : dynamic - registration fields * ) <nl> } <nl> module Initialize = struct <nl> snippetSupport : bool ; ( * client can do snippets as insert text * ) <nl> } <nl> <nl> + and windowClientCapabilities = { <nl> + progress : bool ; ( * Nuclide - specific : client supports window / progress * ) <nl> + actionRequired : bool ; ( * Nuclide - specific : client supports window / actionRequired * ) <nl> + } <nl> + <nl> ( * What capabilities the server provides * ) <nl> and server_capabilities = { <nl> textDocumentSync : textDocumentSyncOptions ; ( * how to sync * ) <nl> module ShowMessageRequest = struct <nl> end <nl> <nl> <nl> + ( * Progress notification , method = " window / progress " * ) <nl> + module Progress = struct <nl> + type params = progressParams <nl> + <nl> + and progressParams = { <nl> + ( * LSP progress notifications have a lifetime that starts with their 1st * ) <nl> + ( * window / progress update message and ends with an update message with * ) <nl> + ( * label = None . They use an ID number ( not JsonRPC id ) to associate * ) <nl> + ( * multiple messages to a single lifetime stream . * ) <nl> + id : int ; <nl> + label : string option ; <nl> + } <nl> + end <nl> + <nl> + <nl> + ( * ActionRequired notification , method = " window / actionRequired " * ) <nl> + module ActionRequired = struct <nl> + type params = actionRequiredParams <nl> + <nl> + and actionRequiredParams = { <nl> + ( * See progressParams . id for an explanation of this field . * ) <nl> + id : int ; <nl> + label : string option ; <nl> + } <nl> + end <nl> + <nl> + <nl> ( * ErrorResponse * ) <nl> module Error = struct <nl> ( * Defined by JSON - RPC . * ) <nl> mmm a / hphp / hack / src / ide_rpc / lsp_fmt . ml <nl> ppp b / hphp / hack / src / ide_rpc / lsp_fmt . ml <nl> let print_showMessageRequest <nl> ] <nl> <nl> <nl> + ( * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * ) <nl> + ( * * window / progress notification * * ) <nl> + ( * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * ) <nl> + <nl> + let print_progress ( id : int ) ( label : string option ) : json = <nl> + let open Progress in <nl> + let r = { Progress . id ; label ; } in <nl> + JSON_Object [ <nl> + " id " , r . id | > int_ ; <nl> + " label " , match r . label with None - > JSON_Null | Some s - > JSON_String s ; <nl> + ] <nl> + <nl> + <nl> + ( * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * ) <nl> + ( * * window / actionRequired notification * * ) <nl> + ( * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * ) <nl> + <nl> + let print_actionRequired ( id : int ) ( label : string option ) : json = <nl> + let open ActionRequired in <nl> + let r = { ActionRequired . id ; label ; } in <nl> + JSON_Object [ <nl> + " id " , r . id | > int_ ; <nl> + " label " , match r . label with None - > JSON_Null | Some s - > JSON_String s ; <nl> + ] <nl> + <nl> <nl> ( * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * ) <nl> ( * * textDocument / hover request * * ) <nl> let parse_initialize ( params : json option ) : Initialize . params = <nl> { <nl> workspace = Jget . obj_opt json " workspace " | > parse_workspace ; <nl> textDocument = Jget . obj_opt json " textDocument " | > parse_textDocument ; <nl> + window = Jget . obj_opt json " window " | > parse_window ; <nl> } <nl> and parse_workspace json = <nl> { <nl> let parse_initialize ( params : json option ) : Initialize . params = <nl> and parse_completionItem json = <nl> { snippetSupport = Jget . bool_d json " snippetSupport " ~ default : false ; <nl> } <nl> + and parse_window json = <nl> + { <nl> + progress = Jget . obj_opt json " progress " | > Option . is_some ; <nl> + actionRequired = Jget . obj_opt json " actionRequired " | > Option . is_some ; <nl> + } <nl> in <nl> parse_initialize params <nl> <nl>
emit ' busy : initializing ' over LSP
facebook/hhvm
f7540c8144b06fa25c477faad935f67227d783d5
2017-08-07T17:08:15Z
mmm a / test / functional / rpc_txoutproof . py <nl> ppp b / test / functional / rpc_txoutproof . py <nl> def run_test ( self ) : <nl> assert_equal ( self . nodes [ 0 ] . verifytxoutproof ( self . nodes [ 1 ] . gettxoutproof ( [ txid_spent ] ) ) , [ txid_spent ] ) <nl> # We can ' t get a proof if we specify transactions from different blocks <nl> assert_raises_rpc_error ( - 5 , " Not all transactions found in specified or retrieved block " , self . nodes [ 0 ] . gettxoutproof , [ txid1 , txid3 ] ) <nl> + # Test empty list <nl> + assert_raises_rpc_error ( - 5 , " Transaction not yet in block " , self . nodes [ 0 ] . gettxoutproof , [ ] ) <nl> <nl> # Now we ' ll try tweaking a proof . <nl> proof = self . nodes [ 1 ] . gettxoutproof ( [ txid1 , txid2 ] ) <nl>
test : Test empty array in gettxoutproof
bitcoin/bitcoin
faf5eb45c4a08fbfd9a8c12534bca8adfe756ef2
2020-09-09T09:27:33Z
mmm a / tensorflow / contrib / eager / python / examples / notebooks / 4_high_level . ipynb <nl> ppp b / tensorflow / contrib / eager / python / examples / notebooks / 4_high_level . ipynb <nl> <nl> " # simply construct the object . Most layers take as a first argument the number \ n " , <nl> " # of output dimensions / channels . \ n " , <nl> " layer = tf . keras . layers . Dense ( 100 ) \ n " , <nl> - " # The number of input dimensionss is often unnecessary , as it can be inferred \ n " , <nl> + " # The number of input dimensions is often unnecessary , as it can be inferred \ n " , <nl> " # the first time the layer is used , but it can be provided if you want to \ n " , <nl> " # specify it manually , which is useful in some complex models . \ n " , <nl> " layer = tf . keras . layers . Dense ( 10 , input_shape = ( None , 5 ) ) " <nl> <nl> " * ` build ` , where you know the shapes of the input tensors and can do the rest of the initialization \ n " , <nl> " * ` call ` , where you do the forward computation \ n " , <nl> " \ n " , <nl> - " Note that you don ' t have to wait until ` build ` is called to create your variables , you can also create them in ` __init__ ` . However , the advantage of creating them in ` build ` is that it enables late variable creation based on the shape of the inputs the layer will operate on . On the other hand , creating variables in ` __init__ ` would mean that shapes requires to create the variables will need to be explicitly specified . " <nl> + " Note that you don ' t have to wait until ` build ` is called to create your variables , you can also create them in ` __init__ ` . However , the advantage of creating them in ` build ` is that it enables late variable creation based on the shape of the inputs the layer will operate on . On the other hand , creating variables in ` __init__ ` would mean that shapes required to create the variables will need to be explicitly specified . " <nl> ] <nl> } , <nl> { <nl>
Fix typo ( )
tensorflow/tensorflow
c241e9bc57d1f3855d55d440ebbe4189fae6ea8b
2018-06-12T13:05:08Z
new file mode 100644 <nl> index 000000000000 . . dea74aa4eaaa <nl> mmm / dev / null <nl> ppp b / caffe2 / operators / batch_permutation_op . cc <nl> <nl> + # include " caffe2 / operators / batch_permutation_op . h " <nl> + <nl> + # include < cstring > <nl> + # include < vector > <nl> + <nl> + # ifdef CAFFE2_USE_MKLDNN <nl> + # include < caffe2 / ideep / operators / operator_fallback_ideep . h > <nl> + # include < caffe2 / ideep / utils / ideep_operator . h > <nl> + # endif <nl> + <nl> + namespace caffe2 { <nl> + <nl> + template < bool forwards > <nl> + void batch_permutation_loop ( <nl> + const int N , <nl> + const int K , <nl> + const float * src , <nl> + const int * indices , <nl> + float * dst ) { <nl> + long numBytes = K * sizeof ( float ) ; <nl> + if ( forwards ) { <nl> + # ifdef _OPENMP <nl> + # if ( _OPENMP > = 201307 ) <nl> + # pragma omp parallel for simd <nl> + # else <nl> + # pragma omp parallel for <nl> + # endif <nl> + # endif <nl> + for ( int n = 0 ; n < N ; n + + ) { <nl> + int origIdx = n * K ; <nl> + int permuteIdx = indices [ n ] * K ; <nl> + std : : memcpy ( dst + origIdx , src + permuteIdx , numBytes ) ; <nl> + } <nl> + } else { <nl> + std : : vector < int > backward_indices ( N ) ; <nl> + for ( size_t i = 0 ; i < N ; + + i ) { <nl> + backward_indices [ indices [ i ] ] = i ; <nl> + } <nl> + for ( int n = 0 ; n < N ; n + + ) { <nl> + int permuteIdx = n * K ; <nl> + int origIdx = backward_indices [ n ] * K ; <nl> + std : : memcpy ( dst + permuteIdx , src + origIdx , numBytes ) ; <nl> + } <nl> + } <nl> + } <nl> + <nl> + template < > <nl> + bool BatchPermutationOp < float , CPUContext > : : RunOnDevice ( ) { <nl> + auto & X = Input ( 0 ) ; <nl> + auto & indices = Input ( 1 ) ; <nl> + <nl> + CAFFE_ENFORCE ( indices . dim ( ) = = 1 , " indices must be 1 - d " ) ; <nl> + CAFFE_ENFORCE ( <nl> + X . dim32 ( 0 ) = = indices . dim32 ( 0 ) , <nl> + " X . dim32 ( 0 ) must be equal to indices . dim32 ( 0 ) " , <nl> + " ( " , <nl> + X . dim32 ( 0 ) , <nl> + " vs . " , <nl> + indices . dim32 ( 0 ) , <nl> + " ) " ) ; <nl> + <nl> + auto * Y = Output ( 0 , X . sizes ( ) , at : : dtype < float > ( ) ) ; <nl> + <nl> + CAFFE_ENFORCE_GT ( X . dim32 ( 0 ) , 0 ) ; <nl> + batch_permutation_loop < true > ( <nl> + X . dim32 ( 0 ) , <nl> + X . numel ( ) / X . dim32 ( 0 ) , <nl> + X . data < float > ( ) , <nl> + indices . data < int > ( ) , <nl> + Y - > mutable_data < float > ( ) ) ; <nl> + return true ; <nl> + } <nl> + <nl> + template < > <nl> + bool BatchPermutationGradientOp < float , CPUContext > : : RunOnDevice ( ) { <nl> + auto & indices = Input ( 0 ) ; <nl> + auto & dY = Input ( 1 ) ; <nl> + <nl> + auto * dX = Output ( 0 , dY . sizes ( ) , at : : dtype < float > ( ) ) ; <nl> + <nl> + CAFFE_ENFORCE_GT ( dY . dim32 ( 0 ) , 0 ) ; <nl> + batch_permutation_loop < false > ( <nl> + dY . dim32 ( 0 ) , <nl> + dY . numel ( ) / dY . dim32 ( 0 ) , <nl> + dY . data < float > ( ) , <nl> + indices . data < int > ( ) , <nl> + dX - > mutable_data < float > ( ) ) ; <nl> + return true ; <nl> + } <nl> + <nl> + # ifdef CAFFE2_USE_MKLDNN <nl> + REGISTER_IDEEP_OPERATOR ( <nl> + BatchPermutation , <nl> + IDEEPFallbackOp < BatchPermutationOp < float , CPUContext > > ) ; <nl> + # endif <nl> + <nl> + REGISTER_CPU_OPERATOR ( BatchPermutation , BatchPermutationOp < float , CPUContext > ) ; <nl> + REGISTER_CPU_OPERATOR ( <nl> + BatchPermutationGradient , <nl> + BatchPermutationGradientOp < float , CPUContext > ) ; <nl> + <nl> + / / Input : X , indices ; Output : Y <nl> + OPERATOR_SCHEMA ( BatchPermutation ) <nl> + . NumInputs ( 2 ) <nl> + . NumOutputs ( 1 ) <nl> + . SetDoc ( R " DOC ( <nl> + Batch permutation of an input tensor X given input indices . First dimension of <nl> + X equals batch size N . The indices stores a be permutation of N . <nl> + The output Y is a tensor of same shape as X , with data re - ordered according to <nl> + the indices within the batch size . <nl> + <nl> + Example of batch permutation on a 2 - D tensor with batch size 4 : <nl> + X = [ <nl> + [ 1 , 5 , 2 , 3 , 4 , 6 , 0 ] , <nl> + [ 4 , 3 , 3 , 5 , 2 , 3 , 1 ] , <nl> + [ 2 , 2 , 3 , 6 , 0 , 0 , 1 ] , <nl> + [ 0 , 0 , 1 , 1 , 2 , 2 , 3 ] <nl> + ] <nl> + indices = [ 2 , 0 , 1 , 3 ] <nl> + Y = [ <nl> + [ 2 , 2 , 3 , 6 , 0 , 0 , 1 ] , <nl> + [ 1 , 5 , 2 , 3 , 4 , 6 , 0 ] , <nl> + [ 4 , 3 , 3 , 5 , 2 , 3 , 1 ] , <nl> + [ 0 , 0 , 1 , 1 , 2 , 2 , 3 ] <nl> + ] <nl> + <nl> + Example of batch permutation on a 3 - D tensor with batch size 4 : <nl> + X = [ <nl> + [ [ 1 , 5 , 2 ] , [ 3 , 4 , 6 , 0 ] ] , <nl> + [ [ 4 , 3 , 3 ] , [ 5 , 2 , 3 , 1 ] ] , <nl> + [ [ 2 , 2 , 3 ] , [ 6 , 0 , 0 , 1 ] ] , <nl> + [ [ 0 , 0 , 1 ] , [ 1 , 2 , 2 , 3 ] ] <nl> + ] <nl> + indices = [ 2 , 0 , 1 , 3 ] <nl> + Y = [ <nl> + [ [ 2 , 2 , 3 ] , [ 6 , 0 , 0 , 1 ] ] , <nl> + [ [ 1 , 5 , 2 ] , [ 3 , 4 , 6 , 0 ] ] , <nl> + [ [ 4 , 3 , 3 ] , [ 5 , 2 , 3 , 1 ] ] , <nl> + [ [ 0 , 0 , 1 ] , [ 1 , 2 , 2 , 3 ] ] <nl> + ] <nl> + ) DOC " ) <nl> + . Input ( 0 , " X " , " Input tensor , where 1st dimension equals batch size " ) <nl> + . Input ( 1 , " indices " , " Input indices of batch to permute " ) <nl> + . Output ( 0 , " Y " , " Output permuted tensor " ) ; <nl> + / / Input : indices , dY ( aka " gradOutput " ) ; Output : dX ( aka " gradInput " ) <nl> + OPERATOR_SCHEMA ( BatchPermutationGradient ) . NumInputs ( 2 ) . NumOutputs ( 1 ) ; <nl> + <nl> + class GetBatchPermutationGradient : public GradientMakerBase { <nl> + using GradientMakerBase : : GradientMakerBase ; <nl> + vector < OperatorDef > GetGradientDefs ( ) override { <nl> + return SingleGradientDef ( <nl> + " BatchPermutationGradient " , <nl> + " " , <nl> + vector < string > { I ( 1 ) , GO ( 0 ) } , <nl> + vector < string > { GI ( 0 ) } ) ; <nl> + } <nl> + } ; <nl> + <nl> + REGISTER_GRADIENT ( BatchPermutation , GetBatchPermutationGradient ) ; <nl> + <nl> + } / / namespace caffe2 <nl> + <nl> + using BatchPermutationOpFloatCPU = <nl> + caffe2 : : BatchPermutationOp < float , caffe2 : : CPUContext > ; <nl> + <nl> + C10_EXPORT_CAFFE2_OP_TO_C10_CPU ( <nl> + BatchPermutation , <nl> + " _caffe2 : : BatchPermutation ( Tensor X , Tensor indices ) - > Tensor " , <nl> + BatchPermutationOpFloatCPU ) ; <nl> new file mode 100644 <nl> index 000000000000 . . 3e0bb028484e <nl> mmm / dev / null <nl> ppp b / caffe2 / operators / batch_permutation_op . cu <nl> <nl> + # include " caffe2 / core / context_gpu . h " <nl> + # include " caffe2 / operators / batch_permutation_op . h " <nl> + <nl> + namespace caffe2 { <nl> + <nl> + namespace { <nl> + template < bool forward > <nl> + __global__ void BatchPermutationKernel ( <nl> + int N , <nl> + int K , <nl> + const float * src , <nl> + const int * indices , <nl> + float * dst ) { <nl> + if ( forward ) { <nl> + CUDA_1D_KERNEL_LOOP ( index , N * K ) { <nl> + int k = index % K ; <nl> + int n = index / K ; <nl> + int idx = indices [ n ] ; <nl> + CUDA_KERNEL_ASSERT ( idx > = 0 ) ; <nl> + CUDA_KERNEL_ASSERT ( idx < N ) ; <nl> + dst [ index ] = src [ idx * K + k ] ; <nl> + } <nl> + } else { <nl> + CUDA_1D_KERNEL_LOOP ( index , N * K ) { <nl> + int k = index % K ; <nl> + int n = index / K ; <nl> + <nl> + / / NOTE : an alternative implementation if we want to align the index with <nl> + / / the output tensor ( rather than the input tensor ) . <nl> + / / int idx = - 1 ; <nl> + / / for ( size_t i = 0 ; i < N ; + + i ) { <nl> + / / if ( indices [ i ] = = n ) { <nl> + / / idx = i ; <nl> + / / } <nl> + / / } <nl> + / / CUDA_KERNEL_ASSERT ( idx > = 0 ) ; <nl> + / / CUDA_KERNEL_ASSERT ( idx < N ) ; <nl> + / / dst [ index ] = src [ idx * K + k ] ; <nl> + <nl> + int idx = indices [ n ] ; <nl> + CUDA_KERNEL_ASSERT ( idx > = 0 ) ; <nl> + CUDA_KERNEL_ASSERT ( idx < N ) ; <nl> + dst [ idx * K + k ] = src [ index ] ; <nl> + } <nl> + } <nl> + } <nl> + } / / namespace <nl> + <nl> + template < > <nl> + bool BatchPermutationOp < float , CUDAContext > : : RunOnDevice ( ) { <nl> + auto & X = Input ( 0 ) ; <nl> + auto & indices = Input ( 1 ) ; <nl> + <nl> + CAFFE_ENFORCE ( indices . dim ( ) = = 1 , " indices must be 1 - d " ) ; <nl> + CAFFE_ENFORCE ( <nl> + X . dim32 ( 0 ) = = indices . dim32 ( 0 ) , <nl> + " X . dim32 ( 0 ) must be equal to indices . dim32 ( 0 ) " , <nl> + " ( " , <nl> + X . dim32 ( 0 ) , <nl> + " vs . " , <nl> + indices . dim32 ( 0 ) , <nl> + " ) " ) ; <nl> + <nl> + auto * Y = Output ( 0 , X . sizes ( ) , at : : dtype < float > ( ) ) ; <nl> + <nl> + CAFFE_ENFORCE_GT ( X . dim32 ( 0 ) , 0 ) ; <nl> + BatchPermutationKernel < true > <nl> + < < < CAFFE_GET_BLOCKS ( X . numel ( ) ) , <nl> + CAFFE_CUDA_NUM_THREADS , <nl> + 0 , <nl> + context_ . cuda_stream ( ) > > > ( <nl> + X . dim32 ( 0 ) , <nl> + X . numel ( ) / X . dim32 ( 0 ) , <nl> + X . data < float > ( ) , <nl> + indices . data < int > ( ) , <nl> + Y - > mutable_data < float > ( ) ) ; <nl> + <nl> + return true ; <nl> + } <nl> + <nl> + template < > <nl> + bool BatchPermutationGradientOp < float , CUDAContext > : : RunOnDevice ( ) { <nl> + auto & indices = Input ( 0 ) ; <nl> + auto & dY = Input ( 1 ) ; <nl> + auto * dX = Output ( 0 , dY . sizes ( ) , at : : dtype < float > ( ) ) ; <nl> + <nl> + CAFFE_ENFORCE_GT ( dY . dim32 ( 0 ) , 0 ) ; <nl> + BatchPermutationKernel < false > <nl> + < < < CAFFE_GET_BLOCKS ( dY . numel ( ) ) , <nl> + CAFFE_CUDA_NUM_THREADS , <nl> + 0 , <nl> + context_ . cuda_stream ( ) > > > ( <nl> + dY . dim32 ( 0 ) , <nl> + dY . numel ( ) / dY . dim32 ( 0 ) , <nl> + dY . data < float > ( ) , <nl> + indices . data < int > ( ) , <nl> + dX - > mutable_data < float > ( ) ) ; <nl> + <nl> + return true ; <nl> + } <nl> + <nl> + REGISTER_CUDA_OPERATOR ( <nl> + BatchPermutation , <nl> + BatchPermutationOp < float , CUDAContext > ) ; <nl> + REGISTER_CUDA_OPERATOR ( <nl> + BatchPermutationGradient , <nl> + BatchPermutationGradientOp < float , CUDAContext > ) ; <nl> + } / / namespace caffe2 <nl> + <nl> + using BatchPermutationOpFloatCUDA = <nl> + caffe2 : : BatchPermutationOp < float , caffe2 : : CUDAContext > ; <nl> + <nl> + C10_EXPORT_CAFFE2_OP_TO_C10_CUDA ( BatchPermutation , BatchPermutationOpFloatCUDA ) ; <nl> new file mode 100644 <nl> index 000000000000 . . 560b1e2d97ae <nl> mmm / dev / null <nl> ppp b / caffe2 / operators / batch_permutation_op . h <nl> <nl> + # ifndef BATCHPERMUTATION_OP_H_ <nl> + # define BATCHPERMUTATION_OP_H_ <nl> + <nl> + # include " caffe2 / core / context . h " <nl> + # include " caffe2 / core / export_caffe2_op_to_c10 . h " <nl> + # include " caffe2 / core / logging . h " <nl> + # include " caffe2 / core / operator . h " <nl> + # include " caffe2 / utils / math . h " <nl> + <nl> + C10_DECLARE_EXPORT_CAFFE2_OP_TO_C10 ( BatchPermutation ) <nl> + <nl> + namespace caffe2 { <nl> + <nl> + template < typename T , class Context > <nl> + class BatchPermutationOp final : public Operator < Context > { <nl> + public : <nl> + template < class . . . Args > <nl> + explicit BatchPermutationOp ( Args & & . . . args ) <nl> + : Operator < Context > ( std : : forward < Args > ( args ) . . . ) { } <nl> + USE_OPERATOR_CONTEXT_FUNCTIONS ; <nl> + <nl> + bool RunOnDevice ( ) ; <nl> + } ; <nl> + <nl> + template < typename T , class Context > <nl> + class BatchPermutationGradientOp final : public Operator < Context > { <nl> + public : <nl> + BatchPermutationGradientOp ( const OperatorDef & def , Workspace * ws ) <nl> + : Operator < Context > ( def , ws ) { } <nl> + USE_OPERATOR_CONTEXT_FUNCTIONS ; <nl> + <nl> + bool RunOnDevice ( ) ; <nl> + } ; <nl> + <nl> + } / / namespace caffe2 <nl> + <nl> + # endif / / BATCHPERMUTATION_OP_H_ <nl> new file mode 100644 <nl> index 000000000000 . . 40886a73afaa <nl> mmm / dev / null <nl> ppp b / caffe2 / operators / batch_permutation_op_gpu_test . cc <nl> <nl> + # include " caffe2 / core / context_gpu . h " <nl> + # include " caffe2 / core / flags . h " <nl> + # include " caffe2 / operators / batch_permutation_op . h " <nl> + # include " caffe2 / utils / eigen_utils . h " <nl> + # include " caffe2 / utils / math . h " <nl> + # include " gtest / gtest . h " <nl> + <nl> + namespace caffe2 { <nl> + namespace { <nl> + <nl> + / / Add the vector as an input to a Workspace depending on the context of the <nl> + / / workspace <nl> + <nl> + template < typename T > <nl> + void AddInputCPU ( <nl> + const vector < int64_t > & shape , <nl> + const vector < T > & values , <nl> + const string & name , <nl> + Workspace * ws ) { <nl> + Blob * blob = ws - > CreateBlob ( name ) ; <nl> + auto * tensor = BlobGetMutableTensor ( blob , CPU ) ; <nl> + tensor - > Resize ( shape ) ; <nl> + EigenVectorMap < T > tensor_vec ( tensor - > mutable_data < T > ( ) , tensor - > numel ( ) ) ; <nl> + tensor_vec . array ( ) = Eigen : : Map < const Eigen : : Matrix < T , Eigen : : Dynamic , 1 > > { <nl> + values . data ( ) , static_cast < int > ( values . size ( ) ) } ; <nl> + } <nl> + <nl> + template < typename T > <nl> + void AddInputGPU ( <nl> + const vector < int64_t > & shape , <nl> + const vector < T > & values , <nl> + const string & name , <nl> + Workspace * ws ) { <nl> + Tensor tmp ( shape , CPU ) ; <nl> + EigenVectorMap < T > tmp_vec ( tmp . mutable_data < T > ( ) , tmp . numel ( ) ) ; <nl> + tmp_vec . array ( ) = Eigen : : Map < const Eigen : : Matrix < T , Eigen : : Dynamic , 1 > > { <nl> + values . data ( ) , static_cast < int > ( values . size ( ) ) } ; <nl> + <nl> + Blob * blob = ws - > CreateBlob ( name ) ; <nl> + auto * tensor = BlobGetMutableTensor ( blob , CUDA ) ; <nl> + tensor - > CopyFrom ( tmp ) ; <nl> + } <nl> + <nl> + / / Overload 4 different signatures for AddInput because clang does not allow <nl> + / / template < typename T > <nl> + / / void AddInput < CPUContext > ( . . . ) { . . . } <nl> + <nl> + template < typename T , class Context > <nl> + void AddInput ( <nl> + const vector < int64_t > & shape , <nl> + const vector < T > & values , <nl> + const string & name , <nl> + Workspace * ws ) ; <nl> + <nl> + template < > <nl> + void AddInput < int , CPUContext > ( <nl> + const vector < int64_t > & shape , <nl> + const vector < int > & values , <nl> + const string & name , <nl> + Workspace * ws ) { <nl> + AddInputCPU < int > ( shape , values , name , ws ) ; <nl> + } <nl> + <nl> + template < > <nl> + void AddInput < float , CPUContext > ( <nl> + const vector < int64_t > & shape , <nl> + const vector < float > & values , <nl> + const string & name , <nl> + Workspace * ws ) { <nl> + AddInputCPU < float > ( shape , values , name , ws ) ; <nl> + } <nl> + <nl> + template < > <nl> + void AddInput < int , CUDAContext > ( <nl> + const vector < int64_t > & shape , <nl> + const vector < int > & values , <nl> + const string & name , <nl> + Workspace * ws ) { <nl> + AddInputGPU < int > ( shape , values , name , ws ) ; <nl> + } <nl> + <nl> + template < > <nl> + void AddInput < float , CUDAContext > ( <nl> + const vector < int64_t > & shape , <nl> + const vector < float > & values , <nl> + const string & name , <nl> + Workspace * ws ) { <nl> + AddInputGPU < float > ( shape , values , name , ws ) ; <nl> + } <nl> + <nl> + template < class Context > <nl> + DeviceTypeProto GetDeviceType ( ) { <nl> + return PROTO_CPU ; <nl> + } <nl> + template < > <nl> + DeviceTypeProto GetDeviceType < CUDAContext > ( ) { <nl> + return PROTO_CUDA ; <nl> + } <nl> + <nl> + / / Create a BatchPermutationOp with the given inputs ( actual values are <nl> + / / generated sequentially ) and run it <nl> + template < class Context > <nl> + void CreateAndRun ( <nl> + TensorCPU * outResult , <nl> + int N , <nl> + vector < int64_t > & shape , <nl> + vector < float > & features , <nl> + vector < int > indices ) { <nl> + Workspace ws ; <nl> + <nl> + AddInput < float , Context > ( shape , features , " X " , & ws ) ; <nl> + AddInput < int , Context > ( vector < int64_t > { N } , indices , " indices " , & ws ) ; <nl> + <nl> + OperatorDef def ; <nl> + def . set_name ( " test " ) ; <nl> + def . set_type ( " BatchPermutation " ) ; <nl> + def . add_input ( " X " ) ; <nl> + def . add_input ( " indices " ) ; <nl> + def . add_output ( " Y " ) ; <nl> + def . mutable_device_option ( ) - > set_device_type ( GetDeviceType < Context > ( ) ) ; <nl> + unique_ptr < OperatorBase > op = CreateOperator ( def , & ws ) ; <nl> + <nl> + EXPECT_NE ( nullptr , op . get ( ) ) ; <nl> + EXPECT_TRUE ( op - > Run ( ) ) ; <nl> + <nl> + Blob * Y_blob = ws . GetBlob ( " Y " ) ; <nl> + EXPECT_NE ( nullptr , Y_blob ) ; <nl> + <nl> + auto & Y = Y_blob - > Get < Tensor > ( ) ; <nl> + outResult - > CopyFrom ( Y ) ; <nl> + } <nl> + <nl> + / / Create a BatchPermutationOp with the given inputs ( actual values are <nl> + / / generated sequentially ) and run it <nl> + template < class Context > <nl> + void CreateAndRunGradient ( <nl> + TensorCPU * outResult , <nl> + int N , <nl> + vector < int64_t > & shape , <nl> + vector < float > & features , <nl> + vector < int > indices ) { <nl> + Workspace ws ; <nl> + <nl> + AddInput < float , Context > ( shape , features , " dY " , & ws ) ; <nl> + AddInput < int , Context > ( vector < int64_t > { N } , indices , " indices " , & ws ) ; <nl> + <nl> + OperatorDef def ; <nl> + def . set_name ( " test " ) ; <nl> + def . set_type ( " BatchPermutationGradient " ) ; <nl> + def . add_input ( " indices " ) ; <nl> + def . add_input ( " dY " ) ; <nl> + def . add_output ( " dX " ) ; <nl> + def . mutable_device_option ( ) - > set_device_type ( GetDeviceType < Context > ( ) ) ; <nl> + unique_ptr < OperatorBase > op = CreateOperator ( def , & ws ) ; <nl> + <nl> + EXPECT_NE ( nullptr , op . get ( ) ) ; <nl> + EXPECT_TRUE ( op - > Run ( ) ) ; <nl> + <nl> + Blob * Y_blob = ws . GetBlob ( " dX " ) ; <nl> + EXPECT_NE ( nullptr , Y_blob ) ; <nl> + <nl> + auto & Y = Y_blob - > Get < Tensor > ( ) ; <nl> + outResult - > CopyFrom ( Y ) ; <nl> + } <nl> + <nl> + / / Check that the CPU and GPU implementations provide the exact same results <nl> + void CheckCPUGPUEqual ( vector < int64_t > shape , vector < int > indices ) { <nl> + / / Prepare input data <nl> + EXPECT_GT ( shape . size ( ) , 1 ) ; <nl> + int N = shape [ 0 ] ; <nl> + int input_size = 1 ; <nl> + for ( auto k : shape ) { <nl> + input_size * = k ; <nl> + } <nl> + int K = input_size / N ; <nl> + vector < float > features ( input_size ) ; <nl> + std : : iota ( features . begin ( ) , features . end ( ) , 0 ) ; <nl> + <nl> + / / CPU outputs <nl> + Tensor y_cpu { CPU } ; <nl> + Tensor y_cpu_grad { CPU } ; <nl> + <nl> + / / CPU BatchPermutation <nl> + CreateAndRun < CPUContext > ( & y_cpu , N , shape , features , indices ) ; <nl> + <nl> + / / CPU BatchPermutationGradient <nl> + CreateAndRunGradient < CPUContext > ( & y_cpu_grad , N , shape , features , indices ) ; <nl> + <nl> + / / Check CPU output values <nl> + for ( auto i = 0 ; i < indices . size ( ) ; + + i ) { <nl> + for ( auto k = 0 ; k < K ; + + k ) { <nl> + EXPECT_NEAR ( <nl> + y_cpu . data < float > ( ) [ indices [ i ] * K + k ] , features [ i * K + k ] , 1e4 ) ; <nl> + EXPECT_NEAR ( <nl> + y_cpu_grad . data < float > ( ) [ i * K + k ] , <nl> + features [ indices [ i ] * K + k ] , <nl> + 1e4 ) ; <nl> + } <nl> + } <nl> + <nl> + if ( ! caffe2 : : HasCudaGPU ( ) ) { <nl> + VLOG ( 2 ) < < " No CudaGPU found . Skip GPU test . " < < std : : endl ; <nl> + return ; <nl> + } <nl> + <nl> + / / GPU outputs <nl> + Tensor y_gpu { CPU } ; <nl> + Tensor y_gpu_grad { CPU } ; <nl> + <nl> + / / GPU BatchPermutation <nl> + CreateAndRun < CPUContext > ( & y_gpu , N , shape , features , indices ) ; <nl> + <nl> + / / Compare CPU and GPU BatchPermutation outputs <nl> + EXPECT_EQ ( y_cpu . sizes ( ) , y_gpu . sizes ( ) ) ; <nl> + ConstEigenVectorMap < float > y_cpu_vec ( y_cpu . data < float > ( ) , y_cpu . numel ( ) ) ; <nl> + ConstEigenVectorMap < float > y_gpu_vec ( y_gpu . data < float > ( ) , y_gpu . numel ( ) ) ; <nl> + EXPECT_TRUE ( y_cpu_vec . isApprox ( y_gpu_vec ) ) ; <nl> + <nl> + / / GPU BatchPermutationGradient <nl> + CreateAndRunGradient < CUDAContext > ( & y_gpu_grad , N , shape , features , indices ) ; <nl> + <nl> + / / Check GPU outputs <nl> + for ( auto i = 0 ; i < indices . size ( ) ; + + i ) { <nl> + for ( auto k = 0 ; k < K ; + + k ) { <nl> + EXPECT_NEAR ( <nl> + y_gpu . data < float > ( ) [ indices [ i ] * K + k ] , features [ i * K + k ] , 1e4 ) ; <nl> + EXPECT_NEAR ( <nl> + y_gpu_grad . data < float > ( ) [ i * K + k ] , <nl> + features [ indices [ i ] * K + k ] , <nl> + 1e4 ) ; <nl> + } <nl> + } <nl> + <nl> + / / Compare CPU and GPU BatchPermutationGradient outputs <nl> + EXPECT_EQ ( y_cpu_grad . sizes ( ) , y_gpu_grad . sizes ( ) ) ; <nl> + ConstEigenVectorMap < float > y_cpu_vec_grad ( <nl> + y_cpu_grad . data < float > ( ) , y_cpu_grad . numel ( ) ) ; <nl> + ConstEigenVectorMap < float > y_gpu_vec_grad ( <nl> + y_gpu_grad . data < float > ( ) , y_gpu_grad . numel ( ) ) ; <nl> + EXPECT_TRUE ( y_cpu_vec_grad . isApprox ( y_gpu_vec_grad ) ) ; <nl> + } <nl> + <nl> + } / / namespace <nl> + <nl> + TEST ( BatchPermutationTest , CHECKCPUGPUEqualGenericDimension ) { <nl> + auto t0 = std : : chrono : : high_resolution_clock : : now ( ) ; <nl> + int batch_size = 8 ; <nl> + int max_dimension = 6 ; <nl> + vector < int64_t > shape = vector < int64_t > { batch_size } ; <nl> + <nl> + auto seed = std : : chrono : : system_clock : : now ( ) . time_since_epoch ( ) . count ( ) ; <nl> + std : : default_random_engine generator ( seed ) ; <nl> + <nl> + for ( int i = 2 ; i < max_dimension ; + + i ) { <nl> + std : : uniform_int_distribution < > dis ( 1 , i ) ; <nl> + shape . push_back ( dis ( generator ) ) ; <nl> + CheckCPUGPUEqual ( shape , vector < int > { 0 , 1 , 2 , 3 , 4 , 5 , 6 , 7 } ) ; <nl> + CheckCPUGPUEqual ( shape , vector < int > { 7 , 6 , 5 , 4 , 3 , 2 , 1 , 0 } ) ; <nl> + CheckCPUGPUEqual ( shape , vector < int > { 1 , 3 , 5 , 7 , 0 , 2 , 4 , 6 } ) ; <nl> + CheckCPUGPUEqual ( shape , vector < int > { 4 , 5 , 6 , 7 , 0 , 1 , 2 , 3 } ) ; <nl> + CheckCPUGPUEqual ( shape , vector < int > { 3 , 1 , 5 , 7 , 6 , 2 , 4 , 0 } ) ; <nl> + } <nl> + auto t1 = std : : chrono : : high_resolution_clock : : now ( ) ; <nl> + double elapsed = <nl> + std : : chrono : : duration_cast < std : : chrono : : milliseconds > ( t1 - t0 ) . count ( ) ; <nl> + VLOG ( 2 ) < < " Time elapsed : " < < elapsed < < " ms " < < std : : endl ; <nl> + return ; <nl> + } <nl> + } / / namespace caffe2 <nl> deleted file mode 100644 <nl> index 60916e58d8cb . . 000000000000 <nl> mmm a / modules / detectron / batch_permutation_op . cc <nl> ppp / dev / null <nl> <nl> - / * * <nl> - * Copyright ( c ) 2016 - present , 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 " batch_permutation_op . h " <nl> - # ifdef CAFFE2_USE_MKLDNN <nl> - # include < caffe2 / ideep / operators / operator_fallback_ideep . h > <nl> - # include < caffe2 / ideep / utils / ideep_operator . h > <nl> - # endif <nl> - <nl> - namespace caffe2 { <nl> - <nl> - # ifdef CAFFE2_USE_MKLDNN <nl> - REGISTER_IDEEP_OPERATOR ( <nl> - BatchPermutation , <nl> - IDEEPFallbackOp < BatchPermutationOp < float , CPUContext > > ) ; <nl> - # endif <nl> - <nl> - REGISTER_CPU_OPERATOR ( BatchPermutation , BatchPermutationOp < float , CPUContext > ) ; <nl> - REGISTER_CPU_OPERATOR ( <nl> - BatchPermutationGradient , <nl> - BatchPermutationGradientOp < float , CPUContext > ) ; <nl> - <nl> - OPERATOR_SCHEMA ( BatchPermutation ) <nl> - . NumInputs ( 2 ) <nl> - . NumOutputs ( 1 ) <nl> - . SetDoc ( R " DOC ( <nl> - Permute the batch elements of the input tensor X according to the permutation <nl> - specified in the input indices . <nl> - <nl> - Warning : this op does not verify that indices is a valid permutation ; gradient <nl> - comptuation is only correct if indices is a permutation . <nl> - ) DOC " ) <nl> - . Input ( <nl> - 0 , <nl> - " X " , <nl> - " Tensor of at least 1D shape ( N , D0 , D1 , . . . ) . " ) <nl> - . Input ( <nl> - 1 , <nl> - " indices " , <nl> - " 1D tensor of type int with shape ( N , ) specifying a valid permutation " <nl> - " of the indices in [ 0 , N - 1 ] ( inclusive ) . " ) <nl> - . Output ( <nl> - 0 , <nl> - " Y " , <nl> - " Tensor with the same shape as X where the ( D0 , D1 , . . . ) dimensional " <nl> - " batch elements of X are permuted according to the input indices . " ) ; <nl> - <nl> - OPERATOR_SCHEMA ( BatchPermutationGradient ) <nl> - . NumInputs ( 2 ) <nl> - . NumOutputs ( 1 ) <nl> - . Input ( <nl> - 0 , <nl> - " indices " , <nl> - " See BatchPermutation . " ) <nl> - . Input ( <nl> - 1 , <nl> - " dY " , <nl> - " Gradient of forward output 0 ( Y ) . " ) <nl> - . Output ( <nl> - 0 , <nl> - " dX " , <nl> - " Gradient of forward input 0 ( X ) . " ) ; <nl> - <nl> - template < > <nl> - bool BatchPermutationOp < float , CPUContext > : : RunOnDevice ( ) { <nl> - const auto & X = Input ( 0 ) ; <nl> - const auto & indices = Input ( 1 ) ; <nl> - <nl> - CAFFE_ENFORCE_EQ ( indices . dim ( ) , 1 , " indices must be 1 - d " ) ; <nl> - CAFFE_ENFORCE_EQ ( <nl> - X . dim32 ( 0 ) , indices . dim32 ( 0 ) , <nl> - " X . dim32 ( 0 ) must be equal to indices . dim32 ( 0 ) " , <nl> - " ( " , <nl> - X . dim32 ( 0 ) , <nl> - " vs . " , <nl> - indices . dim32 ( 0 ) , <nl> - " ) " ) ; <nl> - <nl> - auto * Y = Output ( 0 , X . sizes ( ) , at : : dtype < float > ( ) ) ; <nl> - <nl> - const int N = X . dim32 ( 0 ) ; <nl> - const int C = X . dim32 ( 1 ) ; <nl> - const int H = X . dim32 ( 2 ) ; <nl> - const int W = X . dim32 ( 3 ) ; <nl> - <nl> - const float * src = X . template data < float > ( ) ; <nl> - float * dst = Y - > template mutable_data < float > ( ) ; <nl> - <nl> - # ifdef _OPENMP <nl> - # if ( _OPENMP > = 201307 ) <nl> - # pragma omp parallel for simd <nl> - # else <nl> - # pragma omp parallel for <nl> - # endif <nl> - # endif <nl> - for ( int i = 0 ; i < N ; i + + ) { <nl> - int idx = indices . template data < int > ( ) [ i ] ; <nl> - <nl> - std : : memcpy ( dst + i * C * H * W , src + idx * C * H * W , sizeof ( float ) * C * H * W ) ; <nl> - } <nl> - <nl> - return true ; <nl> - } <nl> - <nl> - class GetBatchPermutationGradient : public GradientMakerBase { <nl> - using GradientMakerBase : : GradientMakerBase ; <nl> - vector < OperatorDef > GetGradientDefs ( ) override { <nl> - return SingleGradientDef ( <nl> - " BatchPermutationGradient " , <nl> - " " , <nl> - vector < string > { I ( 1 ) , GO ( 0 ) } , <nl> - vector < string > { GI ( 0 ) } ) ; <nl> - } <nl> - } ; <nl> - <nl> - REGISTER_GRADIENT ( BatchPermutation , GetBatchPermutationGradient ) ; <nl> - <nl> - } / / namespace caffe2 <nl> deleted file mode 100644 <nl> index 72199def6af3 . . 000000000000 <nl> mmm a / modules / detectron / batch_permutation_op . cu <nl> ppp / dev / null <nl> <nl> - / * * <nl> - * Copyright ( c ) 2016 - present , 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 " modules / detectron / batch_permutation_op . h " <nl> - # include " caffe2 / core / context_gpu . h " <nl> - <nl> - namespace caffe2 { <nl> - <nl> - namespace { <nl> - template < bool forward > <nl> - __global__ void BatchPermutationKernel ( <nl> - int N , <nl> - int C , <nl> - int H , <nl> - int W , <nl> - const float * src , <nl> - const int * indices , <nl> - float * dst ) { <nl> - CUDA_1D_KERNEL_LOOP ( index , N * C * H * W ) { <nl> - int w = index % W ; <nl> - int h = ( index / W ) % H ; <nl> - int c = ( index / W / H ) % C ; <nl> - int n = ( index / W / H / C ) ; <nl> - int idx = indices [ n ] ; <nl> - if ( forward ) { <nl> - dst [ n * C * H * W + c * H * W + h * W + w ] = <nl> - src [ idx * C * H * W + c * H * W + h * W + w ] ; <nl> - } else { <nl> - dst [ idx * C * H * W + c * H * W + h * W + w ] = <nl> - src [ n * C * H * W + c * H * W + h * W + w ] ; <nl> - } <nl> - } <nl> - } <nl> - } <nl> - <nl> - template < > <nl> - bool BatchPermutationOp < float , CUDAContext > : : RunOnDevice ( ) { <nl> - auto & X = Input ( 0 ) ; <nl> - auto & indices = Input ( 1 ) ; <nl> - <nl> - <nl> - CAFFE_ENFORCE ( indices . ndim ( ) = = 1 , " indices must be 1 - d " ) ; <nl> - CAFFE_ENFORCE ( <nl> - X . dim32 ( 0 ) = = indices . dim32 ( 0 ) , <nl> - " X . dim32 ( 0 ) must be equal to indices . dim32 ( 0 ) " , <nl> - " ( " , <nl> - X . dim32 ( 0 ) , <nl> - " vs . " , <nl> - indices . dim32 ( 0 ) , <nl> - " ) " ) ; <nl> - <nl> - auto * Y = Output ( 0 , X . sizes ( ) , at : : dtype < float > ( ) ) ; <nl> - <nl> - BatchPermutationKernel < true > < < < <nl> - CAFFE_GET_BLOCKS ( X . size ( ) ) , <nl> - CAFFE_CUDA_NUM_THREADS , <nl> - 0 , <nl> - context_ . cuda_stream ( ) > > > ( <nl> - X . dim32 ( 0 ) , <nl> - X . dim32 ( 1 ) , <nl> - X . dim32 ( 2 ) , <nl> - X . dim32 ( 3 ) , <nl> - X . data < float > ( ) , <nl> - indices . data < int > ( ) , <nl> - Y - > mutable_data < float > ( ) ) ; <nl> - <nl> - return true ; <nl> - } <nl> - <nl> - template < > <nl> - bool BatchPermutationGradientOp < float , CUDAContext > : : RunOnDevice ( ) { <nl> - auto & indices = Input ( 0 ) ; <nl> - auto & dY = Input ( 1 ) ; <nl> - <nl> - auto * dX = Output ( 0 , dY . sizes ( ) , at : : dtype < float > ( ) ) ; <nl> - <nl> - BatchPermutationKernel < false > < < < <nl> - CAFFE_GET_BLOCKS ( dY . size ( ) ) , <nl> - CAFFE_CUDA_NUM_THREADS , <nl> - 0 , <nl> - context_ . cuda_stream ( ) > > > ( <nl> - dY . dim32 ( 0 ) , <nl> - dY . dim32 ( 1 ) , <nl> - dY . dim32 ( 2 ) , <nl> - dY . dim32 ( 3 ) , <nl> - dY . data < float > ( ) , <nl> - indices . data < int > ( ) , <nl> - dX - > mutable_data < float > ( ) ) ; <nl> - <nl> - return true ; <nl> - } <nl> - <nl> - REGISTER_CUDA_OPERATOR ( <nl> - BatchPermutation , <nl> - BatchPermutationOp < float , CUDAContext > ) ; <nl> - REGISTER_CUDA_OPERATOR ( <nl> - BatchPermutationGradient , <nl> - BatchPermutationGradientOp < float , CUDAContext > ) ; <nl> - } / / namespace caffe2 <nl> deleted file mode 100644 <nl> index 81a98bd81209 . . 000000000000 <nl> mmm a / modules / detectron / batch_permutation_op . h <nl> ppp / dev / null <nl> <nl> - / * * <nl> - * Copyright ( c ) 2016 - present , 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> - # ifndef BATCHPERMUTATION_OP_H_ <nl> - # define BATCHPERMUTATION_OP_H_ <nl> - <nl> - # include < cstring > <nl> - # include " caffe2 / core / context . h " <nl> - # include " caffe2 / core / logging . h " <nl> - # include " caffe2 / core / operator . h " <nl> - # include " caffe2 / utils / math . h " <nl> - <nl> - namespace caffe2 { <nl> - <nl> - template < typename T , class Context > <nl> - class BatchPermutationOp final : public Operator < Context > { <nl> - public : <nl> - BatchPermutationOp ( const OperatorDef & operator_def , Workspace * ws ) <nl> - : Operator < Context > ( operator_def , ws ) { } <nl> - USE_OPERATOR_CONTEXT_FUNCTIONS ; <nl> - <nl> - bool RunOnDevice ( ) override ; <nl> - } ; <nl> - <nl> - template < typename T , class Context > <nl> - class BatchPermutationGradientOp final : public Operator < Context > { <nl> - public : <nl> - BatchPermutationGradientOp ( const OperatorDef & def , Workspace * ws ) <nl> - : Operator < Context > ( def , ws ) { } <nl> - USE_OPERATOR_CONTEXT_FUNCTIONS ; <nl> - <nl> - bool RunOnDevice ( ) override { <nl> - / / No CPU implementation for now <nl> - CAFFE_NOT_IMPLEMENTED ; <nl> - } <nl> - } ; <nl> - <nl> - } / / namespace caffe2 <nl> - <nl> - # endif / / BATCHPERMUTATION_OP_H_ <nl>
move BatchPermutationOp to caffe2 / operators
pytorch/pytorch
d9c3913dfc4ac1812ef0e0e180f0433884758d7d
2019-12-17T22:58:27Z
new file mode 100644 <nl> index 0000000000 . . 3f830565c0 <nl> mmm / dev / null <nl> ppp b / flowbench / BenchRandom . cpp <nl> <nl> + / * <nl> + * BenchRandom . cpp <nl> + * <nl> + * This source file is part of the FoundationDB open source project <nl> + * <nl> + * Copyright 2013 - 2020 Apple Inc . and the FoundationDB project authors <nl> + * <nl> + * Licensed under the Apache License , Version 2 . 0 ( the " License " ) ; <nl> + * you may not use this file except in compliance with the License . <nl> + * You may obtain a copy of the License at <nl> + * <nl> + * http : / / www . apache . org / licenses / LICENSE - 2 . 0 <nl> + * <nl> + * Unless required by applicable law or agreed to in writing , software <nl> + * distributed under the License is distributed on an " AS IS " BASIS , <nl> + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND , either express or implied . <nl> + * See the License for the specific language governing permissions and <nl> + * limitations under the License . <nl> + * / <nl> + <nl> + # include " benchmark / benchmark . h " <nl> + <nl> + # include " flow / IRandom . h " <nl> + <nl> + static void bench_random ( benchmark : : State & state ) { <nl> + while ( state . KeepRunning ( ) ) { <nl> + double r = deterministicRandom ( ) - > random01 ( ) ; <nl> + benchmark : : DoNotOptimize ( r ) ; <nl> + } <nl> + } <nl> + <nl> + BENCHMARK ( bench_random ) - > ReportAggregatesOnly ( true ) ; <nl> mmm a / flowbench / CMakeLists . txt <nl> ppp b / flowbench / CMakeLists . txt <nl> set ( FLOWBENCH_SRCS <nl> flowbench . actor . cpp <nl> BenchIterate . cpp <nl> BenchPopulate . cpp <nl> + BenchRandom . cpp <nl> BenchRef . cpp <nl> BenchStream . actor . cpp <nl> GlobalData . h <nl>
Added bench_random benchmark
apple/foundationdb
39ebb2eeff13db107135ff4a58ad839a43de8502
2020-08-03T22:45:53Z
mmm a / Makefile <nl> ppp b / Makefile <nl> gpr_host_port_test : $ ( BINDIR ) / $ ( CONFIG ) / gpr_host_port_test <nl> gpr_log_test : $ ( BINDIR ) / $ ( CONFIG ) / gpr_log_test <nl> gpr_mpscq_test : $ ( BINDIR ) / $ ( CONFIG ) / gpr_mpscq_test <nl> gpr_percent_encoding_test : $ ( BINDIR ) / $ ( CONFIG ) / gpr_percent_encoding_test <nl> - gpr_slice_buffer_test : $ ( BINDIR ) / $ ( CONFIG ) / gpr_slice_buffer_test <nl> - gpr_slice_test : $ ( BINDIR ) / $ ( CONFIG ) / gpr_slice_test <nl> + grpc_slice_buffer_test : $ ( BINDIR ) / $ ( CONFIG ) / grpc_slice_buffer_test <nl> + grpc_slice_test : $ ( BINDIR ) / $ ( CONFIG ) / grpc_slice_test <nl> gpr_stack_lockfree_test : $ ( BINDIR ) / $ ( CONFIG ) / gpr_stack_lockfree_test <nl> gpr_string_test : $ ( BINDIR ) / $ ( CONFIG ) / gpr_string_test <nl> gpr_sync_test : $ ( BINDIR ) / $ ( CONFIG ) / gpr_sync_test <nl> buildtests_c : privatelibs_c \ <nl> $ ( BINDIR ) / $ ( CONFIG ) / gpr_log_test \ <nl> $ ( BINDIR ) / $ ( CONFIG ) / gpr_mpscq_test \ <nl> $ ( BINDIR ) / $ ( CONFIG ) / gpr_percent_encoding_test \ <nl> - $ ( BINDIR ) / $ ( CONFIG ) / gpr_slice_buffer_test \ <nl> - $ ( BINDIR ) / $ ( CONFIG ) / gpr_slice_test \ <nl> + $ ( BINDIR ) / $ ( CONFIG ) / grpc_slice_buffer_test \ <nl> + $ ( BINDIR ) / $ ( CONFIG ) / grpc_slice_test \ <nl> $ ( BINDIR ) / $ ( CONFIG ) / gpr_stack_lockfree_test \ <nl> $ ( BINDIR ) / $ ( CONFIG ) / gpr_string_test \ <nl> $ ( BINDIR ) / $ ( CONFIG ) / gpr_sync_test \ <nl> test_c : buildtests_c <nl> $ ( Q ) $ ( BINDIR ) / $ ( CONFIG ) / gpr_mpscq_test | | ( echo test gpr_mpscq_test failed ; exit 1 ) <nl> $ ( E ) " [ RUN ] Testing gpr_percent_encoding_test " <nl> $ ( Q ) $ ( BINDIR ) / $ ( CONFIG ) / gpr_percent_encoding_test | | ( echo test gpr_percent_encoding_test failed ; exit 1 ) <nl> - $ ( E ) " [ RUN ] Testing gpr_slice_buffer_test " <nl> - $ ( Q ) $ ( BINDIR ) / $ ( CONFIG ) / gpr_slice_buffer_test | | ( echo test gpr_slice_buffer_test failed ; exit 1 ) <nl> - $ ( E ) " [ RUN ] Testing gpr_slice_test " <nl> - $ ( Q ) $ ( BINDIR ) / $ ( CONFIG ) / gpr_slice_test | | ( echo test gpr_slice_test failed ; exit 1 ) <nl> + $ ( E ) " [ RUN ] Testing grpc_slice_buffer_test " <nl> + $ ( Q ) $ ( BINDIR ) / $ ( CONFIG ) / grpc_slice_buffer_test | | ( echo test grpc_slice_buffer_test failed ; exit 1 ) <nl> + $ ( E ) " [ RUN ] Testing grpc_slice_test " <nl> + $ ( Q ) $ ( BINDIR ) / $ ( CONFIG ) / grpc_slice_test | | ( echo test grpc_slice_test failed ; exit 1 ) <nl> $ ( E ) " [ RUN ] Testing gpr_stack_lockfree_test " <nl> $ ( Q ) $ ( BINDIR ) / $ ( CONFIG ) / gpr_stack_lockfree_test | | ( echo test gpr_stack_lockfree_test failed ; exit 1 ) <nl> $ ( E ) " [ RUN ] Testing gpr_string_test " <nl> ifeq ( $ ( NO_SECURE ) , true ) <nl> <nl> # You can ' t build secure targets if you don ' t have OpenSSL . <nl> <nl> - $ ( BINDIR ) / $ ( CONFIG ) / gpr_slice_buffer_test : openssl_dep_error <nl> + $ ( BINDIR ) / $ ( CONFIG ) / grpc_slice_buffer_test : openssl_dep_error <nl> <nl> else <nl> <nl> <nl> <nl> - $ ( BINDIR ) / $ ( CONFIG ) / gpr_slice_buffer_test : $ ( GPR_SLICE_BUFFER_TEST_OBJS ) $ ( LIBDIR ) / $ ( CONFIG ) / libgpr_test_util . a $ ( LIBDIR ) / $ ( CONFIG ) / libgpr . a <nl> + $ ( BINDIR ) / $ ( CONFIG ) / grpc_slice_buffer_test : $ ( GPR_SLICE_BUFFER_TEST_OBJS ) $ ( LIBDIR ) / $ ( CONFIG ) / libgpr_test_util . a $ ( LIBDIR ) / $ ( CONFIG ) / libgpr . a <nl> $ ( E ) " [ LD ] Linking $ @ " <nl> $ ( Q ) mkdir - p ` dirname $ @ ` <nl> - $ ( Q ) $ ( LD ) $ ( LDFLAGS ) $ ( GPR_SLICE_BUFFER_TEST_OBJS ) $ ( LIBDIR ) / $ ( CONFIG ) / libgpr_test_util . a $ ( LIBDIR ) / $ ( CONFIG ) / libgpr . a $ ( LDLIBS ) $ ( LDLIBS_SECURE ) - o $ ( BINDIR ) / $ ( CONFIG ) / gpr_slice_buffer_test <nl> + $ ( Q ) $ ( LD ) $ ( LDFLAGS ) $ ( GPR_SLICE_BUFFER_TEST_OBJS ) $ ( LIBDIR ) / $ ( CONFIG ) / libgpr_test_util . a $ ( LIBDIR ) / $ ( CONFIG ) / libgpr . a $ ( LDLIBS ) $ ( LDLIBS_SECURE ) - o $ ( BINDIR ) / $ ( CONFIG ) / grpc_slice_buffer_test <nl> <nl> endif <nl> <nl> $ ( OBJDIR ) / $ ( CONFIG ) / test / core / support / slice_buffer_test . o : $ ( LIBDIR ) / $ ( CONFIG ) / libgpr_test_util . a $ ( LIBDIR ) / $ ( CONFIG ) / libgpr . a <nl> <nl> - deps_gpr_slice_buffer_test : $ ( GPR_SLICE_BUFFER_TEST_OBJS : . o = . dep ) <nl> + deps_grpc_slice_buffer_test : $ ( GPR_SLICE_BUFFER_TEST_OBJS : . o = . dep ) <nl> <nl> ifneq ( $ ( NO_SECURE ) , true ) <nl> ifneq ( $ ( NO_DEPS ) , true ) <nl> ifeq ( $ ( NO_SECURE ) , true ) <nl> <nl> # You can ' t build secure targets if you don ' t have OpenSSL . <nl> <nl> - $ ( BINDIR ) / $ ( CONFIG ) / gpr_slice_test : openssl_dep_error <nl> + $ ( BINDIR ) / $ ( CONFIG ) / grpc_slice_test : openssl_dep_error <nl> <nl> else <nl> <nl> <nl> <nl> - $ ( BINDIR ) / $ ( CONFIG ) / gpr_slice_test : $ ( GPR_SLICE_TEST_OBJS ) $ ( LIBDIR ) / $ ( CONFIG ) / libgpr_test_util . a $ ( LIBDIR ) / $ ( CONFIG ) / libgpr . a <nl> + $ ( BINDIR ) / $ ( CONFIG ) / grpc_slice_test : $ ( GPR_SLICE_TEST_OBJS ) $ ( LIBDIR ) / $ ( CONFIG ) / libgpr_test_util . a $ ( LIBDIR ) / $ ( CONFIG ) / libgpr . a <nl> $ ( E ) " [ LD ] Linking $ @ " <nl> $ ( Q ) mkdir - p ` dirname $ @ ` <nl> - $ ( Q ) $ ( LD ) $ ( LDFLAGS ) $ ( GPR_SLICE_TEST_OBJS ) $ ( LIBDIR ) / $ ( CONFIG ) / libgpr_test_util . a $ ( LIBDIR ) / $ ( CONFIG ) / libgpr . a $ ( LDLIBS ) $ ( LDLIBS_SECURE ) - o $ ( BINDIR ) / $ ( CONFIG ) / gpr_slice_test <nl> + $ ( Q ) $ ( LD ) $ ( LDFLAGS ) $ ( GPR_SLICE_TEST_OBJS ) $ ( LIBDIR ) / $ ( CONFIG ) / libgpr_test_util . a $ ( LIBDIR ) / $ ( CONFIG ) / libgpr . a $ ( LDLIBS ) $ ( LDLIBS_SECURE ) - o $ ( BINDIR ) / $ ( CONFIG ) / grpc_slice_test <nl> <nl> endif <nl> <nl> $ ( OBJDIR ) / $ ( CONFIG ) / test / core / support / slice_test . o : $ ( LIBDIR ) / $ ( CONFIG ) / libgpr_test_util . a $ ( LIBDIR ) / $ ( CONFIG ) / libgpr . a <nl> <nl> - deps_gpr_slice_test : $ ( GPR_SLICE_TEST_OBJS : . o = . dep ) <nl> + deps_grpc_slice_test : $ ( GPR_SLICE_TEST_OBJS : . o = . dep ) <nl> <nl> ifneq ( $ ( NO_SECURE ) , true ) <nl> ifneq ( $ ( NO_DEPS ) , true ) <nl> mmm a / build . yaml <nl> ppp b / build . yaml <nl> filegroups : <nl> - include / grpc / support / log . h <nl> - include / grpc / support / log_windows . h <nl> - include / grpc / support / port_platform . h <nl> - - include / grpc / support / slice . h <nl> - - include / grpc / support / slice_buffer . h <nl> - include / grpc / support / string_util . h <nl> - include / grpc / support / subprocess . h <nl> - include / grpc / support / sync . h <nl> filegroups : <nl> - src / core / lib / support / env . h <nl> - src / core / lib / support / mpscq . h <nl> - src / core / lib / support / murmur_hash . h <nl> - - src / core / lib / support / percent_encoding . h <nl> - src / core / lib / support / stack_lockfree . h <nl> - src / core / lib / support / string . h <nl> - src / core / lib / support / string_windows . h <nl> filegroups : <nl> - src / core / lib / support / log_windows . c <nl> - src / core / lib / support / mpscq . c <nl> - src / core / lib / support / murmur_hash . c <nl> - - src / core / lib / support / percent_encoding . c <nl> - - src / core / lib / support / slice . c <nl> - - src / core / lib / support / slice_buffer . c <nl> - src / core / lib / support / stack_lockfree . c <nl> - src / core / lib / support / string . c <nl> - src / core / lib / support / string_posix . c <nl> filegroups : <nl> - include / grpc / grpc_posix . h <nl> - include / grpc / grpc_security_constants . h <nl> - include / grpc / status . h <nl> + - include / grpc / slice . h <nl> + - include / grpc / slice_buffer . h <nl> headers : <nl> - src / core / lib / channel / channel_args . h <nl> - src / core / lib / channel / channel_stack . h <nl> filegroups : <nl> - src / core / lib / iomgr / ev_epoll_linux . h <nl> - src / core / lib / iomgr / ev_poll_and_epoll_posix . h <nl> - src / core / lib / iomgr / ev_poll_posix . h <nl> + - src / core / lib / slice / percent_encoding . h <nl> - src / core / lib / iomgr / ev_posix . h <nl> - src / core / lib / iomgr / exec_ctx . h <nl> - src / core / lib / iomgr / executor . h <nl> filegroups : <nl> - src / core / lib / iomgr / pollset . h <nl> - src / core / lib / iomgr / pollset_set . h <nl> - src / core / lib / iomgr / pollset_set_windows . h <nl> + - src / core / lib / slice / slice_string_helpers . h <nl> - src / core / lib / iomgr / pollset_windows . h <nl> - src / core / lib / iomgr / resolve_address . h <nl> - src / core / lib / iomgr / resource_quota . h <nl> filegroups : <nl> - src / core / lib / channel / channel_stack . c <nl> - src / core / lib / channel / channel_stack_builder . c <nl> - src / core / lib / channel / compress_filter . c <nl> + - src / core / lib / slice / slice . c <nl> + - src / core / lib / slice / percent_encoding . c <nl> + - src / core / lib / slice / slice_buffer . c <nl> + - src / core / lib / slice / slice_string_helpers . c <nl> - src / core / lib / channel / connected_channel . c <nl> - src / core / lib / channel / deadline_filter . c <nl> - src / core / lib / channel / handshaker . c <nl> targets : <nl> deps : <nl> - gpr_test_util <nl> - gpr <nl> - - name : gpr_slice_buffer_test <nl> + - name : slice_buffer_test <nl> build : test <nl> language : c <nl> src : <nl> - - test / core / support / slice_buffer_test . c <nl> + - test / core / slice / slice_buffer_test . c <nl> deps : <nl> - gpr_test_util <nl> - gpr <nl> - - name : gpr_slice_test <nl> + - name : slice_test <nl> build : test <nl> language : c <nl> src : <nl> - - test / core / support / slice_test . c <nl> + - test / core / slice / slice_test . c <nl> deps : <nl> - gpr_test_util <nl> - gpr <nl> targets : <nl> build : fuzzer <nl> language : c <nl> src : <nl> - - test / core / support / percent_decode_fuzzer . c <nl> + - test / core / slice / percent_decode_fuzzer . c <nl> deps : <nl> - grpc_test_util <nl> - grpc <nl> - gpr_test_util <nl> - gpr <nl> corpus_dirs : <nl> - - test / core / support / percent_decode_corpus <nl> + - test / core / slice / percent_decode_corpus <nl> maxlen : 32 <nl> - name : percent_encode_fuzzer <nl> build : fuzzer <nl> language : c <nl> src : <nl> - - test / core / support / percent_encode_fuzzer . c <nl> + - test / core / slice / percent_encode_fuzzer . c <nl> deps : <nl> - grpc_test_util <nl> - grpc <nl> - gpr_test_util <nl> - gpr <nl> corpus_dirs : <nl> - - test / core / support / percent_encode_corpus <nl> + - test / core / slice / percent_encode_corpus <nl> maxlen : 32 <nl> - name : resolve_address_test <nl> build : test <nl> mmm a / grpc . def <nl> ppp b / grpc . def <nl> EXPORTS <nl> gpr_log_verbosity_init <nl> gpr_set_log_function <nl> gpr_format_message <nl> - gpr_slice_ref <nl> - gpr_slice_unref <nl> - gpr_slice_new <nl> - gpr_slice_new_with_user_data <nl> - gpr_slice_new_with_len <nl> - gpr_slice_malloc <nl> - gpr_slice_from_copied_string <nl> - gpr_slice_from_copied_buffer <nl> - gpr_slice_from_static_string <nl> - gpr_slice_sub <nl> - gpr_slice_sub_no_ref <nl> - gpr_slice_split_tail <nl> - gpr_slice_split_head <nl> + grpc_slice_ref <nl> + grpc_slice_unref <nl> + grpc_slice_new <nl> + grpc_slice_new_with_user_data <nl> + grpc_slice_new_with_len <nl> + grpc_slice_malloc <nl> + grpc_slice_from_copied_string <nl> + grpc_slice_from_copied_buffer <nl> + grpc_slice_from_static_string <nl> + grpc_slice_sub <nl> + grpc_slice_sub_no_ref <nl> + grpc_slice_split_tail <nl> + grpc_slice_split_head <nl> gpr_empty_slice <nl> - gpr_slice_cmp <nl> - gpr_slice_str_cmp <nl> - gpr_slice_buffer_init <nl> - gpr_slice_buffer_destroy <nl> - gpr_slice_buffer_add <nl> - gpr_slice_buffer_add_indexed <nl> - gpr_slice_buffer_addn <nl> - gpr_slice_buffer_tiny_add <nl> - gpr_slice_buffer_pop <nl> - gpr_slice_buffer_reset_and_unref <nl> - gpr_slice_buffer_swap <nl> - gpr_slice_buffer_move_into <nl> - gpr_slice_buffer_trim_end <nl> - gpr_slice_buffer_move_first <nl> - gpr_slice_buffer_take_first <nl> + grpc_slice_cmp <nl> + grpc_slice_str_cmp <nl> + grpc_slice_buffer_init <nl> + grpc_slice_buffer_destroy <nl> + grpc_slice_buffer_add <nl> + grpc_slice_buffer_add_indexed <nl> + grpc_slice_buffer_addn <nl> + grpc_slice_buffer_tiny_add <nl> + grpc_slice_buffer_pop <nl> + grpc_slice_buffer_reset_and_unref <nl> + grpc_slice_buffer_swap <nl> + grpc_slice_buffer_move_into <nl> + grpc_slice_buffer_trim_end <nl> + grpc_slice_buffer_move_first <nl> + grpc_slice_buffer_take_first <nl> gpr_strdup <nl> gpr_asprintf <nl> gpr_subprocess_binary_extension <nl> mmm a / include / grpc + + / impl / codegen / core_codegen . h <nl> ppp b / include / grpc + + / impl / codegen / core_codegen . h <nl> class CoreCodegen : public CoreCodegenInterface { <nl> void grpc_byte_buffer_reader_destroy ( grpc_byte_buffer_reader * reader ) <nl> GRPC_OVERRIDE ; <nl> int grpc_byte_buffer_reader_next ( grpc_byte_buffer_reader * reader , <nl> - gpr_slice * slice ) GRPC_OVERRIDE ; <nl> + grpc_slice * slice ) GRPC_OVERRIDE ; <nl> <nl> - grpc_byte_buffer * grpc_raw_byte_buffer_create ( gpr_slice * slice , <nl> + grpc_byte_buffer * grpc_raw_byte_buffer_create ( grpc_slice * slice , <nl> size_t nslices ) GRPC_OVERRIDE ; <nl> <nl> - gpr_slice gpr_slice_malloc ( size_t length ) GRPC_OVERRIDE ; <nl> - void gpr_slice_unref ( gpr_slice slice ) GRPC_OVERRIDE ; <nl> - gpr_slice gpr_slice_split_tail ( gpr_slice * s , size_t split ) GRPC_OVERRIDE ; <nl> - void gpr_slice_buffer_add ( gpr_slice_buffer * sb , <nl> - gpr_slice slice ) GRPC_OVERRIDE ; <nl> - void gpr_slice_buffer_pop ( gpr_slice_buffer * sb ) GRPC_OVERRIDE ; <nl> + grpc_slice grpc_slice_malloc ( size_t length ) GRPC_OVERRIDE ; <nl> + void grpc_slice_unref ( grpc_slice slice ) GRPC_OVERRIDE ; <nl> + grpc_slice grpc_slice_split_tail ( grpc_slice * s , size_t split ) GRPC_OVERRIDE ; <nl> + void grpc_slice_buffer_add ( grpc_slice_buffer * sb , <nl> + grpc_slice slice ) GRPC_OVERRIDE ; <nl> + void grpc_slice_buffer_pop ( grpc_slice_buffer * sb ) GRPC_OVERRIDE ; <nl> <nl> void grpc_metadata_array_init ( grpc_metadata_array * array ) GRPC_OVERRIDE ; <nl> void grpc_metadata_array_destroy ( grpc_metadata_array * array ) GRPC_OVERRIDE ; <nl> mmm a / include / grpc + + / impl / codegen / core_codegen_interface . h <nl> ppp b / include / grpc + + / impl / codegen / core_codegen_interface . h <nl> class CoreCodegenInterface { <nl> virtual void grpc_byte_buffer_reader_destroy ( <nl> grpc_byte_buffer_reader * reader ) = 0 ; <nl> virtual int grpc_byte_buffer_reader_next ( grpc_byte_buffer_reader * reader , <nl> - gpr_slice * slice ) = 0 ; <nl> + grpc_slice * slice ) = 0 ; <nl> <nl> - virtual grpc_byte_buffer * grpc_raw_byte_buffer_create ( gpr_slice * slice , <nl> + virtual grpc_byte_buffer * grpc_raw_byte_buffer_create ( grpc_slice * slice , <nl> size_t nslices ) = 0 ; <nl> <nl> - virtual gpr_slice gpr_slice_malloc ( size_t length ) = 0 ; <nl> - virtual void gpr_slice_unref ( gpr_slice slice ) = 0 ; <nl> - virtual gpr_slice gpr_slice_split_tail ( gpr_slice * s , size_t split ) = 0 ; <nl> - virtual void gpr_slice_buffer_add ( gpr_slice_buffer * sb , gpr_slice slice ) = 0 ; <nl> - virtual void gpr_slice_buffer_pop ( gpr_slice_buffer * sb ) = 0 ; <nl> + virtual grpc_slice grpc_slice_malloc ( size_t length ) = 0 ; <nl> + virtual void grpc_slice_unref ( grpc_slice slice ) = 0 ; <nl> + virtual grpc_slice grpc_slice_split_tail ( grpc_slice * s , size_t split ) = 0 ; <nl> + virtual void grpc_slice_buffer_add ( grpc_slice_buffer * sb , grpc_slice slice ) = 0 ; <nl> + virtual void grpc_slice_buffer_pop ( grpc_slice_buffer * sb ) = 0 ; <nl> <nl> virtual void grpc_metadata_array_init ( grpc_metadata_array * array ) = 0 ; <nl> virtual void grpc_metadata_array_destroy ( grpc_metadata_array * array ) = 0 ; <nl> mmm a / include / grpc + + / impl / codegen / proto_utils . h <nl> ppp b / include / grpc + + / impl / codegen / proto_utils . h <nl> class GrpcBufferWriter GRPC_FINAL <nl> <nl> ~ GrpcBufferWriter ( ) GRPC_OVERRIDE { <nl> if ( have_backup_ ) { <nl> - g_core_codegen_interface - > gpr_slice_unref ( backup_slice_ ) ; <nl> + g_core_codegen_interface - > grpc_slice_unref ( backup_slice_ ) ; <nl> } <nl> } <nl> <nl> class GrpcBufferWriter GRPC_FINAL <nl> slice_ = backup_slice_ ; <nl> have_backup_ = false ; <nl> } else { <nl> - slice_ = g_core_codegen_interface - > gpr_slice_malloc ( block_size_ ) ; <nl> + slice_ = g_core_codegen_interface - > grpc_slice_malloc ( block_size_ ) ; <nl> } <nl> * data = GPR_SLICE_START_PTR ( slice_ ) ; <nl> / / On win x64 , int is only 32bit <nl> GPR_CODEGEN_ASSERT ( GPR_SLICE_LENGTH ( slice_ ) < = INT_MAX ) ; <nl> byte_count_ + = * size = ( int ) GPR_SLICE_LENGTH ( slice_ ) ; <nl> - g_core_codegen_interface - > gpr_slice_buffer_add ( slice_buffer_ , slice_ ) ; <nl> + g_core_codegen_interface - > grpc_slice_buffer_add ( slice_buffer_ , slice_ ) ; <nl> return true ; <nl> } <nl> <nl> void BackUp ( int count ) GRPC_OVERRIDE { <nl> - g_core_codegen_interface - > gpr_slice_buffer_pop ( slice_buffer_ ) ; <nl> + g_core_codegen_interface - > grpc_slice_buffer_pop ( slice_buffer_ ) ; <nl> if ( count = = block_size_ ) { <nl> backup_slice_ = slice_ ; <nl> } else { <nl> - backup_slice_ = g_core_codegen_interface - > gpr_slice_split_tail ( <nl> + backup_slice_ = g_core_codegen_interface - > grpc_slice_split_tail ( <nl> & slice_ , GPR_SLICE_LENGTH ( slice_ ) - count ) ; <nl> - g_core_codegen_interface - > gpr_slice_buffer_add ( slice_buffer_ , slice_ ) ; <nl> + g_core_codegen_interface - > grpc_slice_buffer_add ( slice_buffer_ , slice_ ) ; <nl> } <nl> have_backup_ = true ; <nl> byte_count_ - = count ; <nl> class GrpcBufferWriter GRPC_FINAL <nl> private : <nl> const int block_size_ ; <nl> int64_t byte_count_ ; <nl> - gpr_slice_buffer * slice_buffer_ ; <nl> + grpc_slice_buffer * slice_buffer_ ; <nl> bool have_backup_ ; <nl> - gpr_slice backup_slice_ ; <nl> - gpr_slice slice_ ; <nl> + grpc_slice backup_slice_ ; <nl> + grpc_slice slice_ ; <nl> } ; <nl> <nl> class GrpcBufferReader GRPC_FINAL <nl> class GrpcBufferReader GRPC_FINAL <nl> & slice_ ) ) { <nl> return false ; <nl> } <nl> - g_core_codegen_interface - > gpr_slice_unref ( slice_ ) ; <nl> + g_core_codegen_interface - > grpc_slice_unref ( slice_ ) ; <nl> * data = GPR_SLICE_START_PTR ( slice_ ) ; <nl> / / On win x64 , int is only 32bit <nl> GPR_CODEGEN_ASSERT ( GPR_SLICE_LENGTH ( slice_ ) < = INT_MAX ) ; <nl> class GrpcBufferReader GRPC_FINAL <nl> int64_t byte_count_ ; <nl> int64_t backup_count_ ; <nl> grpc_byte_buffer_reader reader_ ; <nl> - gpr_slice slice_ ; <nl> + grpc_slice slice_ ; <nl> Status status_ ; <nl> } ; <nl> } / / namespace internal <nl> class SerializationTraits < T , typename std : : enable_if < std : : is_base_of < <nl> * own_buffer = true ; <nl> int byte_size = msg . ByteSize ( ) ; <nl> if ( byte_size < = internal : : kGrpcBufferWriterMaxBufferLength ) { <nl> - gpr_slice slice = g_core_codegen_interface - > gpr_slice_malloc ( byte_size ) ; <nl> + grpc_slice slice = g_core_codegen_interface - > grpc_slice_malloc ( byte_size ) ; <nl> GPR_CODEGEN_ASSERT ( <nl> GPR_SLICE_END_PTR ( slice ) = = <nl> msg . SerializeWithCachedSizesToArray ( GPR_SLICE_START_PTR ( slice ) ) ) ; <nl> * bp = g_core_codegen_interface - > grpc_raw_byte_buffer_create ( & slice , 1 ) ; <nl> - g_core_codegen_interface - > gpr_slice_unref ( slice ) ; <nl> + g_core_codegen_interface - > grpc_slice_unref ( slice ) ; <nl> return g_core_codegen_interface - > ok ( ) ; <nl> } else { <nl> internal : : GrpcBufferWriter writer ( <nl> mmm a / include / grpc + + / impl / codegen / thrift_serializer . h <nl> ppp b / include / grpc + + / impl / codegen / thrift_serializer . h <nl> class ThriftSerializer { <nl> <nl> Serialize ( fields , & byte_buffer , & byte_buffer_size ) ; <nl> <nl> - gpr_slice slice = gpr_slice_from_copied_buffer ( <nl> + grpc_slice slice = grpc_slice_from_copied_buffer ( <nl> reinterpret_cast < const char * > ( byte_buffer ) , byte_buffer_size ) ; <nl> <nl> * bp = grpc_raw_byte_buffer_create ( & slice , 1 ) ; <nl> <nl> - gpr_slice_unref ( slice ) ; <nl> + grpc_slice_unref ( slice ) ; <nl> } <nl> <nl> / / Deserialize the passed char array into the passed type , returns the number <nl> class ThriftSerializer { <nl> grpc_byte_buffer_reader reader ; <nl> grpc_byte_buffer_reader_init ( & reader , buffer ) ; <nl> <nl> - gpr_slice slice = grpc_byte_buffer_reader_readall ( & reader ) ; <nl> + grpc_slice slice = grpc_byte_buffer_reader_readall ( & reader ) ; <nl> <nl> uint32_t len = <nl> Deserialize ( GPR_SLICE_START_PTR ( slice ) , GPR_SLICE_LENGTH ( slice ) , msg ) ; <nl> <nl> - gpr_slice_unref ( slice ) ; <nl> + grpc_slice_unref ( slice ) ; <nl> <nl> grpc_byte_buffer_reader_destroy ( & reader ) ; <nl> <nl> mmm a / include / grpc + + / support / slice . h <nl> ppp b / include / grpc + + / support / slice . h <nl> <nl> <nl> namespace grpc { <nl> <nl> - / / / A wrapper around \ a gpr_slice . <nl> + / / / A wrapper around \ a grpc_slice . <nl> / / / <nl> / / / A slice represents a contiguous reference counted array of bytes . <nl> / / / It is cheap to take references to a slice , and it is cheap to create a <nl> class Slice GRPC_FINAL { <nl> <nl> enum AddRef { ADD_REF } ; <nl> / / / Construct a slice from \ a slice , adding a reference . <nl> - Slice ( gpr_slice slice , AddRef ) ; <nl> + Slice ( grpc_slice slice , AddRef ) ; <nl> <nl> enum StealRef { STEAL_REF } ; <nl> / / / Construct a slice from \ a slice , stealing a reference . <nl> - Slice ( gpr_slice slice , StealRef ) ; <nl> + Slice ( grpc_slice slice , StealRef ) ; <nl> <nl> / / / Copy constructor , adds a reference . <nl> Slice ( const Slice & other ) ; <nl> class Slice GRPC_FINAL { <nl> / / / Raw pointer to the end ( one byte \ em past the last element ) of the slice . <nl> const uint8_t * end ( ) const { return GPR_SLICE_END_PTR ( slice_ ) ; } <nl> <nl> - / / / Raw C slice . Caller needs to call gpr_slice_unref when done . <nl> - gpr_slice c_slice ( ) const { return gpr_slice_ref ( slice_ ) ; } <nl> + / / / Raw C slice . Caller needs to call grpc_slice_unref when done . <nl> + grpc_slice c_slice ( ) const { return grpc_slice_ref ( slice_ ) ; } <nl> <nl> private : <nl> friend class ByteBuffer ; <nl> <nl> - gpr_slice slice_ ; <nl> + grpc_slice slice_ ; <nl> } ; <nl> <nl> } / / namespace grpc <nl> mmm a / include / grpc / byte_buffer . h <nl> ppp b / include / grpc / byte_buffer . h <nl> extern " C " { <nl> * <nl> * Increases the reference count for all \ a slices processed . The user is <nl> * responsible for invoking grpc_byte_buffer_destroy on the returned instance . * / <nl> - GRPCAPI grpc_byte_buffer * grpc_raw_byte_buffer_create ( gpr_slice * slices , <nl> + GRPCAPI grpc_byte_buffer * grpc_raw_byte_buffer_create ( grpc_slice * slices , <nl> size_t nslices ) ; <nl> <nl> / * * Returns a * compressed * RAW byte buffer instance over the given slices ( up to <nl> GRPCAPI grpc_byte_buffer * grpc_raw_byte_buffer_create ( gpr_slice * slices , <nl> * Increases the reference count for all \ a slices processed . The user is <nl> * responsible for invoking grpc_byte_buffer_destroy on the returned instance . * / <nl> GRPCAPI grpc_byte_buffer * grpc_raw_compressed_byte_buffer_create ( <nl> - gpr_slice * slices , size_t nslices , grpc_compression_algorithm compression ) ; <nl> + grpc_slice * slices , size_t nslices , grpc_compression_algorithm compression ) ; <nl> <nl> / * * Copies input byte buffer \ a bb . <nl> * <nl> GRPCAPI void grpc_byte_buffer_reader_destroy ( grpc_byte_buffer_reader * reader ) ; <nl> <nl> / * * Updates \ a slice with the next piece of data from from \ a reader and returns <nl> * 1 . Returns 0 at the end of the stream . Caller is responsible for calling <nl> - * gpr_slice_unref on the result . * / <nl> + * grpc_slice_unref on the result . * / <nl> GRPCAPI int grpc_byte_buffer_reader_next ( grpc_byte_buffer_reader * reader , <nl> - gpr_slice * slice ) ; <nl> + grpc_slice * slice ) ; <nl> <nl> / * * Merge all data from \ a reader into single slice * / <nl> - GRPCAPI gpr_slice <nl> + GRPCAPI grpc_slice <nl> grpc_byte_buffer_reader_readall ( grpc_byte_buffer_reader * reader ) ; <nl> <nl> / * * Returns a RAW byte buffer instance from the output of \ a reader . * / <nl> mmm a / include / grpc / impl / codegen / gpr_types . h <nl> ppp b / include / grpc / impl / codegen / gpr_types . h <nl> typedef struct gpr_timespec { <nl> gpr_clock_type clock_type ; <nl> } gpr_timespec ; <nl> <nl> - / * Slice API <nl> - <nl> - A slice represents a contiguous reference counted array of bytes . <nl> - It is cheap to take references to a slice , and it is cheap to create a <nl> - slice pointing to a subset of another slice . <nl> - <nl> - The data - structure for slices is exposed here to allow non - gpr code to <nl> - build slices from whatever data they have available . <nl> - <nl> - When defining interfaces that handle slices , care should be taken to define <nl> - reference ownership semantics ( who should call unref ? ) and mutability <nl> - constraints ( is the callee allowed to modify the slice ? ) * / <nl> - <nl> - / * Reference count container for gpr_slice . Contains function pointers to <nl> - increment and decrement reference counts . Implementations should cleanup <nl> - when the reference count drops to zero . <nl> - Typically client code should not touch this , and use gpr_slice_malloc , <nl> - gpr_slice_new , or gpr_slice_new_with_len instead . * / <nl> - typedef struct gpr_slice_refcount { <nl> - void ( * ref ) ( void * ) ; <nl> - void ( * unref ) ( void * ) ; <nl> - } gpr_slice_refcount ; <nl> - <nl> - # define GPR_SLICE_INLINED_SIZE ( sizeof ( size_t ) + sizeof ( uint8_t * ) - 1 ) <nl> - <nl> - / * A gpr_slice s , if initialized , represents the byte range <nl> - s . bytes [ 0 . . s . length - 1 ] . <nl> - <nl> - It can have an associated ref count which has a destruction routine to be run <nl> - when the ref count reaches zero ( see gpr_slice_new ( ) and grp_slice_unref ( ) ) . <nl> - Multiple gpr_slice values may share a ref count . <nl> - <nl> - If the slice does not have a refcount , it represents an inlined small piece <nl> - of data that is copied by value . * / <nl> - typedef struct gpr_slice { <nl> - struct gpr_slice_refcount * refcount ; <nl> - union { <nl> - struct { <nl> - uint8_t * bytes ; <nl> - size_t length ; <nl> - } refcounted ; <nl> - struct { <nl> - uint8_t length ; <nl> - uint8_t bytes [ GPR_SLICE_INLINED_SIZE ] ; <nl> - } inlined ; <nl> - } data ; <nl> - } gpr_slice ; <nl> - <nl> - # define GRPC_SLICE_BUFFER_INLINE_ELEMENTS 8 <nl> - <nl> - / * Represents an expandable array of slices , to be interpreted as a <nl> - single item . * / <nl> - typedef struct { <nl> - / * slices in the array * / <nl> - gpr_slice * slices ; <nl> - / * the number of slices in the array * / <nl> - size_t count ; <nl> - / * the number of slices allocated in the array * / <nl> - size_t capacity ; <nl> - / * the combined length of all slices in the array * / <nl> - size_t length ; <nl> - / * inlined elements to avoid allocations * / <nl> - gpr_slice inlined [ GRPC_SLICE_BUFFER_INLINE_ELEMENTS ] ; <nl> - } gpr_slice_buffer ; <nl> - <nl> # ifdef __cplusplus <nl> } <nl> # endif <nl> mmm a / include / grpc / impl / codegen / grpc_types . h <nl> ppp b / include / grpc / impl / codegen / grpc_types . h <nl> <nl> # define GRPC_IMPL_CODEGEN_GRPC_TYPES_H <nl> <nl> # include < grpc / impl / codegen / gpr_types . h > <nl> + # include < grpc / impl / codegen / slice . h > <nl> <nl> # include < grpc / impl / codegen / compression_types . h > <nl> # include < grpc / impl / codegen / status . h > <nl> typedef struct grpc_byte_buffer { <nl> } reserved ; <nl> struct { <nl> grpc_compression_algorithm compression ; <nl> - gpr_slice_buffer slice_buffer ; <nl> + grpc_slice_buffer slice_buffer ; <nl> } raw ; <nl> } data ; <nl> } grpc_byte_buffer ; <nl> mmm a / include / grpc / impl / codegen / slice . h <nl> ppp b / include / grpc / impl / codegen / slice . h <nl> <nl> # define GRPC_IMPL_CODEGEN_SLICE_H <nl> <nl> # include < stddef . h > <nl> + # include < stdint . h > <nl> + <nl> + / * Slice API <nl> + <nl> + A slice represents a contiguous reference counted array of bytes . <nl> + It is cheap to take references to a slice , and it is cheap to create a <nl> + slice pointing to a subset of another slice . <nl> + <nl> + The data - structure for slices is exposed here to allow non - gpr code to <nl> + build slices from whatever data they have available . <nl> + <nl> + When defining interfaces that handle slices , care should be taken to define <nl> + reference ownership semantics ( who should call unref ? ) and mutability <nl> + constraints ( is the callee allowed to modify the slice ? ) * / <nl> + <nl> + / * Reference count container for grpc_slice . Contains function pointers to <nl> + increment and decrement reference counts . Implementations should cleanup <nl> + when the reference count drops to zero . <nl> + Typically client code should not touch this , and use grpc_slice_malloc , <nl> + grpc_slice_new , or grpc_slice_new_with_len instead . * / <nl> + typedef struct grpc_slice_refcount { <nl> + void ( * ref ) ( void * ) ; <nl> + void ( * unref ) ( void * ) ; <nl> + } grpc_slice_refcount ; <nl> + <nl> + # define GPR_SLICE_INLINED_SIZE ( sizeof ( size_t ) + sizeof ( uint8_t * ) - 1 ) <nl> + <nl> + / * A grpc_slice s , if initialized , represents the byte range <nl> + s . bytes [ 0 . . s . length - 1 ] . <nl> + <nl> + It can have an associated ref count which has a destruction routine to be run <nl> + when the ref count reaches zero ( see grpc_slice_new ( ) and grp_slice_unref ( ) ) . <nl> + Multiple grpc_slice values may share a ref count . <nl> + <nl> + If the slice does not have a refcount , it represents an inlined small piece <nl> + of data that is copied by value . * / <nl> + typedef struct grpc_slice { <nl> + struct grpc_slice_refcount * refcount ; <nl> + union { <nl> + struct { <nl> + uint8_t * bytes ; <nl> + size_t length ; <nl> + } refcounted ; <nl> + struct { <nl> + uint8_t length ; <nl> + uint8_t bytes [ GPR_SLICE_INLINED_SIZE ] ; <nl> + } inlined ; <nl> + } data ; <nl> + } grpc_slice ; <nl> + <nl> + # define GRPC_SLICE_BUFFER_INLINE_ELEMENTS 8 <nl> + <nl> + / * Represents an expandable array of slices , to be interpreted as a <nl> + single item . * / <nl> + typedef struct { <nl> + / * slices in the array * / <nl> + grpc_slice * slices ; <nl> + / * the number of slices in the array * / <nl> + size_t count ; <nl> + / * the number of slices allocated in the array * / <nl> + size_t capacity ; <nl> + / * the combined length of all slices in the array * / <nl> + size_t length ; <nl> + / * inlined elements to avoid allocations * / <nl> + grpc_slice inlined [ GRPC_SLICE_BUFFER_INLINE_ELEMENTS ] ; <nl> + } grpc_slice_buffer ; <nl> <nl> # define GPR_SLICE_START_PTR ( slice ) \ <nl> ( ( slice ) . refcount ? ( slice ) . data . refcounted . bytes \ <nl> similarity index 67 % <nl> rename from include / grpc / support / slice . h <nl> rename to include / grpc / slice . h <nl> mmm a / include / grpc / support / slice . h <nl> ppp b / include / grpc / slice . h <nl> extern " C " { <nl> <nl> / * Increment the refcount of s . Requires slice is initialized . <nl> Returns s . * / <nl> - GPRAPI gpr_slice gpr_slice_ref ( gpr_slice s ) ; <nl> + GPRAPI grpc_slice grpc_slice_ref ( grpc_slice s ) ; <nl> <nl> / * Decrement the ref count of s . If the ref count of s reaches zero , all <nl> slices sharing the ref count are destroyed , and considered no longer <nl> - initialized . If s is ultimately derived from a call to gpr_slice_new ( start , <nl> + initialized . If s is ultimately derived from a call to grpc_slice_new ( start , <nl> len , dest ) where dest ! = NULL , then ( * dest ) ( start ) is called , else if s is <nl> - ultimately derived from a call to gpr_slice_new_with_len ( start , len , dest ) <nl> + ultimately derived from a call to grpc_slice_new_with_len ( start , len , dest ) <nl> where dest ! = NULL , then ( * dest ) ( start , len ) . Requires s initialized . * / <nl> - GPRAPI void gpr_slice_unref ( gpr_slice s ) ; <nl> + GPRAPI void grpc_slice_unref ( grpc_slice s ) ; <nl> <nl> / * Create a slice pointing at some data . Calls malloc to allocate a refcount <nl> for the object , and arranges that destroy will be called with the pointer <nl> passed in at destruction . * / <nl> - GPRAPI gpr_slice gpr_slice_new ( void * p , size_t len , void ( * destroy ) ( void * ) ) ; <nl> + GPRAPI grpc_slice grpc_slice_new ( void * p , size_t len , void ( * destroy ) ( void * ) ) ; <nl> <nl> - / * Equivalent to gpr_slice_new , but with a separate pointer that is <nl> + / * Equivalent to grpc_slice_new , but with a separate pointer that is <nl> passed to the destroy function . This function can be useful when <nl> the data is part of a larger structure that must be destroyed when <nl> the data is no longer needed . * / <nl> - GPRAPI gpr_slice gpr_slice_new_with_user_data ( void * p , size_t len , <nl> - void ( * destroy ) ( void * ) , <nl> - void * user_data ) ; <nl> + GPRAPI grpc_slice grpc_slice_new_with_user_data ( void * p , size_t len , <nl> + void ( * destroy ) ( void * ) , <nl> + void * user_data ) ; <nl> <nl> - / * Equivalent to gpr_slice_new , but with a two argument destroy function that <nl> + / * Equivalent to grpc_slice_new , but with a two argument destroy function that <nl> also takes the slice length . * / <nl> - GPRAPI gpr_slice gpr_slice_new_with_len ( void * p , size_t len , <nl> - void ( * destroy ) ( void * , size_t ) ) ; <nl> + GPRAPI grpc_slice grpc_slice_new_with_len ( void * p , size_t len , <nl> + void ( * destroy ) ( void * , size_t ) ) ; <nl> <nl> - / * Equivalent to gpr_slice_new ( malloc ( len ) , len , free ) , but saves one malloc ( ) <nl> + / * Equivalent to grpc_slice_new ( malloc ( len ) , len , free ) , but saves one malloc ( ) <nl> call . <nl> Aborts if malloc ( ) fails . * / <nl> - GPRAPI gpr_slice gpr_slice_malloc ( size_t length ) ; <nl> + GPRAPI grpc_slice grpc_slice_malloc ( size_t length ) ; <nl> <nl> / * Create a slice by copying a string . <nl> Does not preserve null terminators . <nl> Equivalent to : <nl> size_t len = strlen ( source ) ; <nl> - gpr_slice slice = gpr_slice_malloc ( len ) ; <nl> + grpc_slice slice = grpc_slice_malloc ( len ) ; <nl> memcpy ( slice - > data , source , len ) ; * / <nl> - GPRAPI gpr_slice gpr_slice_from_copied_string ( const char * source ) ; <nl> + GPRAPI grpc_slice grpc_slice_from_copied_string ( const char * source ) ; <nl> <nl> / * Create a slice by copying a buffer . <nl> Equivalent to : <nl> - gpr_slice slice = gpr_slice_malloc ( len ) ; <nl> + grpc_slice slice = grpc_slice_malloc ( len ) ; <nl> memcpy ( slice - > data , source , len ) ; * / <nl> - GPRAPI gpr_slice gpr_slice_from_copied_buffer ( const char * source , size_t len ) ; <nl> + GPRAPI grpc_slice grpc_slice_from_copied_buffer ( const char * source , size_t len ) ; <nl> <nl> / * Create a slice pointing to constant memory * / <nl> - GPRAPI gpr_slice gpr_slice_from_static_string ( const char * source ) ; <nl> + GPRAPI grpc_slice grpc_slice_from_static_string ( const char * source ) ; <nl> <nl> / * Return a result slice derived from s , which shares a ref count with s , where <nl> result . data = = s . data + begin , and result . length = = end - begin . <nl> The ref count of s is increased by one . <nl> Requires s initialized , begin < = end , begin < = s . length , and <nl> end < = source - > length . * / <nl> - GPRAPI gpr_slice gpr_slice_sub ( gpr_slice s , size_t begin , size_t end ) ; <nl> + GPRAPI grpc_slice grpc_slice_sub ( grpc_slice s , size_t begin , size_t end ) ; <nl> <nl> - / * The same as gpr_slice_sub , but without altering the ref count * / <nl> - GPRAPI gpr_slice gpr_slice_sub_no_ref ( gpr_slice s , size_t begin , size_t end ) ; <nl> + / * The same as grpc_slice_sub , but without altering the ref count * / <nl> + GPRAPI grpc_slice grpc_slice_sub_no_ref ( grpc_slice s , size_t begin , size_t end ) ; <nl> <nl> / * Splits s into two : modifies s to be s [ 0 : split ] , and returns a new slice , <nl> sharing a refcount with s , that contains s [ split : s . length ] . <nl> Requires s intialized , split < = s . length * / <nl> - GPRAPI gpr_slice gpr_slice_split_tail ( gpr_slice * s , size_t split ) ; <nl> + GPRAPI grpc_slice grpc_slice_split_tail ( grpc_slice * s , size_t split ) ; <nl> <nl> / * Splits s into two : modifies s to be s [ split : s . length ] , and returns a new <nl> slice , sharing a refcount with s , that contains s [ 0 : split ] . <nl> Requires s intialized , split < = s . length * / <nl> - GPRAPI gpr_slice gpr_slice_split_head ( gpr_slice * s , size_t split ) ; <nl> + GPRAPI grpc_slice grpc_slice_split_head ( grpc_slice * s , size_t split ) ; <nl> <nl> - GPRAPI gpr_slice gpr_empty_slice ( void ) ; <nl> + GPRAPI grpc_slice gpr_empty_slice ( void ) ; <nl> <nl> / * Returns < 0 if a < b , = = 0 if a = = b , > 0 if a > b <nl> The order is arbitrary , and is not guaranteed to be stable across different <nl> versions of the API . * / <nl> - GPRAPI int gpr_slice_cmp ( gpr_slice a , gpr_slice b ) ; <nl> - GPRAPI int gpr_slice_str_cmp ( gpr_slice a , const char * b ) ; <nl> + GPRAPI int grpc_slice_cmp ( grpc_slice a , grpc_slice b ) ; <nl> + GPRAPI int grpc_slice_str_cmp ( grpc_slice a , const char * b ) ; <nl> <nl> # ifdef __cplusplus <nl> } <nl> similarity index 72 % <nl> rename from include / grpc / support / slice_buffer . h <nl> rename to include / grpc / slice_buffer . h <nl> mmm a / include / grpc / support / slice_buffer . h <nl> ppp b / include / grpc / slice_buffer . h <nl> extern " C " { <nl> # endif <nl> <nl> / * initialize a slice buffer * / <nl> - GPRAPI void gpr_slice_buffer_init ( gpr_slice_buffer * sb ) ; <nl> + GPRAPI void grpc_slice_buffer_init ( grpc_slice_buffer * sb ) ; <nl> / * destroy a slice buffer - unrefs any held elements * / <nl> - GPRAPI void gpr_slice_buffer_destroy ( gpr_slice_buffer * sb ) ; <nl> + GPRAPI void grpc_slice_buffer_destroy ( grpc_slice_buffer * sb ) ; <nl> / * Add an element to a slice buffer - takes ownership of the slice . <nl> This function is allowed to concatenate the passed in slice to the end of <nl> some other slice if desired by the slice buffer . * / <nl> - GPRAPI void gpr_slice_buffer_add ( gpr_slice_buffer * sb , gpr_slice slice ) ; <nl> + GPRAPI void grpc_slice_buffer_add ( grpc_slice_buffer * sb , grpc_slice slice ) ; <nl> / * add an element to a slice buffer - takes ownership of the slice and returns <nl> the index of the slice . <nl> Guarantees that the slice will not be concatenated at the end of another <nl> GPRAPI void gpr_slice_buffer_add ( gpr_slice_buffer * sb , gpr_slice slice ) ; <nl> slice at the returned index in sb - > slices ) <nl> The implementation MAY decide to concatenate data at the end of a small <nl> slice added in this fashion . * / <nl> - GPRAPI size_t gpr_slice_buffer_add_indexed ( gpr_slice_buffer * sb , <nl> - gpr_slice slice ) ; <nl> - GPRAPI void gpr_slice_buffer_addn ( gpr_slice_buffer * sb , gpr_slice * slices , <nl> + GPRAPI size_t grpc_slice_buffer_add_indexed ( grpc_slice_buffer * sb , <nl> + grpc_slice slice ) ; <nl> + GPRAPI void grpc_slice_buffer_addn ( grpc_slice_buffer * sb , grpc_slice * slices , <nl> size_t n ) ; <nl> / * add a very small ( less than 8 bytes ) amount of data to the end of a slice <nl> buffer : returns a pointer into which to add the data * / <nl> - GPRAPI uint8_t * gpr_slice_buffer_tiny_add ( gpr_slice_buffer * sb , size_t len ) ; <nl> + GPRAPI uint8_t * grpc_slice_buffer_tiny_add ( grpc_slice_buffer * sb , size_t len ) ; <nl> / * pop the last buffer , but don ' t unref it * / <nl> - GPRAPI void gpr_slice_buffer_pop ( gpr_slice_buffer * sb ) ; <nl> + GPRAPI void grpc_slice_buffer_pop ( grpc_slice_buffer * sb ) ; <nl> / * clear a slice buffer , unref all elements * / <nl> - GPRAPI void gpr_slice_buffer_reset_and_unref ( gpr_slice_buffer * sb ) ; <nl> + GPRAPI void grpc_slice_buffer_reset_and_unref ( grpc_slice_buffer * sb ) ; <nl> / * swap the contents of two slice buffers * / <nl> - GPRAPI void gpr_slice_buffer_swap ( gpr_slice_buffer * a , gpr_slice_buffer * b ) ; <nl> + GPRAPI void grpc_slice_buffer_swap ( grpc_slice_buffer * a , grpc_slice_buffer * b ) ; <nl> / * move all of the elements of src into dst * / <nl> - GPRAPI void gpr_slice_buffer_move_into ( gpr_slice_buffer * src , <nl> - gpr_slice_buffer * dst ) ; <nl> + GPRAPI void grpc_slice_buffer_move_into ( grpc_slice_buffer * src , <nl> + grpc_slice_buffer * dst ) ; <nl> / * remove n bytes from the end of a slice buffer * / <nl> - GPRAPI void gpr_slice_buffer_trim_end ( gpr_slice_buffer * src , size_t n , <nl> - gpr_slice_buffer * garbage ) ; <nl> + GPRAPI void grpc_slice_buffer_trim_end ( grpc_slice_buffer * src , size_t n , <nl> + grpc_slice_buffer * garbage ) ; <nl> / * move the first n bytes of src into dst * / <nl> - GPRAPI void gpr_slice_buffer_move_first ( gpr_slice_buffer * src , size_t n , <nl> - gpr_slice_buffer * dst ) ; <nl> + GPRAPI void grpc_slice_buffer_move_first ( grpc_slice_buffer * src , size_t n , <nl> + grpc_slice_buffer * dst ) ; <nl> / * take the first slice in the slice buffer * / <nl> - GPRAPI gpr_slice gpr_slice_buffer_take_first ( gpr_slice_buffer * src ) ; <nl> + GPRAPI grpc_slice grpc_slice_buffer_take_first ( grpc_slice_buffer * src ) ; <nl> <nl> # ifdef __cplusplus <nl> } <nl> mmm a / src / core / ext / client_channel / connector . h <nl> ppp b / src / core / ext / client_channel / connector . h <nl> typedef struct { <nl> const struct sockaddr * addr ; <nl> size_t addr_len ; <nl> / * * initial connect string to send * / <nl> - gpr_slice initial_connect_string ; <nl> + grpc_slice initial_connect_string ; <nl> / * * deadline for connection * / <nl> gpr_timespec deadline ; <nl> / * * channel arguments ( to be passed to transport ) * / <nl> mmm a / src / core / ext / client_channel / default_initial_connect_string . c <nl> ppp b / src / core / ext / client_channel / default_initial_connect_string . c <nl> <nl> <nl> void grpc_set_default_initial_connect_string ( struct sockaddr * * addr , <nl> size_t * addr_len , <nl> - gpr_slice * initial_str ) { } <nl> + grpc_slice * initial_str ) { } <nl> mmm a / src / core / ext / client_channel / http_connect_handshaker . c <nl> ppp b / src / core / ext / client_channel / http_connect_handshaker . c <nl> typedef struct http_connect_handshaker { <nl> void * user_data ; <nl> <nl> / / Objects for processing the HTTP CONNECT request and response . <nl> - gpr_slice_buffer write_buffer ; <nl> - gpr_slice_buffer * read_buffer ; / / Ownership passes through this object . <nl> + grpc_slice_buffer write_buffer ; <nl> + grpc_slice_buffer * read_buffer ; / / Ownership passes through this object . <nl> grpc_closure request_done_closure ; <nl> grpc_closure response_read_closure ; <nl> grpc_http_parser http_parser ; <nl> static void http_connect_handshaker_unref ( http_connect_handshaker * handshaker ) { <nl> if ( gpr_unref ( & handshaker - > refcount ) ) { <nl> gpr_free ( handshaker - > proxy_server ) ; <nl> gpr_free ( handshaker - > server_name ) ; <nl> - gpr_slice_buffer_destroy ( & handshaker - > write_buffer ) ; <nl> + grpc_slice_buffer_destroy ( & handshaker - > write_buffer ) ; <nl> grpc_http_parser_destroy ( & handshaker - > http_parser ) ; <nl> grpc_http_response_destroy ( & handshaker - > http_response ) ; <nl> gpr_free ( handshaker ) ; <nl> static void on_read_done ( grpc_exec_ctx * exec_ctx , void * arg , <nl> grpc_timer_cancel ( exec_ctx , & handshaker - > timeout_timer ) ; <nl> / / Remove the data we ' ve already read from the read buffer , <nl> / / leaving only the leftover bytes ( if any ) . <nl> - gpr_slice_buffer tmp_buffer ; <nl> - gpr_slice_buffer_init ( & tmp_buffer ) ; <nl> + grpc_slice_buffer tmp_buffer ; <nl> + grpc_slice_buffer_init ( & tmp_buffer ) ; <nl> if ( body_start_offset < <nl> GPR_SLICE_LENGTH ( handshaker - > read_buffer - > slices [ i ] ) ) { <nl> - gpr_slice_buffer_add ( <nl> + grpc_slice_buffer_add ( <nl> & tmp_buffer , <nl> - gpr_slice_split_tail ( & handshaker - > read_buffer - > slices [ i ] , <nl> + grpc_slice_split_tail ( & handshaker - > read_buffer - > slices [ i ] , <nl> body_start_offset ) ) ; <nl> } <nl> - gpr_slice_buffer_addn ( & tmp_buffer , <nl> + grpc_slice_buffer_addn ( & tmp_buffer , <nl> & handshaker - > read_buffer - > slices [ i + 1 ] , <nl> handshaker - > read_buffer - > count - i - 1 ) ; <nl> - gpr_slice_buffer_swap ( handshaker - > read_buffer , & tmp_buffer ) ; <nl> - gpr_slice_buffer_destroy ( & tmp_buffer ) ; <nl> + grpc_slice_buffer_swap ( handshaker - > read_buffer , & tmp_buffer ) ; <nl> + grpc_slice_buffer_destroy ( & tmp_buffer ) ; <nl> break ; <nl> } <nl> } <nl> static void on_read_done ( grpc_exec_ctx * exec_ctx , void * arg , <nl> / / complete ( e . g . , handling chunked transfer encoding or looking <nl> / / at the Content - Length : header ) . <nl> if ( handshaker - > http_parser . state ! = GRPC_HTTP_BODY ) { <nl> - gpr_slice_buffer_reset_and_unref ( handshaker - > read_buffer ) ; <nl> + grpc_slice_buffer_reset_and_unref ( handshaker - > read_buffer ) ; <nl> grpc_endpoint_read ( exec_ctx , handshaker - > endpoint , handshaker - > read_buffer , <nl> & handshaker - > response_read_closure ) ; <nl> return ; <nl> static void http_connect_handshaker_shutdown ( grpc_exec_ctx * exec_ctx , <nl> static void http_connect_handshaker_do_handshake ( <nl> grpc_exec_ctx * exec_ctx , grpc_handshaker * handshaker_in , <nl> grpc_endpoint * endpoint , grpc_channel_args * args , <nl> - gpr_slice_buffer * read_buffer , gpr_timespec deadline , <nl> + grpc_slice_buffer * read_buffer , gpr_timespec deadline , <nl> grpc_tcp_server_acceptor * acceptor , grpc_handshaker_done_cb cb , <nl> void * user_data ) { <nl> http_connect_handshaker * handshaker = ( http_connect_handshaker * ) handshaker_in ; <nl> static void http_connect_handshaker_do_handshake ( <nl> request . http . method = " CONNECT " ; <nl> request . http . path = handshaker - > server_name ; <nl> request . handshaker = & grpc_httpcli_plaintext ; <nl> - gpr_slice request_slice = grpc_httpcli_format_connect_request ( & request ) ; <nl> - gpr_slice_buffer_add ( & handshaker - > write_buffer , request_slice ) ; <nl> + grpc_slice request_slice = grpc_httpcli_format_connect_request ( & request ) ; <nl> + grpc_slice_buffer_add ( & handshaker - > write_buffer , request_slice ) ; <nl> grpc_endpoint_write ( exec_ctx , endpoint , & handshaker - > write_buffer , <nl> & handshaker - > request_done_closure ) ; <nl> / / Set timeout timer . The timer gets a reference to the handshaker . <nl> grpc_handshaker * grpc_http_connect_handshaker_create ( const char * proxy_server , <nl> grpc_handshaker_init ( & http_connect_handshaker_vtable , & handshaker - > base ) ; <nl> handshaker - > proxy_server = gpr_strdup ( proxy_server ) ; <nl> handshaker - > server_name = gpr_strdup ( server_name ) ; <nl> - gpr_slice_buffer_init ( & handshaker - > write_buffer ) ; <nl> + grpc_slice_buffer_init ( & handshaker - > write_buffer ) ; <nl> grpc_closure_init ( & handshaker - > request_done_closure , on_write_done , <nl> handshaker ) ; <nl> grpc_closure_init ( & handshaker - > response_read_closure , on_read_done , <nl> mmm a / src / core / ext / client_channel / initial_connect_string . c <nl> ppp b / src / core / ext / client_channel / initial_connect_string . c <nl> <nl> <nl> extern void grpc_set_default_initial_connect_string ( struct sockaddr * * addr , <nl> size_t * addr_len , <nl> - gpr_slice * initial_str ) ; <nl> + grpc_slice * initial_str ) ; <nl> <nl> static grpc_set_initial_connect_string_func g_set_initial_connect_string_func = <nl> grpc_set_default_initial_connect_string ; <nl> void grpc_test_set_initial_connect_string_function ( <nl> } <nl> <nl> void grpc_set_initial_connect_string ( struct sockaddr * * addr , size_t * addr_len , <nl> - gpr_slice * initial_str ) { <nl> + grpc_slice * initial_str ) { <nl> g_set_initial_connect_string_func ( addr , addr_len , initial_str ) ; <nl> } <nl> mmm a / src / core / ext / client_channel / initial_connect_string . h <nl> ppp b / src / core / ext / client_channel / initial_connect_string . h <nl> <nl> <nl> typedef void ( * grpc_set_initial_connect_string_func ) ( struct sockaddr * * addr , <nl> size_t * addr_len , <nl> - gpr_slice * initial_str ) ; <nl> + grpc_slice * initial_str ) ; <nl> void grpc_test_set_initial_connect_string_function ( <nl> grpc_set_initial_connect_string_func func ) ; <nl> <nl> / * * Set a string to be sent once connected . Optionally reset addr . * / <nl> void grpc_set_initial_connect_string ( struct sockaddr * * addr , size_t * addr_len , <nl> - gpr_slice * connect_string ) ; <nl> + grpc_slice * connect_string ) ; <nl> <nl> # endif / * GRPC_CORE_EXT_CLIENT_CHANNEL_INITIAL_CONNECT_STRING_H * / <nl> mmm a / src / core / ext / client_channel / subchannel . c <nl> ppp b / src / core / ext / client_channel / subchannel . c <nl> struct grpc_subchannel { <nl> grpc_subchannel_key * key ; <nl> <nl> / * * initial string to send to peer * / <nl> - gpr_slice initial_connect_string ; <nl> + grpc_slice initial_connect_string ; <nl> <nl> / * * set during connection * / <nl> grpc_connect_out_args connecting_result ; <nl> static void subchannel_destroy ( grpc_exec_ctx * exec_ctx , void * arg , <nl> gpr_free ( ( void * ) c - > filters ) ; <nl> grpc_channel_args_destroy ( c - > args ) ; <nl> gpr_free ( c - > addr ) ; <nl> - gpr_slice_unref ( c - > initial_connect_string ) ; <nl> + grpc_slice_unref ( c - > initial_connect_string ) ; <nl> grpc_connectivity_state_destroy ( exec_ctx , & c - > state_tracker ) ; <nl> grpc_connector_unref ( exec_ctx , c - > connector ) ; <nl> grpc_pollset_set_destroy ( c - > pollset_set ) ; <nl> mmm a / src / core / ext / client_channel / uri_parser . c <nl> ppp b / src / core / ext / client_channel / uri_parser . c <nl> static void parse_query_parts ( grpc_uri * uri ) { <nl> uri - > num_query_parts = 0 ; <nl> return ; <nl> } <nl> - gpr_slice query_slice = <nl> - gpr_slice_new ( uri - > query , strlen ( uri - > query ) , do_nothing ) ; <nl> - gpr_slice_buffer query_parts ; / * the & - separated elements of the query * / <nl> - gpr_slice_buffer query_param_parts ; / * the = - separated subelements * / <nl> + grpc_slice query_slice = <nl> + grpc_slice_new ( uri - > query , strlen ( uri - > query ) , do_nothing ) ; <nl> + grpc_slice_buffer query_parts ; / * the & - separated elements of the query * / <nl> + grpc_slice_buffer query_param_parts ; / * the = - separated subelements * / <nl> <nl> - gpr_slice_buffer_init ( & query_parts ) ; <nl> - gpr_slice_buffer_init ( & query_param_parts ) ; <nl> + grpc_slice_buffer_init ( & query_parts ) ; <nl> + grpc_slice_buffer_init ( & query_param_parts ) ; <nl> <nl> - gpr_slice_split ( query_slice , QUERY_PARTS_SEPARATOR , & query_parts ) ; <nl> + grpc_slice_split ( query_slice , QUERY_PARTS_SEPARATOR , & query_parts ) ; <nl> uri - > query_parts = gpr_malloc ( query_parts . count * sizeof ( char * ) ) ; <nl> uri - > query_parts_values = gpr_malloc ( query_parts . count * sizeof ( char * ) ) ; <nl> uri - > num_query_parts = query_parts . count ; <nl> for ( size_t i = 0 ; i < query_parts . count ; i + + ) { <nl> - gpr_slice_split ( query_parts . slices [ i ] , QUERY_PARTS_VALUE_SEPARATOR , <nl> + grpc_slice_split ( query_parts . slices [ i ] , QUERY_PARTS_VALUE_SEPARATOR , <nl> & query_param_parts ) ; <nl> GPR_ASSERT ( query_param_parts . count > 0 ) ; <nl> uri - > query_parts [ i ] = <nl> static void parse_query_parts ( grpc_uri * uri ) { <nl> } else { <nl> uri - > query_parts_values [ i ] = NULL ; <nl> } <nl> - gpr_slice_buffer_reset_and_unref ( & query_param_parts ) ; <nl> + grpc_slice_buffer_reset_and_unref ( & query_param_parts ) ; <nl> } <nl> - gpr_slice_buffer_destroy ( & query_parts ) ; <nl> - gpr_slice_buffer_destroy ( & query_param_parts ) ; <nl> - gpr_slice_unref ( query_slice ) ; <nl> + grpc_slice_buffer_destroy ( & query_parts ) ; <nl> + grpc_slice_buffer_destroy ( & query_param_parts ) ; <nl> + grpc_slice_unref ( query_slice ) ; <nl> } <nl> <nl> grpc_uri * grpc_uri_parse ( const char * uri_text , int suppress_errors ) { <nl> mmm a / src / core / ext / lb_policy / grpclb / grpclb . c <nl> ppp b / src / core / ext / lb_policy / grpclb / grpclb . c <nl> static lb_client_data * lb_client_data_create ( glb_lb_policy * glb_policy ) { <nl> <nl> grpc_grpclb_request * request = <nl> grpc_grpclb_request_create ( glb_policy - > server_name ) ; <nl> - gpr_slice request_payload_slice = grpc_grpclb_request_encode ( request ) ; <nl> + grpc_slice request_payload_slice = grpc_grpclb_request_encode ( request ) ; <nl> lb_client - > request_payload = <nl> grpc_raw_byte_buffer_create ( & request_payload_slice , 1 ) ; <nl> - gpr_slice_unref ( request_payload_slice ) ; <nl> + grpc_slice_unref ( request_payload_slice ) ; <nl> grpc_grpclb_request_destroy ( request ) ; <nl> <nl> lb_client - > status_details = NULL ; <nl> static void res_recv_cb ( grpc_exec_ctx * exec_ctx , void * arg , grpc_error * error ) { <nl> * lb_client - > response_payload , for a serverlist . * / <nl> grpc_byte_buffer_reader bbr ; <nl> grpc_byte_buffer_reader_init ( & bbr , lb_client - > response_payload ) ; <nl> - gpr_slice response_slice = grpc_byte_buffer_reader_readall ( & bbr ) ; <nl> + grpc_slice response_slice = grpc_byte_buffer_reader_readall ( & bbr ) ; <nl> grpc_byte_buffer_destroy ( lb_client - > response_payload ) ; <nl> grpc_grpclb_serverlist * serverlist = <nl> grpc_grpclb_response_parse_serverlist ( response_slice ) ; <nl> if ( serverlist ! = NULL ) { <nl> - gpr_slice_unref ( response_slice ) ; <nl> + grpc_slice_unref ( response_slice ) ; <nl> if ( grpc_lb_glb_trace ) { <nl> gpr_log ( GPR_INFO , " Serverlist with % lu servers received " , <nl> ( unsigned long ) serverlist - > num_servers ) ; <nl> static void res_recv_cb ( grpc_exec_ctx * exec_ctx , void * arg , grpc_error * error ) { <nl> GPR_ASSERT ( serverlist = = NULL ) ; <nl> gpr_log ( GPR_ERROR , " Invalid LB response received : ' % s ' " , <nl> gpr_dump_slice ( response_slice , GPR_DUMP_ASCII ) ) ; <nl> - gpr_slice_unref ( response_slice ) ; <nl> + grpc_slice_unref ( response_slice ) ; <nl> <nl> / * Disconnect from server returning invalid response . * / <nl> op - > op = GRPC_OP_SEND_CLOSE_FROM_CLIENT ; <nl> mmm a / src / core / ext / lb_policy / grpclb / load_balancer_api . c <nl> ppp b / src / core / ext / lb_policy / grpclb / load_balancer_api . c <nl> grpc_grpclb_request * grpc_grpclb_request_create ( const char * lb_service_name ) { <nl> return req ; <nl> } <nl> <nl> - gpr_slice grpc_grpclb_request_encode ( const grpc_grpclb_request * request ) { <nl> + grpc_slice grpc_grpclb_request_encode ( const grpc_grpclb_request * request ) { <nl> size_t encoded_length ; <nl> pb_ostream_t sizestream ; <nl> pb_ostream_t outputstream ; <nl> - gpr_slice slice ; <nl> + grpc_slice slice ; <nl> memset ( & sizestream , 0 , sizeof ( pb_ostream_t ) ) ; <nl> pb_encode ( & sizestream , grpc_lb_v1_LoadBalanceRequest_fields , request ) ; <nl> encoded_length = sizestream . bytes_written ; <nl> <nl> - slice = gpr_slice_malloc ( encoded_length ) ; <nl> + slice = grpc_slice_malloc ( encoded_length ) ; <nl> outputstream = <nl> pb_ostream_from_buffer ( GPR_SLICE_START_PTR ( slice ) , encoded_length ) ; <nl> GPR_ASSERT ( pb_encode ( & outputstream , grpc_lb_v1_LoadBalanceRequest_fields , <nl> void grpc_grpclb_request_destroy ( grpc_grpclb_request * request ) { <nl> <nl> typedef grpc_lb_v1_LoadBalanceResponse grpc_grpclb_response ; <nl> grpc_grpclb_initial_response * grpc_grpclb_initial_response_parse ( <nl> - gpr_slice encoded_grpc_grpclb_response ) { <nl> + grpc_slice encoded_grpc_grpclb_response ) { <nl> pb_istream_t stream = <nl> pb_istream_from_buffer ( GPR_SLICE_START_PTR ( encoded_grpc_grpclb_response ) , <nl> GPR_SLICE_LENGTH ( encoded_grpc_grpclb_response ) ) ; <nl> grpc_grpclb_initial_response * grpc_grpclb_initial_response_parse ( <nl> } <nl> <nl> grpc_grpclb_serverlist * grpc_grpclb_response_parse_serverlist ( <nl> - gpr_slice encoded_grpc_grpclb_response ) { <nl> + grpc_slice encoded_grpc_grpclb_response ) { <nl> bool status ; <nl> decode_serverlist_arg arg ; <nl> pb_istream_t stream = <nl> mmm a / src / core / ext / lb_policy / grpclb / load_balancer_api . h <nl> ppp b / src / core / ext / lb_policy / grpclb / load_balancer_api . h <nl> typedef struct grpc_grpclb_serverlist { <nl> grpc_grpclb_request * grpc_grpclb_request_create ( const char * lb_service_name ) ; <nl> <nl> / * * Protocol Buffers v3 - encode \ a request * / <nl> - gpr_slice grpc_grpclb_request_encode ( const grpc_grpclb_request * request ) ; <nl> + grpc_slice grpc_grpclb_request_encode ( const grpc_grpclb_request * request ) ; <nl> <nl> / * * Destroy \ a request * / <nl> void grpc_grpclb_request_destroy ( grpc_grpclb_request * request ) ; <nl> void grpc_grpclb_request_destroy ( grpc_grpclb_request * request ) ; <nl> / * * Parse ( ie , decode ) the bytes in \ a encoded_grpc_grpclb_response as a \ a <nl> * grpc_grpclb_initial_response * / <nl> grpc_grpclb_initial_response * grpc_grpclb_initial_response_parse ( <nl> - gpr_slice encoded_grpc_grpclb_response ) ; <nl> + grpc_slice encoded_grpc_grpclb_response ) ; <nl> <nl> / * * Parse the list of servers from an encoded \ a grpc_grpclb_response * / <nl> grpc_grpclb_serverlist * grpc_grpclb_response_parse_serverlist ( <nl> - gpr_slice encoded_grpc_grpclb_response ) ; <nl> + grpc_slice encoded_grpc_grpclb_response ) ; <nl> <nl> / * * Return a copy of \ a sl . The caller is responsible for calling \ a <nl> * grpc_grpclb_destroy_serverlist on the returned copy . * / <nl> mmm a / src / core / ext / resolver / sockaddr / sockaddr_resolver . c <nl> ppp b / src / core / ext / resolver / sockaddr / sockaddr_resolver . c <nl> static grpc_resolver * sockaddr_create ( grpc_resolver_args * args , <nl> return NULL ; <nl> } <nl> / * Construct addresses . * / <nl> - gpr_slice path_slice = <nl> - gpr_slice_new ( args - > uri - > path , strlen ( args - > uri - > path ) , do_nothing ) ; <nl> - gpr_slice_buffer path_parts ; <nl> - gpr_slice_buffer_init ( & path_parts ) ; <nl> - gpr_slice_split ( path_slice , " , " , & path_parts ) ; <nl> + grpc_slice path_slice = <nl> + grpc_slice_new ( args - > uri - > path , strlen ( args - > uri - > path ) , do_nothing ) ; <nl> + grpc_slice_buffer path_parts ; <nl> + grpc_slice_buffer_init ( & path_parts ) ; <nl> + grpc_slice_split ( path_slice , " , " , & path_parts ) ; <nl> grpc_lb_addresses * addresses = grpc_lb_addresses_create ( path_parts . count ) ; <nl> bool errors_found = false ; <nl> for ( size_t i = 0 ; i < addresses - > num_addresses ; i + + ) { <nl> static grpc_resolver * sockaddr_create ( grpc_resolver_args * args , <nl> gpr_free ( part_str ) ; <nl> if ( errors_found ) break ; <nl> } <nl> - gpr_slice_buffer_destroy ( & path_parts ) ; <nl> - gpr_slice_unref ( path_slice ) ; <nl> + grpc_slice_buffer_destroy ( & path_parts ) ; <nl> + grpc_slice_unref ( path_slice ) ; <nl> if ( errors_found ) { <nl> grpc_lb_addresses_destroy ( addresses , NULL / * user_data_destroy * / ) ; <nl> return NULL ; <nl> mmm a / src / core / ext / transport / chttp2 / client / insecure / channel_create . c <nl> ppp b / src / core / ext / transport / chttp2 / client / insecure / channel_create . c <nl> typedef struct { <nl> grpc_connect_in_args args ; <nl> grpc_connect_out_args * result ; <nl> grpc_closure initial_string_sent ; <nl> - gpr_slice_buffer initial_string_buffer ; <nl> + grpc_slice_buffer initial_string_buffer ; <nl> <nl> grpc_endpoint * tcp ; <nl> <nl> static void on_initial_connect_string_sent ( grpc_exec_ctx * exec_ctx , void * arg , <nl> <nl> static void on_handshake_done ( grpc_exec_ctx * exec_ctx , grpc_endpoint * endpoint , <nl> grpc_channel_args * args , <nl> - gpr_slice_buffer * read_buffer , void * user_data , <nl> + grpc_slice_buffer * read_buffer , void * user_data , <nl> grpc_error * error ) { <nl> connector * c = user_data ; <nl> if ( error ! = GRPC_ERROR_NONE ) { <nl> static void connected ( grpc_exec_ctx * exec_ctx , void * arg , grpc_error * error ) { <nl> if ( ! GPR_SLICE_IS_EMPTY ( c - > args . initial_connect_string ) ) { <nl> grpc_closure_init ( & c - > initial_string_sent , on_initial_connect_string_sent , <nl> c ) ; <nl> - gpr_slice_buffer_init ( & c - > initial_string_buffer ) ; <nl> - gpr_slice_buffer_add ( & c - > initial_string_buffer , <nl> + grpc_slice_buffer_init ( & c - > initial_string_buffer ) ; <nl> + grpc_slice_buffer_add ( & c - > initial_string_buffer , <nl> c - > args . initial_connect_string ) ; <nl> connector_ref ( arg ) ; <nl> grpc_endpoint_write ( exec_ctx , tcp , & c - > initial_string_buffer , <nl> mmm a / src / core / ext / transport / chttp2 / client / secure / secure_channel_create . c <nl> ppp b / src / core / ext / transport / chttp2 / client / secure / secure_channel_create . c <nl> typedef struct { <nl> grpc_connect_in_args args ; <nl> grpc_connect_out_args * result ; <nl> grpc_closure initial_string_sent ; <nl> - gpr_slice_buffer initial_string_buffer ; <nl> + grpc_slice_buffer initial_string_buffer ; <nl> <nl> gpr_mu mu ; <nl> grpc_endpoint * connecting_endpoint ; <nl> static void on_secure_handshake_done ( grpc_exec_ctx * exec_ctx , void * arg , <nl> <nl> static void on_handshake_done ( grpc_exec_ctx * exec_ctx , grpc_endpoint * endpoint , <nl> grpc_channel_args * args , <nl> - gpr_slice_buffer * read_buffer , void * user_data , <nl> + grpc_slice_buffer * read_buffer , void * user_data , <nl> grpc_error * error ) { <nl> connector * c = user_data ; <nl> c - > tmp_args = args ; <nl> static void connected ( grpc_exec_ctx * exec_ctx , void * arg , grpc_error * error ) { <nl> if ( ! GPR_SLICE_IS_EMPTY ( c - > args . initial_connect_string ) ) { <nl> grpc_closure_init ( & c - > initial_string_sent , on_initial_connect_string_sent , <nl> c ) ; <nl> - gpr_slice_buffer_init ( & c - > initial_string_buffer ) ; <nl> - gpr_slice_buffer_add ( & c - > initial_string_buffer , <nl> + grpc_slice_buffer_init ( & c - > initial_string_buffer ) ; <nl> + grpc_slice_buffer_add ( & c - > initial_string_buffer , <nl> c - > args . initial_connect_string ) ; <nl> grpc_endpoint_write ( exec_ctx , tcp , & c - > initial_string_buffer , <nl> & c - > initial_string_sent ) ; <nl> mmm a / src / core / ext / transport / chttp2 / server / insecure / server_chttp2 . c <nl> ppp b / src / core / ext / transport / chttp2 / server / insecure / server_chttp2 . c <nl> typedef struct server_connect_state { <nl> <nl> static void on_handshake_done ( grpc_exec_ctx * exec_ctx , grpc_endpoint * endpoint , <nl> grpc_channel_args * args , <nl> - gpr_slice_buffer * read_buffer , void * user_data , <nl> + grpc_slice_buffer * read_buffer , void * user_data , <nl> grpc_error * error ) { <nl> server_connect_state * state = user_data ; <nl> if ( error ! = GRPC_ERROR_NONE ) { <nl> mmm a / src / core / ext / transport / chttp2 / server / secure / server_secure_chttp2 . c <nl> ppp b / src / core / ext / transport / chttp2 / server / secure / server_secure_chttp2 . c <nl> static void on_secure_handshake_done ( grpc_exec_ctx * exec_ctx , void * statep , <nl> <nl> static void on_handshake_done ( grpc_exec_ctx * exec_ctx , grpc_endpoint * endpoint , <nl> grpc_channel_args * args , <nl> - gpr_slice_buffer * read_buffer , void * user_data , <nl> + grpc_slice_buffer * read_buffer , void * user_data , <nl> grpc_error * error ) { <nl> server_secure_connect * connection_state = user_data ; <nl> if ( error ! = GRPC_ERROR_NONE ) { <nl> mmm a / src / core / ext / transport / chttp2 / transport / bin_decoder . c <nl> ppp b / src / core / ext / transport / chttp2 / transport / bin_decoder . c <nl> bool grpc_base64_decode_partial ( struct grpc_base64_decode_context * ctx ) { <nl> return true ; <nl> } <nl> <nl> - gpr_slice grpc_chttp2_base64_decode ( gpr_slice input ) { <nl> + grpc_slice grpc_chttp2_base64_decode ( grpc_slice input ) { <nl> size_t input_length = GPR_SLICE_LENGTH ( input ) ; <nl> size_t output_length = input_length / 4 * 3 ; <nl> struct grpc_base64_decode_context ctx ; <nl> - gpr_slice output ; <nl> + grpc_slice output ; <nl> <nl> if ( input_length % 4 ! = 0 ) { <nl> gpr_log ( GPR_ERROR , <nl> gpr_slice grpc_chttp2_base64_decode ( gpr_slice input ) { <nl> } <nl> } <nl> } <nl> - output = gpr_slice_malloc ( output_length ) ; <nl> + output = grpc_slice_malloc ( output_length ) ; <nl> <nl> ctx . input_cur = GPR_SLICE_START_PTR ( input ) ; <nl> ctx . input_end = GPR_SLICE_END_PTR ( input ) ; <nl> gpr_slice grpc_chttp2_base64_decode ( gpr_slice input ) { <nl> char * s = gpr_dump_slice ( input , GPR_DUMP_ASCII ) ; <nl> gpr_log ( GPR_ERROR , " Base64 decoding failed , input string : \ n % s \ n " , s ) ; <nl> gpr_free ( s ) ; <nl> - gpr_slice_unref ( output ) ; <nl> + grpc_slice_unref ( output ) ; <nl> return gpr_empty_slice ( ) ; <nl> } <nl> GPR_ASSERT ( ctx . output_cur = = GPR_SLICE_END_PTR ( output ) ) ; <nl> gpr_slice grpc_chttp2_base64_decode ( gpr_slice input ) { <nl> return output ; <nl> } <nl> <nl> - gpr_slice grpc_chttp2_base64_decode_with_length ( gpr_slice input , <nl> + grpc_slice grpc_chttp2_base64_decode_with_length ( grpc_slice input , <nl> size_t output_length ) { <nl> size_t input_length = GPR_SLICE_LENGTH ( input ) ; <nl> - gpr_slice output = gpr_slice_malloc ( output_length ) ; <nl> + grpc_slice output = grpc_slice_malloc ( output_length ) ; <nl> struct grpc_base64_decode_context ctx ; <nl> <nl> / / The length of a base64 string cannot be 4 * n + 1 <nl> gpr_slice grpc_chttp2_base64_decode_with_length ( gpr_slice input , <nl> " grpc_chttp2_base64_decode_with_length has a length of % d , which " <nl> " has a tail of 1 byte . \ n " , <nl> ( int ) input_length ) ; <nl> - gpr_slice_unref ( output ) ; <nl> + grpc_slice_unref ( output ) ; <nl> return gpr_empty_slice ( ) ; <nl> } <nl> <nl> gpr_slice grpc_chttp2_base64_decode_with_length ( gpr_slice input , <nl> " than the max possible output length % d . \ n " , <nl> ( int ) output_length , <nl> ( int ) ( input_length / 4 * 3 + tail_xtra [ input_length % 4 ] ) ) ; <nl> - gpr_slice_unref ( output ) ; <nl> + grpc_slice_unref ( output ) ; <nl> return gpr_empty_slice ( ) ; <nl> } <nl> <nl> gpr_slice grpc_chttp2_base64_decode_with_length ( gpr_slice input , <nl> char * s = gpr_dump_slice ( input , GPR_DUMP_ASCII ) ; <nl> gpr_log ( GPR_ERROR , " Base64 decoding failed , input string : \ n % s \ n " , s ) ; <nl> gpr_free ( s ) ; <nl> - gpr_slice_unref ( output ) ; <nl> + grpc_slice_unref ( output ) ; <nl> return gpr_empty_slice ( ) ; <nl> } <nl> GPR_ASSERT ( ctx . output_cur = = GPR_SLICE_END_PTR ( output ) ) ; <nl> mmm a / src / core / ext / transport / chttp2 / transport / bin_decoder . h <nl> ppp b / src / core / ext / transport / chttp2 / transport / bin_decoder . h <nl> bool grpc_base64_decode_partial ( struct grpc_base64_decode_context * ctx ) ; <nl> <nl> / * base64 decode a slice with pad chars . Returns a new slice , does not take <nl> ownership of the input . Returns an empty slice if decoding is failed . * / <nl> - gpr_slice grpc_chttp2_base64_decode ( gpr_slice input ) ; <nl> + grpc_slice grpc_chttp2_base64_decode ( grpc_slice input ) ; <nl> <nl> / * base64 decode a slice without pad chars , data length is needed . Returns a new <nl> slice , does not take ownership of the input . Returns an empty slice if <nl> decoding is failed . * / <nl> - gpr_slice grpc_chttp2_base64_decode_with_length ( gpr_slice input , <nl> + grpc_slice grpc_chttp2_base64_decode_with_length ( grpc_slice input , <nl> size_t output_length ) ; <nl> <nl> # endif / * GRPC_CORE_EXT_TRANSPORT_CHTTP2_TRANSPORT_BIN_DECODER_H * / <nl> mmm a / src / core / ext / transport / chttp2 / transport / bin_encoder . c <nl> ppp b / src / core / ext / transport / chttp2 / transport / bin_encoder . c <nl> static const b64_huff_sym huff_alphabet [ 64 ] = { <nl> <nl> static const uint8_t tail_xtra [ 3 ] = { 0 , 2 , 3 } ; <nl> <nl> - gpr_slice grpc_chttp2_base64_encode ( gpr_slice input ) { <nl> + grpc_slice grpc_chttp2_base64_encode ( grpc_slice input ) { <nl> size_t input_length = GPR_SLICE_LENGTH ( input ) ; <nl> size_t input_triplets = input_length / 3 ; <nl> size_t tail_case = input_length % 3 ; <nl> size_t output_length = input_triplets * 4 + tail_xtra [ tail_case ] ; <nl> - gpr_slice output = gpr_slice_malloc ( output_length ) ; <nl> + grpc_slice output = grpc_slice_malloc ( output_length ) ; <nl> uint8_t * in = GPR_SLICE_START_PTR ( input ) ; <nl> char * out = ( char * ) GPR_SLICE_START_PTR ( output ) ; <nl> size_t i ; <nl> gpr_slice grpc_chttp2_base64_encode ( gpr_slice input ) { <nl> return output ; <nl> } <nl> <nl> - gpr_slice grpc_chttp2_huffman_compress ( gpr_slice input ) { <nl> + grpc_slice grpc_chttp2_huffman_compress ( grpc_slice input ) { <nl> size_t nbits ; <nl> uint8_t * in ; <nl> uint8_t * out ; <nl> - gpr_slice output ; <nl> + grpc_slice output ; <nl> uint32_t temp = 0 ; <nl> uint32_t temp_length = 0 ; <nl> <nl> gpr_slice grpc_chttp2_huffman_compress ( gpr_slice input ) { <nl> nbits + = grpc_chttp2_huffsyms [ * in ] . length ; <nl> } <nl> <nl> - output = gpr_slice_malloc ( nbits / 8 + ( nbits % 8 ! = 0 ) ) ; <nl> + output = grpc_slice_malloc ( nbits / 8 + ( nbits % 8 ! = 0 ) ) ; <nl> out = GPR_SLICE_START_PTR ( output ) ; <nl> for ( in = GPR_SLICE_START_PTR ( input ) ; in ! = GPR_SLICE_END_PTR ( input ) ; + + in ) { <nl> int sym = * in ; <nl> static void enc_add1 ( huff_out * out , uint8_t a ) { <nl> enc_flush_some ( out ) ; <nl> } <nl> <nl> - gpr_slice grpc_chttp2_base64_encode_and_huffman_compress_impl ( gpr_slice input ) { <nl> + grpc_slice grpc_chttp2_base64_encode_and_huffman_compress_impl ( grpc_slice input ) { <nl> size_t input_length = GPR_SLICE_LENGTH ( input ) ; <nl> size_t input_triplets = input_length / 3 ; <nl> size_t tail_case = input_length % 3 ; <nl> size_t output_syms = input_triplets * 4 + tail_xtra [ tail_case ] ; <nl> size_t max_output_bits = 11 * output_syms ; <nl> size_t max_output_length = max_output_bits / 8 + ( max_output_bits % 8 ! = 0 ) ; <nl> - gpr_slice output = gpr_slice_malloc ( max_output_length ) ; <nl> + grpc_slice output = grpc_slice_malloc ( max_output_length ) ; <nl> uint8_t * in = GPR_SLICE_START_PTR ( input ) ; <nl> uint8_t * start_out = GPR_SLICE_START_PTR ( output ) ; <nl> huff_out out ; <nl> mmm a / src / core / ext / transport / chttp2 / transport / bin_encoder . h <nl> ppp b / src / core / ext / transport / chttp2 / transport / bin_encoder . h <nl> <nl> <nl> / * base64 encode a slice . Returns a new slice , does not take ownership of the <nl> input * / <nl> - gpr_slice grpc_chttp2_base64_encode ( gpr_slice input ) ; <nl> + grpc_slice grpc_chttp2_base64_encode ( grpc_slice input ) ; <nl> <nl> / * Compress a slice with the static huffman encoder detailed in the hpack <nl> standard . Returns a new slice , does not take ownership of the input * / <nl> - gpr_slice grpc_chttp2_huffman_compress ( gpr_slice input ) ; <nl> + grpc_slice grpc_chttp2_huffman_compress ( grpc_slice input ) ; <nl> <nl> / * equivalent to : <nl> - gpr_slice x = grpc_chttp2_base64_encode ( input ) ; <nl> - gpr_slice y = grpc_chttp2_huffman_compress ( x ) ; <nl> - gpr_slice_unref ( x ) ; <nl> + grpc_slice x = grpc_chttp2_base64_encode ( input ) ; <nl> + grpc_slice y = grpc_chttp2_huffman_compress ( x ) ; <nl> + grpc_slice_unref ( x ) ; <nl> return y ; * / <nl> - gpr_slice grpc_chttp2_base64_encode_and_huffman_compress_impl ( gpr_slice input ) ; <nl> + grpc_slice grpc_chttp2_base64_encode_and_huffman_compress_impl ( grpc_slice input ) ; <nl> <nl> # endif / * GRPC_CORE_EXT_TRANSPORT_CHTTP2_TRANSPORT_BIN_ENCODER_H * / <nl> mmm a / src / core / ext / transport / chttp2 / transport / chttp2_transport . c <nl> ppp b / src / core / ext / transport / chttp2 / transport / chttp2_transport . c <nl> static void destruct_transport ( grpc_exec_ctx * exec_ctx , <nl> <nl> grpc_endpoint_destroy ( exec_ctx , t - > ep ) ; <nl> <nl> - gpr_slice_buffer_destroy ( & t - > qbuf ) ; <nl> + grpc_slice_buffer_destroy ( & t - > qbuf ) ; <nl> <nl> - gpr_slice_buffer_destroy ( & t - > outbuf ) ; <nl> + grpc_slice_buffer_destroy ( & t - > outbuf ) ; <nl> grpc_chttp2_hpack_compressor_destroy ( & t - > hpack_compressor ) ; <nl> <nl> - gpr_slice_buffer_destroy ( & t - > read_buffer ) ; <nl> + grpc_slice_buffer_destroy ( & t - > read_buffer ) ; <nl> grpc_chttp2_hpack_parser_destroy ( & t - > hpack_parser ) ; <nl> grpc_chttp2_goaway_parser_destroy ( & t - > goaway_parser ) ; <nl> <nl> static void init_transport ( grpc_exec_ctx * exec_ctx , grpc_chttp2_transport * t , <nl> & t - > channel_callback . state_tracker , GRPC_CHANNEL_READY , <nl> is_client ? " client_transport " : " server_transport " ) ; <nl> <nl> - gpr_slice_buffer_init ( & t - > qbuf ) ; <nl> + grpc_slice_buffer_init ( & t - > qbuf ) ; <nl> <nl> - gpr_slice_buffer_init ( & t - > outbuf ) ; <nl> + grpc_slice_buffer_init ( & t - > outbuf ) ; <nl> grpc_chttp2_hpack_compressor_init ( & t - > hpack_compressor ) ; <nl> <nl> grpc_closure_init ( & t - > write_action_begin_locked , write_action_begin_locked , <nl> static void init_transport ( grpc_exec_ctx * exec_ctx , grpc_chttp2_transport * t , <nl> grpc_chttp2_goaway_parser_init ( & t - > goaway_parser ) ; <nl> grpc_chttp2_hpack_parser_init ( & t - > hpack_parser ) ; <nl> <nl> - gpr_slice_buffer_init ( & t - > read_buffer ) ; <nl> + grpc_slice_buffer_init ( & t - > read_buffer ) ; <nl> <nl> / * 8 is a random stab in the dark as to a good initial size : it ' s small enough <nl> that it shouldn ' t waste memory for infrequently used connections , yet <nl> static void init_transport ( grpc_exec_ctx * exec_ctx , grpc_chttp2_transport * t , <nl> t - > sent_local_settings = 0 ; <nl> <nl> if ( is_client ) { <nl> - gpr_slice_buffer_add ( & t - > outbuf , gpr_slice_from_copied_string ( <nl> + grpc_slice_buffer_add ( & t - > outbuf , grpc_slice_from_copied_string ( <nl> GRPC_CHTTP2_CLIENT_CONNECT_STRING ) ) ; <nl> grpc_chttp2_initiate_write ( exec_ctx , t , false , " initial_write " ) ; <nl> } <nl> static int init_stream ( grpc_exec_ctx * exec_ctx , grpc_transport * gt , <nl> grpc_chttp2_incoming_metadata_buffer_init ( & s - > metadata_buffer [ 0 ] ) ; <nl> grpc_chttp2_incoming_metadata_buffer_init ( & s - > metadata_buffer [ 1 ] ) ; <nl> grpc_chttp2_data_parser_init ( & s - > data_parser ) ; <nl> - gpr_slice_buffer_init ( & s - > flow_controlled_buffer ) ; <nl> + grpc_slice_buffer_init ( & s - > flow_controlled_buffer ) ; <nl> s - > deadline = gpr_inf_future ( GPR_CLOCK_MONOTONIC ) ; <nl> grpc_closure_init ( & s - > complete_fetch , complete_fetch , s ) ; <nl> grpc_closure_init ( & s - > complete_fetch_locked , complete_fetch_locked , s ) ; <nl> static void destroy_stream_locked ( grpc_exec_ctx * exec_ctx , void * sp , <nl> grpc_chttp2_data_parser_destroy ( exec_ctx , & s - > data_parser ) ; <nl> grpc_chttp2_incoming_metadata_buffer_destroy ( & s - > metadata_buffer [ 0 ] ) ; <nl> grpc_chttp2_incoming_metadata_buffer_destroy ( & s - > metadata_buffer [ 1 ] ) ; <nl> - gpr_slice_buffer_destroy ( & s - > flow_controlled_buffer ) ; <nl> + grpc_slice_buffer_destroy ( & s - > flow_controlled_buffer ) ; <nl> GRPC_ERROR_UNREF ( s - > read_closed_error ) ; <nl> GRPC_ERROR_UNREF ( s - > write_closed_error ) ; <nl> <nl> static void push_setting ( grpc_exec_ctx * exec_ctx , grpc_chttp2_transport * t , <nl> void grpc_chttp2_add_incoming_goaway ( grpc_exec_ctx * exec_ctx , <nl> grpc_chttp2_transport * t , <nl> uint32_t goaway_error , <nl> - gpr_slice goaway_text ) { <nl> + grpc_slice goaway_text ) { <nl> char * msg = gpr_dump_slice ( goaway_text , GPR_DUMP_HEX | GPR_DUMP_ASCII ) ; <nl> GRPC_CHTTP2_IF_TRACING ( <nl> gpr_log ( GPR_DEBUG , " got goaway [ % d ] : % s " , goaway_error , msg ) ) ; <nl> - gpr_slice_unref ( goaway_text ) ; <nl> + grpc_slice_unref ( goaway_text ) ; <nl> t - > seen_goaway = 1 ; <nl> / * lie : use transient failure from the transport to indicate goaway has been <nl> * received * / <nl> static void add_fetched_slice_locked ( grpc_exec_ctx * exec_ctx , <nl> grpc_chttp2_stream * s ) { <nl> s - > fetched_send_message_length + = <nl> ( uint32_t ) GPR_SLICE_LENGTH ( s - > fetching_slice ) ; <nl> - gpr_slice_buffer_add ( & s - > flow_controlled_buffer , s - > fetching_slice ) ; <nl> + grpc_slice_buffer_add ( & s - > flow_controlled_buffer , s - > fetching_slice ) ; <nl> if ( s - > id ! = 0 ) { <nl> grpc_chttp2_become_writable ( exec_ctx , t , s , true , " op . send_message " ) ; <nl> } <nl> static void perform_stream_op_locked ( grpc_exec_ctx * exec_ctx , void * stream_op , <nl> } else { <nl> GPR_ASSERT ( s - > fetching_send_message = = NULL ) ; <nl> uint8_t * frame_hdr = <nl> - gpr_slice_buffer_tiny_add ( & s - > flow_controlled_buffer , 5 ) ; <nl> + grpc_slice_buffer_tiny_add ( & s - > flow_controlled_buffer , 5 ) ; <nl> uint32_t flags = op - > send_message - > flags ; <nl> frame_hdr [ 0 ] = ( flags & GRPC_WRITE_INTERNAL_COMPRESS ) ! = 0 ; <nl> size_t len = op - > send_message - > length ; <nl> static void send_ping_locked ( grpc_exec_ctx * exec_ctx , grpc_chttp2_transport * t , <nl> p - > id [ 7 ] = ( uint8_t ) ( t - > ping_counter & 0xff ) ; <nl> t - > ping_counter + + ; <nl> p - > on_recv = on_recv ; <nl> - gpr_slice_buffer_add ( & t - > qbuf , grpc_chttp2_ping_create ( 0 , p - > id ) ) ; <nl> + grpc_slice_buffer_add ( & t - > qbuf , grpc_chttp2_ping_create ( 0 , p - > id ) ) ; <nl> grpc_chttp2_initiate_write ( exec_ctx , t , true , " send_ping " ) ; <nl> } <nl> <nl> void grpc_chttp2_ack_ping ( grpc_exec_ctx * exec_ctx , grpc_chttp2_transport * t , <nl> } <nl> <nl> static void send_goaway ( grpc_exec_ctx * exec_ctx , grpc_chttp2_transport * t , <nl> - grpc_chttp2_error_code error , gpr_slice data ) { <nl> + grpc_chttp2_error_code error , grpc_slice data ) { <nl> t - > sent_goaway_state = GRPC_CHTTP2_GOAWAY_SEND_SCHEDULED ; <nl> grpc_chttp2_goaway_append ( t - > last_new_stream_id , ( uint32_t ) error , data , <nl> & t - > qbuf ) ; <nl> static void perform_transport_op_locked ( grpc_exec_ctx * exec_ctx , <nl> if ( op - > send_goaway ) { <nl> send_goaway ( exec_ctx , t , <nl> grpc_chttp2_grpc_status_to_http2_error ( op - > goaway_status ) , <nl> - gpr_slice_ref ( * op - > goaway_message ) ) ; <nl> + grpc_slice_ref ( * op - > goaway_message ) ) ; <nl> } <nl> <nl> if ( op - > set_accept_stream ) { <nl> void grpc_chttp2_cancel_stream ( grpc_exec_ctx * exec_ctx , <nl> & grpc_status ) ; <nl> <nl> if ( s - > id ! = 0 ) { <nl> - gpr_slice_buffer_add ( <nl> + grpc_slice_buffer_add ( <nl> & t - > qbuf , grpc_chttp2_rst_stream_create ( s - > id , ( uint32_t ) http_error , <nl> & s - > stats . outgoing ) ) ; <nl> grpc_chttp2_initiate_write ( exec_ctx , t , false , " rst_stream " ) ; <nl> void grpc_chttp2_cancel_stream ( grpc_exec_ctx * exec_ctx , <nl> free_msg = true ; <nl> msg = grpc_error_string ( due_to_error ) ; <nl> } <nl> - gpr_slice msg_slice = gpr_slice_from_copied_string ( msg ) ; <nl> + grpc_slice msg_slice = grpc_slice_from_copied_string ( msg ) ; <nl> grpc_chttp2_fake_status ( exec_ctx , t , s , grpc_status , & msg_slice ) ; <nl> if ( free_msg ) grpc_error_free_string ( msg ) ; <nl> } <nl> void grpc_chttp2_cancel_stream ( grpc_exec_ctx * exec_ctx , <nl> <nl> void grpc_chttp2_fake_status ( grpc_exec_ctx * exec_ctx , grpc_chttp2_transport * t , <nl> grpc_chttp2_stream * s , grpc_status_code status , <nl> - gpr_slice * slice ) { <nl> + grpc_slice * slice ) { <nl> if ( status ! = GRPC_STATUS_OK ) { <nl> s - > seen_error = true ; <nl> } <nl> void grpc_chttp2_fake_status ( grpc_exec_ctx * exec_ctx , grpc_chttp2_transport * t , <nl> & s - > metadata_buffer [ 1 ] , <nl> grpc_mdelem_from_metadata_strings ( <nl> GRPC_MDSTR_GRPC_MESSAGE , <nl> - grpc_mdstr_from_slice ( gpr_slice_ref ( * slice ) ) ) ) ; <nl> + grpc_mdstr_from_slice ( grpc_slice_ref ( * slice ) ) ) ) ; <nl> } <nl> s - > published_metadata [ 1 ] = GRPC_METADATA_SYNTHESIZED_FROM_FAKE ; <nl> grpc_chttp2_maybe_complete_recv_trailing_metadata ( exec_ctx , t , s ) ; <nl> } <nl> if ( slice ) { <nl> - gpr_slice_unref ( * slice ) ; <nl> + grpc_slice_unref ( * slice ) ; <nl> } <nl> } <nl> <nl> void grpc_chttp2_mark_stream_closed ( grpc_exec_ctx * exec_ctx , <nl> <nl> static void close_from_api ( grpc_exec_ctx * exec_ctx , grpc_chttp2_transport * t , <nl> grpc_chttp2_stream * s , grpc_error * error ) { <nl> - gpr_slice hdr ; <nl> - gpr_slice status_hdr ; <nl> - gpr_slice message_pfx ; <nl> + grpc_slice hdr ; <nl> + grpc_slice status_hdr ; <nl> + grpc_slice message_pfx ; <nl> uint8_t * p ; <nl> uint32_t len = 0 ; <nl> grpc_status_code grpc_status ; <nl> static void close_from_api ( grpc_exec_ctx * exec_ctx , grpc_chttp2_transport * t , <nl> time we got around to sending this , so instead we ignore HPACK <nl> compression <nl> and just write the uncompressed bytes onto the wire . * / <nl> - status_hdr = gpr_slice_malloc ( 15 + ( grpc_status > = 10 ) ) ; <nl> + status_hdr = grpc_slice_malloc ( 15 + ( grpc_status > = 10 ) ) ; <nl> p = GPR_SLICE_START_PTR ( status_hdr ) ; <nl> * p + + = 0x40 ; / * literal header * / <nl> * p + + = 11 ; / * len ( grpc - status ) * / <nl> static void close_from_api ( grpc_exec_ctx * exec_ctx , grpc_chttp2_transport * t , <nl> if ( optional_message ! = NULL ) { <nl> size_t msg_len = strlen ( optional_message ) ; <nl> GPR_ASSERT ( msg_len < 127 ) ; <nl> - message_pfx = gpr_slice_malloc ( 15 ) ; <nl> + message_pfx = grpc_slice_malloc ( 15 ) ; <nl> p = GPR_SLICE_START_PTR ( message_pfx ) ; <nl> * p + + = 0x40 ; <nl> * p + + = 12 ; / * len ( grpc - message ) * / <nl> static void close_from_api ( grpc_exec_ctx * exec_ctx , grpc_chttp2_transport * t , <nl> len + = ( uint32_t ) msg_len ; <nl> } <nl> <nl> - hdr = gpr_slice_malloc ( 9 ) ; <nl> + hdr = grpc_slice_malloc ( 9 ) ; <nl> p = GPR_SLICE_START_PTR ( hdr ) ; <nl> * p + + = ( uint8_t ) ( len > > 16 ) ; <nl> * p + + = ( uint8_t ) ( len > > 8 ) ; <nl> static void close_from_api ( grpc_exec_ctx * exec_ctx , grpc_chttp2_transport * t , <nl> * p + + = ( uint8_t ) ( s - > id ) ; <nl> GPR_ASSERT ( p = = GPR_SLICE_END_PTR ( hdr ) ) ; <nl> <nl> - gpr_slice_buffer_add ( & t - > qbuf , hdr ) ; <nl> - gpr_slice_buffer_add ( & t - > qbuf , status_hdr ) ; <nl> + grpc_slice_buffer_add ( & t - > qbuf , hdr ) ; <nl> + grpc_slice_buffer_add ( & t - > qbuf , status_hdr ) ; <nl> if ( optional_message ) { <nl> - gpr_slice_buffer_add ( & t - > qbuf , message_pfx ) ; <nl> - gpr_slice_buffer_add ( & t - > qbuf , <nl> - gpr_slice_from_copied_string ( optional_message ) ) ; <nl> + grpc_slice_buffer_add ( & t - > qbuf , message_pfx ) ; <nl> + grpc_slice_buffer_add ( & t - > qbuf , <nl> + grpc_slice_from_copied_string ( optional_message ) ) ; <nl> } <nl> - gpr_slice_buffer_add ( <nl> + grpc_slice_buffer_add ( <nl> & t - > qbuf , grpc_chttp2_rst_stream_create ( s - > id , GRPC_CHTTP2_NO_ERROR , <nl> & s - > stats . outgoing ) ) ; <nl> } <nl> static void close_from_api ( grpc_exec_ctx * exec_ctx , grpc_chttp2_transport * t , <nl> free_msg = true ; <nl> msg = grpc_error_string ( error ) ; <nl> } <nl> - gpr_slice msg_slice = gpr_slice_from_copied_string ( msg ) ; <nl> + grpc_slice msg_slice = grpc_slice_from_copied_string ( msg ) ; <nl> grpc_chttp2_fake_status ( exec_ctx , t , s , grpc_status , & msg_slice ) ; <nl> if ( free_msg ) grpc_error_free_string ( msg ) ; <nl> <nl> static void read_action_locked ( grpc_exec_ctx * exec_ctx , void * tp , <nl> keep_reading = true ; <nl> GRPC_CHTTP2_REF_TRANSPORT ( t , " keep_reading " ) ; <nl> } <nl> - gpr_slice_buffer_reset_and_unref ( & t - > read_buffer ) ; <nl> + grpc_slice_buffer_reset_and_unref ( & t - > read_buffer ) ; <nl> <nl> if ( keep_reading ) { <nl> grpc_endpoint_read ( exec_ctx , t - > ep , & t - > read_buffer , & t - > read_action_begin ) ; <nl> static void incoming_byte_stream_unref ( grpc_exec_ctx * exec_ctx , <nl> grpc_chttp2_incoming_byte_stream * bs ) { <nl> if ( gpr_unref ( & bs - > refs ) ) { <nl> GRPC_ERROR_UNREF ( bs - > error ) ; <nl> - gpr_slice_buffer_destroy ( & bs - > slices ) ; <nl> + grpc_slice_buffer_destroy ( & bs - > slices ) ; <nl> gpr_mu_destroy ( & bs - > slice_mu ) ; <nl> gpr_free ( bs ) ; <nl> } <nl> static void incoming_byte_stream_next_locked ( grpc_exec_ctx * exec_ctx , <nl> } <nl> gpr_mu_lock ( & bs - > slice_mu ) ; <nl> if ( bs - > slices . count > 0 ) { <nl> - * bs - > next_action . slice = gpr_slice_buffer_take_first ( & bs - > slices ) ; <nl> + * bs - > next_action . slice = grpc_slice_buffer_take_first ( & bs - > slices ) ; <nl> grpc_closure_run ( exec_ctx , bs - > next_action . on_complete , GRPC_ERROR_NONE ) ; <nl> } else if ( bs - > error ! = GRPC_ERROR_NONE ) { <nl> grpc_closure_run ( exec_ctx , bs - > next_action . on_complete , <nl> static void incoming_byte_stream_next_locked ( grpc_exec_ctx * exec_ctx , <nl> <nl> static int incoming_byte_stream_next ( grpc_exec_ctx * exec_ctx , <nl> grpc_byte_stream * byte_stream , <nl> - gpr_slice * slice , size_t max_size_hint , <nl> + grpc_slice * slice , size_t max_size_hint , <nl> grpc_closure * on_complete ) { <nl> GPR_TIMER_BEGIN ( " incoming_byte_stream_next " , 0 ) ; <nl> grpc_chttp2_incoming_byte_stream * bs = <nl> static void incoming_byte_stream_publish_error ( <nl> <nl> void grpc_chttp2_incoming_byte_stream_push ( grpc_exec_ctx * exec_ctx , <nl> grpc_chttp2_incoming_byte_stream * bs , <nl> - gpr_slice slice ) { <nl> + grpc_slice slice ) { <nl> gpr_mu_lock ( & bs - > slice_mu ) ; <nl> if ( bs - > remaining_bytes < GPR_SLICE_LENGTH ( slice ) ) { <nl> incoming_byte_stream_publish_error ( <nl> void grpc_chttp2_incoming_byte_stream_push ( grpc_exec_ctx * exec_ctx , <nl> grpc_exec_ctx_sched ( exec_ctx , bs - > on_next , GRPC_ERROR_NONE , NULL ) ; <nl> bs - > on_next = NULL ; <nl> } else { <nl> - gpr_slice_buffer_add ( & bs - > slices , slice ) ; <nl> + grpc_slice_buffer_add ( & bs - > slices , slice ) ; <nl> } <nl> } <nl> gpr_mu_unlock ( & bs - > slice_mu ) ; <nl> grpc_chttp2_incoming_byte_stream * grpc_chttp2_incoming_byte_stream_create ( <nl> incoming_byte_stream - > transport = t ; <nl> incoming_byte_stream - > stream = s ; <nl> gpr_ref ( & incoming_byte_stream - > stream - > active_streams ) ; <nl> - gpr_slice_buffer_init ( & incoming_byte_stream - > slices ) ; <nl> + grpc_slice_buffer_init ( & incoming_byte_stream - > slices ) ; <nl> incoming_byte_stream - > on_next = NULL ; <nl> incoming_byte_stream - > is_tail = 1 ; <nl> incoming_byte_stream - > error = GRPC_ERROR_NONE ; <nl> static void benign_reclaimer_locked ( grpc_exec_ctx * exec_ctx , void * arg , <nl> t - > peer_string ) ; <nl> } <nl> send_goaway ( exec_ctx , t , GRPC_CHTTP2_ENHANCE_YOUR_CALM , <nl> - gpr_slice_from_static_string ( " Buffers full " ) ) ; <nl> + grpc_slice_from_static_string ( " Buffers full " ) ) ; <nl> } else if ( error = = GRPC_ERROR_NONE & & grpc_resource_quota_trace ) { <nl> gpr_log ( GPR_DEBUG , <nl> " HTTP2 : % s - skip benign reclamation , there are still % " PRIdPTR <nl> grpc_transport * grpc_create_chttp2_transport ( <nl> <nl> void grpc_chttp2_transport_start_reading ( grpc_exec_ctx * exec_ctx , <nl> grpc_transport * transport , <nl> - gpr_slice_buffer * read_buffer ) { <nl> + grpc_slice_buffer * read_buffer ) { <nl> grpc_chttp2_transport * t = ( grpc_chttp2_transport * ) transport ; <nl> GRPC_CHTTP2_REF_TRANSPORT ( <nl> t , " reading_action " ) ; / * matches unref inside reading_action * / <nl> if ( read_buffer ! = NULL ) { <nl> - gpr_slice_buffer_move_into ( read_buffer , & t - > read_buffer ) ; <nl> + grpc_slice_buffer_move_into ( read_buffer , & t - > read_buffer ) ; <nl> gpr_free ( read_buffer ) ; <nl> } <nl> read_action_begin ( exec_ctx , t , GRPC_ERROR_NONE ) ; <nl> mmm a / src / core / ext / transport / chttp2 / transport / chttp2_transport . h <nl> ppp b / src / core / ext / transport / chttp2 / transport / chttp2_transport . h <nl> grpc_transport * grpc_create_chttp2_transport ( <nl> / / / leftover bytes previously read from the endpoint ( e . g . , by handshakers ) . <nl> void grpc_chttp2_transport_start_reading ( grpc_exec_ctx * exec_ctx , <nl> grpc_transport * transport , <nl> - gpr_slice_buffer * read_buffer ) ; <nl> + grpc_slice_buffer * read_buffer ) ; <nl> <nl> # endif / * GRPC_CORE_EXT_TRANSPORT_CHTTP2_TRANSPORT_CHTTP2_TRANSPORT_H * / <nl> mmm a / src / core / ext / transport / chttp2 / transport / frame_data . c <nl> ppp b / src / core / ext / transport / chttp2 / transport / frame_data . c <nl> grpc_byte_stream * grpc_chttp2_incoming_frame_queue_pop ( <nl> return out ; <nl> } <nl> <nl> - void grpc_chttp2_encode_data ( uint32_t id , gpr_slice_buffer * inbuf , <nl> + void grpc_chttp2_encode_data ( uint32_t id , grpc_slice_buffer * inbuf , <nl> uint32_t write_bytes , int is_eof , <nl> grpc_transport_one_way_stats * stats , <nl> - gpr_slice_buffer * outbuf ) { <nl> - gpr_slice hdr ; <nl> + grpc_slice_buffer * outbuf ) { <nl> + grpc_slice hdr ; <nl> uint8_t * p ; <nl> static const size_t header_size = 9 ; <nl> <nl> - hdr = gpr_slice_malloc ( header_size ) ; <nl> + hdr = grpc_slice_malloc ( header_size ) ; <nl> p = GPR_SLICE_START_PTR ( hdr ) ; <nl> GPR_ASSERT ( write_bytes < ( 1 < < 24 ) ) ; <nl> * p + + = ( uint8_t ) ( write_bytes > > 16 ) ; <nl> void grpc_chttp2_encode_data ( uint32_t id , gpr_slice_buffer * inbuf , <nl> * p + + = ( uint8_t ) ( id > > 16 ) ; <nl> * p + + = ( uint8_t ) ( id > > 8 ) ; <nl> * p + + = ( uint8_t ) ( id ) ; <nl> - gpr_slice_buffer_add ( outbuf , hdr ) ; <nl> + grpc_slice_buffer_add ( outbuf , hdr ) ; <nl> <nl> - gpr_slice_buffer_move_first ( inbuf , write_bytes , outbuf ) ; <nl> + grpc_slice_buffer_move_first ( inbuf , write_bytes , outbuf ) ; <nl> <nl> stats - > framing_bytes + = header_size ; <nl> stats - > data_bytes + = write_bytes ; <nl> void grpc_chttp2_encode_data ( uint32_t id , gpr_slice_buffer * inbuf , <nl> static grpc_error * parse_inner ( grpc_exec_ctx * exec_ctx , <nl> grpc_chttp2_data_parser * p , <nl> grpc_chttp2_transport * t , grpc_chttp2_stream * s , <nl> - gpr_slice slice ) { <nl> + grpc_slice slice ) { <nl> uint8_t * const beg = GPR_SLICE_START_PTR ( slice ) ; <nl> uint8_t * const end = GPR_SLICE_END_PTR ( slice ) ; <nl> uint8_t * cur = beg ; <nl> static grpc_error * parse_inner ( grpc_exec_ctx * exec_ctx , <nl> s - > stats . incoming . data_bytes + = p - > frame_size ; <nl> grpc_chttp2_incoming_byte_stream_push ( <nl> exec_ctx , p - > parsing_frame , <nl> - gpr_slice_sub ( slice , ( size_t ) ( cur - beg ) , ( size_t ) ( end - beg ) ) ) ; <nl> + grpc_slice_sub ( slice , ( size_t ) ( cur - beg ) , ( size_t ) ( end - beg ) ) ) ; <nl> grpc_chttp2_incoming_byte_stream_finished ( exec_ctx , p - > parsing_frame , <nl> GRPC_ERROR_NONE ) ; <nl> p - > parsing_frame = NULL ; <nl> static grpc_error * parse_inner ( grpc_exec_ctx * exec_ctx , <nl> s - > stats . incoming . data_bytes + = p - > frame_size ; <nl> grpc_chttp2_incoming_byte_stream_push ( <nl> exec_ctx , p - > parsing_frame , <nl> - gpr_slice_sub ( slice , ( size_t ) ( cur - beg ) , <nl> + grpc_slice_sub ( slice , ( size_t ) ( cur - beg ) , <nl> ( size_t ) ( cur + p - > frame_size - beg ) ) ) ; <nl> grpc_chttp2_incoming_byte_stream_finished ( exec_ctx , p - > parsing_frame , <nl> GRPC_ERROR_NONE ) ; <nl> static grpc_error * parse_inner ( grpc_exec_ctx * exec_ctx , <nl> GPR_ASSERT ( remaining < = p - > frame_size ) ; <nl> grpc_chttp2_incoming_byte_stream_push ( <nl> exec_ctx , p - > parsing_frame , <nl> - gpr_slice_sub ( slice , ( size_t ) ( cur - beg ) , ( size_t ) ( end - beg ) ) ) ; <nl> + grpc_slice_sub ( slice , ( size_t ) ( cur - beg ) , ( size_t ) ( end - beg ) ) ) ; <nl> p - > frame_size - = remaining ; <nl> s - > stats . incoming . data_bytes + = remaining ; <nl> return GRPC_ERROR_NONE ; <nl> static grpc_error * parse_inner ( grpc_exec_ctx * exec_ctx , <nl> grpc_error * grpc_chttp2_data_parser_parse ( grpc_exec_ctx * exec_ctx , void * parser , <nl> grpc_chttp2_transport * t , <nl> grpc_chttp2_stream * s , <nl> - gpr_slice slice , int is_last ) { <nl> + grpc_slice slice , int is_last ) { <nl> grpc_chttp2_data_parser * p = parser ; <nl> grpc_error * error = parse_inner ( exec_ctx , p , t , s , slice ) ; <nl> <nl> mmm a / src / core / ext / transport / chttp2 / transport / frame_data . h <nl> ppp b / src / core / ext / transport / chttp2 / transport / frame_data . h <nl> grpc_error * grpc_chttp2_data_parser_begin_frame ( grpc_chttp2_data_parser * parser , <nl> grpc_error * grpc_chttp2_data_parser_parse ( grpc_exec_ctx * exec_ctx , void * parser , <nl> grpc_chttp2_transport * t , <nl> grpc_chttp2_stream * s , <nl> - gpr_slice slice , int is_last ) ; <nl> + grpc_slice slice , int is_last ) ; <nl> <nl> - void grpc_chttp2_encode_data ( uint32_t id , gpr_slice_buffer * inbuf , <nl> + void grpc_chttp2_encode_data ( uint32_t id , grpc_slice_buffer * inbuf , <nl> uint32_t write_bytes , int is_eof , <nl> grpc_transport_one_way_stats * stats , <nl> - gpr_slice_buffer * outbuf ) ; <nl> + grpc_slice_buffer * outbuf ) ; <nl> <nl> # endif / * GRPC_CORE_EXT_TRANSPORT_CHTTP2_TRANSPORT_FRAME_DATA_H * / <nl> mmm a / src / core / ext / transport / chttp2 / transport / frame_goaway . c <nl> ppp b / src / core / ext / transport / chttp2 / transport / frame_goaway . c <nl> grpc_error * grpc_chttp2_goaway_parser_parse ( grpc_exec_ctx * exec_ctx , <nl> void * parser , <nl> grpc_chttp2_transport * t , <nl> grpc_chttp2_stream * s , <nl> - gpr_slice slice , int is_last ) { <nl> + grpc_slice slice , int is_last ) { <nl> uint8_t * const beg = GPR_SLICE_START_PTR ( slice ) ; <nl> uint8_t * const end = GPR_SLICE_END_PTR ( slice ) ; <nl> uint8_t * cur = beg ; <nl> grpc_error * grpc_chttp2_goaway_parser_parse ( grpc_exec_ctx * exec_ctx , <nl> if ( is_last ) { <nl> grpc_chttp2_add_incoming_goaway ( <nl> exec_ctx , t , ( uint32_t ) p - > error_code , <nl> - gpr_slice_new ( p - > debug_data , p - > debug_length , gpr_free ) ) ; <nl> + grpc_slice_new ( p - > debug_data , p - > debug_length , gpr_free ) ) ; <nl> p - > debug_data = NULL ; <nl> } <nl> return GRPC_ERROR_NONE ; <nl> grpc_error * grpc_chttp2_goaway_parser_parse ( grpc_exec_ctx * exec_ctx , <nl> } <nl> <nl> void grpc_chttp2_goaway_append ( uint32_t last_stream_id , uint32_t error_code , <nl> - gpr_slice debug_data , <nl> - gpr_slice_buffer * slice_buffer ) { <nl> - gpr_slice header = gpr_slice_malloc ( 9 + 4 + 4 ) ; <nl> + grpc_slice debug_data , <nl> + grpc_slice_buffer * slice_buffer ) { <nl> + grpc_slice header = grpc_slice_malloc ( 9 + 4 + 4 ) ; <nl> uint8_t * p = GPR_SLICE_START_PTR ( header ) ; <nl> uint32_t frame_length ; <nl> GPR_ASSERT ( GPR_SLICE_LENGTH ( debug_data ) < UINT32_MAX - 4 - 4 ) ; <nl> void grpc_chttp2_goaway_append ( uint32_t last_stream_id , uint32_t error_code , <nl> * p + + = ( uint8_t ) ( error_code > > 8 ) ; <nl> * p + + = ( uint8_t ) ( error_code ) ; <nl> GPR_ASSERT ( p = = GPR_SLICE_END_PTR ( header ) ) ; <nl> - gpr_slice_buffer_add ( slice_buffer , header ) ; <nl> - gpr_slice_buffer_add ( slice_buffer , debug_data ) ; <nl> + grpc_slice_buffer_add ( slice_buffer , header ) ; <nl> + grpc_slice_buffer_add ( slice_buffer , debug_data ) ; <nl> } <nl> mmm a / src / core / ext / transport / chttp2 / transport / frame_goaway . h <nl> ppp b / src / core / ext / transport / chttp2 / transport / frame_goaway . h <nl> grpc_error * grpc_chttp2_goaway_parser_parse ( grpc_exec_ctx * exec_ctx , <nl> void * parser , <nl> grpc_chttp2_transport * t , <nl> grpc_chttp2_stream * s , <nl> - gpr_slice slice , int is_last ) ; <nl> + grpc_slice slice , int is_last ) ; <nl> <nl> void grpc_chttp2_goaway_append ( uint32_t last_stream_id , uint32_t error_code , <nl> - gpr_slice debug_data , <nl> - gpr_slice_buffer * slice_buffer ) ; <nl> + grpc_slice debug_data , <nl> + grpc_slice_buffer * slice_buffer ) ; <nl> <nl> # endif / * GRPC_CORE_EXT_TRANSPORT_CHTTP2_TRANSPORT_FRAME_GOAWAY_H * / <nl> mmm a / src / core / ext / transport / chttp2 / transport / frame_ping . c <nl> ppp b / src / core / ext / transport / chttp2 / transport / frame_ping . c <nl> <nl> # include < grpc / support / log . h > <nl> # include < grpc / support / string_util . h > <nl> <nl> - gpr_slice grpc_chttp2_ping_create ( uint8_t ack , uint8_t * opaque_8bytes ) { <nl> - gpr_slice slice = gpr_slice_malloc ( 9 + 8 ) ; <nl> + grpc_slice grpc_chttp2_ping_create ( uint8_t ack , uint8_t * opaque_8bytes ) { <nl> + grpc_slice slice = grpc_slice_malloc ( 9 + 8 ) ; <nl> uint8_t * p = GPR_SLICE_START_PTR ( slice ) ; <nl> <nl> * p + + = 0 ; <nl> grpc_error * grpc_chttp2_ping_parser_begin_frame ( grpc_chttp2_ping_parser * parser , <nl> grpc_error * grpc_chttp2_ping_parser_parse ( grpc_exec_ctx * exec_ctx , void * parser , <nl> grpc_chttp2_transport * t , <nl> grpc_chttp2_stream * s , <nl> - gpr_slice slice , int is_last ) { <nl> + grpc_slice slice , int is_last ) { <nl> uint8_t * const beg = GPR_SLICE_START_PTR ( slice ) ; <nl> uint8_t * const end = GPR_SLICE_END_PTR ( slice ) ; <nl> uint8_t * cur = beg ; <nl> grpc_error * grpc_chttp2_ping_parser_parse ( grpc_exec_ctx * exec_ctx , void * parser , <nl> if ( p - > is_ack ) { <nl> grpc_chttp2_ack_ping ( exec_ctx , t , p - > opaque_8bytes ) ; <nl> } else { <nl> - gpr_slice_buffer_add ( & t - > qbuf , <nl> + grpc_slice_buffer_add ( & t - > qbuf , <nl> grpc_chttp2_ping_create ( 1 , p - > opaque_8bytes ) ) ; <nl> grpc_chttp2_initiate_write ( exec_ctx , t , false , " ping response " ) ; <nl> } <nl> mmm a / src / core / ext / transport / chttp2 / transport / frame_ping . h <nl> ppp b / src / core / ext / transport / chttp2 / transport / frame_ping . h <nl> typedef struct { <nl> uint8_t opaque_8bytes [ 8 ] ; <nl> } grpc_chttp2_ping_parser ; <nl> <nl> - gpr_slice grpc_chttp2_ping_create ( uint8_t ack , uint8_t * opaque_8bytes ) ; <nl> + grpc_slice grpc_chttp2_ping_create ( uint8_t ack , uint8_t * opaque_8bytes ) ; <nl> <nl> grpc_error * grpc_chttp2_ping_parser_begin_frame ( grpc_chttp2_ping_parser * parser , <nl> uint32_t length , uint8_t flags ) ; <nl> grpc_error * grpc_chttp2_ping_parser_parse ( grpc_exec_ctx * exec_ctx , void * parser , <nl> grpc_chttp2_transport * t , <nl> grpc_chttp2_stream * s , <nl> - gpr_slice slice , int is_last ) ; <nl> + grpc_slice slice , int is_last ) ; <nl> <nl> # endif / * GRPC_CORE_EXT_TRANSPORT_CHTTP2_TRANSPORT_FRAME_PING_H * / <nl> mmm a / src / core / ext / transport / chttp2 / transport / frame_rst_stream . c <nl> ppp b / src / core / ext / transport / chttp2 / transport / frame_rst_stream . c <nl> <nl> # include " src / core / ext / transport / chttp2 / transport / http2_errors . h " <nl> # include " src / core / ext / transport / chttp2 / transport / status_conversion . h " <nl> <nl> - gpr_slice grpc_chttp2_rst_stream_create ( uint32_t id , uint32_t code , <nl> + grpc_slice grpc_chttp2_rst_stream_create ( uint32_t id , uint32_t code , <nl> grpc_transport_one_way_stats * stats ) { <nl> static const size_t frame_size = 13 ; <nl> - gpr_slice slice = gpr_slice_malloc ( frame_size ) ; <nl> + grpc_slice slice = grpc_slice_malloc ( frame_size ) ; <nl> stats - > framing_bytes + = frame_size ; <nl> uint8_t * p = GPR_SLICE_START_PTR ( slice ) ; <nl> <nl> grpc_error * grpc_chttp2_rst_stream_parser_parse ( grpc_exec_ctx * exec_ctx , <nl> void * parser , <nl> grpc_chttp2_transport * t , <nl> grpc_chttp2_stream * s , <nl> - gpr_slice slice , int is_last ) { <nl> + grpc_slice slice , int is_last ) { <nl> uint8_t * const beg = GPR_SLICE_START_PTR ( slice ) ; <nl> uint8_t * const end = GPR_SLICE_END_PTR ( slice ) ; <nl> uint8_t * cur = beg ; <nl> grpc_error * grpc_chttp2_rst_stream_parser_parse ( grpc_exec_ctx * exec_ctx , <nl> char * status_details ; <nl> gpr_asprintf ( & status_details , " Received RST_STREAM with error code % d " , <nl> reason ) ; <nl> - gpr_slice slice_details = gpr_slice_from_copied_string ( status_details ) ; <nl> + grpc_slice slice_details = grpc_slice_from_copied_string ( status_details ) ; <nl> gpr_free ( status_details ) ; <nl> grpc_chttp2_fake_status ( exec_ctx , t , s , status_code , & slice_details ) ; <nl> } <nl> mmm a / src / core / ext / transport / chttp2 / transport / frame_rst_stream . h <nl> ppp b / src / core / ext / transport / chttp2 / transport / frame_rst_stream . h <nl> typedef struct { <nl> uint8_t reason_bytes [ 4 ] ; <nl> } grpc_chttp2_rst_stream_parser ; <nl> <nl> - gpr_slice grpc_chttp2_rst_stream_create ( uint32_t stream_id , uint32_t code , <nl> + grpc_slice grpc_chttp2_rst_stream_create ( uint32_t stream_id , uint32_t code , <nl> grpc_transport_one_way_stats * stats ) ; <nl> <nl> grpc_error * grpc_chttp2_rst_stream_parser_begin_frame ( <nl> grpc_error * grpc_chttp2_rst_stream_parser_parse ( grpc_exec_ctx * exec_ctx , <nl> void * parser , <nl> grpc_chttp2_transport * t , <nl> grpc_chttp2_stream * s , <nl> - gpr_slice slice , int is_last ) ; <nl> + grpc_slice slice , int is_last ) ; <nl> <nl> # endif / * GRPC_CORE_EXT_TRANSPORT_CHTTP2_TRANSPORT_FRAME_RST_STREAM_H * / <nl> mmm a / src / core / ext / transport / chttp2 / transport / frame_settings . c <nl> ppp b / src / core / ext / transport / chttp2 / transport / frame_settings . c <nl> static uint8_t * fill_header ( uint8_t * out , uint32_t length , uint8_t flags ) { <nl> return out ; <nl> } <nl> <nl> - gpr_slice grpc_chttp2_settings_create ( uint32_t * old , const uint32_t * new , <nl> + grpc_slice grpc_chttp2_settings_create ( uint32_t * old , const uint32_t * new , <nl> uint32_t force_mask , size_t count ) { <nl> size_t i ; <nl> uint32_t n = 0 ; <nl> - gpr_slice output ; <nl> + grpc_slice output ; <nl> uint8_t * p ; <nl> <nl> for ( i = 0 ; i < count ; i + + ) { <nl> n + = ( new [ i ] ! = old [ i ] | | ( force_mask & ( 1u < < i ) ) ! = 0 ) ; <nl> } <nl> <nl> - output = gpr_slice_malloc ( 9 + 6 * n ) ; <nl> + output = grpc_slice_malloc ( 9 + 6 * n ) ; <nl> p = fill_header ( GPR_SLICE_START_PTR ( output ) , 6 * n , 0 ) ; <nl> <nl> for ( i = 0 ; i < count ; i + + ) { <nl> gpr_slice grpc_chttp2_settings_create ( uint32_t * old , const uint32_t * new , <nl> return output ; <nl> } <nl> <nl> - gpr_slice grpc_chttp2_settings_ack_create ( void ) { <nl> - gpr_slice output = gpr_slice_malloc ( 9 ) ; <nl> + grpc_slice grpc_chttp2_settings_ack_create ( void ) { <nl> + grpc_slice output = grpc_slice_malloc ( 9 ) ; <nl> fill_header ( GPR_SLICE_START_PTR ( output ) , 0 , GRPC_CHTTP2_FLAG_ACK ) ; <nl> return output ; <nl> } <nl> grpc_error * grpc_chttp2_settings_parser_begin_frame ( <nl> grpc_error * grpc_chttp2_settings_parser_parse ( grpc_exec_ctx * exec_ctx , void * p , <nl> grpc_chttp2_transport * t , <nl> grpc_chttp2_stream * s , <nl> - gpr_slice slice , int is_last ) { <nl> + grpc_slice slice , int is_last ) { <nl> grpc_chttp2_settings_parser * parser = p ; <nl> const uint8_t * cur = GPR_SLICE_START_PTR ( slice ) ; <nl> const uint8_t * end = GPR_SLICE_END_PTR ( slice ) ; <nl> grpc_error * grpc_chttp2_settings_parser_parse ( grpc_exec_ctx * exec_ctx , void * p , <nl> if ( is_last ) { <nl> memcpy ( parser - > target_settings , parser - > incoming_settings , <nl> GRPC_CHTTP2_NUM_SETTINGS * sizeof ( uint32_t ) ) ; <nl> - gpr_slice_buffer_add ( & t - > qbuf , grpc_chttp2_settings_ack_create ( ) ) ; <nl> + grpc_slice_buffer_add ( & t - > qbuf , grpc_chttp2_settings_ack_create ( ) ) ; <nl> } <nl> return GRPC_ERROR_NONE ; <nl> } <nl> grpc_error * grpc_chttp2_settings_parser_parse ( grpc_exec_ctx * exec_ctx , void * p , <nl> case GRPC_CHTTP2_DISCONNECT_ON_INVALID_VALUE : <nl> grpc_chttp2_goaway_append ( <nl> t - > last_new_stream_id , sp - > error_value , <nl> - gpr_slice_from_static_string ( " HTTP2 settings error " ) , <nl> + grpc_slice_from_static_string ( " HTTP2 settings error " ) , <nl> & t - > qbuf ) ; <nl> gpr_asprintf ( & msg , " invalid value % u passed for % s " , <nl> parser - > value , sp - > name ) ; <nl> mmm a / src / core / ext / transport / chttp2 / transport / frame_settings . h <nl> ppp b / src / core / ext / transport / chttp2 / transport / frame_settings . h <nl> extern const grpc_chttp2_setting_parameters <nl> grpc_chttp2_settings_parameters [ GRPC_CHTTP2_NUM_SETTINGS ] ; <nl> <nl> / * Create a settings frame by diffing old & new , and updating old to be new * / <nl> - gpr_slice grpc_chttp2_settings_create ( uint32_t * old , const uint32_t * new , <nl> + grpc_slice grpc_chttp2_settings_create ( uint32_t * old , const uint32_t * new , <nl> uint32_t force_mask , size_t count ) ; <nl> / * Create an ack settings frame * / <nl> - gpr_slice grpc_chttp2_settings_ack_create ( void ) ; <nl> + grpc_slice grpc_chttp2_settings_ack_create ( void ) ; <nl> <nl> grpc_error * grpc_chttp2_settings_parser_begin_frame ( <nl> grpc_chttp2_settings_parser * parser , uint32_t length , uint8_t flags , <nl> grpc_error * grpc_chttp2_settings_parser_parse ( grpc_exec_ctx * exec_ctx , <nl> void * parser , <nl> grpc_chttp2_transport * t , <nl> grpc_chttp2_stream * s , <nl> - gpr_slice slice , int is_last ) ; <nl> + grpc_slice slice , int is_last ) ; <nl> <nl> # endif / * GRPC_CORE_EXT_TRANSPORT_CHTTP2_TRANSPORT_FRAME_SETTINGS_H * / <nl> mmm a / src / core / ext / transport / chttp2 / transport / frame_window_update . c <nl> ppp b / src / core / ext / transport / chttp2 / transport / frame_window_update . c <nl> <nl> # include < grpc / support / log . h > <nl> # include < grpc / support / string_util . h > <nl> <nl> - gpr_slice grpc_chttp2_window_update_create ( <nl> + grpc_slice grpc_chttp2_window_update_create ( <nl> uint32_t id , uint32_t window_update , grpc_transport_one_way_stats * stats ) { <nl> static const size_t frame_size = 13 ; <nl> - gpr_slice slice = gpr_slice_malloc ( frame_size ) ; <nl> + grpc_slice slice = grpc_slice_malloc ( frame_size ) ; <nl> stats - > header_bytes + = frame_size ; <nl> uint8_t * p = GPR_SLICE_START_PTR ( slice ) ; <nl> <nl> grpc_error * grpc_chttp2_window_update_parser_begin_frame ( <nl> <nl> grpc_error * grpc_chttp2_window_update_parser_parse ( <nl> grpc_exec_ctx * exec_ctx , void * parser , grpc_chttp2_transport * t , <nl> - grpc_chttp2_stream * s , gpr_slice slice , int is_last ) { <nl> + grpc_chttp2_stream * s , grpc_slice slice , int is_last ) { <nl> uint8_t * const beg = GPR_SLICE_START_PTR ( slice ) ; <nl> uint8_t * const end = GPR_SLICE_END_PTR ( slice ) ; <nl> uint8_t * cur = beg ; <nl> mmm a / src / core / ext / transport / chttp2 / transport / frame_window_update . h <nl> ppp b / src / core / ext / transport / chttp2 / transport / frame_window_update . h <nl> typedef struct { <nl> uint32_t amount ; <nl> } grpc_chttp2_window_update_parser ; <nl> <nl> - gpr_slice grpc_chttp2_window_update_create ( uint32_t id , uint32_t window_delta , <nl> + grpc_slice grpc_chttp2_window_update_create ( uint32_t id , uint32_t window_delta , <nl> grpc_transport_one_way_stats * stats ) ; <nl> <nl> grpc_error * grpc_chttp2_window_update_parser_begin_frame ( <nl> grpc_chttp2_window_update_parser * parser , uint32_t length , uint8_t flags ) ; <nl> grpc_error * grpc_chttp2_window_update_parser_parse ( <nl> grpc_exec_ctx * exec_ctx , void * parser , grpc_chttp2_transport * t , <nl> - grpc_chttp2_stream * s , gpr_slice slice , int is_last ) ; <nl> + grpc_chttp2_stream * s , grpc_slice slice , int is_last ) ; <nl> <nl> # endif / * GRPC_CORE_EXT_TRANSPORT_CHTTP2_TRANSPORT_FRAME_WINDOW_UPDATE_H * / <nl> mmm a / src / core / ext / transport / chttp2 / transport / hpack_encoder . c <nl> ppp b / src / core / ext / transport / chttp2 / transport / hpack_encoder . c <nl> typedef struct { <nl> uint8_t seen_regular_header ; <nl> / * output stream id * / <nl> uint32_t stream_id ; <nl> - gpr_slice_buffer * output ; <nl> + grpc_slice_buffer * output ; <nl> grpc_transport_one_way_stats * stats ; <nl> / * maximum size of a frame * / <nl> size_t max_frame_size ; <nl> static void finish_frame ( framer_state * st , int is_header_boundary , <nl> output before beginning * / <nl> static void begin_frame ( framer_state * st ) { <nl> st - > header_idx = <nl> - gpr_slice_buffer_add_indexed ( st - > output , gpr_slice_malloc ( 9 ) ) ; <nl> + grpc_slice_buffer_add_indexed ( st - > output , grpc_slice_malloc ( 9 ) ) ; <nl> st - > output_length_at_start_of_frame = st - > output - > length ; <nl> } <nl> <nl> static void inc_filter ( uint8_t idx , uint32_t * sum , uint8_t * elems ) { <nl> } <nl> } <nl> <nl> - static void add_header_data ( framer_state * st , gpr_slice slice ) { <nl> + static void add_header_data ( framer_state * st , grpc_slice slice ) { <nl> size_t len = GPR_SLICE_LENGTH ( slice ) ; <nl> size_t remaining ; <nl> if ( len = = 0 ) return ; <nl> static void add_header_data ( framer_state * st , gpr_slice slice ) { <nl> st - > output - > length ; <nl> if ( len < = remaining ) { <nl> st - > stats - > header_bytes + = len ; <nl> - gpr_slice_buffer_add ( st - > output , slice ) ; <nl> + grpc_slice_buffer_add ( st - > output , slice ) ; <nl> } else { <nl> st - > stats - > header_bytes + = remaining ; <nl> - gpr_slice_buffer_add ( st - > output , gpr_slice_split_head ( & slice , remaining ) ) ; <nl> + grpc_slice_buffer_add ( st - > output , grpc_slice_split_head ( & slice , remaining ) ) ; <nl> finish_frame ( st , 0 , 0 ) ; <nl> begin_frame ( st ) ; <nl> add_header_data ( st , slice ) ; <nl> static void add_header_data ( framer_state * st , gpr_slice slice ) { <nl> <nl> static uint8_t * add_tiny_header_data ( framer_state * st , size_t len ) { <nl> ensure_space ( st , len ) ; <nl> - return gpr_slice_buffer_tiny_add ( st - > output , len ) ; <nl> + return grpc_slice_buffer_tiny_add ( st - > output , len ) ; <nl> } <nl> <nl> static void evict_entry ( grpc_chttp2_hpack_compressor * c ) { <nl> static void emit_indexed ( grpc_chttp2_hpack_compressor * c , uint32_t elem_index , <nl> len ) ; <nl> } <nl> <nl> - static gpr_slice get_wire_value ( grpc_mdelem * elem , uint8_t * huffman_prefix ) { <nl> + static grpc_slice get_wire_value ( grpc_mdelem * elem , uint8_t * huffman_prefix ) { <nl> if ( grpc_is_binary_header ( ( const char * ) GPR_SLICE_START_PTR ( elem - > key - > slice ) , <nl> GPR_SLICE_LENGTH ( elem - > key - > slice ) ) ) { <nl> * huffman_prefix = 0x80 ; <nl> static void emit_lithdr_incidx ( grpc_chttp2_hpack_compressor * c , <nl> framer_state * st ) { <nl> uint32_t len_pfx = GRPC_CHTTP2_VARINT_LENGTH ( key_index , 2 ) ; <nl> uint8_t huffman_prefix ; <nl> - gpr_slice value_slice = get_wire_value ( elem , & huffman_prefix ) ; <nl> + grpc_slice value_slice = get_wire_value ( elem , & huffman_prefix ) ; <nl> size_t len_val = GPR_SLICE_LENGTH ( value_slice ) ; <nl> uint32_t len_val_len ; <nl> GPR_ASSERT ( len_val < = UINT32_MAX ) ; <nl> static void emit_lithdr_incidx ( grpc_chttp2_hpack_compressor * c , <nl> add_tiny_header_data ( st , len_pfx ) , len_pfx ) ; <nl> GRPC_CHTTP2_WRITE_VARINT ( ( uint32_t ) len_val , 1 , huffman_prefix , <nl> add_tiny_header_data ( st , len_val_len ) , len_val_len ) ; <nl> - add_header_data ( st , gpr_slice_ref ( value_slice ) ) ; <nl> + add_header_data ( st , grpc_slice_ref ( value_slice ) ) ; <nl> } <nl> <nl> static void emit_lithdr_noidx ( grpc_chttp2_hpack_compressor * c , <nl> static void emit_lithdr_noidx ( grpc_chttp2_hpack_compressor * c , <nl> framer_state * st ) { <nl> uint32_t len_pfx = GRPC_CHTTP2_VARINT_LENGTH ( key_index , 4 ) ; <nl> uint8_t huffman_prefix ; <nl> - gpr_slice value_slice = get_wire_value ( elem , & huffman_prefix ) ; <nl> + grpc_slice value_slice = get_wire_value ( elem , & huffman_prefix ) ; <nl> size_t len_val = GPR_SLICE_LENGTH ( value_slice ) ; <nl> uint32_t len_val_len ; <nl> GPR_ASSERT ( len_val < = UINT32_MAX ) ; <nl> static void emit_lithdr_noidx ( grpc_chttp2_hpack_compressor * c , <nl> add_tiny_header_data ( st , len_pfx ) , len_pfx ) ; <nl> GRPC_CHTTP2_WRITE_VARINT ( ( uint32_t ) len_val , 1 , huffman_prefix , <nl> add_tiny_header_data ( st , len_val_len ) , len_val_len ) ; <nl> - add_header_data ( st , gpr_slice_ref ( value_slice ) ) ; <nl> + add_header_data ( st , grpc_slice_ref ( value_slice ) ) ; <nl> } <nl> <nl> static void emit_lithdr_incidx_v ( grpc_chttp2_hpack_compressor * c , <nl> grpc_mdelem * elem , framer_state * st ) { <nl> uint32_t len_key = ( uint32_t ) GPR_SLICE_LENGTH ( elem - > key - > slice ) ; <nl> uint8_t huffman_prefix ; <nl> - gpr_slice value_slice = get_wire_value ( elem , & huffman_prefix ) ; <nl> + grpc_slice value_slice = get_wire_value ( elem , & huffman_prefix ) ; <nl> uint32_t len_val = ( uint32_t ) GPR_SLICE_LENGTH ( value_slice ) ; <nl> uint32_t len_key_len = GRPC_CHTTP2_VARINT_LENGTH ( len_key , 1 ) ; <nl> uint32_t len_val_len = GRPC_CHTTP2_VARINT_LENGTH ( len_val , 1 ) ; <nl> static void emit_lithdr_incidx_v ( grpc_chttp2_hpack_compressor * c , <nl> * add_tiny_header_data ( st , 1 ) = 0x40 ; <nl> GRPC_CHTTP2_WRITE_VARINT ( len_key , 1 , 0x00 , <nl> add_tiny_header_data ( st , len_key_len ) , len_key_len ) ; <nl> - add_header_data ( st , gpr_slice_ref ( elem - > key - > slice ) ) ; <nl> + add_header_data ( st , grpc_slice_ref ( elem - > key - > slice ) ) ; <nl> GRPC_CHTTP2_WRITE_VARINT ( len_val , 1 , huffman_prefix , <nl> add_tiny_header_data ( st , len_val_len ) , len_val_len ) ; <nl> - add_header_data ( st , gpr_slice_ref ( value_slice ) ) ; <nl> + add_header_data ( st , grpc_slice_ref ( value_slice ) ) ; <nl> } <nl> <nl> static void emit_lithdr_noidx_v ( grpc_chttp2_hpack_compressor * c , <nl> grpc_mdelem * elem , framer_state * st ) { <nl> uint32_t len_key = ( uint32_t ) GPR_SLICE_LENGTH ( elem - > key - > slice ) ; <nl> uint8_t huffman_prefix ; <nl> - gpr_slice value_slice = get_wire_value ( elem , & huffman_prefix ) ; <nl> + grpc_slice value_slice = get_wire_value ( elem , & huffman_prefix ) ; <nl> uint32_t len_val = ( uint32_t ) GPR_SLICE_LENGTH ( value_slice ) ; <nl> uint32_t len_key_len = GRPC_CHTTP2_VARINT_LENGTH ( len_key , 1 ) ; <nl> uint32_t len_val_len = GRPC_CHTTP2_VARINT_LENGTH ( len_val , 1 ) ; <nl> static void emit_lithdr_noidx_v ( grpc_chttp2_hpack_compressor * c , <nl> * add_tiny_header_data ( st , 1 ) = 0x00 ; <nl> GRPC_CHTTP2_WRITE_VARINT ( len_key , 1 , 0x00 , <nl> add_tiny_header_data ( st , len_key_len ) , len_key_len ) ; <nl> - add_header_data ( st , gpr_slice_ref ( elem - > key - > slice ) ) ; <nl> + add_header_data ( st , grpc_slice_ref ( elem - > key - > slice ) ) ; <nl> GRPC_CHTTP2_WRITE_VARINT ( len_val , 1 , huffman_prefix , <nl> add_tiny_header_data ( st , len_val_len ) , len_val_len ) ; <nl> - add_header_data ( st , gpr_slice_ref ( value_slice ) ) ; <nl> + add_header_data ( st , grpc_slice_ref ( value_slice ) ) ; <nl> } <nl> <nl> static void emit_advertise_table_size_change ( grpc_chttp2_hpack_compressor * c , <nl> void grpc_chttp2_encode_header ( grpc_chttp2_hpack_compressor * c , <nl> grpc_metadata_batch * metadata , int is_eof , <nl> size_t max_frame_size , <nl> grpc_transport_one_way_stats * stats , <nl> - gpr_slice_buffer * outbuf ) { <nl> + grpc_slice_buffer * outbuf ) { <nl> framer_state st ; <nl> grpc_linked_mdelem * l ; <nl> gpr_timespec deadline ; <nl> mmm a / src / core / ext / transport / chttp2 / transport / hpack_encoder . h <nl> ppp b / src / core / ext / transport / chttp2 / transport / hpack_encoder . h <nl> void grpc_chttp2_encode_header ( grpc_chttp2_hpack_compressor * c , uint32_t id , <nl> grpc_metadata_batch * metadata , int is_eof , <nl> size_t max_frame_size , <nl> grpc_transport_one_way_stats * stats , <nl> - gpr_slice_buffer * outbuf ) ; <nl> + grpc_slice_buffer * outbuf ) ; <nl> <nl> # endif / * GRPC_CORE_EXT_TRANSPORT_CHTTP2_TRANSPORT_HPACK_ENCODER_H * / <nl> mmm a / src / core / ext / transport / chttp2 / transport / hpack_parser . c <nl> ppp b / src / core / ext / transport / chttp2 / transport / hpack_parser . c <nl> grpc_error * grpc_chttp2_header_parser_parse ( grpc_exec_ctx * exec_ctx , <nl> void * hpack_parser , <nl> grpc_chttp2_transport * t , <nl> grpc_chttp2_stream * s , <nl> - gpr_slice slice , int is_last ) { <nl> + grpc_slice slice , int is_last ) { <nl> grpc_chttp2_hpack_parser * parser = hpack_parser ; <nl> GPR_TIMER_BEGIN ( " grpc_chttp2_hpack_parser_parse " , 0 ) ; <nl> if ( s ! = NULL ) { <nl> mmm a / src / core / ext / transport / chttp2 / transport / hpack_parser . h <nl> ppp b / src / core / ext / transport / chttp2 / transport / hpack_parser . h <nl> grpc_error * grpc_chttp2_header_parser_parse ( grpc_exec_ctx * exec_ctx , <nl> void * hpack_parser , <nl> grpc_chttp2_transport * t , <nl> grpc_chttp2_stream * s , <nl> - gpr_slice slice , int is_last ) ; <nl> + grpc_slice slice , int is_last ) ; <nl> <nl> # endif / * GRPC_CORE_EXT_TRANSPORT_CHTTP2_TRANSPORT_HPACK_PARSER_H * / <nl> mmm a / src / core / ext / transport / chttp2 / transport / internal . h <nl> ppp b / src / core / ext / transport / chttp2 / transport / internal . h <nl> struct grpc_chttp2_incoming_byte_stream { <nl> bool is_tail ; <nl> <nl> gpr_mu slice_mu ; / / protects slices , on_next <nl> - gpr_slice_buffer slices ; <nl> + grpc_slice_buffer slices ; <nl> grpc_closure * on_next ; <nl> - gpr_slice * next ; <nl> + grpc_slice * next ; <nl> uint32_t remaining_bytes ; <nl> <nl> struct { <nl> grpc_closure closure ; <nl> - gpr_slice * slice ; <nl> + grpc_slice * slice ; <nl> size_t max_size_hint ; <nl> grpc_closure * on_complete ; <nl> } next_action ; <nl> struct grpc_chttp2_transport { <nl> grpc_closure read_action_locked ; <nl> <nl> / * * incoming read bytes * / <nl> - gpr_slice_buffer read_buffer ; <nl> + grpc_slice_buffer read_buffer ; <nl> <nl> / * * address to place a newly accepted stream - set and unset by <nl> grpc_chttp2_parsing_accept_stream ; used by init_stream to <nl> struct grpc_chttp2_transport { <nl> } channel_callback ; <nl> <nl> / * * data to write now * / <nl> - gpr_slice_buffer outbuf ; <nl> + grpc_slice_buffer outbuf ; <nl> / * * hpack encoding * / <nl> grpc_chttp2_hpack_compressor hpack_compressor ; <nl> int64_t outgoing_window ; <nl> struct grpc_chttp2_transport { <nl> uint8_t is_client ; <nl> <nl> / * * data to write next write * / <nl> - gpr_slice_buffer qbuf ; <nl> + grpc_slice_buffer qbuf ; <nl> <nl> / * * window available to announce to peer * / <nl> int64_t announce_incoming_window ; <nl> struct grpc_chttp2_transport { <nl> grpc_chttp2_stream * incoming_stream ; <nl> grpc_error * ( * parser ) ( grpc_exec_ctx * exec_ctx , void * parser_user_data , <nl> grpc_chttp2_transport * t , grpc_chttp2_stream * s , <nl> - gpr_slice slice , int is_last ) ; <nl> + grpc_slice slice , int is_last ) ; <nl> <nl> / * goaway data * / <nl> grpc_status_code goaway_error ; <nl> uint32_t goaway_last_stream_index ; <nl> - gpr_slice goaway_text ; <nl> + grpc_slice goaway_text ; <nl> <nl> grpc_chttp2_write_cb * write_cb_pool ; <nl> <nl> struct grpc_chttp2_stream { <nl> <nl> grpc_byte_stream * fetching_send_message ; <nl> uint32_t fetched_send_message_length ; <nl> - gpr_slice fetching_slice ; <nl> + grpc_slice fetching_slice ; <nl> int64_t next_message_end_offset ; <nl> int64_t flow_controlled_bytes_written ; <nl> bool complete_fetch_covered_by_poller ; <nl> struct grpc_chttp2_stream { <nl> bool sent_trailing_metadata ; <nl> / * * how much window should we announce ? * / <nl> uint32_t announce_window ; <nl> - gpr_slice_buffer flow_controlled_buffer ; <nl> + grpc_slice_buffer flow_controlled_buffer ; <nl> <nl> grpc_chttp2_write_cb * on_write_finished_cbs ; <nl> grpc_chttp2_write_cb * finish_after_write ; <nl> void grpc_chttp2_end_write ( grpc_exec_ctx * exec_ctx , grpc_chttp2_transport * t , <nl> / * * Process one slice of incoming data ; return 1 if the connection is still <nl> viable after reading , or 0 if the connection should be torn down * / <nl> grpc_error * grpc_chttp2_perform_read ( grpc_exec_ctx * exec_ctx , <nl> - grpc_chttp2_transport * t , gpr_slice slice ) ; <nl> + grpc_chttp2_transport * t , grpc_slice slice ) ; <nl> <nl> bool grpc_chttp2_list_add_writable_stream ( grpc_chttp2_transport * t , <nl> grpc_chttp2_stream * s ) ; <nl> grpc_chttp2_stream * grpc_chttp2_parsing_accept_stream ( grpc_exec_ctx * exec_ctx , <nl> void grpc_chttp2_add_incoming_goaway ( grpc_exec_ctx * exec_ctx , <nl> grpc_chttp2_transport * t , <nl> uint32_t goaway_error , <nl> - gpr_slice goaway_text ) ; <nl> + grpc_slice goaway_text ) ; <nl> <nl> void grpc_chttp2_parsing_become_skip_parser ( grpc_exec_ctx * exec_ctx , <nl> grpc_chttp2_transport * t ) ; <nl> void grpc_chttp2_flowctl_trace ( const char * file , int line , const char * phase , <nl> <nl> void grpc_chttp2_fake_status ( grpc_exec_ctx * exec_ctx , grpc_chttp2_transport * t , <nl> grpc_chttp2_stream * stream , <nl> - grpc_status_code status , gpr_slice * details ) ; <nl> + grpc_status_code status , grpc_slice * details ) ; <nl> void grpc_chttp2_mark_stream_closed ( grpc_exec_ctx * exec_ctx , <nl> grpc_chttp2_transport * t , <nl> grpc_chttp2_stream * s , int close_reads , <nl> grpc_chttp2_incoming_byte_stream * grpc_chttp2_incoming_byte_stream_create ( <nl> uint32_t frame_size , uint32_t flags ) ; <nl> void grpc_chttp2_incoming_byte_stream_push ( grpc_exec_ctx * exec_ctx , <nl> grpc_chttp2_incoming_byte_stream * bs , <nl> - gpr_slice slice ) ; <nl> + grpc_slice slice ) ; <nl> void grpc_chttp2_incoming_byte_stream_finished ( <nl> grpc_exec_ctx * exec_ctx , grpc_chttp2_incoming_byte_stream * bs , <nl> grpc_error * error ) ; <nl> mmm a / src / core / ext / transport / chttp2 / transport / parsing . c <nl> ppp b / src / core / ext / transport / chttp2 / transport / parsing . c <nl> static grpc_error * init_skip_frame_parser ( grpc_exec_ctx * exec_ctx , <nl> int is_header ) ; <nl> <nl> static grpc_error * parse_frame_slice ( grpc_exec_ctx * exec_ctx , <nl> - grpc_chttp2_transport * t , gpr_slice slice , <nl> + grpc_chttp2_transport * t , grpc_slice slice , <nl> int is_last ) ; <nl> <nl> grpc_error * grpc_chttp2_perform_read ( grpc_exec_ctx * exec_ctx , <nl> grpc_chttp2_transport * t , <nl> - gpr_slice slice ) { <nl> + grpc_slice slice ) { <nl> uint8_t * beg = GPR_SLICE_START_PTR ( slice ) ; <nl> uint8_t * end = GPR_SLICE_END_PTR ( slice ) ; <nl> uint8_t * cur = beg ; <nl> grpc_error * grpc_chttp2_perform_read ( grpc_exec_ctx * exec_ctx , <nl> GPR_ASSERT ( cur < end ) ; <nl> if ( ( uint32_t ) ( end - cur ) = = t - > incoming_frame_size ) { <nl> err = parse_frame_slice ( exec_ctx , t , <nl> - gpr_slice_sub_no_ref ( slice , ( size_t ) ( cur - beg ) , <nl> + grpc_slice_sub_no_ref ( slice , ( size_t ) ( cur - beg ) , <nl> ( size_t ) ( end - beg ) ) , <nl> 1 ) ; <nl> if ( err ! = GRPC_ERROR_NONE ) { <nl> grpc_error * grpc_chttp2_perform_read ( grpc_exec_ctx * exec_ctx , <nl> size_t cur_offset = ( size_t ) ( cur - beg ) ; <nl> err = parse_frame_slice ( <nl> exec_ctx , t , <nl> - gpr_slice_sub_no_ref ( slice , cur_offset , <nl> + grpc_slice_sub_no_ref ( slice , cur_offset , <nl> cur_offset + t - > incoming_frame_size ) , <nl> 1 ) ; <nl> if ( err ! = GRPC_ERROR_NONE ) { <nl> grpc_error * grpc_chttp2_perform_read ( grpc_exec_ctx * exec_ctx , <nl> goto dts_fh_0 ; / * loop * / <nl> } else { <nl> err = parse_frame_slice ( exec_ctx , t , <nl> - gpr_slice_sub_no_ref ( slice , ( size_t ) ( cur - beg ) , <nl> + grpc_slice_sub_no_ref ( slice , ( size_t ) ( cur - beg ) , <nl> ( size_t ) ( end - beg ) ) , <nl> 0 ) ; <nl> if ( err ! = GRPC_ERROR_NONE ) { <nl> static grpc_error * init_frame_parser ( grpc_exec_ctx * exec_ctx , <nl> <nl> static grpc_error * skip_parser ( grpc_exec_ctx * exec_ctx , void * parser , <nl> grpc_chttp2_transport * t , grpc_chttp2_stream * s , <nl> - gpr_slice slice , int is_last ) { <nl> + grpc_slice slice , int is_last ) { <nl> return GRPC_ERROR_NONE ; <nl> } <nl> <nl> static grpc_error * init_data_frame_parser ( grpc_exec_ctx * exec_ctx , <nl> if ( s ! = NULL ) { <nl> grpc_chttp2_mark_stream_closed ( exec_ctx , t , s , true , false , err ) ; <nl> } <nl> - gpr_slice_buffer_add ( <nl> + grpc_slice_buffer_add ( <nl> & t - > qbuf , grpc_chttp2_rst_stream_create ( t - > incoming_stream_id , <nl> GRPC_CHTTP2_PROTOCOL_ERROR , <nl> & s - > stats . outgoing ) ) ; <nl> static grpc_error * init_settings_frame_parser ( grpc_exec_ctx * exec_ctx , <nl> } <nl> <nl> static grpc_error * parse_frame_slice ( grpc_exec_ctx * exec_ctx , <nl> - grpc_chttp2_transport * t , gpr_slice slice , <nl> + grpc_chttp2_transport * t , grpc_slice slice , <nl> int is_last ) { <nl> grpc_chttp2_stream * s = t - > incoming_stream ; <nl> grpc_error * err = t - > parser ( exec_ctx , t - > parser_data , t , s , slice , is_last ) ; <nl> static grpc_error * parse_frame_slice ( grpc_exec_ctx * exec_ctx , <nl> grpc_chttp2_parsing_become_skip_parser ( exec_ctx , t ) ; <nl> if ( s ) { <nl> s - > forced_close_error = err ; <nl> - gpr_slice_buffer_add ( <nl> + grpc_slice_buffer_add ( <nl> & t - > qbuf , grpc_chttp2_rst_stream_create ( t - > incoming_stream_id , <nl> GRPC_CHTTP2_PROTOCOL_ERROR , <nl> & s - > stats . outgoing ) ) ; <nl> mmm a / src / core / ext / transport / chttp2 / transport / writing . c <nl> ppp b / src / core / ext / transport / chttp2 / transport / writing . c <nl> bool grpc_chttp2_begin_write ( grpc_exec_ctx * exec_ctx , <nl> GPR_TIMER_BEGIN ( " grpc_chttp2_begin_write " , 0 ) ; <nl> <nl> if ( t - > dirtied_local_settings & & ! t - > sent_local_settings ) { <nl> - gpr_slice_buffer_add ( <nl> + grpc_slice_buffer_add ( <nl> & t - > outbuf , <nl> grpc_chttp2_settings_create ( <nl> t - > settings [ GRPC_SENT_SETTINGS ] , t - > settings [ GRPC_LOCAL_SETTINGS ] , <nl> bool grpc_chttp2_begin_write ( grpc_exec_ctx * exec_ctx , <nl> } <nl> <nl> / * simple writes are queued to qbuf , and flushed here * / <nl> - gpr_slice_buffer_move_into ( & t - > qbuf , & t - > outbuf ) ; <nl> + grpc_slice_buffer_move_into ( & t - > qbuf , & t - > outbuf ) ; <nl> GPR_ASSERT ( t - > qbuf . count = = 0 ) ; <nl> <nl> grpc_chttp2_hpack_compressor_set_max_table_size ( <nl> bool grpc_chttp2_begin_write ( grpc_exec_ctx * exec_ctx , <nl> / * send any window updates * / <nl> if ( s - > announce_window > 0 ) { <nl> uint32_t announce = s - > announce_window ; <nl> - gpr_slice_buffer_add ( & t - > outbuf , <nl> + grpc_slice_buffer_add ( & t - > outbuf , <nl> grpc_chttp2_window_update_create ( <nl> s - > id , s - > announce_window , & s - > stats . outgoing ) ) ; <nl> GRPC_CHTTP2_FLOW_DEBIT_STREAM ( " write " , t , s , announce_window , announce ) ; <nl> bool grpc_chttp2_begin_write ( grpc_exec_ctx * exec_ctx , <nl> s - > send_trailing_metadata = NULL ; <nl> s - > sent_trailing_metadata = true ; <nl> if ( ! t - > is_client & & ! s - > read_closed ) { <nl> - gpr_slice_buffer_add ( & t - > outbuf , grpc_chttp2_rst_stream_create ( <nl> + grpc_slice_buffer_add ( & t - > outbuf , grpc_chttp2_rst_stream_create ( <nl> s - > id , GRPC_CHTTP2_NO_ERROR , <nl> & s - > stats . outgoing ) ) ; <nl> } <nl> bool grpc_chttp2_begin_write ( grpc_exec_ctx * exec_ctx , <nl> s - > send_trailing_metadata = NULL ; <nl> s - > sent_trailing_metadata = true ; <nl> if ( ! t - > is_client & & ! s - > read_closed ) { <nl> - gpr_slice_buffer_add ( <nl> + grpc_slice_buffer_add ( <nl> & t - > outbuf , grpc_chttp2_rst_stream_create ( <nl> s - > id , GRPC_CHTTP2_NO_ERROR , & s - > stats . outgoing ) ) ; <nl> } <nl> bool grpc_chttp2_begin_write ( grpc_exec_ctx * exec_ctx , <nl> GRPC_CHTTP2_FLOW_DEBIT_TRANSPORT ( " write " , t , announce_incoming_window , <nl> announced ) ; <nl> grpc_transport_one_way_stats throwaway_stats ; <nl> - gpr_slice_buffer_add ( & t - > outbuf , grpc_chttp2_window_update_create ( <nl> + grpc_slice_buffer_add ( & t - > outbuf , grpc_chttp2_window_update_create ( <nl> 0 , announced , & throwaway_stats ) ) ; <nl> } <nl> <nl> void grpc_chttp2_end_write ( grpc_exec_ctx * exec_ctx , grpc_chttp2_transport * t , <nl> } <nl> GRPC_CHTTP2_STREAM_UNREF ( exec_ctx , s , " chttp2_writing : end " ) ; <nl> } <nl> - gpr_slice_buffer_reset_and_unref ( & t - > outbuf ) ; <nl> + grpc_slice_buffer_reset_and_unref ( & t - > outbuf ) ; <nl> GRPC_ERROR_UNREF ( error ) ; <nl> GPR_TIMER_END ( " grpc_chttp2_end_write " , 0 ) ; <nl> } <nl> mmm a / src / core / ext / transport / cronet / transport / cronet_transport . c <nl> ppp b / src / core / ext / transport / cronet / transport / cronet_transport . c <nl> struct read_state { <nl> <nl> / * vars for holding data destined for the application * / <nl> struct grpc_slice_buffer_stream sbs ; <nl> - gpr_slice_buffer read_slice_buffer ; <nl> + grpc_slice_buffer read_slice_buffer ; <nl> <nl> / * vars for trailing metadata * / <nl> grpc_chttp2_incoming_metadata_buffer trailing_metadata ; <nl> static void on_response_trailers_received ( <nl> Utility function that takes the data from s - > write_slice_buffer and assembles <nl> into a contiguous byte stream with 5 byte gRPC header prepended . <nl> * / <nl> - static void create_grpc_frame ( gpr_slice_buffer * write_slice_buffer , <nl> + static void create_grpc_frame ( grpc_slice_buffer * write_slice_buffer , <nl> char * * pp_write_buffer , <nl> size_t * p_write_buffer_size ) { <nl> - gpr_slice slice = gpr_slice_buffer_take_first ( write_slice_buffer ) ; <nl> + grpc_slice slice = grpc_slice_buffer_take_first ( write_slice_buffer ) ; <nl> size_t length = GPR_SLICE_LENGTH ( slice ) ; <nl> * p_write_buffer_size = length + GRPC_HEADER_SIZE_IN_BYTES ; <nl> / * This is freed in the on_write_completed callback * / <nl> static enum e_op_result execute_stream_op ( grpc_exec_ctx * exec_ctx , <nl> result = NO_ACTION_POSSIBLE ; <nl> CRONET_LOG ( GPR_DEBUG , " Stream is either cancelled or failed . " ) ; <nl> } else { <nl> - gpr_slice_buffer write_slice_buffer ; <nl> - gpr_slice slice ; <nl> - gpr_slice_buffer_init ( & write_slice_buffer ) ; <nl> + grpc_slice_buffer write_slice_buffer ; <nl> + grpc_slice slice ; <nl> + grpc_slice_buffer_init ( & write_slice_buffer ) ; <nl> grpc_byte_stream_next ( NULL , stream_op - > send_message , & slice , <nl> stream_op - > send_message - > length , NULL ) ; <nl> / * Check that compression flag is OFF . We don ' t support compression yet . <nl> static enum e_op_result execute_stream_op ( grpc_exec_ctx * exec_ctx , <nl> gpr_log ( GPR_ERROR , " Compression is not supported " ) ; <nl> GPR_ASSERT ( stream_op - > send_message - > flags = = 0 ) ; <nl> } <nl> - gpr_slice_buffer_add ( & write_slice_buffer , slice ) ; <nl> + grpc_slice_buffer_add ( & write_slice_buffer , slice ) ; <nl> if ( write_slice_buffer . count ! = 1 ) { <nl> / * Empty request not handled yet * / <nl> gpr_log ( GPR_ERROR , " Empty request is not supported " ) ; <nl> static enum e_op_result execute_stream_op ( grpc_exec_ctx * exec_ctx , <nl> } else { <nl> stream_state - > rs . remaining_bytes = 0 ; <nl> CRONET_LOG ( GPR_DEBUG , " read operation complete . Empty response . " ) ; <nl> - gpr_slice_buffer_init ( & stream_state - > rs . read_slice_buffer ) ; <nl> + grpc_slice_buffer_init ( & stream_state - > rs . read_slice_buffer ) ; <nl> grpc_slice_buffer_stream_init ( & stream_state - > rs . sbs , <nl> & stream_state - > rs . read_slice_buffer , 0 ) ; <nl> * ( ( grpc_byte_buffer * * ) stream_op - > recv_message ) = <nl> static enum e_op_result execute_stream_op ( grpc_exec_ctx * exec_ctx , <nl> } <nl> } else if ( stream_state - > rs . remaining_bytes = = 0 ) { <nl> CRONET_LOG ( GPR_DEBUG , " read operation complete " ) ; <nl> - gpr_slice read_data_slice = <nl> - gpr_slice_malloc ( ( uint32_t ) stream_state - > rs . length_field ) ; <nl> + grpc_slice read_data_slice = <nl> + grpc_slice_malloc ( ( uint32_t ) stream_state - > rs . length_field ) ; <nl> uint8_t * dst_p = GPR_SLICE_START_PTR ( read_data_slice ) ; <nl> memcpy ( dst_p , stream_state - > rs . read_buffer , <nl> ( size_t ) stream_state - > rs . length_field ) ; <nl> free_read_buffer ( s ) ; <nl> - gpr_slice_buffer_init ( & stream_state - > rs . read_slice_buffer ) ; <nl> - gpr_slice_buffer_add ( & stream_state - > rs . read_slice_buffer , <nl> + grpc_slice_buffer_init ( & stream_state - > rs . read_slice_buffer ) ; <nl> + grpc_slice_buffer_add ( & stream_state - > rs . read_slice_buffer , <nl> read_data_slice ) ; <nl> grpc_slice_buffer_stream_init ( & stream_state - > rs . sbs , <nl> & stream_state - > rs . read_slice_buffer , 0 ) ; <nl> mmm a / src / core / lib / channel / channel_stack . c <nl> ppp b / src / core / lib / channel / channel_stack . c <nl> void grpc_call_element_send_cancel ( grpc_exec_ctx * exec_ctx , <nl> void grpc_call_element_send_cancel_with_message ( grpc_exec_ctx * exec_ctx , <nl> grpc_call_element * elem , <nl> grpc_status_code status , <nl> - gpr_slice * optional_message ) { <nl> + grpc_slice * optional_message ) { <nl> grpc_transport_stream_op * op = gpr_malloc ( sizeof ( * op ) ) ; <nl> memset ( op , 0 , sizeof ( * op ) ) ; <nl> op - > on_complete = grpc_closure_create ( destroy_op , op ) ; <nl> void grpc_call_element_send_cancel_with_message ( grpc_exec_ctx * exec_ctx , <nl> void grpc_call_element_send_close_with_message ( grpc_exec_ctx * exec_ctx , <nl> grpc_call_element * elem , <nl> grpc_status_code status , <nl> - gpr_slice * optional_message ) { <nl> + grpc_slice * optional_message ) { <nl> grpc_transport_stream_op * op = gpr_malloc ( sizeof ( * op ) ) ; <nl> memset ( op , 0 , sizeof ( * op ) ) ; <nl> op - > on_complete = grpc_closure_create ( destroy_op , op ) ; <nl> mmm a / src / core / lib / channel / channel_stack . h <nl> ppp b / src / core / lib / channel / channel_stack . h <nl> void grpc_call_element_send_cancel ( grpc_exec_ctx * exec_ctx , <nl> void grpc_call_element_send_cancel_with_message ( grpc_exec_ctx * exec_ctx , <nl> grpc_call_element * cur_elem , <nl> grpc_status_code status , <nl> - gpr_slice * optional_message ) ; <nl> + grpc_slice * optional_message ) ; <nl> <nl> void grpc_call_element_send_close_with_message ( grpc_exec_ctx * exec_ctx , <nl> grpc_call_element * cur_elem , <nl> grpc_status_code status , <nl> - gpr_slice * optional_message ) ; <nl> + grpc_slice * optional_message ) ; <nl> <nl> extern int grpc_trace_channel ; <nl> <nl> mmm a / src / core / lib / channel / compress_filter . c <nl> ppp b / src / core / lib / channel / compress_filter . c <nl> <nl> int grpc_compression_trace = 0 ; <nl> <nl> typedef struct call_data { <nl> - gpr_slice_buffer slices ; / * * < Buffers up input slices to be compressed * / <nl> + grpc_slice_buffer slices ; / * * < Buffers up input slices to be compressed * / <nl> grpc_linked_mdelem compression_algorithm_storage ; <nl> grpc_linked_mdelem accept_encoding_storage ; <nl> uint32_t remaining_slice_bytes ; <nl> typedef struct call_data { <nl> grpc_transport_stream_op * send_op ; <nl> uint32_t send_length ; <nl> uint32_t send_flags ; <nl> - gpr_slice incoming_slice ; <nl> + grpc_slice incoming_slice ; <nl> grpc_slice_buffer_stream replacement_stream ; <nl> grpc_closure * post_send ; <nl> grpc_closure send_done ; <nl> static void continue_send_message ( grpc_exec_ctx * exec_ctx , <nl> static void send_done ( grpc_exec_ctx * exec_ctx , void * elemp , grpc_error * error ) { <nl> grpc_call_element * elem = elemp ; <nl> call_data * calld = elem - > call_data ; <nl> - gpr_slice_buffer_reset_and_unref ( & calld - > slices ) ; <nl> + grpc_slice_buffer_reset_and_unref ( & calld - > slices ) ; <nl> calld - > post_send - > cb ( exec_ctx , calld - > post_send - > cb_arg , error ) ; <nl> } <nl> <nl> static void finish_send_message ( grpc_exec_ctx * exec_ctx , <nl> grpc_call_element * elem ) { <nl> call_data * calld = elem - > call_data ; <nl> int did_compress ; <nl> - gpr_slice_buffer tmp ; <nl> - gpr_slice_buffer_init ( & tmp ) ; <nl> + grpc_slice_buffer tmp ; <nl> + grpc_slice_buffer_init ( & tmp ) ; <nl> did_compress = <nl> grpc_msg_compress ( calld - > compression_algorithm , & calld - > slices , & tmp ) ; <nl> if ( did_compress ) { <nl> static void finish_send_message ( grpc_exec_ctx * exec_ctx , <nl> " bytes ( % . 2f % % savings ) " , <nl> algo_name , before_size , after_size , 100 * savings_ratio ) ; <nl> } <nl> - gpr_slice_buffer_swap ( & calld - > slices , & tmp ) ; <nl> + grpc_slice_buffer_swap ( & calld - > slices , & tmp ) ; <nl> calld - > send_flags | = GRPC_WRITE_INTERNAL_COMPRESS ; <nl> } else { <nl> if ( grpc_compression_trace ) { <nl> static void finish_send_message ( grpc_exec_ctx * exec_ctx , <nl> } <nl> } <nl> <nl> - gpr_slice_buffer_destroy ( & tmp ) ; <nl> + grpc_slice_buffer_destroy ( & tmp ) ; <nl> <nl> grpc_slice_buffer_stream_init ( & calld - > replacement_stream , & calld - > slices , <nl> calld - > send_flags ) ; <nl> static void finish_send_message ( grpc_exec_ctx * exec_ctx , <nl> static void got_slice ( grpc_exec_ctx * exec_ctx , void * elemp , grpc_error * error ) { <nl> grpc_call_element * elem = elemp ; <nl> call_data * calld = elem - > call_data ; <nl> - gpr_slice_buffer_add ( & calld - > slices , calld - > incoming_slice ) ; <nl> + grpc_slice_buffer_add ( & calld - > slices , calld - > incoming_slice ) ; <nl> if ( calld - > send_length = = calld - > slices . length ) { <nl> finish_send_message ( exec_ctx , elem ) ; <nl> } else { <nl> static void continue_send_message ( grpc_exec_ctx * exec_ctx , <nl> while ( grpc_byte_stream_next ( exec_ctx , calld - > send_op - > send_message , <nl> & calld - > incoming_slice , ~ ( size_t ) 0 , <nl> & calld - > got_slice ) ) { <nl> - gpr_slice_buffer_add ( & calld - > slices , calld - > incoming_slice ) ; <nl> + grpc_slice_buffer_add ( & calld - > slices , calld - > incoming_slice ) ; <nl> if ( calld - > send_length = = calld - > slices . length ) { <nl> finish_send_message ( exec_ctx , elem ) ; <nl> break ; <nl> static grpc_error * init_call_elem ( grpc_exec_ctx * exec_ctx , <nl> call_data * calld = elem - > call_data ; <nl> <nl> / * initialize members * / <nl> - gpr_slice_buffer_init ( & calld - > slices ) ; <nl> + grpc_slice_buffer_init ( & calld - > slices ) ; <nl> calld - > has_compression_algorithm = 0 ; <nl> grpc_closure_init ( & calld - > got_slice , got_slice , elem ) ; <nl> grpc_closure_init ( & calld - > send_done , send_done , elem ) ; <nl> static void destroy_call_elem ( grpc_exec_ctx * exec_ctx , grpc_call_element * elem , <nl> void * ignored ) { <nl> / * grab pointers to our data from the call element * / <nl> call_data * calld = elem - > call_data ; <nl> - gpr_slice_buffer_destroy ( & calld - > slices ) ; <nl> + grpc_slice_buffer_destroy ( & calld - > slices ) ; <nl> } <nl> <nl> / * Constructor for channel_data * / <nl> mmm a / src / core / lib / channel / deadline_filter . c <nl> ppp b / src / core / lib / channel / deadline_filter . c <nl> static void timer_callback ( grpc_exec_ctx * exec_ctx , void * arg , <nl> deadline_state - > timer_pending = false ; <nl> gpr_mu_unlock ( & deadline_state - > timer_mu ) ; <nl> if ( error ! = GRPC_ERROR_CANCELLED ) { <nl> - gpr_slice msg = gpr_slice_from_static_string ( " Deadline Exceeded " ) ; <nl> + grpc_slice msg = grpc_slice_from_static_string ( " Deadline Exceeded " ) ; <nl> grpc_call_element_send_cancel_with_message ( <nl> exec_ctx , elem , GRPC_STATUS_DEADLINE_EXCEEDED , & msg ) ; <nl> - gpr_slice_unref ( msg ) ; <nl> + grpc_slice_unref ( msg ) ; <nl> } <nl> GRPC_CALL_STACK_UNREF ( exec_ctx , deadline_state - > call_stack , " deadline_timer " ) ; <nl> } <nl> mmm a / src / core / lib / channel / handshaker . c <nl> ppp b / src / core / lib / channel / handshaker . c <nl> void grpc_handshaker_do_handshake ( grpc_exec_ctx * exec_ctx , <nl> grpc_handshaker * handshaker , <nl> grpc_endpoint * endpoint , <nl> grpc_channel_args * args , <nl> - gpr_slice_buffer * read_buffer , <nl> + grpc_slice_buffer * read_buffer , <nl> gpr_timespec deadline , <nl> grpc_tcp_server_acceptor * acceptor , <nl> grpc_handshaker_done_cb cb , void * user_data ) { <nl> void grpc_handshake_manager_shutdown ( grpc_exec_ctx * exec_ctx , <nl> static void call_next_handshaker ( grpc_exec_ctx * exec_ctx , <nl> grpc_endpoint * endpoint , <nl> grpc_channel_args * args , <nl> - gpr_slice_buffer * read_buffer , void * user_data , <nl> + grpc_slice_buffer * read_buffer , void * user_data , <nl> grpc_error * error ) { <nl> grpc_handshake_manager * mgr = user_data ; <nl> GPR_ASSERT ( mgr - > state ! = NULL ) ; <nl> void grpc_handshake_manager_do_handshake ( <nl> gpr_timespec deadline , grpc_tcp_server_acceptor * acceptor , <nl> grpc_handshaker_done_cb cb , void * user_data ) { <nl> grpc_channel_args * args_copy = grpc_channel_args_copy ( args ) ; <nl> - gpr_slice_buffer * read_buffer = gpr_malloc ( sizeof ( * read_buffer ) ) ; <nl> - gpr_slice_buffer_init ( read_buffer ) ; <nl> + grpc_slice_buffer * read_buffer = gpr_malloc ( sizeof ( * read_buffer ) ) ; <nl> + grpc_slice_buffer_init ( read_buffer ) ; <nl> if ( mgr - > count = = 0 ) { <nl> / / No handshakers registered , so we just immediately call the done <nl> / / callback with the passed - in endpoint . <nl> mmm a / src / core / lib / channel / handshaker . h <nl> ppp b / src / core / lib / channel / handshaker . h <nl> typedef struct grpc_handshaker grpc_handshaker ; <nl> typedef void ( * grpc_handshaker_done_cb ) ( grpc_exec_ctx * exec_ctx , <nl> grpc_endpoint * endpoint , <nl> grpc_channel_args * args , <nl> - gpr_slice_buffer * read_buffer , <nl> + grpc_slice_buffer * read_buffer , <nl> void * user_data , grpc_error * error ) ; <nl> <nl> struct grpc_handshaker_vtable { <nl> struct grpc_handshaker_vtable { <nl> / / / \ a acceptor will be NULL for client - side handshakers . <nl> void ( * do_handshake ) ( grpc_exec_ctx * exec_ctx , grpc_handshaker * handshaker , <nl> grpc_endpoint * endpoint , grpc_channel_args * args , <nl> - gpr_slice_buffer * read_buffer , gpr_timespec deadline , <nl> + grpc_slice_buffer * read_buffer , gpr_timespec deadline , <nl> grpc_tcp_server_acceptor * acceptor , <nl> grpc_handshaker_done_cb cb , void * user_data ) ; <nl> } ; <nl> void grpc_handshaker_do_handshake ( grpc_exec_ctx * exec_ctx , <nl> grpc_handshaker * handshaker , <nl> grpc_endpoint * endpoint , <nl> grpc_channel_args * args , <nl> - gpr_slice_buffer * read_buffer , <nl> + grpc_slice_buffer * read_buffer , <nl> gpr_timespec deadline , <nl> grpc_tcp_server_acceptor * acceptor , <nl> grpc_handshaker_done_cb cb , void * user_data ) ; <nl> mmm a / src / core / lib / channel / http_client_filter . c <nl> ppp b / src / core / lib / channel / http_client_filter . c <nl> typedef struct call_data { <nl> grpc_transport_stream_op send_op ; <nl> uint32_t send_length ; <nl> uint32_t send_flags ; <nl> - gpr_slice incoming_slice ; <nl> + grpc_slice incoming_slice ; <nl> grpc_slice_buffer_stream replacement_stream ; <nl> - gpr_slice_buffer slices ; <nl> + grpc_slice_buffer slices ; <nl> / * flag that indicates that all slices of send_messages aren ' t availble * / <nl> bool send_message_blocked ; <nl> <nl> static grpc_mdelem * client_recv_filter ( void * user_data , grpc_mdelem * md ) { <nl> char * message_string ; <nl> gpr_asprintf ( & message_string , " Received http2 header with status : % s " , <nl> grpc_mdstr_as_c_string ( md - > value ) ) ; <nl> - gpr_slice message = gpr_slice_from_copied_string ( message_string ) ; <nl> + grpc_slice message = grpc_slice_from_copied_string ( message_string ) ; <nl> gpr_free ( message_string ) ; <nl> grpc_call_element_send_close_with_message ( a - > exec_ctx , a - > elem , <nl> GRPC_STATUS_CANCELLED , & message ) ; <nl> static void hc_on_complete ( grpc_exec_ctx * exec_ctx , void * user_data , <nl> static void send_done ( grpc_exec_ctx * exec_ctx , void * elemp , grpc_error * error ) { <nl> grpc_call_element * elem = elemp ; <nl> call_data * calld = elem - > call_data ; <nl> - gpr_slice_buffer_reset_and_unref ( & calld - > slices ) ; <nl> + grpc_slice_buffer_reset_and_unref ( & calld - > slices ) ; <nl> calld - > post_send - > cb ( exec_ctx , calld - > post_send - > cb_arg , error ) ; <nl> } <nl> <nl> static void continue_send_message ( grpc_exec_ctx * exec_ctx , <nl> memcpy ( wrptr , GPR_SLICE_START_PTR ( calld - > incoming_slice ) , <nl> GPR_SLICE_LENGTH ( calld - > incoming_slice ) ) ; <nl> wrptr + = GPR_SLICE_LENGTH ( calld - > incoming_slice ) ; <nl> - gpr_slice_buffer_add ( & calld - > slices , calld - > incoming_slice ) ; <nl> + grpc_slice_buffer_add ( & calld - > slices , calld - > incoming_slice ) ; <nl> if ( calld - > send_length = = calld - > slices . length ) { <nl> calld - > send_message_blocked = false ; <nl> break ; <nl> static void got_slice ( grpc_exec_ctx * exec_ctx , void * elemp , grpc_error * error ) { <nl> grpc_call_element * elem = elemp ; <nl> call_data * calld = elem - > call_data ; <nl> calld - > send_message_blocked = false ; <nl> - gpr_slice_buffer_add ( & calld - > slices , calld - > incoming_slice ) ; <nl> + grpc_slice_buffer_add ( & calld - > slices , calld - > incoming_slice ) ; <nl> if ( calld - > send_length = = calld - > slices . length ) { <nl> / * Pass down the original send_message op that was blocked . * / <nl> grpc_slice_buffer_stream_init ( & calld - > replacement_stream , & calld - > slices , <nl> static grpc_error * init_call_elem ( grpc_exec_ctx * exec_ctx , <nl> calld - > on_done_recv = NULL ; <nl> calld - > on_complete = NULL ; <nl> calld - > payload_bytes = NULL ; <nl> - gpr_slice_buffer_init ( & calld - > slices ) ; <nl> + grpc_slice_buffer_init ( & calld - > slices ) ; <nl> grpc_closure_init ( & calld - > hc_on_recv , hc_on_recv , elem ) ; <nl> grpc_closure_init ( & calld - > hc_on_complete , hc_on_complete , elem ) ; <nl> grpc_closure_init ( & calld - > got_slice , got_slice , elem ) ; <nl> static void destroy_call_elem ( grpc_exec_ctx * exec_ctx , grpc_call_element * elem , <nl> const grpc_call_final_info * final_info , <nl> void * ignored ) { <nl> call_data * calld = elem - > call_data ; <nl> - gpr_slice_buffer_destroy ( & calld - > slices ) ; <nl> + grpc_slice_buffer_destroy ( & calld - > slices ) ; <nl> } <nl> <nl> static grpc_mdelem * scheme_from_args ( const grpc_channel_args * args ) { <nl> mmm a / src / core / lib / channel / http_server_filter . c <nl> ppp b / src / core / lib / channel / http_server_filter . c <nl> typedef struct call_data { <nl> grpc_closure * recv_message_ready ; <nl> grpc_closure * on_complete ; <nl> grpc_byte_stream * * pp_recv_message ; <nl> - gpr_slice_buffer read_slice_buffer ; <nl> + grpc_slice_buffer read_slice_buffer ; <nl> grpc_slice_buffer_stream read_stream ; <nl> <nl> / * * Receive closures are chained : we inject this closure as the on_done_recv <nl> static grpc_mdelem * server_filter ( void * user_data , grpc_mdelem * md ) { <nl> / * Retrieve the payload from the value of the ' grpc - internal - payload - bin ' <nl> header field * / <nl> calld - > seen_payload_bin = 1 ; <nl> - gpr_slice_buffer_init ( & calld - > read_slice_buffer ) ; <nl> - gpr_slice_buffer_add ( & calld - > read_slice_buffer , <nl> - gpr_slice_ref ( md - > value - > slice ) ) ; <nl> + grpc_slice_buffer_init ( & calld - > read_slice_buffer ) ; <nl> + grpc_slice_buffer_add ( & calld - > read_slice_buffer , <nl> + grpc_slice_ref ( md - > value - > slice ) ) ; <nl> grpc_slice_buffer_stream_init ( & calld - > read_stream , <nl> & calld - > read_slice_buffer , 0 ) ; <nl> return NULL ; <nl> mmm a / src / core / lib / channel / message_size_filter . c <nl> ppp b / src / core / lib / channel / message_size_filter . c <nl> static void start_transport_stream_op ( grpc_exec_ctx * exec_ctx , <nl> char * message_string ; <nl> gpr_asprintf ( & message_string , " Sent message larger than max ( % u vs . % d ) " , <nl> op - > send_message - > length , calld - > max_send_size ) ; <nl> - gpr_slice message = gpr_slice_from_copied_string ( message_string ) ; <nl> + grpc_slice message = grpc_slice_from_copied_string ( message_string ) ; <nl> gpr_free ( message_string ) ; <nl> grpc_call_element_send_close_with_message ( <nl> exec_ctx , elem , GRPC_STATUS_INVALID_ARGUMENT , & message ) ; <nl> mmm a / src / core / lib / compression / message_compress . c <nl> ppp b / src / core / lib / compression / message_compress . c <nl> <nl> <nl> # define OUTPUT_BLOCK_SIZE 1024 <nl> <nl> - static int zlib_body ( z_stream * zs , gpr_slice_buffer * input , <nl> - gpr_slice_buffer * output , <nl> + static int zlib_body ( z_stream * zs , grpc_slice_buffer * input , <nl> + grpc_slice_buffer * output , <nl> int ( * flate ) ( z_stream * zs , int flush ) ) { <nl> int r ; <nl> int flush ; <nl> size_t i ; <nl> - gpr_slice outbuf = gpr_slice_malloc ( OUTPUT_BLOCK_SIZE ) ; <nl> + grpc_slice outbuf = grpc_slice_malloc ( OUTPUT_BLOCK_SIZE ) ; <nl> const uInt uint_max = ~ ( uInt ) 0 ; <nl> <nl> GPR_ASSERT ( GPR_SLICE_LENGTH ( outbuf ) < = uint_max ) ; <nl> static int zlib_body ( z_stream * zs , gpr_slice_buffer * input , <nl> zs - > next_in = GPR_SLICE_START_PTR ( input - > slices [ i ] ) ; <nl> do { <nl> if ( zs - > avail_out = = 0 ) { <nl> - gpr_slice_buffer_add_indexed ( output , outbuf ) ; <nl> - outbuf = gpr_slice_malloc ( OUTPUT_BLOCK_SIZE ) ; <nl> + grpc_slice_buffer_add_indexed ( output , outbuf ) ; <nl> + outbuf = grpc_slice_malloc ( OUTPUT_BLOCK_SIZE ) ; <nl> GPR_ASSERT ( GPR_SLICE_LENGTH ( outbuf ) < = uint_max ) ; <nl> zs - > avail_out = ( uInt ) GPR_SLICE_LENGTH ( outbuf ) ; <nl> zs - > next_out = GPR_SLICE_START_PTR ( outbuf ) ; <nl> static int zlib_body ( z_stream * zs , gpr_slice_buffer * input , <nl> <nl> GPR_ASSERT ( outbuf . refcount ) ; <nl> outbuf . data . refcounted . length - = zs - > avail_out ; <nl> - gpr_slice_buffer_add_indexed ( output , outbuf ) ; <nl> + grpc_slice_buffer_add_indexed ( output , outbuf ) ; <nl> <nl> return 1 ; <nl> <nl> error : <nl> - gpr_slice_unref ( outbuf ) ; <nl> + grpc_slice_unref ( outbuf ) ; <nl> return 0 ; <nl> } <nl> <nl> static void * zalloc_gpr ( void * opaque , unsigned int items , unsigned int size ) { <nl> <nl> static void zfree_gpr ( void * opaque , void * address ) { gpr_free ( address ) ; } <nl> <nl> - static int zlib_compress ( gpr_slice_buffer * input , gpr_slice_buffer * output , <nl> + static int zlib_compress ( grpc_slice_buffer * input , grpc_slice_buffer * output , <nl> int gzip ) { <nl> z_stream zs ; <nl> int r ; <nl> static int zlib_compress ( gpr_slice_buffer * input , gpr_slice_buffer * output , <nl> r = zlib_body ( & zs , input , output , deflate ) & & output - > length < input - > length ; <nl> if ( ! r ) { <nl> for ( i = count_before ; i < output - > count ; i + + ) { <nl> - gpr_slice_unref ( output - > slices [ i ] ) ; <nl> + grpc_slice_unref ( output - > slices [ i ] ) ; <nl> } <nl> output - > count = count_before ; <nl> output - > length = length_before ; <nl> static int zlib_compress ( gpr_slice_buffer * input , gpr_slice_buffer * output , <nl> return r ; <nl> } <nl> <nl> - static int zlib_decompress ( gpr_slice_buffer * input , gpr_slice_buffer * output , <nl> + static int zlib_decompress ( grpc_slice_buffer * input , grpc_slice_buffer * output , <nl> int gzip ) { <nl> z_stream zs ; <nl> int r ; <nl> static int zlib_decompress ( gpr_slice_buffer * input , gpr_slice_buffer * output , <nl> r = zlib_body ( & zs , input , output , inflate ) ; <nl> if ( ! r ) { <nl> for ( i = count_before ; i < output - > count ; i + + ) { <nl> - gpr_slice_unref ( output - > slices [ i ] ) ; <nl> + grpc_slice_unref ( output - > slices [ i ] ) ; <nl> } <nl> output - > count = count_before ; <nl> output - > length = length_before ; <nl> static int zlib_decompress ( gpr_slice_buffer * input , gpr_slice_buffer * output , <nl> return r ; <nl> } <nl> <nl> - static int copy ( gpr_slice_buffer * input , gpr_slice_buffer * output ) { <nl> + static int copy ( grpc_slice_buffer * input , grpc_slice_buffer * output ) { <nl> size_t i ; <nl> for ( i = 0 ; i < input - > count ; i + + ) { <nl> - gpr_slice_buffer_add ( output , gpr_slice_ref ( input - > slices [ i ] ) ) ; <nl> + grpc_slice_buffer_add ( output , grpc_slice_ref ( input - > slices [ i ] ) ) ; <nl> } <nl> return 1 ; <nl> } <nl> <nl> static int compress_inner ( grpc_compression_algorithm algorithm , <nl> - gpr_slice_buffer * input , gpr_slice_buffer * output ) { <nl> + grpc_slice_buffer * input , grpc_slice_buffer * output ) { <nl> switch ( algorithm ) { <nl> case GRPC_COMPRESS_NONE : <nl> / * the fallback path always needs to be send uncompressed : we simply <nl> static int compress_inner ( grpc_compression_algorithm algorithm , <nl> } <nl> <nl> int grpc_msg_compress ( grpc_compression_algorithm algorithm , <nl> - gpr_slice_buffer * input , gpr_slice_buffer * output ) { <nl> + grpc_slice_buffer * input , grpc_slice_buffer * output ) { <nl> if ( ! compress_inner ( algorithm , input , output ) ) { <nl> copy ( input , output ) ; <nl> return 0 ; <nl> int grpc_msg_compress ( grpc_compression_algorithm algorithm , <nl> } <nl> <nl> int grpc_msg_decompress ( grpc_compression_algorithm algorithm , <nl> - gpr_slice_buffer * input , gpr_slice_buffer * output ) { <nl> + grpc_slice_buffer * input , grpc_slice_buffer * output ) { <nl> switch ( algorithm ) { <nl> case GRPC_COMPRESS_NONE : <nl> return copy ( input , output ) ; <nl> mmm a / src / core / lib / compression / message_compress . h <nl> ppp b / src / core / lib / compression / message_compress . h <nl> <nl> On success , appends compressed slices to output and returns 1 . <nl> On failure , appends uncompressed slices to output and returns 0 . * / <nl> int grpc_msg_compress ( grpc_compression_algorithm algorithm , <nl> - gpr_slice_buffer * input , gpr_slice_buffer * output ) ; <nl> + grpc_slice_buffer * input , grpc_slice_buffer * output ) ; <nl> <nl> / * decompress ' input ' to ' output ' using ' algorithm ' . <nl> On success , appends slices to output and returns 1 . <nl> On failure , output is unchanged , and returns 0 . * / <nl> int grpc_msg_decompress ( grpc_compression_algorithm algorithm , <nl> - gpr_slice_buffer * input , gpr_slice_buffer * output ) ; <nl> + grpc_slice_buffer * input , grpc_slice_buffer * output ) ; <nl> <nl> # endif / * GRPC_CORE_LIB_COMPRESSION_MESSAGE_COMPRESS_H * / <nl> mmm a / src / core / lib / http / format_request . c <nl> ppp b / src / core / lib / http / format_request . c <nl> static void fill_common_header ( const grpc_httpcli_request * request , <nl> } <nl> } <nl> <nl> - gpr_slice grpc_httpcli_format_get_request ( const grpc_httpcli_request * request ) { <nl> + grpc_slice grpc_httpcli_format_get_request ( const grpc_httpcli_request * request ) { <nl> gpr_strvec out ; <nl> char * flat ; <nl> size_t flat_len ; <nl> gpr_slice grpc_httpcli_format_get_request ( const grpc_httpcli_request * request ) { <nl> flat = gpr_strvec_flatten ( & out , & flat_len ) ; <nl> gpr_strvec_destroy ( & out ) ; <nl> <nl> - return gpr_slice_new ( flat , flat_len , gpr_free ) ; <nl> + return grpc_slice_new ( flat , flat_len , gpr_free ) ; <nl> } <nl> <nl> - gpr_slice grpc_httpcli_format_post_request ( const grpc_httpcli_request * request , <nl> + grpc_slice grpc_httpcli_format_post_request ( const grpc_httpcli_request * request , <nl> const char * body_bytes , <nl> size_t body_size ) { <nl> gpr_strvec out ; <nl> gpr_slice grpc_httpcli_format_post_request ( const grpc_httpcli_request * request , <nl> out_len + = body_size ; <nl> } <nl> <nl> - return gpr_slice_new ( tmp , out_len , gpr_free ) ; <nl> + return grpc_slice_new ( tmp , out_len , gpr_free ) ; <nl> } <nl> <nl> - gpr_slice grpc_httpcli_format_connect_request ( <nl> + grpc_slice grpc_httpcli_format_connect_request ( <nl> const grpc_httpcli_request * request ) { <nl> gpr_strvec out ; <nl> gpr_strvec_init ( & out ) ; <nl> gpr_slice grpc_httpcli_format_connect_request ( <nl> size_t flat_len ; <nl> char * flat = gpr_strvec_flatten ( & out , & flat_len ) ; <nl> gpr_strvec_destroy ( & out ) ; <nl> - return gpr_slice_new ( flat , flat_len , gpr_free ) ; <nl> + return grpc_slice_new ( flat , flat_len , gpr_free ) ; <nl> } <nl> mmm a / src / core / lib / http / format_request . h <nl> ppp b / src / core / lib / http / format_request . h <nl> <nl> # include < grpc / support / slice . h > <nl> # include " src / core / lib / http / httpcli . h " <nl> <nl> - gpr_slice grpc_httpcli_format_get_request ( const grpc_httpcli_request * request ) ; <nl> - gpr_slice grpc_httpcli_format_post_request ( const grpc_httpcli_request * request , <nl> + grpc_slice grpc_httpcli_format_get_request ( const grpc_httpcli_request * request ) ; <nl> + grpc_slice grpc_httpcli_format_post_request ( const grpc_httpcli_request * request , <nl> const char * body_bytes , <nl> size_t body_size ) ; <nl> - gpr_slice grpc_httpcli_format_connect_request ( <nl> + grpc_slice grpc_httpcli_format_connect_request ( <nl> const grpc_httpcli_request * request ) ; <nl> <nl> # endif / * GRPC_CORE_LIB_HTTP_FORMAT_REQUEST_H * / <nl> mmm a / src / core / lib / http / httpcli . c <nl> ppp b / src / core / lib / http / httpcli . c <nl> <nl> # include " src / core / lib / support / string . h " <nl> <nl> typedef struct { <nl> - gpr_slice request_text ; <nl> + grpc_slice request_text ; <nl> grpc_http_parser parser ; <nl> grpc_resolved_addresses * addresses ; <nl> size_t next_address ; <nl> typedef struct { <nl> grpc_httpcli_context * context ; <nl> grpc_polling_entity * pollent ; <nl> grpc_iomgr_object iomgr_obj ; <nl> - gpr_slice_buffer incoming ; <nl> - gpr_slice_buffer outgoing ; <nl> + grpc_slice_buffer incoming ; <nl> + grpc_slice_buffer outgoing ; <nl> grpc_closure on_read ; <nl> grpc_closure done_write ; <nl> grpc_closure connected ; <nl> static void finish ( grpc_exec_ctx * exec_ctx , internal_request * req , <nl> if ( req - > ep ! = NULL ) { <nl> grpc_endpoint_destroy ( exec_ctx , req - > ep ) ; <nl> } <nl> - gpr_slice_unref ( req - > request_text ) ; <nl> + grpc_slice_unref ( req - > request_text ) ; <nl> gpr_free ( req - > host ) ; <nl> gpr_free ( req - > ssl_host_override ) ; <nl> grpc_iomgr_unregister_object ( & req - > iomgr_obj ) ; <nl> - gpr_slice_buffer_destroy ( & req - > incoming ) ; <nl> - gpr_slice_buffer_destroy ( & req - > outgoing ) ; <nl> + grpc_slice_buffer_destroy ( & req - > incoming ) ; <nl> + grpc_slice_buffer_destroy ( & req - > outgoing ) ; <nl> GRPC_ERROR_UNREF ( req - > overall_error ) ; <nl> grpc_resource_quota_internal_unref ( exec_ctx , req - > resource_quota ) ; <nl> gpr_free ( req ) ; <nl> static void done_write ( grpc_exec_ctx * exec_ctx , void * arg , grpc_error * error ) { <nl> } <nl> <nl> static void start_write ( grpc_exec_ctx * exec_ctx , internal_request * req ) { <nl> - gpr_slice_ref ( req - > request_text ) ; <nl> - gpr_slice_buffer_add ( & req - > outgoing , req - > request_text ) ; <nl> + grpc_slice_ref ( req - > request_text ) ; <nl> + grpc_slice_buffer_add ( & req - > outgoing , req - > request_text ) ; <nl> grpc_endpoint_write ( exec_ctx , req - > ep , & req - > outgoing , & req - > done_write ) ; <nl> } <nl> <nl> static void internal_request_begin ( grpc_exec_ctx * exec_ctx , <nl> const grpc_httpcli_request * request , <nl> gpr_timespec deadline , grpc_closure * on_done , <nl> grpc_httpcli_response * response , <nl> - const char * name , gpr_slice request_text ) { <nl> + const char * name , grpc_slice request_text ) { <nl> internal_request * req = gpr_malloc ( sizeof ( internal_request ) ) ; <nl> memset ( req , 0 , sizeof ( * req ) ) ; <nl> req - > request_text = request_text ; <nl> static void internal_request_begin ( grpc_exec_ctx * exec_ctx , <nl> req - > resource_quota = grpc_resource_quota_internal_ref ( resource_quota ) ; <nl> grpc_closure_init ( & req - > on_read , on_read , req ) ; <nl> grpc_closure_init ( & req - > done_write , done_write , req ) ; <nl> - gpr_slice_buffer_init ( & req - > incoming ) ; <nl> - gpr_slice_buffer_init ( & req - > outgoing ) ; <nl> + grpc_slice_buffer_init ( & req - > incoming ) ; <nl> + grpc_slice_buffer_init ( & req - > outgoing ) ; <nl> grpc_iomgr_register_object ( & req - > iomgr_obj , name ) ; <nl> req - > host = gpr_strdup ( request - > host ) ; <nl> req - > ssl_host_override = gpr_strdup ( request - > ssl_host_override ) ; <nl> mmm a / src / core / lib / http / httpcli_security_connector . c <nl> ppp b / src / core / lib / http / httpcli_security_connector . c <nl> static void httpcli_ssl_destroy ( grpc_security_connector * sc ) { <nl> static void httpcli_ssl_do_handshake ( grpc_exec_ctx * exec_ctx , <nl> grpc_channel_security_connector * sc , <nl> grpc_endpoint * nonsecure_endpoint , <nl> - gpr_slice_buffer * read_buffer , <nl> + grpc_slice_buffer * read_buffer , <nl> gpr_timespec deadline , <nl> grpc_security_handshake_done_cb cb , <nl> void * user_data ) { <nl> mmm a / src / core / lib / http / parser . c <nl> ppp b / src / core / lib / http / parser . c <nl> void grpc_http_response_destroy ( grpc_http_response * response ) { <nl> gpr_free ( response - > hdrs ) ; <nl> } <nl> <nl> - grpc_error * grpc_http_parser_parse ( grpc_http_parser * parser , gpr_slice slice , <nl> + grpc_error * grpc_http_parser_parse ( grpc_http_parser * parser , grpc_slice slice , <nl> size_t * start_of_body ) { <nl> for ( size_t i = 0 ; i < GPR_SLICE_LENGTH ( slice ) ; i + + ) { <nl> bool found_body_start = false ; <nl> mmm a / src / core / lib / http / parser . h <nl> ppp b / src / core / lib / http / parser . h <nl> void grpc_http_parser_init ( grpc_http_parser * parser , grpc_http_type type , <nl> void grpc_http_parser_destroy ( grpc_http_parser * parser ) ; <nl> <nl> / * Sets \ a start_of_body to the offset in \ a slice of the start of the body . * / <nl> - grpc_error * grpc_http_parser_parse ( grpc_http_parser * parser , gpr_slice slice , <nl> + grpc_error * grpc_http_parser_parse ( grpc_http_parser * parser , grpc_slice slice , <nl> size_t * start_of_body ) ; <nl> grpc_error * grpc_http_parser_eof ( grpc_http_parser * parser ) ; <nl> <nl> mmm a / src / core / lib / iomgr / endpoint . c <nl> ppp b / src / core / lib / iomgr / endpoint . c <nl> <nl> # include " src / core / lib / iomgr / endpoint . h " <nl> <nl> void grpc_endpoint_read ( grpc_exec_ctx * exec_ctx , grpc_endpoint * ep , <nl> - gpr_slice_buffer * slices , grpc_closure * cb ) { <nl> + grpc_slice_buffer * slices , grpc_closure * cb ) { <nl> ep - > vtable - > read ( exec_ctx , ep , slices , cb ) ; <nl> } <nl> <nl> void grpc_endpoint_write ( grpc_exec_ctx * exec_ctx , grpc_endpoint * ep , <nl> - gpr_slice_buffer * slices , grpc_closure * cb ) { <nl> + grpc_slice_buffer * slices , grpc_closure * cb ) { <nl> ep - > vtable - > write ( exec_ctx , ep , slices , cb ) ; <nl> } <nl> <nl> mmm a / src / core / lib / iomgr / endpoint . h <nl> ppp b / src / core / lib / iomgr / endpoint . h <nl> typedef struct grpc_endpoint_vtable grpc_endpoint_vtable ; <nl> <nl> struct grpc_endpoint_vtable { <nl> void ( * read ) ( grpc_exec_ctx * exec_ctx , grpc_endpoint * ep , <nl> - gpr_slice_buffer * slices , grpc_closure * cb ) ; <nl> + grpc_slice_buffer * slices , grpc_closure * cb ) ; <nl> void ( * write ) ( grpc_exec_ctx * exec_ctx , grpc_endpoint * ep , <nl> - gpr_slice_buffer * slices , grpc_closure * cb ) ; <nl> + grpc_slice_buffer * slices , grpc_closure * cb ) ; <nl> grpc_workqueue * ( * get_workqueue ) ( grpc_endpoint * ep ) ; <nl> void ( * add_to_pollset ) ( grpc_exec_ctx * exec_ctx , grpc_endpoint * ep , <nl> grpc_pollset * pollset ) ; <nl> struct grpc_endpoint_vtable { <nl> Valid slices may be placed into \ a slices even when the callback is <nl> invoked with error ! = GRPC_ERROR_NONE . * / <nl> void grpc_endpoint_read ( grpc_exec_ctx * exec_ctx , grpc_endpoint * ep , <nl> - gpr_slice_buffer * slices , grpc_closure * cb ) ; <nl> + grpc_slice_buffer * slices , grpc_closure * cb ) ; <nl> <nl> char * grpc_endpoint_get_peer ( grpc_endpoint * ep ) ; <nl> <nl> grpc_workqueue * grpc_endpoint_get_workqueue ( grpc_endpoint * ep ) ; <nl> it is a valid slice buffer . <nl> * / <nl> void grpc_endpoint_write ( grpc_exec_ctx * exec_ctx , grpc_endpoint * ep , <nl> - gpr_slice_buffer * slices , grpc_closure * cb ) ; <nl> + grpc_slice_buffer * slices , grpc_closure * cb ) ; <nl> <nl> / * Causes any pending and future read / write callbacks to run immediately with <nl> success = = 0 * / <nl> mmm a / src / core / lib / iomgr / load_file . c <nl> ppp b / src / core / lib / iomgr / load_file . c <nl> <nl> # include " src / core / lib / support / string . h " <nl> <nl> grpc_error * grpc_load_file ( const char * filename , int add_null_terminator , <nl> - gpr_slice * output ) { <nl> + grpc_slice * output ) { <nl> unsigned char * contents = NULL ; <nl> size_t contents_size = 0 ; <nl> - gpr_slice result = gpr_empty_slice ( ) ; <nl> + grpc_slice result = gpr_empty_slice ( ) ; <nl> FILE * file ; <nl> size_t bytes_read = 0 ; <nl> grpc_error * error = GRPC_ERROR_NONE ; <nl> grpc_error * grpc_load_file ( const char * filename , int add_null_terminator , <nl> if ( add_null_terminator ) { <nl> contents [ contents_size + + ] = 0 ; <nl> } <nl> - result = gpr_slice_new ( contents , contents_size , gpr_free ) ; <nl> + result = grpc_slice_new ( contents , contents_size , gpr_free ) ; <nl> <nl> end : <nl> * output = result ; <nl> mmm a / src / core / lib / iomgr / load_file . h <nl> ppp b / src / core / lib / iomgr / load_file . h <nl> extern " C " { <nl> / * Loads the content of a file into a slice . add_null_terminator will add <nl> a NULL terminator if non - zero . * / <nl> grpc_error * grpc_load_file ( const char * filename , int add_null_terminator , <nl> - gpr_slice * slice ) ; <nl> + grpc_slice * slice ) ; <nl> <nl> # ifdef __cplusplus <nl> } <nl> mmm a / src / core / lib / iomgr / resource_quota . c <nl> ppp b / src / core / lib / iomgr / resource_quota . c <nl> static bool rq_reclaim ( grpc_exec_ctx * exec_ctx , <nl> * / <nl> <nl> typedef struct { <nl> - gpr_slice_refcount base ; <nl> + grpc_slice_refcount base ; <nl> gpr_refcount refs ; <nl> grpc_resource_user * resource_user ; <nl> size_t size ; <nl> static void ru_slice_unref ( void * p ) { <nl> / * TODO ( ctiller ) : this is dangerous , but I think safe for now : <nl> we have no guarantee here that we ' re at a safe point for creating an <nl> execution context , but we have no way of writing this code otherwise . <nl> - In the future : consider lifting gpr_slice to grpc , and offering an <nl> + In the future : consider lifting grpc_slice to grpc , and offering an <nl> internal_ { ref , unref } pair that is execution context aware . <nl> Alternatively , <nl> make exec_ctx be thread local and ' do the right thing ' ( whatever that <nl> static void ru_slice_unref ( void * p ) { <nl> } <nl> } <nl> <nl> - static gpr_slice ru_slice_create ( grpc_resource_user * resource_user , <nl> + static grpc_slice ru_slice_create ( grpc_resource_user * resource_user , <nl> size_t size ) { <nl> ru_slice_refcount * rc = gpr_malloc ( sizeof ( ru_slice_refcount ) + size ) ; <nl> rc - > base . ref = ru_slice_ref ; <nl> static gpr_slice ru_slice_create ( grpc_resource_user * resource_user , <nl> gpr_ref_init ( & rc - > refs , 1 ) ; <nl> rc - > resource_user = resource_user ; <nl> rc - > size = size ; <nl> - gpr_slice slice ; <nl> + grpc_slice slice ; <nl> slice . refcount = & rc - > base ; <nl> slice . data . refcounted . bytes = ( uint8_t * ) ( rc + 1 ) ; <nl> slice . data . refcounted . length = size ; <nl> static void ru_allocated_slices ( grpc_exec_ctx * exec_ctx , void * arg , <nl> grpc_resource_user_slice_allocator * slice_allocator = arg ; <nl> if ( error = = GRPC_ERROR_NONE ) { <nl> for ( size_t i = 0 ; i < slice_allocator - > count ; i + + ) { <nl> - gpr_slice_buffer_add_indexed ( <nl> + grpc_slice_buffer_add_indexed ( <nl> slice_allocator - > dest , ru_slice_create ( slice_allocator - > resource_user , <nl> slice_allocator - > length ) ) ; <nl> } <nl> void grpc_resource_user_slice_allocator_init ( <nl> void grpc_resource_user_alloc_slices ( <nl> grpc_exec_ctx * exec_ctx , <nl> grpc_resource_user_slice_allocator * slice_allocator , size_t length , <nl> - size_t count , gpr_slice_buffer * dest ) { <nl> + size_t count , grpc_slice_buffer * dest ) { <nl> slice_allocator - > length = length ; <nl> slice_allocator - > count = count ; <nl> slice_allocator - > dest = dest ; <nl> mmm a / src / core / lib / iomgr / resource_quota . h <nl> ppp b / src / core / lib / iomgr / resource_quota . h <nl> typedef struct grpc_resource_user_slice_allocator { <nl> / * Number of slices to allocate on the current request * / <nl> size_t count ; <nl> / * Destination for slices to allocate on the current request * / <nl> - gpr_slice_buffer * dest ; <nl> + grpc_slice_buffer * dest ; <nl> / * Parent resource user * / <nl> grpc_resource_user * resource_user ; <nl> } grpc_resource_user_slice_allocator ; <nl> void grpc_resource_user_slice_allocator_init ( <nl> void grpc_resource_user_alloc_slices ( <nl> grpc_exec_ctx * exec_ctx , <nl> grpc_resource_user_slice_allocator * slice_allocator , size_t length , <nl> - size_t count , gpr_slice_buffer * dest ) ; <nl> + size_t count , grpc_slice_buffer * dest ) ; <nl> <nl> # endif / * GRPC_CORE_LIB_IOMGR_RESOURCE_QUOTA_H * / <nl> mmm a / src / core / lib / iomgr / tcp_posix . c <nl> ppp b / src / core / lib / iomgr / tcp_posix . c <nl> typedef struct { <nl> gpr_atm shutdown_count ; <nl> <nl> / * garbage after the last read * / <nl> - gpr_slice_buffer last_read_buffer ; <nl> + grpc_slice_buffer last_read_buffer ; <nl> <nl> - gpr_slice_buffer * incoming_buffer ; <nl> - gpr_slice_buffer * outgoing_buffer ; <nl> + grpc_slice_buffer * incoming_buffer ; <nl> + grpc_slice_buffer * outgoing_buffer ; <nl> / * * slice within outgoing_buffer to write next * / <nl> size_t outgoing_slice_idx ; <nl> / * * byte within outgoing_buffer - > slices [ outgoing_slice_idx ] to write next * / <nl> static void tcp_shutdown ( grpc_exec_ctx * exec_ctx , grpc_endpoint * ep ) { <nl> static void tcp_free ( grpc_exec_ctx * exec_ctx , grpc_tcp * tcp ) { <nl> grpc_fd_orphan ( exec_ctx , tcp - > em_fd , tcp - > release_fd_cb , tcp - > release_fd , <nl> " tcp_unref_orphan " ) ; <nl> - gpr_slice_buffer_destroy ( & tcp - > last_read_buffer ) ; <nl> + grpc_slice_buffer_destroy ( & tcp - > last_read_buffer ) ; <nl> grpc_resource_user_destroy ( exec_ctx , & tcp - > resource_user ) ; <nl> gpr_free ( tcp - > peer_string ) ; <nl> gpr_free ( tcp ) ; <nl> static void tcp_destroy ( grpc_exec_ctx * exec_ctx , grpc_endpoint * ep ) { <nl> grpc_network_status_unregister_endpoint ( ep ) ; <nl> grpc_tcp * tcp = ( grpc_tcp * ) ep ; <nl> tcp_maybe_shutdown_resource_user ( exec_ctx , tcp ) ; <nl> - gpr_slice_buffer_reset_and_unref ( & tcp - > last_read_buffer ) ; <nl> + grpc_slice_buffer_reset_and_unref ( & tcp - > last_read_buffer ) ; <nl> TCP_UNREF ( exec_ctx , tcp , " destroy " ) ; <nl> } <nl> <nl> static void tcp_do_read ( grpc_exec_ctx * exec_ctx , grpc_tcp * tcp ) { <nl> / * We ' ve consumed the edge , request a new one * / <nl> grpc_fd_notify_on_read ( exec_ctx , tcp - > em_fd , & tcp - > read_closure ) ; <nl> } else { <nl> - gpr_slice_buffer_reset_and_unref ( tcp - > incoming_buffer ) ; <nl> + grpc_slice_buffer_reset_and_unref ( tcp - > incoming_buffer ) ; <nl> call_read_cb ( exec_ctx , tcp , GRPC_OS_ERROR ( errno , " recvmsg " ) ) ; <nl> TCP_UNREF ( exec_ctx , tcp , " read " ) ; <nl> } <nl> } else if ( read_bytes = = 0 ) { <nl> / * 0 read size = = > end of stream * / <nl> - gpr_slice_buffer_reset_and_unref ( tcp - > incoming_buffer ) ; <nl> + grpc_slice_buffer_reset_and_unref ( tcp - > incoming_buffer ) ; <nl> call_read_cb ( exec_ctx , tcp , GRPC_ERROR_CREATE ( " Socket closed " ) ) ; <nl> TCP_UNREF ( exec_ctx , tcp , " read " ) ; <nl> } else { <nl> GPR_ASSERT ( ( size_t ) read_bytes < = tcp - > incoming_buffer - > length ) ; <nl> if ( ( size_t ) read_bytes < tcp - > incoming_buffer - > length ) { <nl> - gpr_slice_buffer_trim_end ( <nl> + grpc_slice_buffer_trim_end ( <nl> tcp - > incoming_buffer , <nl> tcp - > incoming_buffer - > length - ( size_t ) read_bytes , <nl> & tcp - > last_read_buffer ) ; <nl> static void tcp_read_allocation_done ( grpc_exec_ctx * exec_ctx , void * tcpp , <nl> grpc_error * error ) { <nl> grpc_tcp * tcp = tcpp ; <nl> if ( error ! = GRPC_ERROR_NONE ) { <nl> - gpr_slice_buffer_reset_and_unref ( tcp - > incoming_buffer ) ; <nl> - gpr_slice_buffer_reset_and_unref ( & tcp - > last_read_buffer ) ; <nl> + grpc_slice_buffer_reset_and_unref ( tcp - > incoming_buffer ) ; <nl> + grpc_slice_buffer_reset_and_unref ( & tcp - > last_read_buffer ) ; <nl> call_read_cb ( exec_ctx , tcp , GRPC_ERROR_REF ( error ) ) ; <nl> TCP_UNREF ( exec_ctx , tcp , " read " ) ; <nl> } else { <nl> static void tcp_handle_read ( grpc_exec_ctx * exec_ctx , void * arg / * grpc_tcp * / , <nl> GPR_ASSERT ( ! tcp - > finished_edge ) ; <nl> <nl> if ( error ! = GRPC_ERROR_NONE ) { <nl> - gpr_slice_buffer_reset_and_unref ( tcp - > incoming_buffer ) ; <nl> - gpr_slice_buffer_reset_and_unref ( & tcp - > last_read_buffer ) ; <nl> + grpc_slice_buffer_reset_and_unref ( tcp - > incoming_buffer ) ; <nl> + grpc_slice_buffer_reset_and_unref ( & tcp - > last_read_buffer ) ; <nl> call_read_cb ( exec_ctx , tcp , GRPC_ERROR_REF ( error ) ) ; <nl> TCP_UNREF ( exec_ctx , tcp , " read " ) ; <nl> } else { <nl> static void tcp_handle_read ( grpc_exec_ctx * exec_ctx , void * arg / * grpc_tcp * / , <nl> } <nl> <nl> static void tcp_read ( grpc_exec_ctx * exec_ctx , grpc_endpoint * ep , <nl> - gpr_slice_buffer * incoming_buffer , grpc_closure * cb ) { <nl> + grpc_slice_buffer * incoming_buffer , grpc_closure * cb ) { <nl> grpc_tcp * tcp = ( grpc_tcp * ) ep ; <nl> GPR_ASSERT ( tcp - > read_cb = = NULL ) ; <nl> tcp - > read_cb = cb ; <nl> tcp - > incoming_buffer = incoming_buffer ; <nl> - gpr_slice_buffer_reset_and_unref ( incoming_buffer ) ; <nl> - gpr_slice_buffer_swap ( incoming_buffer , & tcp - > last_read_buffer ) ; <nl> + grpc_slice_buffer_reset_and_unref ( incoming_buffer ) ; <nl> + grpc_slice_buffer_swap ( incoming_buffer , & tcp - > last_read_buffer ) ; <nl> TCP_REF ( tcp , " read " ) ; <nl> if ( tcp - > finished_edge ) { <nl> tcp - > finished_edge = false ; <nl> static void tcp_handle_write ( grpc_exec_ctx * exec_ctx , void * arg / * grpc_tcp * / , <nl> } <nl> <nl> static void tcp_write ( grpc_exec_ctx * exec_ctx , grpc_endpoint * ep , <nl> - gpr_slice_buffer * buf , grpc_closure * cb ) { <nl> + grpc_slice_buffer * buf , grpc_closure * cb ) { <nl> grpc_tcp * tcp = ( grpc_tcp * ) ep ; <nl> grpc_error * error = GRPC_ERROR_NONE ; <nl> <nl> grpc_endpoint * grpc_tcp_create ( grpc_fd * em_fd , <nl> tcp - > read_closure . cb_arg = tcp ; <nl> tcp - > write_closure . cb = tcp_handle_write ; <nl> tcp - > write_closure . cb_arg = tcp ; <nl> - gpr_slice_buffer_init ( & tcp - > last_read_buffer ) ; <nl> + grpc_slice_buffer_init ( & tcp - > last_read_buffer ) ; <nl> grpc_resource_user_init ( & tcp - > resource_user , resource_quota , peer_string ) ; <nl> grpc_resource_user_slice_allocator_init ( & tcp - > slice_allocator , <nl> & tcp - > resource_user , <nl> void grpc_tcp_destroy_and_release_fd ( grpc_exec_ctx * exec_ctx , grpc_endpoint * ep , <nl> tcp - > release_fd = fd ; <nl> tcp - > release_fd_cb = done ; <nl> tcp_maybe_shutdown_resource_user ( exec_ctx , tcp ) ; <nl> - gpr_slice_buffer_reset_and_unref ( & tcp - > last_read_buffer ) ; <nl> + grpc_slice_buffer_reset_and_unref ( & tcp - > last_read_buffer ) ; <nl> TCP_UNREF ( exec_ctx , tcp , " destroy " ) ; <nl> } <nl> <nl> mmm a / src / core / lib / iomgr / tcp_windows . c <nl> ppp b / src / core / lib / iomgr / tcp_windows . c <nl> typedef struct grpc_tcp { <nl> <nl> grpc_closure * read_cb ; <nl> grpc_closure * write_cb ; <nl> - gpr_slice read_slice ; <nl> - gpr_slice_buffer * write_slices ; <nl> - gpr_slice_buffer * read_slices ; <nl> + grpc_slice read_slice ; <nl> + grpc_slice_buffer * write_slices ; <nl> + grpc_slice_buffer * read_slices ; <nl> <nl> / * The IO Completion Port runs from another thread . We need some mechanism <nl> to protect ourselves when requesting a shutdown . * / <nl> static void on_read ( grpc_exec_ctx * exec_ctx , void * tcpp , grpc_error * error ) { <nl> grpc_tcp * tcp = tcpp ; <nl> grpc_closure * cb = tcp - > read_cb ; <nl> grpc_winsocket * socket = tcp - > socket ; <nl> - gpr_slice sub ; <nl> + grpc_slice sub ; <nl> grpc_winsocket_callback_info * info = & socket - > read_info ; <nl> <nl> GRPC_ERROR_REF ( error ) ; <nl> static void on_read ( grpc_exec_ctx * exec_ctx , void * tcpp , grpc_error * error ) { <nl> char * utf8_message = gpr_format_message ( info - > wsa_error ) ; <nl> error = GRPC_ERROR_CREATE ( utf8_message ) ; <nl> gpr_free ( utf8_message ) ; <nl> - gpr_slice_unref ( tcp - > read_slice ) ; <nl> + grpc_slice_unref ( tcp - > read_slice ) ; <nl> } else { <nl> if ( info - > bytes_transfered ! = 0 & & ! tcp - > shutting_down ) { <nl> - sub = gpr_slice_sub_no_ref ( tcp - > read_slice , 0 , info - > bytes_transfered ) ; <nl> - gpr_slice_buffer_add ( tcp - > read_slices , sub ) ; <nl> + sub = grpc_slice_sub_no_ref ( tcp - > read_slice , 0 , info - > bytes_transfered ) ; <nl> + grpc_slice_buffer_add ( tcp - > read_slices , sub ) ; <nl> } else { <nl> - gpr_slice_unref ( tcp - > read_slice ) ; <nl> + grpc_slice_unref ( tcp - > read_slice ) ; <nl> error = GRPC_ERROR_CREATE ( " End of TCP stream " ) ; <nl> } <nl> } <nl> static void on_read ( grpc_exec_ctx * exec_ctx , void * tcpp , grpc_error * error ) { <nl> } <nl> <nl> static void win_read ( grpc_exec_ctx * exec_ctx , grpc_endpoint * ep , <nl> - gpr_slice_buffer * read_slices , grpc_closure * cb ) { <nl> + grpc_slice_buffer * read_slices , grpc_closure * cb ) { <nl> grpc_tcp * tcp = ( grpc_tcp * ) ep ; <nl> grpc_winsocket * handle = tcp - > socket ; <nl> grpc_winsocket_callback_info * info = & handle - > read_info ; <nl> static void win_read ( grpc_exec_ctx * exec_ctx , grpc_endpoint * ep , <nl> <nl> tcp - > read_cb = cb ; <nl> tcp - > read_slices = read_slices ; <nl> - gpr_slice_buffer_reset_and_unref ( read_slices ) ; <nl> + grpc_slice_buffer_reset_and_unref ( read_slices ) ; <nl> <nl> - tcp - > read_slice = gpr_slice_malloc ( 8192 ) ; <nl> + tcp - > read_slice = grpc_slice_malloc ( 8192 ) ; <nl> <nl> buffer . len = ( ULONG ) GPR_SLICE_LENGTH ( <nl> tcp - > read_slice ) ; / / we know slice size fits in 32bit . <nl> static void on_write ( grpc_exec_ctx * exec_ctx , void * tcpp , grpc_error * error ) { <nl> <nl> / * Initiates a write . * / <nl> static void win_write ( grpc_exec_ctx * exec_ctx , grpc_endpoint * ep , <nl> - gpr_slice_buffer * slices , grpc_closure * cb ) { <nl> + grpc_slice_buffer * slices , grpc_closure * cb ) { <nl> grpc_tcp * tcp = ( grpc_tcp * ) ep ; <nl> grpc_winsocket * socket = tcp - > socket ; <nl> grpc_winsocket_callback_info * info = & socket - > write_info ; <nl> mmm a / src / core / lib / security / credentials / credentials . h <nl> ppp b / src / core / lib / security / credentials / credentials . h <nl> grpc_channel_credentials_duplicate_without_call_credentials ( <nl> / * mmm grpc_credentials_md . mmm * / <nl> <nl> typedef struct { <nl> - gpr_slice key ; <nl> - gpr_slice value ; <nl> + grpc_slice key ; <nl> + grpc_slice value ; <nl> } grpc_credentials_md ; <nl> <nl> typedef struct { <nl> grpc_credentials_md_store * grpc_credentials_md_store_create ( <nl> <nl> / * Will ref key and value . * / <nl> void grpc_credentials_md_store_add ( grpc_credentials_md_store * store , <nl> - gpr_slice key , gpr_slice value ) ; <nl> + grpc_slice key , grpc_slice value ) ; <nl> void grpc_credentials_md_store_add_cstrings ( grpc_credentials_md_store * store , <nl> const char * key , const char * value ) ; <nl> grpc_credentials_md_store * grpc_credentials_md_store_ref ( <nl> mmm a / src / core / lib / security / credentials / credentials_metadata . c <nl> ppp b / src / core / lib / security / credentials / credentials_metadata . c <nl> grpc_credentials_md_store * grpc_credentials_md_store_create ( <nl> } <nl> <nl> void grpc_credentials_md_store_add ( grpc_credentials_md_store * store , <nl> - gpr_slice key , gpr_slice value ) { <nl> + grpc_slice key , grpc_slice value ) { <nl> if ( store = = NULL ) return ; <nl> store_ensure_capacity ( store ) ; <nl> - store - > entries [ store - > num_entries ] . key = gpr_slice_ref ( key ) ; <nl> - store - > entries [ store - > num_entries ] . value = gpr_slice_ref ( value ) ; <nl> + store - > entries [ store - > num_entries ] . key = grpc_slice_ref ( key ) ; <nl> + store - > entries [ store - > num_entries ] . value = grpc_slice_ref ( value ) ; <nl> store - > num_entries + + ; <nl> } <nl> <nl> void grpc_credentials_md_store_add_cstrings ( grpc_credentials_md_store * store , <nl> const char * value ) { <nl> if ( store = = NULL ) return ; <nl> store_ensure_capacity ( store ) ; <nl> - store - > entries [ store - > num_entries ] . key = gpr_slice_from_copied_string ( key ) ; <nl> + store - > entries [ store - > num_entries ] . key = grpc_slice_from_copied_string ( key ) ; <nl> store - > entries [ store - > num_entries ] . value = <nl> - gpr_slice_from_copied_string ( value ) ; <nl> + grpc_slice_from_copied_string ( value ) ; <nl> store - > num_entries + + ; <nl> } <nl> <nl> void grpc_credentials_md_store_unref ( grpc_credentials_md_store * store ) { <nl> if ( store - > entries ! = NULL ) { <nl> size_t i ; <nl> for ( i = 0 ; i < store - > num_entries ; i + + ) { <nl> - gpr_slice_unref ( store - > entries [ i ] . key ) ; <nl> - gpr_slice_unref ( store - > entries [ i ] . value ) ; <nl> + grpc_slice_unref ( store - > entries [ i ] . key ) ; <nl> + grpc_slice_unref ( store - > entries [ i ] . value ) ; <nl> } <nl> gpr_free ( store - > entries ) ; <nl> } <nl> mmm a / src / core / lib / security / credentials / google_default / google_default_credentials . c <nl> ppp b / src / core / lib / security / credentials / google_default / google_default_credentials . c <nl> static grpc_error * create_default_creds_from_path ( <nl> grpc_auth_json_key key ; <nl> grpc_auth_refresh_token token ; <nl> grpc_call_credentials * result = NULL ; <nl> - gpr_slice creds_data = gpr_empty_slice ( ) ; <nl> + grpc_slice creds_data = gpr_empty_slice ( ) ; <nl> grpc_error * error = GRPC_ERROR_NONE ; <nl> if ( creds_path = = NULL ) { <nl> error = GRPC_ERROR_CREATE ( " creds_path unset " ) ; <nl> static grpc_error * create_default_creds_from_path ( <nl> end : <nl> GPR_ASSERT ( ( result = = NULL ) + ( error = = GRPC_ERROR_NONE ) = = 1 ) ; <nl> if ( creds_path ! = NULL ) gpr_free ( creds_path ) ; <nl> - gpr_slice_unref ( creds_data ) ; <nl> + grpc_slice_unref ( creds_data ) ; <nl> if ( json ! = NULL ) grpc_json_destroy ( json ) ; <nl> * creds = result ; <nl> return error ; <nl> mmm a / src / core / lib / security / credentials / jwt / jwt_verifier . c <nl> ppp b / src / core / lib / security / credentials / jwt / jwt_verifier . c <nl> static const EVP_MD * evp_md_from_alg ( const char * alg ) { <nl> } <nl> <nl> static grpc_json * parse_json_part_from_jwt ( const char * str , size_t len , <nl> - gpr_slice * buffer ) { <nl> + grpc_slice * buffer ) { <nl> grpc_json * json ; <nl> <nl> * buffer = grpc_base64_decode_with_len ( str , len , 1 ) ; <nl> static grpc_json * parse_json_part_from_jwt ( const char * str , size_t len , <nl> json = grpc_json_parse_string_with_len ( ( char * ) GPR_SLICE_START_PTR ( * buffer ) , <nl> GPR_SLICE_LENGTH ( * buffer ) ) ; <nl> if ( json = = NULL ) { <nl> - gpr_slice_unref ( * buffer ) ; <nl> + grpc_slice_unref ( * buffer ) ; <nl> gpr_log ( GPR_ERROR , " JSON parsing error . " ) ; <nl> } <nl> return json ; <nl> typedef struct { <nl> const char * kid ; <nl> const char * typ ; <nl> / * TODO ( jboeuf ) : Add others as needed ( jku , jwk , x5u , x5c and so on . . . ) . * / <nl> - gpr_slice buffer ; <nl> + grpc_slice buffer ; <nl> } jose_header ; <nl> <nl> static void jose_header_destroy ( jose_header * h ) { <nl> - gpr_slice_unref ( h - > buffer ) ; <nl> + grpc_slice_unref ( h - > buffer ) ; <nl> gpr_free ( h ) ; <nl> } <nl> <nl> / * Takes ownership of json and buffer . * / <nl> - static jose_header * jose_header_from_json ( grpc_json * json , gpr_slice buffer ) { <nl> + static jose_header * jose_header_from_json ( grpc_json * json , grpc_slice buffer ) { <nl> grpc_json * cur ; <nl> jose_header * h = gpr_malloc ( sizeof ( jose_header ) ) ; <nl> memset ( h , 0 , sizeof ( jose_header ) ) ; <nl> struct grpc_jwt_claims { <nl> gpr_timespec nbf ; <nl> <nl> grpc_json * json ; <nl> - gpr_slice buffer ; <nl> + grpc_slice buffer ; <nl> } ; <nl> <nl> void grpc_jwt_claims_destroy ( grpc_jwt_claims * claims ) { <nl> grpc_json_destroy ( claims - > json ) ; <nl> - gpr_slice_unref ( claims - > buffer ) ; <nl> + grpc_slice_unref ( claims - > buffer ) ; <nl> gpr_free ( claims ) ; <nl> } <nl> <nl> gpr_timespec grpc_jwt_claims_not_before ( const grpc_jwt_claims * claims ) { <nl> } <nl> <nl> / * Takes ownership of json and buffer even in case of failure . * / <nl> - grpc_jwt_claims * grpc_jwt_claims_from_json ( grpc_json * json , gpr_slice buffer ) { <nl> + grpc_jwt_claims * grpc_jwt_claims_from_json ( grpc_json * json , grpc_slice buffer ) { <nl> grpc_json * cur ; <nl> grpc_jwt_claims * claims = gpr_malloc ( sizeof ( grpc_jwt_claims ) ) ; <nl> memset ( claims , 0 , sizeof ( grpc_jwt_claims ) ) ; <nl> typedef struct { <nl> jose_header * header ; <nl> grpc_jwt_claims * claims ; <nl> char * audience ; <nl> - gpr_slice signature ; <nl> - gpr_slice signed_data ; <nl> + grpc_slice signature ; <nl> + grpc_slice signed_data ; <nl> void * user_data ; <nl> grpc_jwt_verification_done_cb user_cb ; <nl> grpc_http_response responses [ HTTP_RESPONSE_COUNT ] ; <nl> typedef struct { <nl> / * Takes ownership of the header , claims and signature . * / <nl> static verifier_cb_ctx * verifier_cb_ctx_create ( <nl> grpc_jwt_verifier * verifier , grpc_pollset * pollset , jose_header * header , <nl> - grpc_jwt_claims * claims , const char * audience , gpr_slice signature , <nl> + grpc_jwt_claims * claims , const char * audience , grpc_slice signature , <nl> const char * signed_jwt , size_t signed_jwt_len , void * user_data , <nl> grpc_jwt_verification_done_cb cb ) { <nl> grpc_exec_ctx exec_ctx = GRPC_EXEC_CTX_INIT ; <nl> static verifier_cb_ctx * verifier_cb_ctx_create ( <nl> ctx - > audience = gpr_strdup ( audience ) ; <nl> ctx - > claims = claims ; <nl> ctx - > signature = signature ; <nl> - ctx - > signed_data = gpr_slice_from_copied_buffer ( signed_jwt , signed_jwt_len ) ; <nl> + ctx - > signed_data = grpc_slice_from_copied_buffer ( signed_jwt , signed_jwt_len ) ; <nl> ctx - > user_data = user_data ; <nl> ctx - > user_cb = cb ; <nl> grpc_exec_ctx_finish ( & exec_ctx ) ; <nl> static verifier_cb_ctx * verifier_cb_ctx_create ( <nl> void verifier_cb_ctx_destroy ( verifier_cb_ctx * ctx ) { <nl> if ( ctx - > audience ! = NULL ) gpr_free ( ctx - > audience ) ; <nl> if ( ctx - > claims ! = NULL ) grpc_jwt_claims_destroy ( ctx - > claims ) ; <nl> - gpr_slice_unref ( ctx - > signature ) ; <nl> - gpr_slice_unref ( ctx - > signed_data ) ; <nl> + grpc_slice_unref ( ctx - > signature ) ; <nl> + grpc_slice_unref ( ctx - > signed_data ) ; <nl> jose_header_destroy ( ctx - > header ) ; <nl> for ( size_t i = 0 ; i < HTTP_RESPONSE_COUNT ; i + + ) { <nl> grpc_http_response_destroy ( & ctx - > responses [ i ] ) ; <nl> static EVP_PKEY * extract_pkey_from_x509 ( const char * x509_str ) { <nl> <nl> static BIGNUM * bignum_from_base64 ( const char * b64 ) { <nl> BIGNUM * result = NULL ; <nl> - gpr_slice bin ; <nl> + grpc_slice bin ; <nl> <nl> if ( b64 = = NULL ) return NULL ; <nl> bin = grpc_base64_decode ( b64 , 1 ) ; <nl> static BIGNUM * bignum_from_base64 ( const char * b64 ) { <nl> } <nl> result = BN_bin2bn ( GPR_SLICE_START_PTR ( bin ) , <nl> TSI_SIZE_AS_SIZE ( GPR_SLICE_LENGTH ( bin ) ) , NULL ) ; <nl> - gpr_slice_unref ( bin ) ; <nl> + grpc_slice_unref ( bin ) ; <nl> return result ; <nl> } <nl> <nl> static EVP_PKEY * find_verification_key ( const grpc_json * json , <nl> } <nl> <nl> static int verify_jwt_signature ( EVP_PKEY * key , const char * alg , <nl> - gpr_slice signature , gpr_slice signed_data ) { <nl> + grpc_slice signature , grpc_slice signed_data ) { <nl> EVP_MD_CTX * md_ctx = EVP_MD_CTX_create ( ) ; <nl> const EVP_MD * md = evp_md_from_alg ( alg ) ; <nl> int result = 0 ; <nl> void grpc_jwt_verifier_verify ( grpc_exec_ctx * exec_ctx , <nl> grpc_json * json ; <nl> jose_header * header = NULL ; <nl> grpc_jwt_claims * claims = NULL ; <nl> - gpr_slice header_buffer ; <nl> - gpr_slice claims_buffer ; <nl> - gpr_slice signature ; <nl> + grpc_slice header_buffer ; <nl> + grpc_slice claims_buffer ; <nl> + grpc_slice signature ; <nl> size_t signed_jwt_len ; <nl> const char * cur = jwt ; <nl> <nl> mmm a / src / core / lib / security / credentials / jwt / jwt_verifier . h <nl> ppp b / src / core / lib / security / credentials / jwt / jwt_verifier . h <nl> void grpc_jwt_verifier_verify ( grpc_exec_ctx * exec_ctx , <nl> <nl> / * mmm TESTING ONLY exposed functions . mmm * / <nl> <nl> - grpc_jwt_claims * grpc_jwt_claims_from_json ( grpc_json * json , gpr_slice buffer ) ; <nl> + grpc_jwt_claims * grpc_jwt_claims_from_json ( grpc_json * json , grpc_slice buffer ) ; <nl> grpc_jwt_verifier_status grpc_jwt_claims_check ( const grpc_jwt_claims * claims , <nl> const char * audience ) ; <nl> <nl> mmm a / src / core / lib / security / credentials / plugin / plugin_credentials . c <nl> ppp b / src / core / lib / security / credentials / plugin / plugin_credentials . c <nl> static void plugin_md_request_metadata_ready ( void * request , <nl> } else if ( num_md > 0 ) { <nl> md_array = gpr_malloc ( num_md * sizeof ( grpc_credentials_md ) ) ; <nl> for ( i = 0 ; i < num_md ; i + + ) { <nl> - md_array [ i ] . key = gpr_slice_from_copied_string ( md [ i ] . key ) ; <nl> + md_array [ i ] . key = grpc_slice_from_copied_string ( md [ i ] . key ) ; <nl> md_array [ i ] . value = <nl> - gpr_slice_from_copied_buffer ( md [ i ] . value , md [ i ] . value_length ) ; <nl> + grpc_slice_from_copied_buffer ( md [ i ] . value , md [ i ] . value_length ) ; <nl> } <nl> r - > cb ( & exec_ctx , r - > user_data , md_array , num_md , GRPC_CREDENTIALS_OK , <nl> NULL ) ; <nl> for ( i = 0 ; i < num_md ; i + + ) { <nl> - gpr_slice_unref ( md_array [ i ] . key ) ; <nl> - gpr_slice_unref ( md_array [ i ] . value ) ; <nl> + grpc_slice_unref ( md_array [ i ] . key ) ; <nl> + grpc_slice_unref ( md_array [ i ] . value ) ; <nl> } <nl> gpr_free ( md_array ) ; <nl> } <nl> mmm a / src / core / lib / security / transport / client_auth_filter . c <nl> ppp b / src / core / lib / security / transport / client_auth_filter . c <nl> static void bubble_up_error ( grpc_exec_ctx * exec_ctx , grpc_call_element * elem , <nl> grpc_status_code status , const char * error_msg ) { <nl> call_data * calld = elem - > call_data ; <nl> gpr_log ( GPR_ERROR , " Client side authentication failure : % s " , error_msg ) ; <nl> - gpr_slice error_slice = gpr_slice_from_copied_string ( error_msg ) ; <nl> + grpc_slice error_slice = grpc_slice_from_copied_string ( error_msg ) ; <nl> grpc_transport_stream_op_add_close ( & calld - > op , status , & error_slice ) ; <nl> grpc_call_next_op ( exec_ctx , elem , & calld - > op ) ; <nl> } <nl> static void on_credentials_metadata ( grpc_exec_ctx * exec_ctx , void * user_data , <nl> for ( i = 0 ; i < num_md ; i + + ) { <nl> grpc_metadata_batch_add_tail ( <nl> mdb , & calld - > md_links [ i ] , <nl> - grpc_mdelem_from_slices ( gpr_slice_ref ( md_elems [ i ] . key ) , <nl> - gpr_slice_ref ( md_elems [ i ] . value ) ) ) ; <nl> + grpc_mdelem_from_slices ( grpc_slice_ref ( md_elems [ i ] . key ) , <nl> + grpc_slice_ref ( md_elems [ i ] . value ) ) ) ; <nl> } <nl> grpc_call_next_op ( exec_ctx , elem , op ) ; <nl> } <nl> mmm a / src / core / lib / security / transport / handshake . c <nl> ppp b / src / core / lib / security / transport / handshake . c <nl> typedef struct { <nl> size_t handshake_buffer_size ; <nl> grpc_endpoint * wrapped_endpoint ; <nl> grpc_endpoint * secure_endpoint ; <nl> - gpr_slice_buffer left_overs ; <nl> - gpr_slice_buffer incoming ; <nl> - gpr_slice_buffer outgoing ; <nl> + grpc_slice_buffer left_overs ; <nl> + grpc_slice_buffer incoming ; <nl> + grpc_slice_buffer outgoing ; <nl> grpc_security_handshake_done_cb cb ; <nl> void * user_data ; <nl> grpc_closure on_handshake_data_sent_to_peer ; <nl> static void unref_handshake ( grpc_security_handshake * h ) { <nl> if ( gpr_unref ( & h - > refs ) ) { <nl> if ( h - > handshaker ! = NULL ) tsi_handshaker_destroy ( h - > handshaker ) ; <nl> if ( h - > handshake_buffer ! = NULL ) gpr_free ( h - > handshake_buffer ) ; <nl> - gpr_slice_buffer_destroy ( & h - > left_overs ) ; <nl> - gpr_slice_buffer_destroy ( & h - > outgoing ) ; <nl> - gpr_slice_buffer_destroy ( & h - > incoming ) ; <nl> + grpc_slice_buffer_destroy ( & h - > left_overs ) ; <nl> + grpc_slice_buffer_destroy ( & h - > outgoing ) ; <nl> + grpc_slice_buffer_destroy ( & h - > incoming ) ; <nl> GRPC_AUTH_CONTEXT_UNREF ( h - > auth_context , " handshake " ) ; <nl> GRPC_SECURITY_CONNECTOR_UNREF ( h - > connector , " handshake " ) ; <nl> gpr_free ( h ) ; <nl> static void send_handshake_bytes_to_peer ( grpc_exec_ctx * exec_ctx , <nl> grpc_security_handshake * h ) { <nl> size_t offset = 0 ; <nl> tsi_result result = TSI_OK ; <nl> - gpr_slice to_send ; <nl> + grpc_slice to_send ; <nl> <nl> do { <nl> size_t to_send_size = h - > handshake_buffer_size - offset ; <nl> static void send_handshake_bytes_to_peer ( grpc_exec_ctx * exec_ctx , <nl> } <nl> <nl> to_send = <nl> - gpr_slice_from_copied_buffer ( ( const char * ) h - > handshake_buffer , offset ) ; <nl> - gpr_slice_buffer_reset_and_unref ( & h - > outgoing ) ; <nl> - gpr_slice_buffer_add ( & h - > outgoing , to_send ) ; <nl> + grpc_slice_from_copied_buffer ( ( const char * ) h - > handshake_buffer , offset ) ; <nl> + grpc_slice_buffer_reset_and_unref ( & h - > outgoing ) ; <nl> + grpc_slice_buffer_add ( & h - > outgoing , to_send ) ; <nl> / * TODO ( klempner , jboeuf ) : This should probably use the client setup <nl> deadline * / <nl> grpc_endpoint_write ( exec_ctx , h - > wrapped_endpoint , & h - > outgoing , <nl> static void on_handshake_data_received_from_peer ( grpc_exec_ctx * exec_ctx , <nl> <nl> / * Put the leftovers in our buffer ( ownership transfered ) . * / <nl> if ( has_left_overs_in_current_slice ) { <nl> - gpr_slice_buffer_add ( <nl> + grpc_slice_buffer_add ( <nl> & h - > left_overs , <nl> - gpr_slice_split_tail ( & h - > incoming . slices [ i ] , consumed_slice_size ) ) ; <nl> - gpr_slice_unref ( <nl> + grpc_slice_split_tail ( & h - > incoming . slices [ i ] , consumed_slice_size ) ) ; <nl> + grpc_slice_unref ( <nl> h - > incoming . slices [ i ] ) ; / * split_tail above increments refcount . * / <nl> } <nl> - gpr_slice_buffer_addn ( <nl> + grpc_slice_buffer_addn ( <nl> & h - > left_overs , & h - > incoming . slices [ i + 1 ] , <nl> num_left_overs - ( size_t ) has_left_overs_in_current_slice ) ; <nl> check_peer ( exec_ctx , h ) ; <nl> static void on_timeout ( grpc_exec_ctx * exec_ctx , void * arg , grpc_error * error ) { <nl> void grpc_do_security_handshake ( <nl> grpc_exec_ctx * exec_ctx , tsi_handshaker * handshaker , <nl> grpc_security_connector * connector , bool is_client_side , <nl> - grpc_endpoint * nonsecure_endpoint , gpr_slice_buffer * read_buffer , <nl> + grpc_endpoint * nonsecure_endpoint , grpc_slice_buffer * read_buffer , <nl> gpr_timespec deadline , grpc_security_handshake_done_cb cb , <nl> void * user_data ) { <nl> grpc_security_connector_handshake_list * handshake_node ; <nl> void grpc_do_security_handshake ( <nl> on_handshake_data_sent_to_peer , h ) ; <nl> grpc_closure_init ( & h - > on_handshake_data_received_from_peer , <nl> on_handshake_data_received_from_peer , h ) ; <nl> - gpr_slice_buffer_init ( & h - > left_overs ) ; <nl> - gpr_slice_buffer_init ( & h - > outgoing ) ; <nl> - gpr_slice_buffer_init ( & h - > incoming ) ; <nl> + grpc_slice_buffer_init ( & h - > left_overs ) ; <nl> + grpc_slice_buffer_init ( & h - > outgoing ) ; <nl> + grpc_slice_buffer_init ( & h - > incoming ) ; <nl> if ( read_buffer ! = NULL ) { <nl> - gpr_slice_buffer_move_into ( read_buffer , & h - > incoming ) ; <nl> + grpc_slice_buffer_move_into ( read_buffer , & h - > incoming ) ; <nl> gpr_free ( read_buffer ) ; <nl> } <nl> if ( ! is_client_side ) { <nl> mmm a / src / core / lib / security / transport / handshake . h <nl> ppp b / src / core / lib / security / transport / handshake . h <nl> <nl> void grpc_do_security_handshake ( <nl> grpc_exec_ctx * exec_ctx , tsi_handshaker * handshaker , <nl> grpc_security_connector * connector , bool is_client_side , <nl> - grpc_endpoint * nonsecure_endpoint , gpr_slice_buffer * read_buffer , <nl> + grpc_endpoint * nonsecure_endpoint , grpc_slice_buffer * read_buffer , <nl> gpr_timespec deadline , grpc_security_handshake_done_cb cb , void * user_data ) ; <nl> <nl> void grpc_security_handshake_shutdown ( grpc_exec_ctx * exec_ctx , void * handshake ) ; <nl> mmm a / src / core / lib / security / transport / secure_endpoint . c <nl> ppp b / src / core / lib / security / transport / secure_endpoint . c <nl> typedef struct { <nl> grpc_closure * read_cb ; <nl> grpc_closure * write_cb ; <nl> grpc_closure on_read ; <nl> - gpr_slice_buffer * read_buffer ; <nl> - gpr_slice_buffer source_buffer ; <nl> + grpc_slice_buffer * read_buffer ; <nl> + grpc_slice_buffer source_buffer ; <nl> / * saved handshaker leftover data to unprotect . * / <nl> - gpr_slice_buffer leftover_bytes ; <nl> + grpc_slice_buffer leftover_bytes ; <nl> / * buffers for read and write * / <nl> - gpr_slice read_staging_buffer ; <nl> + grpc_slice read_staging_buffer ; <nl> <nl> - gpr_slice write_staging_buffer ; <nl> - gpr_slice_buffer output_buffer ; <nl> + grpc_slice write_staging_buffer ; <nl> + grpc_slice_buffer output_buffer ; <nl> <nl> gpr_refcount ref ; <nl> } secure_endpoint ; <nl> static void destroy ( grpc_exec_ctx * exec_ctx , secure_endpoint * secure_ep ) { <nl> secure_endpoint * ep = secure_ep ; <nl> grpc_endpoint_destroy ( exec_ctx , ep - > wrapped_ep ) ; <nl> tsi_frame_protector_destroy ( ep - > protector ) ; <nl> - gpr_slice_buffer_destroy ( & ep - > leftover_bytes ) ; <nl> - gpr_slice_unref ( ep - > read_staging_buffer ) ; <nl> - gpr_slice_unref ( ep - > write_staging_buffer ) ; <nl> - gpr_slice_buffer_destroy ( & ep - > output_buffer ) ; <nl> - gpr_slice_buffer_destroy ( & ep - > source_buffer ) ; <nl> + grpc_slice_buffer_destroy ( & ep - > leftover_bytes ) ; <nl> + grpc_slice_unref ( ep - > read_staging_buffer ) ; <nl> + grpc_slice_unref ( ep - > write_staging_buffer ) ; <nl> + grpc_slice_buffer_destroy ( & ep - > output_buffer ) ; <nl> + grpc_slice_buffer_destroy ( & ep - > source_buffer ) ; <nl> gpr_mu_destroy ( & ep - > protector_mu ) ; <nl> gpr_free ( ep ) ; <nl> } <nl> static void secure_endpoint_ref ( secure_endpoint * ep ) { gpr_ref ( & ep - > ref ) ; } <nl> <nl> static void flush_read_staging_buffer ( secure_endpoint * ep , uint8_t * * cur , <nl> uint8_t * * end ) { <nl> - gpr_slice_buffer_add ( ep - > read_buffer , ep - > read_staging_buffer ) ; <nl> - ep - > read_staging_buffer = gpr_slice_malloc ( STAGING_BUFFER_SIZE ) ; <nl> + grpc_slice_buffer_add ( ep - > read_buffer , ep - > read_staging_buffer ) ; <nl> + ep - > read_staging_buffer = grpc_slice_malloc ( STAGING_BUFFER_SIZE ) ; <nl> * cur = GPR_SLICE_START_PTR ( ep - > read_staging_buffer ) ; <nl> * end = GPR_SLICE_END_PTR ( ep - > read_staging_buffer ) ; <nl> } <nl> static void on_read ( grpc_exec_ctx * exec_ctx , void * user_data , <nl> uint8_t * end = GPR_SLICE_END_PTR ( ep - > read_staging_buffer ) ; <nl> <nl> if ( error ! = GRPC_ERROR_NONE ) { <nl> - gpr_slice_buffer_reset_and_unref ( ep - > read_buffer ) ; <nl> + grpc_slice_buffer_reset_and_unref ( ep - > read_buffer ) ; <nl> call_read_cb ( exec_ctx , ep , GRPC_ERROR_CREATE_REFERENCING ( <nl> " Secure read failed " , & error , 1 ) ) ; <nl> return ; <nl> static void on_read ( grpc_exec_ctx * exec_ctx , void * user_data , <nl> <nl> / * TODO ( yangg ) check error , maybe bail out early * / <nl> for ( i = 0 ; i < ep - > source_buffer . count ; i + + ) { <nl> - gpr_slice encrypted = ep - > source_buffer . slices [ i ] ; <nl> + grpc_slice encrypted = ep - > source_buffer . slices [ i ] ; <nl> uint8_t * message_bytes = GPR_SLICE_START_PTR ( encrypted ) ; <nl> size_t message_size = GPR_SLICE_LENGTH ( encrypted ) ; <nl> <nl> static void on_read ( grpc_exec_ctx * exec_ctx , void * user_data , <nl> } <nl> <nl> if ( cur ! = GPR_SLICE_START_PTR ( ep - > read_staging_buffer ) ) { <nl> - gpr_slice_buffer_add ( <nl> + grpc_slice_buffer_add ( <nl> ep - > read_buffer , <nl> - gpr_slice_split_head ( <nl> + grpc_slice_split_head ( <nl> & ep - > read_staging_buffer , <nl> ( size_t ) ( cur - GPR_SLICE_START_PTR ( ep - > read_staging_buffer ) ) ) ) ; <nl> } <nl> <nl> / * TODO ( yangg ) experiment with moving this block after read_cb to see if it <nl> helps latency * / <nl> - gpr_slice_buffer_reset_and_unref ( & ep - > source_buffer ) ; <nl> + grpc_slice_buffer_reset_and_unref ( & ep - > source_buffer ) ; <nl> <nl> if ( result ! = TSI_OK ) { <nl> - gpr_slice_buffer_reset_and_unref ( ep - > read_buffer ) ; <nl> + grpc_slice_buffer_reset_and_unref ( ep - > read_buffer ) ; <nl> call_read_cb ( exec_ctx , ep , grpc_set_tsi_error_result ( <nl> GRPC_ERROR_CREATE ( " Unwrap failed " ) , result ) ) ; <nl> return ; <nl> static void on_read ( grpc_exec_ctx * exec_ctx , void * user_data , <nl> } <nl> <nl> static void endpoint_read ( grpc_exec_ctx * exec_ctx , grpc_endpoint * secure_ep , <nl> - gpr_slice_buffer * slices , grpc_closure * cb ) { <nl> + grpc_slice_buffer * slices , grpc_closure * cb ) { <nl> secure_endpoint * ep = ( secure_endpoint * ) secure_ep ; <nl> ep - > read_cb = cb ; <nl> ep - > read_buffer = slices ; <nl> - gpr_slice_buffer_reset_and_unref ( ep - > read_buffer ) ; <nl> + grpc_slice_buffer_reset_and_unref ( ep - > read_buffer ) ; <nl> <nl> SECURE_ENDPOINT_REF ( ep , " read " ) ; <nl> if ( ep - > leftover_bytes . count ) { <nl> - gpr_slice_buffer_swap ( & ep - > leftover_bytes , & ep - > source_buffer ) ; <nl> + grpc_slice_buffer_swap ( & ep - > leftover_bytes , & ep - > source_buffer ) ; <nl> GPR_ASSERT ( ep - > leftover_bytes . count = = 0 ) ; <nl> on_read ( exec_ctx , ep , GRPC_ERROR_NONE ) ; <nl> return ; <nl> static void endpoint_read ( grpc_exec_ctx * exec_ctx , grpc_endpoint * secure_ep , <nl> <nl> static void flush_write_staging_buffer ( secure_endpoint * ep , uint8_t * * cur , <nl> uint8_t * * end ) { <nl> - gpr_slice_buffer_add ( & ep - > output_buffer , ep - > write_staging_buffer ) ; <nl> - ep - > write_staging_buffer = gpr_slice_malloc ( STAGING_BUFFER_SIZE ) ; <nl> + grpc_slice_buffer_add ( & ep - > output_buffer , ep - > write_staging_buffer ) ; <nl> + ep - > write_staging_buffer = grpc_slice_malloc ( STAGING_BUFFER_SIZE ) ; <nl> * cur = GPR_SLICE_START_PTR ( ep - > write_staging_buffer ) ; <nl> * end = GPR_SLICE_END_PTR ( ep - > write_staging_buffer ) ; <nl> } <nl> <nl> static void endpoint_write ( grpc_exec_ctx * exec_ctx , grpc_endpoint * secure_ep , <nl> - gpr_slice_buffer * slices , grpc_closure * cb ) { <nl> + grpc_slice_buffer * slices , grpc_closure * cb ) { <nl> GPR_TIMER_BEGIN ( " secure_endpoint . endpoint_write " , 0 ) ; <nl> <nl> unsigned i ; <nl> static void endpoint_write ( grpc_exec_ctx * exec_ctx , grpc_endpoint * secure_ep , <nl> uint8_t * cur = GPR_SLICE_START_PTR ( ep - > write_staging_buffer ) ; <nl> uint8_t * end = GPR_SLICE_END_PTR ( ep - > write_staging_buffer ) ; <nl> <nl> - gpr_slice_buffer_reset_and_unref ( & ep - > output_buffer ) ; <nl> + grpc_slice_buffer_reset_and_unref ( & ep - > output_buffer ) ; <nl> <nl> if ( grpc_trace_secure_endpoint ) { <nl> for ( i = 0 ; i < slices - > count ; i + + ) { <nl> static void endpoint_write ( grpc_exec_ctx * exec_ctx , grpc_endpoint * secure_ep , <nl> } <nl> <nl> for ( i = 0 ; i < slices - > count ; i + + ) { <nl> - gpr_slice plain = slices - > slices [ i ] ; <nl> + grpc_slice plain = slices - > slices [ i ] ; <nl> uint8_t * message_bytes = GPR_SLICE_START_PTR ( plain ) ; <nl> size_t message_size = GPR_SLICE_LENGTH ( plain ) ; <nl> while ( message_size > 0 ) { <nl> static void endpoint_write ( grpc_exec_ctx * exec_ctx , grpc_endpoint * secure_ep , <nl> } <nl> } while ( still_pending_size > 0 ) ; <nl> if ( cur ! = GPR_SLICE_START_PTR ( ep - > write_staging_buffer ) ) { <nl> - gpr_slice_buffer_add ( <nl> + grpc_slice_buffer_add ( <nl> & ep - > output_buffer , <nl> - gpr_slice_split_head ( <nl> + grpc_slice_split_head ( <nl> & ep - > write_staging_buffer , <nl> ( size_t ) ( cur - GPR_SLICE_START_PTR ( ep - > write_staging_buffer ) ) ) ) ; <nl> } <nl> static void endpoint_write ( grpc_exec_ctx * exec_ctx , grpc_endpoint * secure_ep , <nl> <nl> if ( result ! = TSI_OK ) { <nl> / * TODO ( yangg ) do different things according to the error type ? * / <nl> - gpr_slice_buffer_reset_and_unref ( & ep - > output_buffer ) ; <nl> + grpc_slice_buffer_reset_and_unref ( & ep - > output_buffer ) ; <nl> grpc_exec_ctx_sched ( <nl> exec_ctx , cb , <nl> grpc_set_tsi_error_result ( GRPC_ERROR_CREATE ( " Wrap failed " ) , result ) , <nl> static const grpc_endpoint_vtable vtable = { endpoint_read , <nl> <nl> grpc_endpoint * grpc_secure_endpoint_create ( <nl> struct tsi_frame_protector * protector , grpc_endpoint * transport , <nl> - gpr_slice * leftover_slices , size_t leftover_nslices ) { <nl> + grpc_slice * leftover_slices , size_t leftover_nslices ) { <nl> size_t i ; <nl> secure_endpoint * ep = ( secure_endpoint * ) gpr_malloc ( sizeof ( secure_endpoint ) ) ; <nl> ep - > base . vtable = & vtable ; <nl> ep - > wrapped_ep = transport ; <nl> ep - > protector = protector ; <nl> - gpr_slice_buffer_init ( & ep - > leftover_bytes ) ; <nl> + grpc_slice_buffer_init ( & ep - > leftover_bytes ) ; <nl> for ( i = 0 ; i < leftover_nslices ; i + + ) { <nl> - gpr_slice_buffer_add ( & ep - > leftover_bytes , <nl> - gpr_slice_ref ( leftover_slices [ i ] ) ) ; <nl> + grpc_slice_buffer_add ( & ep - > leftover_bytes , <nl> + grpc_slice_ref ( leftover_slices [ i ] ) ) ; <nl> } <nl> - ep - > write_staging_buffer = gpr_slice_malloc ( STAGING_BUFFER_SIZE ) ; <nl> - ep - > read_staging_buffer = gpr_slice_malloc ( STAGING_BUFFER_SIZE ) ; <nl> - gpr_slice_buffer_init ( & ep - > output_buffer ) ; <nl> - gpr_slice_buffer_init ( & ep - > source_buffer ) ; <nl> + ep - > write_staging_buffer = grpc_slice_malloc ( STAGING_BUFFER_SIZE ) ; <nl> + ep - > read_staging_buffer = grpc_slice_malloc ( STAGING_BUFFER_SIZE ) ; <nl> + grpc_slice_buffer_init ( & ep - > output_buffer ) ; <nl> + grpc_slice_buffer_init ( & ep - > source_buffer ) ; <nl> ep - > read_buffer = NULL ; <nl> grpc_closure_init ( & ep - > on_read , on_read , ep ) ; <nl> gpr_mu_init ( & ep - > protector_mu ) ; <nl> mmm a / src / core / lib / security / transport / secure_endpoint . h <nl> ppp b / src / core / lib / security / transport / secure_endpoint . h <nl> extern int grpc_trace_secure_endpoint ; <nl> / * Takes ownership of protector and to_wrap , and refs leftover_slices . * / <nl> grpc_endpoint * grpc_secure_endpoint_create ( <nl> struct tsi_frame_protector * protector , grpc_endpoint * to_wrap , <nl> - gpr_slice * leftover_slices , size_t leftover_nslices ) ; <nl> + grpc_slice * leftover_slices , size_t leftover_nslices ) ; <nl> <nl> # endif / * GRPC_CORE_LIB_SECURITY_TRANSPORT_SECURE_ENDPOINT_H * / <nl> mmm a / src / core / lib / security / transport / security_connector . c <nl> ppp b / src / core / lib / security / transport / security_connector . c <nl> void grpc_server_security_connector_shutdown ( <nl> <nl> void grpc_channel_security_connector_do_handshake ( <nl> grpc_exec_ctx * exec_ctx , grpc_channel_security_connector * sc , <nl> - grpc_endpoint * nonsecure_endpoint , gpr_slice_buffer * read_buffer , <nl> + grpc_endpoint * nonsecure_endpoint , grpc_slice_buffer * read_buffer , <nl> gpr_timespec deadline , grpc_security_handshake_done_cb cb , <nl> void * user_data ) { <nl> if ( sc = = NULL | | nonsecure_endpoint = = NULL ) { <nl> void grpc_channel_security_connector_do_handshake ( <nl> void grpc_server_security_connector_do_handshake ( <nl> grpc_exec_ctx * exec_ctx , grpc_server_security_connector * sc , <nl> grpc_tcp_server_acceptor * acceptor , grpc_endpoint * nonsecure_endpoint , <nl> - gpr_slice_buffer * read_buffer , gpr_timespec deadline , <nl> + grpc_slice_buffer * read_buffer , gpr_timespec deadline , <nl> grpc_security_handshake_done_cb cb , void * user_data ) { <nl> if ( sc = = NULL | | nonsecure_endpoint = = NULL ) { <nl> gpr_free ( read_buffer ) ; <nl> static void fake_channel_check_call_host ( grpc_exec_ctx * exec_ctx , <nl> static void fake_channel_do_handshake ( grpc_exec_ctx * exec_ctx , <nl> grpc_channel_security_connector * sc , <nl> grpc_endpoint * nonsecure_endpoint , <nl> - gpr_slice_buffer * read_buffer , <nl> + grpc_slice_buffer * read_buffer , <nl> gpr_timespec deadline , <nl> grpc_security_handshake_done_cb cb , <nl> void * user_data ) { <nl> static void fake_channel_do_handshake ( grpc_exec_ctx * exec_ctx , <nl> static void fake_server_do_handshake ( <nl> grpc_exec_ctx * exec_ctx , grpc_server_security_connector * sc , <nl> grpc_tcp_server_acceptor * acceptor , grpc_endpoint * nonsecure_endpoint , <nl> - gpr_slice_buffer * read_buffer , gpr_timespec deadline , <nl> + grpc_slice_buffer * read_buffer , gpr_timespec deadline , <nl> grpc_security_handshake_done_cb cb , void * user_data ) { <nl> grpc_do_security_handshake ( exec_ctx , tsi_create_fake_handshaker ( 0 ) , & sc - > base , <nl> false , nonsecure_endpoint , read_buffer , deadline , <nl> static grpc_security_status ssl_create_handshaker ( <nl> static void ssl_channel_do_handshake ( grpc_exec_ctx * exec_ctx , <nl> grpc_channel_security_connector * sc , <nl> grpc_endpoint * nonsecure_endpoint , <nl> - gpr_slice_buffer * read_buffer , <nl> + grpc_slice_buffer * read_buffer , <nl> gpr_timespec deadline , <nl> grpc_security_handshake_done_cb cb , <nl> void * user_data ) { <nl> static void ssl_channel_do_handshake ( grpc_exec_ctx * exec_ctx , <nl> static void ssl_server_do_handshake ( <nl> grpc_exec_ctx * exec_ctx , grpc_server_security_connector * sc , <nl> grpc_tcp_server_acceptor * acceptor , grpc_endpoint * nonsecure_endpoint , <nl> - gpr_slice_buffer * read_buffer , gpr_timespec deadline , <nl> + grpc_slice_buffer * read_buffer , gpr_timespec deadline , <nl> grpc_security_handshake_done_cb cb , void * user_data ) { <nl> grpc_ssl_server_security_connector * c = <nl> ( grpc_ssl_server_security_connector * ) sc ; <nl> static grpc_security_connector_vtable ssl_channel_vtable = { <nl> static grpc_security_connector_vtable ssl_server_vtable = { <nl> ssl_server_destroy , ssl_server_check_peer } ; <nl> <nl> - static gpr_slice compute_default_pem_root_certs_once ( void ) { <nl> - gpr_slice result = gpr_empty_slice ( ) ; <nl> + static grpc_slice compute_default_pem_root_certs_once ( void ) { <nl> + grpc_slice result = gpr_empty_slice ( ) ; <nl> <nl> / * First try to load the roots from the environment . * / <nl> char * default_root_certs_path = <nl> static gpr_slice compute_default_pem_root_certs_once ( void ) { <nl> ovrd_res = ssl_roots_override_cb ( & pem_root_certs ) ; <nl> if ( ovrd_res = = GRPC_SSL_ROOTS_OVERRIDE_OK ) { <nl> GPR_ASSERT ( pem_root_certs ! = NULL ) ; <nl> - result = gpr_slice_new ( pem_root_certs , strlen ( pem_root_certs ) , gpr_free ) ; <nl> + result = grpc_slice_new ( pem_root_certs , strlen ( pem_root_certs ) , gpr_free ) ; <nl> } <nl> } <nl> <nl> static gpr_slice compute_default_pem_root_certs_once ( void ) { <nl> return result ; <nl> } <nl> <nl> - static gpr_slice default_pem_root_certs ; <nl> + static grpc_slice default_pem_root_certs ; <nl> <nl> static void init_default_pem_root_certs ( void ) { <nl> default_pem_root_certs = compute_default_pem_root_certs_once ( ) ; <nl> } <nl> <nl> - gpr_slice grpc_get_default_ssl_roots_for_testing ( void ) { <nl> + grpc_slice grpc_get_default_ssl_roots_for_testing ( void ) { <nl> return compute_default_pem_root_certs_once ( ) ; <nl> } <nl> <nl> mmm a / src / core / lib / security / transport / security_connector . h <nl> ppp b / src / core / lib / security / transport / security_connector . h <nl> struct grpc_channel_security_connector { <nl> void ( * do_handshake ) ( grpc_exec_ctx * exec_ctx , <nl> grpc_channel_security_connector * sc , <nl> grpc_endpoint * nonsecure_endpoint , <nl> - gpr_slice_buffer * read_buffer , gpr_timespec deadline , <nl> + grpc_slice_buffer * read_buffer , gpr_timespec deadline , <nl> grpc_security_handshake_done_cb cb , void * user_data ) ; <nl> } ; <nl> <nl> void grpc_channel_security_connector_check_call_host ( <nl> / * Handshake . * / <nl> void grpc_channel_security_connector_do_handshake ( <nl> grpc_exec_ctx * exec_ctx , grpc_channel_security_connector * connector , <nl> - grpc_endpoint * nonsecure_endpoint , gpr_slice_buffer * read_buffer , <nl> + grpc_endpoint * nonsecure_endpoint , grpc_slice_buffer * read_buffer , <nl> gpr_timespec deadline , grpc_security_handshake_done_cb cb , void * user_data ) ; <nl> <nl> / * mmm server_security_connector object . mmm <nl> struct grpc_server_security_connector { <nl> grpc_server_security_connector * sc , <nl> grpc_tcp_server_acceptor * acceptor , <nl> grpc_endpoint * nonsecure_endpoint , <nl> - gpr_slice_buffer * read_buffer , gpr_timespec deadline , <nl> + grpc_slice_buffer * read_buffer , gpr_timespec deadline , <nl> grpc_security_handshake_done_cb cb , void * user_data ) ; <nl> } ; <nl> <nl> void grpc_server_security_connector_do_handshake ( <nl> grpc_exec_ctx * exec_ctx , grpc_server_security_connector * sc , <nl> grpc_tcp_server_acceptor * acceptor , grpc_endpoint * nonsecure_endpoint , <nl> - gpr_slice_buffer * read_buffer , gpr_timespec deadline , <nl> + grpc_slice_buffer * read_buffer , gpr_timespec deadline , <nl> grpc_security_handshake_done_cb cb , void * user_data ) ; <nl> <nl> void grpc_server_security_connector_shutdown ( <nl> grpc_security_status grpc_ssl_channel_security_connector_create ( <nl> size_t grpc_get_default_ssl_roots ( const unsigned char * * pem_root_certs ) ; <nl> <nl> / * Exposed for TESTING ONLY ! . * / <nl> - gpr_slice grpc_get_default_ssl_roots_for_testing ( void ) ; <nl> + grpc_slice grpc_get_default_ssl_roots_for_testing ( void ) ; <nl> <nl> / * Config for ssl servers . * / <nl> typedef struct { <nl> mmm a / src / core / lib / security / transport / server_auth_filter . c <nl> ppp b / src / core / lib / security / transport / server_auth_filter . c <nl> static void on_md_processing_done ( <nl> grpc_metadata_array_destroy ( & calld - > md ) ; <nl> grpc_exec_ctx_sched ( & exec_ctx , calld - > on_done_recv , GRPC_ERROR_NONE , NULL ) ; <nl> } else { <nl> - gpr_slice message ; <nl> + grpc_slice message ; <nl> grpc_transport_stream_op * close_op = gpr_malloc ( sizeof ( * close_op ) ) ; <nl> memset ( close_op , 0 , sizeof ( * close_op ) ) ; <nl> grpc_metadata_array_destroy ( & calld - > md ) ; <nl> error_details = error_details ! = NULL <nl> ? error_details <nl> : " Authentication metadata processing failed . " ; <nl> - message = gpr_slice_from_copied_string ( error_details ) ; <nl> + message = grpc_slice_from_copied_string ( error_details ) ; <nl> calld - > transport_op - > send_initial_metadata = NULL ; <nl> if ( calld - > transport_op - > send_message ! = NULL ) { <nl> grpc_byte_stream_destroy ( & exec_ctx , calld - > transport_op - > send_message ) ; <nl> mmm a / src / core / lib / security / util / b64 . c <nl> ppp b / src / core / lib / security / util / b64 . c <nl> char * grpc_base64_encode ( const void * vdata , size_t data_size , int url_safe , <nl> return result ; <nl> } <nl> <nl> - gpr_slice grpc_base64_decode ( const char * b64 , int url_safe ) { <nl> + grpc_slice grpc_base64_decode ( const char * b64 , int url_safe ) { <nl> return grpc_base64_decode_with_len ( b64 , strlen ( b64 ) , url_safe ) ; <nl> } <nl> <nl> static int decode_group ( const unsigned char * codes , size_t num_codes , <nl> return 1 ; <nl> } <nl> <nl> - gpr_slice grpc_base64_decode_with_len ( const char * b64 , size_t b64_len , <nl> + grpc_slice grpc_base64_decode_with_len ( const char * b64 , size_t b64_len , <nl> int url_safe ) { <nl> - gpr_slice result = gpr_slice_malloc ( b64_len ) ; <nl> + grpc_slice result = grpc_slice_malloc ( b64_len ) ; <nl> unsigned char * current = GPR_SLICE_START_PTR ( result ) ; <nl> size_t result_size = 0 ; <nl> unsigned char codes [ 4 ] ; <nl> gpr_slice grpc_base64_decode_with_len ( const char * b64 , size_t b64_len , <nl> return result ; <nl> <nl> fail : <nl> - gpr_slice_unref ( result ) ; <nl> + grpc_slice_unref ( result ) ; <nl> return gpr_empty_slice ( ) ; <nl> } <nl> mmm a / src / core / lib / security / util / b64 . h <nl> ppp b / src / core / lib / security / util / b64 . h <nl> char * grpc_base64_encode ( const void * data , size_t data_size , int url_safe , <nl> <nl> / * Decodes data according to the base64 specification . Returns an empty <nl> slice in case of failure . * / <nl> - gpr_slice grpc_base64_decode ( const char * b64 , int url_safe ) ; <nl> + grpc_slice grpc_base64_decode ( const char * b64 , int url_safe ) ; <nl> <nl> / * Same as above except that the length is provided by the caller . * / <nl> - gpr_slice grpc_base64_decode_with_len ( const char * b64 , size_t b64_len , <nl> + grpc_slice grpc_base64_decode_with_len ( const char * b64 , size_t b64_len , <nl> int url_safe ) ; <nl> <nl> # endif / * GRPC_CORE_LIB_SECURITY_UTIL_B64_H * / <nl> similarity index 91 % <nl> rename from src / core / lib / support / percent_encoding . c <nl> rename to src / core / lib / slice / percent_encoding . c <nl> mmm a / src / core / lib / support / percent_encoding . c <nl> ppp b / src / core / lib / slice / percent_encoding . c <nl> static bool is_unreserved_character ( uint8_t c , <nl> return ( ( unreserved_bytes [ c / 8 ] > > ( c % 8 ) ) & 1 ) ! = 0 ; <nl> } <nl> <nl> - gpr_slice gpr_percent_encode_slice ( gpr_slice slice , <nl> + grpc_slice gpr_percent_encode_slice ( grpc_slice slice , <nl> const uint8_t * unreserved_bytes ) { <nl> static const uint8_t hex [ ] = " 0123456789ABCDEF " ; <nl> <nl> gpr_slice gpr_percent_encode_slice ( gpr_slice slice , <nl> } <nl> / / no unreserved bytes : return the string unmodified <nl> if ( ! any_reserved_bytes ) { <nl> - return gpr_slice_ref ( slice ) ; <nl> + return grpc_slice_ref ( slice ) ; <nl> } <nl> / / second pass : actually encode <nl> - gpr_slice out = gpr_slice_malloc ( output_length ) ; <nl> + grpc_slice out = grpc_slice_malloc ( output_length ) ; <nl> uint8_t * q = GPR_SLICE_START_PTR ( out ) ; <nl> for ( p = slice_start ; p < slice_end ; p + + ) { <nl> if ( is_unreserved_character ( * p , unreserved_bytes ) ) { <nl> static uint8_t dehex ( uint8_t c ) { <nl> GPR_UNREACHABLE_CODE ( return 255 ) ; <nl> } <nl> <nl> - bool gpr_strict_percent_decode_slice ( gpr_slice slice_in , <nl> + bool gpr_strict_percent_decode_slice ( grpc_slice slice_in , <nl> const uint8_t * unreserved_bytes , <nl> - gpr_slice * slice_out ) { <nl> + grpc_slice * slice_out ) { <nl> const uint8_t * p = GPR_SLICE_START_PTR ( slice_in ) ; <nl> const uint8_t * in_end = GPR_SLICE_END_PTR ( slice_in ) ; <nl> size_t out_length = 0 ; <nl> bool gpr_strict_percent_decode_slice ( gpr_slice slice_in , <nl> } <nl> } <nl> if ( ! any_percent_encoded_stuff ) { <nl> - * slice_out = gpr_slice_ref ( slice_in ) ; <nl> + * slice_out = grpc_slice_ref ( slice_in ) ; <nl> return true ; <nl> } <nl> p = GPR_SLICE_START_PTR ( slice_in ) ; <nl> - * slice_out = gpr_slice_malloc ( out_length ) ; <nl> + * slice_out = grpc_slice_malloc ( out_length ) ; <nl> uint8_t * q = GPR_SLICE_START_PTR ( * slice_out ) ; <nl> while ( p ! = in_end ) { <nl> if ( * p = = ' % ' ) { <nl> bool gpr_strict_percent_decode_slice ( gpr_slice slice_in , <nl> return true ; <nl> } <nl> <nl> - gpr_slice gpr_permissive_percent_decode_slice ( gpr_slice slice_in ) { <nl> + grpc_slice gpr_permissive_percent_decode_slice ( grpc_slice slice_in ) { <nl> const uint8_t * p = GPR_SLICE_START_PTR ( slice_in ) ; <nl> const uint8_t * in_end = GPR_SLICE_END_PTR ( slice_in ) ; <nl> size_t out_length = 0 ; <nl> gpr_slice gpr_permissive_percent_decode_slice ( gpr_slice slice_in ) { <nl> } <nl> } <nl> if ( ! any_percent_encoded_stuff ) { <nl> - return gpr_slice_ref ( slice_in ) ; <nl> + return grpc_slice_ref ( slice_in ) ; <nl> } <nl> p = GPR_SLICE_START_PTR ( slice_in ) ; <nl> - gpr_slice out = gpr_slice_malloc ( out_length ) ; <nl> + grpc_slice out = grpc_slice_malloc ( out_length ) ; <nl> uint8_t * q = GPR_SLICE_START_PTR ( out ) ; <nl> while ( p ! = in_end ) { <nl> if ( * p = = ' % ' ) { <nl> similarity index 93 % <nl> rename from src / core / lib / support / percent_encoding . h <nl> rename to src / core / lib / slice / percent_encoding . h <nl> mmm a / src / core / lib / support / percent_encoding . h <nl> ppp b / src / core / lib / slice / percent_encoding . h <nl> extern const uint8_t gpr_compatible_percent_encoding_unreserved_bytes [ 256 / 8 ] ; <nl> / * Percent - encode a slice , returning the new slice ( this cannot fail ) : <nl> unreserved_bytes is a bitfield indicating which bytes are considered <nl> unreserved and thus do not need percent encoding * / <nl> - gpr_slice gpr_percent_encode_slice ( gpr_slice slice , <nl> + grpc_slice gpr_percent_encode_slice ( grpc_slice slice , <nl> const uint8_t * unreserved_bytes ) ; <nl> / * Percent - decode a slice , strictly . <nl> If the input is legal ( contains no unreserved bytes , and legal % encodings ) , <nl> gpr_slice gpr_percent_encode_slice ( gpr_slice slice , <nl> If the input is not legal , returns false and leaves * slice_out untouched . <nl> unreserved_bytes is a bitfield indicating which bytes are considered <nl> unreserved and thus do not need percent encoding * / <nl> - bool gpr_strict_percent_decode_slice ( gpr_slice slice_in , <nl> + bool gpr_strict_percent_decode_slice ( grpc_slice slice_in , <nl> const uint8_t * unreserved_bytes , <nl> - gpr_slice * slice_out ) ; <nl> + grpc_slice * slice_out ) ; <nl> / * Percent - decode a slice , permissively . <nl> If a % triplet can not be decoded , pass it through verbatim . <nl> This cannot fail . * / <nl> - gpr_slice gpr_permissive_percent_decode_slice ( gpr_slice slice_in ) ; <nl> + grpc_slice gpr_permissive_percent_decode_slice ( grpc_slice slice_in ) ; <nl> <nl> # endif / * GRPC_CORE_LIB_SUPPORT_PERCENT_ENCODING_H * / <nl> similarity index 84 % <nl> rename from src / core / lib / support / slice . c <nl> rename to src / core / lib / slice / slice . c <nl> mmm a / src / core / lib / support / slice . c <nl> ppp b / src / core / lib / slice / slice . c <nl> <nl> <nl> # include < string . h > <nl> <nl> - gpr_slice gpr_empty_slice ( void ) { <nl> - gpr_slice out ; <nl> + grpc_slice gpr_empty_slice ( void ) { <nl> + grpc_slice out ; <nl> out . refcount = 0 ; <nl> out . data . inlined . length = 0 ; <nl> return out ; <nl> } <nl> <nl> - gpr_slice gpr_slice_ref ( gpr_slice slice ) { <nl> + grpc_slice grpc_slice_ref ( grpc_slice slice ) { <nl> if ( slice . refcount ) { <nl> slice . refcount - > ref ( slice . refcount ) ; <nl> } <nl> return slice ; <nl> } <nl> <nl> - void gpr_slice_unref ( gpr_slice slice ) { <nl> + void grpc_slice_unref ( grpc_slice slice ) { <nl> if ( slice . refcount ) { <nl> slice . refcount - > unref ( slice . refcount ) ; <nl> } <nl> } <nl> <nl> - / * gpr_slice_from_static_string support structure - a refcount that does <nl> + / * grpc_slice_from_static_string support structure - a refcount that does <nl> nothing * / <nl> static void noop_ref_or_unref ( void * unused ) { } <nl> <nl> - static gpr_slice_refcount noop_refcount = { noop_ref_or_unref , <nl> + static grpc_slice_refcount noop_refcount = { noop_ref_or_unref , <nl> noop_ref_or_unref } ; <nl> <nl> - gpr_slice gpr_slice_from_static_string ( const char * s ) { <nl> - gpr_slice slice ; <nl> + grpc_slice grpc_slice_from_static_string ( const char * s ) { <nl> + grpc_slice slice ; <nl> slice . refcount = & noop_refcount ; <nl> slice . data . refcounted . bytes = ( uint8_t * ) s ; <nl> slice . data . refcounted . length = strlen ( s ) ; <nl> return slice ; <nl> } <nl> <nl> - / * gpr_slice_new support structures - we create a refcount object extended <nl> + / * grpc_slice_new support structures - we create a refcount object extended <nl> with the user provided data pointer & destroy function * / <nl> typedef struct new_slice_refcount { <nl> - gpr_slice_refcount rc ; <nl> + grpc_slice_refcount rc ; <nl> gpr_refcount refs ; <nl> void ( * user_destroy ) ( void * ) ; <nl> void * user_data ; <nl> static void new_slice_unref ( void * p ) { <nl> } <nl> } <nl> <nl> - gpr_slice gpr_slice_new_with_user_data ( void * p , size_t len , <nl> + grpc_slice grpc_slice_new_with_user_data ( void * p , size_t len , <nl> void ( * destroy ) ( void * ) , <nl> void * user_data ) { <nl> - gpr_slice slice ; <nl> + grpc_slice slice ; <nl> new_slice_refcount * rc = gpr_malloc ( sizeof ( new_slice_refcount ) ) ; <nl> gpr_ref_init ( & rc - > refs , 1 ) ; <nl> rc - > rc . ref = new_slice_ref ; <nl> gpr_slice gpr_slice_new_with_user_data ( void * p , size_t len , <nl> return slice ; <nl> } <nl> <nl> - gpr_slice gpr_slice_new ( void * p , size_t len , void ( * destroy ) ( void * ) ) { <nl> + grpc_slice grpc_slice_new ( void * p , size_t len , void ( * destroy ) ( void * ) ) { <nl> / * Pass " p " to * destroy when the slice is no longer needed . * / <nl> - return gpr_slice_new_with_user_data ( p , len , destroy , p ) ; <nl> + return grpc_slice_new_with_user_data ( p , len , destroy , p ) ; <nl> } <nl> <nl> - / * gpr_slice_new_with_len support structures - we create a refcount object <nl> + / * grpc_slice_new_with_len support structures - we create a refcount object <nl> extended with the user provided data pointer & destroy function * / <nl> typedef struct new_with_len_slice_refcount { <nl> - gpr_slice_refcount rc ; <nl> + grpc_slice_refcount rc ; <nl> gpr_refcount refs ; <nl> void * user_data ; <nl> size_t user_length ; <nl> static void new_with_len_unref ( void * p ) { <nl> } <nl> } <nl> <nl> - gpr_slice gpr_slice_new_with_len ( void * p , size_t len , <nl> + grpc_slice grpc_slice_new_with_len ( void * p , size_t len , <nl> void ( * destroy ) ( void * , size_t ) ) { <nl> - gpr_slice slice ; <nl> + grpc_slice slice ; <nl> new_with_len_slice_refcount * rc = <nl> gpr_malloc ( sizeof ( new_with_len_slice_refcount ) ) ; <nl> gpr_ref_init ( & rc - > refs , 1 ) ; <nl> gpr_slice gpr_slice_new_with_len ( void * p , size_t len , <nl> return slice ; <nl> } <nl> <nl> - gpr_slice gpr_slice_from_copied_buffer ( const char * source , size_t length ) { <nl> - gpr_slice slice = gpr_slice_malloc ( length ) ; <nl> + grpc_slice grpc_slice_from_copied_buffer ( const char * source , size_t length ) { <nl> + grpc_slice slice = grpc_slice_malloc ( length ) ; <nl> memcpy ( GPR_SLICE_START_PTR ( slice ) , source , length ) ; <nl> return slice ; <nl> } <nl> <nl> - gpr_slice gpr_slice_from_copied_string ( const char * source ) { <nl> - return gpr_slice_from_copied_buffer ( source , strlen ( source ) ) ; <nl> + grpc_slice grpc_slice_from_copied_string ( const char * source ) { <nl> + return grpc_slice_from_copied_buffer ( source , strlen ( source ) ) ; <nl> } <nl> <nl> typedef struct { <nl> - gpr_slice_refcount base ; <nl> + grpc_slice_refcount base ; <nl> gpr_refcount refs ; <nl> } malloc_refcount ; <nl> <nl> static void malloc_unref ( void * p ) { <nl> } <nl> } <nl> <nl> - gpr_slice gpr_slice_malloc ( size_t length ) { <nl> - gpr_slice slice ; <nl> + grpc_slice grpc_slice_malloc ( size_t length ) { <nl> + grpc_slice slice ; <nl> <nl> if ( length > sizeof ( slice . data . inlined . bytes ) ) { <nl> / * Memory layout used by the slice created here : <nl> gpr_slice gpr_slice_malloc ( size_t length ) { <nl> return slice ; <nl> } <nl> <nl> - gpr_slice gpr_slice_sub_no_ref ( gpr_slice source , size_t begin , size_t end ) { <nl> - gpr_slice subset ; <nl> + grpc_slice grpc_slice_sub_no_ref ( grpc_slice source , size_t begin , size_t end ) { <nl> + grpc_slice subset ; <nl> <nl> GPR_ASSERT ( end > = begin ) ; <nl> <nl> gpr_slice gpr_slice_sub_no_ref ( gpr_slice source , size_t begin , size_t end ) { <nl> return subset ; <nl> } <nl> <nl> - gpr_slice gpr_slice_sub ( gpr_slice source , size_t begin , size_t end ) { <nl> - gpr_slice subset ; <nl> + grpc_slice grpc_slice_sub ( grpc_slice source , size_t begin , size_t end ) { <nl> + grpc_slice subset ; <nl> <nl> if ( end - begin < = sizeof ( subset . data . inlined . bytes ) ) { <nl> subset . refcount = NULL ; <nl> gpr_slice gpr_slice_sub ( gpr_slice source , size_t begin , size_t end ) { <nl> memcpy ( subset . data . inlined . bytes , GPR_SLICE_START_PTR ( source ) + begin , <nl> end - begin ) ; <nl> } else { <nl> - subset = gpr_slice_sub_no_ref ( source , begin , end ) ; <nl> + subset = grpc_slice_sub_no_ref ( source , begin , end ) ; <nl> / * Bump the refcount * / <nl> subset . refcount - > ref ( subset . refcount ) ; <nl> } <nl> return subset ; <nl> } <nl> <nl> - gpr_slice gpr_slice_split_tail ( gpr_slice * source , size_t split ) { <nl> - gpr_slice tail ; <nl> + grpc_slice grpc_slice_split_tail ( grpc_slice * source , size_t split ) { <nl> + grpc_slice tail ; <nl> <nl> if ( source - > refcount = = NULL ) { <nl> / * inlined data , copy it out * / <nl> gpr_slice gpr_slice_split_tail ( gpr_slice * source , size_t split ) { <nl> return tail ; <nl> } <nl> <nl> - gpr_slice gpr_slice_split_head ( gpr_slice * source , size_t split ) { <nl> - gpr_slice head ; <nl> + grpc_slice grpc_slice_split_head ( grpc_slice * source , size_t split ) { <nl> + grpc_slice head ; <nl> <nl> if ( source - > refcount = = NULL ) { <nl> GPR_ASSERT ( source - > data . inlined . length > = split ) ; <nl> gpr_slice gpr_slice_split_head ( gpr_slice * source , size_t split ) { <nl> return head ; <nl> } <nl> <nl> - int gpr_slice_cmp ( gpr_slice a , gpr_slice b ) { <nl> + int grpc_slice_cmp ( grpc_slice a , grpc_slice b ) { <nl> int d = ( int ) ( GPR_SLICE_LENGTH ( a ) - GPR_SLICE_LENGTH ( b ) ) ; <nl> if ( d ! = 0 ) return d ; <nl> return memcmp ( GPR_SLICE_START_PTR ( a ) , GPR_SLICE_START_PTR ( b ) , <nl> GPR_SLICE_LENGTH ( a ) ) ; <nl> } <nl> <nl> - int gpr_slice_str_cmp ( gpr_slice a , const char * b ) { <nl> + int grpc_slice_str_cmp ( grpc_slice a , const char * b ) { <nl> size_t b_length = strlen ( b ) ; <nl> int d = ( int ) ( GPR_SLICE_LENGTH ( a ) - b_length ) ; <nl> if ( d ! = 0 ) return d ; <nl> similarity index 72 % <nl> rename from src / core / lib / support / slice_buffer . c <nl> rename to src / core / lib / slice / slice_buffer . c <nl> mmm a / src / core / lib / support / slice_buffer . c <nl> ppp b / src / core / lib / slice / slice_buffer . c <nl> <nl> / * grow a buffer ; requires GRPC_SLICE_BUFFER_INLINE_ELEMENTS > 1 * / <nl> # define GROW ( x ) ( 3 * ( x ) / 2 ) <nl> <nl> - static void maybe_embiggen ( gpr_slice_buffer * sb ) { <nl> + static void maybe_embiggen ( grpc_slice_buffer * sb ) { <nl> if ( sb - > count = = sb - > capacity ) { <nl> sb - > capacity = GROW ( sb - > capacity ) ; <nl> GPR_ASSERT ( sb - > capacity > sb - > count ) ; <nl> if ( sb - > slices = = sb - > inlined ) { <nl> - sb - > slices = gpr_malloc ( sb - > capacity * sizeof ( gpr_slice ) ) ; <nl> - memcpy ( sb - > slices , sb - > inlined , sb - > count * sizeof ( gpr_slice ) ) ; <nl> + sb - > slices = gpr_malloc ( sb - > capacity * sizeof ( grpc_slice ) ) ; <nl> + memcpy ( sb - > slices , sb - > inlined , sb - > count * sizeof ( grpc_slice ) ) ; <nl> } else { <nl> - sb - > slices = gpr_realloc ( sb - > slices , sb - > capacity * sizeof ( gpr_slice ) ) ; <nl> + sb - > slices = gpr_realloc ( sb - > slices , sb - > capacity * sizeof ( grpc_slice ) ) ; <nl> } <nl> } <nl> } <nl> <nl> - void gpr_slice_buffer_init ( gpr_slice_buffer * sb ) { <nl> + void grpc_slice_buffer_init ( grpc_slice_buffer * sb ) { <nl> sb - > count = 0 ; <nl> sb - > length = 0 ; <nl> sb - > capacity = GRPC_SLICE_BUFFER_INLINE_ELEMENTS ; <nl> sb - > slices = sb - > inlined ; <nl> } <nl> <nl> - void gpr_slice_buffer_destroy ( gpr_slice_buffer * sb ) { <nl> - gpr_slice_buffer_reset_and_unref ( sb ) ; <nl> + void grpc_slice_buffer_destroy ( grpc_slice_buffer * sb ) { <nl> + grpc_slice_buffer_reset_and_unref ( sb ) ; <nl> if ( sb - > slices ! = sb - > inlined ) { <nl> gpr_free ( sb - > slices ) ; <nl> } <nl> } <nl> <nl> - uint8_t * gpr_slice_buffer_tiny_add ( gpr_slice_buffer * sb , size_t n ) { <nl> - gpr_slice * back ; <nl> + uint8_t * grpc_slice_buffer_tiny_add ( grpc_slice_buffer * sb , size_t n ) { <nl> + grpc_slice * back ; <nl> uint8_t * out ; <nl> <nl> sb - > length + = n ; <nl> uint8_t * gpr_slice_buffer_tiny_add ( gpr_slice_buffer * sb , size_t n ) { <nl> return back - > data . inlined . bytes ; <nl> } <nl> <nl> - size_t gpr_slice_buffer_add_indexed ( gpr_slice_buffer * sb , gpr_slice s ) { <nl> + size_t grpc_slice_buffer_add_indexed ( grpc_slice_buffer * sb , grpc_slice s ) { <nl> size_t out = sb - > count ; <nl> maybe_embiggen ( sb ) ; <nl> sb - > slices [ out ] = s ; <nl> size_t gpr_slice_buffer_add_indexed ( gpr_slice_buffer * sb , gpr_slice s ) { <nl> return out ; <nl> } <nl> <nl> - void gpr_slice_buffer_add ( gpr_slice_buffer * sb , gpr_slice s ) { <nl> + void grpc_slice_buffer_add ( grpc_slice_buffer * sb , grpc_slice s ) { <nl> size_t n = sb - > count ; <nl> / * if both the last slice in the slice buffer and the slice being added <nl> are inlined ( that is , that they carry their data inside the slice data <nl> void gpr_slice_buffer_add ( gpr_slice_buffer * sb , gpr_slice s ) { <nl> into the back slice , preventing many small slices being passed into <nl> writes * / <nl> if ( ! s . refcount & & n ) { <nl> - gpr_slice * back = & sb - > slices [ n - 1 ] ; <nl> + grpc_slice * back = & sb - > slices [ n - 1 ] ; <nl> if ( ! back - > refcount & & back - > data . inlined . length < GPR_SLICE_INLINED_SIZE ) { <nl> if ( s . data . inlined . length + back - > data . inlined . length < = <nl> GPR_SLICE_INLINED_SIZE ) { <nl> void gpr_slice_buffer_add ( gpr_slice_buffer * sb , gpr_slice s ) { <nl> return ; / * early out * / <nl> } <nl> } <nl> - gpr_slice_buffer_add_indexed ( sb , s ) ; <nl> + grpc_slice_buffer_add_indexed ( sb , s ) ; <nl> } <nl> <nl> - void gpr_slice_buffer_addn ( gpr_slice_buffer * sb , gpr_slice * s , size_t n ) { <nl> + void grpc_slice_buffer_addn ( grpc_slice_buffer * sb , grpc_slice * s , size_t n ) { <nl> size_t i ; <nl> for ( i = 0 ; i < n ; i + + ) { <nl> - gpr_slice_buffer_add ( sb , s [ i ] ) ; <nl> + grpc_slice_buffer_add ( sb , s [ i ] ) ; <nl> } <nl> } <nl> <nl> - void gpr_slice_buffer_pop ( gpr_slice_buffer * sb ) { <nl> + void grpc_slice_buffer_pop ( grpc_slice_buffer * sb ) { <nl> if ( sb - > count ! = 0 ) { <nl> size_t count = - - sb - > count ; <nl> sb - > length - = GPR_SLICE_LENGTH ( sb - > slices [ count ] ) ; <nl> } <nl> } <nl> <nl> - void gpr_slice_buffer_reset_and_unref ( gpr_slice_buffer * sb ) { <nl> + void grpc_slice_buffer_reset_and_unref ( grpc_slice_buffer * sb ) { <nl> size_t i ; <nl> <nl> for ( i = 0 ; i < sb - > count ; i + + ) { <nl> - gpr_slice_unref ( sb - > slices [ i ] ) ; <nl> + grpc_slice_unref ( sb - > slices [ i ] ) ; <nl> } <nl> <nl> sb - > count = 0 ; <nl> sb - > length = 0 ; <nl> } <nl> <nl> - void gpr_slice_buffer_swap ( gpr_slice_buffer * a , gpr_slice_buffer * b ) { <nl> + void grpc_slice_buffer_swap ( grpc_slice_buffer * a , grpc_slice_buffer * b ) { <nl> GPR_SWAP ( size_t , a - > count , b - > count ) ; <nl> GPR_SWAP ( size_t , a - > capacity , b - > capacity ) ; <nl> GPR_SWAP ( size_t , a - > length , b - > length ) ; <nl> void gpr_slice_buffer_swap ( gpr_slice_buffer * a , gpr_slice_buffer * b ) { <nl> if ( a - > slices = = a - > inlined ) { <nl> if ( b - > slices = = b - > inlined ) { <nl> / * swap contents of inlined buffer * / <nl> - gpr_slice temp [ GRPC_SLICE_BUFFER_INLINE_ELEMENTS ] ; <nl> - memcpy ( temp , a - > slices , b - > count * sizeof ( gpr_slice ) ) ; <nl> - memcpy ( a - > slices , b - > slices , a - > count * sizeof ( gpr_slice ) ) ; <nl> - memcpy ( b - > slices , temp , b - > count * sizeof ( gpr_slice ) ) ; <nl> + grpc_slice temp [ GRPC_SLICE_BUFFER_INLINE_ELEMENTS ] ; <nl> + memcpy ( temp , a - > slices , b - > count * sizeof ( grpc_slice ) ) ; <nl> + memcpy ( a - > slices , b - > slices , a - > count * sizeof ( grpc_slice ) ) ; <nl> + memcpy ( b - > slices , temp , b - > count * sizeof ( grpc_slice ) ) ; <nl> } else { <nl> / * a is inlined , b is not - copy a inlined into b , fix pointers * / <nl> a - > slices = b - > slices ; <nl> b - > slices = b - > inlined ; <nl> - memcpy ( b - > slices , a - > inlined , b - > count * sizeof ( gpr_slice ) ) ; <nl> + memcpy ( b - > slices , a - > inlined , b - > count * sizeof ( grpc_slice ) ) ; <nl> } <nl> } else if ( b - > slices = = b - > inlined ) { <nl> / * b is inlined , a is not - copy b inlined int a , fix pointers * / <nl> b - > slices = a - > slices ; <nl> a - > slices = a - > inlined ; <nl> - memcpy ( a - > slices , b - > inlined , a - > count * sizeof ( gpr_slice ) ) ; <nl> + memcpy ( a - > slices , b - > inlined , a - > count * sizeof ( grpc_slice ) ) ; <nl> } else { <nl> / * no inlining : easy swap * / <nl> - GPR_SWAP ( gpr_slice * , a - > slices , b - > slices ) ; <nl> + GPR_SWAP ( grpc_slice * , a - > slices , b - > slices ) ; <nl> } <nl> } <nl> <nl> - void gpr_slice_buffer_move_into ( gpr_slice_buffer * src , gpr_slice_buffer * dst ) { <nl> + void grpc_slice_buffer_move_into ( grpc_slice_buffer * src , grpc_slice_buffer * dst ) { <nl> / * anything to move ? * / <nl> if ( src - > count = = 0 ) { <nl> return ; <nl> } <nl> / * anything in dst ? * / <nl> if ( dst - > count = = 0 ) { <nl> - gpr_slice_buffer_swap ( src , dst ) ; <nl> + grpc_slice_buffer_swap ( src , dst ) ; <nl> return ; <nl> } <nl> / * both buffers have data - copy , and reset src * / <nl> - gpr_slice_buffer_addn ( dst , src - > slices , src - > count ) ; <nl> + grpc_slice_buffer_addn ( dst , src - > slices , src - > count ) ; <nl> src - > count = 0 ; <nl> src - > length = 0 ; <nl> } <nl> <nl> - void gpr_slice_buffer_move_first ( gpr_slice_buffer * src , size_t n , <nl> - gpr_slice_buffer * dst ) { <nl> + void grpc_slice_buffer_move_first ( grpc_slice_buffer * src , size_t n , <nl> + grpc_slice_buffer * dst ) { <nl> size_t src_idx ; <nl> size_t output_len = dst - > length + n ; <nl> size_t new_input_len = src - > length - n ; <nl> GPR_ASSERT ( src - > length > = n ) ; <nl> if ( src - > length = = n ) { <nl> - gpr_slice_buffer_move_into ( src , dst ) ; <nl> + grpc_slice_buffer_move_into ( src , dst ) ; <nl> return ; <nl> } <nl> src_idx = 0 ; <nl> while ( src_idx < src - > capacity ) { <nl> - gpr_slice slice = src - > slices [ src_idx ] ; <nl> + grpc_slice slice = src - > slices [ src_idx ] ; <nl> size_t slice_len = GPR_SLICE_LENGTH ( slice ) ; <nl> if ( n > slice_len ) { <nl> - gpr_slice_buffer_add ( dst , slice ) ; <nl> + grpc_slice_buffer_add ( dst , slice ) ; <nl> n - = slice_len ; <nl> src_idx + + ; <nl> } else if ( n = = slice_len ) { <nl> - gpr_slice_buffer_add ( dst , slice ) ; <nl> + grpc_slice_buffer_add ( dst , slice ) ; <nl> src_idx + + ; <nl> break ; <nl> } else { / * n < slice_len * / <nl> - src - > slices [ src_idx ] = gpr_slice_split_tail ( & slice , n ) ; <nl> + src - > slices [ src_idx ] = grpc_slice_split_tail ( & slice , n ) ; <nl> GPR_ASSERT ( GPR_SLICE_LENGTH ( slice ) = = n ) ; <nl> GPR_ASSERT ( GPR_SLICE_LENGTH ( src - > slices [ src_idx ] ) = = slice_len - n ) ; <nl> - gpr_slice_buffer_add ( dst , slice ) ; <nl> + grpc_slice_buffer_add ( dst , slice ) ; <nl> break ; <nl> } <nl> } <nl> GPR_ASSERT ( dst - > length = = output_len ) ; <nl> memmove ( src - > slices , src - > slices + src_idx , <nl> - sizeof ( gpr_slice ) * ( src - > count - src_idx ) ) ; <nl> + sizeof ( grpc_slice ) * ( src - > count - src_idx ) ) ; <nl> src - > count - = src_idx ; <nl> src - > length = new_input_len ; <nl> GPR_ASSERT ( src - > count > 0 ) ; <nl> } <nl> <nl> - void gpr_slice_buffer_trim_end ( gpr_slice_buffer * sb , size_t n , <nl> - gpr_slice_buffer * garbage ) { <nl> + void grpc_slice_buffer_trim_end ( grpc_slice_buffer * sb , size_t n , <nl> + grpc_slice_buffer * garbage ) { <nl> GPR_ASSERT ( n < = sb - > length ) ; <nl> sb - > length - = n ; <nl> for ( ; ; ) { <nl> size_t idx = sb - > count - 1 ; <nl> - gpr_slice slice = sb - > slices [ idx ] ; <nl> + grpc_slice slice = sb - > slices [ idx ] ; <nl> size_t slice_len = GPR_SLICE_LENGTH ( slice ) ; <nl> if ( slice_len > n ) { <nl> - sb - > slices [ idx ] = gpr_slice_split_head ( & slice , slice_len - n ) ; <nl> - gpr_slice_buffer_add_indexed ( garbage , slice ) ; <nl> + sb - > slices [ idx ] = grpc_slice_split_head ( & slice , slice_len - n ) ; <nl> + grpc_slice_buffer_add_indexed ( garbage , slice ) ; <nl> return ; <nl> } else if ( slice_len = = n ) { <nl> - gpr_slice_buffer_add_indexed ( garbage , slice ) ; <nl> + grpc_slice_buffer_add_indexed ( garbage , slice ) ; <nl> sb - > count = idx ; <nl> return ; <nl> } else { <nl> - gpr_slice_buffer_add_indexed ( garbage , slice ) ; <nl> + grpc_slice_buffer_add_indexed ( garbage , slice ) ; <nl> n - = slice_len ; <nl> sb - > count = idx ; <nl> } <nl> } <nl> } <nl> <nl> - gpr_slice gpr_slice_buffer_take_first ( gpr_slice_buffer * sb ) { <nl> - gpr_slice slice ; <nl> + grpc_slice grpc_slice_buffer_take_first ( grpc_slice_buffer * sb ) { <nl> + grpc_slice slice ; <nl> GPR_ASSERT ( sb - > count > 0 ) ; <nl> slice = sb - > slices [ 0 ] ; <nl> - memmove ( & sb - > slices [ 0 ] , & sb - > slices [ 1 ] , ( sb - > count - 1 ) * sizeof ( gpr_slice ) ) ; <nl> + memmove ( & sb - > slices [ 0 ] , & sb - > slices [ 1 ] , ( sb - > count - 1 ) * sizeof ( grpc_slice ) ) ; <nl> sb - > count - - ; <nl> sb - > length - = GPR_SLICE_LENGTH ( slice ) ; <nl> return slice ; <nl> new file mode 100644 <nl> index 00000000000 . . cc8b80d3b85 <nl> mmm / dev / null <nl> ppp b / src / core / lib / slice / slice_string_helpers . c <nl> <nl> + / * <nl> + * <nl> + * Copyright 2015 , Google Inc . <nl> + * All rights reserved . <nl> + * <nl> + * Redistribution and use in source and binary forms , with or without <nl> + * modification , are permitted provided that the following conditions are <nl> + * met : <nl> + * <nl> + * * Redistributions of source code must retain the above copyright <nl> + * notice , this list of conditions and the following disclaimer . <nl> + * * Redistributions in binary form must reproduce the above <nl> + * copyright notice , this list of conditions and the following disclaimer <nl> + * in the documentation and / or other materials provided with the <nl> + * distribution . <nl> + * * Neither the name of Google Inc . nor the names of its <nl> + * contributors may be used to endorse or promote products derived from <nl> + * this software without specific prior written permission . <nl> + * <nl> + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS <nl> + * " AS IS " AND ANY EXPRESS OR IMPLIED WARRANTIES , INCLUDING , BUT NOT <nl> + * LIMITED TO , THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR <nl> + * A PARTICULAR PURPOSE ARE DISCLAIMED . IN NO EVENT SHALL THE COPYRIGHT <nl> + * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT , INDIRECT , INCIDENTAL , <nl> + * SPECIAL , EXEMPLARY , OR CONSEQUENTIAL DAMAGES ( INCLUDING , BUT NOT <nl> + * LIMITED TO , PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES ; LOSS OF USE , <nl> + * DATA , OR PROFITS ; OR BUSINESS INTERRUPTION ) HOWEVER CAUSED AND ON ANY <nl> + * THEORY OF LIABILITY , WHETHER IN CONTRACT , STRICT LIABILITY , OR TORT <nl> + * ( INCLUDING NEGLIGENCE OR OTHERWISE ) ARISING IN ANY WAY OUT OF THE USE <nl> + * OF THIS SOFTWARE , EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE . <nl> + * <nl> + * / <nl> + <nl> + char * gpr_dump_slice ( grpc_slice s , uint32_t flags ) { <nl> + return gpr_dump ( ( const char * ) GPR_SLICE_START_PTR ( s ) , GPR_SLICE_LENGTH ( s ) , <nl> + flags ) ; <nl> + } <nl> + <nl> + / * * Finds the initial ( \ a begin ) and final ( \ a end ) offsets of the next <nl> + * substring from \ a str + \ a read_offset until the next \ a sep or the end of \ a <nl> + * str . <nl> + * <nl> + * Returns 1 and updates \ a begin and \ a end . Returns 0 otherwise . * / <nl> + static int slice_find_separator_offset ( const grpc_slice str , const char * sep , <nl> + const size_t read_offset , size_t * begin , <nl> + size_t * end ) { <nl> + size_t i ; <nl> + const uint8_t * str_ptr = GPR_SLICE_START_PTR ( str ) + read_offset ; <nl> + const size_t str_len = GPR_SLICE_LENGTH ( str ) - read_offset ; <nl> + const size_t sep_len = strlen ( sep ) ; <nl> + if ( str_len < sep_len ) { <nl> + return 0 ; <nl> + } <nl> + <nl> + for ( i = 0 ; i < = str_len - sep_len ; i + + ) { <nl> + if ( memcmp ( str_ptr + i , sep , sep_len ) = = 0 ) { <nl> + * begin = read_offset ; <nl> + * end = read_offset + i ; <nl> + return 1 ; <nl> + } <nl> + } <nl> + return 0 ; <nl> + } <nl> + <nl> + void grpc_slice_split ( grpc_slice str , const char * sep , grpc_slice_buffer * dst ) { <nl> + const size_t sep_len = strlen ( sep ) ; <nl> + size_t begin , end ; <nl> + <nl> + GPR_ASSERT ( sep_len > 0 ) ; <nl> + <nl> + if ( slice_find_separator_offset ( str , sep , 0 , & begin , & end ) ! = 0 ) { <nl> + do { <nl> + grpc_slice_buffer_add_indexed ( dst , grpc_slice_sub ( str , begin , end ) ) ; <nl> + } while ( slice_find_separator_offset ( str , sep , end + sep_len , & begin , <nl> + & end ) ! = 0 ) ; <nl> + grpc_slice_buffer_add_indexed ( <nl> + dst , grpc_slice_sub ( str , end + sep_len , GPR_SLICE_LENGTH ( str ) ) ) ; <nl> + } else { / * no sep found , add whole input * / <nl> + grpc_slice_buffer_add_indexed ( dst , grpc_slice_ref ( str ) ) ; <nl> + } <nl> + } <nl> new file mode 100644 <nl> index 00000000000 . . d144a70889e <nl> mmm / dev / null <nl> ppp b / src / core / lib / slice / slice_string_helpers . h <nl> <nl> + / * <nl> + * <nl> + * Copyright 2015 , Google Inc . <nl> + * All rights reserved . <nl> + * <nl> + * Redistribution and use in source and binary forms , with or without <nl> + * modification , are permitted provided that the following conditions are <nl> + * met : <nl> + * <nl> + * * Redistributions of source code must retain the above copyright <nl> + * notice , this list of conditions and the following disclaimer . <nl> + * * Redistributions in binary form must reproduce the above <nl> + * copyright notice , this list of conditions and the following disclaimer <nl> + * in the documentation and / or other materials provided with the <nl> + * distribution . <nl> + * * Neither the name of Google Inc . nor the names of its <nl> + * contributors may be used to endorse or promote products derived from <nl> + * this software without specific prior written permission . <nl> + * <nl> + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS <nl> + * " AS IS " AND ANY EXPRESS OR IMPLIED WARRANTIES , INCLUDING , BUT NOT <nl> + * LIMITED TO , THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR <nl> + * A PARTICULAR PURPOSE ARE DISCLAIMED . IN NO EVENT SHALL THE COPYRIGHT <nl> + * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT , INDIRECT , INCIDENTAL , <nl> + * SPECIAL , EXEMPLARY , OR CONSEQUENTIAL DAMAGES ( INCLUDING , BUT NOT <nl> + * LIMITED TO , PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES ; LOSS OF USE , <nl> + * DATA , OR PROFITS ; OR BUSINESS INTERRUPTION ) HOWEVER CAUSED AND ON ANY <nl> + * THEORY OF LIABILITY , WHETHER IN CONTRACT , STRICT LIABILITY , OR TORT <nl> + * ( INCLUDING NEGLIGENCE OR OTHERWISE ) ARISING IN ANY WAY OUT OF THE USE <nl> + * OF THIS SOFTWARE , EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE . <nl> + * <nl> + * / <nl> + <nl> + # ifndef GRPC_CORE_LIB_SUPPORT_SLICE_STRING_H <nl> + # define GRPC_CORE_LIB_SUPPORT_SLICE_STRING_H <nl> + <nl> + # include < stddef . h > <nl> + <nl> + # include < grpc / support / port_platform . h > <nl> + # include < grpc / support / slice . h > <nl> + # include < grpc / support / slice_buffer . h > <nl> + <nl> + # ifdef __cplusplus <nl> + extern " C " { <nl> + # endif <nl> + <nl> + / * Calls gpr_dump on a slice . * / <nl> + char * gpr_dump_slice ( grpc_slice slice , uint32_t flags ) ; <nl> + <nl> + / * * Split \ a str by the separator \ a sep . Results are stored in \ a dst , which <nl> + * should be a properly initialized instance . * / <nl> + void grpc_slice_split ( grpc_slice str , const char * sep , grpc_slice_buffer * dst ) ; <nl> + <nl> + # ifdef __cplusplus <nl> + } <nl> + # endif <nl> + <nl> + # endif / * GRPC_CORE_LIB_SUPPORT_STRING_H * / <nl> mmm a / src / core / lib / support / string . c <nl> ppp b / src / core / lib / support / string . c <nl> char * gpr_dump ( const char * buf , size_t len , uint32_t flags ) { <nl> return out . data ; <nl> } <nl> <nl> - char * gpr_dump_slice ( gpr_slice s , uint32_t flags ) { <nl> - return gpr_dump ( ( const char * ) GPR_SLICE_START_PTR ( s ) , GPR_SLICE_LENGTH ( s ) , <nl> - flags ) ; <nl> - } <nl> - <nl> int gpr_parse_bytes_to_uint32 ( const char * buf , size_t len , uint32_t * result ) { <nl> uint32_t out = 0 ; <nl> uint32_t new ; <nl> char * gpr_strjoin_sep ( const char * * strs , size_t nstrs , const char * sep , <nl> return out ; <nl> } <nl> <nl> - / * * Finds the initial ( \ a begin ) and final ( \ a end ) offsets of the next <nl> - * substring from \ a str + \ a read_offset until the next \ a sep or the end of \ a <nl> - * str . <nl> - * <nl> - * Returns 1 and updates \ a begin and \ a end . Returns 0 otherwise . * / <nl> - static int slice_find_separator_offset ( const gpr_slice str , const char * sep , <nl> - const size_t read_offset , size_t * begin , <nl> - size_t * end ) { <nl> - size_t i ; <nl> - const uint8_t * str_ptr = GPR_SLICE_START_PTR ( str ) + read_offset ; <nl> - const size_t str_len = GPR_SLICE_LENGTH ( str ) - read_offset ; <nl> - const size_t sep_len = strlen ( sep ) ; <nl> - if ( str_len < sep_len ) { <nl> - return 0 ; <nl> - } <nl> - <nl> - for ( i = 0 ; i < = str_len - sep_len ; i + + ) { <nl> - if ( memcmp ( str_ptr + i , sep , sep_len ) = = 0 ) { <nl> - * begin = read_offset ; <nl> - * end = read_offset + i ; <nl> - return 1 ; <nl> - } <nl> - } <nl> - return 0 ; <nl> - } <nl> - <nl> - void gpr_slice_split ( gpr_slice str , const char * sep , gpr_slice_buffer * dst ) { <nl> - const size_t sep_len = strlen ( sep ) ; <nl> - size_t begin , end ; <nl> - <nl> - GPR_ASSERT ( sep_len > 0 ) ; <nl> - <nl> - if ( slice_find_separator_offset ( str , sep , 0 , & begin , & end ) ! = 0 ) { <nl> - do { <nl> - gpr_slice_buffer_add_indexed ( dst , gpr_slice_sub ( str , begin , end ) ) ; <nl> - } while ( slice_find_separator_offset ( str , sep , end + sep_len , & begin , <nl> - & end ) ! = 0 ) ; <nl> - gpr_slice_buffer_add_indexed ( <nl> - dst , gpr_slice_sub ( str , end + sep_len , GPR_SLICE_LENGTH ( str ) ) ) ; <nl> - } else { / * no sep found , add whole input * / <nl> - gpr_slice_buffer_add_indexed ( dst , gpr_slice_ref ( str ) ) ; <nl> - } <nl> - } <nl> - <nl> void gpr_strvec_init ( gpr_strvec * sv ) { memset ( sv , 0 , sizeof ( * sv ) ) ; } <nl> <nl> void gpr_strvec_destroy ( gpr_strvec * sv ) { <nl> mmm a / src / core / lib / support / string . h <nl> ppp b / src / core / lib / support / string . h <nl> extern " C " { <nl> Result should be freed with gpr_free ( ) * / <nl> char * gpr_dump ( const char * buf , size_t len , uint32_t flags ) ; <nl> <nl> - / * Calls gpr_dump on a slice . * / <nl> - char * gpr_dump_slice ( gpr_slice slice , uint32_t flags ) ; <nl> - <nl> / * Parses an array of bytes into an integer ( base 10 ) . Returns 1 on success , <nl> 0 on failure . * / <nl> int gpr_parse_bytes_to_uint32 ( const char * data , size_t length , <nl> char * gpr_strjoin ( const char * * strs , size_t nstrs , size_t * total_length ) ; <nl> char * gpr_strjoin_sep ( const char * * strs , size_t nstrs , const char * sep , <nl> size_t * total_length ) ; <nl> <nl> - / * * Split \ a str by the separator \ a sep . Results are stored in \ a dst , which <nl> - * should be a properly initialized instance . * / <nl> - void gpr_slice_split ( gpr_slice str , const char * sep , gpr_slice_buffer * dst ) ; <nl> - <nl> / * A vector of strings . . . for building up a final string one piece at a time * / <nl> typedef struct { <nl> char * * strs ; <nl> mmm a / src / core / lib / surface / byte_buffer . c <nl> ppp b / src / core / lib / surface / byte_buffer . c <nl> <nl> # include < grpc / support / alloc . h > <nl> # include < grpc / support / log . h > <nl> <nl> - grpc_byte_buffer * grpc_raw_byte_buffer_create ( gpr_slice * slices , <nl> + grpc_byte_buffer * grpc_raw_byte_buffer_create ( grpc_slice * slices , <nl> size_t nslices ) { <nl> return grpc_raw_compressed_byte_buffer_create ( slices , nslices , <nl> GRPC_COMPRESS_NONE ) ; <nl> } <nl> <nl> grpc_byte_buffer * grpc_raw_compressed_byte_buffer_create ( <nl> - gpr_slice * slices , size_t nslices , grpc_compression_algorithm compression ) { <nl> + grpc_slice * slices , size_t nslices , grpc_compression_algorithm compression ) { <nl> size_t i ; <nl> grpc_byte_buffer * bb = gpr_malloc ( sizeof ( grpc_byte_buffer ) ) ; <nl> bb - > type = GRPC_BB_RAW ; <nl> bb - > data . raw . compression = compression ; <nl> - gpr_slice_buffer_init ( & bb - > data . raw . slice_buffer ) ; <nl> + grpc_slice_buffer_init ( & bb - > data . raw . slice_buffer ) ; <nl> for ( i = 0 ; i < nslices ; i + + ) { <nl> - gpr_slice_ref ( slices [ i ] ) ; <nl> - gpr_slice_buffer_add ( & bb - > data . raw . slice_buffer , slices [ i ] ) ; <nl> + grpc_slice_ref ( slices [ i ] ) ; <nl> + grpc_slice_buffer_add ( & bb - > data . raw . slice_buffer , slices [ i ] ) ; <nl> } <nl> return bb ; <nl> } <nl> grpc_byte_buffer * grpc_raw_compressed_byte_buffer_create ( <nl> grpc_byte_buffer * grpc_raw_byte_buffer_from_reader ( <nl> grpc_byte_buffer_reader * reader ) { <nl> grpc_byte_buffer * bb = gpr_malloc ( sizeof ( grpc_byte_buffer ) ) ; <nl> - gpr_slice slice ; <nl> + grpc_slice slice ; <nl> bb - > type = GRPC_BB_RAW ; <nl> bb - > data . raw . compression = GRPC_COMPRESS_NONE ; <nl> - gpr_slice_buffer_init ( & bb - > data . raw . slice_buffer ) ; <nl> + grpc_slice_buffer_init ( & bb - > data . raw . slice_buffer ) ; <nl> <nl> while ( grpc_byte_buffer_reader_next ( reader , & slice ) ) { <nl> - gpr_slice_buffer_add ( & bb - > data . raw . slice_buffer , slice ) ; <nl> + grpc_slice_buffer_add ( & bb - > data . raw . slice_buffer , slice ) ; <nl> } <nl> return bb ; <nl> } <nl> void grpc_byte_buffer_destroy ( grpc_byte_buffer * bb ) { <nl> if ( ! bb ) return ; <nl> switch ( bb - > type ) { <nl> case GRPC_BB_RAW : <nl> - gpr_slice_buffer_destroy ( & bb - > data . raw . slice_buffer ) ; <nl> + grpc_slice_buffer_destroy ( & bb - > data . raw . slice_buffer ) ; <nl> break ; <nl> } <nl> gpr_free ( bb ) ; <nl> mmm a / src / core / lib / surface / byte_buffer_reader . c <nl> ppp b / src / core / lib / surface / byte_buffer_reader . c <nl> static int is_compressed ( grpc_byte_buffer * buffer ) { <nl> <nl> int grpc_byte_buffer_reader_init ( grpc_byte_buffer_reader * reader , <nl> grpc_byte_buffer * buffer ) { <nl> - gpr_slice_buffer decompressed_slices_buffer ; <nl> + grpc_slice_buffer decompressed_slices_buffer ; <nl> reader - > buffer_in = buffer ; <nl> switch ( reader - > buffer_in - > type ) { <nl> case GRPC_BB_RAW : <nl> - gpr_slice_buffer_init ( & decompressed_slices_buffer ) ; <nl> + grpc_slice_buffer_init ( & decompressed_slices_buffer ) ; <nl> if ( is_compressed ( reader - > buffer_in ) ) { <nl> if ( grpc_msg_decompress ( reader - > buffer_in - > data . raw . compression , <nl> & reader - > buffer_in - > data . raw . slice_buffer , <nl> int grpc_byte_buffer_reader_init ( grpc_byte_buffer_reader * reader , <nl> grpc_raw_byte_buffer_create ( decompressed_slices_buffer . slices , <nl> decompressed_slices_buffer . count ) ; <nl> } <nl> - gpr_slice_buffer_destroy ( & decompressed_slices_buffer ) ; <nl> + grpc_slice_buffer_destroy ( & decompressed_slices_buffer ) ; <nl> } else { / * not compressed , use the input buffer as output * / <nl> reader - > buffer_out = reader - > buffer_in ; <nl> } <nl> void grpc_byte_buffer_reader_destroy ( grpc_byte_buffer_reader * reader ) { <nl> } <nl> <nl> int grpc_byte_buffer_reader_next ( grpc_byte_buffer_reader * reader , <nl> - gpr_slice * slice ) { <nl> + grpc_slice * slice ) { <nl> switch ( reader - > buffer_in - > type ) { <nl> case GRPC_BB_RAW : { <nl> - gpr_slice_buffer * slice_buffer ; <nl> + grpc_slice_buffer * slice_buffer ; <nl> slice_buffer = & reader - > buffer_out - > data . raw . slice_buffer ; <nl> if ( reader - > current . index < slice_buffer - > count ) { <nl> - * slice = gpr_slice_ref ( slice_buffer - > slices [ reader - > current . index ] ) ; <nl> + * slice = grpc_slice_ref ( slice_buffer - > slices [ reader - > current . index ] ) ; <nl> reader - > current . index + = 1 ; <nl> return 1 ; <nl> } <nl> int grpc_byte_buffer_reader_next ( grpc_byte_buffer_reader * reader , <nl> return 0 ; <nl> } <nl> <nl> - gpr_slice grpc_byte_buffer_reader_readall ( grpc_byte_buffer_reader * reader ) { <nl> - gpr_slice in_slice ; <nl> + grpc_slice grpc_byte_buffer_reader_readall ( grpc_byte_buffer_reader * reader ) { <nl> + grpc_slice in_slice ; <nl> size_t bytes_read = 0 ; <nl> const size_t input_size = grpc_byte_buffer_length ( reader - > buffer_out ) ; <nl> - gpr_slice out_slice = gpr_slice_malloc ( input_size ) ; <nl> + grpc_slice out_slice = grpc_slice_malloc ( input_size ) ; <nl> uint8_t * const outbuf = GPR_SLICE_START_PTR ( out_slice ) ; / * just an alias * / <nl> <nl> while ( grpc_byte_buffer_reader_next ( reader , & in_slice ) ! = 0 ) { <nl> const size_t slice_length = GPR_SLICE_LENGTH ( in_slice ) ; <nl> memcpy ( & ( outbuf [ bytes_read ] ) , GPR_SLICE_START_PTR ( in_slice ) , slice_length ) ; <nl> bytes_read + = slice_length ; <nl> - gpr_slice_unref ( in_slice ) ; <nl> + grpc_slice_unref ( in_slice ) ; <nl> GPR_ASSERT ( bytes_read < = input_size ) ; <nl> } <nl> return out_slice ; <nl> mmm a / src / core / lib / surface / call . c <nl> ppp b / src / core / lib / surface / call . c <nl> struct grpc_call { <nl> grpc_slice_buffer_stream sending_stream ; <nl> grpc_byte_stream * receiving_stream ; <nl> grpc_byte_buffer * * receiving_buffer ; <nl> - gpr_slice receiving_slice ; <nl> + grpc_slice receiving_slice ; <nl> grpc_closure receiving_slice_ready ; <nl> grpc_closure receiving_stream_ready ; <nl> grpc_closure receiving_initial_metadata_ready ; <nl> static void destroy_encodings_accepted_by_peer ( void * p ) { return ; } <nl> static void set_encodings_accepted_by_peer ( grpc_call * call , grpc_mdelem * mdel ) { <nl> size_t i ; <nl> grpc_compression_algorithm algorithm ; <nl> - gpr_slice_buffer accept_encoding_parts ; <nl> - gpr_slice accept_encoding_slice ; <nl> + grpc_slice_buffer accept_encoding_parts ; <nl> + grpc_slice accept_encoding_slice ; <nl> void * accepted_user_data ; <nl> <nl> accepted_user_data = <nl> static void set_encodings_accepted_by_peer ( grpc_call * call , grpc_mdelem * mdel ) { <nl> } <nl> <nl> accept_encoding_slice = mdel - > value - > slice ; <nl> - gpr_slice_buffer_init ( & accept_encoding_parts ) ; <nl> - gpr_slice_split ( accept_encoding_slice , " , " , & accept_encoding_parts ) ; <nl> + grpc_slice_buffer_init ( & accept_encoding_parts ) ; <nl> + grpc_slice_split ( accept_encoding_slice , " , " , & accept_encoding_parts ) ; <nl> <nl> / * No need to zero call - > encodings_accepted_by_peer : grpc_call_create already <nl> * zeroes the whole grpc_call * / <nl> / * Always support no compression * / <nl> GPR_BITSET ( & call - > encodings_accepted_by_peer , GRPC_COMPRESS_NONE ) ; <nl> for ( i = 0 ; i < accept_encoding_parts . count ; i + + ) { <nl> - const gpr_slice * accept_encoding_entry_slice = <nl> + const grpc_slice * accept_encoding_entry_slice = <nl> & accept_encoding_parts . slices [ i ] ; <nl> if ( grpc_compression_algorithm_parse ( <nl> ( const char * ) GPR_SLICE_START_PTR ( * accept_encoding_entry_slice ) , <nl> static void set_encodings_accepted_by_peer ( grpc_call * call , grpc_mdelem * mdel ) { <nl> } <nl> } <nl> <nl> - gpr_slice_buffer_destroy ( & accept_encoding_parts ) ; <nl> + grpc_slice_buffer_destroy ( & accept_encoding_parts ) ; <nl> <nl> grpc_mdelem_set_user_data ( <nl> mdel , destroy_encodings_accepted_by_peer , <nl> static void get_final_details ( grpc_call * call , char * * out_details , <nl> for ( i = 0 ; i < STATUS_SOURCE_COUNT ; i + + ) { <nl> if ( call - > status [ i ] . is_set ) { <nl> if ( call - > status [ i ] . details ) { <nl> - gpr_slice details = call - > status [ i ] . details - > slice ; <nl> + grpc_slice details = call - > status [ i ] . details - > slice ; <nl> size_t len = GPR_SLICE_LENGTH ( details ) ; <nl> if ( len + 1 > * out_details_capacity ) { <nl> * out_details_capacity = <nl> static void continue_receiving_slices ( grpc_exec_ctx * exec_ctx , <nl> if ( grpc_byte_stream_next ( exec_ctx , call - > receiving_stream , <nl> & call - > receiving_slice , remaining , <nl> & call - > receiving_slice_ready ) ) { <nl> - gpr_slice_buffer_add ( & ( * call - > receiving_buffer ) - > data . raw . slice_buffer , <nl> + grpc_slice_buffer_add ( & ( * call - > receiving_buffer ) - > data . raw . slice_buffer , <nl> call - > receiving_slice ) ; <nl> } else { <nl> return ; <nl> static void receiving_slice_ready ( grpc_exec_ctx * exec_ctx , void * bctlp , <nl> grpc_call * call = bctl - > call ; <nl> <nl> if ( error = = GRPC_ERROR_NONE ) { <nl> - gpr_slice_buffer_add ( & ( * call - > receiving_buffer ) - > data . raw . slice_buffer , <nl> + grpc_slice_buffer_add ( & ( * call - > receiving_buffer ) - > data . raw . slice_buffer , <nl> call - > receiving_slice ) ; <nl> continue_receiving_slices ( exec_ctx , bctl ) ; <nl> } else { <nl> mmm a / src / core / lib / surface / server . c <nl> ppp b / src / core / lib / surface / server . c <nl> static void channel_broadcaster_init ( grpc_server * s , channel_broadcaster * cb ) { <nl> <nl> struct shutdown_cleanup_args { <nl> grpc_closure closure ; <nl> - gpr_slice slice ; <nl> + grpc_slice slice ; <nl> } ; <nl> <nl> static void shutdown_cleanup ( grpc_exec_ctx * exec_ctx , void * arg , <nl> grpc_error * error ) { <nl> struct shutdown_cleanup_args * a = arg ; <nl> - gpr_slice_unref ( a - > slice ) ; <nl> + grpc_slice_unref ( a - > slice ) ; <nl> gpr_free ( a ) ; <nl> } <nl> <nl> static void send_shutdown ( grpc_exec_ctx * exec_ctx , grpc_channel * channel , <nl> <nl> op - > send_goaway = send_goaway ; <nl> op - > set_accept_stream = true ; <nl> - sc - > slice = gpr_slice_from_copied_string ( " Server shutdown " ) ; <nl> + sc - > slice = grpc_slice_from_copied_string ( " Server shutdown " ) ; <nl> op - > goaway_message = & sc - > slice ; <nl> op - > goaway_status = GRPC_STATUS_OK ; <nl> op - > disconnect_with_error = send_disconnect ; <nl> static void destroy_channel ( grpc_exec_ctx * exec_ctx , channel_data * chand , <nl> } <nl> <nl> static void cpstr ( char * * dest , size_t * capacity , grpc_mdstr * value ) { <nl> - gpr_slice slice = value - > slice ; <nl> + grpc_slice slice = value - > slice ; <nl> size_t len = GPR_SLICE_LENGTH ( slice ) ; <nl> <nl> if ( len + 1 > * capacity ) { <nl> mmm a / src / core / lib / transport / byte_stream . c <nl> ppp b / src / core / lib / transport / byte_stream . c <nl> <nl> # include < grpc / support / log . h > <nl> <nl> int grpc_byte_stream_next ( grpc_exec_ctx * exec_ctx , <nl> - grpc_byte_stream * byte_stream , gpr_slice * slice , <nl> + grpc_byte_stream * byte_stream , grpc_slice * slice , <nl> size_t max_size_hint , grpc_closure * on_complete ) { <nl> return byte_stream - > next ( exec_ctx , byte_stream , slice , max_size_hint , <nl> on_complete ) ; <nl> void grpc_byte_stream_destroy ( grpc_exec_ctx * exec_ctx , <nl> <nl> static int slice_buffer_stream_next ( grpc_exec_ctx * exec_ctx , <nl> grpc_byte_stream * byte_stream , <nl> - gpr_slice * slice , size_t max_size_hint , <nl> + grpc_slice * slice , size_t max_size_hint , <nl> grpc_closure * on_complete ) { <nl> grpc_slice_buffer_stream * stream = ( grpc_slice_buffer_stream * ) byte_stream ; <nl> GPR_ASSERT ( stream - > cursor < stream - > backing_buffer - > count ) ; <nl> - * slice = gpr_slice_ref ( stream - > backing_buffer - > slices [ stream - > cursor ] ) ; <nl> + * slice = grpc_slice_ref ( stream - > backing_buffer - > slices [ stream - > cursor ] ) ; <nl> stream - > cursor + + ; <nl> return 1 ; <nl> } <nl> static void slice_buffer_stream_destroy ( grpc_exec_ctx * exec_ctx , <nl> grpc_byte_stream * byte_stream ) { } <nl> <nl> void grpc_slice_buffer_stream_init ( grpc_slice_buffer_stream * stream , <nl> - gpr_slice_buffer * slice_buffer , <nl> + grpc_slice_buffer * slice_buffer , <nl> uint32_t flags ) { <nl> GPR_ASSERT ( slice_buffer - > length < = UINT32_MAX ) ; <nl> stream - > base . length = ( uint32_t ) slice_buffer - > length ; <nl> mmm a / src / core / lib / transport / byte_stream . h <nl> ppp b / src / core / lib / transport / byte_stream . h <nl> struct grpc_byte_stream { <nl> uint32_t length ; <nl> uint32_t flags ; <nl> int ( * next ) ( grpc_exec_ctx * exec_ctx , grpc_byte_stream * byte_stream , <nl> - gpr_slice * slice , size_t max_size_hint , <nl> + grpc_slice * slice , size_t max_size_hint , <nl> grpc_closure * on_complete ) ; <nl> void ( * destroy ) ( grpc_exec_ctx * exec_ctx , grpc_byte_stream * byte_stream ) ; <nl> } ; <nl> struct grpc_byte_stream { <nl> * once a slice is returned into * slice , it is owned by the caller . <nl> * / <nl> int grpc_byte_stream_next ( grpc_exec_ctx * exec_ctx , <nl> - grpc_byte_stream * byte_stream , gpr_slice * slice , <nl> + grpc_byte_stream * byte_stream , grpc_slice * slice , <nl> size_t max_size_hint , grpc_closure * on_complete ) ; <nl> <nl> void grpc_byte_stream_destroy ( grpc_exec_ctx * exec_ctx , <nl> void grpc_byte_stream_destroy ( grpc_exec_ctx * exec_ctx , <nl> / * grpc_byte_stream that wraps a slice buffer * / <nl> typedef struct grpc_slice_buffer_stream { <nl> grpc_byte_stream base ; <nl> - gpr_slice_buffer * backing_buffer ; <nl> + grpc_slice_buffer * backing_buffer ; <nl> size_t cursor ; <nl> } grpc_slice_buffer_stream ; <nl> <nl> void grpc_slice_buffer_stream_init ( grpc_slice_buffer_stream * stream , <nl> - gpr_slice_buffer * slice_buffer , <nl> + grpc_slice_buffer * slice_buffer , <nl> uint32_t flags ) ; <nl> <nl> # endif / * GRPC_CORE_LIB_TRANSPORT_BYTE_STREAM_H * / <nl> mmm a / src / core / lib / transport / metadata . c <nl> ppp b / src / core / lib / transport / metadata . c <nl> <nl> # include " src / core / lib / support / string . h " <nl> # include " src / core / lib / transport / static_metadata . h " <nl> <nl> - gpr_slice ( * grpc_chttp2_base64_encode_and_huffman_compress ) ( gpr_slice input ) ; <nl> + grpc_slice ( * grpc_chttp2_base64_encode_and_huffman_compress ) ( grpc_slice input ) ; <nl> <nl> / * There are two kinds of mdelem and mdstr instances . <nl> * Static instances are declared in static_metadata . { h , c } and <nl> typedef void ( * destroy_user_data_func ) ( void * user_data ) ; <nl> / * Shadow structure for grpc_mdstr for non - static values * / <nl> typedef struct internal_string { <nl> / * must be byte compatible with grpc_mdstr * / <nl> - gpr_slice slice ; <nl> + grpc_slice slice ; <nl> uint32_t hash ; <nl> <nl> / * private only data * / <nl> gpr_atm refcnt ; <nl> <nl> uint8_t has_base64_and_huffman_encoded ; <nl> - gpr_slice_refcount refcount ; <nl> + grpc_slice_refcount refcount ; <nl> <nl> - gpr_slice base64_and_huffman ; <nl> + grpc_slice base64_and_huffman ; <nl> <nl> gpr_atm size_in_decoder_table ; <nl> <nl> void grpc_mdctx_global_init ( void ) { <nl> grpc_mdstr * elem = & grpc_static_mdstr_table [ i ] ; <nl> const char * str = grpc_static_metadata_strings [ i ] ; <nl> uint32_t hash = gpr_murmur_hash3 ( str , strlen ( str ) , g_hash_seed ) ; <nl> - * ( gpr_slice * ) & elem - > slice = gpr_slice_from_static_string ( str ) ; <nl> + * ( grpc_slice * ) & elem - > slice = grpc_slice_from_static_string ( str ) ; <nl> * ( uint32_t * ) & elem - > hash = hash ; <nl> for ( j = 0 ; ; j + + ) { <nl> size_t idx = ( hash + j ) % GPR_ARRAY_SIZE ( g_static_strtab ) ; <nl> static void internal_destroy_string ( strtab_shard * shard , internal_string * is ) { <nl> internal_string * cur ; <nl> GPR_TIMER_BEGIN ( " internal_destroy_string " , 0 ) ; <nl> if ( is - > has_base64_and_huffman_encoded ) { <nl> - gpr_slice_unref ( is - > base64_and_huffman ) ; <nl> + grpc_slice_unref ( is - > base64_and_huffman ) ; <nl> } <nl> for ( prev_next = & shard - > strs [ TABLE_IDX ( is - > hash , LOG2_STRTAB_SHARD_COUNT , <nl> shard - > capacity ) ] , <nl> grpc_mdstr * grpc_mdstr_from_string ( const char * str ) { <nl> return grpc_mdstr_from_buffer ( ( const uint8_t * ) str , strlen ( str ) ) ; <nl> } <nl> <nl> - grpc_mdstr * grpc_mdstr_from_slice ( gpr_slice slice ) { <nl> + grpc_mdstr * grpc_mdstr_from_slice ( grpc_slice slice ) { <nl> grpc_mdstr * result = grpc_mdstr_from_buffer ( GPR_SLICE_START_PTR ( slice ) , <nl> GPR_SLICE_LENGTH ( slice ) ) ; <nl> - gpr_slice_unref ( slice ) ; <nl> + grpc_slice_unref ( slice ) ; <nl> return result ; <nl> } <nl> <nl> grpc_mdelem * grpc_mdelem_from_strings ( const char * key , const char * value ) { <nl> grpc_mdstr_from_string ( value ) ) ; <nl> } <nl> <nl> - grpc_mdelem * grpc_mdelem_from_slices ( gpr_slice key , gpr_slice value ) { <nl> + grpc_mdelem * grpc_mdelem_from_slices ( grpc_slice key , grpc_slice value ) { <nl> return grpc_mdelem_from_metadata_strings ( grpc_mdstr_from_slice ( key ) , <nl> grpc_mdstr_from_slice ( value ) ) ; <nl> } <nl> void grpc_mdelem_set_user_data ( grpc_mdelem * md , void ( * destroy_func ) ( void * ) , <nl> gpr_mu_unlock ( & im - > mu_user_data ) ; <nl> } <nl> <nl> - gpr_slice grpc_mdstr_as_base64_encoded_and_huffman_compressed ( grpc_mdstr * gs ) { <nl> + grpc_slice grpc_mdstr_as_base64_encoded_and_huffman_compressed ( grpc_mdstr * gs ) { <nl> internal_string * s = ( internal_string * ) gs ; <nl> - gpr_slice slice ; <nl> + grpc_slice slice ; <nl> strtab_shard * shard = <nl> & g_strtab_shard [ SHARD_IDX ( s - > hash , LOG2_STRTAB_SHARD_COUNT ) ] ; <nl> gpr_mu_lock ( & shard - > mu ) ; <nl> mmm a / src / core / lib / transport / metadata . h <nl> ppp b / src / core / lib / transport / metadata . h <nl> typedef struct grpc_mdelem grpc_mdelem ; <nl> <nl> / * if changing this , make identical changes in internal_string in metadata . c * / <nl> struct grpc_mdstr { <nl> - const gpr_slice slice ; <nl> + const grpc_slice slice ; <nl> const uint32_t hash ; <nl> / * there is a private part to this in metadata . c * / <nl> } ; <nl> void grpc_test_only_set_metadata_hash_seed ( uint32_t seed ) ; <nl> clients may have handy * / <nl> grpc_mdstr * grpc_mdstr_from_string ( const char * str ) ; <nl> / * Unrefs the slice . * / <nl> - grpc_mdstr * grpc_mdstr_from_slice ( gpr_slice slice ) ; <nl> + grpc_mdstr * grpc_mdstr_from_slice ( grpc_slice slice ) ; <nl> grpc_mdstr * grpc_mdstr_from_buffer ( const uint8_t * str , size_t length ) ; <nl> <nl> / * Returns a borrowed slice from the mdstr with its contents base64 encoded <nl> and huffman compressed * / <nl> - gpr_slice grpc_mdstr_as_base64_encoded_and_huffman_compressed ( grpc_mdstr * str ) ; <nl> + grpc_slice grpc_mdstr_as_base64_encoded_and_huffman_compressed ( grpc_mdstr * str ) ; <nl> <nl> / * Constructors for grpc_mdelem instances ; take a variety of data types that <nl> clients may have handy * / <nl> grpc_mdelem * grpc_mdelem_from_metadata_strings ( grpc_mdstr * key , <nl> grpc_mdstr * value ) ; <nl> grpc_mdelem * grpc_mdelem_from_strings ( const char * key , const char * value ) ; <nl> / * Unrefs the slices . * / <nl> - grpc_mdelem * grpc_mdelem_from_slices ( gpr_slice key , gpr_slice value ) ; <nl> + grpc_mdelem * grpc_mdelem_from_slices ( grpc_slice key , grpc_slice value ) ; <nl> grpc_mdelem * grpc_mdelem_from_string_and_buffer ( const char * key , <nl> const uint8_t * value , <nl> size_t value_length ) ; <nl> void grpc_mdctx_global_init ( void ) ; <nl> void grpc_mdctx_global_shutdown ( void ) ; <nl> <nl> / * Implementation provided by chttp2_transport * / <nl> - extern gpr_slice ( * grpc_chttp2_base64_encode_and_huffman_compress ) ( <nl> - gpr_slice input ) ; <nl> + extern grpc_slice ( * grpc_chttp2_base64_encode_and_huffman_compress ) ( <nl> + grpc_slice input ) ; <nl> <nl> # ifdef __cplusplus <nl> } <nl> mmm a / src / core / lib / transport / transport . c <nl> ppp b / src / core / lib / transport / transport . c <nl> void grpc_transport_stream_op_add_cancellation ( grpc_transport_stream_op * op , <nl> <nl> void grpc_transport_stream_op_add_cancellation_with_message ( <nl> grpc_transport_stream_op * op , grpc_status_code status , <nl> - gpr_slice * optional_message ) { <nl> + grpc_slice * optional_message ) { <nl> GPR_ASSERT ( status ! = GRPC_STATUS_OK ) ; <nl> if ( op - > cancel_error ! = GRPC_ERROR_NONE ) { <nl> if ( optional_message ) { <nl> - gpr_slice_unref ( * optional_message ) ; <nl> + grpc_slice_unref ( * optional_message ) ; <nl> } <nl> return ; <nl> } <nl> void grpc_transport_stream_op_add_cancellation_with_message ( <nl> error = grpc_error_set_str ( GRPC_ERROR_CREATE ( msg ) , <nl> GRPC_ERROR_STR_GRPC_MESSAGE , msg ) ; <nl> gpr_free ( msg ) ; <nl> - gpr_slice_unref ( * optional_message ) ; <nl> + grpc_slice_unref ( * optional_message ) ; <nl> } else { <nl> error = GRPC_ERROR_CREATE ( " Call cancelled " ) ; <nl> } <nl> void grpc_transport_stream_op_add_cancellation_with_message ( <nl> <nl> void grpc_transport_stream_op_add_close ( grpc_transport_stream_op * op , <nl> grpc_status_code status , <nl> - gpr_slice * optional_message ) { <nl> + grpc_slice * optional_message ) { <nl> GPR_ASSERT ( status ! = GRPC_STATUS_OK ) ; <nl> if ( op - > cancel_error ! = GRPC_ERROR_NONE | | <nl> op - > close_error ! = GRPC_ERROR_NONE ) { <nl> if ( optional_message ) { <nl> - gpr_slice_unref ( * optional_message ) ; <nl> + grpc_slice_unref ( * optional_message ) ; <nl> } <nl> return ; <nl> } <nl> void grpc_transport_stream_op_add_close ( grpc_transport_stream_op * op , <nl> error = grpc_error_set_str ( GRPC_ERROR_CREATE ( msg ) , <nl> GRPC_ERROR_STR_GRPC_MESSAGE , msg ) ; <nl> gpr_free ( msg ) ; <nl> - gpr_slice_unref ( * optional_message ) ; <nl> + grpc_slice_unref ( * optional_message ) ; <nl> } else { <nl> error = GRPC_ERROR_CREATE ( " Call force closed " ) ; <nl> } <nl> mmm a / src / core / lib / transport / transport . h <nl> ppp b / src / core / lib / transport / transport . h <nl> typedef struct grpc_transport_op { <nl> bool send_goaway ; <nl> / * * what should the goaway contain ? * / <nl> grpc_status_code goaway_status ; <nl> - gpr_slice * goaway_message ; <nl> + grpc_slice * goaway_message ; <nl> / * * set the callback for accepting new streams ; <nl> this is a permanent callback , unlike the other one - shot closures . <nl> If true , the callback is set to set_accept_stream_fn , with its <nl> void grpc_transport_stream_op_add_cancellation ( grpc_transport_stream_op * op , <nl> <nl> void grpc_transport_stream_op_add_cancellation_with_message ( <nl> grpc_transport_stream_op * op , grpc_status_code status , <nl> - gpr_slice * optional_message ) ; <nl> + grpc_slice * optional_message ) ; <nl> <nl> void grpc_transport_stream_op_add_close ( grpc_transport_stream_op * op , <nl> grpc_status_code status , <nl> - gpr_slice * optional_message ) ; <nl> + grpc_slice * optional_message ) ; <nl> <nl> char * grpc_transport_stream_op_string ( grpc_transport_stream_op * op ) ; <nl> char * grpc_transport_op_string ( grpc_transport_op * op ) ; <nl> void grpc_transport_ping ( grpc_transport * transport , grpc_closure * cb ) ; <nl> <nl> / * Advise peer of pending connection termination . * / <nl> void grpc_transport_goaway ( grpc_transport * transport , grpc_status_code status , <nl> - gpr_slice debug_data ) ; <nl> + grpc_slice debug_data ) ; <nl> <nl> / * Close a transport . Aborts all open streams . * / <nl> void grpc_transport_close ( grpc_transport * transport ) ; <nl> mmm a / src / cpp / common / core_codegen . cc <nl> ppp b / src / cpp / common / core_codegen . cc <nl> void CoreCodegen : : grpc_byte_buffer_reader_destroy ( <nl> } <nl> <nl> int CoreCodegen : : grpc_byte_buffer_reader_next ( grpc_byte_buffer_reader * reader , <nl> - gpr_slice * slice ) { <nl> + grpc_slice * slice ) { <nl> return : : grpc_byte_buffer_reader_next ( reader , slice ) ; <nl> } <nl> <nl> - grpc_byte_buffer * CoreCodegen : : grpc_raw_byte_buffer_create ( gpr_slice * slice , <nl> + grpc_byte_buffer * CoreCodegen : : grpc_raw_byte_buffer_create ( grpc_slice * slice , <nl> size_t nslices ) { <nl> return : : grpc_raw_byte_buffer_create ( slice , nslices ) ; <nl> } <nl> <nl> - gpr_slice CoreCodegen : : gpr_slice_malloc ( size_t length ) { <nl> - return : : gpr_slice_malloc ( length ) ; <nl> + grpc_slice CoreCodegen : : grpc_slice_malloc ( size_t length ) { <nl> + return : : grpc_slice_malloc ( length ) ; <nl> } <nl> <nl> - void CoreCodegen : : gpr_slice_unref ( gpr_slice slice ) { : : gpr_slice_unref ( slice ) ; } <nl> + void CoreCodegen : : grpc_slice_unref ( grpc_slice slice ) { : : grpc_slice_unref ( slice ) ; } <nl> <nl> - gpr_slice CoreCodegen : : gpr_slice_split_tail ( gpr_slice * s , size_t split ) { <nl> - return : : gpr_slice_split_tail ( s , split ) ; <nl> + grpc_slice CoreCodegen : : grpc_slice_split_tail ( grpc_slice * s , size_t split ) { <nl> + return : : grpc_slice_split_tail ( s , split ) ; <nl> } <nl> <nl> - void CoreCodegen : : gpr_slice_buffer_add ( gpr_slice_buffer * sb , gpr_slice slice ) { <nl> - : : gpr_slice_buffer_add ( sb , slice ) ; <nl> + void CoreCodegen : : grpc_slice_buffer_add ( grpc_slice_buffer * sb , grpc_slice slice ) { <nl> + : : grpc_slice_buffer_add ( sb , slice ) ; <nl> } <nl> <nl> - void CoreCodegen : : gpr_slice_buffer_pop ( gpr_slice_buffer * sb ) { <nl> - : : gpr_slice_buffer_pop ( sb ) ; <nl> + void CoreCodegen : : grpc_slice_buffer_pop ( grpc_slice_buffer * sb ) { <nl> + : : grpc_slice_buffer_pop ( sb ) ; <nl> } <nl> <nl> void CoreCodegen : : grpc_metadata_array_init ( grpc_metadata_array * array ) { <nl> mmm a / src / cpp / util / byte_buffer_cc . cc <nl> ppp b / src / cpp / util / byte_buffer_cc . cc <nl> namespace grpc { <nl> <nl> ByteBuffer : : ByteBuffer ( const Slice * slices , size_t nslices ) { <nl> / / The following assertions check that the representation of a grpc : : Slice is <nl> - / / identical to that of a gpr_slice : it has a gpr_slice field , and nothing <nl> + / / identical to that of a grpc_slice : it has a grpc_slice field , and nothing <nl> / / else . <nl> - static_assert ( std : : is_same < decltype ( slices [ 0 ] . slice_ ) , gpr_slice > : : value , <nl> - " Slice must have same representation as gpr_slice " ) ; <nl> - static_assert ( sizeof ( Slice ) = = sizeof ( gpr_slice ) , <nl> - " Slice must have same representation as gpr_slice " ) ; <nl> + static_assert ( std : : is_same < decltype ( slices [ 0 ] . slice_ ) , grpc_slice > : : value , <nl> + " Slice must have same representation as grpc_slice " ) ; <nl> + static_assert ( sizeof ( Slice ) = = sizeof ( grpc_slice ) , <nl> + " Slice must have same representation as grpc_slice " ) ; <nl> / / The const_cast is legal if grpc_raw_byte_buffer_create ( ) does no more <nl> / / than its advertised side effect of increasing the reference count of the <nl> / / slices it processes , and such an increase does not affect the semantics <nl> / / seen by the caller of this constructor . <nl> buffer_ = grpc_raw_byte_buffer_create ( <nl> - reinterpret_cast < gpr_slice * > ( const_cast < Slice * > ( slices ) ) , nslices ) ; <nl> + reinterpret_cast < grpc_slice * > ( const_cast < Slice * > ( slices ) ) , nslices ) ; <nl> } <nl> <nl> ByteBuffer : : ~ ByteBuffer ( ) { <nl> Status ByteBuffer : : Dump ( std : : vector < Slice > * slices ) const { <nl> return Status ( StatusCode : : INTERNAL , <nl> " Couldn ' t initialize byte buffer reader " ) ; <nl> } <nl> - gpr_slice s ; <nl> + grpc_slice s ; <nl> while ( grpc_byte_buffer_reader_next ( & reader , & s ) ) { <nl> slices - > push_back ( Slice ( s , Slice : : STEAL_REF ) ) ; <nl> } <nl> mmm a / src / cpp / util / slice_cc . cc <nl> ppp b / src / cpp / util / slice_cc . cc <nl> namespace grpc { <nl> <nl> Slice : : Slice ( ) : slice_ ( gpr_empty_slice ( ) ) { } <nl> <nl> - Slice : : ~ Slice ( ) { gpr_slice_unref ( slice_ ) ; } <nl> + Slice : : ~ Slice ( ) { grpc_slice_unref ( slice_ ) ; } <nl> <nl> - Slice : : Slice ( gpr_slice slice , AddRef ) : slice_ ( gpr_slice_ref ( slice ) ) { } <nl> + Slice : : Slice ( grpc_slice slice , AddRef ) : slice_ ( grpc_slice_ref ( slice ) ) { } <nl> <nl> - Slice : : Slice ( gpr_slice slice , StealRef ) : slice_ ( slice ) { } <nl> + Slice : : Slice ( grpc_slice slice , StealRef ) : slice_ ( slice ) { } <nl> <nl> - Slice : : Slice ( const Slice & other ) : slice_ ( gpr_slice_ref ( other . slice_ ) ) { } <nl> + Slice : : Slice ( const Slice & other ) : slice_ ( grpc_slice_ref ( other . slice_ ) ) { } <nl> <nl> } / / namespace grpc <nl> mmm a / src / csharp / ext / grpc_csharp_ext . c <nl> ppp b / src / csharp / ext / grpc_csharp_ext . c <nl> <nl> # endif <nl> <nl> grpc_byte_buffer * string_to_byte_buffer ( const char * buffer , size_t len ) { <nl> - gpr_slice slice = gpr_slice_from_copied_buffer ( buffer , len ) ; <nl> + grpc_slice slice = grpc_slice_from_copied_buffer ( buffer , len ) ; <nl> grpc_byte_buffer * bb = grpc_raw_byte_buffer_create ( & slice , 1 ) ; <nl> - gpr_slice_unref ( slice ) ; <nl> + grpc_slice_unref ( slice ) ; <nl> return bb ; <nl> } <nl> <nl> GPR_EXPORT intptr_t GPR_CALLTYPE grpcsharp_batch_context_recv_message_length ( <nl> GPR_EXPORT void GPR_CALLTYPE grpcsharp_batch_context_recv_message_to_buffer ( <nl> const grpcsharp_batch_context * ctx , char * buffer , size_t buffer_len ) { <nl> grpc_byte_buffer_reader reader ; <nl> - gpr_slice slice ; <nl> + grpc_slice slice ; <nl> size_t offset = 0 ; <nl> <nl> GPR_ASSERT ( grpc_byte_buffer_reader_init ( & reader , ctx - > recv_message ) ) ; <nl> GPR_EXPORT void GPR_CALLTYPE grpcsharp_batch_context_recv_message_to_buffer ( <nl> memcpy ( buffer + offset , GPR_SLICE_START_PTR ( slice ) , <nl> GPR_SLICE_LENGTH ( slice ) ) ; <nl> offset + = len ; <nl> - gpr_slice_unref ( slice ) ; <nl> + grpc_slice_unref ( slice ) ; <nl> } <nl> <nl> grpc_byte_buffer_reader_destroy ( & reader ) ; <nl> mmm a / src / node / ext / byte_buffer . cc <nl> ppp b / src / node / ext / byte_buffer . cc <nl> grpc_byte_buffer * BufferToByteBuffer ( Local < Value > buffer ) { <nl> Nan : : HandleScope scope ; <nl> int length = : : node : : Buffer : : Length ( buffer ) ; <nl> char * data = : : node : : Buffer : : Data ( buffer ) ; <nl> - gpr_slice slice = gpr_slice_malloc ( length ) ; <nl> + grpc_slice slice = grpc_slice_malloc ( length ) ; <nl> memcpy ( GPR_SLICE_START_PTR ( slice ) , data , length ) ; <nl> grpc_byte_buffer * byte_buffer ( grpc_raw_byte_buffer_create ( & slice , 1 ) ) ; <nl> - gpr_slice_unref ( slice ) ; <nl> + grpc_slice_unref ( slice ) ; <nl> return byte_buffer ; <nl> } <nl> <nl> Local < Value > ByteBufferToBuffer ( grpc_byte_buffer * buffer ) { <nl> Nan : : ThrowError ( " Error initializing byte buffer reader . " ) ; <nl> return scope . Escape ( Nan : : Undefined ( ) ) ; <nl> } <nl> - gpr_slice slice = grpc_byte_buffer_reader_readall ( & reader ) ; <nl> + grpc_slice slice = grpc_byte_buffer_reader_readall ( & reader ) ; <nl> size_t length = GPR_SLICE_LENGTH ( slice ) ; <nl> char * result = new char [ length ] ; <nl> memcpy ( result , GPR_SLICE_START_PTR ( slice ) , length ) ; <nl> - gpr_slice_unref ( slice ) ; <nl> + grpc_slice_unref ( slice ) ; <nl> return scope . Escape ( MakeFastBuffer ( <nl> Nan : : NewBuffer ( result , length , delete_buffer , NULL ) . ToLocalChecked ( ) ) ) ; <nl> } <nl> mmm a / src / objective - c / GRPCClient / private / NSData + GRPC . m <nl> ppp b / src / objective - c / GRPCClient / private / NSData + GRPC . m <nl> static void MallocAndCopyByteBufferToCharArray ( grpc_byte_buffer * buffer , <nl> } <nl> / / The slice contains uncompressed data even if compressed data was received <nl> / / because the reader takes care of automatically decompressing it <nl> - gpr_slice slice = grpc_byte_buffer_reader_readall ( & reader ) ; <nl> + grpc_slice slice = grpc_byte_buffer_reader_readall ( & reader ) ; <nl> size_t uncompressed_length = GPR_SLICE_LENGTH ( slice ) ; <nl> char * result = malloc ( uncompressed_length ) ; <nl> if ( result ) { <nl> memcpy ( result , GPR_SLICE_START_PTR ( slice ) , uncompressed_length ) ; <nl> } <nl> - gpr_slice_unref ( slice ) ; <nl> + grpc_slice_unref ( slice ) ; <nl> * array = result ; <nl> * length = uncompressed_length ; <nl> } <nl> <nl> static grpc_byte_buffer * CopyCharArrayToNewByteBuffer ( const char * array , <nl> size_t length ) { <nl> - gpr_slice slice = gpr_slice_from_copied_buffer ( array , length ) ; <nl> + grpc_slice slice = grpc_slice_from_copied_buffer ( array , length ) ; <nl> grpc_byte_buffer * buffer = grpc_raw_byte_buffer_create ( & slice , 1 ) ; <nl> - gpr_slice_unref ( slice ) ; <nl> + grpc_slice_unref ( slice ) ; <nl> return buffer ; <nl> } <nl> <nl> - ( grpc_byte_buffer * ) grpc_byteBuffer { <nl> / / appending of byte arrays by not using internally a single contiguous memory <nl> / / block for representation . <nl> / / The following implementation is thus not optimal , sometimes requiring two <nl> - / / copies ( one by self . bytes and another by gpr_slice_from_copied_buffer ) . <nl> + / / copies ( one by self . bytes and another by grpc_slice_from_copied_buffer ) . <nl> / / If it turns out to be an issue , we can use enumerateByteRangesUsingblock : <nl> - / / to create an array of gpr_slice objects to pass to <nl> + / / to create an array of grpc_slice objects to pass to <nl> / / grpc_raw_byte_buffer_create . <nl> / / That would make it do exactly one copy , always . <nl> return CopyCharArrayToNewByteBuffer ( ( const char * ) self . bytes , <nl> mmm a / src / php / ext / grpc / byte_buffer . c <nl> ppp b / src / php / ext / grpc / byte_buffer . c <nl> <nl> # include < grpc / support / slice . h > <nl> <nl> grpc_byte_buffer * string_to_byte_buffer ( char * string , size_t length ) { <nl> - gpr_slice slice = gpr_slice_from_copied_buffer ( string , length ) ; <nl> + grpc_slice slice = grpc_slice_from_copied_buffer ( string , length ) ; <nl> grpc_byte_buffer * buffer = grpc_raw_byte_buffer_create ( & slice , 1 ) ; <nl> - gpr_slice_unref ( slice ) ; <nl> + grpc_slice_unref ( slice ) ; <nl> return buffer ; <nl> } <nl> <nl> void byte_buffer_to_string ( grpc_byte_buffer * buffer , char * * out_string , <nl> return ; <nl> } <nl> <nl> - gpr_slice slice = grpc_byte_buffer_reader_readall ( & reader ) ; <nl> + grpc_slice slice = grpc_byte_buffer_reader_readall ( & reader ) ; <nl> size_t length = GPR_SLICE_LENGTH ( slice ) ; <nl> char * string = ecalloc ( length + 1 , sizeof ( char ) ) ; <nl> memcpy ( string , GPR_SLICE_START_PTR ( slice ) , length ) ; <nl> - gpr_slice_unref ( slice ) ; <nl> + grpc_slice_unref ( slice ) ; <nl> <nl> * out_string = string ; <nl> * out_length = length ; <nl> mmm a / src / python / grpcio / grpc / _cython / _cygrpc / grpc . pxi <nl> ppp b / src / python / grpcio / grpc / _cython / _cygrpc / grpc . pxi <nl> cdef extern from " grpc / byte_buffer_reader . h " : <nl> <nl> cdef extern from " grpc / grpc . h " : <nl> <nl> - ctypedef struct gpr_slice : <nl> - # don ' t worry about writing out the members of gpr_slice ; we never access <nl> + ctypedef struct grpc_slice : <nl> + # don ' t worry about writing out the members of grpc_slice ; we never access <nl> # them directly . <nl> pass <nl> <nl> - gpr_slice gpr_slice_ref ( gpr_slice s ) nogil <nl> - void gpr_slice_unref ( gpr_slice s ) nogil <nl> - gpr_slice gpr_slice_new ( void * p , size_t len , void ( * destroy ) ( void * ) ) nogil <nl> - gpr_slice gpr_slice_new_with_len ( <nl> + grpc_slice grpc_slice_ref ( grpc_slice s ) nogil <nl> + void grpc_slice_unref ( grpc_slice s ) nogil <nl> + grpc_slice grpc_slice_new ( void * p , size_t len , void ( * destroy ) ( void * ) ) nogil <nl> + grpc_slice grpc_slice_new_with_len ( <nl> void * p , size_t len , void ( * destroy ) ( void * , size_t ) ) nogil <nl> - gpr_slice gpr_slice_malloc ( size_t length ) nogil <nl> - gpr_slice gpr_slice_from_copied_string ( const char * source ) nogil <nl> - gpr_slice gpr_slice_from_copied_buffer ( const char * source , size_t len ) nogil <nl> + grpc_slice grpc_slice_malloc ( size_t length ) nogil <nl> + grpc_slice grpc_slice_from_copied_string ( const char * source ) nogil <nl> + grpc_slice grpc_slice_from_copied_buffer ( const char * source , size_t len ) nogil <nl> <nl> # Declare functions for function - like macros ( because Cython ) . . . <nl> - void * gpr_slice_start_ptr " GPR_SLICE_START_PTR " ( gpr_slice s ) nogil <nl> - size_t gpr_slice_length " GPR_SLICE_LENGTH " ( gpr_slice s ) nogil <nl> + void * grpc_slice_start_ptr " GPR_SLICE_START_PTR " ( grpc_slice s ) nogil <nl> + size_t grpc_slice_length " GPR_SLICE_LENGTH " ( grpc_slice s ) nogil <nl> <nl> ctypedef enum gpr_clock_type : <nl> GPR_CLOCK_MONOTONIC <nl> cdef extern from " grpc / grpc . h " : <nl> # We don ' t care about the internals . <nl> pass <nl> <nl> - grpc_byte_buffer * grpc_raw_byte_buffer_create ( gpr_slice * slices , <nl> + grpc_byte_buffer * grpc_raw_byte_buffer_create ( grpc_slice * slices , <nl> size_t nslices ) nogil <nl> size_t grpc_byte_buffer_length ( grpc_byte_buffer * bb ) nogil <nl> void grpc_byte_buffer_destroy ( grpc_byte_buffer * byte_buffer ) nogil <nl> cdef extern from " grpc / grpc . h " : <nl> int grpc_byte_buffer_reader_init ( grpc_byte_buffer_reader * reader , <nl> grpc_byte_buffer * buffer ) nogil <nl> int grpc_byte_buffer_reader_next ( grpc_byte_buffer_reader * reader , <nl> - gpr_slice * slice ) nogil <nl> + grpc_slice * slice ) nogil <nl> void grpc_byte_buffer_reader_destroy ( grpc_byte_buffer_reader * reader ) nogil <nl> <nl> ctypedef enum grpc_status_code : <nl> mmm a / src / python / grpcio / grpc / _cython / _cygrpc / records . pyx . pxi <nl> ppp b / src / python / grpcio / grpc / _cython / _cygrpc / records . pyx . pxi <nl> cdef class ByteBuffer : <nl> return <nl> <nl> cdef char * c_data = data <nl> - cdef gpr_slice data_slice <nl> + cdef grpc_slice data_slice <nl> cdef size_t data_length = len ( data ) <nl> with nogil : <nl> - data_slice = gpr_slice_from_copied_buffer ( c_data , data_length ) <nl> + data_slice = grpc_slice_from_copied_buffer ( c_data , data_length ) <nl> with nogil : <nl> self . c_byte_buffer = grpc_raw_byte_buffer_create ( <nl> & data_slice , 1 ) <nl> with nogil : <nl> - gpr_slice_unref ( data_slice ) <nl> + grpc_slice_unref ( data_slice ) <nl> <nl> def bytes ( self ) : <nl> cdef grpc_byte_buffer_reader reader <nl> - cdef gpr_slice data_slice <nl> + cdef grpc_slice data_slice <nl> cdef size_t data_slice_length <nl> cdef void * data_slice_pointer <nl> cdef bint reader_status <nl> cdef class ByteBuffer : <nl> result = bytearray ( ) <nl> with nogil : <nl> while grpc_byte_buffer_reader_next ( & reader , & data_slice ) : <nl> - data_slice_pointer = gpr_slice_start_ptr ( data_slice ) <nl> - data_slice_length = gpr_slice_length ( data_slice ) <nl> + data_slice_pointer = grpc_slice_start_ptr ( data_slice ) <nl> + data_slice_length = grpc_slice_length ( data_slice ) <nl> with gil : <nl> result + = ( < char * > data_slice_pointer ) [ : data_slice_length ] <nl> - gpr_slice_unref ( data_slice ) <nl> + grpc_slice_unref ( data_slice ) <nl> with nogil : <nl> grpc_byte_buffer_reader_destroy ( & reader ) <nl> return bytes ( result ) <nl> mmm a / src / ruby / ext / grpc / rb_byte_buffer . c <nl> ppp b / src / ruby / ext / grpc / rb_byte_buffer . c <nl> <nl> # include " rb_grpc . h " <nl> <nl> grpc_byte_buffer * grpc_rb_s_to_byte_buffer ( char * string , size_t length ) { <nl> - gpr_slice slice = gpr_slice_from_copied_buffer ( string , length ) ; <nl> + grpc_slice slice = grpc_slice_from_copied_buffer ( string , length ) ; <nl> grpc_byte_buffer * buffer = grpc_raw_byte_buffer_create ( & slice , 1 ) ; <nl> - gpr_slice_unref ( slice ) ; <nl> + grpc_slice_unref ( slice ) ; <nl> return buffer ; <nl> } <nl> <nl> VALUE grpc_rb_byte_buffer_to_s ( grpc_byte_buffer * buffer ) { <nl> VALUE rb_string ; <nl> grpc_byte_buffer_reader reader ; <nl> - gpr_slice next ; <nl> + grpc_slice next ; <nl> if ( buffer = = NULL ) { <nl> return Qnil ; <nl> } <nl> VALUE grpc_rb_byte_buffer_to_s ( grpc_byte_buffer * buffer ) { <nl> while ( grpc_byte_buffer_reader_next ( & reader , & next ) ! = 0 ) { <nl> rb_str_cat ( rb_string , ( const char * ) GPR_SLICE_START_PTR ( next ) , <nl> GPR_SLICE_LENGTH ( next ) ) ; <nl> - gpr_slice_unref ( next ) ; <nl> + grpc_slice_unref ( next ) ; <nl> } <nl> return rb_string ; <nl> } <nl> mmm a / src / ruby / ext / grpc / rb_grpc_imports . generated . c <nl> ppp b / src / ruby / ext / grpc / rb_grpc_imports . generated . c <nl> gpr_set_log_verbosity_type gpr_set_log_verbosity_import ; <nl> gpr_log_verbosity_init_type gpr_log_verbosity_init_import ; <nl> gpr_set_log_function_type gpr_set_log_function_import ; <nl> gpr_format_message_type gpr_format_message_import ; <nl> - gpr_slice_ref_type gpr_slice_ref_import ; <nl> - gpr_slice_unref_type gpr_slice_unref_import ; <nl> - gpr_slice_new_type gpr_slice_new_import ; <nl> - gpr_slice_new_with_user_data_type gpr_slice_new_with_user_data_import ; <nl> - gpr_slice_new_with_len_type gpr_slice_new_with_len_import ; <nl> - gpr_slice_malloc_type gpr_slice_malloc_import ; <nl> - gpr_slice_from_copied_string_type gpr_slice_from_copied_string_import ; <nl> - gpr_slice_from_copied_buffer_type gpr_slice_from_copied_buffer_import ; <nl> - gpr_slice_from_static_string_type gpr_slice_from_static_string_import ; <nl> - gpr_slice_sub_type gpr_slice_sub_import ; <nl> - gpr_slice_sub_no_ref_type gpr_slice_sub_no_ref_import ; <nl> - gpr_slice_split_tail_type gpr_slice_split_tail_import ; <nl> - gpr_slice_split_head_type gpr_slice_split_head_import ; <nl> + grpc_slice_ref_type grpc_slice_ref_import ; <nl> + grpc_slice_unref_type grpc_slice_unref_import ; <nl> + grpc_slice_new_type grpc_slice_new_import ; <nl> + grpc_slice_new_with_user_data_type grpc_slice_new_with_user_data_import ; <nl> + grpc_slice_new_with_len_type grpc_slice_new_with_len_import ; <nl> + grpc_slice_malloc_type grpc_slice_malloc_import ; <nl> + grpc_slice_from_copied_string_type grpc_slice_from_copied_string_import ; <nl> + grpc_slice_from_copied_buffer_type grpc_slice_from_copied_buffer_import ; <nl> + grpc_slice_from_static_string_type grpc_slice_from_static_string_import ; <nl> + grpc_slice_sub_type grpc_slice_sub_import ; <nl> + grpc_slice_sub_no_ref_type grpc_slice_sub_no_ref_import ; <nl> + grpc_slice_split_tail_type grpc_slice_split_tail_import ; <nl> + grpc_slice_split_head_type grpc_slice_split_head_import ; <nl> gpr_empty_slice_type gpr_empty_slice_import ; <nl> - gpr_slice_cmp_type gpr_slice_cmp_import ; <nl> - gpr_slice_str_cmp_type gpr_slice_str_cmp_import ; <nl> - gpr_slice_buffer_init_type gpr_slice_buffer_init_import ; <nl> - gpr_slice_buffer_destroy_type gpr_slice_buffer_destroy_import ; <nl> - gpr_slice_buffer_add_type gpr_slice_buffer_add_import ; <nl> - gpr_slice_buffer_add_indexed_type gpr_slice_buffer_add_indexed_import ; <nl> - gpr_slice_buffer_addn_type gpr_slice_buffer_addn_import ; <nl> - gpr_slice_buffer_tiny_add_type gpr_slice_buffer_tiny_add_import ; <nl> - gpr_slice_buffer_pop_type gpr_slice_buffer_pop_import ; <nl> - gpr_slice_buffer_reset_and_unref_type gpr_slice_buffer_reset_and_unref_import ; <nl> - gpr_slice_buffer_swap_type gpr_slice_buffer_swap_import ; <nl> - gpr_slice_buffer_move_into_type gpr_slice_buffer_move_into_import ; <nl> - gpr_slice_buffer_trim_end_type gpr_slice_buffer_trim_end_import ; <nl> - gpr_slice_buffer_move_first_type gpr_slice_buffer_move_first_import ; <nl> - gpr_slice_buffer_take_first_type gpr_slice_buffer_take_first_import ; <nl> + grpc_slice_cmp_type grpc_slice_cmp_import ; <nl> + grpc_slice_str_cmp_type grpc_slice_str_cmp_import ; <nl> + grpc_slice_buffer_init_type grpc_slice_buffer_init_import ; <nl> + grpc_slice_buffer_destroy_type grpc_slice_buffer_destroy_import ; <nl> + grpc_slice_buffer_add_type grpc_slice_buffer_add_import ; <nl> + grpc_slice_buffer_add_indexed_type grpc_slice_buffer_add_indexed_import ; <nl> + grpc_slice_buffer_addn_type grpc_slice_buffer_addn_import ; <nl> + grpc_slice_buffer_tiny_add_type grpc_slice_buffer_tiny_add_import ; <nl> + grpc_slice_buffer_pop_type grpc_slice_buffer_pop_import ; <nl> + grpc_slice_buffer_reset_and_unref_type grpc_slice_buffer_reset_and_unref_import ; <nl> + grpc_slice_buffer_swap_type grpc_slice_buffer_swap_import ; <nl> + grpc_slice_buffer_move_into_type grpc_slice_buffer_move_into_import ; <nl> + grpc_slice_buffer_trim_end_type grpc_slice_buffer_trim_end_import ; <nl> + grpc_slice_buffer_move_first_type grpc_slice_buffer_move_first_import ; <nl> + grpc_slice_buffer_take_first_type grpc_slice_buffer_take_first_import ; <nl> gpr_strdup_type gpr_strdup_import ; <nl> gpr_asprintf_type gpr_asprintf_import ; <nl> gpr_subprocess_binary_extension_type gpr_subprocess_binary_extension_import ; <nl> void grpc_rb_load_imports ( HMODULE library ) { <nl> gpr_log_verbosity_init_import = ( gpr_log_verbosity_init_type ) GetProcAddress ( library , " gpr_log_verbosity_init " ) ; <nl> gpr_set_log_function_import = ( gpr_set_log_function_type ) GetProcAddress ( library , " gpr_set_log_function " ) ; <nl> gpr_format_message_import = ( gpr_format_message_type ) GetProcAddress ( library , " gpr_format_message " ) ; <nl> - gpr_slice_ref_import = ( gpr_slice_ref_type ) GetProcAddress ( library , " gpr_slice_ref " ) ; <nl> - gpr_slice_unref_import = ( gpr_slice_unref_type ) GetProcAddress ( library , " gpr_slice_unref " ) ; <nl> - gpr_slice_new_import = ( gpr_slice_new_type ) GetProcAddress ( library , " gpr_slice_new " ) ; <nl> - gpr_slice_new_with_user_data_import = ( gpr_slice_new_with_user_data_type ) GetProcAddress ( library , " gpr_slice_new_with_user_data " ) ; <nl> - gpr_slice_new_with_len_import = ( gpr_slice_new_with_len_type ) GetProcAddress ( library , " gpr_slice_new_with_len " ) ; <nl> - gpr_slice_malloc_import = ( gpr_slice_malloc_type ) GetProcAddress ( library , " gpr_slice_malloc " ) ; <nl> - gpr_slice_from_copied_string_import = ( gpr_slice_from_copied_string_type ) GetProcAddress ( library , " gpr_slice_from_copied_string " ) ; <nl> - gpr_slice_from_copied_buffer_import = ( gpr_slice_from_copied_buffer_type ) GetProcAddress ( library , " gpr_slice_from_copied_buffer " ) ; <nl> - gpr_slice_from_static_string_import = ( gpr_slice_from_static_string_type ) GetProcAddress ( library , " gpr_slice_from_static_string " ) ; <nl> - gpr_slice_sub_import = ( gpr_slice_sub_type ) GetProcAddress ( library , " gpr_slice_sub " ) ; <nl> - gpr_slice_sub_no_ref_import = ( gpr_slice_sub_no_ref_type ) GetProcAddress ( library , " gpr_slice_sub_no_ref " ) ; <nl> - gpr_slice_split_tail_import = ( gpr_slice_split_tail_type ) GetProcAddress ( library , " gpr_slice_split_tail " ) ; <nl> - gpr_slice_split_head_import = ( gpr_slice_split_head_type ) GetProcAddress ( library , " gpr_slice_split_head " ) ; <nl> + grpc_slice_ref_import = ( grpc_slice_ref_type ) GetProcAddress ( library , " grpc_slice_ref " ) ; <nl> + grpc_slice_unref_import = ( grpc_slice_unref_type ) GetProcAddress ( library , " grpc_slice_unref " ) ; <nl> + grpc_slice_new_import = ( grpc_slice_new_type ) GetProcAddress ( library , " grpc_slice_new " ) ; <nl> + grpc_slice_new_with_user_data_import = ( grpc_slice_new_with_user_data_type ) GetProcAddress ( library , " grpc_slice_new_with_user_data " ) ; <nl> + grpc_slice_new_with_len_import = ( grpc_slice_new_with_len_type ) GetProcAddress ( library , " grpc_slice_new_with_len " ) ; <nl> + grpc_slice_malloc_import = ( grpc_slice_malloc_type ) GetProcAddress ( library , " grpc_slice_malloc " ) ; <nl> + grpc_slice_from_copied_string_import = ( grpc_slice_from_copied_string_type ) GetProcAddress ( library , " grpc_slice_from_copied_string " ) ; <nl> + grpc_slice_from_copied_buffer_import = ( grpc_slice_from_copied_buffer_type ) GetProcAddress ( library , " grpc_slice_from_copied_buffer " ) ; <nl> + grpc_slice_from_static_string_import = ( grpc_slice_from_static_string_type ) GetProcAddress ( library , " grpc_slice_from_static_string " ) ; <nl> + grpc_slice_sub_import = ( grpc_slice_sub_type ) GetProcAddress ( library , " grpc_slice_sub " ) ; <nl> + grpc_slice_sub_no_ref_import = ( grpc_slice_sub_no_ref_type ) GetProcAddress ( library , " grpc_slice_sub_no_ref " ) ; <nl> + grpc_slice_split_tail_import = ( grpc_slice_split_tail_type ) GetProcAddress ( library , " grpc_slice_split_tail " ) ; <nl> + grpc_slice_split_head_import = ( grpc_slice_split_head_type ) GetProcAddress ( library , " grpc_slice_split_head " ) ; <nl> gpr_empty_slice_import = ( gpr_empty_slice_type ) GetProcAddress ( library , " gpr_empty_slice " ) ; <nl> - gpr_slice_cmp_import = ( gpr_slice_cmp_type ) GetProcAddress ( library , " gpr_slice_cmp " ) ; <nl> - gpr_slice_str_cmp_import = ( gpr_slice_str_cmp_type ) GetProcAddress ( library , " gpr_slice_str_cmp " ) ; <nl> - gpr_slice_buffer_init_import = ( gpr_slice_buffer_init_type ) GetProcAddress ( library , " gpr_slice_buffer_init " ) ; <nl> - gpr_slice_buffer_destroy_import = ( gpr_slice_buffer_destroy_type ) GetProcAddress ( library , " gpr_slice_buffer_destroy " ) ; <nl> - gpr_slice_buffer_add_import = ( gpr_slice_buffer_add_type ) GetProcAddress ( library , " gpr_slice_buffer_add " ) ; <nl> - gpr_slice_buffer_add_indexed_import = ( gpr_slice_buffer_add_indexed_type ) GetProcAddress ( library , " gpr_slice_buffer_add_indexed " ) ; <nl> - gpr_slice_buffer_addn_import = ( gpr_slice_buffer_addn_type ) GetProcAddress ( library , " gpr_slice_buffer_addn " ) ; <nl> - gpr_slice_buffer_tiny_add_import = ( gpr_slice_buffer_tiny_add_type ) GetProcAddress ( library , " gpr_slice_buffer_tiny_add " ) ; <nl> - gpr_slice_buffer_pop_import = ( gpr_slice_buffer_pop_type ) GetProcAddress ( library , " gpr_slice_buffer_pop " ) ; <nl> - gpr_slice_buffer_reset_and_unref_import = ( gpr_slice_buffer_reset_and_unref_type ) GetProcAddress ( library , " gpr_slice_buffer_reset_and_unref " ) ; <nl> - gpr_slice_buffer_swap_import = ( gpr_slice_buffer_swap_type ) GetProcAddress ( library , " gpr_slice_buffer_swap " ) ; <nl> - gpr_slice_buffer_move_into_import = ( gpr_slice_buffer_move_into_type ) GetProcAddress ( library , " gpr_slice_buffer_move_into " ) ; <nl> - gpr_slice_buffer_trim_end_import = ( gpr_slice_buffer_trim_end_type ) GetProcAddress ( library , " gpr_slice_buffer_trim_end " ) ; <nl> - gpr_slice_buffer_move_first_import = ( gpr_slice_buffer_move_first_type ) GetProcAddress ( library , " gpr_slice_buffer_move_first " ) ; <nl> - gpr_slice_buffer_take_first_import = ( gpr_slice_buffer_take_first_type ) GetProcAddress ( library , " gpr_slice_buffer_take_first " ) ; <nl> + grpc_slice_cmp_import = ( grpc_slice_cmp_type ) GetProcAddress ( library , " grpc_slice_cmp " ) ; <nl> + grpc_slice_str_cmp_import = ( grpc_slice_str_cmp_type ) GetProcAddress ( library , " grpc_slice_str_cmp " ) ; <nl> + grpc_slice_buffer_init_import = ( grpc_slice_buffer_init_type ) GetProcAddress ( library , " grpc_slice_buffer_init " ) ; <nl> + grpc_slice_buffer_destroy_import = ( grpc_slice_buffer_destroy_type ) GetProcAddress ( library , " grpc_slice_buffer_destroy " ) ; <nl> + grpc_slice_buffer_add_import = ( grpc_slice_buffer_add_type ) GetProcAddress ( library , " grpc_slice_buffer_add " ) ; <nl> + grpc_slice_buffer_add_indexed_import = ( grpc_slice_buffer_add_indexed_type ) GetProcAddress ( library , " grpc_slice_buffer_add_indexed " ) ; <nl> + grpc_slice_buffer_addn_import = ( grpc_slice_buffer_addn_type ) GetProcAddress ( library , " grpc_slice_buffer_addn " ) ; <nl> + grpc_slice_buffer_tiny_add_import = ( grpc_slice_buffer_tiny_add_type ) GetProcAddress ( library , " grpc_slice_buffer_tiny_add " ) ; <nl> + grpc_slice_buffer_pop_import = ( grpc_slice_buffer_pop_type ) GetProcAddress ( library , " grpc_slice_buffer_pop " ) ; <nl> + grpc_slice_buffer_reset_and_unref_import = ( grpc_slice_buffer_reset_and_unref_type ) GetProcAddress ( library , " grpc_slice_buffer_reset_and_unref " ) ; <nl> + grpc_slice_buffer_swap_import = ( grpc_slice_buffer_swap_type ) GetProcAddress ( library , " grpc_slice_buffer_swap " ) ; <nl> + grpc_slice_buffer_move_into_import = ( grpc_slice_buffer_move_into_type ) GetProcAddress ( library , " grpc_slice_buffer_move_into " ) ; <nl> + grpc_slice_buffer_trim_end_import = ( grpc_slice_buffer_trim_end_type ) GetProcAddress ( library , " grpc_slice_buffer_trim_end " ) ; <nl> + grpc_slice_buffer_move_first_import = ( grpc_slice_buffer_move_first_type ) GetProcAddress ( library , " grpc_slice_buffer_move_first " ) ; <nl> + grpc_slice_buffer_take_first_import = ( grpc_slice_buffer_take_first_type ) GetProcAddress ( library , " grpc_slice_buffer_take_first " ) ; <nl> gpr_strdup_import = ( gpr_strdup_type ) GetProcAddress ( library , " gpr_strdup " ) ; <nl> gpr_asprintf_import = ( gpr_asprintf_type ) GetProcAddress ( library , " gpr_asprintf " ) ; <nl> gpr_subprocess_binary_extension_import = ( gpr_subprocess_binary_extension_type ) GetProcAddress ( library , " gpr_subprocess_binary_extension " ) ; <nl> mmm a / src / ruby / ext / grpc / rb_grpc_imports . generated . h <nl> ppp b / src / ruby / ext / grpc / rb_grpc_imports . generated . h <nl> <nl> # include < grpc / support / thd . h > <nl> # include < grpc / support / time . h > <nl> <nl> - typedef grpc_byte_buffer * ( * grpc_raw_byte_buffer_create_type ) ( gpr_slice * slices , size_t nslices ) ; <nl> + typedef grpc_byte_buffer * ( * grpc_raw_byte_buffer_create_type ) ( grpc_slice * slices , size_t nslices ) ; <nl> extern grpc_raw_byte_buffer_create_type grpc_raw_byte_buffer_create_import ; <nl> # define grpc_raw_byte_buffer_create grpc_raw_byte_buffer_create_import <nl> - typedef grpc_byte_buffer * ( * grpc_raw_compressed_byte_buffer_create_type ) ( gpr_slice * slices , size_t nslices , grpc_compression_algorithm compression ) ; <nl> + typedef grpc_byte_buffer * ( * grpc_raw_compressed_byte_buffer_create_type ) ( grpc_slice * slices , size_t nslices , grpc_compression_algorithm compression ) ; <nl> extern grpc_raw_compressed_byte_buffer_create_type grpc_raw_compressed_byte_buffer_create_import ; <nl> # define grpc_raw_compressed_byte_buffer_create grpc_raw_compressed_byte_buffer_create_import <nl> typedef grpc_byte_buffer * ( * grpc_byte_buffer_copy_type ) ( grpc_byte_buffer * bb ) ; <nl> extern grpc_byte_buffer_reader_init_type grpc_byte_buffer_reader_init_import ; <nl> typedef void ( * grpc_byte_buffer_reader_destroy_type ) ( grpc_byte_buffer_reader * reader ) ; <nl> extern grpc_byte_buffer_reader_destroy_type grpc_byte_buffer_reader_destroy_import ; <nl> # define grpc_byte_buffer_reader_destroy grpc_byte_buffer_reader_destroy_import <nl> - typedef int ( * grpc_byte_buffer_reader_next_type ) ( grpc_byte_buffer_reader * reader , gpr_slice * slice ) ; <nl> + typedef int ( * grpc_byte_buffer_reader_next_type ) ( grpc_byte_buffer_reader * reader , grpc_slice * slice ) ; <nl> extern grpc_byte_buffer_reader_next_type grpc_byte_buffer_reader_next_import ; <nl> # define grpc_byte_buffer_reader_next grpc_byte_buffer_reader_next_import <nl> - typedef gpr_slice ( * grpc_byte_buffer_reader_readall_type ) ( grpc_byte_buffer_reader * reader ) ; <nl> + typedef grpc_slice ( * grpc_byte_buffer_reader_readall_type ) ( grpc_byte_buffer_reader * reader ) ; <nl> extern grpc_byte_buffer_reader_readall_type grpc_byte_buffer_reader_readall_import ; <nl> # define grpc_byte_buffer_reader_readall grpc_byte_buffer_reader_readall_import <nl> typedef grpc_byte_buffer * ( * grpc_raw_byte_buffer_from_reader_type ) ( grpc_byte_buffer_reader * reader ) ; <nl> extern gpr_set_log_function_type gpr_set_log_function_import ; <nl> typedef char * ( * gpr_format_message_type ) ( int messageid ) ; <nl> extern gpr_format_message_type gpr_format_message_import ; <nl> # define gpr_format_message gpr_format_message_import <nl> - typedef gpr_slice ( * gpr_slice_ref_type ) ( gpr_slice s ) ; <nl> - extern gpr_slice_ref_type gpr_slice_ref_import ; <nl> - # define gpr_slice_ref gpr_slice_ref_import <nl> - typedef void ( * gpr_slice_unref_type ) ( gpr_slice s ) ; <nl> - extern gpr_slice_unref_type gpr_slice_unref_import ; <nl> - # define gpr_slice_unref gpr_slice_unref_import <nl> - typedef gpr_slice ( * gpr_slice_new_type ) ( void * p , size_t len , void ( * destroy ) ( void * ) ) ; <nl> - extern gpr_slice_new_type gpr_slice_new_import ; <nl> - # define gpr_slice_new gpr_slice_new_import <nl> - typedef gpr_slice ( * gpr_slice_new_with_user_data_type ) ( void * p , size_t len , void ( * destroy ) ( void * ) , void * user_data ) ; <nl> - extern gpr_slice_new_with_user_data_type gpr_slice_new_with_user_data_import ; <nl> - # define gpr_slice_new_with_user_data gpr_slice_new_with_user_data_import <nl> - typedef gpr_slice ( * gpr_slice_new_with_len_type ) ( void * p , size_t len , void ( * destroy ) ( void * , size_t ) ) ; <nl> - extern gpr_slice_new_with_len_type gpr_slice_new_with_len_import ; <nl> - # define gpr_slice_new_with_len gpr_slice_new_with_len_import <nl> - typedef gpr_slice ( * gpr_slice_malloc_type ) ( size_t length ) ; <nl> - extern gpr_slice_malloc_type gpr_slice_malloc_import ; <nl> - # define gpr_slice_malloc gpr_slice_malloc_import <nl> - typedef gpr_slice ( * gpr_slice_from_copied_string_type ) ( const char * source ) ; <nl> - extern gpr_slice_from_copied_string_type gpr_slice_from_copied_string_import ; <nl> - # define gpr_slice_from_copied_string gpr_slice_from_copied_string_import <nl> - typedef gpr_slice ( * gpr_slice_from_copied_buffer_type ) ( const char * source , size_t len ) ; <nl> - extern gpr_slice_from_copied_buffer_type gpr_slice_from_copied_buffer_import ; <nl> - # define gpr_slice_from_copied_buffer gpr_slice_from_copied_buffer_import <nl> - typedef gpr_slice ( * gpr_slice_from_static_string_type ) ( const char * source ) ; <nl> - extern gpr_slice_from_static_string_type gpr_slice_from_static_string_import ; <nl> - # define gpr_slice_from_static_string gpr_slice_from_static_string_import <nl> - typedef gpr_slice ( * gpr_slice_sub_type ) ( gpr_slice s , size_t begin , size_t end ) ; <nl> - extern gpr_slice_sub_type gpr_slice_sub_import ; <nl> - # define gpr_slice_sub gpr_slice_sub_import <nl> - typedef gpr_slice ( * gpr_slice_sub_no_ref_type ) ( gpr_slice s , size_t begin , size_t end ) ; <nl> - extern gpr_slice_sub_no_ref_type gpr_slice_sub_no_ref_import ; <nl> - # define gpr_slice_sub_no_ref gpr_slice_sub_no_ref_import <nl> - typedef gpr_slice ( * gpr_slice_split_tail_type ) ( gpr_slice * s , size_t split ) ; <nl> - extern gpr_slice_split_tail_type gpr_slice_split_tail_import ; <nl> - # define gpr_slice_split_tail gpr_slice_split_tail_import <nl> - typedef gpr_slice ( * gpr_slice_split_head_type ) ( gpr_slice * s , size_t split ) ; <nl> - extern gpr_slice_split_head_type gpr_slice_split_head_import ; <nl> - # define gpr_slice_split_head gpr_slice_split_head_import <nl> - typedef gpr_slice ( * gpr_empty_slice_type ) ( void ) ; <nl> + typedef grpc_slice ( * grpc_slice_ref_type ) ( grpc_slice s ) ; <nl> + extern grpc_slice_ref_type grpc_slice_ref_import ; <nl> + # define grpc_slice_ref grpc_slice_ref_import <nl> + typedef void ( * grpc_slice_unref_type ) ( grpc_slice s ) ; <nl> + extern grpc_slice_unref_type grpc_slice_unref_import ; <nl> + # define grpc_slice_unref grpc_slice_unref_import <nl> + typedef grpc_slice ( * grpc_slice_new_type ) ( void * p , size_t len , void ( * destroy ) ( void * ) ) ; <nl> + extern grpc_slice_new_type grpc_slice_new_import ; <nl> + # define grpc_slice_new grpc_slice_new_import <nl> + typedef grpc_slice ( * grpc_slice_new_with_user_data_type ) ( void * p , size_t len , void ( * destroy ) ( void * ) , void * user_data ) ; <nl> + extern grpc_slice_new_with_user_data_type grpc_slice_new_with_user_data_import ; <nl> + # define grpc_slice_new_with_user_data grpc_slice_new_with_user_data_import <nl> + typedef grpc_slice ( * grpc_slice_new_with_len_type ) ( void * p , size_t len , void ( * destroy ) ( void * , size_t ) ) ; <nl> + extern grpc_slice_new_with_len_type grpc_slice_new_with_len_import ; <nl> + # define grpc_slice_new_with_len grpc_slice_new_with_len_import <nl> + typedef grpc_slice ( * grpc_slice_malloc_type ) ( size_t length ) ; <nl> + extern grpc_slice_malloc_type grpc_slice_malloc_import ; <nl> + # define grpc_slice_malloc grpc_slice_malloc_import <nl> + typedef grpc_slice ( * grpc_slice_from_copied_string_type ) ( const char * source ) ; <nl> + extern grpc_slice_from_copied_string_type grpc_slice_from_copied_string_import ; <nl> + # define grpc_slice_from_copied_string grpc_slice_from_copied_string_import <nl> + typedef grpc_slice ( * grpc_slice_from_copied_buffer_type ) ( const char * source , size_t len ) ; <nl> + extern grpc_slice_from_copied_buffer_type grpc_slice_from_copied_buffer_import ; <nl> + # define grpc_slice_from_copied_buffer grpc_slice_from_copied_buffer_import <nl> + typedef grpc_slice ( * grpc_slice_from_static_string_type ) ( const char * source ) ; <nl> + extern grpc_slice_from_static_string_type grpc_slice_from_static_string_import ; <nl> + # define grpc_slice_from_static_string grpc_slice_from_static_string_import <nl> + typedef grpc_slice ( * grpc_slice_sub_type ) ( grpc_slice s , size_t begin , size_t end ) ; <nl> + extern grpc_slice_sub_type grpc_slice_sub_import ; <nl> + # define grpc_slice_sub grpc_slice_sub_import <nl> + typedef grpc_slice ( * grpc_slice_sub_no_ref_type ) ( grpc_slice s , size_t begin , size_t end ) ; <nl> + extern grpc_slice_sub_no_ref_type grpc_slice_sub_no_ref_import ; <nl> + # define grpc_slice_sub_no_ref grpc_slice_sub_no_ref_import <nl> + typedef grpc_slice ( * grpc_slice_split_tail_type ) ( grpc_slice * s , size_t split ) ; <nl> + extern grpc_slice_split_tail_type grpc_slice_split_tail_import ; <nl> + # define grpc_slice_split_tail grpc_slice_split_tail_import <nl> + typedef grpc_slice ( * grpc_slice_split_head_type ) ( grpc_slice * s , size_t split ) ; <nl> + extern grpc_slice_split_head_type grpc_slice_split_head_import ; <nl> + # define grpc_slice_split_head grpc_slice_split_head_import <nl> + typedef grpc_slice ( * gpr_empty_slice_type ) ( void ) ; <nl> extern gpr_empty_slice_type gpr_empty_slice_import ; <nl> # define gpr_empty_slice gpr_empty_slice_import <nl> - typedef int ( * gpr_slice_cmp_type ) ( gpr_slice a , gpr_slice b ) ; <nl> - extern gpr_slice_cmp_type gpr_slice_cmp_import ; <nl> - # define gpr_slice_cmp gpr_slice_cmp_import <nl> - typedef int ( * gpr_slice_str_cmp_type ) ( gpr_slice a , const char * b ) ; <nl> - extern gpr_slice_str_cmp_type gpr_slice_str_cmp_import ; <nl> - # define gpr_slice_str_cmp gpr_slice_str_cmp_import <nl> - typedef void ( * gpr_slice_buffer_init_type ) ( gpr_slice_buffer * sb ) ; <nl> - extern gpr_slice_buffer_init_type gpr_slice_buffer_init_import ; <nl> - # define gpr_slice_buffer_init gpr_slice_buffer_init_import <nl> - typedef void ( * gpr_slice_buffer_destroy_type ) ( gpr_slice_buffer * sb ) ; <nl> - extern gpr_slice_buffer_destroy_type gpr_slice_buffer_destroy_import ; <nl> - # define gpr_slice_buffer_destroy gpr_slice_buffer_destroy_import <nl> - typedef void ( * gpr_slice_buffer_add_type ) ( gpr_slice_buffer * sb , gpr_slice slice ) ; <nl> - extern gpr_slice_buffer_add_type gpr_slice_buffer_add_import ; <nl> - # define gpr_slice_buffer_add gpr_slice_buffer_add_import <nl> - typedef size_t ( * gpr_slice_buffer_add_indexed_type ) ( gpr_slice_buffer * sb , gpr_slice slice ) ; <nl> - extern gpr_slice_buffer_add_indexed_type gpr_slice_buffer_add_indexed_import ; <nl> - # define gpr_slice_buffer_add_indexed gpr_slice_buffer_add_indexed_import <nl> - typedef void ( * gpr_slice_buffer_addn_type ) ( gpr_slice_buffer * sb , gpr_slice * slices , size_t n ) ; <nl> - extern gpr_slice_buffer_addn_type gpr_slice_buffer_addn_import ; <nl> - # define gpr_slice_buffer_addn gpr_slice_buffer_addn_import <nl> - typedef uint8_t * ( * gpr_slice_buffer_tiny_add_type ) ( gpr_slice_buffer * sb , size_t len ) ; <nl> - extern gpr_slice_buffer_tiny_add_type gpr_slice_buffer_tiny_add_import ; <nl> - # define gpr_slice_buffer_tiny_add gpr_slice_buffer_tiny_add_import <nl> - typedef void ( * gpr_slice_buffer_pop_type ) ( gpr_slice_buffer * sb ) ; <nl> - extern gpr_slice_buffer_pop_type gpr_slice_buffer_pop_import ; <nl> - # define gpr_slice_buffer_pop gpr_slice_buffer_pop_import <nl> - typedef void ( * gpr_slice_buffer_reset_and_unref_type ) ( gpr_slice_buffer * sb ) ; <nl> - extern gpr_slice_buffer_reset_and_unref_type gpr_slice_buffer_reset_and_unref_import ; <nl> - # define gpr_slice_buffer_reset_and_unref gpr_slice_buffer_reset_and_unref_import <nl> - typedef void ( * gpr_slice_buffer_swap_type ) ( gpr_slice_buffer * a , gpr_slice_buffer * b ) ; <nl> - extern gpr_slice_buffer_swap_type gpr_slice_buffer_swap_import ; <nl> - # define gpr_slice_buffer_swap gpr_slice_buffer_swap_import <nl> - typedef void ( * gpr_slice_buffer_move_into_type ) ( gpr_slice_buffer * src , gpr_slice_buffer * dst ) ; <nl> - extern gpr_slice_buffer_move_into_type gpr_slice_buffer_move_into_import ; <nl> - # define gpr_slice_buffer_move_into gpr_slice_buffer_move_into_import <nl> - typedef void ( * gpr_slice_buffer_trim_end_type ) ( gpr_slice_buffer * src , size_t n , gpr_slice_buffer * garbage ) ; <nl> - extern gpr_slice_buffer_trim_end_type gpr_slice_buffer_trim_end_import ; <nl> - # define gpr_slice_buffer_trim_end gpr_slice_buffer_trim_end_import <nl> - typedef void ( * gpr_slice_buffer_move_first_type ) ( gpr_slice_buffer * src , size_t n , gpr_slice_buffer * dst ) ; <nl> - extern gpr_slice_buffer_move_first_type gpr_slice_buffer_move_first_import ; <nl> - # define gpr_slice_buffer_move_first gpr_slice_buffer_move_first_import <nl> - typedef gpr_slice ( * gpr_slice_buffer_take_first_type ) ( gpr_slice_buffer * src ) ; <nl> - extern gpr_slice_buffer_take_first_type gpr_slice_buffer_take_first_import ; <nl> - # define gpr_slice_buffer_take_first gpr_slice_buffer_take_first_import <nl> + typedef int ( * grpc_slice_cmp_type ) ( grpc_slice a , grpc_slice b ) ; <nl> + extern grpc_slice_cmp_type grpc_slice_cmp_import ; <nl> + # define grpc_slice_cmp grpc_slice_cmp_import <nl> + typedef int ( * grpc_slice_str_cmp_type ) ( grpc_slice a , const char * b ) ; <nl> + extern grpc_slice_str_cmp_type grpc_slice_str_cmp_import ; <nl> + # define grpc_slice_str_cmp grpc_slice_str_cmp_import <nl> + typedef void ( * grpc_slice_buffer_init_type ) ( grpc_slice_buffer * sb ) ; <nl> + extern grpc_slice_buffer_init_type grpc_slice_buffer_init_import ; <nl> + # define grpc_slice_buffer_init grpc_slice_buffer_init_import <nl> + typedef void ( * grpc_slice_buffer_destroy_type ) ( grpc_slice_buffer * sb ) ; <nl> + extern grpc_slice_buffer_destroy_type grpc_slice_buffer_destroy_import ; <nl> + # define grpc_slice_buffer_destroy grpc_slice_buffer_destroy_import <nl> + typedef void ( * grpc_slice_buffer_add_type ) ( grpc_slice_buffer * sb , grpc_slice slice ) ; <nl> + extern grpc_slice_buffer_add_type grpc_slice_buffer_add_import ; <nl> + # define grpc_slice_buffer_add grpc_slice_buffer_add_import <nl> + typedef size_t ( * grpc_slice_buffer_add_indexed_type ) ( grpc_slice_buffer * sb , grpc_slice slice ) ; <nl> + extern grpc_slice_buffer_add_indexed_type grpc_slice_buffer_add_indexed_import ; <nl> + # define grpc_slice_buffer_add_indexed grpc_slice_buffer_add_indexed_import <nl> + typedef void ( * grpc_slice_buffer_addn_type ) ( grpc_slice_buffer * sb , grpc_slice * slices , size_t n ) ; <nl> + extern grpc_slice_buffer_addn_type grpc_slice_buffer_addn_import ; <nl> + # define grpc_slice_buffer_addn grpc_slice_buffer_addn_import <nl> + typedef uint8_t * ( * grpc_slice_buffer_tiny_add_type ) ( grpc_slice_buffer * sb , size_t len ) ; <nl> + extern grpc_slice_buffer_tiny_add_type grpc_slice_buffer_tiny_add_import ; <nl> + # define grpc_slice_buffer_tiny_add grpc_slice_buffer_tiny_add_import <nl> + typedef void ( * grpc_slice_buffer_pop_type ) ( grpc_slice_buffer * sb ) ; <nl> + extern grpc_slice_buffer_pop_type grpc_slice_buffer_pop_import ; <nl> + # define grpc_slice_buffer_pop grpc_slice_buffer_pop_import <nl> + typedef void ( * grpc_slice_buffer_reset_and_unref_type ) ( grpc_slice_buffer * sb ) ; <nl> + extern grpc_slice_buffer_reset_and_unref_type grpc_slice_buffer_reset_and_unref_import ; <nl> + # define grpc_slice_buffer_reset_and_unref grpc_slice_buffer_reset_and_unref_import <nl> + typedef void ( * grpc_slice_buffer_swap_type ) ( grpc_slice_buffer * a , grpc_slice_buffer * b ) ; <nl> + extern grpc_slice_buffer_swap_type grpc_slice_buffer_swap_import ; <nl> + # define grpc_slice_buffer_swap grpc_slice_buffer_swap_import <nl> + typedef void ( * grpc_slice_buffer_move_into_type ) ( grpc_slice_buffer * src , grpc_slice_buffer * dst ) ; <nl> + extern grpc_slice_buffer_move_into_type grpc_slice_buffer_move_into_import ; <nl> + # define grpc_slice_buffer_move_into grpc_slice_buffer_move_into_import <nl> + typedef void ( * grpc_slice_buffer_trim_end_type ) ( grpc_slice_buffer * src , size_t n , grpc_slice_buffer * garbage ) ; <nl> + extern grpc_slice_buffer_trim_end_type grpc_slice_buffer_trim_end_import ; <nl> + # define grpc_slice_buffer_trim_end grpc_slice_buffer_trim_end_import <nl> + typedef void ( * grpc_slice_buffer_move_first_type ) ( grpc_slice_buffer * src , size_t n , grpc_slice_buffer * dst ) ; <nl> + extern grpc_slice_buffer_move_first_type grpc_slice_buffer_move_first_import ; <nl> + # define grpc_slice_buffer_move_first grpc_slice_buffer_move_first_import <nl> + typedef grpc_slice ( * grpc_slice_buffer_take_first_type ) ( grpc_slice_buffer * src ) ; <nl> + extern grpc_slice_buffer_take_first_type grpc_slice_buffer_take_first_import ; <nl> + # define grpc_slice_buffer_take_first grpc_slice_buffer_take_first_import <nl> typedef char * ( * gpr_strdup_type ) ( const char * src ) ; <nl> extern gpr_strdup_type gpr_strdup_import ; <nl> # define gpr_strdup gpr_strdup_import <nl> mmm a / test / core / bad_client / bad_client . c <nl> ppp b / test / core / bad_client / bad_client . c <nl> static void server_setup_transport ( void * ts , grpc_transport * transport ) { <nl> <nl> typedef struct { <nl> grpc_bad_client_client_stream_validator validator ; <nl> - gpr_slice_buffer incoming ; <nl> + grpc_slice_buffer incoming ; <nl> gpr_event read_done ; <nl> } read_args ; <nl> <nl> void grpc_run_bad_client_test ( <nl> gpr_thd_id id ; <nl> char * hex ; <nl> grpc_transport * transport ; <nl> - gpr_slice slice = <nl> - gpr_slice_from_copied_buffer ( client_payload , client_payload_length ) ; <nl> - gpr_slice_buffer outgoing ; <nl> + grpc_slice slice = <nl> + grpc_slice_from_copied_buffer ( client_payload , client_payload_length ) ; <nl> + grpc_slice_buffer outgoing ; <nl> grpc_closure done_write_closure ; <nl> grpc_exec_ctx exec_ctx = GRPC_EXEC_CTX_INIT ; <nl> <nl> void grpc_run_bad_client_test ( <nl> / * Start validator * / <nl> gpr_thd_new ( & id , thd_func , & a , NULL ) ; <nl> <nl> - gpr_slice_buffer_init ( & outgoing ) ; <nl> - gpr_slice_buffer_add ( & outgoing , slice ) ; <nl> + grpc_slice_buffer_init ( & outgoing ) ; <nl> + grpc_slice_buffer_add ( & outgoing , slice ) ; <nl> grpc_closure_init ( & done_write_closure , done_write , & a ) ; <nl> <nl> / * Write data * / <nl> void grpc_run_bad_client_test ( <nl> if ( client_validator ! = NULL ) { <nl> read_args args ; <nl> args . validator = client_validator ; <nl> - gpr_slice_buffer_init ( & args . incoming ) ; <nl> + grpc_slice_buffer_init ( & args . incoming ) ; <nl> gpr_event_init ( & args . read_done ) ; <nl> grpc_closure read_done_closure ; <nl> grpc_closure_init ( & read_done_closure , read_done , & args ) ; <nl> void grpc_run_bad_client_test ( <nl> grpc_exec_ctx_finish ( & exec_ctx ) ; <nl> GPR_ASSERT ( <nl> gpr_event_wait ( & args . read_done , GRPC_TIMEOUT_SECONDS_TO_DEADLINE ( 5 ) ) ) ; <nl> - gpr_slice_buffer_destroy ( & args . incoming ) ; <nl> + grpc_slice_buffer_destroy ( & args . incoming ) ; <nl> } <nl> / / Shutdown . <nl> grpc_endpoint_shutdown ( & exec_ctx , sfd . client ) ; <nl> void grpc_run_bad_client_test ( <nl> . type = = GRPC_OP_COMPLETE ) ; <nl> grpc_server_destroy ( a . server ) ; <nl> grpc_completion_queue_destroy ( a . cq ) ; <nl> - gpr_slice_buffer_destroy ( & outgoing ) ; <nl> + grpc_slice_buffer_destroy ( & outgoing ) ; <nl> <nl> grpc_exec_ctx_finish ( & exec_ctx ) ; <nl> grpc_shutdown ( ) ; <nl> mmm a / test / core / bad_client / bad_client . h <nl> ppp b / test / core / bad_client / bad_client . h <nl> typedef void ( * grpc_bad_client_server_side_validator ) ( grpc_server * server , <nl> void * registered_method ) ; <nl> <nl> typedef void ( * grpc_bad_client_client_stream_validator ) ( <nl> - gpr_slice_buffer * incoming ) ; <nl> + grpc_slice_buffer * incoming ) ; <nl> <nl> # define GRPC_BAD_CLIENT_DISCONNECT 1 <nl> <nl> mmm a / test / core / bad_client / tests / large_metadata . c <nl> ppp b / test / core / bad_client / tests / large_metadata . c <nl> static void server_verifier_sends_too_much_metadata ( grpc_server * server , <nl> cq_verifier_destroy ( cqv ) ; <nl> } <nl> <nl> - static void client_validator ( gpr_slice_buffer * incoming ) { <nl> + static void client_validator ( grpc_slice_buffer * incoming ) { <nl> / / Get last frame from incoming slice buffer . <nl> - gpr_slice_buffer last_frame_buffer ; <nl> - gpr_slice_buffer_init ( & last_frame_buffer ) ; <nl> - gpr_slice_buffer_trim_end ( incoming , 13 , & last_frame_buffer ) ; <nl> + grpc_slice_buffer last_frame_buffer ; <nl> + grpc_slice_buffer_init ( & last_frame_buffer ) ; <nl> + grpc_slice_buffer_trim_end ( incoming , 13 , & last_frame_buffer ) ; <nl> GPR_ASSERT ( last_frame_buffer . count = = 1 ) ; <nl> - gpr_slice last_frame = last_frame_buffer . slices [ 0 ] ; <nl> + grpc_slice last_frame = last_frame_buffer . slices [ 0 ] ; <nl> / / Construct expected frame . <nl> - gpr_slice expected = gpr_slice_malloc ( 13 ) ; <nl> + grpc_slice expected = grpc_slice_malloc ( 13 ) ; <nl> uint8_t * p = GPR_SLICE_START_PTR ( expected ) ; <nl> / / Length . <nl> * p + + = 0 ; <nl> static void client_validator ( gpr_slice_buffer * incoming ) { <nl> * p + + = 0 ; <nl> * p + + = 11 ; <nl> / / Compare actual and expected . <nl> - GPR_ASSERT ( gpr_slice_cmp ( last_frame , expected ) = = 0 ) ; <nl> - gpr_slice_buffer_destroy ( & last_frame_buffer ) ; <nl> + GPR_ASSERT ( grpc_slice_cmp ( last_frame , expected ) = = 0 ) ; <nl> + grpc_slice_buffer_destroy ( & last_frame_buffer ) ; <nl> } <nl> <nl> int main ( int argc , char * * argv ) { <nl> mmm a / test / core / bad_ssl / servers / cert . c <nl> ppp b / test / core / bad_ssl / servers / cert . c <nl> int main ( int argc , char * * argv ) { <nl> grpc_ssl_pem_key_cert_pair pem_key_cert_pair ; <nl> grpc_server_credentials * ssl_creds ; <nl> grpc_server * server ; <nl> - gpr_slice cert_slice , key_slice ; <nl> + grpc_slice cert_slice , key_slice ; <nl> <nl> grpc_init ( ) ; <nl> <nl> int main ( int argc , char * * argv ) { <nl> GPR_ASSERT ( grpc_server_add_secure_http2_port ( server , addr , ssl_creds ) ) ; <nl> grpc_server_credentials_release ( ssl_creds ) ; <nl> <nl> - gpr_slice_unref ( cert_slice ) ; <nl> - gpr_slice_unref ( key_slice ) ; <nl> + grpc_slice_unref ( cert_slice ) ; <nl> + grpc_slice_unref ( key_slice ) ; <nl> <nl> bad_ssl_run ( server ) ; <nl> grpc_shutdown ( ) ; <nl> mmm a / test / core / client_channel / set_initial_connect_string_test . c <nl> ppp b / test / core / client_channel / set_initial_connect_string_test . c <nl> struct rpc_state { <nl> grpc_channel * channel ; <nl> grpc_call * call ; <nl> grpc_op op ; <nl> - gpr_slice_buffer incoming_buffer ; <nl> - gpr_slice_buffer temp_incoming_buffer ; <nl> + grpc_slice_buffer incoming_buffer ; <nl> + grpc_slice_buffer temp_incoming_buffer ; <nl> grpc_endpoint * tcp ; <nl> gpr_atm done_atm ; <nl> } ; <nl> static grpc_closure on_read ; <nl> <nl> static void handle_read ( grpc_exec_ctx * exec_ctx , void * arg , grpc_error * error ) { <nl> GPR_ASSERT ( error = = GRPC_ERROR_NONE ) ; <nl> - gpr_slice_buffer_move_into ( & state . temp_incoming_buffer , <nl> + grpc_slice_buffer_move_into ( & state . temp_incoming_buffer , <nl> & state . incoming_buffer ) ; <nl> gpr_log ( GPR_DEBUG , " got % " PRIuPTR " bytes , magic is % " PRIuPTR " bytes " , <nl> state . incoming_buffer . length , strlen ( magic_connect_string ) ) ; <nl> static void on_connect ( grpc_exec_ctx * exec_ctx , void * arg , grpc_endpoint * tcp , <nl> grpc_tcp_server_acceptor * acceptor ) { <nl> test_tcp_server * server = arg ; <nl> grpc_closure_init ( & on_read , handle_read , NULL ) ; <nl> - gpr_slice_buffer_init ( & state . incoming_buffer ) ; <nl> - gpr_slice_buffer_init ( & state . temp_incoming_buffer ) ; <nl> + grpc_slice_buffer_init ( & state . incoming_buffer ) ; <nl> + grpc_slice_buffer_init ( & state . temp_incoming_buffer ) ; <nl> state . tcp = tcp ; <nl> grpc_endpoint_add_to_pollset ( exec_ctx , tcp , server - > pollset ) ; <nl> grpc_endpoint_read ( exec_ctx , tcp , & state . temp_incoming_buffer , & on_read ) ; <nl> } <nl> <nl> static void set_magic_initial_string ( struct sockaddr * * addr , size_t * addr_len , <nl> - gpr_slice * connect_string ) { <nl> + grpc_slice * connect_string ) { <nl> GPR_ASSERT ( addr ) ; <nl> GPR_ASSERT ( addr_len ) ; <nl> - * connect_string = gpr_slice_from_copied_string ( magic_connect_string ) ; <nl> + * connect_string = grpc_slice_from_copied_string ( magic_connect_string ) ; <nl> } <nl> <nl> static void reset_addr_and_set_magic_string ( struct sockaddr * * addr , <nl> size_t * addr_len , <nl> - gpr_slice * connect_string ) { <nl> + grpc_slice * connect_string ) { <nl> struct sockaddr_in target ; <nl> - * connect_string = gpr_slice_from_copied_string ( magic_connect_string ) ; <nl> + * connect_string = grpc_slice_from_copied_string ( magic_connect_string ) ; <nl> gpr_free ( * addr ) ; <nl> target . sin_family = AF_INET ; <nl> target . sin_addr . s_addr = htonl ( INADDR_LOOPBACK ) ; <nl> static void start_rpc ( int use_creds , int target_port ) { <nl> <nl> static void cleanup_rpc ( void ) { <nl> grpc_event ev ; <nl> - gpr_slice_buffer_destroy ( & state . incoming_buffer ) ; <nl> - gpr_slice_buffer_destroy ( & state . temp_incoming_buffer ) ; <nl> + grpc_slice_buffer_destroy ( & state . incoming_buffer ) ; <nl> + grpc_slice_buffer_destroy ( & state . temp_incoming_buffer ) ; <nl> grpc_channel_credentials_unref ( state . creds ) ; <nl> grpc_call_destroy ( state . call ) ; <nl> grpc_completion_queue_shutdown ( state . cq ) ; <nl> static void poll_server_until_read_done ( test_tcp_server * server , <nl> gpr_thd_new ( & id , actually_poll_server , pa , NULL ) ; <nl> } <nl> <nl> - static void match_initial_magic_string ( gpr_slice_buffer * buffer ) { <nl> + static void match_initial_magic_string ( grpc_slice_buffer * buffer ) { <nl> size_t i , j , cmp_length ; <nl> size_t magic_length = strlen ( magic_connect_string ) ; <nl> GPR_ASSERT ( buffer - > length > = magic_length ) ; <nl> mmm a / test / core / compression / message_compress_test . c <nl> ppp b / test / core / compression / message_compress_test . c <nl> typedef enum { <nl> MAYBE_COMPRESSES <nl> } compressability ; <nl> <nl> - static void assert_passthrough ( gpr_slice value , <nl> + static void assert_passthrough ( grpc_slice value , <nl> grpc_compression_algorithm algorithm , <nl> grpc_slice_split_mode uncompressed_split_mode , <nl> grpc_slice_split_mode compressed_split_mode , <nl> compressability compress_result_check ) { <nl> - gpr_slice_buffer input ; <nl> - gpr_slice_buffer compressed_raw ; <nl> - gpr_slice_buffer compressed ; <nl> - gpr_slice_buffer output ; <nl> - gpr_slice final ; <nl> + grpc_slice_buffer input ; <nl> + grpc_slice_buffer compressed_raw ; <nl> + grpc_slice_buffer compressed ; <nl> + grpc_slice_buffer output ; <nl> + grpc_slice final ; <nl> int was_compressed ; <nl> char * algorithm_name ; <nl> <nl> static void assert_passthrough ( gpr_slice value , <nl> algorithm_name , grpc_slice_split_mode_name ( uncompressed_split_mode ) , <nl> grpc_slice_split_mode_name ( compressed_split_mode ) ) ; <nl> <nl> - gpr_slice_buffer_init ( & input ) ; <nl> - gpr_slice_buffer_init ( & compressed_raw ) ; <nl> - gpr_slice_buffer_init ( & compressed ) ; <nl> - gpr_slice_buffer_init ( & output ) ; <nl> + grpc_slice_buffer_init ( & input ) ; <nl> + grpc_slice_buffer_init ( & compressed_raw ) ; <nl> + grpc_slice_buffer_init ( & compressed ) ; <nl> + grpc_slice_buffer_init ( & output ) ; <nl> <nl> grpc_split_slices_to_buffer ( uncompressed_split_mode , & value , 1 , & input ) ; <nl> <nl> static void assert_passthrough ( gpr_slice value , <nl> was_compressed ? algorithm : GRPC_COMPRESS_NONE , & compressed , & output ) ) ; <nl> <nl> final = grpc_slice_merge ( output . slices , output . count ) ; <nl> - GPR_ASSERT ( 0 = = gpr_slice_cmp ( value , final ) ) ; <nl> + GPR_ASSERT ( 0 = = grpc_slice_cmp ( value , final ) ) ; <nl> <nl> - gpr_slice_buffer_destroy ( & input ) ; <nl> - gpr_slice_buffer_destroy ( & compressed ) ; <nl> - gpr_slice_buffer_destroy ( & compressed_raw ) ; <nl> - gpr_slice_buffer_destroy ( & output ) ; <nl> - gpr_slice_unref ( final ) ; <nl> + grpc_slice_buffer_destroy ( & input ) ; <nl> + grpc_slice_buffer_destroy ( & compressed ) ; <nl> + grpc_slice_buffer_destroy ( & compressed_raw ) ; <nl> + grpc_slice_buffer_destroy ( & output ) ; <nl> + grpc_slice_unref ( final ) ; <nl> } <nl> <nl> - static gpr_slice repeated ( char c , size_t length ) { <nl> - gpr_slice out = gpr_slice_malloc ( length ) ; <nl> + static grpc_slice repeated ( char c , size_t length ) { <nl> + grpc_slice out = grpc_slice_malloc ( length ) ; <nl> memset ( GPR_SLICE_START_PTR ( out ) , c , length ) ; <nl> return out ; <nl> } <nl> static compressability get_compressability ( <nl> return MAYBE_COMPRESSES ; <nl> } <nl> <nl> - static gpr_slice create_test_value ( test_value id ) { <nl> + static grpc_slice create_test_value ( test_value id ) { <nl> switch ( id ) { <nl> case ONE_A : <nl> - return gpr_slice_from_copied_string ( " a " ) ; <nl> + return grpc_slice_from_copied_string ( " a " ) ; <nl> case ONE_KB_A : <nl> return repeated ( ' a ' , 1024 ) ; <nl> case ONE_MB_A : <nl> static gpr_slice create_test_value ( test_value id ) { <nl> abort ( ) ; <nl> break ; <nl> } <nl> - return gpr_slice_from_copied_string ( " bad value " ) ; <nl> + return grpc_slice_from_copied_string ( " bad value " ) ; <nl> } <nl> <nl> static void test_tiny_data_compress ( void ) { <nl> - gpr_slice_buffer input ; <nl> - gpr_slice_buffer output ; <nl> + grpc_slice_buffer input ; <nl> + grpc_slice_buffer output ; <nl> grpc_compression_algorithm i ; <nl> <nl> - gpr_slice_buffer_init ( & input ) ; <nl> - gpr_slice_buffer_init ( & output ) ; <nl> - gpr_slice_buffer_add ( & input , create_test_value ( ONE_A ) ) ; <nl> + grpc_slice_buffer_init ( & input ) ; <nl> + grpc_slice_buffer_init ( & output ) ; <nl> + grpc_slice_buffer_add ( & input , create_test_value ( ONE_A ) ) ; <nl> <nl> for ( i = 0 ; i < GRPC_COMPRESS_ALGORITHMS_COUNT ; i + + ) { <nl> if ( i = = GRPC_COMPRESS_NONE ) continue ; <nl> static void test_tiny_data_compress ( void ) { <nl> GPR_ASSERT ( 1 = = output . count ) ; <nl> } <nl> <nl> - gpr_slice_buffer_destroy ( & input ) ; <nl> - gpr_slice_buffer_destroy ( & output ) ; <nl> + grpc_slice_buffer_destroy ( & input ) ; <nl> + grpc_slice_buffer_destroy ( & output ) ; <nl> } <nl> <nl> static void test_bad_decompression_data_crc ( void ) { <nl> - gpr_slice_buffer input ; <nl> - gpr_slice_buffer corrupted ; <nl> - gpr_slice_buffer output ; <nl> + grpc_slice_buffer input ; <nl> + grpc_slice_buffer corrupted ; <nl> + grpc_slice_buffer output ; <nl> size_t idx ; <nl> const uint32_t bad = 0xdeadbeef ; <nl> <nl> - gpr_slice_buffer_init ( & input ) ; <nl> - gpr_slice_buffer_init ( & corrupted ) ; <nl> - gpr_slice_buffer_init ( & output ) ; <nl> - gpr_slice_buffer_add ( & input , create_test_value ( ONE_MB_A ) ) ; <nl> + grpc_slice_buffer_init ( & input ) ; <nl> + grpc_slice_buffer_init ( & corrupted ) ; <nl> + grpc_slice_buffer_init ( & output ) ; <nl> + grpc_slice_buffer_add ( & input , create_test_value ( ONE_MB_A ) ) ; <nl> <nl> / * compress it * / <nl> grpc_msg_compress ( GRPC_COMPRESS_GZIP , & input , & corrupted ) ; <nl> static void test_bad_decompression_data_crc ( void ) { <nl> / * try ( and fail ) to decompress the corrupted compresed buffer * / <nl> GPR_ASSERT ( 0 = = grpc_msg_decompress ( GRPC_COMPRESS_GZIP , & corrupted , & output ) ) ; <nl> <nl> - gpr_slice_buffer_destroy ( & input ) ; <nl> - gpr_slice_buffer_destroy ( & corrupted ) ; <nl> - gpr_slice_buffer_destroy ( & output ) ; <nl> + grpc_slice_buffer_destroy ( & input ) ; <nl> + grpc_slice_buffer_destroy ( & corrupted ) ; <nl> + grpc_slice_buffer_destroy ( & output ) ; <nl> } <nl> <nl> static void test_bad_decompression_data_trailing_garbage ( void ) { <nl> - gpr_slice_buffer input ; <nl> - gpr_slice_buffer output ; <nl> + grpc_slice_buffer input ; <nl> + grpc_slice_buffer output ; <nl> <nl> - gpr_slice_buffer_init ( & input ) ; <nl> - gpr_slice_buffer_init ( & output ) ; <nl> + grpc_slice_buffer_init ( & input ) ; <nl> + grpc_slice_buffer_init ( & output ) ; <nl> / * append 0x99 to the end of an otherwise valid stream * / <nl> - gpr_slice_buffer_add ( <nl> - & input , gpr_slice_from_copied_buffer ( <nl> + grpc_slice_buffer_add ( <nl> + & input , grpc_slice_from_copied_buffer ( <nl> " \ x78 \ xda \ x63 \ x60 \ x60 \ x60 \ x00 \ x00 \ x00 \ x04 \ x00 \ x01 \ x99 " , 13 ) ) ; <nl> <nl> / * try ( and fail ) to decompress the invalid compresed buffer * / <nl> GPR_ASSERT ( 0 = = grpc_msg_decompress ( GRPC_COMPRESS_DEFLATE , & input , & output ) ) ; <nl> <nl> - gpr_slice_buffer_destroy ( & input ) ; <nl> - gpr_slice_buffer_destroy ( & output ) ; <nl> + grpc_slice_buffer_destroy ( & input ) ; <nl> + grpc_slice_buffer_destroy ( & output ) ; <nl> } <nl> <nl> static void test_bad_decompression_data_stream ( void ) { <nl> - gpr_slice_buffer input ; <nl> - gpr_slice_buffer output ; <nl> + grpc_slice_buffer input ; <nl> + grpc_slice_buffer output ; <nl> <nl> - gpr_slice_buffer_init ( & input ) ; <nl> - gpr_slice_buffer_init ( & output ) ; <nl> - gpr_slice_buffer_add ( & input , <nl> - gpr_slice_from_copied_buffer ( " \ x78 \ xda \ xff \ xff " , 4 ) ) ; <nl> + grpc_slice_buffer_init ( & input ) ; <nl> + grpc_slice_buffer_init ( & output ) ; <nl> + grpc_slice_buffer_add ( & input , <nl> + grpc_slice_from_copied_buffer ( " \ x78 \ xda \ xff \ xff " , 4 ) ) ; <nl> <nl> / * try ( and fail ) to decompress the invalid compresed buffer * / <nl> GPR_ASSERT ( 0 = = grpc_msg_decompress ( GRPC_COMPRESS_DEFLATE , & input , & output ) ) ; <nl> <nl> - gpr_slice_buffer_destroy ( & input ) ; <nl> - gpr_slice_buffer_destroy ( & output ) ; <nl> + grpc_slice_buffer_destroy ( & input ) ; <nl> + grpc_slice_buffer_destroy ( & output ) ; <nl> } <nl> <nl> static void test_bad_compression_algorithm ( void ) { <nl> - gpr_slice_buffer input ; <nl> - gpr_slice_buffer output ; <nl> + grpc_slice_buffer input ; <nl> + grpc_slice_buffer output ; <nl> int was_compressed ; <nl> <nl> - gpr_slice_buffer_init ( & input ) ; <nl> - gpr_slice_buffer_init ( & output ) ; <nl> - gpr_slice_buffer_add ( & input , <nl> - gpr_slice_from_copied_string ( " Never gonna give you up " ) ) ; <nl> + grpc_slice_buffer_init ( & input ) ; <nl> + grpc_slice_buffer_init ( & output ) ; <nl> + grpc_slice_buffer_add ( & input , <nl> + grpc_slice_from_copied_string ( " Never gonna give you up " ) ) ; <nl> was_compressed = <nl> grpc_msg_compress ( GRPC_COMPRESS_ALGORITHMS_COUNT , & input , & output ) ; <nl> GPR_ASSERT ( 0 = = was_compressed ) ; <nl> static void test_bad_compression_algorithm ( void ) { <nl> grpc_msg_compress ( GRPC_COMPRESS_ALGORITHMS_COUNT + 123 , & input , & output ) ; <nl> GPR_ASSERT ( 0 = = was_compressed ) ; <nl> <nl> - gpr_slice_buffer_destroy ( & input ) ; <nl> - gpr_slice_buffer_destroy ( & output ) ; <nl> + grpc_slice_buffer_destroy ( & input ) ; <nl> + grpc_slice_buffer_destroy ( & output ) ; <nl> } <nl> <nl> static void test_bad_decompression_algorithm ( void ) { <nl> - gpr_slice_buffer input ; <nl> - gpr_slice_buffer output ; <nl> + grpc_slice_buffer input ; <nl> + grpc_slice_buffer output ; <nl> int was_decompressed ; <nl> <nl> - gpr_slice_buffer_init ( & input ) ; <nl> - gpr_slice_buffer_init ( & output ) ; <nl> - gpr_slice_buffer_add ( & input , <nl> - gpr_slice_from_copied_string ( <nl> + grpc_slice_buffer_init ( & input ) ; <nl> + grpc_slice_buffer_init ( & output ) ; <nl> + grpc_slice_buffer_add ( & input , <nl> + grpc_slice_from_copied_string ( <nl> " I ' m not really compressed but it doesn ' t matter " ) ) ; <nl> was_decompressed = <nl> grpc_msg_decompress ( GRPC_COMPRESS_ALGORITHMS_COUNT , & input , & output ) ; <nl> static void test_bad_decompression_algorithm ( void ) { <nl> & input , & output ) ; <nl> GPR_ASSERT ( 0 = = was_decompressed ) ; <nl> <nl> - gpr_slice_buffer_destroy ( & input ) ; <nl> - gpr_slice_buffer_destroy ( & output ) ; <nl> + grpc_slice_buffer_destroy ( & input ) ; <nl> + grpc_slice_buffer_destroy ( & output ) ; <nl> } <nl> <nl> int main ( int argc , char * * argv ) { <nl> int main ( int argc , char * * argv ) { <nl> for ( j = 0 ; j < GPR_ARRAY_SIZE ( uncompressed_split_modes ) ; j + + ) { <nl> for ( k = 0 ; k < GPR_ARRAY_SIZE ( compressed_split_modes ) ; k + + ) { <nl> for ( m = 0 ; m < TEST_VALUE_COUNT ; m + + ) { <nl> - gpr_slice slice = create_test_value ( m ) ; <nl> + grpc_slice slice = create_test_value ( m ) ; <nl> assert_passthrough ( slice , i , j , k , get_compressability ( m , i ) ) ; <nl> - gpr_slice_unref ( slice ) ; <nl> + grpc_slice_unref ( slice ) ; <nl> } <nl> } <nl> } <nl> mmm a / test / core / end2end / bad_server_response_test . c <nl> ppp b / test / core / end2end / bad_server_response_test . c <nl> struct rpc_state { <nl> grpc_channel * channel ; <nl> grpc_call * call ; <nl> size_t incoming_data_length ; <nl> - gpr_slice_buffer temp_incoming_buffer ; <nl> - gpr_slice_buffer outgoing_buffer ; <nl> + grpc_slice_buffer temp_incoming_buffer ; <nl> + grpc_slice_buffer outgoing_buffer ; <nl> grpc_endpoint * tcp ; <nl> gpr_atm done_atm ; <nl> bool write_done ; <nl> static void done_write ( grpc_exec_ctx * exec_ctx , void * arg , grpc_error * error ) { <nl> } <nl> <nl> static void handle_write ( grpc_exec_ctx * exec_ctx ) { <nl> - gpr_slice slice = gpr_slice_from_copied_buffer ( state . response_payload , <nl> + grpc_slice slice = grpc_slice_from_copied_buffer ( state . response_payload , <nl> state . response_payload_length ) ; <nl> <nl> - gpr_slice_buffer_reset_and_unref ( & state . outgoing_buffer ) ; <nl> - gpr_slice_buffer_add ( & state . outgoing_buffer , slice ) ; <nl> + grpc_slice_buffer_reset_and_unref ( & state . outgoing_buffer ) ; <nl> + grpc_slice_buffer_add ( & state . outgoing_buffer , slice ) ; <nl> grpc_endpoint_write ( exec_ctx , state . tcp , & state . outgoing_buffer , & on_write ) ; <nl> } <nl> <nl> static void on_connect ( grpc_exec_ctx * exec_ctx , void * arg , grpc_endpoint * tcp , <nl> test_tcp_server * server = arg ; <nl> grpc_closure_init ( & on_read , handle_read , NULL ) ; <nl> grpc_closure_init ( & on_write , done_write , NULL ) ; <nl> - gpr_slice_buffer_init ( & state . temp_incoming_buffer ) ; <nl> - gpr_slice_buffer_init ( & state . outgoing_buffer ) ; <nl> + grpc_slice_buffer_init ( & state . temp_incoming_buffer ) ; <nl> + grpc_slice_buffer_init ( & state . outgoing_buffer ) ; <nl> state . tcp = tcp ; <nl> state . incoming_data_length = 0 ; <nl> grpc_endpoint_add_to_pollset ( exec_ctx , tcp , server - > pollset ) ; <nl> static void start_rpc ( int target_port , grpc_status_code expected_status , <nl> <nl> static void cleanup_rpc ( void ) { <nl> grpc_event ev ; <nl> - gpr_slice_buffer_destroy ( & state . temp_incoming_buffer ) ; <nl> - gpr_slice_buffer_destroy ( & state . outgoing_buffer ) ; <nl> + grpc_slice_buffer_destroy ( & state . temp_incoming_buffer ) ; <nl> + grpc_slice_buffer_destroy ( & state . outgoing_buffer ) ; <nl> grpc_call_destroy ( state . call ) ; <nl> grpc_completion_queue_shutdown ( state . cq ) ; <nl> do { <nl> mmm a / test / core / end2end / cq_verifier . c <nl> ppp b / test / core / end2end / cq_verifier . c <nl> int contains_metadata ( grpc_metadata_array * array , const char * key , <nl> return has_metadata ( array - > metadata , array - > count , key , value ) ; <nl> } <nl> <nl> - static gpr_slice merge_slices ( gpr_slice * slices , size_t nslices ) { <nl> + static grpc_slice merge_slices ( grpc_slice * slices , size_t nslices ) { <nl> size_t i ; <nl> size_t len = 0 ; <nl> uint8_t * cursor ; <nl> - gpr_slice out ; <nl> + grpc_slice out ; <nl> <nl> for ( i = 0 ; i < nslices ; i + + ) { <nl> len + = GPR_SLICE_LENGTH ( slices [ i ] ) ; <nl> } <nl> <nl> - out = gpr_slice_malloc ( len ) ; <nl> + out = grpc_slice_malloc ( len ) ; <nl> cursor = GPR_SLICE_START_PTR ( out ) ; <nl> <nl> for ( i = 0 ; i < nslices ; i + + ) { <nl> static gpr_slice merge_slices ( gpr_slice * slices , size_t nslices ) { <nl> return out ; <nl> } <nl> <nl> - int raw_byte_buffer_eq_slice ( grpc_byte_buffer * rbb , gpr_slice b ) { <nl> - gpr_slice a ; <nl> + int raw_byte_buffer_eq_slice ( grpc_byte_buffer * rbb , grpc_slice b ) { <nl> + grpc_slice a ; <nl> int ok ; <nl> <nl> if ( ! rbb ) return 0 ; <nl> int raw_byte_buffer_eq_slice ( grpc_byte_buffer * rbb , gpr_slice b ) { <nl> ok = GPR_SLICE_LENGTH ( a ) = = GPR_SLICE_LENGTH ( b ) & & <nl> 0 = = memcmp ( GPR_SLICE_START_PTR ( a ) , GPR_SLICE_START_PTR ( b ) , <nl> GPR_SLICE_LENGTH ( a ) ) ; <nl> - gpr_slice_unref ( a ) ; <nl> - gpr_slice_unref ( b ) ; <nl> + grpc_slice_unref ( a ) ; <nl> + grpc_slice_unref ( b ) ; <nl> return ok ; <nl> } <nl> <nl> - int byte_buffer_eq_slice ( grpc_byte_buffer * bb , gpr_slice b ) { <nl> + int byte_buffer_eq_slice ( grpc_byte_buffer * bb , grpc_slice b ) { <nl> grpc_byte_buffer_reader reader ; <nl> grpc_byte_buffer * rbb ; <nl> int res ; <nl> int byte_buffer_eq_string ( grpc_byte_buffer * bb , const char * str ) { <nl> GPR_ASSERT ( grpc_byte_buffer_reader_init ( & reader , bb ) & & <nl> " Couldn ' t init byte buffer reader " ) ; <nl> rbb = grpc_raw_byte_buffer_from_reader ( & reader ) ; <nl> - res = raw_byte_buffer_eq_slice ( rbb , gpr_slice_from_copied_string ( str ) ) ; <nl> + res = raw_byte_buffer_eq_slice ( rbb , grpc_slice_from_copied_string ( str ) ) ; <nl> grpc_byte_buffer_reader_destroy ( & reader ) ; <nl> grpc_byte_buffer_destroy ( rbb ) ; <nl> <nl> mmm a / test / core / end2end / cq_verifier . h <nl> ppp b / test / core / end2end / cq_verifier . h <nl> void cq_expect_completion ( cq_verifier * v , const char * file , int line , void * tag , <nl> # define CQ_EXPECT_COMPLETION ( v , tag , success ) \ <nl> cq_expect_completion ( v , __FILE__ , __LINE__ , tag , success ) <nl> <nl> - int byte_buffer_eq_slice ( grpc_byte_buffer * bb , gpr_slice b ) ; <nl> + int byte_buffer_eq_slice ( grpc_byte_buffer * bb , grpc_slice b ) ; <nl> int byte_buffer_eq_string ( grpc_byte_buffer * byte_buffer , const char * string ) ; <nl> int contains_metadata ( grpc_metadata_array * array , const char * key , <nl> const char * value ) ; <nl> mmm a / test / core / end2end / dualstack_socket_test . c <nl> ppp b / test / core / end2end / dualstack_socket_test . c <nl> void test_connect ( const char * server_host , const char * client_host , int port , <nl> if ( client_host [ 0 ] = = ' i ' ) { <nl> / * for ipv4 : / ipv6 : addresses , concatenate the port to each of the parts * / <nl> size_t i ; <nl> - gpr_slice uri_slice ; <nl> - gpr_slice_buffer uri_parts ; <nl> + grpc_slice uri_slice ; <nl> + grpc_slice_buffer uri_parts ; <nl> char * * hosts_with_port ; <nl> <nl> uri_slice = <nl> - gpr_slice_new ( ( char * ) client_host , strlen ( client_host ) , do_nothing ) ; <nl> - gpr_slice_buffer_init ( & uri_parts ) ; <nl> - gpr_slice_split ( uri_slice , " , " , & uri_parts ) ; <nl> + grpc_slice_new ( ( char * ) client_host , strlen ( client_host ) , do_nothing ) ; <nl> + grpc_slice_buffer_init ( & uri_parts ) ; <nl> + grpc_slice_split ( uri_slice , " , " , & uri_parts ) ; <nl> hosts_with_port = gpr_malloc ( sizeof ( char * ) * uri_parts . count ) ; <nl> for ( i = 0 ; i < uri_parts . count ; i + + ) { <nl> char * uri_part_str = gpr_dump_slice ( uri_parts . slices [ i ] , GPR_DUMP_ASCII ) ; <nl> void test_connect ( const char * server_host , const char * client_host , int port , <nl> gpr_free ( hosts_with_port [ i ] ) ; <nl> } <nl> gpr_free ( hosts_with_port ) ; <nl> - gpr_slice_buffer_destroy ( & uri_parts ) ; <nl> - gpr_slice_unref ( uri_slice ) ; <nl> + grpc_slice_buffer_destroy ( & uri_parts ) ; <nl> + grpc_slice_unref ( uri_slice ) ; <nl> } else { <nl> gpr_join_host_port ( & client_hostport , client_host , port ) ; <nl> } <nl> mmm a / test / core / end2end / fake_resolver . c <nl> ppp b / test / core / end2end / fake_resolver . c <nl> static grpc_resolver * fake_resolver_create ( grpc_resolver_factory * factory , <nl> const bool lb_enabled = <nl> lb_enabled_qpart ! = NULL & & strcmp ( " 0 " , lb_enabled_qpart ) ! = 0 ; <nl> / / Construct addresses . <nl> - gpr_slice path_slice = <nl> - gpr_slice_new ( args - > uri - > path , strlen ( args - > uri - > path ) , do_nothing ) ; <nl> - gpr_slice_buffer path_parts ; <nl> - gpr_slice_buffer_init ( & path_parts ) ; <nl> - gpr_slice_split ( path_slice , " , " , & path_parts ) ; <nl> + grpc_slice path_slice = <nl> + grpc_slice_new ( args - > uri - > path , strlen ( args - > uri - > path ) , do_nothing ) ; <nl> + grpc_slice_buffer path_parts ; <nl> + grpc_slice_buffer_init ( & path_parts ) ; <nl> + grpc_slice_split ( path_slice , " , " , & path_parts ) ; <nl> grpc_lb_addresses * addresses = grpc_lb_addresses_create ( path_parts . count ) ; <nl> bool errors_found = false ; <nl> for ( size_t i = 0 ; i < addresses - > num_addresses ; i + + ) { <nl> static grpc_resolver * fake_resolver_create ( grpc_resolver_factory * factory , <nl> addresses - > addresses [ i ] . is_balancer = lb_enabled ; <nl> if ( errors_found ) break ; <nl> } <nl> - gpr_slice_buffer_destroy ( & path_parts ) ; <nl> - gpr_slice_unref ( path_slice ) ; <nl> + grpc_slice_buffer_destroy ( & path_parts ) ; <nl> + grpc_slice_unref ( path_slice ) ; <nl> if ( errors_found ) { <nl> grpc_lb_addresses_destroy ( addresses , NULL / * user_data_destroy * / ) ; <nl> return NULL ; <nl> mmm a / test / core / end2end / fixtures / http_proxy . c <nl> ppp b / test / core / end2end / fixtures / http_proxy . c <nl> typedef struct proxy_connection { <nl> grpc_closure on_server_read_done ; <nl> grpc_closure on_server_write_done ; <nl> <nl> - gpr_slice_buffer client_read_buffer ; <nl> - gpr_slice_buffer client_deferred_write_buffer ; <nl> - gpr_slice_buffer client_write_buffer ; <nl> - gpr_slice_buffer server_read_buffer ; <nl> - gpr_slice_buffer server_deferred_write_buffer ; <nl> - gpr_slice_buffer server_write_buffer ; <nl> + grpc_slice_buffer client_read_buffer ; <nl> + grpc_slice_buffer client_deferred_write_buffer ; <nl> + grpc_slice_buffer client_write_buffer ; <nl> + grpc_slice_buffer server_read_buffer ; <nl> + grpc_slice_buffer server_deferred_write_buffer ; <nl> + grpc_slice_buffer server_write_buffer ; <nl> <nl> grpc_http_parser http_parser ; <nl> grpc_http_request http_request ; <nl> static void proxy_connection_unref ( grpc_exec_ctx * exec_ctx , <nl> if ( conn - > server_endpoint ! = NULL ) <nl> grpc_endpoint_destroy ( exec_ctx , conn - > server_endpoint ) ; <nl> grpc_pollset_set_destroy ( conn - > pollset_set ) ; <nl> - gpr_slice_buffer_destroy ( & conn - > client_read_buffer ) ; <nl> - gpr_slice_buffer_destroy ( & conn - > client_deferred_write_buffer ) ; <nl> - gpr_slice_buffer_destroy ( & conn - > client_write_buffer ) ; <nl> - gpr_slice_buffer_destroy ( & conn - > server_read_buffer ) ; <nl> - gpr_slice_buffer_destroy ( & conn - > server_deferred_write_buffer ) ; <nl> - gpr_slice_buffer_destroy ( & conn - > server_write_buffer ) ; <nl> + grpc_slice_buffer_destroy ( & conn - > client_read_buffer ) ; <nl> + grpc_slice_buffer_destroy ( & conn - > client_deferred_write_buffer ) ; <nl> + grpc_slice_buffer_destroy ( & conn - > client_write_buffer ) ; <nl> + grpc_slice_buffer_destroy ( & conn - > server_read_buffer ) ; <nl> + grpc_slice_buffer_destroy ( & conn - > server_deferred_write_buffer ) ; <nl> + grpc_slice_buffer_destroy ( & conn - > server_write_buffer ) ; <nl> grpc_http_parser_destroy ( & conn - > http_parser ) ; <nl> grpc_http_request_destroy ( & conn - > http_request ) ; <nl> gpr_free ( conn ) ; <nl> static void on_client_write_done ( grpc_exec_ctx * exec_ctx , void * arg , <nl> return ; <nl> } <nl> / / Clear write buffer ( the data we just wrote ) . <nl> - gpr_slice_buffer_reset_and_unref ( & conn - > client_write_buffer ) ; <nl> + grpc_slice_buffer_reset_and_unref ( & conn - > client_write_buffer ) ; <nl> / / If more data was read from the server since we started this write , <nl> / / write that data now . <nl> if ( conn - > client_deferred_write_buffer . length > 0 ) { <nl> - gpr_slice_buffer_move_into ( & conn - > client_deferred_write_buffer , <nl> + grpc_slice_buffer_move_into ( & conn - > client_deferred_write_buffer , <nl> & conn - > client_write_buffer ) ; <nl> grpc_endpoint_write ( exec_ctx , conn - > client_endpoint , <nl> & conn - > client_write_buffer , <nl> static void on_server_write_done ( grpc_exec_ctx * exec_ctx , void * arg , <nl> return ; <nl> } <nl> / / Clear write buffer ( the data we just wrote ) . <nl> - gpr_slice_buffer_reset_and_unref ( & conn - > server_write_buffer ) ; <nl> + grpc_slice_buffer_reset_and_unref ( & conn - > server_write_buffer ) ; <nl> / / If more data was read from the client since we started this write , <nl> / / write that data now . <nl> if ( conn - > server_deferred_write_buffer . length > 0 ) { <nl> - gpr_slice_buffer_move_into ( & conn - > server_deferred_write_buffer , <nl> + grpc_slice_buffer_move_into ( & conn - > server_deferred_write_buffer , <nl> & conn - > server_write_buffer ) ; <nl> grpc_endpoint_write ( exec_ctx , conn - > server_endpoint , <nl> & conn - > server_write_buffer , <nl> static void on_client_read_done ( grpc_exec_ctx * exec_ctx , void * arg , <nl> / / <nl> / / Otherwise , move the read data into the write buffer and write it . <nl> if ( conn - > server_write_buffer . length > 0 ) { <nl> - gpr_slice_buffer_move_into ( & conn - > client_read_buffer , <nl> + grpc_slice_buffer_move_into ( & conn - > client_read_buffer , <nl> & conn - > server_deferred_write_buffer ) ; <nl> } else { <nl> - gpr_slice_buffer_move_into ( & conn - > client_read_buffer , <nl> + grpc_slice_buffer_move_into ( & conn - > client_read_buffer , <nl> & conn - > server_write_buffer ) ; <nl> gpr_ref ( & conn - > refcount ) ; <nl> grpc_endpoint_write ( exec_ctx , conn - > server_endpoint , <nl> static void on_server_read_done ( grpc_exec_ctx * exec_ctx , void * arg , <nl> / / <nl> / / Otherwise , move the read data into the write buffer and write it . <nl> if ( conn - > client_write_buffer . length > 0 ) { <nl> - gpr_slice_buffer_move_into ( & conn - > server_read_buffer , <nl> + grpc_slice_buffer_move_into ( & conn - > server_read_buffer , <nl> & conn - > client_deferred_write_buffer ) ; <nl> } else { <nl> - gpr_slice_buffer_move_into ( & conn - > server_read_buffer , <nl> + grpc_slice_buffer_move_into ( & conn - > server_read_buffer , <nl> & conn - > client_write_buffer ) ; <nl> gpr_ref ( & conn - > refcount ) ; <nl> grpc_endpoint_write ( exec_ctx , conn - > client_endpoint , <nl> static void on_write_response_done ( grpc_exec_ctx * exec_ctx , void * arg , <nl> return ; <nl> } <nl> / / Clear write buffer . <nl> - gpr_slice_buffer_reset_and_unref ( & conn - > client_write_buffer ) ; <nl> + grpc_slice_buffer_reset_and_unref ( & conn - > client_write_buffer ) ; <nl> / / Start reading from both client and server . One of the read <nl> / / requests inherits our ref to conn , but we need to take a new ref <nl> / / for the other one . <nl> static void on_server_connect_done ( grpc_exec_ctx * exec_ctx , void * arg , <nl> / / We ' ve established a connection , so send back a 200 response code to <nl> / / the client . <nl> / / The write callback inherits our reference to conn . <nl> - gpr_slice slice = <nl> - gpr_slice_from_copied_string ( " HTTP / 1 . 0 200 connected \ r \ n \ r \ n " ) ; <nl> - gpr_slice_buffer_add ( & conn - > client_write_buffer , slice ) ; <nl> + grpc_slice slice = <nl> + grpc_slice_from_copied_string ( " HTTP / 1 . 0 200 connected \ r \ n \ r \ n " ) ; <nl> + grpc_slice_buffer_add ( & conn - > client_write_buffer , slice ) ; <nl> grpc_endpoint_write ( exec_ctx , conn - > client_endpoint , <nl> & conn - > client_write_buffer , <nl> & conn - > on_write_response_done ) ; <nl> static void on_read_request_done ( grpc_exec_ctx * exec_ctx , void * arg , <nl> } <nl> } <nl> } <nl> - gpr_slice_buffer_reset_and_unref ( & conn - > client_read_buffer ) ; <nl> + grpc_slice_buffer_reset_and_unref ( & conn - > client_read_buffer ) ; <nl> / / If we ' re not done reading the request , read more data . <nl> if ( conn - > http_parser . state ! = GRPC_HTTP_BODY ) { <nl> grpc_endpoint_read ( exec_ctx , conn - > client_endpoint , <nl> static void on_accept ( grpc_exec_ctx * exec_ctx , void * arg , <nl> grpc_closure_init ( & conn - > on_client_write_done , on_client_write_done , conn ) ; <nl> grpc_closure_init ( & conn - > on_server_read_done , on_server_read_done , conn ) ; <nl> grpc_closure_init ( & conn - > on_server_write_done , on_server_write_done , conn ) ; <nl> - gpr_slice_buffer_init ( & conn - > client_read_buffer ) ; <nl> - gpr_slice_buffer_init ( & conn - > client_deferred_write_buffer ) ; <nl> - gpr_slice_buffer_init ( & conn - > client_write_buffer ) ; <nl> - gpr_slice_buffer_init ( & conn - > server_read_buffer ) ; <nl> - gpr_slice_buffer_init ( & conn - > server_deferred_write_buffer ) ; <nl> - gpr_slice_buffer_init ( & conn - > server_write_buffer ) ; <nl> + grpc_slice_buffer_init ( & conn - > client_read_buffer ) ; <nl> + grpc_slice_buffer_init ( & conn - > client_deferred_write_buffer ) ; <nl> + grpc_slice_buffer_init ( & conn - > client_write_buffer ) ; <nl> + grpc_slice_buffer_init ( & conn - > server_read_buffer ) ; <nl> + grpc_slice_buffer_init ( & conn - > server_deferred_write_buffer ) ; <nl> + grpc_slice_buffer_init ( & conn - > server_write_buffer ) ; <nl> grpc_http_parser_init ( & conn - > http_parser , GRPC_HTTP_REQUEST , <nl> & conn - > http_request ) ; <nl> grpc_endpoint_read ( exec_ctx , conn - > client_endpoint , & conn - > client_read_buffer , <nl> mmm a / test / core / end2end / fuzzers / api_fuzzer . c <nl> ppp b / test / core / end2end / fuzzers / api_fuzzer . c <nl> static uint32_t read_uint32 ( input_stream * inp ) { <nl> } <nl> <nl> static grpc_byte_buffer * read_message ( input_stream * inp ) { <nl> - gpr_slice slice = gpr_slice_malloc ( read_uint22 ( inp ) ) ; <nl> + grpc_slice slice = grpc_slice_malloc ( read_uint22 ( inp ) ) ; <nl> memset ( GPR_SLICE_START_PTR ( slice ) , 0 , GPR_SLICE_LENGTH ( slice ) ) ; <nl> grpc_byte_buffer * out = grpc_raw_byte_buffer_create ( & slice , 1 ) ; <nl> - gpr_slice_unref ( slice ) ; <nl> + grpc_slice_unref ( slice ) ; <nl> return out ; <nl> } <nl> <nl> mmm a / test / core / end2end / fuzzers / client_fuzzer . c <nl> ppp b / test / core / end2end / fuzzers / client_fuzzer . c <nl> <nl> bool squelch = true ; <nl> bool leak_check = true ; <nl> <nl> - static void discard_write ( gpr_slice slice ) { } <nl> + static void discard_write ( grpc_slice slice ) { } <nl> <nl> static void * tag ( int n ) { return ( void * ) ( uintptr_t ) n ; } <nl> <nl> int LLVMFuzzerTestOneInput ( const uint8_t * data , size_t size ) { <nl> <nl> grpc_mock_endpoint_put_read ( <nl> & exec_ctx , mock_endpoint , <nl> - gpr_slice_from_copied_buffer ( ( const char * ) data , size ) ) ; <nl> + grpc_slice_from_copied_buffer ( ( const char * ) data , size ) ) ; <nl> <nl> grpc_event ev ; <nl> while ( 1 ) { <nl> mmm a / test / core / end2end / fuzzers / server_fuzzer . c <nl> ppp b / test / core / end2end / fuzzers / server_fuzzer . c <nl> <nl> bool squelch = true ; <nl> bool leak_check = true ; <nl> <nl> - static void discard_write ( gpr_slice slice ) { } <nl> + static void discard_write ( grpc_slice slice ) { } <nl> <nl> static void * tag ( int n ) { return ( void * ) ( uintptr_t ) n ; } <nl> static int detag ( void * p ) { return ( int ) ( uintptr_t ) p ; } <nl> int LLVMFuzzerTestOneInput ( const uint8_t * data , size_t size ) { <nl> grpc_resource_quota_internal_unref ( & exec_ctx , resource_quota ) ; <nl> grpc_mock_endpoint_put_read ( <nl> & exec_ctx , mock_endpoint , <nl> - gpr_slice_from_copied_buffer ( ( const char * ) data , size ) ) ; <nl> + grpc_slice_from_copied_buffer ( ( const char * ) data , size ) ) ; <nl> <nl> grpc_server * server = grpc_server_create ( NULL , NULL ) ; <nl> grpc_completion_queue * cq = grpc_completion_queue_create ( NULL ) ; <nl> mmm a / test / core / end2end / invalid_call_argument_test . c <nl> ppp b / test / core / end2end / invalid_call_argument_test . c <nl> static void test_send_messages_at_the_same_time ( ) { <nl> gpr_log ( GPR_INFO , " test_send_messages_at_the_same_time " ) ; <nl> <nl> grpc_op * op ; <nl> - gpr_slice request_payload_slice = gpr_slice_from_copied_string ( " hello world " ) ; <nl> + grpc_slice request_payload_slice = grpc_slice_from_copied_string ( " hello world " ) ; <nl> grpc_byte_buffer * request_payload = <nl> grpc_raw_byte_buffer_create ( & request_payload_slice , 1 ) ; <nl> prepare_test ( 1 ) ; <nl> mmm a / test / core / end2end / tests / binary_metadata . c <nl> ppp b / test / core / end2end / tests / binary_metadata . c <nl> static void test_request_response_with_metadata_and_payload ( <nl> grpc_end2end_test_config config ) { <nl> grpc_call * c ; <nl> grpc_call * s ; <nl> - gpr_slice request_payload_slice = gpr_slice_from_copied_string ( " hello world " ) ; <nl> - gpr_slice response_payload_slice = gpr_slice_from_copied_string ( " hello you " ) ; <nl> + grpc_slice request_payload_slice = grpc_slice_from_copied_string ( " hello world " ) ; <nl> + grpc_slice response_payload_slice = grpc_slice_from_copied_string ( " hello you " ) ; <nl> grpc_byte_buffer * request_payload = <nl> grpc_raw_byte_buffer_create ( & request_payload_slice , 1 ) ; <nl> grpc_byte_buffer * response_payload = <nl> mmm a / test / core / end2end / tests / call_creds . c <nl> ppp b / test / core / end2end / tests / call_creds . c <nl> static void request_response_with_payload_and_call_creds ( <nl> override_mode mode ) { <nl> grpc_call * c ; <nl> grpc_call * s ; <nl> - gpr_slice request_payload_slice = gpr_slice_from_copied_string ( " hello world " ) ; <nl> - gpr_slice response_payload_slice = gpr_slice_from_copied_string ( " hello you " ) ; <nl> + grpc_slice request_payload_slice = grpc_slice_from_copied_string ( " hello world " ) ; <nl> + grpc_slice response_payload_slice = grpc_slice_from_copied_string ( " hello you " ) ; <nl> grpc_byte_buffer * request_payload = <nl> grpc_raw_byte_buffer_create ( & request_payload_slice , 1 ) ; <nl> grpc_byte_buffer * response_payload = <nl> static void test_request_with_server_rejecting_client_creds ( <nl> char * details = NULL ; <nl> size_t details_capacity = 0 ; <nl> grpc_byte_buffer * response_payload_recv = NULL ; <nl> - gpr_slice request_payload_slice = gpr_slice_from_copied_string ( " hello world " ) ; <nl> + grpc_slice request_payload_slice = grpc_slice_from_copied_string ( " hello world " ) ; <nl> grpc_byte_buffer * request_payload = <nl> grpc_raw_byte_buffer_create ( & request_payload_slice , 1 ) ; <nl> grpc_call_credentials * creds ; <nl> mmm a / test / core / end2end / tests / cancel_after_accept . c <nl> ppp b / test / core / end2end / tests / cancel_after_accept . c <nl> static void test_cancel_after_accept ( grpc_end2end_test_config config , <nl> size_t details_capacity = 0 ; <nl> grpc_byte_buffer * request_payload_recv = NULL ; <nl> grpc_byte_buffer * response_payload_recv = NULL ; <nl> - gpr_slice request_payload_slice = gpr_slice_from_copied_string ( " hello world " ) ; <nl> - gpr_slice response_payload_slice = gpr_slice_from_copied_string ( " hello you " ) ; <nl> + grpc_slice request_payload_slice = grpc_slice_from_copied_string ( " hello world " ) ; <nl> + grpc_slice response_payload_slice = grpc_slice_from_copied_string ( " hello you " ) ; <nl> grpc_byte_buffer * request_payload = <nl> grpc_raw_byte_buffer_create ( & request_payload_slice , 1 ) ; <nl> grpc_byte_buffer * response_payload = <nl> mmm a / test / core / end2end / tests / cancel_after_client_done . c <nl> ppp b / test / core / end2end / tests / cancel_after_client_done . c <nl> static void test_cancel_after_accept_and_writes_closed ( <nl> size_t details_capacity = 0 ; <nl> grpc_byte_buffer * request_payload_recv = NULL ; <nl> grpc_byte_buffer * response_payload_recv = NULL ; <nl> - gpr_slice request_payload_slice = gpr_slice_from_copied_string ( " hello world " ) ; <nl> - gpr_slice response_payload_slice = gpr_slice_from_copied_string ( " hello you " ) ; <nl> + grpc_slice request_payload_slice = grpc_slice_from_copied_string ( " hello world " ) ; <nl> + grpc_slice response_payload_slice = grpc_slice_from_copied_string ( " hello you " ) ; <nl> grpc_byte_buffer * request_payload = <nl> grpc_raw_byte_buffer_create ( & request_payload_slice , 1 ) ; <nl> grpc_byte_buffer * response_payload = <nl> mmm a / test / core / end2end / tests / cancel_after_invoke . c <nl> ppp b / test / core / end2end / tests / cancel_after_invoke . c <nl> static void test_cancel_after_invoke ( grpc_end2end_test_config config , <nl> char * details = NULL ; <nl> size_t details_capacity = 0 ; <nl> grpc_byte_buffer * response_payload_recv = NULL ; <nl> - gpr_slice request_payload_slice = gpr_slice_from_copied_string ( " hello world " ) ; <nl> + grpc_slice request_payload_slice = grpc_slice_from_copied_string ( " hello world " ) ; <nl> grpc_byte_buffer * request_payload = <nl> grpc_raw_byte_buffer_create ( & request_payload_slice , 1 ) ; <nl> <nl> mmm a / test / core / end2end / tests / cancel_before_invoke . c <nl> ppp b / test / core / end2end / tests / cancel_before_invoke . c <nl> static void test_cancel_before_invoke ( grpc_end2end_test_config config , <nl> char * details = NULL ; <nl> size_t details_capacity = 0 ; <nl> grpc_byte_buffer * response_payload_recv = NULL ; <nl> - gpr_slice request_payload_slice = gpr_slice_from_copied_string ( " hello world " ) ; <nl> + grpc_slice request_payload_slice = grpc_slice_from_copied_string ( " hello world " ) ; <nl> grpc_byte_buffer * request_payload = <nl> grpc_raw_byte_buffer_create ( & request_payload_slice , 1 ) ; <nl> <nl> mmm a / test / core / end2end / tests / compressed_payload . c <nl> ppp b / test / core / end2end / tests / compressed_payload . c <nl> static void request_for_disabled_algorithm ( <nl> grpc_status_code expected_error , grpc_metadata * client_metadata ) { <nl> grpc_call * c ; <nl> grpc_call * s ; <nl> - gpr_slice request_payload_slice ; <nl> + grpc_slice request_payload_slice ; <nl> grpc_byte_buffer * request_payload ; <nl> gpr_timespec deadline = five_seconds_time ( ) ; <nl> grpc_channel_args * client_args ; <nl> static void request_for_disabled_algorithm ( <nl> <nl> memset ( str , ' x ' , 1023 ) ; <nl> str [ 1023 ] = ' \ 0 ' ; <nl> - request_payload_slice = gpr_slice_from_copied_string ( str ) ; <nl> + request_payload_slice = grpc_slice_from_copied_string ( str ) ; <nl> request_payload = grpc_raw_byte_buffer_create ( & request_payload_slice , 1 ) ; <nl> <nl> client_args = grpc_channel_args_set_compression_algorithm ( <nl> static void request_for_disabled_algorithm ( <nl> <nl> cq_verifier_destroy ( cqv ) ; <nl> <nl> - gpr_slice_unref ( request_payload_slice ) ; <nl> + grpc_slice_unref ( request_payload_slice ) ; <nl> grpc_byte_buffer_destroy ( request_payload ) ; <nl> grpc_byte_buffer_destroy ( request_payload_recv ) ; <nl> <nl> static void request_with_payload_template ( <nl> grpc_compression_level server_compression_level ) { <nl> grpc_call * c ; <nl> grpc_call * s ; <nl> - gpr_slice request_payload_slice ; <nl> + grpc_slice request_payload_slice ; <nl> grpc_byte_buffer * request_payload ; <nl> gpr_timespec deadline = five_seconds_time ( ) ; <nl> grpc_channel_args * client_args ; <nl> static void request_with_payload_template ( <nl> memset ( response_str , ' y ' , 1023 ) ; <nl> response_str [ 1023 ] = ' \ 0 ' ; <nl> <nl> - request_payload_slice = gpr_slice_from_copied_string ( request_str ) ; <nl> - gpr_slice response_payload_slice = gpr_slice_from_copied_string ( response_str ) ; <nl> + request_payload_slice = grpc_slice_from_copied_string ( request_str ) ; <nl> + grpc_slice response_payload_slice = grpc_slice_from_copied_string ( response_str ) ; <nl> <nl> client_args = grpc_channel_args_set_compression_algorithm ( <nl> NULL , default_client_channel_compression_algorithm ) ; <nl> static void request_with_payload_template ( <nl> grpc_byte_buffer_destroy ( response_payload_recv ) ; <nl> } <nl> <nl> - gpr_slice_unref ( request_payload_slice ) ; <nl> - gpr_slice_unref ( response_payload_slice ) ; <nl> + grpc_slice_unref ( request_payload_slice ) ; <nl> + grpc_slice_unref ( response_payload_slice ) ; <nl> <nl> memset ( ops , 0 , sizeof ( ops ) ) ; <nl> op = ops ; <nl> mmm a / test / core / end2end / tests / filter_call_init_fails . c <nl> ppp b / test / core / end2end / tests / filter_call_init_fails . c <nl> static void end_test ( grpc_end2end_test_fixture * f ) { <nl> static void test_request ( grpc_end2end_test_config config ) { <nl> grpc_call * c ; <nl> grpc_call * s ; <nl> - gpr_slice request_payload_slice = gpr_slice_from_copied_string ( " hello world " ) ; <nl> + grpc_slice request_payload_slice = grpc_slice_from_copied_string ( " hello world " ) ; <nl> grpc_byte_buffer * request_payload = <nl> grpc_raw_byte_buffer_create ( & request_payload_slice , 1 ) ; <nl> gpr_timespec deadline = five_seconds_time ( ) ; <nl> mmm a / test / core / end2end / tests / filter_causes_close . c <nl> ppp b / test / core / end2end / tests / filter_causes_close . c <nl> static void end_test ( grpc_end2end_test_fixture * f ) { <nl> static void test_request ( grpc_end2end_test_config config ) { <nl> grpc_call * c ; <nl> grpc_call * s ; <nl> - gpr_slice request_payload_slice = gpr_slice_from_copied_string ( " hello world " ) ; <nl> + grpc_slice request_payload_slice = grpc_slice_from_copied_string ( " hello world " ) ; <nl> grpc_byte_buffer * request_payload = <nl> grpc_raw_byte_buffer_create ( & request_payload_slice , 1 ) ; <nl> gpr_timespec deadline = five_seconds_time ( ) ; <nl> static void recv_im_ready ( grpc_exec_ctx * exec_ctx , void * arg , <nl> call_data * calld = elem - > call_data ; <nl> if ( error = = GRPC_ERROR_NONE ) { <nl> / / close the stream with an error . <nl> - gpr_slice message = <nl> - gpr_slice_from_copied_string ( " Failure that ' s not preventable . " ) ; <nl> + grpc_slice message = <nl> + grpc_slice_from_copied_string ( " Failure that ' s not preventable . " ) ; <nl> grpc_transport_stream_op * op = grpc_make_transport_stream_op ( NULL ) ; <nl> grpc_transport_stream_op_add_close ( op , GRPC_STATUS_PERMISSION_DENIED , <nl> & message ) ; <nl> mmm a / test / core / end2end / tests / invoke_large_request . c <nl> ppp b / test / core / end2end / tests / invoke_large_request . c <nl> static void end_test ( grpc_end2end_test_fixture * f ) { <nl> grpc_completion_queue_destroy ( f - > cq ) ; <nl> } <nl> <nl> - static gpr_slice large_slice ( void ) { <nl> - gpr_slice slice = gpr_slice_malloc ( 1000000 ) ; <nl> + static grpc_slice large_slice ( void ) { <nl> + grpc_slice slice = grpc_slice_malloc ( 1000000 ) ; <nl> memset ( GPR_SLICE_START_PTR ( slice ) , ' x ' , GPR_SLICE_LENGTH ( slice ) ) ; <nl> return slice ; <nl> } <nl> static void test_invoke_large_request ( grpc_end2end_test_config config , <nl> begin_test ( config , name , & channel_args , & channel_args ) ; <nl> gpr_free ( name ) ; <nl> <nl> - gpr_slice request_payload_slice = large_slice ( ) ; <nl> - gpr_slice response_payload_slice = large_slice ( ) ; <nl> + grpc_slice request_payload_slice = large_slice ( ) ; <nl> + grpc_slice response_payload_slice = large_slice ( ) ; <nl> grpc_call * c ; <nl> grpc_call * s ; <nl> grpc_byte_buffer * request_payload = <nl> static void test_invoke_large_request ( grpc_end2end_test_config config , <nl> grpc_byte_buffer_destroy ( response_payload ) ; <nl> grpc_byte_buffer_destroy ( request_payload_recv ) ; <nl> grpc_byte_buffer_destroy ( response_payload_recv ) ; <nl> - gpr_slice_unref ( request_payload_slice ) ; <nl> - gpr_slice_unref ( response_payload_slice ) ; <nl> + grpc_slice_unref ( request_payload_slice ) ; <nl> + grpc_slice_unref ( response_payload_slice ) ; <nl> <nl> end_test ( & f ) ; <nl> config . tear_down_data ( & f ) ; <nl> mmm a / test / core / end2end / tests / large_metadata . c <nl> ppp b / test / core / end2end / tests / large_metadata . c <nl> static void end_test ( grpc_end2end_test_fixture * f ) { <nl> static void test_request_with_large_metadata ( grpc_end2end_test_config config ) { <nl> grpc_call * c ; <nl> grpc_call * s ; <nl> - gpr_slice request_payload_slice = gpr_slice_from_copied_string ( " hello world " ) ; <nl> + grpc_slice request_payload_slice = grpc_slice_from_copied_string ( " hello world " ) ; <nl> grpc_byte_buffer * request_payload = <nl> grpc_raw_byte_buffer_create ( & request_payload_slice , 1 ) ; <nl> gpr_timespec deadline = five_seconds_time ( ) ; <nl> mmm a / test / core / end2end / tests / load_reporting_hook . c <nl> ppp b / test / core / end2end / tests / load_reporting_hook . c <nl> static void request_response_with_payload ( grpc_end2end_test_fixture f , <nl> const char * response_msg , <nl> grpc_metadata * initial_lr_metadata , <nl> grpc_metadata * trailing_lr_metadata ) { <nl> - gpr_slice request_payload_slice = gpr_slice_from_static_string ( request_msg ) ; <nl> - gpr_slice response_payload_slice = gpr_slice_from_static_string ( response_msg ) ; <nl> + grpc_slice request_payload_slice = grpc_slice_from_static_string ( request_msg ) ; <nl> + grpc_slice response_payload_slice = grpc_slice_from_static_string ( response_msg ) ; <nl> grpc_call * c ; <nl> grpc_call * s ; <nl> grpc_byte_buffer * request_payload = <nl> mmm a / test / core / end2end / tests / max_message_length . c <nl> ppp b / test / core / end2end / tests / max_message_length . c <nl> static void test_max_message_length_on_request ( grpc_end2end_test_config config , <nl> cq_verifier * cqv ; <nl> grpc_op ops [ 6 ] ; <nl> grpc_op * op ; <nl> - gpr_slice request_payload_slice = gpr_slice_from_copied_string ( " hello world " ) ; <nl> + grpc_slice request_payload_slice = grpc_slice_from_copied_string ( " hello world " ) ; <nl> grpc_byte_buffer * request_payload = <nl> grpc_raw_byte_buffer_create ( & request_payload_slice , 1 ) ; <nl> grpc_byte_buffer * recv_payload = NULL ; <nl> static void test_max_message_length_on_response ( grpc_end2end_test_config config , <nl> cq_verifier * cqv ; <nl> grpc_op ops [ 6 ] ; <nl> grpc_op * op ; <nl> - gpr_slice response_payload_slice = <nl> - gpr_slice_from_copied_string ( " hello world " ) ; <nl> + grpc_slice response_payload_slice = <nl> + grpc_slice_from_copied_string ( " hello world " ) ; <nl> grpc_byte_buffer * response_payload = <nl> grpc_raw_byte_buffer_create ( & response_payload_slice , 1 ) ; <nl> grpc_byte_buffer * recv_payload = NULL ; <nl> mmm a / test / core / end2end / tests / network_status_change . c <nl> ppp b / test / core / end2end / tests / network_status_change . c <nl> static void end_test ( grpc_end2end_test_fixture * f ) { <nl> static void test_invoke_network_status_change ( grpc_end2end_test_config config ) { <nl> grpc_call * c ; <nl> grpc_call * s ; <nl> - gpr_slice request_payload_slice = gpr_slice_from_copied_string ( " hello world " ) ; <nl> + grpc_slice request_payload_slice = grpc_slice_from_copied_string ( " hello world " ) ; <nl> grpc_byte_buffer * request_payload = <nl> grpc_raw_byte_buffer_create ( & request_payload_slice , 1 ) ; <nl> gpr_timespec deadline = five_seconds_time ( ) ; <nl> mmm a / test / core / end2end / tests / payload . c <nl> ppp b / test / core / end2end / tests / payload . c <nl> static void end_test ( grpc_end2end_test_fixture * f ) { <nl> grpc_completion_queue_destroy ( f - > cq ) ; <nl> } <nl> <nl> - / * Creates and returns a gpr_slice containing random alphanumeric characters . * / <nl> - static gpr_slice generate_random_slice ( ) { <nl> + / * Creates and returns a grpc_slice containing random alphanumeric characters . * / <nl> + static grpc_slice generate_random_slice ( ) { <nl> size_t i ; <nl> static const char chars [ ] = " abcdefghijklmnopqrstuvwxyz1234567890 " ; <nl> char * output ; <nl> static gpr_slice generate_random_slice ( ) { <nl> output [ i ] = chars [ rand ( ) % ( int ) ( sizeof ( chars ) - 1 ) ] ; <nl> } <nl> output [ output_size - 1 ] = ' \ 0 ' ; <nl> - gpr_slice out = gpr_slice_from_copied_string ( output ) ; <nl> + grpc_slice out = grpc_slice_from_copied_string ( output ) ; <nl> gpr_free ( output ) ; <nl> return out ; <nl> } <nl> static void request_response_with_payload ( grpc_end2end_test_fixture f ) { <nl> / * Create large request and response bodies . These are big enough to require <nl> * multiple round trips to deliver to the peer , and their exact contents of <nl> * will be verified on completion . * / <nl> - gpr_slice request_payload_slice = generate_random_slice ( ) ; <nl> - gpr_slice response_payload_slice = generate_random_slice ( ) ; <nl> + grpc_slice request_payload_slice = generate_random_slice ( ) ; <nl> + grpc_slice response_payload_slice = generate_random_slice ( ) ; <nl> <nl> grpc_call * c ; <nl> grpc_call * s ; <nl> mmm a / test / core / end2end / tests / ping_pong_streaming . c <nl> ppp b / test / core / end2end / tests / ping_pong_streaming . c <nl> static void test_pingpong_streaming ( grpc_end2end_test_config config , <nl> grpc_byte_buffer * response_payload ; <nl> grpc_byte_buffer * response_payload_recv ; <nl> int i ; <nl> - gpr_slice request_payload_slice = gpr_slice_from_copied_string ( " hello world " ) ; <nl> - gpr_slice response_payload_slice = gpr_slice_from_copied_string ( " hello you " ) ; <nl> + grpc_slice request_payload_slice = grpc_slice_from_copied_string ( " hello world " ) ; <nl> + grpc_slice response_payload_slice = grpc_slice_from_copied_string ( " hello you " ) ; <nl> <nl> c = grpc_channel_create_call ( f . client , NULL , GRPC_PROPAGATE_DEFAULTS , f . cq , <nl> " / foo " , " foo . test . google . fr : 1234 " , deadline , <nl> static void test_pingpong_streaming ( grpc_end2end_test_config config , <nl> grpc_byte_buffer_destroy ( response_payload_recv ) ; <nl> } <nl> <nl> - gpr_slice_unref ( request_payload_slice ) ; <nl> - gpr_slice_unref ( response_payload_slice ) ; <nl> + grpc_slice_unref ( request_payload_slice ) ; <nl> + grpc_slice_unref ( response_payload_slice ) ; <nl> <nl> memset ( ops , 0 , sizeof ( ops ) ) ; <nl> op = ops ; <nl> mmm a / test / core / end2end / tests / request_with_flags . c <nl> ppp b / test / core / end2end / tests / request_with_flags . c <nl> static void test_invoke_request_with_flags ( <nl> grpc_end2end_test_config config , uint32_t * flags_for_op , <nl> grpc_call_error call_start_batch_expected_result ) { <nl> grpc_call * c ; <nl> - gpr_slice request_payload_slice = gpr_slice_from_copied_string ( " hello world " ) ; <nl> + grpc_slice request_payload_slice = grpc_slice_from_copied_string ( " hello world " ) ; <nl> grpc_byte_buffer * request_payload = <nl> grpc_raw_byte_buffer_create ( & request_payload_slice , 1 ) ; <nl> gpr_timespec deadline = five_seconds_time ( ) ; <nl> mmm a / test / core / end2end / tests / request_with_payload . c <nl> ppp b / test / core / end2end / tests / request_with_payload . c <nl> static void end_test ( grpc_end2end_test_fixture * f ) { <nl> static void test_invoke_request_with_payload ( grpc_end2end_test_config config ) { <nl> grpc_call * c ; <nl> grpc_call * s ; <nl> - gpr_slice request_payload_slice = gpr_slice_from_copied_string ( " hello world " ) ; <nl> + grpc_slice request_payload_slice = grpc_slice_from_copied_string ( " hello world " ) ; <nl> grpc_byte_buffer * request_payload = <nl> grpc_raw_byte_buffer_create ( & request_payload_slice , 1 ) ; <nl> gpr_timespec deadline = five_seconds_time ( ) ; <nl> mmm a / test / core / end2end / tests / resource_quota_server . c <nl> ppp b / test / core / end2end / tests / resource_quota_server . c <nl> static void end_test ( grpc_end2end_test_fixture * f ) { <nl> grpc_completion_queue_destroy ( f - > cq ) ; <nl> } <nl> <nl> - / * Creates and returns a gpr_slice containing random alphanumeric characters . * / <nl> - static gpr_slice generate_random_slice ( ) { <nl> + / * Creates and returns a grpc_slice containing random alphanumeric characters . * / <nl> + static grpc_slice generate_random_slice ( ) { <nl> size_t i ; <nl> static const char chars [ ] = " abcdefghijklmnopqrstuvwxyz1234567890 " ; <nl> char output [ 1024 * 1024 ] ; <nl> static gpr_slice generate_random_slice ( ) { <nl> output [ i ] = chars [ rand ( ) % ( int ) ( sizeof ( chars ) - 1 ) ] ; <nl> } <nl> output [ GPR_ARRAY_SIZE ( output ) - 1 ] = ' \ 0 ' ; <nl> - return gpr_slice_from_copied_string ( output ) ; <nl> + return grpc_slice_from_copied_string ( output ) ; <nl> } <nl> <nl> void resource_quota_server ( grpc_end2end_test_config config ) { <nl> void resource_quota_server ( grpc_end2end_test_config config ) { <nl> / * Create large request and response bodies . These are big enough to require <nl> * multiple round trips to deliver to the peer , and their exact contents of <nl> * will be verified on completion . * / <nl> - gpr_slice request_payload_slice = generate_random_slice ( ) ; <nl> + grpc_slice request_payload_slice = generate_random_slice ( ) ; <nl> <nl> grpc_call * client_calls [ NUM_CALLS ] ; <nl> grpc_call * server_calls [ NUM_CALLS ] ; <nl> void resource_quota_server ( grpc_end2end_test_config config ) { <nl> GPR_ASSERT ( cancelled_calls_on_server > = 0 . 9 * cancelled_calls_on_client ) ; <nl> <nl> grpc_byte_buffer_destroy ( request_payload ) ; <nl> - gpr_slice_unref ( request_payload_slice ) ; <nl> + grpc_slice_unref ( request_payload_slice ) ; <nl> grpc_resource_quota_unref ( resource_quota ) ; <nl> <nl> end_test ( & f ) ; <nl> mmm a / test / core / end2end / tests / simple_cacheable_request . c <nl> ppp b / test / core / end2end / tests / simple_cacheable_request . c <nl> static void test_cacheable_request_response_with_metadata_and_payload ( <nl> grpc_end2end_test_config config ) { <nl> grpc_call * c ; <nl> grpc_call * s ; <nl> - gpr_slice request_payload_slice = gpr_slice_from_copied_string ( " hello world " ) ; <nl> - gpr_slice response_payload_slice = gpr_slice_from_copied_string ( " hello you " ) ; <nl> + grpc_slice request_payload_slice = grpc_slice_from_copied_string ( " hello world " ) ; <nl> + grpc_slice response_payload_slice = grpc_slice_from_copied_string ( " hello you " ) ; <nl> grpc_byte_buffer * request_payload = <nl> grpc_raw_byte_buffer_create ( & request_payload_slice , 1 ) ; <nl> grpc_byte_buffer * response_payload = <nl> mmm a / test / core / end2end / tests / simple_metadata . c <nl> ppp b / test / core / end2end / tests / simple_metadata . c <nl> static void test_request_response_with_metadata_and_payload ( <nl> grpc_end2end_test_config config ) { <nl> grpc_call * c ; <nl> grpc_call * s ; <nl> - gpr_slice request_payload_slice = gpr_slice_from_copied_string ( " hello world " ) ; <nl> - gpr_slice response_payload_slice = gpr_slice_from_copied_string ( " hello you " ) ; <nl> + grpc_slice request_payload_slice = grpc_slice_from_copied_string ( " hello world " ) ; <nl> + grpc_slice response_payload_slice = grpc_slice_from_copied_string ( " hello you " ) ; <nl> grpc_byte_buffer * request_payload = <nl> grpc_raw_byte_buffer_create ( & request_payload_slice , 1 ) ; <nl> grpc_byte_buffer * response_payload = <nl> mmm a / test / core / end2end / tests / streaming_error_response . c <nl> ppp b / test / core / end2end / tests / streaming_error_response . c <nl> static void end_test ( grpc_end2end_test_fixture * f ) { <nl> static void test ( grpc_end2end_test_config config , bool request_status_early ) { <nl> grpc_call * c ; <nl> grpc_call * s ; <nl> - gpr_slice response_payload1_slice = gpr_slice_from_copied_string ( " hello " ) ; <nl> + grpc_slice response_payload1_slice = grpc_slice_from_copied_string ( " hello " ) ; <nl> grpc_byte_buffer * response_payload1 = <nl> grpc_raw_byte_buffer_create ( & response_payload1_slice , 1 ) ; <nl> - gpr_slice response_payload2_slice = gpr_slice_from_copied_string ( " world " ) ; <nl> + grpc_slice response_payload2_slice = grpc_slice_from_copied_string ( " world " ) ; <nl> grpc_byte_buffer * response_payload2 = <nl> grpc_raw_byte_buffer_create ( & response_payload2_slice , 1 ) ; <nl> gpr_timespec deadline = five_seconds_time ( ) ; <nl> mmm a / test / core / end2end / tests / trailing_metadata . c <nl> ppp b / test / core / end2end / tests / trailing_metadata . c <nl> static void test_request_response_with_metadata_and_payload ( <nl> grpc_end2end_test_config config ) { <nl> grpc_call * c ; <nl> grpc_call * s ; <nl> - gpr_slice request_payload_slice = gpr_slice_from_copied_string ( " hello world " ) ; <nl> - gpr_slice response_payload_slice = gpr_slice_from_copied_string ( " hello you " ) ; <nl> + grpc_slice request_payload_slice = grpc_slice_from_copied_string ( " hello world " ) ; <nl> + grpc_slice response_payload_slice = grpc_slice_from_copied_string ( " hello you " ) ; <nl> grpc_byte_buffer * request_payload = <nl> grpc_raw_byte_buffer_create ( & request_payload_slice , 1 ) ; <nl> grpc_byte_buffer * response_payload = <nl> mmm a / test / core / fling / client . c <nl> ppp b / test / core / fling / client . c <nl> static const scenario scenarios [ ] = { <nl> } ; <nl> <nl> int main ( int argc , char * * argv ) { <nl> - gpr_slice slice = gpr_slice_from_copied_string ( " x " ) ; <nl> + grpc_slice slice = grpc_slice_from_copied_string ( " x " ) ; <nl> double start , stop ; <nl> unsigned i ; <nl> <nl> int main ( int argc , char * * argv ) { <nl> } while ( event . type ! = GRPC_QUEUE_SHUTDOWN ) ; <nl> grpc_completion_queue_destroy ( cq ) ; <nl> grpc_byte_buffer_destroy ( the_buffer ) ; <nl> - gpr_slice_unref ( slice ) ; <nl> + grpc_slice_unref ( slice ) ; <nl> <nl> gpr_log ( GPR_INFO , " latency ( 50 / 95 / 99 / 99 . 9 ) : % f / % f / % f / % f " , <nl> gpr_histogram_percentile ( histogram , 50 ) , <nl> mmm a / test / core / http / format_request_test . c <nl> ppp b / test / core / http / format_request_test . c <nl> <nl> static void test_format_get_request ( void ) { <nl> grpc_http_header hdr = { " x - yz " , " abc " } ; <nl> grpc_httpcli_request req ; <nl> - gpr_slice slice ; <nl> + grpc_slice slice ; <nl> <nl> memset ( & req , 0 , sizeof ( req ) ) ; <nl> req . host = " example . com " ; <nl> static void test_format_get_request ( void ) { <nl> <nl> slice = grpc_httpcli_format_get_request ( & req ) ; <nl> <nl> - GPR_ASSERT ( 0 = = gpr_slice_str_cmp ( slice , <nl> + GPR_ASSERT ( 0 = = grpc_slice_str_cmp ( slice , <nl> " GET / index . html HTTP / 1 . 0 \ r \ n " <nl> " Host : example . com \ r \ n " <nl> " Connection : close \ r \ n " <nl> static void test_format_get_request ( void ) { <nl> " x - yz : abc \ r \ n " <nl> " \ r \ n " ) ) ; <nl> <nl> - gpr_slice_unref ( slice ) ; <nl> + grpc_slice_unref ( slice ) ; <nl> } <nl> <nl> static void test_format_post_request ( void ) { <nl> grpc_http_header hdr = { " x - yz " , " abc " } ; <nl> grpc_httpcli_request req ; <nl> - gpr_slice slice ; <nl> + grpc_slice slice ; <nl> char body_bytes [ ] = " fake body " ; <nl> size_t body_len = 9 ; <nl> <nl> static void test_format_post_request ( void ) { <nl> <nl> slice = grpc_httpcli_format_post_request ( & req , body_bytes , body_len ) ; <nl> <nl> - GPR_ASSERT ( 0 = = gpr_slice_str_cmp ( slice , <nl> + GPR_ASSERT ( 0 = = grpc_slice_str_cmp ( slice , <nl> " POST / index . html HTTP / 1 . 0 \ r \ n " <nl> " Host : example . com \ r \ n " <nl> " Connection : close \ r \ n " <nl> static void test_format_post_request ( void ) { <nl> " \ r \ n " <nl> " fake body " ) ) ; <nl> <nl> - gpr_slice_unref ( slice ) ; <nl> + grpc_slice_unref ( slice ) ; <nl> } <nl> <nl> static void test_format_post_request_no_body ( void ) { <nl> grpc_http_header hdr = { " x - yz " , " abc " } ; <nl> grpc_httpcli_request req ; <nl> - gpr_slice slice ; <nl> + grpc_slice slice ; <nl> <nl> memset ( & req , 0 , sizeof ( req ) ) ; <nl> req . host = " example . com " ; <nl> static void test_format_post_request_no_body ( void ) { <nl> <nl> slice = grpc_httpcli_format_post_request ( & req , NULL , 0 ) ; <nl> <nl> - GPR_ASSERT ( 0 = = gpr_slice_str_cmp ( slice , <nl> + GPR_ASSERT ( 0 = = grpc_slice_str_cmp ( slice , <nl> " POST / index . html HTTP / 1 . 0 \ r \ n " <nl> " Host : example . com \ r \ n " <nl> " Connection : close \ r \ n " <nl> static void test_format_post_request_no_body ( void ) { <nl> " x - yz : abc \ r \ n " <nl> " \ r \ n " ) ) ; <nl> <nl> - gpr_slice_unref ( slice ) ; <nl> + grpc_slice_unref ( slice ) ; <nl> } <nl> <nl> static void test_format_post_request_content_type_override ( void ) { <nl> grpc_http_header hdrs [ 2 ] ; <nl> grpc_httpcli_request req ; <nl> - gpr_slice slice ; <nl> + grpc_slice slice ; <nl> char body_bytes [ ] = " fake % 20body " ; <nl> size_t body_len = 11 ; <nl> <nl> static void test_format_post_request_content_type_override ( void ) { <nl> <nl> slice = grpc_httpcli_format_post_request ( & req , body_bytes , body_len ) ; <nl> <nl> - GPR_ASSERT ( 0 = = gpr_slice_str_cmp ( <nl> + GPR_ASSERT ( 0 = = grpc_slice_str_cmp ( <nl> slice , <nl> " POST / index . html HTTP / 1 . 0 \ r \ n " <nl> " Host : example . com \ r \ n " <nl> static void test_format_post_request_content_type_override ( void ) { <nl> " \ r \ n " <nl> " fake % 20body " ) ) ; <nl> <nl> - gpr_slice_unref ( slice ) ; <nl> + grpc_slice_unref ( slice ) ; <nl> } <nl> <nl> int main ( int argc , char * * argv ) { <nl> mmm a / test / core / http / parser_test . c <nl> ppp b / test / core / http / parser_test . c <nl> static void test_request_succeeds ( grpc_slice_split_mode split_mode , <nl> grpc_http_version expect_version , <nl> char * expect_path , char * expect_body , . . . ) { <nl> grpc_http_parser parser ; <nl> - gpr_slice input_slice = gpr_slice_from_copied_string ( request_text ) ; <nl> + grpc_slice input_slice = grpc_slice_from_copied_string ( request_text ) ; <nl> size_t num_slices ; <nl> size_t i ; <nl> - gpr_slice * slices ; <nl> + grpc_slice * slices ; <nl> va_list args ; <nl> grpc_http_request request ; <nl> memset ( & request , 0 , sizeof ( request ) ) ; <nl> <nl> grpc_split_slices ( split_mode , & input_slice , 1 , & slices , & num_slices ) ; <nl> - gpr_slice_unref ( input_slice ) ; <nl> + grpc_slice_unref ( input_slice ) ; <nl> <nl> grpc_http_parser_init ( & parser , GRPC_HTTP_REQUEST , & request ) ; <nl> <nl> for ( i = 0 ; i < num_slices ; i + + ) { <nl> GPR_ASSERT ( grpc_http_parser_parse ( & parser , slices [ i ] , NULL ) = = <nl> GRPC_ERROR_NONE ) ; <nl> - gpr_slice_unref ( slices [ i ] ) ; <nl> + grpc_slice_unref ( slices [ i ] ) ; <nl> } <nl> GPR_ASSERT ( grpc_http_parser_eof ( & parser ) = = GRPC_ERROR_NONE ) ; <nl> <nl> static void test_request_succeeds ( grpc_slice_split_mode split_mode , <nl> static void test_succeeds ( grpc_slice_split_mode split_mode , char * response_text , <nl> int expect_status , char * expect_body , . . . ) { <nl> grpc_http_parser parser ; <nl> - gpr_slice input_slice = gpr_slice_from_copied_string ( response_text ) ; <nl> + grpc_slice input_slice = grpc_slice_from_copied_string ( response_text ) ; <nl> size_t num_slices ; <nl> size_t i ; <nl> - gpr_slice * slices ; <nl> + grpc_slice * slices ; <nl> va_list args ; <nl> grpc_http_response response ; <nl> memset ( & response , 0 , sizeof ( response ) ) ; <nl> <nl> grpc_split_slices ( split_mode , & input_slice , 1 , & slices , & num_slices ) ; <nl> - gpr_slice_unref ( input_slice ) ; <nl> + grpc_slice_unref ( input_slice ) ; <nl> <nl> grpc_http_parser_init ( & parser , GRPC_HTTP_RESPONSE , & response ) ; <nl> <nl> for ( i = 0 ; i < num_slices ; i + + ) { <nl> GPR_ASSERT ( grpc_http_parser_parse ( & parser , slices [ i ] , NULL ) = = <nl> GRPC_ERROR_NONE ) ; <nl> - gpr_slice_unref ( slices [ i ] ) ; <nl> + grpc_slice_unref ( slices [ i ] ) ; <nl> } <nl> GPR_ASSERT ( grpc_http_parser_eof ( & parser ) = = GRPC_ERROR_NONE ) ; <nl> <nl> static void test_succeeds ( grpc_slice_split_mode split_mode , char * response_text , <nl> <nl> static void test_fails ( grpc_slice_split_mode split_mode , char * response_text ) { <nl> grpc_http_parser parser ; <nl> - gpr_slice input_slice = gpr_slice_from_copied_string ( response_text ) ; <nl> + grpc_slice input_slice = grpc_slice_from_copied_string ( response_text ) ; <nl> size_t num_slices ; <nl> size_t i ; <nl> - gpr_slice * slices ; <nl> + grpc_slice * slices ; <nl> grpc_error * error = GRPC_ERROR_NONE ; <nl> grpc_http_response response ; <nl> memset ( & response , 0 , sizeof ( response ) ) ; <nl> <nl> grpc_split_slices ( split_mode , & input_slice , 1 , & slices , & num_slices ) ; <nl> - gpr_slice_unref ( input_slice ) ; <nl> + grpc_slice_unref ( input_slice ) ; <nl> <nl> grpc_http_parser_init ( & parser , GRPC_HTTP_RESPONSE , & response ) ; <nl> <nl> static void test_fails ( grpc_slice_split_mode split_mode , char * response_text ) { <nl> if ( GRPC_ERROR_NONE = = error ) { <nl> error = grpc_http_parser_parse ( & parser , slices [ i ] , NULL ) ; <nl> } <nl> - gpr_slice_unref ( slices [ i ] ) ; <nl> + grpc_slice_unref ( slices [ i ] ) ; <nl> } <nl> if ( GRPC_ERROR_NONE = = error ) { <nl> error = grpc_http_parser_eof ( & parser ) ; <nl> static void test_fails ( grpc_slice_split_mode split_mode , char * response_text ) { <nl> static void test_request_fails ( grpc_slice_split_mode split_mode , <nl> char * request_text ) { <nl> grpc_http_parser parser ; <nl> - gpr_slice input_slice = gpr_slice_from_copied_string ( request_text ) ; <nl> + grpc_slice input_slice = grpc_slice_from_copied_string ( request_text ) ; <nl> size_t num_slices ; <nl> size_t i ; <nl> - gpr_slice * slices ; <nl> + grpc_slice * slices ; <nl> grpc_error * error = GRPC_ERROR_NONE ; <nl> grpc_http_request request ; <nl> memset ( & request , 0 , sizeof ( request ) ) ; <nl> <nl> grpc_split_slices ( split_mode , & input_slice , 1 , & slices , & num_slices ) ; <nl> - gpr_slice_unref ( input_slice ) ; <nl> + grpc_slice_unref ( input_slice ) ; <nl> <nl> grpc_http_parser_init ( & parser , GRPC_HTTP_REQUEST , & request ) ; <nl> <nl> static void test_request_fails ( grpc_slice_split_mode split_mode , <nl> if ( error = = GRPC_ERROR_NONE ) { <nl> error = grpc_http_parser_parse ( & parser , slices [ i ] , NULL ) ; <nl> } <nl> - gpr_slice_unref ( slices [ i ] ) ; <nl> + grpc_slice_unref ( slices [ i ] ) ; <nl> } <nl> if ( error = = GRPC_ERROR_NONE ) { <nl> error = grpc_http_parser_eof ( & parser ) ; <nl> mmm a / test / core / http / request_fuzzer . c <nl> ppp b / test / core / http / request_fuzzer . c <nl> int LLVMFuzzerTestOneInput ( const uint8_t * data , size_t size ) { <nl> grpc_http_request request ; <nl> memset ( & request , 0 , sizeof ( request ) ) ; <nl> grpc_http_parser_init ( & parser , GRPC_HTTP_REQUEST , & request ) ; <nl> - gpr_slice slice = gpr_slice_from_copied_buffer ( ( const char * ) data , size ) ; <nl> + grpc_slice slice = grpc_slice_from_copied_buffer ( ( const char * ) data , size ) ; <nl> GRPC_ERROR_UNREF ( grpc_http_parser_parse ( & parser , slice , NULL ) ) ; <nl> GRPC_ERROR_UNREF ( grpc_http_parser_eof ( & parser ) ) ; <nl> - gpr_slice_unref ( slice ) ; <nl> + grpc_slice_unref ( slice ) ; <nl> grpc_http_parser_destroy ( & parser ) ; <nl> grpc_http_request_destroy ( & request ) ; <nl> return 0 ; <nl> mmm a / test / core / http / response_fuzzer . c <nl> ppp b / test / core / http / response_fuzzer . c <nl> int LLVMFuzzerTestOneInput ( const uint8_t * data , size_t size ) { <nl> grpc_http_response response ; <nl> memset ( & response , 0 , sizeof ( response ) ) ; <nl> grpc_http_parser_init ( & parser , GRPC_HTTP_RESPONSE , & response ) ; <nl> - gpr_slice slice = gpr_slice_from_copied_buffer ( ( const char * ) data , size ) ; <nl> + grpc_slice slice = grpc_slice_from_copied_buffer ( ( const char * ) data , size ) ; <nl> GRPC_ERROR_UNREF ( grpc_http_parser_parse ( & parser , slice , NULL ) ) ; <nl> GRPC_ERROR_UNREF ( grpc_http_parser_eof ( & parser ) ) ; <nl> - gpr_slice_unref ( slice ) ; <nl> + grpc_slice_unref ( slice ) ; <nl> grpc_http_parser_destroy ( & parser ) ; <nl> grpc_http_response_destroy ( & response ) ; <nl> return 0 ; <nl> mmm a / test / core / internal_api_canaries / transport . c <nl> ppp b / test / core / internal_api_canaries / transport . c <nl> static void test_code ( void ) { <nl> grpc_transport_perform_op ( & transport , NULL , NULL ) ; <nl> grpc_transport_ping ( & transport , NULL ) ; <nl> grpc_transport_goaway ( & transport , GRPC_STATUS_UNAVAILABLE , <nl> - gpr_slice_malloc ( 0 ) ) ; <nl> + grpc_slice_malloc ( 0 ) ) ; <nl> grpc_transport_close ( & transport ) ; <nl> grpc_transport_destroy ( & transport , NULL ) ; <nl> GPR_ASSERT ( " xyz " = = grpc_transport_get_peer ( & transport , NULL ) ) ; <nl> mmm a / test / core / iomgr / endpoint_tests . c <nl> ppp b / test / core / iomgr / endpoint_tests . c <nl> <nl> static gpr_mu * g_mu ; <nl> static grpc_pollset * g_pollset ; <nl> <nl> - size_t count_slices ( gpr_slice * slices , size_t nslices , int * current_data ) { <nl> + size_t count_slices ( grpc_slice * slices , size_t nslices , int * current_data ) { <nl> size_t num_bytes = 0 ; <nl> size_t i ; <nl> size_t j ; <nl> static grpc_endpoint_test_fixture begin_test ( grpc_endpoint_test_config config , <nl> <nl> static void end_test ( grpc_endpoint_test_config config ) { config . clean_up ( ) ; } <nl> <nl> - static gpr_slice * allocate_blocks ( size_t num_bytes , size_t slice_size , <nl> + static grpc_slice * allocate_blocks ( size_t num_bytes , size_t slice_size , <nl> size_t * num_blocks , uint8_t * current_data ) { <nl> size_t nslices = num_bytes / slice_size + ( num_bytes % slice_size ? 1 : 0 ) ; <nl> - gpr_slice * slices = gpr_malloc ( sizeof ( gpr_slice ) * nslices ) ; <nl> + grpc_slice * slices = gpr_malloc ( sizeof ( grpc_slice ) * nslices ) ; <nl> size_t num_bytes_left = num_bytes ; <nl> size_t i ; <nl> size_t j ; <nl> static gpr_slice * allocate_blocks ( size_t num_bytes , size_t slice_size , <nl> * num_blocks = nslices ; <nl> <nl> for ( i = 0 ; i < nslices ; + + i ) { <nl> - slices [ i ] = gpr_slice_malloc ( slice_size > num_bytes_left ? num_bytes_left <nl> + slices [ i ] = grpc_slice_malloc ( slice_size > num_bytes_left ? num_bytes_left <nl> : slice_size ) ; <nl> num_bytes_left - = GPR_SLICE_LENGTH ( slices [ i ] ) ; <nl> buf = GPR_SLICE_START_PTR ( slices [ i ] ) ; <nl> struct read_and_write_test_state { <nl> uint8_t current_write_data ; <nl> int read_done ; <nl> int write_done ; <nl> - gpr_slice_buffer incoming ; <nl> - gpr_slice_buffer outgoing ; <nl> + grpc_slice_buffer incoming ; <nl> + grpc_slice_buffer outgoing ; <nl> grpc_closure done_read ; <nl> grpc_closure done_write ; <nl> } ; <nl> static void read_and_write_test_read_handler ( grpc_exec_ctx * exec_ctx , <nl> static void read_and_write_test_write_handler ( grpc_exec_ctx * exec_ctx , <nl> void * data , grpc_error * error ) { <nl> struct read_and_write_test_state * state = data ; <nl> - gpr_slice * slices = NULL ; <nl> + grpc_slice * slices = NULL ; <nl> size_t nslices ; <nl> <nl> if ( error = = GRPC_ERROR_NONE ) { <nl> static void read_and_write_test_write_handler ( grpc_exec_ctx * exec_ctx , <nl> if ( state - > current_write_size ! = 0 ) { <nl> slices = allocate_blocks ( state - > current_write_size , 8192 , & nslices , <nl> & state - > current_write_data ) ; <nl> - gpr_slice_buffer_reset_and_unref ( & state - > outgoing ) ; <nl> - gpr_slice_buffer_addn ( & state - > outgoing , slices , nslices ) ; <nl> + grpc_slice_buffer_reset_and_unref ( & state - > outgoing ) ; <nl> + grpc_slice_buffer_addn ( & state - > outgoing , slices , nslices ) ; <nl> grpc_endpoint_write ( exec_ctx , state - > write_ep , & state - > outgoing , <nl> & state - > done_write ) ; <nl> gpr_free ( slices ) ; <nl> static void read_and_write_test ( grpc_endpoint_test_config config , <nl> grpc_closure_init ( & state . done_read , read_and_write_test_read_handler , & state ) ; <nl> grpc_closure_init ( & state . done_write , read_and_write_test_write_handler , <nl> & state ) ; <nl> - gpr_slice_buffer_init ( & state . outgoing ) ; <nl> - gpr_slice_buffer_init ( & state . incoming ) ; <nl> + grpc_slice_buffer_init ( & state . outgoing ) ; <nl> + grpc_slice_buffer_init ( & state . incoming ) ; <nl> <nl> / * Get started by pretending an initial write completed * / <nl> / * NOTE : Sets up initial conditions so we can have the same write handler <nl> static void read_and_write_test ( grpc_endpoint_test_config config , <nl> grpc_exec_ctx_flush ( & exec_ctx ) ; <nl> <nl> end_test ( config ) ; <nl> - gpr_slice_buffer_destroy ( & state . outgoing ) ; <nl> - gpr_slice_buffer_destroy ( & state . incoming ) ; <nl> + grpc_slice_buffer_destroy ( & state . outgoing ) ; <nl> + grpc_slice_buffer_destroy ( & state . incoming ) ; <nl> grpc_endpoint_destroy ( & exec_ctx , state . read_ep ) ; <nl> grpc_endpoint_destroy ( & exec_ctx , state . write_ep ) ; <nl> grpc_exec_ctx_finish ( & exec_ctx ) ; <nl> static void multiple_shutdown_test ( grpc_endpoint_test_config config ) { <nl> begin_test ( config , " multiple_shutdown_test " , 128 ) ; <nl> int fail_count = 0 ; <nl> <nl> - gpr_slice_buffer slice_buffer ; <nl> - gpr_slice_buffer_init ( & slice_buffer ) ; <nl> + grpc_slice_buffer slice_buffer ; <nl> + grpc_slice_buffer_init ( & slice_buffer ) ; <nl> <nl> grpc_exec_ctx exec_ctx = GRPC_EXEC_CTX_INIT ; <nl> grpc_endpoint_add_to_pollset ( & exec_ctx , f . client_ep , g_pollset ) ; <nl> static void multiple_shutdown_test ( grpc_endpoint_test_config config ) { <nl> grpc_endpoint_read ( & exec_ctx , f . client_ep , & slice_buffer , <nl> grpc_closure_create ( inc_on_failure , & fail_count ) ) ; <nl> wait_for_fail_count ( & exec_ctx , & fail_count , 2 ) ; <nl> - gpr_slice_buffer_add ( & slice_buffer , gpr_slice_from_copied_string ( " a " ) ) ; <nl> + grpc_slice_buffer_add ( & slice_buffer , grpc_slice_from_copied_string ( " a " ) ) ; <nl> grpc_endpoint_write ( & exec_ctx , f . client_ep , & slice_buffer , <nl> grpc_closure_create ( inc_on_failure , & fail_count ) ) ; <nl> wait_for_fail_count ( & exec_ctx , & fail_count , 3 ) ; <nl> grpc_endpoint_shutdown ( & exec_ctx , f . client_ep ) ; <nl> wait_for_fail_count ( & exec_ctx , & fail_count , 3 ) ; <nl> <nl> - gpr_slice_buffer_destroy ( & slice_buffer ) ; <nl> + grpc_slice_buffer_destroy ( & slice_buffer ) ; <nl> <nl> grpc_endpoint_destroy ( & exec_ctx , f . client_ep ) ; <nl> grpc_endpoint_destroy ( & exec_ctx , f . server_ep ) ; <nl> mmm a / test / core / iomgr / load_file_test . c <nl> ppp b / test / core / iomgr / load_file_test . c <nl> static const char prefix [ ] = " file_test " ; <nl> <nl> static void test_load_empty_file ( void ) { <nl> FILE * tmp = NULL ; <nl> - gpr_slice slice ; <nl> - gpr_slice slice_with_null_term ; <nl> + grpc_slice slice ; <nl> + grpc_slice slice_with_null_term ; <nl> grpc_error * error ; <nl> char * tmp_name ; <nl> <nl> static void test_load_empty_file ( void ) { <nl> <nl> remove ( tmp_name ) ; <nl> gpr_free ( tmp_name ) ; <nl> - gpr_slice_unref ( slice ) ; <nl> - gpr_slice_unref ( slice_with_null_term ) ; <nl> + grpc_slice_unref ( slice ) ; <nl> + grpc_slice_unref ( slice_with_null_term ) ; <nl> } <nl> <nl> static void test_load_failure ( void ) { <nl> FILE * tmp = NULL ; <nl> - gpr_slice slice ; <nl> + grpc_slice slice ; <nl> grpc_error * error ; <nl> char * tmp_name ; <nl> <nl> static void test_load_failure ( void ) { <nl> GRPC_ERROR_UNREF ( error ) ; <nl> GPR_ASSERT ( GPR_SLICE_LENGTH ( slice ) = = 0 ) ; <nl> gpr_free ( tmp_name ) ; <nl> - gpr_slice_unref ( slice ) ; <nl> + grpc_slice_unref ( slice ) ; <nl> } <nl> <nl> static void test_load_small_file ( void ) { <nl> FILE * tmp = NULL ; <nl> - gpr_slice slice ; <nl> - gpr_slice slice_with_null_term ; <nl> + grpc_slice slice ; <nl> + grpc_slice slice_with_null_term ; <nl> grpc_error * error ; <nl> char * tmp_name ; <nl> const char * blah = " blah " ; <nl> static void test_load_small_file ( void ) { <nl> <nl> remove ( tmp_name ) ; <nl> gpr_free ( tmp_name ) ; <nl> - gpr_slice_unref ( slice ) ; <nl> - gpr_slice_unref ( slice_with_null_term ) ; <nl> + grpc_slice_unref ( slice ) ; <nl> + grpc_slice_unref ( slice_with_null_term ) ; <nl> } <nl> <nl> static void test_load_big_file ( void ) { <nl> FILE * tmp = NULL ; <nl> - gpr_slice slice ; <nl> + grpc_slice slice ; <nl> grpc_error * error ; <nl> char * tmp_name ; <nl> static const size_t buffer_size = 124631 ; <nl> static void test_load_big_file ( void ) { <nl> <nl> remove ( tmp_name ) ; <nl> gpr_free ( tmp_name ) ; <nl> - gpr_slice_unref ( slice ) ; <nl> + grpc_slice_unref ( slice ) ; <nl> gpr_free ( buffer ) ; <nl> } <nl> <nl> mmm a / test / core / iomgr / resource_quota_test . c <nl> ppp b / test / core / iomgr / resource_quota_test . c <nl> static void test_one_slice ( void ) { <nl> grpc_resource_user_slice_allocator_init ( & alloc , & usr , inc_int_cb , <nl> & num_allocs ) ; <nl> <nl> - gpr_slice_buffer buffer ; <nl> - gpr_slice_buffer_init ( & buffer ) ; <nl> + grpc_slice_buffer buffer ; <nl> + grpc_slice_buffer_init ( & buffer ) ; <nl> <nl> { <nl> const int start_allocs = num_allocs ; <nl> static void test_one_slice ( void ) { <nl> GPR_ASSERT ( num_allocs = = start_allocs + 1 ) ; <nl> } <nl> <nl> - gpr_slice_buffer_destroy ( & buffer ) ; <nl> + grpc_slice_buffer_destroy ( & buffer ) ; <nl> destroy_user ( & usr ) ; <nl> grpc_resource_quota_unref ( q ) ; <nl> } <nl> static void test_one_slice_deleted_late ( void ) { <nl> grpc_resource_user_slice_allocator_init ( & alloc , & usr , inc_int_cb , <nl> & num_allocs ) ; <nl> <nl> - gpr_slice_buffer buffer ; <nl> - gpr_slice_buffer_init ( & buffer ) ; <nl> + grpc_slice_buffer buffer ; <nl> + grpc_slice_buffer_init ( & buffer ) ; <nl> <nl> { <nl> const int start_allocs = num_allocs ; <nl> static void test_one_slice_deleted_late ( void ) { <nl> } <nl> <nl> grpc_resource_quota_unref ( q ) ; <nl> - gpr_slice_buffer_destroy ( & buffer ) ; <nl> + grpc_slice_buffer_destroy ( & buffer ) ; <nl> GPR_ASSERT ( done ) ; <nl> { <nl> grpc_exec_ctx exec_ctx = GRPC_EXEC_CTX_INIT ; <nl> mmm a / test / core / iomgr / tcp_posix_test . c <nl> ppp b / test / core / iomgr / tcp_posix_test . c <nl> struct read_socket_state { <nl> grpc_endpoint * ep ; <nl> size_t read_bytes ; <nl> size_t target_read_bytes ; <nl> - gpr_slice_buffer incoming ; <nl> + grpc_slice_buffer incoming ; <nl> grpc_closure read_cb ; <nl> } ; <nl> <nl> - static size_t count_slices ( gpr_slice * slices , size_t nslices , <nl> + static size_t count_slices ( grpc_slice * slices , size_t nslices , <nl> int * current_data ) { <nl> size_t num_bytes = 0 ; <nl> unsigned i , j ; <nl> static void read_test ( size_t num_bytes , size_t slice_size ) { <nl> state . ep = ep ; <nl> state . read_bytes = 0 ; <nl> state . target_read_bytes = written_bytes ; <nl> - gpr_slice_buffer_init ( & state . incoming ) ; <nl> + grpc_slice_buffer_init ( & state . incoming ) ; <nl> grpc_closure_init ( & state . read_cb , read_cb , & state ) ; <nl> <nl> grpc_endpoint_read ( & exec_ctx , ep , & state . incoming , & state . read_cb ) ; <nl> static void read_test ( size_t num_bytes , size_t slice_size ) { <nl> GPR_ASSERT ( state . read_bytes = = state . target_read_bytes ) ; <nl> gpr_mu_unlock ( g_mu ) ; <nl> <nl> - gpr_slice_buffer_destroy ( & state . incoming ) ; <nl> + grpc_slice_buffer_destroy ( & state . incoming ) ; <nl> grpc_endpoint_destroy ( & exec_ctx , ep ) ; <nl> grpc_exec_ctx_finish ( & exec_ctx ) ; <nl> } <nl> static void large_read_test ( size_t slice_size ) { <nl> state . ep = ep ; <nl> state . read_bytes = 0 ; <nl> state . target_read_bytes = ( size_t ) written_bytes ; <nl> - gpr_slice_buffer_init ( & state . incoming ) ; <nl> + grpc_slice_buffer_init ( & state . incoming ) ; <nl> grpc_closure_init ( & state . read_cb , read_cb , & state ) ; <nl> <nl> grpc_endpoint_read ( & exec_ctx , ep , & state . incoming , & state . read_cb ) ; <nl> static void large_read_test ( size_t slice_size ) { <nl> GPR_ASSERT ( state . read_bytes = = state . target_read_bytes ) ; <nl> gpr_mu_unlock ( g_mu ) ; <nl> <nl> - gpr_slice_buffer_destroy ( & state . incoming ) ; <nl> + grpc_slice_buffer_destroy ( & state . incoming ) ; <nl> grpc_endpoint_destroy ( & exec_ctx , ep ) ; <nl> grpc_exec_ctx_finish ( & exec_ctx ) ; <nl> } <nl> struct write_socket_state { <nl> int write_done ; <nl> } ; <nl> <nl> - static gpr_slice * allocate_blocks ( size_t num_bytes , size_t slice_size , <nl> + static grpc_slice * allocate_blocks ( size_t num_bytes , size_t slice_size , <nl> size_t * num_blocks , uint8_t * current_data ) { <nl> size_t nslices = num_bytes / slice_size + ( num_bytes % slice_size ? 1u : 0u ) ; <nl> - gpr_slice * slices = gpr_malloc ( sizeof ( gpr_slice ) * nslices ) ; <nl> + grpc_slice * slices = gpr_malloc ( sizeof ( grpc_slice ) * nslices ) ; <nl> size_t num_bytes_left = num_bytes ; <nl> unsigned i , j ; <nl> unsigned char * buf ; <nl> * num_blocks = nslices ; <nl> <nl> for ( i = 0 ; i < nslices ; + + i ) { <nl> - slices [ i ] = gpr_slice_malloc ( slice_size > num_bytes_left ? num_bytes_left <nl> + slices [ i ] = grpc_slice_malloc ( slice_size > num_bytes_left ? num_bytes_left <nl> : slice_size ) ; <nl> num_bytes_left - = GPR_SLICE_LENGTH ( slices [ i ] ) ; <nl> buf = GPR_SLICE_START_PTR ( slices [ i ] ) ; <nl> static void write_test ( size_t num_bytes , size_t slice_size ) { <nl> grpc_endpoint * ep ; <nl> struct write_socket_state state ; <nl> size_t num_blocks ; <nl> - gpr_slice * slices ; <nl> + grpc_slice * slices ; <nl> uint8_t current_data = 0 ; <nl> - gpr_slice_buffer outgoing ; <nl> + grpc_slice_buffer outgoing ; <nl> grpc_closure write_done_closure ; <nl> gpr_timespec deadline = GRPC_TIMEOUT_SECONDS_TO_DEADLINE ( 20 ) ; <nl> grpc_exec_ctx exec_ctx = GRPC_EXEC_CTX_INIT ; <nl> static void write_test ( size_t num_bytes , size_t slice_size ) { <nl> <nl> slices = allocate_blocks ( num_bytes , slice_size , & num_blocks , & current_data ) ; <nl> <nl> - gpr_slice_buffer_init ( & outgoing ) ; <nl> - gpr_slice_buffer_addn ( & outgoing , slices , num_blocks ) ; <nl> + grpc_slice_buffer_init ( & outgoing ) ; <nl> + grpc_slice_buffer_addn ( & outgoing , slices , num_blocks ) ; <nl> grpc_closure_init ( & write_done_closure , write_done , & state ) ; <nl> <nl> grpc_endpoint_write ( & exec_ctx , ep , & outgoing , & write_done_closure ) ; <nl> static void write_test ( size_t num_bytes , size_t slice_size ) { <nl> } <nl> gpr_mu_unlock ( g_mu ) ; <nl> <nl> - gpr_slice_buffer_destroy ( & outgoing ) ; <nl> + grpc_slice_buffer_destroy ( & outgoing ) ; <nl> grpc_endpoint_destroy ( & exec_ctx , ep ) ; <nl> gpr_free ( slices ) ; <nl> grpc_exec_ctx_finish ( & exec_ctx ) ; <nl> static void release_fd_test ( size_t num_bytes , size_t slice_size ) { <nl> state . ep = ep ; <nl> state . read_bytes = 0 ; <nl> state . target_read_bytes = written_bytes ; <nl> - gpr_slice_buffer_init ( & state . incoming ) ; <nl> + grpc_slice_buffer_init ( & state . incoming ) ; <nl> grpc_closure_init ( & state . read_cb , read_cb , & state ) ; <nl> <nl> grpc_endpoint_read ( & exec_ctx , ep , & state . incoming , & state . read_cb ) ; <nl> static void release_fd_test ( size_t num_bytes , size_t slice_size ) { <nl> GPR_ASSERT ( state . read_bytes = = state . target_read_bytes ) ; <nl> gpr_mu_unlock ( g_mu ) ; <nl> <nl> - gpr_slice_buffer_destroy ( & state . incoming ) ; <nl> + grpc_slice_buffer_destroy ( & state . incoming ) ; <nl> grpc_tcp_destroy_and_release_fd ( & exec_ctx , ep , & fd , & fd_released_cb ) ; <nl> grpc_exec_ctx_flush ( & exec_ctx ) ; <nl> gpr_mu_lock ( g_mu ) ; <nl> mmm a / test / core / nanopb / fuzzer_response . c <nl> ppp b / test / core / nanopb / fuzzer_response . c <nl> static void dont_log ( gpr_log_func_args * args ) { } <nl> <nl> int LLVMFuzzerTestOneInput ( const uint8_t * data , size_t size ) { <nl> if ( squelch ) gpr_set_log_function ( dont_log ) ; <nl> - gpr_slice slice = gpr_slice_from_copied_buffer ( ( const char * ) data , size ) ; <nl> + grpc_slice slice = grpc_slice_from_copied_buffer ( ( const char * ) data , size ) ; <nl> grpc_grpclb_initial_response * response ; <nl> if ( ( response = grpc_grpclb_initial_response_parse ( slice ) ) ) { <nl> grpc_grpclb_initial_response_destroy ( response ) ; <nl> } <nl> - gpr_slice_unref ( slice ) ; <nl> + grpc_slice_unref ( slice ) ; <nl> return 0 ; <nl> } <nl> mmm a / test / core / nanopb / fuzzer_serverlist . c <nl> ppp b / test / core / nanopb / fuzzer_serverlist . c <nl> static void dont_log ( gpr_log_func_args * args ) { } <nl> <nl> int LLVMFuzzerTestOneInput ( const uint8_t * data , size_t size ) { <nl> if ( squelch ) gpr_set_log_function ( dont_log ) ; <nl> - gpr_slice slice = gpr_slice_from_copied_buffer ( ( const char * ) data , size ) ; <nl> + grpc_slice slice = grpc_slice_from_copied_buffer ( ( const char * ) data , size ) ; <nl> grpc_grpclb_serverlist * serverlist ; <nl> if ( ( serverlist = grpc_grpclb_response_parse_serverlist ( slice ) ) ) { <nl> grpc_grpclb_destroy_serverlist ( serverlist ) ; <nl> } <nl> - gpr_slice_unref ( slice ) ; <nl> + grpc_slice_unref ( slice ) ; <nl> return 0 ; <nl> } <nl> mmm a / test / core / security / b64_test . c <nl> ppp b / test / core / security / b64_test . c <nl> static void test_simple_encode_decode_b64 ( int url_safe , int multiline ) { <nl> const char * hello = " hello " ; <nl> char * hello_b64 = <nl> grpc_base64_encode ( hello , strlen ( hello ) , url_safe , multiline ) ; <nl> - gpr_slice hello_slice = grpc_base64_decode ( hello_b64 , url_safe ) ; <nl> + grpc_slice hello_slice = grpc_base64_decode ( hello_b64 , url_safe ) ; <nl> GPR_ASSERT ( GPR_SLICE_LENGTH ( hello_slice ) = = strlen ( hello ) ) ; <nl> GPR_ASSERT ( strncmp ( ( const char * ) GPR_SLICE_START_PTR ( hello_slice ) , hello , <nl> GPR_SLICE_LENGTH ( hello_slice ) ) = = 0 ) ; <nl> <nl> - gpr_slice_unref ( hello_slice ) ; <nl> + grpc_slice_unref ( hello_slice ) ; <nl> gpr_free ( hello_b64 ) ; <nl> } <nl> <nl> static void test_full_range_encode_decode_b64 ( int url_safe , int multiline ) { <nl> unsigned char orig [ 256 ] ; <nl> size_t i ; <nl> char * b64 ; <nl> - gpr_slice orig_decoded ; <nl> + grpc_slice orig_decoded ; <nl> for ( i = 0 ; i < sizeof ( orig ) ; i + + ) orig [ i ] = ( uint8_t ) i ; <nl> <nl> / * Try all the different paddings . * / <nl> static void test_full_range_encode_decode_b64 ( int url_safe , int multiline ) { <nl> GPR_ASSERT ( GPR_SLICE_LENGTH ( orig_decoded ) = = ( sizeof ( orig ) - i ) ) ; <nl> GPR_ASSERT ( buffers_are_equal ( orig , GPR_SLICE_START_PTR ( orig_decoded ) , <nl> sizeof ( orig ) - i ) ) ; <nl> - gpr_slice_unref ( orig_decoded ) ; <nl> + grpc_slice_unref ( orig_decoded ) ; <nl> gpr_free ( b64 ) ; <nl> } <nl> } <nl> static void test_url_safe_unsafe_mismtach_failure ( void ) { <nl> unsigned char orig [ 256 ] ; <nl> size_t i ; <nl> char * b64 ; <nl> - gpr_slice orig_decoded ; <nl> + grpc_slice orig_decoded ; <nl> int url_safe = 1 ; <nl> for ( i = 0 ; i < sizeof ( orig ) ; i + + ) orig [ i ] = ( uint8_t ) i ; <nl> <nl> static void test_url_safe_unsafe_mismtach_failure ( void ) { <nl> orig_decoded = grpc_base64_decode ( b64 , ! url_safe ) ; <nl> GPR_ASSERT ( GPR_SLICE_IS_EMPTY ( orig_decoded ) ) ; <nl> gpr_free ( b64 ) ; <nl> - gpr_slice_unref ( orig_decoded ) ; <nl> + grpc_slice_unref ( orig_decoded ) ; <nl> <nl> b64 = grpc_base64_encode ( orig , sizeof ( orig ) , ! url_safe , 0 ) ; <nl> orig_decoded = grpc_base64_decode ( b64 , url_safe ) ; <nl> GPR_ASSERT ( GPR_SLICE_IS_EMPTY ( orig_decoded ) ) ; <nl> gpr_free ( b64 ) ; <nl> - gpr_slice_unref ( orig_decoded ) ; <nl> + grpc_slice_unref ( orig_decoded ) ; <nl> } <nl> <nl> static void test_rfc4648_test_vectors ( void ) { <nl> static void test_rfc4648_test_vectors ( void ) { <nl> } <nl> <nl> static void test_unpadded_decode ( void ) { <nl> - gpr_slice decoded ; <nl> + grpc_slice decoded ; <nl> <nl> decoded = grpc_base64_decode ( " Zm9vYmFy " , 0 ) ; <nl> GPR_ASSERT ( ! GPR_SLICE_IS_EMPTY ( decoded ) ) ; <nl> - GPR_ASSERT ( gpr_slice_str_cmp ( decoded , " foobar " ) = = 0 ) ; <nl> - gpr_slice_unref ( decoded ) ; <nl> + GPR_ASSERT ( grpc_slice_str_cmp ( decoded , " foobar " ) = = 0 ) ; <nl> + grpc_slice_unref ( decoded ) ; <nl> <nl> decoded = grpc_base64_decode ( " Zm9vYmE " , 0 ) ; <nl> GPR_ASSERT ( ! GPR_SLICE_IS_EMPTY ( decoded ) ) ; <nl> - GPR_ASSERT ( gpr_slice_str_cmp ( decoded , " fooba " ) = = 0 ) ; <nl> - gpr_slice_unref ( decoded ) ; <nl> + GPR_ASSERT ( grpc_slice_str_cmp ( decoded , " fooba " ) = = 0 ) ; <nl> + grpc_slice_unref ( decoded ) ; <nl> <nl> decoded = grpc_base64_decode ( " Zm9vYg " , 0 ) ; <nl> GPR_ASSERT ( ! GPR_SLICE_IS_EMPTY ( decoded ) ) ; <nl> - GPR_ASSERT ( gpr_slice_str_cmp ( decoded , " foob " ) = = 0 ) ; <nl> - gpr_slice_unref ( decoded ) ; <nl> + GPR_ASSERT ( grpc_slice_str_cmp ( decoded , " foob " ) = = 0 ) ; <nl> + grpc_slice_unref ( decoded ) ; <nl> <nl> decoded = grpc_base64_decode ( " Zm9v " , 0 ) ; <nl> GPR_ASSERT ( ! GPR_SLICE_IS_EMPTY ( decoded ) ) ; <nl> - GPR_ASSERT ( gpr_slice_str_cmp ( decoded , " foo " ) = = 0 ) ; <nl> - gpr_slice_unref ( decoded ) ; <nl> + GPR_ASSERT ( grpc_slice_str_cmp ( decoded , " foo " ) = = 0 ) ; <nl> + grpc_slice_unref ( decoded ) ; <nl> <nl> decoded = grpc_base64_decode ( " Zm8 " , 0 ) ; <nl> GPR_ASSERT ( ! GPR_SLICE_IS_EMPTY ( decoded ) ) ; <nl> - GPR_ASSERT ( gpr_slice_str_cmp ( decoded , " fo " ) = = 0 ) ; <nl> - gpr_slice_unref ( decoded ) ; <nl> + GPR_ASSERT ( grpc_slice_str_cmp ( decoded , " fo " ) = = 0 ) ; <nl> + grpc_slice_unref ( decoded ) ; <nl> <nl> decoded = grpc_base64_decode ( " Zg " , 0 ) ; <nl> GPR_ASSERT ( ! GPR_SLICE_IS_EMPTY ( decoded ) ) ; <nl> - GPR_ASSERT ( gpr_slice_str_cmp ( decoded , " f " ) = = 0 ) ; <nl> - gpr_slice_unref ( decoded ) ; <nl> + GPR_ASSERT ( grpc_slice_str_cmp ( decoded , " f " ) = = 0 ) ; <nl> + grpc_slice_unref ( decoded ) ; <nl> <nl> decoded = grpc_base64_decode ( " " , 0 ) ; <nl> GPR_ASSERT ( GPR_SLICE_IS_EMPTY ( decoded ) ) ; <nl> mmm a / test / core / security / create_jwt . c <nl> ppp b / test / core / security / create_jwt . c <nl> void create_jwt ( const char * json_key_file_path , const char * service_url , <nl> const char * scope ) { <nl> grpc_auth_json_key key ; <nl> char * jwt ; <nl> - gpr_slice json_key_data ; <nl> + grpc_slice json_key_data ; <nl> GPR_ASSERT ( GRPC_LOG_IF_ERROR ( <nl> " load_file " , grpc_load_file ( json_key_file_path , 1 , & json_key_data ) ) ) ; <nl> key = grpc_auth_json_key_create_from_string ( <nl> ( const char * ) GPR_SLICE_START_PTR ( json_key_data ) ) ; <nl> - gpr_slice_unref ( json_key_data ) ; <nl> + grpc_slice_unref ( json_key_data ) ; <nl> if ( ! grpc_auth_json_key_is_valid ( & key ) ) { <nl> fprintf ( stderr , " Could not parse json key . \ n " ) ; <nl> exit ( 1 ) ; <nl> mmm a / test / core / security / credentials_test . c <nl> ppp b / test / core / security / credentials_test . c <nl> static void test_add_to_empty_md_store ( void ) { <nl> grpc_credentials_md_store * store = grpc_credentials_md_store_create ( 0 ) ; <nl> const char * key_str = " hello " ; <nl> const char * value_str = " there blah blah blah blah blah blah blah " ; <nl> - gpr_slice key = gpr_slice_from_copied_string ( key_str ) ; <nl> - gpr_slice value = gpr_slice_from_copied_string ( value_str ) ; <nl> + grpc_slice key = grpc_slice_from_copied_string ( key_str ) ; <nl> + grpc_slice value = grpc_slice_from_copied_string ( value_str ) ; <nl> grpc_credentials_md_store_add ( store , key , value ) ; <nl> GPR_ASSERT ( store - > num_entries = = 1 ) ; <nl> - GPR_ASSERT ( gpr_slice_cmp ( key , store - > entries [ 0 ] . key ) = = 0 ) ; <nl> - GPR_ASSERT ( gpr_slice_cmp ( value , store - > entries [ 0 ] . value ) = = 0 ) ; <nl> - gpr_slice_unref ( key ) ; <nl> - gpr_slice_unref ( value ) ; <nl> + GPR_ASSERT ( grpc_slice_cmp ( key , store - > entries [ 0 ] . key ) = = 0 ) ; <nl> + GPR_ASSERT ( grpc_slice_cmp ( value , store - > entries [ 0 ] . value ) = = 0 ) ; <nl> + grpc_slice_unref ( key ) ; <nl> + grpc_slice_unref ( value ) ; <nl> grpc_credentials_md_store_unref ( store ) ; <nl> } <nl> <nl> static void test_add_cstrings_to_empty_md_store ( void ) { <nl> const char * value_str = " there blah blah blah blah blah blah blah " ; <nl> grpc_credentials_md_store_add_cstrings ( store , key_str , value_str ) ; <nl> GPR_ASSERT ( store - > num_entries = = 1 ) ; <nl> - GPR_ASSERT ( gpr_slice_str_cmp ( store - > entries [ 0 ] . key , key_str ) = = 0 ) ; <nl> - GPR_ASSERT ( gpr_slice_str_cmp ( store - > entries [ 0 ] . value , value_str ) = = 0 ) ; <nl> + GPR_ASSERT ( grpc_slice_str_cmp ( store - > entries [ 0 ] . key , key_str ) = = 0 ) ; <nl> + GPR_ASSERT ( grpc_slice_str_cmp ( store - > entries [ 0 ] . value , value_str ) = = 0 ) ; <nl> grpc_credentials_md_store_unref ( store ) ; <nl> } <nl> <nl> static void test_add_abunch_to_md_store ( void ) { <nl> grpc_credentials_md_store_add_cstrings ( store , key_str , value_str ) ; <nl> } <nl> for ( i = 0 ; i < num_entries ; i + + ) { <nl> - GPR_ASSERT ( gpr_slice_str_cmp ( store - > entries [ i ] . key , key_str ) = = 0 ) ; <nl> - GPR_ASSERT ( gpr_slice_str_cmp ( store - > entries [ i ] . value , value_str ) = = 0 ) ; <nl> + GPR_ASSERT ( grpc_slice_str_cmp ( store - > entries [ i ] . key , key_str ) = = 0 ) ; <nl> + GPR_ASSERT ( grpc_slice_str_cmp ( store - > entries [ i ] . value , value_str ) = = 0 ) ; <nl> } <nl> grpc_credentials_md_store_unref ( store ) ; <nl> } <nl> static void test_oauth2_token_fetcher_creds_parsing_ok ( void ) { <nl> GPR_ASSERT ( token_lifetime . tv_sec = = 3599 ) ; <nl> GPR_ASSERT ( token_lifetime . tv_nsec = = 0 ) ; <nl> GPR_ASSERT ( token_md - > num_entries = = 1 ) ; <nl> - GPR_ASSERT ( gpr_slice_str_cmp ( token_md - > entries [ 0 ] . key , " authorization " ) = = 0 ) ; <nl> - GPR_ASSERT ( gpr_slice_str_cmp ( token_md - > entries [ 0 ] . value , <nl> + GPR_ASSERT ( grpc_slice_str_cmp ( token_md - > entries [ 0 ] . key , " authorization " ) = = 0 ) ; <nl> + GPR_ASSERT ( grpc_slice_str_cmp ( token_md - > entries [ 0 ] . value , <nl> " Bearer ya29 . AHES6ZRN3 - HlhAPya30GnW_bHSb_ " ) = = <nl> 0 ) ; <nl> grpc_credentials_md_store_unref ( token_md ) ; <nl> static void check_metadata ( expected_md * expected , grpc_credentials_md * md_elems , <nl> for ( i = 0 ; i < num_md ; i + + ) { <nl> size_t j ; <nl> for ( j = 0 ; j < num_md ; j + + ) { <nl> - if ( 0 = = gpr_slice_str_cmp ( md_elems [ j ] . key , expected [ i ] . key ) ) { <nl> - GPR_ASSERT ( gpr_slice_str_cmp ( md_elems [ j ] . value , expected [ i ] . value ) = = <nl> + if ( 0 = = grpc_slice_str_cmp ( md_elems [ j ] . key , expected [ i ] . key ) ) { <nl> + GPR_ASSERT ( grpc_slice_str_cmp ( md_elems [ j ] . value , expected [ i ] . value ) = = <nl> 0 ) ; <nl> break ; <nl> } <nl> static void on_oauth2_creds_get_metadata_success ( <nl> GPR_ASSERT ( status = = GRPC_CREDENTIALS_OK ) ; <nl> GPR_ASSERT ( error_details = = NULL ) ; <nl> GPR_ASSERT ( num_md = = 1 ) ; <nl> - GPR_ASSERT ( gpr_slice_str_cmp ( md_elems [ 0 ] . key , " authorization " ) = = 0 ) ; <nl> - GPR_ASSERT ( gpr_slice_str_cmp ( md_elems [ 0 ] . value , <nl> + GPR_ASSERT ( grpc_slice_str_cmp ( md_elems [ 0 ] . key , " authorization " ) = = 0 ) ; <nl> + GPR_ASSERT ( grpc_slice_str_cmp ( md_elems [ 0 ] . value , <nl> " Bearer ya29 . AHES6ZRN3 - HlhAPya30GnW_bHSb_ " ) = = <nl> 0 ) ; <nl> GPR_ASSERT ( user_data ! = NULL ) ; <nl> static void on_jwt_creds_get_metadata_success ( <nl> GPR_ASSERT ( status = = GRPC_CREDENTIALS_OK ) ; <nl> GPR_ASSERT ( error_details = = NULL ) ; <nl> GPR_ASSERT ( num_md = = 1 ) ; <nl> - GPR_ASSERT ( gpr_slice_str_cmp ( md_elems [ 0 ] . key , " authorization " ) = = 0 ) ; <nl> - GPR_ASSERT ( gpr_slice_str_cmp ( md_elems [ 0 ] . value , expected_md_value ) = = 0 ) ; <nl> + GPR_ASSERT ( grpc_slice_str_cmp ( md_elems [ 0 ] . key , " authorization " ) = = 0 ) ; <nl> + GPR_ASSERT ( grpc_slice_str_cmp ( md_elems [ 0 ] . value , expected_md_value ) = = 0 ) ; <nl> GPR_ASSERT ( user_data ! = NULL ) ; <nl> GPR_ASSERT ( strcmp ( ( const char * ) user_data , test_user_data ) = = 0 ) ; <nl> gpr_free ( expected_md_value ) ; <nl> static void on_plugin_metadata_received_success ( <nl> GPR_ASSERT ( md_elems ! = NULL ) ; <nl> GPR_ASSERT ( num_md = = GPR_ARRAY_SIZE ( plugin_md ) ) ; <nl> for ( i = 0 ; i < num_md ; i + + ) { <nl> - GPR_ASSERT ( gpr_slice_str_cmp ( md_elems [ i ] . key , plugin_md [ i ] . key ) = = 0 ) ; <nl> - GPR_ASSERT ( gpr_slice_str_cmp ( md_elems [ i ] . value , plugin_md [ i ] . value ) = = 0 ) ; <nl> + GPR_ASSERT ( grpc_slice_str_cmp ( md_elems [ i ] . key , plugin_md [ i ] . key ) = = 0 ) ; <nl> + GPR_ASSERT ( grpc_slice_str_cmp ( md_elems [ i ] . value , plugin_md [ i ] . value ) = = 0 ) ; <nl> } <nl> } <nl> <nl> mmm a / test / core / security / fetch_oauth2 . c <nl> ppp b / test / core / security / fetch_oauth2 . c <nl> <nl> <nl> static grpc_call_credentials * create_refresh_token_creds ( <nl> const char * json_refresh_token_file_path ) { <nl> - gpr_slice refresh_token ; <nl> + grpc_slice refresh_token ; <nl> GPR_ASSERT ( GRPC_LOG_IF_ERROR ( <nl> " load_file " , <nl> grpc_load_file ( json_refresh_token_file_path , 1 , & refresh_token ) ) ) ; <nl> mmm a / test / core / security / json_token_test . c <nl> ppp b / test / core / security / json_token_test . c <nl> static grpc_json * parse_json_part_from_jwt ( const char * str , size_t len , <nl> char * b64 ; <nl> char * decoded ; <nl> grpc_json * json ; <nl> - gpr_slice slice ; <nl> + grpc_slice slice ; <nl> b64 = gpr_malloc ( len + 1 ) ; <nl> strncpy ( b64 , str , len ) ; <nl> b64 [ len ] = ' \ 0 ' ; <nl> static grpc_json * parse_json_part_from_jwt ( const char * str , size_t len , <nl> json = grpc_json_parse_string ( decoded ) ; <nl> gpr_free ( b64 ) ; <nl> * scratchpad = decoded ; <nl> - gpr_slice_unref ( slice ) ; <nl> + grpc_slice_unref ( slice ) ; <nl> return json ; <nl> } <nl> <nl> static void check_jwt_signature ( const char * b64_signature , RSA * rsa_key , <nl> EVP_MD_CTX * md_ctx = EVP_MD_CTX_create ( ) ; <nl> EVP_PKEY * key = EVP_PKEY_new ( ) ; <nl> <nl> - gpr_slice sig = grpc_base64_decode ( b64_signature , 1 ) ; <nl> + grpc_slice sig = grpc_base64_decode ( b64_signature , 1 ) ; <nl> GPR_ASSERT ( ! GPR_SLICE_IS_EMPTY ( sig ) ) ; <nl> GPR_ASSERT ( GPR_SLICE_LENGTH ( sig ) = = 128 ) ; <nl> <nl> static void check_jwt_signature ( const char * b64_signature , RSA * rsa_key , <nl> GPR_ASSERT ( EVP_DigestVerifyFinal ( md_ctx , GPR_SLICE_START_PTR ( sig ) , <nl> GPR_SLICE_LENGTH ( sig ) ) = = 1 ) ; <nl> <nl> - gpr_slice_unref ( sig ) ; <nl> + grpc_slice_unref ( sig ) ; <nl> if ( key ! = NULL ) EVP_PKEY_free ( key ) ; <nl> if ( md_ctx ! = NULL ) EVP_MD_CTX_destroy ( md_ctx ) ; <nl> } <nl> mmm a / test / core / security / jwt_verifier_test . c <nl> ppp b / test / core / security / jwt_verifier_test . c <nl> typedef struct { <nl> <nl> static void test_claims_success ( void ) { <nl> grpc_jwt_claims * claims ; <nl> - gpr_slice s = gpr_slice_from_copied_string ( claims_without_time_constraint ) ; <nl> + grpc_slice s = grpc_slice_from_copied_string ( claims_without_time_constraint ) ; <nl> grpc_json * json = grpc_json_parse_string_with_len ( <nl> ( char * ) GPR_SLICE_START_PTR ( s ) , GPR_SLICE_LENGTH ( s ) ) ; <nl> GPR_ASSERT ( json ! = NULL ) ; <nl> static void test_claims_success ( void ) { <nl> <nl> static void test_expired_claims_failure ( void ) { <nl> grpc_jwt_claims * claims ; <nl> - gpr_slice s = gpr_slice_from_copied_string ( expired_claims ) ; <nl> + grpc_slice s = grpc_slice_from_copied_string ( expired_claims ) ; <nl> grpc_json * json = grpc_json_parse_string_with_len ( <nl> ( char * ) GPR_SLICE_START_PTR ( s ) , GPR_SLICE_LENGTH ( s ) ) ; <nl> gpr_timespec exp_iat = { 100 , 0 , GPR_CLOCK_REALTIME } ; <nl> static void test_expired_claims_failure ( void ) { <nl> } <nl> <nl> static void test_invalid_claims_failure ( void ) { <nl> - gpr_slice s = gpr_slice_from_copied_string ( invalid_claims ) ; <nl> + grpc_slice s = grpc_slice_from_copied_string ( invalid_claims ) ; <nl> grpc_json * json = grpc_json_parse_string_with_len ( <nl> ( char * ) GPR_SLICE_START_PTR ( s ) , GPR_SLICE_LENGTH ( s ) ) ; <nl> GPR_ASSERT ( grpc_jwt_claims_from_json ( json , s ) = = NULL ) ; <nl> static void test_invalid_claims_failure ( void ) { <nl> <nl> static void test_bad_audience_claims_failure ( void ) { <nl> grpc_jwt_claims * claims ; <nl> - gpr_slice s = gpr_slice_from_copied_string ( claims_without_time_constraint ) ; <nl> + grpc_slice s = grpc_slice_from_copied_string ( claims_without_time_constraint ) ; <nl> grpc_json * json = grpc_json_parse_string_with_len ( <nl> ( char * ) GPR_SLICE_START_PTR ( s ) , GPR_SLICE_LENGTH ( s ) ) ; <nl> GPR_ASSERT ( json ! = NULL ) ; <nl> static void test_jwt_verifier_bad_json_key ( void ) { <nl> } <nl> <nl> static void corrupt_jwt_sig ( char * jwt ) { <nl> - gpr_slice sig ; <nl> + grpc_slice sig ; <nl> char * bad_b64_sig ; <nl> uint8_t * sig_bytes ; <nl> char * last_dot = strrchr ( jwt , ' . ' ) ; <nl> static void corrupt_jwt_sig ( char * jwt ) { <nl> grpc_base64_encode ( GPR_SLICE_START_PTR ( sig ) , GPR_SLICE_LENGTH ( sig ) , 1 , 0 ) ; <nl> memcpy ( last_dot + 1 , bad_b64_sig , strlen ( bad_b64_sig ) ) ; <nl> gpr_free ( bad_b64_sig ) ; <nl> - gpr_slice_unref ( sig ) ; <nl> + grpc_slice_unref ( sig ) ; <nl> } <nl> <nl> static void on_verification_bad_signature ( void * user_data , <nl> mmm a / test / core / security / oauth2_utils . c <nl> ppp b / test / core / security / oauth2_utils . c <nl> static void on_oauth2_response ( grpc_exec_ctx * exec_ctx , void * user_data , <nl> const char * error_details ) { <nl> oauth2_request * request = user_data ; <nl> char * token = NULL ; <nl> - gpr_slice token_slice ; <nl> + grpc_slice token_slice ; <nl> if ( status = = GRPC_CREDENTIALS_ERROR ) { <nl> gpr_log ( GPR_ERROR , " Fetching token failed . " ) ; <nl> } else { <nl> mmm a / test / core / security / secure_endpoint_test . c <nl> ppp b / test / core / security / secure_endpoint_test . c <nl> static gpr_mu * g_mu ; <nl> static grpc_pollset * g_pollset ; <nl> <nl> static grpc_endpoint_test_fixture secure_endpoint_create_fixture_tcp_socketpair ( <nl> - size_t slice_size , gpr_slice * leftover_slices , size_t leftover_nslices ) { <nl> + size_t slice_size , grpc_slice * leftover_slices , size_t leftover_nslices ) { <nl> grpc_exec_ctx exec_ctx = GRPC_EXEC_CTX_INIT ; <nl> tsi_frame_protector * fake_read_protector = tsi_create_fake_protector ( NULL ) ; <nl> tsi_frame_protector * fake_write_protector = tsi_create_fake_protector ( NULL ) ; <nl> static grpc_endpoint_test_fixture secure_endpoint_create_fixture_tcp_socketpair ( <nl> size_t buffer_size = total_buffer_size ; <nl> uint8_t * encrypted_buffer = gpr_malloc ( buffer_size ) ; <nl> uint8_t * cur = encrypted_buffer ; <nl> - gpr_slice encrypted_leftover ; <nl> + grpc_slice encrypted_leftover ; <nl> for ( i = 0 ; i < leftover_nslices ; i + + ) { <nl> - gpr_slice plain = leftover_slices [ i ] ; <nl> + grpc_slice plain = leftover_slices [ i ] ; <nl> uint8_t * message_bytes = GPR_SLICE_START_PTR ( plain ) ; <nl> size_t message_size = GPR_SLICE_LENGTH ( plain ) ; <nl> while ( message_size > 0 ) { <nl> static grpc_endpoint_test_fixture secure_endpoint_create_fixture_tcp_socketpair ( <nl> GPR_ASSERT ( buffer_size > = protected_buffer_size_to_send ) ; <nl> buffer_size - = protected_buffer_size_to_send ; <nl> } <nl> - gpr_slice_unref ( plain ) ; <nl> + grpc_slice_unref ( plain ) ; <nl> } <nl> do { <nl> size_t protected_buffer_size_to_send = buffer_size ; <nl> static grpc_endpoint_test_fixture secure_endpoint_create_fixture_tcp_socketpair ( <nl> GPR_ASSERT ( buffer_size > = protected_buffer_size_to_send ) ; <nl> buffer_size - = protected_buffer_size_to_send ; <nl> } while ( still_pending_size > 0 ) ; <nl> - encrypted_leftover = gpr_slice_from_copied_buffer ( <nl> + encrypted_leftover = grpc_slice_from_copied_buffer ( <nl> ( const char * ) encrypted_buffer , total_buffer_size - buffer_size ) ; <nl> f . client_ep = grpc_secure_endpoint_create ( fake_read_protector , tcp . client , <nl> & encrypted_leftover , 1 ) ; <nl> - gpr_slice_unref ( encrypted_leftover ) ; <nl> + grpc_slice_unref ( encrypted_leftover ) ; <nl> gpr_free ( encrypted_buffer ) ; <nl> } <nl> <nl> secure_endpoint_create_fixture_tcp_socketpair_noleftover ( size_t slice_size ) { <nl> <nl> static grpc_endpoint_test_fixture <nl> secure_endpoint_create_fixture_tcp_socketpair_leftover ( size_t slice_size ) { <nl> - gpr_slice s = <nl> - gpr_slice_from_copied_string ( " hello world 12345678900987654321 " ) ; <nl> + grpc_slice s = <nl> + grpc_slice_from_copied_string ( " hello world 12345678900987654321 " ) ; <nl> grpc_endpoint_test_fixture f ; <nl> <nl> f = secure_endpoint_create_fixture_tcp_socketpair ( slice_size , & s , 1 ) ; <nl> static void inc_call_ctr ( grpc_exec_ctx * exec_ctx , void * arg , <nl> <nl> static void test_leftover ( grpc_endpoint_test_config config , size_t slice_size ) { <nl> grpc_endpoint_test_fixture f = config . create_fixture ( slice_size ) ; <nl> - gpr_slice_buffer incoming ; <nl> - gpr_slice s = <nl> - gpr_slice_from_copied_string ( " hello world 12345678900987654321 " ) ; <nl> + grpc_slice_buffer incoming ; <nl> + grpc_slice s = <nl> + grpc_slice_from_copied_string ( " hello world 12345678900987654321 " ) ; <nl> grpc_exec_ctx exec_ctx = GRPC_EXEC_CTX_INIT ; <nl> int n = 0 ; <nl> grpc_closure done_closure ; <nl> gpr_log ( GPR_INFO , " Start test left over " ) ; <nl> <nl> - gpr_slice_buffer_init ( & incoming ) ; <nl> + grpc_slice_buffer_init ( & incoming ) ; <nl> grpc_closure_init ( & done_closure , inc_call_ctr , & n ) ; <nl> grpc_endpoint_read ( & exec_ctx , f . client_ep , & incoming , & done_closure ) ; <nl> grpc_exec_ctx_finish ( & exec_ctx ) ; <nl> GPR_ASSERT ( n = = 1 ) ; <nl> GPR_ASSERT ( incoming . count = = 1 ) ; <nl> - GPR_ASSERT ( 0 = = gpr_slice_cmp ( s , incoming . slices [ 0 ] ) ) ; <nl> + GPR_ASSERT ( 0 = = grpc_slice_cmp ( s , incoming . slices [ 0 ] ) ) ; <nl> <nl> grpc_endpoint_shutdown ( & exec_ctx , f . client_ep ) ; <nl> grpc_endpoint_shutdown ( & exec_ctx , f . server_ep ) ; <nl> grpc_endpoint_destroy ( & exec_ctx , f . client_ep ) ; <nl> grpc_endpoint_destroy ( & exec_ctx , f . server_ep ) ; <nl> grpc_exec_ctx_finish ( & exec_ctx ) ; <nl> - gpr_slice_unref ( s ) ; <nl> - gpr_slice_buffer_destroy ( & incoming ) ; <nl> + grpc_slice_unref ( s ) ; <nl> + grpc_slice_buffer_destroy ( & incoming ) ; <nl> <nl> clean_up ( ) ; <nl> } <nl> mmm a / test / core / security / security_connector_test . c <nl> ppp b / test / core / security / security_connector_test . c <nl> static void test_default_ssl_roots ( void ) { <nl> value . * / <nl> gpr_setenv ( GRPC_DEFAULT_SSL_ROOTS_FILE_PATH_ENV_VAR , " " ) ; <nl> grpc_set_ssl_roots_override_callback ( override_roots_success ) ; <nl> - gpr_slice roots = grpc_get_default_ssl_roots_for_testing ( ) ; <nl> + grpc_slice roots = grpc_get_default_ssl_roots_for_testing ( ) ; <nl> char * roots_contents = gpr_dump_slice ( roots , GPR_DUMP_ASCII ) ; <nl> - gpr_slice_unref ( roots ) ; <nl> + grpc_slice_unref ( roots ) ; <nl> GPR_ASSERT ( strcmp ( roots_contents , roots_for_override_api ) = = 0 ) ; <nl> gpr_free ( roots_contents ) ; <nl> <nl> static void test_default_ssl_roots ( void ) { <nl> gpr_setenv ( GRPC_DEFAULT_SSL_ROOTS_FILE_PATH_ENV_VAR , roots_env_var_file_path ) ; <nl> roots = grpc_get_default_ssl_roots_for_testing ( ) ; <nl> roots_contents = gpr_dump_slice ( roots , GPR_DUMP_ASCII ) ; <nl> - gpr_slice_unref ( roots ) ; <nl> + grpc_slice_unref ( roots ) ; <nl> GPR_ASSERT ( strcmp ( roots_contents , roots_for_env_var ) = = 0 ) ; <nl> gpr_free ( roots_contents ) ; <nl> <nl> static void test_default_ssl_roots ( void ) { <nl> gpr_setenv ( GRPC_DEFAULT_SSL_ROOTS_FILE_PATH_ENV_VAR , " " ) ; <nl> roots = grpc_get_default_ssl_roots_for_testing ( ) ; <nl> roots_contents = gpr_dump_slice ( roots , GPR_DUMP_ASCII ) ; <nl> - gpr_slice_unref ( roots ) ; <nl> + grpc_slice_unref ( roots ) ; <nl> GPR_ASSERT ( strcmp ( roots_contents , roots_for_override_api ) = = 0 ) ; <nl> gpr_free ( roots_contents ) ; <nl> <nl> similarity index 100 % <nl> rename from test / core / support / percent_decode_corpus / 04cb8ccc553f9b2f5e52c421aff6d1c954d3dae6 <nl> rename to test / core / slice / percent_decode_corpus / 04cb8ccc553f9b2f5e52c421aff6d1c954d3dae6 <nl> similarity index 100 % <nl> rename from test / core / support / percent_decode_corpus / 0dd8f3a63745b3a2d39791559b5c1b311447b537 <nl> rename to test / core / slice / percent_decode_corpus / 0dd8f3a63745b3a2d39791559b5c1b311447b537 <nl> similarity index 100 % <nl> rename from test / core / support / percent_decode_corpus / 17eeaca784409adbe43365c32ac87915d736bba3 <nl> rename to test / core / slice / percent_decode_corpus / 17eeaca784409adbe43365c32ac87915d736bba3 <nl> similarity index 100 % <nl> rename from test / core / support / percent_decode_corpus / 2040c1ff65f52a7ae668c2c8f324de5dacc9d695 <nl> rename to test / core / slice / percent_decode_corpus / 2040c1ff65f52a7ae668c2c8f324de5dacc9d695 <nl> similarity index 100 % <nl> rename from test / core / support / percent_decode_corpus / 26b0d1da23027ae54db96e125e4a9e98842d77fb <nl> rename to test / core / slice / percent_decode_corpus / 26b0d1da23027ae54db96e125e4a9e98842d77fb <nl> similarity index 100 % <nl> rename from test / core / support / percent_decode_corpus / 2a089c0db45acdb4c6ed8e7ff81ca7235792c0b9 <nl> rename to test / core / slice / percent_decode_corpus / 2a089c0db45acdb4c6ed8e7ff81ca7235792c0b9 <nl> similarity index 100 % <nl> rename from test / core / support / percent_decode_corpus / 35b7b3bc3a740d5c3abca0d75b53f0e1e1ee998a <nl> rename to test / core / slice / percent_decode_corpus / 35b7b3bc3a740d5c3abca0d75b53f0e1e1ee998a <nl> similarity index 100 % <nl> rename from test / core / support / percent_decode_corpus / 36367ba1adba47a1cbc3a88707fde8cc7abdc248 <nl> rename to test / core / slice / percent_decode_corpus / 36367ba1adba47a1cbc3a88707fde8cc7abdc248 <nl> similarity index 100 % <nl> rename from test / core / support / percent_decode_corpus / 39c2ba51548a0beaf0d6d1164531f1447dc311b5 <nl> rename to test / core / slice / percent_decode_corpus / 39c2ba51548a0beaf0d6d1164531f1447dc311b5 <nl> similarity index 100 % <nl> rename from test / core / support / percent_decode_corpus / 56d08fea787c041395c6697ce26cfbc0decbe688 <nl> rename to test / core / slice / percent_decode_corpus / 56d08fea787c041395c6697ce26cfbc0decbe688 <nl> similarity index 100 % <nl> rename from test / core / support / percent_decode_corpus / 678d981fdabb9f0d6640235cf1719dd1e1e66ae9 <nl> rename to test / core / slice / percent_decode_corpus / 678d981fdabb9f0d6640235cf1719dd1e1e66ae9 <nl> similarity index 100 % <nl> rename from test / core / support / percent_decode_corpus / 68751961609ec010565de0aa87521dcbf0722c5d <nl> rename to test / core / slice / percent_decode_corpus / 68751961609ec010565de0aa87521dcbf0722c5d <nl> similarity index 100 % <nl> rename from test / core / support / percent_decode_corpus / 7875c06c6f03c9aa2f8e9c59f8d8957c8a32e759 <nl> rename to test / core / slice / percent_decode_corpus / 7875c06c6f03c9aa2f8e9c59f8d8957c8a32e759 <nl> similarity index 100 % <nl> rename from test / core / support / percent_decode_corpus / 7b302090e090a5829b6d1dd7be30bd4e36a7e60f <nl> rename to test / core / slice / percent_decode_corpus / 7b302090e090a5829b6d1dd7be30bd4e36a7e60f <nl> similarity index 100 % <nl> rename from test / core / support / percent_decode_corpus / 875e1022169c9e4c541a9ad894e69e989df22ba1 <nl> rename to test / core / slice / percent_decode_corpus / 875e1022169c9e4c541a9ad894e69e989df22ba1 <nl> similarity index 100 % <nl> rename from test / core / support / percent_decode_corpus / 8c1051ce066f5a26de9a9d133180621d0da957b4 <nl> rename to test / core / slice / percent_decode_corpus / 8c1051ce066f5a26de9a9d133180621d0da957b4 <nl> similarity index 100 % <nl> rename from test / core / support / percent_decode_corpus / 8e084e628ab83a18ac7ca7cb3506525263655c63 <nl> rename to test / core / slice / percent_decode_corpus / 8e084e628ab83a18ac7ca7cb3506525263655c63 <nl> similarity index 100 % <nl> rename from test / core / support / percent_decode_corpus / 9d316c4675f40ddccaf8f1cc7aea94170b1e4223 <nl> rename to test / core / slice / percent_decode_corpus / 9d316c4675f40ddccaf8f1cc7aea94170b1e4223 <nl> similarity index 100 % <nl> rename from test / core / support / percent_decode_corpus / ad1c7c11d18a7d116e2c2ef4d4c5afb1270836ae <nl> rename to test / core / slice / percent_decode_corpus / ad1c7c11d18a7d116e2c2ef4d4c5afb1270836ae <nl> similarity index 100 % <nl> rename from test / core / support / percent_decode_corpus / b471f94aa4facf502e622e4a248f1ba4063ae681 <nl> rename to test / core / slice / percent_decode_corpus / b471f94aa4facf502e622e4a248f1ba4063ae681 <nl> similarity index 100 % <nl> rename from test / core / support / percent_decode_corpus / bf52ece030f16136d46e0dc97f58d60a0d8a1f0b <nl> rename to test / core / slice / percent_decode_corpus / bf52ece030f16136d46e0dc97f58d60a0d8a1f0b <nl> similarity index 100 % <nl> rename from test / core / support / percent_decode_corpus / d5b2a7177339ba2b7ce2f60e5f4459bef1e72758 <nl> rename to test / core / slice / percent_decode_corpus / d5b2a7177339ba2b7ce2f60e5f4459bef1e72758 <nl> similarity index 100 % <nl> rename from test / core / support / percent_decode_corpus / de867b64c54a7ed773dc611fc5cd2f17c5433113 <nl> rename to test / core / slice / percent_decode_corpus / de867b64c54a7ed773dc611fc5cd2f17c5433113 <nl> similarity index 100 % <nl> rename from test / core / support / percent_decode_corpus / e3948dbe004950591630dd5c52f4e0fcbd5e388a <nl> rename to test / core / slice / percent_decode_corpus / e3948dbe004950591630dd5c52f4e0fcbd5e388a <nl> similarity index 100 % <nl> rename from test / core / support / percent_decode_corpus / e7064f0b80f61dbc65915311032d27baa569ae2a <nl> rename to test / core / slice / percent_decode_corpus / e7064f0b80f61dbc65915311032d27baa569ae2a <nl> similarity index 100 % <nl> rename from test / core / support / percent_decode_corpus / xyz <nl> rename to test / core / slice / percent_decode_corpus / xyz <nl> similarity index 90 % <nl> rename from test / core / support / percent_decode_fuzzer . c <nl> rename to test / core / slice / percent_decode_fuzzer . c <nl> mmm a / test / core / support / percent_decode_fuzzer . c <nl> ppp b / test / core / slice / percent_decode_fuzzer . c <nl> bool leak_check = true ; <nl> int LLVMFuzzerTestOneInput ( const uint8_t * data , size_t size ) { <nl> struct grpc_memory_counters counters ; <nl> grpc_memory_counters_init ( ) ; <nl> - gpr_slice input = gpr_slice_from_copied_buffer ( ( const char * ) data , size ) ; <nl> - gpr_slice output ; <nl> + grpc_slice input = grpc_slice_from_copied_buffer ( ( const char * ) data , size ) ; <nl> + grpc_slice output ; <nl> if ( gpr_strict_percent_decode_slice ( <nl> input , gpr_url_percent_encoding_unreserved_bytes , & output ) ) { <nl> - gpr_slice_unref ( output ) ; <nl> + grpc_slice_unref ( output ) ; <nl> } <nl> if ( gpr_strict_percent_decode_slice ( <nl> input , gpr_compatible_percent_encoding_unreserved_bytes , & output ) ) { <nl> - gpr_slice_unref ( output ) ; <nl> + grpc_slice_unref ( output ) ; <nl> } <nl> - gpr_slice_unref ( gpr_permissive_percent_decode_slice ( input ) ) ; <nl> - gpr_slice_unref ( input ) ; <nl> + grpc_slice_unref ( gpr_permissive_percent_decode_slice ( input ) ) ; <nl> + grpc_slice_unref ( input ) ; <nl> counters = grpc_memory_counters_snapshot ( ) ; <nl> grpc_memory_counters_destroy ( ) ; <nl> GPR_ASSERT ( counters . total_size_relative = = 0 ) ; <nl> similarity index 100 % <nl> rename from test / core / support / percent_encode_corpus / 0d3ee7fa54e6c66103965fd4409b044ba7db6c3f <nl> rename to test / core / slice / percent_encode_corpus / 0d3ee7fa54e6c66103965fd4409b044ba7db6c3f <nl> similarity index 100 % <nl> rename from test / core / support / percent_encode_corpus / 2e7ccf75e27b9501e3b28cf1c50ed0c45ab7c226 <nl> rename to test / core / slice / percent_encode_corpus / 2e7ccf75e27b9501e3b28cf1c50ed0c45ab7c226 <nl> similarity index 100 % <nl> rename from test / core / support / percent_encode_corpus / 55bb859f3942c462b03b7cbcf22ab4a0ac9705cf <nl> rename to test / core / slice / percent_encode_corpus / 55bb859f3942c462b03b7cbcf22ab4a0ac9705cf <nl> similarity index 100 % <nl> rename from test / core / support / percent_encode_corpus / 56070cecd54c845b6d4334953b17b712eb000d93 <nl> rename to test / core / slice / percent_encode_corpus / 56070cecd54c845b6d4334953b17b712eb000d93 <nl> similarity index 100 % <nl> rename from test / core / support / percent_encode_corpus / 61f50e891bf7ff5eb7a7af206f1e25d77f8756e7 <nl> rename to test / core / slice / percent_encode_corpus / 61f50e891bf7ff5eb7a7af206f1e25d77f8756e7 <nl> similarity index 100 % <nl> rename from test / core / support / percent_encode_corpus / 6e0c60cefc704c7940e475a87dd9ae423061cb5a <nl> rename to test / core / slice / percent_encode_corpus / 6e0c60cefc704c7940e475a87dd9ae423061cb5a <nl> similarity index 100 % <nl> rename from test / core / support / percent_encode_corpus / 7271ebcc6d22a0f186f7bc3c1973a7ed1bec8d8e <nl> rename to test / core / slice / percent_encode_corpus / 7271ebcc6d22a0f186f7bc3c1973a7ed1bec8d8e <nl> similarity index 100 % <nl> rename from test / core / support / percent_encode_corpus / 74c83ece3e2920a67593a9be9c82468f16cbb969 <nl> rename to test / core / slice / percent_encode_corpus / 74c83ece3e2920a67593a9be9c82468f16cbb969 <nl> similarity index 100 % <nl> rename from test / core / support / percent_encode_corpus / 98e004fd2a9f141a7a019720820080e12d637c06 <nl> rename to test / core / slice / percent_encode_corpus / 98e004fd2a9f141a7a019720820080e12d637c06 <nl> similarity index 100 % <nl> rename from test / core / support / percent_encode_corpus / ba2c1e98227aa21ea3bb2ca4d0e504119717da8b <nl> rename to test / core / slice / percent_encode_corpus / ba2c1e98227aa21ea3bb2ca4d0e504119717da8b <nl> similarity index 100 % <nl> rename from test / core / support / percent_encode_corpus / c16b9fd45370d4afb5d3ebd307a6e263c25ffd45 <nl> rename to test / core / slice / percent_encode_corpus / c16b9fd45370d4afb5d3ebd307a6e263c25ffd45 <nl> similarity index 100 % <nl> rename from test / core / support / percent_encode_corpus / d58c3cd4eab9b6d2343abfa1c25c90a383fe0ec3 <nl> rename to test / core / slice / percent_encode_corpus / d58c3cd4eab9b6d2343abfa1c25c90a383fe0ec3 <nl> similarity index 100 % <nl> rename from test / core / support / percent_encode_corpus / e2619218ede30d2b7b8ecd601a9f0ae754b728b4 <nl> rename to test / core / slice / percent_encode_corpus / e2619218ede30d2b7b8ecd601a9f0ae754b728b4 <nl> similarity index 100 % <nl> rename from test / core / support / percent_encode_corpus / f93b3653e453f0e3eea3198001be6ce46e64bd21 <nl> rename to test / core / slice / percent_encode_corpus / f93b3653e453f0e3eea3198001be6ce46e64bd21 <nl> similarity index 100 % <nl> rename from test / core / support / percent_encode_corpus / fd41d029c7682ad3d1c40a9fd017a4c85b673a54 <nl> rename to test / core / slice / percent_encode_corpus / fd41d029c7682ad3d1c40a9fd017a4c85b673a54 <nl> similarity index 100 % <nl> rename from test / core / support / percent_encode_corpus / xyz <nl> rename to test / core / slice / percent_encode_corpus / xyz <nl> similarity index 84 % <nl> rename from test / core / support / percent_encode_fuzzer . c <nl> rename to test / core / slice / percent_encode_fuzzer . c <nl> mmm a / test / core / support / percent_encode_fuzzer . c <nl> ppp b / test / core / slice / percent_encode_fuzzer . c <nl> bool leak_check = true ; <nl> static void test ( const uint8_t * data , size_t size , const uint8_t * dict ) { <nl> struct grpc_memory_counters counters ; <nl> grpc_memory_counters_init ( ) ; <nl> - gpr_slice input = gpr_slice_from_copied_buffer ( ( const char * ) data , size ) ; <nl> - gpr_slice output = gpr_percent_encode_slice ( input , dict ) ; <nl> - gpr_slice decoded_output ; <nl> + grpc_slice input = grpc_slice_from_copied_buffer ( ( const char * ) data , size ) ; <nl> + grpc_slice output = gpr_percent_encode_slice ( input , dict ) ; <nl> + grpc_slice decoded_output ; <nl> / / encoder must always produce decodable output <nl> GPR_ASSERT ( gpr_strict_percent_decode_slice ( output , dict , & decoded_output ) ) ; <nl> - gpr_slice permissive_decoded_output = <nl> + grpc_slice permissive_decoded_output = <nl> gpr_permissive_percent_decode_slice ( output ) ; <nl> / / and decoded output must always match the input <nl> - GPR_ASSERT ( gpr_slice_cmp ( input , decoded_output ) = = 0 ) ; <nl> - GPR_ASSERT ( gpr_slice_cmp ( input , permissive_decoded_output ) = = 0 ) ; <nl> - gpr_slice_unref ( input ) ; <nl> - gpr_slice_unref ( output ) ; <nl> - gpr_slice_unref ( decoded_output ) ; <nl> - gpr_slice_unref ( permissive_decoded_output ) ; <nl> + GPR_ASSERT ( grpc_slice_cmp ( input , decoded_output ) = = 0 ) ; <nl> + GPR_ASSERT ( grpc_slice_cmp ( input , permissive_decoded_output ) = = 0 ) ; <nl> + grpc_slice_unref ( input ) ; <nl> + grpc_slice_unref ( output ) ; <nl> + grpc_slice_unref ( decoded_output ) ; <nl> + grpc_slice_unref ( permissive_decoded_output ) ; <nl> counters = grpc_memory_counters_snapshot ( ) ; <nl> grpc_memory_counters_destroy ( ) ; <nl> GPR_ASSERT ( counters . total_size_relative = = 0 ) ; <nl> similarity index 84 % <nl> rename from test / core / support / percent_encoding_test . c <nl> rename to test / core / slice / percent_encoding_test . c <nl> mmm a / test / core / support / percent_encoding_test . c <nl> ppp b / test / core / slice / percent_encoding_test . c <nl> static void test_vector ( const char * raw , size_t raw_length , const char * encoded , <nl> gpr_free ( raw_msg ) ; <nl> gpr_free ( encoded_msg ) ; <nl> <nl> - gpr_slice raw_slice = gpr_slice_from_copied_buffer ( raw , raw_length ) ; <nl> - gpr_slice encoded_slice = <nl> - gpr_slice_from_copied_buffer ( encoded , encoded_length ) ; <nl> - gpr_slice raw2encoded_slice = gpr_percent_encode_slice ( raw_slice , dict ) ; <nl> - gpr_slice encoded2raw_slice ; <nl> + grpc_slice raw_slice = grpc_slice_from_copied_buffer ( raw , raw_length ) ; <nl> + grpc_slice encoded_slice = <nl> + grpc_slice_from_copied_buffer ( encoded , encoded_length ) ; <nl> + grpc_slice raw2encoded_slice = gpr_percent_encode_slice ( raw_slice , dict ) ; <nl> + grpc_slice encoded2raw_slice ; <nl> GPR_ASSERT ( <nl> gpr_strict_percent_decode_slice ( encoded_slice , dict , & encoded2raw_slice ) ) ; <nl> - gpr_slice encoded2raw_permissive_slice = <nl> + grpc_slice encoded2raw_permissive_slice = <nl> gpr_permissive_percent_decode_slice ( encoded_slice ) ; <nl> <nl> char * raw2encoded_msg = <nl> static void test_vector ( const char * raw , size_t raw_length , const char * encoded , <nl> gpr_free ( encoded2raw_msg ) ; <nl> gpr_free ( encoded2raw_permissive_msg ) ; <nl> <nl> - GPR_ASSERT ( 0 = = gpr_slice_cmp ( raw_slice , encoded2raw_slice ) ) ; <nl> - GPR_ASSERT ( 0 = = gpr_slice_cmp ( raw_slice , encoded2raw_permissive_slice ) ) ; <nl> - GPR_ASSERT ( 0 = = gpr_slice_cmp ( encoded_slice , raw2encoded_slice ) ) ; <nl> + GPR_ASSERT ( 0 = = grpc_slice_cmp ( raw_slice , encoded2raw_slice ) ) ; <nl> + GPR_ASSERT ( 0 = = grpc_slice_cmp ( raw_slice , encoded2raw_permissive_slice ) ) ; <nl> + GPR_ASSERT ( 0 = = grpc_slice_cmp ( encoded_slice , raw2encoded_slice ) ) ; <nl> <nl> - gpr_slice_unref ( encoded2raw_slice ) ; <nl> - gpr_slice_unref ( encoded2raw_permissive_slice ) ; <nl> - gpr_slice_unref ( raw2encoded_slice ) ; <nl> - gpr_slice_unref ( raw_slice ) ; <nl> - gpr_slice_unref ( encoded_slice ) ; <nl> + grpc_slice_unref ( encoded2raw_slice ) ; <nl> + grpc_slice_unref ( encoded2raw_permissive_slice ) ; <nl> + grpc_slice_unref ( raw2encoded_slice ) ; <nl> + grpc_slice_unref ( raw_slice ) ; <nl> + grpc_slice_unref ( encoded_slice ) ; <nl> } <nl> <nl> static void test_nonconformant_vector ( const char * encoded , <nl> static void test_nonconformant_vector ( const char * encoded , <nl> gpr_free ( permissive_unencoded_msg ) ; <nl> gpr_free ( encoded_msg ) ; <nl> <nl> - gpr_slice permissive_unencoded_slice = gpr_slice_from_copied_buffer ( <nl> + grpc_slice permissive_unencoded_slice = grpc_slice_from_copied_buffer ( <nl> permissive_unencoded , permissive_unencoded_length ) ; <nl> - gpr_slice encoded_slice = <nl> - gpr_slice_from_copied_buffer ( encoded , encoded_length ) ; <nl> - gpr_slice encoded2raw_slice ; <nl> + grpc_slice encoded_slice = <nl> + grpc_slice_from_copied_buffer ( encoded , encoded_length ) ; <nl> + grpc_slice encoded2raw_slice ; <nl> GPR_ASSERT ( ! gpr_strict_percent_decode_slice ( encoded_slice , dict , <nl> & encoded2raw_slice ) ) ; <nl> - gpr_slice encoded2raw_permissive_slice = <nl> + grpc_slice encoded2raw_permissive_slice = <nl> gpr_permissive_percent_decode_slice ( encoded_slice ) ; <nl> <nl> char * encoded2raw_permissive_msg = gpr_dump_slice ( <nl> static void test_nonconformant_vector ( const char * encoded , <nl> encoded2raw_permissive_msg ) ; <nl> gpr_free ( encoded2raw_permissive_msg ) ; <nl> <nl> - GPR_ASSERT ( 0 = = gpr_slice_cmp ( permissive_unencoded_slice , <nl> + GPR_ASSERT ( 0 = = grpc_slice_cmp ( permissive_unencoded_slice , <nl> encoded2raw_permissive_slice ) ) ; <nl> <nl> - gpr_slice_unref ( permissive_unencoded_slice ) ; <nl> - gpr_slice_unref ( encoded2raw_permissive_slice ) ; <nl> - gpr_slice_unref ( encoded_slice ) ; <nl> + grpc_slice_unref ( permissive_unencoded_slice ) ; <nl> + grpc_slice_unref ( encoded2raw_permissive_slice ) ; <nl> + grpc_slice_unref ( encoded_slice ) ; <nl> } <nl> <nl> int main ( int argc , char * * argv ) { <nl> similarity index 72 % <nl> rename from test / core / support / slice_buffer_test . c <nl> rename to test / core / slice / slice_buffer_test . c <nl> mmm a / test / core / support / slice_buffer_test . c <nl> ppp b / test / core / slice / slice_buffer_test . c <nl> <nl> # include " test / core / util / test_config . h " <nl> <nl> void test_slice_buffer_add ( ) { <nl> - gpr_slice_buffer buf ; <nl> - gpr_slice aaa = gpr_slice_from_copied_string ( " aaa " ) ; <nl> - gpr_slice bb = gpr_slice_from_copied_string ( " bb " ) ; <nl> + grpc_slice_buffer buf ; <nl> + grpc_slice aaa = grpc_slice_from_copied_string ( " aaa " ) ; <nl> + grpc_slice bb = grpc_slice_from_copied_string ( " bb " ) ; <nl> size_t i ; <nl> <nl> - gpr_slice_buffer_init ( & buf ) ; <nl> + grpc_slice_buffer_init ( & buf ) ; <nl> for ( i = 0 ; i < 10 ; i + + ) { <nl> - gpr_slice_ref ( aaa ) ; <nl> - gpr_slice_ref ( bb ) ; <nl> - gpr_slice_buffer_add ( & buf , aaa ) ; <nl> - gpr_slice_buffer_add ( & buf , bb ) ; <nl> + grpc_slice_ref ( aaa ) ; <nl> + grpc_slice_ref ( bb ) ; <nl> + grpc_slice_buffer_add ( & buf , aaa ) ; <nl> + grpc_slice_buffer_add ( & buf , bb ) ; <nl> } <nl> GPR_ASSERT ( buf . count > 0 ) ; <nl> GPR_ASSERT ( buf . length = = 50 ) ; <nl> - gpr_slice_buffer_reset_and_unref ( & buf ) ; <nl> + grpc_slice_buffer_reset_and_unref ( & buf ) ; <nl> GPR_ASSERT ( buf . count = = 0 ) ; <nl> GPR_ASSERT ( buf . length = = 0 ) ; <nl> for ( i = 0 ; i < 10 ; i + + ) { <nl> - gpr_slice_ref ( aaa ) ; <nl> - gpr_slice_ref ( bb ) ; <nl> - gpr_slice_buffer_add ( & buf , aaa ) ; <nl> - gpr_slice_buffer_add ( & buf , bb ) ; <nl> + grpc_slice_ref ( aaa ) ; <nl> + grpc_slice_ref ( bb ) ; <nl> + grpc_slice_buffer_add ( & buf , aaa ) ; <nl> + grpc_slice_buffer_add ( & buf , bb ) ; <nl> } <nl> GPR_ASSERT ( buf . count > 0 ) ; <nl> GPR_ASSERT ( buf . length = = 50 ) ; <nl> for ( i = 0 ; i < 10 ; i + + ) { <nl> - gpr_slice_buffer_pop ( & buf ) ; <nl> - gpr_slice_unref ( aaa ) ; <nl> - gpr_slice_unref ( bb ) ; <nl> + grpc_slice_buffer_pop ( & buf ) ; <nl> + grpc_slice_unref ( aaa ) ; <nl> + grpc_slice_unref ( bb ) ; <nl> } <nl> GPR_ASSERT ( buf . count = = 0 ) ; <nl> GPR_ASSERT ( buf . length = = 0 ) ; <nl> - gpr_slice_buffer_destroy ( & buf ) ; <nl> + grpc_slice_buffer_destroy ( & buf ) ; <nl> } <nl> <nl> void test_slice_buffer_move_first ( ) { <nl> - gpr_slice slices [ 3 ] ; <nl> - gpr_slice_buffer src ; <nl> - gpr_slice_buffer dst ; <nl> + grpc_slice slices [ 3 ] ; <nl> + grpc_slice_buffer src ; <nl> + grpc_slice_buffer dst ; <nl> int idx = 0 ; <nl> size_t src_len = 0 ; <nl> size_t dst_len = 0 ; <nl> <nl> - slices [ 0 ] = gpr_slice_from_copied_string ( " aaa " ) ; <nl> - slices [ 1 ] = gpr_slice_from_copied_string ( " bbbb " ) ; <nl> - slices [ 2 ] = gpr_slice_from_copied_string ( " ccc " ) ; <nl> + slices [ 0 ] = grpc_slice_from_copied_string ( " aaa " ) ; <nl> + slices [ 1 ] = grpc_slice_from_copied_string ( " bbbb " ) ; <nl> + slices [ 2 ] = grpc_slice_from_copied_string ( " ccc " ) ; <nl> <nl> - gpr_slice_buffer_init ( & src ) ; <nl> - gpr_slice_buffer_init ( & dst ) ; <nl> + grpc_slice_buffer_init ( & src ) ; <nl> + grpc_slice_buffer_init ( & dst ) ; <nl> for ( idx = 0 ; idx < 3 ; idx + + ) { <nl> - gpr_slice_ref ( slices [ idx ] ) ; <nl> + grpc_slice_ref ( slices [ idx ] ) ; <nl> / * For this test , it is important that we add each slice at a new <nl> slice index * / <nl> - gpr_slice_buffer_add_indexed ( & src , slices [ idx ] ) ; <nl> - gpr_slice_buffer_add_indexed ( & dst , slices [ idx ] ) ; <nl> + grpc_slice_buffer_add_indexed ( & src , slices [ idx ] ) ; <nl> + grpc_slice_buffer_add_indexed ( & dst , slices [ idx ] ) ; <nl> } <nl> <nl> / * Case 1 : Move more than the first slice ' s length from src to dst * / <nl> src_len = src . length ; <nl> dst_len = dst . length ; <nl> - gpr_slice_buffer_move_first ( & src , 4 , & dst ) ; <nl> + grpc_slice_buffer_move_first ( & src , 4 , & dst ) ; <nl> src_len - = 4 ; <nl> dst_len + = 4 ; <nl> GPR_ASSERT ( src . length = = src_len ) ; <nl> void test_slice_buffer_move_first ( ) { <nl> <nl> / * src now has two slices [ " bbb " ] and [ " ccc " ] * / <nl> / * Case 2 : Move the first slice from src to dst * / <nl> - gpr_slice_buffer_move_first ( & src , 3 , & dst ) ; <nl> + grpc_slice_buffer_move_first ( & src , 3 , & dst ) ; <nl> src_len - = 3 ; <nl> dst_len + = 3 ; <nl> GPR_ASSERT ( src . length = = src_len ) ; <nl> void test_slice_buffer_move_first ( ) { <nl> <nl> / * src now has one slice [ " ccc " ] * / <nl> / * Case 3 : Move less than the first slice ' s length from src to dst * / <nl> - gpr_slice_buffer_move_first ( & src , 2 , & dst ) ; <nl> + grpc_slice_buffer_move_first ( & src , 2 , & dst ) ; <nl> src_len - = 2 ; <nl> dst_len + = 2 ; <nl> GPR_ASSERT ( src . length = = src . length ) ; <nl> new file mode 100644 <nl> index 00000000000 . . d3dbb1e7f94 <nl> mmm / dev / null <nl> ppp b / test / core / slice / slice_string_helpers_test . c <nl> <nl> + / * <nl> + * <nl> + * Copyright 2015 , Google Inc . <nl> + * All rights reserved . <nl> + * <nl> + * Redistribution and use in source and binary forms , with or without <nl> + * modification , are permitted provided that the following conditions are <nl> + * met : <nl> + * <nl> + * * Redistributions of source code must retain the above copyright <nl> + * notice , this list of conditions and the following disclaimer . <nl> + * * Redistributions in binary form must reproduce the above <nl> + * copyright notice , this list of conditions and the following disclaimer <nl> + * in the documentation and / or other materials provided with the <nl> + * distribution . <nl> + * * Neither the name of Google Inc . nor the names of its <nl> + * contributors may be used to endorse or promote products derived from <nl> + * this software without specific prior written permission . <nl> + * <nl> + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS <nl> + * " AS IS " AND ANY EXPRESS OR IMPLIED WARRANTIES , INCLUDING , BUT NOT <nl> + * LIMITED TO , THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR <nl> + * A PARTICULAR PURPOSE ARE DISCLAIMED . IN NO EVENT SHALL THE COPYRIGHT <nl> + * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT , INDIRECT , INCIDENTAL , <nl> + * SPECIAL , EXEMPLARY , OR CONSEQUENTIAL DAMAGES ( INCLUDING , BUT NOT <nl> + * LIMITED TO , PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES ; LOSS OF USE , <nl> + * DATA , OR PROFITS ; OR BUSINESS INTERRUPTION ) HOWEVER CAUSED AND ON ANY <nl> + * THEORY OF LIABILITY , WHETHER IN CONTRACT , STRICT LIABILITY , OR TORT <nl> + * ( INCLUDING NEGLIGENCE OR OTHERWISE ) ARISING IN ANY WAY OUT OF THE USE <nl> + * OF THIS SOFTWARE , EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE . <nl> + * <nl> + * / <nl> + <nl> + # include " src / core / lib / support / string . h " <nl> + <nl> + # include < limits . h > <nl> + # include < stddef . h > <nl> + # include < stdlib . h > <nl> + # include < string . h > <nl> + <nl> + # include < grpc / support / alloc . h > <nl> + # include < grpc / support / log . h > <nl> + # include < grpc / support / string_util . h > <nl> + # include < grpc / support / useful . h > <nl> + # include " test / core / util / test_config . h " <nl> + <nl> + # define LOG_TEST_NAME ( x ) gpr_log ( GPR_INFO , " % s " , x ) <nl> + <nl> + static void expect_slice_dump ( grpc_slice slice , uint32_t flags , <nl> + const char * result ) { <nl> + char * got = gpr_dump_slice ( slice , flags ) ; <nl> + GPR_ASSERT ( 0 = = strcmp ( got , result ) ) ; <nl> + gpr_free ( got ) ; <nl> + grpc_slice_unref ( slice ) ; <nl> + } <nl> + <nl> + static void test_dump_slice ( void ) { <nl> + static const char * text = " HELLO WORLD ! " ; <nl> + static const char * long_text = <nl> + " It was a bright cold day in April , and the clocks were striking " <nl> + " thirteen . Winston Smith , his chin nuzzled into his breast in an effort " <nl> + " to escape the vile wind , slipped quickly through the glass doors of " <nl> + " Victory Mansions , though not quickly enough to prevent a swirl of " <nl> + " gritty dust from entering along with him . " ; <nl> + <nl> + LOG_TEST_NAME ( " test_dump_slice " ) ; <nl> + <nl> + expect_slice_dump ( grpc_slice_from_copied_string ( text ) , GPR_DUMP_ASCII , text ) ; <nl> + expect_slice_dump ( grpc_slice_from_copied_string ( long_text ) , GPR_DUMP_ASCII , <nl> + long_text ) ; <nl> + expect_slice_dump ( grpc_slice_from_copied_buffer ( " \ x01 " , 1 ) , GPR_DUMP_HEX , <nl> + " 01 " ) ; <nl> + expect_slice_dump ( grpc_slice_from_copied_buffer ( " \ x01 " , 1 ) , <nl> + GPR_DUMP_HEX | GPR_DUMP_ASCII , " 01 ' . ' " ) ; <nl> + } <nl> + <nl> + static void test_strsplit ( void ) { <nl> + grpc_slice_buffer * parts ; <nl> + grpc_slice str ; <nl> + <nl> + LOG_TEST_NAME ( " test_strsplit " ) ; <nl> + <nl> + parts = gpr_malloc ( sizeof ( grpc_slice_buffer ) ) ; <nl> + grpc_slice_buffer_init ( parts ) ; <nl> + <nl> + str = grpc_slice_from_copied_string ( " one , two , three , four " ) ; <nl> + grpc_slice_split ( str , " , " , parts ) ; <nl> + GPR_ASSERT ( 4 = = parts - > count ) ; <nl> + GPR_ASSERT ( 0 = = grpc_slice_str_cmp ( parts - > slices [ 0 ] , " one " ) ) ; <nl> + GPR_ASSERT ( 0 = = grpc_slice_str_cmp ( parts - > slices [ 1 ] , " two " ) ) ; <nl> + GPR_ASSERT ( 0 = = grpc_slice_str_cmp ( parts - > slices [ 2 ] , " three " ) ) ; <nl> + GPR_ASSERT ( 0 = = grpc_slice_str_cmp ( parts - > slices [ 3 ] , " four " ) ) ; <nl> + grpc_slice_buffer_reset_and_unref ( parts ) ; <nl> + grpc_slice_unref ( str ) ; <nl> + <nl> + / * separator not present in string * / <nl> + str = grpc_slice_from_copied_string ( " one two three four " ) ; <nl> + grpc_slice_split ( str , " , " , parts ) ; <nl> + GPR_ASSERT ( 1 = = parts - > count ) ; <nl> + GPR_ASSERT ( 0 = = grpc_slice_str_cmp ( parts - > slices [ 0 ] , " one two three four " ) ) ; <nl> + grpc_slice_buffer_reset_and_unref ( parts ) ; <nl> + grpc_slice_unref ( str ) ; <nl> + <nl> + / * separator at the end * / <nl> + str = grpc_slice_from_copied_string ( " foo , " ) ; <nl> + grpc_slice_split ( str , " , " , parts ) ; <nl> + GPR_ASSERT ( 2 = = parts - > count ) ; <nl> + GPR_ASSERT ( 0 = = grpc_slice_str_cmp ( parts - > slices [ 0 ] , " foo " ) ) ; <nl> + GPR_ASSERT ( 0 = = grpc_slice_str_cmp ( parts - > slices [ 1 ] , " " ) ) ; <nl> + grpc_slice_buffer_reset_and_unref ( parts ) ; <nl> + grpc_slice_unref ( str ) ; <nl> + <nl> + / * separator at the beginning * / <nl> + str = grpc_slice_from_copied_string ( " , foo " ) ; <nl> + grpc_slice_split ( str , " , " , parts ) ; <nl> + GPR_ASSERT ( 2 = = parts - > count ) ; <nl> + GPR_ASSERT ( 0 = = grpc_slice_str_cmp ( parts - > slices [ 0 ] , " " ) ) ; <nl> + GPR_ASSERT ( 0 = = grpc_slice_str_cmp ( parts - > slices [ 1 ] , " foo " ) ) ; <nl> + grpc_slice_buffer_reset_and_unref ( parts ) ; <nl> + grpc_slice_unref ( str ) ; <nl> + <nl> + / * standalone separator * / <nl> + str = grpc_slice_from_copied_string ( " , " ) ; <nl> + grpc_slice_split ( str , " , " , parts ) ; <nl> + GPR_ASSERT ( 2 = = parts - > count ) ; <nl> + GPR_ASSERT ( 0 = = grpc_slice_str_cmp ( parts - > slices [ 0 ] , " " ) ) ; <nl> + GPR_ASSERT ( 0 = = grpc_slice_str_cmp ( parts - > slices [ 1 ] , " " ) ) ; <nl> + grpc_slice_buffer_reset_and_unref ( parts ) ; <nl> + grpc_slice_unref ( str ) ; <nl> + <nl> + / * empty input * / <nl> + str = grpc_slice_from_copied_string ( " " ) ; <nl> + grpc_slice_split ( str , " , " , parts ) ; <nl> + GPR_ASSERT ( 1 = = parts - > count ) ; <nl> + GPR_ASSERT ( 0 = = grpc_slice_str_cmp ( parts - > slices [ 0 ] , " " ) ) ; <nl> + grpc_slice_buffer_reset_and_unref ( parts ) ; <nl> + grpc_slice_unref ( str ) ; <nl> + <nl> + grpc_slice_buffer_destroy ( parts ) ; <nl> + gpr_free ( parts ) ; <nl> + } <nl> + <nl> + int main ( int argc , char * * argv ) { <nl> + grpc_test_init ( argc , argv ) ; <nl> + test_dump_slice ( ) ; <nl> + test_strsplit ( ) ; <nl> + return 0 ; <nl> + } <nl> similarity index 84 % <nl> rename from test / core / support / slice_test . c <nl> rename to test / core / slice / slice_test . c <nl> mmm a / test / core / support / slice_test . c <nl> ppp b / test / core / slice / slice_test . c <nl> <nl> # define LOG_TEST_NAME ( x ) gpr_log ( GPR_INFO , " % s " , x ) ; <nl> <nl> static void test_slice_malloc_returns_something_sensible ( void ) { <nl> - / * Calls gpr_slice_create for various lengths and verifies the internals for <nl> + / * Calls grpc_slice_create for various lengths and verifies the internals for <nl> consistency . * / <nl> size_t length ; <nl> size_t i ; <nl> - gpr_slice slice ; <nl> + grpc_slice slice ; <nl> <nl> LOG_TEST_NAME ( " test_slice_malloc_returns_something_sensible " ) ; <nl> <nl> for ( length = 0 ; length < = 1024 ; length + + ) { <nl> - slice = gpr_slice_malloc ( length ) ; <nl> + slice = grpc_slice_malloc ( length ) ; <nl> / * If there is a length , slice . data must be non - NULL . If length is zero <nl> we don ' t care . * / <nl> if ( length ) { <nl> static void test_slice_malloc_returns_something_sensible ( void ) { <nl> GPR_SLICE_START_PTR ( slice ) [ i ] = ( uint8_t ) i ; <nl> } <nl> / * And finally we must succeed in destroying the slice * / <nl> - gpr_slice_unref ( slice ) ; <nl> + grpc_slice_unref ( slice ) ; <nl> } <nl> } <nl> <nl> static void do_nothing ( void * ignored ) { } <nl> static void test_slice_new_returns_something_sensible ( void ) { <nl> uint8_t x ; <nl> <nl> - gpr_slice slice = gpr_slice_new ( & x , 1 , do_nothing ) ; <nl> + grpc_slice slice = grpc_slice_new ( & x , 1 , do_nothing ) ; <nl> GPR_ASSERT ( slice . refcount ) ; <nl> GPR_ASSERT ( slice . data . refcounted . bytes = = & x ) ; <nl> GPR_ASSERT ( slice . data . refcounted . length = = 1 ) ; <nl> - gpr_slice_unref ( slice ) ; <nl> + grpc_slice_unref ( slice ) ; <nl> } <nl> <nl> / * destroy function that sets a mark to indicate it was called . * / <nl> static void set_mark ( void * p ) { * ( ( int * ) p ) = 1 ; } <nl> static void test_slice_new_with_user_data ( void ) { <nl> int marker = 0 ; <nl> uint8_t buf [ 2 ] ; <nl> - gpr_slice slice ; <nl> + grpc_slice slice ; <nl> <nl> buf [ 0 ] = 0 ; <nl> buf [ 1 ] = 1 ; <nl> - slice = gpr_slice_new_with_user_data ( buf , 2 , set_mark , & marker ) ; <nl> + slice = grpc_slice_new_with_user_data ( buf , 2 , set_mark , & marker ) ; <nl> GPR_ASSERT ( marker = = 0 ) ; <nl> GPR_ASSERT ( GPR_SLICE_LENGTH ( slice ) = = 2 ) ; <nl> GPR_ASSERT ( GPR_SLICE_START_PTR ( slice ) [ 0 ] = = 0 ) ; <nl> GPR_ASSERT ( GPR_SLICE_START_PTR ( slice ) [ 1 ] = = 1 ) ; <nl> <nl> / * unref should cause destroy function to run . * / <nl> - gpr_slice_unref ( slice ) ; <nl> + grpc_slice_unref ( slice ) ; <nl> GPR_ASSERT ( marker = = 1 ) ; <nl> } <nl> <nl> static void test_slice_new_with_len_returns_something_sensible ( void ) { <nl> int num_refs = 5 ; / * To test adding / removing an arbitrary number of refs * / <nl> int i ; <nl> <nl> - gpr_slice slice = gpr_slice_new_with_len ( & x , 1 , do_nothing_with_len_1 ) ; <nl> + grpc_slice slice = grpc_slice_new_with_len ( & x , 1 , do_nothing_with_len_1 ) ; <nl> GPR_ASSERT ( slice . refcount ) ; / * ref count is initialized to 1 at this point * / <nl> GPR_ASSERT ( slice . data . refcounted . bytes = = & x ) ; <nl> GPR_ASSERT ( slice . data . refcounted . length = = 1 ) ; <nl> static void test_slice_new_with_len_returns_something_sensible ( void ) { <nl> make sure that that the destroy callback ( i . e do_nothing_with_len_1 ( ) ) is <nl> not called until the last unref operation * / <nl> for ( i = 0 ; i < num_refs ; i + + ) { <nl> - gpr_slice_ref ( slice ) ; <nl> + grpc_slice_ref ( slice ) ; <nl> } <nl> for ( i = 0 ; i < num_refs ; i + + ) { <nl> - gpr_slice_unref ( slice ) ; <nl> + grpc_slice_unref ( slice ) ; <nl> } <nl> GPR_ASSERT ( do_nothing_with_len_1_calls = = 0 ) ; / * Shouldn ' t be called yet * / <nl> <nl> / * last unref * / <nl> - gpr_slice_unref ( slice ) ; <nl> + grpc_slice_unref ( slice ) ; <nl> GPR_ASSERT ( do_nothing_with_len_1_calls = = 1 ) ; <nl> } <nl> <nl> static void test_slice_sub_works ( unsigned length ) { <nl> - gpr_slice slice ; <nl> - gpr_slice sub ; <nl> + grpc_slice slice ; <nl> + grpc_slice sub ; <nl> unsigned i , j , k ; <nl> <nl> LOG_TEST_NAME ( " test_slice_sub_works " ) ; <nl> static void test_slice_sub_works ( unsigned length ) { <nl> <nl> / * Create a slice in which each byte is equal to the distance from it to the <nl> beginning of the slice . * / <nl> - slice = gpr_slice_malloc ( length ) ; <nl> + slice = grpc_slice_malloc ( length ) ; <nl> for ( i = 0 ; i < length ; i + + ) { <nl> GPR_SLICE_START_PTR ( slice ) [ i ] = ( uint8_t ) i ; <nl> } <nl> static void test_slice_sub_works ( unsigned length ) { <nl> correct byte . Additionally check that no copies were made . * / <nl> for ( i = 0 ; i < length ; i + + ) { <nl> for ( j = i ; j < length ; j + + ) { <nl> - sub = gpr_slice_sub ( slice , i , j ) ; <nl> + sub = grpc_slice_sub ( slice , i , j ) ; <nl> GPR_ASSERT ( GPR_SLICE_LENGTH ( sub ) = = j - i ) ; <nl> for ( k = 0 ; k < j - i ; k + + ) { <nl> GPR_ASSERT ( GPR_SLICE_START_PTR ( sub ) [ k ] = = ( uint8_t ) ( i + k ) ) ; <nl> } <nl> - gpr_slice_unref ( sub ) ; <nl> + grpc_slice_unref ( sub ) ; <nl> } <nl> } <nl> - gpr_slice_unref ( slice ) ; <nl> + grpc_slice_unref ( slice ) ; <nl> } <nl> <nl> - static void check_head_tail ( gpr_slice slice , gpr_slice head , gpr_slice tail ) { <nl> + static void check_head_tail ( grpc_slice slice , grpc_slice head , grpc_slice tail ) { <nl> GPR_ASSERT ( GPR_SLICE_LENGTH ( slice ) = = <nl> GPR_SLICE_LENGTH ( head ) + GPR_SLICE_LENGTH ( tail ) ) ; <nl> GPR_ASSERT ( 0 = = memcmp ( GPR_SLICE_START_PTR ( slice ) , GPR_SLICE_START_PTR ( head ) , <nl> static void check_head_tail ( gpr_slice slice , gpr_slice head , gpr_slice tail ) { <nl> } <nl> <nl> static void test_slice_split_head_works ( size_t length ) { <nl> - gpr_slice slice ; <nl> - gpr_slice head , tail ; <nl> + grpc_slice slice ; <nl> + grpc_slice head , tail ; <nl> size_t i ; <nl> <nl> LOG_TEST_NAME ( " test_slice_split_head_works " ) ; <nl> static void test_slice_split_head_works ( size_t length ) { <nl> <nl> / * Create a slice in which each byte is equal to the distance from it to the <nl> beginning of the slice . * / <nl> - slice = gpr_slice_malloc ( length ) ; <nl> + slice = grpc_slice_malloc ( length ) ; <nl> for ( i = 0 ; i < length ; i + + ) { <nl> GPR_SLICE_START_PTR ( slice ) [ i ] = ( uint8_t ) i ; <nl> } <nl> static void test_slice_split_head_works ( size_t length ) { <nl> / * Ensure that for all subsets length is correct and that we start on the <nl> correct byte . Additionally check that no copies were made . * / <nl> for ( i = 0 ; i < length ; i + + ) { <nl> - tail = gpr_slice_ref ( slice ) ; <nl> - head = gpr_slice_split_head ( & tail , i ) ; <nl> + tail = grpc_slice_ref ( slice ) ; <nl> + head = grpc_slice_split_head ( & tail , i ) ; <nl> check_head_tail ( slice , head , tail ) ; <nl> - gpr_slice_unref ( tail ) ; <nl> - gpr_slice_unref ( head ) ; <nl> + grpc_slice_unref ( tail ) ; <nl> + grpc_slice_unref ( head ) ; <nl> } <nl> <nl> - gpr_slice_unref ( slice ) ; <nl> + grpc_slice_unref ( slice ) ; <nl> } <nl> <nl> static void test_slice_split_tail_works ( size_t length ) { <nl> - gpr_slice slice ; <nl> - gpr_slice head , tail ; <nl> + grpc_slice slice ; <nl> + grpc_slice head , tail ; <nl> size_t i ; <nl> <nl> LOG_TEST_NAME ( " test_slice_split_tail_works " ) ; <nl> static void test_slice_split_tail_works ( size_t length ) { <nl> <nl> / * Create a slice in which each byte is equal to the distance from it to the <nl> beginning of the slice . * / <nl> - slice = gpr_slice_malloc ( length ) ; <nl> + slice = grpc_slice_malloc ( length ) ; <nl> for ( i = 0 ; i < length ; i + + ) { <nl> GPR_SLICE_START_PTR ( slice ) [ i ] = ( uint8_t ) i ; <nl> } <nl> static void test_slice_split_tail_works ( size_t length ) { <nl> / * Ensure that for all subsets length is correct and that we start on the <nl> correct byte . Additionally check that no copies were made . * / <nl> for ( i = 0 ; i < length ; i + + ) { <nl> - head = gpr_slice_ref ( slice ) ; <nl> - tail = gpr_slice_split_tail ( & head , i ) ; <nl> + head = grpc_slice_ref ( slice ) ; <nl> + tail = grpc_slice_split_tail ( & head , i ) ; <nl> check_head_tail ( slice , head , tail ) ; <nl> - gpr_slice_unref ( tail ) ; <nl> - gpr_slice_unref ( head ) ; <nl> + grpc_slice_unref ( tail ) ; <nl> + grpc_slice_unref ( head ) ; <nl> } <nl> <nl> - gpr_slice_unref ( slice ) ; <nl> + grpc_slice_unref ( slice ) ; <nl> } <nl> <nl> static void test_slice_from_copied_string_works ( void ) { <nl> static const char * text = " HELLO WORLD ! " ; <nl> - gpr_slice slice ; <nl> + grpc_slice slice ; <nl> <nl> LOG_TEST_NAME ( " test_slice_from_copied_string_works " ) ; <nl> <nl> - slice = gpr_slice_from_copied_string ( text ) ; <nl> + slice = grpc_slice_from_copied_string ( text ) ; <nl> GPR_ASSERT ( strlen ( text ) = = GPR_SLICE_LENGTH ( slice ) ) ; <nl> GPR_ASSERT ( 0 = = <nl> memcmp ( text , GPR_SLICE_START_PTR ( slice ) , GPR_SLICE_LENGTH ( slice ) ) ) ; <nl> - gpr_slice_unref ( slice ) ; <nl> + grpc_slice_unref ( slice ) ; <nl> } <nl> <nl> int main ( int argc , char * * argv ) { <nl> mmm a / test / core / support / string_test . c <nl> ppp b / test / core / support / string_test . c <nl> static void test_dump ( void ) { <nl> expect_dump ( " ab " , 2 , GPR_DUMP_HEX | GPR_DUMP_ASCII , " 61 62 ' ab ' " ) ; <nl> } <nl> <nl> - static void expect_slice_dump ( gpr_slice slice , uint32_t flags , <nl> - const char * result ) { <nl> - char * got = gpr_dump_slice ( slice , flags ) ; <nl> - GPR_ASSERT ( 0 = = strcmp ( got , result ) ) ; <nl> - gpr_free ( got ) ; <nl> - gpr_slice_unref ( slice ) ; <nl> - } <nl> - <nl> - static void test_dump_slice ( void ) { <nl> - static const char * text = " HELLO WORLD ! " ; <nl> - static const char * long_text = <nl> - " It was a bright cold day in April , and the clocks were striking " <nl> - " thirteen . Winston Smith , his chin nuzzled into his breast in an effort " <nl> - " to escape the vile wind , slipped quickly through the glass doors of " <nl> - " Victory Mansions , though not quickly enough to prevent a swirl of " <nl> - " gritty dust from entering along with him . " ; <nl> - <nl> - LOG_TEST_NAME ( " test_dump_slice " ) ; <nl> - <nl> - expect_slice_dump ( gpr_slice_from_copied_string ( text ) , GPR_DUMP_ASCII , text ) ; <nl> - expect_slice_dump ( gpr_slice_from_copied_string ( long_text ) , GPR_DUMP_ASCII , <nl> - long_text ) ; <nl> - expect_slice_dump ( gpr_slice_from_copied_buffer ( " \ x01 " , 1 ) , GPR_DUMP_HEX , <nl> - " 01 " ) ; <nl> - expect_slice_dump ( gpr_slice_from_copied_buffer ( " \ x01 " , 1 ) , <nl> - GPR_DUMP_HEX | GPR_DUMP_ASCII , " 01 ' . ' " ) ; <nl> - } <nl> - <nl> static void test_pu32_fail ( const char * s ) { <nl> uint32_t out ; <nl> GPR_ASSERT ( ! gpr_parse_bytes_to_uint32 ( s , strlen ( s ) , & out ) ) ; <nl> static void test_strjoin_sep ( void ) { <nl> gpr_free ( joined ) ; <nl> } <nl> <nl> - static void test_strsplit ( void ) { <nl> - gpr_slice_buffer * parts ; <nl> - gpr_slice str ; <nl> - <nl> - LOG_TEST_NAME ( " test_strsplit " ) ; <nl> - <nl> - parts = gpr_malloc ( sizeof ( gpr_slice_buffer ) ) ; <nl> - gpr_slice_buffer_init ( parts ) ; <nl> - <nl> - str = gpr_slice_from_copied_string ( " one , two , three , four " ) ; <nl> - gpr_slice_split ( str , " , " , parts ) ; <nl> - GPR_ASSERT ( 4 = = parts - > count ) ; <nl> - GPR_ASSERT ( 0 = = gpr_slice_str_cmp ( parts - > slices [ 0 ] , " one " ) ) ; <nl> - GPR_ASSERT ( 0 = = gpr_slice_str_cmp ( parts - > slices [ 1 ] , " two " ) ) ; <nl> - GPR_ASSERT ( 0 = = gpr_slice_str_cmp ( parts - > slices [ 2 ] , " three " ) ) ; <nl> - GPR_ASSERT ( 0 = = gpr_slice_str_cmp ( parts - > slices [ 3 ] , " four " ) ) ; <nl> - gpr_slice_buffer_reset_and_unref ( parts ) ; <nl> - gpr_slice_unref ( str ) ; <nl> - <nl> - / * separator not present in string * / <nl> - str = gpr_slice_from_copied_string ( " one two three four " ) ; <nl> - gpr_slice_split ( str , " , " , parts ) ; <nl> - GPR_ASSERT ( 1 = = parts - > count ) ; <nl> - GPR_ASSERT ( 0 = = gpr_slice_str_cmp ( parts - > slices [ 0 ] , " one two three four " ) ) ; <nl> - gpr_slice_buffer_reset_and_unref ( parts ) ; <nl> - gpr_slice_unref ( str ) ; <nl> - <nl> - / * separator at the end * / <nl> - str = gpr_slice_from_copied_string ( " foo , " ) ; <nl> - gpr_slice_split ( str , " , " , parts ) ; <nl> - GPR_ASSERT ( 2 = = parts - > count ) ; <nl> - GPR_ASSERT ( 0 = = gpr_slice_str_cmp ( parts - > slices [ 0 ] , " foo " ) ) ; <nl> - GPR_ASSERT ( 0 = = gpr_slice_str_cmp ( parts - > slices [ 1 ] , " " ) ) ; <nl> - gpr_slice_buffer_reset_and_unref ( parts ) ; <nl> - gpr_slice_unref ( str ) ; <nl> - <nl> - / * separator at the beginning * / <nl> - str = gpr_slice_from_copied_string ( " , foo " ) ; <nl> - gpr_slice_split ( str , " , " , parts ) ; <nl> - GPR_ASSERT ( 2 = = parts - > count ) ; <nl> - GPR_ASSERT ( 0 = = gpr_slice_str_cmp ( parts - > slices [ 0 ] , " " ) ) ; <nl> - GPR_ASSERT ( 0 = = gpr_slice_str_cmp ( parts - > slices [ 1 ] , " foo " ) ) ; <nl> - gpr_slice_buffer_reset_and_unref ( parts ) ; <nl> - gpr_slice_unref ( str ) ; <nl> - <nl> - / * standalone separator * / <nl> - str = gpr_slice_from_copied_string ( " , " ) ; <nl> - gpr_slice_split ( str , " , " , parts ) ; <nl> - GPR_ASSERT ( 2 = = parts - > count ) ; <nl> - GPR_ASSERT ( 0 = = gpr_slice_str_cmp ( parts - > slices [ 0 ] , " " ) ) ; <nl> - GPR_ASSERT ( 0 = = gpr_slice_str_cmp ( parts - > slices [ 1 ] , " " ) ) ; <nl> - gpr_slice_buffer_reset_and_unref ( parts ) ; <nl> - gpr_slice_unref ( str ) ; <nl> - <nl> - / * empty input * / <nl> - str = gpr_slice_from_copied_string ( " " ) ; <nl> - gpr_slice_split ( str , " , " , parts ) ; <nl> - GPR_ASSERT ( 1 = = parts - > count ) ; <nl> - GPR_ASSERT ( 0 = = gpr_slice_str_cmp ( parts - > slices [ 0 ] , " " ) ) ; <nl> - gpr_slice_buffer_reset_and_unref ( parts ) ; <nl> - gpr_slice_unref ( str ) ; <nl> - <nl> - gpr_slice_buffer_destroy ( parts ) ; <nl> - gpr_free ( parts ) ; <nl> - } <nl> - <nl> static void test_ltoa ( ) { <nl> char * str ; <nl> char buf [ GPR_LTOA_MIN_BUFSIZE ] ; <nl> mmm a / test / core / surface / byte_buffer_reader_test . c <nl> ppp b / test / core / surface / byte_buffer_reader_test . c <nl> <nl> # define LOG_TEST ( x ) gpr_log ( GPR_INFO , " % s " , x ) <nl> <nl> static void test_read_one_slice ( void ) { <nl> - gpr_slice slice ; <nl> + grpc_slice slice ; <nl> grpc_byte_buffer * buffer ; <nl> grpc_byte_buffer_reader reader ; <nl> - gpr_slice first_slice , second_slice ; <nl> + grpc_slice first_slice , second_slice ; <nl> int first_code , second_code ; <nl> <nl> LOG_TEST ( " test_read_one_slice " ) ; <nl> - slice = gpr_slice_from_copied_string ( " test " ) ; <nl> + slice = grpc_slice_from_copied_string ( " test " ) ; <nl> buffer = grpc_raw_byte_buffer_create ( & slice , 1 ) ; <nl> - gpr_slice_unref ( slice ) ; <nl> + grpc_slice_unref ( slice ) ; <nl> GPR_ASSERT ( grpc_byte_buffer_reader_init ( & reader , buffer ) & & <nl> " Couldn ' t init byte buffer reader " ) ; <nl> first_code = grpc_byte_buffer_reader_next ( & reader , & first_slice ) ; <nl> GPR_ASSERT ( first_code ! = 0 ) ; <nl> GPR_ASSERT ( memcmp ( GPR_SLICE_START_PTR ( first_slice ) , " test " , 4 ) = = 0 ) ; <nl> - gpr_slice_unref ( first_slice ) ; <nl> + grpc_slice_unref ( first_slice ) ; <nl> second_code = grpc_byte_buffer_reader_next ( & reader , & second_slice ) ; <nl> GPR_ASSERT ( second_code = = 0 ) ; <nl> grpc_byte_buffer_destroy ( buffer ) ; <nl> } <nl> <nl> static void test_read_one_slice_malloc ( void ) { <nl> - gpr_slice slice ; <nl> + grpc_slice slice ; <nl> grpc_byte_buffer * buffer ; <nl> grpc_byte_buffer_reader reader ; <nl> - gpr_slice first_slice , second_slice ; <nl> + grpc_slice first_slice , second_slice ; <nl> int first_code , second_code ; <nl> <nl> LOG_TEST ( " test_read_one_slice_malloc " ) ; <nl> - slice = gpr_slice_malloc ( 4 ) ; <nl> + slice = grpc_slice_malloc ( 4 ) ; <nl> memcpy ( GPR_SLICE_START_PTR ( slice ) , " test " , 4 ) ; <nl> buffer = grpc_raw_byte_buffer_create ( & slice , 1 ) ; <nl> - gpr_slice_unref ( slice ) ; <nl> + grpc_slice_unref ( slice ) ; <nl> GPR_ASSERT ( grpc_byte_buffer_reader_init ( & reader , buffer ) & & <nl> " Couldn ' t init byte buffer reader " ) ; <nl> first_code = grpc_byte_buffer_reader_next ( & reader , & first_slice ) ; <nl> GPR_ASSERT ( first_code ! = 0 ) ; <nl> GPR_ASSERT ( memcmp ( GPR_SLICE_START_PTR ( first_slice ) , " test " , 4 ) = = 0 ) ; <nl> - gpr_slice_unref ( first_slice ) ; <nl> + grpc_slice_unref ( first_slice ) ; <nl> second_code = grpc_byte_buffer_reader_next ( & reader , & second_slice ) ; <nl> GPR_ASSERT ( second_code = = 0 ) ; <nl> grpc_byte_buffer_destroy ( buffer ) ; <nl> } <nl> <nl> static void test_read_none_compressed_slice ( void ) { <nl> - gpr_slice slice ; <nl> + grpc_slice slice ; <nl> grpc_byte_buffer * buffer ; <nl> grpc_byte_buffer_reader reader ; <nl> - gpr_slice first_slice , second_slice ; <nl> + grpc_slice first_slice , second_slice ; <nl> int first_code , second_code ; <nl> <nl> LOG_TEST ( " test_read_none_compressed_slice " ) ; <nl> - slice = gpr_slice_from_copied_string ( " test " ) ; <nl> + slice = grpc_slice_from_copied_string ( " test " ) ; <nl> buffer = grpc_raw_byte_buffer_create ( & slice , 1 ) ; <nl> - gpr_slice_unref ( slice ) ; <nl> + grpc_slice_unref ( slice ) ; <nl> GPR_ASSERT ( grpc_byte_buffer_reader_init ( & reader , buffer ) & & <nl> " Couldn ' t init byte buffer reader " ) ; <nl> first_code = grpc_byte_buffer_reader_next ( & reader , & first_slice ) ; <nl> GPR_ASSERT ( first_code ! = 0 ) ; <nl> GPR_ASSERT ( memcmp ( GPR_SLICE_START_PTR ( first_slice ) , " test " , 4 ) = = 0 ) ; <nl> - gpr_slice_unref ( first_slice ) ; <nl> + grpc_slice_unref ( first_slice ) ; <nl> second_code = grpc_byte_buffer_reader_next ( & reader , & second_slice ) ; <nl> GPR_ASSERT ( second_code = = 0 ) ; <nl> grpc_byte_buffer_destroy ( buffer ) ; <nl> } <nl> <nl> static void test_read_corrupted_slice ( void ) { <nl> - gpr_slice slice ; <nl> + grpc_slice slice ; <nl> grpc_byte_buffer * buffer ; <nl> grpc_byte_buffer_reader reader ; <nl> <nl> LOG_TEST ( " test_read_corrupted_slice " ) ; <nl> - slice = gpr_slice_from_copied_string ( " test " ) ; <nl> + slice = grpc_slice_from_copied_string ( " test " ) ; <nl> buffer = grpc_raw_byte_buffer_create ( & slice , 1 ) ; <nl> buffer - > data . raw . compression = GRPC_COMPRESS_GZIP ; / * lies ! * / <nl> - gpr_slice_unref ( slice ) ; <nl> + grpc_slice_unref ( slice ) ; <nl> GPR_ASSERT ( ! grpc_byte_buffer_reader_init ( & reader , buffer ) ) ; <nl> grpc_byte_buffer_destroy ( buffer ) ; <nl> } <nl> <nl> static void read_compressed_slice ( grpc_compression_algorithm algorithm , <nl> size_t input_size ) { <nl> - gpr_slice input_slice ; <nl> - gpr_slice_buffer sliceb_in ; <nl> - gpr_slice_buffer sliceb_out ; <nl> + grpc_slice input_slice ; <nl> + grpc_slice_buffer sliceb_in ; <nl> + grpc_slice_buffer sliceb_out ; <nl> grpc_byte_buffer * buffer ; <nl> grpc_byte_buffer_reader reader ; <nl> - gpr_slice read_slice ; <nl> + grpc_slice read_slice ; <nl> size_t read_count = 0 ; <nl> <nl> - gpr_slice_buffer_init ( & sliceb_in ) ; <nl> - gpr_slice_buffer_init ( & sliceb_out ) ; <nl> + grpc_slice_buffer_init ( & sliceb_in ) ; <nl> + grpc_slice_buffer_init ( & sliceb_out ) ; <nl> <nl> - input_slice = gpr_slice_malloc ( input_size ) ; <nl> + input_slice = grpc_slice_malloc ( input_size ) ; <nl> memset ( GPR_SLICE_START_PTR ( input_slice ) , ' a ' , input_size ) ; <nl> - gpr_slice_buffer_add ( & sliceb_in , input_slice ) ; / * takes ownership * / <nl> + grpc_slice_buffer_add ( & sliceb_in , input_slice ) ; / * takes ownership * / <nl> GPR_ASSERT ( grpc_msg_compress ( algorithm , & sliceb_in , & sliceb_out ) ) ; <nl> <nl> buffer = grpc_raw_compressed_byte_buffer_create ( sliceb_out . slices , <nl> static void read_compressed_slice ( grpc_compression_algorithm algorithm , <nl> GPR_SLICE_START_PTR ( input_slice ) + read_count , <nl> GPR_SLICE_LENGTH ( read_slice ) ) = = 0 ) ; <nl> read_count + = GPR_SLICE_LENGTH ( read_slice ) ; <nl> - gpr_slice_unref ( read_slice ) ; <nl> + grpc_slice_unref ( read_slice ) ; <nl> } <nl> GPR_ASSERT ( read_count = = input_size ) ; <nl> grpc_byte_buffer_reader_destroy ( & reader ) ; <nl> grpc_byte_buffer_destroy ( buffer ) ; <nl> - gpr_slice_buffer_destroy ( & sliceb_out ) ; <nl> - gpr_slice_buffer_destroy ( & sliceb_in ) ; <nl> + grpc_slice_buffer_destroy ( & sliceb_out ) ; <nl> + grpc_slice_buffer_destroy ( & sliceb_in ) ; <nl> } <nl> <nl> static void test_read_gzip_compressed_slice ( void ) { <nl> static void test_read_deflate_compressed_slice ( void ) { <nl> } <nl> <nl> static void test_byte_buffer_from_reader ( void ) { <nl> - gpr_slice slice ; <nl> + grpc_slice slice ; <nl> grpc_byte_buffer * buffer , * buffer_from_reader ; <nl> grpc_byte_buffer_reader reader ; <nl> <nl> LOG_TEST ( " test_byte_buffer_from_reader " ) ; <nl> - slice = gpr_slice_malloc ( 4 ) ; <nl> + slice = grpc_slice_malloc ( 4 ) ; <nl> memcpy ( GPR_SLICE_START_PTR ( slice ) , " test " , 4 ) ; <nl> buffer = grpc_raw_byte_buffer_create ( & slice , 1 ) ; <nl> - gpr_slice_unref ( slice ) ; <nl> + grpc_slice_unref ( slice ) ; <nl> GPR_ASSERT ( grpc_byte_buffer_reader_init ( & reader , buffer ) & & <nl> " Couldn ' t init byte buffer reader " ) ; <nl> <nl> static void test_byte_buffer_from_reader ( void ) { <nl> static void test_readall ( void ) { <nl> char * lotsa_as [ 512 ] ; <nl> char * lotsa_bs [ 1024 ] ; <nl> - gpr_slice slices [ 2 ] ; <nl> + grpc_slice slices [ 2 ] ; <nl> grpc_byte_buffer * buffer ; <nl> grpc_byte_buffer_reader reader ; <nl> - gpr_slice slice_out ; <nl> + grpc_slice slice_out ; <nl> <nl> LOG_TEST ( " test_readall " ) ; <nl> <nl> memset ( lotsa_as , ' a ' , 512 ) ; <nl> memset ( lotsa_bs , ' b ' , 1024 ) ; <nl> / * use slices large enough to overflow inlining * / <nl> - slices [ 0 ] = gpr_slice_malloc ( 512 ) ; <nl> + slices [ 0 ] = grpc_slice_malloc ( 512 ) ; <nl> memcpy ( GPR_SLICE_START_PTR ( slices [ 0 ] ) , lotsa_as , 512 ) ; <nl> - slices [ 1 ] = gpr_slice_malloc ( 1024 ) ; <nl> + slices [ 1 ] = grpc_slice_malloc ( 1024 ) ; <nl> memcpy ( GPR_SLICE_START_PTR ( slices [ 1 ] ) , lotsa_bs , 1024 ) ; <nl> <nl> buffer = grpc_raw_byte_buffer_create ( slices , 2 ) ; <nl> - gpr_slice_unref ( slices [ 0 ] ) ; <nl> - gpr_slice_unref ( slices [ 1 ] ) ; <nl> + grpc_slice_unref ( slices [ 0 ] ) ; <nl> + grpc_slice_unref ( slices [ 1 ] ) ; <nl> <nl> GPR_ASSERT ( grpc_byte_buffer_reader_init ( & reader , buffer ) & & <nl> " Couldn ' t init byte buffer reader " ) ; <nl> static void test_readall ( void ) { <nl> GPR_ASSERT ( memcmp ( GPR_SLICE_START_PTR ( slice_out ) , lotsa_as , 512 ) = = 0 ) ; <nl> GPR_ASSERT ( memcmp ( & ( GPR_SLICE_START_PTR ( slice_out ) [ 512 ] ) , lotsa_bs , 1024 ) = = <nl> 0 ) ; <nl> - gpr_slice_unref ( slice_out ) ; <nl> + grpc_slice_unref ( slice_out ) ; <nl> grpc_byte_buffer_destroy ( buffer ) ; <nl> } <nl> <nl> static void test_byte_buffer_copy ( void ) { <nl> char * lotsa_as [ 512 ] ; <nl> char * lotsa_bs [ 1024 ] ; <nl> - gpr_slice slices [ 2 ] ; <nl> + grpc_slice slices [ 2 ] ; <nl> grpc_byte_buffer * buffer ; <nl> grpc_byte_buffer * copied_buffer ; <nl> grpc_byte_buffer_reader reader ; <nl> - gpr_slice slice_out ; <nl> + grpc_slice slice_out ; <nl> <nl> LOG_TEST ( " test_byte_buffer_copy " ) ; <nl> <nl> memset ( lotsa_as , ' a ' , 512 ) ; <nl> memset ( lotsa_bs , ' b ' , 1024 ) ; <nl> / * use slices large enough to overflow inlining * / <nl> - slices [ 0 ] = gpr_slice_malloc ( 512 ) ; <nl> + slices [ 0 ] = grpc_slice_malloc ( 512 ) ; <nl> memcpy ( GPR_SLICE_START_PTR ( slices [ 0 ] ) , lotsa_as , 512 ) ; <nl> - slices [ 1 ] = gpr_slice_malloc ( 1024 ) ; <nl> + slices [ 1 ] = grpc_slice_malloc ( 1024 ) ; <nl> memcpy ( GPR_SLICE_START_PTR ( slices [ 1 ] ) , lotsa_bs , 1024 ) ; <nl> <nl> buffer = grpc_raw_byte_buffer_create ( slices , 2 ) ; <nl> - gpr_slice_unref ( slices [ 0 ] ) ; <nl> - gpr_slice_unref ( slices [ 1 ] ) ; <nl> + grpc_slice_unref ( slices [ 0 ] ) ; <nl> + grpc_slice_unref ( slices [ 1 ] ) ; <nl> copied_buffer = grpc_byte_buffer_copy ( buffer ) ; <nl> <nl> GPR_ASSERT ( grpc_byte_buffer_reader_init ( & reader , buffer ) & & <nl> static void test_byte_buffer_copy ( void ) { <nl> GPR_ASSERT ( memcmp ( GPR_SLICE_START_PTR ( slice_out ) , lotsa_as , 512 ) = = 0 ) ; <nl> GPR_ASSERT ( memcmp ( & ( GPR_SLICE_START_PTR ( slice_out ) [ 512 ] ) , lotsa_bs , 1024 ) = = <nl> 0 ) ; <nl> - gpr_slice_unref ( slice_out ) ; <nl> + grpc_slice_unref ( slice_out ) ; <nl> grpc_byte_buffer_destroy ( buffer ) ; <nl> grpc_byte_buffer_destroy ( copied_buffer ) ; <nl> } <nl> mmm a / test / core / transport / chttp2 / bin_decoder_test . c <nl> ppp b / test / core / transport / chttp2 / bin_decoder_test . c <nl> <nl> <nl> static int all_ok = 1 ; <nl> <nl> - static void expect_slice_eq ( gpr_slice expected , gpr_slice slice , char * debug , <nl> + static void expect_slice_eq ( grpc_slice expected , grpc_slice slice , char * debug , <nl> int line ) { <nl> - if ( 0 ! = gpr_slice_cmp ( slice , expected ) ) { <nl> + if ( 0 ! = grpc_slice_cmp ( slice , expected ) ) { <nl> char * hs = gpr_dump_slice ( slice , GPR_DUMP_HEX | GPR_DUMP_ASCII ) ; <nl> char * he = gpr_dump_slice ( expected , GPR_DUMP_HEX | GPR_DUMP_ASCII ) ; <nl> gpr_log ( GPR_ERROR , " FAILED : % d : % s \ ngot : % s \ nwant : % s " , line , debug , hs , <nl> static void expect_slice_eq ( gpr_slice expected , gpr_slice slice , char * debug , <nl> gpr_free ( he ) ; <nl> all_ok = 0 ; <nl> } <nl> - gpr_slice_unref ( expected ) ; <nl> - gpr_slice_unref ( slice ) ; <nl> + grpc_slice_unref ( expected ) ; <nl> + grpc_slice_unref ( slice ) ; <nl> } <nl> <nl> - static gpr_slice base64_encode ( const char * s ) { <nl> - gpr_slice ss = gpr_slice_from_copied_string ( s ) ; <nl> - gpr_slice out = grpc_chttp2_base64_encode ( ss ) ; <nl> - gpr_slice_unref ( ss ) ; <nl> + static grpc_slice base64_encode ( const char * s ) { <nl> + grpc_slice ss = grpc_slice_from_copied_string ( s ) ; <nl> + grpc_slice out = grpc_chttp2_base64_encode ( ss ) ; <nl> + grpc_slice_unref ( ss ) ; <nl> return out ; <nl> } <nl> <nl> - static gpr_slice base64_decode ( const char * s ) { <nl> - gpr_slice ss = gpr_slice_from_copied_string ( s ) ; <nl> - gpr_slice out = grpc_chttp2_base64_decode ( ss ) ; <nl> - gpr_slice_unref ( ss ) ; <nl> + static grpc_slice base64_decode ( const char * s ) { <nl> + grpc_slice ss = grpc_slice_from_copied_string ( s ) ; <nl> + grpc_slice out = grpc_chttp2_base64_decode ( ss ) ; <nl> + grpc_slice_unref ( ss ) ; <nl> return out ; <nl> } <nl> <nl> - static gpr_slice base64_decode_with_length ( const char * s , <nl> + static grpc_slice base64_decode_with_length ( const char * s , <nl> size_t output_length ) { <nl> - gpr_slice ss = gpr_slice_from_copied_string ( s ) ; <nl> - gpr_slice out = grpc_chttp2_base64_decode_with_length ( ss , output_length ) ; <nl> - gpr_slice_unref ( ss ) ; <nl> + grpc_slice ss = grpc_slice_from_copied_string ( s ) ; <nl> + grpc_slice out = grpc_chttp2_base64_decode_with_length ( ss , output_length ) ; <nl> + grpc_slice_unref ( ss ) ; <nl> return out ; <nl> } <nl> <nl> # define EXPECT_SLICE_EQ ( expected , slice ) \ <nl> expect_slice_eq ( \ <nl> - gpr_slice_from_copied_buffer ( expected , sizeof ( expected ) - 1 ) , slice , \ <nl> + grpc_slice_from_copied_buffer ( expected , sizeof ( expected ) - 1 ) , slice , \ <nl> # slice , __LINE__ ) ; <nl> <nl> # define ENCODE_AND_DECODE ( s ) \ <nl> mmm a / test / core / transport / chttp2 / bin_encoder_test . c <nl> ppp b / test / core / transport / chttp2 / bin_encoder_test . c <nl> <nl> <nl> static int all_ok = 1 ; <nl> <nl> - static void expect_slice_eq ( gpr_slice expected , gpr_slice slice , char * debug , <nl> + static void expect_slice_eq ( grpc_slice expected , grpc_slice slice , char * debug , <nl> int line ) { <nl> - if ( 0 ! = gpr_slice_cmp ( slice , expected ) ) { <nl> + if ( 0 ! = grpc_slice_cmp ( slice , expected ) ) { <nl> char * hs = gpr_dump_slice ( slice , GPR_DUMP_HEX | GPR_DUMP_ASCII ) ; <nl> char * he = gpr_dump_slice ( expected , GPR_DUMP_HEX | GPR_DUMP_ASCII ) ; <nl> gpr_log ( GPR_ERROR , " FAILED : % d : % s \ ngot : % s \ nwant : % s " , line , debug , hs , <nl> static void expect_slice_eq ( gpr_slice expected , gpr_slice slice , char * debug , <nl> gpr_free ( he ) ; <nl> all_ok = 0 ; <nl> } <nl> - gpr_slice_unref ( expected ) ; <nl> - gpr_slice_unref ( slice ) ; <nl> + grpc_slice_unref ( expected ) ; <nl> + grpc_slice_unref ( slice ) ; <nl> } <nl> <nl> - static gpr_slice B64 ( const char * s ) { <nl> - gpr_slice ss = gpr_slice_from_copied_string ( s ) ; <nl> - gpr_slice out = grpc_chttp2_base64_encode ( ss ) ; <nl> - gpr_slice_unref ( ss ) ; <nl> + static grpc_slice B64 ( const char * s ) { <nl> + grpc_slice ss = grpc_slice_from_copied_string ( s ) ; <nl> + grpc_slice out = grpc_chttp2_base64_encode ( ss ) ; <nl> + grpc_slice_unref ( ss ) ; <nl> return out ; <nl> } <nl> <nl> - static gpr_slice HUFF ( const char * s ) { <nl> - gpr_slice ss = gpr_slice_from_copied_string ( s ) ; <nl> - gpr_slice out = grpc_chttp2_huffman_compress ( ss ) ; <nl> - gpr_slice_unref ( ss ) ; <nl> + static grpc_slice HUFF ( const char * s ) { <nl> + grpc_slice ss = grpc_slice_from_copied_string ( s ) ; <nl> + grpc_slice out = grpc_chttp2_huffman_compress ( ss ) ; <nl> + grpc_slice_unref ( ss ) ; <nl> return out ; <nl> } <nl> <nl> # define EXPECT_SLICE_EQ ( expected , slice ) \ <nl> expect_slice_eq ( \ <nl> - gpr_slice_from_copied_buffer ( expected , sizeof ( expected ) - 1 ) , slice , \ <nl> + grpc_slice_from_copied_buffer ( expected , sizeof ( expected ) - 1 ) , slice , \ <nl> # slice , __LINE__ ) ; <nl> <nl> static void expect_combined_equiv ( const char * s , size_t len , int line ) { <nl> - gpr_slice input = gpr_slice_from_copied_buffer ( s , len ) ; <nl> - gpr_slice base64 = grpc_chttp2_base64_encode ( input ) ; <nl> - gpr_slice expect = grpc_chttp2_huffman_compress ( base64 ) ; <nl> - gpr_slice got = grpc_chttp2_base64_encode_and_huffman_compress_impl ( input ) ; <nl> - if ( 0 ! = gpr_slice_cmp ( expect , got ) ) { <nl> + grpc_slice input = grpc_slice_from_copied_buffer ( s , len ) ; <nl> + grpc_slice base64 = grpc_chttp2_base64_encode ( input ) ; <nl> + grpc_slice expect = grpc_chttp2_huffman_compress ( base64 ) ; <nl> + grpc_slice got = grpc_chttp2_base64_encode_and_huffman_compress_impl ( input ) ; <nl> + if ( 0 ! = grpc_slice_cmp ( expect , got ) ) { <nl> char * t = gpr_dump_slice ( input , GPR_DUMP_HEX | GPR_DUMP_ASCII ) ; <nl> char * e = gpr_dump_slice ( expect , GPR_DUMP_HEX | GPR_DUMP_ASCII ) ; <nl> char * g = gpr_dump_slice ( got , GPR_DUMP_HEX | GPR_DUMP_ASCII ) ; <nl> static void expect_combined_equiv ( const char * s , size_t len , int line ) { <nl> gpr_free ( g ) ; <nl> all_ok = 0 ; <nl> } <nl> - gpr_slice_unref ( input ) ; <nl> - gpr_slice_unref ( base64 ) ; <nl> - gpr_slice_unref ( expect ) ; <nl> - gpr_slice_unref ( got ) ; <nl> + grpc_slice_unref ( input ) ; <nl> + grpc_slice_unref ( base64 ) ; <nl> + grpc_slice_unref ( expect ) ; <nl> + grpc_slice_unref ( got ) ; <nl> } <nl> <nl> # define EXPECT_COMBINED_EQUIV ( x ) \ <nl> mmm a / test / core / transport / chttp2 / hpack_encoder_test . c <nl> ppp b / test / core / transport / chttp2 / hpack_encoder_test . c <nl> size_t cap_to_delete = 0 ; <nl> hexstring passed in * / <nl> static void verify ( size_t window_available , int eof , size_t expect_window_used , <nl> const char * expected , size_t nheaders , . . . ) { <nl> - gpr_slice_buffer output ; <nl> - gpr_slice merged ; <nl> - gpr_slice expect = parse_hexstring ( expected ) ; <nl> + grpc_slice_buffer output ; <nl> + grpc_slice merged ; <nl> + grpc_slice expect = parse_hexstring ( expected ) ; <nl> size_t i ; <nl> va_list l ; <nl> grpc_linked_mdelem * e = gpr_malloc ( sizeof ( * e ) * nheaders ) ; <nl> static void verify ( size_t window_available , int eof , size_t expect_window_used , <nl> } <nl> to_delete [ num_to_delete + + ] = e ; <nl> <nl> - gpr_slice_buffer_init ( & output ) ; <nl> + grpc_slice_buffer_init ( & output ) ; <nl> <nl> grpc_transport_one_way_stats stats ; <nl> memset ( & stats , 0 , sizeof ( stats ) ) ; <nl> grpc_chttp2_encode_header ( & g_compressor , 0xdeadbeef , & b , eof , 16384 , & stats , <nl> & output ) ; <nl> merged = grpc_slice_merge ( output . slices , output . count ) ; <nl> - gpr_slice_buffer_destroy ( & output ) ; <nl> + grpc_slice_buffer_destroy ( & output ) ; <nl> grpc_metadata_batch_destroy ( & b ) ; <nl> <nl> - if ( 0 ! = gpr_slice_cmp ( merged , expect ) ) { <nl> + if ( 0 ! = grpc_slice_cmp ( merged , expect ) ) { <nl> char * expect_str = gpr_dump_slice ( expect , GPR_DUMP_HEX | GPR_DUMP_ASCII ) ; <nl> char * got_str = gpr_dump_slice ( merged , GPR_DUMP_HEX | GPR_DUMP_ASCII ) ; <nl> gpr_log ( GPR_ERROR , " mismatched output for % s " , expected ) ; <nl> static void verify ( size_t window_available , int eof , size_t expect_window_used , <nl> g_failure = 1 ; <nl> } <nl> <nl> - gpr_slice_unref ( merged ) ; <nl> - gpr_slice_unref ( expect ) ; <nl> + grpc_slice_unref ( merged ) ; <nl> + grpc_slice_unref ( expect ) ; <nl> } <nl> <nl> static void test_basic_headers ( void ) { <nl> static void test_decode_table_overflow ( void ) { <nl> <nl> static void verify_table_size_change_match_elem_size ( const char * key , <nl> const char * value ) { <nl> - gpr_slice_buffer output ; <nl> + grpc_slice_buffer output ; <nl> grpc_mdelem * elem = grpc_mdelem_from_strings ( key , value ) ; <nl> size_t elem_size = grpc_mdelem_get_size_in_hpack_table ( elem ) ; <nl> size_t initial_table_size = g_compressor . table_size ; <nl> static void verify_table_size_change_match_elem_size ( const char * key , <nl> e [ 0 ] . next = NULL ; <nl> b . list . head = & e [ 0 ] ; <nl> b . list . tail = & e [ 0 ] ; <nl> - gpr_slice_buffer_init ( & output ) ; <nl> + grpc_slice_buffer_init ( & output ) ; <nl> <nl> grpc_transport_one_way_stats stats ; <nl> memset ( & stats , 0 , sizeof ( stats ) ) ; <nl> grpc_chttp2_encode_header ( & g_compressor , 0xdeadbeef , & b , 0 , 16384 , & stats , <nl> & output ) ; <nl> - gpr_slice_buffer_destroy ( & output ) ; <nl> + grpc_slice_buffer_destroy ( & output ) ; <nl> grpc_metadata_batch_destroy ( & b ) ; <nl> <nl> GPR_ASSERT ( g_compressor . table_size = = elem_size + initial_table_size ) ; <nl> mmm a / test / core / transport / chttp2 / hpack_parser_test . c <nl> ppp b / test / core / transport / chttp2 / hpack_parser_test . c <nl> static void onhdr ( grpc_exec_ctx * exec_ctx , void * ud , grpc_mdelem * md ) { <nl> GPR_ASSERT ( ekey ) ; <nl> evalue = va_arg ( chk - > args , char * ) ; <nl> GPR_ASSERT ( evalue ) ; <nl> - GPR_ASSERT ( gpr_slice_str_cmp ( md - > key - > slice , ekey ) = = 0 ) ; <nl> - GPR_ASSERT ( gpr_slice_str_cmp ( md - > value - > slice , evalue ) = = 0 ) ; <nl> + GPR_ASSERT ( grpc_slice_str_cmp ( md - > key - > slice , ekey ) = = 0 ) ; <nl> + GPR_ASSERT ( grpc_slice_str_cmp ( md - > value - > slice , evalue ) = = 0 ) ; <nl> GRPC_MDELEM_UNREF ( md ) ; <nl> } <nl> <nl> static void test_vector ( grpc_chttp2_hpack_parser * parser , <nl> grpc_slice_split_mode mode , const char * hexstring , <nl> . . . / * char * key , char * value * / ) { <nl> - gpr_slice input = parse_hexstring ( hexstring ) ; <nl> - gpr_slice * slices ; <nl> + grpc_slice input = parse_hexstring ( hexstring ) ; <nl> + grpc_slice * slices ; <nl> size_t nslices ; <nl> size_t i ; <nl> test_checker chk ; <nl> static void test_vector ( grpc_chttp2_hpack_parser * parser , <nl> parser - > on_header_user_data = & chk ; <nl> <nl> grpc_split_slices ( mode , & input , 1 , & slices , & nslices ) ; <nl> - gpr_slice_unref ( input ) ; <nl> + grpc_slice_unref ( input ) ; <nl> <nl> for ( i = 0 ; i < nslices ; i + + ) { <nl> grpc_exec_ctx exec_ctx = GRPC_EXEC_CTX_INIT ; <nl> static void test_vector ( grpc_chttp2_hpack_parser * parser , <nl> } <nl> <nl> for ( i = 0 ; i < nslices ; i + + ) { <nl> - gpr_slice_unref ( slices [ i ] ) ; <nl> + grpc_slice_unref ( slices [ i ] ) ; <nl> } <nl> gpr_free ( slices ) ; <nl> <nl> mmm a / test / core / transport / chttp2 / hpack_table_test . c <nl> ppp b / test / core / transport / chttp2 / hpack_table_test . c <nl> <nl> <nl> static void assert_str ( const grpc_chttp2_hptbl * tbl , grpc_mdstr * mdstr , <nl> const char * str ) { <nl> - GPR_ASSERT ( gpr_slice_str_cmp ( mdstr - > slice , str ) = = 0 ) ; <nl> + GPR_ASSERT ( grpc_slice_str_cmp ( mdstr - > slice , str ) = = 0 ) ; <nl> } <nl> <nl> static void assert_index ( const grpc_chttp2_hptbl * tbl , uint32_t idx , <nl> mmm a / test / core / transport / chttp2 / varint_test . c <nl> ppp b / test / core / transport / chttp2 / varint_test . c <nl> <nl> static void test_varint ( uint32_t value , uint32_t prefix_bits , uint8_t prefix_or , <nl> const char * expect_bytes , size_t expect_length ) { <nl> uint32_t nbytes = GRPC_CHTTP2_VARINT_LENGTH ( value , prefix_bits ) ; <nl> - gpr_slice expect = gpr_slice_from_copied_buffer ( expect_bytes , expect_length ) ; <nl> - gpr_slice slice ; <nl> + grpc_slice expect = grpc_slice_from_copied_buffer ( expect_bytes , expect_length ) ; <nl> + grpc_slice slice ; <nl> gpr_log ( GPR_DEBUG , " Test : 0x % 08x " , value ) ; <nl> GPR_ASSERT ( nbytes = = expect_length ) ; <nl> - slice = gpr_slice_malloc ( nbytes ) ; <nl> + slice = grpc_slice_malloc ( nbytes ) ; <nl> GRPC_CHTTP2_WRITE_VARINT ( value , prefix_bits , prefix_or , <nl> GPR_SLICE_START_PTR ( slice ) , nbytes ) ; <nl> - GPR_ASSERT ( gpr_slice_cmp ( expect , slice ) = = 0 ) ; <nl> - gpr_slice_unref ( expect ) ; <nl> - gpr_slice_unref ( slice ) ; <nl> + GPR_ASSERT ( grpc_slice_cmp ( expect , slice ) = = 0 ) ; <nl> + grpc_slice_unref ( expect ) ; <nl> + grpc_slice_unref ( slice ) ; <nl> } <nl> <nl> # define TEST_VARINT ( value , prefix_bits , prefix_or , expect ) \ <nl> mmm a / test / core / transport / metadata_test . c <nl> ppp b / test / core / transport / metadata_test . c <nl> static void test_create_string ( void ) { <nl> s3 = grpc_mdstr_from_string ( " very much not hello " ) ; <nl> GPR_ASSERT ( s1 = = s2 ) ; <nl> GPR_ASSERT ( s3 ! = s1 ) ; <nl> - GPR_ASSERT ( gpr_slice_str_cmp ( s1 - > slice , " hello " ) = = 0 ) ; <nl> - GPR_ASSERT ( gpr_slice_str_cmp ( s3 - > slice , " very much not hello " ) = = 0 ) ; <nl> + GPR_ASSERT ( grpc_slice_str_cmp ( s1 - > slice , " hello " ) = = 0 ) ; <nl> + GPR_ASSERT ( grpc_slice_str_cmp ( s3 - > slice , " very much not hello " ) = = 0 ) ; <nl> GRPC_MDSTR_UNREF ( s1 ) ; <nl> GRPC_MDSTR_UNREF ( s2 ) ; <nl> GRPC_MDSTR_UNREF ( s3 ) ; <nl> static void test_create_metadata ( void ) { <nl> GPR_ASSERT ( m3 ! = m1 ) ; <nl> GPR_ASSERT ( m3 - > key = = m1 - > key ) ; <nl> GPR_ASSERT ( m3 - > value ! = m1 - > value ) ; <nl> - GPR_ASSERT ( gpr_slice_str_cmp ( m1 - > key - > slice , " a " ) = = 0 ) ; <nl> - GPR_ASSERT ( gpr_slice_str_cmp ( m1 - > value - > slice , " b " ) = = 0 ) ; <nl> - GPR_ASSERT ( gpr_slice_str_cmp ( m3 - > value - > slice , " c " ) = = 0 ) ; <nl> + GPR_ASSERT ( grpc_slice_str_cmp ( m1 - > key - > slice , " a " ) = = 0 ) ; <nl> + GPR_ASSERT ( grpc_slice_str_cmp ( m1 - > value - > slice , " b " ) = = 0 ) ; <nl> + GPR_ASSERT ( grpc_slice_str_cmp ( m3 - > value - > slice , " c " ) = = 0 ) ; <nl> GRPC_MDELEM_UNREF ( m1 ) ; <nl> GRPC_MDELEM_UNREF ( m2 ) ; <nl> GRPC_MDELEM_UNREF ( m3 ) ; <nl> static void test_things_stick_around ( void ) { <nl> static void test_slices_work ( void ) { <nl> / * ensure no memory leaks when switching representation from mdstr to slice * / <nl> grpc_mdstr * str ; <nl> - gpr_slice slice ; <nl> + grpc_slice slice ; <nl> <nl> LOG_TEST ( " test_slices_work " ) ; <nl> <nl> static void test_slices_work ( void ) { <nl> <nl> str = grpc_mdstr_from_string ( <nl> " 123456789012345678901234567890123456789012345678901234567890 " ) ; <nl> - slice = gpr_slice_ref ( str - > slice ) ; <nl> + slice = grpc_slice_ref ( str - > slice ) ; <nl> GRPC_MDSTR_UNREF ( str ) ; <nl> - gpr_slice_unref ( slice ) ; <nl> + grpc_slice_unref ( slice ) ; <nl> <nl> str = grpc_mdstr_from_string ( <nl> " 123456789012345678901234567890123456789012345678901234567890 " ) ; <nl> - slice = gpr_slice_ref ( str - > slice ) ; <nl> - gpr_slice_unref ( slice ) ; <nl> + slice = grpc_slice_ref ( str - > slice ) ; <nl> + grpc_slice_unref ( slice ) ; <nl> GRPC_MDSTR_UNREF ( str ) ; <nl> <nl> grpc_shutdown ( ) ; <nl> static void test_slices_work ( void ) { <nl> <nl> static void test_base64_and_huffman_works ( void ) { <nl> grpc_mdstr * str ; <nl> - gpr_slice slice1 ; <nl> - gpr_slice slice2 ; <nl> + grpc_slice slice1 ; <nl> + grpc_slice slice2 ; <nl> <nl> LOG_TEST ( " test_base64_and_huffman_works " ) ; <nl> <nl> static void test_base64_and_huffman_works ( void ) { <nl> str = grpc_mdstr_from_string ( " abcdefg " ) ; <nl> slice1 = grpc_mdstr_as_base64_encoded_and_huffman_compressed ( str ) ; <nl> slice2 = grpc_chttp2_base64_encode_and_huffman_compress ( str - > slice ) ; <nl> - GPR_ASSERT ( 0 = = gpr_slice_cmp ( slice1 , slice2 ) ) ; <nl> + GPR_ASSERT ( 0 = = grpc_slice_cmp ( slice1 , slice2 ) ) ; <nl> <nl> - gpr_slice_unref ( slice2 ) ; <nl> + grpc_slice_unref ( slice2 ) ; <nl> GRPC_MDSTR_UNREF ( str ) ; <nl> grpc_shutdown ( ) ; <nl> } <nl> static void verify_binary_header_size ( const char * key , const uint8_t * value , <nl> grpc_mdelem * elem = grpc_mdelem_from_string_and_buffer ( key , value , value_len ) ; <nl> GPR_ASSERT ( grpc_is_binary_header ( key , strlen ( key ) ) ) ; <nl> size_t elem_size = grpc_mdelem_get_size_in_hpack_table ( elem ) ; <nl> - gpr_slice value_slice = <nl> - gpr_slice_from_copied_buffer ( ( const char * ) value , value_len ) ; <nl> - gpr_slice base64_encoded = grpc_chttp2_base64_encode ( value_slice ) ; <nl> + grpc_slice value_slice = <nl> + grpc_slice_from_copied_buffer ( ( const char * ) value , value_len ) ; <nl> + grpc_slice base64_encoded = grpc_chttp2_base64_encode ( value_slice ) ; <nl> size_t expected_size = 32 + strlen ( key ) + GPR_SLICE_LENGTH ( base64_encoded ) ; <nl> GPR_ASSERT ( expected_size = = elem_size ) ; <nl> - gpr_slice_unref ( value_slice ) ; <nl> - gpr_slice_unref ( base64_encoded ) ; <nl> + grpc_slice_unref ( value_slice ) ; <nl> + grpc_slice_unref ( base64_encoded ) ; <nl> GRPC_MDELEM_UNREF ( elem ) ; <nl> } <nl> <nl> mmm a / test / core / util / mock_endpoint . c <nl> ppp b / test / core / util / mock_endpoint . c <nl> typedef struct grpc_mock_endpoint { <nl> grpc_endpoint base ; <nl> gpr_mu mu ; <nl> int refs ; <nl> - void ( * on_write ) ( gpr_slice slice ) ; <nl> - gpr_slice_buffer read_buffer ; <nl> - gpr_slice_buffer * on_read_out ; <nl> + void ( * on_write ) ( grpc_slice slice ) ; <nl> + grpc_slice_buffer read_buffer ; <nl> + grpc_slice_buffer * on_read_out ; <nl> grpc_closure * on_read ; <nl> grpc_resource_user resource_user ; <nl> } grpc_mock_endpoint ; <nl> <nl> static void me_read ( grpc_exec_ctx * exec_ctx , grpc_endpoint * ep , <nl> - gpr_slice_buffer * slices , grpc_closure * cb ) { <nl> + grpc_slice_buffer * slices , grpc_closure * cb ) { <nl> grpc_mock_endpoint * m = ( grpc_mock_endpoint * ) ep ; <nl> gpr_mu_lock ( & m - > mu ) ; <nl> if ( m - > read_buffer . count > 0 ) { <nl> - gpr_slice_buffer_swap ( & m - > read_buffer , slices ) ; <nl> + grpc_slice_buffer_swap ( & m - > read_buffer , slices ) ; <nl> grpc_exec_ctx_sched ( exec_ctx , cb , GRPC_ERROR_NONE , NULL ) ; <nl> } else { <nl> m - > on_read = cb ; <nl> static void me_read ( grpc_exec_ctx * exec_ctx , grpc_endpoint * ep , <nl> } <nl> <nl> static void me_write ( grpc_exec_ctx * exec_ctx , grpc_endpoint * ep , <nl> - gpr_slice_buffer * slices , grpc_closure * cb ) { <nl> + grpc_slice_buffer * slices , grpc_closure * cb ) { <nl> grpc_mock_endpoint * m = ( grpc_mock_endpoint * ) ep ; <nl> for ( size_t i = 0 ; i < slices - > count ; i + + ) { <nl> m - > on_write ( slices - > slices [ i ] ) ; <nl> static void unref ( grpc_exec_ctx * exec_ctx , grpc_mock_endpoint * m ) { <nl> gpr_mu_lock ( & m - > mu ) ; <nl> if ( 0 = = - - m - > refs ) { <nl> gpr_mu_unlock ( & m - > mu ) ; <nl> - gpr_slice_buffer_destroy ( & m - > read_buffer ) ; <nl> + grpc_slice_buffer_destroy ( & m - > read_buffer ) ; <nl> grpc_resource_user_destroy ( exec_ctx , & m - > resource_user ) ; <nl> gpr_free ( m ) ; <nl> } else { <nl> static const grpc_endpoint_vtable vtable = { <nl> me_get_peer , <nl> } ; <nl> <nl> - grpc_endpoint * grpc_mock_endpoint_create ( void ( * on_write ) ( gpr_slice slice ) , <nl> + grpc_endpoint * grpc_mock_endpoint_create ( void ( * on_write ) ( grpc_slice slice ) , <nl> grpc_resource_quota * resource_quota ) { <nl> grpc_mock_endpoint * m = gpr_malloc ( sizeof ( * m ) ) ; <nl> m - > base . vtable = & vtable ; <nl> grpc_endpoint * grpc_mock_endpoint_create ( void ( * on_write ) ( gpr_slice slice ) , <nl> gpr_asprintf ( & name , " mock_endpoint_ % " PRIxPTR , ( intptr_t ) m ) ; <nl> grpc_resource_user_init ( & m - > resource_user , resource_quota , name ) ; <nl> gpr_free ( name ) ; <nl> - gpr_slice_buffer_init ( & m - > read_buffer ) ; <nl> + grpc_slice_buffer_init ( & m - > read_buffer ) ; <nl> gpr_mu_init ( & m - > mu ) ; <nl> m - > on_write = on_write ; <nl> m - > on_read = NULL ; <nl> grpc_endpoint * grpc_mock_endpoint_create ( void ( * on_write ) ( gpr_slice slice ) , <nl> } <nl> <nl> void grpc_mock_endpoint_put_read ( grpc_exec_ctx * exec_ctx , grpc_endpoint * ep , <nl> - gpr_slice slice ) { <nl> + grpc_slice slice ) { <nl> grpc_mock_endpoint * m = ( grpc_mock_endpoint * ) ep ; <nl> gpr_mu_lock ( & m - > mu ) ; <nl> if ( m - > on_read ! = NULL ) { <nl> - gpr_slice_buffer_add ( m - > on_read_out , slice ) ; <nl> + grpc_slice_buffer_add ( m - > on_read_out , slice ) ; <nl> grpc_exec_ctx_sched ( exec_ctx , m - > on_read , GRPC_ERROR_NONE , NULL ) ; <nl> m - > on_read = NULL ; <nl> } else { <nl> - gpr_slice_buffer_add ( & m - > read_buffer , slice ) ; <nl> + grpc_slice_buffer_add ( & m - > read_buffer , slice ) ; <nl> } <nl> gpr_mu_unlock ( & m - > mu ) ; <nl> } <nl> mmm a / test / core / util / mock_endpoint . h <nl> ppp b / test / core / util / mock_endpoint . h <nl> <nl> <nl> # include " src / core / lib / iomgr / endpoint . h " <nl> <nl> - grpc_endpoint * grpc_mock_endpoint_create ( void ( * on_write ) ( gpr_slice slice ) , <nl> + grpc_endpoint * grpc_mock_endpoint_create ( void ( * on_write ) ( grpc_slice slice ) , <nl> grpc_resource_quota * resource_quota ) ; <nl> void grpc_mock_endpoint_put_read ( grpc_exec_ctx * exec_ctx , <nl> - grpc_endpoint * mock_endpoint , gpr_slice slice ) ; <nl> + grpc_endpoint * mock_endpoint , grpc_slice slice ) ; <nl> <nl> # endif <nl> mmm a / test / core / util / one_corpus_entry_fuzzer . c <nl> ppp b / test / core / util / one_corpus_entry_fuzzer . c <nl> extern bool squelch ; <nl> extern bool leak_check ; <nl> <nl> int main ( int argc , char * * argv ) { <nl> - gpr_slice buffer ; <nl> + grpc_slice buffer ; <nl> squelch = false ; <nl> leak_check = false ; <nl> GPR_ASSERT ( <nl> GRPC_LOG_IF_ERROR ( " load_file " , grpc_load_file ( argv [ 1 ] , 0 , & buffer ) ) ) ; <nl> LLVMFuzzerTestOneInput ( GPR_SLICE_START_PTR ( buffer ) , GPR_SLICE_LENGTH ( buffer ) ) ; <nl> - gpr_slice_unref ( buffer ) ; <nl> + grpc_slice_unref ( buffer ) ; <nl> return 0 ; <nl> } <nl> mmm a / test / core / util / parse_hexstring . c <nl> ppp b / test / core / util / parse_hexstring . c <nl> <nl> # include " test / core / util / parse_hexstring . h " <nl> # include < grpc / support / log . h > <nl> <nl> - gpr_slice parse_hexstring ( const char * hexstring ) { <nl> + grpc_slice parse_hexstring ( const char * hexstring ) { <nl> size_t nibbles = 0 ; <nl> const char * p = 0 ; <nl> uint8_t * out ; <nl> uint8_t temp ; <nl> - gpr_slice slice ; <nl> + grpc_slice slice ; <nl> <nl> for ( p = hexstring ; * p ; p + + ) { <nl> nibbles + = ( * p > = ' 0 ' & & * p < = ' 9 ' ) | | ( * p > = ' a ' & & * p < = ' f ' ) ; <nl> gpr_slice parse_hexstring ( const char * hexstring ) { <nl> <nl> GPR_ASSERT ( ( nibbles & 1 ) = = 0 ) ; <nl> <nl> - slice = gpr_slice_malloc ( nibbles / 2 ) ; <nl> + slice = grpc_slice_malloc ( nibbles / 2 ) ; <nl> out = GPR_SLICE_START_PTR ( slice ) ; <nl> <nl> nibbles = 0 ; <nl> mmm a / test / core / util / parse_hexstring . h <nl> ppp b / test / core / util / parse_hexstring . h <nl> <nl> <nl> # include < grpc / support / slice . h > <nl> <nl> - gpr_slice parse_hexstring ( const char * hexstring ) ; <nl> + grpc_slice parse_hexstring ( const char * hexstring ) ; <nl> <nl> # endif / * GRPC_TEST_CORE_UTIL_PARSE_HEXSTRING_H * / <nl> mmm a / test / core / util / passthru_endpoint . c <nl> ppp b / test / core / util / passthru_endpoint . c <nl> typedef struct passthru_endpoint passthru_endpoint ; <nl> typedef struct { <nl> grpc_endpoint base ; <nl> passthru_endpoint * parent ; <nl> - gpr_slice_buffer read_buffer ; <nl> - gpr_slice_buffer * on_read_out ; <nl> + grpc_slice_buffer read_buffer ; <nl> + grpc_slice_buffer * on_read_out ; <nl> grpc_closure * on_read ; <nl> grpc_resource_user resource_user ; <nl> } half ; <nl> struct passthru_endpoint { <nl> } ; <nl> <nl> static void me_read ( grpc_exec_ctx * exec_ctx , grpc_endpoint * ep , <nl> - gpr_slice_buffer * slices , grpc_closure * cb ) { <nl> + grpc_slice_buffer * slices , grpc_closure * cb ) { <nl> half * m = ( half * ) ep ; <nl> gpr_mu_lock ( & m - > parent - > mu ) ; <nl> if ( m - > parent - > shutdown ) { <nl> grpc_exec_ctx_sched ( exec_ctx , cb , GRPC_ERROR_CREATE ( " Already shutdown " ) , <nl> NULL ) ; <nl> } else if ( m - > read_buffer . count > 0 ) { <nl> - gpr_slice_buffer_swap ( & m - > read_buffer , slices ) ; <nl> + grpc_slice_buffer_swap ( & m - > read_buffer , slices ) ; <nl> grpc_exec_ctx_sched ( exec_ctx , cb , GRPC_ERROR_NONE , NULL ) ; <nl> } else { <nl> m - > on_read = cb ; <nl> static half * other_half ( half * h ) { <nl> } <nl> <nl> static void me_write ( grpc_exec_ctx * exec_ctx , grpc_endpoint * ep , <nl> - gpr_slice_buffer * slices , grpc_closure * cb ) { <nl> + grpc_slice_buffer * slices , grpc_closure * cb ) { <nl> half * m = other_half ( ( half * ) ep ) ; <nl> gpr_mu_lock ( & m - > parent - > mu ) ; <nl> grpc_error * error = GRPC_ERROR_NONE ; <nl> static void me_write ( grpc_exec_ctx * exec_ctx , grpc_endpoint * ep , <nl> error = GRPC_ERROR_CREATE ( " Endpoint already shutdown " ) ; <nl> } else if ( m - > on_read ! = NULL ) { <nl> for ( size_t i = 0 ; i < slices - > count ; i + + ) { <nl> - gpr_slice_buffer_add ( m - > on_read_out , gpr_slice_ref ( slices - > slices [ i ] ) ) ; <nl> + grpc_slice_buffer_add ( m - > on_read_out , grpc_slice_ref ( slices - > slices [ i ] ) ) ; <nl> } <nl> grpc_exec_ctx_sched ( exec_ctx , m - > on_read , GRPC_ERROR_NONE , NULL ) ; <nl> m - > on_read = NULL ; <nl> } else { <nl> for ( size_t i = 0 ; i < slices - > count ; i + + ) { <nl> - gpr_slice_buffer_add ( & m - > read_buffer , gpr_slice_ref ( slices - > slices [ i ] ) ) ; <nl> + grpc_slice_buffer_add ( & m - > read_buffer , grpc_slice_ref ( slices - > slices [ i ] ) ) ; <nl> } <nl> } <nl> gpr_mu_unlock ( & m - > parent - > mu ) ; <nl> static void me_really_destroy ( grpc_exec_ctx * exec_ctx , void * ep , <nl> if ( 0 = = - - p - > halves ) { <nl> gpr_mu_unlock ( & p - > mu ) ; <nl> gpr_mu_destroy ( & p - > mu ) ; <nl> - gpr_slice_buffer_destroy ( & p - > client . read_buffer ) ; <nl> - gpr_slice_buffer_destroy ( & p - > server . read_buffer ) ; <nl> + grpc_slice_buffer_destroy ( & p - > client . read_buffer ) ; <nl> + grpc_slice_buffer_destroy ( & p - > server . read_buffer ) ; <nl> gpr_free ( p ) ; <nl> } else { <nl> gpr_mu_unlock ( & p - > mu ) ; <nl> static void half_init ( half * m , passthru_endpoint * parent , <nl> const char * half_name ) { <nl> m - > base . vtable = & vtable ; <nl> m - > parent = parent ; <nl> - gpr_slice_buffer_init ( & m - > read_buffer ) ; <nl> + grpc_slice_buffer_init ( & m - > read_buffer ) ; <nl> m - > on_read = NULL ; <nl> char * name ; <nl> gpr_asprintf ( & name , " passthru_endpoint_ % s_ % " PRIxPTR , half_name , <nl> mmm a / test / core / util / slice_splitter . c <nl> ppp b / test / core / util / slice_splitter . c <nl> const char * grpc_slice_split_mode_name ( grpc_slice_split_mode mode ) { <nl> return " error " ; <nl> } <nl> <nl> - void grpc_split_slices ( grpc_slice_split_mode mode , gpr_slice * src_slices , <nl> - size_t src_slice_count , gpr_slice * * dst_slices , <nl> + void grpc_split_slices ( grpc_slice_split_mode mode , grpc_slice * src_slices , <nl> + size_t src_slice_count , grpc_slice * * dst_slices , <nl> size_t * dst_slice_count ) { <nl> size_t i , j ; <nl> size_t length ; <nl> void grpc_split_slices ( grpc_slice_split_mode mode , gpr_slice * src_slices , <nl> switch ( mode ) { <nl> case GRPC_SLICE_SPLIT_IDENTITY : <nl> * dst_slice_count = src_slice_count ; <nl> - * dst_slices = gpr_malloc ( sizeof ( gpr_slice ) * src_slice_count ) ; <nl> + * dst_slices = gpr_malloc ( sizeof ( grpc_slice ) * src_slice_count ) ; <nl> for ( i = 0 ; i < src_slice_count ; i + + ) { <nl> ( * dst_slices ) [ i ] = src_slices [ i ] ; <nl> - gpr_slice_ref ( ( * dst_slices ) [ i ] ) ; <nl> + grpc_slice_ref ( ( * dst_slices ) [ i ] ) ; <nl> } <nl> break ; <nl> case GRPC_SLICE_SPLIT_MERGE_ALL : <nl> void grpc_split_slices ( grpc_slice_split_mode mode , gpr_slice * src_slices , <nl> for ( i = 0 ; i < src_slice_count ; i + + ) { <nl> length + = GPR_SLICE_LENGTH ( src_slices [ i ] ) ; <nl> } <nl> - * dst_slices = gpr_malloc ( sizeof ( gpr_slice ) ) ; <nl> - * * dst_slices = gpr_slice_malloc ( length ) ; <nl> + * dst_slices = gpr_malloc ( sizeof ( grpc_slice ) ) ; <nl> + * * dst_slices = grpc_slice_malloc ( length ) ; <nl> length = 0 ; <nl> for ( i = 0 ; i < src_slice_count ; i + + ) { <nl> memcpy ( GPR_SLICE_START_PTR ( * * dst_slices ) + length , <nl> void grpc_split_slices ( grpc_slice_split_mode mode , gpr_slice * src_slices , <nl> length + = GPR_SLICE_LENGTH ( src_slices [ i ] ) ; <nl> } <nl> * dst_slice_count = length ; <nl> - * dst_slices = gpr_malloc ( sizeof ( gpr_slice ) * length ) ; <nl> + * dst_slices = gpr_malloc ( sizeof ( grpc_slice ) * length ) ; <nl> length = 0 ; <nl> for ( i = 0 ; i < src_slice_count ; i + + ) { <nl> for ( j = 0 ; j < GPR_SLICE_LENGTH ( src_slices [ i ] ) ; j + + ) { <nl> - ( * dst_slices ) [ length ] = gpr_slice_sub ( src_slices [ i ] , j , j + 1 ) ; <nl> + ( * dst_slices ) [ length ] = grpc_slice_sub ( src_slices [ i ] , j , j + 1 ) ; <nl> length + + ; <nl> } <nl> } <nl> void grpc_split_slices ( grpc_slice_split_mode mode , gpr_slice * src_slices , <nl> } <nl> <nl> void grpc_split_slices_to_buffer ( grpc_slice_split_mode mode , <nl> - gpr_slice * src_slices , size_t src_slice_count , <nl> - gpr_slice_buffer * dst ) { <nl> - gpr_slice * slices ; <nl> + grpc_slice * src_slices , size_t src_slice_count , <nl> + grpc_slice_buffer * dst ) { <nl> + grpc_slice * slices ; <nl> size_t nslices ; <nl> size_t i ; <nl> grpc_split_slices ( mode , src_slices , src_slice_count , & slices , & nslices ) ; <nl> for ( i = 0 ; i < nslices ; i + + ) { <nl> / * add indexed to avoid re - merging split slices * / <nl> - gpr_slice_buffer_add_indexed ( dst , slices [ i ] ) ; <nl> + grpc_slice_buffer_add_indexed ( dst , slices [ i ] ) ; <nl> } <nl> gpr_free ( slices ) ; <nl> } <nl> <nl> - void grpc_split_slice_buffer ( grpc_slice_split_mode mode , gpr_slice_buffer * src , <nl> - gpr_slice_buffer * dst ) { <nl> + void grpc_split_slice_buffer ( grpc_slice_split_mode mode , grpc_slice_buffer * src , <nl> + grpc_slice_buffer * dst ) { <nl> grpc_split_slices_to_buffer ( mode , src - > slices , src - > count , dst ) ; <nl> } <nl> <nl> - gpr_slice grpc_slice_merge ( gpr_slice * slices , size_t nslices ) { <nl> + grpc_slice grpc_slice_merge ( grpc_slice * slices , size_t nslices ) { <nl> uint8_t * out = NULL ; <nl> size_t length = 0 ; <nl> size_t capacity = 0 ; <nl> gpr_slice grpc_slice_merge ( gpr_slice * slices , size_t nslices ) { <nl> length + = GPR_SLICE_LENGTH ( slices [ i ] ) ; <nl> } <nl> <nl> - return gpr_slice_new ( out , length , gpr_free ) ; <nl> + return grpc_slice_new ( out , length , gpr_free ) ; <nl> } <nl> mmm a / test / core / util / slice_splitter . h <nl> ppp b / test / core / util / slice_splitter . h <nl> typedef enum { <nl> <nl> / * allocates * dst_slices ; caller must unref all slices in dst_slices then free <nl> it * / <nl> - void grpc_split_slices ( grpc_slice_split_mode mode , gpr_slice * src_slices , <nl> - size_t src_slice_count , gpr_slice * * dst_slices , <nl> + void grpc_split_slices ( grpc_slice_split_mode mode , grpc_slice * src_slices , <nl> + size_t src_slice_count , grpc_slice * * dst_slices , <nl> size_t * dst_slice_count ) ; <nl> <nl> void grpc_split_slices_to_buffer ( grpc_slice_split_mode mode , <nl> - gpr_slice * src_slices , size_t src_slice_count , <nl> - gpr_slice_buffer * dst ) ; <nl> - void grpc_split_slice_buffer ( grpc_slice_split_mode mode , gpr_slice_buffer * src , <nl> - gpr_slice_buffer * dst ) ; <nl> + grpc_slice * src_slices , size_t src_slice_count , <nl> + grpc_slice_buffer * dst ) ; <nl> + void grpc_split_slice_buffer ( grpc_slice_split_mode mode , grpc_slice_buffer * src , <nl> + grpc_slice_buffer * dst ) ; <nl> <nl> - gpr_slice grpc_slice_merge ( gpr_slice * slices , size_t nslices ) ; <nl> + grpc_slice grpc_slice_merge ( grpc_slice * slices , size_t nslices ) ; <nl> <nl> const char * grpc_slice_split_mode_name ( grpc_slice_split_mode mode ) ; <nl> <nl> mmm a / test / cpp / grpclb / grpclb_api_test . cc <nl> ppp b / test / cpp / grpclb / grpclb_api_test . cc <nl> TEST_F ( GrpclbTest , CreateRequest ) { <nl> const grpc : : string service_name = " AServiceName " ; <nl> LoadBalanceRequest request ; <nl> grpc_grpclb_request * c_req = grpc_grpclb_request_create ( service_name . c_str ( ) ) ; <nl> - gpr_slice slice = grpc_grpclb_request_encode ( c_req ) ; <nl> + grpc_slice slice = grpc_grpclb_request_encode ( c_req ) ; <nl> const int num_bytes_written = GPR_SLICE_LENGTH ( slice ) ; <nl> EXPECT_GT ( num_bytes_written , 0 ) ; <nl> request . ParseFromArray ( GPR_SLICE_START_PTR ( slice ) , num_bytes_written ) ; <nl> EXPECT_EQ ( request . initial_request ( ) . name ( ) , service_name ) ; <nl> - gpr_slice_unref ( slice ) ; <nl> + grpc_slice_unref ( slice ) ; <nl> grpc_grpclb_request_destroy ( c_req ) ; <nl> } <nl> <nl> TEST_F ( GrpclbTest , ParseInitialResponse ) { <nl> client_stats_report_interval - > set_seconds ( 123 ) ; <nl> client_stats_report_interval - > set_nanos ( 456 ) ; <nl> const grpc : : string encoded_response = response . SerializeAsString ( ) ; <nl> - gpr_slice encoded_slice = <nl> - gpr_slice_from_copied_string ( encoded_response . c_str ( ) ) ; <nl> + grpc_slice encoded_slice = <nl> + grpc_slice_from_copied_string ( encoded_response . c_str ( ) ) ; <nl> <nl> grpc_grpclb_initial_response * c_initial_response = <nl> grpc_grpclb_initial_response_parse ( encoded_slice ) ; <nl> EXPECT_FALSE ( c_initial_response - > has_load_balancer_delegate ) ; <nl> EXPECT_EQ ( c_initial_response - > client_stats_report_interval . seconds , 123 ) ; <nl> EXPECT_EQ ( c_initial_response - > client_stats_report_interval . nanos , 456 ) ; <nl> - gpr_slice_unref ( encoded_slice ) ; <nl> + grpc_slice_unref ( encoded_slice ) ; <nl> grpc_grpclb_initial_response_destroy ( c_initial_response ) ; <nl> } <nl> <nl> TEST_F ( GrpclbTest , ParseResponseServerList ) { <nl> expiration_interval - > set_nanos ( 999 ) ; <nl> <nl> const grpc : : string encoded_response = response . SerializeAsString ( ) ; <nl> - const gpr_slice encoded_slice = gpr_slice_from_copied_buffer ( <nl> + const grpc_slice encoded_slice = grpc_slice_from_copied_buffer ( <nl> encoded_response . data ( ) , encoded_response . size ( ) ) ; <nl> grpc_grpclb_serverlist * c_serverlist = <nl> grpc_grpclb_response_parse_serverlist ( encoded_slice ) ; <nl> TEST_F ( GrpclbTest , ParseResponseServerList ) { <nl> EXPECT_TRUE ( c_serverlist - > expiration_interval . has_nanos ) ; <nl> EXPECT_EQ ( c_serverlist - > expiration_interval . nanos , 999 ) ; <nl> <nl> - gpr_slice_unref ( encoded_slice ) ; <nl> + grpc_slice_unref ( encoded_slice ) ; <nl> grpc_grpclb_destroy_serverlist ( c_serverlist ) ; <nl> } <nl> <nl> mmm a / test / cpp / grpclb / grpclb_test . cc <nl> ppp b / test / cpp / grpclb / grpclb_test . cc <nl> typedef struct test_fixture { <nl> <nl> static void * tag ( intptr_t t ) { return ( void * ) t ; } <nl> <nl> - static gpr_slice build_response_payload_slice ( <nl> + static grpc_slice build_response_payload_slice ( <nl> const char * host , int * ports , size_t nports , <nl> int64_t expiration_interval_secs , int32_t expiration_interval_nanos ) { <nl> / / server_list { <nl> static gpr_slice build_response_payload_slice ( <nl> server - > set_load_balance_token ( token_data ) ; <nl> } <nl> const grpc : : string & enc_resp = response . SerializeAsString ( ) ; <nl> - return gpr_slice_from_copied_buffer ( enc_resp . data ( ) , enc_resp . size ( ) ) ; <nl> + return grpc_slice_from_copied_buffer ( enc_resp . data ( ) , enc_resp . size ( ) ) ; <nl> } <nl> <nl> static void drain_cq ( grpc_completion_queue * cq ) { <nl> static void start_lb_server ( server_fixture * sf , int * ports , size_t nports , <nl> / / validate initial request . <nl> grpc_byte_buffer_reader bbr ; <nl> grpc_byte_buffer_reader_init ( & bbr , request_payload_recv ) ; <nl> - gpr_slice request_payload_slice = grpc_byte_buffer_reader_readall ( & bbr ) ; <nl> + grpc_slice request_payload_slice = grpc_byte_buffer_reader_readall ( & bbr ) ; <nl> grpc : : lb : : v1 : : LoadBalanceRequest request ; <nl> request . ParseFromArray ( GPR_SLICE_START_PTR ( request_payload_slice ) , <nl> GPR_SLICE_LENGTH ( request_payload_slice ) ) ; <nl> GPR_ASSERT ( request . has_initial_request ( ) ) ; <nl> GPR_ASSERT ( request . initial_request ( ) . name ( ) = = sf - > servers_hostport ) ; <nl> - gpr_slice_unref ( request_payload_slice ) ; <nl> + grpc_slice_unref ( request_payload_slice ) ; <nl> grpc_byte_buffer_reader_destroy ( & bbr ) ; <nl> grpc_byte_buffer_destroy ( request_payload_recv ) ; <nl> <nl> - gpr_slice response_payload_slice ; <nl> + grpc_slice response_payload_slice ; <nl> op = ops ; <nl> op - > op = GRPC_OP_SEND_INITIAL_METADATA ; <nl> op - > data . send_initial_metadata . count = 0 ; <nl> static void start_lb_server ( server_fixture * sf , int * ports , size_t nports , <nl> sf - > servers_hostport , i ) ; <nl> <nl> grpc_byte_buffer_destroy ( response_payload ) ; <nl> - gpr_slice_unref ( response_payload_slice ) ; <nl> + grpc_slice_unref ( response_payload_slice ) ; <nl> } <nl> gpr_log ( GPR_INFO , " LB Server [ % s ] shutting down " , sf - > servers_hostport ) ; <nl> <nl> static void start_backend_server ( server_fixture * sf ) { <nl> gpr_log ( GPR_INFO , " Server [ % s ] after tag 101 " , sf - > servers_hostport ) ; <nl> <nl> bool exit = false ; <nl> - gpr_slice response_payload_slice = gpr_slice_from_copied_string ( PAYLOAD ) ; <nl> + grpc_slice response_payload_slice = grpc_slice_from_copied_string ( PAYLOAD ) ; <nl> while ( ! exit ) { <nl> op = ops ; <nl> op - > op = GRPC_OP_RECV_MESSAGE ; <nl> static void start_backend_server ( server_fixture * sf ) { <nl> + + sf - > num_calls_serviced ; <nl> <nl> gpr_log ( GPR_INFO , " Server [ % s ] OUT OF THE LOOP " , sf - > servers_hostport ) ; <nl> - gpr_slice_unref ( response_payload_slice ) ; <nl> + grpc_slice_unref ( response_payload_slice ) ; <nl> <nl> op = ops ; <nl> op - > op = GRPC_OP_SEND_STATUS_FROM_SERVER ; <nl> static void perform_request ( client_fixture * cf ) { <nl> int i ; <nl> <nl> memset ( ops , 0 , sizeof ( ops ) ) ; <nl> - gpr_slice request_payload_slice = gpr_slice_from_copied_string ( " hello world " ) ; <nl> + grpc_slice request_payload_slice = grpc_slice_from_copied_string ( " hello world " ) ; <nl> <nl> c = grpc_channel_create_call ( cf - > client , NULL , GRPC_PROPAGATE_DEFAULTS , <nl> cf - > cq , " / foo " , " foo . test . google . fr : 1234 " , <nl> static void perform_request ( client_fixture * cf ) { <nl> grpc_byte_buffer_destroy ( response_payload_recv ) ; <nl> } <nl> <nl> - gpr_slice_unref ( request_payload_slice ) ; <nl> + grpc_slice_unref ( request_payload_slice ) ; <nl> <nl> op = ops ; <nl> op - > op = GRPC_OP_SEND_CLOSE_FROM_CLIENT ; <nl> mmm a / test / cpp / qps / client . h <nl> ppp b / test / cpp / qps / client . h <nl> class ClientRequestCreator < ByteBuffer > { <nl> if ( payload_config . has_bytebuf_params ( ) ) { <nl> std : : unique_ptr < char [ ] > buf ( <nl> new char [ payload_config . bytebuf_params ( ) . req_size ( ) ] ) ; <nl> - gpr_slice s = gpr_slice_from_copied_buffer ( <nl> + grpc_slice s = grpc_slice_from_copied_buffer ( <nl> buf . get ( ) , payload_config . bytebuf_params ( ) . req_size ( ) ) ; <nl> Slice slice ( s , Slice : : STEAL_REF ) ; <nl> * req = ByteBuffer ( & slice , 1 ) ; <nl> mmm a / test / cpp / qps / server_async . cc <nl> ppp b / test / cpp / qps / server_async . cc <nl> static Status ProcessGenericRPC ( const PayloadConfig & payload_config , <nl> ByteBuffer * response ) { <nl> int resp_size = payload_config . bytebuf_params ( ) . resp_size ( ) ; <nl> std : : unique_ptr < char [ ] > buf ( new char [ resp_size ] ) ; <nl> - gpr_slice s = gpr_slice_from_copied_buffer ( buf . get ( ) , resp_size ) ; <nl> + grpc_slice s = grpc_slice_from_copied_buffer ( buf . get ( ) , resp_size ) ; <nl> Slice slice ( s , Slice : : STEAL_REF ) ; <nl> * response = ByteBuffer ( & slice , 1 ) ; <nl> return Status : : OK ; <nl> mmm a / test / cpp / util / byte_buffer_proto_helper . cc <nl> ppp b / test / cpp / util / byte_buffer_proto_helper . cc <nl> std : : unique_ptr < ByteBuffer > SerializeToByteBuffer ( <nl> grpc : : protobuf : : Message * message ) { <nl> grpc : : string buf ; <nl> message - > SerializeToString ( & buf ) ; <nl> - gpr_slice s = gpr_slice_from_copied_string ( buf . c_str ( ) ) ; <nl> + grpc_slice s = grpc_slice_from_copied_string ( buf . c_str ( ) ) ; <nl> Slice slice ( s , Slice : : STEAL_REF ) ; <nl> return std : : unique_ptr < ByteBuffer > ( new ByteBuffer ( & slice , 1 ) ) ; <nl> } <nl> mmm a / test / cpp / util / byte_buffer_test . cc <nl> ppp b / test / cpp / util / byte_buffer_test . cc <nl> const char * kContent2 = " yyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyy world " ; <nl> class ByteBufferTest : public : : testing : : Test { } ; <nl> <nl> TEST_F ( ByteBufferTest , CreateFromSingleSlice ) { <nl> - gpr_slice hello = gpr_slice_from_copied_string ( kContent1 ) ; <nl> + grpc_slice hello = grpc_slice_from_copied_string ( kContent1 ) ; <nl> Slice s ( hello , Slice : : STEAL_REF ) ; <nl> ByteBuffer buffer ( & s , 1 ) ; <nl> } <nl> <nl> TEST_F ( ByteBufferTest , CreateFromVector ) { <nl> - gpr_slice hello = gpr_slice_from_copied_string ( kContent1 ) ; <nl> - gpr_slice world = gpr_slice_from_copied_string ( kContent2 ) ; <nl> + grpc_slice hello = grpc_slice_from_copied_string ( kContent1 ) ; <nl> + grpc_slice world = grpc_slice_from_copied_string ( kContent2 ) ; <nl> std : : vector < Slice > slices ; <nl> slices . push_back ( Slice ( hello , Slice : : STEAL_REF ) ) ; <nl> slices . push_back ( Slice ( world , Slice : : STEAL_REF ) ) ; <nl> TEST_F ( ByteBufferTest , CreateFromVector ) { <nl> } <nl> <nl> TEST_F ( ByteBufferTest , Clear ) { <nl> - gpr_slice hello = gpr_slice_from_copied_string ( kContent1 ) ; <nl> + grpc_slice hello = grpc_slice_from_copied_string ( kContent1 ) ; <nl> Slice s ( hello , Slice : : STEAL_REF ) ; <nl> ByteBuffer buffer ( & s , 1 ) ; <nl> buffer . Clear ( ) ; <nl> } <nl> <nl> TEST_F ( ByteBufferTest , Length ) { <nl> - gpr_slice hello = gpr_slice_from_copied_string ( kContent1 ) ; <nl> - gpr_slice world = gpr_slice_from_copied_string ( kContent2 ) ; <nl> + grpc_slice hello = grpc_slice_from_copied_string ( kContent1 ) ; <nl> + grpc_slice world = grpc_slice_from_copied_string ( kContent2 ) ; <nl> std : : vector < Slice > slices ; <nl> slices . push_back ( Slice ( hello , Slice : : STEAL_REF ) ) ; <nl> slices . push_back ( Slice ( world , Slice : : STEAL_REF ) ) ; <nl> TEST_F ( ByteBufferTest , Length ) { <nl> EXPECT_EQ ( strlen ( kContent1 ) + strlen ( kContent2 ) , buffer . Length ( ) ) ; <nl> } <nl> <nl> - bool SliceEqual ( const Slice & a , gpr_slice b ) { <nl> + bool SliceEqual ( const Slice & a , grpc_slice b ) { <nl> if ( a . size ( ) ! = GPR_SLICE_LENGTH ( b ) ) { <nl> return false ; <nl> } <nl> bool SliceEqual ( const Slice & a , gpr_slice b ) { <nl> } <nl> <nl> TEST_F ( ByteBufferTest , Dump ) { <nl> - gpr_slice hello = gpr_slice_from_copied_string ( kContent1 ) ; <nl> - gpr_slice world = gpr_slice_from_copied_string ( kContent2 ) ; <nl> + grpc_slice hello = grpc_slice_from_copied_string ( kContent1 ) ; <nl> + grpc_slice world = grpc_slice_from_copied_string ( kContent2 ) ; <nl> std : : vector < Slice > slices ; <nl> slices . push_back ( Slice ( hello , Slice : : STEAL_REF ) ) ; <nl> slices . push_back ( Slice ( world , Slice : : STEAL_REF ) ) ; <nl> TEST_F ( ByteBufferTest , Dump ) { <nl> } <nl> <nl> TEST_F ( ByteBufferTest , SerializationMakesCopy ) { <nl> - gpr_slice hello = gpr_slice_from_copied_string ( kContent1 ) ; <nl> - gpr_slice world = gpr_slice_from_copied_string ( kContent2 ) ; <nl> + grpc_slice hello = grpc_slice_from_copied_string ( kContent1 ) ; <nl> + grpc_slice world = grpc_slice_from_copied_string ( kContent2 ) ; <nl> std : : vector < Slice > slices ; <nl> slices . push_back ( Slice ( hello , Slice : : STEAL_REF ) ) ; <nl> slices . push_back ( Slice ( world , Slice : : STEAL_REF ) ) ; <nl> mmm a / test / cpp / util / cli_call . cc <nl> ppp b / test / cpp / util / cli_call . cc <nl> Status CliCall : : Call ( std : : shared_ptr < grpc : : Channel > channel , <nl> cq . Next ( & got_tag , & ok ) ; <nl> GPR_ASSERT ( ok ) ; <nl> <nl> - gpr_slice s = gpr_slice_from_copied_string ( request . c_str ( ) ) ; <nl> + grpc_slice s = grpc_slice_from_copied_string ( request . c_str ( ) ) ; <nl> grpc : : Slice req_slice ( s , grpc : : Slice : : STEAL_REF ) ; <nl> grpc : : ByteBuffer send_buffer ( & req_slice , 1 ) ; <nl> call - > Write ( send_buffer , tag ( 2 ) ) ; <nl> mmm a / test / cpp / util / slice_test . cc <nl> ppp b / test / cpp / util / slice_test . cc <nl> class SliceTest : public : : testing : : Test { <nl> } ; <nl> <nl> TEST_F ( SliceTest , Steal ) { <nl> - gpr_slice s = gpr_slice_from_copied_string ( kContent ) ; <nl> + grpc_slice s = grpc_slice_from_copied_string ( kContent ) ; <nl> Slice spp ( s , Slice : : STEAL_REF ) ; <nl> CheckSlice ( spp , kContent ) ; <nl> } <nl> <nl> TEST_F ( SliceTest , Add ) { <nl> - gpr_slice s = gpr_slice_from_copied_string ( kContent ) ; <nl> + grpc_slice s = grpc_slice_from_copied_string ( kContent ) ; <nl> Slice spp ( s , Slice : : ADD_REF ) ; <nl> - gpr_slice_unref ( s ) ; <nl> + grpc_slice_unref ( s ) ; <nl> CheckSlice ( spp , kContent ) ; <nl> } <nl> <nl> TEST_F ( SliceTest , Empty ) { <nl> } <nl> <nl> TEST_F ( SliceTest , Cslice ) { <nl> - gpr_slice s = gpr_slice_from_copied_string ( kContent ) ; <nl> + grpc_slice s = grpc_slice_from_copied_string ( kContent ) ; <nl> Slice spp ( s , Slice : : STEAL_REF ) ; <nl> CheckSlice ( spp , kContent ) ; <nl> - gpr_slice c_slice = spp . c_slice ( ) ; <nl> + grpc_slice c_slice = spp . c_slice ( ) ; <nl> EXPECT_EQ ( GPR_SLICE_START_PTR ( s ) , GPR_SLICE_START_PTR ( c_slice ) ) ; <nl> EXPECT_EQ ( GPR_SLICE_END_PTR ( s ) , GPR_SLICE_END_PTR ( c_slice ) ) ; <nl> - gpr_slice_unref ( c_slice ) ; <nl> + grpc_slice_unref ( c_slice ) ; <nl> } <nl> <nl> } / / namespace <nl> mmm a / tools / run_tests / sources_and_headers . json <nl> ppp b / tools / run_tests / sources_and_headers . json <nl> <nl> " headers " : [ ] , <nl> " is_filegroup " : false , <nl> " language " : " c " , <nl> - " name " : " gpr_slice_buffer_test " , <nl> + " name " : " grpc_slice_buffer_test " , <nl> " src " : [ <nl> " test / core / support / slice_buffer_test . c " <nl> ] , <nl> <nl> " headers " : [ ] , <nl> " is_filegroup " : false , <nl> " language " : " c " , <nl> - " name " : " gpr_slice_test " , <nl> + " name " : " grpc_slice_test " , <nl> " src " : [ <nl> " test / core / support / slice_test . c " <nl> ] , <nl> mmm a / tools / run_tests / tests . json <nl> ppp b / tools / run_tests / tests . json <nl> <nl> " flaky " : false , <nl> " gtest " : false , <nl> " language " : " c " , <nl> - " name " : " gpr_slice_buffer_test " , <nl> + " name " : " grpc_slice_buffer_test " , <nl> " platforms " : [ <nl> " linux " , <nl> " mac " , <nl> <nl> " flaky " : false , <nl> " gtest " : false , <nl> " language " : " c " , <nl> - " name " : " gpr_slice_test " , <nl> + " name " : " grpc_slice_test " , <nl> " platforms " : [ <nl> " linux " , <nl> " mac " , <nl> mmm a / vsprojects / buildtests_c . sln <nl> ppp b / vsprojects / buildtests_c . sln <nl> Project ( " { 8BC9CEB8 - 8B4A - 11D0 - 8D11 - 00A0C91BC942 } " ) = " gpr_percent_encoding_test " , <nl> { B23D3D1A - 9438 - 4EDA - BEB6 - 9A0A03D17792 } = { B23D3D1A - 9438 - 4EDA - BEB6 - 9A0A03D17792 } <nl> EndProjectSection <nl> EndProject <nl> - Project ( " { 8BC9CEB8 - 8B4A - 11D0 - 8D11 - 00A0C91BC942 } " ) = " gpr_slice_buffer_test " , " vcxproj \ test \ gpr_slice_buffer_test \ gpr_slice_buffer_test . vcxproj " , " { E679773D - DE89 - AEBB - 9787 - 59019989B825 } " <nl> + Project ( " { 8BC9CEB8 - 8B4A - 11D0 - 8D11 - 00A0C91BC942 } " ) = " grpc_slice_buffer_test " , " vcxproj \ test \ grpc_slice_buffer_test \ grpc_slice_buffer_test . vcxproj " , " { E679773D - DE89 - AEBB - 9787 - 59019989B825 } " <nl> ProjectSection ( myProperties ) = preProject <nl> lib = " False " <nl> EndProjectSection <nl> Project ( " { 8BC9CEB8 - 8B4A - 11D0 - 8D11 - 00A0C91BC942 } " ) = " gpr_slice_buffer_test " , " vc <nl> { B23D3D1A - 9438 - 4EDA - BEB6 - 9A0A03D17792 } = { B23D3D1A - 9438 - 4EDA - BEB6 - 9A0A03D17792 } <nl> EndProjectSection <nl> EndProject <nl> - Project ( " { 8BC9CEB8 - 8B4A - 11D0 - 8D11 - 00A0C91BC942 } " ) = " gpr_slice_test " , " vcxproj \ test \ gpr_slice_test \ gpr_slice_test . vcxproj " , " { 7F2D1623 - AF04 - DD98 - BCE6 - 61ADB9A52366 } " <nl> + Project ( " { 8BC9CEB8 - 8B4A - 11D0 - 8D11 - 00A0C91BC942 } " ) = " grpc_slice_test " , " vcxproj \ test \ grpc_slice_test \ grpc_slice_test . vcxproj " , " { 7F2D1623 - AF04 - DD98 - BCE6 - 61ADB9A52366 } " <nl> ProjectSection ( myProperties ) = preProject <nl> lib = " False " <nl> EndProjectSection <nl> mmm a / vsprojects / vcxproj / test / gpr_slice_buffer_test / gpr_slice_buffer_test . vcxproj <nl> ppp b / vsprojects / vcxproj / test / gpr_slice_buffer_test / gpr_slice_buffer_test . vcxproj <nl> <nl> < / ImportGroup > <nl> < PropertyGroup Label = " UserMacros " / > <nl> < PropertyGroup Condition = " ' $ ( Configuration ) ' = = ' Debug ' " > <nl> - < TargetName > gpr_slice_buffer_test < / TargetName > <nl> + < TargetName > grpc_slice_buffer_test < / TargetName > <nl> < Linkage - grpc_dependencies_zlib > static < / Linkage - grpc_dependencies_zlib > <nl> < Configuration - grpc_dependencies_zlib > Debug < / Configuration - grpc_dependencies_zlib > <nl> < Linkage - grpc_dependencies_openssl > static < / Linkage - grpc_dependencies_openssl > <nl> < Configuration - grpc_dependencies_openssl > Debug < / Configuration - grpc_dependencies_openssl > <nl> < / PropertyGroup > <nl> < PropertyGroup Condition = " ' $ ( Configuration ) ' = = ' Release ' " > <nl> - < TargetName > gpr_slice_buffer_test < / TargetName > <nl> + < TargetName > grpc_slice_buffer_test < / TargetName > <nl> < Linkage - grpc_dependencies_zlib > static < / Linkage - grpc_dependencies_zlib > <nl> < Configuration - grpc_dependencies_zlib > Release < / Configuration - grpc_dependencies_zlib > <nl> < Linkage - grpc_dependencies_openssl > static < / Linkage - grpc_dependencies_openssl > <nl> mmm a / vsprojects / vcxproj / test / gpr_slice_test / gpr_slice_test . vcxproj <nl> ppp b / vsprojects / vcxproj / test / gpr_slice_test / gpr_slice_test . vcxproj <nl> <nl> < / ImportGroup > <nl> < PropertyGroup Label = " UserMacros " / > <nl> < PropertyGroup Condition = " ' $ ( Configuration ) ' = = ' Debug ' " > <nl> - < TargetName > gpr_slice_test < / TargetName > <nl> + < TargetName > grpc_slice_test < / TargetName > <nl> < Linkage - grpc_dependencies_zlib > static < / Linkage - grpc_dependencies_zlib > <nl> < Configuration - grpc_dependencies_zlib > Debug < / Configuration - grpc_dependencies_zlib > <nl> < Linkage - grpc_dependencies_openssl > static < / Linkage - grpc_dependencies_openssl > <nl> < Configuration - grpc_dependencies_openssl > Debug < / Configuration - grpc_dependencies_openssl > <nl> < / PropertyGroup > <nl> < PropertyGroup Condition = " ' $ ( Configuration ) ' = = ' Release ' " > <nl> - < TargetName > gpr_slice_test < / TargetName > <nl> + < TargetName > grpc_slice_test < / TargetName > <nl> < Linkage - grpc_dependencies_zlib > static < / Linkage - grpc_dependencies_zlib > <nl> < Configuration - grpc_dependencies_zlib > Release < / Configuration - grpc_dependencies_zlib > <nl> < Linkage - grpc_dependencies_openssl > static < / Linkage - grpc_dependencies_openssl > <nl>
s / gpr_slice / grpc_slice , and move around tests , impls
grpc/grpc
d41a4a720f76c6555b80f82ee771071e09d55e03
2016-10-26T23:16:06Z
mmm a / src / mongo / util / descriptive_stats_test . cpp <nl> ppp b / src / mongo / util / descriptive_stats_test . cpp <nl> <nl> + / * * <nl> + * Copyright ( C ) 2012 10gen Inc . <nl> + * <nl> + * This program is free software : you can redistribute it and / or modify <nl> + * it under the terms of the GNU Affero General Public License , version 3 , <nl> + * as published by the Free Software Foundation . <nl> + * <nl> + * This program is distributed in the hope that it will be useful , <nl> + * but WITHOUT ANY WARRANTY ; without even the implied warranty of <nl> + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE . See the <nl> + * GNU Affero General Public License for more details . <nl> + * <nl> + * You should have received a copy of the GNU Affero General Public License <nl> + * along with this program . If not , see < http : / / www . gnu . org / licenses / > . <nl> + * / <nl> + <nl> / * * <nl> * Tests for mongo / util / descriptive_stats . h <nl> * / <nl>
Add copyright notice to fix lint failure
mongodb/mongo
0078f9cb5084e049f06a58fafa6dc6330cc2c076
2012-11-14T06:02:04Z
mmm a / arangod / Cluster / ClusterComm . h <nl> ppp b / arangod / Cluster / ClusterComm . h <nl> struct ClusterCommResult { <nl> / / / @ brief stringify the internal error state <nl> std : : string stringifyErrorMessage ( ) const ; <nl> <nl> + / / / @ brief return if request was successful , use this on the request <nl> + / / / results after a ` performRequest ` : <nl> + bool successful ( ) const { <nl> + if ( status ! = CL_COMM_RECEIVED ) { <nl> + return false ; <nl> + } <nl> + return answer_code = = rest : : ResponseCode : : OK | | <nl> + answer_code = = rest : : ResponseCode : : CREATED | | <nl> + answer_code = = rest : : ResponseCode : : ACCEPTED | | <nl> + answer_code = = rest : : ResponseCode : : NO_CONTENT ; <nl> + } <nl> + <nl> / / / @ brief return an error code for a result <nl> int getErrorCode ( ) const ; <nl> <nl> struct ClusterCommResult { <nl> if ( status = = CL_COMM_ERROR ) { <nl> try { <nl> auto body = result - > getBodyVelocyPack ( VPackOptions ( ) ) ; <nl> - if ( body - > slice ( ) . isObject ( ) & & <nl> - body - > slice ( ) . hasKey ( " errorMessage " ) ) { <nl> - errorMessage = body - > slice ( ) . get ( " errorMessage " ) . copyString ( ) ; <nl> - errorCode = body - > slice ( ) . get ( " errorNum " ) . getNumber < int > ( ) ; <nl> + if ( body - > slice ( ) . isObject ( ) ) { <nl> + if ( body - > slice ( ) . hasKey ( arangodb : : StaticStrings : : ErrorMessage ) ) { <nl> + errorMessage = body - > slice ( ) . get ( arangodb : : StaticStrings : : ErrorMessage ) . copyString ( ) ; <nl> + } <nl> + if ( body - > slice ( ) . hasKey ( arangodb : : StaticStrings : : ErrorNum ) ) { <nl> + errorCode = body - > slice ( ) . get ( arangodb : : StaticStrings : : ErrorNum ) . getNumber < int > ( ) ; <nl> + } <nl> } <nl> } catch ( . . . ) { <nl> } <nl> } <nl> } else { <nl> - / / mop : actually it will never be an ERROR here . . . this is and was a dirty <nl> - / / hack : S <nl> status = CL_COMM_RECEIVED ; <nl> + / / Get error message and code out of body if possible : <nl> + try { <nl> + auto options = VPackOptions ( ) ; <nl> + VPackSlice body = request - > payload ( & options ) ; <nl> + if ( body . isObject ( ) ) { <nl> + if ( body . hasKey ( arangodb : : StaticStrings : : ErrorMessage ) ) { <nl> + errorMessage = body . get ( arangodb : : StaticStrings : : ErrorMessage ) . copyString ( ) ; <nl> + } <nl> + if ( body . hasKey ( arangodb : : StaticStrings : : ErrorNum ) ) { <nl> + errorCode = body . get ( arangodb : : StaticStrings : : ErrorNum ) . getNumber < int > ( ) ; <nl> + } <nl> + } <nl> + } catch ( . . . ) { <nl> + } <nl> } <nl> } <nl> } ; <nl>
Sort out google cloud storage as remote . ( )
arangodb/arangodb
d45757db514c8fbe845159fff4a9e476d2ab1854
2019-09-05T11:36:50Z
mmm a / CMakeLists . txt <nl> ppp b / CMakeLists . txt <nl> target_link_libraries ( spdlog_header_only INTERFACE Threads : : Threads ) <nl> # mmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmm <nl> if ( SPDLOG_MASTER_PROJECT ) <nl> if ( CMAKE_CXX_COMPILER_ID MATCHES " GNU | Clang | AppleClang " ) <nl> - target_compile_options ( spdlog PRIVATE - Wall - Wextra - Wconversion - pedantic - Wfatal - errors ) <nl> + target_compile_options ( spdlog PUBLIC - Wall - Wextra - Wconversion - pedantic - Wfatal - errors ) <nl> target_compile_options ( spdlog_header_only INTERFACE - Wall - Wextra - Wconversion - pedantic - Wfatal - errors ) <nl> endif ( ) <nl> if ( CMAKE_CXX_COMPILER_ID MATCHES " MSVC " ) <nl> - target_compile_options ( spdlog PRIVATE / W3 / WX ) <nl> + target_compile_options ( spdlog PUBLIC / W3 / WX ) <nl> target_compile_options ( spdlog_header_only INTERFACE / W3 / WX ) <nl> endif ( ) <nl> <nl>
Fixed target_compile_options in cmake
gabime/spdlog
54f1941691ac0f8b51d8122a98c259c87cf8026b
2019-05-23T22:39:02Z
mmm a / Source / CNTK / BrainScript / CNTKCoreLib / CNTK . core . bs <nl> ppp b / Source / CNTK / BrainScript / CNTKCoreLib / CNTK . core . bs <nl> ConvolutionTransposeLayer { numOutputChannels , <nl> } . res <nl> } . apply <nl> <nl> + # BilinearUpsamplingLayer - - upsample input activations using transposed convolution with bilinear weights . <nl> + BilinearUpsamplingLayer { numInputChannels , numOutputChannels , kernelSize , stride } = <nl> + { <nl> + kernelShape = kernelSize : kernelSize : numOutputChannels <nl> + paramShape = _ConcatArrays ( kernelShape , _AsArray ( numInputChannels ) ) <nl> + W = ParameterTensor { paramShape , init = ' bilinear ' , initValueScale = 1 , initOnCPUOnly = true , learningRateMultiplier = 0 } <nl> + sharing = true # TODO : support this <nl> + apply ( x ) = { <nl> + c = ConvolutionTranspose ( W , x , kernelShape , mapDims = numInputChannels , stride = stride , sharing = sharing , autoPadding = false , lowerPad = 0 , upperPad = 0 , outputShape = None , maxTempMemSizeInSamples = 0 ) <nl> + } . c <nl> + } . apply <nl> + <nl> # MaxPoolingLayer , AveragePoolingLayer - - create a max - or average - pooling layer <nl> _PoolingLayer { poolKind , # " max " or " average " <nl> filterShape , # e . g . ( 3 : 3 ) <nl>
Add bilinear upsampling layer
microsoft/CNTK
8f3392069479f59ac4fed1c7ffd2813026348f4b
2017-03-30T12:43:08Z
mmm a / third_party / tf2 / geometry2_0 . 5 . 16_tf2 . patch <nl> ppp b / third_party / tf2 / geometry2_0 . 5 . 16_tf2 . patch <nl> diff - uprN 0 . 5 . 16 / include / tf2 / convert . h tf2 / include / tf2 / convert . h <nl> # include < tf2 / transform_datatypes . h > <nl> # include < tf2 / exceptions . h > <nl> - # include < geometry_msgs / TransformStamped . h > <nl> - + # include < geometry_msgs / transform_stamped . h > <nl> + + # include < tf2 / transform_stamped . h > <nl> # include < tf2 / impl / convert . h > <nl> + # include < tf2 / time . h > <nl> <nl>
Update geometry2_0 . 5 . 16_tf2 . patch
ApolloAuto/apollo
e5b9b1f18abf282997642d39f18d1d52cd1f78fc
2019-02-27T19:22:09Z
mmm a / Source / CNTKv2LibraryDll / API / CNTKLibrary . h <nl> ppp b / Source / CNTKv2LibraryDll / API / CNTKLibrary . h <nl> <nl> <nl> # pragma once <nl> <nl> - <nl> # include < memory > <nl> # include < vector > <nl> # include < array > <nl> namespace CNTK <nl> : m_shapeDims ( dimensions ) <nl> { } <nl> <nl> - # ifndef SWIGCSHARP <nl> / / / <nl> / / / Construct a NDShape instance with specified dimensions . <nl> / / / <nl> NDShape ( const std : : initializer_list < size_t > & dimensions ) <nl> : m_shapeDims ( dimensions ) <nl> { } <nl> - # endif <nl> <nl> / / / <nl> / / / Returns the dimensions of ' this ' shape as a std : : vector < size_t > <nl> namespace CNTK <nl> / / / <nl> const NDShape & Shape ( ) const { return m_maskShape ; } <nl> <nl> - # ifndef SWIGCSHARP <nl> / / / <nl> / / / Returns a read - only pointer to the data buffer underlying ' this ' Mask object <nl> / / / <nl> CNTK_API const MaskKind * DataBuffer ( ) const ; <nl> - # endif <nl> <nl> / / / <nl> / / / Creates a new NDArrayView with newly allocated storage on the specified device and copies ' this ' view ' s contents into the newly allocated view . <nl> namespace CNTK <nl> <nl> namespace Internal <nl> { <nl> - # ifndef SWIGCSHARP <nl> inline std : : wstring GenerateUid ( std : : wstring & & prefix ) <nl> { <nl> return prefix + std : : to_wstring ( Internal : : NewUniqueId ( ) ) ; <nl> namespace CNTK <nl> { <nl> return GenerateUid ( std : : wstring ( prefix ) ) ; <nl> } <nl> - # endif <nl> } <nl> <nl> typedef Dictionary ParameterInitializer ; <nl> <nl> / / Forward declarations <nl> - # ifndef SWIGCSHARP <nl> inline Variable PlaceholderVariable ( const NDShape & shape , const std : : wstring & name , const std : : vector < Axis > & dynamicAxes = Axis : : UnknownDynamicAxes ( ) ) ; <nl> <nl> inline Variable InputVariable ( const NDShape & shape , bool isSparse , : : CNTK : : DataType dataType , bool needsGradient , const std : : wstring & name , const std : : vector < Axis > & dynamicAxes = Axis : : DefaultInputVariableDynamicAxes ( ) ) ; <nl> inline Variable OutputVariable ( const NDShape & shape , : : CNTK : : DataType dataType , Function * ownerFunction , const std : : vector < Axis > & dynamicAxes , const std : : wstring & name = L " " ) ; <nl> - # endif <nl> + <nl> / / / <nl> / / / Denotes a symbolic entity corresponding to the inputs and outputs of a Function . <nl> / / / A Variable is symbolic and does not represent the actual values . <nl> namespace CNTK <nl> { <nl> friend bool operator = = ( const Variable & first , const Variable & second ) ; <nl> friend class Function ; <nl> - # ifndef SWIGCSHARP <nl> friend class CompositeFunction ; <nl> - <nl> friend class Trainer ; <nl> friend class PrimitiveFunction ; <nl> <nl> - # endif <nl> template < typename T > <nl> friend struct std : : hash ; <nl> <nl> friend class Internal : : VariableResolver ; <nl> <nl> - # ifndef SWIG <nl> private : <nl> friend inline Variable PlaceholderVariable ( const NDShape & shape , const std : : wstring & name , const std : : vector < Axis > & dynamicAxes ) ; <nl> friend inline Variable InputVariable ( const NDShape & shape , bool isSparse , : : CNTK : : DataType dataType , bool needsGradient , const std : : wstring & name , const std : : vector < Axis > & dynamicAxes / * = Axis : : DefaultInputVariableDynamicAxes ( ) * / ) ; <nl> friend inline Variable OutputVariable ( const NDShape & shape , : : CNTK : : DataType dataType , Function * ownerFunction , const std : : vector < Axis > & dynamicAxes , const std : : wstring & name / * = L " " * / ) ; <nl> - # endif <nl> <nl> public : <nl> <nl> namespace CNTK <nl> CNTK_API Variable ( const NDShape & shape , VariableKind varType , : : CNTK : : DataType dataType , Function * ownerFunction , const NDArrayViewPtr & value , bool needsGradient , const std : : vector < Axis > & dynamicAxes , bool isSparse , const std : : wstring & name , const std : : wstring & uid ) ; <nl> <nl> private : <nl> - # ifndef SWIGCSHARP <nl> Variable Clone ( ) const <nl> { <nl> Variable clonedVariable ; <nl> namespace CNTK <nl> <nl> return clonedVariable ; <nl> } <nl> - # endif <nl> <nl> CNTK_API virtual Dictionary Serialize ( ) const override ; <nl> <nl> namespace CNTK <nl> } <nl> } <nl> <nl> - # ifndef SWIGCSHARP <nl> std : : shared_ptr < VariableFields > Clone ( ) const <nl> { <nl> if ( m_ownerFunction ! = nullptr ) <nl> namespace CNTK <nl> <nl> return clone ; <nl> } <nl> - # endif <nl> <nl> CNTK_API void SetValueInitialization ( const ParameterInitializer & initializationConfig , const DeviceDescriptor & device ) ; <nl> <nl> namespace CNTK <nl> return ! ( first = = second ) ; <nl> } <nl> <nl> - # ifndef SWIGCSHARP <nl> / / / <nl> / / / Create a Placeholder variable to be used as a temporary / placeholder input to a Function . <nl> / / / All placeholder inputs of a Function must be replaced with non - placeholder Variables before Forward evaluation of the Function . <nl> namespace CNTK <nl> { <nl> return PlaceholderVariable ( NDShape : : Unknown , name , Axis : : UnknownDynamicAxes ( ) ) ; <nl> } <nl> - # endif <nl> <nl> - # ifndef SWIGCSHARP <nl> / / / <nl> / / / Create an ' Input ' Variable denoting sparse data and specify if gradients are to be computed for this input <nl> / / / <nl> namespace CNTK <nl> { <nl> return Variable ( shape , VariableKind : : Output , dataType , ownerFunction , nullptr , / * needsGradient = * / false , dynamicAxes , / * isSparse = * / false , name , Internal : : GenerateUid ( VariableKind : : Output ) ) ; <nl> } <nl> - # endif <nl> <nl> static const int SentinelValueForInferParamInitRank = std : : numeric_limits < int > : : max ( ) ; <nl> static const int DefaultParamInitScale = 1 ; <nl> static const int DefaultParamInitOutputRank = 1 ; <nl> static const int DefaultParamInitFilterRank = 0 ; <nl> <nl> - # ifndef SWIGCSHARP <nl> CNTK_API ParameterInitializer ConstantInitializer ( double value = 0 . 0 ) ; <nl> CNTK_API ParameterInitializer UniformInitializer ( double scale = DefaultParamInitScale , unsigned long seed = SentinelValueForAutoSelectRandomSeed ) ; <nl> CNTK_API ParameterInitializer GaussianInitializer ( int outputRank = SentinelValueForInferParamInitRank , int filterRank = SentinelValueForInferParamInitRank , double scale = DefaultParamInitScale , unsigned long seed = SentinelValueForAutoSelectRandomSeed ) ; <nl> namespace CNTK <nl> CNTK_API ParameterInitializer HeNormalInitializer ( int outputRank = SentinelValueForInferParamInitRank , int filterRank = SentinelValueForInferParamInitRank , double scale = DefaultParamInitScale , unsigned long seed = SentinelValueForAutoSelectRandomSeed ) ; <nl> CNTK_API ParameterInitializer BilinearInitializer ( size_t kernelWidth , size_t kernelHeight ) ; <nl> CNTK_API ParameterInitializer RandomInitializerWithRank ( const ParameterInitializer & initializer , int outputRank , int filterRank ) ; <nl> - # endif <nl> <nl> - # ifndef SWIGCSHARP <nl> / / / <nl> / / / Denotes Parameter inputs of a Function . <nl> / / / <nl> namespace CNTK <nl> / / This check is weak in that the derives types may sneak in some additional fields if the base type had some padding at the end , without changing the object size <nl> / / but it should be good enough for catching any accidental addiiton of fields . <nl> static_assert ( sizeof ( Constant ) = = sizeof ( Variable ) , " The Constant type should not have any data fields beyond what its base type ' Variable ' has . " ) ; <nl> - # endif <nl> } <nl> <nl> namespace std { <nl> namespace std { <nl> } <nl> } ; <nl> <nl> - # ifndef SWIGCSHARP <nl> template < > struct hash < : : CNTK : : Parameter > <nl> { <nl> size_t operator ( ) ( const : : CNTK : : Parameter & x ) const <nl> namespace std { <nl> return std : : hash < : : CNTK : : Variable > ( ) ( x ) ; <nl> } <nl> } ; <nl> - # endif <nl> <nl> } <nl> <nl> namespace CNTK <nl> / / / <nl> class Function : public std : : enable_shared_from_this < Function > , public IDictionarySerializable <nl> { <nl> - # ifndef SWIGCSHARP <nl> friend class CompositeFunction ; <nl> friend class Trainer ; <nl> - # endif <nl> <nl> public : <nl> / / / <nl> namespace CNTK <nl> const DeviceDescriptor & computeDevice = DeviceDescriptor : : UseDefaultDevice ( ) , <nl> const std : : unordered_set < Variable > & outputsToRetainBackwardStateFor = { } ) = 0 ; <nl> <nl> - # ifndef SWIGCSHARP <nl> / / / <nl> / / / Backpropagates supplied ' rootGradientValues ' for one or more of the output variables of the Function , to produce gradient Values <nl> / / / corresponding to the specified set of input variables in ' backPropagatedGradientValuesForInputs ' . <nl> namespace CNTK <nl> virtual void Backward ( const BackPropStatePtr & state , <nl> const std : : unordered_map < Variable , ValuePtr > & rootGradientValues , <nl> std : : unordered_map < Variable , ValuePtr > & backPropagatedGradientValuesForInputs ) = 0 ; <nl> - # endif <nl> - <nl> + <nl> + <nl> / / / <nl> / / / Returns the name of the operation that this Function denotes <nl> / / / <nl> namespace CNTK <nl> / / / <nl> CNTK_API virtual ~ Function ( ) ; <nl> <nl> + / / / <nl> + / / / Performs forward computation , i . e . evaluation , on the computaion graph using provided ' input ' and stores the results in the ' outputs ' map . <nl> + / / / It is same as Forward , but without storing and returning information needed for backpropagation . <nl> + / / / <nl> + CNTK_API void Evaluate ( const std : : unordered_map < Variable , ValuePtr > & arguments , <nl> + std : : unordered_map < Variable , ValuePtr > & outputs , <nl> + const DeviceDescriptor & computeDevice = DeviceDescriptor : : UseDefaultDevice ( ) ) ; <nl> + <nl> / / / <nl> / / / Clones ' this ' Function . The parameters of the Function are either cloned , shared or frozen as specified by the parameterCloneMethod argument and <nl> / / / any variable replacements requested are applied in the cloned Function instance . <nl> / / / <nl> CNTK_API FunctionPtr Clone ( ParameterCloningMethod parameterCloneMethod = ParameterCloningMethod : : Clone , const std : : unordered_map < Variable , Variable > & replacements = { } ) const ; <nl> <nl> - # ifndef SWIGCSHARP <nl> / / / <nl> / / / Generates a dictionary that captures the state of the Function graph underlying this Function . <nl> / / / <nl> namespace CNTK <nl> / / / user - defined op - codes with custom functionality . <nl> / / / <nl> CNTK_API static FunctionPtr Deserialize ( const Dictionary & dictionary , const : : CNTK : : DeviceDescriptor & device = DeviceDescriptor : : UseDefaultDevice ( ) ) ; <nl> - # endif <nl> <nl> public : <nl> / / / <nl> namespace CNTK <nl> } ) ; <nl> } <nl> <nl> - # ifndef SWIGCSHARP <nl> / / / <nl> / / / Returns the set of all Parameter variables of ' this ' Function . <nl> / / / <nl> namespace CNTK <nl> / / / Throws an exception if ' this ' Function has multiple placeholders <nl> / / / <nl> CNTK_API FunctionPtr ReplacePlaceholder ( const Variable & placeholderReplacement ) ; <nl> - # endif <nl> <nl> / / / <nl> / / / Save this function graph into a model file <nl> namespace CNTK <nl> <nl> <nl> protected : <nl> - # ifndef SWIGCSHARP <nl> / / / <nl> / / / Protected constructor for derived ' Function ' types to specify the actual input and output variables for the ( primitive ) Function instance . <nl> / / / <nl> namespace CNTK <nl> / / / Restores the state of the ' this ' function in place using the provided dictionary . <nl> / / / Structurally , ' this ' function graph has to be identical to the state captured in the dictionary . <nl> CNTK_API virtual void RestoreFromCheckpoint ( const Dictionary & dictionary ) ; <nl> - # endif <nl> <nl> private : <nl> <nl> namespace CNTK <nl> <nl> } ; <nl> <nl> - # ifndef SWIGCSHARP / / Not needed for SWIG C # Eval Binding <nl> / / / <nl> / / / Create an instance of the CNTK built - in elementwise negate operation with the specified input operand . <nl> / / / <nl> namespace CNTK <nl> / / / Create an instance of the CNTK built - in splice operation to splice together all the specified tensor operands into a single output tensor <nl> / / / <nl> CNTK_API FunctionPtr Splice ( const std : : vector < Variable > & operands , const Axis & axis , const std : : wstring & name = L " " ) ; <nl> - # endif <nl> <nl> / / / <nl> / / / Create a new Function instance which just combines the outputs of the specified list of ' operands ' Functions such that the ' Outputs ' of the <nl> namespace CNTK <nl> / / / <nl> CNTK_API FunctionPtr Alias ( const Variable & operand , const std : : wstring & name = L " " ) ; <nl> <nl> - # ifndef SWIGCSHARP <nl> namespace Sequence <nl> { <nl> CNTK_API FunctionPtr IsFirst ( const Variable & operand , const std : : wstring & name = L " " ) ; <nl> namespace CNTK <nl> ( left . m_elementType = = right . m_elementType ) & & <nl> ( left . m_sampleLayout = = right . m_sampleLayout ) ) ; <nl> } <nl> - <nl> - # endif / / SWIGCSHARP <nl> } <nl> <nl> - # ifndef SWIGCSHARP / / Not need for SWIG C # Eval Binding <nl> namespace std { <nl> template < > struct hash < : : CNTK : : StreamInformation > <nl> { <nl> namespace std <nl> } <nl> } ; <nl> } <nl> - <nl> - # endif / / SWIGCSHARP <nl> mmm a / Source / CNTKv2LibraryDll / Function . cpp <nl> ppp b / Source / CNTKv2LibraryDll / Function . cpp <nl> namespace CNTK <nl> } <nl> } <nl> <nl> + void Function : : Evaluate ( const std : : unordered_map < Variable , ValuePtr > & arguments , <nl> + std : : unordered_map < Variable , ValuePtr > & outputs , <nl> + const DeviceDescriptor & computeDevice / * = DeviceDescriptor : : UseDefaultDevice ( ) * / ) <nl> + { <nl> + Forward ( arguments , outputs , computeDevice , { } ) ; <nl> + } <nl> + <nl> void Function : : SaveModel ( const std : : wstring & modelFilePath , bool usinglegacyModelFormat ) <nl> { <nl> if ( usinglegacyModelFormat ) <nl> mmm a / bindings / csharp / CSEvalV2Library / CSEvalV2Library . csproj <nl> ppp b / bindings / csharp / CSEvalV2Library / CSEvalV2Library . csproj <nl> <nl> < Compile Include = " . . \ SwigBinding \ AxisVector . cs " > <nl> < Link > GeneratedFiles \ AxisVector . cs < / Link > <nl> < / Compile > <nl> - < Compile Include = " . . \ SwigBinding \ BackPropState . cs " > <nl> - < Link > GeneratedFiles \ BackPropState . cs < / Link > <nl> - < / Compile > <nl> < Compile Include = " . . \ SwigBinding \ BoolVector . cs " > <nl> < Link > GeneratedFiles \ BoolVector . cs < / Link > <nl> < / Compile > <nl> <nl> < Compile Include = " . . \ SwigBinding \ StorageFormat . cs " > <nl> < Link > GeneratedFiles \ StorageFormat . cs < / Link > <nl> < / Compile > <nl> - < Compile Include = " . . \ SwigBinding \ SWIGTYPE_p_std__unordered_setT_CNTK__Variable_t . cs " > <nl> - < Link > GeneratedFiles \ SWIGTYPE_p_std__unordered_setT_CNTK__Variable_t . cs < / Link > <nl> - < / Compile > <nl> < Compile Include = " . . \ SwigBinding \ SWIGTYPE_p_void . cs " > <nl> < Link > GeneratedFiles \ SWIGTYPE_p_void . cs < / Link > <nl> < / Compile > <nl> mmm a / bindings / csharp / SwigBinding / cntk_cs . i <nl> ppp b / bindings / csharp / SwigBinding / cntk_cs . i <nl> <nl> <nl> % nspace CNTK ; <nl> <nl> + % shared_ptr ( CNTK : : BackPropState ) ; <nl> + % shared_ptr ( CNTK : : Function ) ; <nl> + % shared_ptr ( CNTK : : CompositeFunction ) ; <nl> + % shared_ptr ( CNTK : : Value ) ; <nl> + % shared_ptr ( CNTK : : NDShape ) ; <nl> + % shared_ptr ( CNTK : : NDArrayView ) ; <nl> + % shared_ptr ( CNTK : : NDMask ) ; <nl> + % shared_ptr ( std : : vector < float > ) ; <nl> + <nl> % template ( SizeTVector ) std : : vector < size_t > ; <nl> % template ( BoolVector ) std : : vector < bool > ; <nl> % template ( DoubleVector ) std : : vector < double > ; <nl> <nl> % template ( FloatVectorVector ) std : : vector < std : : vector < float > > ; <nl> % template ( DoubleVectorVector ) std : : vector < std : : vector < double > > ; <nl> % template ( VariableVector ) std : : vector < CNTK : : Variable > ; <nl> - / / % template ( ) std : : vector < CNTK : : Parameter > ; <nl> - / / % template ( ) std : : vector < CNTK : : Constant > ; <nl> % template ( AxisVector ) std : : vector < CNTK : : Axis > ; <nl> % template ( DeviceDescriptorVector ) std : : vector < CNTK : : DeviceDescriptor > ; <nl> - / / % template ( ) std : : vector < CNTK : : StreamConfiguration > ; <nl> - <nl> - / / % template ( ) std : : vector < CNTK : : DictionaryValue > ; <nl> + % template ( UnorderedMapVariableValuePtr ) std : : unordered_map < CNTK : : Variable , std : : shared_ptr < CNTK : : Value > > ; <nl> + % template ( UnorderedMapVariableVariable ) std : : unordered_map < CNTK : : Variable , CNTK : : Variable > ; <nl> <nl> % template ( ) std : : vector < std : : shared_ptr < CNTK : : Function > > ; <nl> % template ( ) std : : vector < std : : shared_ptr < CNTK : : Learner > > ; <nl> % template ( ) std : : pair < size_t , double > ; <nl> % template ( ) std : : vector < std : : pair < size_t , double > > ; <nl> <nl> - % shared_ptr ( CNTK : : BackPropState ) ; <nl> - % shared_ptr ( CNTK : : Function ) ; <nl> - % shared_ptr ( CNTK : : CompositeFunction ) ; <nl> - % shared_ptr ( CNTK : : Value ) ; <nl> - % shared_ptr ( CNTK : : NDShape ) ; <nl> - % shared_ptr ( CNTK : : NDArrayView ) ; <nl> - % shared_ptr ( CNTK : : NDMask ) ; <nl> - % shared_ptr ( std : : vector < float > ) ; <nl> - <nl> - / / SWIG does not understand ValuePtr here . <nl> - % template ( UnorderedMapVariableValuePtr ) std : : unordered_map < CNTK : : Variable , std : : shared_ptr < CNTK : : Value > > ; <nl> - % template ( UnorderedMapVariableVariable ) std : : unordered_map < CNTK : : Variable , CNTK : : Variable > ; <nl> + / / Ignore things not exposed for C # Eval . <nl> + % ignore CNTK : : NDShape : : NDShape ( const std : : initializer_list < size_t > & dimensions ) ; <nl> + <nl> + % ignore CNTK : : Internal : : GenerateUid ( std : : wstring & & prefix ) ; <nl> + % ignore CNTK : : Internal : : GenerateUid ( VariableKind varKind ) ; <nl> + % ignore CNTK : : Internal : : GenerateUid ( const std : : wstring & prefix ) ; <nl> + <nl> + % ignore CNTK : : PlaceholderVariable ( const NDShape & shape , const std : : wstring & name , const std : : vector < Axis > & dynamicAxes = Axis : : UnknownDynamicAxes ( ) ) ; <nl> + % ignore CNTK : : PlaceholderVariable ( const NDShape & shape , const std : : vector < Axis > & dynamicAxes = Axis : : UnknownDynamicAxes ( ) ) ; <nl> + % ignore CNTK : : PlaceholderVariable ( const std : : wstring & name = L " " ) ; <nl> + <nl> + % ignore CNTK : : InputVariable ( const NDShape & shape , <nl> + bool isSparse , <nl> + : : CNTK : : DataType dataType , <nl> + bool needsGradient , <nl> + const std : : wstring & name , <nl> + const std : : vector < Axis > & dynamicAxes = Axis : : DefaultInputVariableDynamicAxes ( ) ) ; <nl> + % ignore CNTK : : InputVariable ( const NDShape & shape , <nl> + : : CNTK : : DataType dataType , <nl> + bool needsGradient , <nl> + const std : : wstring & name = L " " , <nl> + const std : : vector < Axis > & dynamicAxes = Axis : : DefaultInputVariableDynamicAxes ( ) ) ; <nl> + % ignore CNTK : : InputVariable ( const NDShape & shape , <nl> + DataType dataType , <nl> + const std : : wstring & name , <nl> + const std : : vector < Axis > & <nl> + dynamicAxes = Axis : : DefaultInputVariableDynamicAxes ( ) ) ; <nl> + % ignore CNTK : : InputVariable ( const NDShape & shape , <nl> + DataType dataType , <nl> + const wchar_t * name , <nl> + const std : : vector < Axis > & dynamicAxes = Axis : : DefaultInputVariableDynamicAxes ( ) ) ; <nl> + % ignore CNTK : : InputVariable ( const NDShape & shape , <nl> + DataType dataType , <nl> + const std : : vector < Axis > & dynamicAxes = Axis : : DefaultInputVariableDynamicAxes ( ) ) ; <nl> + % ignore CNTK : : InputVariable ( const NDShape & shape , <nl> + bool isSparse , <nl> + : : CNTK : : DataType dataType , <nl> + const std : : wstring & name , <nl> + const std : : vector < Axis > & dynamicAxes = Axis : : DefaultInputVariableDynamicAxes ( ) ) ; <nl> + % ignore CNTK : : InputVariable ( const NDShape & shape , <nl> + bool isSparse , <nl> + : : CNTK : : DataType dataType , <nl> + const wchar_t * name , <nl> + const std : : vector < Axis > & dynamicAxes = Axis : : DefaultInputVariableDynamicAxes ( ) ) ; <nl> + % ignore CNTK : : InputVariable ( const NDShape & shape , <nl> + bool isSparse , <nl> + : : CNTK : : DataType dataType , <nl> + const std : : vector < Axis > & dynamicAxes = Axis : : DefaultInputVariableDynamicAxes ( ) ) ; <nl> + <nl> + % ignore CNTK : : OutputVariable ( const NDShape & shape , <nl> + : : CNTK : : DataType dataType , <nl> + Function * ownerFunction , <nl> + const std : : vector < Axis > & dynamicAxes , <nl> + const std : : wstring & name = L " " ) ; <nl> + <nl> + % ignore CNTK : : Variable : : CompositeFunction ; <nl> + % ignore CNTK : : Variable : : Trainer ; <nl> + % ignore CNTK : : Varaiable : : PrimitiveFunction ; <nl> + <nl> + % ignore CNTK : : ConstantInitializer ( double value = 0 . 0 ) ; <nl> + % ignore CNTK : : UniformInitializer ( double scale = DefaultParamInitScale , unsigned long seed = SentinelValueForAutoSelectRandomSeed ) ; <nl> + % ignore CNTK : : GaussianInitializer ( int outputRank = SentinelValueForInferParamInitRank , <nl> + int filterRank = SentinelValueForInferParamInitRank , <nl> + double scale = DefaultParamInitScale , <nl> + unsigned long seed = SentinelValueForAutoSelectRandomSeed ) ; <nl> + % ignore CNTK : : XavierInitializer ( int outputRank = SentinelValueForInferParamInitRank , <nl> + int filterRank = SentinelValueForInferParamInitRank , <nl> + double scale = DefaultParamInitScale , <nl> + unsigned long seed = SentinelValueForAutoSelectRandomSeed ) ; <nl> + % ignore CNTK : : GlorotUniformInitializer ( int outputRank = SentinelValueForInferParamInitRank , <nl> + int filterRank = SentinelValueForInferParamInitRank , <nl> + double scale = DefaultParamInitScale , <nl> + unsigned long seed = SentinelValueForAutoSelectRandomSeed ) ; <nl> + % ignore CNTK : : GlorotNormalInitializer ( int outputRank = SentinelValueForInferParamInitRank , <nl> + int filterRank = SentinelValueForInferParamInitRank , <nl> + double scale = DefaultParamInitScale , <nl> + unsigned long seed = SentinelValueForAutoSelectRandomSeed ) ; <nl> + % ignore CNTK : : HeUniformInitializer ( int outputRank = SentinelValueForInferParamInitRank , <nl> + int filterRank = SentinelValueForInferParamInitRank , <nl> + double scale = DefaultParamInitScale , <nl> + unsigned long seed = SentinelValueForAutoSelectRandomSeed ) ; <nl> + % ignore CNTK : : HeNormalInitializer ( int outputRank = SentinelValueForInferParamInitRank , <nl> + int filterRank = SentinelValueForInferParamInitRank , <nl> + double scale = DefaultParamInitScale , <nl> + unsigned long seed = SentinelValueForAutoSelectRandomSeed ) ; <nl> + % ignore CNTK : : BilinearInitializer ( size_t kernelWidth , size_t kernelHeight ) ; <nl> + % ignore CNTK : : RandomInitializerWithRank ( const ParameterInitializer & initializer , int outputRank , int filterRank ) ; <nl> <nl> % ignore CNTK : : IDictionarySerializable ; <nl> % ignore CNTK : : DictionaryValue ; <nl> % ignore CNTK : : Dictionary ; <nl> % ignore CNTK : : ParameterInitializer ; <nl> <nl> + % ignore std : : hash < : : CNTK : : Parameter > ; <nl> + % ignore CNTK : : hash < : : CNTK : : Constant > ; <nl> + <nl> + % ignore CNTK : : Function : : CompositeFunction ; <nl> + % ignore CNTK : : Function : : Trainer ; <nl> + % ignore CNTK : : Function : : Backward ( const BackPropStatePtr & state , <nl> + const std : : unordered_map < Variable , ValuePtr > & rootGradientValues , <nl> + std : : unordered_map < Variable , ValuePtr > & backPropagatedGradientValuesForInputs ) ; <nl> + % ignore CNTK : : Function : : Forward ( const std : : unordered_map < Variable , ValuePtr > & arguments , <nl> + std : : unordered_map < Variable , ValuePtr > & outputs , <nl> + const DeviceDescriptor & computeDevice = DeviceDescriptor : : UseDefaultDevice ( ) , <nl> + const std : : unordered_set < Variable > & outputsToRetainBackwardStateFor = { } ) ; <nl> + % ignore CNTK : : Function : : Serialize ( ) const ; <nl> + % ignore CNTK : : Function : : Deserialize ( const Dictionary & dictionary , const : : CNTK : : DeviceDescriptor & device = DeviceDescriptor : : UseDefaultDevice ( ) ) ; <nl> + % ignore CNTK : : Function : : Parameters ( ) const ; <nl> + % ignore CNTK : : Function : : Constants ( ) const ; <nl> + % ignore CNTK : : Function : : Placeholders ( ) const ; <nl> + % ignore CNTK : : Function : : Attributes ( ) const ; <nl> + % ignore CNTK : : Function : : PrintGraph ( ) const ; <nl> + % ignore CNTK : : Function : : ReplacePlaceholders ( const std : : unordered_map < Variable , Variable > & placeholderReplacements ) ; <nl> + % ignore CNTK : : Function : : ReplacePlaceholder ( const Variable & placeholderReplacement ) ; <nl> + % ignore CNTK : : Function : : Function ( const std : : vector < Variable > & inputs , <nl> + const std : : vector < Variable > & outputs , <nl> + Dictionary & & functionConfig , <nl> + const std : : wstring & name = L " " , <nl> + const std : : wstring & uid = Internal : : GenerateUid ( L " UserDefinedFunction " ) ) ; <nl> + % ignore CNTK : : Function : : RestoreFromCheckpoint ( const Dictionary & dictionary ) ; <nl> + <nl> % ignore CNTK : : Parameter ; <nl> % ignore CNTK : : Constant ; <nl> + % ignore CNTK : : BackPropState ; <nl> % ignore CNTK : : PoolingType ; <nl> + <nl> + % ignore CNTK : : Negate ( const Variable & operand , const std : : wstring & name = L " " ) ; <nl> + % ignore CNTK : : operator - ( const Variable & operand ) ; <nl> + % ignore CNTK : : Sigmoid ( const Variable & operand , const std : : wstring & name = L " " ) ; <nl> + % ignore CNTK : : Tanh ( const Variable & operand , const std : : wstring & name = L " " ) ; <nl> + % ignore CNTK : : Sin ( const Variable & operand , const std : : wstring & name = L " " ) ; <nl> + % ignore CNTK : : Cos ( const Variable & operand , const std : : wstring & name = L " " ) ; <nl> + % ignore CNTK : : ReLU ( const Variable & operand , const std : : wstring & name = L " " ) ; <nl> + % ignore CNTK : : Exp ( const Variable & operand , const std : : wstring & name = L " " ) ; <nl> + % ignore CNTK : : Log ( const Variable & operand , const std : : wstring & name = L " " ) ; <nl> + % ignore CNTK : : Square ( const Variable & operand , const std : : wstring & name = L " " ) ; <nl> + % ignore CNTK : : Sqrt ( const Variable & operand , const std : : wstring & name = L " " ) ; <nl> + % ignore CNTK : : Round ( const Variable & operand , const std : : wstring & name = L " " ) ; <nl> + % ignore CNTK : : Floor ( const Variable & operand , const std : : wstring & name = L " " ) ; <nl> + % ignore CNTK : : Ceil ( const Variable & operand , const std : : wstring & name = L " " ) ; <nl> + % ignore CNTK : : Abs ( const Variable & operand , const std : : wstring & name = L " " ) ; <nl> + % ignore CNTK : : Reciprocal ( const Variable & operand , const std : : wstring & name = L " " ) ; <nl> + % ignore CNTK : : Softmax ( const Variable & operand , const std : : wstring & name = L " " ) ; <nl> + % ignore CNTK : : Hardmax ( const Variable & operand , const std : : wstring & name = L " " ) ; <nl> + % ignore CNTK : : TransposeAxes ( const Variable & operand , const Axis & axis1 , const Axis & axis2 , const std : : wstring & name = L " " ) ; <nl> + % ignore CNTK : : Transpose ( const Variable & operand , const std : : wstring & name = L " " ) ; <nl> + % ignore CNTK : : Slice ( const Variable & operand , const Axis & axis , int beginIndex , int endIndex , const std : : wstring & name = L " " ) ; <nl> + % ignore CNTK : : RandomSample ( const Variable & operand , size_t numSamples , bool allowDuplicates , const std : : wstring & name ) ; <nl> + % ignore CNTK : : RandomSampleInclusionFrequency ( const Variable & operand , size_t numSamples , bool allowDuplicates , const std : : wstring & name ) ; <nl> + % ignore CNTK : : Dropout ( const Variable & operand , double dropoutRate , const std : : wstring & name = L " " ) ; <nl> + % ignore CNTK : : Reshape ( const Variable & operand , const NDShape & newShape , const std : : wstring & name = L " " ) ; <nl> + % ignore CNTK : : Plus ( const Variable & leftOperand , const Variable & rightOperand , const std : : wstring & name = L " " ) ; <nl> + % ignore CNTK : : operator + ( const Variable & leftOperand , const Variable & rightOperand ) ; <nl> + % ignore CNTK : : Minus ( const Variable & leftOperand , const Variable & rightOperand , const std : : wstring & name = L " " ) ; <nl> + % ignore CNTK : : operator - ( const Variable & leftOperand , const Variable & rightOperand ) ; <nl> + % ignore CNTK : : LogAddExp ( const Variable & leftOperand , const Variable & rightOperand , const std : : wstring & name = L " " ) ; <nl> + % ignore CNTK : : ElementTimes ( const Variable & leftOperand , const Variable & rightOperand , const std : : wstring & name = L " " ) ; <nl> + % ignore CNTK : : ElementDivide ( const Variable & leftOperand , const Variable & rightOperand , const std : : wstring & name = L " " ) ; <nl> + % ignore CNTK : : Equal ( const Variable & leftOperand , const Variable & rightOperand , const std : : wstring & name = L " " ) ; <nl> + % ignore CNTK : : NotEqual ( const Variable & leftOperand , const Variable & rightOperand , const std : : wstring & name = L " " ) ; <nl> + % ignore CNTK : : Less ( const Variable & leftOperand , const Variable & rightOperand , const std : : wstring & name = L " " ) ; <nl> + % ignore CNTK : : LessEqual ( const Variable & leftOperand , const Variable & rightOperand , const std : : wstring & name = L " " ) ; <nl> + % ignore CNTK : : Greater ( const Variable & leftOperand , const Variable & rightOperand , const std : : wstring & name = L " " ) ; <nl> + % ignore CNTK : : GreaterEqual ( const Variable & leftOperand , const Variable & rightOperand , const std : : wstring & name = L " " ) ; <nl> + % ignore CNTK : : Times ( const Variable & leftOperand , const Variable & rightOperand , size_t outputRank , int inferInputRankToMap , const std : : wstring & name = L " " ) ; <nl> + % ignore CNTK : : Times ( const Variable & leftOperand , const Variable & rightOperand , size_t outputRank , const std : : wstring & name = L " " ) ; <nl> + % ignore CNTK : : Times ( const Variable & leftOperand , const Variable & rightOperand , const std : : wstring & name = L " " ) ; <nl> + % ignore CNTK : : TransposeTimes ( const Variable & leftOperand , const Variable & rightOperand , size_t outputRank , const std : : wstring & name = L " " ) ; <nl> + % ignore CNTK : : TransposeTimes ( const Variable & leftOperand , const Variable & rightOperand , const std : : wstring & name = L " " ) ; <nl> + % ignore CNTK : : CosineDistance ( const Variable & leftOperand , const Variable & rightOperand , const std : : wstring & name = L " " ) ; <nl> + % ignore CNTK : : BinaryCrossEntropy ( const Variable & prediction , const Variable & targets , const std : : wstring & name = L " " ) ; <nl> + % ignore CNTK : : WeightedBinaryCrossEntropy ( const Variable & prediction , const Variable & targets , const Variable & weights , const std : : wstring & name = L " " ) ; <nl> + % ignore CNTK : : SquaredError ( const Variable & prediction , const Variable & targets , const std : : wstring & name = L " " ) ; <nl> + % ignore CNTK : : CrossEntropyWithSoftmax ( const Variable & prediction , const Variable & labels , const Axis & axis , const std : : wstring & name = L " " ) ; <nl> + % ignore CNTK : : CrossEntropyWithSoftmax ( const Variable & prediction , const Variable & labels , const std : : wstring & name = L " " ) ; <nl> + % ignore CNTK : : ClassificationError ( const Variable & prediction , const Variable & labels , size_t topN , const Axis & axis , const std : : wstring & name = L " " ) ; <nl> + % ignore CNTK : : ClassificationError ( const Variable & prediction , const Variable & labels , size_t topN , const std : : wstring & name = L " " ) ; <nl> + % ignore CNTK : : ClassificationError ( const Variable & prediction , const Variable & labels , const Axis & axis , const std : : wstring & name = L " " ) ; <nl> + % ignore CNTK : : ClassificationError ( const Variable & prediction , const Variable & labels , const std : : wstring & name = L " " ) ; <nl> + % ignore CNTK : : PastValue ( const Variable & operand , const Variable & initialState , size_t offset = 1 , const std : : wstring & name = L " " ) ; <nl> + % ignore CNTK : : PastValue ( const Variable & operand , size_t offset = 1 , const std : : wstring & name = L " " ) ; <nl> + % ignore CNTK : : FutureValue ( const Variable & operand , const Variable & initialState , size_t offset = 1 , const std : : wstring & name = L " " ) ; <nl> + % ignore CNTK : : FutureValue ( const Variable & operand , size_t offset = 1 , const std : : wstring & name = L " " ) ; <nl> + % ignore CNTK : : ReduceSum ( const Variable & operand , const std : : wstring & name = L " " ) ; <nl> + % ignore CNTK : : ReduceSum ( const Variable & operand , const Axis & axis , const std : : wstring & name = L " " ) ; <nl> + % ignore CNTK : : ReduceLogSum ( const Variable & operand , const Axis & axis , const std : : wstring & name = L " " ) ; <nl> + % ignore CNTK : : ReduceMean ( const Variable & operand , const Axis & axis , const std : : wstring & name = L " " ) ; <nl> + % ignore CNTK : : ReduceMax ( const Variable & operand , const Axis & axis , const std : : wstring & name = L " " ) ; <nl> + % ignore CNTK : : ReduceMin ( const Variable & operand , const Axis & axis , const std : : wstring & name = L " " ) ; <nl> + % ignore CNTK : : PerDimMeanVarianceNormalize ( const Variable & operand , const NDArrayViewPtr & mean , const NDArrayViewPtr & invStdDev , const std : : wstring & name = L " " ) ; <nl> + % ignore CNTK : : Convolution ( const Variable & convolutionMap , <nl> + const Variable & operand , <nl> + const NDShape & strides = { 1 } , <nl> + const std : : vector < bool > & sharing = { true } , <nl> + const std : : vector < bool > & autoPadding = { true } , <nl> + const NDShape & lowerPad = { 0 } , <nl> + const NDShape & upperPad = { 0 } , <nl> + bool transpose = false , <nl> + size_t maxTempMemSizeInSamples = 0 , <nl> + const std : : wstring & name = L " " ) ; <nl> + % ignore CNTK : : ROIPooling ( const Variable & convolutionMap , const Variable & rois , const NDShape & roiOutputShape , const std : : wstring & name = L " " ) ; <nl> + <nl> + % ignore CNTK : : Pooling ( const Variable & operand , <nl> + PoolingType poolingType , <nl> + const NDShape & poolingWindowShape , <nl> + const NDShape & strides = { 1 } , <nl> + const std : : vector < bool > & autoPadding = { false } , <nl> + const NDShape & lowerPad = { 0 } , <nl> + const NDShape & upperPad = { 0 } , <nl> + const std : : wstring & name = L " " ) ; <nl> + % ignore CNTK : : BatchNormalization ( const Variable & operand , <nl> + const Variable & scale , <nl> + const Variable & bias , <nl> + const Variable & runningMean , <nl> + const Variable & runningInvStd , <nl> + bool spatial , <nl> + double normalizationTimeConstant = 0 , <nl> + double blendTimeConstant = 0 , <nl> + double epsilon = 0 . 00001 , <nl> + bool useCuDNNEngine = false , <nl> + const std : : wstring & name = L " " ) ; <nl> + % ignore CNTK : : OptimizedRNNStack ( const Variable & operand , <nl> + const Variable & weights , <nl> + size_t hiddenSize , <nl> + size_t numLayers , <nl> + bool bidirectional = false , <nl> + const std : : wstring & recurrentOp = L " lstm " , <nl> + const std : : wstring & name = L " " ) ; <nl> + % ignore CNTK : : Clip ( const Variable & operand , const Variable & min , const Variable & max , const std : : wstring & name = L " " ) ; <nl> + % ignore CNTK : : ElementSelect ( const Variable & condition , const Variable & leftOperand , const Variable & rightOperand , const std : : wstring & name = L " " ) ; <nl> + % ignore CNTK : : Splice ( const std : : vector < Variable > & operands , const Axis & axis , const std : : wstring & name = L " " ) ; <nl> + <nl> + % ignore CNTK : : Sequence ; <nl> + <nl> % ignore CNTK : : TrainingParameterSchedule ; <nl> % ignore CNTK : : TrainingParameterPerUnitSchedule ; <nl> + % ignore CNTK : : TrainingParameterPerSampleSchedule ; <nl> + % ignore CNTK : : TrainingParameterPerMinibatchSchedule ; <nl> + % ignore CNTK : : LearningRateSchedule ; <nl> + % ignore CNTK : : LearningRatePerSampleSchedule ; <nl> + % ignore CNTK : : LearningRatePerMinibatchSchedule ; <nl> % ignore CNTK : : MomentumAsTimeConstantSchedule ; <nl> % ignore CNTK : : AdditionalLearningOptions ; <nl> % ignore CNTK : : Learner ; <nl> + <nl> + % ignore CNTK : : SGDLearner ( const std : : vector < Parameter > & parameters , <nl> + const LearningRateSchedule & learningRateSchedule , <nl> + AdditionalLearningOptions additionalOptions = AdditionalLearningOptions ( ) ) ; <nl> + % ignore CNTK : : MomentumSGDLearner ( const std : : vector < Parameter > & parameters , <nl> + const LearningRateSchedule & learningRateSchedule , <nl> + const MomentumSchedule & momentumSchedule , <nl> + AdditionalLearningOptions additionalOptions = AdditionalLearningOptions ( ) ) ; <nl> + % ignore CNTK : : NesterovLearner ( const std : : vector < Parameter > & parameters , <nl> + const LearningRateSchedule & learningRateSchedule , <nl> + const MomentumSchedule & momentumSchedule , <nl> + AdditionalLearningOptions additionalOptions = AdditionalLearningOptions ( ) ) ; <nl> + % ignore CNTK : : DefaultVarianceMomentum ; <nl> + % ignore CNTK : : AdamLearner ( const std : : vector < Parameter > & parameters , <nl> + const LearningRateSchedule & learningRateSchedule , <nl> + const MomentumSchedule & momentumSchedule , <nl> + const MomentumSchedule & varianceMomentumSchedule = DefaultVarianceMomentum , <nl> + bool lowMemory = true , <nl> + AdditionalLearningOptions additionalOptions = AdditionalLearningOptions ( ) ) ; <nl> + % ignore CNTK : : AdaGradLearner ( const std : : vector < Parameter > & parameters , <nl> + const LearningRateSchedule & learningRateSchedule , <nl> + bool needAveMultiplier = true , <nl> + AdditionalLearningOptions additionalOptions = AdditionalLearningOptions ( ) ) ; <nl> + % ignore CNTK : : RMSPropLearner ( const std : : vector < Parameter > & parameters , <nl> + const LearningRateSchedule & learningRateSchedule , <nl> + double gamma , <nl> + double inc , <nl> + double dec , <nl> + double max , <nl> + double min , <nl> + bool needAveMultiplier = true , <nl> + AdditionalLearningOptions additionalOptions = AdditionalLearningOptions ( ) ) ; <nl> + <nl> % ignore CNTK : : Trainer ; <nl> % ignore CNTK : : StreamInformation ; <nl> + % ignore std : : hash < : : CNTK : : StreamInformation > ; <nl> + <nl> % ignore CNTK : : MinibatchData ; <nl> % ignore CNTK : : MinibatchSource ; <nl> + % ignore CNTK : : CreateCompositeMinibatchSource ( const Dictionary & configuration ) ; <nl> % ignore CNTK : : StreamConfiguration ; <nl> + % ignore CNTK : : TextFormatMinibatchSource ; <nl> + % ignore CNTK : : ComputeInputPerDimMeansAndInvStdDevs ; <nl> % ignore CNTK : : DistributedWorkerDescriptor ; <nl> + % ignore CNTK : : operator = = ( const DistributedWorkerDescriptor & left , const DistributedWorkerDescriptor & right ) ; <nl> % ignore CNTK : : DistributedCommunicator ; <nl> % ignore CNTK : : QuantizedDistributedCommunicator ; <nl> + % ignore CNTK : : MPICommunicator ( ) ; <nl> + % ignore CNTK : : QuantizedMPICommunicator ( bool zeroThresholdFor1Bit , bool useQuantizationForSelfStripe , size_t numQuantizationBits ) ; <nl> % ignore CNTK : : MinibatchInfo ; <nl> % ignore CNTK : : DistributedTrainer ; <nl> + % ignore CNTK : : CreateDataParallelDistributedTrainer ( DistributedCommunicatorPtr communicator , bool useAsyncBufferedParameterUpdate , size_t distributedAfterSampleCount = 0 ) ; <nl> + % ignore CNTK : : CreateQuantizedDataParallelDistributedTrainer ( QuantizedDistributedCommunicatorPtr communicator , <nl> + bool useAsyncBufferedParameterUpdate , <nl> + size_t distributedAfterSampleCount ) ; <nl> + % ignore CNTK : : CreateBlockMomentumDistributedTrainer ; <nl> + <nl> + % ignore std : : hash < : : CNTK : : DistributedWorkerDescriptor > ; <nl> <nl> - / / map the point to array <nl> + / / Todo : add correct typemap as they might be useful for C # in future . <nl> + % ignore CNTK : : NDMask : : DataBuffer ( ) const ; <nl> + <nl> + <nl> + / / map the pointer to array <nl> % apply float INPUT [ ] { float * dataBuffer } <nl> % apply double INPUT [ ] { double * dataBuffer } <nl> <nl> <nl> } <nl> } <nl> <nl> - / / <nl> - / / Function <nl> - / / <nl> - % extend CNTK : : Function { <nl> - / / / <nl> - / / / Computes and stores the values of specified variables in the ' outputs ' map , using provided ' inputs ' values corresponding <nl> - / / / to each leaf variable of the function of VariableKind ' Input ' . <nl> - / / / The function does not return any variables that needed for backpropagation of gradients . <nl> - / / / <nl> - void Evaluate ( const std : : unordered_map < Variable , ValuePtr > & arguments , <nl> - std : : unordered_map < Variable , ValuePtr > & outputs , <nl> - const DeviceDescriptor & computeDevice = DeviceDescriptor : : UseDefaultDevice ( ) ) <nl> - { <nl> - self - > Forward ( arguments , outputs , computeDevice , { } ) ; <nl> - } <nl> - <nl> - } <nl> - <nl> - <nl> <nl> <nl>
add % ignore in cntk_cs . i , remove SWIGCSHARP in CNTKLibrary . h , add Evaluate function at C + +
microsoft/CNTK
339908a11e36c1e5cec0de36642b02a4eefe28fa
2016-12-07T12:11:06Z
mmm a / lib / Sema / TypeCheckConstraints . cpp <nl> ppp b / lib / Sema / TypeCheckConstraints . cpp <nl> CheckedCastKind TypeChecker : : typeCheckCheckedCast ( Type fromType , <nl> return CheckedCastKind : : BridgeFromObjectiveC ; <nl> } <nl> <nl> + / / Objective - C metaclasses are subclasses of NSObject in the ObjC runtime , <nl> + / / so casts from NSObject to potentially - class metatypes may succeed . <nl> + if ( auto nsObject = cs . TC . getNSObjectType ( dc ) ) { <nl> + if ( fromType - > isEqual ( nsObject ) ) { <nl> + if ( auto toMeta = toType - > getAs < MetatypeType > ( ) ) { <nl> + if ( toMeta - > getInstanceType ( ) - > mayHaveSuperclass ( ) <nl> + | | toMeta - > getInstanceType ( ) - > is < ArchetypeType > ( ) ) <nl> + return CheckedCastKind : : ValueCast ; <nl> + } <nl> + if ( toType - > is < ExistentialMetatypeType > ( ) ) <nl> + return CheckedCastKind : : ValueCast ; <nl> + } <nl> + } <nl> + <nl> / / We can conditionally cast from NSError to an ErrorType - conforming type . <nl> / / This is handled in the runtime , so it doesn ' t need a special cast kind . <nl> auto errorTypeProto = Context . getProtocol ( KnownProtocolKind : : ErrorType ) ; <nl> new file mode 100644 <nl> index 000000000000 . . da17e0520ec4 <nl> mmm / dev / null <nl> ppp b / test / Constraints / casts_objc . swift <nl> <nl> + / / RUN : % target - swift - frontend ( mock - sdk : % clang - importer - sdk ) - parse - verify % s <nl> + / / REQUIRES : objc_interop <nl> + <nl> + import Foundation <nl> + <nl> + struct NotClass { } <nl> + <nl> + class SomeClass { } <nl> + <nl> + func nsobject_as_class_cast < T > ( x : NSObject , _ : T ) { <nl> + let _ = x is AnyObject . Type <nl> + let _ = x as ! AnyObject . Type <nl> + let _ = x as ? AnyObject . Type <nl> + <nl> + let _ = x is Any . Type <nl> + let _ = x as ! Any . Type <nl> + let _ = x as ? Any . Type <nl> + <nl> + let _ = x is SomeClass . Type <nl> + let _ = x as ! SomeClass . Type <nl> + let _ = x as ? SomeClass . Type <nl> + <nl> + let _ = x is T . Type <nl> + let _ = x as ! T . Type <nl> + let _ = x as ? T . Type <nl> + <nl> + let _ = x is NotClass . Type / / expected - warning { { cast from ' NSObject ' to unrelated type ' NotClass . Type ' always fails } } <nl> + let _ = x as ! NotClass . Type / / expected - warning { { cast from ' NSObject ' to unrelated type ' NotClass . Type ' always fails } } <nl> + let _ = x as ? NotClass . Type / / expected - warning { { cast from ' NSObject ' to unrelated type ' NotClass . Type ' always fails } } <nl> + } <nl> + <nl> + <nl>
Sema : Don ' t diagnose casts from NSObject to potentially - class metatypes .
apple/swift
190251fd64d567013afa182a4b8fdf2f7c07f6cb
2015-07-08T23:23:35Z
mmm a / hphp / compiler / analysis / emitter . cpp <nl> ppp b / hphp / compiler / analysis / emitter . cpp <nl> static Unit * emitHHBCNativeClassUnit ( const HhbcExtClassInfo * builtinClasses , <nl> e . info = it - > second ; <nl> e . ci = ClassInfo : : FindSystemClassInterfaceOrTrait ( e . name ) ; <nl> assert ( e . ci ) ; <nl> + if ( ( e . ci - > getAttribute ( ) & ClassInfo : : ZendCompat ) & & <nl> + ! RuntimeOption : : EnableZendCompat ) { <nl> + continue ; <nl> + } <nl> StringData * parentName <nl> = makeStaticString ( e . ci - > getParentClass ( ) . get ( ) ) ; <nl> if ( parentName - > empty ( ) ) { <nl> / / If this class doesn ' t have a base class , it ' s eligible to be <nl> / / loaded now <nl> classEntries . push_back ( e ) ; <nl> + } else if ( ( e . ci - > getAttribute ( ) & ClassInfo : : ZendCompat ) & & <nl> + Unit : : loadClass ( parentName ) ) { <nl> + / / You can really hurt yourself trying to extend a systemlib class from <nl> + / / a normal IDL ( like overriding the property vector with your own C + + <nl> + / / properties ) . ZendCompat things don ' t do any of that so they are cool . <nl> + classEntries . push_back ( e ) ; <nl> } else { <nl> / / If this class has a base class , we can ' t load it until its <nl> / / base class has been loaded <nl> mmm a / hphp / hhvm / process - init . cpp <nl> ppp b / hphp / hhvm / process - init . cpp <nl> void ProcessInit ( ) { <nl> for ( long long i = 0 ; i < hhbc_ext_class_count ; + + i ) { <nl> const HhbcExtClassInfo * info = hhbc_ext_classes + i ; <nl> const StringData * name = makeStaticString ( info - > m_name ) ; <nl> + <nl> + const String strName ( info - > m_name , CopyString ) ; <nl> + const auto & ci = ClassInfo : : FindSystemClassInterfaceOrTrait ( strName ) ; <nl> + if ( ci & & <nl> + ( ci - > getAttribute ( ) & ClassInfo : : ZendCompat ) & & <nl> + ! RuntimeOption : : EnableZendCompat ) { <nl> + continue ; <nl> + } <nl> + <nl> const NamedEntity * ne = Unit : : GetNamedEntity ( name ) ; <nl> Class * cls = Unit : : lookupClass ( ne ) ; <nl> assert ( cls ) ; <nl> mmm a / hphp / runtime / base / class - info . cpp <nl> ppp b / hphp / runtime / base / class - info . cpp <nl> Array ClassInfo : : GetClassLike ( unsigned mask , unsigned value ) { <nl> for ( ClassMap : : const_iterator iter = s_class_like . begin ( ) ; <nl> iter ! = s_class_like . end ( ) ; + + iter ) { <nl> const ClassInfo * info = iter - > second - > getDeclared ( ) ; <nl> + <nl> + if ( ( info - > getAttribute ( ) & ClassInfo : : ZendCompat ) & & <nl> + ! RuntimeOption : : EnableZendCompat ) { <nl> + continue ; <nl> + } <nl> + <nl> if ( ! info | | ( info - > m_attribute & mask ) ! = value ) continue ; <nl> ret . append ( info - > m_name ) ; <nl> } <nl> mmm a / hphp / tools / bootstrap / gen - class - map . cpp <nl> ppp b / hphp / tools / bootstrap / gen - class - map . cpp <nl> static void writeConstant ( std : : ostream & out , const PhpConst & cns ) { <nl> } <nl> <nl> # define CLASS_FLAG_MASK ( IsAbstract | IsFinal | NoDefaultSweep | \ <nl> - HipHopSpecific | IsCppSerializable ) <nl> + HipHopSpecific | IsCppSerializable | ZendCompat ) <nl> # define PROP_FLAG_MASK ( IsProtected | IsPrivate | IsPublic | IsStatic ) <nl> <nl> static void writeClass ( std : : ostream & out , const PhpClass & cls ) { <nl>
get ready for ZendCompat classes
facebook/hhvm
86a1fddee9217571bd5bbc1cc5d0402c60ae4243
2013-09-24T16:54:16Z
mmm a / libraries / ESP8266WebServer / src / ESP8266WebServer . cpp <nl> ppp b / libraries / ESP8266WebServer / src / ESP8266WebServer . cpp <nl> <nl> - / * <nl> + / * <nl> ESP8266WebServer . cpp - Dead simple web - server . <nl> Supports only one simultaneous client , knows how to handle GET and POST . <nl> <nl> Copyright ( c ) 2014 Ivan Grokhotkov . All rights reserved . <nl> - <nl> + <nl> This library is free software ; you can redistribute it and / or <nl> modify it under the terms of the GNU Lesser General Public <nl> License as published by the Free Software Foundation ; either <nl> <nl> # include " WiFiServer . h " <nl> # include " WiFiClient . h " <nl> # include " ESP8266WebServer . h " <nl> - <nl> + # include " detail / RequestHandler . h " <nl> / / # define DEBUG <nl> # define DEBUG_OUTPUT Serial <nl> <nl> - struct ESP8266WebServer : : RequestHandler { <nl> - RequestHandler ( ESP8266WebServer : : THandlerFunction fn , const char * uri , HTTPMethod method ) <nl> - : fn ( fn ) <nl> - , uri ( uri ) <nl> - , method ( method ) <nl> - , next ( NULL ) <nl> - { <nl> - } <nl> - <nl> - ESP8266WebServer : : THandlerFunction fn ; <nl> - String uri ; <nl> - HTTPMethod method ; <nl> - RequestHandler * next ; <nl> - <nl> - } ; <nl> <nl> ESP8266WebServer : : ESP8266WebServer ( int port ) <nl> : _server ( port ) <nl> void ESP8266WebServer : : on ( const char * uri , ESP8266WebServer : : THandlerFunction ha <nl> <nl> void ESP8266WebServer : : on ( const char * uri , HTTPMethod method , ESP8266WebServer : : THandlerFunction fn ) <nl> { <nl> - RequestHandler * handler = new RequestHandler ( fn , uri , method ) ; <nl> - if ( ! _lastHandler ) { <nl> - _firstHandler = handler ; <nl> - _lastHandler = handler ; <nl> - } <nl> - else { <nl> - _lastHandler - > next = handler ; <nl> - _lastHandler = handler ; <nl> - } <nl> + _addRequestHandler ( new FunctionRequestHandler ( fn , uri , method ) ) ; <nl> + } <nl> + <nl> + void ESP8266WebServer : : _addRequestHandler ( RequestHandler * handler ) { <nl> + if ( ! _lastHandler ) { <nl> + _firstHandler = handler ; <nl> + _lastHandler = handler ; <nl> + } <nl> + else { <nl> + _lastHandler - > next = handler ; <nl> + _lastHandler = handler ; <nl> + } <nl> + } <nl> + <nl> + void ESP8266WebServer : : serveStatic ( const char * uri , FS fs , const char * path ) { <nl> + _addRequestHandler ( new StaticRequestHandler ( fs , uri ) ) ; <nl> } <nl> <nl> void ESP8266WebServer : : handleClient ( ) <nl> void ESP8266WebServer : : onNotFound ( THandlerFunction fn ) { <nl> <nl> void ESP8266WebServer : : _handleRequest ( ) { <nl> RequestHandler * handler ; <nl> - for ( handler = _firstHandler ; handler ; handler = handler - > next ) <nl> - { <nl> - if ( handler - > method ! = HTTP_ANY & & handler - > method ! = _currentMethod ) <nl> - continue ; <nl> - <nl> - if ( handler - > uri ! = _currentUri ) <nl> - continue ; <nl> - <nl> - handler - > fn ( ) ; <nl> - break ; <nl> + for ( handler = _firstHandler ; handler ; handler = handler - > next ) { <nl> + if ( handler - > handle ( * this , _currentMethod , _currentUri ) ) <nl> + break ; <nl> } <nl> <nl> if ( ! handler ) { <nl> mmm a / libraries / ESP8266WebServer / src / ESP8266WebServer . h <nl> ppp b / libraries / ESP8266WebServer / src / ESP8266WebServer . h <nl> <nl> - / * <nl> + / * <nl> ESP8266WebServer . h - Dead simple web - server . <nl> Supports only one simultaneous client , knows how to handle GET and POST . <nl> <nl> Copyright ( c ) 2014 Ivan Grokhotkov . All rights reserved . <nl> - <nl> + <nl> This library is free software ; you can redistribute it and / or <nl> modify it under the terms of the GNU Lesser General Public <nl> License as published by the Free Software Foundation ; either <nl> <nl> # define ESP8266WEBSERVER_H <nl> <nl> # include < functional > <nl> + # include < FS . h > <nl> <nl> enum HTTPMethod { HTTP_ANY , HTTP_GET , HTTP_POST , HTTP_PUT , HTTP_PATCH , HTTP_DELETE } ; <nl> enum HTTPUploadStatus { UPLOAD_FILE_START , UPLOAD_FILE_WRITE , UPLOAD_FILE_END } ; <nl> enum HTTPUploadStatus { UPLOAD_FILE_START , UPLOAD_FILE_WRITE , UPLOAD_FILE_END } ; <nl> # define CONTENT_LENGTH_UNKNOWN ( ( size_t ) - 1 ) <nl> # define CONTENT_LENGTH_NOT_SET ( ( size_t ) - 2 ) <nl> <nl> + class RequestHandler ; <nl> + <nl> typedef struct { <nl> HTTPUploadStatus status ; <nl> String filename ; <nl> class ESP8266WebServer <nl> typedef std : : function < void ( void ) > THandlerFunction ; <nl> void on ( const char * uri , THandlerFunction handler ) ; <nl> void on ( const char * uri , HTTPMethod method , THandlerFunction fn ) ; <nl> + void serveStatic ( const char * uri , FS fs , const char * path ) ; <nl> void onNotFound ( THandlerFunction fn ) ; / / called when handler is not assigned <nl> void onFileUpload ( THandlerFunction fn ) ; / / handle file uploads <nl> <nl> class ESP8266WebServer <nl> HTTPMethod method ( ) { return _currentMethod ; } <nl> WiFiClient client ( ) { return _currentClient ; } <nl> HTTPUpload & upload ( ) { return _currentUpload ; } <nl> - <nl> + <nl> String arg ( const char * name ) ; / / get request argument value by name <nl> String arg ( int i ) ; / / get request argument value by number <nl> String argName ( int i ) ; / / get request argument name by number <nl> int args ( ) ; / / get arguments count <nl> bool hasArg ( const char * name ) ; / / check if argument exists <nl> - <nl> + <nl> / / send response to the client <nl> / / code - HTTP response code , can be 200 or 404 <nl> / / content_type - HTTP content type , like " text / plain " or " image / png " <nl> class ESP8266WebServer <nl> <nl> template < typename T > size_t streamFile ( T & file , const String & contentType ) { <nl> setContentLength ( file . size ( ) ) ; <nl> - if ( String ( file . name ( ) ) . endsWith ( " . gz " ) & & <nl> + if ( String ( file . name ( ) ) . endsWith ( " . gz " ) & & <nl> contentType ! = " application / x - gzip " & & <nl> contentType ! = " application / octet - stream " ) { <nl> sendHeader ( " Content - Encoding " , " gzip " ) ; <nl> template < typename T > size_t streamFile ( T & file , const String & contentType ) { <nl> send ( 200 , contentType , " " ) ; <nl> return _currentClient . write ( file , HTTP_DOWNLOAD_UNIT_SIZE ) ; <nl> } <nl> - <nl> + <nl> protected : <nl> + void _addRequestHandler ( RequestHandler * handler ) ; <nl> void _handleRequest ( ) ; <nl> bool _parseRequest ( WiFiClient & client ) ; <nl> void _parseArguments ( String data ) ; <nl> template < typename T > size_t streamFile ( T & file , const String & contentType ) { <nl> uint8_t _uploadReadByte ( WiFiClient & client ) ; <nl> void _prepareHeader ( String & response , int code , const char * content_type , size_t contentLength ) ; <nl> <nl> - struct RequestHandler ; <nl> struct RequestArgument { <nl> String key ; <nl> String value ; <nl> new file mode 100644 <nl> index 0000000000 . . 702e24e0b9 <nl> mmm / dev / null <nl> ppp b / libraries / ESP8266WebServer / src / detail / RequestHandler . h <nl> <nl> + # ifndef REQUESTHANDLER_H <nl> + # define REQUESTHANDLER_H <nl> + <nl> + class RequestHandler { <nl> + public : <nl> + RequestHandler ( const char * uri , HTTPMethod method ) <nl> + : uri ( uri ) <nl> + , method ( method ) <nl> + , next ( NULL ) <nl> + { <nl> + } <nl> + <nl> + virtual bool handle ( ESP8266WebServer & server , HTTPMethod requestMethod , String requestUri ) = 0 ; <nl> + <nl> + RequestHandler * next ; <nl> + <nl> + protected : <nl> + String uri ; <nl> + HTTPMethod method ; <nl> + } ; <nl> + <nl> + <nl> + class FunctionRequestHandler : public RequestHandler { <nl> + typedef RequestHandler base ; <nl> + <nl> + public : <nl> + FunctionRequestHandler ( ESP8266WebServer : : THandlerFunction fn , const char * uri , HTTPMethod method ) <nl> + : fn ( fn ) <nl> + , base ( uri , method ) <nl> + { <nl> + } <nl> + <nl> + bool handle ( ESP8266WebServer & server , HTTPMethod requestMethod , String requestUri ) override { <nl> + if ( method ! = HTTP_ANY & & method ! = requestMethod ) <nl> + return false ; <nl> + <nl> + if ( requestUri ! = uri ) <nl> + return false ; <nl> + <nl> + fn ( ) ; <nl> + return true ; <nl> + } <nl> + <nl> + protected : <nl> + ESP8266WebServer : : THandlerFunction fn ; <nl> + } ; <nl> + <nl> + class StaticRequestHandler : public RequestHandler { <nl> + typedef RequestHandler base ; <nl> + <nl> + public : <nl> + StaticRequestHandler ( FS & fs , const char * uri ) <nl> + : fs ( fs ) <nl> + , base ( uri , HTTP_GET ) <nl> + { <nl> + } <nl> + <nl> + bool handle ( ESP8266WebServer & server , HTTPMethod requestMethod , String requestUri ) override { <nl> + if ( requestMethod ! = method ) <nl> + return false ; <nl> + DEBUGV ( " StaticRequestHandler : : handle : % s \ r \ n " , requestUri . c_str ( ) ) ; <nl> + if ( ! requestUri . startsWith ( uri ) ) <nl> + return false ; <nl> + <nl> + auto prefixLength = uri . length ( ) - 1 ; <nl> + String path = requestUri . substring ( prefixLength ) ; <nl> + DEBUGV ( " StaticRequestHandler : : handle : % d % s \ r \ n " , prefixLength , path . c_str ( ) ) ; <nl> + File f = fs . open ( path , " r " ) ; <nl> + if ( ! f ) <nl> + return false ; <nl> + <nl> + server . streamFile ( f , getContentType ( path ) ) ; <nl> + return true ; <nl> + } <nl> + <nl> + static String getContentType ( const String & path ) { <nl> + if ( path . endsWith ( " . html " ) ) return " text / html " ; <nl> + else if ( path . endsWith ( " . htm " ) ) return " text / html " ; <nl> + else if ( path . endsWith ( " . css " ) ) return " text / css " ; <nl> + else if ( path . endsWith ( " . txt " ) ) return " text / plain " ; <nl> + else if ( path . endsWith ( " . js " ) ) return " application / javascript " ; <nl> + else if ( path . endsWith ( " . png " ) ) return " image / png " ; <nl> + else if ( path . endsWith ( " . gif " ) ) return " image / gif " ; <nl> + else if ( path . endsWith ( " . jpg " ) ) return " image / jpeg " ; <nl> + else if ( path . endsWith ( " . ico " ) ) return " image / x - icon " ; <nl> + else if ( path . endsWith ( " . xml " ) ) return " text / xml " ; <nl> + else if ( path . endsWith ( " . pdf " ) ) return " application / pdf " ; <nl> + else if ( path . endsWith ( " . zip " ) ) return " application / zip " ; <nl> + return " text / plain " ; <nl> + } <nl> + <nl> + protected : <nl> + FS fs ; <nl> + } ; <nl> + <nl> + # endif / / REQUESTHANDLER_H <nl>
ESP8266WebServer : serve static files from FS
esp8266/Arduino
e8b27912d724aa4bc5a78bcb535d08c7bed0a998
2015-08-05T11:44:00Z
mmm a / cmake / ConfigureCompiler . cmake <nl> ppp b / cmake / ConfigureCompiler . cmake <nl> else ( ) <nl> - Wno - undefined - var - template <nl> - Wno - tautological - pointer - compare <nl> - Wno - format <nl> - < < < < < < < HEAD <nl> - Wredundant - move <nl> - Wpessimizing - move <nl> + - Woverloaded - virtual <nl> ) <nl> - = = = = = = = <nl> - - Woverloaded - virtual ) <nl> - > > > > > > > master <nl> if ( USE_CCACHE ) <nl> add_compile_options ( <nl> - Wno - register <nl> deleted file mode 100644 <nl> index 14e00f2ac4 . . 0000000000 <nl> mmm a / fdbrpc / batcher . actor . h <nl> ppp / dev / null <nl> <nl> - / * <nl> - * batcher . actor . h <nl> - * <nl> - * This source file is part of the FoundationDB open source project <nl> - * <nl> - * Copyright 2013 - 2018 Apple Inc . and the FoundationDB project authors <nl> - * <nl> - * Licensed under the Apache License , Version 2 . 0 ( the " License " ) ; <nl> - * you may not use this file except in compliance with the License . <nl> - * You may obtain a copy of the License at <nl> - * <nl> - * http : / / www . apache . org / licenses / LICENSE - 2 . 0 <nl> - * <nl> - * Unless required by applicable law or agreed to in writing , software <nl> - * distributed under the License is distributed on an " AS IS " BASIS , <nl> - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND , either express or implied . <nl> - * See the License for the specific language governing permissions and <nl> - * limitations under the License . <nl> - * / <nl> - <nl> - # pragma once <nl> - <nl> - / / When actually compiled ( NO_INTELLISENSE ) , include the generated version of this file . In intellisense use the source version . <nl> - # if defined ( NO_INTELLISENSE ) & & ! defined ( FLOW_BATCHER_ACTOR_G_H ) <nl> - # define FLOW_BATCHER_ACTOR_G_H <nl> - # include " fdbrpc / batcher . actor . g . h " <nl> - # elif ! defined ( FLOW_BATCHER_ACTOR_H ) <nl> - # define FLOW_BATCHER_ACTOR_H <nl> - <nl> - # include " fdbrpc / Stats . h " <nl> - # include " flow / flow . h " <nl> - # include " flow / actorcompiler . h " / / This must be the last # include . <nl> - <nl> - template < class X > <nl> - void logOnReceive ( X x ) { } <nl> - <nl> - void logOnReceive ( CommitTransactionRequest x ) { <nl> - if ( x . debugID . present ( ) ) <nl> - g_traceBatch . addEvent ( " CommitDebug " , x . debugID . get ( ) . first ( ) , " MasterProxyServer . batcher " ) ; <nl> - } <nl> - <nl> - template < class X > <nl> - bool firstInBatch ( X x ) { return false ; } <nl> - <nl> - bool firstInBatch ( CommitTransactionRequest x ) { <nl> - return x . firstInBatch ( ) ; <nl> - } <nl> - <nl> - ACTOR template < class X > <nl> - Future < Void > batcher ( PromiseStream < std : : pair < std : : vector < X > , int > > out , FutureStream < X > in , double avgMinDelay , double * avgMaxDelay , double emptyBatchTimeout , int maxCount , int desiredBytes , int maxBytes , Optional < PromiseStream < Void > > batchStartedStream , int64_t * commitBatchesMemBytesCount , int64_t commitBatchesMemBytesLimit , TaskPriority taskID = TaskPriority : : DefaultDelay , Counter * counter = 0 ) <nl> - { <nl> - wait ( delayJittered ( * avgMaxDelay , taskID ) ) ; / / smooth out <nl> - / / This is set up to deliver even zero - size batches if emptyBatchTimeout elapses , because that ' s what master proxy wants . The source control history <nl> - / / contains a version that does not . <nl> - <nl> - state double lastBatch = 0 ; <nl> - <nl> - loop { <nl> - state Future < Void > timeout ; <nl> - state std : : vector < X > batch ; <nl> - state int batchBytes = 0 ; <nl> - <nl> - if ( emptyBatchTimeout < = 0 ) <nl> - timeout = Never ( ) ; <nl> - else <nl> - timeout = delayJittered ( emptyBatchTimeout , taskID ) ; <nl> - <nl> - while ( ! timeout . isReady ( ) & & ! ( batch . size ( ) = = maxCount | | batchBytes > = desiredBytes ) ) { <nl> - choose { <nl> - when ( X x = waitNext ( in ) ) { <nl> - int bytes = getBytes ( x ) ; <nl> - / / Drop requests if memory is under severe pressure <nl> - if ( * commitBatchesMemBytesCount + bytes > commitBatchesMemBytesLimit ) { <nl> - x . reply . sendError ( proxy_memory_limit_exceeded ( ) ) ; <nl> - TraceEvent ( SevWarnAlways , " ProxyCommitBatchMemoryThresholdExceeded " ) . suppressFor ( 60 ) . detail ( " CommitBatchesMemBytesCount " , * commitBatchesMemBytesCount ) . detail ( " CommitBatchesMemLimit " , commitBatchesMemBytesLimit ) ; <nl> - continue ; <nl> - } <nl> - <nl> - / / Process requests in the normal case <nl> - if ( counter ) + + * counter ; <nl> - logOnReceive ( x ) ; <nl> - if ( ! batch . size ( ) ) { <nl> - if ( batchStartedStream . present ( ) ) <nl> - batchStartedStream . get ( ) . send ( Void ( ) ) ; <nl> - if ( now ( ) - lastBatch > * avgMaxDelay ) <nl> - timeout = delayJittered ( avgMinDelay , taskID ) ; <nl> - else <nl> - timeout = delayJittered ( * avgMaxDelay - ( now ( ) - lastBatch ) , taskID ) ; <nl> - } <nl> - <nl> - bool first = firstInBatch ( x ) ; <nl> - if ( ( batchBytes + bytes > maxBytes | | first ) & & batch . size ( ) ) { <nl> - out . send ( { batch , batchBytes } ) ; <nl> - lastBatch = now ( ) ; <nl> - if ( batchStartedStream . present ( ) ) <nl> - batchStartedStream . get ( ) . send ( Void ( ) ) ; <nl> - timeout = delayJittered ( * avgMaxDelay , taskID ) ; <nl> - batch = std : : vector < X > ( ) ; <nl> - batchBytes = 0 ; <nl> - } <nl> - <nl> - batch . push_back ( x ) ; <nl> - batchBytes + = bytes ; <nl> - * commitBatchesMemBytesCount + = bytes ; <nl> - } <nl> - when ( wait ( timeout ) ) { } <nl> - } <nl> - } <nl> - out . send ( { std : : move ( batch ) , batchBytes } ) ; <nl> - lastBatch = now ( ) ; <nl> - } <nl> - } <nl> - <nl> - # include " flow / unactorcompiler . h " <nl> - <nl> - # endif <nl> mmm a / flow / Arena . h <nl> ppp b / flow / Arena . h <nl> struct ArenaBlock : NonCopyable , ThreadSafeReferenceCounted < ArenaBlock > <nl> static void * operator new ( size_t s ) ; / / not implemented <nl> } ; <nl> <nl> - < < < < < < < HEAD <nl> - = = = = = = = <nl> - inline Arena : : Arena ( ) : impl ( NULL ) { } <nl> - inline Arena : : Arena ( size_t reservedSize ) : impl ( 0 ) { <nl> - UNSTOPPABLE_ASSERT ( reservedSize < std : : numeric_limits < int > : : max ( ) ) ; <nl> - if ( reservedSize ) <nl> - ArenaBlock : : create ( ( int ) reservedSize , impl ) ; <nl> - } <nl> - inline Arena : : Arena ( const Arena & r ) : impl ( r . impl ) { } <nl> - inline Arena : : Arena ( Arena & & r ) noexcept : impl ( std : : move ( r . impl ) ) { } <nl> - inline Arena & Arena : : operator = ( const Arena & r ) { <nl> - impl = r . impl ; <nl> - return * this ; <nl> - } <nl> - inline Arena & Arena : : operator = ( Arena & & r ) noexcept { <nl> - impl = std : : move ( r . impl ) ; <nl> - return * this ; <nl> - } <nl> - inline void Arena : : dependsOn ( const Arena & p ) { <nl> - if ( p . impl ) <nl> - ArenaBlock : : dependOn ( impl , p . impl . getPtr ( ) ) ; <nl> - } <nl> - inline size_t Arena : : getSize ( ) const { return impl ? impl - > totalSize ( ) : 0 ; } <nl> - inline bool Arena : : hasFree ( size_t size , const void * address ) { return impl & & impl - > unused ( ) > = size & & impl - > getNextData ( ) = = address ; } <nl> - > > > > > > > master <nl> inline void * operator new ( size_t size , Arena & p ) { <nl> UNSTOPPABLE_ASSERT ( size < std : : numeric_limits < int > : : max ( ) ) ; <nl> return ArenaBlock : : allocate ( p . impl , ( int ) size ) ; <nl> mmm a / tests / slow / LowLatencyWithFailures . txt <nl> ppp b / tests / slow / LowLatencyWithFailures . txt <nl> connectionFailuresDisableDuration = 60 <nl> waitForVersion = true <nl> allowFaultInjection = false <nl> killDc = false <nl> - < < < < < < < HEAD <nl> <nl> connectionFailuresDisableDuration = 60 <nl> minimumReplication = 2 <nl> - = = = = = = = <nl> - > > > > > > > master <nl>
Resolve merge conflict
apple/foundationdb
8ae0d9b73d6c04c0fc0f00460c3f57200181dbfd
2020-07-13T17:21:53Z
mmm a / cocos2dx / include / CCTMXXMLParser . h <nl> ppp b / cocos2dx / include / CCTMXXMLParser . h <nl> THE SOFTWARE . <nl> # include " CCMutableDictionary . h " <nl> # include " CCGeometry . h " <nl> <nl> - # if ( CC_TARGET_PLATFORM = = CC_PLATFORM_AIRPLAY ) <nl> - <nl> - # include " . . / platform / airplay / CCSAXParser_airplay . h " <nl> - <nl> - namespace cocos2d { <nl> - <nl> - class CCTMXObjectGroup ; <nl> - <nl> - / * * @ file <nl> - * Internal TMX parser <nl> - * <nl> - * IMPORTANT : These classed should not be documented using doxygen strings <nl> - * since the user should not use them . <nl> - * <nl> - * / <nl> - <nl> - enum { <nl> - TMXLayerAttribNone = 1 < < 0 , <nl> - TMXLayerAttribBase64 = 1 < < 1 , <nl> - TMXLayerAttribGzip = 1 < < 2 , <nl> - } ; <nl> - <nl> - enum { <nl> - TMXPropertyNone , <nl> - TMXPropertyMap , <nl> - TMXPropertyLayer , <nl> - TMXPropertyObjectGroup , <nl> - TMXPropertyObject , <nl> - TMXPropertyTile <nl> - } ; <nl> - <nl> - / * * @ brief CCTMXLayerInfo contains the information about the layers like : <nl> - - Layer name <nl> - - Layer size <nl> - - Layer opacity at creation time ( it can be modified at runtime ) <nl> - - Whether the layer is visible ( if it ' s not visible , then the CocosNode won ' t be created ) <nl> - <nl> - This information is obtained from the TMX file . <nl> - * / <nl> - class CC_DLL CCTMXLayerInfo : public CCObject <nl> - { <nl> - CC_PROPERTY ( CCStringToStringDictionary * , m_pProperties , Properties ) ; <nl> - public : <nl> - std : : string m_sName ; <nl> - CCSize m_tLayerSize ; <nl> - unsigned int * m_pTiles ; <nl> - bool m_bVisible ; <nl> - unsigned char m_cOpacity ; <nl> - bool m_bOwnTiles ; <nl> - unsigned int m_uMinGID ; <nl> - unsigned int m_uMaxGID ; <nl> - CCPoint m_tOffset ; <nl> - public : <nl> - CCTMXLayerInfo ( ) ; <nl> - virtual ~ CCTMXLayerInfo ( ) ; <nl> - } ; <nl> - <nl> - / * * @ brief CCTMXTilesetInfo contains the information about the tilesets like : <nl> - - Tileset name <nl> - - Tilset spacing <nl> - - Tileset margin <nl> - - size of the tiles <nl> - - Image used for the tiles <nl> - - Image size <nl> - <nl> - This information is obtained from the TMX file . <nl> - * / <nl> - class CC_DLL CCTMXTilesetInfo : public CCObject <nl> - { <nl> - public : <nl> - std : : string m_sName ; <nl> - unsigned int m_uFirstGid ; <nl> - CCSize m_tTileSize ; <nl> - unsigned int m_uSpacing ; <nl> - unsigned int m_uMargin ; <nl> - / / ! filename containing the tiles ( should be spritesheet / texture atlas ) <nl> - std : : string m_sSourceImage ; <nl> - / / ! size in pixels of the image <nl> - CCSize m_tImageSize ; <nl> - public : <nl> - CCTMXTilesetInfo ( ) ; <nl> - virtual ~ CCTMXTilesetInfo ( ) ; <nl> - CCRect rectForGID ( unsigned int gid ) ; <nl> - } ; <nl> - <nl> - / * * @ brief CCTMXMapInfo contains the information about the map like : <nl> - - Map orientation ( hexagonal , isometric or orthogonal ) <nl> - - Tile size <nl> - - Map size <nl> - <nl> - And it also contains : <nl> - - Layers ( an array of TMXLayerInfo objects ) <nl> - - Tilesets ( an array of TMXTilesetInfo objects ) <nl> - - ObjectGroups ( an array of TMXObjectGroupInfo objects ) <nl> - <nl> - This information is obtained from the TMX file . <nl> - <nl> - * / <nl> - class CC_DLL CCTMXMapInfo : public CCObject , public CCSAXDelegator <nl> - { <nl> - public : <nl> - / / / map orientation <nl> - CC_SYNTHESIZE ( int , m_nOrientation , Orientation ) ; <nl> - / / / map width & height <nl> - CC_SYNTHESIZE ( CCSize , m_tMapSize , MapSize ) ; <nl> - / / / tiles width & height <nl> - CC_SYNTHESIZE ( CCSize , m_tTileSize , TileSize ) ; <nl> - / / / Layers <nl> - CC_PROPERTY ( CCMutableArray < CCTMXLayerInfo * > * , m_pLayers , Layers ) ; <nl> - / / / tilesets <nl> - CC_PROPERTY ( CCMutableArray < CCTMXTilesetInfo * > * , m_pTilesets , Tilesets ) ; <nl> - / / / ObjectGroups <nl> - CC_PROPERTY ( CCMutableArray < CCTMXObjectGroup * > * , m_pObjectGroups , ObjectGroups ) ; <nl> - / / / parent element <nl> - CC_SYNTHESIZE ( int , m_nParentElement , ParentElement ) ; <nl> - / / / parent GID <nl> - CC_SYNTHESIZE ( unsigned int , m_uParentGID , ParentGID ) ; <nl> - / / / layer attribs <nl> - CC_SYNTHESIZE ( int , m_nLayerAttribs , LayerAttribs ) ; <nl> - / / / is stroing characters ? <nl> - CC_SYNTHESIZE ( bool , m_bStoringCharacters , StoringCharacters ) ; <nl> - / / / properties <nl> - CC_PROPERTY ( CCStringToStringDictionary * , m_pProperties , Properties ) ; <nl> - public : <nl> - CCTMXMapInfo ( ) ; <nl> - virtual ~ CCTMXMapInfo ( ) ; <nl> - / * * creates a TMX Format with a tmx file * / <nl> - static CCTMXMapInfo * formatWithTMXFile ( const char * tmxFile ) ; <nl> - / * * initializes a TMX format witha tmx file * / <nl> - bool initWithTMXFile ( const char * tmxFile ) ; <nl> - / * * initalises parsing of an XML file , either a tmx ( Map ) file or tsx ( Tileset ) file * / <nl> - bool parseXMLFile ( const char * xmlFilename ) ; <nl> - void startElement ( void * ctx , const XML_Char * name , const XML_Char * * atts ) ; <nl> - void endElement ( void * ctx , const XML_Char * name ) ; <nl> - void textHandler ( void * ctx , const XML_Char * ch , int len ) ; <nl> - CCDictionary < int , CCStringToStringDictionary * > * getTileProperties ( ) ; <nl> - void setTileProperties ( CCDictionary < int , CCStringToStringDictionary * > * tileProperties ) ; <nl> - <nl> - inline const char * getCurrentString ( ) { return m_sCurrentString . c_str ( ) ; } <nl> - inline void setCurrentString ( const char * currentString ) { m_sCurrentString = currentString ; } <nl> - inline const char * getTMXFileName ( ) { return m_sTMXFileName . c_str ( ) ; } <nl> - inline void setTMXFileName ( const char * fileName ) { m_sTMXFileName = fileName ; } <nl> - <nl> - protected : <nl> - / / ! tmx filename <nl> - std : : string m_sTMXFileName ; <nl> - / / ! current string <nl> - std : : string m_sCurrentString ; <nl> - / / ! tile properties <nl> - CCDictionary < int , CCStringToStringDictionary * > * m_pTileProperties ; <nl> - <nl> - <nl> - } ; <nl> - <nl> - } / / namespace cocos2d <nl> - <nl> - <nl> - # else <nl> + # include " . . / platform / CCSAXParser . h " <nl> <nl> namespace cocos2d { <nl> <nl> namespace cocos2d { <nl> This information is obtained from the TMX file . <nl> <nl> * / <nl> - class CC_DLL CCTMXMapInfo : public CCObject <nl> + class CC_DLL CCTMXMapInfo : public CCObject , public CCSAXDelegator <nl> { <nl> public : <nl> / / / map orientation <nl> namespace cocos2d { <nl> bool initWithTMXFile ( const char * tmxFile ) ; <nl> / * * initalises parsing of an XML file , either a tmx ( Map ) file or tsx ( Tileset ) file * / <nl> bool parseXMLFile ( const char * xmlFilename ) ; <nl> - <nl> + <nl> CCDictionary < int , CCStringToStringDictionary * > * getTileProperties ( ) ; <nl> void setTileProperties ( CCDictionary < int , CCStringToStringDictionary * > * tileProperties ) ; <nl> <nl> + / / implement pure virtual methods of CCSAXDelegator <nl> + void startElement ( void * ctx , const XML_Char * name , const XML_Char * * atts ) ; <nl> + void endElement ( void * ctx , const XML_Char * name ) ; <nl> + void textHandler ( void * ctx , const XML_Char * ch , int len ) ; <nl> + <nl> inline const char * getCurrentString ( ) { return m_sCurrentString . c_str ( ) ; } <nl> inline void setCurrentString ( const char * currentString ) { m_sCurrentString = currentString ; } <nl> inline const char * getTMXFileName ( ) { return m_sTMXFileName . c_str ( ) ; } <nl> namespace cocos2d { <nl> } ; <nl> <nl> } / / namespace cocos2d <nl> - # endif / / __CC_TM_XML_PARSER__ <nl> <nl> # endif <nl> <nl> new file mode 100644 <nl> index 000000000000 . . c3e7cc6a197a <nl> mmm / dev / null <nl> ppp b / cocos2dx / platform / CCSAXParser . h <nl> <nl> + # ifndef __CCSAXPARSER_H__ <nl> + # define __CCSAXPARSER_H__ <nl> + <nl> + NS_CC_BEGIN ; <nl> + <nl> + class CCSAXDelegator <nl> + { <nl> + public : <nl> + virtual void startElement ( const char * name , const char * * atts ) = 0 ; <nl> + virtual void endElement ( const char * name ) = 0 ; <nl> + virtual void textHandler ( const char * s , int len ) = 0 ; <nl> + } ; <nl> + <nl> + class CCSAXParser <nl> + { <nl> + CCSAXDelegator * m_pDelegator ; <nl> + public : <nl> + <nl> + CCSAXParser ( ) ; <nl> + ~ CCSAXParser ( void ) ; <nl> + <nl> + void init ( const char * pszEncoding ) ; <nl> + void parse ( const char * pszFile ) ; <nl> + void setDelegator ( CCSAXDelegator * pDelegator ) ; <nl> + <nl> + static void startElement ( void * ctx , const char * name , const char * * atts ) ; <nl> + static void endElement ( void * ctx , const char * name ) ; <nl> + static void textHandler ( void * ctx , const char * name , int len ) ; <nl> + } ; <nl> + NS_CC_END ; <nl> + <nl> + # endif / / __CCSAXPARSER_H__ <nl> \ No newline at end of file <nl> mmm a / cocos2dx / platform / airplay / CCSAXParser_airplay . cpp <nl> ppp b / cocos2dx / platform / airplay / CCSAXParser_airplay . cpp <nl> <nl> - # include " CCSAXParser_airplay . h " <nl> + # include " CCSAXParser . h " <nl> + # include " expat . h " <nl> + # include " CCMutableDictionary . h " <nl> # include " IwUtil . h " <nl> + <nl> NS_CC_BEGIN ; <nl> <nl> + static XML_Parser s_pParser = NULL ; <nl> + <nl> CCSAXParser : : CCSAXParser ( ) <nl> { <nl> + s_pParser = NULL ; <nl> m_pDelegator = NULL ; <nl> <nl> } <nl> CCSAXParser : : ~ CCSAXParser ( void ) <nl> { <nl> - if ( m_parser ) <nl> + if ( s_pParser ) <nl> { <nl> - XML_ParserFree ( m_parser ) ; <nl> + XML_ParserFree ( s_pParser ) ; <nl> + s_pParser = NULL ; <nl> } <nl> } <nl> void CCSAXParser : : init ( const char * pszEncoding ) <nl> { <nl> - m_parser = XML_ParserCreate ( reinterpret_cast < const XML_Char * > ( pszEncoding ) ) ; <nl> - XML_SetUserData ( m_parser , this ) ; <nl> - XML_SetElementHandler ( m_parser , startElement , endElement ) ; <nl> - XML_SetCharacterDataHandler ( m_parser , textHandler ) ; <nl> + s_pParser = XML_ParserCreate ( reinterpret_cast < const XML_Char * > ( pszEncoding ) ) ; <nl> + XML_SetUserData ( s_pParser , this ) ; <nl> + XML_SetElementHandler ( s_pParser , startElement , endElement ) ; <nl> + XML_SetCharacterDataHandler ( s_pParser , textHandler ) ; <nl> <nl> } <nl> void CCSAXParser : : parse ( const char * pszFile ) <nl> void CCSAXParser : : parse ( const char * pszFile ) <nl> char * buf = new char [ size ] ; <nl> int done = 0 ; <nl> int len = ( int ) s3eFileRead ( buf , 1 , size , file ) ; <nl> - if ( XML_Parse ( m_parser , buf , len , 1 ) = = XML_STATUS_ERROR ) <nl> + if ( XML_Parse ( s_pParser , buf , len , 1 ) = = XML_STATUS_ERROR ) <nl> { <nl> - CCLog ( " GAME : cocos2d : plist err : % s at line % d " , XML_ErrorString ( XML_GetErrorCode ( m_parser ) ) , XML_GetCurrentLineNumber ( m_parser ) ) ; <nl> + CCLog ( " GAME : cocos2d : plist err : % s at line % d " , XML_ErrorString ( XML_GetErrorCode ( s_pParser ) ) , XML_GetCurrentLineNumber ( s_pParser ) ) ; <nl> } <nl> s3eFileClose ( file ) ; <nl> delete [ ] buf ; <nl> <nl> } <nl> - void CCSAXParser : : startElement ( void * ctx , const XML_Char * name , const XML_Char * * atts ) <nl> + void CCSAXParser : : startElement ( void * ctx , const char * name , const char * * atts ) <nl> { <nl> - ( ( CCSAXParser * ) ( ctx ) ) - > m_pDelegator - > startElement ( ctx , name , atts ) ; <nl> + ( ( CCSAXParser * ) ( ctx ) ) - > m_pDelegator - > startElement ( ctx , ( XML_Char ) name , atts ) ; <nl> } <nl> <nl> - void CCSAXParser : : endElement ( void * ctx , const XML_Char * name ) <nl> + void CCSAXParser : : endElement ( void * ctx , const char * name ) <nl> { <nl> - ( ( CCSAXParser * ) ( ctx ) ) - > m_pDelegator - > endElement ( ctx , name ) ; <nl> + ( ( CCSAXParser * ) ( ctx ) ) - > m_pDelegator - > endElement ( ctx , ( XML_Char ) name ) ; <nl> } <nl> - void CCSAXParser : : textHandler ( void * ctx , const XML_Char * name , int len ) <nl> + void CCSAXParser : : textHandler ( void * ctx , const char * name , int len ) <nl> { <nl> - ( ( CCSAXParser * ) ( ctx ) ) - > m_pDelegator - > textHandler ( ctx , name , len ) ; <nl> + ( ( CCSAXParser * ) ( ctx ) ) - > m_pDelegator - > textHandler ( ctx , ( XML_Char ) name , len ) ; <nl> } <nl> void CCSAXParser : : setDelegator ( CCSAXDelegator * pDelegator ) <nl> { <nl> m_pDelegator = pDelegator ; <nl> } <nl> + <nl> NS_CC_END ; <nl> <nl> <nl> mmm a / cocos2dx / tileMap_parallax_nodes / CCTMXXMLParser . cpp <nl> ppp b / cocos2dx / tileMap_parallax_nodes / CCTMXXMLParser . cpp <nl> THE SOFTWARE . <nl> # include " platform / platform . h " <nl> <nl> # if ( CC_TARGET_PLATFORM = = CC_PLATFORM_AIRPLAY ) <nl> - # include " expat . h " <nl> - namespace cocos2d { <nl> - <nl> - const char * valueForKey ( const char * key , std : : map < std : : string , std : : string > * dict ) <nl> - { <nl> - if ( dict ) <nl> - { <nl> - std : : map < std : : string , std : : string > : : iterator it = dict - > find ( key ) ; <nl> - return it ! = dict - > end ( ) ? it - > second . c_str ( ) : " " ; <nl> - } <nl> - return " " ; <nl> - } <nl> - / / implementation CCTMXLayerInfo <nl> - CCTMXLayerInfo : : CCTMXLayerInfo ( ) <nl> - : m_bOwnTiles ( true ) <nl> - , m_uMinGID ( 100000 ) <nl> - , m_uMaxGID ( 0 ) <nl> - , m_sName ( " " ) <nl> - , m_pTiles ( NULL ) <nl> - , m_tOffset ( CCPointZero ) <nl> - { <nl> - m_pProperties = new CCStringToStringDictionary ( ) ; ; <nl> - } <nl> - CCTMXLayerInfo : : ~ CCTMXLayerInfo ( ) <nl> - { <nl> - CCLOGINFO ( " cocos2d : deallocing . " ) ; <nl> - CC_SAFE_RELEASE ( m_pProperties ) ; <nl> - if ( m_bOwnTiles & & m_pTiles ) <nl> - { <nl> - delete [ ] m_pTiles ; <nl> - m_pTiles = NULL ; <nl> - } <nl> - } <nl> - CCStringToStringDictionary * CCTMXLayerInfo : : getProperties ( ) <nl> - { <nl> - return m_pProperties ; <nl> - } <nl> - void CCTMXLayerInfo : : setProperties ( CCStringToStringDictionary * var ) <nl> - { <nl> - CC_SAFE_RETAIN ( var ) ; <nl> - CC_SAFE_RELEASE ( m_pProperties ) ; <nl> - m_pProperties = var ; <nl> - } <nl> - <nl> - / / implementation CCTMXTilesetInfo <nl> - CCTMXTilesetInfo : : CCTMXTilesetInfo ( ) <nl> - : m_uFirstGid ( 0 ) <nl> - , m_tTileSize ( CCSizeZero ) <nl> - , m_uSpacing ( 0 ) <nl> - , m_uMargin ( 0 ) <nl> - , m_tImageSize ( CCSizeZero ) <nl> - { <nl> - } <nl> - CCTMXTilesetInfo : : ~ CCTMXTilesetInfo ( ) <nl> - { <nl> - CCLOGINFO ( " cocos2d : deallocing . " ) ; <nl> - } <nl> - CCRect CCTMXTilesetInfo : : rectForGID ( unsigned int gid ) <nl> - { <nl> - CCRect rect ; <nl> - rect . size = m_tTileSize ; <nl> - gid = gid - m_uFirstGid ; <nl> - int max_x = ( int ) ( ( m_tImageSize . width - m_uMargin * 2 + m_uSpacing ) / ( m_tTileSize . width + m_uSpacing ) ) ; <nl> - / / int max_y = ( imageSize . height - margin * 2 + spacing ) / ( tileSize . height + spacing ) ; <nl> - rect . origin . x = ( gid % max_x ) * ( m_tTileSize . width + m_uSpacing ) + m_uMargin ; <nl> - rect . origin . y = ( gid / max_x ) * ( m_tTileSize . height + m_uSpacing ) + m_uMargin ; <nl> - return rect ; <nl> - } <nl> - <nl> - / / implementation CCTMXMapInfo <nl> - <nl> - CCTMXMapInfo * CCTMXMapInfo : : formatWithTMXFile ( const char * tmxFile ) <nl> - { <nl> - CCTMXMapInfo * pRet = new CCTMXMapInfo ( ) ; <nl> - if ( pRet - > initWithTMXFile ( tmxFile ) ) <nl> - { <nl> - pRet - > autorelease ( ) ; <nl> - return pRet ; <nl> - } <nl> - CC_SAFE_DELETE ( pRet ) ; <nl> - return NULL ; <nl> - } <nl> - bool CCTMXMapInfo : : initWithTMXFile ( const char * tmxFile ) <nl> - { <nl> - m_pTilesets = new CCMutableArray < CCTMXTilesetInfo * > ( ) ; <nl> - m_pLayers = new CCMutableArray < CCTMXLayerInfo * > ( ) ; <nl> - m_sTMXFileName = CCFileUtils : : fullPathFromRelativePath ( tmxFile ) ; <nl> - m_pObjectGroups = new CCMutableArray < CCTMXObjectGroup * > ( ) ; <nl> - m_pProperties = new CCStringToStringDictionary ( ) ; <nl> - m_pTileProperties = new CCDictionary < int , CCStringToStringDictionary * > ( ) ; <nl> - <nl> - / / tmp vars <nl> - m_sCurrentString = " " ; <nl> - m_bStoringCharacters = false ; <nl> - m_nLayerAttribs = TMXLayerAttribNone ; <nl> - m_nParentElement = TMXPropertyNone ; <nl> - <nl> - return parseXMLFile ( m_sTMXFileName . c_str ( ) ) ; <nl> - } <nl> - CCTMXMapInfo : : CCTMXMapInfo ( ) <nl> - : m_bStoringCharacters ( false ) <nl> - , m_nLayerAttribs ( 0 ) <nl> - , m_tMapSize ( CCSizeZero ) <nl> - , m_tTileSize ( CCSizeZero ) <nl> - , m_pLayers ( NULL ) <nl> - , m_pTilesets ( NULL ) <nl> - , m_pObjectGroups ( NULL ) <nl> - , m_pProperties ( NULL ) <nl> - , m_pTileProperties ( NULL ) <nl> - { <nl> - } <nl> - CCTMXMapInfo : : ~ CCTMXMapInfo ( ) <nl> - { <nl> - CCLOGINFO ( " cocos2d : deallocing . " ) ; <nl> - CC_SAFE_RELEASE ( m_pTilesets ) ; <nl> - CC_SAFE_RELEASE ( m_pLayers ) ; <nl> - CC_SAFE_RELEASE ( m_pProperties ) ; <nl> - CC_SAFE_RELEASE ( m_pTileProperties ) ; <nl> - CC_SAFE_RELEASE ( m_pObjectGroups ) ; <nl> - } <nl> - CCMutableArray < CCTMXLayerInfo * > * CCTMXMapInfo : : getLayers ( ) <nl> - { <nl> - return m_pLayers ; <nl> - } <nl> - void CCTMXMapInfo : : setLayers ( CCMutableArray < CCTMXLayerInfo * > * var ) <nl> - { <nl> - CC_SAFE_RETAIN ( var ) ; <nl> - CC_SAFE_RELEASE ( m_pLayers ) ; <nl> - m_pLayers = var ; <nl> - } <nl> - CCMutableArray < CCTMXTilesetInfo * > * CCTMXMapInfo : : getTilesets ( ) <nl> - { <nl> - return m_pTilesets ; <nl> - } <nl> - void CCTMXMapInfo : : setTilesets ( CCMutableArray < CCTMXTilesetInfo * > * var ) <nl> - { <nl> - CC_SAFE_RETAIN ( var ) ; <nl> - CC_SAFE_RELEASE ( m_pTilesets ) ; <nl> - m_pTilesets = var ; <nl> - } <nl> - CCMutableArray < CCTMXObjectGroup * > * CCTMXMapInfo : : getObjectGroups ( ) <nl> - { <nl> - return m_pObjectGroups ; <nl> - } <nl> - void CCTMXMapInfo : : setObjectGroups ( CCMutableArray < CCTMXObjectGroup * > * var ) <nl> - { <nl> - CC_SAFE_RETAIN ( var ) ; <nl> - CC_SAFE_RELEASE ( m_pObjectGroups ) ; <nl> - m_pObjectGroups = var ; <nl> - } <nl> - CCStringToStringDictionary * CCTMXMapInfo : : getProperties ( ) <nl> - { <nl> - return m_pProperties ; <nl> - } <nl> - void CCTMXMapInfo : : setProperties ( CCStringToStringDictionary * var ) <nl> - { <nl> - CC_SAFE_RETAIN ( var ) ; <nl> - CC_SAFE_RELEASE ( m_pProperties ) ; <nl> - m_pProperties = var ; <nl> - } <nl> - CCDictionary < int , CCStringToStringDictionary * > * CCTMXMapInfo : : getTileProperties ( ) <nl> - { <nl> - return m_pTileProperties ; <nl> - } <nl> - void CCTMXMapInfo : : setTileProperties ( CCDictionary < int , CCStringToStringDictionary * > * tileProperties ) <nl> - { <nl> - CC_SAFE_RETAIN ( tileProperties ) ; <nl> - CC_SAFE_RELEASE ( m_pTileProperties ) ; <nl> - m_pTileProperties = tileProperties ; <nl> - } <nl> - <nl> - bool CCTMXMapInfo : : parseXMLFile ( const char * xmlFilename ) <nl> - { <nl> - CCSAXParser parser ; <nl> - parser . init ( " UTF - 8 " ) ; <nl> - parser . setDelegator ( this ) ; <nl> - parser . parse ( xmlFilename ) ; <nl> - return true ; <nl> - } <nl> - <nl> - <nl> - / / the XML parser calls here with all the elements <nl> - <nl> - / / void tmx_startElement ( void * ctx , const xmlChar * name , const xmlChar * * atts ) <nl> - void CCTMXMapInfo : : startElement ( void * ctx , const XML_Char * name , const XML_Char * * atts ) <nl> - { <nl> - CCTMXMapInfo * pTMXMapInfo = this ; / / ( CCTMXMapInfo * ) ( ctx ) ; <nl> - std : : string elementName = ( char * ) name ; <nl> - std : : map < std : : string , std : : string > * attributeDict = new std : : map < std : : string , std : : string > ( ) ; <nl> - if ( atts & & atts [ 0 ] ) <nl> - { <nl> - for ( int i = 0 ; atts [ i ] ; i + = 2 ) <nl> - { <nl> - std : : string key = ( char * ) atts [ i ] ; <nl> - std : : string value = ( char * ) atts [ i + 1 ] ; <nl> - attributeDict - > insert ( pair < std : : string , std : : string > ( key , value ) ) ; <nl> - } <nl> - } <nl> - if ( elementName = = " map " ) <nl> - { <nl> - std : : string version = valueForKey ( " version " , attributeDict ) ; <nl> - if ( version ! = " 1 . 0 " ) <nl> - { <nl> - CCLOG ( " cocos2d : TMXFormat : Unsupported TMX version : % @ " , version ) ; <nl> - } <nl> - std : : string orientationStr = valueForKey ( " orientation " , attributeDict ) ; <nl> - if ( orientationStr = = " orthogonal " ) <nl> - pTMXMapInfo - > setOrientation ( CCTMXOrientationOrtho ) ; <nl> - else if ( orientationStr = = " isometric " ) <nl> - pTMXMapInfo - > setOrientation ( CCTMXOrientationIso ) ; <nl> - else if ( orientationStr = = " hexagonal " ) <nl> - pTMXMapInfo - > setOrientation ( CCTMXOrientationHex ) ; <nl> - else <nl> - CCLOG ( " cocos2d : TMXFomat : Unsupported orientation : % d " , pTMXMapInfo - > getOrientation ( ) ) ; <nl> - <nl> - CCSize s ; <nl> - s . width = ( float ) atof ( valueForKey ( " width " , attributeDict ) ) ; <nl> - s . height = ( float ) atof ( valueForKey ( " height " , attributeDict ) ) ; <nl> - pTMXMapInfo - > setMapSize ( s ) ; <nl> - <nl> - s . width = ( float ) atof ( valueForKey ( " tilewidth " , attributeDict ) ) ; <nl> - s . height = ( float ) atof ( valueForKey ( " tileheight " , attributeDict ) ) ; <nl> - pTMXMapInfo - > setTileSize ( s ) ; <nl> - <nl> - / / The parent element is now " map " <nl> - pTMXMapInfo - > setParentElement ( TMXPropertyMap ) ; <nl> - } <nl> - else if ( elementName = = " tileset " ) <nl> - { <nl> - / / If this is an external tileset then start parsing that <nl> - std : : string externalTilesetFilename = valueForKey ( " source " , attributeDict ) ; <nl> - if ( externalTilesetFilename ! = " " ) <nl> - { <nl> - externalTilesetFilename = CCFileUtils : : fullPathFromRelativeFile ( externalTilesetFilename . c_str ( ) , pTMXMapInfo - > getTMXFileName ( ) ) ; <nl> - pTMXMapInfo - > parseXMLFile ( externalTilesetFilename . c_str ( ) ) ; <nl> - } <nl> - else <nl> - { <nl> - CCTMXTilesetInfo * tileset = new CCTMXTilesetInfo ( ) ; <nl> - tileset - > m_sName = valueForKey ( " name " , attributeDict ) ; <nl> - tileset - > m_uFirstGid = ( unsigned int ) atoi ( valueForKey ( " firstgid " , attributeDict ) ) ; <nl> - tileset - > m_uSpacing = ( unsigned int ) atoi ( valueForKey ( " spacing " , attributeDict ) ) ; <nl> - tileset - > m_uMargin = ( unsigned int ) atoi ( valueForKey ( " margin " , attributeDict ) ) ; <nl> - CCSize s ; <nl> - s . width = ( float ) atof ( valueForKey ( " tilewidth " , attributeDict ) ) ; <nl> - s . height = ( float ) atof ( valueForKey ( " tileheight " , attributeDict ) ) ; <nl> - tileset - > m_tTileSize = s ; <nl> - <nl> - pTMXMapInfo - > getTilesets ( ) - > addObject ( tileset ) ; <nl> - tileset - > release ( ) ; <nl> - } <nl> - } <nl> - else if ( elementName = = " tile " ) <nl> - { <nl> - CCTMXTilesetInfo * info = pTMXMapInfo - > getTilesets ( ) - > getLastObject ( ) ; <nl> - CCStringToStringDictionary * dict = new CCStringToStringDictionary ( ) ; <nl> - pTMXMapInfo - > setParentGID ( info - > m_uFirstGid + atoi ( valueForKey ( " id " , attributeDict ) ) ) ; <nl> - pTMXMapInfo - > getTileProperties ( ) - > setObject ( dict , pTMXMapInfo - > getParentGID ( ) ) ; <nl> - CC_SAFE_RELEASE ( dict ) ; <nl> - <nl> - pTMXMapInfo - > setParentElement ( TMXPropertyTile ) ; <nl> - <nl> - } <nl> - else if ( elementName = = " layer " ) <nl> - { <nl> - CCTMXLayerInfo * layer = new CCTMXLayerInfo ( ) ; <nl> - layer - > m_sName = valueForKey ( " name " , attributeDict ) ; <nl> - <nl> - CCSize s ; <nl> - s . width = ( float ) atof ( valueForKey ( " width " , attributeDict ) ) ; <nl> - s . height = ( float ) atof ( valueForKey ( " height " , attributeDict ) ) ; <nl> - layer - > m_tLayerSize = s ; <nl> - <nl> - std : : string visible = valueForKey ( " visible " , attributeDict ) ; <nl> - layer - > m_bVisible = ! ( visible = = " 0 " ) ; <nl> - <nl> - std : : string opacity = valueForKey ( " opacity " , attributeDict ) ; <nl> - if ( opacity ! = " " ) <nl> - { <nl> - layer - > m_cOpacity = ( unsigned char ) ( 255 * atof ( opacity . c_str ( ) ) ) ; <nl> - } <nl> - else <nl> - { <nl> - layer - > m_cOpacity = 255 ; <nl> - } <nl> - <nl> - float x = ( float ) atof ( valueForKey ( " x " , attributeDict ) ) ; <nl> - float y = ( float ) atof ( valueForKey ( " y " , attributeDict ) ) ; <nl> - layer - > m_tOffset = ccp ( x , y ) ; <nl> - <nl> - pTMXMapInfo - > getLayers ( ) - > addObject ( layer ) ; <nl> - layer - > release ( ) ; <nl> - <nl> - / / The parent element is now " layer " <nl> - pTMXMapInfo - > setParentElement ( TMXPropertyLayer ) ; <nl> - <nl> - } <nl> - else if ( elementName = = " objectgroup " ) <nl> - { <nl> - CCTMXObjectGroup * objectGroup = new CCTMXObjectGroup ( ) ; <nl> - objectGroup - > setGroupName ( valueForKey ( " name " , attributeDict ) ) ; <nl> - CCPoint positionOffset ; <nl> - positionOffset . x = ( float ) atof ( valueForKey ( " x " , attributeDict ) ) * pTMXMapInfo - > getTileSize ( ) . width ; <nl> - positionOffset . y = ( float ) atof ( valueForKey ( " y " , attributeDict ) ) * pTMXMapInfo - > getTileSize ( ) . height ; <nl> - objectGroup - > setPositionOffset ( positionOffset ) ; <nl> - <nl> - pTMXMapInfo - > getObjectGroups ( ) - > addObject ( objectGroup ) ; <nl> - objectGroup - > release ( ) ; <nl> - <nl> - / / The parent element is now " objectgroup " <nl> - pTMXMapInfo - > setParentElement ( TMXPropertyObjectGroup ) ; <nl> - <nl> - } <nl> - else if ( elementName = = " image " ) <nl> - { <nl> - CCTMXTilesetInfo * tileset = pTMXMapInfo - > getTilesets ( ) - > getLastObject ( ) ; <nl> - <nl> - / / build full path <nl> - std : : string imagename = valueForKey ( " source " , attributeDict ) ; <nl> - tileset - > m_sSourceImage = CCFileUtils : : fullPathFromRelativeFile ( imagename . c_str ( ) , pTMXMapInfo - > getTMXFileName ( ) ) ; <nl> - <nl> - } <nl> - else if ( elementName = = " data " ) <nl> - { <nl> - std : : string encoding = valueForKey ( " encoding " , attributeDict ) ; <nl> - std : : string compression = valueForKey ( " compression " , attributeDict ) ; <nl> - <nl> - if ( encoding = = " base64 " ) <nl> - { <nl> - int layerAttribs = pTMXMapInfo - > getLayerAttribs ( ) ; <nl> - pTMXMapInfo - > setLayerAttribs ( layerAttribs | TMXLayerAttribBase64 ) ; <nl> - pTMXMapInfo - > setStoringCharacters ( true ) ; <nl> - <nl> - if ( compression = = " gzip " ) <nl> - { <nl> - layerAttribs = pTMXMapInfo - > getLayerAttribs ( ) ; <nl> - pTMXMapInfo - > setLayerAttribs ( layerAttribs | TMXLayerAttribGzip ) ; <nl> - } <nl> - CCAssert ( compression = = " " | | compression = = " gzip " , " TMX : unsupported compression method " ) ; <nl> - } <nl> - CCAssert ( pTMXMapInfo - > getLayerAttribs ( ) ! = TMXLayerAttribNone , " TMX tile map : Only base64 and / or gzip maps are supported " ) ; <nl> - <nl> - } <nl> - else if ( elementName = = " object " ) <nl> - { <nl> - char buffer [ 32 ] ; <nl> - CCTMXObjectGroup * objectGroup = pTMXMapInfo - > getObjectGroups ( ) - > getLastObject ( ) ; <nl> - <nl> - / / The value for " type " was blank or not a valid class name <nl> - / / Create an instance of TMXObjectInfo to store the object and its properties <nl> - CCStringToStringDictionary * dict = new CCStringToStringDictionary ( ) ; <nl> - <nl> - / / Set the name of the object to the value for " name " <nl> - std : : string key = " name " ; <nl> - CCString * value = new CCString ( valueForKey ( " name " , attributeDict ) ) ; <nl> - dict - > setObject ( value , key ) ; <nl> - value - > release ( ) ; <nl> - <nl> - / / Assign all the attributes as key / name pairs in the properties dictionary <nl> - key = " type " ; <nl> - value = new CCString ( valueForKey ( " type " , attributeDict ) ) ; <nl> - dict - > setObject ( value , key ) ; <nl> - value - > release ( ) ; <nl> - <nl> - int x = atoi ( valueForKey ( " x " , attributeDict ) ) + ( int ) objectGroup - > getPositionOffset ( ) . x ; <nl> - key = " x " ; <nl> - sprintf ( buffer , " % d " , x ) ; <nl> - value = new CCString ( buffer ) ; <nl> - dict - > setObject ( value , key ) ; <nl> - value - > release ( ) ; <nl> - <nl> - int y = atoi ( valueForKey ( " y " , attributeDict ) ) + ( int ) objectGroup - > getPositionOffset ( ) . y ; <nl> - / / Correct y position . ( Tiled uses Flipped , cocos2d uses Standard ) <nl> - y = ( int ) ( pTMXMapInfo - > getMapSize ( ) . height * pTMXMapInfo - > getTileSize ( ) . height ) - y - atoi ( valueForKey ( " height " , attributeDict ) ) ; <nl> - key = " y " ; <nl> - sprintf ( buffer , " % d " , y ) ; <nl> - value = new CCString ( buffer ) ; <nl> - dict - > setObject ( value , key ) ; <nl> - value - > release ( ) ; <nl> - <nl> - key = " width " ; <nl> - value = new CCString ( valueForKey ( " width " , attributeDict ) ) ; <nl> - dict - > setObject ( value , key ) ; <nl> - value - > release ( ) ; <nl> - <nl> - key = " height " ; <nl> - value = new CCString ( valueForKey ( " height " , attributeDict ) ) ; <nl> - dict - > setObject ( value , key ) ; <nl> - value - > release ( ) ; <nl> - <nl> - / / Add the object to the objectGroup <nl> - objectGroup - > getObjects ( ) - > addObject ( dict ) ; <nl> - dict - > release ( ) ; <nl> - <nl> - / / The parent element is now " object " <nl> - pTMXMapInfo - > setParentElement ( TMXPropertyObject ) ; <nl> - <nl> - } <nl> - else if ( elementName = = " property " ) <nl> - { <nl> - if ( pTMXMapInfo - > getParentElement ( ) = = TMXPropertyNone ) <nl> - { <nl> - CCLOG ( " TMX tile map : Parent element is unsupported . Cannot add property named ' % s ' with value ' % s ' " , <nl> - valueForKey ( " name " , attributeDict ) , valueForKey ( " value " , attributeDict ) ) ; <nl> - } <nl> - else if ( pTMXMapInfo - > getParentElement ( ) = = TMXPropertyMap ) <nl> - { <nl> - / / The parent element is the map <nl> - CCString * value = new CCString ( valueForKey ( " value " , attributeDict ) ) ; <nl> - std : : string key = valueForKey ( " name " , attributeDict ) ; <nl> - pTMXMapInfo - > getProperties ( ) - > setObject ( value , key ) ; <nl> - value - > release ( ) ; <nl> - <nl> - } <nl> - else if ( pTMXMapInfo - > getParentElement ( ) = = TMXPropertyLayer ) <nl> - { <nl> - / / The parent element is the last layer <nl> - CCTMXLayerInfo * layer = pTMXMapInfo - > getLayers ( ) - > getLastObject ( ) ; <nl> - CCString * value = new CCString ( valueForKey ( " value " , attributeDict ) ) ; <nl> - std : : string key = valueForKey ( " name " , attributeDict ) ; <nl> - / / Add the property to the layer <nl> - layer - > getProperties ( ) - > setObject ( value , key ) ; <nl> - value - > release ( ) ; <nl> - <nl> - } <nl> - else if ( pTMXMapInfo - > getParentElement ( ) = = TMXPropertyObjectGroup ) <nl> - { <nl> - / / The parent element is the last object group <nl> - CCTMXObjectGroup * objectGroup = pTMXMapInfo - > getObjectGroups ( ) - > getLastObject ( ) ; <nl> - CCString * value = new CCString ( valueForKey ( " value " , attributeDict ) ) ; <nl> - std : : string key = valueForKey ( " name " , attributeDict ) ; <nl> - objectGroup - > getProperties ( ) - > setObject ( value , key ) ; <nl> - value - > release ( ) ; <nl> - <nl> - } <nl> - else if ( pTMXMapInfo - > getParentElement ( ) = = TMXPropertyObject ) <nl> - { <nl> - / / The parent element is the last object <nl> - CCTMXObjectGroup * objectGroup = pTMXMapInfo - > getObjectGroups ( ) - > getLastObject ( ) ; <nl> - CCStringToStringDictionary * dict = objectGroup - > getObjects ( ) - > getLastObject ( ) ; <nl> - <nl> - std : : string propertyName = valueForKey ( " name " , attributeDict ) ; <nl> - CCString * propertyValue = new CCString ( valueForKey ( " value " , attributeDict ) ) ; <nl> - dict - > setObject ( propertyValue , propertyName ) ; <nl> - propertyValue - > release ( ) ; <nl> - } <nl> - else if ( pTMXMapInfo - > getParentElement ( ) = = TMXPropertyTile ) <nl> - { <nl> - CCStringToStringDictionary * dict ; <nl> - dict = pTMXMapInfo - > getTileProperties ( ) - > objectForKey ( pTMXMapInfo - > getParentGID ( ) ) ; <nl> - <nl> - std : : string propertyName = valueForKey ( " name " , attributeDict ) ; <nl> - CCString * propertyValue = new CCString ( valueForKey ( " value " , attributeDict ) ) ; <nl> - dict - > setObject ( propertyValue , propertyName ) ; <nl> - propertyValue - > release ( ) ; <nl> - } <nl> - } <nl> - if ( attributeDict ) <nl> - { <nl> - attributeDict - > clear ( ) ; <nl> - delete attributeDict ; <nl> - } <nl> - } <nl> - <nl> - void CCTMXMapInfo : : endElement ( void * ctx , const XML_Char * name ) <nl> - { <nl> - CCTMXMapInfo * pTMXMapInfo = this ; / / ( CCTMXMapInfo * ) ( ctx ) ; <nl> - std : : string elementName = ( char * ) name ; <nl> - <nl> - int len = 0 ; <nl> - <nl> - if ( elementName = = " data " & & pTMXMapInfo - > getLayerAttribs ( ) & TMXLayerAttribBase64 ) <nl> - { <nl> - pTMXMapInfo - > setStoringCharacters ( false ) ; <nl> - <nl> - CCTMXLayerInfo * layer = pTMXMapInfo - > getLayers ( ) - > getLastObject ( ) ; <nl> - <nl> - std : : string currentString = pTMXMapInfo - > getCurrentString ( ) ; <nl> - unsigned char * buffer ; <nl> - len = base64Decode ( ( unsigned char * ) currentString . c_str ( ) , currentString . length ( ) , & buffer ) ; <nl> - if ( ! buffer ) <nl> - { <nl> - CCLOG ( " cocos2d : TiledMap : decode data error " ) ; <nl> - return ; <nl> - } <nl> - <nl> - if ( pTMXMapInfo - > getLayerAttribs ( ) & TMXLayerAttribGzip ) <nl> - { <nl> - unsigned char * deflated ; <nl> - ZipUtils : : ccInflateMemory ( buffer , len , & deflated ) ; <nl> - delete [ ] buffer ; <nl> - buffer = NULL ; <nl> - <nl> - if ( ! deflated ) <nl> - { <nl> - CCLOG ( " cocos2d : TiledMap : inflate data error " ) ; <nl> - return ; <nl> - } <nl> - <nl> - layer - > m_pTiles = ( unsigned int * ) deflated ; <nl> - } <nl> - else <nl> - { <nl> - layer - > m_pTiles = ( unsigned int * ) buffer ; <nl> - } <nl> - <nl> - pTMXMapInfo - > setCurrentString ( " " ) ; <nl> - <nl> - } <nl> - else if ( elementName = = " map " ) <nl> - { <nl> - / / The map element has ended <nl> - pTMXMapInfo - > setParentElement ( TMXPropertyNone ) ; <nl> - } <nl> - else if ( elementName = = " layer " ) <nl> - { <nl> - / / The layer element has ended <nl> - pTMXMapInfo - > setParentElement ( TMXPropertyNone ) ; <nl> - } <nl> - else if ( elementName = = " objectgroup " ) <nl> - { <nl> - / / The objectgroup element has ended <nl> - pTMXMapInfo - > setParentElement ( TMXPropertyNone ) ; <nl> - } <nl> - else if ( elementName = = " object " ) <nl> - { <nl> - / / The object element has ended <nl> - pTMXMapInfo - > setParentElement ( TMXPropertyNone ) ; <nl> - } <nl> - } <nl> - void CCTMXMapInfo : : textHandler ( void * ctx , const XML_Char * ch , int len ) <nl> - { <nl> - CCTMXMapInfo * pTMXMapInfo = this ; / / ( CCTMXMapInfo * ) ( ctx ) ; <nl> - std : : string pText ( ( char * ) ch , 0 , len ) ; <nl> - <nl> - if ( pTMXMapInfo - > getStoringCharacters ( ) ) <nl> - { <nl> - std : : string currentString = pTMXMapInfo - > getCurrentString ( ) ; <nl> - currentString + = pText ; <nl> - pTMXMapInfo - > setCurrentString ( currentString . c_str ( ) ) ; <nl> - } <nl> - } <nl> - <nl> - } / / namespace cocos2d <nl> - <nl> + # include " expat . h " <nl> # else <nl> - <nl> - <nl> - # include < libxml / parser . h > <nl> - # include < libxml / tree . h > <nl> - # include < libxml / xmlmemory . h > <nl> - # include " CCLibxml2 . h " <nl> + # include < libxml / parser . h > <nl> + # include < libxml / tree . h > <nl> + # include < libxml / xmlmemory . h > <nl> + # include " CCLibxml2 . h " <nl> + # endf <nl> <nl> namespace cocos2d { <nl> <nl> + / * <nl> void tmx_startElement ( void * ctx , const xmlChar * name , const xmlChar * * atts ) ; <nl> void tmx_endElement ( void * ctx , const xmlChar * name ) ; <nl> void tmx_characters ( void * ctx , const xmlChar * ch , int len ) ; <nl> + * / <nl> + <nl> const char * valueForKey ( const char * key , std : : map < std : : string , std : : string > * dict ) <nl> { <nl> if ( dict ) <nl> namespace cocos2d { <nl> <nl> bool CCTMXMapInfo : : parseXMLFile ( const char * xmlFilename ) <nl> { <nl> + # if ( CC_TARGET_PLATFORM = = CC_PLATFORM_AIRPLAY ) <nl> + CCSAXParser parser ; <nl> + parser . init ( " UTF - 8 " ) ; <nl> + parser . setDelegator ( this ) ; <nl> + parser . parse ( xmlFilename ) ; <nl> + return true ; <nl> + # else <nl> FileData data ; <nl> unsigned long size = 0 ; <nl> char * pBuffer = ( char * ) data . getFileData ( xmlFilename , " r " , & size ) ; <nl> namespace cocos2d { <nl> xmlMemoryDump ( ) ; <nl> <nl> return true ; <nl> + # endif <nl> } <nl> <nl> <nl> / / the XML parser calls here with all the elements <nl> - void tmx_startElement ( void * ctx , const xmlChar * name , const xmlChar * * atts ) <nl> + void CCTMXMapInfo : : startElement ( const char * name , const char * * atts ) <nl> { <nl> - CCTMXMapInfo * pTMXMapInfo = ( CCTMXMapInfo * ) ( ctx ) ; <nl> + CCTMXMapInfo * pTMXMapInfo = this ; <nl> std : : string elementName = ( char * ) name ; <nl> std : : map < std : : string , std : : string > * attributeDict = new std : : map < std : : string , std : : string > ( ) ; <nl> if ( atts & & atts [ 0 ] ) <nl> namespace cocos2d { <nl> } <nl> } <nl> <nl> - void tmx_endElement ( void * ctx , const xmlChar * name ) <nl> + void CCTMXMapInfo : : endElement ( const char * name ) <nl> { <nl> - CCTMXMapInfo * pTMXMapInfo = ( CCTMXMapInfo * ) ( ctx ) ; <nl> + CCTMXMapInfo * pTMXMapInfo = this ; <nl> std : : string elementName = ( char * ) name ; <nl> <nl> int len = 0 ; <nl> namespace cocos2d { <nl> pTMXMapInfo - > setParentElement ( TMXPropertyNone ) ; <nl> } <nl> } <nl> - void tmx_characters ( void * ctx , const xmlChar * ch , int len ) <nl> + <nl> + void CCTMXMapInfo : : textHandler ( const char * ch , int len ) <nl> { <nl> - CCTMXMapInfo * pTMXMapInfo = ( CCTMXMapInfo * ) ( ctx ) ; <nl> + CCTMXMapInfo * pTMXMapInfo = this ; <nl> std : : string pText ( ( char * ) ch , 0 , len ) ; <nl> <nl> if ( pTMXMapInfo - > getStoringCharacters ( ) ) <nl> mmm a / tests / test . ios / test . xcodeproj / project . pbxproj . REMOVED . git - id <nl> ppp b / tests / test . ios / test . xcodeproj / project . pbxproj . REMOVED . git - id <nl> @ @ - 1 + 1 @ @ <nl> - 2ad248e761f87ec06d6d0c8c6792ab23406440d5 <nl> \ No newline at end of file <nl> + ce2994d42f10070ffae356137f50e6a6fa24f18b <nl> \ No newline at end of file <nl>
issue , try to add CCSAXParser . h
cocos2d/cocos2d-x
b9c56f1728c3a05c48380e8b4612e548a71e99ed
2011-03-24T08:16:49Z
mmm a / docs / docs / api . xml <nl> ppp b / docs / docs / api . xml <nl> <nl> < name > thread_pool < / name > <nl> < link > dlib / threads / thread_pool_extension_abstract . h . html # thread_pool < / link > <nl> < / item > <nl> + < item > <nl> + < name > future < / name > <nl> + < link > dlib / threads / thread_pool_extension_abstract . h . html # future < / link > <nl> + < / item > <nl> < item > <nl> < name > thread_function < / name > <nl> < link > dlib / threads / thread_function_extension_abstract . h . html # thread_function < / link > <nl> <nl> <nl> < extension > <nl> < name > thread_pool < / name > <nl> - < spec_file > dlib / threads / thread_pool_extension_abstract . h < / spec_file > <nl> + < spec_file link = " true " > dlib / threads / thread_pool_extension_abstract . h < / spec_file > <nl> < description > <nl> < p > <nl> This object represents a fixed size group of threads which you can <nl> - submit tasks to and then wait for those tasks to be completed . <nl> + submit tasks to and then wait for those tasks to be completed . It also <nl> + provides a < a href = " dlib / threads / thread_pool_extension_abstract . h . html # future " > future < / a > object <nl> + that provides a container which allows you to safely pass objects into the tasks . <nl> < / p > <nl> The implementation of this extension can be found <nl> < a href = " dlib / threads / thread_pool_extension . h . html " > here < / a > . It is <nl> implemented such that no memory allocations occur after the thread pool <nl> - has been constructed . <nl> + has been constructed ( the future object also doesn ' t perform any memory allocations or contain any system <nl> + resources such as mutex objects ) . <nl> + <nl> < / description > <nl> <nl> < examples > <nl> mmm a / docs / docs / index . xml <nl> ppp b / docs / docs / index . xml <nl> <nl> < li > < a href = " api . html # thread_specific_data " > Thread specific data < / a > < / li > <nl> < li > < a href = " api . html # threaded_object " > Threaded objects < / a > < / li > <nl> < li > < a href = " api . html # thread_function " > Threaded functions < / a > < / li > <nl> - < li > A simple but powerful < a href = " api . html # thread_pool " > thread_pool < / a > < / li > <nl> + < li > A < a href = " api . html # thread_pool " > thread_pool < / a > with support for futures < / li > <nl> < / ul > <nl> < / li > <nl> <nl> mmm a / docs / docs / term_index . xml <nl> ppp b / docs / docs / term_index . xml <nl> <nl> < term link = " api . html # thread_specific_data " name = " thread_specific_data " / > <nl> < term link = " api . html # threaded_object " name = " threaded_object " / > <nl> < term link = " api . html # thread_pool " name = " thread_pool " / > <nl> + < term link = " api . html # thread_pool " name = " futures " / > <nl> <nl> <nl> <nl>
updated the docs
davisking/dlib
99913d4b7d6c13bc9d730250505db354280fde0d
2008-11-28T01:55:37Z
mmm a / spec / webview - spec . js <nl> ppp b / spec / webview - spec . js <nl> describe ( ' < webview > tag ' , function ( ) { <nl> } ) <nl> } ) <nl> <nl> - describe ( ' < webview > . clearHistory ( ) ' , ( ) = > { <nl> + / / FIXME : https : / / github . com / electron / electron / issues / 19397 <nl> + xdescribe ( ' < webview > . clearHistory ( ) ' , ( ) = > { <nl> it ( ' should clear the navigation history ' , async ( ) = > { <nl> const message = waitForEvent ( webview , ' ipc - message ' ) <nl> await loadWebView ( webview , { <nl>
test : disable flaky webview . clearHistory test ( )
electron/electron
ad6fb2048621f5274772655819d8add7609023c7
2019-07-23T23:54:41Z
mmm a / projects / ExtraTests / CMakeLists . txt <nl> ppp b / projects / ExtraTests / CMakeLists . txt <nl> set_tests_properties ( <nl> " REQUIRE ; REQUIRE_FALSE ; REQUIRE_THROWS ; REQUIRE_THROWS_AS ; REQUIRE_THROWS_WITH ; REQUIRE_THROWS_MATCHES ; REQUIRE_NOTHROW ; CHECK ; CHECK_FALSE ; CHECKED_IF ; CHECKED_ELSE ; CHECK_NOFAIL ; CHECK_THROWS ; CHECK_THROWS_AS ; CHECK_THROWS_WITH ; CHECK_THROWS_MATCHES ; CHECK_NOTHROW ; REQUIRE_THAT ; CHECK_THAT " <nl> ) <nl> <nl> + add_executable ( DisabledMacros $ { TESTS_DIR } / X02 - DisabledMacros . cpp ) <nl> + target_compile_definitions ( DisabledMacros PRIVATE CATCH_CONFIG_DISABLE ) <nl> + <nl> + add_test ( NAME CATCH_CONFIG_DISABLE - 1 COMMAND DisabledMacros - s ) <nl> + set_tests_properties ( <nl> + CATCH_CONFIG_DISABLE - 1 <nl> + PROPERTIES <nl> + PASS_REGULAR_EXPRESSION " No tests ran " <nl> + FAIL_REGULAR_EXPRESSION " This should not happen " <nl> + ) <nl> + add_test ( NAME CATCH_CONFIG_DISABLE - 2 COMMAND DisabledMacros - - list - tests ) <nl> + set_tests_properties ( <nl> + CATCH_CONFIG_DISABLE - 2 <nl> + PROPERTIES <nl> + PASS_REGULAR_EXPRESSION " 0 test cases " <nl> + ) <nl> + <nl> <nl> add_executable ( FallbackStringifier $ { TESTS_DIR } / X10 - FallbackStringifier . cpp ) <nl> target_compile_definitions ( FallbackStringifier PRIVATE CATCH_CONFIG_FALLBACK_STRINGIFIER = fallbackStringifier ) <nl> set_tests_properties ( <nl> <nl> set ( EXTRA_TEST_BINARIES <nl> PrefixedMacros <nl> + DisabledMacros <nl> FallbackStringifier <nl> DisableStringification <nl> ) <nl> mmm a / projects / ExtraTests / ToDo . txt <nl> ppp b / projects / ExtraTests / ToDo . txt <nl> yet : <nl> CATCH_CONFIG_DISABLE_MATCHERS / / Do not compile Matchers in this compilation unit <nl> CATCH_CONFIG_POSIX_SIGNALS / / Enable handling POSIX signals <nl> CATCH_CONFIG_WINDOWS_CRTDBG / / Enable leak checking using Windows ' s CRT Debug Heap <nl> - CATCH_CONFIG_DISABLE / / Disables assertions and test case registration <nl> CATCH_CONFIG_DEFAULT_REPORTER <nl> CATCH_CONFIG_ENABLE_ALL_STRINGMAKERS <nl> new file mode 100644 <nl> index 000000000 . . 3a969d769 <nl> mmm / dev / null <nl> ppp b / projects / ExtraTests / X02 - DisabledMacros . cpp <nl> <nl> + / / X02 - DisabledMacros . cpp <nl> + / / Test that CATCH_CONFIG_DISABLE turns off TEST_CASE autoregistration <nl> + / / and expressions in assertion macros are not run . <nl> + <nl> + # define CATCH_CONFIG_MAIN <nl> + # include < catch2 / catch . hpp > <nl> + <nl> + <nl> + / / CATCH_CONFIG_DISABLE also prevents reporter registration . <nl> + / / We need to manually register at least one reporter for our tests <nl> + static Catch : : ReporterRegistrar < Catch : : ConsoleReporter > temporary ( " console " ) ; <nl> + <nl> + # include < iostream > <nl> + <nl> + struct foo { <nl> + foo ( ) { <nl> + REQUIRE_NOTHROW ( print ( ) ) ; <nl> + } <nl> + void print ( ) const { <nl> + std : : cout < < " This should not happen \ n " ; <nl> + } <nl> + } ; <nl> + <nl> + / / Construct foo , but ` foo : : print ` should not be run <nl> + foo f ; <nl> + <nl> + / / This test should not be run , because it won ' t be registered <nl> + TEST_CASE ( " Disabled Macros " ) { <nl> + std : : cout < < " This should not happen \ n " ; <nl> + FAIL ( ) ; <nl> + } <nl>
Add tests for CATCH_CONFIG_DISABLE
catchorg/Catch2
6f75acbfb551c87a84947b5ce9481ca9d00a33c7
2018-09-01T15:28:06Z
new file mode 100644 <nl> index 000000000 . . 1e68bfda7 <nl> mmm / dev / null <nl> ppp b / examples / switch_grave_accent_and_tilde_and_backslash . json <nl> <nl> + { <nl> + " profiles " : [ <nl> + { <nl> + " name " : " Default profile " , <nl> + " selected " : true , <nl> + " simple_modifications " : { <nl> + " non_us_backslash " : " grave_accent_and_tilde " , <nl> + " grave_accent_and_tilde " : " non_us_backslash " <nl> + } <nl> + } <nl> + ] <nl> + } <nl>
Add example for switching § and `
pqrs-org/Karabiner-Elements
2650eef09eb036a8ef408a5ba8317beeec9c6fdc
2016-10-06T13:40:34Z
mmm a / caffe2 / operators / fully_connected_op . cc <nl> ppp b / caffe2 / operators / fully_connected_op . cc <nl> OPERATOR_SCHEMA ( FCTransposedGradient ) . NumInputs ( 3 ) . NumOutputs ( 2 , 3 ) ; <nl> <nl> namespace { <nl> <nl> - template < const char * GradientOp > <nl> class GetFCGradient : public GradientMakerBase { <nl> using GradientMakerBase : : GradientMakerBase ; <nl> <nl> std : : vector < OperatorDef > GetGradientDefs ( ) override { <nl> CAFFE_ENFORCE_EQ ( def_ . input_size ( ) , 3 ) ; <nl> + CAFFE_ENFORCE ( def_ . type ( ) = = " FC " | | def_ . type ( ) = = " FCTransposed " ) ; <nl> return SingleGradientDef ( <nl> - GradientOp , <nl> + def_ . type ( ) + " Gradient " , <nl> " " , <nl> vector < string > { I ( 0 ) , I ( 1 ) , GO ( 0 ) } , <nl> vector < string > { GI ( 1 ) , GI ( 2 ) , GI ( 0 ) } ) ; <nl> } <nl> } ; <nl> <nl> - constexpr char kFCGradient [ ] = " FCGradient " ; <nl> - constexpr char kFCTransposedGradient [ ] = " FCTransposedGradient " ; <nl> - <nl> - REGISTER_GRADIENT ( FC , GetFCGradient < kFCGradient > ) ; <nl> - REGISTER_GRADIENT ( FCTransposed , GetFCGradient < kFCTransposedGradient > ) ; <nl> + REGISTER_GRADIENT ( FC , GetFCGradient ) ; <nl> + REGISTER_GRADIENT ( FCTransposed , GetFCGradient ) ; <nl> <nl> } / / namespace <nl> <nl>
Simple fix for windows
pytorch/pytorch
eed95f8660a46419595e7bb17dc771278921ac8a
2017-12-14T20:32:24Z
mmm a / ports / pcre / CONTROL <nl> ppp b / ports / pcre / CONTROL <nl> <nl> Source : pcre <nl> Version : 8 . 41 - 2 <nl> - Description : Perl Compatible Regular Expresions <nl> + Description : Perl Compatible Regular Expressions <nl> mmm a / ports / pcre / portfile . cmake <nl> ppp b / ports / pcre / portfile . cmake <nl> set ( PCRE_VERSION 8 . 41 ) <nl> include ( vcpkg_common_functions ) <nl> set ( SOURCE_PATH $ { CURRENT_BUILDTREES_DIR } / src / pcre - $ { PCRE_VERSION } ) <nl> vcpkg_download_distfile ( ARCHIVE <nl> - URLS " ftp : / / ftp . csx . cam . ac . uk / pub / software / programming / pcre / pcre - $ { PCRE_VERSION } . zip " <nl> + URLS " https : / / ftp . pcre . org / pub / pcre / pcre - $ { PCRE_VERSION } . zip " <nl> " https : / / downloads . sourceforge . net / project / pcre / pcre / $ { PCRE_VERSION } / pcre - $ { PCRE_VERSION } . zip " <nl> FILENAME " pcre - $ { PCRE_VERSION } . zip " <nl> SHA512 a3fd57090a5d9ce9d608aeecd59f42f04deea5b86a5c5899bdb25b18d8ec3a89b2b52b62e325c6485a87411eb65f1421604f80c3eaa653bd7dbab05ad22795ea <nl>
[ pcre ] Update download URL ( )
microsoft/vcpkg
d143827ae8649ddcfd482a3fecfbebca4b740659
2019-08-27T22:49:31Z
mmm a / include / swift / AST / DiagnosticsSema . def <nl> ppp b / include / swift / AST / DiagnosticsSema . def <nl> ERROR ( expr_keypath_not_property , none , <nl> " ' # keyPath ' cannot refer to % 0 % 1 " , ( DescriptiveDeclKind , DeclName ) ) <nl> ERROR ( expr_keypath_empty , none , <nl> " empty ' # keyPath ' does not refer to a property " , ( ) ) <nl> + ERROR ( expr_unsupported_objc_key_path_component , none , <nl> + " an Objective - C key path cannot contain " <nl> + " % select { BAD | subscript | BAD | BAD | optional - forcing | optional - chaining | BAD } " <nl> + " components " , <nl> + ( unsigned ) ) <nl> + ERROR ( expr_unsupported_objc_key_path_compound_name , none , <nl> + " an Objective - C key path cannot reference a declaration with a " <nl> + " compound name " , ( ) ) <nl> <nl> / / Selector expressions . <nl> ERROR ( expr_selector_no_objc_runtime , none , <nl> mmm a / include / swift / AST / Expr . h <nl> ppp b / include / swift / AST / Expr . h <nl> <nl> # include " swift / AST / TypeLoc . h " <nl> # include " swift / AST / Availability . h " <nl> # include " llvm / Support / TrailingObjects . h " <nl> + # include < utility > <nl> <nl> namespace llvm { <nl> struct fltSemantics ; <nl> class alignas ( 8 ) Expr { <nl> friend class KeyPathExpr ; <nl> unsigned : NumExprBits ; <nl> <nl> - / / / The number of components in the selector path . <nl> - unsigned NumComponents : 8 ; <nl> - <nl> - / / / Whether the names have corresponding source locations . <nl> - unsigned HaveSourceLocations : 1 ; <nl> + / / / Whether this is an ObjC stringified keypath . <nl> + unsigned IsObjC : 1 ; <nl> } ; <nl> - enum { NumKeyPathExprBits = NumExprBits + 9 } ; <nl> + enum { NumKeyPathExprBits = NumExprBits + 2 } ; <nl> static_assert ( NumKeyPathExprBits < = 32 , " fits in an unsigned " ) ; <nl> <nl> protected : <nl> class KeyPathExpr : public Expr { <nl> SourceLoc KeywordLoc ; <nl> SourceLoc LParenLoc ; <nl> SourceLoc RParenLoc ; <nl> - Expr * SemanticExpr = nullptr ; <nl> - <nl> - / / / A single stored component , which will be either an identifier or <nl> - / / / a resolved declaration . <nl> - typedef llvm : : PointerUnion < Identifier , ValueDecl * > StoredComponent ; <nl> - <nl> - KeyPathExpr ( SourceLoc keywordLoc , SourceLoc lParenLoc , <nl> - ArrayRef < Identifier > names , <nl> - ArrayRef < SourceLoc > nameLocs , <nl> - SourceLoc rParenLoc ) ; <nl> - <nl> - / / / Retrieve a mutable version of the " components " array , for <nl> - / / / initialization purposes . <nl> - MutableArrayRef < StoredComponent > getComponentsMutable ( ) { <nl> - return { reinterpret_cast < StoredComponent * > ( this + 1 ) , getNumComponents ( ) } ; <nl> - } <nl> - <nl> - / / / Retrieve the " components " storage . <nl> - ArrayRef < StoredComponent > getComponents ( ) const { <nl> - return { reinterpret_cast < StoredComponent const * > ( this + 1 ) , <nl> - getNumComponents ( ) } ; <nl> - } <nl> + Expr * ObjCStringLiteralExpr = nullptr ; <nl> <nl> - / / / Retrieve a mutable version of the name locations array , for <nl> - / / / initialization purposes . <nl> - MutableArrayRef < SourceLoc > getNameLocsMutable ( ) { <nl> - if ( ! KeyPathExprBits . HaveSourceLocations ) return { } ; <nl> + public : <nl> + / / / A single stored component , which will be one of : <nl> + / / / - an unresolved DeclName , which has to be type - checked <nl> + / / / - a resolved ValueDecl , referring to <nl> + / / / - a subscript index expression , which may or may not be resolved <nl> + / / / - an optional chaining , forcing , or wrapping component <nl> + class Component { <nl> + public : <nl> + enum class Kind : unsigned { <nl> + UnresolvedProperty , <nl> + UnresolvedSubscript , <nl> + Property , <nl> + Subscript , <nl> + OptionalForce , <nl> + OptionalChain , <nl> + OptionalWrap <nl> + } ; <nl> + <nl> + private : <nl> + union DeclNameOrRef { <nl> + DeclName UnresolvedName ; <nl> + ConcreteDeclRef ResolvedDecl ; <nl> + <nl> + DeclNameOrRef ( ) : UnresolvedName { } { } <nl> + DeclNameOrRef ( DeclName un ) : UnresolvedName ( un ) { } <nl> + DeclNameOrRef ( ConcreteDeclRef rd ) : ResolvedDecl ( rd ) { } <nl> + } Decl ; <nl> + <nl> + <nl> + llvm : : PointerIntPair < Expr * , 3 , Kind > SubscriptIndexExprAndKind ; <nl> + Type ComponentType ; <nl> + <nl> + explicit Component ( DeclNameOrRef decl , <nl> + Expr * indexExpr , <nl> + Kind kind , <nl> + Type type ) <nl> + : Decl ( decl ) , SubscriptIndexExprAndKind ( indexExpr , kind ) , <nl> + ComponentType ( type ) <nl> + { } <nl> + <nl> + public : <nl> + Component ( ) : Component ( { } , nullptr , ( Kind ) 0 , Type ( ) ) { } <nl> + <nl> + / / / Create an unresolved component for a property . <nl> + static Component forUnresolvedProperty ( DeclName UnresolvedName ) { <nl> + return Component ( UnresolvedName , nullptr , <nl> + Kind : : UnresolvedProperty , <nl> + Type ( ) ) ; <nl> + } <nl> + <nl> + / / / Create an unresolved component for a subscript . <nl> + static Component forUnresolvedSubscript ( Expr * UnresolvedSubscriptIndex ) { <nl> + return Component ( { } , UnresolvedSubscriptIndex , <nl> + Kind : : UnresolvedSubscript , <nl> + Type ( ) ) ; <nl> + } <nl> + <nl> + / / / Create an unresolved optional force ` ! ` component . <nl> + static Component forUnresolvedOptionalForce ( ) { <nl> + return Component ( { } , nullptr , <nl> + Kind : : OptionalForce , <nl> + Type ( ) ) ; <nl> + } <nl> + <nl> + / / / Create an unresolved optional chain ` ? ` component . <nl> + static Component forUnresolvedOptionalChain ( ) { <nl> + return Component ( { } , nullptr , <nl> + Kind : : OptionalChain , <nl> + Type ( ) ) ; <nl> + } <nl> + <nl> + / / / Create a component for a property . <nl> + static Component forProperty ( ConcreteDeclRef property , <nl> + Type propertyType ) { <nl> + return Component ( property , nullptr , Kind : : Property , <nl> + propertyType ) ; <nl> + } <nl> + <nl> + / / / Create a component for a subscript . <nl> + static Component forSubscript ( ConcreteDeclRef subscript , <nl> + Expr * indexExpr , <nl> + Type elementType ) { <nl> + return Component ( subscript , indexExpr , Kind : : Subscript , elementType ) ; <nl> + } <nl> + <nl> + / / / Create an optional - forcing ` ! ` component . <nl> + static Component forOptionalForce ( Type forcedType ) { <nl> + return Component ( { } , nullptr , Kind : : OptionalForce , forcedType ) ; <nl> + } <nl> + <nl> + / / / Create an optional - chaining ` ? ` component . <nl> + static Component forOptionalChain ( Type unwrappedType ) { <nl> + return Component ( { } , nullptr , Kind : : OptionalChain , unwrappedType ) ; <nl> + } <nl> + <nl> + / / / Create an optional - wrapping component . This doesn ' t have a surface <nl> + / / / syntax but may appear when the non - optional result of an optional chain <nl> + / / / is implicitly wrapped . <nl> + static Component forOptionalWrap ( Type wrappedType ) { <nl> + return Component ( { } , nullptr , Kind : : OptionalWrap , wrappedType ) ; <nl> + } <nl> + <nl> + Kind getKind ( ) const { <nl> + return SubscriptIndexExprAndKind . getInt ( ) ; <nl> + } <nl> + <nl> + Expr * getIndexExpr ( ) const { <nl> + switch ( getKind ( ) ) { <nl> + case Kind : : Subscript : <nl> + case Kind : : UnresolvedSubscript : <nl> + return SubscriptIndexExprAndKind . getPointer ( ) ; <nl> + <nl> + case Kind : : OptionalChain : <nl> + case Kind : : OptionalWrap : <nl> + case Kind : : OptionalForce : <nl> + case Kind : : UnresolvedProperty : <nl> + case Kind : : Property : <nl> + llvm_unreachable ( " no index expr for this kind " ) ; <nl> + } <nl> + } <nl> + <nl> + DeclName getUnresolvedDeclName ( ) const { <nl> + switch ( getKind ( ) ) { <nl> + case Kind : : UnresolvedProperty : <nl> + return Decl . UnresolvedName ; <nl> + <nl> + case Kind : : Subscript : <nl> + case Kind : : UnresolvedSubscript : <nl> + case Kind : : OptionalChain : <nl> + case Kind : : OptionalWrap : <nl> + case Kind : : OptionalForce : <nl> + case Kind : : Property : <nl> + llvm_unreachable ( " no unresolved name for this kind " ) ; <nl> + } <nl> + } <nl> + <nl> + ConcreteDeclRef getDeclRef ( ) const { <nl> + switch ( getKind ( ) ) { <nl> + case Kind : : Property : <nl> + case Kind : : Subscript : <nl> + return Decl . ResolvedDecl ; <nl> + <nl> + case Kind : : UnresolvedProperty : <nl> + case Kind : : UnresolvedSubscript : <nl> + case Kind : : OptionalChain : <nl> + case Kind : : OptionalWrap : <nl> + case Kind : : OptionalForce : <nl> + llvm_unreachable ( " no decl ref for this kind " ) ; <nl> + } <nl> + } <nl> + <nl> + Type getComponentType ( ) const { <nl> + return ComponentType ; <nl> + } <nl> + } ; <nl> <nl> - auto mutableComponents = getComponentsMutable ( ) ; <nl> - return { reinterpret_cast < SourceLoc * > ( mutableComponents . end ( ) ) , <nl> - mutableComponents . size ( ) } ; <nl> - } <nl> + using ComponentAndLoc = std : : pair < Component , SourceLoc > ; <nl> + <nl> + private : <nl> + llvm : : MutableArrayRef < ComponentAndLoc > Components ; <nl> <nl> public : <nl> / / / Create a new # keyPath expression . <nl> - / / / <nl> - / / / \ param nameLocs The locations of the names in the key - path , <nl> - / / / which must either have the same number of entries as \ p names or <nl> - / / / must be empty . <nl> - static KeyPathExpr * create ( ASTContext & ctx , <nl> - SourceLoc keywordLoc , SourceLoc lParenLoc , <nl> - ArrayRef < Identifier > names , <nl> - ArrayRef < SourceLoc > nameLocs , <nl> - SourceLoc rParenLoc ) ; <nl> + KeyPathExpr ( ASTContext & C , <nl> + SourceLoc keywordLoc , SourceLoc lParenLoc , <nl> + ArrayRef < ComponentAndLoc > components , <nl> + SourceLoc rParenLoc , <nl> + bool isObjC , <nl> + bool isImplicit = false ) ; <nl> <nl> SourceLoc getLoc ( ) const { return KeywordLoc ; } <nl> SourceRange getSourceRange ( ) const { <nl> return SourceRange ( KeywordLoc , RParenLoc ) ; <nl> } <nl> <nl> - / / / Retrieve the number of components in the key - path . <nl> - unsigned getNumComponents ( ) const { <nl> - return KeyPathExprBits . NumComponents ; <nl> + / / / Get the components array . <nl> + ArrayRef < ComponentAndLoc > getComponents ( ) const { <nl> + return Components ; <nl> } <nl> - <nl> - / / / Retrieve ' s the name for the ( i ) th component ; <nl> - Identifier getComponentName ( unsigned i ) const ; <nl> - <nl> - / / / Retrieve ' s the declaration corresponding to the ( i ) th component , <nl> - / / / or null if this component has not yet been resolved . <nl> - ValueDecl * getComponentDecl ( unsigned i ) const { <nl> - return getComponents ( ) [ i ] . dyn_cast < ValueDecl * > ( ) ; <nl> - } <nl> - <nl> - / / / Retrieve the location corresponding to the ( i ) th name . <nl> - / / / <nl> - / / / If no location information is available , returns an empty <nl> - / / / \ c DeclNameLoc . <nl> - SourceLoc getComponentNameLoc ( unsigned i ) const { <nl> - if ( ! KeyPathExprBits . HaveSourceLocations ) return { } ; <nl> - <nl> - auto components = getComponents ( ) ; <nl> - ArrayRef < SourceLoc > nameLocs ( <nl> - reinterpret_cast < SourceLoc const * > ( components . end ( ) ) , <nl> - components . size ( ) ) ; <nl> - <nl> - return nameLocs [ i ] ; <nl> - } <nl> - <nl> - / / / Retrieve the semantic expression , which will be \ c NULL prior to <nl> - / / / type checking and a string literal after type checking . <nl> - Expr * getSemanticExpr ( ) const { return SemanticExpr ; } <nl> + <nl> + / / / Resolve the components of an un - type - checked expr . This copies over the <nl> + / / / components from the argument array . <nl> + void resolveComponents ( ASTContext & C , <nl> + ArrayRef < Component > resolvedComponents ) ; <nl> + <nl> + / / / Retrieve the string literal expression , which will be \ c NULL prior to <nl> + / / / type checking and a string literal after type checking for an <nl> + / / / @ objc key path . <nl> + Expr * getObjCStringLiteralExpr ( ) const { return ObjCStringLiteralExpr ; } <nl> <nl> / / / Set the semantic expression . <nl> - void setSemanticExpr ( Expr * expr ) { SemanticExpr = expr ; } <nl> - <nl> - / / / Resolve the given component to the given declaration . <nl> - void resolveComponent ( unsigned idx , ValueDecl * decl ) { <nl> - getComponentsMutable ( ) [ idx ] = decl ; <nl> - } <nl> + void setObjCStringLiteralExpr ( Expr * expr ) { ObjCStringLiteralExpr = expr ; } <nl> + <nl> + / / / True if this is an ObjC key path expression . <nl> + bool isObjC ( ) const { return KeyPathExprBits . IsObjC ; } <nl> <nl> static bool classof ( const Expr * E ) { <nl> return E - > getKind ( ) = = ExprKind : : KeyPath ; <nl> mmm a / lib / AST / ASTDumper . cpp <nl> ppp b / lib / AST / ASTDumper . cpp <nl> class PrintExpr : public ExprVisitor < PrintExpr > { <nl> <nl> void visitKeyPathExpr ( KeyPathExpr * E ) { <nl> printCommon ( E , " keypath_expr " ) ; <nl> - for ( unsigned i = 0 , n = E - > getNumComponents ( ) ; i ! = n ; + + i ) { <nl> - OS < < " \ n " ; <nl> + for ( auto & componentAndLoc : E - > getComponents ( ) ) { <nl> + KeyPathExpr : : Component component = componentAndLoc . first ; <nl> + OS < < ' \ n ' ; <nl> OS . indent ( Indent + 2 ) ; <nl> - OS < < " component = " ; <nl> - if ( auto decl = E - > getComponentDecl ( i ) ) <nl> - decl - > dumpRef ( OS ) ; <nl> - else <nl> - OS < < E - > getComponentName ( i ) ; <nl> + OS < < " ( component = " ; <nl> + switch ( component . getKind ( ) ) { <nl> + case KeyPathExpr : : Component : : Kind : : OptionalChain : <nl> + OS < < " optional_chain " ; <nl> + break ; <nl> + <nl> + case KeyPathExpr : : Component : : Kind : : OptionalForce : <nl> + OS < < " optional_force " ; <nl> + break ; <nl> + <nl> + case KeyPathExpr : : Component : : Kind : : OptionalWrap : <nl> + OS < < " optional_wrap " ; <nl> + break ; <nl> + <nl> + case KeyPathExpr : : Component : : Kind : : Property : <nl> + OS < < " property " ; <nl> + component . getDeclRef ( ) . dump ( OS ) ; <nl> + break ; <nl> + <nl> + case KeyPathExpr : : Component : : Kind : : Subscript : <nl> + OS < < " subscript " ; <nl> + component . getDeclRef ( ) . dump ( OS ) ; <nl> + OS < < ' \ n ' ; <nl> + component . getIndexExpr ( ) - > print ( OS , Indent + 4 ) ; <nl> + break ; <nl> + <nl> + case KeyPathExpr : : Component : : Kind : : UnresolvedProperty : <nl> + OS < < " unresolved_property " ; <nl> + component . getUnresolvedDeclName ( ) . print ( OS ) ; <nl> + break ; <nl> + <nl> + case KeyPathExpr : : Component : : Kind : : UnresolvedSubscript : <nl> + OS < < " unresolved_subscript " ; <nl> + OS < < ' \ n ' ; <nl> + component . getIndexExpr ( ) - > print ( OS , Indent + 4 ) ; <nl> + break ; <nl> + } <nl> + OS < < " ) " ; <nl> } <nl> - if ( auto semanticE = E - > getSemanticExpr ( ) ) { <nl> + if ( auto stringLiteral = E - > getObjCStringLiteralExpr ( ) ) { <nl> OS < < ' \ n ' ; <nl> - printRec ( semanticE ) ; <nl> + printRec ( stringLiteral ) ; <nl> } <nl> OS < < " ) " ; <nl> } <nl> mmm a / lib / AST / ASTWalker . cpp <nl> ppp b / lib / AST / ASTWalker . cpp <nl> class Traversal : public ASTVisitor < Traversal , Expr * , Stmt * , <nl> } <nl> <nl> Expr * visitKeyPathExpr ( KeyPathExpr * E ) { <nl> - HANDLE_SEMANTIC_EXPR ( E ) ; <nl> + / / For an ObjC key path , the string literal expr serves as the semantic <nl> + / / expression . <nl> + if ( auto objcStringLiteral = E - > getObjCStringLiteralExpr ( ) ) { <nl> + Expr * sub = doIt ( objcStringLiteral ) ; <nl> + if ( ! sub ) return nullptr ; <nl> + E - > setObjCStringLiteralExpr ( sub ) ; <nl> + return E ; <nl> + } <nl> + <nl> + SmallVector < KeyPathExpr : : Component , 4 > updatedComponents ; <nl> + bool didChangeComponents = false ; <nl> + for ( auto & componentAndLoc : E - > getComponents ( ) ) { <nl> + auto component = componentAndLoc . first ; <nl> + <nl> + switch ( auto kind = component . getKind ( ) ) { <nl> + case KeyPathExpr : : Component : : Kind : : Subscript : <nl> + case KeyPathExpr : : Component : : Kind : : UnresolvedSubscript : { <nl> + Expr * origIndex = component . getIndexExpr ( ) ; <nl> + Expr * newIndex = doIt ( origIndex ) ; <nl> + if ( ! newIndex ) return nullptr ; <nl> + if ( newIndex ! = origIndex ) { <nl> + didChangeComponents = true ; <nl> + component = kind = = KeyPathExpr : : Component : : Kind : : Subscript <nl> + ? KeyPathExpr : : Component : : forSubscript ( component . getDeclRef ( ) , <nl> + newIndex , <nl> + component . getComponentType ( ) ) <nl> + : KeyPathExpr : : Component : : forUnresolvedSubscript ( newIndex ) ; <nl> + } <nl> + break ; <nl> + } <nl> + <nl> + case KeyPathExpr : : Component : : Kind : : OptionalChain : <nl> + case KeyPathExpr : : Component : : Kind : : OptionalWrap : <nl> + case KeyPathExpr : : Component : : Kind : : OptionalForce : <nl> + case KeyPathExpr : : Component : : Kind : : Property : <nl> + case KeyPathExpr : : Component : : Kind : : UnresolvedProperty : <nl> + / / No subexpr to visit . <nl> + break ; <nl> + } <nl> + updatedComponents . push_back ( component ) ; <nl> + } <nl> + <nl> + if ( didChangeComponents ) { <nl> + E - > resolveComponents ( E - > getType ( ) - > getASTContext ( ) , <nl> + updatedComponents ) ; <nl> + } <nl> + <nl> return E ; <nl> } <nl> <nl> mmm a / lib / AST / Expr . cpp <nl> ppp b / lib / AST / Expr . cpp <nl> ArchetypeType * OpenExistentialExpr : : getOpenedArchetype ( ) const { <nl> return type - > castTo < ArchetypeType > ( ) ; <nl> } <nl> <nl> - KeyPathExpr : : KeyPathExpr ( SourceLoc keywordLoc , SourceLoc lParenLoc , <nl> - ArrayRef < Identifier > names , <nl> - ArrayRef < SourceLoc > nameLocs , <nl> - SourceLoc rParenLoc ) <nl> - : Expr ( ExprKind : : KeyPath , / * Implicit = * / nameLocs . empty ( ) ) , <nl> - KeywordLoc ( keywordLoc ) , LParenLoc ( lParenLoc ) , RParenLoc ( rParenLoc ) <nl> + KeyPathExpr : : KeyPathExpr ( ASTContext & C , <nl> + SourceLoc keywordLoc , SourceLoc lParenLoc , <nl> + ArrayRef < ComponentAndLoc > components , <nl> + SourceLoc rParenLoc , <nl> + bool isObjC , <nl> + bool isImplicit ) <nl> + : Expr ( ExprKind : : KeyPath , isImplicit ) , <nl> + KeywordLoc ( keywordLoc ) , LParenLoc ( lParenLoc ) , RParenLoc ( rParenLoc ) , <nl> + Components ( C . AllocateUninitialized < ComponentAndLoc > ( components . size ( ) ) ) <nl> { <nl> - / / Copy components ( which are all names ) . <nl> - KeyPathExprBits . NumComponents = names . size ( ) ; <nl> - for ( auto idx : indices ( names ) ) <nl> - getComponentsMutable ( ) [ idx ] = names [ idx ] ; <nl> - <nl> - assert ( nameLocs . empty ( ) | | nameLocs . size ( ) = = names . size ( ) ) ; <nl> - KeyPathExprBits . HaveSourceLocations = ! nameLocs . empty ( ) ; <nl> - if ( KeyPathExprBits . HaveSourceLocations ) { <nl> - memcpy ( getNameLocsMutable ( ) . data ( ) , nameLocs . data ( ) , <nl> - nameLocs . size ( ) * sizeof ( SourceLoc ) ) ; <nl> - } <nl> - } <nl> - <nl> - Identifier KeyPathExpr : : getComponentName ( unsigned i ) const { <nl> - if ( auto decl = getComponentDecl ( i ) ) <nl> - return decl - > getFullName ( ) . getBaseName ( ) ; <nl> - <nl> - return getComponents ( ) [ i ] . get < Identifier > ( ) ; <nl> + / / Copy components into the AST context . <nl> + std : : uninitialized_copy ( components . begin ( ) , components . end ( ) , <nl> + Components . begin ( ) ) ; <nl> + <nl> + KeyPathExprBits . IsObjC = isObjC ; <nl> } <nl> <nl> - KeyPathExpr * KeyPathExpr : : create ( ASTContext & ctx , <nl> - SourceLoc keywordLoc , SourceLoc lParenLoc , <nl> - ArrayRef < Identifier > names , <nl> - ArrayRef < SourceLoc > nameLocs , <nl> - SourceLoc rParenLoc ) { <nl> - unsigned size = sizeof ( KeyPathExpr ) <nl> - + names . size ( ) * sizeof ( Identifier ) <nl> - + nameLocs . size ( ) * sizeof ( SourceLoc ) ; <nl> - void * mem = ctx . Allocate ( size , alignof ( KeyPathExpr ) ) ; <nl> - return new ( mem ) KeyPathExpr ( keywordLoc , lParenLoc , names , nameLocs , <nl> - rParenLoc ) ; <nl> + void <nl> + KeyPathExpr : : resolveComponents ( ASTContext & C , <nl> + ArrayRef < KeyPathExpr : : Component > resolvedComponents ) { <nl> + / / Reallocate the components array if it needs to be . <nl> + if ( Components . size ( ) < resolvedComponents . size ( ) ) { <nl> + Components = C . Allocate < ComponentAndLoc > ( resolvedComponents . size ( ) ) ; <nl> + for ( unsigned i : indices ( Components ) ) { <nl> + new ( ( void * ) & Components [ i ] ) ComponentAndLoc { } ; <nl> + } <nl> + } <nl> + <nl> + for ( unsigned i : indices ( resolvedComponents ) ) { <nl> + Components [ i ] . first = resolvedComponents [ i ] ; <nl> + } <nl> + Components = Components . slice ( 0 , resolvedComponents . size ( ) ) ; <nl> } <nl> mmm a / lib / Parse / ParseExpr . cpp <nl> ppp b / lib / Parse / ParseExpr . cpp <nl> ParserResult < Expr > Parser : : parseExprKeyPath ( ) { <nl> SourceLoc lParenLoc = consumeToken ( tok : : l_paren ) ; <nl> <nl> / / Handle code completion . <nl> - SmallVector < Identifier , 4 > names ; <nl> - SmallVector < SourceLoc , 4 > nameLocs ; <nl> + SmallVector < KeyPathExpr : : ComponentAndLoc , 4 > componentsWithLocs ; <nl> auto handleCodeCompletion = [ & ] ( bool hasDot ) - > ParserResult < Expr > { <nl> KeyPathExpr * expr = nullptr ; <nl> - if ( ! names . empty ( ) ) { <nl> - expr = KeyPathExpr : : create ( Context , keywordLoc , lParenLoc , names , <nl> - nameLocs , Tok . getLoc ( ) ) ; <nl> + if ( ! componentsWithLocs . empty ( ) ) { <nl> + expr = new ( Context ) KeyPathExpr ( Context , keywordLoc , lParenLoc , <nl> + componentsWithLocs , Tok . getLoc ( ) , <nl> + / * isObjC TODO * / true ) ; <nl> } <nl> <nl> if ( CodeCompletion ) <nl> ParserResult < Expr > Parser : : parseExprKeyPath ( ) { <nl> while ( true ) { <nl> / / Handle code completion . <nl> if ( Tok . is ( tok : : code_complete ) ) <nl> - return handleCodeCompletion ( ! names . empty ( ) ) ; <nl> + return handleCodeCompletion ( ! componentsWithLocs . empty ( ) ) ; <nl> <nl> / / Parse the next name . <nl> DeclNameLoc nameLoc ; <nl> - bool afterDot = ! names . empty ( ) ; <nl> + bool afterDot = ! componentsWithLocs . empty ( ) ; <nl> auto name = parseUnqualifiedDeclName ( <nl> afterDot , nameLoc , <nl> diag : : expr_keypath_expected_property_or_type ) ; <nl> ParserResult < Expr > Parser : : parseExprKeyPath ( ) { <nl> } <nl> <nl> / / Cannot use compound names here . <nl> + / / TODO : yet . . . <nl> if ( name . isCompoundName ( ) ) { <nl> diagnose ( nameLoc . getBaseNameLoc ( ) , diag : : expr_keypath_compound_name , <nl> name ) <nl> ParserResult < Expr > Parser : : parseExprKeyPath ( ) { <nl> } <nl> <nl> / / Record the name we parsed . <nl> - names . push_back ( name . getBaseName ( ) ) ; <nl> - nameLocs . push_back ( nameLoc . getBaseNameLoc ( ) ) ; <nl> + auto component = KeyPathExpr : : Component : : forUnresolvedProperty ( name ) ; <nl> + componentsWithLocs . push_back ( { component , nameLoc . getBaseNameLoc ( ) } ) ; <nl> <nl> / / Handle code completion . <nl> if ( Tok . is ( tok : : code_complete ) ) <nl> return handleCodeCompletion ( false ) ; <nl> <nl> / / Parse the next period to continue the path . <nl> + / / TODO : subscripts , optional operators <nl> if ( consumeIf ( tok : : period ) ) <nl> continue ; <nl> <nl> ParserResult < Expr > Parser : : parseExprKeyPath ( ) { <nl> <nl> / / If we cannot build a useful expression , just return an error <nl> / / expression . <nl> - if ( names . empty ( ) | | status . isError ( ) ) { <nl> + if ( componentsWithLocs . empty ( ) | | status . isError ( ) ) { <nl> return makeParserResult < Expr > ( <nl> new ( Context ) ErrorExpr ( SourceRange ( keywordLoc , rParenLoc ) ) ) ; <nl> } <nl> <nl> / / We ' re done : create the key - path expression . <nl> return makeParserResult < Expr > ( <nl> - KeyPathExpr : : create ( Context , keywordLoc , lParenLoc , names , <nl> - nameLocs , rParenLoc ) ) ; <nl> + new ( Context ) KeyPathExpr ( Context , keywordLoc , lParenLoc , <nl> + componentsWithLocs , <nl> + rParenLoc , / * isObjC TODO * / true ) ) ; <nl> } <nl> <nl> / / / parseExprSelector <nl> mmm a / lib / SILGen / SILGenExpr . cpp <nl> ppp b / lib / SILGen / SILGenExpr . cpp <nl> RValue RValueEmitter : : visitObjCSelectorExpr ( ObjCSelectorExpr * e , SGFContext C ) { <nl> } <nl> <nl> RValue RValueEmitter : : visitKeyPathExpr ( KeyPathExpr * E , SGFContext C ) { <nl> - return visit ( E - > getSemanticExpr ( ) , C ) ; <nl> + if ( E - > isObjC ( ) ) { <nl> + return visit ( E - > getObjCStringLiteralExpr ( ) , C ) ; <nl> + } <nl> + <nl> + / / TODO : native keypaths <nl> + llvm_unreachable ( " not implemented " ) ; <nl> } <nl> <nl> RValue RValueEmitter : : <nl> mmm a / lib / Sema / CSApply . cpp <nl> ppp b / lib / Sema / CSApply . cpp <nl> namespace { <nl> } <nl> <nl> Expr * visitKeyPathExpr ( KeyPathExpr * E ) { <nl> - if ( auto semanticE = E - > getSemanticExpr ( ) ) <nl> + if ( auto semanticE = E - > getObjCStringLiteralExpr ( ) ) { <nl> cs . setType ( E , cs . getType ( semanticE ) ) ; <nl> - <nl> - return E ; <nl> + return E ; <nl> + } <nl> + <nl> + / / TODO : Native keypaths <nl> + llvm_unreachable ( " not implemented " ) ; <nl> } <nl> <nl> / / / Interface for ExprWalker <nl> mmm a / lib / Sema / CSGen . cpp <nl> ppp b / lib / Sema / CSGen . cpp <nl> namespace { <nl> } <nl> <nl> Type visitKeyPathExpr ( KeyPathExpr * E ) { <nl> - return E - > getSemanticExpr ( ) - > getType ( ) ; <nl> + if ( auto objCLiteral = E - > getObjCStringLiteralExpr ( ) ) <nl> + return objCLiteral - > getType ( ) ; <nl> + <nl> + / / TODO : native key paths <nl> + llvm_unreachable ( " not implemented " ) ; <nl> } <nl> } ; <nl> <nl> mmm a / lib / Sema / TypeCheckExprObjC . cpp <nl> ppp b / lib / Sema / TypeCheckExprObjC . cpp <nl> <nl> / / = = = mmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmm - = = = / / <nl> # include " TypeChecker . h " <nl> # include " swift / Basic / Range . h " <nl> + <nl> using namespace swift ; <nl> <nl> Optional < Type > TypeChecker : : checkKeyPathExpr ( DeclContext * dc , <nl> - KeyPathExpr * expr , <nl> - bool requireResultType ) { <nl> + KeyPathExpr * expr , <nl> + bool requireResultType ) { <nl> + / / TODO : Native keypaths <nl> + assert ( expr - > isObjC ( ) & & " native keypaths not implemented " ) ; <nl> + <nl> / / If there is already a semantic expression , do nothing . <nl> - if ( expr - > getSemanticExpr ( ) & & ! requireResultType ) return None ; <nl> + if ( expr - > getObjCStringLiteralExpr ( ) & & ! requireResultType ) return None ; <nl> <nl> - / / # keyPath only makes sense when we have the Objective - C runtime . <nl> + / / ObjC # keyPath only makes sense when we have the Objective - C runtime . <nl> if ( ! Context . LangOpts . EnableObjCInterop ) { <nl> diagnose ( expr - > getLoc ( ) , diag : : expr_keypath_no_objc_runtime ) ; <nl> <nl> - expr - > setSemanticExpr ( <nl> + expr - > setObjCStringLiteralExpr ( <nl> new ( Context ) StringLiteralExpr ( " " , expr - > getSourceRange ( ) , <nl> / * Implicit = * / true ) ) ; <nl> return None ; <nl> Optional < Type > TypeChecker : : checkKeyPathExpr ( DeclContext * dc , <nl> } ; <nl> <nl> / / Local function to perform name lookup for the current index . <nl> - auto performLookup = [ & ] ( unsigned idx , Identifier componentName , <nl> + auto performLookup = [ & ] ( Identifier componentName , <nl> SourceLoc componentNameLoc , <nl> Type & lookupType ) - > LookupResult { <nl> if ( state = = Beginning ) <nl> Optional < Type > TypeChecker : : checkKeyPathExpr ( DeclContext * dc , <nl> } ; <nl> <nl> bool isInvalid = false ; <nl> - for ( unsigned idx : range ( expr - > getNumComponents ( ) ) ) { <nl> - auto componentName = expr - > getComponentName ( idx ) ; <nl> - auto componentNameLoc = expr - > getComponentNameLoc ( idx ) ; <nl> + SmallVector < KeyPathExpr : : Component , 4 > resolvedComponents ; <nl> + <nl> + for ( auto & componentAndLoc : expr - > getComponents ( ) ) { <nl> + KeyPathExpr : : Component component = componentAndLoc . first ; <nl> + auto componentNameLoc = componentAndLoc . second ; <nl> + <nl> + / / ObjC keypaths only support named segments . <nl> + / / TODO : Perhaps we can map subscript components to dictionary keys . <nl> + switch ( auto kind = component . getKind ( ) ) { <nl> + case KeyPathExpr : : Component : : Kind : : UnresolvedProperty : <nl> + break ; <nl> + case KeyPathExpr : : Component : : Kind : : UnresolvedSubscript : <nl> + case KeyPathExpr : : Component : : Kind : : OptionalChain : <nl> + case KeyPathExpr : : Component : : Kind : : OptionalForce : <nl> + diagnose ( componentNameLoc , <nl> + diag : : expr_unsupported_objc_key_path_component , <nl> + ( unsigned ) kind ) ; <nl> + continue ; <nl> + case KeyPathExpr : : Component : : Kind : : OptionalWrap : <nl> + case KeyPathExpr : : Component : : Kind : : Property : <nl> + case KeyPathExpr : : Component : : Kind : : Subscript : <nl> + llvm_unreachable ( " already resolved ! " ) ; <nl> + } <nl> + <nl> + auto componentFullName = component . getUnresolvedDeclName ( ) ; <nl> + if ( ! componentFullName . isSimpleName ( ) ) { <nl> + diagnose ( componentNameLoc , <nl> + diag : : expr_unsupported_objc_key_path_compound_name ) ; <nl> + continue ; <nl> + } <nl> + auto componentName = componentFullName . getBaseName ( ) ; <nl> <nl> / / If we are resolving into a dictionary , any component is <nl> / / well - formed because the keys are unknown dynamically . <nl> Optional < Type > TypeChecker : : checkKeyPathExpr ( DeclContext * dc , <nl> <nl> / / Look for this component . <nl> Type lookupType ; <nl> - LookupResult lookup = performLookup ( idx , componentName , componentNameLoc , <nl> + LookupResult lookup = performLookup ( componentName , componentNameLoc , <nl> lookupType ) ; <nl> <nl> / / If we didn ' t find anything , try to apply typo - correction . <nl> Optional < Type > TypeChecker : : checkKeyPathExpr ( DeclContext * dc , <nl> validateDecl ( var ) ; <nl> <nl> / / Resolve this component to the variable we found . <nl> - expr - > resolveComponent ( idx , var ) ; <nl> + auto varRef = ConcreteDeclRef ( var ) ; <nl> + auto resolved = <nl> + KeyPathExpr : : Component : : forProperty ( varRef , Type ( ) ) ; <nl> + resolvedComponents . push_back ( resolved ) ; <nl> updateState ( / * isProperty = * / true , <nl> var - > getInterfaceType ( ) - > getRValueObjectType ( ) ) ; <nl> <nl> Optional < Type > TypeChecker : : checkKeyPathExpr ( DeclContext * dc , <nl> isInvalid = true ; <nl> break ; <nl> } <nl> + / / A successful check of an ObjC keypath shouldn ' t add or remove components , <nl> + / / currently . <nl> + if ( resolvedComponents . size ( ) = = expr - > getComponents ( ) . size ( ) ) <nl> + expr - > resolveComponents ( Context , resolvedComponents ) ; <nl> <nl> / / Check for an empty key - path string . <nl> auto keyPathString = keyPathOS . str ( ) ; <nl> if ( keyPathString . empty ( ) & & ! isInvalid ) <nl> diagnose ( expr - > getLoc ( ) , diag : : expr_keypath_empty ) ; <nl> <nl> - / / Set the semantic expression . <nl> - if ( ! expr - > getSemanticExpr ( ) ) { <nl> - expr - > setSemanticExpr ( <nl> + / / Set the string literal expression for the ObjC key path . <nl> + if ( ! expr - > getObjCStringLiteralExpr ( ) ) { <nl> + expr - > setObjCStringLiteralExpr ( <nl> new ( Context ) StringLiteralExpr ( Context . AllocateCopy ( keyPathString ) , <nl> expr - > getSourceRange ( ) , <nl> / * Implicit = * / true ) ) ; <nl> mmm a / lib / Syntax / LegacyASTTransformer . cpp <nl> ppp b / lib / Syntax / LegacyASTTransformer . cpp <nl> LegacyASTTransformer : : visitObjCSelectorExpr ( ObjCSelectorExpr * E , <nl> <nl> RC < SyntaxData > <nl> LegacyASTTransformer : : visitKeyPathExpr ( KeyPathExpr * E , <nl> - const SyntaxData * Parent , <nl> - const CursorIndex IndexInParent ) { <nl> + const SyntaxData * Parent , <nl> + const CursorIndex IndexInParent ) { <nl> return getUnknownExpr ( E ) ; <nl> } <nl> <nl> mmm a / test / expr / unary / keypath / keypath . swift <nl> ppp b / test / expr / unary / keypath / keypath . swift <nl> func testParseErrors ( ) { <nl> let _ : String = # keyPath ; / / expected - error { { expected ' ( ' following ' # keyPath ' } } <nl> let _ : String = # keyPath ( 123 ; / / expected - error { { expected property or type name within ' # keyPath ( . . . ) ' } } <nl> let _ : String = # keyPath ( a . 123 ; / / expected - error { { expected property or type name within ' # keyPath ( . . . ) ' } } <nl> - let _ : String = # keyPath ( A ( b : c : d : ) . propSet ) ; / / expected - error { { cannot use compound name ' A ( b : c : d : ) ' in ' # keyPath ' expression } } <nl> + / / TODO : redundant compound name error <nl> + let _ : String = # keyPath ( A ( b : c : d : ) . propSet ) ; / / expected - error { { cannot use compound name } } expected - error { { an Objective - C key path cannot reference a declaration with a compound name } } expected - error { { unresolved identifier ' propSet ' } } <nl> let _ : String = # keyPath ( A . propString ; / / expected - error { { expected ' ) ' to complete ' # keyPath ' expression } } <nl> / / expected - note @ - 1 { { to match this opening ' ( ' } } <nl> } <nl>
Restructure KeyPathExpr to allow more kinds of components .
apple/swift
a5ca6ccd61d072228e384fe9eded4daa0e556e19
2017-04-04T18:31:15Z
mmm a / hphp / hack / src / typing / typing_instantiate . ml <nl> ppp b / hphp / hack / src / typing / typing_instantiate . ml <nl> and check_constraint env ck ty x_ty = <nl> end <nl> <nl> and instantiate subst env ( r , ty ) = <nl> + ( * PERF : If subst is empty then instantiation is a no - op . We can save a <nl> + * significant amount of CPU by avoiding recursively deconstructing the ty <nl> + * data type . <nl> + * ) <nl> + if SMap . is_empty subst then env , ( r , ty ) else <nl> match ty with <nl> | Tgeneric ( x , cstr_opt ) - > <nl> ( match SMap . get x subst with <nl> mmm a / hphp / hack / test / typecheck / array_map . php . exp <nl> ppp b / hphp / hack / test / typecheck / array_map . php . exp <nl> <nl> - array < [ 175 ] Tbool > <nl> + array < [ 169 ] Tbool > <nl> No errors <nl> mmm a / hphp / hack / test / typecheck / instanceof_static_with_reqs . php . exp <nl> ppp b / hphp / hack / test / typecheck / instanceof_static_with_reqs . php . exp <nl> <nl> object <nl> generic this as < App \ BaseField < generic T , > > <nl> - App \ INeedsFoo < [ 292 ] intersect ( ) , > <nl> - [ 324 ] intersect ( App \ INeedsFoo < [ 304 ] intersect ( X ) , > , generic this as < App \ BaseField < generic T , > > ) <nl> + App \ INeedsFoo < [ 276 ] intersect ( ) , > <nl> + [ 306 ] intersect ( App \ INeedsFoo < [ 286 ] intersect ( X ) , > , generic this as < App \ BaseField < generic T , > > ) <nl> File " instanceof_static_with_reqs . php " , line 31 , characters 12 - 17 : <nl> Invalid return type ( Typing [ 4110 ] ) <nl> File " instanceof_static_with_reqs . php " , line 7 , characters 49 - 52 : <nl> mmm a / hphp / hack / test / typecheck / tconst / local_inference . php . exp <nl> ppp b / hphp / hack / test / typecheck / tconst / local_inference . php . exp <nl> <nl> - [ 291 ] intersect ( App \ Foo < > , App \ IFoo < > ) <nl> + [ 275 ] intersect ( App \ Foo < > , App \ IFoo < > ) <nl> No errors <nl> mmm a / hphp / hack / test / typecheck / tconst / method_contravariant . php . exp <nl> ppp b / hphp / hack / test / typecheck / tconst / method_contravariant . php . exp <nl> <nl> File " method_contravariant . php " , line 43 , characters 14 - 15 : <nl> Invalid argument ( Typing [ 4110 ] ) <nl> File " method_contravariant . php " , line 15 , characters 5 - 11 : <nl> - This is the expression dependent type < expr # 295 > : : T <nl> + This is the expression dependent type < expr # 279 > : : T <nl> that is compatible with the abstract type constant X : : T <nl> that is compatible with an array key ( int / string ) <nl> File " method_contravariant . php " , line 43 , characters 3 - 4 : <nl> - where ' < expr # 295 > ' is a reference to this expression <nl> + where ' < expr # 279 > ' is a reference to this expression <nl> File " method_contravariant . php " , line 4 , characters 14 - 14 : <nl> resulting from expanding a type constant as follows : <nl> - < expr # 295 > : : T - > X : : T <nl> + < expr # 279 > : : T - > X : : T <nl> File " method_contravariant . php " , line 43 , characters 14 - 15 : <nl> It is incompatible with a string <nl> mmm a / hphp / hack / test / typecheck / tconst / method_swap_error . php . exp <nl> ppp b / hphp / hack / test / typecheck / tconst / method_swap_error . php . exp <nl> Some type constraint ( s ) here are violated <nl> File " method_swap_error . php " , line 4 , characters 14 - 14 : <nl> ' X : : T ' is a constrained type <nl> File " method_swap_error . php " , line 15 , characters 5 - 11 : <nl> - This is the expression dependent type < expr # 294 > : : T <nl> + This is the expression dependent type < expr # 278 > : : T <nl> that is compatible with the abstract type constant X : : T <nl> that is compatible with an array key ( int / string ) <nl> File " method_swap_error . php " , line 21 , characters 5 - 7 : <nl> - where ' < expr # 294 > ' is a reference to this expression <nl> + where ' < expr # 278 > ' is a reference to this expression <nl> File " method_swap_error . php " , line 4 , characters 14 - 14 : <nl> resulting from expanding a type constant as follows : <nl> - < expr # 294 > : : T - > X : : T <nl> + < expr # 278 > : : T - > X : : T <nl> File " method_swap_error . php " , line 4 , characters 19 - 26 : <nl> It is incompatible with an array key ( int / string ) <nl> File " method_swap_error . php " , line 10 , characters 26 - 32 : <nl> - Considering the constraint on ' < expr # 295 > : : T ' <nl> + Considering the constraint on ' < expr # 279 > : : T ' <nl> File " method_swap_error . php " , line 21 , characters 14 - 16 : <nl> - where ' < expr # 295 > ' is a reference to this expression <nl> + where ' < expr # 279 > ' is a reference to this expression <nl> File " method_swap_error . php " , line 4 , characters 14 - 14 : <nl> resulting from expanding a type constant as follows : <nl> - < expr # 295 > : : T - > X : : T <nl> + < expr # 279 > : : T - > X : : T <nl>
Skip instantiation if there is nothing to substitute
facebook/hhvm
e754ae8187d5e1e6bb7932dbc837f0e6392a2158
2015-04-13T18:00:56Z
mmm a / scene / gui / label . cpp <nl> ppp b / scene / gui / label . cpp <nl> void Label : : regenerate_word_cache ( ) { <nl> } <nl> <nl> if ( current = = ' \ n ' ) { <nl> - <nl> insert_newline = true ; <nl> } else { <nl> total_char_cache + + ; <nl> } <nl> <nl> + if ( i < text . length ( ) & & text [ i ] = = ' ' ) { <nl> + total_char_cache - - ; / / do not count spaces <nl> + } <nl> + <nl> <nl> } else { <nl> <nl> void Label : : regenerate_word_cache ( ) { <nl> last_width = line_width ; <nl> <nl> } <nl> - <nl> + <nl> + total_char_cache - = line_count + 1 ; / / do not count new lines ( including the first one ) <nl> <nl> if ( ! autowrap ) { <nl> <nl> String Label : : get_text ( ) const { <nl> <nl> return text ; <nl> } <nl> + <nl> void Label : : set_visible_characters ( int p_amount ) { <nl> <nl> visible_chars = p_amount ; <nl> void Label : : _bind_methods ( ) { <nl> ADD_PROPERTY ( PropertyInfo ( Variant : : INT , " valign " , PROPERTY_HINT_ENUM , " Top , Center , Bottom , Fill " ) , _SCS ( " set_valign " ) , _SCS ( " get_valign " ) ) ; <nl> ADD_PROPERTY ( PropertyInfo ( Variant : : BOOL , " autowrap " ) , _SCS ( " set_autowrap " ) , _SCS ( " has_autowrap " ) ) ; <nl> ADD_PROPERTY ( PropertyInfo ( Variant : : BOOL , " uppercase " ) , _SCS ( " set_uppercase " ) , _SCS ( " is_uppercase " ) ) ; <nl> - ADD_PROPERTY ( PropertyInfo ( Variant : : REAL , " percent_visible " ) , _SCS ( " set_percent_visible " ) , _SCS ( " get_percent_visible " ) ) ; <nl> + ADD_PROPERTY ( PropertyInfo ( Variant : : REAL , " percent_visible " , PROPERTY_HINT_RANGE , " 0 , 1 , 0 . 001 " ) , _SCS ( " set_percent_visible " ) , _SCS ( " get_percent_visible " ) ) ; <nl> <nl> } <nl> <nl>
Made a uniform distribution of characters in Label : : set_percent_visible ( )
godotengine/godot
359ea6088cbe6cdad49919eb1ee669cb73d28da0
2014-05-31T21:50:10Z
mmm a / BUILD <nl> ppp b / BUILD <nl> cc_library ( <nl> " src / cpp / common / channel_filter . cc " , <nl> " src / cpp / common / completion_queue_cc . cc " , <nl> " src / cpp / common / core_codegen . cc " , <nl> - " src / cpp / common / health_check_service_server_builder_option . cc " , <nl> " src / cpp / common / resource_quota_cc . cc " , <nl> " src / cpp / common / rpc_method . cc " , <nl> " src / cpp / common / version_cc . cc " , <nl> cc_library ( <nl> " src / cpp / server / default_health_check_service . cc " , <nl> " src / cpp / server / dynamic_thread_pool . cc " , <nl> " src / cpp / server / health_check_service . cc " , <nl> + " src / cpp / server / health_check_service_server_builder_option . cc " , <nl> " src / cpp / server / server_builder . cc " , <nl> " src / cpp / server / server_cc . cc " , <nl> " src / cpp / server / server_context . cc " , <nl> cc_library ( <nl> " src / cpp / common / channel_filter . cc " , <nl> " src / cpp / common / completion_queue_cc . cc " , <nl> " src / cpp / common / core_codegen . cc " , <nl> - " src / cpp / common / health_check_service_server_builder_option . cc " , <nl> " src / cpp / common / resource_quota_cc . cc " , <nl> " src / cpp / common / rpc_method . cc " , <nl> " src / cpp / common / version_cc . cc " , <nl> cc_library ( <nl> " src / cpp / server / default_health_check_service . cc " , <nl> " src / cpp / server / dynamic_thread_pool . cc " , <nl> " src / cpp / server / health_check_service . cc " , <nl> + " src / cpp / server / health_check_service_server_builder_option . cc " , <nl> " src / cpp / server / server_builder . cc " , <nl> " src / cpp / server / server_cc . cc " , <nl> " src / cpp / server / server_context . cc " , <nl> cc_library ( <nl> " src / cpp / common / channel_filter . cc " , <nl> " src / cpp / common / completion_queue_cc . cc " , <nl> " src / cpp / common / core_codegen . cc " , <nl> - " src / cpp / common / health_check_service_server_builder_option . cc " , <nl> " src / cpp / common / resource_quota_cc . cc " , <nl> " src / cpp / common / rpc_method . cc " , <nl> " src / cpp / common / version_cc . cc " , <nl> cc_library ( <nl> " src / cpp / server / default_health_check_service . cc " , <nl> " src / cpp / server / dynamic_thread_pool . cc " , <nl> " src / cpp / server / health_check_service . cc " , <nl> + " src / cpp / server / health_check_service_server_builder_option . cc " , <nl> " src / cpp / server / server_builder . cc " , <nl> " src / cpp / server / server_cc . cc " , <nl> " src / cpp / server / server_context . cc " , <nl> mmm a / CMakeLists . txt <nl> ppp b / CMakeLists . txt <nl> add_library ( grpc + + <nl> src / cpp / common / channel_filter . cc <nl> src / cpp / common / completion_queue_cc . cc <nl> src / cpp / common / core_codegen . cc <nl> - src / cpp / common / health_check_service_server_builder_option . cc <nl> src / cpp / common / resource_quota_cc . cc <nl> src / cpp / common / rpc_method . cc <nl> src / cpp / common / version_cc . cc <nl> add_library ( grpc + + <nl> src / cpp / server / default_health_check_service . cc <nl> src / cpp / server / dynamic_thread_pool . cc <nl> src / cpp / server / health_check_service . cc <nl> + src / cpp / server / health_check_service_server_builder_option . cc <nl> src / cpp / server / server_builder . cc <nl> src / cpp / server / server_cc . cc <nl> src / cpp / server / server_context . cc <nl> add_library ( grpc + + _cronet <nl> src / cpp / common / channel_filter . cc <nl> src / cpp / common / completion_queue_cc . cc <nl> src / cpp / common / core_codegen . cc <nl> - src / cpp / common / health_check_service_server_builder_option . cc <nl> src / cpp / common / resource_quota_cc . cc <nl> src / cpp / common / rpc_method . cc <nl> src / cpp / common / version_cc . cc <nl> add_library ( grpc + + _cronet <nl> src / cpp / server / default_health_check_service . cc <nl> src / cpp / server / dynamic_thread_pool . cc <nl> src / cpp / server / health_check_service . cc <nl> + src / cpp / server / health_check_service_server_builder_option . cc <nl> src / cpp / server / server_builder . cc <nl> src / cpp / server / server_cc . cc <nl> src / cpp / server / server_context . cc <nl> add_library ( grpc + + _unsecure <nl> src / cpp / common / channel_filter . cc <nl> src / cpp / common / completion_queue_cc . cc <nl> src / cpp / common / core_codegen . cc <nl> - src / cpp / common / health_check_service_server_builder_option . cc <nl> src / cpp / common / resource_quota_cc . cc <nl> src / cpp / common / rpc_method . cc <nl> src / cpp / common / version_cc . cc <nl> add_library ( grpc + + _unsecure <nl> src / cpp / server / default_health_check_service . cc <nl> src / cpp / server / dynamic_thread_pool . cc <nl> src / cpp / server / health_check_service . cc <nl> + src / cpp / server / health_check_service_server_builder_option . cc <nl> src / cpp / server / server_builder . cc <nl> src / cpp / server / server_cc . cc <nl> src / cpp / server / server_context . cc <nl> mmm a / Makefile <nl> ppp b / Makefile <nl> LIBGRPC + + _SRC = \ <nl> src / cpp / common / channel_filter . cc \ <nl> src / cpp / common / completion_queue_cc . cc \ <nl> src / cpp / common / core_codegen . cc \ <nl> - src / cpp / common / health_check_service_server_builder_option . cc \ <nl> src / cpp / common / resource_quota_cc . cc \ <nl> src / cpp / common / rpc_method . cc \ <nl> src / cpp / common / version_cc . cc \ <nl> LIBGRPC + + _SRC = \ <nl> src / cpp / server / default_health_check_service . cc \ <nl> src / cpp / server / dynamic_thread_pool . cc \ <nl> src / cpp / server / health_check_service . cc \ <nl> + src / cpp / server / health_check_service_server_builder_option . cc \ <nl> src / cpp / server / server_builder . cc \ <nl> src / cpp / server / server_cc . cc \ <nl> src / cpp / server / server_context . cc \ <nl> LIBGRPC + + _CRONET_SRC = \ <nl> src / cpp / common / channel_filter . cc \ <nl> src / cpp / common / completion_queue_cc . cc \ <nl> src / cpp / common / core_codegen . cc \ <nl> - src / cpp / common / health_check_service_server_builder_option . cc \ <nl> src / cpp / common / resource_quota_cc . cc \ <nl> src / cpp / common / rpc_method . cc \ <nl> src / cpp / common / version_cc . cc \ <nl> LIBGRPC + + _CRONET_SRC = \ <nl> src / cpp / server / default_health_check_service . cc \ <nl> src / cpp / server / dynamic_thread_pool . cc \ <nl> src / cpp / server / health_check_service . cc \ <nl> + src / cpp / server / health_check_service_server_builder_option . cc \ <nl> src / cpp / server / server_builder . cc \ <nl> src / cpp / server / server_cc . cc \ <nl> src / cpp / server / server_context . cc \ <nl> LIBGRPC + + _UNSECURE_SRC = \ <nl> src / cpp / common / channel_filter . cc \ <nl> src / cpp / common / completion_queue_cc . cc \ <nl> src / cpp / common / core_codegen . cc \ <nl> - src / cpp / common / health_check_service_server_builder_option . cc \ <nl> src / cpp / common / resource_quota_cc . cc \ <nl> src / cpp / common / rpc_method . cc \ <nl> src / cpp / common / version_cc . cc \ <nl> LIBGRPC + + _UNSECURE_SRC = \ <nl> src / cpp / server / default_health_check_service . cc \ <nl> src / cpp / server / dynamic_thread_pool . cc \ <nl> src / cpp / server / health_check_service . cc \ <nl> + src / cpp / server / health_check_service_server_builder_option . cc \ <nl> src / cpp / server / server_builder . cc \ <nl> src / cpp / server / server_cc . cc \ <nl> src / cpp / server / server_context . cc \ <nl> mmm a / build . yaml <nl> ppp b / build . yaml <nl> filegroups : <nl> - src / cpp / common / channel_filter . cc <nl> - src / cpp / common / completion_queue_cc . cc <nl> - src / cpp / common / core_codegen . cc <nl> - - src / cpp / common / health_check_service_server_builder_option . cc <nl> - src / cpp / common / resource_quota_cc . cc <nl> - src / cpp / common / rpc_method . cc <nl> - src / cpp / common / version_cc . cc <nl> filegroups : <nl> - src / cpp / server / default_health_check_service . cc <nl> - src / cpp / server / dynamic_thread_pool . cc <nl> - src / cpp / server / health_check_service . cc <nl> + - src / cpp / server / health_check_service_server_builder_option . cc <nl> - src / cpp / server / server_builder . cc <nl> - src / cpp / server / server_cc . cc <nl> - src / cpp / server / server_context . cc <nl> mmm a / include / grpc + + / server . h <nl> ppp b / include / grpc + + / server . h <nl> struct grpc_server ; <nl> <nl> namespace grpc { <nl> <nl> - class GenericServerContext ; <nl> class AsyncGenericService ; <nl> - class ServerAsyncStreamingInterface ; <nl> + class HealthCheckServiceInterface ; <nl> class ServerContext ; <nl> class ServerInitializer ; <nl> - class ThreadPoolInterface ; <nl> <nl> / / / Models a gRPC server . <nl> / / / <nl> class Server final : public ServerInterface , private GrpcLibraryCodegen { <nl> <nl> / / / Returns the health check service . <nl> HealthCheckServiceInterface * GetHealthCheckService ( ) const { <nl> - return hc_ . get ( ) ; <nl> + return health_check_service_ . get ( ) ; <nl> } <nl> <nl> private : <nl> class Server final : public ServerInterface , private GrpcLibraryCodegen { <nl> std : : unique_ptr < ServerInitializer > server_initializer_ ; <nl> <nl> std : : unique_ptr < HealthCheckServiceInterface > health_check_service_ ; <nl> - / / User explicitly disabled health check service . <nl> - bool health_check_service_disabled_ ; <nl> } ; <nl> <nl> } / / namespace grpc <nl> mmm a / src / cpp / server / default_health_check_service . cc <nl> ppp b / src / cpp / server / default_health_check_service . cc <nl> <nl> # include " src / cpp / server / default_health_check_service . h " <nl> <nl> namespace grpc { <nl> + namespace { <nl> + <nl> + const char kHealthCheckMethodName [ ] = " / grpc . health . v1 . Health / Check " ; <nl> + <nl> + } / / namespace <nl> + <nl> + SyncHealthCheckServiceImpl : : SyncHealthCheckServiceImpl ( <nl> + DefaultHealthCheckService * service ) <nl> + : service_ ( service ) { <nl> + auto * handler = <nl> + new RpcMethodHandler < SyncHealthCheckServiceImpl , ByteBuffer , ByteBuffer > ( <nl> + std : : mem_fn ( & SyncHealthCheckServiceImpl : : Check ) , this ) ; <nl> + auto * method = new RpcServiceMethod ( kHealthCheckMethodName , <nl> + RpcMethod : : NORMAL_RPC , handler ) ; <nl> + AddMethod ( mehtod ) ; <nl> + } <nl> + <nl> + Status SyncHealthCheckServiceImpl : : Check ( ServerContext * context , <nl> + const ByteBuffer * request , <nl> + ByteBuffer * response ) { <nl> + / / TODO nanopb <nl> + return Status : : OK ; <nl> + } <nl> <nl> DefaultHealthCheckService : : DefaultHealthCheckService ( ) { <nl> services_map_ . insert ( " " , true ) ; <nl> mmm a / src / cpp / server / default_health_check_service . h <nl> ppp b / src / cpp / server / default_health_check_service . h <nl> <nl> # include < mutex > <nl> <nl> # include < grpc + + / health_check_service_interface . h > <nl> + # include < grpc + + / impl / codegen / service_types . h > <nl> <nl> namespace grpc { <nl> <nl> + class SyncHealthCheckServiceImpl : public Service { <nl> + public : <nl> + explicit SyncHealthCheckServiceImpl ( DefaultHealthCheckService * service ) ; <nl> + Status Check ( ServerContext * context , const ByteBuffer * request , <nl> + ByteBuffer * response ) ; <nl> + <nl> + private : <nl> + const DefaultHealthCheckService * service_ ; <nl> + } ; <nl> + <nl> + / / Default implementation of HealthCheckServiceInterface . Server will create and <nl> + / / own it . <nl> class DefaultHealthCheckService : public HealthCheckServiceInterface { <nl> public : <nl> DefaultHealthCheckService ( ) ; <nl> - void SetServingStatus ( const grpc : : string & service_name , <nl> - bool serving ) override ; <nl> - void SetServingStatus ( bool serving ) override ; <nl> + void SetServingStatus ( const grpc : : string & service_name , bool serving ) final ; <nl> + void SetServingStatus ( bool serving ) final ; <nl> enum ServingStatus { NOT_FOUND , SERVING , NOT_SERVING } ; <nl> ServingStatus GetServingStatus ( const grpc : : string & service_name ) const ; <nl> + SyncHealthCheckServiceImpl * GetSyncHealthCheckService ( ) const { <nl> + return sync_service_ . get ( ) ; <nl> + } <nl> <nl> private : <nl> std : : mutex mu_ ; <nl> std : : map < grpc : : string , bool > services_map_ ; <nl> + std : : unique_ptr < SyncHealthCheckServiceImpl > sync_service_ ; <nl> } ; <nl> <nl> } / / namespace grpc <nl> new file mode 100644 <nl> index 00000000000 . . 80004b77fae <nl> mmm / dev / null <nl> ppp b / src / cpp / server / health_check_service_server_builder_option . cc <nl> <nl> + / * <nl> + * <nl> + * Copyright 2016 , Google Inc . <nl> + * All rights reserved . <nl> + * <nl> + * Redistribution and use in source and binary forms , with or without <nl> + * modification , are permitted provided that the following conditions are <nl> + * met : <nl> + * <nl> + * * Redistributions of source code must retain the above copyright <nl> + * notice , this list of conditions and the following disclaimer . <nl> + * * Redistributions in binary form must reproduce the above <nl> + * copyright notice , this list of conditions and the following disclaimer <nl> + * in the documentation and / or other materials provided with the <nl> + * distribution . <nl> + * * Neither the name of Google Inc . nor the names of its <nl> + * contributors may be used to endorse or promote products derived from <nl> + * this software without specific prior written permission . <nl> + * <nl> + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS <nl> + * " AS IS " AND ANY EXPRESS OR IMPLIED WARRANTIES , INCLUDING , BUT NOT <nl> + * LIMITED TO , THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR <nl> + * A PARTICULAR PURPOSE ARE DISCLAIMED . IN NO EVENT SHALL THE COPYRIGHT <nl> + * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT , INDIRECT , INCIDENTAL , <nl> + * SPECIAL , EXEMPLARY , OR CONSEQUENTIAL DAMAGES ( INCLUDING , BUT NOT <nl> + * LIMITED TO , PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES ; LOSS OF USE , <nl> + * DATA , OR PROFITS ; OR BUSINESS INTERRUPTION ) HOWEVER CAUSED AND ON ANY <nl> + * THEORY OF LIABILITY , WHETHER IN CONTRACT , STRICT LIABILITY , OR TORT <nl> + * ( INCLUDING NEGLIGENCE OR OTHERWISE ) ARISING IN ANY WAY OUT OF THE USE <nl> + * OF THIS SOFTWARE , EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE . <nl> + * <nl> + * / <nl> + <nl> + # include < grpc + + / ext / health_check_service_server_builder_option . h > <nl> + <nl> + namespace grpc { <nl> + <nl> + HealthCheckServiceServerBuilderOption : : HealthCheckServiceServerBuilderOption ( <nl> + std : : unique_ptr < HealthCheckServiceInterface > hc ) <nl> + : hc_ ( std : : move ( hc ) ) { } <nl> + / / Hand over hc_ to the server . <nl> + void HealthCheckServiceServerBuilderOption : : UpdateArguments ( <nl> + ChannelArguments * args ) override { <nl> + args - > SetPointer ( kDefaultHealthCheckServiceInterfaceArg , hc_ . release ( ) ) ; <nl> + } <nl> + <nl> + void HealthCheckServiceServerBuilderOption : : UpdatePlugins ( <nl> + std : : vector < std : : unique_ptr < ServerBuilderPlugin > > * plugins ) override { } <nl> + <nl> + } / / namespace grpc <nl> mmm a / src / cpp / server / server_cc . cc <nl> ppp b / src / cpp / server / server_cc . cc <nl> Server : : Server ( <nl> shutdown_notified_ ( false ) , <nl> has_generic_service_ ( false ) , <nl> server_ ( nullptr ) , <nl> - server_initializer_ ( new ServerInitializer ( this ) ) , <nl> - health_check_service_disabled_ ( false ) { <nl> + server_initializer_ ( new ServerInitializer ( this ) ) { <nl> g_gli_initializer . summon ( ) ; <nl> gpr_once_init ( & g_once_init_callbacks , InitGlobalCallbacks ) ; <nl> global_callbacks_ = g_callbacks ; <nl> Server : : Server ( <nl> grpc_channel_args channel_args ; <nl> args - > SetChannelArgs ( & channel_args ) ; <nl> <nl> + bool health_check_service_disabled = false ; <nl> for ( size_t i = 0 ; i < channel_args . num_args ; i + + ) { <nl> if ( 0 = = strcmp ( channel_args . args [ i ] . key , <nl> kDefaultHealthCheckServiceInterfaceArg ) ) { <nl> Server : : Server ( <nl> break ; <nl> } <nl> } <nl> + / / Only create default health check service when user did not provide an <nl> + / / explicit one . <nl> + if ( health_check_service_ = = nullptr & & ! health_check_service_disabled & & <nl> + EnableDefaultHealthCheckService ( ) ) { <nl> + health_check_service_ . reset ( new DefaultHealthCheckService ) ; <nl> + if ( ! sync_server_cqs - > empty ( ) ) { / / Has sync methods . <nl> + RegisterService ( health_check_service_ - > GetSyncHealthCheckService ( ) ) ; <nl> + } <nl> + } <nl> <nl> server_ = grpc_server_create ( & channel_args , nullptr ) ; <nl> } <nl> bool Server : : Start ( ServerCompletionQueue * * cqs , size_t num_cqs ) { <nl> started_ = true ; <nl> grpc_server_start ( server_ ) ; <nl> <nl> - / / Only create default health check service when user did not provide an <nl> - / / explicit one . <nl> - if ( health_check_service_ = = nullptr & & ! health_check_service_disabled_ & & <nl> - EnableDefaultHealthCheckService ( ) ) { <nl> - health_check_service_ . reset ( new DefaultHealthCheckService ) ; <nl> - for ( auto it = sync_req_mgrs_ . begin ( ) ; it ! = sync_req_mgrs_ . end ( ) ; it + + ) { <nl> - ( * it ) - > AddHealthCheckSyncMethod ( ) ; <nl> - } <nl> - <nl> - for ( size_t i = 0 ; i < num_cqs ; i + + ) { <nl> - if ( cqs [ i ] - > IsFrequentlyPolled ( ) ) { <nl> - / / new UnimplementedAsyncRequest ( this , cqs [ i ] ) ; <nl> - } <nl> - } <nl> - } <nl> - <nl> if ( ! has_generic_service_ ) { <nl> for ( auto it = sync_req_mgrs_ . begin ( ) ; it ! = sync_req_mgrs_ . end ( ) ; it + + ) { <nl> ( * it ) - > AddUnknownSyncMethod ( ) ; <nl> mmm a / tools / doxygen / Doxyfile . c + + . internal <nl> ppp b / tools / doxygen / Doxyfile . c + + . internal <nl> src / cpp / common / channel_arguments . cc \ <nl> src / cpp / common / channel_filter . cc \ <nl> src / cpp / common / completion_queue_cc . cc \ <nl> src / cpp / common / core_codegen . cc \ <nl> - src / cpp / common / health_check_service_server_builder_option . cc \ <nl> src / cpp / common / resource_quota_cc . cc \ <nl> src / cpp / common / rpc_method . cc \ <nl> src / cpp / common / version_cc . cc \ <nl> src / cpp / server / create_default_thread_pool . cc \ <nl> src / cpp / server / default_health_check_service . cc \ <nl> src / cpp / server / dynamic_thread_pool . cc \ <nl> src / cpp / server / health_check_service . cc \ <nl> + src / cpp / server / health_check_service_server_builder_option . cc \ <nl> src / cpp / server / server_builder . cc \ <nl> src / cpp / server / server_cc . cc \ <nl> src / cpp / server / server_context . cc \ <nl> mmm a / tools / run_tests / generated / sources_and_headers . json <nl> ppp b / tools / run_tests / generated / sources_and_headers . json <nl> <nl> " src / cpp / common / channel_filter . h " , <nl> " src / cpp / common / completion_queue_cc . cc " , <nl> " src / cpp / common / core_codegen . cc " , <nl> - " src / cpp / common / health_check_service_server_builder_option . cc " , <nl> " src / cpp / common / resource_quota_cc . cc " , <nl> " src / cpp / common / rpc_method . cc " , <nl> " src / cpp / common / version_cc . cc " , <nl> <nl> " src / cpp / server / dynamic_thread_pool . cc " , <nl> " src / cpp / server / dynamic_thread_pool . h " , <nl> " src / cpp / server / health_check_service . cc " , <nl> + " src / cpp / server / health_check_service_server_builder_option . cc " , <nl> " src / cpp / server / server_builder . cc " , <nl> " src / cpp / server / server_cc . cc " , <nl> " src / cpp / server / server_context . cc " , <nl> mmm a / vsprojects / vcxproj / grpc + + / grpc + + . vcxproj <nl> ppp b / vsprojects / vcxproj / grpc + + / grpc + + . vcxproj <nl> <nl> < / ClCompile > <nl> < ClCompile Include = " $ ( SolutionDir ) \ . . \ src \ cpp \ common \ core_codegen . cc " > <nl> < / ClCompile > <nl> - < ClCompile Include = " $ ( SolutionDir ) \ . . \ src \ cpp \ common \ health_check_service_server_builder_option . cc " > <nl> - < / ClCompile > <nl> < ClCompile Include = " $ ( SolutionDir ) \ . . \ src \ cpp \ common \ resource_quota_cc . cc " > <nl> < / ClCompile > <nl> < ClCompile Include = " $ ( SolutionDir ) \ . . \ src \ cpp \ common \ rpc_method . cc " > <nl> <nl> < / ClCompile > <nl> < ClCompile Include = " $ ( SolutionDir ) \ . . \ src \ cpp \ server \ health_check_service . cc " > <nl> < / ClCompile > <nl> + < ClCompile Include = " $ ( SolutionDir ) \ . . \ src \ cpp \ server \ health_check_service_server_builder_option . cc " > <nl> + < / ClCompile > <nl> < ClCompile Include = " $ ( SolutionDir ) \ . . \ src \ cpp \ server \ server_builder . cc " > <nl> < / ClCompile > <nl> < ClCompile Include = " $ ( SolutionDir ) \ . . \ src \ cpp \ server \ server_cc . cc " > <nl> mmm a / vsprojects / vcxproj / grpc + + / grpc + + . vcxproj . filters <nl> ppp b / vsprojects / vcxproj / grpc + + / grpc + + . vcxproj . filters <nl> <nl> < ClCompile Include = " $ ( SolutionDir ) \ . . \ src \ cpp \ common \ core_codegen . cc " > <nl> < Filter > src \ cpp \ common < / Filter > <nl> < / ClCompile > <nl> - < ClCompile Include = " $ ( SolutionDir ) \ . . \ src \ cpp \ common \ health_check_service_server_builder_option . cc " > <nl> - < Filter > src \ cpp \ common < / Filter > <nl> - < / ClCompile > <nl> < ClCompile Include = " $ ( SolutionDir ) \ . . \ src \ cpp \ common \ resource_quota_cc . cc " > <nl> < Filter > src \ cpp \ common < / Filter > <nl> < / ClCompile > <nl> <nl> < ClCompile Include = " $ ( SolutionDir ) \ . . \ src \ cpp \ server \ health_check_service . cc " > <nl> < Filter > src \ cpp \ server < / Filter > <nl> < / ClCompile > <nl> + < ClCompile Include = " $ ( SolutionDir ) \ . . \ src \ cpp \ server \ health_check_service_server_builder_option . cc " > <nl> + < Filter > src \ cpp \ server < / Filter > <nl> + < / ClCompile > <nl> < ClCompile Include = " $ ( SolutionDir ) \ . . \ src \ cpp \ server \ server_builder . cc " > <nl> < Filter > src \ cpp \ server < / Filter > <nl> < / ClCompile > <nl> mmm a / vsprojects / vcxproj / grpc + + _unsecure / grpc + + _unsecure . vcxproj <nl> ppp b / vsprojects / vcxproj / grpc + + _unsecure / grpc + + _unsecure . vcxproj <nl> <nl> < / ClCompile > <nl> < ClCompile Include = " $ ( SolutionDir ) \ . . \ src \ cpp \ common \ core_codegen . cc " > <nl> < / ClCompile > <nl> - < ClCompile Include = " $ ( SolutionDir ) \ . . \ src \ cpp \ common \ health_check_service_server_builder_option . cc " > <nl> - < / ClCompile > <nl> < ClCompile Include = " $ ( SolutionDir ) \ . . \ src \ cpp \ common \ resource_quota_cc . cc " > <nl> < / ClCompile > <nl> < ClCompile Include = " $ ( SolutionDir ) \ . . \ src \ cpp \ common \ rpc_method . cc " > <nl> <nl> < / ClCompile > <nl> < ClCompile Include = " $ ( SolutionDir ) \ . . \ src \ cpp \ server \ health_check_service . cc " > <nl> < / ClCompile > <nl> + < ClCompile Include = " $ ( SolutionDir ) \ . . \ src \ cpp \ server \ health_check_service_server_builder_option . cc " > <nl> + < / ClCompile > <nl> < ClCompile Include = " $ ( SolutionDir ) \ . . \ src \ cpp \ server \ server_builder . cc " > <nl> < / ClCompile > <nl> < ClCompile Include = " $ ( SolutionDir ) \ . . \ src \ cpp \ server \ server_cc . cc " > <nl> mmm a / vsprojects / vcxproj / grpc + + _unsecure / grpc + + _unsecure . vcxproj . filters <nl> ppp b / vsprojects / vcxproj / grpc + + _unsecure / grpc + + _unsecure . vcxproj . filters <nl> <nl> < ClCompile Include = " $ ( SolutionDir ) \ . . \ src \ cpp \ common \ core_codegen . cc " > <nl> < Filter > src \ cpp \ common < / Filter > <nl> < / ClCompile > <nl> - < ClCompile Include = " $ ( SolutionDir ) \ . . \ src \ cpp \ common \ health_check_service_server_builder_option . cc " > <nl> - < Filter > src \ cpp \ common < / Filter > <nl> - < / ClCompile > <nl> < ClCompile Include = " $ ( SolutionDir ) \ . . \ src \ cpp \ common \ resource_quota_cc . cc " > <nl> < Filter > src \ cpp \ common < / Filter > <nl> < / ClCompile > <nl> <nl> < ClCompile Include = " $ ( SolutionDir ) \ . . \ src \ cpp \ server \ health_check_service . cc " > <nl> < Filter > src \ cpp \ server < / Filter > <nl> < / ClCompile > <nl> + < ClCompile Include = " $ ( SolutionDir ) \ . . \ src \ cpp \ server \ health_check_service_server_builder_option . cc " > <nl> + < Filter > src \ cpp \ server < / Filter > <nl> + < / ClCompile > <nl> < ClCompile Include = " $ ( SolutionDir ) \ . . \ src \ cpp \ server \ server_builder . cc " > <nl> < Filter > src \ cpp \ server < / Filter > <nl> < / ClCompile > <nl>
more
grpc/grpc
c9d2954e556db3f102a858d97e339edb9db0388c
2016-12-27T23:37:59Z
mmm a / xbmc / addons / Scraper . cpp <nl> ppp b / xbmc / addons / Scraper . cpp <nl> std : : vector < CScraperUrl > CScraper : : FindMovie ( XFILE : : CCurlFile & fcurl , const CStd <nl> <nl> / / we need to sort if returned results don ' t specify ' sorted = " yes " ' <nl> if ( fSort ) <nl> - fSort = ! StringUtils : : EqualsNoCase ( xhResults . Element ( ) - > Attribute ( " sorted " ) , " yes " ) ; <nl> + { <nl> + const char * sorted = xhResults . Element ( ) - > Attribute ( " sorted " ) ; <nl> + if ( sorted ! = NULL ) <nl> + fSort = ! StringUtils : : EqualsNoCase ( sorted , " yes " ) ; <nl> + } <nl> <nl> for ( TiXmlElement * pxeMovie = xhResults . FirstChild ( " entity " ) . Element ( ) ; <nl> pxeMovie ; pxeMovie = pxeMovie - > NextSiblingElement ( ) ) <nl>
fix : CScraper : check for TiXmlElement NULL return to not pass NULL to StringUtils : : EqualsNoCase ( ) , fixes SIGSEGV crash
xbmc/xbmc
a20bd74949e812d769cb3b231ecf1bd4a4810bc7
2013-11-14T21:40:25Z
mmm a / Marlin / src / HAL / HAL_AVR / pinsDebug . h <nl> ppp b / Marlin / src / HAL / HAL_AVR / pinsDebug . h <nl> static void pwm_details ( uint8_t pin ) { <nl> <nl> # endif <nl> <nl> - # define PRINT_PIN ( p ) do { sprintf_P ( buffer , PSTR ( " % 3d " ) , p ) ; SERIAL_ECHO ( buffer ) ; } while ( 0 ) <nl> + # define PRINT_PIN ( p ) do { sprintf_P ( buffer , PSTR ( " % 3d " ) , p ) ; SERIAL_ECHO ( buffer ) ; } while ( 0 ) <nl> mmm a / Marlin / src / HAL / HAL_DUE / pinsDebug . h <nl> ppp b / Marlin / src / HAL / HAL_DUE / pinsDebug . h <nl> <nl> # define digitalRead_mod ( p ) extDigitalRead ( p ) / / AVR digitalRead disabled PWM before it read the pin <nl> # define PRINT_PORT ( p ) <nl> # define NAME_FORMAT ( p ) PSTR ( " % - # # p # # s " ) <nl> - # define PRINT_ARRAY_NAME ( x ) do { sprintf_P ( buffer , PSTR ( " % - " STRINGIFY ( MAX_NAME_LENGTH ) " s " ) , pin_array [ x ] . name ) ; SERIAL_ECHO ( buffer ) ; } while ( 0 ) <nl> - # define PRINT_PIN ( p ) do { sprintf_P ( buffer , PSTR ( " % 02d " ) , p ) ; SERIAL_ECHO ( buffer ) ; } while ( 0 ) <nl> + # define PRINT_ARRAY_NAME ( x ) do { sprintf_P ( buffer , PSTR ( " % - " STRINGIFY ( MAX_NAME_LENGTH ) " s " ) , pin_array [ x ] . name ) ; SERIAL_ECHO ( buffer ) ; } while ( 0 ) <nl> + # define PRINT_PIN ( p ) do { sprintf_P ( buffer , PSTR ( " % 02d " ) , p ) ; SERIAL_ECHO ( buffer ) ; } while ( 0 ) <nl> # define GET_ARRAY_PIN ( p ) pin_array [ p ] . pin <nl> # define GET_ARRAY_IS_DIGITAL ( p ) pin_array [ p ] . is_digital <nl> # define VALID_PIN ( pin ) ( pin > = 0 & & pin < ( int8_t ) NUMBER_PINS_TOTAL ? 1 : 0 ) <nl> mmm a / Marlin / src / HAL / HAL_LINUX / pinsDebug . h <nl> ppp b / Marlin / src / HAL / HAL_LINUX / pinsDebug . h <nl> <nl> # define PRINT_PORT ( p ) <nl> # define GET_ARRAY_PIN ( p ) pin_array [ p ] . pin <nl> # define NAME_FORMAT ( p ) PSTR ( " % - # # p # # s " ) <nl> - # define PRINT_ARRAY_NAME ( x ) do { sprintf_P ( buffer , PSTR ( " % - " STRINGIFY ( MAX_NAME_LENGTH ) " s " ) , pin_array [ x ] . name ) ; SERIAL_ECHO ( buffer ) ; } while ( 0 ) <nl> - # define PRINT_PIN ( p ) do { sprintf_P ( buffer , PSTR ( " % 3d " ) , p ) ; SERIAL_ECHO ( buffer ) ; } while ( 0 ) <nl> + # define PRINT_ARRAY_NAME ( x ) do { sprintf_P ( buffer , PSTR ( " % - " STRINGIFY ( MAX_NAME_LENGTH ) " s " ) , pin_array [ x ] . name ) ; SERIAL_ECHO ( buffer ) ; } while ( 0 ) <nl> + # define PRINT_PIN ( p ) do { sprintf_P ( buffer , PSTR ( " % 3d " ) , p ) ; SERIAL_ECHO ( buffer ) ; } while ( 0 ) <nl> # define MULTI_NAME_PAD 16 / / space needed to be pretty if not first name assigned to a pin <nl> <nl> / / active ADC function / mode / code values for PINSEL registers <nl> mmm a / Marlin / src / HAL / HAL_LPC1768 / pinsDebug . h <nl> ppp b / Marlin / src / HAL / HAL_LPC1768 / pinsDebug . h <nl> <nl> # define PRINT_PORT ( p ) <nl> # define GET_ARRAY_PIN ( p ) pin_array [ p ] . pin <nl> # define NAME_FORMAT ( p ) PSTR ( " % - # # p # # s " ) <nl> - # define PRINT_ARRAY_NAME ( x ) do { sprintf_P ( buffer , PSTR ( " % - " STRINGIFY ( MAX_NAME_LENGTH ) " s " ) , pin_array [ x ] . name ) ; SERIAL_ECHO ( buffer ) ; } while ( 0 ) <nl> - # define PRINT_PIN ( p ) do { sprintf_P ( buffer , PSTR ( " % d . % 02d " ) , LPC1768_PIN_PORT ( p ) , LPC1768_PIN_PIN ( p ) ) ; SERIAL_ECHO ( buffer ) ; } while ( 0 ) <nl> + # define PRINT_ARRAY_NAME ( x ) do { sprintf_P ( buffer , PSTR ( " % - " STRINGIFY ( MAX_NAME_LENGTH ) " s " ) , pin_array [ x ] . name ) ; SERIAL_ECHO ( buffer ) ; } while ( 0 ) <nl> + # define PRINT_PIN ( p ) do { sprintf_P ( buffer , PSTR ( " % d . % 02d " ) , LPC1768_PIN_PORT ( p ) , LPC1768_PIN_PIN ( p ) ) ; SERIAL_ECHO ( buffer ) ; } while ( 0 ) <nl> # define MULTI_NAME_PAD 16 / / space needed to be pretty if not first name assigned to a pin <nl> <nl> / / pins that will cause hang / reset / disconnect in M43 Toggle and Watch utilities <nl> mmm a / Marlin / src / HAL / HAL_STM32 / pinsDebug . h <nl> ppp b / Marlin / src / HAL / HAL_STM32 / pinsDebug . h <nl> @ @ - 1 + 1 , 34 @ @ <nl> - # error " PINS_DEBUGGING is not yet supported for STM32 ! " <nl> + / * * <nl> + * Marlin 3D Printer Firmware <nl> + * Copyright ( c ) 2019 MarlinFirmware [ https : / / github . com / MarlinFirmware / Marlin ] <nl> + * <nl> + * This program is free software : you can redistribute it and / or modify <nl> + * it under the terms of the GNU General Public License as published by <nl> + * the Free Software Foundation , either version 3 of the License , or <nl> + * ( at your option ) any later version . <nl> + * <nl> + * This program is distributed in the hope that it will be useful , <nl> + * but WITHOUT ANY WARRANTY ; without even the implied warranty of <nl> + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE . See the <nl> + * GNU General Public License for more details . <nl> + * <nl> + * You should have received a copy of the GNU General Public License <nl> + * along with this program . If not , see < http : / / www . gnu . org / licenses / > . <nl> + * <nl> + * / <nl> + # pragma once <nl> + <nl> + # if ! ( defined ( NUM_DIGITAL_PINS ) | | defined ( BOARD_NR_GPIO_PINS ) ) <nl> + # error " M43 not supported for this board " <nl> + # endif <nl> + <nl> + / / Strange - STM32F4 comes to HAL_STM32 rather than HAL_STM32F4 for these files <nl> + # ifdef STM32F4 <nl> + # ifdef NUM_DIGITAL_PINS / / Only in ST ' s Arduino core ( STM32duino , STM32Core ) <nl> + # include " pinsDebug_STM32duino . h " <nl> + # elif defined ( BOARD_NR_GPIO_PINS ) / / Only in STM32GENERIC ( Maple ) <nl> + # include " pinsDebug_STM32GENERIC . h " <nl> + # else <nl> + # error " M43 not supported for this board " <nl> + # endif <nl> + # endif <nl> new file mode 100644 <nl> index 00000000000 . . a323f7366b7 <nl> mmm / dev / null <nl> ppp b / Marlin / src / HAL / HAL_STM32 / pinsDebug_STM32GENERIC . h <nl> <nl> + / * * <nl> + * Marlin 3D Printer Firmware <nl> + * Copyright ( C ) 2019 MarlinFirmware [ https : / / github . com / MarlinFirmware / Marlin ] <nl> + * <nl> + * This program is free software : you can redistribute it and / or modify <nl> + * it under the terms of the GNU General Public License as published by <nl> + * the Free Software Foundation , either version 3 of the License , or <nl> + * ( at your option ) any later version . <nl> + * <nl> + * This program is distributed in the hope that it will be useful , <nl> + * but WITHOUT ANY WARRANTY ; without even the implied warranty of <nl> + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE . See the <nl> + * GNU General Public License for more details . <nl> + * <nl> + * You should have received a copy of the GNU General Public License <nl> + * along with this program . If not , see < http : / / www . gnu . org / licenses / > . <nl> + * <nl> + * / <nl> + # pragma once <nl> + <nl> + / * * <nl> + * Support routines for STM32GENERIC ( Maple ) <nl> + * / <nl> + <nl> + / * * <nl> + * Translation of routines & variables used by pinsDebug . h <nl> + * / <nl> + <nl> + # ifdef BOARD_NR_GPIO_PINS / / Only in STM32GENERIC ( Maple ) <nl> + <nl> + # ifdef __STM32F1__ <nl> + # include " . . / HAL_STM32F1 / fastio_STM32F1 . h " <nl> + # elif defined ( STM32F4 ) <nl> + # include " . . / HAL_STM32F4 / fastio_STM32F4 . h " <nl> + # elif defined ( STM32F7 ) <nl> + # include " . . / HAL_STM32F7 / fastio_STM32F7 . h " <nl> + # endif <nl> + <nl> + extern const stm32_pin_info PIN_MAP [ BOARD_NR_GPIO_PINS ] ; <nl> + <nl> + # define NUM_DIGITAL_PINS BOARD_NR_GPIO_PINS <nl> + # define NUMBER_PINS_TOTAL BOARD_NR_GPIO_PINS <nl> + # define VALID_PIN ( pin ) ( pin > = 0 & & pin < BOARD_NR_GPIO_PINS ) <nl> + # define GET_ARRAY_PIN ( p ) pin_t ( pin_array [ p ] . pin ) <nl> + # define pwm_status ( pin ) PWM_PIN ( pin ) <nl> + # define digitalRead_mod ( p ) extDigitalRead ( p ) <nl> + # define NAME_FORMAT ( p ) PSTR ( " % - # # p # # s " ) <nl> + # define PRINT_PIN ( p ) do { sprintf_P ( buffer , PSTR ( " % 3hd " ) , int16_t ( p ) ) ; SERIAL_ECHO ( buffer ) ; } while ( 0 ) <nl> + # define PRINT_PORT ( p ) print_port ( p ) <nl> + # define PRINT_ARRAY_NAME ( x ) do { sprintf_P ( buffer , PSTR ( " % - " STRINGIFY ( MAX_NAME_LENGTH ) " s " ) , pin_array [ x ] . name ) ; SERIAL_ECHO ( buffer ) ; } while ( 0 ) <nl> + # define MULTI_NAME_PAD 20 / / space needed to be pretty if not first name assigned to a pin <nl> + <nl> + / / pins that will cause hang / reset / disconnect in M43 Toggle and Watch utilities <nl> + # ifndef M43_NEVER_TOUCH <nl> + # define M43_NEVER_TOUCH ( Q ) ( Q > = 9 & & Q < = 12 ) / / SERIAL / USB pins PA9 ( TX ) PA10 ( RX ) <nl> + # endif <nl> + <nl> + static inline int8_t get_pin_mode ( pin_t pin ) { <nl> + return VALID_PIN ( pin ) ? _GET_MODE ( pin ) : - 1 ; <nl> + } <nl> + <nl> + static inline pin_t DIGITAL_PIN_TO_ANALOG_PIN ( pin_t pin ) { <nl> + if ( ! VALID_PIN ( pin ) ) return - 1 ; <nl> + int8_t adc_channel = int8_t ( PIN_MAP [ pin ] . adc_channel ) ; <nl> + # ifdef NUM_ANALOG_INPUTS <nl> + if ( adc_channel > = NUM_ANALOG_INPUTS ) adc_channel = ADCx ; <nl> + # endif <nl> + return pin_t ( adc_channel ) ; <nl> + } <nl> + <nl> + static inline bool IS_ANALOG ( pin_t pin ) { <nl> + if ( ! VALID_PIN ( pin ) ) return false ; <nl> + if ( PIN_MAP [ pin ] . adc_channel ! = ADCx ) { <nl> + # ifdef NUM_ANALOG_INPUTS <nl> + if ( PIN_MAP [ pin ] . adc_channel > = NUM_ANALOG_INPUTS ) return false ; <nl> + # endif <nl> + return _GET_MODE ( pin ) = = GPIO_INPUT_ANALOG & & ! M43_NEVER_TOUCH ( pin ) ; <nl> + } <nl> + return false ; <nl> + } <nl> + <nl> + static inline bool GET_PINMODE ( const pin_t pin ) { <nl> + return VALID_PIN ( pin ) & & ! IS_INPUT ( pin ) ; <nl> + } <nl> + <nl> + static inline bool GET_ARRAY_IS_DIGITAL ( const int16_t array_pin ) { <nl> + const pin_t pin = GET_ARRAY_PIN ( array_pin ) ; <nl> + return ( ! IS_ANALOG ( pin ) <nl> + # ifdef NUM_ANALOG_INPUTS <nl> + | | PIN_MAP [ pin ] . adc_channel > = NUM_ANALOG_INPUTS <nl> + # endif <nl> + ) ; <nl> + } <nl> + <nl> + static inline void pwm_details ( const pin_t pin ) { <nl> + if ( PWM_PIN ( pin ) ) { <nl> + timer_dev * const tdev = PIN_MAP [ pin ] . timer_device ; <nl> + const uint8_t channel = PIN_MAP [ pin ] . timer_channel ; <nl> + const char num = ( <nl> + # ifdef STM32_HIGH_DENSITY <nl> + tdev = = & timer8 ? ' 8 ' : <nl> + tdev = = & timer5 ? ' 5 ' : <nl> + # endif <nl> + tdev = = & timer4 ? ' 4 ' : <nl> + tdev = = & timer3 ? ' 3 ' : <nl> + tdev = = & timer2 ? ' 2 ' : <nl> + tdev = = & timer1 ? ' 1 ' : ' ? ' <nl> + ) ; <nl> + char buffer [ 10 ] ; <nl> + sprintf_P ( buffer , PSTR ( " TIM % c CH % c " ) , num , ( ' 0 ' + channel ) ) ; <nl> + SERIAL_ECHO ( buffer ) ; <nl> + } <nl> + } <nl> + <nl> + static inline void print_port ( pin_t pin ) { <nl> + const char port = ' A ' + char ( pin > > 4 ) ; / / pin div 16 <nl> + / * seems not to be required for our devices <nl> + gpio_dev * const gp = PIN_MAP [ pin ] . gpio_device ; <nl> + const char port = ( <nl> + # if STM32_NR_GPIO_PORTS > 4 <nl> + gp = = & gpiog ? ' G ' : <nl> + gp = = & gpiof ? ' F ' : <nl> + gp = = & gpioe ? ' E ' : <nl> + # endif <nl> + gp = = & gpiod ? ' D ' : <nl> + gp = = & gpioc ? ' C ' : <nl> + gp = = & gpiob ? ' B ' : <nl> + gp = = & gpioa ? ' A ' : ' ? ' <nl> + ) ; <nl> + * / <nl> + const int16_t gbit = PIN_MAP [ pin ] . gpio_bit ; <nl> + char buffer [ 6 ] ; <nl> + sprintf_P ( buffer , PSTR ( " P % c % hd " ) , port , gbit ) ; <nl> + if ( gbit < 10 ) SERIAL_CHAR ( ' ' ) ; <nl> + SERIAL_ECHO ( buffer ) ; <nl> + } <nl> + <nl> + # endif / / BOARD_NR_GPIO_PINS <nl> new file mode 100644 <nl> index 00000000000 . . 2e003ea567c <nl> mmm / dev / null <nl> ppp b / Marlin / src / HAL / HAL_STM32 / pinsDebug_STM32duino . h <nl> <nl> + / * * <nl> + * Marlin 3D Printer Firmware <nl> + * Copyright ( C ) 2019 MarlinFirmware [ https : / / github . com / MarlinFirmware / Marlin ] <nl> + * <nl> + * This program is free software : you can redistribute it and / or modify <nl> + * it under the terms of the GNU General Public License as published by <nl> + * the Free Software Foundation , either version 3 of the License , or <nl> + * ( at your option ) any later version . <nl> + * <nl> + * This program is distributed in the hope that it will be useful , <nl> + * but WITHOUT ANY WARRANTY ; without even the implied warranty of <nl> + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE . See the <nl> + * GNU General Public License for more details . <nl> + * <nl> + * You should have received a copy of the GNU General Public License <nl> + * along with this program . If not , see < http : / / www . gnu . org / licenses / > . <nl> + * <nl> + * / <nl> + # pragma once <nl> + <nl> + # include < Arduino . h > <nl> + <nl> + # ifdef NUM_DIGITAL_PINS / / Only in ST ' s Arduino core ( STM32duino , STM32Core ) <nl> + <nl> + / * * <nl> + * Life gets complicated if you want an easy to use ' M43 I ' output ( in port / pin order ) <nl> + * because the variants in this platform do not always define all the I / O port / pins <nl> + * that a CPU has . <nl> + * <nl> + * VARIABLES : <nl> + * Ard_num - Arduino pin number - defined by the platform . It is used by digitalRead and <nl> + * digitalWrite commands and by M42 . <nl> + * - does not contain port / pin info <nl> + * - is not in port / pin order <nl> + * - typically a variant will only assign Ard_num to port / pins that are actually used <nl> + * Index - M43 counter - only used to get Ard_num <nl> + * x - a parameter / argument used to search the pin_array to try to find a signal name <nl> + * associated with a Ard_num <nl> + * Port_pin - port number and pin number for use with CPU registers and printing reports <nl> + * <nl> + * Since M43 uses digitalRead and digitalWrite commands , only the Port_pins with an Ard_num <nl> + * are accessed and / or displayed . <nl> + * <nl> + * Three arrays are used . <nl> + * <nl> + * digitalPin [ ] is provided by the platform . It consists of the Port_pin numbers in <nl> + * Arduino pin number order . <nl> + * <nl> + * pin_array is a structure generated by the pins / pinsDebug . h header file . It is generated by <nl> + * the preprocessor . Only the signals associated with enabled options are in this table . <nl> + * It contains : <nl> + * - name of the signal <nl> + * - the Ard_num assigned by the pins_YOUR_BOARD . h file using the platform defines . <nl> + * EXAMPLE : " # define KILL_PIN PB1 " results in Ard_num of 57 . 57 is then used as an <nl> + * index into digitalPin [ ] to get the Port_pin number <nl> + * - if it is a digital or analog signal . PWMs are considered digital here . <nl> + * <nl> + * pin_xref is a structure generated by this header file . It is generated by the <nl> + * preprocessor . It is in port / pin order . It contains just the port / pin numbers defined by the <nl> + * platform for this variant . <nl> + * - Ard_num <nl> + * - printable version of Port_pin <nl> + * <nl> + * Routines with an " x " as a parameter / argument are used to search the pin_array to try to <nl> + * find a signal name associated with a port / pin . <nl> + * <nl> + * NOTE - the Arduino pin number is what is used by the M42 command , NOT the port / pin for that <nl> + * signal . The Arduino pin number is listed by the M43 I command . <nl> + * / <nl> + <nl> + extern const PinName digitalPin [ ] ; / / provided by the platform <nl> + <nl> + / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / <nl> + / / <nl> + / / make a list of the Arduino pin numbers in the Port / Pin order <nl> + / / <nl> + <nl> + # define _PIN_ADD_2 ( NAME_ALPHA , ARDUINO_NUM ) { { NAME_ALPHA } , ARDUINO_NUM } , <nl> + # define _PIN_ADD ( NAME_ALPHA , ARDUINO_NUM ) { NAME_ALPHA , ARDUINO_NUM } , <nl> + # define PIN_ADD ( NAME ) _PIN_ADD ( # NAME , NAME ) <nl> + <nl> + typedef struct { <nl> + char Port_pin_alpha [ 5 ] ; <nl> + pin_t Ard_num ; <nl> + } XrefInfo ; <nl> + <nl> + const XrefInfo pin_xref [ ] PROGMEM = { <nl> + # include " pins_Xref . h " <nl> + } ; <nl> + <nl> + / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / <nl> + <nl> + # define MODE_PIN_INPUT 0 / / Input mode ( reset state ) <nl> + # define MODE_PIN_OUTPUT 1 / / General purpose output mode <nl> + # define MODE_PIN_ALT 2 / / Alternate function mode <nl> + # define MODE_PIN_ANALOG 3 / / Analog mode <nl> + <nl> + # define PIN_NUM ( P ) ( P & 0x000F ) <nl> + # define PIN_NUM_ALPHA_LEFT ( P ) ( ( ( P & 0x000F ) < 10 ) ? ( ' 0 ' + ( P & 0x000F ) ) : ' 1 ' ) <nl> + # define PIN_NUM_ALPHA_RIGHT ( P ) ( ( ( P & 0x000F ) > 9 ) ? ( ' 0 ' + ( P & 0x000F ) - 10 ) : 0 ) <nl> + # define PORT_NUM ( P ) ( ( P > > 4 ) & 0x0007 ) <nl> + # define PORT_ALPHA ( P ) ( ' A ' + ( P > > 4 ) ) <nl> + <nl> + / * * <nl> + * Translation of routines & variables used by pinsDebug . h <nl> + * / <nl> + # define NUMBER_PINS_TOTAL NUM_DIGITAL_PINS <nl> + # define VALID_PIN ( ANUM ) ( ( ANUM ) > = 0 & & ( ANUM ) < NUMBER_PINS_TOTAL ) <nl> + # define digitalRead_mod ( Ard_num ) extDigitalRead ( Ard_num ) / / must use Arduino pin numbers when doing reads <nl> + # define NAME_FORMAT ( p ) PSTR ( " % - # # p # # s " ) <nl> + # define PRINT_PIN ( Q ) <nl> + # define PRINT_PORT ( ANUM ) port_print ( ANUM ) <nl> + # define DIGITAL_PIN_TO_ANALOG_PIN ( ANUM ) - 1 / / will report analog pin number in the print port routine <nl> + # define GET_PIN_MAP_PIN_M43 ( Index ) pin_xref [ Index ] . Ard_num <nl> + <nl> + / / x is a variable used to search pin_array <nl> + # define GET_ARRAY_IS_DIGITAL ( x ) ( ( bool ) pin_array [ x ] . is_digital ) <nl> + # define GET_ARRAY_PIN ( x ) ( ( pin_t ) pin_array [ x ] . pin ) <nl> + # define PRINT_ARRAY_NAME ( x ) do { sprintf_P ( buffer , PSTR ( " % - " STRINGIFY ( MAX_NAME_LENGTH ) " s " ) , pin_array [ x ] . name ) ; SERIAL_ECHO ( buffer ) ; } while ( 0 ) <nl> + # define MULTI_NAME_PAD 33 / / space needed to be pretty if not first name assigned to a pin <nl> + <nl> + # ifndef M43_NEVER_TOUCH <nl> + # define _M43_NEVER_TOUCH ( Index ) ( Index > = 9 & & Index < = 12 ) / / SERIAL / USB pins : PA9 ( TX ) PA10 ( RX ) PA11 ( USB_DM ) PA12 ( USB_DP ) <nl> + # ifdef KILL_PIN <nl> + # define M43_NEVER_TOUCH ( Index ) m43_never_touch ( Index ) <nl> + <nl> + bool m43_never_touch ( const pin_t Index ) { <nl> + static pin_t M43_kill_index = - 1 ; <nl> + if ( M43_kill_index < 0 ) <nl> + for ( M43_kill_index = 0 ; M43_kill_index < NUMBER_PINS_TOTAL ; M43_kill_index + + ) <nl> + if ( KILL_PIN = = GET_PIN_MAP_PIN_M43 ( M43_kill_index ) ) break ; <nl> + return _M43_NEVER_TOUCH ( Index ) | | Index = = M43_kill_index ; / / KILL_PIN and SERIAL / USB <nl> + } <nl> + # else <nl> + # define M43_NEVER_TOUCH ( Index ) _M43_NEVER_TOUCH ( Index ) <nl> + # endif <nl> + # endif <nl> + <nl> + uint8_t get_pin_mode ( const pin_t Ard_num ) { <nl> + uint32_t mode_all = 0 ; <nl> + const PinName dp = digitalPin [ Ard_num ] ; <nl> + switch ( PORT_ALPHA ( dp ) ) { <nl> + case ' A ' : mode_all = GPIOA - > MODER ; break ; <nl> + case ' B ' : mode_all = GPIOB - > MODER ; break ; <nl> + case ' C ' : mode_all = GPIOC - > MODER ; break ; <nl> + case ' D ' : mode_all = GPIOD - > MODER ; break ; <nl> + # ifdef PE_0 <nl> + case ' E ' : mode_all = GPIOE - > MODER ; break ; <nl> + # elif defined ( PF_0 ) <nl> + case ' F ' : mode_all = GPIOF - > MODER ; break ; <nl> + # elif defined ( PG_0 ) <nl> + case ' G ' : mode_all = GPIOG - > MODER ; break ; <nl> + # elif defined ( PH_0 ) <nl> + case ' H ' : mode_all = GPIOH - > MODER ; break ; <nl> + # elif defined ( PI_0 ) <nl> + case ' I ' : mode_all = GPIOI - > MODER ; break ; <nl> + # elif defined ( PJ_0 ) <nl> + case ' J ' : mode_all = GPIOJ - > MODER ; break ; <nl> + # elif defined ( PK_0 ) <nl> + case ' K ' : mode_all = GPIOK - > MODER ; break ; <nl> + # elif defined ( PL_0 ) <nl> + case ' L ' : mode_all = GPIOL - > MODER ; break ; <nl> + # endif <nl> + } <nl> + return ( mode_all > > ( 2 * uint8_t ( PIN_NUM ( dp ) ) ) ) & 0x03 ; <nl> + } <nl> + <nl> + bool GET_PINMODE ( const pin_t Ard_num ) { <nl> + const uint8_t pin_mode = get_pin_mode ( Ard_num ) ; <nl> + return pin_mode = = MODE_PIN_OUTPUT | | pin_mode = = MODE_PIN_ALT ; / / assume all alt definitions are PWM <nl> + } <nl> + <nl> + int8_t digital_pin_to_analog_pin ( pin_t Ard_num ) { <nl> + Ard_num - = NUM_ANALOG_FIRST ; <nl> + return ( Ard_num > = 0 & & Ard_num < NUM_ANALOG_INPUTS ) ? Ard_num : - 1 ; <nl> + } <nl> + <nl> + bool IS_ANALOG ( const pin_t Ard_num ) { <nl> + return get_pin_mode ( Ard_num ) = = MODE_PIN_ANALOG ; <nl> + } <nl> + <nl> + bool is_digital ( const pin_t x ) { <nl> + const uint8_t pin_mode = get_pin_mode ( pin_array [ x ] . pin ) ; <nl> + return pin_mode = = MODE_PIN_INPUT | | pin_mode = = MODE_PIN_OUTPUT ; <nl> + } <nl> + <nl> + void port_print ( const pin_t Ard_num ) { <nl> + char buffer [ 16 ] ; <nl> + pin_t Index ; <nl> + for ( Index = 0 ; Index < NUMBER_PINS_TOTAL ; Index + + ) <nl> + if ( Ard_num = = GET_PIN_MAP_PIN_M43 ( Index ) ) break ; <nl> + <nl> + char * const ppa = pin_xref [ Index ] . Port_pin_alpha ; <nl> + sprintf_P ( buffer , PSTR ( " % s " ) , ppa ) ; <nl> + SERIAL_ECHO ( buffer ) ; <nl> + if ( ppa [ 3 ] = = ' \ 0 ' ) SERIAL_CHAR ( ' ' ) ; <nl> + <nl> + / / print analog pin number <nl> + const int8_t Port_pin = digital_pin_to_analog_pin ( Ard_num ) ; <nl> + if ( Port_pin > = 0 ) { <nl> + sprintf_P ( buffer , PSTR ( " ( A % d ) " ) , Port_pin ) ; <nl> + SERIAL_ECHO ( buffer ) ; <nl> + if ( Port_pin < 10 ) SERIAL_CHAR ( ' ' ) ; <nl> + } <nl> + else <nl> + SERIAL_ECHO_SP ( 7 ) ; <nl> + <nl> + / / Print number to be used with M42 <nl> + sprintf_P ( buffer , PSTR ( " M42 P % d " ) , Ard_num ) ; <nl> + SERIAL_ECHO ( buffer ) ; <nl> + if ( Ard_num < 10 ) SERIAL_CHAR ( ' ' ) ; <nl> + if ( Ard_num < 100 ) SERIAL_CHAR ( ' ' ) ; <nl> + } <nl> + <nl> + bool pwm_status ( const pin_t Ard_num ) { <nl> + return get_pin_mode ( Ard_num ) = = MODE_PIN_ALT ; <nl> + } <nl> + <nl> + void pwm_details ( const pin_t Ard_num ) { <nl> + if ( pwm_status ( Ard_num ) ) { <nl> + uint32_t alt_all = 0 ; <nl> + const PinName dp = digitalPin [ Ard_num ] ; <nl> + pin_t pin_number = uint8_t ( PIN_NUM ( dp ) ) ; <nl> + const bool over_7 = pin_number > = 8 ; <nl> + const uint8_t ind = over_7 ? 1 : 0 ; <nl> + switch ( PORT_ALPHA ( dp ) ) { / / get alt function <nl> + case ' A ' : alt_all = GPIOA - > AFR [ ind ] ; break ; <nl> + case ' B ' : alt_all = GPIOB - > AFR [ ind ] ; break ; <nl> + case ' C ' : alt_all = GPIOC - > AFR [ ind ] ; break ; <nl> + case ' D ' : alt_all = GPIOD - > AFR [ ind ] ; break ; <nl> + # ifdef PE_0 <nl> + case ' E ' : alt_all = GPIOE - > AFR [ ind ] ; break ; <nl> + # elif defined ( PF_0 ) <nl> + case ' F ' : alt_all = GPIOF - > AFR [ ind ] ; break ; <nl> + # elif defined ( PG_0 ) <nl> + case ' G ' : alt_all = GPIOG - > AFR [ ind ] ; break ; <nl> + # elif defined ( PH_0 ) <nl> + case ' H ' : alt_all = GPIOH - > AFR [ ind ] ; break ; <nl> + # elif defined ( PI_0 ) <nl> + case ' I ' : alt_all = GPIOI - > AFR [ ind ] ; break ; <nl> + # elif defined ( PJ_0 ) <nl> + case ' J ' : alt_all = GPIOJ - > AFR [ ind ] ; break ; <nl> + # elif defined ( PK_0 ) <nl> + case ' K ' : alt_all = GPIOK - > AFR [ ind ] ; break ; <nl> + # elif defined ( PL_0 ) <nl> + case ' L ' : alt_all = GPIOL - > AFR [ ind ] ; break ; <nl> + # endif <nl> + } <nl> + if ( over_7 ) pin_number - = 8 ; <nl> + <nl> + uint8_t alt_func = ( alt_all > > ( 4 * pin_number ) ) & 0x0F ; <nl> + SERIAL_ECHOPAIR ( " Alt Function : " , alt_func ) ; <nl> + if ( alt_func < 10 ) SERIAL_CHAR ( ' ' ) ; <nl> + SERIAL_ECHOPGM ( " - " ) ; <nl> + switch ( alt_func ) { <nl> + case 0 : SERIAL_ECHOPGM ( " system ( misc . I / O ) " ) ; break ; <nl> + case 1 : SERIAL_ECHOPGM ( " TIM1 / TIM2 ( probably PWM ) " ) ; break ; <nl> + case 2 : SERIAL_ECHOPGM ( " TIM3 . . 5 ( probably PWM ) " ) ; break ; <nl> + case 3 : SERIAL_ECHOPGM ( " TIM8 . . 11 ( probably PWM ) " ) ; break ; <nl> + case 4 : SERIAL_ECHOPGM ( " I2C1 . . 3 " ) ; break ; <nl> + case 5 : SERIAL_ECHOPGM ( " SPI1 / SPI2 " ) ; break ; <nl> + case 6 : SERIAL_ECHOPGM ( " SPI3 " ) ; break ; <nl> + case 7 : SERIAL_ECHOPGM ( " USART1 . . 3 " ) ; break ; <nl> + case 8 : SERIAL_ECHOPGM ( " USART4 . . 6 " ) ; break ; <nl> + case 9 : SERIAL_ECHOPGM ( " CAN1 / CAN2 , TIM12 . . 14 ( probably PWM ) " ) ; break ; <nl> + case 10 : SERIAL_ECHOPGM ( " OTG " ) ; break ; <nl> + case 11 : SERIAL_ECHOPGM ( " ETH " ) ; break ; <nl> + case 12 : SERIAL_ECHOPGM ( " FSMC , SDIO , OTG " ) ; break ; <nl> + case 13 : SERIAL_ECHOPGM ( " DCMI " ) ; break ; <nl> + case 14 : SERIAL_ECHOPGM ( " unused ( shouldn ' t see this ) " ) ; break ; <nl> + case 15 : SERIAL_ECHOPGM ( " EVENTOUT " ) ; break ; <nl> + } <nl> + } <nl> + } / / pwm_details <nl> + <nl> + # endif / / NUM_DIGITAL_PINS <nl> new file mode 100644 <nl> index 00000000000 . . 84278c39168 <nl> mmm / dev / null <nl> ppp b / Marlin / src / HAL / HAL_STM32 / pins_Xref . h <nl> <nl> + / * * <nl> + * Marlin 3D Printer Firmware <nl> + * Copyright ( c ) 2019 MarlinFirmware [ https : / / github . com / MarlinFirmware / Marlin ] <nl> + * <nl> + * Based on Sprinter and grbl . <nl> + * Copyright ( c ) 2011 Camiel Gubbels / Erik van der Zalm <nl> + * <nl> + * This program is free software : you can redistribute it and / or modify <nl> + * it under the terms of the GNU General Public License as published by <nl> + * the Free Software Foundation , either version 3 of the License , or <nl> + * ( at your option ) any later version . <nl> + * <nl> + * This program is distributed in the hope that it will be useful , <nl> + * but WITHOUT ANY WARRANTY ; without even the implied warranty of <nl> + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE . See the <nl> + * GNU General Public License for more details . <nl> + * <nl> + * You should have received a copy of the GNU General Public License <nl> + * along with this program . If not , see < http : / / www . gnu . org / licenses / > . <nl> + * <nl> + * / <nl> + <nl> + / / <nl> + / / make a list of the Arduino pin numbers in the Port / Pin order <nl> + / / <nl> + # ifdef PA0 <nl> + PIN_ADD ( PA0 ) <nl> + # endif <nl> + # ifdef PA1 <nl> + PIN_ADD ( PA1 ) <nl> + # endif <nl> + # ifdef PA2 <nl> + PIN_ADD ( PA2 ) <nl> + # endif <nl> + # ifdef PA3 <nl> + PIN_ADD ( PA3 ) <nl> + # endif <nl> + # ifdef PA4 <nl> + PIN_ADD ( PA4 ) <nl> + # endif <nl> + # ifdef PA5 <nl> + PIN_ADD ( PA5 ) <nl> + # endif <nl> + # ifdef PA6 <nl> + PIN_ADD ( PA6 ) <nl> + # endif <nl> + # ifdef PA7 <nl> + PIN_ADD ( PA7 ) <nl> + # endif <nl> + # ifdef PA8 <nl> + PIN_ADD ( PA8 ) <nl> + # endif <nl> + # ifdef PA9 <nl> + PIN_ADD ( PA9 ) <nl> + # endif <nl> + # ifdef PA10 <nl> + PIN_ADD ( PA10 ) <nl> + # endif <nl> + # ifdef PA11 <nl> + PIN_ADD ( PA11 ) <nl> + # endif <nl> + # ifdef PA12 <nl> + PIN_ADD ( PA12 ) <nl> + # endif <nl> + # ifdef PA13 <nl> + PIN_ADD ( PA13 ) <nl> + # endif <nl> + # ifdef PA14 <nl> + PIN_ADD ( PA14 ) <nl> + # endif <nl> + # ifdef PA15 <nl> + PIN_ADD ( PA15 ) <nl> + # endif <nl> + <nl> + # ifdef PB0 <nl> + PIN_ADD ( PB0 ) <nl> + # endif <nl> + # ifdef PB1 <nl> + PIN_ADD ( PB1 ) <nl> + # endif <nl> + # ifdef PB2 <nl> + PIN_ADD ( PB2 ) <nl> + # endif <nl> + # ifdef PB3 <nl> + PIN_ADD ( PB3 ) <nl> + # endif <nl> + # ifdef PB4 <nl> + PIN_ADD ( PB4 ) <nl> + # endif <nl> + # ifdef PB5 <nl> + PIN_ADD ( PB5 ) <nl> + # endif <nl> + # ifdef PB6 <nl> + PIN_ADD ( PB6 ) <nl> + # endif <nl> + # ifdef PB7 <nl> + PIN_ADD ( PB7 ) <nl> + # endif <nl> + # ifdef PB8 <nl> + PIN_ADD ( PB8 ) <nl> + # endif <nl> + # ifdef PB9 <nl> + PIN_ADD ( PB9 ) <nl> + # endif <nl> + # ifdef PB10 <nl> + PIN_ADD ( PB10 ) <nl> + # endif <nl> + # ifdef PB11 <nl> + PIN_ADD ( PB11 ) <nl> + # endif <nl> + # ifdef PB12 <nl> + PIN_ADD ( PB12 ) <nl> + # endif <nl> + # ifdef PB13 <nl> + PIN_ADD ( PB13 ) <nl> + # endif <nl> + # ifdef PB14 <nl> + PIN_ADD ( PB14 ) <nl> + # endif <nl> + # ifdef PB15 <nl> + PIN_ADD ( PB15 ) <nl> + # endif <nl> + <nl> + # ifdef PC0 <nl> + PIN_ADD ( PC0 ) <nl> + # endif <nl> + # ifdef PC1 <nl> + PIN_ADD ( PC1 ) <nl> + # endif <nl> + # ifdef PC2 <nl> + PIN_ADD ( PC2 ) <nl> + # endif <nl> + # ifdef PC3 <nl> + PIN_ADD ( PC3 ) <nl> + # endif <nl> + # ifdef PC4 <nl> + PIN_ADD ( PC4 ) <nl> + # endif <nl> + # ifdef PC5 <nl> + PIN_ADD ( PC5 ) <nl> + # endif <nl> + # ifdef PC6 <nl> + PIN_ADD ( PC6 ) <nl> + # endif <nl> + # ifdef PC7 <nl> + PIN_ADD ( PC7 ) <nl> + # endif <nl> + # ifdef PC8 <nl> + PIN_ADD ( PC8 ) <nl> + # endif <nl> + # ifdef PC9 <nl> + PIN_ADD ( PC9 ) <nl> + # endif <nl> + # ifdef PC10 <nl> + PIN_ADD ( PC10 ) <nl> + # endif <nl> + # ifdef PC11 <nl> + PIN_ADD ( PC11 ) <nl> + # endif <nl> + # ifdef PC12 <nl> + PIN_ADD ( PC12 ) <nl> + # endif <nl> + # ifdef PC13 <nl> + PIN_ADD ( PC13 ) <nl> + # endif <nl> + # ifdef PC14 <nl> + PIN_ADD ( PC14 ) <nl> + # endif <nl> + # ifdef PC15 <nl> + PIN_ADD ( PC15 ) <nl> + # endif <nl> + <nl> + # ifdef PD0 <nl> + PIN_ADD ( PD0 ) <nl> + # endif <nl> + # ifdef PD1 <nl> + PIN_ADD ( PD1 ) <nl> + # endif <nl> + # ifdef PD2 <nl> + PIN_ADD ( PD2 ) <nl> + # endif <nl> + # ifdef PD3 <nl> + PIN_ADD ( PD3 ) <nl> + # endif <nl> + # ifdef PD4 <nl> + PIN_ADD ( PD4 ) <nl> + # endif <nl> + # ifdef PD5 <nl> + PIN_ADD ( PD5 ) <nl> + # endif <nl> + # ifdef PD6 <nl> + PIN_ADD ( PD6 ) <nl> + # endif <nl> + # ifdef PD7 <nl> + PIN_ADD ( PD7 ) <nl> + # endif <nl> + # ifdef PD8 <nl> + PIN_ADD ( PD8 ) <nl> + # endif <nl> + # ifdef PD9 <nl> + PIN_ADD ( PD9 ) <nl> + # endif <nl> + # ifdef PD10 <nl> + PIN_ADD ( PD10 ) <nl> + # endif <nl> + # ifdef PD11 <nl> + PIN_ADD ( PD11 ) <nl> + # endif <nl> + # ifdef PD12 <nl> + PIN_ADD ( PD12 ) <nl> + # endif <nl> + # ifdef PD13 <nl> + PIN_ADD ( PD13 ) <nl> + # endif <nl> + # ifdef PD14 <nl> + PIN_ADD ( PD14 ) <nl> + # endif <nl> + # ifdef PD15 <nl> + PIN_ADD ( PD15 ) <nl> + # endif <nl> + <nl> + # ifdef PE0 <nl> + PIN_ADD ( PE0 ) <nl> + # endif <nl> + # ifdef PE1 <nl> + PIN_ADD ( PE1 ) <nl> + # endif <nl> + # ifdef PE2 <nl> + PIN_ADD ( PE2 ) <nl> + # endif <nl> + # ifdef PE3 <nl> + PIN_ADD ( PE3 ) <nl> + # endif <nl> + # ifdef PE4 <nl> + PIN_ADD ( PE4 ) <nl> + # endif <nl> + # ifdef PE5 <nl> + PIN_ADD ( PE5 ) <nl> + # endif <nl> + # ifdef PE6 <nl> + PIN_ADD ( PE6 ) <nl> + # endif <nl> + # ifdef PE7 <nl> + PIN_ADD ( PE7 ) <nl> + # endif <nl> + # ifdef PE8 <nl> + PIN_ADD ( PE8 ) <nl> + # endif <nl> + # ifdef PE9 <nl> + PIN_ADD ( PE9 ) <nl> + # endif <nl> + # ifdef PE10 <nl> + PIN_ADD ( PE10 ) <nl> + # endif <nl> + # ifdef PE11 <nl> + PIN_ADD ( PE11 ) <nl> + # endif <nl> + # ifdef PE12 <nl> + PIN_ADD ( PE12 ) <nl> + # endif <nl> + # ifdef PE13 <nl> + PIN_ADD ( PE13 ) <nl> + # endif <nl> + # ifdef PE14 <nl> + PIN_ADD ( PE14 ) <nl> + # endif <nl> + # ifdef PE15 <nl> + PIN_ADD ( PE15 ) <nl> + # endif <nl> + <nl> + # ifdef PF0 <nl> + PIN_ADD ( PF0 ) <nl> + # endif <nl> + # ifdef PF1 <nl> + PIN_ADD ( PF1 ) <nl> + # endif <nl> + # ifdef PF2 <nl> + PIN_ADD ( PF2 ) <nl> + # endif <nl> + # ifdef PF3 <nl> + PIN_ADD ( PF3 ) <nl> + # endif <nl> + # ifdef PF4 <nl> + PIN_ADD ( PF4 ) <nl> + # endif <nl> + # ifdef PF5 <nl> + PIN_ADD ( PF5 ) <nl> + # endif <nl> + # ifdef PF6 <nl> + PIN_ADD ( PF6 ) <nl> + # endif <nl> + # ifdef PF7 <nl> + PIN_ADD ( PF7 ) <nl> + # endif <nl> + # ifdef PF8 <nl> + PIN_ADD ( PF8 ) <nl> + # endif <nl> + # ifdef PF9 <nl> + PIN_ADD ( PF9 ) <nl> + # endif <nl> + # ifdef PF10 <nl> + PIN_ADD ( PF10 ) <nl> + # endif <nl> + # ifdef PF11 <nl> + PIN_ADD ( PF11 ) <nl> + # endif <nl> + # ifdef PF12 <nl> + PIN_ADD ( PF12 ) <nl> + # endif <nl> + # ifdef PF13 <nl> + PIN_ADD ( PF13 ) <nl> + # endif <nl> + # ifdef PF14 <nl> + PIN_ADD ( PF14 ) <nl> + # endif <nl> + # ifdef PF15 <nl> + PIN_ADD ( PF15 ) <nl> + # endif <nl> + <nl> + # ifdef PG0 <nl> + PIN_ADD ( PG0 ) <nl> + # endif <nl> + # ifdef PG1 <nl> + PIN_ADD ( PG1 ) <nl> + # endif <nl> + # ifdef PG2 <nl> + PIN_ADD ( PG2 ) <nl> + # endif <nl> + # ifdef PG3 <nl> + PIN_ADD ( PG3 ) <nl> + # endif <nl> + # ifdef PG4 <nl> + PIN_ADD ( PG4 ) <nl> + # endif <nl> + # ifdef PG5 <nl> + PIN_ADD ( PG5 ) <nl> + # endif <nl> + # ifdef PG6 <nl> + PIN_ADD ( PG6 ) <nl> + # endif <nl> + # ifdef PG7 <nl> + PIN_ADD ( PG7 ) <nl> + # endif <nl> + # ifdef PG8 <nl> + PIN_ADD ( PG8 ) <nl> + # endif <nl> + # ifdef PG9 <nl> + PIN_ADD ( PG9 ) <nl> + # endif <nl> + # ifdef PG10 <nl> + PIN_ADD ( PG10 ) <nl> + # endif <nl> + # ifdef PG11 <nl> + PIN_ADD ( PG11 ) <nl> + # endif <nl> + # ifdef PG12 <nl> + PIN_ADD ( PG12 ) <nl> + # endif <nl> + # ifdef PG13 <nl> + PIN_ADD ( PG13 ) <nl> + # endif <nl> + # ifdef PG14 <nl> + PIN_ADD ( PG14 ) <nl> + # endif <nl> + # ifdef PG15 <nl> + PIN_ADD ( PG15 ) <nl> + # endif <nl> + <nl> + # ifdef PH0 <nl> + PIN_ADD ( PH0 ) <nl> + # endif <nl> + # ifdef PH1 <nl> + PIN_ADD ( PH1 ) <nl> + # endif <nl> + # ifdef PH2 <nl> + PIN_ADD ( PH2 ) <nl> + # endif <nl> + # ifdef PH3 <nl> + PIN_ADD ( PH3 ) <nl> + # endif <nl> + # ifdef PH4 <nl> + PIN_ADD ( PH4 ) <nl> + # endif <nl> + # ifdef PH5 <nl> + PIN_ADD ( PH5 ) <nl> + # endif <nl> + # ifdef PH6 <nl> + PIN_ADD ( PH6 ) <nl> + # endif <nl> + # ifdef PH7 <nl> + PIN_ADD ( PH7 ) <nl> + # endif <nl> + # ifdef PH8 <nl> + PIN_ADD ( PH8 ) <nl> + # endif <nl> + # ifdef PH9 <nl> + PIN_ADD ( PH9 ) <nl> + # endif <nl> + # ifdef PH10 <nl> + PIN_ADD ( PH10 ) <nl> + # endif <nl> + # ifdef PH11 <nl> + PIN_ADD ( PH11 ) <nl> + # endif <nl> + # ifdef PH12 <nl> + PIN_ADD ( PH12 ) <nl> + # endif <nl> + # ifdef PH13 <nl> + PIN_ADD ( PH13 ) <nl> + # endif <nl> + # ifdef PH14 <nl> + PIN_ADD ( PH14 ) <nl> + # endif <nl> + # ifdef PH15 <nl> + PIN_ADD ( PH15 ) <nl> + # endif <nl> + <nl> + # ifdef PI0 <nl> + PIN_ADD ( PI0 ) <nl> + # endif <nl> + # ifdef PI1 <nl> + PIN_ADD ( PI1 ) <nl> + # endif <nl> + # ifdef PI2 <nl> + PIN_ADD ( PI2 ) <nl> + # endif <nl> + # ifdef PI3 <nl> + PIN_ADD ( PI3 ) <nl> + # endif <nl> + # ifdef PI4 <nl> + PIN_ADD ( PI4 ) <nl> + # endif <nl> + # ifdef PI5 <nl> + PIN_ADD ( PI5 ) <nl> + # endif <nl> + # ifdef PI6 <nl> + PIN_ADD ( PI6 ) <nl> + # endif <nl> + # ifdef PI7 <nl> + PIN_ADD ( PI7 ) <nl> + # endif <nl> + # ifdef PI8 <nl> + PIN_ADD ( PI8 ) <nl> + # endif <nl> + # ifdef PI9 <nl> + PIN_ADD ( PI9 ) <nl> + # endif <nl> + # ifdef PI10 <nl> + PIN_ADD ( PI10 ) <nl> + # endif <nl> + # ifdef PI11 <nl> + PIN_ADD ( PI11 ) <nl> + # endif <nl> + # ifdef PI12 <nl> + PIN_ADD ( PI12 ) <nl> + # endif <nl> + # ifdef PI13 <nl> + PIN_ADD ( PI13 ) <nl> + # endif <nl> + # ifdef PI14 <nl> + PIN_ADD ( PI14 ) <nl> + # endif <nl> + # ifdef PI15 <nl> + PIN_ADD ( PI15 ) <nl> + # endif <nl> + <nl> + # ifdef PJ0 <nl> + PIN_ADD ( PJ0 ) <nl> + # endif <nl> + # ifdef PJ1 <nl> + PIN_ADD ( PJ1 ) <nl> + # endif <nl> + # ifdef PJ2 <nl> + PIN_ADD ( PJ2 ) <nl> + # endif <nl> + # ifdef PJ3 <nl> + PIN_ADD ( PJ3 ) <nl> + # endif <nl> + # ifdef PJ4 <nl> + PIN_ADD ( PJ4 ) <nl> + # endif <nl> + # ifdef PJ5 <nl> + PIN_ADD ( PJ5 ) <nl> + # endif <nl> + # ifdef PJ6 <nl> + PIN_ADD ( PJ6 ) <nl> + # endif <nl> + # ifdef PJ7 <nl> + PIN_ADD ( PJ7 ) <nl> + # endif <nl> + # ifdef PJ8 <nl> + PIN_ADD ( PJ8 ) <nl> + # endif <nl> + # ifdef PJ9 <nl> + PIN_ADD ( PJ9 ) <nl> + # endif <nl> + # ifdef PJ10 <nl> + PIN_ADD ( PJ10 ) <nl> + # endif <nl> + # ifdef PJ11 <nl> + PIN_ADD ( PJ11 ) <nl> + # endif <nl> + # ifdef PJ12 <nl> + PIN_ADD ( PJ12 ) <nl> + # endif <nl> + # ifdef PJ13 <nl> + PIN_ADD ( PJ13 ) <nl> + # endif <nl> + # ifdef PJ14 <nl> + PIN_ADD ( PJ14 ) <nl> + # endif <nl> + # ifdef PJ15 <nl> + PIN_ADD ( PJ15 ) <nl> + # endif <nl> + <nl> + # ifdef PK0 <nl> + PIN_ADD ( PK0 ) <nl> + # endif <nl> + # ifdef PK1 <nl> + PIN_ADD ( PK1 ) <nl> + # endif <nl> + # ifdef PK2 <nl> + PIN_ADD ( PK2 ) <nl> + # endif <nl> + # ifdef PK3 <nl> + PIN_ADD ( PK3 ) <nl> + # endif <nl> + # ifdef PK4 <nl> + PIN_ADD ( PK4 ) <nl> + # endif <nl> + # ifdef PK5 <nl> + PIN_ADD ( PK5 ) <nl> + # endif <nl> + # ifdef PK6 <nl> + PIN_ADD ( PK6 ) <nl> + # endif <nl> + # ifdef PK7 <nl> + PIN_ADD ( PK7 ) <nl> + # endif <nl> + # ifdef PK8 <nl> + PIN_ADD ( PK8 ) <nl> + # endif <nl> + # ifdef PK9 <nl> + PIN_ADD ( PK9 ) <nl> + # endif <nl> + # ifdef PK10 <nl> + PIN_ADD ( PK10 ) <nl> + # endif <nl> + # ifdef PK11 <nl> + PIN_ADD ( PK11 ) <nl> + # endif <nl> + # ifdef PK12 <nl> + PIN_ADD ( PK12 ) <nl> + # endif <nl> + # ifdef PK13 <nl> + PIN_ADD ( PK13 ) <nl> + # endif <nl> + # ifdef PK14 <nl> + PIN_ADD ( PK14 ) <nl> + # endif <nl> + # ifdef PK15 <nl> + PIN_ADD ( PK15 ) <nl> + # endif <nl> + <nl> + # ifdef PL0 <nl> + PIN_ADD ( PL0 ) <nl> + # endif <nl> + # ifdef PL1 <nl> + PIN_ADD ( PL1 ) <nl> + # endif <nl> + # ifdef PL2 <nl> + PIN_ADD ( PL2 ) <nl> + # endif <nl> + # ifdef PL3 <nl> + PIN_ADD ( PL3 ) <nl> + # endif <nl> + # ifdef PL4 <nl> + PIN_ADD ( PL4 ) <nl> + # endif <nl> + # ifdef PL5 <nl> + PIN_ADD ( PL5 ) <nl> + # endif <nl> + # ifdef PL6 <nl> + PIN_ADD ( PL6 ) <nl> + # endif <nl> + # ifdef PL7 <nl> + PIN_ADD ( PL7 ) <nl> + # endif <nl> + # ifdef PL8 <nl> + PIN_ADD ( PL8 ) <nl> + # endif <nl> + # ifdef PL9 <nl> + PIN_ADD ( PL9 ) <nl> + # endif <nl> + # ifdef PL10 <nl> + PIN_ADD ( PL10 ) <nl> + # endif <nl> + # ifdef PL11 <nl> + PIN_ADD ( PL11 ) <nl> + # endif <nl> + # ifdef PL12 <nl> + PIN_ADD ( PL12 ) <nl> + # endif <nl> + # ifdef PL13 <nl> + PIN_ADD ( PL13 ) <nl> + # endif <nl> + # ifdef PL14 <nl> + PIN_ADD ( PL14 ) <nl> + # endif <nl> + # ifdef PL15 <nl> + PIN_ADD ( PL15 ) <nl> + # endif <nl> mmm a / Marlin / src / HAL / HAL_STM32F1 / pinsDebug . h <nl> ppp b / Marlin / src / HAL / HAL_STM32F1 / pinsDebug . h <nl> <nl> * along with this program . If not , see < http : / / www . gnu . org / licenses / > . <nl> * <nl> * / <nl> - <nl> - / * * <nl> - * Support routines for STM32F1 <nl> - * / <nl> - # ifdef __STM32F1__ <nl> - <nl> - / * * <nl> - * Translation of routines & variables used by pinsDebug . h <nl> - * / <nl> - # include " fastio_STM32F1 . h " <nl> - <nl> - extern const stm32_pin_info PIN_MAP [ BOARD_NR_GPIO_PINS ] ; <nl> - <nl> - # define NUM_DIGITAL_PINS BOARD_NR_GPIO_PINS <nl> - # define NUMBER_PINS_TOTAL BOARD_NR_GPIO_PINS <nl> - # define VALID_PIN ( pin ) ( pin > = 0 & & pin < BOARD_NR_GPIO_PINS ) <nl> - # define GET_ARRAY_PIN ( p ) pin_t ( pin_array [ p ] . pin ) <nl> - # define pwm_status ( pin ) PWM_PIN ( pin ) <nl> - # define digitalRead_mod ( p ) extDigitalRead ( p ) <nl> - # define NAME_FORMAT ( p ) PSTR ( " % - # # p # # s " ) <nl> - # define PRINT_PIN ( p ) do { sprintf_P ( buffer , PSTR ( " % 3hd " ) , int16_t ( p ) ) ; SERIAL_ECHO ( buffer ) ; } while ( 0 ) <nl> - # define PRINT_PORT ( p ) print_port ( p ) <nl> - # define PRINT_ARRAY_NAME ( x ) do { sprintf_P ( buffer , PSTR ( " % - " STRINGIFY ( MAX_NAME_LENGTH ) " s " ) , pin_array [ x ] . name ) ; SERIAL_ECHO ( buffer ) ; } while ( 0 ) <nl> - # define MULTI_NAME_PAD 20 / / spaces needed to be pretty if not first name assigned to a pin <nl> - <nl> - / / pins that will cause hang / reset / disconnect in M43 Toggle and Watch utilities <nl> - # ifndef M43_NEVER_TOUCH <nl> - # define M43_NEVER_TOUCH ( Q ) ( Q > = 9 & & Q < = 12 ) / / SERIAL / USB pins PA9 ( TX ) PA10 ( RX ) <nl> + # pragma once <nl> + <nl> + # ifdef NUM_DIGITAL_PINS / / Only in ST ' s Arduino core ( STM32duino , STM32Core ) <nl> + # include " . . / HAL_STM32 / pinsDebug_STM32duino . h " <nl> + # elif defined ( BOARD_NR_GPIO_PINS ) / / Only in STM32GENERIC ( Maple ) <nl> + # include " . . / HAL_STM32 / pinsDebug_STM32GENERIC . h " <nl> + # else <nl> + # error " M43 not supported for this board " <nl> # endif <nl> - <nl> - static inline int8_t get_pin_mode ( pin_t pin ) { <nl> - return VALID_PIN ( pin ) ? _GET_MODE ( pin ) : - 1 ; <nl> - } <nl> - <nl> - static inline pin_t DIGITAL_PIN_TO_ANALOG_PIN ( pin_t pin ) { <nl> - if ( ! VALID_PIN ( pin ) ) return - 1 ; <nl> - int8_t adc_channel = int8_t ( PIN_MAP [ pin ] . adc_channel ) ; <nl> - # ifdef NUM_ANALOG_INPUTS <nl> - if ( adc_channel > = NUM_ANALOG_INPUTS ) adc_channel = ADCx ; <nl> - # endif <nl> - return pin_t ( adc_channel ) ; <nl> - } <nl> - <nl> - static inline bool IS_ANALOG ( pin_t pin ) { <nl> - if ( ! VALID_PIN ( pin ) ) return false ; <nl> - if ( PIN_MAP [ pin ] . adc_channel ! = ADCx ) { <nl> - # ifdef NUM_ANALOG_INPUTS <nl> - if ( PIN_MAP [ pin ] . adc_channel > = NUM_ANALOG_INPUTS ) return false ; <nl> - # endif <nl> - return _GET_MODE ( pin ) = = GPIO_INPUT_ANALOG & & ! M43_NEVER_TOUCH ( pin ) ; <nl> - } <nl> - return false ; <nl> - } <nl> - <nl> - static inline bool GET_PINMODE ( pin_t pin ) { <nl> - return VALID_PIN ( pin ) ? ! IS_INPUT ( pin ) : false ; <nl> - } <nl> - <nl> - static inline bool GET_ARRAY_IS_DIGITAL ( int16_t array_pin ) { <nl> - pin_t pin = GET_ARRAY_PIN ( array_pin ) ; <nl> - bool isDigital = ! IS_ANALOG ( pin ) ; <nl> - # ifdef NUM_ANALOG_INPUTS <nl> - if ( ! isDigital & & PIN_MAP [ pin ] . adc_channel > = NUM_ANALOG_INPUTS ) <nl> - isDigital = true ; <nl> - # endif <nl> - return isDigital ; <nl> - } <nl> - <nl> - static inline void pwm_details ( pin_t pin ) { <nl> - if ( PWM_PIN ( pin ) ) { <nl> - char buffer [ 16 ] , num = ' ? ' ; <nl> - timer_dev * const tdev = PIN_MAP [ pin ] . timer_device ; <nl> - const uint8_t channel = PIN_MAP [ pin ] . timer_channel ; <nl> - if ( tdev = = & timer1 ) num = ' 1 ' ; <nl> - else if ( tdev = = & timer1 ) num = ' 1 ' ; <nl> - else if ( tdev = = & timer2 ) num = ' 2 ' ; <nl> - else if ( tdev = = & timer3 ) num = ' 3 ' ; <nl> - else if ( tdev = = & timer4 ) num = ' 4 ' ; <nl> - # ifdef STM32_HIGH_DENSITY <nl> - else if ( tdev = = & timer5 ) num = ' 5 ' ; <nl> - else if ( tdev = = & timer8 ) num = ' 8 ' ; <nl> - # endif <nl> - sprintf_P ( buffer , PSTR ( " TIM % c CH % c " ) , num , ( ' 0 ' + channel ) ) ; <nl> - SERIAL_ECHO ( buffer ) ; <nl> - } <nl> - } <nl> - <nl> - static inline void print_port ( pin_t pin ) { <nl> - char buffer [ 8 ] ; <nl> - char port = ' A ' + char ( pin > > 4 ) ; / / pin div 16 <nl> - / * seems not to be required for our devices <nl> - gpio_dev * gp = PIN_MAP [ pin ] . gpio_device ; <nl> - if ( gp = = & gpioa ) port = ' A ' ; <nl> - else if ( gp = = & gpiob ) port = ' B ' ; <nl> - else if ( gp = = & gpioc ) port = ' C ' ; <nl> - else if ( gp = = & gpiod ) port = ' D ' ; <nl> - # if STM32_NR_GPIO_PORTS > 4 <nl> - else if ( gp = = & gpioe ) port = ' E ' ; <nl> - else if ( gp = = & gpiof ) port = ' F ' ; <nl> - else if ( gp = = & gpiog ) port = ' G ' ; <nl> - # endif <nl> - * / <nl> - const int16_t gbit = PIN_MAP [ pin ] . gpio_bit ; <nl> - sprintf_P ( buffer , PSTR ( " P % c % hd " ) , port , gbit ) ; <nl> - if ( gbit < 10 ) SERIAL_CHAR ( ' ' ) ; <nl> - SERIAL_ECHO ( buffer ) ; <nl> - } <nl> - <nl> - # endif / / __STM32F1__ <nl> mmm a / Marlin / src / HAL / HAL_STM32F4 / fastio_STM32F4 . h <nl> ppp b / Marlin / src / HAL / HAL_STM32F4 / fastio_STM32F4 . h <nl> <nl> # define PORTD 3 <nl> # define PORTE 4 <nl> <nl> - # define _STM32_PIN ( _PORT , _PIN ) ( ( PORT # # _PORT * 16 ) + _PIN ) <nl> + # define _STM32_PIN ( P , PN ) ( ( PORT # # P * 16 ) + PN ) <nl> <nl> # define PA0 _STM32_PIN ( A , 0 ) <nl> # define PA1 _STM32_PIN ( A , 1 ) <nl> mmm a / Marlin / src / HAL / HAL_STM32F4 / pinsDebug . h <nl> ppp b / Marlin / src / HAL / HAL_STM32F4 / pinsDebug . h <nl> @ @ - 1 + 1 , 27 @ @ <nl> - # error Debug pins is not supported on this Platform ! <nl> + / * * <nl> + * Marlin 3D Printer Firmware <nl> + * Copyright ( c ) 2019 MarlinFirmware [ https : / / github . com / MarlinFirmware / Marlin ] <nl> + * <nl> + * This program is free software : you can redistribute it and / or modify <nl> + * it under the terms of the GNU General Public License as published by <nl> + * the Free Software Foundation , either version 3 of the License , or <nl> + * ( at your option ) any later version . <nl> + * <nl> + * This program is distributed in the hope that it will be useful , <nl> + * but WITHOUT ANY WARRANTY ; without even the implied warranty of <nl> + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE . See the <nl> + * GNU General Public License for more details . <nl> + * <nl> + * You should have received a copy of the GNU General Public License <nl> + * along with this program . If not , see < http : / / www . gnu . org / licenses / > . <nl> + * <nl> + * / <nl> + # pragma once <nl> + <nl> + # ifdef NUM_DIGITAL_PINS / / Only in ST ' s Arduino core ( STM32duino , STM32Core ) <nl> + # include " . . / HAL_STM32 / pinsDebug_STM32duino . h " <nl> + # elif defined ( BOARD_NR_GPIO_PINS ) / / Only in STM32GENERIC ( Maple ) <nl> + # include " . . / HAL_STM32 / pinsDebug_STM32GENERIC . h " <nl> + # else <nl> + # error " M43 not supported for this board " <nl> + # endif <nl> mmm a / Marlin / src / HAL / HAL_STM32F7 / pinsDebug . h <nl> ppp b / Marlin / src / HAL / HAL_STM32F7 / pinsDebug . h <nl> @ @ - 1 + 1 , 27 @ @ <nl> - # error Debug pins is not supported on this Platform ! <nl> + / * * <nl> + * Marlin 3D Printer Firmware <nl> + * Copyright ( c ) 2019 MarlinFirmware [ https : / / github . com / MarlinFirmware / Marlin ] <nl> + * <nl> + * This program is free software : you can redistribute it and / or modify <nl> + * it under the terms of the GNU General Public License as published by <nl> + * the Free Software Foundation , either version 3 of the License , or <nl> + * ( at your option ) any later version . <nl> + * <nl> + * This program is distributed in the hope that it will be useful , <nl> + * but WITHOUT ANY WARRANTY ; without even the implied warranty of <nl> + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE . See the <nl> + * GNU General Public License for more details . <nl> + * <nl> + * You should have received a copy of the GNU General Public License <nl> + * along with this program . If not , see < http : / / www . gnu . org / licenses / > . <nl> + * <nl> + * / <nl> + # pragma once <nl> + <nl> + # ifdef NUM_DIGITAL_PINS / / Only in ST ' s Arduino core ( STM32duino , STM32Core ) <nl> + # include " . . / HAL_STM32 / pinsDebug_STM32duino . h " <nl> + # elif defined ( BOARD_NR_GPIO_PINS ) / / Only in STM32GENERIC ( Maple ) <nl> + # include " . . / HAL_STM32 / pinsDebug_STM32GENERIC . h " <nl> + # else <nl> + # error " M43 not supported for this board " <nl> + # endif <nl> mmm a / Marlin / src / gcode / config / M43 . cpp <nl> ppp b / Marlin / src / gcode / config / M43 . cpp <nl> <nl> # include " . . / . . / feature / host_actions . h " <nl> # endif <nl> <nl> + # ifndef GET_PIN_MAP_PIN_M43 <nl> + # define GET_PIN_MAP_PIN_M43 ( Q ) GET_PIN_MAP_PIN ( Q ) <nl> + # endif <nl> + <nl> inline void toggle_pins ( ) { <nl> const bool ignore_protection = parser . boolval ( ' I ' ) ; <nl> const int repeat = parser . intval ( ' R ' , 1 ) , <nl> inline void toggle_pins ( ) { <nl> wait = parser . intval ( ' W ' , 500 ) ; <nl> <nl> for ( uint8_t i = start ; i < = end ; i + + ) { <nl> - pin_t pin = GET_PIN_MAP_PIN ( i ) ; <nl> + pin_t pin = GET_PIN_MAP_PIN_M43 ( i ) ; <nl> if ( ! VALID_PIN ( pin ) ) continue ; <nl> if ( M43_NEVER_TOUCH ( i ) | | ( ! ignore_protection & & pin_is_protected ( pin ) ) ) { <nl> report_pin_state_extended ( pin , ignore_protection , true , " Untouched " ) ; <nl> void GcodeSuite : : M43 ( ) { <nl> # endif <nl> uint8_t pin_state [ last_pin - first_pin + 1 ] ; <nl> for ( uint8_t i = first_pin ; i < = last_pin ; i + + ) { <nl> - pin_t pin = GET_PIN_MAP_PIN ( i ) ; <nl> + pin_t pin = GET_PIN_MAP_PIN_M43 ( i ) ; <nl> if ( ! VALID_PIN ( pin ) ) continue ; <nl> if ( M43_NEVER_TOUCH ( i ) | | ( ! ignore_protection & & pin_is_protected ( pin ) ) ) continue ; <nl> pinMode ( pin , INPUT_PULLUP ) ; <nl> void GcodeSuite : : M43 ( ) { <nl> <nl> for ( ; ; ) { <nl> for ( uint8_t i = first_pin ; i < = last_pin ; i + + ) { <nl> - pin_t pin = GET_PIN_MAP_PIN ( i ) ; <nl> + pin_t pin = GET_PIN_MAP_PIN_M43 ( i ) ; <nl> if ( ! VALID_PIN ( pin ) ) continue ; <nl> if ( M43_NEVER_TOUCH ( i ) | | ( ! ignore_protection & & pin_is_protected ( pin ) ) ) continue ; <nl> const byte val = <nl> void GcodeSuite : : M43 ( ) { <nl> else { <nl> / / Report current state of selected pin ( s ) <nl> for ( uint8_t i = first_pin ; i < = last_pin ; i + + ) { <nl> - pin_t pin = GET_PIN_MAP_PIN ( i ) ; <nl> + pin_t pin = GET_PIN_MAP_PIN_M43 ( i ) ; <nl> if ( VALID_PIN ( pin ) ) report_pin_state_extended ( pin , ignore_protection , true ) ; <nl> } <nl> } <nl> mmm a / Marlin / src / pins / pinsDebug . h <nl> ppp b / Marlin / src / pins / pinsDebug . h <nl> inline void report_pin_state_extended ( pin_t pin , bool ignore , bool extended = fa <nl> SERIAL_ECHO ( buffer ) ; <nl> PRINT_PIN ( pin ) ; <nl> PRINT_PORT ( pin ) ; <nl> - if ( IS_ANALOG ( pin ) ) { <nl> + if ( int8_t ( DIGITAL_PIN_TO_ANALOG_PIN ( pin ) ) > = 0 ) { <nl> sprintf_P ( buffer , PSTR ( " ( A % 2d ) " ) , DIGITAL_PIN_TO_ANALOG_PIN ( pin ) ) ; / / analog pin number <nl> SERIAL_ECHO ( buffer ) ; <nl> } <nl> inline void report_pin_state_extended ( pin_t pin , bool ignore , bool extended = fa <nl> SERIAL_ECHO ( buffer ) ; <nl> PRINT_PIN ( pin ) ; <nl> PRINT_PORT ( pin ) ; <nl> - if ( IS_ANALOG ( pin ) ) { <nl> + if ( int8_t ( DIGITAL_PIN_TO_ANALOG_PIN ( pin ) ) > = 0 ) { <nl> sprintf_P ( buffer , PSTR ( " ( A % 2d ) " ) , DIGITAL_PIN_TO_ANALOG_PIN ( pin ) ) ; / / analog pin number <nl> SERIAL_ECHO ( buffer ) ; <nl> } <nl> inline void report_pin_state_extended ( pin_t pin , bool ignore , bool extended = fa <nl> else <nl> # endif <nl> { <nl> - if ( GET_PINMODE ( pin ) ) { <nl> + if ( pwm_status ( pin ) ) { <nl> + / / do nothing <nl> + } <nl> + else if ( GET_PINMODE ( pin ) ) { <nl> SERIAL_ECHO_SP ( MAX_NAME_LENGTH - 16 ) ; <nl> print_input_or_output ( true ) ; <nl> SERIAL_ECHO ( digitalRead_mod ( pin ) ) ; <nl> inline void report_pin_state_extended ( pin_t pin , bool ignore , bool extended = fa <nl> SERIAL_ECHO ( digitalRead_mod ( pin ) ) ; <nl> } <nl> / / if ( ! pwm_status ( pin ) ) SERIAL_CHAR ( ' ' ) ; / / add padding if it ' s not a PWM pin <nl> - if ( extended ) pwm_details ( pin ) ; / / report PWM capabilities only if doing an extended report <nl> + if ( extended ) { <nl> + SERIAL_ECHO_SP ( MAX_NAME_LENGTH - 16 ) ; <nl> + pwm_details ( pin ) ; / / report PWM capabilities only if doing an extended report <nl> + } <nl> } <nl> } <nl> SERIAL_EOL ( ) ; <nl> mmm a / buildroot / share / atom / auto_build . py <nl> ppp b / buildroot / share / atom / auto_build . py <nl> def __init__ ( self ) : <nl> Text . __init__ ( self , self . frame , borderwidth = 3 , relief = " sunken " ) <nl> self . config ( tabs = ( 400 , ) ) # configure Text widget tab stops <nl> self . config ( background = ' black ' , foreground = ' white ' , font = ( " consolas " , 12 ) , wrap = ' word ' , undo = ' True ' ) <nl> - # self . config ( background = ' black ' , foreground = ' white ' , font = ( " consolas " , 12 ) , wrap = ' none ' , undo = ' True ' ) <nl> + # self . config ( background = ' black ' , foreground = ' white ' , font = ( " consolas " , 12 ) , wrap = ' none ' , undo = ' True ' ) <nl> self . config ( height = 24 , width = 100 ) <nl> self . config ( insertbackground = ' pale green ' ) # keyboard insertion point <nl> self . pack ( side = ' left ' , fill = ' both ' , expand = True ) <nl> def __init__ ( self ) : <nl> self . config ( yscrollcommand = scrb . set ) <nl> scrb . pack ( side = ' right ' , fill = ' y ' ) <nl> <nl> - # self . scrb_Y = tk . Scrollbar ( self . frame , orient = ' vertical ' , command = self . yview ) <nl> - # self . scrb_Y . config ( yscrollcommand = self . scrb_Y . set ) <nl> - # self . scrb_Y . pack ( side = ' right ' , fill = ' y ' ) <nl> - # <nl> - # self . scrb_X = tk . Scrollbar ( self . frame , orient = ' horizontal ' , command = self . xview ) <nl> - # self . scrb_X . config ( xscrollcommand = self . scrb_X . set ) <nl> - # self . scrb_X . pack ( side = ' bottom ' , fill = ' x ' ) <nl> + # self . scrb_Y = tk . Scrollbar ( self . frame , orient = ' vertical ' , command = self . yview ) <nl> + # self . scrb_Y . config ( yscrollcommand = self . scrb_Y . set ) <nl> + # self . scrb_Y . pack ( side = ' right ' , fill = ' y ' ) <nl> <nl> - # scrb_X = tk . Scrollbar ( self , orient = tk . HORIZONTAL , command = self . xview ) # tk . HORIZONTAL now have a horizsontal scroll bar BUT . . . shrinks it to a postage stamp and hides far right behind the vertical scroll bar <nl> - # self . config ( xscrollcommand = scrb_X . set ) <nl> - # scrb_X . pack ( side = ' bottom ' , fill = ' x ' ) <nl> - # <nl> - # scrb = tk . Scrollbar ( self , orient = ' vertical ' , command = self . yview ) <nl> - # self . config ( yscrollcommand = scrb . set ) <nl> - # scrb . pack ( side = ' right ' , fill = ' y ' ) <nl> + # self . scrb_X = tk . Scrollbar ( self . frame , orient = ' horizontal ' , command = self . xview ) <nl> + # self . scrb_X . config ( xscrollcommand = self . scrb_X . set ) <nl> + # self . scrb_X . pack ( side = ' bottom ' , fill = ' x ' ) <nl> + <nl> + # scrb_X = tk . Scrollbar ( self , orient = tk . HORIZONTAL , command = self . xview ) # tk . HORIZONTAL now have a horizsontal scroll bar BUT . . . shrinks it to a postage stamp and hides far right behind the vertical scroll bar <nl> + # self . config ( xscrollcommand = scrb_X . set ) <nl> + # scrb_X . pack ( side = ' bottom ' , fill = ' x ' ) <nl> <nl> - # self . config ( height = 240 , width = 1000 ) # didn ' t get the size baCK TO NORMAL <nl> - # self . pack ( side = ' left ' , fill = ' both ' , expand = True ) # didn ' t get the size baCK TO NORMAL <nl> + # scrb = tk . Scrollbar ( self , orient = ' vertical ' , command = self . yview ) <nl> + # self . config ( yscrollcommand = scrb . set ) <nl> + # scrb . pack ( side = ' right ' , fill = ' y ' ) <nl> + <nl> + # self . config ( height = 240 , width = 1000 ) # didn ' t get the size baCK TO NORMAL <nl> + # self . pack ( side = ' left ' , fill = ' both ' , expand = True ) # didn ' t get the size baCK TO NORMAL <nl> <nl> <nl> # pop - up menu <nl> def __init__ ( self ) : <nl> self . popup . add_separator ( ) <nl> self . popup . add_command ( label = ' Save As ' , command = self . _file_save_as ) <nl> self . popup . add_separator ( ) <nl> - # self . popup . add_command ( label = ' Repeat Build ( CTL - shift - r ) ' , command = self . _rebuild ) <nl> + # self . popup . add_command ( label = ' Repeat Build ( CTL - shift - r ) ' , command = self . _rebuild ) <nl> self . popup . add_command ( label = ' Repeat Build ' , command = self . _rebuild ) <nl> self . popup . add_separator ( ) <nl> self . popup . add_command ( label = ' Scroll Errors ( CTL - shift - e ) ' , command = self . _scroll_errors ) <nl> def select_all ( self , event ) : <nl> <nl> <nl> def _clear_all ( self ) : <nl> - ' ' ' erases all text ' ' ' <nl> - <nl> - isok = askokcancel ( ' Clear All ' , ' Erase all text ? ' , frame = self , <nl> - default = ' ok ' ) <nl> - if isok : <nl> - self . delete ( ' 1 . 0 ' , ' end ' ) <nl> + # ' ' ' erases all text ' ' ' <nl> + # <nl> + # isok = askokcancel ( ' Clear All ' , ' Erase all text ? ' , frame = self , <nl> + # default = ' ok ' ) <nl> + # if isok : <nl> + # self . delete ( ' 1 . 0 ' , ' end ' ) <nl> + self . delete ( ' 1 . 0 ' , ' end ' ) <nl> <nl> <nl> # end - output_window <nl>
Pins Debugging for STM32 — NEEDS TESTING ( )
MarlinFirmware/Marlin
dc02d0720df318045e3ca6cdf5f27e6c39525829
2019-07-06T03:08:06Z
mmm a / buildscripts / emr / IOUtil . java <nl> ppp b / buildscripts / emr / IOUtil . java <nl> <nl> <nl> import java . io . * ; <nl> import java . net . * ; <nl> + import java . util . * ; <nl> <nl> public class IOUtil { <nl> <nl> public static String readStringFully ( InputStream in ) <nl> <nl> } <nl> <nl> + public static Map < String , Object > readPythonSettings ( File file ) <nl> + throws IOException { <nl> + <nl> + String all = readStringFully ( new FileInputStream ( file ) ) ; <nl> + <nl> + Map < String , Object > map = new TreeMap < String , Object > ( ) ; <nl> + <nl> + for ( String line : all . split ( " \ n " ) ) { <nl> + line = line . trim ( ) ; <nl> + if ( line . length ( ) = = 0 ) <nl> + continue ; <nl> + <nl> + String [ ] pcs = line . split ( " = " ) ; <nl> + if ( pcs . length ! = 2 ) <nl> + continue ; <nl> + <nl> + String name = pcs [ 0 ] . trim ( ) ; <nl> + String value = pcs [ 1 ] . trim ( ) ; <nl> + <nl> + if ( value . startsWith ( " \ " " ) ) { <nl> + map . put ( name , value . substring ( 1 , value . length ( ) - 1 ) ) ; <nl> + } <nl> + else { <nl> + map . put ( name , Long . parseLong ( value ) ) ; <nl> + } <nl> + <nl> + } <nl> + <nl> + return map ; <nl> + } <nl> + <nl> public static String [ ] runCommand ( String cmd , File dir ) <nl> throws IOException { <nl> <nl> mmm a / buildscripts / emr / emr . java <nl> ppp b / buildscripts / emr / emr . java <nl> void copy ( MongoSuite c ) { <nl> mongo = c . mongo ; <nl> code = c . code ; <nl> workingDir = c . workingDir ; <nl> + <nl> suite = c . suite ; <nl> + <nl> } <nl> <nl> void downloadTo ( File localDir ) <nl> boolean runTest ( ) <nl> dir . mkdirs ( ) ; <nl> <nl> / / download <nl> + System . out . println ( " going to download " ) ; <nl> downloadTo ( dir ) ; <nl> - <nl> + <nl> <nl> / / explode <nl> + System . out . println ( " going to explode " ) ; <nl> IOUtil . runCommand ( " tar zxvf " + IOUtil . urlFileName ( code ) , dir ) ; <nl> String [ ] res = IOUtil . runCommand ( " tar zxvf " + IOUtil . urlFileName ( mongo ) , dir ) ; <nl> for ( String x : res [ 0 ] . split ( " \ n " ) ) { <nl> boolean runTest ( ) <nl> throw new RuntimeException ( " rename failed " ) ; <nl> } <nl> <nl> + List < String > cmd = new ArrayList < String > ( ) ; <nl> + cmd . add ( " / usr / bin / python " ) ; <nl> + cmd . add ( " buildscripts / smoke . py " ) ; <nl> + <nl> + File log_config = new File ( dir , " log_config . py " ) ; <nl> + System . out . println ( " log_config : " + log_config . exists ( ) ) ; <nl> + if ( log_config . exists ( ) ) { <nl> + <nl> + java . util . Map < String , Object > properties = IOUtil . readPythonSettings ( log_config ) ; <nl> + <nl> + cmd . add ( " - - buildlogger - builder " ) ; <nl> + cmd . add ( properties . get ( " name " ) . toString ( ) ) ; <nl> + <nl> + cmd . add ( " - - buildlogger - buildnum " ) ; <nl> + cmd . add ( properties . get ( " number " ) . toString ( ) ) ; <nl> + <nl> + cmd . add ( " - - buildlogger - credentials " ) ; <nl> + cmd . add ( " log_config . py " ) ; <nl> + <nl> + cmd . add ( " - - buildlogger - phase " ) ; <nl> + { <nl> + int idx = suite . lastIndexOf ( " / " ) ; <nl> + if ( idx < 0 ) <nl> + cmd . add ( suite ) ; <nl> + else <nl> + cmd . add ( suite . substring ( 0 , idx ) ) ; <nl> + } <nl> + <nl> + } <nl> + <nl> + cmd . add ( suite ) ; <nl> + <nl> + System . out . println ( cmd ) ; <nl> + <nl> + Process p = Runtime . getRuntime ( ) . exec ( cmd . toArray ( new String [ cmd . size ( ) ] ) , new String [ ] { } , dir ) ; <nl> <nl> - Process p = Runtime . getRuntime ( ) . exec ( new String [ ] { " / usr / bin / python " , " buildscripts / smoke . py " , suite } , new String [ ] { } , dir ) ; <nl> List < Thread > threads = new ArrayList < Thread > ( ) ; <nl> threads . add ( new IOUtil . PipingThread ( p . getInputStream ( ) , System . out ) ) ; <nl> threads . add ( new IOUtil . PipingThread ( p . getErrorStream ( ) , System . out ) ) ; <nl> - <nl> - for ( Thread t : threads ) t . start ( ) ; <nl> + <nl> + for ( Thread t : threads ) <nl> + t . start ( ) ; <nl> + <nl> try { <nl> - for ( Thread t : threads ) t . join ( ) ; <nl> + for ( Thread t : threads ) { <nl> + t . join ( ) ; <nl> + } <nl> int rc = p . waitFor ( ) ; <nl> - System . out . println ( " \ n \ nResult : " + rc ) ; <nl> - <nl> return rc = = 0 ; <nl> } <nl> catch ( InterruptedException ie ) { <nl> + ie . printStackTrace ( ) ; <nl> throw new RuntimeException ( " sad " , ie ) ; <nl> } <nl> - <nl> + <nl> } <nl> <nl> public void readFields ( DataInput in ) <nl> public void readFields ( DataInput in ) <nl> mongo = in . readUTF ( ) ; <nl> code = in . readUTF ( ) ; <nl> workingDir = in . readUTF ( ) ; <nl> + <nl> suite = in . readUTF ( ) ; <nl> } <nl> <nl> public void write ( final DataOutput out ) <nl> out . writeUTF ( mongo ) ; <nl> out . writeUTF ( code ) ; <nl> out . writeUTF ( workingDir ) ; <nl> + <nl> out . writeUTF ( suite ) ; <nl> } <nl> <nl> public void map ( Text key , MongoSuite value , OutputCollector < Text , IntWritable > o <nl> ip = ip . substring ( ip . indexOf ( " : " ) + 1 ) . trim ( ) ; <nl> output . collect ( new Text ( ip ) , new IntWritable ( 1 ) ) ; <nl> } <nl> + catch ( RuntimeException re ) { <nl> + re . printStackTrace ( ) ; <nl> + throw re ; <nl> + } <nl> + catch ( IOException ioe ) { <nl> + ioe . printStackTrace ( ) ; <nl> + throw ioe ; <nl> + } <nl> finally { <nl> lock . unlock ( ) ; <nl> } <nl> public static void main ( String [ ] args ) throws Exception { <nl> <nl> String workingDir = " / data / db / emr / " ; <nl> <nl> + <nl> / / parse args <nl> <nl> int pos = 0 ; <nl> public static void main ( String [ ] args ) throws Exception { <nl> System . out . println ( " output \ t : " + output ) ; <nl> System . out . println ( " suites \ t : " + suites ) ; <nl> <nl> + if ( false ) { <nl> + MongoSuite s = new MongoSuite ( ) ; <nl> + s . mongo = mongo ; <nl> + s . code = code ; <nl> + s . workingDir = workingDir ; <nl> + s . suite = suites ; <nl> + s . runTest ( ) ; <nl> + return ; <nl> + } <nl> + <nl> / / main hadoop set <nl> conf . set ( " mongo " , mongo ) ; <nl> conf . set ( " code " , code ) ; <nl> mmm a / buildscripts / emr / emr . py <nl> ppp b / buildscripts / emr / emr . py <nl> <nl> import boto <nl> import simples3 <nl> <nl> + import pymongo <nl> + <nl> def findSettingsSetup ( ) : <nl> sys . path . append ( " . / " ) <nl> sys . path . append ( " . . / " ) <nl> def _get_most_recent_tgz ( prefix ) : <nl> <nl> return all [ 0 ] [ 0 ] <nl> <nl> + def get_build_info ( ) : <nl> + return ( os . environ . get ( ' MONGO_BUILDER_NAME ' ) , os . environ . get ( ' MONGO_BUILD_NUMBER ' ) ) <nl> + <nl> def make_tarball ( ) : <nl> <nl> m = _get_most_recent_tgz ( " mongodb - " ) <nl> - c = " test - code - emr . tgz " <nl> - utils . execsys ( " tar zcf % s src jstests buildscripts " % c ) <nl> + <nl> + c = " test - code - emr . tgz " <nl> + tar = " tar zcf % s src jstests buildscripts " % c <nl> + <nl> + log_config = " log_config . py " <nl> + if os . path . exists ( log_config ) : <nl> + os . unlink ( log_config ) <nl> + <nl> + credentials = do_credentials ( ) <nl> + if credentials : <nl> + <nl> + builder , buildnum = get_build_info ( ) <nl> + <nl> + if builder and buildnum : <nl> + <nl> + file = open ( log_config , " wb " ) <nl> + file . write ( ' username = " % s " \ npassword = " % s " \ n ' % credentials ) <nl> + file . write ( ' name = " % s " \ nnumber = % s \ n ' % ( builder , buildnum ) ) <nl> + <nl> + file . close ( ) <nl> + <nl> + tar = tar + " " + log_config <nl> + <nl> + utils . execsys ( tar ) <nl> return ( m , c ) <nl> <nl> def _put_ine ( bucket , local , remote ) : <nl> def push ( ) : <nl> <nl> root = " emr / % s / % s " % ( datetime . date . today ( ) . strftime ( " % Y - % m - % d " ) , os . uname ( ) [ 0 ] . lower ( ) ) <nl> <nl> - def make_long_name ( local ) : <nl> + def make_long_name ( local , hash ) : <nl> pcs = local . rpartition ( " . " ) <nl> - return " % s / % s - % s . % s " % ( root , pcs [ 0 ] , _get_status ( ) , pcs [ 2 ] ) <nl> + h = _get_status ( ) <nl> + if hash : <nl> + h = utils . md5sum ( local ) <nl> + return " % s / % s - % s . % s " % ( root , pcs [ 0 ] , h , pcs [ 2 ] ) <nl> <nl> - mongo = _put_ine ( bucket , mongo , make_long_name ( mongo ) ) <nl> - test_code = _put_ine ( bucket , test_code , make_long_name ( test_code ) ) <nl> + mongo = _put_ine ( bucket , mongo , make_long_name ( mongo , False ) ) <nl> + test_code = _put_ine ( bucket , test_code , make_long_name ( test_code , True ) ) <nl> <nl> jar = build_jar ( ) <nl> - jar = _put_ine ( bucket , jar , make_long_name ( jar ) ) <nl> + jar = _put_ine ( bucket , jar , make_long_name ( jar , False ) ) <nl> <nl> setup = " buildscripts / emr / emrnodesetup . sh " <nl> - setup = _put_ine ( bucket , setup , make_long_name ( setup ) ) <nl> + setup = _put_ine ( bucket , setup , make_long_name ( setup , True ) ) <nl> <nl> return mongo , test_code , jar , setup <nl> <nl> def http ( path ) : <nl> <nl> syncdir = " build / emrout / " + jobid + " / " <nl> sync_s3 ( run_s3_path , syncdir ) <nl> - print ( " output in : build / emrout / " + jobid + " / " ) <nl> + <nl> + final_out = " build / emrout / " + jobid + " / " <nl> + <nl> + print ( " output in : " + final_out ) <nl> + do_output ( final_out ) <nl> <nl> def sync_s3 ( remote_dir , local_dir ) : <nl> for x in bucket . listdir ( remote_dir ) : <nl> def fix_suites ( suites ) : <nl> fixed . append ( name ) <nl> return fixed <nl> <nl> + def do_credentials ( ) : <nl> + root = " buildbot . tac " <nl> + <nl> + while len ( root ) < 40 : <nl> + if os . path . exists ( root ) : <nl> + break <nl> + root = " . . / " + root <nl> + <nl> + if not os . path . exists ( root ) : <nl> + return None <nl> + <nl> + credentials = { } <nl> + execfile ( root , credentials , credentials ) <nl> + <nl> + if " slavename " not in credentials : <nl> + return None <nl> + <nl> + if " passwd " not in credentials : <nl> + return None <nl> + <nl> + return ( credentials [ " slavename " ] , credentials [ " passwd " ] ) <nl> + <nl> + <nl> + def do_output ( dir ) : <nl> + <nl> + def go_down ( start ) : <nl> + lst = os . listdir ( dir ) <nl> + if len ( lst ) ! = 1 : <nl> + raise Exception ( " sad : " + start ) <nl> + return start + " / " + lst [ 0 ] <nl> + <nl> + while " out " not in os . listdir ( dir ) : <nl> + dir = go_down ( dir ) <nl> + <nl> + dir = dir + " / out " <nl> + <nl> + pieces = os . listdir ( dir ) <nl> + pieces . sort ( ) <nl> + <nl> + passed = [ ] <nl> + failed = [ ] <nl> + times = { } <nl> + <nl> + for x in pieces : <nl> + if not x . startswith ( " part " ) : <nl> + continue <nl> + full = dir + " / " + x <nl> + <nl> + for line in open ( full , " rb " ) : <nl> + if line . find ( " - passed " ) > = 0 : <nl> + passed . append ( line . partition ( " - passed " ) [ 0 ] ) <nl> + continue <nl> + <nl> + if line . find ( " - failed " ) > = 0 : <nl> + failed . append ( line . partition ( " - failed " ) [ 0 ] ) <nl> + continue <nl> + <nl> + if line . find ( " - time - seconds " ) > = 0 : <nl> + p = line . partition ( " - time - seconds " ) <nl> + times [ p [ 0 ] ] = p [ 2 ] . strip ( ) <nl> + continue <nl> + <nl> + print ( " \ t " + line . strip ( ) ) <nl> + <nl> + def print_list ( name , lst ) : <nl> + print ( name ) <nl> + for x in lst : <nl> + print ( " \ t % s \ t % s " % ( x , times [ x ] ) ) <nl> + <nl> + print_list ( " passed " , passed ) <nl> + print_list ( " failed " , failed ) <nl> + <nl> + if do_credentials ( ) : <nl> + builder , buildnum = get_build_info ( ) <nl> + if builder and buildnum : <nl> + conn = pymongo . Connection ( " bbout1 . 10gen . cc " ) <nl> + db = conn . buildlogs <nl> + q = { " builder " : builder , " buildnum " : int ( buildnum ) } <nl> + doc = db . builds . find_one ( q ) <nl> + <nl> + if doc : <nl> + print ( " \ nhttp : / / buildlogs . mongodb . org / build / % s " % doc [ " _id " ] ) <nl> + <nl> + <nl> if __name__ = = " __main__ " : <nl> if len ( sys . argv ) = = 1 : <nl> print ( " need an arg " ) <nl> def fix_suites ( suites ) : <nl> elif sys . argv [ 1 ] = = " fix_suites " : <nl> for x in fix_suites ( sys . argv [ 2 : ] ) : <nl> print ( x ) <nl> + <nl> + elif sys . argv [ 1 ] = = " credentials " : <nl> + print ( do_credentials ( ) ) <nl> + <nl> + elif sys . argv [ 1 ] = = " test " : <nl> + m , c = make_tarball ( ) <nl> + build_jar ( ) <nl> + cmd = [ " java " , " - cp " , os . environ . get ( " CLASSPATH " , " . " ) + " : emr . jar " , " emr " ] <nl> + <nl> + workingDir = " / data / emr / test " <nl> + cmd . append ( " - - workingDir " ) <nl> + cmd . append ( workingDir ) <nl> + if os . path . exists ( workingDir ) : <nl> + shutil . rmtree ( workingDir ) <nl> + <nl> + cmd . append ( " file : / / " + os . getcwd ( ) + " / " + m ) <nl> + cmd . append ( " file : / / " + os . getcwd ( ) + " / " + c ) <nl> + <nl> + out = " / tmp / emrresults " <nl> + cmd . append ( out ) <nl> + if os . path . exists ( out ) : <nl> + shutil . rmtree ( out ) <nl> + <nl> + cmd . append ( " jstests / basic1 . js " ) <nl> + <nl> + subprocess . call ( cmd ) <nl> <nl> + for x in os . listdir ( out ) : <nl> + if x . startswith ( " . " ) : <nl> + continue <nl> + print ( x ) <nl> + for z in open ( out + " / " + x ) : <nl> + print ( " \ t " + z . strip ( ) ) <nl> + <nl> + elif sys . argv [ 1 ] = = " output " : <nl> + do_output ( sys . argv [ 2 ] ) <nl> + <nl> elif sys . argv [ 1 ] = = " full " : <nl> things = push ( ) <nl> run_tests ( things , sys . argv [ 2 : ] ) <nl> - <nl> + <nl> else : <nl> things = push ( ) <nl> run_tests ( things , sys . argv [ 1 : ] ) <nl>
output management for emr
mongodb/mongo
087253be5766e74881b7964a726257f407b340cd
2012-05-25T19:05:07Z
mmm a / test / core / handshake / server_ssl_common . cc <nl> ppp b / test / core / handshake / server_ssl_common . cc <nl> <nl> # include < grpc / support / string_util . h > <nl> # include < grpc / support / sync . h > <nl> <nl> + # include " src / core / lib / gprpp / sync . h " <nl> # include " src / core / lib / gprpp / thd . h " <nl> # include " src / core / lib / iomgr / load_file . h " <nl> # include " test / core / util / port . h " <nl> <nl> # define SSL_KEY_PATH " src / core / tsi / test_creds / server1 . key " <nl> # define SSL_CA_PATH " src / core / tsi / test_creds / ca . pem " <nl> <nl> + namespace { <nl> + <nl> / / Handshake completed signal to server thread . <nl> - static gpr_event client_handshake_complete ; <nl> + gpr_event client_handshake_complete ; <nl> <nl> - static int create_socket ( int port ) { <nl> + int create_socket ( int port ) { <nl> int s ; <nl> struct sockaddr_in addr ; <nl> <nl> static int create_socket ( int port ) { <nl> return s ; <nl> } <nl> <nl> + class ServerInfo { <nl> + public : <nl> + explicit ServerInfo ( int p ) : port_ ( p ) { } <nl> + <nl> + int port ( ) const { return port_ ; } <nl> + <nl> + void Activate ( ) { <nl> + grpc_core : : MutexLock lock ( & mu_ ) ; <nl> + ready_ = true ; <nl> + cv_ . Signal ( ) ; <nl> + } <nl> + <nl> + void Await ( ) { <nl> + grpc_core : : MutexLock lock ( & mu_ ) ; <nl> + cv_ . WaitUntil ( & mu_ , [ this ] { return ready_ ; } ) ; <nl> + } <nl> + <nl> + private : <nl> + const int port_ ; <nl> + grpc_core : : Mutex mu_ ; <nl> + grpc_core : : CondVar cv_ ; <nl> + bool ready_ = false ; <nl> + } ; <nl> + <nl> / / Simple gRPC server . This listens until client_handshake_complete occurs . <nl> - static void server_thread ( void * arg ) { <nl> - const int port = * static_cast < int * > ( arg ) ; <nl> + void server_thread ( void * arg ) { <nl> + ServerInfo * s = static_cast < ServerInfo * > ( arg ) ; <nl> + const int port = s - > port ( ) ; <nl> <nl> / / Load key pair and establish server SSL credentials . <nl> grpc_ssl_pem_key_cert_pair pem_key_cert_pair ; <nl> static void server_thread ( void * arg ) { <nl> grpc_server_register_completion_queue ( server , cq , nullptr ) ; <nl> grpc_server_start ( server ) ; <nl> <nl> + / / Notify the other side that it is now ok to start working since SSL is <nl> + / / definitely already started . <nl> + s - > Activate ( ) ; <nl> + <nl> / / Wait a bounded number of time until client_handshake_complete is set , <nl> / / sleeping between polls . <nl> int retries = 10 ; <nl> static void server_thread ( void * arg ) { <nl> grpc_slice_unref ( ca_slice ) ; <nl> } <nl> <nl> + } / / namespace <nl> + <nl> / / This test launches a gRPC server on a separate thread and then establishes a <nl> / / TLS handshake via a minimal TLS client . The TLS client has configurable ( via <nl> / / alpn_list ) ALPN settings and can probe at the supported ALPN preferences <nl> bool server_ssl_test ( const char * alpn_list [ ] , unsigned int alpn_list_len , <nl> bool success = true ; <nl> <nl> grpc_init ( ) ; <nl> - int port = grpc_pick_unused_port_or_die ( ) ; <nl> + ServerInfo s ( grpc_pick_unused_port_or_die ( ) ) ; <nl> gpr_event_init ( & client_handshake_complete ) ; <nl> <nl> / / Launch the gRPC server thread . <nl> bool ok ; <nl> - grpc_core : : Thread thd ( " grpc_ssl_test " , server_thread , & port , & ok ) ; <nl> + grpc_core : : Thread thd ( " grpc_ssl_test " , server_thread , & s , & ok ) ; <nl> GPR_ASSERT ( ok ) ; <nl> thd . Start ( ) ; <nl> <nl> - SSL_load_error_strings ( ) ; <nl> - OpenSSL_add_ssl_algorithms ( ) ; <nl> + / / The work in server_thread will cause the SSL initialization to take place <nl> + / / so long as we wait for it to reach beyond the point of adding a secure <nl> + / / server port . <nl> + s . Await ( ) ; <nl> <nl> const SSL_METHOD * method = TLSv1_2_client_method ( ) ; <nl> SSL_CTX * ctx = SSL_CTX_new ( method ) ; <nl> bool server_ssl_test ( const char * alpn_list [ ] , unsigned int alpn_list_len , <nl> int retries = 10 ; <nl> int sock = - 1 ; <nl> while ( sock = = - 1 & & retries - - > 0 ) { <nl> - sock = create_socket ( port ) ; <nl> + sock = create_socket ( s . port ( ) ) ; <nl> if ( sock < 0 ) { <nl> sleep ( 1 ) ; <nl> } <nl> } <nl> GPR_ASSERT ( sock > 0 ) ; <nl> - gpr_log ( GPR_INFO , " Connected to server on port % d " , port ) ; <nl> + gpr_log ( GPR_INFO , " Connected to server on port % d " , s . port ( ) ) ; <nl> <nl> / / Establish a SSL * and connect at SSL layer . <nl> SSL * ssl = SSL_new ( ctx ) ; <nl>
Merge pull request from vjpai / sslfix
grpc/grpc
8cd7f6445d58991c0eb566019eb86524590f5258
2019-09-05T18:07:32Z
mmm a / tensorflow / compiler / mlir / tensorflow / tests / shape_inference . mlir <nl> ppp b / tensorflow / compiler / mlir / tensorflow / tests / shape_inference . mlir <nl> module attributes { tf . versions = { bad_consumers = [ ] , min_consumer = 0 : i32 , pr <nl> } <nl> return % 0 : tensor < * xi32 > <nl> } <nl> + <nl> + / / Test shape invariant While only propagates operand handle types into <nl> + / / results and functions / regions . <nl> + / / CHECK - LABEL : func @ while_shape_invariant_propagate <nl> + / / CHECK - SAME : ( { { % . + } } : tensor < 4xf32 > , { { % . + } } : tensor < ! tf . resource < tensor < 4xf32 > > > , { { % . + } } : tensor < ! tf . resource < tensor < 8xf32 > > > , { { % . + } } : tensor < 1xi32 > ) <nl> + / / CHECK - SAME : - > ( tensor < * xf32 > , tensor < * x ! tf . resource < tensor < 4xf32 > > > , tensor < ! tf . resource < tensor < 8xf32 > > > , tensor < ? xi32 > , tensor < * xf32 > , tensor < * x ! tf . resource < tensor < 4xf32 > > > , tensor < ! tf . resource < tensor < 8xf32 > > > , tensor < ? xi32 > ) <nl> + func @ while_shape_invariant_propagate ( % arg0 : tensor < 4xf32 > , % arg1 : tensor < ! tf . resource < tensor < 4xf32 > > > , % arg2 : tensor < ! tf . resource < tensor < 8xf32 > > > , % arg3 : tensor < 1xi32 > ) - > ( tensor < * xf32 > , tensor < * x ! tf . resource > , tensor < ! tf . resource > , tensor < ? xi32 > , tensor < * xf32 > , tensor < * x ! tf . resource > , tensor < ! tf . resource > , tensor < ? xi32 > ) { <nl> + / / CHECK : " tf . While " <nl> + / / CHECK - SAME : ( tensor < 4xf32 > , tensor < ! tf . resource < tensor < 4xf32 > > > , tensor < ! tf . resource < tensor < 8xf32 > > > , tensor < 1xi32 > ) <nl> + / / CHECK - SAME : - > ( tensor < * xf32 > , tensor < * x ! tf . resource < tensor < 4xf32 > > > , tensor < ! tf . resource < tensor < 8xf32 > > > , tensor < ? xi32 > ) <nl> + % 0 : 4 = " tf . While " ( % arg0 , % arg1 , % arg2 , % arg3 ) { cond = @ while_shape_invariant_func_propagate , body = @ while_shape_invariant_body_func_propagate , is_stateless = false , shape_invariant } : ( tensor < 4xf32 > , tensor < ! tf . resource < tensor < 4xf32 > > > , tensor < ! tf . resource < tensor < 8xf32 > > > , tensor < 1xi32 > ) - > ( tensor < * xf32 > , tensor < * x ! tf . resource > , tensor < ! tf . resource > , tensor < ? xi32 > ) <nl> + <nl> + / / CHECK : " tf . WhileRegion " <nl> + % 1 : 4 = " tf . WhileRegion " ( % arg0 , % arg1 , % arg2 , % arg3 ) ( { <nl> + / / CHECK - NEXT : ^ { { . + } } ( { { % . + } } : tensor < * xf32 > , { { % . + } } : tensor < * x ! tf . resource < tensor < 4xf32 > > > , { { % . + } } : tensor < ! tf . resource < tensor < 8xf32 > > > , { { % . + } } : tensor < ? xi32 > ) : <nl> + ^ cond ( % carg0 : tensor < * xf32 > , % carg1 : tensor < * x ! tf . resource > , % carg2 : tensor < ! tf . resource > , % carg3 : tensor < ? xi32 > ) : <nl> + % 2 = " tf . Const " ( ) { value = dense < true > : tensor < i1 > } : ( ) - > tensor < i1 > <nl> + " tf . Yield " ( % 2 ) : ( tensor < i1 > ) - > ( ) <nl> + } , { <nl> + / / CHECK : ^ { { . + } } ( { { % . + } } : tensor < * xf32 > , { { % . + } } : tensor < * x ! tf . resource < tensor < 4xf32 > > > , { { % . + } } : tensor < ! tf . resource < tensor < 8xf32 > > > , { { % . + } } : tensor < ? xi32 > ) : <nl> + ^ body ( % barg0 : tensor < * xf32 > , % barg1 : tensor < * x ! tf . resource > , % barg2 : tensor < ! tf . resource > , % barg3 : tensor < ? xi32 > ) : <nl> + % 2 = " tf . SomeOp " ( % barg3 ) : ( tensor < ? xi32 > ) - > tensor < ? xi32 > <nl> + / / CHECK : " tf . Yield " <nl> + / / CHECK - SAME : ( tensor < * xf32 > , tensor < * x ! tf . resource < tensor < 4xf32 > > > , tensor < ! tf . resource < tensor < 8xf32 > > > , tensor < ? xi32 > ) - > ( ) <nl> + " tf . Yield " ( % barg0 , % barg1 , % barg2 , % 2 ) : ( tensor < * xf32 > , tensor < * x ! tf . resource > , tensor < ! tf . resource > , tensor < ? xi32 > ) - > ( ) <nl> + / / CHECK - NEXT : shape_invariant <nl> + / / CHECK - SAME : ( tensor < 4xf32 > , tensor < ! tf . resource < tensor < 4xf32 > > > , tensor < ! tf . resource < tensor < 8xf32 > > > , tensor < 1xi32 > ) <nl> + / / CHECK - SAME : - > ( tensor < * xf32 > , tensor < * x ! tf . resource < tensor < 4xf32 > > > , tensor < ! tf . resource < tensor < 8xf32 > > > , tensor < ? xi32 > ) <nl> + } ) { is_stateless = false , shape_invariant } : ( tensor < 4xf32 > , tensor < ! tf . resource < tensor < 4xf32 > > > , tensor < ! tf . resource < tensor < 8xf32 > > > , tensor < 1xi32 > ) - > ( tensor < * xf32 > , tensor < * x ! tf . resource > , tensor < ! tf . resource > , tensor < ? xi32 > ) <nl> + <nl> + return % 0 # 0 , % 0 # 1 , % 0 # 2 , % 0 # 3 , % 1 # 0 , % 1 # 1 , % 1 # 2 , % 1 # 3 : tensor < * xf32 > , tensor < * x ! tf . resource > , tensor < ! tf . resource > , tensor < ? xi32 > , tensor < * xf32 > , tensor < * x ! tf . resource > , tensor < ! tf . resource > , tensor < ? xi32 > <nl> + } <nl> + <nl> + / / CHECK - LABEL : func @ while_shape_invariant_func_propagate <nl> + / / CHECK - SAME : ( { { % . + } } : tensor < * xf32 > , { { % . + } } : tensor < * x ! tf . resource < tensor < 4xf32 > > > , { { % . + } } : tensor < ! tf . resource < tensor < 8xf32 > > > , { { % . + } } : tensor < ? xi32 > ) <nl> + / / CHECK - SAME : - > tensor < i1 > <nl> + func @ while_shape_invariant_func_propagate ( % arg0 : tensor < * xf32 > , % arg1 : tensor < * x ! tf . resource > , % arg2 : tensor < ! tf . resource > , % arg3 : tensor < ? xi32 > ) - > tensor < i1 > { <nl> + % 0 = " tf . Const " ( ) { value = dense < true > : tensor < i1 > } : ( ) - > tensor < i1 > <nl> + return % 0 : tensor < i1 > <nl> + } <nl> + <nl> + / / CHECK - LABEL : func @ while_shape_invariant_body_func_propagate <nl> + / / CHECK - SAME : ( { { % . + } } : tensor < * xf32 > , { { % . + } } : tensor < * x ! tf . resource < tensor < 4xf32 > > > , { { % . + } } : tensor < ! tf . resource < tensor < 8xf32 > > > , { { % . + } } : tensor < ? xi32 > ) <nl> + / / CHECK - SAME : - > ( tensor < * xf32 > , tensor < * x ! tf . resource < tensor < 4xf32 > > > , tensor < ! tf . resource < tensor < 8xf32 > > > , tensor < ? xi32 > ) <nl> + func @ while_shape_invariant_body_func_propagate ( % arg0 : tensor < * xf32 > , % arg1 : tensor < * x ! tf . resource > , % arg2 : tensor < ! tf . resource > , % arg3 : tensor < ? xi32 > ) - > ( tensor < * xf32 > , tensor < * x ! tf . resource > , tensor < ! tf . resource > , tensor < ? xi32 > ) { <nl> + % 0 = " tf . SomeOp " ( % arg3 ) : ( tensor < ? xi32 > ) - > tensor < ? xi32 > <nl> + return % arg0 , % arg1 , % arg2 , % 0 : tensor < * xf32 > , tensor < * x ! tf . resource > , tensor < ! tf . resource > , tensor < ? xi32 > <nl> + } <nl> + <nl> + / / Test shape invariant While with result type refinement . <nl> + / / CHECK - LABEL : func @ while_shape_invariant_refine <nl> + / / CHECK - SAME : ( { { % . + } } : tensor < 2xi32 > , { { % . + } } : tensor < 8xf32 > , { { % . + } } : tensor < ? xi1 > ) <nl> + / / CHECK - SAME : - > ( tensor < 2xi32 > , tensor < 8xf32 > , tensor < ? xi1 > , tensor < 2xi32 > , tensor < 8xf32 > , tensor < ? xi1 > ) <nl> + func @ while_shape_invariant_refine ( % arg0 : tensor < 2xi32 > , % arg1 : tensor < 8xf32 > , % arg2 : tensor < ? xi1 > ) - > ( tensor < ? xi32 > , tensor < * xf32 > , tensor < * xi1 > , tensor < ? xi32 > , tensor < * xf32 > , tensor < * xi1 > ) { <nl> + / / CHECK : " tf . While " <nl> + / / CHECK - SAME : ( tensor < 2xi32 > , tensor < 8xf32 > , tensor < ? xi1 > ) <nl> + / / CHECK - SAME : - > ( tensor < 2xi32 > , tensor < 8xf32 > , tensor < ? xi1 > ) <nl> + % 0 : 3 = " tf . While " ( % arg0 , % arg1 , % arg2 ) { cond = @ while_shape_invariant_func_refine , body = @ while_shape_invariant_body_func_refine , is_stateless = false , shape_invariant } : ( tensor < 2xi32 > , tensor < 8xf32 > , tensor < ? xi1 > ) - > ( tensor < ? xi32 > , tensor < * xf32 > , tensor < * xi1 > ) <nl> + <nl> + / / CHECK : " tf . WhileRegion " <nl> + % 1 : 3 = " tf . WhileRegion " ( % arg0 , % arg1 , % arg2 ) ( { <nl> + / / CHECK - NEXT : ^ { { . + } } ( { { % . + } } : tensor < 2xi32 > , { { % . + } } : tensor < 8xf32 > , { { % . + } } : tensor < ? xi1 > ) : <nl> + ^ cond ( % carg0 : tensor < 2xi32 > , % carg1 : tensor < 8xf32 > , % carg2 : tensor < ? xi1 > ) : <nl> + % 2 = " tf . Const " ( ) { value = dense < true > : tensor < i1 > } : ( ) - > tensor < i1 > <nl> + " tf . Yield " ( % 2 ) : ( tensor < i1 > ) - > ( ) <nl> + } , { <nl> + / / CHECK : ^ { { . + } } ( { { % . + } } : tensor < 2xi32 > , { { % . + } } : tensor < 8xf32 > , { { % . + } } : tensor < ? xi1 > ) : <nl> + ^ body ( % barg0 : tensor < 2xi32 > , % barg1 : tensor < 8xf32 > , % barg2 : tensor < ? xi1 > ) : <nl> + % 2 : 3 = " tf . IdentityN " ( % barg0 , % barg1 , % barg2 ) : ( tensor < 2xi32 > , tensor < 8xf32 > , tensor < ? xi1 > ) - > ( tensor < ? xi32 > , tensor < * xf32 > , tensor < * xi1 > ) <nl> + / / CHECK : " tf . Yield " <nl> + / / CHECK - SAME : ( tensor < 2xi32 > , tensor < 8xf32 > , tensor < ? xi1 > ) - > ( ) <nl> + " tf . Yield " ( % 2 # 0 , % 2 # 1 , % 2 # 2 ) : ( tensor < ? xi32 > , tensor < * xf32 > , tensor < * xi1 > ) - > ( ) <nl> + / / CHECK - NEXT : shape_invariant <nl> + / / CHECK - SAME : ( tensor < 2xi32 > , tensor < 8xf32 > , tensor < ? xi1 > ) <nl> + / / CHECK - SAME : - > ( tensor < 2xi32 > , tensor < 8xf32 > , tensor < ? xi1 > ) <nl> + } ) { is_stateless = false , shape_invariant } : ( tensor < 2xi32 > , tensor < 8xf32 > , tensor < ? xi1 > ) - > ( tensor < ? xi32 > , tensor < * xf32 > , tensor < * xi1 > ) <nl> + <nl> + return % 0 # 0 , % 0 # 1 , % 0 # 2 , % 1 # 0 , % 1 # 1 , % 1 # 2 : tensor < ? xi32 > , tensor < * xf32 > , tensor < * xi1 > , tensor < ? xi32 > , tensor < * xf32 > , tensor < * xi1 > <nl> + } <nl> + <nl> + / / CHECK - LABEL : func @ while_shape_invariant_func_refine <nl> + / / CHECK - SAME : ( { { % . + } } : tensor < 2xi32 > , { { % . + } } : tensor < 8xf32 > , { { % . + } } : tensor < ? xi1 > ) <nl> + / / CHECK - SAME : - > tensor < i1 > <nl> + func @ while_shape_invariant_func_refine ( % arg0 : tensor < 2xi32 > , % arg1 : tensor < 8xf32 > , % arg2 : tensor < ? xi1 > ) - > tensor < i1 > { <nl> + % 0 = " tf . Const " ( ) { value = dense < true > : tensor < i1 > } : ( ) - > tensor < i1 > <nl> + return % 0 : tensor < i1 > <nl> + } <nl> + <nl> + / / CHECK - LABEL : func @ while_shape_invariant_body_func_refine <nl> + / / CHECK - SAME : ( { { % . + } } : tensor < 2xi32 > , { { % . + } } : tensor < 8xf32 > , { { % . + } } : tensor < ? xi1 > ) <nl> + / / CHECK - SAME : - > ( tensor < 2xi32 > , tensor < 8xf32 > , tensor < ? xi1 > ) <nl> + func @ while_shape_invariant_body_func_refine ( % arg0 : tensor < 2xi32 > , % arg1 : tensor < 8xf32 > , % arg2 : tensor < ? xi1 > ) - > ( tensor < ? xi32 > , tensor < * xf32 > , tensor < * xi1 > ) { <nl> + % 0 : 3 = " tf . IdentityN " ( % arg0 , % arg1 , % arg2 ) : ( tensor < 2xi32 > , tensor < 8xf32 > , tensor < ? xi1 > ) - > ( tensor < ? xi32 > , tensor < * xf32 > , tensor < * xi1 > ) <nl> + return % 0 # 0 , % 0 # 1 , % 0 # 2 : tensor < ? xi32 > , tensor < * xf32 > , tensor < * xi1 > <nl> + } <nl> } <nl> mmm a / tensorflow / compiler / mlir / tensorflow / transforms / shape_inference . cc <nl> ppp b / tensorflow / compiler / mlir / tensorflow / transforms / shape_inference . cc <nl> class ShapeInference { <nl> results_ [ value_port ] = value ; <nl> } <nl> <nl> + / / Infers shape of tf . While / tf . WhileRegion . If ` shape_invariant ` attribute is <nl> + / / set , operand types are set as result types if associated body result types <nl> + / / match the operand type ( does not change per loop iteration ) . If operand and <nl> + / / body result types are not the same , only handle types are propagated to <nl> + / / result types . This is necessary to not incorrectly change result shapes <nl> + / / when the While op will have a different result shape . Otherwise operand <nl> + / / shapes are propagated to result shapes . <nl> + template < typename WhileOpTy > <nl> + bool InferShapeForWhile ( WhileOpTy op , TypeRange body_result_types ) ; <nl> + <nl> / / Performs shape inference on the provided op and return true if the type of <nl> / / at least one result has been changed . <nl> / / A tf . Cast ( ) is inserted for any uses that isn ' t in the TensorFlow dialect . <nl> class ShapeInference { <nl> / / 1 ) They are never reused , ie . having a single use in module . <nl> / / 2 ) Their input types match those of their parent ops ( excluding inputs <nl> / / like predicate ) . <nl> - LogicalResult PropagateShapeToFunctions ( <nl> - ModuleOp module , Operation : : operand_type_range input_types , <nl> - ArrayRef < FuncOp > functions , int64_t max_iteration ) ; <nl> + LogicalResult PropagateShapeToFunctions ( ModuleOp module , <nl> + TypeRange input_types , <nl> + ArrayRef < FuncOp > functions , <nl> + int64_t max_iteration ) ; <nl> <nl> / / Propagates shapes to regions given the shapes of the inputs of the regions . <nl> / / All regions provided in ` regions ` are assumed to have inputs of type <nl> / / ` input_types ` . <nl> - LogicalResult PropagateShapeToRegions ( <nl> - Operation : : operand_type_range input_types , ArrayRef < Region * > regions , <nl> - int64_t max_iteration ) ; <nl> + LogicalResult PropagateShapeToRegions ( TypeRange input_types , <nl> + ArrayRef < Region * > regions , <nl> + int64_t max_iteration ) ; <nl> <nl> / / Shape propagation for call / control flow ops . <nl> LogicalResult PropagateShapeIntoAttachedFunctions ( Operation * op , <nl> bool ShapeInference : : InferShapeForNonTFDialectOperation ( Operation * op ) { <nl> return false ; <nl> } <nl> <nl> + / / Finds element type to be used for result from operand , with special handling <nl> + / / for handle types . <nl> + Type GetElementTypeFromOperand ( TensorType operand_type , <nl> + TensorType result_type ) { <nl> + auto operand_handle_type = <nl> + operand_type . getElementType ( ) . dyn_cast < TensorFlowTypeWithSubtype > ( ) ; <nl> + if ( ! operand_handle_type ) return result_type . getElementType ( ) ; <nl> + auto result_handle_type = <nl> + result_type . getElementType ( ) . cast < TensorFlowTypeWithSubtype > ( ) ; <nl> + if ( operand_handle_type . GetSubtypes ( ) . empty ( ) | | <nl> + ! result_handle_type . GetSubtypes ( ) . empty ( ) ) <nl> + return result_type . getElementType ( ) ; <nl> + return operand_handle_type ; <nl> + } <nl> + <nl> + template < typename WhileOpTy > <nl> + bool ShapeInference : : InferShapeForWhile ( WhileOpTy op , <nl> + TypeRange body_result_types ) { <nl> + if ( ! op . shape_invariant ( ) ) <nl> + return RefineTypeForPassThroughOperands ( op , op . input ( ) , op . output ( ) ) ; <nl> + <nl> + bool changed = false ; <nl> + for ( auto entry : <nl> + zip ( op . input ( ) . getTypes ( ) , op . output ( ) , body_result_types ) ) { <nl> + auto operand_type = std : : get < 0 > ( entry ) . template cast < TensorType > ( ) ; <nl> + Value result = std : : get < 1 > ( entry ) ; <nl> + auto body_result_type = std : : get < 2 > ( entry ) . template cast < TensorType > ( ) ; <nl> + if ( operand_type = = body_result_type ) { <nl> + changed | = RefineResultType ( op , result , operand_type ) ; <nl> + continue ; <nl> + } <nl> + auto result_type = result . getType ( ) . cast < TensorType > ( ) ; <nl> + Type element_type = GetElementTypeFromOperand ( operand_type , result_type ) ; <nl> + Type potential_refined_type ; <nl> + if ( result_type . hasRank ( ) ) <nl> + potential_refined_type = <nl> + RankedTensorType : : get ( result_type . getShape ( ) , element_type ) ; <nl> + else <nl> + potential_refined_type = UnrankedTensorType : : get ( element_type ) ; <nl> + changed | = RefineResultType ( op , result , potential_refined_type ) ; <nl> + } <nl> + return changed ; <nl> + } <nl> + <nl> bool ShapeInference : : InferShapeForSingleOperation ( Operation * op ) { <nl> LLVM_DEBUG ( op - > print ( llvm : : dbgs ( ) < < " InferShapeForSingleOperation for " ) ; <nl> llvm : : dbgs ( ) < < " \ n " ) ; <nl> bool ShapeInference : : InferShapeForSingleOperation ( Operation * op ) { <nl> / / The shape function of these ops sometimes does not propagate subtypes <nl> / / ( handle shapes ) for resource and variant types . We use a simple passthrough <nl> / / to make sure they are preserved in the output . <nl> - if ( isa < TF : : IdentityOp , TF : : IdentityNOp , TF : : ZerosLikeOp , TF : : WhileOp , <nl> - TF : : WhileRegionOp > ( op ) ) { <nl> + if ( isa < TF : : IdentityOp , TF : : IdentityNOp , TF : : ZerosLikeOp > ( op ) ) { <nl> return RefineTypeForPassThroughOperands ( op , op - > getOperands ( ) , <nl> op - > getResults ( ) ) ; <nl> } <nl> bool ShapeInference : : InferShapeForSingleOperation ( Operation * op ) { <nl> if ( auto if_region = dyn_cast < IfRegionOp > ( op ) ) <nl> return InferShapeForIfRegion ( if_region ) ; <nl> <nl> + if ( auto while_op = dyn_cast < WhileOp > ( op ) ) <nl> + return InferShapeForWhile ( while_op , <nl> + while_op . body_function ( ) . getType ( ) . getResults ( ) ) ; <nl> + <nl> + if ( auto while_region = dyn_cast < WhileRegionOp > ( op ) ) <nl> + return InferShapeForWhile ( <nl> + while_region , <nl> + while_region . body ( ) . front ( ) . getTerminator ( ) - > getOperandTypes ( ) ) ; <nl> + <nl> / / Return operand as a constant attribute . <nl> auto operand_as_constant_fn = [ & ] ( Value operand ) { <nl> ValuePort vp ( operand ) ; <nl> bool ShapeInference : : InferShapeForSingleOperation ( Operation * op ) { <nl> } <nl> <nl> LogicalResult ShapeInference : : PropagateShapeToFunctions ( <nl> - ModuleOp module , Operation : : operand_type_range input_types , <nl> - ArrayRef < FuncOp > functions , int64_t max_iteration ) { <nl> + ModuleOp module , TypeRange input_types , ArrayRef < FuncOp > functions , <nl> + int64_t max_iteration ) { <nl> bool all_succeeded = true ; <nl> / / If shape propagation fails for one function , return failure , but do not <nl> / / early exit and attempt to propagate shapes for all provided functions to <nl> LogicalResult ShapeInference : : PropagateShapeToFunctions ( <nl> return success ( all_succeeded ) ; <nl> } <nl> <nl> - LogicalResult ShapeInference : : PropagateShapeToRegions ( <nl> - Operation : : operand_type_range input_types , ArrayRef < Region * > regions , <nl> - int64_t max_iteration ) { <nl> + LogicalResult ShapeInference : : PropagateShapeToRegions ( TypeRange input_types , <nl> + ArrayRef < Region * > regions , <nl> + int64_t max_iteration ) { <nl> DCOMMENT ( " \ tPropagating shapes to regions " ) ; <nl> bool all_succeeded = true ; <nl> / / If shape propagation fails for one region , return failure , but do not <nl> void ShapeInference : : PropagateConstantFromCallee ( CallOpInterface call_op , <nl> } <nl> } <nl> <nl> + / / Finds compatible types to propagate into functions / regions of a shape variant <nl> + / / tf . While / tf . WhileRegion . If operand and result types are the same , that type <nl> + / / is returned . Otherwise functions / regions arguments are returned but with the <nl> + / / handle type from the operand type . <nl> + / / TODO ( b / 174145518 ) : Support more granular shape refining of different shaped <nl> + / / operands and results ( e . g . if rank does not change or only some dimensions <nl> + / / change ) . <nl> + llvm : : SmallVector < Type , 4 > GetWhileCompatibleTypes ( <nl> + TypeRange operand_types , TypeRange result_types , <nl> + TypeRange region_argument_types ) { <nl> + llvm : : SmallVector < Type , 4 > types ; <nl> + types . reserve ( operand_types . size ( ) ) ; <nl> + for ( auto entry : <nl> + llvm : : zip ( operand_types , result_types , region_argument_types ) ) { <nl> + Type operand_type = std : : get < 0 > ( entry ) ; <nl> + Type result_type = std : : get < 1 > ( entry ) ; <nl> + if ( operand_type = = result_type ) { <nl> + types . push_back ( operand_type ) ; <nl> + } else { <nl> + auto region_argument_type = std : : get < 2 > ( entry ) . cast < TensorType > ( ) ; <nl> + Type element_type = GetElementTypeFromOperand ( <nl> + operand_type . cast < TensorType > ( ) , region_argument_type ) ; <nl> + Type potential_refined_type ; <nl> + if ( region_argument_type . hasRank ( ) ) <nl> + potential_refined_type = RankedTensorType : : get ( <nl> + region_argument_type . getShape ( ) , element_type ) ; <nl> + else <nl> + potential_refined_type = UnrankedTensorType : : get ( element_type ) ; <nl> + types . push_back ( potential_refined_type ) ; <nl> + } <nl> + } <nl> + return types ; <nl> + } <nl> + <nl> LogicalResult ShapeInference : : PropagateShapeIntoAttachedFunctions ( <nl> Operation * op , int64_t max_iteration ) { <nl> ModuleOp module = op - > getParentOfType < ModuleOp > ( ) ; <nl> if ( auto if_op = dyn_cast < TF : : IfOp > ( op ) ) { <nl> DCOMMENT ( " Propagating shapes into If " ) ; <nl> return PropagateShapeToFunctions ( <nl> - module , drop_begin ( if_op . getOperandTypes ( ) , 1 ) , <nl> + module , if_op . input ( ) . getTypes ( ) , <nl> { if_op . then_function ( ) , if_op . else_function ( ) } , max_iteration ) ; <nl> } else if ( auto case_op = dyn_cast < TF : : CaseOp > ( op ) ) { <nl> SmallVector < FuncOp , 4 > branches ; <nl> case_op . get_branch_functions ( branches ) ; <nl> - return PropagateShapeToFunctions ( module , <nl> - drop_begin ( case_op . getOperandTypes ( ) , 1 ) , <nl> + return PropagateShapeToFunctions ( module , case_op . input ( ) . getTypes ( ) , <nl> branches , max_iteration ) ; <nl> } else if ( auto while_op = dyn_cast < TF : : WhileOp > ( op ) ) { <nl> + / / If ` shape_invariant ` is set , operand shapes cannot be simply propagated <nl> + / / to result shapes as the op may have different intermediate shapes ( such <nl> + / / While ops can have different result shapes from operand shapes ) . <nl> + / / Compatible shapes must be determined before propagating them . <nl> + if ( while_op . shape_invariant ( ) ) { <nl> + auto compatible_types = GetWhileCompatibleTypes ( <nl> + while_op . input ( ) . getTypes ( ) , while_op . output ( ) . getTypes ( ) , <nl> + while_op . body_function ( ) . getType ( ) . getInputs ( ) ) ; <nl> + return PropagateShapeToFunctions ( <nl> + module , compatible_types , <nl> + { while_op . cond_function ( ) , while_op . body_function ( ) } , max_iteration ) ; <nl> + } <nl> return PropagateShapeToFunctions ( <nl> - module , while_op . getOperandTypes ( ) , <nl> + module , while_op . input ( ) . getTypes ( ) , <nl> { while_op . cond_function ( ) , while_op . body_function ( ) } , max_iteration ) ; <nl> } else if ( auto call_op = dyn_cast < CallOpInterface > ( op ) ) { <nl> if ( auto func = dyn_cast < FuncOp > ( call_op . resolveCallable ( ) ) ) { <nl> LogicalResult ShapeInference : : PropagateShapeIntoAttachedFunctions ( <nl> LogicalResult ShapeInference : : PropagateShapeIntoAttachedRegions ( <nl> Operation * op , int64_t max_iteration ) { <nl> if ( auto while_op = dyn_cast < TF : : WhileRegionOp > ( op ) ) { <nl> - return PropagateShapeToRegions ( while_op . getOperandTypes ( ) , <nl> + / / If ` shape_invariant ` is set , operand shapes cannot be simply propagated <nl> + / / to result shapes as the op may have different intermediate shapes ( such <nl> + / / While ops can have different result shapes from operand shapes ) . <nl> + / / Compatible shapes must be determined before propagating them . <nl> + if ( while_op . shape_invariant ( ) ) { <nl> + auto compatible_types = GetWhileCompatibleTypes ( <nl> + while_op . input ( ) . getTypes ( ) , while_op . output ( ) . getTypes ( ) , <nl> + while_op . body ( ) . getArgumentTypes ( ) ) ; <nl> + return PropagateShapeToRegions ( compatible_types , <nl> + { & while_op . cond ( ) , & while_op . body ( ) } , <nl> + max_iteration ) ; <nl> + } <nl> + return PropagateShapeToRegions ( while_op . input ( ) . getTypes ( ) , <nl> { & while_op . cond ( ) , & while_op . body ( ) } , <nl> max_iteration ) ; <nl> } <nl>
Update tf . While / tf . WhileRegion shape inference to support different operand and result shapes .
tensorflow/tensorflow
3c572a3c558740c6e724ae70c175561b45003560
2020-11-25T16:22:12Z
mmm a / TASKS . md <nl> ppp b / TASKS . md <nl> <nl> # Tasks <nl> <nl> - [ ] Migrate Objective - C code to Swift . <nl> + - [ x ] EventViewer <nl> + - [ ] KarabinerKit <nl> + - [ ] Menu <nl> + - [ ] Preferences <nl> + - [ ] Updater <nl> + - [ ] MultitouchExtension <nl> + - [ ] NotificationWindow <nl> + - [ ] Migrate to SwiftUI . <nl> + - [ ] EventViewer <nl> + - [ ] Menu <nl> + - [ ] Preferences <nl> + - [ ] MultitouchExtension <nl> + - [ ] NotificationWindow <nl> - [ ] Add IOHIDSystem keyboard implementation to support own adjustable key repeat feature . <nl> - [ ] Add ` event_type ` to ` to ` in order to support ` key_down ` only event . <nl> - [ ] Add mouse movement to source events . <nl>
Update TASKS
pqrs-org/Karabiner-Elements
152eeb34577f5dcf79b7b96028f433ade1659f5c
2020-09-26T13:16:20Z
mmm a / utils / build - presets . ini <nl> ppp b / utils / build - presets . ini <nl> lldb - assertions <nl> [ preset : buildbot_incremental_base ] <nl> test <nl> validation - test <nl> - lit - args = - v <nl> + lit - args = - v - - time - tests <nl> <nl> compiler - vendor = apple <nl> <nl> foundation <nl> libdispatch <nl> indexstore - db <nl> sourcekit - lsp <nl> - lit - args = - v <nl> + lit - args = - v - - time - tests <nl> <nl> dash - dash <nl> <nl> mixin - preset = buildbot_linux <nl> debug - foundation <nl> <nl> [ preset : buildbot_linux , foundation = release ] <nl> - mixin - preset = buildbot_linux <nl> \ No newline at end of file <nl> + mixin - preset = buildbot_linux <nl>
Merge pull request from apple / shahmishal - patch - 2
apple/swift
de1752b39eb314f895ae534b2abe144188bfb3aa
2019-02-26T18:21:34Z
mmm a / scene / gui / text_edit . cpp <nl> ppp b / scene / gui / text_edit . cpp <nl> void TextEdit : : _update_completion_candidates ( ) { <nl> int ci_match = 0 ; <nl> Vector < float > sim_cache ; <nl> for ( int i = 0 ; i < completion_strings . size ( ) ; i + + ) { <nl> + if ( s = = completion_strings [ i ] ) { <nl> + / / A perfect match , stop completion <nl> + _cancel_completion ( ) ; <nl> + return ; <nl> + } <nl> if ( s . is_subsequence_ofi ( completion_strings [ i ] ) ) { <nl> / / don ' t remove duplicates if no input is provided <nl> if ( s ! = " " & & completion_options . find ( completion_strings [ i ] ) ! = - 1 ) { <nl>
Stop completion when the match is perfect
godotengine/godot
ec18b97f5cdc3fcf67cb2625d289cb061958b2b6
2016-07-03T14:34:23Z
mmm a / scene / animation / animation_player . cpp <nl> ppp b / scene / animation / animation_player . cpp <nl> void AnimationPlayer : : _ensure_node_caches ( AnimationData * p_anim ) { <nl> key . id = id ; <nl> key . bone_idx = bone_idx ; <nl> <nl> - if ( node_cache_map . has ( key ) ) { <nl> - <nl> - p_anim - > node_cache . write [ i ] = & node_cache_map [ key ] ; <nl> - } else { <nl> - <nl> + if ( ! node_cache_map . has ( key ) ) <nl> node_cache_map [ key ] = TrackNodeCache ( ) ; <nl> <nl> - p_anim - > node_cache . write [ i ] = & node_cache_map [ key ] ; <nl> - p_anim - > node_cache [ i ] - > path = a - > track_get_path ( i ) ; <nl> - p_anim - > node_cache [ i ] - > node = child ; <nl> - p_anim - > node_cache [ i ] - > resource = resource ; <nl> - p_anim - > node_cache [ i ] - > node_2d = Object : : cast_to < Node2D > ( child ) ; <nl> - if ( a - > track_get_type ( i ) = = Animation : : TYPE_TRANSFORM ) { <nl> - / / special cases and caches for transform tracks <nl> - <nl> - / / cache spatial <nl> - p_anim - > node_cache [ i ] - > spatial = Object : : cast_to < Spatial > ( child ) ; <nl> - / / cache skeleton <nl> - p_anim - > node_cache [ i ] - > skeleton = Object : : cast_to < Skeleton > ( child ) ; <nl> - if ( p_anim - > node_cache [ i ] - > skeleton ) { <nl> - <nl> - if ( a - > track_get_path ( i ) . get_subname_count ( ) = = 1 ) { <nl> - StringName bone_name = a - > track_get_path ( i ) . get_subname ( 0 ) ; <nl> - <nl> - p_anim - > node_cache [ i ] - > bone_idx = p_anim - > node_cache [ i ] - > skeleton - > find_bone ( bone_name ) ; <nl> - if ( p_anim - > node_cache [ i ] - > bone_idx < 0 ) { <nl> - / / broken track ( nonexistent bone ) <nl> - p_anim - > node_cache [ i ] - > skeleton = NULL ; <nl> - p_anim - > node_cache [ i ] - > spatial = NULL ; <nl> - printf ( " bone is % ls \ n " , String ( bone_name ) . c_str ( ) ) ; <nl> - ERR_CONTINUE ( p_anim - > node_cache [ i ] - > bone_idx < 0 ) ; <nl> - } else { <nl> - } <nl> - } else { <nl> - / / no property , just use spatialnode <nl> + p_anim - > node_cache . write [ i ] = & node_cache_map [ key ] ; <nl> + p_anim - > node_cache [ i ] - > path = a - > track_get_path ( i ) ; <nl> + p_anim - > node_cache [ i ] - > node = child ; <nl> + p_anim - > node_cache [ i ] - > resource = resource ; <nl> + p_anim - > node_cache [ i ] - > node_2d = Object : : cast_to < Node2D > ( child ) ; <nl> + if ( a - > track_get_type ( i ) = = Animation : : TYPE_TRANSFORM ) { <nl> + / / special cases and caches for transform tracks <nl> + <nl> + / / cache spatial <nl> + p_anim - > node_cache [ i ] - > spatial = Object : : cast_to < Spatial > ( child ) ; <nl> + / / cache skeleton <nl> + p_anim - > node_cache [ i ] - > skeleton = Object : : cast_to < Skeleton > ( child ) ; <nl> + if ( p_anim - > node_cache [ i ] - > skeleton ) { <nl> + if ( a - > track_get_path ( i ) . get_subname_count ( ) = = 1 ) { <nl> + StringName bone_name = a - > track_get_path ( i ) . get_subname ( 0 ) ; <nl> + <nl> + p_anim - > node_cache [ i ] - > bone_idx = p_anim - > node_cache [ i ] - > skeleton - > find_bone ( bone_name ) ; <nl> + if ( p_anim - > node_cache [ i ] - > bone_idx < 0 ) { <nl> + / / broken track ( nonexistent bone ) <nl> p_anim - > node_cache [ i ] - > skeleton = NULL ; <nl> + p_anim - > node_cache [ i ] - > spatial = NULL ; <nl> + printf ( " bone is % ls \ n " , String ( bone_name ) . c_str ( ) ) ; <nl> + ERR_CONTINUE ( p_anim - > node_cache [ i ] - > bone_idx < 0 ) ; <nl> } <nl> + } else { <nl> + / / no property , just use spatialnode <nl> + p_anim - > node_cache [ i ] - > skeleton = NULL ; <nl> } <nl> } <nl> } <nl>
Merge pull request from DualMatrix / animation_track
godotengine/godot
497853c383677c130f818d4988dcf52beb4e0ece
2018-09-10T17:01:18Z
mmm a / jstests / core / recursion . js <nl> ppp b / jstests / core / recursion . js <nl> <nl> / / Basic tests for a form of stack recursion that ' s been shown to cause C + + <nl> / / side stack overflows in the past . See SERVER - 19614 . <nl> <nl> - ( function ( ) { <nl> - " use strict " ; <nl> - <nl> - db . recursion . drop ( ) ; <nl> - <nl> - / / Make sure the shell doesn ' t blow up <nl> - function shellRecursion ( ) { <nl> - shellRecursion . apply ( ) ; <nl> - } <nl> - assert . throws ( shellRecursion ) ; <nl> - <nl> - / / Make sure db . eval doesn ' t blow up <nl> - function dbEvalRecursion ( ) { <nl> - db . eval ( function ( ) { <nl> - function recursion ( ) { <nl> - recursion . apply ( ) ; <nl> - } <nl> - recursion ( ) ; <nl> - } ) ; <nl> - } <nl> - assert . commandFailedWithCode ( assert . throws ( dbEvalRecursion ) , ErrorCodes . JSInterpreterFailure ) ; <nl> - <nl> - / / Make sure mapReduce doesn ' t blow up <nl> - function mapReduceRecursion ( ) { <nl> - db . recursion . mapReduce ( function ( ) { <nl> - ( function recursion ( ) { <nl> - recursion . apply ( ) ; <nl> - } ) ( ) ; <nl> - } , function ( ) { <nl> - } , { <nl> - out : ' inline ' <nl> - } ) ; <nl> - } <nl> - <nl> - db . recursion . insert ( { } ) ; <nl> - assert . commandFailedWithCode ( <nl> - assert . throws ( mapReduceRecursion ) , ErrorCodes . JSInterpreterFailure ) ; <nl> - } ( ) ) ; <nl> + / / TODO : Re - enable this test once SERVER - 19614 has been resolved in a <nl> + / / way that does not conflict with SERVER - 20678 . See the similar <nl> + / / comment in src / mongo / scripting / mozjs / implscope . cpp for additional <nl> + / / details . <nl> + / / <nl> + / / ( function ( ) { <nl> + / / " use strict " ; <nl> + / / <nl> + / / db . recursion . drop ( ) ; <nl> + / / <nl> + / / / / Make sure the shell doesn ' t blow up <nl> + / / function shellRecursion ( ) { <nl> + / / shellRecursion . apply ( ) ; <nl> + / / } <nl> + / / assert . throws ( shellRecursion ) ; <nl> + / / <nl> + / / / / Make sure db . eval doesn ' t blow up <nl> + / / function dbEvalRecursion ( ) { <nl> + / / db . eval ( function ( ) { <nl> + / / function recursion ( ) { <nl> + / / recursion . apply ( ) ; <nl> + / / } <nl> + / / recursion ( ) ; <nl> + / / } ) ; <nl> + / / } <nl> + / / assert . commandFailedWithCode ( assert . throws ( dbEvalRecursion ) , ErrorCodes . JSInterpreterFailure ) ; <nl> + / / <nl> + / / / / Make sure mapReduce doesn ' t blow up <nl> + / / function mapReduceRecursion ( ) { <nl> + / / db . recursion . mapReduce ( function ( ) { <nl> + / / ( function recursion ( ) { <nl> + / / recursion . apply ( ) ; <nl> + / / } ) ( ) ; <nl> + / / } , function ( ) { <nl> + / / } , { <nl> + / / out : ' inline ' <nl> + / / } ) ; <nl> + / / } <nl> + / / <nl> + / / db . recursion . insert ( { } ) ; <nl> + / / assert . commandFailedWithCode ( <nl> + / / assert . throws ( mapReduceRecursion ) , ErrorCodes . JSInterpreterFailure ) ; <nl> + / / } ( ) ) ; <nl> mmm a / src / mongo / scripting / mozjs / implscope . cpp <nl> ppp b / src / mongo / scripting / mozjs / implscope . cpp <nl> MozJSImplScope : : MozRuntime : : MozRuntime ( ) { <nl> <nl> _runtime = JS_NewRuntime ( kMaxBytesBeforeGC ) ; <nl> <nl> - static_assert ( kMaxStackBytes > ( 32 * 1024 ) , " kMaxStackBytes must be larger than 32k " ) ; <nl> - <nl> - JS_SetNativeStackQuota ( _runtime , kMaxStackBytes - ( 32 * 1024 ) ) ; <nl> + / / TODO : Re - enable this when it can be done in a way that does <nl> + / / not conflict with the performance fix in SERVER - 20678 . The <nl> + / / jscore / recursion . js tes tshould be re - enabled when this is <nl> + / / uncommented . <nl> + / / <nl> + / / static_assert ( kMaxStackBytes > ( 32 * 1024 ) , " kMaxStackBytes must be larger than 32k " ) ; <nl> + / / JS_SetNativeStackQuota ( _runtime , kMaxStackBytes - ( 32 * 1024 ) ) ; <nl> } <nl> <nl> uassert ( ErrorCodes : : JSInterpreterFailure , " Failed to initialize JSRuntime " , _runtime ) ; <nl>
SERVER - 19614 Temporarily disable JS recursion depth protections
mongodb/mongo
804f8c7b926f999cd1eeaf4ebe50dfb99f7acfad
2015-10-13T20:44:10Z
mmm a / db / repl / rs . cpp <nl> ppp b / db / repl / rs . cpp <nl> namespace mongo { <nl> loadLastOpTimeWritten ( ) ; <nl> } <nl> catch ( std : : exception & e ) { <nl> - log ( ) < < " replSet ERROR FATAL couldn ' t query the local " < < rsoplog < < " collection . Terminating mongod after 30 seconds . " < < rsLog ; <nl> + log ( ) < < " replSet error fatal couldn ' t query the local " < < rsoplog < < " collection . Terminating mongod after 30 seconds . " < < rsLog ; <nl> log ( ) < < e . what ( ) < < rsLog ; <nl> sleepsecs ( 30 ) ; <nl> dbexit ( EXIT_REPLICATION_ERROR ) ; <nl>
lowercase
mongodb/mongo
5ab160eba7c3371558fa4bae7e45fc228ac56feb
2010-08-31T07:03:09Z
mmm a / src / php / tests / qps / client . php <nl> ppp b / src / php / tests / qps / client . php <nl> <nl> * / <nl> <nl> require dirname ( __FILE__ ) . ' / vendor / autoload . php ' ; <nl> + require dirname ( __FILE__ ) . ' / histogram . php ' ; <nl> <nl> / * * <nl> * Assertion function that always exits with an error code if the assertion is <nl> function hardAssertIfStatusOk ( $ status ) <nl> } <nl> <nl> / * Start the actual client * / <nl> - <nl> - function qps_client_main ( $ proxy_address ) { <nl> - echo " Initiating php client \ n " ; <nl> + function qps_client_main ( $ proxy_address , $ server_ind ) { <nl> + echo " [ php - client ] Initiating php client \ n " ; <nl> <nl> $ proxystubopts = [ ] ; <nl> $ proxystubopts [ ' credentials ' ] = Grpc \ ChannelCredentials : : createInsecure ( ) ; <nl> $ proxystub = new Grpc \ Testing \ ProxyClientServiceClient ( $ proxy_address , $ proxystubopts ) ; <nl> list ( $ config , $ status ) = $ proxystub - > GetConfig ( new Grpc \ Testing \ Void ( ) ) - > wait ( ) ; <nl> hardAssertIfStatusOk ( $ status ) ; <nl> - hardAssert ( $ config - > getClientChannels ( ) = = 1 , " Only 1 channel supported " ) ; <nl> hardAssert ( $ config - > getOutstandingRpcsPerChannel ( ) = = 1 , " Only 1 outstanding RPC supported " ) ; <nl> <nl> - echo " Got configuration from proxy , target is " . $ config - > getServerTargets ( ) [ 0 ] . " \ n " ; <nl> + echo " [ php - client ] Got configuration from proxy , target is ' $ server_ind ' th server " . $ config - > getServerTargets ( ) [ $ server_ind ] . " \ n " ; <nl> + $ histres = $ config - > getHistogramParams ( ) - > getResolution ( ) ; <nl> + $ histmax = $ config - > getHistogramParams ( ) - > getMaxPossible ( ) ; <nl> <nl> $ stubopts = [ ] ; <nl> if ( $ config - > getSecurityParams ( ) ) { <nl> function qps_client_main ( $ proxy_address ) { <nl> } else { <nl> $ stubopts [ ' credentials ' ] = Grpc \ ChannelCredentials : : createInsecure ( ) ; <nl> } <nl> - echo " Initiating php benchmarking client \ n " ; <nl> + echo " [ php - client ] Initiating php benchmarking client \ n " ; <nl> <nl> $ stub = new Grpc \ Testing \ BenchmarkServiceClient ( <nl> - $ config - > getServerTargets ( ) [ 0 ] , $ stubopts ) ; <nl> + $ config - > getServerTargets ( ) [ $ server_ind ] , $ stubopts ) ; <nl> $ req = new Grpc \ Testing \ SimpleRequest ( ) ; <nl> <nl> $ req - > setResponseType ( Grpc \ Testing \ PayloadType : : COMPRESSABLE ) ; <nl> function qps_client_main ( $ proxy_address ) { <nl> } else { <nl> $ poisson = false ; <nl> } <nl> - $ metric = new Grpc \ Testing \ ProxyStat ; <nl> - $ telemetry = $ proxystub - > ReportTime ( ) ; <nl> + $ histogram = new Histogram ( $ histres , $ histmax ) ; <nl> + $ histogram - > clean ( ) ; <nl> + $ count = 0 ; <nl> + $ histogram_result = new Grpc \ Testing \ HistogramData ; <nl> + $ telehist = $ proxystub - > ReportHist ( ) ; <nl> if ( $ config - > getRpcType ( ) = = Grpc \ Testing \ RpcType : : UNARY ) { <nl> while ( 1 ) { <nl> if ( $ poisson ) { <nl> function qps_client_main ( $ proxy_address ) { <nl> $ startreq = microtime ( true ) ; <nl> list ( $ resp , $ status ) = $ stub - > UnaryCall ( $ req ) - > wait ( ) ; <nl> hardAssertIfStatusOk ( $ status ) ; <nl> - $ metric - > setLatency ( microtime ( true ) - $ startreq ) ; <nl> - $ telemetry - > write ( $ metric ) ; <nl> + $ histogram - > add ( ( microtime ( true ) - $ startreq ) * 1e9 ) ; <nl> + $ count + = 1 ; <nl> + if ( $ count = = 2000 ) { <nl> + $ contents = $ histogram - > contents ( ) ; <nl> + $ histogram_result - > setBucket ( $ contents ) ; <nl> + $ histogram_result - > setMinSeen ( $ histogram - > minimum ( ) ) ; <nl> + $ histogram_result - > setMaxSeen ( $ histogram - > maximum ( ) ) ; <nl> + $ histogram_result - > setSum ( $ histogram - > sum ( ) ) ; <nl> + $ histogram_result - > setSumOfSquares ( $ histogram - > sum_of_squares ( ) ) ; <nl> + $ histogram_result - > setCount ( $ histogram - > count ( ) ) ; <nl> + $ telehist - > write ( $ histogram_result ) ; <nl> + $ histogram - > clean ( ) ; <nl> + $ count = 0 ; <nl> + } <nl> } <nl> } else { <nl> $ stream = $ stub - > StreamingCall ( ) ; <nl> function qps_client_main ( $ proxy_address ) { <nl> $ startreq = microtime ( true ) ; <nl> $ stream - > write ( $ req ) ; <nl> $ resp = $ stream - > read ( ) ; <nl> - $ metric - > setLatency ( microtime ( true ) - $ startreq ) ; <nl> - $ telemetry - > write ( $ metric ) ; <nl> + $ histogram - > add ( ( microtime ( true ) - $ startreq ) * 1e9 ) ; <nl> + $ count + = 1 ; <nl> + if ( $ count = = 2000 ) { <nl> + $ contents = $ histogram - > contents ( ) ; <nl> + $ histogram_result - > setBucket ( $ contents ) ; <nl> + $ histogram_result - > setMinSeen ( $ histogram - > minimum ( ) ) ; <nl> + $ histogram_result - > setMaxSeen ( $ histogram - > maximum ( ) ) ; <nl> + $ histogram_result - > setSum ( $ histogram - > sum ( ) ) ; <nl> + $ histogram_result - > setSumOfSquares ( $ histogram - > sum_of_squares ( ) ) ; <nl> + $ histogram_result - > setCount ( $ histogram - > count ( ) ) ; <nl> + $ telehist - > write ( $ histogram_result ) ; <nl> + $ histogram - > clean ( ) ; <nl> + $ count = 0 ; <nl> + } <nl> } <nl> } <nl> } <nl> function qps_client_main ( $ proxy_address ) { <nl> ini_set ( ' display_startup_errors ' , 1 ) ; <nl> ini_set ( ' display_errors ' , 1 ) ; <nl> error_reporting ( - 1 ) ; <nl> - qps_client_main ( $ argv [ 1 ] ) ; <nl> + qps_client_main ( $ argv [ 1 ] , $ argv [ 2 ] ) ; <nl> new file mode 100644 <nl> index 00000000000 . . f9c710cd4e0 <nl> mmm / dev / null <nl> ppp b / src / php / tests / qps / generated_code / GPBMetadata / Src / Proto / Grpc / Core / Stats . php <nl> <nl> + < ? php <nl> + # Generated by the protocol buffer compiler . DO NOT EDIT ! <nl> + # source : src / proto / grpc / core / stats . proto <nl> + <nl> + namespace GPBMetadata \ Src \ Proto \ Grpc \ Core ; <nl> + <nl> + class Stats <nl> + { <nl> + public static $ is_initialized = false ; <nl> + <nl> + public static function initOnce ( ) { <nl> + $ pool = \ Google \ Protobuf \ Internal \ DescriptorPool : : getGeneratedPool ( ) ; <nl> + <nl> + if ( static : : $ is_initialized = = true ) { <nl> + return ; <nl> + } <nl> + $ pool - > internalAddGeneratedFile ( hex2bin ( <nl> + " 0a97020a1f7372632f70726f746f2f677270632f636f72652f7374617473 " . <nl> + " 2e70726f746f1209677270632e636f726522260a064275636b6574120d0a " . <nl> + " 057374617274180120012801120d0a05636f756e74180220012804222f0a " . <nl> + " 09486973746f6772616d12220a076275636b65747318012003280b32112e " . <nl> + " 677270632e636f72652e4275636b6574225b0a064d6574726963120c0a04 " . <nl> + " 6e616d65180120012809120f0a05636f756e74180a20012804480012290a " . <nl> + " 09686973746f6772616d180b2001280b32142e677270632e636f72652e48 " . <nl> + " 6973746f6772616d480042070a0576616c7565222b0a0553746174731222 " . <nl> + " 0a076d65747269637318012003280b32112e677270632e636f72652e4d65 " . <nl> + " 74726963620670726f746f33 " <nl> + ) ) ; <nl> + <nl> + static : : $ is_initialized = true ; <nl> + } <nl> + } <nl> + <nl> mmm a / src / php / tests / qps / generated_code / GPBMetadata / Src / Proto / Grpc / Testing / Control . php <nl> ppp b / src / php / tests / qps / generated_code / GPBMetadata / Src / Proto / Grpc / Testing / Control . php <nl> public static function initOnce ( ) { <nl> \ GPBMetadata \ Src \ Proto \ Grpc \ Testing \ Payloads : : initOnce ( ) ; <nl> \ GPBMetadata \ Src \ Proto \ Grpc \ Testing \ Stats : : initOnce ( ) ; <nl> $ pool - > internalAddGeneratedFile ( hex2bin ( <nl> - " 0add170a247372632f70726f746f2f677270632f74657374696e672f636f " . <nl> - " 6e74726f6c2e70726f746f120c677270632e74657374696e671a25737263 " . <nl> - " 2f70726f746f2f677270632f74657374696e672f7061796c6f6164732e70 " . <nl> - " 726f746f1a227372632f70726f746f2f677270632f74657374696e672f73 " . <nl> - " 746174732e70726f746f22250a0d506f6973736f6e506172616d7312140a " . <nl> - " 0c6f6666657265645f6c6f616418012001280122120a10436c6f7365644c " . <nl> - " 6f6f70506172616d73227b0a0a4c6f6164506172616d7312350a0b636c6f " . <nl> - " 7365645f6c6f6f7018012001280b321e2e677270632e74657374696e672e " . <nl> - " 436c6f7365644c6f6f70506172616d734800122e0a07706f6973736f6e18 " . <nl> - " 022001280b321b2e677270632e74657374696e672e506f6973736f6e5061 " . <nl> - " 72616d73480042060a046c6f616422430a0e536563757269747950617261 " . <nl> - " 6d7312130a0b7573655f746573745f6361180120012808121c0a14736572 " . <nl> - " 7665725f686f73745f6f76657272696465180220012809224d0a0a436861 " . <nl> - " 6e6e656c417267120c0a046e616d6518012001280912130a097374725f76 " . <nl> - " 616c7565180220012809480012130a09696e745f76616c75651803200128 " . <nl> - " 05480042070a0576616c756522a0040a0c436c69656e74436f6e66696712 " . <nl> - " 160a0e7365727665725f74617267657473180120032809122d0a0b636c69 " . <nl> - " 656e745f7479706518022001280e32182e677270632e74657374696e672e " . <nl> - " 436c69656e745479706512350a0f73656375726974795f706172616d7318 " . <nl> - " 032001280b321c2e677270632e74657374696e672e536563757269747950 " . <nl> - " 6172616d7312240a1c6f75747374616e64696e675f727063735f7065725f " . <nl> - " 6368616e6e656c18042001280512170a0f636c69656e745f6368616e6e65 " . <nl> - " 6c73180520012805121c0a146173796e635f636c69656e745f7468726561 " . <nl> - " 647318072001280512270a087270635f7479706518082001280e32152e67 " . <nl> - " 7270632e74657374696e672e52706354797065122d0a0b6c6f61645f7061 " . <nl> - " 72616d73180a2001280b32182e677270632e74657374696e672e4c6f6164 " . <nl> - " 506172616d7312330a0e7061796c6f61645f636f6e666967180b2001280b " . <nl> - " 321b2e677270632e74657374696e672e5061796c6f6164436f6e66696712 " . <nl> - " 370a10686973746f6772616d5f706172616d73180c2001280b321d2e6772 " . <nl> - " 70632e74657374696e672e486973746f6772616d506172616d7312110a09 " . <nl> - " 636f72655f6c697374180d2003280512120a0a636f72655f6c696d697418 " . <nl> - " 0e2001280512180a106f746865725f636c69656e745f617069180f200128 " . <nl> - " 09122e0a0c6368616e6e656c5f6172677318102003280b32182e67727063 " . <nl> - " 2e74657374696e672e4368616e6e656c41726722380a0c436c69656e7453 " . <nl> - " 746174757312280a05737461747318012001280b32192e677270632e7465 " . <nl> - " 7374696e672e436c69656e74537461747322150a044d61726b120d0a0572 " . <nl> - " 6573657418012001280822680a0a436c69656e7441726773122b0a057365 " . <nl> - " 74757018012001280b321a2e677270632e74657374696e672e436c69656e " . <nl> - " 74436f6e666967480012220a046d61726b18022001280b32122e67727063 " . <nl> - " 2e74657374696e672e4d61726b480042090a076172677479706522b4020a " . <nl> - " 0c536572766572436f6e666967122d0a0b7365727665725f747970651801 " . <nl> - " 2001280e32182e677270632e74657374696e672e53657276657254797065 " . <nl> - " 12350a0f73656375726974795f706172616d7318022001280b321c2e6772 " . <nl> - " 70632e74657374696e672e5365637572697479506172616d73120c0a0470 " . <nl> - " 6f7274180420012805121c0a146173796e635f7365727665725f74687265 " . <nl> - " 61647318072001280512120a0a636f72655f6c696d697418082001280512 " . <nl> - " 330a0e7061796c6f61645f636f6e66696718092001280b321b2e67727063 " . <nl> - " 2e74657374696e672e5061796c6f6164436f6e66696712110a09636f7265 " . <nl> - " 5f6c697374180a2003280512180a106f746865725f7365727665725f6170 " . <nl> - " 69180b20012809121c0a137265736f757263655f71756f74615f73697a65 " . <nl> - " 18e9072001280522680a0a53657276657241726773122b0a057365747570 " . <nl> - " 18012001280b321a2e677270632e74657374696e672e536572766572436f " . <nl> - " 6e666967480012220a046d61726b18022001280b32122e677270632e7465 " . <nl> - " 7374696e672e4d61726b480042090a076172677479706522550a0c536572 " . <nl> - " 76657253746174757312280a05737461747318012001280b32192e677270 " . <nl> - " 632e74657374696e672e5365727665725374617473120c0a04706f727418 " . <nl> - " 0220012805120d0a05636f726573180320012805220d0a0b436f72655265 " . <nl> - " 7175657374221d0a0c436f7265526573706f6e7365120d0a05636f726573 " . <nl> - " 18012001280522060a04566f696422fd010a085363656e6172696f120c0a " . <nl> - " 046e616d6518012001280912310a0d636c69656e745f636f6e6669671802 " . <nl> - " 2001280b321a2e677270632e74657374696e672e436c69656e74436f6e66 " . <nl> - " 696712130a0b6e756d5f636c69656e747318032001280512310a0d736572 " . <nl> - " 7665725f636f6e66696718042001280b321a2e677270632e74657374696e " . <nl> - " 672e536572766572436f6e66696712130a0b6e756d5f7365727665727318 " . <nl> - " 052001280512160a0e7761726d75705f7365636f6e647318062001280512 " . <nl> - " 190a1162656e63686d61726b5f7365636f6e647318072001280512200a18 " . <nl> - " 737061776e5f6c6f63616c5f776f726b65725f636f756e74180820012805 " . <nl> - " 22360a095363656e6172696f7312290a097363656e6172696f7318012003 " . <nl> - " 280b32162e677270632e74657374696e672e5363656e6172696f22f8020a " . <nl> - " 155363656e6172696f526573756c7453756d6d617279120b0a0371707318 " . <nl> - " 0120012801121b0a137170735f7065725f7365727665725f636f72651802 " . <nl> - " 20012801121a0a127365727665725f73797374656d5f74696d6518032001 " . <nl> - " 280112180a107365727665725f757365725f74696d65180420012801121a " . <nl> - " 0a12636c69656e745f73797374656d5f74696d6518052001280112180a10 " . <nl> - " 636c69656e745f757365725f74696d6518062001280112120a0a6c617465 " . <nl> - " 6e63795f353018072001280112120a0a6c6174656e63795f393018082001 " . <nl> - " 280112120a0a6c6174656e63795f393518092001280112120a0a6c617465 " . <nl> - " 6e63795f3939180a2001280112130a0b6c6174656e63795f393939180b20 " . <nl> - " 01280112180a107365727665725f6370755f7573616765180c2001280112 " . <nl> - " 260a1e7375636365737366756c5f72657175657374735f7065725f736563 " . <nl> - " 6f6e64180d2001280112220a1a6661696c65645f72657175657374735f70 " . <nl> - " 65725f7365636f6e64180e200128012283030a0e5363656e6172696f5265 " . <nl> - " 73756c7412280a087363656e6172696f18012001280b32162e677270632e " . <nl> - " 74657374696e672e5363656e6172696f122e0a096c6174656e6369657318 " . <nl> - " 022001280b321b2e677270632e74657374696e672e486973746f6772616d " . <nl> - " 44617461122f0a0c636c69656e745f737461747318032003280b32192e67 " . <nl> - " 7270632e74657374696e672e436c69656e745374617473122f0a0c736572 " . <nl> - " 7665725f737461747318042003280b32192e677270632e74657374696e67 " . <nl> - " 2e536572766572537461747312140a0c7365727665725f636f7265731805 " . <nl> - " 2003280512340a0773756d6d61727918062001280b32232e677270632e74 " . <nl> - " 657374696e672e5363656e6172696f526573756c7453756d6d6172791216 " . <nl> - " 0a0e636c69656e745f7375636365737318072003280812160a0e73657276 " . <nl> - " 65725f7375636365737318082003280812390a0f726571756573745f7265 " . <nl> - " 73756c747318092003280b32202e677270632e74657374696e672e526571 " . <nl> - " 75657374526573756c74436f756e742a410a0a436c69656e745479706512 " . <nl> - " 0f0a0b53594e435f434c49454e54100012100a0c4153594e435f434c4945 " . <nl> - " 4e54100112100a0c4f544845525f434c49454e5410022a5b0a0a53657276 " . <nl> - " 657254797065120f0a0b53594e435f534552564552100012100a0c415359 " . <nl> - " 4e435f534552564552100112180a144153594e435f47454e455249435f53 " . <nl> - " 4552564552100212100a0c4f544845525f53455256455210032a230a0752 " . <nl> - " 70635479706512090a05554e4152591000120d0a0953545245414d494e47 " . <nl> - " 1001620670726f746f33 " <nl> + " 0aa21a0a247372632f70726f746f2f677270632f74657374696e672f636f " . <nl> + " 6e74726f6c2e70726f746f120c677270632e74657374696e671a22737263 " . <nl> + " 2f70726f746f2f677270632f74657374696e672f73746174732e70726f74 " . <nl> + " 6f22250a0d506f6973736f6e506172616d7312140a0c6f6666657265645f " . <nl> + " 6c6f616418012001280122120a10436c6f7365644c6f6f70506172616d73 " . <nl> + " 227b0a0a4c6f6164506172616d7312350a0b636c6f7365645f6c6f6f7018 " . <nl> + " 012001280b321e2e677270632e74657374696e672e436c6f7365644c6f6f " . <nl> + " 70506172616d734800122e0a07706f6973736f6e18022001280b321b2e67 " . <nl> + " 7270632e74657374696e672e506f6973736f6e506172616d73480042060a " . <nl> + " 046c6f616422560a0e5365637572697479506172616d7312130a0b757365 " . <nl> + " 5f746573745f6361180120012808121c0a147365727665725f686f73745f " . <nl> + " 6f7665727269646518022001280912110a09637265645f74797065180320 " . <nl> + " 012809224d0a0a4368616e6e656c417267120c0a046e616d651801200128 " . <nl> + " 0912130a097374725f76616c7565180220012809480012130a09696e745f " . <nl> + " 76616c7565180320012805480042070a0576616c756522d5040a0c436c69 " . <nl> + " 656e74436f6e66696712160a0e7365727665725f74617267657473180120 " . <nl> + " 032809122d0a0b636c69656e745f7479706518022001280e32182e677270 " . <nl> + " 632e74657374696e672e436c69656e745479706512350a0f736563757269 " . <nl> + " 74795f706172616d7318032001280b321c2e677270632e74657374696e67 " . <nl> + " 2e5365637572697479506172616d7312240a1c6f75747374616e64696e67 " . <nl> + " 5f727063735f7065725f6368616e6e656c18042001280512170a0f636c69 " . <nl> + " 656e745f6368616e6e656c73180520012805121c0a146173796e635f636c " . <nl> + " 69656e745f7468726561647318072001280512270a087270635f74797065 " . <nl> + " 18082001280e32152e677270632e74657374696e672e5270635479706512 " . <nl> + " 2d0a0b6c6f61645f706172616d73180a2001280b32182e677270632e7465 " . <nl> + " 7374696e672e4c6f6164506172616d7312330a0e7061796c6f61645f636f " . <nl> + " 6e666967180b2001280b321b2e677270632e74657374696e672e5061796c " . <nl> + " 6f6164436f6e66696712370a10686973746f6772616d5f706172616d7318 " . <nl> + " 0c2001280b321d2e677270632e74657374696e672e486973746f6772616d " . <nl> + " 506172616d7312110a09636f72655f6c697374180d2003280512120a0a63 " . <nl> + " 6f72655f6c696d6974180e2001280512180a106f746865725f636c69656e " . <nl> + " 745f617069180f20012809122e0a0c6368616e6e656c5f61726773181020 " . <nl> + " 03280b32182e677270632e74657374696e672e4368616e6e656c41726712 " . <nl> + " 160a0e746872656164735f7065725f6371181120012805121b0a136d6573 " . <nl> + " 73616765735f7065725f73747265616d18122001280522380a0c436c6965 " . <nl> + " 6e7453746174757312280a05737461747318012001280b32192e67727063 " . <nl> + " 2e74657374696e672e436c69656e74537461747322150a044d61726b120d " . <nl> + " 0a05726573657418012001280822680a0a436c69656e7441726773122b0a " . <nl> + " 05736574757018012001280b321a2e677270632e74657374696e672e436c " . <nl> + " 69656e74436f6e666967480012220a046d61726b18022001280b32122e67 " . <nl> + " 7270632e74657374696e672e4d61726b480042090a076172677479706522 " . <nl> + " fd020a0c536572766572436f6e666967122d0a0b7365727665725f747970 " . <nl> + " 6518012001280e32182e677270632e74657374696e672e53657276657254 " . <nl> + " 79706512350a0f73656375726974795f706172616d7318022001280b321c " . <nl> + " 2e677270632e74657374696e672e5365637572697479506172616d73120c " . <nl> + " 0a04706f7274180420012805121c0a146173796e635f7365727665725f74 " . <nl> + " 68726561647318072001280512120a0a636f72655f6c696d697418082001 " . <nl> + " 280512330a0e7061796c6f61645f636f6e66696718092001280b321b2e67 " . <nl> + " 7270632e74657374696e672e5061796c6f6164436f6e66696712110a0963 " . <nl> + " 6f72655f6c697374180a2003280512180a106f746865725f736572766572 " . <nl> + " 5f617069180b2001280912160a0e746872656164735f7065725f6371180c " . <nl> + " 20012805121c0a137265736f757263655f71756f74615f73697a6518e907 " . <nl> + " 20012805122f0a0c6368616e6e656c5f6172677318ea072003280b32182e " . <nl> + " 677270632e74657374696e672e4368616e6e656c41726722680a0a536572 " . <nl> + " 76657241726773122b0a05736574757018012001280b321a2e677270632e " . <nl> + " 74657374696e672e536572766572436f6e666967480012220a046d61726b " . <nl> + " 18022001280b32122e677270632e74657374696e672e4d61726b48004209 " . <nl> + " 0a076172677479706522550a0c53657276657253746174757312280a0573 " . <nl> + " 7461747318012001280b32192e677270632e74657374696e672e53657276 " . <nl> + " 65725374617473120c0a04706f7274180220012805120d0a05636f726573 " . <nl> + " 180320012805220d0a0b436f726552657175657374221d0a0c436f726552 " . <nl> + " 6573706f6e7365120d0a05636f72657318012001280522060a04566f6964 " . <nl> + " 22fd010a085363656e6172696f120c0a046e616d6518012001280912310a " . <nl> + " 0d636c69656e745f636f6e66696718022001280b321a2e677270632e7465 " . <nl> + " 7374696e672e436c69656e74436f6e66696712130a0b6e756d5f636c6965 " . <nl> + " 6e747318032001280512310a0d7365727665725f636f6e66696718042001 " . <nl> + " 280b321a2e677270632e74657374696e672e536572766572436f6e666967 " . <nl> + " 12130a0b6e756d5f7365727665727318052001280512160a0e7761726d75 " . <nl> + " 705f7365636f6e647318062001280512190a1162656e63686d61726b5f73 " . <nl> + " 65636f6e647318072001280512200a18737061776e5f6c6f63616c5f776f " . <nl> + " 726b65725f636f756e7418082001280522360a095363656e6172696f7312 " . <nl> + " 290a097363656e6172696f7318012003280b32162e677270632e74657374 " . <nl> + " 696e672e5363656e6172696f2284040a155363656e6172696f526573756c " . <nl> + " 7453756d6d617279120b0a03717073180120012801121b0a137170735f70 " . <nl> + " 65725f7365727665725f636f7265180220012801121a0a12736572766572 " . <nl> + " 5f73797374656d5f74696d6518032001280112180a107365727665725f75 " . <nl> + " 7365725f74696d65180420012801121a0a12636c69656e745f7379737465 " . <nl> + " 6d5f74696d6518052001280112180a10636c69656e745f757365725f7469 " . <nl> + " 6d6518062001280112120a0a6c6174656e63795f35301807200128011212 " . <nl> + " 0a0a6c6174656e63795f393018082001280112120a0a6c6174656e63795f " . <nl> + " 393518092001280112120a0a6c6174656e63795f3939180a200128011213 " . <nl> + " 0a0b6c6174656e63795f393939180b2001280112180a107365727665725f " . <nl> + " 6370755f7573616765180c2001280112260a1e7375636365737366756c5f " . <nl> + " 72657175657374735f7065725f7365636f6e64180d2001280112220a1a66 " . <nl> + " 61696c65645f72657175657374735f7065725f7365636f6e64180e200128 " . <nl> + " 0112200a18636c69656e745f706f6c6c735f7065725f7265717565737418 " . <nl> + " 0f2001280112200a187365727665725f706f6c6c735f7065725f72657175 " . <nl> + " 65737418102001280112220a1a7365727665725f717565726965735f7065 " . <nl> + " 725f6370755f73656318112001280112220a1a636c69656e745f71756572 " . <nl> + " 6965735f7065725f6370755f7365631812200128012283030a0e5363656e " . <nl> + " 6172696f526573756c7412280a087363656e6172696f18012001280b3216 " . <nl> + " 2e677270632e74657374696e672e5363656e6172696f122e0a096c617465 " . <nl> + " 6e6369657318022001280b321b2e677270632e74657374696e672e486973 " . <nl> + " 746f6772616d44617461122f0a0c636c69656e745f737461747318032003 " . <nl> + " 280b32192e677270632e74657374696e672e436c69656e74537461747312 " . <nl> + " 2f0a0c7365727665725f737461747318042003280b32192e677270632e74 " . <nl> + " 657374696e672e536572766572537461747312140a0c7365727665725f63 " . <nl> + " 6f72657318052003280512340a0773756d6d61727918062001280b32232e " . <nl> + " 677270632e74657374696e672e5363656e6172696f526573756c7453756d " . <nl> + " 6d61727912160a0e636c69656e745f737563636573731807200328081216 " . <nl> + " 0a0e7365727665725f7375636365737318082003280812390a0f72657175 " . <nl> + " 6573745f726573756c747318092003280b32202e677270632e7465737469 " . <nl> + " 6e672e52657175657374526573756c74436f756e742a410a0a436c69656e " . <nl> + " 7454797065120f0a0b53594e435f434c49454e54100012100a0c4153594e " . <nl> + " 435f434c49454e54100112100a0c4f544845525f434c49454e5410022a5b " . <nl> + " 0a0a53657276657254797065120f0a0b53594e435f534552564552100012 " . <nl> + " 100a0c4153594e435f534552564552100112180a144153594e435f47454e " . <nl> + " 455249435f534552564552100212100a0c4f544845525f53455256455210 " . <nl> + " 032a720a075270635479706512090a05554e4152591000120d0a09535452 " . <nl> + " 45414d494e47100112190a1553545245414d494e475f46524f4d5f434c49 " . <nl> + " 454e54100212190a1553545245414d494e475f46524f4d5f534552564552 " . <nl> + " 100312170a1353545245414d494e475f424f54485f574159531004620670 " . <nl> + " 726f746f33 " <nl> ) ) ; <nl> <nl> static : : $ is_initialized = true ; <nl> mmm a / src / php / tests / qps / generated_code / GPBMetadata / Src / Proto / Grpc / Testing / ProxyService . php <nl> ppp b / src / php / tests / qps / generated_code / GPBMetadata / Src / Proto / Grpc / Testing / ProxyService . php <nl> public static function initOnce ( ) { <nl> return ; <nl> } <nl> \ GPBMetadata \ Src \ Proto \ Grpc \ Testing \ Control : : initOnce ( ) ; <nl> + \ GPBMetadata \ Src \ Proto \ Grpc \ Testing \ Stats : : initOnce ( ) ; <nl> $ pool - > internalAddGeneratedFile ( hex2bin ( <nl> - " 0a97020a2a7372632f70726f746f2f677270632f74657374696e672f7072 " . <nl> + " 0ad6020a2a7372632f70726f746f2f677270632f74657374696e672f7072 " . <nl> " 6f78792d736572766963652e70726f746f120c677270632e74657374696e " . <nl> - " 671a247372632f70726f746f2f677270632f74657374696e672f636f6e74 " . <nl> - " 726f6c2e70726f746f221c0a0950726f787953746174120f0a076c617465 " . <nl> - " 6e6379180120012801328e010a1250726f7879436c69656e745365727669 " . <nl> - " 6365123b0a09476574436f6e66696712122e677270632e74657374696e67 " . <nl> - " 2e566f69641a1a2e677270632e74657374696e672e436c69656e74436f6e " . <nl> - " 666967123b0a0a5265706f727454696d6512172e677270632e7465737469 " . <nl> - " 6e672e50726f7879537461741a122e677270632e74657374696e672e566f " . <nl> - " 69642801620670726f746f33 " <nl> + " 671a227372632f70726f746f2f677270632f74657374696e672f73746174 " . <nl> + " 732e70726f746f221c0a0950726f787953746174120f0a076c6174656e63 " . <nl> + " 7918012001280132cf010a1250726f7879436c69656e7453657276696365 " . <nl> + " 123b0a09476574436f6e66696712122e677270632e74657374696e672e56 " . <nl> + " 6f69641a1a2e677270632e74657374696e672e436c69656e74436f6e6669 " . <nl> + " 67123b0a0a5265706f727454696d6512172e677270632e74657374696e67 " . <nl> + " 2e50726f7879537461741a122e677270632e74657374696e672e566f6964 " . <nl> + " 2801123f0a0a5265706f727448697374121b2e677270632e74657374696e " . <nl> + " 672e486973746f6772616d446174611a122e677270632e74657374696e67 " . <nl> + " 2e566f69642801620670726f746f33 " <nl> ) ) ; <nl> <nl> static : : $ is_initialized = true ; <nl> mmm a / src / php / tests / qps / generated_code / GPBMetadata / Src / Proto / Grpc / Testing / Services . php <nl> ppp b / src / php / tests / qps / generated_code / GPBMetadata / Src / Proto / Grpc / Testing / Services . php <nl> public static function initOnce ( ) { <nl> } <nl> \ GPBMetadata \ Src \ Proto \ Grpc \ Testing \ Messages : : initOnce ( ) ; <nl> \ GPBMetadata \ Src \ Proto \ Grpc \ Testing \ Control : : initOnce ( ) ; <nl> + \ GPBMetadata \ Src \ Proto \ Grpc \ Testing \ Stats : : initOnce ( ) ; <nl> $ pool - > internalAddGeneratedFile ( hex2bin ( <nl> - " 0ad1040a257372632f70726f746f2f677270632f74657374696e672f7365 " . <nl> - " 7276696365732e70726f746f120c677270632e74657374696e671a257372 " . <nl> - " 632f70726f746f2f677270632f74657374696e672f6d657373616765732e " . <nl> - " 70726f746f1a247372632f70726f746f2f677270632f74657374696e672f " . <nl> - " 636f6e74726f6c2e70726f746f32aa010a1042656e63686d61726b536572 " . <nl> - " 7669636512460a09556e61727943616c6c121b2e677270632e7465737469 " . <nl> - " 6e672e53696d706c65526571756573741a1c2e677270632e74657374696e " . <nl> - " 672e53696d706c65526573706f6e7365124e0a0d53747265616d696e6743 " . <nl> - " 616c6c121b2e677270632e74657374696e672e53696d706c655265717565 " . <nl> - " 73741a1c2e677270632e74657374696e672e53696d706c65526573706f6e " . <nl> - " 7365280130013297020a0d576f726b65725365727669636512450a095275 " . <nl> - " 6e53657276657212182e677270632e74657374696e672e53657276657241 " . <nl> - " 7267731a1a2e677270632e74657374696e672e5365727665725374617475 " . <nl> - " 732801300112450a0952756e436c69656e7412182e677270632e74657374 " . <nl> - " 696e672e436c69656e74417267731a1a2e677270632e74657374696e672e " . <nl> - " 436c69656e745374617475732801300112420a09436f7265436f756e7412 " . <nl> - " 192e677270632e74657374696e672e436f7265526571756573741a1a2e67 " . <nl> - " 7270632e74657374696e672e436f7265526573706f6e736512340a0a5175 " . <nl> - " 6974576f726b657212122e677270632e74657374696e672e566f69641a12 " . <nl> - " 2e677270632e74657374696e672e566f6964620670726f746f33 " <nl> + " 0aaa070a257372632f70726f746f2f677270632f74657374696e672f7365 " . <nl> + " 7276696365732e70726f746f120c677270632e74657374696e671a247372 " . <nl> + " 632f70726f746f2f677270632f74657374696e672f636f6e74726f6c2e70 " . <nl> + " 726f746f1a227372632f70726f746f2f677270632f74657374696e672f73 " . <nl> + " 746174732e70726f746f32a6030a1042656e63686d61726b536572766963 " . <nl> + " 6512460a09556e61727943616c6c121b2e677270632e74657374696e672e " . <nl> + " 53696d706c65526571756573741a1c2e677270632e74657374696e672e53 " . <nl> + " 696d706c65526573706f6e7365124e0a0d53747265616d696e6743616c6c " . <nl> + " 121b2e677270632e74657374696e672e53696d706c65526571756573741a " . <nl> + " 1c2e677270632e74657374696e672e53696d706c65526573706f6e736528 " . <nl> + " 01300112520a1353747265616d696e6746726f6d436c69656e74121b2e67 " . <nl> + " 7270632e74657374696e672e53696d706c65526571756573741a1c2e6772 " . <nl> + " 70632e74657374696e672e53696d706c65526573706f6e7365280112520a " . <nl> + " 1353747265616d696e6746726f6d536572766572121b2e677270632e7465 " . <nl> + " 7374696e672e53696d706c65526571756573741a1c2e677270632e746573 " . <nl> + " 74696e672e53696d706c65526573706f6e7365300112520a115374726561 " . <nl> + " 6d696e67426f746857617973121b2e677270632e74657374696e672e5369 " . <nl> + " 6d706c65526571756573741a1c2e677270632e74657374696e672e53696d " . <nl> + " 706c65526573706f6e7365280130013297020a0d576f726b657253657276 " . <nl> + " 69636512450a0952756e53657276657212182e677270632e74657374696e " . <nl> + " 672e536572766572417267731a1a2e677270632e74657374696e672e5365 " . <nl> + " 727665725374617475732801300112450a0952756e436c69656e7412182e " . <nl> + " 677270632e74657374696e672e436c69656e74417267731a1a2e67727063 " . <nl> + " 2e74657374696e672e436c69656e745374617475732801300112420a0943 " . <nl> + " 6f7265436f756e7412192e677270632e74657374696e672e436f72655265 " . <nl> + " 71756573741a1a2e677270632e74657374696e672e436f7265526573706f " . <nl> + " 6e736512340a0a51756974576f726b657212122e677270632e7465737469 " . <nl> + " 6e672e566f69641a122e677270632e74657374696e672e566f6964325e0a " . <nl> + " 185265706f72745170735363656e6172696f5365727669636512420a0e52 " . <nl> + " 65706f72745363656e6172696f121c2e677270632e74657374696e672e53 " . <nl> + " 63656e6172696f526573756c741a122e677270632e74657374696e672e56 " . <nl> + " 6f6964620670726f746f33 " <nl> ) ) ; <nl> <nl> static : : $ is_initialized = true ; <nl> mmm a / src / php / tests / qps / generated_code / GPBMetadata / Src / Proto / Grpc / Testing / Stats . php <nl> ppp b / src / php / tests / qps / generated_code / GPBMetadata / Src / Proto / Grpc / Testing / Stats . php <nl> public static function initOnce ( ) { <nl> if ( static : : $ is_initialized = = true ) { <nl> return ; <nl> } <nl> + \ GPBMetadata \ Src \ Proto \ Grpc \ Core \ Stats : : initOnce ( ) ; <nl> $ pool - > internalAddGeneratedFile ( hex2bin ( <nl> - " 0adf040a227372632f70726f746f2f677270632f74657374696e672f7374 " . <nl> - " 6174732e70726f746f120c677270632e74657374696e67227a0a0b536572 " . <nl> - " 766572537461747312140a0c74696d655f656c6170736564180120012801 " . <nl> - " 12110a0974696d655f7573657218022001280112130a0b74696d655f7379 " . <nl> - " 7374656d18032001280112160a0e746f74616c5f6370755f74696d651804 " . <nl> - " 2001280412150a0d69646c655f6370755f74696d65180520012804223b0a " . <nl> - " 0f486973746f6772616d506172616d7312120a0a7265736f6c7574696f6e " . <nl> - " 18012001280112140a0c6d61785f706f737369626c651802200128012277 " . <nl> - " 0a0d486973746f6772616d44617461120e0a066275636b65741801200328 " . <nl> - " 0d12100a086d696e5f7365656e18022001280112100a086d61785f736565 " . <nl> - " 6e180320012801120b0a0373756d18042001280112160a0e73756d5f6f66 " . <nl> - " 5f73717561726573180520012801120d0a05636f756e7418062001280122 " . <nl> - " 380a1252657175657374526573756c74436f756e7412130a0b7374617475 " . <nl> - " 735f636f6465180120012805120d0a05636f756e7418022001280322b601 " . <nl> - " 0a0b436c69656e745374617473122e0a096c6174656e6369657318012001 " . <nl> - " 280b321b2e677270632e74657374696e672e486973746f6772616d446174 " . <nl> - " 6112140a0c74696d655f656c617073656418022001280112110a0974696d " . <nl> - " 655f7573657218032001280112130a0b74696d655f73797374656d180420 " . <nl> - " 01280112390a0f726571756573745f726573756c747318052003280b3220 " . <nl> - " 2e677270632e74657374696e672e52657175657374526573756c74436f75 " . <nl> - " 6e74620670726f746f33 " <nl> + " 0ada050a227372632f70726f746f2f677270632f74657374696e672f7374 " . <nl> + " 6174732e70726f746f120c677270632e74657374696e6722b7010a0b5365 " . <nl> + " 72766572537461747312140a0c74696d655f656c61707365641801200128 " . <nl> + " 0112110a0974696d655f7573657218022001280112130a0b74696d655f73 " . <nl> + " 797374656d18032001280112160a0e746f74616c5f6370755f74696d6518 " . <nl> + " 042001280412150a0d69646c655f6370755f74696d651805200128041215 " . <nl> + " 0a0d63715f706f6c6c5f636f756e7418062001280412240a0a636f72655f " . <nl> + " 737461747318072001280b32102e677270632e636f72652e537461747322 " . <nl> + " 3b0a0f486973746f6772616d506172616d7312120a0a7265736f6c757469 " . <nl> + " 6f6e18012001280112140a0c6d61785f706f737369626c65180220012801 " . <nl> + " 22770a0d486973746f6772616d44617461120e0a066275636b6574180120 " . <nl> + " 03280d12100a086d696e5f7365656e18022001280112100a086d61785f73 " . <nl> + " 65656e180320012801120b0a0373756d18042001280112160a0e73756d5f " . <nl> + " 6f665f73717561726573180520012801120d0a05636f756e741806200128 " . <nl> + " 0122380a1252657175657374526573756c74436f756e7412130a0b737461 " . <nl> + " 7475735f636f6465180120012805120d0a05636f756e7418022001280322 " . <nl> + " f3010a0b436c69656e745374617473122e0a096c6174656e636965731801 " . <nl> + " 2001280b321b2e677270632e74657374696e672e486973746f6772616d44 " . <nl> + " 61746112140a0c74696d655f656c617073656418022001280112110a0974 " . <nl> + " 696d655f7573657218032001280112130a0b74696d655f73797374656d18 " . <nl> + " 042001280112390a0f726571756573745f726573756c747318052003280b " . <nl> + " 32202e677270632e74657374696e672e52657175657374526573756c7443 " . <nl> + " 6f756e7412150a0d63715f706f6c6c5f636f756e7418062001280412240a " . <nl> + " 0a636f72655f737461747318072001280b32102e677270632e636f72652e " . <nl> + " 5374617473620670726f746f33 " <nl> ) ) ; <nl> <nl> static : : $ is_initialized = true ; <nl> new file mode 100644 <nl> index 00000000000 . . 897d6271c28 <nl> mmm / dev / null <nl> ppp b / src / php / tests / qps / generated_code / Grpc / Core / Bucket . php <nl> <nl> + < ? php <nl> + # Generated by the protocol buffer compiler . DO NOT EDIT ! <nl> + # source : src / proto / grpc / core / stats . proto <nl> + <nl> + namespace Grpc \ Core ; <nl> + <nl> + use Google \ Protobuf \ Internal \ GPBType ; <nl> + use Google \ Protobuf \ Internal \ RepeatedField ; <nl> + use Google \ Protobuf \ Internal \ GPBUtil ; <nl> + <nl> + / * * <nl> + * Generated from protobuf message < code > grpc . core . Bucket < / code > <nl> + * / <nl> + class Bucket extends \ Google \ Protobuf \ Internal \ Message <nl> + { <nl> + / * * <nl> + * Generated from protobuf field < code > double start = 1 ; < / code > <nl> + * / <nl> + private $ start = 0 . 0 ; <nl> + / * * <nl> + * Generated from protobuf field < code > uint64 count = 2 ; < / code > <nl> + * / <nl> + private $ count = 0 ; <nl> + <nl> + public function __construct ( ) { <nl> + \ GPBMetadata \ Src \ Proto \ Grpc \ Core \ Stats : : initOnce ( ) ; <nl> + parent : : __construct ( ) ; <nl> + } <nl> + <nl> + / * * <nl> + * Generated from protobuf field < code > double start = 1 ; < / code > <nl> + * @ return float <nl> + * / <nl> + public function getStart ( ) <nl> + { <nl> + return $ this - > start ; <nl> + } <nl> + <nl> + / * * <nl> + * Generated from protobuf field < code > double start = 1 ; < / code > <nl> + * @ param float $ var <nl> + * @ return $ this <nl> + * / <nl> + public function setStart ( $ var ) <nl> + { <nl> + GPBUtil : : checkDouble ( $ var ) ; <nl> + $ this - > start = $ var ; <nl> + <nl> + return $ this ; <nl> + } <nl> + <nl> + / * * <nl> + * Generated from protobuf field < code > uint64 count = 2 ; < / code > <nl> + * @ return int | string <nl> + * / <nl> + public function getCount ( ) <nl> + { <nl> + return $ this - > count ; <nl> + } <nl> + <nl> + / * * <nl> + * Generated from protobuf field < code > uint64 count = 2 ; < / code > <nl> + * @ param int | string $ var <nl> + * @ return $ this <nl> + * / <nl> + public function setCount ( $ var ) <nl> + { <nl> + GPBUtil : : checkUint64 ( $ var ) ; <nl> + $ this - > count = $ var ; <nl> + <nl> + return $ this ; <nl> + } <nl> + <nl> + } <nl> + <nl> new file mode 100644 <nl> index 00000000000 . . 1902be8e4ac <nl> mmm / dev / null <nl> ppp b / src / php / tests / qps / generated_code / Grpc / Core / Histogram . php <nl> <nl> + < ? php <nl> + # Generated by the protocol buffer compiler . DO NOT EDIT ! <nl> + # source : src / proto / grpc / core / stats . proto <nl> + <nl> + namespace Grpc \ Core ; <nl> + <nl> + use Google \ Protobuf \ Internal \ GPBType ; <nl> + use Google \ Protobuf \ Internal \ RepeatedField ; <nl> + use Google \ Protobuf \ Internal \ GPBUtil ; <nl> + <nl> + / * * <nl> + * Generated from protobuf message < code > grpc . core . Histogram < / code > <nl> + * / <nl> + class Histogram extends \ Google \ Protobuf \ Internal \ Message <nl> + { <nl> + / * * <nl> + * Generated from protobuf field < code > repeated . grpc . core . Bucket buckets = 1 ; < / code > <nl> + * / <nl> + private $ buckets ; <nl> + <nl> + public function __construct ( ) { <nl> + \ GPBMetadata \ Src \ Proto \ Grpc \ Core \ Stats : : initOnce ( ) ; <nl> + parent : : __construct ( ) ; <nl> + } <nl> + <nl> + / * * <nl> + * Generated from protobuf field < code > repeated . grpc . core . Bucket buckets = 1 ; < / code > <nl> + * @ return \ Google \ Protobuf \ Internal \ RepeatedField <nl> + * / <nl> + public function getBuckets ( ) <nl> + { <nl> + return $ this - > buckets ; <nl> + } <nl> + <nl> + / * * <nl> + * Generated from protobuf field < code > repeated . grpc . core . Bucket buckets = 1 ; < / code > <nl> + * @ param \ Grpc \ Core \ Bucket [ ] | \ Google \ Protobuf \ Internal \ RepeatedField $ var <nl> + * @ return $ this <nl> + * / <nl> + public function setBuckets ( $ var ) <nl> + { <nl> + $ arr = GPBUtil : : checkRepeatedField ( $ var , \ Google \ Protobuf \ Internal \ GPBType : : MESSAGE , \ Grpc \ Core \ Bucket : : class ) ; <nl> + $ this - > buckets = $ arr ; <nl> + <nl> + return $ this ; <nl> + } <nl> + <nl> + } <nl> + <nl> new file mode 100644 <nl> index 00000000000 . . c3581b7d21b <nl> mmm / dev / null <nl> ppp b / src / php / tests / qps / generated_code / Grpc / Core / Metric . php <nl> <nl> + < ? php <nl> + # Generated by the protocol buffer compiler . DO NOT EDIT ! <nl> + # source : src / proto / grpc / core / stats . proto <nl> + <nl> + namespace Grpc \ Core ; <nl> + <nl> + use Google \ Protobuf \ Internal \ GPBType ; <nl> + use Google \ Protobuf \ Internal \ RepeatedField ; <nl> + use Google \ Protobuf \ Internal \ GPBUtil ; <nl> + <nl> + / * * <nl> + * Generated from protobuf message < code > grpc . core . Metric < / code > <nl> + * / <nl> + class Metric extends \ Google \ Protobuf \ Internal \ Message <nl> + { <nl> + / * * <nl> + * Generated from protobuf field < code > string name = 1 ; < / code > <nl> + * / <nl> + private $ name = ' ' ; <nl> + protected $ value ; <nl> + <nl> + public function __construct ( ) { <nl> + \ GPBMetadata \ Src \ Proto \ Grpc \ Core \ Stats : : initOnce ( ) ; <nl> + parent : : __construct ( ) ; <nl> + } <nl> + <nl> + / * * <nl> + * Generated from protobuf field < code > string name = 1 ; < / code > <nl> + * @ return string <nl> + * / <nl> + public function getName ( ) <nl> + { <nl> + return $ this - > name ; <nl> + } <nl> + <nl> + / * * <nl> + * Generated from protobuf field < code > string name = 1 ; < / code > <nl> + * @ param string $ var <nl> + * @ return $ this <nl> + * / <nl> + public function setName ( $ var ) <nl> + { <nl> + GPBUtil : : checkString ( $ var , True ) ; <nl> + $ this - > name = $ var ; <nl> + <nl> + return $ this ; <nl> + } <nl> + <nl> + / * * <nl> + * Generated from protobuf field < code > uint64 count = 10 ; < / code > <nl> + * @ return int | string <nl> + * / <nl> + public function getCount ( ) <nl> + { <nl> + return $ this - > readOneof ( 10 ) ; <nl> + } <nl> + <nl> + / * * <nl> + * Generated from protobuf field < code > uint64 count = 10 ; < / code > <nl> + * @ param int | string $ var <nl> + * @ return $ this <nl> + * / <nl> + public function setCount ( $ var ) <nl> + { <nl> + GPBUtil : : checkUint64 ( $ var ) ; <nl> + $ this - > writeOneof ( 10 , $ var ) ; <nl> + <nl> + return $ this ; <nl> + } <nl> + <nl> + / * * <nl> + * Generated from protobuf field < code > . grpc . core . Histogram histogram = 11 ; < / code > <nl> + * @ return \ Grpc \ Core \ Histogram <nl> + * / <nl> + public function getHistogram ( ) <nl> + { <nl> + return $ this - > readOneof ( 11 ) ; <nl> + } <nl> + <nl> + / * * <nl> + * Generated from protobuf field < code > . grpc . core . Histogram histogram = 11 ; < / code > <nl> + * @ param \ Grpc \ Core \ Histogram $ var <nl> + * @ return $ this <nl> + * / <nl> + public function setHistogram ( $ var ) <nl> + { <nl> + GPBUtil : : checkMessage ( $ var , \ Grpc \ Core \ Histogram : : class ) ; <nl> + $ this - > writeOneof ( 11 , $ var ) ; <nl> + <nl> + return $ this ; <nl> + } <nl> + <nl> + / * * <nl> + * @ return string <nl> + * / <nl> + public function getValue ( ) <nl> + { <nl> + return $ this - > whichOneof ( " value " ) ; <nl> + } <nl> + <nl> + } <nl> + <nl> new file mode 100644 <nl> index 00000000000 . . e6f3fb08992 <nl> mmm / dev / null <nl> ppp b / src / php / tests / qps / generated_code / Grpc / Core / Stats . php <nl> <nl> + < ? php <nl> + # Generated by the protocol buffer compiler . DO NOT EDIT ! <nl> + # source : src / proto / grpc / core / stats . proto <nl> + <nl> + namespace Grpc \ Core ; <nl> + <nl> + use Google \ Protobuf \ Internal \ GPBType ; <nl> + use Google \ Protobuf \ Internal \ RepeatedField ; <nl> + use Google \ Protobuf \ Internal \ GPBUtil ; <nl> + <nl> + / * * <nl> + * Generated from protobuf message < code > grpc . core . Stats < / code > <nl> + * / <nl> + class Stats extends \ Google \ Protobuf \ Internal \ Message <nl> + { <nl> + / * * <nl> + * Generated from protobuf field < code > repeated . grpc . core . Metric metrics = 1 ; < / code > <nl> + * / <nl> + private $ metrics ; <nl> + <nl> + public function __construct ( ) { <nl> + \ GPBMetadata \ Src \ Proto \ Grpc \ Core \ Stats : : initOnce ( ) ; <nl> + parent : : __construct ( ) ; <nl> + } <nl> + <nl> + / * * <nl> + * Generated from protobuf field < code > repeated . grpc . core . Metric metrics = 1 ; < / code > <nl> + * @ return \ Google \ Protobuf \ Internal \ RepeatedField <nl> + * / <nl> + public function getMetrics ( ) <nl> + { <nl> + return $ this - > metrics ; <nl> + } <nl> + <nl> + / * * <nl> + * Generated from protobuf field < code > repeated . grpc . core . Metric metrics = 1 ; < / code > <nl> + * @ param \ Grpc \ Core \ Metric [ ] | \ Google \ Protobuf \ Internal \ RepeatedField $ var <nl> + * @ return $ this <nl> + * / <nl> + public function setMetrics ( $ var ) <nl> + { <nl> + $ arr = GPBUtil : : checkRepeatedField ( $ var , \ Google \ Protobuf \ Internal \ GPBType : : MESSAGE , \ Grpc \ Core \ Metric : : class ) ; <nl> + $ this - > metrics = $ arr ; <nl> + <nl> + return $ this ; <nl> + } <nl> + <nl> + } <nl> + <nl> mmm a / src / php / tests / qps / generated_code / Grpc / Testing / BenchmarkServiceClient . php <nl> ppp b / src / php / tests / qps / generated_code / Grpc / Testing / BenchmarkServiceClient . php <nl> <nl> / / <nl> / / An integration test service that covers all the method signature permutations <nl> / / of unary / streaming requests / responses . <nl> - namespace Grpc \ Testing { <nl> + namespace Grpc \ Testing ; <nl> <nl> - class BenchmarkServiceClient extends \ Grpc \ BaseStub { <nl> + / * * <nl> + * / <nl> + class BenchmarkServiceClient extends \ Grpc \ BaseStub { <nl> <nl> / * * <nl> * @ param string $ hostname hostname <nl> * @ param array $ opts channel options <nl> - * @ param Grpc \ Channel $ channel ( optional ) re - use channel object <nl> + * @ param \ Grpc \ Channel $ channel ( optional ) re - use channel object <nl> * / <nl> public function __construct ( $ hostname , $ opts , $ channel = null ) { <nl> - parent : : __construct ( $ hostname , $ opts , $ channel ) ; <nl> + parent : : __construct ( $ hostname , $ opts , $ channel ) ; <nl> } <nl> <nl> / * * <nl> public function __construct ( $ hostname , $ opts , $ channel = null ) { <nl> * / <nl> public function UnaryCall ( \ Grpc \ Testing \ SimpleRequest $ argument , <nl> $ metadata = [ ] , $ options = [ ] ) { <nl> - return $ this - > _simpleRequest ( ' / grpc . testing . BenchmarkService / UnaryCall ' , <nl> - $ argument , <nl> - [ ' \ Grpc \ Testing \ SimpleResponse ' , ' decode ' ] , <nl> - $ metadata , $ options ) ; <nl> + return $ this - > _simpleRequest ( ' / grpc . testing . BenchmarkService / UnaryCall ' , <nl> + $ argument , <nl> + [ ' \ Grpc \ Testing \ SimpleResponse ' , ' decode ' ] , <nl> + $ metadata , $ options ) ; <nl> } <nl> <nl> / * * <nl> - * One request followed by one response . <nl> - * The server returns the client payload as - is . <nl> + * Repeated sequence of one request followed by one response . <nl> + * Should be called streaming ping - pong <nl> + * The server returns the client payload as - is on each response <nl> * @ param array $ metadata metadata <nl> * @ param array $ options call options <nl> * / <nl> public function StreamingCall ( $ metadata = [ ] , $ options = [ ] ) { <nl> - return $ this - > _bidiRequest ( ' / grpc . testing . BenchmarkService / StreamingCall ' , <nl> - [ ' \ Grpc \ Testing \ SimpleResponse ' , ' decode ' ] , <nl> - $ metadata , $ options ) ; <nl> + return $ this - > _bidiRequest ( ' / grpc . testing . BenchmarkService / StreamingCall ' , <nl> + [ ' \ Grpc \ Testing \ SimpleResponse ' , ' decode ' ] , <nl> + $ metadata , $ options ) ; <nl> } <nl> <nl> - } <nl> + / * * <nl> + * Single - sided unbounded streaming from client to server <nl> + * The server returns the client payload as - is once the client does WritesDone <nl> + * @ param array $ metadata metadata <nl> + * @ param array $ options call options <nl> + * / <nl> + public function StreamingFromClient ( $ metadata = [ ] , $ options = [ ] ) { <nl> + return $ this - > _clientStreamRequest ( ' / grpc . testing . BenchmarkService / StreamingFromClient ' , <nl> + [ ' \ Grpc \ Testing \ SimpleResponse ' , ' decode ' ] , <nl> + $ metadata , $ options ) ; <nl> + } <nl> + <nl> + / * * <nl> + * Single - sided unbounded streaming from server to client <nl> + * The server repeatedly returns the client payload as - is <nl> + * @ param \ Grpc \ Testing \ SimpleRequest $ argument input argument <nl> + * @ param array $ metadata metadata <nl> + * @ param array $ options call options <nl> + * / <nl> + public function StreamingFromServer ( \ Grpc \ Testing \ SimpleRequest $ argument , <nl> + $ metadata = [ ] , $ options = [ ] ) { <nl> + return $ this - > _serverStreamRequest ( ' / grpc . testing . BenchmarkService / StreamingFromServer ' , <nl> + $ argument , <nl> + [ ' \ Grpc \ Testing \ SimpleResponse ' , ' decode ' ] , <nl> + $ metadata , $ options ) ; <nl> + } <nl> + <nl> + / * * <nl> + * Two - sided unbounded streaming between server to client <nl> + * Both sides send the content of their own choice to the other <nl> + * @ param array $ metadata metadata <nl> + * @ param array $ options call options <nl> + * / <nl> + public function StreamingBothWays ( $ metadata = [ ] , $ options = [ ] ) { <nl> + return $ this - > _bidiRequest ( ' / grpc . testing . BenchmarkService / StreamingBothWays ' , <nl> + [ ' \ Grpc \ Testing \ SimpleResponse ' , ' decode ' ] , <nl> + $ metadata , $ options ) ; <nl> + } <nl> <nl> } <nl> mmm a / src / php / tests / qps / generated_code / Grpc / Testing / BoolValue . php <nl> ppp b / src / php / tests / qps / generated_code / Grpc / Testing / BoolValue . php <nl> <nl> use Google \ Protobuf \ Internal \ GPBUtil ; <nl> <nl> / * * <nl> - * < pre > <nl> * TODO ( dgq ) : Go back to using well - known types once <nl> * https : / / github . com / grpc / grpc / issues / 6980 has been fixed . <nl> * import " google / protobuf / wrappers . proto " ; <nl> - * < / pre > <nl> * <nl> - * Protobuf type < code > grpc . testing . BoolValue < / code > <nl> + * Generated from protobuf message < code > grpc . testing . BoolValue < / code > <nl> * / <nl> class BoolValue extends \ Google \ Protobuf \ Internal \ Message <nl> { <nl> / * * <nl> - * < pre > <nl> * The bool value . <nl> - * < / pre > <nl> * <nl> - * < code > bool value = 1 ; < / code > <nl> + * Generated from protobuf field < code > bool value = 1 ; < / code > <nl> * / <nl> private $ value = false ; <nl> <nl> public function __construct ( ) { <nl> } <nl> <nl> / * * <nl> - * < pre > <nl> * The bool value . <nl> - * < / pre > <nl> * <nl> - * < code > bool value = 1 ; < / code > <nl> + * Generated from protobuf field < code > bool value = 1 ; < / code > <nl> + * @ return bool <nl> * / <nl> public function getValue ( ) <nl> { <nl> public function getValue ( ) <nl> } <nl> <nl> / * * <nl> - * < pre > <nl> * The bool value . <nl> - * < / pre > <nl> * <nl> - * < code > bool value = 1 ; < / code > <nl> + * Generated from protobuf field < code > bool value = 1 ; < / code > <nl> + * @ param bool $ var <nl> + * @ return $ this <nl> * / <nl> public function setValue ( $ var ) <nl> { <nl> GPBUtil : : checkBool ( $ var ) ; <nl> $ this - > value = $ var ; <nl> + <nl> + return $ this ; <nl> } <nl> <nl> } <nl> mmm a / src / php / tests / qps / generated_code / Grpc / Testing / ByteBufferParams . php <nl> ppp b / src / php / tests / qps / generated_code / Grpc / Testing / ByteBufferParams . php <nl> <nl> use Google \ Protobuf \ Internal \ GPBUtil ; <nl> <nl> / * * <nl> - * Protobuf type < code > grpc . testing . ByteBufferParams < / code > <nl> + * Generated from protobuf message < code > grpc . testing . ByteBufferParams < / code > <nl> * / <nl> class ByteBufferParams extends \ Google \ Protobuf \ Internal \ Message <nl> { <nl> / * * <nl> - * < code > int32 req_size = 1 ; < / code > <nl> + * Generated from protobuf field < code > int32 req_size = 1 ; < / code > <nl> * / <nl> private $ req_size = 0 ; <nl> / * * <nl> - * < code > int32 resp_size = 2 ; < / code > <nl> + * Generated from protobuf field < code > int32 resp_size = 2 ; < / code > <nl> * / <nl> private $ resp_size = 0 ; <nl> <nl> public function __construct ( ) { <nl> } <nl> <nl> / * * <nl> - * < code > int32 req_size = 1 ; < / code > <nl> + * Generated from protobuf field < code > int32 req_size = 1 ; < / code > <nl> + * @ return int <nl> * / <nl> public function getReqSize ( ) <nl> { <nl> public function getReqSize ( ) <nl> } <nl> <nl> / * * <nl> - * < code > int32 req_size = 1 ; < / code > <nl> + * Generated from protobuf field < code > int32 req_size = 1 ; < / code > <nl> + * @ param int $ var <nl> + * @ return $ this <nl> * / <nl> public function setReqSize ( $ var ) <nl> { <nl> GPBUtil : : checkInt32 ( $ var ) ; <nl> $ this - > req_size = $ var ; <nl> + <nl> + return $ this ; <nl> } <nl> <nl> / * * <nl> - * < code > int32 resp_size = 2 ; < / code > <nl> + * Generated from protobuf field < code > int32 resp_size = 2 ; < / code > <nl> + * @ return int <nl> * / <nl> public function getRespSize ( ) <nl> { <nl> public function getRespSize ( ) <nl> } <nl> <nl> / * * <nl> - * < code > int32 resp_size = 2 ; < / code > <nl> + * Generated from protobuf field < code > int32 resp_size = 2 ; < / code > <nl> + * @ param int $ var <nl> + * @ return $ this <nl> * / <nl> public function setRespSize ( $ var ) <nl> { <nl> GPBUtil : : checkInt32 ( $ var ) ; <nl> $ this - > resp_size = $ var ; <nl> + <nl> + return $ this ; <nl> } <nl> <nl> } <nl> mmm a / src / php / tests / qps / generated_code / Grpc / Testing / ChannelArg . php <nl> ppp b / src / php / tests / qps / generated_code / Grpc / Testing / ChannelArg . php <nl> <nl> use Google \ Protobuf \ Internal \ GPBUtil ; <nl> <nl> / * * <nl> - * Protobuf type < code > grpc . testing . ChannelArg < / code > <nl> + * Generated from protobuf message < code > grpc . testing . ChannelArg < / code > <nl> * / <nl> class ChannelArg extends \ Google \ Protobuf \ Internal \ Message <nl> { <nl> / * * <nl> - * < code > string name = 1 ; < / code > <nl> + * Generated from protobuf field < code > string name = 1 ; < / code > <nl> * / <nl> private $ name = ' ' ; <nl> protected $ value ; <nl> public function __construct ( ) { <nl> } <nl> <nl> / * * <nl> - * < code > string name = 1 ; < / code > <nl> + * Generated from protobuf field < code > string name = 1 ; < / code > <nl> + * @ return string <nl> * / <nl> public function getName ( ) <nl> { <nl> public function getName ( ) <nl> } <nl> <nl> / * * <nl> - * < code > string name = 1 ; < / code > <nl> + * Generated from protobuf field < code > string name = 1 ; < / code > <nl> + * @ param string $ var <nl> + * @ return $ this <nl> * / <nl> public function setName ( $ var ) <nl> { <nl> GPBUtil : : checkString ( $ var , True ) ; <nl> $ this - > name = $ var ; <nl> + <nl> + return $ this ; <nl> } <nl> <nl> / * * <nl> - * < code > string str_value = 2 ; < / code > <nl> + * Generated from protobuf field < code > string str_value = 2 ; < / code > <nl> + * @ return string <nl> * / <nl> public function getStrValue ( ) <nl> { <nl> public function getStrValue ( ) <nl> } <nl> <nl> / * * <nl> - * < code > string str_value = 2 ; < / code > <nl> + * Generated from protobuf field < code > string str_value = 2 ; < / code > <nl> + * @ param string $ var <nl> + * @ return $ this <nl> * / <nl> public function setStrValue ( $ var ) <nl> { <nl> GPBUtil : : checkString ( $ var , True ) ; <nl> $ this - > writeOneof ( 2 , $ var ) ; <nl> + <nl> + return $ this ; <nl> } <nl> <nl> / * * <nl> - * < code > int32 int_value = 3 ; < / code > <nl> + * Generated from protobuf field < code > int32 int_value = 3 ; < / code > <nl> + * @ return int <nl> * / <nl> public function getIntValue ( ) <nl> { <nl> public function getIntValue ( ) <nl> } <nl> <nl> / * * <nl> - * < code > int32 int_value = 3 ; < / code > <nl> + * Generated from protobuf field < code > int32 int_value = 3 ; < / code > <nl> + * @ param int $ var <nl> + * @ return $ this <nl> * / <nl> public function setIntValue ( $ var ) <nl> { <nl> GPBUtil : : checkInt32 ( $ var ) ; <nl> $ this - > writeOneof ( 3 , $ var ) ; <nl> + <nl> + return $ this ; <nl> } <nl> <nl> + / * * <nl> + * @ return string <nl> + * / <nl> public function getValue ( ) <nl> { <nl> return $ this - > whichOneof ( " value " ) ; <nl> mmm a / src / php / tests / qps / generated_code / Grpc / Testing / ClientArgs . php <nl> ppp b / src / php / tests / qps / generated_code / Grpc / Testing / ClientArgs . php <nl> <nl> use Google \ Protobuf \ Internal \ GPBUtil ; <nl> <nl> / * * <nl> - * Protobuf type < code > grpc . testing . ClientArgs < / code > <nl> + * Generated from protobuf message < code > grpc . testing . ClientArgs < / code > <nl> * / <nl> class ClientArgs extends \ Google \ Protobuf \ Internal \ Message <nl> { <nl> public function __construct ( ) { <nl> } <nl> <nl> / * * <nl> - * < code > . grpc . testing . ClientConfig setup = 1 ; < / code > <nl> + * Generated from protobuf field < code > . grpc . testing . ClientConfig setup = 1 ; < / code > <nl> + * @ return \ Grpc \ Testing \ ClientConfig <nl> * / <nl> public function getSetup ( ) <nl> { <nl> public function getSetup ( ) <nl> } <nl> <nl> / * * <nl> - * < code > . grpc . testing . ClientConfig setup = 1 ; < / code > <nl> + * Generated from protobuf field < code > . grpc . testing . ClientConfig setup = 1 ; < / code > <nl> + * @ param \ Grpc \ Testing \ ClientConfig $ var <nl> + * @ return $ this <nl> * / <nl> - public function setSetup ( & $ var ) <nl> + public function setSetup ( $ var ) <nl> { <nl> GPBUtil : : checkMessage ( $ var , \ Grpc \ Testing \ ClientConfig : : class ) ; <nl> $ this - > writeOneof ( 1 , $ var ) ; <nl> + <nl> + return $ this ; <nl> } <nl> <nl> / * * <nl> - * < code > . grpc . testing . Mark mark = 2 ; < / code > <nl> + * Generated from protobuf field < code > . grpc . testing . Mark mark = 2 ; < / code > <nl> + * @ return \ Grpc \ Testing \ Mark <nl> * / <nl> public function getMark ( ) <nl> { <nl> public function getMark ( ) <nl> } <nl> <nl> / * * <nl> - * < code > . grpc . testing . Mark mark = 2 ; < / code > <nl> + * Generated from protobuf field < code > . grpc . testing . Mark mark = 2 ; < / code > <nl> + * @ param \ Grpc \ Testing \ Mark $ var <nl> + * @ return $ this <nl> * / <nl> - public function setMark ( & $ var ) <nl> + public function setMark ( $ var ) <nl> { <nl> GPBUtil : : checkMessage ( $ var , \ Grpc \ Testing \ Mark : : class ) ; <nl> $ this - > writeOneof ( 2 , $ var ) ; <nl> + <nl> + return $ this ; <nl> } <nl> <nl> + / * * <nl> + * @ return string <nl> + * / <nl> public function getArgtype ( ) <nl> { <nl> return $ this - > whichOneof ( " argtype " ) ; <nl> mmm a / src / php / tests / qps / generated_code / Grpc / Testing / ClientConfig . php <nl> ppp b / src / php / tests / qps / generated_code / Grpc / Testing / ClientConfig . php <nl> <nl> use Google \ Protobuf \ Internal \ GPBUtil ; <nl> <nl> / * * <nl> - * Protobuf type < code > grpc . testing . ClientConfig < / code > <nl> + * Generated from protobuf message < code > grpc . testing . ClientConfig < / code > <nl> * / <nl> class ClientConfig extends \ Google \ Protobuf \ Internal \ Message <nl> { <nl> / * * <nl> - * < pre > <nl> * List of targets to connect to . At least one target needs to be specified . <nl> - * < / pre > <nl> * <nl> - * < code > repeated string server_targets = 1 ; < / code > <nl> + * Generated from protobuf field < code > repeated string server_targets = 1 ; < / code > <nl> * / <nl> private $ server_targets ; <nl> / * * <nl> - * < code > . grpc . testing . ClientType client_type = 2 ; < / code > <nl> + * Generated from protobuf field < code > . grpc . testing . ClientType client_type = 2 ; < / code > <nl> * / <nl> private $ client_type = 0 ; <nl> / * * <nl> - * < code > . grpc . testing . SecurityParams security_params = 3 ; < / code > <nl> + * Generated from protobuf field < code > . grpc . testing . SecurityParams security_params = 3 ; < / code > <nl> * / <nl> private $ security_params = null ; <nl> / * * <nl> - * < pre > <nl> * How many concurrent RPCs to start for each channel . <nl> * For synchronous client , use a separate thread for each outstanding RPC . <nl> - * < / pre > <nl> * <nl> - * < code > int32 outstanding_rpcs_per_channel = 4 ; < / code > <nl> + * Generated from protobuf field < code > int32 outstanding_rpcs_per_channel = 4 ; < / code > <nl> * / <nl> private $ outstanding_rpcs_per_channel = 0 ; <nl> / * * <nl> - * < pre > <nl> * Number of independent client channels to create . <nl> * i - th channel will connect to server_target [ i % server_targets . size ( ) ] <nl> - * < / pre > <nl> * <nl> - * < code > int32 client_channels = 5 ; < / code > <nl> + * Generated from protobuf field < code > int32 client_channels = 5 ; < / code > <nl> * / <nl> private $ client_channels = 0 ; <nl> / * * <nl> - * < pre > <nl> * Only for async client . Number of threads to use to start / manage RPCs . <nl> - * < / pre > <nl> * <nl> - * < code > int32 async_client_threads = 7 ; < / code > <nl> + * Generated from protobuf field < code > int32 async_client_threads = 7 ; < / code > <nl> * / <nl> private $ async_client_threads = 0 ; <nl> / * * <nl> - * < code > . grpc . testing . RpcType rpc_type = 8 ; < / code > <nl> + * Generated from protobuf field < code > . grpc . testing . RpcType rpc_type = 8 ; < / code > <nl> * / <nl> private $ rpc_type = 0 ; <nl> / * * <nl> - * < pre > <nl> * The requested load for the entire client ( aggregated over all the threads ) . <nl> - * < / pre > <nl> * <nl> - * < code > . grpc . testing . LoadParams load_params = 10 ; < / code > <nl> + * Generated from protobuf field < code > . grpc . testing . LoadParams load_params = 10 ; < / code > <nl> * / <nl> private $ load_params = null ; <nl> / * * <nl> - * < code > . grpc . testing . PayloadConfig payload_config = 11 ; < / code > <nl> + * Generated from protobuf field < code > . grpc . testing . PayloadConfig payload_config = 11 ; < / code > <nl> * / <nl> private $ payload_config = null ; <nl> / * * <nl> - * < code > . grpc . testing . HistogramParams histogram_params = 12 ; < / code > <nl> + * Generated from protobuf field < code > . grpc . testing . HistogramParams histogram_params = 12 ; < / code > <nl> * / <nl> private $ histogram_params = null ; <nl> / * * <nl> - * < pre > <nl> * Specify the cores we should run the client on , if desired <nl> - * < / pre > <nl> * <nl> - * < code > repeated int32 core_list = 13 ; < / code > <nl> + * Generated from protobuf field < code > repeated int32 core_list = 13 ; < / code > <nl> * / <nl> private $ core_list ; <nl> / * * <nl> - * < code > int32 core_limit = 14 ; < / code > <nl> + * Generated from protobuf field < code > int32 core_limit = 14 ; < / code > <nl> * / <nl> private $ core_limit = 0 ; <nl> / * * <nl> - * < pre > <nl> * If we use an OTHER_CLIENT client_type , this string gives more detail <nl> - * < / pre > <nl> * <nl> - * < code > string other_client_api = 15 ; < / code > <nl> + * Generated from protobuf field < code > string other_client_api = 15 ; < / code > <nl> * / <nl> private $ other_client_api = ' ' ; <nl> / * * <nl> - * < code > repeated . grpc . testing . ChannelArg channel_args = 16 ; < / code > <nl> + * Generated from protobuf field < code > repeated . grpc . testing . ChannelArg channel_args = 16 ; < / code > <nl> * / <nl> private $ channel_args ; <nl> + / * * <nl> + * Number of threads that share each completion queue <nl> + * <nl> + * Generated from protobuf field < code > int32 threads_per_cq = 17 ; < / code > <nl> + * / <nl> + private $ threads_per_cq = 0 ; <nl> + / * * <nl> + * Number of messages on a stream before it gets finished / restarted <nl> + * <nl> + * Generated from protobuf field < code > int32 messages_per_stream = 18 ; < / code > <nl> + * / <nl> + private $ messages_per_stream = 0 ; <nl> <nl> public function __construct ( ) { <nl> \ GPBMetadata \ Src \ Proto \ Grpc \ Testing \ Control : : initOnce ( ) ; <nl> public function __construct ( ) { <nl> } <nl> <nl> / * * <nl> - * < pre > <nl> * List of targets to connect to . At least one target needs to be specified . <nl> - * < / pre > <nl> * <nl> - * < code > repeated string server_targets = 1 ; < / code > <nl> + * Generated from protobuf field < code > repeated string server_targets = 1 ; < / code > <nl> + * @ return \ Google \ Protobuf \ Internal \ RepeatedField <nl> * / <nl> public function getServerTargets ( ) <nl> { <nl> public function getServerTargets ( ) <nl> } <nl> <nl> / * * <nl> - * < pre > <nl> * List of targets to connect to . At least one target needs to be specified . <nl> - * < / pre > <nl> * <nl> - * < code > repeated string server_targets = 1 ; < / code > <nl> + * Generated from protobuf field < code > repeated string server_targets = 1 ; < / code > <nl> + * @ param string [ ] | \ Google \ Protobuf \ Internal \ RepeatedField $ var <nl> + * @ return $ this <nl> * / <nl> - public function setServerTargets ( & $ var ) <nl> + public function setServerTargets ( $ var ) <nl> { <nl> - GPBUtil : : checkRepeatedField ( $ var , \ Google \ Protobuf \ Internal \ GPBType : : STRING ) ; <nl> - $ this - > server_targets = $ var ; <nl> + $ arr = GPBUtil : : checkRepeatedField ( $ var , \ Google \ Protobuf \ Internal \ GPBType : : STRING ) ; <nl> + $ this - > server_targets = $ arr ; <nl> + <nl> + return $ this ; <nl> } <nl> <nl> / * * <nl> - * < code > . grpc . testing . ClientType client_type = 2 ; < / code > <nl> + * Generated from protobuf field < code > . grpc . testing . ClientType client_type = 2 ; < / code > <nl> + * @ return int <nl> * / <nl> public function getClientType ( ) <nl> { <nl> public function getClientType ( ) <nl> } <nl> <nl> / * * <nl> - * < code > . grpc . testing . ClientType client_type = 2 ; < / code > <nl> + * Generated from protobuf field < code > . grpc . testing . ClientType client_type = 2 ; < / code > <nl> + * @ param int $ var <nl> + * @ return $ this <nl> * / <nl> public function setClientType ( $ var ) <nl> { <nl> GPBUtil : : checkEnum ( $ var , \ Grpc \ Testing \ ClientType : : class ) ; <nl> $ this - > client_type = $ var ; <nl> + <nl> + return $ this ; <nl> } <nl> <nl> / * * <nl> - * < code > . grpc . testing . SecurityParams security_params = 3 ; < / code > <nl> + * Generated from protobuf field < code > . grpc . testing . SecurityParams security_params = 3 ; < / code > <nl> + * @ return \ Grpc \ Testing \ SecurityParams <nl> * / <nl> public function getSecurityParams ( ) <nl> { <nl> public function getSecurityParams ( ) <nl> } <nl> <nl> / * * <nl> - * < code > . grpc . testing . SecurityParams security_params = 3 ; < / code > <nl> + * Generated from protobuf field < code > . grpc . testing . SecurityParams security_params = 3 ; < / code > <nl> + * @ param \ Grpc \ Testing \ SecurityParams $ var <nl> + * @ return $ this <nl> * / <nl> - public function setSecurityParams ( & $ var ) <nl> + public function setSecurityParams ( $ var ) <nl> { <nl> GPBUtil : : checkMessage ( $ var , \ Grpc \ Testing \ SecurityParams : : class ) ; <nl> $ this - > security_params = $ var ; <nl> + <nl> + return $ this ; <nl> } <nl> <nl> / * * <nl> - * < pre > <nl> * How many concurrent RPCs to start for each channel . <nl> * For synchronous client , use a separate thread for each outstanding RPC . <nl> - * < / pre > <nl> * <nl> - * < code > int32 outstanding_rpcs_per_channel = 4 ; < / code > <nl> + * Generated from protobuf field < code > int32 outstanding_rpcs_per_channel = 4 ; < / code > <nl> + * @ return int <nl> * / <nl> public function getOutstandingRpcsPerChannel ( ) <nl> { <nl> public function getOutstandingRpcsPerChannel ( ) <nl> } <nl> <nl> / * * <nl> - * < pre > <nl> * How many concurrent RPCs to start for each channel . <nl> * For synchronous client , use a separate thread for each outstanding RPC . <nl> - * < / pre > <nl> * <nl> - * < code > int32 outstanding_rpcs_per_channel = 4 ; < / code > <nl> + * Generated from protobuf field < code > int32 outstanding_rpcs_per_channel = 4 ; < / code > <nl> + * @ param int $ var <nl> + * @ return $ this <nl> * / <nl> public function setOutstandingRpcsPerChannel ( $ var ) <nl> { <nl> GPBUtil : : checkInt32 ( $ var ) ; <nl> $ this - > outstanding_rpcs_per_channel = $ var ; <nl> + <nl> + return $ this ; <nl> } <nl> <nl> / * * <nl> - * < pre > <nl> * Number of independent client channels to create . <nl> * i - th channel will connect to server_target [ i % server_targets . size ( ) ] <nl> - * < / pre > <nl> * <nl> - * < code > int32 client_channels = 5 ; < / code > <nl> + * Generated from protobuf field < code > int32 client_channels = 5 ; < / code > <nl> + * @ return int <nl> * / <nl> public function getClientChannels ( ) <nl> { <nl> public function getClientChannels ( ) <nl> } <nl> <nl> / * * <nl> - * < pre > <nl> * Number of independent client channels to create . <nl> * i - th channel will connect to server_target [ i % server_targets . size ( ) ] <nl> - * < / pre > <nl> * <nl> - * < code > int32 client_channels = 5 ; < / code > <nl> + * Generated from protobuf field < code > int32 client_channels = 5 ; < / code > <nl> + * @ param int $ var <nl> + * @ return $ this <nl> * / <nl> public function setClientChannels ( $ var ) <nl> { <nl> GPBUtil : : checkInt32 ( $ var ) ; <nl> $ this - > client_channels = $ var ; <nl> + <nl> + return $ this ; <nl> } <nl> <nl> / * * <nl> - * < pre > <nl> * Only for async client . Number of threads to use to start / manage RPCs . <nl> - * < / pre > <nl> * <nl> - * < code > int32 async_client_threads = 7 ; < / code > <nl> + * Generated from protobuf field < code > int32 async_client_threads = 7 ; < / code > <nl> + * @ return int <nl> * / <nl> public function getAsyncClientThreads ( ) <nl> { <nl> public function getAsyncClientThreads ( ) <nl> } <nl> <nl> / * * <nl> - * < pre > <nl> * Only for async client . Number of threads to use to start / manage RPCs . <nl> - * < / pre > <nl> * <nl> - * < code > int32 async_client_threads = 7 ; < / code > <nl> + * Generated from protobuf field < code > int32 async_client_threads = 7 ; < / code > <nl> + * @ param int $ var <nl> + * @ return $ this <nl> * / <nl> public function setAsyncClientThreads ( $ var ) <nl> { <nl> GPBUtil : : checkInt32 ( $ var ) ; <nl> $ this - > async_client_threads = $ var ; <nl> + <nl> + return $ this ; <nl> } <nl> <nl> / * * <nl> - * < code > . grpc . testing . RpcType rpc_type = 8 ; < / code > <nl> + * Generated from protobuf field < code > . grpc . testing . RpcType rpc_type = 8 ; < / code > <nl> + * @ return int <nl> * / <nl> public function getRpcType ( ) <nl> { <nl> public function getRpcType ( ) <nl> } <nl> <nl> / * * <nl> - * < code > . grpc . testing . RpcType rpc_type = 8 ; < / code > <nl> + * Generated from protobuf field < code > . grpc . testing . RpcType rpc_type = 8 ; < / code > <nl> + * @ param int $ var <nl> + * @ return $ this <nl> * / <nl> public function setRpcType ( $ var ) <nl> { <nl> GPBUtil : : checkEnum ( $ var , \ Grpc \ Testing \ RpcType : : class ) ; <nl> $ this - > rpc_type = $ var ; <nl> + <nl> + return $ this ; <nl> } <nl> <nl> / * * <nl> - * < pre > <nl> * The requested load for the entire client ( aggregated over all the threads ) . <nl> - * < / pre > <nl> * <nl> - * < code > . grpc . testing . LoadParams load_params = 10 ; < / code > <nl> + * Generated from protobuf field < code > . grpc . testing . LoadParams load_params = 10 ; < / code > <nl> + * @ return \ Grpc \ Testing \ LoadParams <nl> * / <nl> public function getLoadParams ( ) <nl> { <nl> public function getLoadParams ( ) <nl> } <nl> <nl> / * * <nl> - * < pre > <nl> * The requested load for the entire client ( aggregated over all the threads ) . <nl> - * < / pre > <nl> * <nl> - * < code > . grpc . testing . LoadParams load_params = 10 ; < / code > <nl> + * Generated from protobuf field < code > . grpc . testing . LoadParams load_params = 10 ; < / code > <nl> + * @ param \ Grpc \ Testing \ LoadParams $ var <nl> + * @ return $ this <nl> * / <nl> - public function setLoadParams ( & $ var ) <nl> + public function setLoadParams ( $ var ) <nl> { <nl> GPBUtil : : checkMessage ( $ var , \ Grpc \ Testing \ LoadParams : : class ) ; <nl> $ this - > load_params = $ var ; <nl> + <nl> + return $ this ; <nl> } <nl> <nl> / * * <nl> - * < code > . grpc . testing . PayloadConfig payload_config = 11 ; < / code > <nl> + * Generated from protobuf field < code > . grpc . testing . PayloadConfig payload_config = 11 ; < / code > <nl> + * @ return \ Grpc \ Testing \ PayloadConfig <nl> * / <nl> public function getPayloadConfig ( ) <nl> { <nl> public function getPayloadConfig ( ) <nl> } <nl> <nl> / * * <nl> - * < code > . grpc . testing . PayloadConfig payload_config = 11 ; < / code > <nl> + * Generated from protobuf field < code > . grpc . testing . PayloadConfig payload_config = 11 ; < / code > <nl> + * @ param \ Grpc \ Testing \ PayloadConfig $ var <nl> + * @ return $ this <nl> * / <nl> - public function setPayloadConfig ( & $ var ) <nl> + public function setPayloadConfig ( $ var ) <nl> { <nl> GPBUtil : : checkMessage ( $ var , \ Grpc \ Testing \ PayloadConfig : : class ) ; <nl> $ this - > payload_config = $ var ; <nl> + <nl> + return $ this ; <nl> } <nl> <nl> / * * <nl> - * < code > . grpc . testing . HistogramParams histogram_params = 12 ; < / code > <nl> + * Generated from protobuf field < code > . grpc . testing . HistogramParams histogram_params = 12 ; < / code > <nl> + * @ return \ Grpc \ Testing \ HistogramParams <nl> * / <nl> public function getHistogramParams ( ) <nl> { <nl> public function getHistogramParams ( ) <nl> } <nl> <nl> / * * <nl> - * < code > . grpc . testing . HistogramParams histogram_params = 12 ; < / code > <nl> + * Generated from protobuf field < code > . grpc . testing . HistogramParams histogram_params = 12 ; < / code > <nl> + * @ param \ Grpc \ Testing \ HistogramParams $ var <nl> + * @ return $ this <nl> * / <nl> - public function setHistogramParams ( & $ var ) <nl> + public function setHistogramParams ( $ var ) <nl> { <nl> GPBUtil : : checkMessage ( $ var , \ Grpc \ Testing \ HistogramParams : : class ) ; <nl> $ this - > histogram_params = $ var ; <nl> + <nl> + return $ this ; <nl> } <nl> <nl> / * * <nl> - * < pre > <nl> * Specify the cores we should run the client on , if desired <nl> - * < / pre > <nl> * <nl> - * < code > repeated int32 core_list = 13 ; < / code > <nl> + * Generated from protobuf field < code > repeated int32 core_list = 13 ; < / code > <nl> + * @ return \ Google \ Protobuf \ Internal \ RepeatedField <nl> * / <nl> public function getCoreList ( ) <nl> { <nl> public function getCoreList ( ) <nl> } <nl> <nl> / * * <nl> - * < pre > <nl> * Specify the cores we should run the client on , if desired <nl> - * < / pre > <nl> * <nl> - * < code > repeated int32 core_list = 13 ; < / code > <nl> + * Generated from protobuf field < code > repeated int32 core_list = 13 ; < / code > <nl> + * @ param int [ ] | \ Google \ Protobuf \ Internal \ RepeatedField $ var <nl> + * @ return $ this <nl> * / <nl> - public function setCoreList ( & $ var ) <nl> + public function setCoreList ( $ var ) <nl> { <nl> - GPBUtil : : checkRepeatedField ( $ var , \ Google \ Protobuf \ Internal \ GPBType : : INT32 ) ; <nl> - $ this - > core_list = $ var ; <nl> + $ arr = GPBUtil : : checkRepeatedField ( $ var , \ Google \ Protobuf \ Internal \ GPBType : : INT32 ) ; <nl> + $ this - > core_list = $ arr ; <nl> + <nl> + return $ this ; <nl> } <nl> <nl> / * * <nl> - * < code > int32 core_limit = 14 ; < / code > <nl> + * Generated from protobuf field < code > int32 core_limit = 14 ; < / code > <nl> + * @ return int <nl> * / <nl> public function getCoreLimit ( ) <nl> { <nl> public function getCoreLimit ( ) <nl> } <nl> <nl> / * * <nl> - * < code > int32 core_limit = 14 ; < / code > <nl> + * Generated from protobuf field < code > int32 core_limit = 14 ; < / code > <nl> + * @ param int $ var <nl> + * @ return $ this <nl> * / <nl> public function setCoreLimit ( $ var ) <nl> { <nl> GPBUtil : : checkInt32 ( $ var ) ; <nl> $ this - > core_limit = $ var ; <nl> + <nl> + return $ this ; <nl> } <nl> <nl> / * * <nl> - * < pre > <nl> * If we use an OTHER_CLIENT client_type , this string gives more detail <nl> - * < / pre > <nl> * <nl> - * < code > string other_client_api = 15 ; < / code > <nl> + * Generated from protobuf field < code > string other_client_api = 15 ; < / code > <nl> + * @ return string <nl> * / <nl> public function getOtherClientApi ( ) <nl> { <nl> public function getOtherClientApi ( ) <nl> } <nl> <nl> / * * <nl> - * < pre > <nl> * If we use an OTHER_CLIENT client_type , this string gives more detail <nl> - * < / pre > <nl> * <nl> - * < code > string other_client_api = 15 ; < / code > <nl> + * Generated from protobuf field < code > string other_client_api = 15 ; < / code > <nl> + * @ param string $ var <nl> + * @ return $ this <nl> * / <nl> public function setOtherClientApi ( $ var ) <nl> { <nl> GPBUtil : : checkString ( $ var , True ) ; <nl> $ this - > other_client_api = $ var ; <nl> + <nl> + return $ this ; <nl> } <nl> <nl> / * * <nl> - * < code > repeated . grpc . testing . ChannelArg channel_args = 16 ; < / code > <nl> + * Generated from protobuf field < code > repeated . grpc . testing . ChannelArg channel_args = 16 ; < / code > <nl> + * @ return \ Google \ Protobuf \ Internal \ RepeatedField <nl> * / <nl> public function getChannelArgs ( ) <nl> { <nl> public function getChannelArgs ( ) <nl> } <nl> <nl> / * * <nl> - * < code > repeated . grpc . testing . ChannelArg channel_args = 16 ; < / code > <nl> + * Generated from protobuf field < code > repeated . grpc . testing . ChannelArg channel_args = 16 ; < / code > <nl> + * @ param \ Grpc \ Testing \ ChannelArg [ ] | \ Google \ Protobuf \ Internal \ RepeatedField $ var <nl> + * @ return $ this <nl> + * / <nl> + public function setChannelArgs ( $ var ) <nl> + { <nl> + $ arr = GPBUtil : : checkRepeatedField ( $ var , \ Google \ Protobuf \ Internal \ GPBType : : MESSAGE , \ Grpc \ Testing \ ChannelArg : : class ) ; <nl> + $ this - > channel_args = $ arr ; <nl> + <nl> + return $ this ; <nl> + } <nl> + <nl> + / * * <nl> + * Number of threads that share each completion queue <nl> + * <nl> + * Generated from protobuf field < code > int32 threads_per_cq = 17 ; < / code > <nl> + * @ return int <nl> + * / <nl> + public function getThreadsPerCq ( ) <nl> + { <nl> + return $ this - > threads_per_cq ; <nl> + } <nl> + <nl> + / * * <nl> + * Number of threads that share each completion queue <nl> + * <nl> + * Generated from protobuf field < code > int32 threads_per_cq = 17 ; < / code > <nl> + * @ param int $ var <nl> + * @ return $ this <nl> + * / <nl> + public function setThreadsPerCq ( $ var ) <nl> + { <nl> + GPBUtil : : checkInt32 ( $ var ) ; <nl> + $ this - > threads_per_cq = $ var ; <nl> + <nl> + return $ this ; <nl> + } <nl> + <nl> + / * * <nl> + * Number of messages on a stream before it gets finished / restarted <nl> + * <nl> + * Generated from protobuf field < code > int32 messages_per_stream = 18 ; < / code > <nl> + * @ return int <nl> + * / <nl> + public function getMessagesPerStream ( ) <nl> + { <nl> + return $ this - > messages_per_stream ; <nl> + } <nl> + <nl> + / * * <nl> + * Number of messages on a stream before it gets finished / restarted <nl> + * <nl> + * Generated from protobuf field < code > int32 messages_per_stream = 18 ; < / code > <nl> + * @ param int $ var <nl> + * @ return $ this <nl> * / <nl> - public function setChannelArgs ( & $ var ) <nl> + public function setMessagesPerStream ( $ var ) <nl> { <nl> - GPBUtil : : checkRepeatedField ( $ var , \ Google \ Protobuf \ Internal \ GPBType : : MESSAGE , \ Grpc \ Testing \ ChannelArg : : class ) ; <nl> - $ this - > channel_args = $ var ; <nl> + GPBUtil : : checkInt32 ( $ var ) ; <nl> + $ this - > messages_per_stream = $ var ; <nl> + <nl> + return $ this ; <nl> } <nl> <nl> } <nl> mmm a / src / php / tests / qps / generated_code / Grpc / Testing / ClientStats . php <nl> ppp b / src / php / tests / qps / generated_code / Grpc / Testing / ClientStats . php <nl> <nl> use Google \ Protobuf \ Internal \ GPBUtil ; <nl> <nl> / * * <nl> - * Protobuf type < code > grpc . testing . ClientStats < / code > <nl> + * Generated from protobuf message < code > grpc . testing . ClientStats < / code > <nl> * / <nl> class ClientStats extends \ Google \ Protobuf \ Internal \ Message <nl> { <nl> / * * <nl> - * < pre > <nl> * Latency histogram . Data points are in nanoseconds . <nl> - * < / pre > <nl> * <nl> - * < code > . grpc . testing . HistogramData latencies = 1 ; < / code > <nl> + * Generated from protobuf field < code > . grpc . testing . HistogramData latencies = 1 ; < / code > <nl> * / <nl> private $ latencies = null ; <nl> / * * <nl> - * < pre > <nl> * See ServerStats for details . <nl> - * < / pre > <nl> * <nl> - * < code > double time_elapsed = 2 ; < / code > <nl> + * Generated from protobuf field < code > double time_elapsed = 2 ; < / code > <nl> * / <nl> private $ time_elapsed = 0 . 0 ; <nl> / * * <nl> - * < code > double time_user = 3 ; < / code > <nl> + * Generated from protobuf field < code > double time_user = 3 ; < / code > <nl> * / <nl> private $ time_user = 0 . 0 ; <nl> / * * <nl> - * < code > double time_system = 4 ; < / code > <nl> + * Generated from protobuf field < code > double time_system = 4 ; < / code > <nl> * / <nl> private $ time_system = 0 . 0 ; <nl> / * * <nl> - * < pre > <nl> * Number of failed requests ( one row per status code seen ) <nl> - * < / pre > <nl> * <nl> - * < code > repeated . grpc . testing . RequestResultCount request_results = 5 ; < / code > <nl> + * Generated from protobuf field < code > repeated . grpc . testing . RequestResultCount request_results = 5 ; < / code > <nl> * / <nl> private $ request_results ; <nl> + / * * <nl> + * Number of polls called inside completion queue <nl> + * <nl> + * Generated from protobuf field < code > uint64 cq_poll_count = 6 ; < / code > <nl> + * / <nl> + private $ cq_poll_count = 0 ; <nl> + / * * <nl> + * Core library stats <nl> + * <nl> + * Generated from protobuf field < code > . grpc . core . Stats core_stats = 7 ; < / code > <nl> + * / <nl> + private $ core_stats = null ; <nl> <nl> public function __construct ( ) { <nl> \ GPBMetadata \ Src \ Proto \ Grpc \ Testing \ Stats : : initOnce ( ) ; <nl> public function __construct ( ) { <nl> } <nl> <nl> / * * <nl> - * < pre > <nl> * Latency histogram . Data points are in nanoseconds . <nl> - * < / pre > <nl> * <nl> - * < code > . grpc . testing . HistogramData latencies = 1 ; < / code > <nl> + * Generated from protobuf field < code > . grpc . testing . HistogramData latencies = 1 ; < / code > <nl> + * @ return \ Grpc \ Testing \ HistogramData <nl> * / <nl> public function getLatencies ( ) <nl> { <nl> public function getLatencies ( ) <nl> } <nl> <nl> / * * <nl> - * < pre > <nl> * Latency histogram . Data points are in nanoseconds . <nl> - * < / pre > <nl> * <nl> - * < code > . grpc . testing . HistogramData latencies = 1 ; < / code > <nl> + * Generated from protobuf field < code > . grpc . testing . HistogramData latencies = 1 ; < / code > <nl> + * @ param \ Grpc \ Testing \ HistogramData $ var <nl> + * @ return $ this <nl> * / <nl> - public function setLatencies ( & $ var ) <nl> + public function setLatencies ( $ var ) <nl> { <nl> GPBUtil : : checkMessage ( $ var , \ Grpc \ Testing \ HistogramData : : class ) ; <nl> $ this - > latencies = $ var ; <nl> + <nl> + return $ this ; <nl> } <nl> <nl> / * * <nl> - * < pre > <nl> * See ServerStats for details . <nl> - * < / pre > <nl> * <nl> - * < code > double time_elapsed = 2 ; < / code > <nl> + * Generated from protobuf field < code > double time_elapsed = 2 ; < / code > <nl> + * @ return float <nl> * / <nl> public function getTimeElapsed ( ) <nl> { <nl> public function getTimeElapsed ( ) <nl> } <nl> <nl> / * * <nl> - * < pre > <nl> * See ServerStats for details . <nl> - * < / pre > <nl> * <nl> - * < code > double time_elapsed = 2 ; < / code > <nl> + * Generated from protobuf field < code > double time_elapsed = 2 ; < / code > <nl> + * @ param float $ var <nl> + * @ return $ this <nl> * / <nl> public function setTimeElapsed ( $ var ) <nl> { <nl> GPBUtil : : checkDouble ( $ var ) ; <nl> $ this - > time_elapsed = $ var ; <nl> + <nl> + return $ this ; <nl> } <nl> <nl> / * * <nl> - * < code > double time_user = 3 ; < / code > <nl> + * Generated from protobuf field < code > double time_user = 3 ; < / code > <nl> + * @ return float <nl> * / <nl> public function getTimeUser ( ) <nl> { <nl> public function getTimeUser ( ) <nl> } <nl> <nl> / * * <nl> - * < code > double time_user = 3 ; < / code > <nl> + * Generated from protobuf field < code > double time_user = 3 ; < / code > <nl> + * @ param float $ var <nl> + * @ return $ this <nl> * / <nl> public function setTimeUser ( $ var ) <nl> { <nl> GPBUtil : : checkDouble ( $ var ) ; <nl> $ this - > time_user = $ var ; <nl> + <nl> + return $ this ; <nl> } <nl> <nl> / * * <nl> - * < code > double time_system = 4 ; < / code > <nl> + * Generated from protobuf field < code > double time_system = 4 ; < / code > <nl> + * @ return float <nl> * / <nl> public function getTimeSystem ( ) <nl> { <nl> public function getTimeSystem ( ) <nl> } <nl> <nl> / * * <nl> - * < code > double time_system = 4 ; < / code > <nl> + * Generated from protobuf field < code > double time_system = 4 ; < / code > <nl> + * @ param float $ var <nl> + * @ return $ this <nl> * / <nl> public function setTimeSystem ( $ var ) <nl> { <nl> GPBUtil : : checkDouble ( $ var ) ; <nl> $ this - > time_system = $ var ; <nl> + <nl> + return $ this ; <nl> } <nl> <nl> / * * <nl> - * < pre > <nl> * Number of failed requests ( one row per status code seen ) <nl> - * < / pre > <nl> * <nl> - * < code > repeated . grpc . testing . RequestResultCount request_results = 5 ; < / code > <nl> + * Generated from protobuf field < code > repeated . grpc . testing . RequestResultCount request_results = 5 ; < / code > <nl> + * @ return \ Google \ Protobuf \ Internal \ RepeatedField <nl> * / <nl> public function getRequestResults ( ) <nl> { <nl> public function getRequestResults ( ) <nl> } <nl> <nl> / * * <nl> - * < pre > <nl> * Number of failed requests ( one row per status code seen ) <nl> - * < / pre > <nl> * <nl> - * < code > repeated . grpc . testing . RequestResultCount request_results = 5 ; < / code > <nl> + * Generated from protobuf field < code > repeated . grpc . testing . RequestResultCount request_results = 5 ; < / code > <nl> + * @ param \ Grpc \ Testing \ RequestResultCount [ ] | \ Google \ Protobuf \ Internal \ RepeatedField $ var <nl> + * @ return $ this <nl> * / <nl> - public function setRequestResults ( & $ var ) <nl> + public function setRequestResults ( $ var ) <nl> { <nl> - GPBUtil : : checkRepeatedField ( $ var , \ Google \ Protobuf \ Internal \ GPBType : : MESSAGE , \ Grpc \ Testing \ RequestResultCount : : class ) ; <nl> - $ this - > request_results = $ var ; <nl> + $ arr = GPBUtil : : checkRepeatedField ( $ var , \ Google \ Protobuf \ Internal \ GPBType : : MESSAGE , \ Grpc \ Testing \ RequestResultCount : : class ) ; <nl> + $ this - > request_results = $ arr ; <nl> + <nl> + return $ this ; <nl> + } <nl> + <nl> + / * * <nl> + * Number of polls called inside completion queue <nl> + * <nl> + * Generated from protobuf field < code > uint64 cq_poll_count = 6 ; < / code > <nl> + * @ return int | string <nl> + * / <nl> + public function getCqPollCount ( ) <nl> + { <nl> + return $ this - > cq_poll_count ; <nl> + } <nl> + <nl> + / * * <nl> + * Number of polls called inside completion queue <nl> + * <nl> + * Generated from protobuf field < code > uint64 cq_poll_count = 6 ; < / code > <nl> + * @ param int | string $ var <nl> + * @ return $ this <nl> + * / <nl> + public function setCqPollCount ( $ var ) <nl> + { <nl> + GPBUtil : : checkUint64 ( $ var ) ; <nl> + $ this - > cq_poll_count = $ var ; <nl> + <nl> + return $ this ; <nl> + } <nl> + <nl> + / * * <nl> + * Core library stats <nl> + * <nl> + * Generated from protobuf field < code > . grpc . core . Stats core_stats = 7 ; < / code > <nl> + * @ return \ Grpc \ Core \ Stats <nl> + * / <nl> + public function getCoreStats ( ) <nl> + { <nl> + return $ this - > core_stats ; <nl> + } <nl> + <nl> + / * * <nl> + * Core library stats <nl> + * <nl> + * Generated from protobuf field < code > . grpc . core . Stats core_stats = 7 ; < / code > <nl> + * @ param \ Grpc \ Core \ Stats $ var <nl> + * @ return $ this <nl> + * / <nl> + public function setCoreStats ( $ var ) <nl> + { <nl> + GPBUtil : : checkMessage ( $ var , \ Grpc \ Core \ Stats : : class ) ; <nl> + $ this - > core_stats = $ var ; <nl> + <nl> + return $ this ; <nl> } <nl> <nl> } <nl> mmm a / src / php / tests / qps / generated_code / Grpc / Testing / ClientStatus . php <nl> ppp b / src / php / tests / qps / generated_code / Grpc / Testing / ClientStatus . php <nl> <nl> use Google \ Protobuf \ Internal \ GPBUtil ; <nl> <nl> / * * <nl> - * Protobuf type < code > grpc . testing . ClientStatus < / code > <nl> + * Generated from protobuf message < code > grpc . testing . ClientStatus < / code > <nl> * / <nl> class ClientStatus extends \ Google \ Protobuf \ Internal \ Message <nl> { <nl> / * * <nl> - * < code > . grpc . testing . ClientStats stats = 1 ; < / code > <nl> + * Generated from protobuf field < code > . grpc . testing . ClientStats stats = 1 ; < / code > <nl> * / <nl> private $ stats = null ; <nl> <nl> public function __construct ( ) { <nl> } <nl> <nl> / * * <nl> - * < code > . grpc . testing . ClientStats stats = 1 ; < / code > <nl> + * Generated from protobuf field < code > . grpc . testing . ClientStats stats = 1 ; < / code > <nl> + * @ return \ Grpc \ Testing \ ClientStats <nl> * / <nl> public function getStats ( ) <nl> { <nl> public function getStats ( ) <nl> } <nl> <nl> / * * <nl> - * < code > . grpc . testing . ClientStats stats = 1 ; < / code > <nl> + * Generated from protobuf field < code > . grpc . testing . ClientStats stats = 1 ; < / code > <nl> + * @ param \ Grpc \ Testing \ ClientStats $ var <nl> + * @ return $ this <nl> * / <nl> - public function setStats ( & $ var ) <nl> + public function setStats ( $ var ) <nl> { <nl> GPBUtil : : checkMessage ( $ var , \ Grpc \ Testing \ ClientStats : : class ) ; <nl> $ this - > stats = $ var ; <nl> + <nl> + return $ this ; <nl> } <nl> <nl> } <nl> mmm a / src / php / tests / qps / generated_code / Grpc / Testing / ClientType . php <nl> ppp b / src / php / tests / qps / generated_code / Grpc / Testing / ClientType . php <nl> <nl> namespace Grpc \ Testing ; <nl> <nl> / * * <nl> - * Protobuf enum < code > grpc . testing . ClientType < / code > <nl> + * Protobuf enum < code > Grpc \ Testing \ ClientType < / code > <nl> * / <nl> class ClientType <nl> { <nl> / * * <nl> - * < pre > <nl> * Many languages support a basic distinction between using <nl> * sync or async client , and this allows the specification <nl> - * < / pre > <nl> * <nl> - * < code > SYNC_CLIENT = 0 ; < / code > <nl> + * Generated from protobuf enum < code > SYNC_CLIENT = 0 ; < / code > <nl> * / <nl> const SYNC_CLIENT = 0 ; <nl> / * * <nl> - * < code > ASYNC_CLIENT = 1 ; < / code > <nl> + * Generated from protobuf enum < code > ASYNC_CLIENT = 1 ; < / code > <nl> * / <nl> const ASYNC_CLIENT = 1 ; <nl> / * * <nl> - * < pre > <nl> * used for some language - specific variants <nl> - * < / pre > <nl> * <nl> - * < code > OTHER_CLIENT = 2 ; < / code > <nl> + * Generated from protobuf enum < code > OTHER_CLIENT = 2 ; < / code > <nl> * / <nl> const OTHER_CLIENT = 2 ; <nl> } <nl> mmm a / src / php / tests / qps / generated_code / Grpc / Testing / ClosedLoopParams . php <nl> ppp b / src / php / tests / qps / generated_code / Grpc / Testing / ClosedLoopParams . php <nl> <nl> use Google \ Protobuf \ Internal \ GPBUtil ; <nl> <nl> / * * <nl> - * < pre > <nl> * Once an RPC finishes , immediately start a new one . <nl> * No configuration parameters needed . <nl> - * < / pre > <nl> * <nl> - * Protobuf type < code > grpc . testing . ClosedLoopParams < / code > <nl> + * Generated from protobuf message < code > grpc . testing . ClosedLoopParams < / code > <nl> * / <nl> class ClosedLoopParams extends \ Google \ Protobuf \ Internal \ Message <nl> { <nl> mmm a / src / php / tests / qps / generated_code / Grpc / Testing / ComplexProtoParams . php <nl> ppp b / src / php / tests / qps / generated_code / Grpc / Testing / ComplexProtoParams . php <nl> <nl> use Google \ Protobuf \ Internal \ GPBUtil ; <nl> <nl> / * * <nl> - * < pre > <nl> * TODO ( vpai ) : Fill this in once the details of complex , representative <nl> * protos are decided <nl> - * < / pre > <nl> * <nl> - * Protobuf type < code > grpc . testing . ComplexProtoParams < / code > <nl> + * Generated from protobuf message < code > grpc . testing . ComplexProtoParams < / code > <nl> * / <nl> class ComplexProtoParams extends \ Google \ Protobuf \ Internal \ Message <nl> { <nl> mmm a / src / php / tests / qps / generated_code / Grpc / Testing / CoreRequest . php <nl> ppp b / src / php / tests / qps / generated_code / Grpc / Testing / CoreRequest . php <nl> <nl> use Google \ Protobuf \ Internal \ GPBUtil ; <nl> <nl> / * * <nl> - * Protobuf type < code > grpc . testing . CoreRequest < / code > <nl> + * Generated from protobuf message < code > grpc . testing . CoreRequest < / code > <nl> * / <nl> class CoreRequest extends \ Google \ Protobuf \ Internal \ Message <nl> { <nl> mmm a / src / php / tests / qps / generated_code / Grpc / Testing / CoreResponse . php <nl> ppp b / src / php / tests / qps / generated_code / Grpc / Testing / CoreResponse . php <nl> <nl> use Google \ Protobuf \ Internal \ GPBUtil ; <nl> <nl> / * * <nl> - * Protobuf type < code > grpc . testing . CoreResponse < / code > <nl> + * Generated from protobuf message < code > grpc . testing . CoreResponse < / code > <nl> * / <nl> class CoreResponse extends \ Google \ Protobuf \ Internal \ Message <nl> { <nl> / * * <nl> - * < pre > <nl> * Number of cores available on the server <nl> - * < / pre > <nl> * <nl> - * < code > int32 cores = 1 ; < / code > <nl> + * Generated from protobuf field < code > int32 cores = 1 ; < / code > <nl> * / <nl> private $ cores = 0 ; <nl> <nl> public function __construct ( ) { <nl> } <nl> <nl> / * * <nl> - * < pre > <nl> * Number of cores available on the server <nl> - * < / pre > <nl> * <nl> - * < code > int32 cores = 1 ; < / code > <nl> + * Generated from protobuf field < code > int32 cores = 1 ; < / code > <nl> + * @ return int <nl> * / <nl> public function getCores ( ) <nl> { <nl> public function getCores ( ) <nl> } <nl> <nl> / * * <nl> - * < pre > <nl> * Number of cores available on the server <nl> - * < / pre > <nl> * <nl> - * < code > int32 cores = 1 ; < / code > <nl> + * Generated from protobuf field < code > int32 cores = 1 ; < / code > <nl> + * @ param int $ var <nl> + * @ return $ this <nl> * / <nl> public function setCores ( $ var ) <nl> { <nl> GPBUtil : : checkInt32 ( $ var ) ; <nl> $ this - > cores = $ var ; <nl> + <nl> + return $ this ; <nl> } <nl> <nl> } <nl> mmm a / src / php / tests / qps / generated_code / Grpc / Testing / EchoStatus . php <nl> ppp b / src / php / tests / qps / generated_code / Grpc / Testing / EchoStatus . php <nl> <nl> use Google \ Protobuf \ Internal \ GPBUtil ; <nl> <nl> / * * <nl> - * < pre > <nl> * A protobuf representation for grpc status . This is used by test <nl> * clients to specify a status that the server should attempt to return . <nl> - * < / pre > <nl> * <nl> - * Protobuf type < code > grpc . testing . EchoStatus < / code > <nl> + * Generated from protobuf message < code > grpc . testing . EchoStatus < / code > <nl> * / <nl> class EchoStatus extends \ Google \ Protobuf \ Internal \ Message <nl> { <nl> / * * <nl> - * < code > int32 code = 1 ; < / code > <nl> + * Generated from protobuf field < code > int32 code = 1 ; < / code > <nl> * / <nl> private $ code = 0 ; <nl> / * * <nl> - * < code > string message = 2 ; < / code > <nl> + * Generated from protobuf field < code > string message = 2 ; < / code > <nl> * / <nl> private $ message = ' ' ; <nl> <nl> public function __construct ( ) { <nl> } <nl> <nl> / * * <nl> - * < code > int32 code = 1 ; < / code > <nl> + * Generated from protobuf field < code > int32 code = 1 ; < / code > <nl> + * @ return int <nl> * / <nl> public function getCode ( ) <nl> { <nl> public function getCode ( ) <nl> } <nl> <nl> / * * <nl> - * < code > int32 code = 1 ; < / code > <nl> + * Generated from protobuf field < code > int32 code = 1 ; < / code > <nl> + * @ param int $ var <nl> + * @ return $ this <nl> * / <nl> public function setCode ( $ var ) <nl> { <nl> GPBUtil : : checkInt32 ( $ var ) ; <nl> $ this - > code = $ var ; <nl> + <nl> + return $ this ; <nl> } <nl> <nl> / * * <nl> - * < code > string message = 2 ; < / code > <nl> + * Generated from protobuf field < code > string message = 2 ; < / code > <nl> + * @ return string <nl> * / <nl> public function getMessage ( ) <nl> { <nl> public function getMessage ( ) <nl> } <nl> <nl> / * * <nl> - * < code > string message = 2 ; < / code > <nl> + * Generated from protobuf field < code > string message = 2 ; < / code > <nl> + * @ param string $ var <nl> + * @ return $ this <nl> * / <nl> public function setMessage ( $ var ) <nl> { <nl> GPBUtil : : checkString ( $ var , True ) ; <nl> $ this - > message = $ var ; <nl> + <nl> + return $ this ; <nl> } <nl> <nl> } <nl> mmm a / src / php / tests / qps / generated_code / Grpc / Testing / HistogramData . php <nl> ppp b / src / php / tests / qps / generated_code / Grpc / Testing / HistogramData . php <nl> <nl> use Google \ Protobuf \ Internal \ GPBUtil ; <nl> <nl> / * * <nl> - * < pre > <nl> * Histogram data based on grpc / support / histogram . c <nl> - * < / pre > <nl> * <nl> - * Protobuf type < code > grpc . testing . HistogramData < / code > <nl> + * Generated from protobuf message < code > grpc . testing . HistogramData < / code > <nl> * / <nl> class HistogramData extends \ Google \ Protobuf \ Internal \ Message <nl> { <nl> / * * <nl> - * < code > repeated uint32 bucket = 1 ; < / code > <nl> + * Generated from protobuf field < code > repeated uint32 bucket = 1 ; < / code > <nl> * / <nl> private $ bucket ; <nl> / * * <nl> - * < code > double min_seen = 2 ; < / code > <nl> + * Generated from protobuf field < code > double min_seen = 2 ; < / code > <nl> * / <nl> private $ min_seen = 0 . 0 ; <nl> / * * <nl> - * < code > double max_seen = 3 ; < / code > <nl> + * Generated from protobuf field < code > double max_seen = 3 ; < / code > <nl> * / <nl> private $ max_seen = 0 . 0 ; <nl> / * * <nl> - * < code > double sum = 4 ; < / code > <nl> + * Generated from protobuf field < code > double sum = 4 ; < / code > <nl> * / <nl> private $ sum = 0 . 0 ; <nl> / * * <nl> - * < code > double sum_of_squares = 5 ; < / code > <nl> + * Generated from protobuf field < code > double sum_of_squares = 5 ; < / code > <nl> * / <nl> private $ sum_of_squares = 0 . 0 ; <nl> / * * <nl> - * < code > double count = 6 ; < / code > <nl> + * Generated from protobuf field < code > double count = 6 ; < / code > <nl> * / <nl> private $ count = 0 . 0 ; <nl> <nl> public function __construct ( ) { <nl> } <nl> <nl> / * * <nl> - * < code > repeated uint32 bucket = 1 ; < / code > <nl> + * Generated from protobuf field < code > repeated uint32 bucket = 1 ; < / code > <nl> + * @ return \ Google \ Protobuf \ Internal \ RepeatedField <nl> * / <nl> public function getBucket ( ) <nl> { <nl> public function getBucket ( ) <nl> } <nl> <nl> / * * <nl> - * < code > repeated uint32 bucket = 1 ; < / code > <nl> + * Generated from protobuf field < code > repeated uint32 bucket = 1 ; < / code > <nl> + * @ param int [ ] | \ Google \ Protobuf \ Internal \ RepeatedField $ var <nl> + * @ return $ this <nl> * / <nl> - public function setBucket ( & $ var ) <nl> + public function setBucket ( $ var ) <nl> { <nl> - GPBUtil : : checkRepeatedField ( $ var , \ Google \ Protobuf \ Internal \ GPBType : : UINT32 ) ; <nl> - $ this - > bucket = $ var ; <nl> + $ arr = GPBUtil : : checkRepeatedField ( $ var , \ Google \ Protobuf \ Internal \ GPBType : : UINT32 ) ; <nl> + $ this - > bucket = $ arr ; <nl> + <nl> + return $ this ; <nl> } <nl> <nl> / * * <nl> - * < code > double min_seen = 2 ; < / code > <nl> + * Generated from protobuf field < code > double min_seen = 2 ; < / code > <nl> + * @ return float <nl> * / <nl> public function getMinSeen ( ) <nl> { <nl> public function getMinSeen ( ) <nl> } <nl> <nl> / * * <nl> - * < code > double min_seen = 2 ; < / code > <nl> + * Generated from protobuf field < code > double min_seen = 2 ; < / code > <nl> + * @ param float $ var <nl> + * @ return $ this <nl> * / <nl> public function setMinSeen ( $ var ) <nl> { <nl> GPBUtil : : checkDouble ( $ var ) ; <nl> $ this - > min_seen = $ var ; <nl> + <nl> + return $ this ; <nl> } <nl> <nl> / * * <nl> - * < code > double max_seen = 3 ; < / code > <nl> + * Generated from protobuf field < code > double max_seen = 3 ; < / code > <nl> + * @ return float <nl> * / <nl> public function getMaxSeen ( ) <nl> { <nl> public function getMaxSeen ( ) <nl> } <nl> <nl> / * * <nl> - * < code > double max_seen = 3 ; < / code > <nl> + * Generated from protobuf field < code > double max_seen = 3 ; < / code > <nl> + * @ param float $ var <nl> + * @ return $ this <nl> * / <nl> public function setMaxSeen ( $ var ) <nl> { <nl> GPBUtil : : checkDouble ( $ var ) ; <nl> $ this - > max_seen = $ var ; <nl> + <nl> + return $ this ; <nl> } <nl> <nl> / * * <nl> - * < code > double sum = 4 ; < / code > <nl> + * Generated from protobuf field < code > double sum = 4 ; < / code > <nl> + * @ return float <nl> * / <nl> public function getSum ( ) <nl> { <nl> public function getSum ( ) <nl> } <nl> <nl> / * * <nl> - * < code > double sum = 4 ; < / code > <nl> + * Generated from protobuf field < code > double sum = 4 ; < / code > <nl> + * @ param float $ var <nl> + * @ return $ this <nl> * / <nl> public function setSum ( $ var ) <nl> { <nl> GPBUtil : : checkDouble ( $ var ) ; <nl> $ this - > sum = $ var ; <nl> + <nl> + return $ this ; <nl> } <nl> <nl> / * * <nl> - * < code > double sum_of_squares = 5 ; < / code > <nl> + * Generated from protobuf field < code > double sum_of_squares = 5 ; < / code > <nl> + * @ return float <nl> * / <nl> public function getSumOfSquares ( ) <nl> { <nl> public function getSumOfSquares ( ) <nl> } <nl> <nl> / * * <nl> - * < code > double sum_of_squares = 5 ; < / code > <nl> + * Generated from protobuf field < code > double sum_of_squares = 5 ; < / code > <nl> + * @ param float $ var <nl> + * @ return $ this <nl> * / <nl> public function setSumOfSquares ( $ var ) <nl> { <nl> GPBUtil : : checkDouble ( $ var ) ; <nl> $ this - > sum_of_squares = $ var ; <nl> + <nl> + return $ this ; <nl> } <nl> <nl> / * * <nl> - * < code > double count = 6 ; < / code > <nl> + * Generated from protobuf field < code > double count = 6 ; < / code > <nl> + * @ return float <nl> * / <nl> public function getCount ( ) <nl> { <nl> public function getCount ( ) <nl> } <nl> <nl> / * * <nl> - * < code > double count = 6 ; < / code > <nl> + * Generated from protobuf field < code > double count = 6 ; < / code > <nl> + * @ param float $ var <nl> + * @ return $ this <nl> * / <nl> public function setCount ( $ var ) <nl> { <nl> GPBUtil : : checkDouble ( $ var ) ; <nl> $ this - > count = $ var ; <nl> + <nl> + return $ this ; <nl> } <nl> <nl> } <nl> mmm a / src / php / tests / qps / generated_code / Grpc / Testing / HistogramParams . php <nl> ppp b / src / php / tests / qps / generated_code / Grpc / Testing / HistogramParams . php <nl> <nl> use Google \ Protobuf \ Internal \ GPBUtil ; <nl> <nl> / * * <nl> - * < pre > <nl> * Histogram params based on grpc / support / histogram . c <nl> - * < / pre > <nl> * <nl> - * Protobuf type < code > grpc . testing . HistogramParams < / code > <nl> + * Generated from protobuf message < code > grpc . testing . HistogramParams < / code > <nl> * / <nl> class HistogramParams extends \ Google \ Protobuf \ Internal \ Message <nl> { <nl> / * * <nl> - * < pre > <nl> * first bucket is [ 0 , 1 + resolution ) <nl> - * < / pre > <nl> * <nl> - * < code > double resolution = 1 ; < / code > <nl> + * Generated from protobuf field < code > double resolution = 1 ; < / code > <nl> * / <nl> private $ resolution = 0 . 0 ; <nl> / * * <nl> - * < pre > <nl> * use enough buckets to allow this value <nl> - * < / pre > <nl> * <nl> - * < code > double max_possible = 2 ; < / code > <nl> + * Generated from protobuf field < code > double max_possible = 2 ; < / code > <nl> * / <nl> private $ max_possible = 0 . 0 ; <nl> <nl> public function __construct ( ) { <nl> } <nl> <nl> / * * <nl> - * < pre > <nl> * first bucket is [ 0 , 1 + resolution ) <nl> - * < / pre > <nl> * <nl> - * < code > double resolution = 1 ; < / code > <nl> + * Generated from protobuf field < code > double resolution = 1 ; < / code > <nl> + * @ return float <nl> * / <nl> public function getResolution ( ) <nl> { <nl> public function getResolution ( ) <nl> } <nl> <nl> / * * <nl> - * < pre > <nl> * first bucket is [ 0 , 1 + resolution ) <nl> - * < / pre > <nl> * <nl> - * < code > double resolution = 1 ; < / code > <nl> + * Generated from protobuf field < code > double resolution = 1 ; < / code > <nl> + * @ param float $ var <nl> + * @ return $ this <nl> * / <nl> public function setResolution ( $ var ) <nl> { <nl> GPBUtil : : checkDouble ( $ var ) ; <nl> $ this - > resolution = $ var ; <nl> + <nl> + return $ this ; <nl> } <nl> <nl> / * * <nl> - * < pre > <nl> * use enough buckets to allow this value <nl> - * < / pre > <nl> * <nl> - * < code > double max_possible = 2 ; < / code > <nl> + * Generated from protobuf field < code > double max_possible = 2 ; < / code > <nl> + * @ return float <nl> * / <nl> public function getMaxPossible ( ) <nl> { <nl> public function getMaxPossible ( ) <nl> } <nl> <nl> / * * <nl> - * < pre > <nl> * use enough buckets to allow this value <nl> - * < / pre > <nl> * <nl> - * < code > double max_possible = 2 ; < / code > <nl> + * Generated from protobuf field < code > double max_possible = 2 ; < / code > <nl> + * @ param float $ var <nl> + * @ return $ this <nl> * / <nl> public function setMaxPossible ( $ var ) <nl> { <nl> GPBUtil : : checkDouble ( $ var ) ; <nl> $ this - > max_possible = $ var ; <nl> + <nl> + return $ this ; <nl> } <nl> <nl> } <nl> mmm a / src / php / tests / qps / generated_code / Grpc / Testing / LoadParams . php <nl> ppp b / src / php / tests / qps / generated_code / Grpc / Testing / LoadParams . php <nl> <nl> use Google \ Protobuf \ Internal \ GPBUtil ; <nl> <nl> / * * <nl> - * Protobuf type < code > grpc . testing . LoadParams < / code > <nl> + * Generated from protobuf message < code > grpc . testing . LoadParams < / code > <nl> * / <nl> class LoadParams extends \ Google \ Protobuf \ Internal \ Message <nl> { <nl> public function __construct ( ) { <nl> } <nl> <nl> / * * <nl> - * < code > . grpc . testing . ClosedLoopParams closed_loop = 1 ; < / code > <nl> + * Generated from protobuf field < code > . grpc . testing . ClosedLoopParams closed_loop = 1 ; < / code > <nl> + * @ return \ Grpc \ Testing \ ClosedLoopParams <nl> * / <nl> public function getClosedLoop ( ) <nl> { <nl> public function getClosedLoop ( ) <nl> } <nl> <nl> / * * <nl> - * < code > . grpc . testing . ClosedLoopParams closed_loop = 1 ; < / code > <nl> + * Generated from protobuf field < code > . grpc . testing . ClosedLoopParams closed_loop = 1 ; < / code > <nl> + * @ param \ Grpc \ Testing \ ClosedLoopParams $ var <nl> + * @ return $ this <nl> * / <nl> - public function setClosedLoop ( & $ var ) <nl> + public function setClosedLoop ( $ var ) <nl> { <nl> GPBUtil : : checkMessage ( $ var , \ Grpc \ Testing \ ClosedLoopParams : : class ) ; <nl> $ this - > writeOneof ( 1 , $ var ) ; <nl> + <nl> + return $ this ; <nl> } <nl> <nl> / * * <nl> - * < code > . grpc . testing . PoissonParams poisson = 2 ; < / code > <nl> + * Generated from protobuf field < code > . grpc . testing . PoissonParams poisson = 2 ; < / code > <nl> + * @ return \ Grpc \ Testing \ PoissonParams <nl> * / <nl> public function getPoisson ( ) <nl> { <nl> public function getPoisson ( ) <nl> } <nl> <nl> / * * <nl> - * < code > . grpc . testing . PoissonParams poisson = 2 ; < / code > <nl> + * Generated from protobuf field < code > . grpc . testing . PoissonParams poisson = 2 ; < / code > <nl> + * @ param \ Grpc \ Testing \ PoissonParams $ var <nl> + * @ return $ this <nl> * / <nl> - public function setPoisson ( & $ var ) <nl> + public function setPoisson ( $ var ) <nl> { <nl> GPBUtil : : checkMessage ( $ var , \ Grpc \ Testing \ PoissonParams : : class ) ; <nl> $ this - > writeOneof ( 2 , $ var ) ; <nl> + <nl> + return $ this ; <nl> } <nl> <nl> + / * * <nl> + * @ return string <nl> + * / <nl> public function getLoad ( ) <nl> { <nl> return $ this - > whichOneof ( " load " ) ; <nl> mmm a / src / php / tests / qps / generated_code / Grpc / Testing / Mark . php <nl> ppp b / src / php / tests / qps / generated_code / Grpc / Testing / Mark . php <nl> <nl> use Google \ Protobuf \ Internal \ GPBUtil ; <nl> <nl> / * * <nl> - * < pre > <nl> * Request current stats <nl> - * < / pre > <nl> * <nl> - * Protobuf type < code > grpc . testing . Mark < / code > <nl> + * Generated from protobuf message < code > grpc . testing . Mark < / code > <nl> * / <nl> class Mark extends \ Google \ Protobuf \ Internal \ Message <nl> { <nl> / * * <nl> - * < pre > <nl> * if true , the stats will be reset after taking their snapshot . <nl> - * < / pre > <nl> * <nl> - * < code > bool reset = 1 ; < / code > <nl> + * Generated from protobuf field < code > bool reset = 1 ; < / code > <nl> * / <nl> private $ reset = false ; <nl> <nl> public function __construct ( ) { <nl> } <nl> <nl> / * * <nl> - * < pre > <nl> * if true , the stats will be reset after taking their snapshot . <nl> - * < / pre > <nl> * <nl> - * < code > bool reset = 1 ; < / code > <nl> + * Generated from protobuf field < code > bool reset = 1 ; < / code > <nl> + * @ return bool <nl> * / <nl> public function getReset ( ) <nl> { <nl> public function getReset ( ) <nl> } <nl> <nl> / * * <nl> - * < pre > <nl> * if true , the stats will be reset after taking their snapshot . <nl> - * < / pre > <nl> * <nl> - * < code > bool reset = 1 ; < / code > <nl> + * Generated from protobuf field < code > bool reset = 1 ; < / code > <nl> + * @ param bool $ var <nl> + * @ return $ this <nl> * / <nl> public function setReset ( $ var ) <nl> { <nl> GPBUtil : : checkBool ( $ var ) ; <nl> $ this - > reset = $ var ; <nl> + <nl> + return $ this ; <nl> } <nl> <nl> } <nl> mmm a / src / php / tests / qps / generated_code / Grpc / Testing / Payload . php <nl> ppp b / src / php / tests / qps / generated_code / Grpc / Testing / Payload . php <nl> <nl> use Google \ Protobuf \ Internal \ GPBUtil ; <nl> <nl> / * * <nl> - * < pre > <nl> * A block of data , to simply increase gRPC message size . <nl> - * < / pre > <nl> * <nl> - * Protobuf type < code > grpc . testing . Payload < / code > <nl> + * Generated from protobuf message < code > grpc . testing . Payload < / code > <nl> * / <nl> class Payload extends \ Google \ Protobuf \ Internal \ Message <nl> { <nl> / * * <nl> - * < pre > <nl> * DEPRECATED , don ' t use . To be removed shortly . <nl> * The type of data in body . <nl> - * < / pre > <nl> * <nl> - * < code > . grpc . testing . PayloadType type = 1 ; < / code > <nl> + * Generated from protobuf field < code > . grpc . testing . PayloadType type = 1 ; < / code > <nl> * / <nl> private $ type = 0 ; <nl> / * * <nl> - * < pre > <nl> * Primary contents of payload . <nl> - * < / pre > <nl> * <nl> - * < code > bytes body = 2 ; < / code > <nl> + * Generated from protobuf field < code > bytes body = 2 ; < / code > <nl> * / <nl> private $ body = ' ' ; <nl> <nl> public function __construct ( ) { <nl> } <nl> <nl> / * * <nl> - * < pre > <nl> * DEPRECATED , don ' t use . To be removed shortly . <nl> * The type of data in body . <nl> - * < / pre > <nl> * <nl> - * < code > . grpc . testing . PayloadType type = 1 ; < / code > <nl> + * Generated from protobuf field < code > . grpc . testing . PayloadType type = 1 ; < / code > <nl> + * @ return int <nl> * / <nl> public function getType ( ) <nl> { <nl> public function getType ( ) <nl> } <nl> <nl> / * * <nl> - * < pre > <nl> * DEPRECATED , don ' t use . To be removed shortly . <nl> * The type of data in body . <nl> - * < / pre > <nl> * <nl> - * < code > . grpc . testing . PayloadType type = 1 ; < / code > <nl> + * Generated from protobuf field < code > . grpc . testing . PayloadType type = 1 ; < / code > <nl> + * @ param int $ var <nl> + * @ return $ this <nl> * / <nl> public function setType ( $ var ) <nl> { <nl> GPBUtil : : checkEnum ( $ var , \ Grpc \ Testing \ PayloadType : : class ) ; <nl> $ this - > type = $ var ; <nl> + <nl> + return $ this ; <nl> } <nl> <nl> / * * <nl> - * < pre > <nl> * Primary contents of payload . <nl> - * < / pre > <nl> * <nl> - * < code > bytes body = 2 ; < / code > <nl> + * Generated from protobuf field < code > bytes body = 2 ; < / code > <nl> + * @ return string <nl> * / <nl> public function getBody ( ) <nl> { <nl> public function getBody ( ) <nl> } <nl> <nl> / * * <nl> - * < pre > <nl> * Primary contents of payload . <nl> - * < / pre > <nl> * <nl> - * < code > bytes body = 2 ; < / code > <nl> + * Generated from protobuf field < code > bytes body = 2 ; < / code > <nl> + * @ param string $ var <nl> + * @ return $ this <nl> * / <nl> public function setBody ( $ var ) <nl> { <nl> GPBUtil : : checkString ( $ var , False ) ; <nl> $ this - > body = $ var ; <nl> + <nl> + return $ this ; <nl> } <nl> <nl> } <nl> mmm a / src / php / tests / qps / generated_code / Grpc / Testing / PayloadConfig . php <nl> ppp b / src / php / tests / qps / generated_code / Grpc / Testing / PayloadConfig . php <nl> <nl> use Google \ Protobuf \ Internal \ GPBUtil ; <nl> <nl> / * * <nl> - * Protobuf type < code > grpc . testing . PayloadConfig < / code > <nl> + * Generated from protobuf message < code > grpc . testing . PayloadConfig < / code > <nl> * / <nl> class PayloadConfig extends \ Google \ Protobuf \ Internal \ Message <nl> { <nl> public function __construct ( ) { <nl> } <nl> <nl> / * * <nl> - * < code > . grpc . testing . ByteBufferParams bytebuf_params = 1 ; < / code > <nl> + * Generated from protobuf field < code > . grpc . testing . ByteBufferParams bytebuf_params = 1 ; < / code > <nl> + * @ return \ Grpc \ Testing \ ByteBufferParams <nl> * / <nl> public function getBytebufParams ( ) <nl> { <nl> public function getBytebufParams ( ) <nl> } <nl> <nl> / * * <nl> - * < code > . grpc . testing . ByteBufferParams bytebuf_params = 1 ; < / code > <nl> + * Generated from protobuf field < code > . grpc . testing . ByteBufferParams bytebuf_params = 1 ; < / code > <nl> + * @ param \ Grpc \ Testing \ ByteBufferParams $ var <nl> + * @ return $ this <nl> * / <nl> - public function setBytebufParams ( & $ var ) <nl> + public function setBytebufParams ( $ var ) <nl> { <nl> GPBUtil : : checkMessage ( $ var , \ Grpc \ Testing \ ByteBufferParams : : class ) ; <nl> $ this - > writeOneof ( 1 , $ var ) ; <nl> + <nl> + return $ this ; <nl> } <nl> <nl> / * * <nl> - * < code > . grpc . testing . SimpleProtoParams simple_params = 2 ; < / code > <nl> + * Generated from protobuf field < code > . grpc . testing . SimpleProtoParams simple_params = 2 ; < / code > <nl> + * @ return \ Grpc \ Testing \ SimpleProtoParams <nl> * / <nl> public function getSimpleParams ( ) <nl> { <nl> public function getSimpleParams ( ) <nl> } <nl> <nl> / * * <nl> - * < code > . grpc . testing . SimpleProtoParams simple_params = 2 ; < / code > <nl> + * Generated from protobuf field < code > . grpc . testing . SimpleProtoParams simple_params = 2 ; < / code > <nl> + * @ param \ Grpc \ Testing \ SimpleProtoParams $ var <nl> + * @ return $ this <nl> * / <nl> - public function setSimpleParams ( & $ var ) <nl> + public function setSimpleParams ( $ var ) <nl> { <nl> GPBUtil : : checkMessage ( $ var , \ Grpc \ Testing \ SimpleProtoParams : : class ) ; <nl> $ this - > writeOneof ( 2 , $ var ) ; <nl> + <nl> + return $ this ; <nl> } <nl> <nl> / * * <nl> - * < code > . grpc . testing . ComplexProtoParams complex_params = 3 ; < / code > <nl> + * Generated from protobuf field < code > . grpc . testing . ComplexProtoParams complex_params = 3 ; < / code > <nl> + * @ return \ Grpc \ Testing \ ComplexProtoParams <nl> * / <nl> public function getComplexParams ( ) <nl> { <nl> public function getComplexParams ( ) <nl> } <nl> <nl> / * * <nl> - * < code > . grpc . testing . ComplexProtoParams complex_params = 3 ; < / code > <nl> + * Generated from protobuf field < code > . grpc . testing . ComplexProtoParams complex_params = 3 ; < / code > <nl> + * @ param \ Grpc \ Testing \ ComplexProtoParams $ var <nl> + * @ return $ this <nl> * / <nl> - public function setComplexParams ( & $ var ) <nl> + public function setComplexParams ( $ var ) <nl> { <nl> GPBUtil : : checkMessage ( $ var , \ Grpc \ Testing \ ComplexProtoParams : : class ) ; <nl> $ this - > writeOneof ( 3 , $ var ) ; <nl> + <nl> + return $ this ; <nl> } <nl> <nl> + / * * <nl> + * @ return string <nl> + * / <nl> public function getPayload ( ) <nl> { <nl> return $ this - > whichOneof ( " payload " ) ; <nl> mmm a / src / php / tests / qps / generated_code / Grpc / Testing / PayloadType . php <nl> ppp b / src / php / tests / qps / generated_code / Grpc / Testing / PayloadType . php <nl> <nl> namespace Grpc \ Testing ; <nl> <nl> / * * <nl> - * < pre > <nl> * DEPRECATED , don ' t use . To be removed shortly . <nl> * The type of payload that should be returned . <nl> - * < / pre > <nl> * <nl> - * Protobuf enum < code > grpc . testing . PayloadType < / code > <nl> + * Protobuf enum < code > Grpc \ Testing \ PayloadType < / code > <nl> * / <nl> class PayloadType <nl> { <nl> / * * <nl> - * < pre > <nl> * Compressable text format . <nl> - * < / pre > <nl> * <nl> - * < code > COMPRESSABLE = 0 ; < / code > <nl> + * Generated from protobuf enum < code > COMPRESSABLE = 0 ; < / code > <nl> * / <nl> const COMPRESSABLE = 0 ; <nl> } <nl> mmm a / src / php / tests / qps / generated_code / Grpc / Testing / PoissonParams . php <nl> ppp b / src / php / tests / qps / generated_code / Grpc / Testing / PoissonParams . php <nl> <nl> use Google \ Protobuf \ Internal \ GPBUtil ; <nl> <nl> / * * <nl> - * < pre > <nl> * Parameters of poisson process distribution , which is a good representation <nl> * of activity coming in from independent identical stationary sources . <nl> - * < / pre > <nl> * <nl> - * Protobuf type < code > grpc . testing . PoissonParams < / code > <nl> + * Generated from protobuf message < code > grpc . testing . PoissonParams < / code > <nl> * / <nl> class PoissonParams extends \ Google \ Protobuf \ Internal \ Message <nl> { <nl> / * * <nl> - * < pre > <nl> * The rate of arrivals ( a . k . a . lambda parameter of the exp distribution ) . <nl> - * < / pre > <nl> * <nl> - * < code > double offered_load = 1 ; < / code > <nl> + * Generated from protobuf field < code > double offered_load = 1 ; < / code > <nl> * / <nl> private $ offered_load = 0 . 0 ; <nl> <nl> public function __construct ( ) { <nl> } <nl> <nl> / * * <nl> - * < pre > <nl> * The rate of arrivals ( a . k . a . lambda parameter of the exp distribution ) . <nl> - * < / pre > <nl> * <nl> - * < code > double offered_load = 1 ; < / code > <nl> + * Generated from protobuf field < code > double offered_load = 1 ; < / code > <nl> + * @ return float <nl> * / <nl> public function getOfferedLoad ( ) <nl> { <nl> public function getOfferedLoad ( ) <nl> } <nl> <nl> / * * <nl> - * < pre > <nl> * The rate of arrivals ( a . k . a . lambda parameter of the exp distribution ) . <nl> - * < / pre > <nl> * <nl> - * < code > double offered_load = 1 ; < / code > <nl> + * Generated from protobuf field < code > double offered_load = 1 ; < / code > <nl> + * @ param float $ var <nl> + * @ return $ this <nl> * / <nl> public function setOfferedLoad ( $ var ) <nl> { <nl> GPBUtil : : checkDouble ( $ var ) ; <nl> $ this - > offered_load = $ var ; <nl> + <nl> + return $ this ; <nl> } <nl> <nl> } <nl> mmm a / src / php / tests / qps / generated_code / Grpc / Testing / ProxyClientServiceClient . php <nl> ppp b / src / php / tests / qps / generated_code / Grpc / Testing / ProxyClientServiceClient . php <nl> <nl> / / See the License for the specific language governing permissions and <nl> / / limitations under the License . <nl> / / <nl> - namespace Grpc \ Testing { <nl> + namespace Grpc \ Testing ; <nl> <nl> - class ProxyClientServiceClient extends \ Grpc \ BaseStub { <nl> + / * * <nl> + * / <nl> + class ProxyClientServiceClient extends \ Grpc \ BaseStub { <nl> <nl> / * * <nl> * @ param string $ hostname hostname <nl> * @ param array $ opts channel options <nl> - * @ param Grpc \ Channel $ channel ( optional ) re - use channel object <nl> + * @ param \ Grpc \ Channel $ channel ( optional ) re - use channel object <nl> * / <nl> public function __construct ( $ hostname , $ opts , $ channel = null ) { <nl> - parent : : __construct ( $ hostname , $ opts , $ channel ) ; <nl> + parent : : __construct ( $ hostname , $ opts , $ channel ) ; <nl> } <nl> <nl> / * * <nl> public function __construct ( $ hostname , $ opts , $ channel = null ) { <nl> * / <nl> public function GetConfig ( \ Grpc \ Testing \ Void $ argument , <nl> $ metadata = [ ] , $ options = [ ] ) { <nl> - return $ this - > _simpleRequest ( ' / grpc . testing . ProxyClientService / GetConfig ' , <nl> - $ argument , <nl> - [ ' \ Grpc \ Testing \ ClientConfig ' , ' decode ' ] , <nl> - $ metadata , $ options ) ; <nl> + return $ this - > _simpleRequest ( ' / grpc . testing . ProxyClientService / GetConfig ' , <nl> + $ argument , <nl> + [ ' \ Grpc \ Testing \ ClientConfig ' , ' decode ' ] , <nl> + $ metadata , $ options ) ; <nl> } <nl> <nl> / * * <nl> public function GetConfig ( \ Grpc \ Testing \ Void $ argument , <nl> * @ param array $ options call options <nl> * / <nl> public function ReportTime ( $ metadata = [ ] , $ options = [ ] ) { <nl> - return $ this - > _clientStreamRequest ( ' / grpc . testing . ProxyClientService / ReportTime ' , <nl> - [ ' \ Grpc \ Testing \ Void ' , ' decode ' ] , <nl> - $ metadata , $ options ) ; <nl> + return $ this - > _clientStreamRequest ( ' / grpc . testing . ProxyClientService / ReportTime ' , <nl> + [ ' \ Grpc \ Testing \ Void ' , ' decode ' ] , <nl> + $ metadata , $ options ) ; <nl> } <nl> <nl> - } <nl> + / * * <nl> + * @ param array $ metadata metadata <nl> + * @ param array $ options call options <nl> + * / <nl> + public function ReportHist ( $ metadata = [ ] , $ options = [ ] ) { <nl> + return $ this - > _clientStreamRequest ( ' / grpc . testing . ProxyClientService / ReportHist ' , <nl> + [ ' \ Grpc \ Testing \ Void ' , ' decode ' ] , <nl> + $ metadata , $ options ) ; <nl> + } <nl> <nl> } <nl> mmm a / src / php / tests / qps / generated_code / Grpc / Testing / ProxyStat . php <nl> ppp b / src / php / tests / qps / generated_code / Grpc / Testing / ProxyStat . php <nl> <nl> use Google \ Protobuf \ Internal \ GPBUtil ; <nl> <nl> / * * <nl> - * Protobuf type < code > grpc . testing . ProxyStat < / code > <nl> + * Generated from protobuf message < code > grpc . testing . ProxyStat < / code > <nl> * / <nl> class ProxyStat extends \ Google \ Protobuf \ Internal \ Message <nl> { <nl> / * * <nl> - * < code > double latency = 1 ; < / code > <nl> + * Generated from protobuf field < code > double latency = 1 ; < / code > <nl> * / <nl> private $ latency = 0 . 0 ; <nl> <nl> public function __construct ( ) { <nl> } <nl> <nl> / * * <nl> - * < code > double latency = 1 ; < / code > <nl> + * Generated from protobuf field < code > double latency = 1 ; < / code > <nl> + * @ return float <nl> * / <nl> public function getLatency ( ) <nl> { <nl> public function getLatency ( ) <nl> } <nl> <nl> / * * <nl> - * < code > double latency = 1 ; < / code > <nl> + * Generated from protobuf field < code > double latency = 1 ; < / code > <nl> + * @ param float $ var <nl> + * @ return $ this <nl> * / <nl> public function setLatency ( $ var ) <nl> { <nl> GPBUtil : : checkDouble ( $ var ) ; <nl> $ this - > latency = $ var ; <nl> + <nl> + return $ this ; <nl> } <nl> <nl> } <nl> mmm a / src / php / tests / qps / generated_code / Grpc / Testing / ReconnectInfo . php <nl> ppp b / src / php / tests / qps / generated_code / Grpc / Testing / ReconnectInfo . php <nl> <nl> use Google \ Protobuf \ Internal \ GPBUtil ; <nl> <nl> / * * <nl> - * < pre > <nl> * For reconnect interop test only . <nl> * Server tells client whether its reconnects are following the spec and the <nl> * reconnect backoffs it saw . <nl> - * < / pre > <nl> * <nl> - * Protobuf type < code > grpc . testing . ReconnectInfo < / code > <nl> + * Generated from protobuf message < code > grpc . testing . ReconnectInfo < / code > <nl> * / <nl> class ReconnectInfo extends \ Google \ Protobuf \ Internal \ Message <nl> { <nl> / * * <nl> - * < code > bool passed = 1 ; < / code > <nl> + * Generated from protobuf field < code > bool passed = 1 ; < / code > <nl> * / <nl> private $ passed = false ; <nl> / * * <nl> - * < code > repeated int32 backoff_ms = 2 ; < / code > <nl> + * Generated from protobuf field < code > repeated int32 backoff_ms = 2 ; < / code > <nl> * / <nl> private $ backoff_ms ; <nl> <nl> public function __construct ( ) { <nl> } <nl> <nl> / * * <nl> - * < code > bool passed = 1 ; < / code > <nl> + * Generated from protobuf field < code > bool passed = 1 ; < / code > <nl> + * @ return bool <nl> * / <nl> public function getPassed ( ) <nl> { <nl> public function getPassed ( ) <nl> } <nl> <nl> / * * <nl> - * < code > bool passed = 1 ; < / code > <nl> + * Generated from protobuf field < code > bool passed = 1 ; < / code > <nl> + * @ param bool $ var <nl> + * @ return $ this <nl> * / <nl> public function setPassed ( $ var ) <nl> { <nl> GPBUtil : : checkBool ( $ var ) ; <nl> $ this - > passed = $ var ; <nl> + <nl> + return $ this ; <nl> } <nl> <nl> / * * <nl> - * < code > repeated int32 backoff_ms = 2 ; < / code > <nl> + * Generated from protobuf field < code > repeated int32 backoff_ms = 2 ; < / code > <nl> + * @ return \ Google \ Protobuf \ Internal \ RepeatedField <nl> * / <nl> public function getBackoffMs ( ) <nl> { <nl> public function getBackoffMs ( ) <nl> } <nl> <nl> / * * <nl> - * < code > repeated int32 backoff_ms = 2 ; < / code > <nl> + * Generated from protobuf field < code > repeated int32 backoff_ms = 2 ; < / code > <nl> + * @ param int [ ] | \ Google \ Protobuf \ Internal \ RepeatedField $ var <nl> + * @ return $ this <nl> * / <nl> - public function setBackoffMs ( & $ var ) <nl> + public function setBackoffMs ( $ var ) <nl> { <nl> - GPBUtil : : checkRepeatedField ( $ var , \ Google \ Protobuf \ Internal \ GPBType : : INT32 ) ; <nl> - $ this - > backoff_ms = $ var ; <nl> + $ arr = GPBUtil : : checkRepeatedField ( $ var , \ Google \ Protobuf \ Internal \ GPBType : : INT32 ) ; <nl> + $ this - > backoff_ms = $ arr ; <nl> + <nl> + return $ this ; <nl> } <nl> <nl> } <nl> mmm a / src / php / tests / qps / generated_code / Grpc / Testing / ReconnectParams . php <nl> ppp b / src / php / tests / qps / generated_code / Grpc / Testing / ReconnectParams . php <nl> <nl> use Google \ Protobuf \ Internal \ GPBUtil ; <nl> <nl> / * * <nl> - * < pre > <nl> * For reconnect interop test only . <nl> * Client tells server what reconnection parameters it used . <nl> - * < / pre > <nl> * <nl> - * Protobuf type < code > grpc . testing . ReconnectParams < / code > <nl> + * Generated from protobuf message < code > grpc . testing . ReconnectParams < / code > <nl> * / <nl> class ReconnectParams extends \ Google \ Protobuf \ Internal \ Message <nl> { <nl> / * * <nl> - * < code > int32 max_reconnect_backoff_ms = 1 ; < / code > <nl> + * Generated from protobuf field < code > int32 max_reconnect_backoff_ms = 1 ; < / code > <nl> * / <nl> private $ max_reconnect_backoff_ms = 0 ; <nl> <nl> public function __construct ( ) { <nl> } <nl> <nl> / * * <nl> - * < code > int32 max_reconnect_backoff_ms = 1 ; < / code > <nl> + * Generated from protobuf field < code > int32 max_reconnect_backoff_ms = 1 ; < / code > <nl> + * @ return int <nl> * / <nl> public function getMaxReconnectBackoffMs ( ) <nl> { <nl> public function getMaxReconnectBackoffMs ( ) <nl> } <nl> <nl> / * * <nl> - * < code > int32 max_reconnect_backoff_ms = 1 ; < / code > <nl> + * Generated from protobuf field < code > int32 max_reconnect_backoff_ms = 1 ; < / code > <nl> + * @ param int $ var <nl> + * @ return $ this <nl> * / <nl> public function setMaxReconnectBackoffMs ( $ var ) <nl> { <nl> GPBUtil : : checkInt32 ( $ var ) ; <nl> $ this - > max_reconnect_backoff_ms = $ var ; <nl> + <nl> + return $ this ; <nl> } <nl> <nl> } <nl> new file mode 100644 <nl> index 00000000000 . . 72d44ffc667 <nl> mmm / dev / null <nl> ppp b / src / php / tests / qps / generated_code / Grpc / Testing / ReportQpsScenarioServiceClient . php <nl> <nl> + < ? php <nl> + / / GENERATED CODE - - DO NOT EDIT ! <nl> + <nl> + / / Original file comments : <nl> + / / Copyright 2015 gRPC authors . <nl> + / / <nl> + / / Licensed under the Apache License , Version 2 . 0 ( the " License " ) ; <nl> + / / you may not use this file except in compliance with the License . <nl> + / / You may obtain a copy of the License at <nl> + / / <nl> + / / http : / / www . apache . org / licenses / LICENSE - 2 . 0 <nl> + / / <nl> + / / Unless required by applicable law or agreed to in writing , software <nl> + / / distributed under the License is distributed on an " AS IS " BASIS , <nl> + / / WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND , either express or implied . <nl> + / / See the License for the specific language governing permissions and <nl> + / / limitations under the License . <nl> + / / <nl> + / / An integration test service that covers all the method signature permutations <nl> + / / of unary / streaming requests / responses . <nl> + namespace Grpc \ Testing ; <nl> + <nl> + / * * <nl> + * / <nl> + class ReportQpsScenarioServiceClient extends \ Grpc \ BaseStub { <nl> + <nl> + / * * <nl> + * @ param string $ hostname hostname <nl> + * @ param array $ opts channel options <nl> + * @ param \ Grpc \ Channel $ channel ( optional ) re - use channel object <nl> + * / <nl> + public function __construct ( $ hostname , $ opts , $ channel = null ) { <nl> + parent : : __construct ( $ hostname , $ opts , $ channel ) ; <nl> + } <nl> + <nl> + / * * <nl> + * Report results of a QPS test benchmark scenario . <nl> + * @ param \ Grpc \ Testing \ ScenarioResult $ argument input argument <nl> + * @ param array $ metadata metadata <nl> + * @ param array $ options call options <nl> + * / <nl> + public function ReportScenario ( \ Grpc \ Testing \ ScenarioResult $ argument , <nl> + $ metadata = [ ] , $ options = [ ] ) { <nl> + return $ this - > _simpleRequest ( ' / grpc . testing . ReportQpsScenarioService / ReportScenario ' , <nl> + $ argument , <nl> + [ ' \ Grpc \ Testing \ Void ' , ' decode ' ] , <nl> + $ metadata , $ options ) ; <nl> + } <nl> + <nl> + } <nl> mmm a / src / php / tests / qps / generated_code / Grpc / Testing / RequestResultCount . php <nl> ppp b / src / php / tests / qps / generated_code / Grpc / Testing / RequestResultCount . php <nl> <nl> use Google \ Protobuf \ Internal \ GPBUtil ; <nl> <nl> / * * <nl> - * Protobuf type < code > grpc . testing . RequestResultCount < / code > <nl> + * Generated from protobuf message < code > grpc . testing . RequestResultCount < / code > <nl> * / <nl> class RequestResultCount extends \ Google \ Protobuf \ Internal \ Message <nl> { <nl> / * * <nl> - * < code > int32 status_code = 1 ; < / code > <nl> + * Generated from protobuf field < code > int32 status_code = 1 ; < / code > <nl> * / <nl> private $ status_code = 0 ; <nl> / * * <nl> - * < code > int64 count = 2 ; < / code > <nl> + * Generated from protobuf field < code > int64 count = 2 ; < / code > <nl> * / <nl> private $ count = 0 ; <nl> <nl> public function __construct ( ) { <nl> } <nl> <nl> / * * <nl> - * < code > int32 status_code = 1 ; < / code > <nl> + * Generated from protobuf field < code > int32 status_code = 1 ; < / code > <nl> + * @ return int <nl> * / <nl> public function getStatusCode ( ) <nl> { <nl> public function getStatusCode ( ) <nl> } <nl> <nl> / * * <nl> - * < code > int32 status_code = 1 ; < / code > <nl> + * Generated from protobuf field < code > int32 status_code = 1 ; < / code > <nl> + * @ param int $ var <nl> + * @ return $ this <nl> * / <nl> public function setStatusCode ( $ var ) <nl> { <nl> GPBUtil : : checkInt32 ( $ var ) ; <nl> $ this - > status_code = $ var ; <nl> + <nl> + return $ this ; <nl> } <nl> <nl> / * * <nl> - * < code > int64 count = 2 ; < / code > <nl> + * Generated from protobuf field < code > int64 count = 2 ; < / code > <nl> + * @ return int | string <nl> * / <nl> public function getCount ( ) <nl> { <nl> public function getCount ( ) <nl> } <nl> <nl> / * * <nl> - * < code > int64 count = 2 ; < / code > <nl> + * Generated from protobuf field < code > int64 count = 2 ; < / code > <nl> + * @ param int | string $ var <nl> + * @ return $ this <nl> * / <nl> public function setCount ( $ var ) <nl> { <nl> GPBUtil : : checkInt64 ( $ var ) ; <nl> $ this - > count = $ var ; <nl> + <nl> + return $ this ; <nl> } <nl> <nl> } <nl> mmm a / src / php / tests / qps / generated_code / Grpc / Testing / ResponseParameters . php <nl> ppp b / src / php / tests / qps / generated_code / Grpc / Testing / ResponseParameters . php <nl> <nl> use Google \ Protobuf \ Internal \ GPBUtil ; <nl> <nl> / * * <nl> - * < pre > <nl> * Configuration for a particular response . <nl> - * < / pre > <nl> * <nl> - * Protobuf type < code > grpc . testing . ResponseParameters < / code > <nl> + * Generated from protobuf message < code > grpc . testing . ResponseParameters < / code > <nl> * / <nl> class ResponseParameters extends \ Google \ Protobuf \ Internal \ Message <nl> { <nl> / * * <nl> - * < pre > <nl> * Desired payload sizes in responses from the server . <nl> - * < / pre > <nl> * <nl> - * < code > int32 size = 1 ; < / code > <nl> + * Generated from protobuf field < code > int32 size = 1 ; < / code > <nl> * / <nl> private $ size = 0 ; <nl> / * * <nl> - * < pre > <nl> * Desired interval between consecutive responses in the response stream in <nl> * microseconds . <nl> - * < / pre > <nl> * <nl> - * < code > int32 interval_us = 2 ; < / code > <nl> + * Generated from protobuf field < code > int32 interval_us = 2 ; < / code > <nl> * / <nl> private $ interval_us = 0 ; <nl> / * * <nl> - * < pre > <nl> * Whether to request the server to compress the response . This field is <nl> * " nullable " in order to interoperate seamlessly with clients not able to <nl> * implement the full compression tests by introspecting the call to verify <nl> * the response ' s compression status . <nl> - * < / pre > <nl> * <nl> - * < code > . grpc . testing . BoolValue compressed = 3 ; < / code > <nl> + * Generated from protobuf field < code > . grpc . testing . BoolValue compressed = 3 ; < / code > <nl> * / <nl> private $ compressed = null ; <nl> <nl> public function __construct ( ) { <nl> } <nl> <nl> / * * <nl> - * < pre > <nl> * Desired payload sizes in responses from the server . <nl> - * < / pre > <nl> * <nl> - * < code > int32 size = 1 ; < / code > <nl> + * Generated from protobuf field < code > int32 size = 1 ; < / code > <nl> + * @ return int <nl> * / <nl> public function getSize ( ) <nl> { <nl> public function getSize ( ) <nl> } <nl> <nl> / * * <nl> - * < pre > <nl> * Desired payload sizes in responses from the server . <nl> - * < / pre > <nl> * <nl> - * < code > int32 size = 1 ; < / code > <nl> + * Generated from protobuf field < code > int32 size = 1 ; < / code > <nl> + * @ param int $ var <nl> + * @ return $ this <nl> * / <nl> public function setSize ( $ var ) <nl> { <nl> GPBUtil : : checkInt32 ( $ var ) ; <nl> $ this - > size = $ var ; <nl> + <nl> + return $ this ; <nl> } <nl> <nl> / * * <nl> - * < pre > <nl> * Desired interval between consecutive responses in the response stream in <nl> * microseconds . <nl> - * < / pre > <nl> * <nl> - * < code > int32 interval_us = 2 ; < / code > <nl> + * Generated from protobuf field < code > int32 interval_us = 2 ; < / code > <nl> + * @ return int <nl> * / <nl> public function getIntervalUs ( ) <nl> { <nl> public function getIntervalUs ( ) <nl> } <nl> <nl> / * * <nl> - * < pre > <nl> * Desired interval between consecutive responses in the response stream in <nl> * microseconds . <nl> - * < / pre > <nl> * <nl> - * < code > int32 interval_us = 2 ; < / code > <nl> + * Generated from protobuf field < code > int32 interval_us = 2 ; < / code > <nl> + * @ param int $ var <nl> + * @ return $ this <nl> * / <nl> public function setIntervalUs ( $ var ) <nl> { <nl> GPBUtil : : checkInt32 ( $ var ) ; <nl> $ this - > interval_us = $ var ; <nl> + <nl> + return $ this ; <nl> } <nl> <nl> / * * <nl> - * < pre > <nl> * Whether to request the server to compress the response . This field is <nl> * " nullable " in order to interoperate seamlessly with clients not able to <nl> * implement the full compression tests by introspecting the call to verify <nl> * the response ' s compression status . <nl> - * < / pre > <nl> * <nl> - * < code > . grpc . testing . BoolValue compressed = 3 ; < / code > <nl> + * Generated from protobuf field < code > . grpc . testing . BoolValue compressed = 3 ; < / code > <nl> + * @ return \ Grpc \ Testing \ BoolValue <nl> * / <nl> public function getCompressed ( ) <nl> { <nl> public function getCompressed ( ) <nl> } <nl> <nl> / * * <nl> - * < pre > <nl> * Whether to request the server to compress the response . This field is <nl> * " nullable " in order to interoperate seamlessly with clients not able to <nl> * implement the full compression tests by introspecting the call to verify <nl> * the response ' s compression status . <nl> - * < / pre > <nl> * <nl> - * < code > . grpc . testing . BoolValue compressed = 3 ; < / code > <nl> + * Generated from protobuf field < code > . grpc . testing . BoolValue compressed = 3 ; < / code > <nl> + * @ param \ Grpc \ Testing \ BoolValue $ var <nl> + * @ return $ this <nl> * / <nl> - public function setCompressed ( & $ var ) <nl> + public function setCompressed ( $ var ) <nl> { <nl> GPBUtil : : checkMessage ( $ var , \ Grpc \ Testing \ BoolValue : : class ) ; <nl> $ this - > compressed = $ var ; <nl> + <nl> + return $ this ; <nl> } <nl> <nl> } <nl> mmm a / src / php / tests / qps / generated_code / Grpc / Testing / RpcType . php <nl> ppp b / src / php / tests / qps / generated_code / Grpc / Testing / RpcType . php <nl> <nl> namespace Grpc \ Testing ; <nl> <nl> / * * <nl> - * Protobuf enum < code > grpc . testing . RpcType < / code > <nl> + * Protobuf enum < code > Grpc \ Testing \ RpcType < / code > <nl> * / <nl> class RpcType <nl> { <nl> / * * <nl> - * < code > UNARY = 0 ; < / code > <nl> + * Generated from protobuf enum < code > UNARY = 0 ; < / code > <nl> * / <nl> const UNARY = 0 ; <nl> / * * <nl> - * < code > STREAMING = 1 ; < / code > <nl> + * Generated from protobuf enum < code > STREAMING = 1 ; < / code > <nl> * / <nl> const STREAMING = 1 ; <nl> + / * * <nl> + * Generated from protobuf enum < code > STREAMING_FROM_CLIENT = 2 ; < / code > <nl> + * / <nl> + const STREAMING_FROM_CLIENT = 2 ; <nl> + / * * <nl> + * Generated from protobuf enum < code > STREAMING_FROM_SERVER = 3 ; < / code > <nl> + * / <nl> + const STREAMING_FROM_SERVER = 3 ; <nl> + / * * <nl> + * Generated from protobuf enum < code > STREAMING_BOTH_WAYS = 4 ; < / code > <nl> + * / <nl> + const STREAMING_BOTH_WAYS = 4 ; <nl> } <nl> <nl> mmm a / src / php / tests / qps / generated_code / Grpc / Testing / Scenario . php <nl> ppp b / src / php / tests / qps / generated_code / Grpc / Testing / Scenario . php <nl> <nl> use Google \ Protobuf \ Internal \ GPBUtil ; <nl> <nl> / * * <nl> - * < pre > <nl> * A single performance scenario : input to qps_json_driver <nl> - * < / pre > <nl> * <nl> - * Protobuf type < code > grpc . testing . Scenario < / code > <nl> + * Generated from protobuf message < code > grpc . testing . Scenario < / code > <nl> * / <nl> class Scenario extends \ Google \ Protobuf \ Internal \ Message <nl> { <nl> / * * <nl> - * < pre > <nl> * Human readable name for this scenario <nl> - * < / pre > <nl> * <nl> - * < code > string name = 1 ; < / code > <nl> + * Generated from protobuf field < code > string name = 1 ; < / code > <nl> * / <nl> private $ name = ' ' ; <nl> / * * <nl> - * < pre > <nl> * Client configuration <nl> - * < / pre > <nl> * <nl> - * < code > . grpc . testing . ClientConfig client_config = 2 ; < / code > <nl> + * Generated from protobuf field < code > . grpc . testing . ClientConfig client_config = 2 ; < / code > <nl> * / <nl> private $ client_config = null ; <nl> / * * <nl> - * < pre > <nl> * Number of clients to start for the test <nl> - * < / pre > <nl> * <nl> - * < code > int32 num_clients = 3 ; < / code > <nl> + * Generated from protobuf field < code > int32 num_clients = 3 ; < / code > <nl> * / <nl> private $ num_clients = 0 ; <nl> / * * <nl> - * < pre > <nl> * Server configuration <nl> - * < / pre > <nl> * <nl> - * < code > . grpc . testing . ServerConfig server_config = 4 ; < / code > <nl> + * Generated from protobuf field < code > . grpc . testing . ServerConfig server_config = 4 ; < / code > <nl> * / <nl> private $ server_config = null ; <nl> / * * <nl> - * < pre > <nl> * Number of servers to start for the test <nl> - * < / pre > <nl> * <nl> - * < code > int32 num_servers = 5 ; < / code > <nl> + * Generated from protobuf field < code > int32 num_servers = 5 ; < / code > <nl> * / <nl> private $ num_servers = 0 ; <nl> / * * <nl> - * < pre > <nl> * Warmup period , in seconds <nl> - * < / pre > <nl> * <nl> - * < code > int32 warmup_seconds = 6 ; < / code > <nl> + * Generated from protobuf field < code > int32 warmup_seconds = 6 ; < / code > <nl> * / <nl> private $ warmup_seconds = 0 ; <nl> / * * <nl> - * < pre > <nl> * Benchmark time , in seconds <nl> - * < / pre > <nl> * <nl> - * < code > int32 benchmark_seconds = 7 ; < / code > <nl> + * Generated from protobuf field < code > int32 benchmark_seconds = 7 ; < / code > <nl> * / <nl> private $ benchmark_seconds = 0 ; <nl> / * * <nl> - * < pre > <nl> * Number of workers to spawn locally ( usually zero ) <nl> - * < / pre > <nl> * <nl> - * < code > int32 spawn_local_worker_count = 8 ; < / code > <nl> + * Generated from protobuf field < code > int32 spawn_local_worker_count = 8 ; < / code > <nl> * / <nl> private $ spawn_local_worker_count = 0 ; <nl> <nl> public function __construct ( ) { <nl> } <nl> <nl> / * * <nl> - * < pre > <nl> * Human readable name for this scenario <nl> - * < / pre > <nl> * <nl> - * < code > string name = 1 ; < / code > <nl> + * Generated from protobuf field < code > string name = 1 ; < / code > <nl> + * @ return string <nl> * / <nl> public function getName ( ) <nl> { <nl> public function getName ( ) <nl> } <nl> <nl> / * * <nl> - * < pre > <nl> * Human readable name for this scenario <nl> - * < / pre > <nl> * <nl> - * < code > string name = 1 ; < / code > <nl> + * Generated from protobuf field < code > string name = 1 ; < / code > <nl> + * @ param string $ var <nl> + * @ return $ this <nl> * / <nl> public function setName ( $ var ) <nl> { <nl> GPBUtil : : checkString ( $ var , True ) ; <nl> $ this - > name = $ var ; <nl> + <nl> + return $ this ; <nl> } <nl> <nl> / * * <nl> - * < pre > <nl> * Client configuration <nl> - * < / pre > <nl> * <nl> - * < code > . grpc . testing . ClientConfig client_config = 2 ; < / code > <nl> + * Generated from protobuf field < code > . grpc . testing . ClientConfig client_config = 2 ; < / code > <nl> + * @ return \ Grpc \ Testing \ ClientConfig <nl> * / <nl> public function getClientConfig ( ) <nl> { <nl> public function getClientConfig ( ) <nl> } <nl> <nl> / * * <nl> - * < pre > <nl> * Client configuration <nl> - * < / pre > <nl> * <nl> - * < code > . grpc . testing . ClientConfig client_config = 2 ; < / code > <nl> + * Generated from protobuf field < code > . grpc . testing . ClientConfig client_config = 2 ; < / code > <nl> + * @ param \ Grpc \ Testing \ ClientConfig $ var <nl> + * @ return $ this <nl> * / <nl> - public function setClientConfig ( & $ var ) <nl> + public function setClientConfig ( $ var ) <nl> { <nl> GPBUtil : : checkMessage ( $ var , \ Grpc \ Testing \ ClientConfig : : class ) ; <nl> $ this - > client_config = $ var ; <nl> + <nl> + return $ this ; <nl> } <nl> <nl> / * * <nl> - * < pre > <nl> * Number of clients to start for the test <nl> - * < / pre > <nl> * <nl> - * < code > int32 num_clients = 3 ; < / code > <nl> + * Generated from protobuf field < code > int32 num_clients = 3 ; < / code > <nl> + * @ return int <nl> * / <nl> public function getNumClients ( ) <nl> { <nl> public function getNumClients ( ) <nl> } <nl> <nl> / * * <nl> - * < pre > <nl> * Number of clients to start for the test <nl> - * < / pre > <nl> * <nl> - * < code > int32 num_clients = 3 ; < / code > <nl> + * Generated from protobuf field < code > int32 num_clients = 3 ; < / code > <nl> + * @ param int $ var <nl> + * @ return $ this <nl> * / <nl> public function setNumClients ( $ var ) <nl> { <nl> GPBUtil : : checkInt32 ( $ var ) ; <nl> $ this - > num_clients = $ var ; <nl> + <nl> + return $ this ; <nl> } <nl> <nl> / * * <nl> - * < pre > <nl> * Server configuration <nl> - * < / pre > <nl> * <nl> - * < code > . grpc . testing . ServerConfig server_config = 4 ; < / code > <nl> + * Generated from protobuf field < code > . grpc . testing . ServerConfig server_config = 4 ; < / code > <nl> + * @ return \ Grpc \ Testing \ ServerConfig <nl> * / <nl> public function getServerConfig ( ) <nl> { <nl> public function getServerConfig ( ) <nl> } <nl> <nl> / * * <nl> - * < pre > <nl> * Server configuration <nl> - * < / pre > <nl> * <nl> - * < code > . grpc . testing . ServerConfig server_config = 4 ; < / code > <nl> + * Generated from protobuf field < code > . grpc . testing . ServerConfig server_config = 4 ; < / code > <nl> + * @ param \ Grpc \ Testing \ ServerConfig $ var <nl> + * @ return $ this <nl> * / <nl> - public function setServerConfig ( & $ var ) <nl> + public function setServerConfig ( $ var ) <nl> { <nl> GPBUtil : : checkMessage ( $ var , \ Grpc \ Testing \ ServerConfig : : class ) ; <nl> $ this - > server_config = $ var ; <nl> + <nl> + return $ this ; <nl> } <nl> <nl> / * * <nl> - * < pre > <nl> * Number of servers to start for the test <nl> - * < / pre > <nl> * <nl> - * < code > int32 num_servers = 5 ; < / code > <nl> + * Generated from protobuf field < code > int32 num_servers = 5 ; < / code > <nl> + * @ return int <nl> * / <nl> public function getNumServers ( ) <nl> { <nl> public function getNumServers ( ) <nl> } <nl> <nl> / * * <nl> - * < pre > <nl> * Number of servers to start for the test <nl> - * < / pre > <nl> * <nl> - * < code > int32 num_servers = 5 ; < / code > <nl> + * Generated from protobuf field < code > int32 num_servers = 5 ; < / code > <nl> + * @ param int $ var <nl> + * @ return $ this <nl> * / <nl> public function setNumServers ( $ var ) <nl> { <nl> GPBUtil : : checkInt32 ( $ var ) ; <nl> $ this - > num_servers = $ var ; <nl> + <nl> + return $ this ; <nl> } <nl> <nl> / * * <nl> - * < pre > <nl> * Warmup period , in seconds <nl> - * < / pre > <nl> * <nl> - * < code > int32 warmup_seconds = 6 ; < / code > <nl> + * Generated from protobuf field < code > int32 warmup_seconds = 6 ; < / code > <nl> + * @ return int <nl> * / <nl> public function getWarmupSeconds ( ) <nl> { <nl> public function getWarmupSeconds ( ) <nl> } <nl> <nl> / * * <nl> - * < pre > <nl> * Warmup period , in seconds <nl> - * < / pre > <nl> * <nl> - * < code > int32 warmup_seconds = 6 ; < / code > <nl> + * Generated from protobuf field < code > int32 warmup_seconds = 6 ; < / code > <nl> + * @ param int $ var <nl> + * @ return $ this <nl> * / <nl> public function setWarmupSeconds ( $ var ) <nl> { <nl> GPBUtil : : checkInt32 ( $ var ) ; <nl> $ this - > warmup_seconds = $ var ; <nl> + <nl> + return $ this ; <nl> } <nl> <nl> / * * <nl> - * < pre > <nl> * Benchmark time , in seconds <nl> - * < / pre > <nl> * <nl> - * < code > int32 benchmark_seconds = 7 ; < / code > <nl> + * Generated from protobuf field < code > int32 benchmark_seconds = 7 ; < / code > <nl> + * @ return int <nl> * / <nl> public function getBenchmarkSeconds ( ) <nl> { <nl> public function getBenchmarkSeconds ( ) <nl> } <nl> <nl> / * * <nl> - * < pre > <nl> * Benchmark time , in seconds <nl> - * < / pre > <nl> * <nl> - * < code > int32 benchmark_seconds = 7 ; < / code > <nl> + * Generated from protobuf field < code > int32 benchmark_seconds = 7 ; < / code > <nl> + * @ param int $ var <nl> + * @ return $ this <nl> * / <nl> public function setBenchmarkSeconds ( $ var ) <nl> { <nl> GPBUtil : : checkInt32 ( $ var ) ; <nl> $ this - > benchmark_seconds = $ var ; <nl> + <nl> + return $ this ; <nl> } <nl> <nl> / * * <nl> - * < pre > <nl> * Number of workers to spawn locally ( usually zero ) <nl> - * < / pre > <nl> * <nl> - * < code > int32 spawn_local_worker_count = 8 ; < / code > <nl> + * Generated from protobuf field < code > int32 spawn_local_worker_count = 8 ; < / code > <nl> + * @ return int <nl> * / <nl> public function getSpawnLocalWorkerCount ( ) <nl> { <nl> public function getSpawnLocalWorkerCount ( ) <nl> } <nl> <nl> / * * <nl> - * < pre > <nl> * Number of workers to spawn locally ( usually zero ) <nl> - * < / pre > <nl> * <nl> - * < code > int32 spawn_local_worker_count = 8 ; < / code > <nl> + * Generated from protobuf field < code > int32 spawn_local_worker_count = 8 ; < / code > <nl> + * @ param int $ var <nl> + * @ return $ this <nl> * / <nl> public function setSpawnLocalWorkerCount ( $ var ) <nl> { <nl> GPBUtil : : checkInt32 ( $ var ) ; <nl> $ this - > spawn_local_worker_count = $ var ; <nl> + <nl> + return $ this ; <nl> } <nl> <nl> } <nl> mmm a / src / php / tests / qps / generated_code / Grpc / Testing / ScenarioResult . php <nl> ppp b / src / php / tests / qps / generated_code / Grpc / Testing / ScenarioResult . php <nl> <nl> use Google \ Protobuf \ Internal \ GPBUtil ; <nl> <nl> / * * <nl> - * < pre > <nl> * Results of a single benchmark scenario . <nl> - * < / pre > <nl> * <nl> - * Protobuf type < code > grpc . testing . ScenarioResult < / code > <nl> + * Generated from protobuf message < code > grpc . testing . ScenarioResult < / code > <nl> * / <nl> class ScenarioResult extends \ Google \ Protobuf \ Internal \ Message <nl> { <nl> / * * <nl> - * < pre > <nl> * Inputs used to run the scenario . <nl> - * < / pre > <nl> * <nl> - * < code > . grpc . testing . Scenario scenario = 1 ; < / code > <nl> + * Generated from protobuf field < code > . grpc . testing . Scenario scenario = 1 ; < / code > <nl> * / <nl> private $ scenario = null ; <nl> / * * <nl> - * < pre > <nl> * Histograms from all clients merged into one histogram . <nl> - * < / pre > <nl> * <nl> - * < code > . grpc . testing . HistogramData latencies = 2 ; < / code > <nl> + * Generated from protobuf field < code > . grpc . testing . HistogramData latencies = 2 ; < / code > <nl> * / <nl> private $ latencies = null ; <nl> / * * <nl> - * < pre > <nl> * Client stats for each client <nl> - * < / pre > <nl> * <nl> - * < code > repeated . grpc . testing . ClientStats client_stats = 3 ; < / code > <nl> + * Generated from protobuf field < code > repeated . grpc . testing . ClientStats client_stats = 3 ; < / code > <nl> * / <nl> private $ client_stats ; <nl> / * * <nl> - * < pre > <nl> * Server stats for each server <nl> - * < / pre > <nl> * <nl> - * < code > repeated . grpc . testing . ServerStats server_stats = 4 ; < / code > <nl> + * Generated from protobuf field < code > repeated . grpc . testing . ServerStats server_stats = 4 ; < / code > <nl> * / <nl> private $ server_stats ; <nl> / * * <nl> - * < pre > <nl> * Number of cores available to each server <nl> - * < / pre > <nl> * <nl> - * < code > repeated int32 server_cores = 5 ; < / code > <nl> + * Generated from protobuf field < code > repeated int32 server_cores = 5 ; < / code > <nl> * / <nl> private $ server_cores ; <nl> / * * <nl> - * < pre > <nl> * An after - the - fact computed summary <nl> - * < / pre > <nl> * <nl> - * < code > . grpc . testing . ScenarioResultSummary summary = 6 ; < / code > <nl> + * Generated from protobuf field < code > . grpc . testing . ScenarioResultSummary summary = 6 ; < / code > <nl> * / <nl> private $ summary = null ; <nl> / * * <nl> - * < pre > <nl> * Information on success or failure of each worker <nl> - * < / pre > <nl> * <nl> - * < code > repeated bool client_success = 7 ; < / code > <nl> + * Generated from protobuf field < code > repeated bool client_success = 7 ; < / code > <nl> * / <nl> private $ client_success ; <nl> / * * <nl> - * < code > repeated bool server_success = 8 ; < / code > <nl> + * Generated from protobuf field < code > repeated bool server_success = 8 ; < / code > <nl> * / <nl> private $ server_success ; <nl> / * * <nl> - * < pre > <nl> * Number of failed requests ( one row per status code seen ) <nl> - * < / pre > <nl> * <nl> - * < code > repeated . grpc . testing . RequestResultCount request_results = 9 ; < / code > <nl> + * Generated from protobuf field < code > repeated . grpc . testing . RequestResultCount request_results = 9 ; < / code > <nl> * / <nl> private $ request_results ; <nl> <nl> public function __construct ( ) { <nl> } <nl> <nl> / * * <nl> - * < pre > <nl> * Inputs used to run the scenario . <nl> - * < / pre > <nl> * <nl> - * < code > . grpc . testing . Scenario scenario = 1 ; < / code > <nl> + * Generated from protobuf field < code > . grpc . testing . Scenario scenario = 1 ; < / code > <nl> + * @ return \ Grpc \ Testing \ Scenario <nl> * / <nl> public function getScenario ( ) <nl> { <nl> public function getScenario ( ) <nl> } <nl> <nl> / * * <nl> - * < pre > <nl> * Inputs used to run the scenario . <nl> - * < / pre > <nl> * <nl> - * < code > . grpc . testing . Scenario scenario = 1 ; < / code > <nl> + * Generated from protobuf field < code > . grpc . testing . Scenario scenario = 1 ; < / code > <nl> + * @ param \ Grpc \ Testing \ Scenario $ var <nl> + * @ return $ this <nl> * / <nl> - public function setScenario ( & $ var ) <nl> + public function setScenario ( $ var ) <nl> { <nl> GPBUtil : : checkMessage ( $ var , \ Grpc \ Testing \ Scenario : : class ) ; <nl> $ this - > scenario = $ var ; <nl> + <nl> + return $ this ; <nl> } <nl> <nl> / * * <nl> - * < pre > <nl> * Histograms from all clients merged into one histogram . <nl> - * < / pre > <nl> * <nl> - * < code > . grpc . testing . HistogramData latencies = 2 ; < / code > <nl> + * Generated from protobuf field < code > . grpc . testing . HistogramData latencies = 2 ; < / code > <nl> + * @ return \ Grpc \ Testing \ HistogramData <nl> * / <nl> public function getLatencies ( ) <nl> { <nl> public function getLatencies ( ) <nl> } <nl> <nl> / * * <nl> - * < pre > <nl> * Histograms from all clients merged into one histogram . <nl> - * < / pre > <nl> * <nl> - * < code > . grpc . testing . HistogramData latencies = 2 ; < / code > <nl> + * Generated from protobuf field < code > . grpc . testing . HistogramData latencies = 2 ; < / code > <nl> + * @ param \ Grpc \ Testing \ HistogramData $ var <nl> + * @ return $ this <nl> * / <nl> - public function setLatencies ( & $ var ) <nl> + public function setLatencies ( $ var ) <nl> { <nl> GPBUtil : : checkMessage ( $ var , \ Grpc \ Testing \ HistogramData : : class ) ; <nl> $ this - > latencies = $ var ; <nl> + <nl> + return $ this ; <nl> } <nl> <nl> / * * <nl> - * < pre > <nl> * Client stats for each client <nl> - * < / pre > <nl> * <nl> - * < code > repeated . grpc . testing . ClientStats client_stats = 3 ; < / code > <nl> + * Generated from protobuf field < code > repeated . grpc . testing . ClientStats client_stats = 3 ; < / code > <nl> + * @ return \ Google \ Protobuf \ Internal \ RepeatedField <nl> * / <nl> public function getClientStats ( ) <nl> { <nl> public function getClientStats ( ) <nl> } <nl> <nl> / * * <nl> - * < pre > <nl> * Client stats for each client <nl> - * < / pre > <nl> * <nl> - * < code > repeated . grpc . testing . ClientStats client_stats = 3 ; < / code > <nl> + * Generated from protobuf field < code > repeated . grpc . testing . ClientStats client_stats = 3 ; < / code > <nl> + * @ param \ Grpc \ Testing \ ClientStats [ ] | \ Google \ Protobuf \ Internal \ RepeatedField $ var <nl> + * @ return $ this <nl> * / <nl> - public function setClientStats ( & $ var ) <nl> + public function setClientStats ( $ var ) <nl> { <nl> - GPBUtil : : checkRepeatedField ( $ var , \ Google \ Protobuf \ Internal \ GPBType : : MESSAGE , \ Grpc \ Testing \ ClientStats : : class ) ; <nl> - $ this - > client_stats = $ var ; <nl> + $ arr = GPBUtil : : checkRepeatedField ( $ var , \ Google \ Protobuf \ Internal \ GPBType : : MESSAGE , \ Grpc \ Testing \ ClientStats : : class ) ; <nl> + $ this - > client_stats = $ arr ; <nl> + <nl> + return $ this ; <nl> } <nl> <nl> / * * <nl> - * < pre > <nl> * Server stats for each server <nl> - * < / pre > <nl> * <nl> - * < code > repeated . grpc . testing . ServerStats server_stats = 4 ; < / code > <nl> + * Generated from protobuf field < code > repeated . grpc . testing . ServerStats server_stats = 4 ; < / code > <nl> + * @ return \ Google \ Protobuf \ Internal \ RepeatedField <nl> * / <nl> public function getServerStats ( ) <nl> { <nl> public function getServerStats ( ) <nl> } <nl> <nl> / * * <nl> - * < pre > <nl> * Server stats for each server <nl> - * < / pre > <nl> * <nl> - * < code > repeated . grpc . testing . ServerStats server_stats = 4 ; < / code > <nl> + * Generated from protobuf field < code > repeated . grpc . testing . ServerStats server_stats = 4 ; < / code > <nl> + * @ param \ Grpc \ Testing \ ServerStats [ ] | \ Google \ Protobuf \ Internal \ RepeatedField $ var <nl> + * @ return $ this <nl> * / <nl> - public function setServerStats ( & $ var ) <nl> + public function setServerStats ( $ var ) <nl> { <nl> - GPBUtil : : checkRepeatedField ( $ var , \ Google \ Protobuf \ Internal \ GPBType : : MESSAGE , \ Grpc \ Testing \ ServerStats : : class ) ; <nl> - $ this - > server_stats = $ var ; <nl> + $ arr = GPBUtil : : checkRepeatedField ( $ var , \ Google \ Protobuf \ Internal \ GPBType : : MESSAGE , \ Grpc \ Testing \ ServerStats : : class ) ; <nl> + $ this - > server_stats = $ arr ; <nl> + <nl> + return $ this ; <nl> } <nl> <nl> / * * <nl> - * < pre > <nl> * Number of cores available to each server <nl> - * < / pre > <nl> * <nl> - * < code > repeated int32 server_cores = 5 ; < / code > <nl> + * Generated from protobuf field < code > repeated int32 server_cores = 5 ; < / code > <nl> + * @ return \ Google \ Protobuf \ Internal \ RepeatedField <nl> * / <nl> public function getServerCores ( ) <nl> { <nl> public function getServerCores ( ) <nl> } <nl> <nl> / * * <nl> - * < pre > <nl> * Number of cores available to each server <nl> - * < / pre > <nl> * <nl> - * < code > repeated int32 server_cores = 5 ; < / code > <nl> + * Generated from protobuf field < code > repeated int32 server_cores = 5 ; < / code > <nl> + * @ param int [ ] | \ Google \ Protobuf \ Internal \ RepeatedField $ var <nl> + * @ return $ this <nl> * / <nl> - public function setServerCores ( & $ var ) <nl> + public function setServerCores ( $ var ) <nl> { <nl> - GPBUtil : : checkRepeatedField ( $ var , \ Google \ Protobuf \ Internal \ GPBType : : INT32 ) ; <nl> - $ this - > server_cores = $ var ; <nl> + $ arr = GPBUtil : : checkRepeatedField ( $ var , \ Google \ Protobuf \ Internal \ GPBType : : INT32 ) ; <nl> + $ this - > server_cores = $ arr ; <nl> + <nl> + return $ this ; <nl> } <nl> <nl> / * * <nl> - * < pre > <nl> * An after - the - fact computed summary <nl> - * < / pre > <nl> * <nl> - * < code > . grpc . testing . ScenarioResultSummary summary = 6 ; < / code > <nl> + * Generated from protobuf field < code > . grpc . testing . ScenarioResultSummary summary = 6 ; < / code > <nl> + * @ return \ Grpc \ Testing \ ScenarioResultSummary <nl> * / <nl> public function getSummary ( ) <nl> { <nl> public function getSummary ( ) <nl> } <nl> <nl> / * * <nl> - * < pre > <nl> * An after - the - fact computed summary <nl> - * < / pre > <nl> * <nl> - * < code > . grpc . testing . ScenarioResultSummary summary = 6 ; < / code > <nl> + * Generated from protobuf field < code > . grpc . testing . ScenarioResultSummary summary = 6 ; < / code > <nl> + * @ param \ Grpc \ Testing \ ScenarioResultSummary $ var <nl> + * @ return $ this <nl> * / <nl> - public function setSummary ( & $ var ) <nl> + public function setSummary ( $ var ) <nl> { <nl> GPBUtil : : checkMessage ( $ var , \ Grpc \ Testing \ ScenarioResultSummary : : class ) ; <nl> $ this - > summary = $ var ; <nl> + <nl> + return $ this ; <nl> } <nl> <nl> / * * <nl> - * < pre > <nl> * Information on success or failure of each worker <nl> - * < / pre > <nl> * <nl> - * < code > repeated bool client_success = 7 ; < / code > <nl> + * Generated from protobuf field < code > repeated bool client_success = 7 ; < / code > <nl> + * @ return \ Google \ Protobuf \ Internal \ RepeatedField <nl> * / <nl> public function getClientSuccess ( ) <nl> { <nl> public function getClientSuccess ( ) <nl> } <nl> <nl> / * * <nl> - * < pre > <nl> * Information on success or failure of each worker <nl> - * < / pre > <nl> * <nl> - * < code > repeated bool client_success = 7 ; < / code > <nl> + * Generated from protobuf field < code > repeated bool client_success = 7 ; < / code > <nl> + * @ param bool [ ] | \ Google \ Protobuf \ Internal \ RepeatedField $ var <nl> + * @ return $ this <nl> * / <nl> - public function setClientSuccess ( & $ var ) <nl> + public function setClientSuccess ( $ var ) <nl> { <nl> - GPBUtil : : checkRepeatedField ( $ var , \ Google \ Protobuf \ Internal \ GPBType : : BOOL ) ; <nl> - $ this - > client_success = $ var ; <nl> + $ arr = GPBUtil : : checkRepeatedField ( $ var , \ Google \ Protobuf \ Internal \ GPBType : : BOOL ) ; <nl> + $ this - > client_success = $ arr ; <nl> + <nl> + return $ this ; <nl> } <nl> <nl> / * * <nl> - * < code > repeated bool server_success = 8 ; < / code > <nl> + * Generated from protobuf field < code > repeated bool server_success = 8 ; < / code > <nl> + * @ return \ Google \ Protobuf \ Internal \ RepeatedField <nl> * / <nl> public function getServerSuccess ( ) <nl> { <nl> public function getServerSuccess ( ) <nl> } <nl> <nl> / * * <nl> - * < code > repeated bool server_success = 8 ; < / code > <nl> + * Generated from protobuf field < code > repeated bool server_success = 8 ; < / code > <nl> + * @ param bool [ ] | \ Google \ Protobuf \ Internal \ RepeatedField $ var <nl> + * @ return $ this <nl> * / <nl> - public function setServerSuccess ( & $ var ) <nl> + public function setServerSuccess ( $ var ) <nl> { <nl> - GPBUtil : : checkRepeatedField ( $ var , \ Google \ Protobuf \ Internal \ GPBType : : BOOL ) ; <nl> - $ this - > server_success = $ var ; <nl> + $ arr = GPBUtil : : checkRepeatedField ( $ var , \ Google \ Protobuf \ Internal \ GPBType : : BOOL ) ; <nl> + $ this - > server_success = $ arr ; <nl> + <nl> + return $ this ; <nl> } <nl> <nl> / * * <nl> - * < pre > <nl> * Number of failed requests ( one row per status code seen ) <nl> - * < / pre > <nl> * <nl> - * < code > repeated . grpc . testing . RequestResultCount request_results = 9 ; < / code > <nl> + * Generated from protobuf field < code > repeated . grpc . testing . RequestResultCount request_results = 9 ; < / code > <nl> + * @ return \ Google \ Protobuf \ Internal \ RepeatedField <nl> * / <nl> public function getRequestResults ( ) <nl> { <nl> public function getRequestResults ( ) <nl> } <nl> <nl> / * * <nl> - * < pre > <nl> * Number of failed requests ( one row per status code seen ) <nl> - * < / pre > <nl> * <nl> - * < code > repeated . grpc . testing . RequestResultCount request_results = 9 ; < / code > <nl> + * Generated from protobuf field < code > repeated . grpc . testing . RequestResultCount request_results = 9 ; < / code > <nl> + * @ param \ Grpc \ Testing \ RequestResultCount [ ] | \ Google \ Protobuf \ Internal \ RepeatedField $ var <nl> + * @ return $ this <nl> * / <nl> - public function setRequestResults ( & $ var ) <nl> + public function setRequestResults ( $ var ) <nl> { <nl> - GPBUtil : : checkRepeatedField ( $ var , \ Google \ Protobuf \ Internal \ GPBType : : MESSAGE , \ Grpc \ Testing \ RequestResultCount : : class ) ; <nl> - $ this - > request_results = $ var ; <nl> + $ arr = GPBUtil : : checkRepeatedField ( $ var , \ Google \ Protobuf \ Internal \ GPBType : : MESSAGE , \ Grpc \ Testing \ RequestResultCount : : class ) ; <nl> + $ this - > request_results = $ arr ; <nl> + <nl> + return $ this ; <nl> } <nl> <nl> } <nl> mmm a / src / php / tests / qps / generated_code / Grpc / Testing / ScenarioResultSummary . php <nl> ppp b / src / php / tests / qps / generated_code / Grpc / Testing / ScenarioResultSummary . php <nl> <nl> use Google \ Protobuf \ Internal \ GPBUtil ; <nl> <nl> / * * <nl> - * < pre > <nl> * Basic summary that can be computed from ClientStats and ServerStats <nl> * once the scenario has finished . <nl> - * < / pre > <nl> * <nl> - * Protobuf type < code > grpc . testing . ScenarioResultSummary < / code > <nl> + * Generated from protobuf message < code > grpc . testing . ScenarioResultSummary < / code > <nl> * / <nl> class ScenarioResultSummary extends \ Google \ Protobuf \ Internal \ Message <nl> { <nl> / * * <nl> - * < pre > <nl> * Total number of operations per second over all clients . <nl> - * < / pre > <nl> * <nl> - * < code > double qps = 1 ; < / code > <nl> + * Generated from protobuf field < code > double qps = 1 ; < / code > <nl> * / <nl> private $ qps = 0 . 0 ; <nl> / * * <nl> - * < pre > <nl> * QPS per one server core . <nl> - * < / pre > <nl> * <nl> - * < code > double qps_per_server_core = 2 ; < / code > <nl> + * Generated from protobuf field < code > double qps_per_server_core = 2 ; < / code > <nl> * / <nl> private $ qps_per_server_core = 0 . 0 ; <nl> / * * <nl> - * < pre > <nl> - * server load based on system_time ( 0 . 85 = & gt ; 85 % ) <nl> - * < / pre > <nl> + * server load based on system_time ( 0 . 85 = > 85 % ) <nl> * <nl> - * < code > double server_system_time = 3 ; < / code > <nl> + * Generated from protobuf field < code > double server_system_time = 3 ; < / code > <nl> * / <nl> private $ server_system_time = 0 . 0 ; <nl> / * * <nl> - * < pre > <nl> - * server load based on user_time ( 0 . 85 = & gt ; 85 % ) <nl> - * < / pre > <nl> + * server load based on user_time ( 0 . 85 = > 85 % ) <nl> * <nl> - * < code > double server_user_time = 4 ; < / code > <nl> + * Generated from protobuf field < code > double server_user_time = 4 ; < / code > <nl> * / <nl> private $ server_user_time = 0 . 0 ; <nl> / * * <nl> - * < pre > <nl> - * client load based on system_time ( 0 . 85 = & gt ; 85 % ) <nl> - * < / pre > <nl> + * client load based on system_time ( 0 . 85 = > 85 % ) <nl> * <nl> - * < code > double client_system_time = 5 ; < / code > <nl> + * Generated from protobuf field < code > double client_system_time = 5 ; < / code > <nl> * / <nl> private $ client_system_time = 0 . 0 ; <nl> / * * <nl> - * < pre > <nl> - * client load based on user_time ( 0 . 85 = & gt ; 85 % ) <nl> - * < / pre > <nl> + * client load based on user_time ( 0 . 85 = > 85 % ) <nl> * <nl> - * < code > double client_user_time = 6 ; < / code > <nl> + * Generated from protobuf field < code > double client_user_time = 6 ; < / code > <nl> * / <nl> private $ client_user_time = 0 . 0 ; <nl> / * * <nl> - * < pre > <nl> * X % latency percentiles ( in nanoseconds ) <nl> - * < / pre > <nl> * <nl> - * < code > double latency_50 = 7 ; < / code > <nl> + * Generated from protobuf field < code > double latency_50 = 7 ; < / code > <nl> * / <nl> private $ latency_50 = 0 . 0 ; <nl> / * * <nl> - * < code > double latency_90 = 8 ; < / code > <nl> + * Generated from protobuf field < code > double latency_90 = 8 ; < / code > <nl> * / <nl> private $ latency_90 = 0 . 0 ; <nl> / * * <nl> - * < code > double latency_95 = 9 ; < / code > <nl> + * Generated from protobuf field < code > double latency_95 = 9 ; < / code > <nl> * / <nl> private $ latency_95 = 0 . 0 ; <nl> / * * <nl> - * < code > double latency_99 = 10 ; < / code > <nl> + * Generated from protobuf field < code > double latency_99 = 10 ; < / code > <nl> * / <nl> private $ latency_99 = 0 . 0 ; <nl> / * * <nl> - * < code > double latency_999 = 11 ; < / code > <nl> + * Generated from protobuf field < code > double latency_999 = 11 ; < / code > <nl> * / <nl> private $ latency_999 = 0 . 0 ; <nl> / * * <nl> - * < pre > <nl> * server cpu usage percentage <nl> - * < / pre > <nl> * <nl> - * < code > double server_cpu_usage = 12 ; < / code > <nl> + * Generated from protobuf field < code > double server_cpu_usage = 12 ; < / code > <nl> * / <nl> private $ server_cpu_usage = 0 . 0 ; <nl> / * * <nl> - * < pre > <nl> * Number of requests that succeeded / failed <nl> - * < / pre > <nl> * <nl> - * < code > double successful_requests_per_second = 13 ; < / code > <nl> + * Generated from protobuf field < code > double successful_requests_per_second = 13 ; < / code > <nl> * / <nl> private $ successful_requests_per_second = 0 . 0 ; <nl> / * * <nl> - * < code > double failed_requests_per_second = 14 ; < / code > <nl> + * Generated from protobuf field < code > double failed_requests_per_second = 14 ; < / code > <nl> * / <nl> private $ failed_requests_per_second = 0 . 0 ; <nl> + / * * <nl> + * Number of polls called inside completion queue per request <nl> + * <nl> + * Generated from protobuf field < code > double client_polls_per_request = 15 ; < / code > <nl> + * / <nl> + private $ client_polls_per_request = 0 . 0 ; <nl> + / * * <nl> + * Generated from protobuf field < code > double server_polls_per_request = 16 ; < / code > <nl> + * / <nl> + private $ server_polls_per_request = 0 . 0 ; <nl> + / * * <nl> + * Queries per CPU - sec over all servers or clients <nl> + * <nl> + * Generated from protobuf field < code > double server_queries_per_cpu_sec = 17 ; < / code > <nl> + * / <nl> + private $ server_queries_per_cpu_sec = 0 . 0 ; <nl> + / * * <nl> + * Generated from protobuf field < code > double client_queries_per_cpu_sec = 18 ; < / code > <nl> + * / <nl> + private $ client_queries_per_cpu_sec = 0 . 0 ; <nl> <nl> public function __construct ( ) { <nl> \ GPBMetadata \ Src \ Proto \ Grpc \ Testing \ Control : : initOnce ( ) ; <nl> public function __construct ( ) { <nl> } <nl> <nl> / * * <nl> - * < pre > <nl> * Total number of operations per second over all clients . <nl> - * < / pre > <nl> * <nl> - * < code > double qps = 1 ; < / code > <nl> + * Generated from protobuf field < code > double qps = 1 ; < / code > <nl> + * @ return float <nl> * / <nl> public function getQps ( ) <nl> { <nl> public function getQps ( ) <nl> } <nl> <nl> / * * <nl> - * < pre > <nl> * Total number of operations per second over all clients . <nl> - * < / pre > <nl> * <nl> - * < code > double qps = 1 ; < / code > <nl> + * Generated from protobuf field < code > double qps = 1 ; < / code > <nl> + * @ param float $ var <nl> + * @ return $ this <nl> * / <nl> public function setQps ( $ var ) <nl> { <nl> GPBUtil : : checkDouble ( $ var ) ; <nl> $ this - > qps = $ var ; <nl> + <nl> + return $ this ; <nl> } <nl> <nl> / * * <nl> - * < pre > <nl> * QPS per one server core . <nl> - * < / pre > <nl> * <nl> - * < code > double qps_per_server_core = 2 ; < / code > <nl> + * Generated from protobuf field < code > double qps_per_server_core = 2 ; < / code > <nl> + * @ return float <nl> * / <nl> public function getQpsPerServerCore ( ) <nl> { <nl> public function getQpsPerServerCore ( ) <nl> } <nl> <nl> / * * <nl> - * < pre > <nl> * QPS per one server core . <nl> - * < / pre > <nl> * <nl> - * < code > double qps_per_server_core = 2 ; < / code > <nl> + * Generated from protobuf field < code > double qps_per_server_core = 2 ; < / code > <nl> + * @ param float $ var <nl> + * @ return $ this <nl> * / <nl> public function setQpsPerServerCore ( $ var ) <nl> { <nl> GPBUtil : : checkDouble ( $ var ) ; <nl> $ this - > qps_per_server_core = $ var ; <nl> + <nl> + return $ this ; <nl> } <nl> <nl> / * * <nl> - * < pre > <nl> - * server load based on system_time ( 0 . 85 = & gt ; 85 % ) <nl> - * < / pre > <nl> + * server load based on system_time ( 0 . 85 = > 85 % ) <nl> * <nl> - * < code > double server_system_time = 3 ; < / code > <nl> + * Generated from protobuf field < code > double server_system_time = 3 ; < / code > <nl> + * @ return float <nl> * / <nl> public function getServerSystemTime ( ) <nl> { <nl> public function getServerSystemTime ( ) <nl> } <nl> <nl> / * * <nl> - * < pre > <nl> - * server load based on system_time ( 0 . 85 = & gt ; 85 % ) <nl> - * < / pre > <nl> + * server load based on system_time ( 0 . 85 = > 85 % ) <nl> * <nl> - * < code > double server_system_time = 3 ; < / code > <nl> + * Generated from protobuf field < code > double server_system_time = 3 ; < / code > <nl> + * @ param float $ var <nl> + * @ return $ this <nl> * / <nl> public function setServerSystemTime ( $ var ) <nl> { <nl> GPBUtil : : checkDouble ( $ var ) ; <nl> $ this - > server_system_time = $ var ; <nl> + <nl> + return $ this ; <nl> } <nl> <nl> / * * <nl> - * < pre > <nl> - * server load based on user_time ( 0 . 85 = & gt ; 85 % ) <nl> - * < / pre > <nl> + * server load based on user_time ( 0 . 85 = > 85 % ) <nl> * <nl> - * < code > double server_user_time = 4 ; < / code > <nl> + * Generated from protobuf field < code > double server_user_time = 4 ; < / code > <nl> + * @ return float <nl> * / <nl> public function getServerUserTime ( ) <nl> { <nl> public function getServerUserTime ( ) <nl> } <nl> <nl> / * * <nl> - * < pre > <nl> - * server load based on user_time ( 0 . 85 = & gt ; 85 % ) <nl> - * < / pre > <nl> + * server load based on user_time ( 0 . 85 = > 85 % ) <nl> * <nl> - * < code > double server_user_time = 4 ; < / code > <nl> + * Generated from protobuf field < code > double server_user_time = 4 ; < / code > <nl> + * @ param float $ var <nl> + * @ return $ this <nl> * / <nl> public function setServerUserTime ( $ var ) <nl> { <nl> GPBUtil : : checkDouble ( $ var ) ; <nl> $ this - > server_user_time = $ var ; <nl> + <nl> + return $ this ; <nl> } <nl> <nl> / * * <nl> - * < pre > <nl> - * client load based on system_time ( 0 . 85 = & gt ; 85 % ) <nl> - * < / pre > <nl> + * client load based on system_time ( 0 . 85 = > 85 % ) <nl> * <nl> - * < code > double client_system_time = 5 ; < / code > <nl> + * Generated from protobuf field < code > double client_system_time = 5 ; < / code > <nl> + * @ return float <nl> * / <nl> public function getClientSystemTime ( ) <nl> { <nl> public function getClientSystemTime ( ) <nl> } <nl> <nl> / * * <nl> - * < pre > <nl> - * client load based on system_time ( 0 . 85 = & gt ; 85 % ) <nl> - * < / pre > <nl> + * client load based on system_time ( 0 . 85 = > 85 % ) <nl> * <nl> - * < code > double client_system_time = 5 ; < / code > <nl> + * Generated from protobuf field < code > double client_system_time = 5 ; < / code > <nl> + * @ param float $ var <nl> + * @ return $ this <nl> * / <nl> public function setClientSystemTime ( $ var ) <nl> { <nl> GPBUtil : : checkDouble ( $ var ) ; <nl> $ this - > client_system_time = $ var ; <nl> + <nl> + return $ this ; <nl> } <nl> <nl> / * * <nl> - * < pre > <nl> - * client load based on user_time ( 0 . 85 = & gt ; 85 % ) <nl> - * < / pre > <nl> + * client load based on user_time ( 0 . 85 = > 85 % ) <nl> * <nl> - * < code > double client_user_time = 6 ; < / code > <nl> + * Generated from protobuf field < code > double client_user_time = 6 ; < / code > <nl> + * @ return float <nl> * / <nl> public function getClientUserTime ( ) <nl> { <nl> public function getClientUserTime ( ) <nl> } <nl> <nl> / * * <nl> - * < pre > <nl> - * client load based on user_time ( 0 . 85 = & gt ; 85 % ) <nl> - * < / pre > <nl> + * client load based on user_time ( 0 . 85 = > 85 % ) <nl> * <nl> - * < code > double client_user_time = 6 ; < / code > <nl> + * Generated from protobuf field < code > double client_user_time = 6 ; < / code > <nl> + * @ param float $ var <nl> + * @ return $ this <nl> * / <nl> public function setClientUserTime ( $ var ) <nl> { <nl> GPBUtil : : checkDouble ( $ var ) ; <nl> $ this - > client_user_time = $ var ; <nl> + <nl> + return $ this ; <nl> } <nl> <nl> / * * <nl> - * < pre > <nl> * X % latency percentiles ( in nanoseconds ) <nl> - * < / pre > <nl> * <nl> - * < code > double latency_50 = 7 ; < / code > <nl> + * Generated from protobuf field < code > double latency_50 = 7 ; < / code > <nl> + * @ return float <nl> * / <nl> public function getLatency50 ( ) <nl> { <nl> public function getLatency50 ( ) <nl> } <nl> <nl> / * * <nl> - * < pre > <nl> * X % latency percentiles ( in nanoseconds ) <nl> - * < / pre > <nl> * <nl> - * < code > double latency_50 = 7 ; < / code > <nl> + * Generated from protobuf field < code > double latency_50 = 7 ; < / code > <nl> + * @ param float $ var <nl> + * @ return $ this <nl> * / <nl> public function setLatency50 ( $ var ) <nl> { <nl> GPBUtil : : checkDouble ( $ var ) ; <nl> $ this - > latency_50 = $ var ; <nl> + <nl> + return $ this ; <nl> } <nl> <nl> / * * <nl> - * < code > double latency_90 = 8 ; < / code > <nl> + * Generated from protobuf field < code > double latency_90 = 8 ; < / code > <nl> + * @ return float <nl> * / <nl> public function getLatency90 ( ) <nl> { <nl> public function getLatency90 ( ) <nl> } <nl> <nl> / * * <nl> - * < code > double latency_90 = 8 ; < / code > <nl> + * Generated from protobuf field < code > double latency_90 = 8 ; < / code > <nl> + * @ param float $ var <nl> + * @ return $ this <nl> * / <nl> public function setLatency90 ( $ var ) <nl> { <nl> GPBUtil : : checkDouble ( $ var ) ; <nl> $ this - > latency_90 = $ var ; <nl> + <nl> + return $ this ; <nl> } <nl> <nl> / * * <nl> - * < code > double latency_95 = 9 ; < / code > <nl> + * Generated from protobuf field < code > double latency_95 = 9 ; < / code > <nl> + * @ return float <nl> * / <nl> public function getLatency95 ( ) <nl> { <nl> public function getLatency95 ( ) <nl> } <nl> <nl> / * * <nl> - * < code > double latency_95 = 9 ; < / code > <nl> + * Generated from protobuf field < code > double latency_95 = 9 ; < / code > <nl> + * @ param float $ var <nl> + * @ return $ this <nl> * / <nl> public function setLatency95 ( $ var ) <nl> { <nl> GPBUtil : : checkDouble ( $ var ) ; <nl> $ this - > latency_95 = $ var ; <nl> + <nl> + return $ this ; <nl> } <nl> <nl> / * * <nl> - * < code > double latency_99 = 10 ; < / code > <nl> + * Generated from protobuf field < code > double latency_99 = 10 ; < / code > <nl> + * @ return float <nl> * / <nl> public function getLatency99 ( ) <nl> { <nl> public function getLatency99 ( ) <nl> } <nl> <nl> / * * <nl> - * < code > double latency_99 = 10 ; < / code > <nl> + * Generated from protobuf field < code > double latency_99 = 10 ; < / code > <nl> + * @ param float $ var <nl> + * @ return $ this <nl> * / <nl> public function setLatency99 ( $ var ) <nl> { <nl> GPBUtil : : checkDouble ( $ var ) ; <nl> $ this - > latency_99 = $ var ; <nl> + <nl> + return $ this ; <nl> } <nl> <nl> / * * <nl> - * < code > double latency_999 = 11 ; < / code > <nl> + * Generated from protobuf field < code > double latency_999 = 11 ; < / code > <nl> + * @ return float <nl> * / <nl> public function getLatency999 ( ) <nl> { <nl> public function getLatency999 ( ) <nl> } <nl> <nl> / * * <nl> - * < code > double latency_999 = 11 ; < / code > <nl> + * Generated from protobuf field < code > double latency_999 = 11 ; < / code > <nl> + * @ param float $ var <nl> + * @ return $ this <nl> * / <nl> public function setLatency999 ( $ var ) <nl> { <nl> GPBUtil : : checkDouble ( $ var ) ; <nl> $ this - > latency_999 = $ var ; <nl> + <nl> + return $ this ; <nl> } <nl> <nl> / * * <nl> - * < pre > <nl> * server cpu usage percentage <nl> - * < / pre > <nl> * <nl> - * < code > double server_cpu_usage = 12 ; < / code > <nl> + * Generated from protobuf field < code > double server_cpu_usage = 12 ; < / code > <nl> + * @ return float <nl> * / <nl> public function getServerCpuUsage ( ) <nl> { <nl> public function getServerCpuUsage ( ) <nl> } <nl> <nl> / * * <nl> - * < pre > <nl> * server cpu usage percentage <nl> - * < / pre > <nl> * <nl> - * < code > double server_cpu_usage = 12 ; < / code > <nl> + * Generated from protobuf field < code > double server_cpu_usage = 12 ; < / code > <nl> + * @ param float $ var <nl> + * @ return $ this <nl> * / <nl> public function setServerCpuUsage ( $ var ) <nl> { <nl> GPBUtil : : checkDouble ( $ var ) ; <nl> $ this - > server_cpu_usage = $ var ; <nl> + <nl> + return $ this ; <nl> } <nl> <nl> / * * <nl> - * < pre > <nl> * Number of requests that succeeded / failed <nl> - * < / pre > <nl> * <nl> - * < code > double successful_requests_per_second = 13 ; < / code > <nl> + * Generated from protobuf field < code > double successful_requests_per_second = 13 ; < / code > <nl> + * @ return float <nl> * / <nl> public function getSuccessfulRequestsPerSecond ( ) <nl> { <nl> public function getSuccessfulRequestsPerSecond ( ) <nl> } <nl> <nl> / * * <nl> - * < pre > <nl> * Number of requests that succeeded / failed <nl> - * < / pre > <nl> * <nl> - * < code > double successful_requests_per_second = 13 ; < / code > <nl> + * Generated from protobuf field < code > double successful_requests_per_second = 13 ; < / code > <nl> + * @ param float $ var <nl> + * @ return $ this <nl> * / <nl> public function setSuccessfulRequestsPerSecond ( $ var ) <nl> { <nl> GPBUtil : : checkDouble ( $ var ) ; <nl> $ this - > successful_requests_per_second = $ var ; <nl> + <nl> + return $ this ; <nl> } <nl> <nl> / * * <nl> - * < code > double failed_requests_per_second = 14 ; < / code > <nl> + * Generated from protobuf field < code > double failed_requests_per_second = 14 ; < / code > <nl> + * @ return float <nl> * / <nl> public function getFailedRequestsPerSecond ( ) <nl> { <nl> public function getFailedRequestsPerSecond ( ) <nl> } <nl> <nl> / * * <nl> - * < code > double failed_requests_per_second = 14 ; < / code > <nl> + * Generated from protobuf field < code > double failed_requests_per_second = 14 ; < / code > <nl> + * @ param float $ var <nl> + * @ return $ this <nl> * / <nl> public function setFailedRequestsPerSecond ( $ var ) <nl> { <nl> GPBUtil : : checkDouble ( $ var ) ; <nl> $ this - > failed_requests_per_second = $ var ; <nl> + <nl> + return $ this ; <nl> + } <nl> + <nl> + / * * <nl> + * Number of polls called inside completion queue per request <nl> + * <nl> + * Generated from protobuf field < code > double client_polls_per_request = 15 ; < / code > <nl> + * @ return float <nl> + * / <nl> + public function getClientPollsPerRequest ( ) <nl> + { <nl> + return $ this - > client_polls_per_request ; <nl> + } <nl> + <nl> + / * * <nl> + * Number of polls called inside completion queue per request <nl> + * <nl> + * Generated from protobuf field < code > double client_polls_per_request = 15 ; < / code > <nl> + * @ param float $ var <nl> + * @ return $ this <nl> + * / <nl> + public function setClientPollsPerRequest ( $ var ) <nl> + { <nl> + GPBUtil : : checkDouble ( $ var ) ; <nl> + $ this - > client_polls_per_request = $ var ; <nl> + <nl> + return $ this ; <nl> + } <nl> + <nl> + / * * <nl> + * Generated from protobuf field < code > double server_polls_per_request = 16 ; < / code > <nl> + * @ return float <nl> + * / <nl> + public function getServerPollsPerRequest ( ) <nl> + { <nl> + return $ this - > server_polls_per_request ; <nl> + } <nl> + <nl> + / * * <nl> + * Generated from protobuf field < code > double server_polls_per_request = 16 ; < / code > <nl> + * @ param float $ var <nl> + * @ return $ this <nl> + * / <nl> + public function setServerPollsPerRequest ( $ var ) <nl> + { <nl> + GPBUtil : : checkDouble ( $ var ) ; <nl> + $ this - > server_polls_per_request = $ var ; <nl> + <nl> + return $ this ; <nl> + } <nl> + <nl> + / * * <nl> + * Queries per CPU - sec over all servers or clients <nl> + * <nl> + * Generated from protobuf field < code > double server_queries_per_cpu_sec = 17 ; < / code > <nl> + * @ return float <nl> + * / <nl> + public function getServerQueriesPerCpuSec ( ) <nl> + { <nl> + return $ this - > server_queries_per_cpu_sec ; <nl> + } <nl> + <nl> + / * * <nl> + * Queries per CPU - sec over all servers or clients <nl> + * <nl> + * Generated from protobuf field < code > double server_queries_per_cpu_sec = 17 ; < / code > <nl> + * @ param float $ var <nl> + * @ return $ this <nl> + * / <nl> + public function setServerQueriesPerCpuSec ( $ var ) <nl> + { <nl> + GPBUtil : : checkDouble ( $ var ) ; <nl> + $ this - > server_queries_per_cpu_sec = $ var ; <nl> + <nl> + return $ this ; <nl> + } <nl> + <nl> + / * * <nl> + * Generated from protobuf field < code > double client_queries_per_cpu_sec = 18 ; < / code > <nl> + * @ return float <nl> + * / <nl> + public function getClientQueriesPerCpuSec ( ) <nl> + { <nl> + return $ this - > client_queries_per_cpu_sec ; <nl> + } <nl> + <nl> + / * * <nl> + * Generated from protobuf field < code > double client_queries_per_cpu_sec = 18 ; < / code > <nl> + * @ param float $ var <nl> + * @ return $ this <nl> + * / <nl> + public function setClientQueriesPerCpuSec ( $ var ) <nl> + { <nl> + GPBUtil : : checkDouble ( $ var ) ; <nl> + $ this - > client_queries_per_cpu_sec = $ var ; <nl> + <nl> + return $ this ; <nl> } <nl> <nl> } <nl> mmm a / src / php / tests / qps / generated_code / Grpc / Testing / Scenarios . php <nl> ppp b / src / php / tests / qps / generated_code / Grpc / Testing / Scenarios . php <nl> <nl> use Google \ Protobuf \ Internal \ GPBUtil ; <nl> <nl> / * * <nl> - * < pre > <nl> * A set of scenarios to be run with qps_json_driver <nl> - * < / pre > <nl> * <nl> - * Protobuf type < code > grpc . testing . Scenarios < / code > <nl> + * Generated from protobuf message < code > grpc . testing . Scenarios < / code > <nl> * / <nl> class Scenarios extends \ Google \ Protobuf \ Internal \ Message <nl> { <nl> / * * <nl> - * < code > repeated . grpc . testing . Scenario scenarios = 1 ; < / code > <nl> + * Generated from protobuf field < code > repeated . grpc . testing . Scenario scenarios = 1 ; < / code > <nl> * / <nl> private $ scenarios ; <nl> <nl> public function __construct ( ) { <nl> } <nl> <nl> / * * <nl> - * < code > repeated . grpc . testing . Scenario scenarios = 1 ; < / code > <nl> + * Generated from protobuf field < code > repeated . grpc . testing . Scenario scenarios = 1 ; < / code > <nl> + * @ return \ Google \ Protobuf \ Internal \ RepeatedField <nl> * / <nl> public function getScenarios ( ) <nl> { <nl> public function getScenarios ( ) <nl> } <nl> <nl> / * * <nl> - * < code > repeated . grpc . testing . Scenario scenarios = 1 ; < / code > <nl> + * Generated from protobuf field < code > repeated . grpc . testing . Scenario scenarios = 1 ; < / code > <nl> + * @ param \ Grpc \ Testing \ Scenario [ ] | \ Google \ Protobuf \ Internal \ RepeatedField $ var <nl> + * @ return $ this <nl> * / <nl> - public function setScenarios ( & $ var ) <nl> + public function setScenarios ( $ var ) <nl> { <nl> - GPBUtil : : checkRepeatedField ( $ var , \ Google \ Protobuf \ Internal \ GPBType : : MESSAGE , \ Grpc \ Testing \ Scenario : : class ) ; <nl> - $ this - > scenarios = $ var ; <nl> + $ arr = GPBUtil : : checkRepeatedField ( $ var , \ Google \ Protobuf \ Internal \ GPBType : : MESSAGE , \ Grpc \ Testing \ Scenario : : class ) ; <nl> + $ this - > scenarios = $ arr ; <nl> + <nl> + return $ this ; <nl> } <nl> <nl> } <nl> mmm a / src / php / tests / qps / generated_code / Grpc / Testing / SecurityParams . php <nl> ppp b / src / php / tests / qps / generated_code / Grpc / Testing / SecurityParams . php <nl> <nl> use Google \ Protobuf \ Internal \ GPBUtil ; <nl> <nl> / * * <nl> - * < pre > <nl> * presence of SecurityParams implies use of TLS <nl> - * < / pre > <nl> * <nl> - * Protobuf type < code > grpc . testing . SecurityParams < / code > <nl> + * Generated from protobuf message < code > grpc . testing . SecurityParams < / code > <nl> * / <nl> class SecurityParams extends \ Google \ Protobuf \ Internal \ Message <nl> { <nl> / * * <nl> - * < code > bool use_test_ca = 1 ; < / code > <nl> + * Generated from protobuf field < code > bool use_test_ca = 1 ; < / code > <nl> * / <nl> private $ use_test_ca = false ; <nl> / * * <nl> - * < code > string server_host_override = 2 ; < / code > <nl> + * Generated from protobuf field < code > string server_host_override = 2 ; < / code > <nl> * / <nl> private $ server_host_override = ' ' ; <nl> + / * * <nl> + * Generated from protobuf field < code > string cred_type = 3 ; < / code > <nl> + * / <nl> + private $ cred_type = ' ' ; <nl> <nl> public function __construct ( ) { <nl> \ GPBMetadata \ Src \ Proto \ Grpc \ Testing \ Control : : initOnce ( ) ; <nl> public function __construct ( ) { <nl> } <nl> <nl> / * * <nl> - * < code > bool use_test_ca = 1 ; < / code > <nl> + * Generated from protobuf field < code > bool use_test_ca = 1 ; < / code > <nl> + * @ return bool <nl> * / <nl> public function getUseTestCa ( ) <nl> { <nl> public function getUseTestCa ( ) <nl> } <nl> <nl> / * * <nl> - * < code > bool use_test_ca = 1 ; < / code > <nl> + * Generated from protobuf field < code > bool use_test_ca = 1 ; < / code > <nl> + * @ param bool $ var <nl> + * @ return $ this <nl> * / <nl> public function setUseTestCa ( $ var ) <nl> { <nl> GPBUtil : : checkBool ( $ var ) ; <nl> $ this - > use_test_ca = $ var ; <nl> + <nl> + return $ this ; <nl> } <nl> <nl> / * * <nl> - * < code > string server_host_override = 2 ; < / code > <nl> + * Generated from protobuf field < code > string server_host_override = 2 ; < / code > <nl> + * @ return string <nl> * / <nl> public function getServerHostOverride ( ) <nl> { <nl> public function getServerHostOverride ( ) <nl> } <nl> <nl> / * * <nl> - * < code > string server_host_override = 2 ; < / code > <nl> + * Generated from protobuf field < code > string server_host_override = 2 ; < / code > <nl> + * @ param string $ var <nl> + * @ return $ this <nl> * / <nl> public function setServerHostOverride ( $ var ) <nl> { <nl> GPBUtil : : checkString ( $ var , True ) ; <nl> $ this - > server_host_override = $ var ; <nl> + <nl> + return $ this ; <nl> + } <nl> + <nl> + / * * <nl> + * Generated from protobuf field < code > string cred_type = 3 ; < / code > <nl> + * @ return string <nl> + * / <nl> + public function getCredType ( ) <nl> + { <nl> + return $ this - > cred_type ; <nl> + } <nl> + <nl> + / * * <nl> + * Generated from protobuf field < code > string cred_type = 3 ; < / code > <nl> + * @ param string $ var <nl> + * @ return $ this <nl> + * / <nl> + public function setCredType ( $ var ) <nl> + { <nl> + GPBUtil : : checkString ( $ var , True ) ; <nl> + $ this - > cred_type = $ var ; <nl> + <nl> + return $ this ; <nl> } <nl> <nl> } <nl> mmm a / src / php / tests / qps / generated_code / Grpc / Testing / ServerArgs . php <nl> ppp b / src / php / tests / qps / generated_code / Grpc / Testing / ServerArgs . php <nl> <nl> use Google \ Protobuf \ Internal \ GPBUtil ; <nl> <nl> / * * <nl> - * Protobuf type < code > grpc . testing . ServerArgs < / code > <nl> + * Generated from protobuf message < code > grpc . testing . ServerArgs < / code > <nl> * / <nl> class ServerArgs extends \ Google \ Protobuf \ Internal \ Message <nl> { <nl> public function __construct ( ) { <nl> } <nl> <nl> / * * <nl> - * < code > . grpc . testing . ServerConfig setup = 1 ; < / code > <nl> + * Generated from protobuf field < code > . grpc . testing . ServerConfig setup = 1 ; < / code > <nl> + * @ return \ Grpc \ Testing \ ServerConfig <nl> * / <nl> public function getSetup ( ) <nl> { <nl> public function getSetup ( ) <nl> } <nl> <nl> / * * <nl> - * < code > . grpc . testing . ServerConfig setup = 1 ; < / code > <nl> + * Generated from protobuf field < code > . grpc . testing . ServerConfig setup = 1 ; < / code > <nl> + * @ param \ Grpc \ Testing \ ServerConfig $ var <nl> + * @ return $ this <nl> * / <nl> - public function setSetup ( & $ var ) <nl> + public function setSetup ( $ var ) <nl> { <nl> GPBUtil : : checkMessage ( $ var , \ Grpc \ Testing \ ServerConfig : : class ) ; <nl> $ this - > writeOneof ( 1 , $ var ) ; <nl> + <nl> + return $ this ; <nl> } <nl> <nl> / * * <nl> - * < code > . grpc . testing . Mark mark = 2 ; < / code > <nl> + * Generated from protobuf field < code > . grpc . testing . Mark mark = 2 ; < / code > <nl> + * @ return \ Grpc \ Testing \ Mark <nl> * / <nl> public function getMark ( ) <nl> { <nl> public function getMark ( ) <nl> } <nl> <nl> / * * <nl> - * < code > . grpc . testing . Mark mark = 2 ; < / code > <nl> + * Generated from protobuf field < code > . grpc . testing . Mark mark = 2 ; < / code > <nl> + * @ param \ Grpc \ Testing \ Mark $ var <nl> + * @ return $ this <nl> * / <nl> - public function setMark ( & $ var ) <nl> + public function setMark ( $ var ) <nl> { <nl> GPBUtil : : checkMessage ( $ var , \ Grpc \ Testing \ Mark : : class ) ; <nl> $ this - > writeOneof ( 2 , $ var ) ; <nl> + <nl> + return $ this ; <nl> } <nl> <nl> + / * * <nl> + * @ return string <nl> + * / <nl> public function getArgtype ( ) <nl> { <nl> return $ this - > whichOneof ( " argtype " ) ; <nl> mmm a / src / php / tests / qps / generated_code / Grpc / Testing / ServerConfig . php <nl> ppp b / src / php / tests / qps / generated_code / Grpc / Testing / ServerConfig . php <nl> <nl> use Google \ Protobuf \ Internal \ GPBUtil ; <nl> <nl> / * * <nl> - * Protobuf type < code > grpc . testing . ServerConfig < / code > <nl> + * Generated from protobuf message < code > grpc . testing . ServerConfig < / code > <nl> * / <nl> class ServerConfig extends \ Google \ Protobuf \ Internal \ Message <nl> { <nl> / * * <nl> - * < code > . grpc . testing . ServerType server_type = 1 ; < / code > <nl> + * Generated from protobuf field < code > . grpc . testing . ServerType server_type = 1 ; < / code > <nl> * / <nl> private $ server_type = 0 ; <nl> / * * <nl> - * < code > . grpc . testing . SecurityParams security_params = 2 ; < / code > <nl> + * Generated from protobuf field < code > . grpc . testing . SecurityParams security_params = 2 ; < / code > <nl> * / <nl> private $ security_params = null ; <nl> / * * <nl> - * < pre > <nl> * Port on which to listen . Zero means pick unused port . <nl> - * < / pre > <nl> * <nl> - * < code > int32 port = 4 ; < / code > <nl> + * Generated from protobuf field < code > int32 port = 4 ; < / code > <nl> * / <nl> private $ port = 0 ; <nl> / * * <nl> - * < pre > <nl> * Only for async server . Number of threads used to serve the requests . <nl> - * < / pre > <nl> * <nl> - * < code > int32 async_server_threads = 7 ; < / code > <nl> + * Generated from protobuf field < code > int32 async_server_threads = 7 ; < / code > <nl> * / <nl> private $ async_server_threads = 0 ; <nl> / * * <nl> - * < pre > <nl> * Specify the number of cores to limit server to , if desired <nl> - * < / pre > <nl> * <nl> - * < code > int32 core_limit = 8 ; < / code > <nl> + * Generated from protobuf field < code > int32 core_limit = 8 ; < / code > <nl> * / <nl> private $ core_limit = 0 ; <nl> / * * <nl> - * < pre > <nl> * payload config , used in generic server . <nl> * Note this must NOT be used in proto ( non - generic ) servers . For proto servers , <nl> * ' response sizes ' must be configured from the ' response_size ' field of the <nl> * ' SimpleRequest ' objects in RPC requests . <nl> - * < / pre > <nl> * <nl> - * < code > . grpc . testing . PayloadConfig payload_config = 9 ; < / code > <nl> + * Generated from protobuf field < code > . grpc . testing . PayloadConfig payload_config = 9 ; < / code > <nl> * / <nl> private $ payload_config = null ; <nl> / * * <nl> - * < pre > <nl> * Specify the cores we should run the server on , if desired <nl> - * < / pre > <nl> * <nl> - * < code > repeated int32 core_list = 10 ; < / code > <nl> + * Generated from protobuf field < code > repeated int32 core_list = 10 ; < / code > <nl> * / <nl> private $ core_list ; <nl> / * * <nl> - * < pre > <nl> * If we use an OTHER_SERVER client_type , this string gives more detail <nl> - * < / pre > <nl> * <nl> - * < code > string other_server_api = 11 ; < / code > <nl> + * Generated from protobuf field < code > string other_server_api = 11 ; < / code > <nl> * / <nl> private $ other_server_api = ' ' ; <nl> / * * <nl> - * < pre > <nl> + * Number of threads that share each completion queue <nl> + * <nl> + * Generated from protobuf field < code > int32 threads_per_cq = 12 ; < / code > <nl> + * / <nl> + private $ threads_per_cq = 0 ; <nl> + / * * <nl> * Buffer pool size ( no buffer pool specified if unset ) <nl> - * < / pre > <nl> * <nl> - * < code > int32 resource_quota_size = 1001 ; < / code > <nl> + * Generated from protobuf field < code > int32 resource_quota_size = 1001 ; < / code > <nl> * / <nl> private $ resource_quota_size = 0 ; <nl> + / * * <nl> + * Generated from protobuf field < code > repeated . grpc . testing . ChannelArg channel_args = 1002 ; < / code > <nl> + * / <nl> + private $ channel_args ; <nl> <nl> public function __construct ( ) { <nl> \ GPBMetadata \ Src \ Proto \ Grpc \ Testing \ Control : : initOnce ( ) ; <nl> public function __construct ( ) { <nl> } <nl> <nl> / * * <nl> - * < code > . grpc . testing . ServerType server_type = 1 ; < / code > <nl> + * Generated from protobuf field < code > . grpc . testing . ServerType server_type = 1 ; < / code > <nl> + * @ return int <nl> * / <nl> public function getServerType ( ) <nl> { <nl> public function getServerType ( ) <nl> } <nl> <nl> / * * <nl> - * < code > . grpc . testing . ServerType server_type = 1 ; < / code > <nl> + * Generated from protobuf field < code > . grpc . testing . ServerType server_type = 1 ; < / code > <nl> + * @ param int $ var <nl> + * @ return $ this <nl> * / <nl> public function setServerType ( $ var ) <nl> { <nl> GPBUtil : : checkEnum ( $ var , \ Grpc \ Testing \ ServerType : : class ) ; <nl> $ this - > server_type = $ var ; <nl> + <nl> + return $ this ; <nl> } <nl> <nl> / * * <nl> - * < code > . grpc . testing . SecurityParams security_params = 2 ; < / code > <nl> + * Generated from protobuf field < code > . grpc . testing . SecurityParams security_params = 2 ; < / code > <nl> + * @ return \ Grpc \ Testing \ SecurityParams <nl> * / <nl> public function getSecurityParams ( ) <nl> { <nl> public function getSecurityParams ( ) <nl> } <nl> <nl> / * * <nl> - * < code > . grpc . testing . SecurityParams security_params = 2 ; < / code > <nl> + * Generated from protobuf field < code > . grpc . testing . SecurityParams security_params = 2 ; < / code > <nl> + * @ param \ Grpc \ Testing \ SecurityParams $ var <nl> + * @ return $ this <nl> * / <nl> - public function setSecurityParams ( & $ var ) <nl> + public function setSecurityParams ( $ var ) <nl> { <nl> GPBUtil : : checkMessage ( $ var , \ Grpc \ Testing \ SecurityParams : : class ) ; <nl> $ this - > security_params = $ var ; <nl> + <nl> + return $ this ; <nl> } <nl> <nl> / * * <nl> - * < pre > <nl> * Port on which to listen . Zero means pick unused port . <nl> - * < / pre > <nl> * <nl> - * < code > int32 port = 4 ; < / code > <nl> + * Generated from protobuf field < code > int32 port = 4 ; < / code > <nl> + * @ return int <nl> * / <nl> public function getPort ( ) <nl> { <nl> public function getPort ( ) <nl> } <nl> <nl> / * * <nl> - * < pre > <nl> * Port on which to listen . Zero means pick unused port . <nl> - * < / pre > <nl> * <nl> - * < code > int32 port = 4 ; < / code > <nl> + * Generated from protobuf field < code > int32 port = 4 ; < / code > <nl> + * @ param int $ var <nl> + * @ return $ this <nl> * / <nl> public function setPort ( $ var ) <nl> { <nl> GPBUtil : : checkInt32 ( $ var ) ; <nl> $ this - > port = $ var ; <nl> + <nl> + return $ this ; <nl> } <nl> <nl> / * * <nl> - * < pre > <nl> * Only for async server . Number of threads used to serve the requests . <nl> - * < / pre > <nl> * <nl> - * < code > int32 async_server_threads = 7 ; < / code > <nl> + * Generated from protobuf field < code > int32 async_server_threads = 7 ; < / code > <nl> + * @ return int <nl> * / <nl> public function getAsyncServerThreads ( ) <nl> { <nl> public function getAsyncServerThreads ( ) <nl> } <nl> <nl> / * * <nl> - * < pre > <nl> * Only for async server . Number of threads used to serve the requests . <nl> - * < / pre > <nl> * <nl> - * < code > int32 async_server_threads = 7 ; < / code > <nl> + * Generated from protobuf field < code > int32 async_server_threads = 7 ; < / code > <nl> + * @ param int $ var <nl> + * @ return $ this <nl> * / <nl> public function setAsyncServerThreads ( $ var ) <nl> { <nl> GPBUtil : : checkInt32 ( $ var ) ; <nl> $ this - > async_server_threads = $ var ; <nl> + <nl> + return $ this ; <nl> } <nl> <nl> / * * <nl> - * < pre > <nl> * Specify the number of cores to limit server to , if desired <nl> - * < / pre > <nl> * <nl> - * < code > int32 core_limit = 8 ; < / code > <nl> + * Generated from protobuf field < code > int32 core_limit = 8 ; < / code > <nl> + * @ return int <nl> * / <nl> public function getCoreLimit ( ) <nl> { <nl> public function getCoreLimit ( ) <nl> } <nl> <nl> / * * <nl> - * < pre > <nl> * Specify the number of cores to limit server to , if desired <nl> - * < / pre > <nl> * <nl> - * < code > int32 core_limit = 8 ; < / code > <nl> + * Generated from protobuf field < code > int32 core_limit = 8 ; < / code > <nl> + * @ param int $ var <nl> + * @ return $ this <nl> * / <nl> public function setCoreLimit ( $ var ) <nl> { <nl> GPBUtil : : checkInt32 ( $ var ) ; <nl> $ this - > core_limit = $ var ; <nl> + <nl> + return $ this ; <nl> } <nl> <nl> / * * <nl> - * < pre > <nl> * payload config , used in generic server . <nl> * Note this must NOT be used in proto ( non - generic ) servers . For proto servers , <nl> * ' response sizes ' must be configured from the ' response_size ' field of the <nl> * ' SimpleRequest ' objects in RPC requests . <nl> - * < / pre > <nl> * <nl> - * < code > . grpc . testing . PayloadConfig payload_config = 9 ; < / code > <nl> + * Generated from protobuf field < code > . grpc . testing . PayloadConfig payload_config = 9 ; < / code > <nl> + * @ return \ Grpc \ Testing \ PayloadConfig <nl> * / <nl> public function getPayloadConfig ( ) <nl> { <nl> public function getPayloadConfig ( ) <nl> } <nl> <nl> / * * <nl> - * < pre > <nl> * payload config , used in generic server . <nl> * Note this must NOT be used in proto ( non - generic ) servers . For proto servers , <nl> * ' response sizes ' must be configured from the ' response_size ' field of the <nl> * ' SimpleRequest ' objects in RPC requests . <nl> - * < / pre > <nl> * <nl> - * < code > . grpc . testing . PayloadConfig payload_config = 9 ; < / code > <nl> + * Generated from protobuf field < code > . grpc . testing . PayloadConfig payload_config = 9 ; < / code > <nl> + * @ param \ Grpc \ Testing \ PayloadConfig $ var <nl> + * @ return $ this <nl> * / <nl> - public function setPayloadConfig ( & $ var ) <nl> + public function setPayloadConfig ( $ var ) <nl> { <nl> GPBUtil : : checkMessage ( $ var , \ Grpc \ Testing \ PayloadConfig : : class ) ; <nl> $ this - > payload_config = $ var ; <nl> + <nl> + return $ this ; <nl> } <nl> <nl> / * * <nl> - * < pre > <nl> * Specify the cores we should run the server on , if desired <nl> - * < / pre > <nl> * <nl> - * < code > repeated int32 core_list = 10 ; < / code > <nl> + * Generated from protobuf field < code > repeated int32 core_list = 10 ; < / code > <nl> + * @ return \ Google \ Protobuf \ Internal \ RepeatedField <nl> * / <nl> public function getCoreList ( ) <nl> { <nl> public function getCoreList ( ) <nl> } <nl> <nl> / * * <nl> - * < pre > <nl> * Specify the cores we should run the server on , if desired <nl> - * < / pre > <nl> * <nl> - * < code > repeated int32 core_list = 10 ; < / code > <nl> + * Generated from protobuf field < code > repeated int32 core_list = 10 ; < / code > <nl> + * @ param int [ ] | \ Google \ Protobuf \ Internal \ RepeatedField $ var <nl> + * @ return $ this <nl> * / <nl> - public function setCoreList ( & $ var ) <nl> + public function setCoreList ( $ var ) <nl> { <nl> - GPBUtil : : checkRepeatedField ( $ var , \ Google \ Protobuf \ Internal \ GPBType : : INT32 ) ; <nl> - $ this - > core_list = $ var ; <nl> + $ arr = GPBUtil : : checkRepeatedField ( $ var , \ Google \ Protobuf \ Internal \ GPBType : : INT32 ) ; <nl> + $ this - > core_list = $ arr ; <nl> + <nl> + return $ this ; <nl> } <nl> <nl> / * * <nl> - * < pre > <nl> * If we use an OTHER_SERVER client_type , this string gives more detail <nl> - * < / pre > <nl> * <nl> - * < code > string other_server_api = 11 ; < / code > <nl> + * Generated from protobuf field < code > string other_server_api = 11 ; < / code > <nl> + * @ return string <nl> * / <nl> public function getOtherServerApi ( ) <nl> { <nl> public function getOtherServerApi ( ) <nl> } <nl> <nl> / * * <nl> - * < pre > <nl> * If we use an OTHER_SERVER client_type , this string gives more detail <nl> - * < / pre > <nl> * <nl> - * < code > string other_server_api = 11 ; < / code > <nl> + * Generated from protobuf field < code > string other_server_api = 11 ; < / code > <nl> + * @ param string $ var <nl> + * @ return $ this <nl> * / <nl> public function setOtherServerApi ( $ var ) <nl> { <nl> GPBUtil : : checkString ( $ var , True ) ; <nl> $ this - > other_server_api = $ var ; <nl> + <nl> + return $ this ; <nl> + } <nl> + <nl> + / * * <nl> + * Number of threads that share each completion queue <nl> + * <nl> + * Generated from protobuf field < code > int32 threads_per_cq = 12 ; < / code > <nl> + * @ return int <nl> + * / <nl> + public function getThreadsPerCq ( ) <nl> + { <nl> + return $ this - > threads_per_cq ; <nl> + } <nl> + <nl> + / * * <nl> + * Number of threads that share each completion queue <nl> + * <nl> + * Generated from protobuf field < code > int32 threads_per_cq = 12 ; < / code > <nl> + * @ param int $ var <nl> + * @ return $ this <nl> + * / <nl> + public function setThreadsPerCq ( $ var ) <nl> + { <nl> + GPBUtil : : checkInt32 ( $ var ) ; <nl> + $ this - > threads_per_cq = $ var ; <nl> + <nl> + return $ this ; <nl> } <nl> <nl> / * * <nl> - * < pre > <nl> * Buffer pool size ( no buffer pool specified if unset ) <nl> - * < / pre > <nl> * <nl> - * < code > int32 resource_quota_size = 1001 ; < / code > <nl> + * Generated from protobuf field < code > int32 resource_quota_size = 1001 ; < / code > <nl> + * @ return int <nl> * / <nl> public function getResourceQuotaSize ( ) <nl> { <nl> public function getResourceQuotaSize ( ) <nl> } <nl> <nl> / * * <nl> - * < pre > <nl> * Buffer pool size ( no buffer pool specified if unset ) <nl> - * < / pre > <nl> * <nl> - * < code > int32 resource_quota_size = 1001 ; < / code > <nl> + * Generated from protobuf field < code > int32 resource_quota_size = 1001 ; < / code > <nl> + * @ param int $ var <nl> + * @ return $ this <nl> * / <nl> public function setResourceQuotaSize ( $ var ) <nl> { <nl> GPBUtil : : checkInt32 ( $ var ) ; <nl> $ this - > resource_quota_size = $ var ; <nl> + <nl> + return $ this ; <nl> + } <nl> + <nl> + / * * <nl> + * Generated from protobuf field < code > repeated . grpc . testing . ChannelArg channel_args = 1002 ; < / code > <nl> + * @ return \ Google \ Protobuf \ Internal \ RepeatedField <nl> + * / <nl> + public function getChannelArgs ( ) <nl> + { <nl> + return $ this - > channel_args ; <nl> + } <nl> + <nl> + / * * <nl> + * Generated from protobuf field < code > repeated . grpc . testing . ChannelArg channel_args = 1002 ; < / code > <nl> + * @ param \ Grpc \ Testing \ ChannelArg [ ] | \ Google \ Protobuf \ Internal \ RepeatedField $ var <nl> + * @ return $ this <nl> + * / <nl> + public function setChannelArgs ( $ var ) <nl> + { <nl> + $ arr = GPBUtil : : checkRepeatedField ( $ var , \ Google \ Protobuf \ Internal \ GPBType : : MESSAGE , \ Grpc \ Testing \ ChannelArg : : class ) ; <nl> + $ this - > channel_args = $ arr ; <nl> + <nl> + return $ this ; <nl> } <nl> <nl> } <nl> mmm a / src / php / tests / qps / generated_code / Grpc / Testing / ServerStats . php <nl> ppp b / src / php / tests / qps / generated_code / Grpc / Testing / ServerStats . php <nl> <nl> use Google \ Protobuf \ Internal \ GPBUtil ; <nl> <nl> / * * <nl> - * Protobuf type < code > grpc . testing . ServerStats < / code > <nl> + * Generated from protobuf message < code > grpc . testing . ServerStats < / code > <nl> * / <nl> class ServerStats extends \ Google \ Protobuf \ Internal \ Message <nl> { <nl> / * * <nl> - * < pre > <nl> * wall clock time change in seconds since last reset <nl> - * < / pre > <nl> * <nl> - * < code > double time_elapsed = 1 ; < / code > <nl> + * Generated from protobuf field < code > double time_elapsed = 1 ; < / code > <nl> * / <nl> private $ time_elapsed = 0 . 0 ; <nl> / * * <nl> - * < pre > <nl> * change in user time ( in seconds ) used by the server since last reset <nl> - * < / pre > <nl> * <nl> - * < code > double time_user = 2 ; < / code > <nl> + * Generated from protobuf field < code > double time_user = 2 ; < / code > <nl> * / <nl> private $ time_user = 0 . 0 ; <nl> / * * <nl> - * < pre > <nl> * change in server time ( in seconds ) used by the server process and all <nl> * threads since last reset <nl> - * < / pre > <nl> * <nl> - * < code > double time_system = 3 ; < / code > <nl> + * Generated from protobuf field < code > double time_system = 3 ; < / code > <nl> * / <nl> private $ time_system = 0 . 0 ; <nl> / * * <nl> - * < pre > <nl> * change in total cpu time of the server ( data from proc / stat ) <nl> - * < / pre > <nl> * <nl> - * < code > uint64 total_cpu_time = 4 ; < / code > <nl> + * Generated from protobuf field < code > uint64 total_cpu_time = 4 ; < / code > <nl> * / <nl> private $ total_cpu_time = 0 ; <nl> / * * <nl> - * < pre > <nl> * change in idle time of the server ( data from proc / stat ) <nl> - * < / pre > <nl> * <nl> - * < code > uint64 idle_cpu_time = 5 ; < / code > <nl> + * Generated from protobuf field < code > uint64 idle_cpu_time = 5 ; < / code > <nl> * / <nl> private $ idle_cpu_time = 0 ; <nl> + / * * <nl> + * Number of polls called inside completion queue <nl> + * <nl> + * Generated from protobuf field < code > uint64 cq_poll_count = 6 ; < / code > <nl> + * / <nl> + private $ cq_poll_count = 0 ; <nl> + / * * <nl> + * Core library stats <nl> + * <nl> + * Generated from protobuf field < code > . grpc . core . Stats core_stats = 7 ; < / code > <nl> + * / <nl> + private $ core_stats = null ; <nl> <nl> public function __construct ( ) { <nl> \ GPBMetadata \ Src \ Proto \ Grpc \ Testing \ Stats : : initOnce ( ) ; <nl> public function __construct ( ) { <nl> } <nl> <nl> / * * <nl> - * < pre > <nl> * wall clock time change in seconds since last reset <nl> - * < / pre > <nl> * <nl> - * < code > double time_elapsed = 1 ; < / code > <nl> + * Generated from protobuf field < code > double time_elapsed = 1 ; < / code > <nl> + * @ return float <nl> * / <nl> public function getTimeElapsed ( ) <nl> { <nl> public function getTimeElapsed ( ) <nl> } <nl> <nl> / * * <nl> - * < pre > <nl> * wall clock time change in seconds since last reset <nl> - * < / pre > <nl> * <nl> - * < code > double time_elapsed = 1 ; < / code > <nl> + * Generated from protobuf field < code > double time_elapsed = 1 ; < / code > <nl> + * @ param float $ var <nl> + * @ return $ this <nl> * / <nl> public function setTimeElapsed ( $ var ) <nl> { <nl> GPBUtil : : checkDouble ( $ var ) ; <nl> $ this - > time_elapsed = $ var ; <nl> + <nl> + return $ this ; <nl> } <nl> <nl> / * * <nl> - * < pre > <nl> * change in user time ( in seconds ) used by the server since last reset <nl> - * < / pre > <nl> * <nl> - * < code > double time_user = 2 ; < / code > <nl> + * Generated from protobuf field < code > double time_user = 2 ; < / code > <nl> + * @ return float <nl> * / <nl> public function getTimeUser ( ) <nl> { <nl> public function getTimeUser ( ) <nl> } <nl> <nl> / * * <nl> - * < pre > <nl> * change in user time ( in seconds ) used by the server since last reset <nl> - * < / pre > <nl> * <nl> - * < code > double time_user = 2 ; < / code > <nl> + * Generated from protobuf field < code > double time_user = 2 ; < / code > <nl> + * @ param float $ var <nl> + * @ return $ this <nl> * / <nl> public function setTimeUser ( $ var ) <nl> { <nl> GPBUtil : : checkDouble ( $ var ) ; <nl> $ this - > time_user = $ var ; <nl> + <nl> + return $ this ; <nl> } <nl> <nl> / * * <nl> - * < pre > <nl> * change in server time ( in seconds ) used by the server process and all <nl> * threads since last reset <nl> - * < / pre > <nl> * <nl> - * < code > double time_system = 3 ; < / code > <nl> + * Generated from protobuf field < code > double time_system = 3 ; < / code > <nl> + * @ return float <nl> * / <nl> public function getTimeSystem ( ) <nl> { <nl> public function getTimeSystem ( ) <nl> } <nl> <nl> / * * <nl> - * < pre > <nl> * change in server time ( in seconds ) used by the server process and all <nl> * threads since last reset <nl> - * < / pre > <nl> * <nl> - * < code > double time_system = 3 ; < / code > <nl> + * Generated from protobuf field < code > double time_system = 3 ; < / code > <nl> + * @ param float $ var <nl> + * @ return $ this <nl> * / <nl> public function setTimeSystem ( $ var ) <nl> { <nl> GPBUtil : : checkDouble ( $ var ) ; <nl> $ this - > time_system = $ var ; <nl> + <nl> + return $ this ; <nl> } <nl> <nl> / * * <nl> - * < pre > <nl> * change in total cpu time of the server ( data from proc / stat ) <nl> - * < / pre > <nl> * <nl> - * < code > uint64 total_cpu_time = 4 ; < / code > <nl> + * Generated from protobuf field < code > uint64 total_cpu_time = 4 ; < / code > <nl> + * @ return int | string <nl> * / <nl> public function getTotalCpuTime ( ) <nl> { <nl> public function getTotalCpuTime ( ) <nl> } <nl> <nl> / * * <nl> - * < pre > <nl> * change in total cpu time of the server ( data from proc / stat ) <nl> - * < / pre > <nl> * <nl> - * < code > uint64 total_cpu_time = 4 ; < / code > <nl> + * Generated from protobuf field < code > uint64 total_cpu_time = 4 ; < / code > <nl> + * @ param int | string $ var <nl> + * @ return $ this <nl> * / <nl> public function setTotalCpuTime ( $ var ) <nl> { <nl> GPBUtil : : checkUint64 ( $ var ) ; <nl> $ this - > total_cpu_time = $ var ; <nl> + <nl> + return $ this ; <nl> } <nl> <nl> / * * <nl> - * < pre > <nl> * change in idle time of the server ( data from proc / stat ) <nl> - * < / pre > <nl> * <nl> - * < code > uint64 idle_cpu_time = 5 ; < / code > <nl> + * Generated from protobuf field < code > uint64 idle_cpu_time = 5 ; < / code > <nl> + * @ return int | string <nl> * / <nl> public function getIdleCpuTime ( ) <nl> { <nl> public function getIdleCpuTime ( ) <nl> } <nl> <nl> / * * <nl> - * < pre > <nl> * change in idle time of the server ( data from proc / stat ) <nl> - * < / pre > <nl> * <nl> - * < code > uint64 idle_cpu_time = 5 ; < / code > <nl> + * Generated from protobuf field < code > uint64 idle_cpu_time = 5 ; < / code > <nl> + * @ param int | string $ var <nl> + * @ return $ this <nl> * / <nl> public function setIdleCpuTime ( $ var ) <nl> { <nl> GPBUtil : : checkUint64 ( $ var ) ; <nl> $ this - > idle_cpu_time = $ var ; <nl> + <nl> + return $ this ; <nl> + } <nl> + <nl> + / * * <nl> + * Number of polls called inside completion queue <nl> + * <nl> + * Generated from protobuf field < code > uint64 cq_poll_count = 6 ; < / code > <nl> + * @ return int | string <nl> + * / <nl> + public function getCqPollCount ( ) <nl> + { <nl> + return $ this - > cq_poll_count ; <nl> + } <nl> + <nl> + / * * <nl> + * Number of polls called inside completion queue <nl> + * <nl> + * Generated from protobuf field < code > uint64 cq_poll_count = 6 ; < / code > <nl> + * @ param int | string $ var <nl> + * @ return $ this <nl> + * / <nl> + public function setCqPollCount ( $ var ) <nl> + { <nl> + GPBUtil : : checkUint64 ( $ var ) ; <nl> + $ this - > cq_poll_count = $ var ; <nl> + <nl> + return $ this ; <nl> + } <nl> + <nl> + / * * <nl> + * Core library stats <nl> + * <nl> + * Generated from protobuf field < code > . grpc . core . Stats core_stats = 7 ; < / code > <nl> + * @ return \ Grpc \ Core \ Stats <nl> + * / <nl> + public function getCoreStats ( ) <nl> + { <nl> + return $ this - > core_stats ; <nl> + } <nl> + <nl> + / * * <nl> + * Core library stats <nl> + * <nl> + * Generated from protobuf field < code > . grpc . core . Stats core_stats = 7 ; < / code > <nl> + * @ param \ Grpc \ Core \ Stats $ var <nl> + * @ return $ this <nl> + * / <nl> + public function setCoreStats ( $ var ) <nl> + { <nl> + GPBUtil : : checkMessage ( $ var , \ Grpc \ Core \ Stats : : class ) ; <nl> + $ this - > core_stats = $ var ; <nl> + <nl> + return $ this ; <nl> } <nl> <nl> } <nl> mmm a / src / php / tests / qps / generated_code / Grpc / Testing / ServerStatus . php <nl> ppp b / src / php / tests / qps / generated_code / Grpc / Testing / ServerStatus . php <nl> <nl> use Google \ Protobuf \ Internal \ GPBUtil ; <nl> <nl> / * * <nl> - * Protobuf type < code > grpc . testing . ServerStatus < / code > <nl> + * Generated from protobuf message < code > grpc . testing . ServerStatus < / code > <nl> * / <nl> class ServerStatus extends \ Google \ Protobuf \ Internal \ Message <nl> { <nl> / * * <nl> - * < code > . grpc . testing . ServerStats stats = 1 ; < / code > <nl> + * Generated from protobuf field < code > . grpc . testing . ServerStats stats = 1 ; < / code > <nl> * / <nl> private $ stats = null ; <nl> / * * <nl> - * < pre > <nl> * the port bound by the server <nl> - * < / pre > <nl> * <nl> - * < code > int32 port = 2 ; < / code > <nl> + * Generated from protobuf field < code > int32 port = 2 ; < / code > <nl> * / <nl> private $ port = 0 ; <nl> / * * <nl> - * < pre > <nl> * Number of cores available to the server <nl> - * < / pre > <nl> * <nl> - * < code > int32 cores = 3 ; < / code > <nl> + * Generated from protobuf field < code > int32 cores = 3 ; < / code > <nl> * / <nl> private $ cores = 0 ; <nl> <nl> public function __construct ( ) { <nl> } <nl> <nl> / * * <nl> - * < code > . grpc . testing . ServerStats stats = 1 ; < / code > <nl> + * Generated from protobuf field < code > . grpc . testing . ServerStats stats = 1 ; < / code > <nl> + * @ return \ Grpc \ Testing \ ServerStats <nl> * / <nl> public function getStats ( ) <nl> { <nl> public function getStats ( ) <nl> } <nl> <nl> / * * <nl> - * < code > . grpc . testing . ServerStats stats = 1 ; < / code > <nl> + * Generated from protobuf field < code > . grpc . testing . ServerStats stats = 1 ; < / code > <nl> + * @ param \ Grpc \ Testing \ ServerStats $ var <nl> + * @ return $ this <nl> * / <nl> - public function setStats ( & $ var ) <nl> + public function setStats ( $ var ) <nl> { <nl> GPBUtil : : checkMessage ( $ var , \ Grpc \ Testing \ ServerStats : : class ) ; <nl> $ this - > stats = $ var ; <nl> + <nl> + return $ this ; <nl> } <nl> <nl> / * * <nl> - * < pre > <nl> * the port bound by the server <nl> - * < / pre > <nl> * <nl> - * < code > int32 port = 2 ; < / code > <nl> + * Generated from protobuf field < code > int32 port = 2 ; < / code > <nl> + * @ return int <nl> * / <nl> public function getPort ( ) <nl> { <nl> public function getPort ( ) <nl> } <nl> <nl> / * * <nl> - * < pre > <nl> * the port bound by the server <nl> - * < / pre > <nl> * <nl> - * < code > int32 port = 2 ; < / code > <nl> + * Generated from protobuf field < code > int32 port = 2 ; < / code > <nl> + * @ param int $ var <nl> + * @ return $ this <nl> * / <nl> public function setPort ( $ var ) <nl> { <nl> GPBUtil : : checkInt32 ( $ var ) ; <nl> $ this - > port = $ var ; <nl> + <nl> + return $ this ; <nl> } <nl> <nl> / * * <nl> - * < pre > <nl> * Number of cores available to the server <nl> - * < / pre > <nl> * <nl> - * < code > int32 cores = 3 ; < / code > <nl> + * Generated from protobuf field < code > int32 cores = 3 ; < / code > <nl> + * @ return int <nl> * / <nl> public function getCores ( ) <nl> { <nl> public function getCores ( ) <nl> } <nl> <nl> / * * <nl> - * < pre > <nl> * Number of cores available to the server <nl> - * < / pre > <nl> * <nl> - * < code > int32 cores = 3 ; < / code > <nl> + * Generated from protobuf field < code > int32 cores = 3 ; < / code > <nl> + * @ param int $ var <nl> + * @ return $ this <nl> * / <nl> public function setCores ( $ var ) <nl> { <nl> GPBUtil : : checkInt32 ( $ var ) ; <nl> $ this - > cores = $ var ; <nl> + <nl> + return $ this ; <nl> } <nl> <nl> } <nl> mmm a / src / php / tests / qps / generated_code / Grpc / Testing / ServerType . php <nl> ppp b / src / php / tests / qps / generated_code / Grpc / Testing / ServerType . php <nl> <nl> namespace Grpc \ Testing ; <nl> <nl> / * * <nl> - * Protobuf enum < code > grpc . testing . ServerType < / code > <nl> + * Protobuf enum < code > Grpc \ Testing \ ServerType < / code > <nl> * / <nl> class ServerType <nl> { <nl> / * * <nl> - * < code > SYNC_SERVER = 0 ; < / code > <nl> + * Generated from protobuf enum < code > SYNC_SERVER = 0 ; < / code > <nl> * / <nl> const SYNC_SERVER = 0 ; <nl> / * * <nl> - * < code > ASYNC_SERVER = 1 ; < / code > <nl> + * Generated from protobuf enum < code > ASYNC_SERVER = 1 ; < / code > <nl> * / <nl> const ASYNC_SERVER = 1 ; <nl> / * * <nl> - * < code > ASYNC_GENERIC_SERVER = 2 ; < / code > <nl> + * Generated from protobuf enum < code > ASYNC_GENERIC_SERVER = 2 ; < / code > <nl> * / <nl> const ASYNC_GENERIC_SERVER = 2 ; <nl> / * * <nl> - * < pre > <nl> * used for some language - specific variants <nl> - * < / pre > <nl> * <nl> - * < code > OTHER_SERVER = 3 ; < / code > <nl> + * Generated from protobuf enum < code > OTHER_SERVER = 3 ; < / code > <nl> * / <nl> const OTHER_SERVER = 3 ; <nl> } <nl> mmm a / src / php / tests / qps / generated_code / Grpc / Testing / SimpleProtoParams . php <nl> ppp b / src / php / tests / qps / generated_code / Grpc / Testing / SimpleProtoParams . php <nl> <nl> use Google \ Protobuf \ Internal \ GPBUtil ; <nl> <nl> / * * <nl> - * Protobuf type < code > grpc . testing . SimpleProtoParams < / code > <nl> + * Generated from protobuf message < code > grpc . testing . SimpleProtoParams < / code > <nl> * / <nl> class SimpleProtoParams extends \ Google \ Protobuf \ Internal \ Message <nl> { <nl> / * * <nl> - * < code > int32 req_size = 1 ; < / code > <nl> + * Generated from protobuf field < code > int32 req_size = 1 ; < / code > <nl> * / <nl> private $ req_size = 0 ; <nl> / * * <nl> - * < code > int32 resp_size = 2 ; < / code > <nl> + * Generated from protobuf field < code > int32 resp_size = 2 ; < / code > <nl> * / <nl> private $ resp_size = 0 ; <nl> <nl> public function __construct ( ) { <nl> } <nl> <nl> / * * <nl> - * < code > int32 req_size = 1 ; < / code > <nl> + * Generated from protobuf field < code > int32 req_size = 1 ; < / code > <nl> + * @ return int <nl> * / <nl> public function getReqSize ( ) <nl> { <nl> public function getReqSize ( ) <nl> } <nl> <nl> / * * <nl> - * < code > int32 req_size = 1 ; < / code > <nl> + * Generated from protobuf field < code > int32 req_size = 1 ; < / code > <nl> + * @ param int $ var <nl> + * @ return $ this <nl> * / <nl> public function setReqSize ( $ var ) <nl> { <nl> GPBUtil : : checkInt32 ( $ var ) ; <nl> $ this - > req_size = $ var ; <nl> + <nl> + return $ this ; <nl> } <nl> <nl> / * * <nl> - * < code > int32 resp_size = 2 ; < / code > <nl> + * Generated from protobuf field < code > int32 resp_size = 2 ; < / code > <nl> + * @ return int <nl> * / <nl> public function getRespSize ( ) <nl> { <nl> public function getRespSize ( ) <nl> } <nl> <nl> / * * <nl> - * < code > int32 resp_size = 2 ; < / code > <nl> + * Generated from protobuf field < code > int32 resp_size = 2 ; < / code > <nl> + * @ param int $ var <nl> + * @ return $ this <nl> * / <nl> public function setRespSize ( $ var ) <nl> { <nl> GPBUtil : : checkInt32 ( $ var ) ; <nl> $ this - > resp_size = $ var ; <nl> + <nl> + return $ this ; <nl> } <nl> <nl> } <nl> mmm a / src / php / tests / qps / generated_code / Grpc / Testing / SimpleRequest . php <nl> ppp b / src / php / tests / qps / generated_code / Grpc / Testing / SimpleRequest . php <nl> <nl> use Google \ Protobuf \ Internal \ GPBUtil ; <nl> <nl> / * * <nl> - * < pre > <nl> * Unary request . <nl> - * < / pre > <nl> * <nl> - * Protobuf type < code > grpc . testing . SimpleRequest < / code > <nl> + * Generated from protobuf message < code > grpc . testing . SimpleRequest < / code > <nl> * / <nl> class SimpleRequest extends \ Google \ Protobuf \ Internal \ Message <nl> { <nl> / * * <nl> - * < pre > <nl> * DEPRECATED , don ' t use . To be removed shortly . <nl> * Desired payload type in the response from the server . <nl> * If response_type is RANDOM , server randomly chooses one from other formats . <nl> - * < / pre > <nl> * <nl> - * < code > . grpc . testing . PayloadType response_type = 1 ; < / code > <nl> + * Generated from protobuf field < code > . grpc . testing . PayloadType response_type = 1 ; < / code > <nl> * / <nl> private $ response_type = 0 ; <nl> / * * <nl> - * < pre > <nl> * Desired payload size in the response from the server . <nl> - * < / pre > <nl> * <nl> - * < code > int32 response_size = 2 ; < / code > <nl> + * Generated from protobuf field < code > int32 response_size = 2 ; < / code > <nl> * / <nl> private $ response_size = 0 ; <nl> / * * <nl> - * < pre > <nl> * Optional input payload sent along with the request . <nl> - * < / pre > <nl> * <nl> - * < code > . grpc . testing . Payload payload = 3 ; < / code > <nl> + * Generated from protobuf field < code > . grpc . testing . Payload payload = 3 ; < / code > <nl> * / <nl> private $ payload = null ; <nl> / * * <nl> - * < pre > <nl> * Whether SimpleResponse should include username . <nl> - * < / pre > <nl> * <nl> - * < code > bool fill_username = 4 ; < / code > <nl> + * Generated from protobuf field < code > bool fill_username = 4 ; < / code > <nl> * / <nl> private $ fill_username = false ; <nl> / * * <nl> - * < pre > <nl> * Whether SimpleResponse should include OAuth scope . <nl> - * < / pre > <nl> * <nl> - * < code > bool fill_oauth_scope = 5 ; < / code > <nl> + * Generated from protobuf field < code > bool fill_oauth_scope = 5 ; < / code > <nl> * / <nl> private $ fill_oauth_scope = false ; <nl> / * * <nl> - * < pre > <nl> * Whether to request the server to compress the response . This field is <nl> * " nullable " in order to interoperate seamlessly with clients not able to <nl> * implement the full compression tests by introspecting the call to verify <nl> * the response ' s compression status . <nl> - * < / pre > <nl> * <nl> - * < code > . grpc . testing . BoolValue response_compressed = 6 ; < / code > <nl> + * Generated from protobuf field < code > . grpc . testing . BoolValue response_compressed = 6 ; < / code > <nl> * / <nl> private $ response_compressed = null ; <nl> / * * <nl> - * < pre > <nl> * Whether server should return a given status <nl> - * < / pre > <nl> * <nl> - * < code > . grpc . testing . EchoStatus response_status = 7 ; < / code > <nl> + * Generated from protobuf field < code > . grpc . testing . EchoStatus response_status = 7 ; < / code > <nl> * / <nl> private $ response_status = null ; <nl> / * * <nl> - * < pre > <nl> * Whether the server should expect this request to be compressed . <nl> - * < / pre > <nl> * <nl> - * < code > . grpc . testing . BoolValue expect_compressed = 8 ; < / code > <nl> + * Generated from protobuf field < code > . grpc . testing . BoolValue expect_compressed = 8 ; < / code > <nl> * / <nl> private $ expect_compressed = null ; <nl> <nl> public function __construct ( ) { <nl> } <nl> <nl> / * * <nl> - * < pre > <nl> * DEPRECATED , don ' t use . To be removed shortly . <nl> * Desired payload type in the response from the server . <nl> * If response_type is RANDOM , server randomly chooses one from other formats . <nl> - * < / pre > <nl> * <nl> - * < code > . grpc . testing . PayloadType response_type = 1 ; < / code > <nl> + * Generated from protobuf field < code > . grpc . testing . PayloadType response_type = 1 ; < / code > <nl> + * @ return int <nl> * / <nl> public function getResponseType ( ) <nl> { <nl> public function getResponseType ( ) <nl> } <nl> <nl> / * * <nl> - * < pre > <nl> * DEPRECATED , don ' t use . To be removed shortly . <nl> * Desired payload type in the response from the server . <nl> * If response_type is RANDOM , server randomly chooses one from other formats . <nl> - * < / pre > <nl> * <nl> - * < code > . grpc . testing . PayloadType response_type = 1 ; < / code > <nl> + * Generated from protobuf field < code > . grpc . testing . PayloadType response_type = 1 ; < / code > <nl> + * @ param int $ var <nl> + * @ return $ this <nl> * / <nl> public function setResponseType ( $ var ) <nl> { <nl> GPBUtil : : checkEnum ( $ var , \ Grpc \ Testing \ PayloadType : : class ) ; <nl> $ this - > response_type = $ var ; <nl> + <nl> + return $ this ; <nl> } <nl> <nl> / * * <nl> - * < pre > <nl> * Desired payload size in the response from the server . <nl> - * < / pre > <nl> * <nl> - * < code > int32 response_size = 2 ; < / code > <nl> + * Generated from protobuf field < code > int32 response_size = 2 ; < / code > <nl> + * @ return int <nl> * / <nl> public function getResponseSize ( ) <nl> { <nl> public function getResponseSize ( ) <nl> } <nl> <nl> / * * <nl> - * < pre > <nl> * Desired payload size in the response from the server . <nl> - * < / pre > <nl> * <nl> - * < code > int32 response_size = 2 ; < / code > <nl> + * Generated from protobuf field < code > int32 response_size = 2 ; < / code > <nl> + * @ param int $ var <nl> + * @ return $ this <nl> * / <nl> public function setResponseSize ( $ var ) <nl> { <nl> GPBUtil : : checkInt32 ( $ var ) ; <nl> $ this - > response_size = $ var ; <nl> + <nl> + return $ this ; <nl> } <nl> <nl> / * * <nl> - * < pre > <nl> * Optional input payload sent along with the request . <nl> - * < / pre > <nl> * <nl> - * < code > . grpc . testing . Payload payload = 3 ; < / code > <nl> + * Generated from protobuf field < code > . grpc . testing . Payload payload = 3 ; < / code > <nl> + * @ return \ Grpc \ Testing \ Payload <nl> * / <nl> public function getPayload ( ) <nl> { <nl> public function getPayload ( ) <nl> } <nl> <nl> / * * <nl> - * < pre > <nl> * Optional input payload sent along with the request . <nl> - * < / pre > <nl> * <nl> - * < code > . grpc . testing . Payload payload = 3 ; < / code > <nl> + * Generated from protobuf field < code > . grpc . testing . Payload payload = 3 ; < / code > <nl> + * @ param \ Grpc \ Testing \ Payload $ var <nl> + * @ return $ this <nl> * / <nl> - public function setPayload ( & $ var ) <nl> + public function setPayload ( $ var ) <nl> { <nl> GPBUtil : : checkMessage ( $ var , \ Grpc \ Testing \ Payload : : class ) ; <nl> $ this - > payload = $ var ; <nl> + <nl> + return $ this ; <nl> } <nl> <nl> / * * <nl> - * < pre > <nl> * Whether SimpleResponse should include username . <nl> - * < / pre > <nl> * <nl> - * < code > bool fill_username = 4 ; < / code > <nl> + * Generated from protobuf field < code > bool fill_username = 4 ; < / code > <nl> + * @ return bool <nl> * / <nl> public function getFillUsername ( ) <nl> { <nl> public function getFillUsername ( ) <nl> } <nl> <nl> / * * <nl> - * < pre > <nl> * Whether SimpleResponse should include username . <nl> - * < / pre > <nl> * <nl> - * < code > bool fill_username = 4 ; < / code > <nl> + * Generated from protobuf field < code > bool fill_username = 4 ; < / code > <nl> + * @ param bool $ var <nl> + * @ return $ this <nl> * / <nl> public function setFillUsername ( $ var ) <nl> { <nl> GPBUtil : : checkBool ( $ var ) ; <nl> $ this - > fill_username = $ var ; <nl> + <nl> + return $ this ; <nl> } <nl> <nl> / * * <nl> - * < pre > <nl> * Whether SimpleResponse should include OAuth scope . <nl> - * < / pre > <nl> * <nl> - * < code > bool fill_oauth_scope = 5 ; < / code > <nl> + * Generated from protobuf field < code > bool fill_oauth_scope = 5 ; < / code > <nl> + * @ return bool <nl> * / <nl> public function getFillOauthScope ( ) <nl> { <nl> public function getFillOauthScope ( ) <nl> } <nl> <nl> / * * <nl> - * < pre > <nl> * Whether SimpleResponse should include OAuth scope . <nl> - * < / pre > <nl> * <nl> - * < code > bool fill_oauth_scope = 5 ; < / code > <nl> + * Generated from protobuf field < code > bool fill_oauth_scope = 5 ; < / code > <nl> + * @ param bool $ var <nl> + * @ return $ this <nl> * / <nl> public function setFillOauthScope ( $ var ) <nl> { <nl> GPBUtil : : checkBool ( $ var ) ; <nl> $ this - > fill_oauth_scope = $ var ; <nl> + <nl> + return $ this ; <nl> } <nl> <nl> / * * <nl> - * < pre > <nl> * Whether to request the server to compress the response . This field is <nl> * " nullable " in order to interoperate seamlessly with clients not able to <nl> * implement the full compression tests by introspecting the call to verify <nl> * the response ' s compression status . <nl> - * < / pre > <nl> * <nl> - * < code > . grpc . testing . BoolValue response_compressed = 6 ; < / code > <nl> + * Generated from protobuf field < code > . grpc . testing . BoolValue response_compressed = 6 ; < / code > <nl> + * @ return \ Grpc \ Testing \ BoolValue <nl> * / <nl> public function getResponseCompressed ( ) <nl> { <nl> public function getResponseCompressed ( ) <nl> } <nl> <nl> / * * <nl> - * < pre > <nl> * Whether to request the server to compress the response . This field is <nl> * " nullable " in order to interoperate seamlessly with clients not able to <nl> * implement the full compression tests by introspecting the call to verify <nl> * the response ' s compression status . <nl> - * < / pre > <nl> * <nl> - * < code > . grpc . testing . BoolValue response_compressed = 6 ; < / code > <nl> + * Generated from protobuf field < code > . grpc . testing . BoolValue response_compressed = 6 ; < / code > <nl> + * @ param \ Grpc \ Testing \ BoolValue $ var <nl> + * @ return $ this <nl> * / <nl> - public function setResponseCompressed ( & $ var ) <nl> + public function setResponseCompressed ( $ var ) <nl> { <nl> GPBUtil : : checkMessage ( $ var , \ Grpc \ Testing \ BoolValue : : class ) ; <nl> $ this - > response_compressed = $ var ; <nl> + <nl> + return $ this ; <nl> } <nl> <nl> / * * <nl> - * < pre > <nl> * Whether server should return a given status <nl> - * < / pre > <nl> * <nl> - * < code > . grpc . testing . EchoStatus response_status = 7 ; < / code > <nl> + * Generated from protobuf field < code > . grpc . testing . EchoStatus response_status = 7 ; < / code > <nl> + * @ return \ Grpc \ Testing \ EchoStatus <nl> * / <nl> public function getResponseStatus ( ) <nl> { <nl> public function getResponseStatus ( ) <nl> } <nl> <nl> / * * <nl> - * < pre > <nl> * Whether server should return a given status <nl> - * < / pre > <nl> * <nl> - * < code > . grpc . testing . EchoStatus response_status = 7 ; < / code > <nl> + * Generated from protobuf field < code > . grpc . testing . EchoStatus response_status = 7 ; < / code > <nl> + * @ param \ Grpc \ Testing \ EchoStatus $ var <nl> + * @ return $ this <nl> * / <nl> - public function setResponseStatus ( & $ var ) <nl> + public function setResponseStatus ( $ var ) <nl> { <nl> GPBUtil : : checkMessage ( $ var , \ Grpc \ Testing \ EchoStatus : : class ) ; <nl> $ this - > response_status = $ var ; <nl> + <nl> + return $ this ; <nl> } <nl> <nl> / * * <nl> - * < pre > <nl> * Whether the server should expect this request to be compressed . <nl> - * < / pre > <nl> * <nl> - * < code > . grpc . testing . BoolValue expect_compressed = 8 ; < / code > <nl> + * Generated from protobuf field < code > . grpc . testing . BoolValue expect_compressed = 8 ; < / code > <nl> + * @ return \ Grpc \ Testing \ BoolValue <nl> * / <nl> public function getExpectCompressed ( ) <nl> { <nl> public function getExpectCompressed ( ) <nl> } <nl> <nl> / * * <nl> - * < pre > <nl> * Whether the server should expect this request to be compressed . <nl> - * < / pre > <nl> * <nl> - * < code > . grpc . testing . BoolValue expect_compressed = 8 ; < / code > <nl> + * Generated from protobuf field < code > . grpc . testing . BoolValue expect_compressed = 8 ; < / code > <nl> + * @ param \ Grpc \ Testing \ BoolValue $ var <nl> + * @ return $ this <nl> * / <nl> - public function setExpectCompressed ( & $ var ) <nl> + public function setExpectCompressed ( $ var ) <nl> { <nl> GPBUtil : : checkMessage ( $ var , \ Grpc \ Testing \ BoolValue : : class ) ; <nl> $ this - > expect_compressed = $ var ; <nl> + <nl> + return $ this ; <nl> } <nl> <nl> } <nl> mmm a / src / php / tests / qps / generated_code / Grpc / Testing / SimpleResponse . php <nl> ppp b / src / php / tests / qps / generated_code / Grpc / Testing / SimpleResponse . php <nl> <nl> use Google \ Protobuf \ Internal \ GPBUtil ; <nl> <nl> / * * <nl> - * < pre > <nl> * Unary response , as configured by the request . <nl> - * < / pre > <nl> * <nl> - * Protobuf type < code > grpc . testing . SimpleResponse < / code > <nl> + * Generated from protobuf message < code > grpc . testing . SimpleResponse < / code > <nl> * / <nl> class SimpleResponse extends \ Google \ Protobuf \ Internal \ Message <nl> { <nl> / * * <nl> - * < pre > <nl> * Payload to increase message size . <nl> - * < / pre > <nl> * <nl> - * < code > . grpc . testing . Payload payload = 1 ; < / code > <nl> + * Generated from protobuf field < code > . grpc . testing . Payload payload = 1 ; < / code > <nl> * / <nl> private $ payload = null ; <nl> / * * <nl> - * < pre > <nl> * The user the request came from , for verifying authentication was <nl> * successful when the client expected it . <nl> - * < / pre > <nl> * <nl> - * < code > string username = 2 ; < / code > <nl> + * Generated from protobuf field < code > string username = 2 ; < / code > <nl> * / <nl> private $ username = ' ' ; <nl> / * * <nl> - * < pre > <nl> * OAuth scope . <nl> - * < / pre > <nl> * <nl> - * < code > string oauth_scope = 3 ; < / code > <nl> + * Generated from protobuf field < code > string oauth_scope = 3 ; < / code > <nl> * / <nl> private $ oauth_scope = ' ' ; <nl> <nl> public function __construct ( ) { <nl> } <nl> <nl> / * * <nl> - * < pre > <nl> * Payload to increase message size . <nl> - * < / pre > <nl> * <nl> - * < code > . grpc . testing . Payload payload = 1 ; < / code > <nl> + * Generated from protobuf field < code > . grpc . testing . Payload payload = 1 ; < / code > <nl> + * @ return \ Grpc \ Testing \ Payload <nl> * / <nl> public function getPayload ( ) <nl> { <nl> public function getPayload ( ) <nl> } <nl> <nl> / * * <nl> - * < pre > <nl> * Payload to increase message size . <nl> - * < / pre > <nl> * <nl> - * < code > . grpc . testing . Payload payload = 1 ; < / code > <nl> + * Generated from protobuf field < code > . grpc . testing . Payload payload = 1 ; < / code > <nl> + * @ param \ Grpc \ Testing \ Payload $ var <nl> + * @ return $ this <nl> * / <nl> - public function setPayload ( & $ var ) <nl> + public function setPayload ( $ var ) <nl> { <nl> GPBUtil : : checkMessage ( $ var , \ Grpc \ Testing \ Payload : : class ) ; <nl> $ this - > payload = $ var ; <nl> + <nl> + return $ this ; <nl> } <nl> <nl> / * * <nl> - * < pre > <nl> * The user the request came from , for verifying authentication was <nl> * successful when the client expected it . <nl> - * < / pre > <nl> * <nl> - * < code > string username = 2 ; < / code > <nl> + * Generated from protobuf field < code > string username = 2 ; < / code > <nl> + * @ return string <nl> * / <nl> public function getUsername ( ) <nl> { <nl> public function getUsername ( ) <nl> } <nl> <nl> / * * <nl> - * < pre > <nl> * The user the request came from , for verifying authentication was <nl> * successful when the client expected it . <nl> - * < / pre > <nl> * <nl> - * < code > string username = 2 ; < / code > <nl> + * Generated from protobuf field < code > string username = 2 ; < / code > <nl> + * @ param string $ var <nl> + * @ return $ this <nl> * / <nl> public function setUsername ( $ var ) <nl> { <nl> GPBUtil : : checkString ( $ var , True ) ; <nl> $ this - > username = $ var ; <nl> + <nl> + return $ this ; <nl> } <nl> <nl> / * * <nl> - * < pre > <nl> * OAuth scope . <nl> - * < / pre > <nl> * <nl> - * < code > string oauth_scope = 3 ; < / code > <nl> + * Generated from protobuf field < code > string oauth_scope = 3 ; < / code > <nl> + * @ return string <nl> * / <nl> public function getOauthScope ( ) <nl> { <nl> public function getOauthScope ( ) <nl> } <nl> <nl> / * * <nl> - * < pre > <nl> * OAuth scope . <nl> - * < / pre > <nl> * <nl> - * < code > string oauth_scope = 3 ; < / code > <nl> + * Generated from protobuf field < code > string oauth_scope = 3 ; < / code > <nl> + * @ param string $ var <nl> + * @ return $ this <nl> * / <nl> public function setOauthScope ( $ var ) <nl> { <nl> GPBUtil : : checkString ( $ var , True ) ; <nl> $ this - > oauth_scope = $ var ; <nl> + <nl> + return $ this ; <nl> } <nl> <nl> } <nl> mmm a / src / php / tests / qps / generated_code / Grpc / Testing / StreamingInputCallRequest . php <nl> ppp b / src / php / tests / qps / generated_code / Grpc / Testing / StreamingInputCallRequest . php <nl> <nl> use Google \ Protobuf \ Internal \ GPBUtil ; <nl> <nl> / * * <nl> - * < pre > <nl> * Client - streaming request . <nl> - * < / pre > <nl> * <nl> - * Protobuf type < code > grpc . testing . StreamingInputCallRequest < / code > <nl> + * Generated from protobuf message < code > grpc . testing . StreamingInputCallRequest < / code > <nl> * / <nl> class StreamingInputCallRequest extends \ Google \ Protobuf \ Internal \ Message <nl> { <nl> / * * <nl> - * < pre > <nl> * Optional input payload sent along with the request . <nl> - * < / pre > <nl> * <nl> - * < code > . grpc . testing . Payload payload = 1 ; < / code > <nl> + * Generated from protobuf field < code > . grpc . testing . Payload payload = 1 ; < / code > <nl> * / <nl> private $ payload = null ; <nl> / * * <nl> - * < pre > <nl> * Whether the server should expect this request to be compressed . This field <nl> * is " nullable " in order to interoperate seamlessly with servers not able to <nl> * implement the full compression tests by introspecting the call to verify <nl> * the request ' s compression status . <nl> - * < / pre > <nl> * <nl> - * < code > . grpc . testing . BoolValue expect_compressed = 2 ; < / code > <nl> + * Generated from protobuf field < code > . grpc . testing . BoolValue expect_compressed = 2 ; < / code > <nl> * / <nl> private $ expect_compressed = null ; <nl> <nl> public function __construct ( ) { <nl> } <nl> <nl> / * * <nl> - * < pre > <nl> * Optional input payload sent along with the request . <nl> - * < / pre > <nl> * <nl> - * < code > . grpc . testing . Payload payload = 1 ; < / code > <nl> + * Generated from protobuf field < code > . grpc . testing . Payload payload = 1 ; < / code > <nl> + * @ return \ Grpc \ Testing \ Payload <nl> * / <nl> public function getPayload ( ) <nl> { <nl> public function getPayload ( ) <nl> } <nl> <nl> / * * <nl> - * < pre > <nl> * Optional input payload sent along with the request . <nl> - * < / pre > <nl> * <nl> - * < code > . grpc . testing . Payload payload = 1 ; < / code > <nl> + * Generated from protobuf field < code > . grpc . testing . Payload payload = 1 ; < / code > <nl> + * @ param \ Grpc \ Testing \ Payload $ var <nl> + * @ return $ this <nl> * / <nl> - public function setPayload ( & $ var ) <nl> + public function setPayload ( $ var ) <nl> { <nl> GPBUtil : : checkMessage ( $ var , \ Grpc \ Testing \ Payload : : class ) ; <nl> $ this - > payload = $ var ; <nl> + <nl> + return $ this ; <nl> } <nl> <nl> / * * <nl> - * < pre > <nl> * Whether the server should expect this request to be compressed . This field <nl> * is " nullable " in order to interoperate seamlessly with servers not able to <nl> * implement the full compression tests by introspecting the call to verify <nl> * the request ' s compression status . <nl> - * < / pre > <nl> * <nl> - * < code > . grpc . testing . BoolValue expect_compressed = 2 ; < / code > <nl> + * Generated from protobuf field < code > . grpc . testing . BoolValue expect_compressed = 2 ; < / code > <nl> + * @ return \ Grpc \ Testing \ BoolValue <nl> * / <nl> public function getExpectCompressed ( ) <nl> { <nl> public function getExpectCompressed ( ) <nl> } <nl> <nl> / * * <nl> - * < pre > <nl> * Whether the server should expect this request to be compressed . This field <nl> * is " nullable " in order to interoperate seamlessly with servers not able to <nl> * implement the full compression tests by introspecting the call to verify <nl> * the request ' s compression status . <nl> - * < / pre > <nl> * <nl> - * < code > . grpc . testing . BoolValue expect_compressed = 2 ; < / code > <nl> + * Generated from protobuf field < code > . grpc . testing . BoolValue expect_compressed = 2 ; < / code > <nl> + * @ param \ Grpc \ Testing \ BoolValue $ var <nl> + * @ return $ this <nl> * / <nl> - public function setExpectCompressed ( & $ var ) <nl> + public function setExpectCompressed ( $ var ) <nl> { <nl> GPBUtil : : checkMessage ( $ var , \ Grpc \ Testing \ BoolValue : : class ) ; <nl> $ this - > expect_compressed = $ var ; <nl> + <nl> + return $ this ; <nl> } <nl> <nl> } <nl> mmm a / src / php / tests / qps / generated_code / Grpc / Testing / StreamingInputCallResponse . php <nl> ppp b / src / php / tests / qps / generated_code / Grpc / Testing / StreamingInputCallResponse . php <nl> <nl> use Google \ Protobuf \ Internal \ GPBUtil ; <nl> <nl> / * * <nl> - * < pre > <nl> * Client - streaming response . <nl> - * < / pre > <nl> * <nl> - * Protobuf type < code > grpc . testing . StreamingInputCallResponse < / code > <nl> + * Generated from protobuf message < code > grpc . testing . StreamingInputCallResponse < / code > <nl> * / <nl> class StreamingInputCallResponse extends \ Google \ Protobuf \ Internal \ Message <nl> { <nl> / * * <nl> - * < pre > <nl> * Aggregated size of payloads received from the client . <nl> - * < / pre > <nl> * <nl> - * < code > int32 aggregated_payload_size = 1 ; < / code > <nl> + * Generated from protobuf field < code > int32 aggregated_payload_size = 1 ; < / code > <nl> * / <nl> private $ aggregated_payload_size = 0 ; <nl> <nl> public function __construct ( ) { <nl> } <nl> <nl> / * * <nl> - * < pre > <nl> * Aggregated size of payloads received from the client . <nl> - * < / pre > <nl> * <nl> - * < code > int32 aggregated_payload_size = 1 ; < / code > <nl> + * Generated from protobuf field < code > int32 aggregated_payload_size = 1 ; < / code > <nl> + * @ return int <nl> * / <nl> public function getAggregatedPayloadSize ( ) <nl> { <nl> public function getAggregatedPayloadSize ( ) <nl> } <nl> <nl> / * * <nl> - * < pre > <nl> * Aggregated size of payloads received from the client . <nl> - * < / pre > <nl> * <nl> - * < code > int32 aggregated_payload_size = 1 ; < / code > <nl> + * Generated from protobuf field < code > int32 aggregated_payload_size = 1 ; < / code > <nl> + * @ param int $ var <nl> + * @ return $ this <nl> * / <nl> public function setAggregatedPayloadSize ( $ var ) <nl> { <nl> GPBUtil : : checkInt32 ( $ var ) ; <nl> $ this - > aggregated_payload_size = $ var ; <nl> + <nl> + return $ this ; <nl> } <nl> <nl> } <nl> mmm a / src / php / tests / qps / generated_code / Grpc / Testing / StreamingOutputCallRequest . php <nl> ppp b / src / php / tests / qps / generated_code / Grpc / Testing / StreamingOutputCallRequest . php <nl> <nl> use Google \ Protobuf \ Internal \ GPBUtil ; <nl> <nl> / * * <nl> - * < pre > <nl> * Server - streaming request . <nl> - * < / pre > <nl> * <nl> - * Protobuf type < code > grpc . testing . StreamingOutputCallRequest < / code > <nl> + * Generated from protobuf message < code > grpc . testing . StreamingOutputCallRequest < / code > <nl> * / <nl> class StreamingOutputCallRequest extends \ Google \ Protobuf \ Internal \ Message <nl> { <nl> / * * <nl> - * < pre > <nl> * DEPRECATED , don ' t use . To be removed shortly . <nl> * Desired payload type in the response from the server . <nl> * If response_type is RANDOM , the payload from each response in the stream <nl> * might be of different types . This is to simulate a mixed type of payload <nl> * stream . <nl> - * < / pre > <nl> * <nl> - * < code > . grpc . testing . PayloadType response_type = 1 ; < / code > <nl> + * Generated from protobuf field < code > . grpc . testing . PayloadType response_type = 1 ; < / code > <nl> * / <nl> private $ response_type = 0 ; <nl> / * * <nl> - * < pre > <nl> * Configuration for each expected response message . <nl> - * < / pre > <nl> * <nl> - * < code > repeated . grpc . testing . ResponseParameters response_parameters = 2 ; < / code > <nl> + * Generated from protobuf field < code > repeated . grpc . testing . ResponseParameters response_parameters = 2 ; < / code > <nl> * / <nl> private $ response_parameters ; <nl> / * * <nl> - * < pre > <nl> * Optional input payload sent along with the request . <nl> - * < / pre > <nl> * <nl> - * < code > . grpc . testing . Payload payload = 3 ; < / code > <nl> + * Generated from protobuf field < code > . grpc . testing . Payload payload = 3 ; < / code > <nl> * / <nl> private $ payload = null ; <nl> / * * <nl> - * < pre > <nl> * Whether server should return a given status <nl> - * < / pre > <nl> * <nl> - * < code > . grpc . testing . EchoStatus response_status = 7 ; < / code > <nl> + * Generated from protobuf field < code > . grpc . testing . EchoStatus response_status = 7 ; < / code > <nl> * / <nl> private $ response_status = null ; <nl> <nl> public function __construct ( ) { <nl> } <nl> <nl> / * * <nl> - * < pre > <nl> * DEPRECATED , don ' t use . To be removed shortly . <nl> * Desired payload type in the response from the server . <nl> * If response_type is RANDOM , the payload from each response in the stream <nl> * might be of different types . This is to simulate a mixed type of payload <nl> * stream . <nl> - * < / pre > <nl> * <nl> - * < code > . grpc . testing . PayloadType response_type = 1 ; < / code > <nl> + * Generated from protobuf field < code > . grpc . testing . PayloadType response_type = 1 ; < / code > <nl> + * @ return int <nl> * / <nl> public function getResponseType ( ) <nl> { <nl> public function getResponseType ( ) <nl> } <nl> <nl> / * * <nl> - * < pre > <nl> * DEPRECATED , don ' t use . To be removed shortly . <nl> * Desired payload type in the response from the server . <nl> * If response_type is RANDOM , the payload from each response in the stream <nl> * might be of different types . This is to simulate a mixed type of payload <nl> * stream . <nl> - * < / pre > <nl> * <nl> - * < code > . grpc . testing . PayloadType response_type = 1 ; < / code > <nl> + * Generated from protobuf field < code > . grpc . testing . PayloadType response_type = 1 ; < / code > <nl> + * @ param int $ var <nl> + * @ return $ this <nl> * / <nl> public function setResponseType ( $ var ) <nl> { <nl> GPBUtil : : checkEnum ( $ var , \ Grpc \ Testing \ PayloadType : : class ) ; <nl> $ this - > response_type = $ var ; <nl> + <nl> + return $ this ; <nl> } <nl> <nl> / * * <nl> - * < pre > <nl> * Configuration for each expected response message . <nl> - * < / pre > <nl> * <nl> - * < code > repeated . grpc . testing . ResponseParameters response_parameters = 2 ; < / code > <nl> + * Generated from protobuf field < code > repeated . grpc . testing . ResponseParameters response_parameters = 2 ; < / code > <nl> + * @ return \ Google \ Protobuf \ Internal \ RepeatedField <nl> * / <nl> public function getResponseParameters ( ) <nl> { <nl> public function getResponseParameters ( ) <nl> } <nl> <nl> / * * <nl> - * < pre > <nl> * Configuration for each expected response message . <nl> - * < / pre > <nl> * <nl> - * < code > repeated . grpc . testing . ResponseParameters response_parameters = 2 ; < / code > <nl> + * Generated from protobuf field < code > repeated . grpc . testing . ResponseParameters response_parameters = 2 ; < / code > <nl> + * @ param \ Grpc \ Testing \ ResponseParameters [ ] | \ Google \ Protobuf \ Internal \ RepeatedField $ var <nl> + * @ return $ this <nl> * / <nl> - public function setResponseParameters ( & $ var ) <nl> + public function setResponseParameters ( $ var ) <nl> { <nl> - GPBUtil : : checkRepeatedField ( $ var , \ Google \ Protobuf \ Internal \ GPBType : : MESSAGE , \ Grpc \ Testing \ ResponseParameters : : class ) ; <nl> - $ this - > response_parameters = $ var ; <nl> + $ arr = GPBUtil : : checkRepeatedField ( $ var , \ Google \ Protobuf \ Internal \ GPBType : : MESSAGE , \ Grpc \ Testing \ ResponseParameters : : class ) ; <nl> + $ this - > response_parameters = $ arr ; <nl> + <nl> + return $ this ; <nl> } <nl> <nl> / * * <nl> - * < pre > <nl> * Optional input payload sent along with the request . <nl> - * < / pre > <nl> * <nl> - * < code > . grpc . testing . Payload payload = 3 ; < / code > <nl> + * Generated from protobuf field < code > . grpc . testing . Payload payload = 3 ; < / code > <nl> + * @ return \ Grpc \ Testing \ Payload <nl> * / <nl> public function getPayload ( ) <nl> { <nl> public function getPayload ( ) <nl> } <nl> <nl> / * * <nl> - * < pre > <nl> * Optional input payload sent along with the request . <nl> - * < / pre > <nl> * <nl> - * < code > . grpc . testing . Payload payload = 3 ; < / code > <nl> + * Generated from protobuf field < code > . grpc . testing . Payload payload = 3 ; < / code > <nl> + * @ param \ Grpc \ Testing \ Payload $ var <nl> + * @ return $ this <nl> * / <nl> - public function setPayload ( & $ var ) <nl> + public function setPayload ( $ var ) <nl> { <nl> GPBUtil : : checkMessage ( $ var , \ Grpc \ Testing \ Payload : : class ) ; <nl> $ this - > payload = $ var ; <nl> + <nl> + return $ this ; <nl> } <nl> <nl> / * * <nl> - * < pre > <nl> * Whether server should return a given status <nl> - * < / pre > <nl> * <nl> - * < code > . grpc . testing . EchoStatus response_status = 7 ; < / code > <nl> + * Generated from protobuf field < code > . grpc . testing . EchoStatus response_status = 7 ; < / code > <nl> + * @ return \ Grpc \ Testing \ EchoStatus <nl> * / <nl> public function getResponseStatus ( ) <nl> { <nl> public function getResponseStatus ( ) <nl> } <nl> <nl> / * * <nl> - * < pre > <nl> * Whether server should return a given status <nl> - * < / pre > <nl> * <nl> - * < code > . grpc . testing . EchoStatus response_status = 7 ; < / code > <nl> + * Generated from protobuf field < code > . grpc . testing . EchoStatus response_status = 7 ; < / code > <nl> + * @ param \ Grpc \ Testing \ EchoStatus $ var <nl> + * @ return $ this <nl> * / <nl> - public function setResponseStatus ( & $ var ) <nl> + public function setResponseStatus ( $ var ) <nl> { <nl> GPBUtil : : checkMessage ( $ var , \ Grpc \ Testing \ EchoStatus : : class ) ; <nl> $ this - > response_status = $ var ; <nl> + <nl> + return $ this ; <nl> } <nl> <nl> } <nl> mmm a / src / php / tests / qps / generated_code / Grpc / Testing / StreamingOutputCallResponse . php <nl> ppp b / src / php / tests / qps / generated_code / Grpc / Testing / StreamingOutputCallResponse . php <nl> <nl> use Google \ Protobuf \ Internal \ GPBUtil ; <nl> <nl> / * * <nl> - * < pre > <nl> * Server - streaming response , as configured by the request and parameters . <nl> - * < / pre > <nl> * <nl> - * Protobuf type < code > grpc . testing . StreamingOutputCallResponse < / code > <nl> + * Generated from protobuf message < code > grpc . testing . StreamingOutputCallResponse < / code > <nl> * / <nl> class StreamingOutputCallResponse extends \ Google \ Protobuf \ Internal \ Message <nl> { <nl> / * * <nl> - * < pre > <nl> * Payload to increase response size . <nl> - * < / pre > <nl> * <nl> - * < code > . grpc . testing . Payload payload = 1 ; < / code > <nl> + * Generated from protobuf field < code > . grpc . testing . Payload payload = 1 ; < / code > <nl> * / <nl> private $ payload = null ; <nl> <nl> public function __construct ( ) { <nl> } <nl> <nl> / * * <nl> - * < pre > <nl> * Payload to increase response size . <nl> - * < / pre > <nl> * <nl> - * < code > . grpc . testing . Payload payload = 1 ; < / code > <nl> + * Generated from protobuf field < code > . grpc . testing . Payload payload = 1 ; < / code > <nl> + * @ return \ Grpc \ Testing \ Payload <nl> * / <nl> public function getPayload ( ) <nl> { <nl> public function getPayload ( ) <nl> } <nl> <nl> / * * <nl> - * < pre > <nl> * Payload to increase response size . <nl> - * < / pre > <nl> * <nl> - * < code > . grpc . testing . Payload payload = 1 ; < / code > <nl> + * Generated from protobuf field < code > . grpc . testing . Payload payload = 1 ; < / code > <nl> + * @ param \ Grpc \ Testing \ Payload $ var <nl> + * @ return $ this <nl> * / <nl> - public function setPayload ( & $ var ) <nl> + public function setPayload ( $ var ) <nl> { <nl> GPBUtil : : checkMessage ( $ var , \ Grpc \ Testing \ Payload : : class ) ; <nl> $ this - > payload = $ var ; <nl> + <nl> + return $ this ; <nl> } <nl> <nl> } <nl> mmm a / src / php / tests / qps / generated_code / Grpc / Testing / Void . php <nl> ppp b / src / php / tests / qps / generated_code / Grpc / Testing / Void . php <nl> <nl> use Google \ Protobuf \ Internal \ GPBUtil ; <nl> <nl> / * * <nl> - * Protobuf type < code > grpc . testing . Void < / code > <nl> + * Generated from protobuf message < code > grpc . testing . Void < / code > <nl> * / <nl> class Void extends \ Google \ Protobuf \ Internal \ Message <nl> { <nl> mmm a / src / php / tests / qps / generated_code / Grpc / Testing / WorkerServiceClient . php <nl> ppp b / src / php / tests / qps / generated_code / Grpc / Testing / WorkerServiceClient . php <nl> <nl> / / <nl> / / An integration test service that covers all the method signature permutations <nl> / / of unary / streaming requests / responses . <nl> - namespace Grpc \ Testing { <nl> + namespace Grpc \ Testing ; <nl> <nl> - class WorkerServiceClient extends \ Grpc \ BaseStub { <nl> + / * * <nl> + * / <nl> + class WorkerServiceClient extends \ Grpc \ BaseStub { <nl> <nl> / * * <nl> * @ param string $ hostname hostname <nl> * @ param array $ opts channel options <nl> - * @ param Grpc \ Channel $ channel ( optional ) re - use channel object <nl> + * @ param \ Grpc \ Channel $ channel ( optional ) re - use channel object <nl> * / <nl> public function __construct ( $ hostname , $ opts , $ channel = null ) { <nl> - parent : : __construct ( $ hostname , $ opts , $ channel ) ; <nl> + parent : : __construct ( $ hostname , $ opts , $ channel ) ; <nl> } <nl> <nl> / * * <nl> public function __construct ( $ hostname , $ opts , $ channel = null ) { <nl> * @ param array $ options call options <nl> * / <nl> public function RunServer ( $ metadata = [ ] , $ options = [ ] ) { <nl> - return $ this - > _bidiRequest ( ' / grpc . testing . WorkerService / RunServer ' , <nl> - [ ' \ Grpc \ Testing \ ServerStatus ' , ' decode ' ] , <nl> - $ metadata , $ options ) ; <nl> + return $ this - > _bidiRequest ( ' / grpc . testing . WorkerService / RunServer ' , <nl> + [ ' \ Grpc \ Testing \ ServerStatus ' , ' decode ' ] , <nl> + $ metadata , $ options ) ; <nl> } <nl> <nl> / * * <nl> public function RunServer ( $ metadata = [ ] , $ options = [ ] ) { <nl> * @ param array $ options call options <nl> * / <nl> public function RunClient ( $ metadata = [ ] , $ options = [ ] ) { <nl> - return $ this - > _bidiRequest ( ' / grpc . testing . WorkerService / RunClient ' , <nl> - [ ' \ Grpc \ Testing \ ClientStatus ' , ' decode ' ] , <nl> - $ metadata , $ options ) ; <nl> + return $ this - > _bidiRequest ( ' / grpc . testing . WorkerService / RunClient ' , <nl> + [ ' \ Grpc \ Testing \ ClientStatus ' , ' decode ' ] , <nl> + $ metadata , $ options ) ; <nl> } <nl> <nl> / * * <nl> public function RunClient ( $ metadata = [ ] , $ options = [ ] ) { <nl> * / <nl> public function CoreCount ( \ Grpc \ Testing \ CoreRequest $ argument , <nl> $ metadata = [ ] , $ options = [ ] ) { <nl> - return $ this - > _simpleRequest ( ' / grpc . testing . WorkerService / CoreCount ' , <nl> - $ argument , <nl> - [ ' \ Grpc \ Testing \ CoreResponse ' , ' decode ' ] , <nl> - $ metadata , $ options ) ; <nl> + return $ this - > _simpleRequest ( ' / grpc . testing . WorkerService / CoreCount ' , <nl> + $ argument , <nl> + [ ' \ Grpc \ Testing \ CoreResponse ' , ' decode ' ] , <nl> + $ metadata , $ options ) ; <nl> } <nl> <nl> / * * <nl> public function CoreCount ( \ Grpc \ Testing \ CoreRequest $ argument , <nl> * / <nl> public function QuitWorker ( \ Grpc \ Testing \ Void $ argument , <nl> $ metadata = [ ] , $ options = [ ] ) { <nl> - return $ this - > _simpleRequest ( ' / grpc . testing . WorkerService / QuitWorker ' , <nl> - $ argument , <nl> - [ ' \ Grpc \ Testing \ Void ' , ' decode ' ] , <nl> - $ metadata , $ options ) ; <nl> + return $ this - > _simpleRequest ( ' / grpc . testing . WorkerService / QuitWorker ' , <nl> + $ argument , <nl> + [ ' \ Grpc \ Testing \ Void ' , ' decode ' ] , <nl> + $ metadata , $ options ) ; <nl> } <nl> <nl> - } <nl> - <nl> } <nl> new file mode 100644 <nl> index 00000000000 . . c11a67c6186 <nl> mmm / dev / null <nl> ppp b / src / php / tests / qps / histogram . php <nl> <nl> + < ? php <nl> + / * <nl> + * <nl> + * Copyright 2017 gRPC authors . <nl> + * <nl> + * Licensed under the Apache License , Version 2 . 0 ( the " License " ) ; <nl> + * you may not use this file except in compliance with the License . <nl> + * You may obtain a copy of the License at <nl> + * <nl> + * http : / / www . apache . org / licenses / LICENSE - 2 . 0 <nl> + * <nl> + * Unless required by applicable law or agreed to in writing , software <nl> + * distributed under the License is distributed on an " AS IS " BASIS , <nl> + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND , either express or implied . <nl> + * See the License for the specific language governing permissions and <nl> + * limitations under the License . <nl> + * <nl> + * / <nl> + <nl> + / / Histogram class for use in performance testing and measurement <nl> + class Histogram { <nl> + private $ resolution ; <nl> + private $ max_possible ; <nl> + private $ sum ; <nl> + private $ sum_of_squares ; <nl> + private $ multiplier ; <nl> + private $ count ; <nl> + private $ min_seen ; <nl> + private $ max_seen ; <nl> + private $ buckets ; <nl> + <nl> + private function bucket_for ( $ value ) { <nl> + return ( int ) ( log ( $ value ) / log ( $ this - > multiplier ) ) ; <nl> + } <nl> + <nl> + public function __construct ( $ resolution , $ max_possible ) { <nl> + $ this - > resolution = $ resolution ; <nl> + $ this - > max_possible = $ max_possible ; <nl> + $ this - > sum = 0 ; <nl> + $ this - > sum_of_squares = 0 ; <nl> + $ this - > multiplier = 1 + $ resolution ; <nl> + $ this - > count = 0 ; <nl> + $ this - > min_seen = $ max_possible ; <nl> + $ this - > max_seen = 0 ; <nl> + $ this - > buckets = array_fill ( 0 , $ this - > bucket_for ( $ max_possible ) + 1 , 0 ) ; <nl> + } <nl> + <nl> + public function add ( $ value ) { <nl> + $ this - > sum + = $ value ; <nl> + $ this - > sum_of_squares + = $ value * $ value ; <nl> + $ this - > count + = 1 ; <nl> + if ( $ value < $ this - > min_seen ) { <nl> + $ this - > min_seen = $ value ; <nl> + } <nl> + if ( $ value > $ this - > max_seen ) { <nl> + $ this - > max_seen = $ value ; <nl> + } <nl> + $ this - > buckets [ $ this - > bucket_for ( $ value ) ] + = 1 ; <nl> + } <nl> + <nl> + public function minimum ( ) { <nl> + return $ this - > min_seen ; <nl> + } <nl> + <nl> + public function maximum ( ) { <nl> + return $ this - > max_seen ; <nl> + } <nl> + <nl> + public function sum ( ) { <nl> + return $ this - > sum ; <nl> + } <nl> + <nl> + public function sum_of_squares ( ) { <nl> + return $ this - > sum_of_squares ; <nl> + } <nl> + <nl> + public function count ( ) { <nl> + return $ this - > count ; <nl> + } <nl> + <nl> + public function contents ( ) { <nl> + return $ this - > buckets ; <nl> + } <nl> + <nl> + public function clean ( ) { <nl> + $ this - > sum = 0 ; <nl> + $ this - > sum_of_squares = 0 ; <nl> + $ this - > count = 0 ; <nl> + $ this - > min_seen = $ this - > max_possible ; <nl> + $ this - > max_seen = 0 ; <nl> + $ this - > buckets = array_fill ( 0 , $ this - > bucket_for ( $ this - > max_possible ) + 1 , 0 ) ; <nl> + } <nl> + } <nl> mmm a / src / proto / grpc / testing / proxy - service . proto <nl> ppp b / src / proto / grpc / testing / proxy - service . proto <nl> <nl> syntax = " proto3 " ; <nl> <nl> import " src / proto / grpc / testing / control . proto " ; <nl> + import " src / proto / grpc / testing / stats . proto " ; <nl> <nl> package grpc . testing ; <nl> <nl> message ProxyStat { <nl> service ProxyClientService { <nl> rpc GetConfig ( Void ) returns ( ClientConfig ) ; <nl> rpc ReportTime ( stream ProxyStat ) returns ( Void ) ; <nl> + rpc ReportHist ( stream HistogramData ) returns ( Void ) ; <nl> } <nl> <nl> mmm a / src / ruby / qps / histogram . rb <nl> ppp b / src / ruby / qps / histogram . rb <nl> <nl> <nl> # Histogram class for use in performance testing and measurement <nl> <nl> + require ' thread ' <nl> + <nl> class Histogram <nl> # Determine the bucket index for a given value <nl> # @ param { number } value The value to check <nl> def bucket_for ( value ) <nl> # @ param { number } resolution The resolution of the histogram <nl> # @ param { number } max_possible The maximum value for the histogram <nl> def initialize ( resolution , max_possible ) <nl> + @ lock = Mutex . new <nl> @ resolution = resolution <nl> @ max_possible = max_possible <nl> @ sum = 0 <nl> def count <nl> def contents <nl> @ buckets <nl> end <nl> + <nl> + def merge ( hist ) <nl> + @ lock . synchronize do <nl> + @ min_seen = hist . min_seen <nl> + @ max_seen = hist . max_seen <nl> + @ sum + = hist . sum <nl> + @ sum_of_squares + = hist . sum_of_squares <nl> + @ count + = hist . count <nl> + received_bucket = hist . bucket . to_a <nl> + @ buckets = @ buckets . map . with_index { | m , i | m + received_bucket [ i ] . to_i } <nl> + end <nl> + end <nl> end <nl> mmm a / src / ruby / qps / proxy - worker . rb <nl> ppp b / src / ruby / qps / proxy - worker . rb <nl> def setup ( config ) <nl> @ histmax = config . histogram_params . max_possible <nl> @ histogram = Histogram . new ( @ histres , @ histmax ) <nl> @ start_time = Time . now <nl> - # TODO ( vjpai ) : Support multiple client channels by spawning off a PHP client per channel <nl> - if @ use_c_ext <nl> - puts " Use protobuf c extension " <nl> - command = " php - d extension = " + File . expand_path ( File . dirname ( __FILE__ ) ) + " / . . / . . / php / tests / qps / vendor / google / protobuf / php / ext / google / protobuf / modules / protobuf . so " + " - d extension = " + File . expand_path ( File . dirname ( __FILE__ ) ) + " / . . / . . / php / ext / grpc / modules / grpc . so " + File . expand_path ( File . dirname ( __FILE__ ) ) + " / . . / . . / php / tests / qps / client . php " + @ mytarget <nl> - else <nl> - puts " Use protobuf php extension " <nl> - command = " php - d extension = " + File . expand_path ( File . dirname ( __FILE__ ) ) + " / . . / . . / php / ext / grpc / modules / grpc . so " + File . expand_path ( File . dirname ( __FILE__ ) ) + " / . . / . . / php / tests / qps / client . php " + @ mytarget <nl> - end <nl> - puts " Starting command : " + command <nl> - @ php_pid = spawn ( command ) <nl> + @ php_pid = Array . new ( @ config . client_channels ) <nl> + ( 0 . . @ config . client_channels - 1 ) . each do | chan | <nl> + Thread . new { <nl> + if @ use_c_ext <nl> + puts " Use protobuf c extension " <nl> + command = " php - d extension = " + File . expand_path ( File . dirname ( __FILE__ ) ) + <nl> + " / . . / . . / php / tests / qps / vendor / google / protobuf / php / ext / google / protobuf / modules / protobuf . so " + <nl> + " - d extension = " + File . expand_path ( File . dirname ( __FILE__ ) ) + " / . . / . . / php / ext / grpc / modules / grpc . so " + <nl> + File . expand_path ( File . dirname ( __FILE__ ) ) + " / . . / . . / php / tests / qps / client . php " + @ mytarget + " # { chan % @ config . server_targets . length } " <nl> + else <nl> + puts " Use protobuf php extension " <nl> + command = " php - d extension = " + File . expand_path ( File . dirname ( __FILE__ ) ) + " / . . / . . / php / ext / grpc / modules / grpc . so " + <nl> + File . expand_path ( File . dirname ( __FILE__ ) ) + " / . . / . . / php / tests / qps / client . php " + @ mytarget + " # { chan % @ config . server_targets . length } " <nl> + end <nl> + puts " [ ruby proxy ] Starting # { chan } th php - client command use c protobuf # { @ use_c_ext } : " + command <nl> + @ php_pid [ chan ] = spawn ( command ) <nl> + while true <nl> + sleep <nl> + end <nl> + } <nl> + end <nl> end <nl> def stop <nl> - Process . kill ( " TERM " , @ php_pid ) <nl> - Process . wait ( @ php_pid ) <nl> + ( 0 . . @ config . client_channels - 1 ) . each do | chan | <nl> + Process . kill ( " TERM " , @ php_pid [ chan ] ) <nl> + Process . wait ( @ php_pid [ chan ] ) <nl> + end <nl> end <nl> def get_config ( _args , _call ) <nl> - puts " Answering get_config " <nl> @ config <nl> end <nl> def report_time ( call ) <nl> - puts " Starting a time reporting stream " <nl> call . each_remote_read do | lat | <nl> @ histogram . add ( ( lat . latency ) * 1e9 ) <nl> end <nl> Grpc : : Testing : : Void . new <nl> end <nl> + def report_hist ( call ) <nl> + call . each_remote_read do | lat | <nl> + @ histogram . merge ( lat ) <nl> + end <nl> + Grpc : : Testing : : Void . new <nl> + end <nl> def mark ( reset ) <nl> lat = Grpc : : Testing : : HistogramData . new ( <nl> bucket : @ histogram . contents , <nl> def proxymain <nl> opts . on ( ' - - driver_port PORT ' , ' < port > ' ) do | v | <nl> options [ ' driver_port ' ] = v <nl> end <nl> - opts . on ( " - c " , " - - [ no - ] c_proto_ext " , " Use protobuf C - extention " ) do | c | <nl> + opts . on ( " - c " , " - - [ no - ] use_protobuf_c_extension " , " Use protobuf C - extention " ) do | c | <nl> options [ : c_ext ] = c <nl> end <nl> end . parse ! <nl> def proxymain <nl> # Configure any errors with client or server child threads to surface <nl> Thread . abort_on_exception = true <nl> <nl> - s = GRPC : : RpcServer . new <nl> + # Make sure proxy_server can handle the large number of calls in benchmarks <nl> + s = GRPC : : RpcServer . new ( pool_size : 1024 ) <nl> port = s . add_http2_port ( " 0 . 0 . 0 . 0 : " + options [ ' driver_port ' ] . to_s , <nl> : this_port_is_insecure ) <nl> bmc = ProxyBenchmarkClientServiceImpl . new ( port , options [ : c_ext ] ) <nl> mmm a / src / ruby / qps / src / proto / grpc / testing / proxy - service_pb . rb <nl> ppp b / src / ruby / qps / src / proto / grpc / testing / proxy - service_pb . rb <nl> <nl> require ' google / protobuf ' <nl> <nl> require ' src / proto / grpc / testing / control_pb ' <nl> + require ' src / proto / grpc / testing / stats_pb ' <nl> Google : : Protobuf : : DescriptorPool . generated_pool . build do <nl> add_message " grpc . testing . ProxyStat " do <nl> optional : latency , : double , 1 <nl> mmm a / src / ruby / qps / src / proto / grpc / testing / proxy - service_services_pb . rb <nl> ppp b / src / ruby / qps / src / proto / grpc / testing / proxy - service_services_pb . rb <nl> class Service <nl> <nl> rpc : GetConfig , Void , ClientConfig <nl> rpc : ReportTime , stream ( ProxyStat ) , Void <nl> + rpc : ReportHist , stream ( HistogramData ) , Void <nl> end <nl> <nl> Stub = Service . rpc_stub_class <nl> mmm a / tools / jenkins / run_full_performance . sh <nl> ppp b / tools / jenkins / run_full_performance . sh <nl> cd $ ( dirname $ 0 ) / . . / . . <nl> <nl> # run 8core client vs 8core server <nl> tools / run_tests / run_performance_tests . py \ <nl> - - l c + + csharp node ruby java python go node_express php_protobuf_php php_protobuf_c \ <nl> + - l c + + csharp node ruby java python go node_express php7 php7_protobuf_c \ <nl> - - netperf \ <nl> - - category scalable \ <nl> - - bq_result_table performance_test . performance_experiment \ <nl> mmm a / tools / run_tests / performance / build_performance . sh <nl> ppp b / tools / run_tests / performance / build_performance . sh <nl> then <nl> make CONFIG = $ { CONFIG } EMBED_OPENSSL = true EMBED_ZLIB = true qps_worker qps_json_driver - j8 <nl> fi <nl> <nl> + PHP_ALREADY_BUILT = " " <nl> for language in $ @ <nl> do <nl> case " $ language " in <nl> do <nl> " go " ) <nl> tools / run_tests / performance / build_performance_go . sh <nl> ; ; <nl> + " php7 " | " php7_protobuf_c " ) <nl> + if [ - n " $ PHP_ALREADY_BUILT " ] ; then <nl> + echo " Skipping PHP build as already built by $ PHP_ALREADY_BUILT " <nl> + else <nl> + PHP_ALREADY_BUILT = $ language <nl> + tools / run_tests / performance / build_performance_php7 . sh <nl> + fi <nl> + ; ; <nl> " csharp " ) <nl> python tools / run_tests / run_tests . py - l $ language - c $ CONFIG - - build_only - j 8 - - compiler coreclr <nl> ; ; <nl> new file mode 100755 <nl> index 00000000000 . . 141c9fd1c81 <nl> mmm / dev / null <nl> ppp b / tools / run_tests / performance / build_performance_php7 . sh <nl> <nl> + # ! / bin / bash <nl> + # Copyright 2017 gRPC authors . <nl> + # <nl> + # Licensed under the Apache License , Version 2 . 0 ( the " License " ) ; <nl> + # you may not use this file except in compliance with the License . <nl> + # You may obtain a copy of the License at <nl> + # <nl> + # http : / / www . apache . org / licenses / LICENSE - 2 . 0 <nl> + # <nl> + # Unless required by applicable law or agreed to in writing , software <nl> + # distributed under the License is distributed on an " AS IS " BASIS , <nl> + # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND , either express or implied . <nl> + # See the License for the specific language governing permissions and <nl> + # limitations under the License . <nl> + <nl> + set - ex <nl> + <nl> + cd $ ( dirname $ 0 ) / . . / . . / . . <nl> + CONFIG = $ { CONFIG : - opt } <nl> + python tools / run_tests / run_tests . py - l php7 - c $ CONFIG - - build_only - j 8 <nl> + <nl> + # Set up all dependences needed for PHP QPS test <nl> + cd src / php / tests / qps <nl> + composer install <nl> + # Install protobuf C - extension for php <nl> + cd vendor / google / protobuf / php / ext / google / protobuf <nl> + phpize <nl> + . / configure <nl> + make <nl> + <nl> mmm a / tools / run_tests / performance / run_worker_php . sh <nl> ppp b / tools / run_tests / performance / run_worker_php . sh <nl> source ~ / . rvm / scripts / rvm <nl> set - ex <nl> <nl> cd $ ( dirname $ 0 ) / . . / . . / . . <nl> - repo = $ ( pwd ) <nl> - # First set up all dependences needed for PHP QPS test <nl> - cd $ repo <nl> - cd src / php / tests / qps <nl> - composer install <nl> - # Install protobuf C - extension for php <nl> - cd vendor / google / protobuf / php / ext / google / protobuf <nl> - phpize <nl> - . / configure <nl> - make <nl> + <nl> # The proxy worker for PHP is implemented in Ruby <nl> - cd $ repo <nl> ruby src / ruby / qps / proxy - worker . rb $ @ <nl> <nl> mmm a / tools / run_tests / performance / scenario_config . py <nl> ppp b / tools / run_tests / performance / scenario_config . py <nl> def __str__ ( self ) : <nl> return ' ruby ' <nl> <nl> <nl> - class PhpLanguage : <nl> + class Php7Language : <nl> <nl> - def __init__ ( self , use_protobuf_c_extension = False ) : <nl> + def __init__ ( self , php7_protobuf_c = False ) : <nl> pass <nl> - self . use_protobuf_c_extension = use_protobuf_c_extension <nl> + self . php7_protobuf_c = php7_protobuf_c <nl> self . safename = str ( self ) <nl> <nl> def worker_cmdline ( self ) : <nl> - if self . use_protobuf_c_extension : <nl> - return [ ' tools / run_tests / performance / run_worker_php . sh - c ' ] <nl> + if self . php7_protobuf_c : <nl> + return [ ' tools / run_tests / performance / run_worker_php . sh - - use_protobuf_c_extension ' ] <nl> return [ ' tools / run_tests / performance / run_worker_php . sh ' ] <nl> <nl> def worker_port_offset ( self ) : <nl> + if self . php7_protobuf_c : <nl> + return 900 <nl> return 800 <nl> <nl> def scenarios ( self ) : <nl> - php_extension_mode = ' php_protobuf_php_extension ' <nl> - if self . use_protobuf_c_extension : <nl> - php_extension_mode = ' php_protobuf_c_extension ' <nl> + php7_extension_mode = ' php7_protobuf_php_extension ' <nl> + if self . php7_protobuf_c : <nl> + php7_extension_mode = ' php7_protobuf_c_extension ' <nl> <nl> yield _ping_pong_scenario ( <nl> - ' % s_to_cpp_protobuf_sync_unary_ping_pong ' % php_extension_mode , <nl> + ' % s_to_cpp_protobuf_sync_unary_ping_pong ' % php7_extension_mode , <nl> rpc_type = ' UNARY ' , client_type = ' SYNC_CLIENT ' , server_type = ' SYNC_SERVER ' , <nl> server_language = ' c + + ' , async_server_threads = 1 ) <nl> <nl> yield _ping_pong_scenario ( <nl> - ' % s_to_cpp_protobuf_sync_streaming_ping_pong ' % php_extension_mode , <nl> + ' % s_to_cpp_protobuf_sync_streaming_ping_pong ' % php7_extension_mode , <nl> rpc_type = ' STREAMING ' , client_type = ' SYNC_CLIENT ' , server_type = ' SYNC_SERVER ' , <nl> server_language = ' c + + ' , async_server_threads = 1 ) <nl> <nl> - def __str__ ( self ) : <nl> - return ' php ' <nl> + # TODO ( ddyihai ) : Investigate why when async_server_threads = 1 / CPU usage 340 % , the QPS performs <nl> + # better than async_server_threads = 0 / CPU usage 490 % . <nl> + yield _ping_pong_scenario ( <nl> + ' % s_to_cpp_protobuf_sync_unary_qps_unconstrained ' % php7_extension_mode , <nl> + rpc_type = ' UNARY ' , client_type = ' SYNC_CLIENT ' , server_type = ' ASYNC_SERVER ' , <nl> + server_language = ' c + + ' , outstanding = 1 , async_server_threads = 1 , unconstrained_client = ' sync ' ) <nl> <nl> + yield _ping_pong_scenario ( <nl> + ' % s_to_cpp_protobuf_sync_streaming_qps_unconstrained ' % php7_extension_mode , <nl> + rpc_type = ' STREAMING ' , client_type = ' SYNC_CLIENT ' , server_type = ' ASYNC_SERVER ' , <nl> + server_language = ' c + + ' , outstanding = 1 , async_server_threads = 1 , unconstrained_client = ' sync ' ) <nl> + <nl> + def __str__ ( self ) : <nl> + if self . php7_protobuf_c : <nl> + return ' php7_protobuf_c ' <nl> + return ' php7 ' <nl> <nl> class JavaLanguage : <nl> <nl> def __str__ ( self ) : <nl> ' node ' : NodeLanguage ( ) , <nl> ' node_express ' : NodeExpressLanguage ( ) , <nl> ' ruby ' : RubyLanguage ( ) , <nl> - ' php_protobuf_php ' : PhpLanguage ( ) , <nl> - ' php_protobuf_c ' : PhpLanguage ( use_protobuf_c_extension = True ) , <nl> + ' php7 ' : Php7Language ( ) , <nl> + ' php7_protobuf_c ' : Php7Language ( php7_protobuf_c = True ) , <nl> ' java ' : JavaLanguage ( ) , <nl> ' python ' : PythonLanguage ( ) , <nl> ' go ' : GoLanguage ( ) , <nl>
Merge pull request from ZhouyihaiDing / opt_php_benchmark
grpc/grpc
9078c82dcb9d4dbb419cb8bef92e083eead21ff6
2017-10-08T20:42:13Z
mmm a / lib / Migrator / overlay4 . json <nl> ppp b / lib / Migrator / overlay4 . json <nl> <nl> " DiffItemKind " : " SpecialCaseDiffItem " , <nl> " Usr " : " s : 5UIKit17UIApplicationMainys5Int32VAD_SpySpys4Int8VGGSgSSSgAJtF " , <nl> " SpecialCaseId " : " UIApplicationMain " <nl> - } <nl> + } , <nl> + { <nl> + " DiffItemKind " : " CommonDiffItem " , <nl> + " NodeKind " : " Function " , <nl> + " NodeAnnotation " : " Rename " , <nl> + " ChildIndex " : " 0 " , <nl> + " LeftUsr " : " s : SlsSQ7ElementRpzrlE5index2of5IndexQzSgAB_tF " , <nl> + " LeftComment " : " index " , <nl> + " RightUsr " : " " , <nl> + " RightComment " : " firstIndex " , <nl> + " ModuleName " : " Swift " <nl> + } , <nl> ] <nl> new file mode 100644 <nl> index 000000000000 . . 4fba3a9e3bf8 <nl> mmm / dev / null <nl> ppp b / test / Migrator / stdlib_rename . swift <nl> <nl> + / / REQUIRES : objc_interop <nl> + / / RUN : % empty - directory ( % t ) & & % target - swift - frontend - c - update - code - primary - file % s - F % S / mock - sdk - emit - migrated - file - path % t / stdlib_rename . swift . result - emit - remap - file - path % t / stdlib_rename . swift . remap - o / dev / null <nl> + / / RUN : diff - u % S / stdlib_rename . swift . expected % t / stdlib_rename . swift . result <nl> + <nl> + func test1 ( _ a : [ String ] , s : String ) { <nl> + _ = a . index ( of : s ) <nl> + } <nl> + func test2 ( _ s : String , c : Character ) { <nl> + _ = s . index ( of : c ) <nl> + } <nl> \ No newline at end of file <nl> new file mode 100644 <nl> index 000000000000 . . cb20dcdf27bb <nl> mmm / dev / null <nl> ppp b / test / Migrator / stdlib_rename . swift . expected <nl> <nl> + / / REQUIRES : objc_interop <nl> + / / RUN : % empty - directory ( % t ) & & % target - swift - frontend - c - update - code - primary - file % s - F % S / mock - sdk - emit - migrated - file - path % t / stdlib_rename . swift . result - emit - remap - file - path % t / stdlib_rename . swift . remap - o / dev / null <nl> + / / RUN : diff - u % S / stdlib_rename . swift . expected % t / stdlib_rename . swift . result <nl> + <nl> + func test1 ( _ a : [ String ] , s : String ) { <nl> + _ = a . firstIndex ( of : s ) <nl> + } <nl> + func test2 ( _ s : String , c : Character ) { <nl> + _ = s . firstIndex ( of : c ) <nl> + } <nl> \ No newline at end of file <nl>
Merge pull request from nkcsgexi / rename - index
apple/swift
c4bf8fd92e65a929fff41494c2f65e44c61e9d40
2018-12-18T18:53:40Z
mmm a / src / heap / mark - compact . cc <nl> ppp b / src / heap / mark - compact . cc <nl> bool MarkCompactCollector : : StartCompaction ( ) { <nl> if ( ! compacting_ ) { <nl> DCHECK ( evacuation_candidates_ . empty ( ) ) ; <nl> <nl> + if ( FLAG_gc_experiment_less_compaction & & ! heap_ - > ShouldReduceMemory ( ) ) <nl> + return false ; <nl> + <nl> CollectEvacuationCandidates ( heap ( ) - > old_space ( ) ) ; <nl> <nl> if ( FLAG_compact_code_space ) { <nl>
[ heap ] Experiment : only compact on memory reducing GCs .
v8/v8
f7abd6264b60b29de881155c9614cefddaa9ab7a
2019-06-27T11:42:29Z
mmm a / stdlib / core / ArrayBuffer . swift <nl> ppp b / stdlib / core / ArrayBuffer . swift <nl> extension _ArrayBuffer { <nl> _isBridgedToObjectiveC ( T . self ) , <nl> " Array element type is not bridged to ObjectiveC " ) <nl> <nl> - return _fastPath ( _isNative ) ? _native . _asCocoaArray ( ) : _nonNative ! <nl> + return _fastPath ( _isNative ) ? _native . _asCocoaArray ( ) : _nonNative <nl> } <nl> <nl> var _hasMutableBuffer : Bool { <nl> extension _ArrayBuffer { <nl> } <nl> } <nl> else if ! subRange . isEmpty { <nl> - let ns = _nonNative ! <nl> + let ns = _nonNative <nl> / / Could be sped up , e . g . by using <nl> / / enumerateObjectsAtIndexes : options : usingBlock : <nl> for i in subRange { <nl> extension _ArrayBuffer { <nl> return _native . _uninitializedCopy ( subRange , target : target ) <nl> } <nl> <nl> - let nonNative = _nonNative ! <nl> + let nonNative = _nonNative <nl> <nl> let nsSubRange = SwiftShims . _SwiftNSRange ( <nl> location : subRange . startIndex , <nl> extension _ArrayBuffer { <nl> return _native [ subRange ] <nl> } <nl> <nl> - let nonNative = self . _nonNative ! <nl> + let nonNative = self . _nonNative <nl> <nl> let subRangeCount = Swift . count ( subRange ) <nl> <nl> extension _ArrayBuffer { <nl> public <nl> var count : Int { <nl> get { <nl> - return _fastPath ( _isNative ) ? _native . count : _nonNative ! . count <nl> + return _fastPath ( _isNative ) ? _native . count : _nonNative . count <nl> } <nl> set { <nl> _sanityCheck ( _isNative , " attempting to update count of Cocoa array " ) <nl> extension _ArrayBuffer { <nl> / / / How many elements the buffer can store without reallocation <nl> public <nl> var capacity : Int { <nl> - return _fastPath ( _isNative ) ? _native . capacity : _nonNative ! . count <nl> + return _fastPath ( _isNative ) ? _native . capacity : _nonNative . count <nl> } <nl> <nl> / / / Get / set the value of the ith element <nl> extension _ArrayBuffer { <nl> if _fastPath ( _isNative ) { <nl> return _native [ i ] <nl> } <nl> - return unsafeBitCast ( _nonNative ! . objectAtIndex ( i ) , T . self ) <nl> + return unsafeBitCast ( _nonNative . objectAtIndex ( i ) , T . self ) <nl> } <nl> <nl> nonmutating set { <nl> extension _ArrayBuffer { <nl> body : ( UnsafeBufferPointer < Element > ) - > R <nl> ) - > R { <nl> if _isClassOrObjCExistential ( T . self ) { <nl> - if _nonNative ! = nil { <nl> + if ! _isNative { <nl> indirect . replaceStorage ( _copyCollectionToNativeArrayBuffer ( self ) ) <nl> } <nl> } <nl> extension _ArrayBuffer { <nl> / / / An object that keeps the elements stored in this buffer alive <nl> public <nl> var owner : AnyObject { <nl> - return _fastPath ( _isNative ) ? _native . _storage : _nonNative ! <nl> + return _fastPath ( _isNative ) ? _native . _storage : _nonNative <nl> } <nl> <nl> / / / A value that identifies the storage used by the buffer . Two <nl> extension _ArrayBuffer { <nl> if _isNative { <nl> return _native . identity <nl> } <nl> - else if let cocoa = _nonNative { <nl> - return unsafeAddressOf ( cocoa ) <nl> - } <nl> else { <nl> - return nil <nl> + return unsafeAddressOf ( _nonNative ) <nl> } <nl> } <nl> <nl> extension _ArrayBuffer { <nl> <nl> / / / Our native representation , if any . If there ' s no native <nl> / / / representation , the result is an empty buffer . <nl> - typealias _OptStorage = _ContiguousArrayStorage < T > ? <nl> var _native : NativeBuffer { <nl> if ! _isClassOrObjCExistential ( T . self ) { <nl> let s : _ContiguousArrayStorageBase = Builtin . castFromNativeObject ( storage ) <nl> extension _ArrayBuffer { <nl> } <nl> } <nl> <nl> - var _nonNative : _NSArrayCoreType ? { <nl> - if ! _isClassOrObjCExistential ( T . self ) { <nl> - return nil <nl> - } <nl> - else { <nl> - let i = indirect <nl> - return _fastPath ( ! i . isCocoa ) ? nil : i . getCocoa ( ) <nl> - } <nl> + var _nonNative : _NSArrayCoreType { <nl> + _sanityCheck ( _isClassOrObjCExistential ( T . self ) ) <nl> + let i = indirect <nl> + _sanityCheck ( i . isCocoa ) <nl> + return i . getCocoa ( ) <nl> } <nl> } <nl> <nl>
[ stdlib ] Array nil state elimination , part trois
apple/swift
5957b8bc3e773e2333249a8776aa628782ff7a4f
2014-10-28T21:32:27Z
mmm a / include / swift / AST / Expr . h <nl> ppp b / include / swift / AST / Expr . h <nl> class DefaultArgumentExpr final : public Expr { <nl> DefaultArgsOwner ( defaultArgsOwner ) , ParamIndex ( paramIndex ) , Loc ( loc ) , <nl> ContextOrCallerSideExpr ( dc ) { } <nl> <nl> - SourceRange getSourceRange ( ) const { <nl> - return Loc ; <nl> - } <nl> + SourceRange getSourceRange ( ) const { return { } ; } <nl> + <nl> + SourceLoc getArgumentListLoc ( ) const { return Loc ; } <nl> <nl> ConcreteDeclRef getDefaultArgsOwner ( ) const { <nl> return DefaultArgsOwner ; <nl> mmm a / lib / IDE / SyntaxModel . cpp <nl> ppp b / lib / IDE / SyntaxModel . cpp <nl> std : : pair < bool , Expr * > ModelASTWalker : : walkToExprPre ( Expr * E ) { <nl> return { false , E } ; <nl> <nl> auto addCallArgExpr = [ & ] ( Expr * Elem , TupleExpr * ParentTupleExpr ) { <nl> - if ( isCurrentCallArgExpr ( ParentTupleExpr ) ) { <nl> - CharSourceRange NR = parameterNameRangeOfCallArg ( ParentTupleExpr , Elem ) ; <nl> - SyntaxStructureNode SN ; <nl> - SN . Kind = SyntaxStructureKind : : Argument ; <nl> - SN . NameRange = NR ; <nl> - SN . BodyRange = charSourceRangeFromSourceRange ( SM , Elem - > getSourceRange ( ) ) ; <nl> - if ( NR . isValid ( ) ) { <nl> - SN . Range = charSourceRangeFromSourceRange ( SM , SourceRange ( NR . getStart ( ) , <nl> - Elem - > getEndLoc ( ) ) ) ; <nl> - passTokenNodesUntil ( NR . getStart ( ) , ExcludeNodeAtLocation ) ; <nl> - } <nl> - else <nl> - SN . Range = SN . BodyRange ; <nl> + if ( isa < DefaultArgumentExpr > ( Elem ) | | <nl> + ! isCurrentCallArgExpr ( ParentTupleExpr ) ) <nl> + return ; <nl> <nl> - pushStructureNode ( SN , Elem ) ; <nl> + CharSourceRange NR = parameterNameRangeOfCallArg ( ParentTupleExpr , Elem ) ; <nl> + SyntaxStructureNode SN ; <nl> + SN . Kind = SyntaxStructureKind : : Argument ; <nl> + SN . NameRange = NR ; <nl> + SN . BodyRange = charSourceRangeFromSourceRange ( SM , Elem - > getSourceRange ( ) ) ; <nl> + if ( NR . isValid ( ) ) { <nl> + SN . Range = charSourceRangeFromSourceRange ( SM , SourceRange ( NR . getStart ( ) , <nl> + Elem - > getEndLoc ( ) ) ) ; <nl> + passTokenNodesUntil ( NR . getStart ( ) , ExcludeNodeAtLocation ) ; <nl> } <nl> + else <nl> + SN . Range = SN . BodyRange ; <nl> + <nl> + pushStructureNode ( SN , Elem ) ; <nl> } ; <nl> <nl> if ( auto * ParentTupleExpr = dyn_cast_or_null < TupleExpr > ( Parent . getAsExpr ( ) ) ) { <nl> mmm a / lib / Sema / CSApply . cpp <nl> ppp b / lib / Sema / CSApply . cpp <nl> Expr * ExprRewriter : : coerceCallArguments ( Expr * arg , AnyFunctionType * funcType , <nl> / / We already had a ParenExpr , so replace it ' s sub - expression . <nl> argParen - > setSubExpr ( newArgs [ 0 ] ) ; <nl> } else { <nl> + bool isImplicit = arg - > isImplicit ( ) ; <nl> arg = new ( ctx ) <nl> ParenExpr ( lParenLoc , newArgs [ 0 ] , rParenLoc , hasTrailingClosure ) ; <nl> - arg - > setImplicit ( ) ; <nl> + arg - > setImplicit ( isImplicit ) ; <nl> } <nl> } else { <nl> assert ( isa < TupleType > ( paramType . getPointer ( ) ) ) ; <nl> Expr * ExprRewriter : : coerceCallArguments ( Expr * arg , AnyFunctionType * funcType , <nl> / / Build a new TupleExpr , re - using source location information . <nl> arg = TupleExpr : : create ( ctx , lParenLoc , newArgs , newLabels , newLabelLocs , <nl> rParenLoc , hasTrailingClosure , <nl> - / * implicit = * / true ) ; <nl> + / * implicit = * / arg - > isImplicit ( ) ) ; <nl> } <nl> } <nl> <nl> mmm a / lib / Sema / TypeCheckExpr . cpp <nl> ppp b / lib / Sema / TypeCheckExpr . cpp <nl> Expr * CallerSideDefaultArgExprRequest : : evaluate ( <nl> auto paramTy = defaultExpr - > getType ( ) ; <nl> <nl> / / Re - create the default argument using the location info of the call site . <nl> - auto * initExpr = synthesizeCallerSideDefault ( param , defaultExpr - > getLoc ( ) ) ; <nl> + auto * initExpr = <nl> + synthesizeCallerSideDefault ( param , defaultExpr - > getArgumentListLoc ( ) ) ; <nl> auto * dc = defaultExpr - > ContextOrCallerSideExpr . get < DeclContext * > ( ) ; <nl> assert ( dc & & " Expected a DeclContext before type - checking caller - side arg " ) ; <nl> <nl> mmm a / test / SourceKit / Refactoring / basic . swift <nl> ppp b / test / SourceKit / Refactoring / basic . swift <nl> struct TestDefaultedParen { <nl> <nl> TestDefaultedParen . init ( ) <nl> <nl> + struct HasInitWithDefaultArgs { <nl> + init ( x : Int = 10 , y : Int = 20 , z : Int = 10 ) <nl> + } <nl> + <nl> + HasInitWithDefaultArgs ( z : 45 ) <nl> + HasInitWithDefaultArgs ( y : 45 , z : 89 ) <nl> + <nl> / / RUN : % sourcekitd - test - req = cursor - pos = 3 : 1 - end - pos = 5 : 13 - cursor - action % s - - % s | % FileCheck % s - check - prefix = CHECK1 <nl> <nl> / / CHECK1 : ACTIONS BEGIN <nl> TestDefaultedParen . init ( ) <nl> <nl> / / RUN : % sourcekitd - test - req = cursor - pos = 107 : 20 - cursor - action % s - - % s | % FileCheck % s - check - prefix = CHECK - NORENAME <nl> <nl> + / / RUN : % sourcekitd - test - req = cursor - pos = 113 : 24 - cursor - action % s - - % s | % FileCheck % s - check - prefix = CHECK - GLOBAL <nl> + / / RUN : % sourcekitd - test - req = cursor - pos = 114 : 24 - cursor - action % s - - % s | % FileCheck % s - check - prefix = CHECK - GLOBAL <nl> + / / RUN : % sourcekitd - test - req = cursor - pos = 114 : 31 - cursor - action % s - - % s | % FileCheck % s - check - prefix = CHECK - GLOBAL <nl> + / / RUN : % sourcekitd - test - req = cursor - pos = 114 : 31 - cursor - action % s - - % s | % FileCheck % s - check - prefix = CHECK - GLOBAL <nl> + <nl> / / RUN : % sourcekitd - test - req = cursor - pos = 35 : 10 - end - pos = 35 : 16 - cursor - action % s - - % s | % FileCheck % s - check - prefix = CHECK - RENAME - EXTRACT <nl> / / RUN : % sourcekitd - test - req = cursor - pos = 35 : 10 - end - pos = 35 : 16 - cursor - action % s - - % s | % FileCheck % s - check - prefix = CHECK - RENAME - EXTRACT <nl> <nl>
[ Sema ] Maintain the implicitness of call argument tuple / parens in coerceCallArguments
apple/swift
7c0a17803dc019aec639b718c87cce23cbf6c0d9
2020-04-24T01:54:46Z
mmm a / UnitTests / HttpInterface / api - replication - spec . rb <nl> ppp b / UnitTests / HttpInterface / api - replication - spec . rb <nl> <nl> it " fetches a create collection action from the follow log " do <nl> ArangoDB . drop_collection ( " UnitTestsReplication " ) <nl> <nl> - sleep 1 <nl> + sleep 5 <nl> <nl> cmd = api + " / logger - state " <nl> doc = ArangoDB . log_get ( " # { prefix } - follow - create - collection " , cmd , : body = > " " ) <nl> <nl> <nl> cid = ArangoDB . create_collection ( " UnitTestsReplication " ) <nl> <nl> - sleep 1 <nl> + sleep 5 <nl> + <nl> cmd = api + " / logger - follow ? from = " + fromTick <nl> doc = ArangoDB . log_get ( " # { prefix } - follow - create - collection " , cmd , : body = > " " , : format = > : plain ) <nl> doc . code . should eq ( 200 ) <nl> <nl> it " fetches some collection operations from the follow log " do <nl> ArangoDB . drop_collection ( " UnitTestsReplication " ) <nl> <nl> - sleep 1 <nl> + sleep 5 <nl> <nl> cmd = api + " / logger - state " <nl> doc = ArangoDB . log_get ( " # { prefix } - follow - collection " , cmd , : body = > " " ) <nl> <nl> doc = ArangoDB . log_delete ( " # { prefix } - follow - collection " , cmd ) <nl> doc . code . should eq ( 200 ) <nl> <nl> - sleep 1 <nl> + sleep 5 <nl> <nl> cmd = api + " / logger - follow ? from = " + fromTick <nl> doc = ArangoDB . log_get ( " # { prefix } - follow - create - collection " , cmd , : body = > " " , : format = > : plain ) <nl>
raised sleep
arangodb/arangodb
0f88ade5680c656e94925ddaa300495c34352264
2016-02-13T20:36:51Z
mmm a / ports / dlib / CONTROL <nl> ppp b / ports / dlib / CONTROL <nl> <nl> Source : dlib <nl> - Version : 19 . 16 <nl> + Version : 19 . 16 - 1 <nl> Build - Depends : libjpeg - turbo , libpng , sqlite3 , fftw3 , openblas , clapack <nl> Description : Modern C + + toolkit containing machine learning algorithms and tools for creating complex software in C + + <nl> <nl> new file mode 100644 <nl> index 00000000000 . . 5f961264bf6 <nl> mmm / dev / null <nl> ppp b / ports / dlib / fix - mac - jpeg . patch <nl> <nl> + + mmm a / dlib / CMakeLists . txt <nl> ppp + b / dlib / CMakeLists . txt <nl> + <nl> + set ( CMAKE_REQUIRED_LIBRARIES $ { JPEG_LIBRARY } ) <nl> + CHECK_FUNCTION_EXISTS ( jpeg_read_header LIBJPEG_IS_GOOD ) <nl> + endif ( ) <nl> + - if ( JPEG_FOUND AND LIBJPEG_IS_GOOD AND NOT APPLE ) <nl> + + if ( JPEG_FOUND AND LIBJPEG_IS_GOOD ) <nl> + include_directories ( $ { JPEG_INCLUDE_DIR } ) <nl> + set ( dlib_needed_libraries $ { dlib_needed_libraries } $ { JPEG_LIBRARY } ) <nl> + else ( ) <nl> new file mode 100644 <nl> index 00000000000 . . 84ab0c26535 <nl> mmm / dev / null <nl> ppp b / ports / dlib / fix - sqlite3 - fftw - linkage . patch <nl> <nl> + diff - - git a / dlib / CMakeLists . txt b / dlib / CMakeLists . txt <nl> + mmm a / dlib / CMakeLists . txt <nl> ppp + b / dlib / CMakeLists . txt <nl> + <nl> + <nl> + <nl> + if ( DLIB_LINK_WITH_SQLITE3 ) <nl> + - find_library ( sqlite sqlite3 ) <nl> + - # make sure sqlite3 . h is in the include path <nl> + - find_path ( sqlite_path sqlite3 . h ) <nl> + - if ( sqlite AND sqlite_path ) <nl> + - set ( dlib_needed_includes $ { dlib_needed_includes } $ { sqlite_path } ) <nl> + - set ( dlib_needed_libraries $ { dlib_needed_libraries } $ { sqlite } ) <nl> + - else ( ) <nl> + - set ( DLIB_LINK_WITH_SQLITE3 OFF CACHE STRING $ { DLIB_LINK_WITH_SQLITE3_STR } FORCE ) <nl> + - endif ( ) <nl> + - mark_as_advanced ( sqlite sqlite_path ) <nl> + + find_package ( sqlite3 CONFIG ) <nl> + + set ( dlib_needed_libraries $ { dlib_needed_libraries } sqlite3 ) <nl> + endif ( ) <nl> + <nl> + <nl> + <nl> + if ( DLIB_USE_FFTW ) <nl> + - find_library ( fftw fftw3 ) <nl> + - # make sure fftw3 . h is in the include path <nl> + - find_path ( fftw_path fftw3 . h ) <nl> + - if ( fftw AND fftw_path ) <nl> + - set ( dlib_needed_includes $ { dlib_needed_includes } $ { fftw_path } ) <nl> + - set ( dlib_needed_libraries $ { dlib_needed_libraries } $ { fftw } ) <nl> + - else ( ) <nl> + - set ( DLIB_USE_FFTW OFF CACHE STRING $ { DLIB_USE_FFTW_STR } FORCE ) <nl> + - toggle_preprocessor_switch ( DLIB_USE_FFTW ) <nl> + - endif ( ) <nl> + - mark_as_advanced ( fftw fftw_path ) <nl> + + find_package ( FFTW3 CONFIG ) <nl> + + set ( dlib_needed_libraries $ { dlib_needed_libraries } FFTW3 : : fftw3 ) <nl> + endif ( ) <nl> + <nl> + <nl> + mmm a / dlib / cmake_utils / dlibConfig . cmake . in <nl> ppp + b / dlib / cmake_utils / dlibConfig . cmake . in <nl> + <nl> + include ( " $ { dlib_CMAKE_DIR } / dlib . cmake " ) <nl> + endif ( ) <nl> + <nl> + + include ( CMakeFindDependencyMacro ) <nl> + + if ( " @ DLIB_USE_FFTW @ " ) <nl> + + find_dependency ( FFTW3 CONFIG ) <nl> + + endif ( ) <nl> + + if ( " @ DLIB_LINK_WITH_SQLITE3 @ " ) <nl> + + find_dependency ( sqlite3 CONFIG ) <nl> + + endif ( ) <nl> + + <nl> + set ( dlib_LIBRARIES dlib : : dlib ) <nl> + set ( dlib_LIBS dlib : : dlib ) <nl> + set ( dlib_INCLUDE_DIRS " @ CMAKE_INSTALL_FULL_INCLUDEDIR @ " " @ dlib_needed_includes @ " ) <nl> mmm a / ports / dlib / portfile . cmake <nl> ppp b / ports / dlib / portfile . cmake <nl> vcpkg_from_github ( <nl> REF v19 . 16 <nl> SHA512 4e040ef88acff05e1a48e499b813c876b22ad3f989d076bdf19969d01036b62e51a0dff30b70046910ba31dfa1b1c2450a7fad41ae3142b7285ed74b8d584887 <nl> HEAD_REF master <nl> + PATCHES <nl> + fix - mac - jpeg . patch <nl> + fix - sqlite3 - fftw - linkage . patch <nl> ) <nl> <nl> file ( REMOVE_RECURSE $ { SOURCE_PATH } / dlib / external / libjpeg ) <nl> vcpkg_configure_cmake ( <nl> - DDLIB_USE_CUDA = $ { WITH_CUDA } <nl> - DDLIB_GIF_SUPPORT = OFF <nl> - DDLIB_USE_MKL_FFT = OFF <nl> + - DCMAKE_DEBUG_POSTFIX = d <nl> OPTIONS_DEBUG <nl> - DDLIB_ENABLE_ASSERTS = ON <nl> # - DDLIB_ENABLE_STACK_TRACE = ON <nl>
[ dlib ] fix mac , windows - static build ( )
microsoft/vcpkg
ddf0043e94395c4cfdb633a5ceaa07d2016500fe
2019-02-28T07:52:31Z
mmm a / drivers / gles3 / rasterizer_scene_gles3 . cpp <nl> ppp b / drivers / gles3 / rasterizer_scene_gles3 . cpp <nl> void RasterizerSceneGLES3 : : _draw_sky ( RasterizerStorageGLES3 : : Sky * p_sky , const C <nl> <nl> ERR_FAIL_COND ( ! tex ) ; <nl> glActiveTexture ( GL_TEXTURE0 ) ; <nl> - glBindTexture ( tex - > target , tex - > tex_id ) ; <nl> + <nl> + if ( tex - > proxy & & tex - > proxy - > tex_id ) <nl> + glBindTexture ( tex - > target , tex - > proxy - > tex_id ) ; <nl> + else <nl> + glBindTexture ( tex - > target , tex - > tex_id ) ; <nl> <nl> if ( storage - > config . srgb_decode_supported & & tex - > srgb & & ! tex - > using_srgb ) { <nl> <nl>
Fix binding of ViewportTexture to Sky
godotengine/godot
deca3f18b777f1e3a71f8cb12c5f5fa329aa70cd
2018-04-12T20:51:35Z
mmm a / scripts / cpplint . py <nl> ppp b / scripts / cpplint . py <nl> <nl> <nl> _regexp_compile_cache = { } <nl> <nl> - # Finds occurrences of NOLINT or NOLINT ( . . . ) . <nl> - _RE_SUPPRESSION = re . compile ( r ' \ bNOLINT \ b ( \ ( [ ^ ) ] * \ ) ) ? ' ) <nl> + # Finds occurrences of NOLINT [ _NEXTLINE ] or NOLINT [ _NEXTLINE ] ( . . . ) . <nl> + _RE_SUPPRESSION = re . compile ( r ' \ bNOLINT ( _NEXTLINE ) ? \ b ( \ ( [ ^ ) ] * \ ) ) ? ' ) <nl> <nl> # { str , set ( int ) } : a map from error categories to sets of linenumbers <nl> # on which those errors are expected and should be suppressed . <nl> def ParseNolintSuppressions ( filename , raw_line , linenum , error ) : <nl> # FIXME ( adonovan ) : " NOLINT ( " is misparsed as NOLINT ( * ) . <nl> matched = _RE_SUPPRESSION . search ( raw_line ) <nl> if matched : <nl> - category = matched . group ( 1 ) <nl> + if matched . group ( 1 ) = = ' _NEXTLINE ' : <nl> + linenum + = 1 <nl> + category = matched . group ( 2 ) <nl> if category in ( None , ' ( * ) ' ) : # = > " suppress all " <nl> _error_suppressions . setdefault ( None , set ( ) ) . add ( linenum ) <nl> else : <nl>
add NOLINT_NEXTLINE to suppress linter errors on nextline
BVLC/caffe
b065ae215a95cf9ec87dc51007b738977cd799bd
2014-02-26T23:42:38Z
mmm a / modules / videoio / cmake / plugin . cmake <nl> ppp b / modules / videoio / cmake / plugin . cmake <nl> function ( ocv_create_builtin_videoio_plugin name target ) <nl> <nl> foreach ( mod opencv_videoio opencv_core opencv_imgproc opencv_imgcodecs ) <nl> ocv_target_link_libraries ( $ { name } LINK_PRIVATE $ { mod } ) <nl> - ocv_target_include_directories ( $ { name } PRIVATE " $ { OPENCV_MODULE_ $ { mod } _LOCATION } / include " ) <nl> + ocv_target_include_directories ( $ { name } " $ { OPENCV_MODULE_ $ { mod } _LOCATION } / include " ) <nl> endforeach ( ) <nl> <nl> if ( WIN32 ) <nl> mmm a / modules / videoio / src / precomp . hpp <nl> ppp b / modules / videoio / src / precomp . hpp <nl> <nl> # ifndef __VIDEOIO_H_ <nl> # define __VIDEOIO_H_ <nl> <nl> + # if defined ( __OPENCV_BUILD ) & & defined ( BUILD_PLUGIN ) <nl> + # undef __OPENCV_BUILD / / allow public API only <nl> + # include < opencv2 / core . hpp > <nl> + # include < opencv2 / core / utils / trace . hpp > <nl> + # endif <nl> + <nl> # if defined __linux__ | | defined __APPLE__ | | defined __HAIKU__ <nl> # include < unistd . h > / / - D_FORTIFY_SOURCE = 2 workaround : https : / / github . com / opencv / opencv / issues / 15020 <nl> # endif <nl>
Merge pull request from alalek : fix_build_videoio_plugins_with_enabled_eigen
opencv/opencv
4419f4093e4c59ae1f42956155559a434e40c1bf
2020-09-25T19:51:04Z
mmm a / cocos / platform / winrt / InputEvent . cpp <nl> ppp b / cocos / platform / winrt / InputEvent . cpp <nl> void BackButtonEvent : : execute ( ) <nl> GLViewImpl : : sharedOpenGLView ( ) - > OnBackKeyPress ( ) ; <nl> } <nl> <nl> + CustomInputEvent : : CustomInputEvent ( const std : : function < void ( ) > & fun ) <nl> + : m_fun ( fun ) <nl> + { <nl> + } <nl> + void CustomInputEvent : : execute ( ) <nl> + { <nl> + m_fun ( ) ; <nl> + } <nl> + <nl> + <nl> <nl> NS_CC_END <nl> <nl> mmm a / cocos / platform / winrt / InputEvent . h <nl> ppp b / cocos / platform / winrt / InputEvent . h <nl> class BackButtonEvent : public InputEvent <nl> virtual void execute ( ) ; <nl> } ; <nl> <nl> + class CustomInputEvent : public InputEvent <nl> + { <nl> + public : <nl> + CustomInputEvent ( const std : : function < void ( ) > & ) ; <nl> + virtual void execute ( ) ; <nl> + private : <nl> + std : : function < void ( ) > m_fun ; <nl> + } ; <nl> + <nl> NS_CC_END <nl> <nl> # endif / / # ifndef __INPUT_EVENT__ <nl> mmm a / cocos / platform / wp8 - xaml / cpp / Direct3DInterop . cpp <nl> ppp b / cocos / platform / wp8 - xaml / cpp / Direct3DInterop . cpp <nl> void Direct3DInterop : : OnPointerReleased ( DrawingSurfaceManipulationHost ^ sender , <nl> cocos2d : : GLViewImpl : : sharedOpenGLView ( ) - > QueuePointerEvent ( cocos2d : : PointerEventType : : PointerReleased , args ) ; <nl> } <nl> <nl> + void Direct3DInterop : : OnOrientationChanged ( Windows : : Graphics : : Display : : DisplayOrientations orientation ) <nl> + { <nl> + std : : shared_ptr < cocos2d : : InputEvent > e ( new cocos2d : : CustomInputEvent ( [ this , orientation ] ( ) <nl> + { <nl> + m_renderer - > OnOrientationChanged ( orientation ) ; <nl> + } ) ) ; <nl> + cocos2d : : GLViewImpl : : sharedOpenGLView ( ) - > QueueEvent ( e ) ; <nl> + } <nl> + <nl> void Direct3DInterop : : OnCocos2dKeyEvent ( Cocos2dKeyEvent key ) <nl> { <nl> std : : shared_ptr < cocos2d : : InputEvent > e ( new cocos2d : : KeyboardEvent ( key ) ) ; <nl> HRESULT Direct3DInterop : : PrepareResources ( _In_ const LARGE_INTEGER * presentTarge <nl> HRESULT Direct3DInterop : : Draw ( _In_ ID3D11Device1 * device , _In_ ID3D11DeviceContext1 * context , _In_ ID3D11RenderTargetView * renderTargetView ) <nl> { <nl> m_renderer - > UpdateDevice ( device , context , renderTargetView ) ; <nl> - # if 0 <nl> - if ( mCurrentOrientation ! = WindowOrientation ) <nl> - { <nl> - mCurrentOrientation = WindowOrientation ; <nl> - m_renderer - > OnOrientationChanged ( mCurrentOrientation ) ; <nl> - } <nl> - # endif / / 0 <nl> <nl> cocos2d : : GLViewImpl : : sharedOpenGLView ( ) - > ProcessEvents ( ) ; <nl> m_renderer - > Render ( ) ; <nl> mmm a / cocos / platform / wp8 - xaml / cpp / Direct3DInterop . h <nl> ppp b / cocos / platform / wp8 - xaml / cpp / Direct3DInterop . h <nl> public ref class Direct3DInterop sealed : public Windows : : Phone : : Input : : Interop : <nl> void OnCocos2dKeyEvent ( Cocos2dKeyEvent key ) ; <nl> void OnCocos2dKeyEvent ( Cocos2dKeyEvent key , Platform : : String ^ text ) ; <nl> void OnCocos2dEditboxEvent ( Platform : : Object ^ sender , Platform : : String ^ args , Windows : : Foundation : : EventHandler < Platform : : String ^ > ^ handler ) ; <nl> + void OnOrientationChanged ( Windows : : Graphics : : Display : : DisplayOrientations orientation ) ; <nl> void OnCocos2dOpenURL ( Platform : : String ^ url ) ; <nl> <nl> property Windows : : Graphics : : Display : : DisplayOrientations WindowOrientation ; <nl> mmm a / cocos / platform / wp8 - xaml / xaml / MainPage . xaml . cs <nl> ppp b / cocos / platform / wp8 - xaml / xaml / MainPage . xaml . cs <nl> public MainPage ( ) <nl> # endif <nl> } <nl> <nl> + override protected void OnOrientationChanged ( OrientationChangedEventArgs args ) <nl> + { <nl> + base . OnOrientationChanged ( args ) ; <nl> + if ( m_d3dInterop ! = null ) <nl> + { <nl> + DisplayOrientations orientation = ConvertToNativeOrientation ( args . Orientation ) ; <nl> + m_d3dInterop . OnOrientationChanged ( orientation ) ; <nl> + } <nl> + } <nl> + <nl> + private static DisplayOrientations ConvertToNativeOrientation ( PageOrientation xamlOrientation ) <nl> + { <nl> + switch ( xamlOrientation ) <nl> + { <nl> + case PageOrientation . Portrait : <nl> + case PageOrientation . PortraitUp : <nl> + return DisplayOrientations . Portrait ; <nl> + case PageOrientation . PortraitDown : <nl> + return DisplayOrientations . PortraitFlipped ; <nl> + case PageOrientation . Landscape : <nl> + case PageOrientation . LandscapeLeft : <nl> + return DisplayOrientations . Landscape ; <nl> + case PageOrientation . LandscapeRight : <nl> + return DisplayOrientations . LandscapeFlipped ; <nl> + default : <nl> + return DisplayOrientations . Landscape ; <nl> + } <nl> + } <nl> + <nl> private void DrawingSurfaceBackground_Loaded ( object sender , RoutedEventArgs e ) <nl> { <nl> if ( m_d3dInterop = = null ) <nl> { <nl> PageOrientation pageOrientation = ( PageOrientation ) GetValue ( OrientationProperty ) ; <nl> - DisplayOrientations displayOrientation ; <nl> + DisplayOrientations displayOrientation = ConvertToNativeOrientation ( pageOrientation ) ; <nl> <nl> - switch ( pageOrientation ) <nl> - { <nl> - case PageOrientation . Portrait : <nl> - case PageOrientation . PortraitUp : <nl> - displayOrientation = DisplayOrientations . Portrait ; <nl> - break ; <nl> - case PageOrientation . PortraitDown : <nl> - displayOrientation = DisplayOrientations . PortraitFlipped ; <nl> - break ; <nl> - case PageOrientation . Landscape : <nl> - case PageOrientation . LandscapeLeft : <nl> - displayOrientation = DisplayOrientations . Landscape ; <nl> - break ; <nl> - case PageOrientation . LandscapeRight : <nl> - displayOrientation = DisplayOrientations . LandscapeFlipped ; <nl> - break ; <nl> - default : <nl> - displayOrientation = DisplayOrientations . Landscape ; <nl> - break ; <nl> - } <nl> m_d3dInterop = new Direct3DInterop ( displayOrientation ) ; <nl> <nl> / / Set WindowBounds to size of DrawingSurface <nl> mmm a / templates / cpp - template - default / proj . wp8 - xaml / App / MainPage . xaml . cs <nl> ppp b / templates / cpp - template - default / proj . wp8 - xaml / App / MainPage . xaml . cs <nl> public MainPage ( ) <nl> # endif <nl> } <nl> <nl> + override protected void OnOrientationChanged ( OrientationChangedEventArgs args ) <nl> + { <nl> + base . OnOrientationChanged ( args ) ; <nl> + if ( m_d3dInterop ! = null ) <nl> + { <nl> + DisplayOrientations orientation = ConvertToNativeOrientation ( args . Orientation ) ; <nl> + m_d3dInterop . OnOrientationChanged ( orientation ) ; <nl> + } <nl> + } <nl> + <nl> + private static DisplayOrientations ConvertToNativeOrientation ( PageOrientation xamlOrientation ) <nl> + { <nl> + switch ( xamlOrientation ) <nl> + { <nl> + case PageOrientation . Portrait : <nl> + case PageOrientation . PortraitUp : <nl> + return DisplayOrientations . Portrait ; <nl> + case PageOrientation . PortraitDown : <nl> + return DisplayOrientations . PortraitFlipped ; <nl> + case PageOrientation . Landscape : <nl> + case PageOrientation . LandscapeLeft : <nl> + return DisplayOrientations . Landscape ; <nl> + case PageOrientation . LandscapeRight : <nl> + return DisplayOrientations . LandscapeFlipped ; <nl> + default : <nl> + return DisplayOrientations . Landscape ; <nl> + } <nl> + } <nl> + <nl> private void DrawingSurfaceBackground_Loaded ( object sender , RoutedEventArgs e ) <nl> { <nl> if ( m_d3dInterop = = null ) <nl> { <nl> PageOrientation pageOrientation = ( PageOrientation ) GetValue ( OrientationProperty ) ; <nl> - DisplayOrientations displayOrientation ; <nl> + DisplayOrientations displayOrientation = ConvertToNativeOrientation ( pageOrientation ) ; <nl> <nl> - switch ( pageOrientation ) <nl> - { <nl> - case PageOrientation . Portrait : <nl> - case PageOrientation . PortraitUp : <nl> - displayOrientation = DisplayOrientations . Portrait ; <nl> - break ; <nl> - case PageOrientation . PortraitDown : <nl> - displayOrientation = DisplayOrientations . PortraitFlipped ; <nl> - break ; <nl> - case PageOrientation . Landscape : <nl> - case PageOrientation . LandscapeLeft : <nl> - displayOrientation = DisplayOrientations . Landscape ; <nl> - break ; <nl> - case PageOrientation . LandscapeRight : <nl> - displayOrientation = DisplayOrientations . LandscapeFlipped ; <nl> - break ; <nl> - default : <nl> - displayOrientation = DisplayOrientations . Landscape ; <nl> - break ; <nl> - } <nl> m_d3dInterop = new Direct3DInterop ( displayOrientation ) ; <nl> <nl> / / Set WindowBounds to size of DrawingSurface <nl> mmm a / templates / cpp - template - default / proj . wp8 - xaml / AppComponent / src / Direct3DInterop . cpp <nl> ppp b / templates / cpp - template - default / proj . wp8 - xaml / AppComponent / src / Direct3DInterop . cpp <nl> void Direct3DInterop : : OnPointerReleased ( DrawingSurfaceManipulationHost ^ sender , <nl> cocos2d : : GLViewImpl : : sharedOpenGLView ( ) - > QueuePointerEvent ( cocos2d : : PointerEventType : : PointerReleased , args ) ; <nl> } <nl> <nl> + void Direct3DInterop : : OnOrientationChanged ( Windows : : Graphics : : Display : : DisplayOrientations orientation ) <nl> + { <nl> + std : : shared_ptr < cocos2d : : InputEvent > e ( new cocos2d : : CustomInputEvent ( [ this , orientation ] ( ) <nl> + { <nl> + m_renderer - > OnOrientationChanged ( orientation ) ; <nl> + } ) ) ; <nl> + cocos2d : : GLViewImpl : : sharedOpenGLView ( ) - > QueueEvent ( e ) ; <nl> + } <nl> + <nl> void Direct3DInterop : : OnCocos2dKeyEvent ( Cocos2dKeyEvent key ) <nl> { <nl> std : : shared_ptr < cocos2d : : InputEvent > e ( new cocos2d : : KeyboardEvent ( key ) ) ; <nl> HRESULT Direct3DInterop : : PrepareResources ( _In_ const LARGE_INTEGER * presentTarge <nl> HRESULT Direct3DInterop : : Draw ( _In_ ID3D11Device1 * device , _In_ ID3D11DeviceContext1 * context , _In_ ID3D11RenderTargetView * renderTargetView ) <nl> { <nl> m_renderer - > UpdateDevice ( device , context , renderTargetView ) ; <nl> - # if 0 <nl> - if ( mCurrentOrientation ! = WindowOrientation ) <nl> - { <nl> - mCurrentOrientation = WindowOrientation ; <nl> - m_renderer - > OnOrientationChanged ( mCurrentOrientation ) ; <nl> - } <nl> - # endif / / 0 <nl> <nl> cocos2d : : GLViewImpl : : sharedOpenGLView ( ) - > ProcessEvents ( ) ; <nl> m_renderer - > Render ( ) ; <nl> void Direct3DInterop : : SetCocos2dOpenURLDelegate ( Cocos2dOpenURLDelegate ^ delegat <nl> <nl> bool Direct3DInterop : : SendCocos2dEvent ( Cocos2dEvent event ) <nl> { <nl> - std : : string str ; <nl> + Platform : : String ^ str ; <nl> if ( m_delegate ) <nl> { <nl> - m_delegate - > Invoke ( event , stringToPlatformString ( str ) ) ; <nl> + m_delegate - > Invoke ( event , str ) ; <nl> return true ; <nl> } <nl> return false ; <nl> mmm a / templates / cpp - template - default / proj . wp8 - xaml / AppComponent / src / Direct3DInterop . h <nl> ppp b / templates / cpp - template - default / proj . wp8 - xaml / AppComponent / src / Direct3DInterop . h <nl> public ref class Direct3DInterop sealed : public Windows : : Phone : : Input : : Interop : <nl> void OnCocos2dKeyEvent ( Cocos2dKeyEvent key ) ; <nl> void OnCocos2dKeyEvent ( Cocos2dKeyEvent key , Platform : : String ^ text ) ; <nl> void OnCocos2dEditboxEvent ( Platform : : Object ^ sender , Platform : : String ^ args , Windows : : Foundation : : EventHandler < Platform : : String ^ > ^ handler ) ; <nl> + void OnOrientationChanged ( Windows : : Graphics : : Display : : DisplayOrientations orientation ) ; <nl> void OnCocos2dOpenURL ( Platform : : String ^ url ) ; <nl> <nl> property Windows : : Graphics : : Display : : DisplayOrientations WindowOrientation ; <nl>
Enable screen orientation change handling - by Teivaz
cocos2d/cocos2d-x
7a2a44ad8838ebb39a8a7684e3a1778e66ab1f52
2014-09-26T08:16:34Z
mmm a / source / common / common / BUILD <nl> ppp b / source / common / common / BUILD <nl> envoy_cc_library ( <nl> deps = [ " : minimal_logger_lib " ] , <nl> ) <nl> <nl> + envoy_cc_library ( <nl> + name = " debug_recursion_checker_lib " , <nl> + hdrs = [ " debug_recursion_checker . h " ] , <nl> + deps = [ " : assert_lib " ] , <nl> + ) <nl> + <nl> envoy_cc_library ( <nl> name = " backoff_lib " , <nl> srcs = [ " backoff_strategy . cc " ] , <nl> new file mode 100644 <nl> index 00000000000 . . e2ab275ca21 <nl> mmm / dev / null <nl> ppp b / source / common / common / debug_recursion_checker . h <nl> <nl> + # pragma once <nl> + <nl> + # include " common / common / assert . h " <nl> + <nl> + namespace Envoy { <nl> + namespace Common { <nl> + / * * <nl> + * A helper class to assert that a call is not recursive . <nl> + * / <nl> + class DebugRecursionChecker { <nl> + public : <nl> + void enter ( ) { <nl> + ASSERT ( ! entered_ , " A resource should only be entered once " ) ; <nl> + # if ! defined ( NDEBUG ) <nl> + entered_ = true ; <nl> + # endif / / ! defined ( NDEBUG ) <nl> + } <nl> + <nl> + void exit ( ) { <nl> + # if ! defined ( NDEBUG ) <nl> + entered_ = false ; <nl> + # endif / / ! defined ( NDEBUG ) <nl> + } <nl> + <nl> + private : <nl> + bool entered_ = false ; <nl> + } ; <nl> + <nl> + class AutoDebugRecursionChecker { <nl> + public : <nl> + explicit AutoDebugRecursionChecker ( DebugRecursionChecker & checker ) : checker_ ( checker ) { <nl> + checker . enter ( ) ; <nl> + } <nl> + <nl> + ~ AutoDebugRecursionChecker ( ) { checker_ . exit ( ) ; } <nl> + <nl> + private : <nl> + DebugRecursionChecker & checker_ ; <nl> + } ; <nl> + <nl> + } / / namespace Common <nl> + } / / namespace Envoy <nl> mmm a / source / common / upstream / BUILD <nl> ppp b / source / common / upstream / BUILD <nl> envoy_cc_library ( <nl> " / / source / common / protobuf : utility_lib " , <nl> " / / source / common / router : shadow_writer_lib " , <nl> " / / source / common / tcp : conn_pool_lib " , <nl> + " / / source / common / upstream : conn_pool_map " , <nl> + " / / source / common / upstream : conn_pool_map_impl_lib " , <nl> " / / source / common / upstream : upstream_lib " , <nl> " @ envoy_api / / envoy / admin / v2alpha : config_dump_cc " , <nl> " @ envoy_api / / envoy / api / v2 / core : base_cc " , <nl> ] , <nl> ) <nl> <nl> + envoy_cc_library ( <nl> + name = " conn_pool_map " , <nl> + hdrs = [ " conn_pool_map . h " ] , <nl> + deps = [ <nl> + " / / include / envoy / event : dispatcher_interface " , <nl> + " / / source / common / common : debug_recursion_checker_lib " , <nl> + ] , <nl> + ) <nl> + <nl> + envoy_cc_library ( <nl> + name = " conn_pool_map_impl_lib " , <nl> + hdrs = [ " conn_pool_map_impl . h " ] , <nl> + deps = [ <nl> + " : conn_pool_map " , <nl> + ] , <nl> + ) <nl> + <nl> envoy_cc_library ( <nl> name = " edf_scheduler_lib " , <nl> hdrs = [ " edf_scheduler . h " ] , <nl> mmm a / source / common / upstream / cluster_manager_impl . cc <nl> ppp b / source / common / upstream / cluster_manager_impl . cc <nl> <nl> # include " common / router / shadow_writer_impl . h " <nl> # include " common / tcp / conn_pool . h " <nl> # include " common / upstream / cds_api_impl . h " <nl> + # include " common / upstream / conn_pool_map_impl . h " <nl> # include " common / upstream / load_balancer_impl . h " <nl> # include " common / upstream / maglev_lb . h " <nl> # include " common / upstream / original_dst_cluster . h " <nl> ClusterManagerImpl : : ThreadLocalClusterManagerImpl : : ~ ThreadLocalClusterManagerImp <nl> void ClusterManagerImpl : : ThreadLocalClusterManagerImpl : : drainConnPools ( const HostVector & hosts ) { <nl> for ( const HostSharedPtr & host : hosts ) { <nl> { <nl> - auto container = host_http_conn_pool_map_ . find ( host ) ; <nl> - if ( container ! = host_http_conn_pool_map_ . end ( ) ) { <nl> - drainConnPools ( host , container - > second ) ; <nl> + auto container = getHttpConnPoolsContainer ( host ) ; <nl> + if ( container ! = nullptr ) { <nl> + drainConnPools ( host , * container ) ; <nl> } <nl> } <nl> { <nl> void ClusterManagerImpl : : ThreadLocalClusterManagerImpl : : drainConnPools ( const Hos <nl> <nl> void ClusterManagerImpl : : ThreadLocalClusterManagerImpl : : drainConnPools ( <nl> HostSharedPtr old_host , ConnPoolsContainer & container ) { <nl> - container . drains_remaining_ + = container . pools_ . size ( ) ; <nl> - <nl> - for ( const auto & pair : container . pools_ ) { <nl> - pair . second - > addDrainedCallback ( [ this , old_host ] ( ) - > void { <nl> - if ( destroying_ ) { <nl> - / / It is possible for a connection pool to fire drain callbacks during destruction . Instead <nl> - / / of checking if old_host actually exists in the map , it ' s clearer and cleaner to keep <nl> - / / track of destruction as a separate state and check for it here . This also allows us to <nl> - / / do this check here versus inside every different connection pool implementation . <nl> - return ; <nl> - } <nl> + container . drains_remaining_ + = container . pools_ - > size ( ) ; <nl> + <nl> + / / Make a copy to protect against erasure in the callback . <nl> + std : : shared_ptr < ConnPoolsContainer : : ConnPools > pools = container . pools_ ; <nl> + pools - > addDrainedCallback ( [ this , old_host ] ( ) - > void { <nl> + if ( destroying_ ) { <nl> + / / It is possible for a connection pool to fire drain callbacks during destruction . Instead <nl> + / / of checking if old_host actually exists in the map , it ' s clearer and cleaner to keep <nl> + / / track of destruction as a separate state and check for it here . This also allows us to <nl> + / / do this check here versus inside every different connection pool implementation . <nl> + return ; <nl> + } <nl> <nl> - ConnPoolsContainer & container = host_http_conn_pool_map_ [ old_host ] ; <nl> - ASSERT ( container . drains_remaining_ > 0 ) ; <nl> - container . drains_remaining_ - - ; <nl> - if ( container . drains_remaining_ = = 0 ) { <nl> - for ( auto & pair : container . pools_ ) { <nl> - thread_local_dispatcher_ . deferredDelete ( std : : move ( pair . second ) ) ; <nl> - } <nl> - host_http_conn_pool_map_ . erase ( old_host ) ; <nl> - } <nl> - } ) ; <nl> + ConnPoolsContainer * to_clear = getHttpConnPoolsContainer ( old_host ) ; <nl> + if ( to_clear = = nullptr ) { <nl> + / / This could happen if we have cleaned out the host before iterating through every connection <nl> + / / pool . Handle it by just continuing . <nl> + return ; <nl> + } <nl> <nl> - / / The above addDrainedCallback ( ) drain completion callback might execute immediately . This can <nl> - / / then effectively nuke ' container ' , which means we can ' t continue to loop on its contents <nl> - / / ( we ' re done here ) . <nl> - if ( host_http_conn_pool_map_ . count ( old_host ) = = 0 ) { <nl> - break ; <nl> + ASSERT ( to_clear - > drains_remaining_ > 0 ) ; <nl> + to_clear - > drains_remaining_ - - ; <nl> + if ( to_clear - > drains_remaining_ = = 0 & & to_clear - > ready_to_drain_ ) { <nl> + clearContainer ( old_host , * to_clear ) ; <nl> } <nl> + } ) ; <nl> + <nl> + / / We need to hold off on actually emptying out the container until we have finished processing <nl> + / / ` addDrainedCallback ` . If we do not , then it ' s possible that the container could be erased in <nl> + / / the middle of its iteration , which leads to undefined behaviour . We handle that case by <nl> + / / checking here to see if the drains have completed . <nl> + container . ready_to_drain_ = true ; <nl> + if ( container . drains_remaining_ = = 0 ) { <nl> + clearContainer ( old_host , container ) ; <nl> } <nl> } <nl> <nl> + void ClusterManagerImpl : : ThreadLocalClusterManagerImpl : : clearContainer ( <nl> + HostSharedPtr old_host , ConnPoolsContainer & container ) { <nl> + container . pools_ - > clear ( ) ; <nl> + host_http_conn_pool_map_ . erase ( old_host ) ; <nl> + } <nl> + <nl> void ClusterManagerImpl : : ThreadLocalClusterManagerImpl : : drainTcpConnPools ( <nl> HostSharedPtr old_host , TcpConnPoolsContainer & container ) { <nl> container . drains_remaining_ + = container . pools_ . size ( ) ; <nl> void ClusterManagerImpl : : ThreadLocalClusterManagerImpl : : onHostHealthFailure ( <nl> / / more targeted . <nl> ThreadLocalClusterManagerImpl & config = tls . getTyped < ThreadLocalClusterManagerImpl > ( ) ; <nl> { <nl> - const auto & container = config . host_http_conn_pool_map_ . find ( host ) ; <nl> - if ( container ! = config . host_http_conn_pool_map_ . end ( ) ) { <nl> - for ( const auto & pair : container - > second . pools_ ) { <nl> - const Http : : ConnectionPool : : InstancePtr & pool = pair . second ; <nl> - pool - > drainConnections ( ) ; <nl> - } <nl> + const auto container = config . getHttpConnPoolsContainer ( host ) ; <nl> + if ( container ! = nullptr ) { <nl> + container - > pools_ - > drainConnections ( ) ; <nl> } <nl> } <nl> { <nl> void ClusterManagerImpl : : ThreadLocalClusterManagerImpl : : onHostHealthFailure ( <nl> } <nl> } <nl> <nl> + ClusterManagerImpl : : ThreadLocalClusterManagerImpl : : ConnPoolsContainer * <nl> + ClusterManagerImpl : : ThreadLocalClusterManagerImpl : : getHttpConnPoolsContainer ( <nl> + const HostConstSharedPtr & host , bool allocate ) { <nl> + auto container_iter = host_http_conn_pool_map_ . find ( host ) ; <nl> + if ( container_iter = = host_http_conn_pool_map_ . end ( ) ) { <nl> + if ( ! allocate ) { <nl> + return nullptr ; <nl> + } <nl> + ConnPoolsContainer container { thread_local_dispatcher_ } ; <nl> + container_iter = host_http_conn_pool_map_ . emplace ( host , std : : move ( container ) ) . first ; <nl> + } <nl> + <nl> + return & container_iter - > second ; <nl> + } <nl> + <nl> ClusterManagerImpl : : ThreadLocalClusterManagerImpl : : ClusterEntry : : ClusterEntry ( <nl> ThreadLocalClusterManagerImpl & parent , ClusterInfoConstSharedPtr cluster , <nl> const LoadBalancerFactorySharedPtr & lb_factory ) <nl> ClusterManagerImpl : : ThreadLocalClusterManagerImpl : : ClusterEntry : : connPool ( <nl> } <nl> } <nl> <nl> - ConnPoolsContainer & container = parent_ . host_http_conn_pool_map_ [ host ] ; <nl> - if ( ! container . pools_ [ hash_key ] ) { <nl> - container . pools_ [ hash_key ] = parent_ . parent_ . factory_ . allocateConnPool ( <nl> + ConnPoolsContainer & container = * parent_ . getHttpConnPoolsContainer ( host , true ) ; <nl> + <nl> + / / Note : to simplify this , we assume that the factory is only called in the scope of this <nl> + / / function . Otherwise , we ' d need to capture a few of these variables by value . <nl> + Http : : ConnectionPool : : Instance & pool = container . pools_ - > getPool ( hash_key , [ & ] ( ) { <nl> + return parent_ . parent_ . factory_ . allocateConnPool ( <nl> parent_ . thread_local_dispatcher_ , host , priority , protocol , <nl> have_options ? context - > downstreamConnection ( ) - > socketOptions ( ) : nullptr ) ; <nl> - } <nl> + } ) ; <nl> <nl> - return container . pools_ [ hash_key ] . get ( ) ; <nl> + return & pool ; <nl> } <nl> <nl> Tcp : : ConnectionPool : : Instance * <nl> mmm a / source / common / upstream / cluster_manager_impl . h <nl> ppp b / source / common / upstream / cluster_manager_impl . h <nl> <nl> <nl> # include " common / config / grpc_mux_impl . h " <nl> # include " common / http / async_client_impl . h " <nl> + # include " common / upstream / conn_pool_map . h " <nl> # include " common / upstream / load_stats_reporter . h " <nl> # include " common / upstream / upstream_impl . h " <nl> <nl> class ClusterManagerImpl : public ClusterManager , Logger : : Loggable < Logger : : Id : : u <nl> * / <nl> struct ThreadLocalClusterManagerImpl : public ThreadLocal : : ThreadLocalObject { <nl> struct ConnPoolsContainer { <nl> - typedef std : : map < std : : vector < uint8_t > , Http : : ConnectionPool : : InstancePtr > ConnPools ; <nl> + ConnPoolsContainer ( Event : : Dispatcher & dispatcher ) <nl> + : pools_ { std : : make_shared < ConnPools > ( dispatcher ) } { } <nl> <nl> - ConnPools pools_ ; <nl> + typedef ConnPoolMap < std : : vector < uint8_t > , Http : : ConnectionPool : : Instance > ConnPools ; <nl> + <nl> + / / This is a shared_ptr so we can keep it alive while cleaning up . <nl> + std : : shared_ptr < ConnPools > pools_ ; <nl> + bool ready_to_drain_ { false } ; <nl> uint64_t drains_remaining_ { } ; <nl> } ; <nl> <nl> class ClusterManagerImpl : public ClusterManager , Logger : : Loggable < Logger : : Id : : u <nl> ~ ThreadLocalClusterManagerImpl ( ) ; <nl> void drainConnPools ( const HostVector & hosts ) ; <nl> void drainConnPools ( HostSharedPtr old_host , ConnPoolsContainer & container ) ; <nl> + void clearContainer ( HostSharedPtr old_host , ConnPoolsContainer & container ) ; <nl> void drainTcpConnPools ( HostSharedPtr old_host , TcpConnPoolsContainer & container ) ; <nl> void removeTcpConn ( const HostConstSharedPtr & host , Network : : ClientConnection & connection ) ; <nl> static void updateClusterMembership ( const std : : string & name , uint32_t priority , <nl> class ClusterManagerImpl : public ClusterManager , Logger : : Loggable < Logger : : Id : : u <nl> const HostVector & hosts_removed , ThreadLocal : : Slot & tls ) ; <nl> static void onHostHealthFailure ( const HostSharedPtr & host , ThreadLocal : : Slot & tls ) ; <nl> <nl> + ConnPoolsContainer * getHttpConnPoolsContainer ( const HostConstSharedPtr & host , <nl> + bool allocate = false ) ; <nl> + <nl> ClusterManagerImpl & parent_ ; <nl> Event : : Dispatcher & thread_local_dispatcher_ ; <nl> std : : unordered_map < std : : string , ClusterEntryPtr > thread_local_clusters_ ; <nl> new file mode 100644 <nl> index 00000000000 . . c602c5dd96b <nl> mmm / dev / null <nl> ppp b / source / common / upstream / conn_pool_map . h <nl> <nl> + # pragma once <nl> + <nl> + # include < vector > <nl> + <nl> + # include " envoy / event / dispatcher . h " <nl> + <nl> + # include " common / common / debug_recursion_checker . h " <nl> + <nl> + # include " absl / container / flat_hash_map . h " <nl> + <nl> + namespace Envoy { <nl> + namespace Upstream { <nl> + / * * <nl> + * A class mapping keys to connection pools , with some recycling logic built in . <nl> + * / <nl> + template < typename KEY_TYPE , typename POOL_TYPE > class ConnPoolMap { <nl> + public : <nl> + using PoolFactory = std : : function < std : : unique_ptr < POOL_TYPE > ( ) > ; <nl> + using DrainedCb = std : : function < void ( ) > ; <nl> + <nl> + ConnPoolMap ( Event : : Dispatcher & dispatcher ) ; <nl> + ~ ConnPoolMap ( ) ; <nl> + / * * <nl> + * Returns an existing pool for ` key ` , or creates a new one using ` factory ` . Note that it is <nl> + * possible for this to fail if a limit on the number of pools allowed is reached . <nl> + * @ return The pool corresponding to ` key ` , or ` absl : : nullopt ` . <nl> + * / <nl> + POOL_TYPE & getPool ( KEY_TYPE key , const PoolFactory & factory ) ; <nl> + <nl> + / * * <nl> + * @ return the number of pools . <nl> + * / <nl> + size_t size ( ) const ; <nl> + <nl> + / * * <nl> + * Destroys all mapped pools . <nl> + * / <nl> + void clear ( ) ; <nl> + <nl> + / * * <nl> + * Adds a drain callback to all mapped pools . Any future mapped pools with have the callback <nl> + * automatically added . Be careful with the callback . If it itself calls into ` this ` , modifying <nl> + * the state of ` this ` , there is a good chance it will cause corruption due to the callback firing <nl> + * immediately . <nl> + * / <nl> + void addDrainedCallback ( const DrainedCb & cb ) ; <nl> + <nl> + / * * <nl> + * Instructs each connection pool to drain its connections . <nl> + * / <nl> + void drainConnections ( ) ; <nl> + <nl> + private : <nl> + absl : : flat_hash_map < KEY_TYPE , std : : unique_ptr < POOL_TYPE > > active_pools_ ; <nl> + Event : : Dispatcher & thread_local_dispatcher_ ; <nl> + std : : vector < DrainedCb > cached_callbacks_ ; <nl> + Common : : DebugRecursionChecker recursion_checker_ ; <nl> + } ; <nl> + <nl> + } / / namespace Upstream <nl> + } / / namespace Envoy <nl> new file mode 100644 <nl> index 00000000000 . . 518805106ca <nl> mmm / dev / null <nl> ppp b / source / common / upstream / conn_pool_map_impl . h <nl> <nl> + # pragma once <nl> + <nl> + # include " common / upstream / conn_pool_map . h " <nl> + <nl> + namespace Envoy { <nl> + namespace Upstream { <nl> + <nl> + template < typename KEY_TYPE , typename POOL_TYPE > <nl> + ConnPoolMap < KEY_TYPE , POOL_TYPE > : : ConnPoolMap ( Envoy : : Event : : Dispatcher & dispatcher ) <nl> + : thread_local_dispatcher_ ( dispatcher ) { } <nl> + <nl> + template < typename KEY_TYPE , typename POOL_TYPE > <nl> + ConnPoolMap < KEY_TYPE , POOL_TYPE > : : ~ ConnPoolMap ( ) = default ; <nl> + <nl> + template < typename KEY_TYPE , typename POOL_TYPE > <nl> + POOL_TYPE & ConnPoolMap < KEY_TYPE , POOL_TYPE > : : getPool ( KEY_TYPE key , const PoolFactory & factory ) { <nl> + Common : : AutoDebugRecursionChecker assert_not_in ( recursion_checker_ ) ; <nl> + / / TODO ( klarose ) : Consider how we will change the connection pool ' s configuration in the future . <nl> + / / The plan is to change the downstream socket options . . . We may want to take those as a parameter <nl> + / / here . Maybe we ' ll pass them to the factory function ? <nl> + auto inserted = active_pools_ . emplace ( key , nullptr ) ; <nl> + <nl> + / / If we inserted a new element , create a pool and assign it to the iterator . Tell it about any <nl> + / / cached callbacks . <nl> + if ( inserted . second ) { <nl> + inserted . first - > second = factory ( ) ; <nl> + for ( const auto & cb : cached_callbacks_ ) { <nl> + inserted . first - > second - > addDrainedCallback ( cb ) ; <nl> + } <nl> + } <nl> + <nl> + return * inserted . first - > second ; <nl> + } <nl> + <nl> + template < typename KEY_TYPE , typename POOL_TYPE > <nl> + size_t ConnPoolMap < KEY_TYPE , POOL_TYPE > : : size ( ) const { <nl> + return active_pools_ . size ( ) ; <nl> + } <nl> + <nl> + template < typename KEY_TYPE , typename POOL_TYPE > void ConnPoolMap < KEY_TYPE , POOL_TYPE > : : clear ( ) { <nl> + Common : : AutoDebugRecursionChecker assert_not_in ( recursion_checker_ ) ; <nl> + for ( auto & pool_pair : active_pools_ ) { <nl> + thread_local_dispatcher_ . deferredDelete ( std : : move ( pool_pair . second ) ) ; <nl> + } <nl> + <nl> + active_pools_ . clear ( ) ; <nl> + } <nl> + <nl> + template < typename KEY_TYPE , typename POOL_TYPE > <nl> + void ConnPoolMap < KEY_TYPE , POOL_TYPE > : : addDrainedCallback ( const DrainedCb & cb ) { <nl> + Common : : AutoDebugRecursionChecker assert_not_in ( recursion_checker_ ) ; <nl> + for ( auto & pool_pair : active_pools_ ) { <nl> + pool_pair . second - > addDrainedCallback ( cb ) ; <nl> + } <nl> + <nl> + cached_callbacks_ . emplace_back ( std : : move ( cb ) ) ; <nl> + } <nl> + <nl> + template < typename KEY_TYPE , typename POOL_TYPE > <nl> + void ConnPoolMap < KEY_TYPE , POOL_TYPE > : : drainConnections ( ) { <nl> + Common : : AutoDebugRecursionChecker assert_not_in ( recursion_checker_ ) ; <nl> + for ( auto & pool_pair : active_pools_ ) { <nl> + pool_pair . second - > drainConnections ( ) ; <nl> + } <nl> + } <nl> + } / / namespace Upstream <nl> + } / / namespace Envoy <nl> mmm a / test / common / upstream / BUILD <nl> ppp b / test / common / upstream / BUILD <nl> envoy_cc_test ( <nl> ] , <nl> ) <nl> <nl> + envoy_cc_test ( <nl> + name = " conn_pool_map_impl_test " , <nl> + srcs = [ " conn_pool_map_impl_test . cc " ] , <nl> + deps = [ <nl> + " / / include / envoy / http : conn_pool_interface " , <nl> + " / / source / common / upstream : conn_pool_map_impl_lib " , <nl> + " / / test / mocks : common_lib " , <nl> + " / / test / mocks / event : event_mocks " , <nl> + " / / test / mocks / http : conn_pool_mocks " , <nl> + " / / test / test_common : utility_lib " , <nl> + ] , <nl> + ) <nl> + <nl> envoy_cc_test ( <nl> name = " edf_scheduler_test " , <nl> srcs = [ " edf_scheduler_test . cc " ] , <nl> new file mode 100644 <nl> index 00000000000 . . 11de76b94ea <nl> mmm / dev / null <nl> ppp b / test / common / upstream / conn_pool_map_impl_test . cc <nl> <nl> + # include < memory > <nl> + # include < vector > <nl> + <nl> + # include " envoy / http / conn_pool . h " <nl> + <nl> + # include " common / upstream / conn_pool_map_impl . h " <nl> + <nl> + # include " test / mocks / common . h " <nl> + # include " test / mocks / event / mocks . h " <nl> + # include " test / mocks / http / conn_pool . h " <nl> + # include " test / test_common / test_base . h " <nl> + # include " test / test_common / utility . h " <nl> + <nl> + # include " gmock / gmock . h " <nl> + # include " gtest / gtest . h " <nl> + <nl> + using testing : : Invoke ; <nl> + using testing : : NiceMock ; <nl> + using testing : : SaveArg ; <nl> + <nl> + namespace Envoy { <nl> + namespace Upstream { <nl> + <nl> + class ConnPoolMapImplTest : public TestBase { <nl> + public : <nl> + / / Note , we could test with Http : : ConnectionPool : : MockInstance here , which would simplify the <nl> + / / test . However , it ' s nice to test against an actual interface we ' ll be using . <nl> + using TestMap = ConnPoolMap < int , Http : : ConnectionPool : : Instance > ; <nl> + using TestMapPtr = std : : unique_ptr < TestMap > ; <nl> + <nl> + TestMapPtr makeTestMap ( ) { return std : : make_unique < TestMap > ( dispatcher_ ) ; } <nl> + <nl> + TestMap : : PoolFactory getBasicFactory ( ) { <nl> + return [ & ] ( ) { <nl> + auto pool = std : : make_unique < NiceMock < Http : : ConnectionPool : : MockInstance > > ( ) ; <nl> + mock_pools_ . push_back ( pool . get ( ) ) ; <nl> + return pool ; <nl> + } ; <nl> + } <nl> + <nl> + TestMap : : PoolFactory getFactoryExpectDrainedCb ( Http : : ConnectionPool : : Instance : : DrainedCb * cb ) { <nl> + return [ this , cb ] ( ) { <nl> + auto pool = std : : make_unique < NiceMock < Http : : ConnectionPool : : MockInstance > > ( ) ; <nl> + EXPECT_CALL ( * pool , addDrainedCallback ( _ ) ) . WillOnce ( SaveArg < 0 > ( cb ) ) ; <nl> + mock_pools_ . push_back ( pool . get ( ) ) ; <nl> + return pool ; <nl> + } ; <nl> + } <nl> + <nl> + protected : <nl> + NiceMock < Event : : MockDispatcher > dispatcher_ ; <nl> + std : : vector < NiceMock < Http : : ConnectionPool : : MockInstance > * > mock_pools_ ; <nl> + } ; <nl> + <nl> + TEST_F ( ConnPoolMapImplTest , TestMapIsEmptyOnConstruction ) { <nl> + TestMapPtr test_map = makeTestMap ( ) ; <nl> + <nl> + EXPECT_EQ ( test_map - > size ( ) , 0 ) ; <nl> + } <nl> + <nl> + TEST_F ( ConnPoolMapImplTest , TestAddingAConnPoolIncreasesSize ) { <nl> + TestMapPtr test_map = makeTestMap ( ) ; <nl> + <nl> + test_map - > getPool ( 1 , getBasicFactory ( ) ) ; <nl> + EXPECT_EQ ( test_map - > size ( ) , 1 ) ; <nl> + } <nl> + <nl> + TEST_F ( ConnPoolMapImplTest , TestAddingTwoConnPoolsIncreasesSize ) { <nl> + TestMapPtr test_map = makeTestMap ( ) ; <nl> + <nl> + test_map - > getPool ( 1 , getBasicFactory ( ) ) ; <nl> + test_map - > getPool ( 2 , getBasicFactory ( ) ) ; <nl> + EXPECT_EQ ( test_map - > size ( ) , 2 ) ; <nl> + } <nl> + <nl> + TEST_F ( ConnPoolMapImplTest , TestConnPoolReturnedMatchesCreated ) { <nl> + TestMapPtr test_map = makeTestMap ( ) ; <nl> + <nl> + Http : : ConnectionPool : : Instance & pool = test_map - > getPool ( 1 , getBasicFactory ( ) ) ; <nl> + EXPECT_EQ ( & pool , mock_pools_ [ 0 ] ) ; <nl> + } <nl> + <nl> + TEST_F ( ConnPoolMapImplTest , TestConnSecondPoolReturnedMatchesCreated ) { <nl> + TestMapPtr test_map = makeTestMap ( ) ; <nl> + <nl> + test_map - > getPool ( 1 , getBasicFactory ( ) ) ; <nl> + Http : : ConnectionPool : : Instance & pool = test_map - > getPool ( 2 , getBasicFactory ( ) ) ; <nl> + EXPECT_EQ ( & pool , mock_pools_ [ 1 ] ) ; <nl> + } <nl> + <nl> + TEST_F ( ConnPoolMapImplTest , TestMultipleOfSameKeyReturnsOriginal ) { <nl> + TestMapPtr test_map = makeTestMap ( ) ; <nl> + <nl> + Http : : ConnectionPool : : Instance & pool1 = test_map - > getPool ( 1 , getBasicFactory ( ) ) ; <nl> + Http : : ConnectionPool : : Instance & pool2 = test_map - > getPool ( 2 , getBasicFactory ( ) ) ; <nl> + <nl> + EXPECT_EQ ( & pool1 , & test_map - > getPool ( 1 , getBasicFactory ( ) ) ) ; <nl> + EXPECT_EQ ( & pool2 , & test_map - > getPool ( 2 , getBasicFactory ( ) ) ) ; <nl> + EXPECT_EQ ( test_map - > size ( ) , 2 ) ; <nl> + } <nl> + <nl> + TEST_F ( ConnPoolMapImplTest , TestEmptyClerWorks ) { <nl> + TestMapPtr test_map = makeTestMap ( ) ; <nl> + <nl> + test_map - > clear ( ) ; <nl> + EXPECT_EQ ( test_map - > size ( ) , 0 ) ; <nl> + } <nl> + <nl> + TEST_F ( ConnPoolMapImplTest , TestClearEmptiesOutMap ) { <nl> + TestMapPtr test_map = makeTestMap ( ) ; <nl> + <nl> + test_map - > getPool ( 1 , getBasicFactory ( ) ) ; <nl> + test_map - > getPool ( 2 , getBasicFactory ( ) ) ; <nl> + <nl> + test_map - > clear ( ) ; <nl> + EXPECT_EQ ( test_map - > size ( ) , 0 ) ; <nl> + } <nl> + <nl> + TEST_F ( ConnPoolMapImplTest , CallbacksPassedToPools ) { <nl> + TestMapPtr test_map = makeTestMap ( ) ; <nl> + <nl> + test_map - > getPool ( 1 , getBasicFactory ( ) ) ; <nl> + test_map - > getPool ( 2 , getBasicFactory ( ) ) ; <nl> + Http : : ConnectionPool : : Instance : : DrainedCb cb1 ; <nl> + EXPECT_CALL ( * mock_pools_ [ 0 ] , addDrainedCallback ( _ ) ) . WillOnce ( SaveArg < 0 > ( & cb1 ) ) ; <nl> + Http : : ConnectionPool : : Instance : : DrainedCb cb2 ; <nl> + EXPECT_CALL ( * mock_pools_ [ 1 ] , addDrainedCallback ( _ ) ) . WillOnce ( SaveArg < 0 > ( & cb2 ) ) ; <nl> + <nl> + ReadyWatcher watcher ; <nl> + test_map - > addDrainedCallback ( [ & watcher ] { watcher . ready ( ) ; } ) ; <nl> + <nl> + EXPECT_CALL ( watcher , ready ( ) ) . Times ( 2 ) ; <nl> + cb1 ( ) ; <nl> + cb2 ( ) ; <nl> + } <nl> + <nl> + / / Tests that if we add the callback first , it is passed along when pools are created later . <nl> + TEST_F ( ConnPoolMapImplTest , CallbacksCachedAndPassedOnCreation ) { <nl> + TestMapPtr test_map = makeTestMap ( ) ; <nl> + <nl> + ReadyWatcher watcher ; <nl> + test_map - > addDrainedCallback ( [ & watcher ] { watcher . ready ( ) ; } ) ; <nl> + <nl> + Http : : ConnectionPool : : Instance : : DrainedCb cb1 ; <nl> + test_map - > getPool ( 1 , getFactoryExpectDrainedCb ( & cb1 ) ) ; <nl> + <nl> + Http : : ConnectionPool : : Instance : : DrainedCb cb2 ; <nl> + test_map - > getPool ( 2 , getFactoryExpectDrainedCb ( & cb2 ) ) ; <nl> + <nl> + EXPECT_CALL ( watcher , ready ( ) ) . Times ( 2 ) ; <nl> + cb1 ( ) ; <nl> + cb2 ( ) ; <nl> + } <nl> + <nl> + / / Tests that if we drain connections on an empty map , nothing happens . <nl> + TEST_F ( ConnPoolMapImplTest , EmptyMapDrainConnectionsNop ) { <nl> + TestMapPtr test_map = makeTestMap ( ) ; <nl> + test_map - > drainConnections ( ) ; <nl> + } <nl> + <nl> + / / Tests that we forward drainConnections to the pools . <nl> + TEST_F ( ConnPoolMapImplTest , DrainConnectionsForwarded ) { <nl> + TestMapPtr test_map = makeTestMap ( ) ; <nl> + <nl> + test_map - > getPool ( 1 , getBasicFactory ( ) ) ; <nl> + test_map - > getPool ( 2 , getBasicFactory ( ) ) ; <nl> + EXPECT_CALL ( * mock_pools_ [ 0 ] , drainConnections ( ) ) ; <nl> + EXPECT_CALL ( * mock_pools_ [ 1 ] , drainConnections ( ) ) ; <nl> + <nl> + test_map - > drainConnections ( ) ; <nl> + } <nl> + <nl> + TEST_F ( ConnPoolMapImplTest , ClearDefersDelete ) { <nl> + TestMapPtr test_map = makeTestMap ( ) ; <nl> + <nl> + test_map - > getPool ( 1 , getBasicFactory ( ) ) ; <nl> + test_map - > getPool ( 2 , getBasicFactory ( ) ) ; <nl> + test_map - > clear ( ) ; <nl> + <nl> + EXPECT_EQ ( dispatcher_ . to_delete_ . size ( ) , 2 ) ; <nl> + } <nl> + <nl> + / / The following tests only die in debug builds , so don ' t run them if this isn ' t one . <nl> + # if ! defined ( NDEBUG ) <nl> + class ConnPoolMapImplDeathTest : public ConnPoolMapImplTest { } ; <nl> + <nl> + TEST_F ( ConnPoolMapImplDeathTest , ReentryClearTripsAssert ) { <nl> + TestMapPtr test_map = makeTestMap ( ) ; <nl> + <nl> + test_map - > getPool ( 1 , getBasicFactory ( ) ) ; <nl> + ON_CALL ( * mock_pools_ [ 0 ] , addDrainedCallback ( _ ) ) <nl> + . WillByDefault ( Invoke ( [ ] ( Http : : ConnectionPool : : Instance : : DrainedCb cb ) { cb ( ) ; } ) ) ; <nl> + <nl> + EXPECT_DEATH_LOG_TO_STDERR ( test_map - > addDrainedCallback ( [ & test_map ] { test_map - > clear ( ) ; } ) , <nl> + " . * Details : A resource should only be entered once " ) ; <nl> + } <nl> + <nl> + TEST_F ( ConnPoolMapImplDeathTest , ReentryGetPoolTripsAssert ) { <nl> + TestMapPtr test_map = makeTestMap ( ) ; <nl> + <nl> + test_map - > getPool ( 1 , getBasicFactory ( ) ) ; <nl> + ON_CALL ( * mock_pools_ [ 0 ] , addDrainedCallback ( _ ) ) <nl> + . WillByDefault ( Invoke ( [ ] ( Http : : ConnectionPool : : Instance : : DrainedCb cb ) { cb ( ) ; } ) ) ; <nl> + <nl> + EXPECT_DEATH_LOG_TO_STDERR ( <nl> + test_map - > addDrainedCallback ( [ & test_map , this ] { test_map - > getPool ( 2 , getBasicFactory ( ) ) ; } ) , <nl> + " . * Details : A resource should only be entered once " ) ; <nl> + } <nl> + <nl> + TEST_F ( ConnPoolMapImplDeathTest , ReentryDrainConnectionsTripsAssert ) { <nl> + TestMapPtr test_map = makeTestMap ( ) ; <nl> + <nl> + test_map - > getPool ( 1 , getBasicFactory ( ) ) ; <nl> + ON_CALL ( * mock_pools_ [ 0 ] , addDrainedCallback ( _ ) ) <nl> + . WillByDefault ( Invoke ( [ ] ( Http : : ConnectionPool : : Instance : : DrainedCb cb ) { cb ( ) ; } ) ) ; <nl> + <nl> + EXPECT_DEATH_LOG_TO_STDERR ( <nl> + test_map - > addDrainedCallback ( [ & test_map ] { test_map - > drainConnections ( ) ; } ) , <nl> + " . * Details : A resource should only be entered once " ) ; <nl> + } <nl> + <nl> + TEST_F ( ConnPoolMapImplDeathTest , ReentryAddDrainedCallbackTripsAssert ) { <nl> + TestMapPtr test_map = makeTestMap ( ) ; <nl> + <nl> + test_map - > getPool ( 1 , getBasicFactory ( ) ) ; <nl> + ON_CALL ( * mock_pools_ [ 0 ] , addDrainedCallback ( _ ) ) <nl> + . WillByDefault ( Invoke ( [ ] ( Http : : ConnectionPool : : Instance : : DrainedCb cb ) { cb ( ) ; } ) ) ; <nl> + <nl> + EXPECT_DEATH_LOG_TO_STDERR ( <nl> + test_map - > addDrainedCallback ( [ & test_map ] { test_map - > addDrainedCallback ( [ ] ( ) { } ) ; } ) , <nl> + " . * Details : A resource should only be entered once " ) ; <nl> + } <nl> + # endif / / ! defined ( NDEBUG ) <nl> + } / / namespace Upstream <nl> + } / / namespace Envoy <nl>
upstream : add connpool map ( )
envoyproxy/envoy
6b216b3abeb655f52f4890d93232b1e73545b775
2019-02-05T20:03:59Z
mmm a / doc / classes / @ GlobalScope . xml <nl> ppp b / doc / classes / @ GlobalScope . xml <nl> <nl> Middle Mouse Button <nl> < / constant > <nl> < constant name = " BUTTON_XBUTTON1 " value = " 8 " enum = " ButtonList " > <nl> + Extra Mouse Button 1 <nl> < / constant > <nl> < constant name = " BUTTON_XBUTTON2 " value = " 9 " enum = " ButtonList " > <nl> + Extra Mouse Button 2 <nl> < / constant > <nl> < constant name = " BUTTON_WHEEL_UP " value = " 4 " enum = " ButtonList " > <nl> Mouse wheel up <nl> <nl> Middle Mouse Button Mask <nl> < / constant > <nl> < constant name = " BUTTON_MASK_XBUTTON1 " value = " 128 " enum = " ButtonList " > <nl> + Extra Mouse Button 1 Mask <nl> < / constant > <nl> < constant name = " BUTTON_MASK_XBUTTON2 " value = " 256 " enum = " ButtonList " > <nl> + Extra Mouse Button 2 Mask <nl> < / constant > <nl> < constant name = " JOY_BUTTON_0 " value = " 0 " enum = " JoystickList " > <nl> Joypad Button 0 <nl>
[ DOCS ] ButtonList - extra mouse buttons
godotengine/godot
7759155ce4427a45dd29103d8af81fdc4cb4d56e
2018-09-28T16:37:25Z
mmm a / src / core / ext / transport / chttp2 / transport / chttp2_transport . cc <nl> ppp b / src / core / ext / transport / chttp2 / transport / chttp2_transport . cc <nl> <nl> / * <nl> * <nl> - * Copyright 2015 gRPC authors . <nl> + * Copyright 2018 gRPC authors . <nl> * <nl> * Licensed under the Apache License , Version 2 . 0 ( the " License " ) ; <nl> * you may not use this file except in compliance with the License . <nl> new file mode 100644 <nl> index 00000000000 . . a98d9ad639e <nl> mmm / dev / null <nl> ppp b / src / core / ext / transport / chttp2 / transport / context_list . h <nl> <nl> + / * <nl> + * <nl> + * Copyright 2018 gRPC authors . <nl> + * <nl> + * Licensed under the Apache License , Version 2 . 0 ( the " License " ) ; <nl> + * you may not use this file except in compliance with the License . <nl> + * You may obtain a copy of the License at <nl> + * <nl> + * http : / / www . apache . org / licenses / LICENSE - 2 . 0 <nl> + * <nl> + * Unless required by applicable law or agreed to in writing , software <nl> + * distributed under the License is distributed on an " AS IS " BASIS , <nl> + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND , either express or implied . <nl> + * See the License for the specific language governing permissions and <nl> + * limitations under the License . <nl> + * <nl> + * / <nl> + <nl> + # ifndef GRPC_CORE_EXT_TRANSPORT_CONTEXT_LIST_H <nl> + # define GRPC_CORE_EXT_TRANSPORT_CONTEXT_LIST_H <nl> + <nl> + # include < grpc / support / port_platform . h > <nl> + <nl> + / * * A list of RPC Contexts * / <nl> + class ContextList { <nl> + struct ContextListElement { <nl> + void * context ; <nl> + ContextListElement * next ; <nl> + } ; <nl> + <nl> + public : <nl> + ContextList ( ) : head_ ( nullptr ) ; <nl> + <nl> + / * Creates a new element with \ a context as the value and appends it to the <nl> + * list . * / <nl> + void Append ( void * context ) { <nl> + ContextListElement * elem = static_cast < ContextListElement * > ( gpr_malloc ( sizeof ( ContextlistELement ) ) ) ; <nl> + elem - > context = context ; <nl> + elem - > next = nullptr ; <nl> + if ( head_ = = nullptr ) { <nl> + head = elem ; <nl> + return ; <nl> + } <nl> + ContextListElement * ptr = head_ ; <nl> + while ( ptr - > next ! = nullptr ) { <nl> + ptr = ptr - > next ; <nl> + } <nl> + ptr - > next = elem ; <nl> + } <nl> + <nl> + / * Executes a function \ a fn with each context in the list and \ a arg . It also <nl> + * frees up the entire list after this operation . * / <nl> + void Execute ( void ( * fn ) ( void * context , void * arg ) ) { <nl> + ContextListElement * ptr ; <nl> + while ( head_ ! = nullptr ) { <nl> + fn ( head - > context , arg ) ; <nl> + ptr = head_ ; <nl> + head_ = head_ - > next ; <nl> + gpr_free ( ptr ) ; <nl> + } <nl> + } <nl> + private : <nl> + ContextListElement * head_ ; <nl> + } ; <nl> + <nl> + # endif / * GRPC_CORE_EXT_TRANSPORT_CONTEXT_LIST_H * / <nl>
initial commit
grpc/grpc
b473c72854f1e26ac5794cdceb3fcc717bcc8735
2018-08-24T21:26:20Z