diff
stringlengths 41
2.03M
| msg
stringlengths 1
1.5k
⌀ | repo
stringlengths 5
40
| sha
stringlengths 40
40
| time
stringlengths 20
20
|
---|---|---|---|---|
mmm a / test / test_nn . py <nl> ppp b / test / test_nn . py <nl> def test_data_parallel_module ( self , dtype = torch . float ) : <nl> net = nn . DataParallel ( l ) <nl> out = net ( i ) <nl> self . assertEqual ( out . get_device ( ) , 0 ) <nl> - self . assertEqual ( out . data , expected_out ) <nl> + self . assertEqual ( out . data , expected_out , dtype2prec [ dtype ] ) <nl> <nl> @ unittest . skipIf ( not TEST_CUDA , " CUDA unavailable " ) <nl> @ repeat_test_for_types ( ALL_TENSORTYPES ) <nl> def forward ( self , input ) : <nl> n = nn . DataParallel ( Net ( ) ) <nl> out = n ( input = i ) <nl> self . assertEqual ( out . get_device ( ) , 0 ) <nl> - self . assertEqual ( out . data , expected_out ) <nl> + self . assertEqual ( out . data , expected_out , dtype2prec [ dtype ] ) <nl> <nl> @ unittest . skipIf ( not TEST_CUDA , " CUDA unavailable " ) <nl> @ repeat_test_for_types ( ALL_TENSORTYPES ) <nl> def forward ( self , input ) : <nl> n = nn . DataParallel ( Net ( ) ) <nl> out = n ( input = { ' data ' : i , ' unused ' : [ ] } ) <nl> self . assertEqual ( out . get_device ( ) , 0 ) <nl> - self . assertEqual ( out . data , expected_out ) <nl> + self . assertEqual ( out . data , expected_out , dtype2prec [ dtype ] ) <nl> <nl> @ unittest . skipIf ( not TEST_CUDA , " CUDA unavailable " ) <nl> @ repeat_test_for_types ( ALL_TENSORTYPES ) <nl> def forward ( self , input ) : <nl> n = nn . DataParallel ( Net ( ) ) <nl> out = n ( input = { ' data ' : i , ' unused ' : { } } ) <nl> self . assertEqual ( out . get_device ( ) , 0 ) <nl> - self . assertEqual ( out . data , expected_out ) <nl> + self . assertEqual ( out . data , expected_out , dtype2prec [ dtype ] ) <nl> <nl> @ unittest . skipIf ( not TEST_CUDA , " CUDA unavailable " ) <nl> @ repeat_test_for_types ( ALL_TENSORTYPES ) <nl> def forward ( self , input ) : <nl> n = nn . DataParallel ( Net ( ) ) <nl> out = n ( input = { ' data ' : i , ' unused ' : ( ) } ) <nl> self . assertEqual ( out . get_device ( ) , 0 ) <nl> - self . assertEqual ( out . data , expected_out ) <nl> + self . assertEqual ( out . data , expected_out , dtype2prec [ dtype ] ) <nl> <nl> @ unittest . skipIf ( not TEST_MULTIGPU , " multi - GPU not supported " ) <nl> def test_data_parallel_device_args ( self ) : <nl> | use datatype dependent tolerance in data parallel tests | pytorch/pytorch | 27d5ae7afb9ae7b93b389e70498e25e75540fda3 | 2018-12-11T06:50:27Z |
mmm a / tensorflow / contrib / lite / kernels / internal / optimized / optimized_ops . h <nl> ppp b / tensorflow / contrib / lite / kernels / internal / optimized / optimized_ops . h <nl> void Conv ( const uint8 * input_data , const Dims < 4 > & input_dims , <nl> im2col_data , im2col_dims , gemm_context ) ; <nl> } <nl> <nl> - template < typename T > <nl> - inline void DepthToSpace ( const T * input_data , const Dims < 4 > & input_dims , <nl> - int block_size , T * output_data , <nl> - const Dims < 4 > & output_dims ) { <nl> - gemmlowp : : ScopedProfilingLabel label ( " DepthToSpace " ) ; <nl> - <nl> - const int input_depth = ArraySize ( input_dims , 0 ) ; <nl> - const int input_width = ArraySize ( input_dims , 1 ) ; <nl> - const int input_height = ArraySize ( input_dims , 2 ) ; <nl> - <nl> - const int output_depth = ArraySize ( output_dims , 0 ) ; <nl> - const int batch_size = ArraySize ( output_dims , 3 ) ; <nl> - <nl> - / / Number of continuous values that we can copy in one interation . <nl> - const int stride = block_size * output_depth ; <nl> - <nl> - for ( int batch = 0 ; batch < batch_size ; + + batch ) { <nl> - for ( int in_h = 0 ; in_h < input_height ; + + in_h ) { <nl> - const T * input_ptr = input_data + Offset ( input_dims , 0 , 0 , in_h , batch ) ; <nl> - for ( int offset_h = 0 ; offset_h < block_size ; + + offset_h ) { <nl> - const T * src = input_ptr ; <nl> - for ( int in_w = 0 ; in_w < input_width ; + + in_w ) { <nl> - memcpy ( output_data , src , stride * sizeof ( T ) ) ; <nl> - output_data + = stride ; <nl> - src + = input_depth ; <nl> - } <nl> - input_ptr + = stride ; <nl> - } <nl> - } <nl> - } <nl> - } <nl> - <nl> / / legacy , for compatibility with old checked - in code <nl> template < FusedActivationFunctionType Ac , typename T > <nl> void Im2col ( const T * input_data , const Dims < 4 > & input_dims , int stride , <nl> void ConvAsGemm ( const uint8 * input_data , const Dims < 4 > & input_dims , <nl> } <nl> <nl> template < typename T > <nl> - inline void SpaceToDepth ( const T * input_data , const Dims < 4 > & input_dims , <nl> + inline void DepthToSpace ( const tflite : : DepthToSpaceParams & op_params , <nl> + const RuntimeShape & unextended_input_shape , <nl> + const T * input_data , <nl> + const RuntimeShape & unextended_output_shape , <nl> + T * output_data ) { <nl> + gemmlowp : : ScopedProfilingLabel label ( " DepthToSpace " ) ; <nl> + <nl> + TFLITE_DCHECK_LE ( unextended_input_shape . DimensionsCount ( ) , 4 ) ; <nl> + TFLITE_DCHECK_LE ( unextended_output_shape . DimensionsCount ( ) , 4 ) ; <nl> + RuntimeShape input_shape = <nl> + RuntimeShape : : ExtendedShape ( 4 , unextended_input_shape ) ; <nl> + RuntimeShape output_shape = <nl> + RuntimeShape : : ExtendedShape ( 4 , unextended_output_shape ) ; <nl> + <nl> + const int input_depth = input_shape . Dims ( 3 ) ; <nl> + const int input_width = input_shape . Dims ( 2 ) ; <nl> + const int input_height = input_shape . Dims ( 1 ) ; <nl> + <nl> + const int output_depth = output_shape . Dims ( 3 ) ; <nl> + const int batch_size = output_shape . Dims ( 0 ) ; <nl> + <nl> + / / Number of continuous values that we can copy in one interation . <nl> + const int stride = op_params . block_size * output_depth ; <nl> + <nl> + for ( int batch = 0 ; batch < batch_size ; + + batch ) { <nl> + for ( int in_h = 0 ; in_h < input_height ; + + in_h ) { <nl> + const T * input_ptr = input_data + Offset ( input_shape , batch , in_h , 0 , 0 ) ; <nl> + for ( int offset_h = 0 ; offset_h < op_params . block_size ; + + offset_h ) { <nl> + const T * src = input_ptr ; <nl> + for ( int in_w = 0 ; in_w < input_width ; + + in_w ) { <nl> + memcpy ( output_data , src , stride * sizeof ( T ) ) ; <nl> + output_data + = stride ; <nl> + src + = input_depth ; <nl> + } <nl> + input_ptr + = stride ; <nl> + } <nl> + } <nl> + } <nl> + } <nl> + <nl> + / / Legacy Dims < 4 > . <nl> + template < typename T > <nl> + inline void DepthToSpace ( const T * input_data , const Dims < 4 > & input_dims , <nl> int block_size , T * output_data , <nl> const Dims < 4 > & output_dims ) { <nl> + tflite : : DepthToSpaceParams op_params ; <nl> + op_params . block_size = block_size ; <nl> + <nl> + DepthToSpace ( op_params , DimsToShape ( input_dims ) , input_data , <nl> + DimsToShape ( output_dims ) , output_data ) ; <nl> + } <nl> + <nl> + template < typename T > <nl> + inline void SpaceToDepth ( const tflite : : SpaceToDepthParams & op_params , <nl> + const RuntimeShape & unextended_input_shape , <nl> + const T * input_data , <nl> + const RuntimeShape & unextended_output_shape , <nl> + T * output_data ) { <nl> gemmlowp : : ScopedProfilingLabel label ( " SpaceToDepth " ) ; <nl> <nl> - const int output_depth = ArraySize ( output_dims , 0 ) ; <nl> - const int output_width = ArraySize ( output_dims , 1 ) ; <nl> - const int output_height = ArraySize ( output_dims , 2 ) ; <nl> + TFLITE_DCHECK_LE ( unextended_input_shape . DimensionsCount ( ) , 4 ) ; <nl> + TFLITE_DCHECK_LE ( unextended_output_shape . DimensionsCount ( ) , 4 ) ; <nl> + RuntimeShape input_shape = <nl> + RuntimeShape : : ExtendedShape ( 4 , unextended_input_shape ) ; <nl> + RuntimeShape output_shape = <nl> + RuntimeShape : : ExtendedShape ( 4 , unextended_output_shape ) ; <nl> <nl> - const int input_depth = ArraySize ( input_dims , 0 ) ; <nl> - const int batch_size = ArraySize ( input_dims , 3 ) ; <nl> + const int output_depth = output_shape . Dims ( 3 ) ; <nl> + const int output_width = output_shape . Dims ( 2 ) ; <nl> + const int output_height = output_shape . Dims ( 1 ) ; <nl> + <nl> + const int input_depth = input_shape . Dims ( 3 ) ; <nl> + const int batch_size = input_shape . Dims ( 0 ) ; <nl> <nl> / / Number of continuous values that we can copy in one interation . <nl> - const int stride = block_size * input_depth ; <nl> + const int stride = op_params . block_size * input_depth ; <nl> <nl> for ( int batch = 0 ; batch < batch_size ; + + batch ) { <nl> for ( int out_h = 0 ; out_h < output_height ; + + out_h ) { <nl> - T * output_ptr = output_data + Offset ( output_dims , 0 , 0 , out_h , batch ) ; <nl> - for ( int offset_h = 0 ; offset_h < block_size ; + + offset_h ) { <nl> + T * output_ptr = output_data + Offset ( output_shape , batch , out_h , 0 , 0 ) ; <nl> + for ( int offset_h = 0 ; offset_h < op_params . block_size ; + + offset_h ) { <nl> T * dst = output_ptr ; <nl> for ( int out_w = 0 ; out_w < output_width ; + + out_w ) { <nl> memcpy ( dst , input_data , stride * sizeof ( T ) ) ; <nl> inline void SpaceToDepth ( const T * input_data , const Dims < 4 > & input_dims , <nl> } <nl> } <nl> <nl> + / / Legacy Dims < 4 > . <nl> + template < typename T > <nl> + inline void SpaceToDepth ( const T * input_data , const Dims < 4 > & input_dims , <nl> + int block_size , T * output_data , <nl> + const Dims < 4 > & output_dims ) { <nl> + tflite : : SpaceToDepthParams op_params ; <nl> + op_params . block_size = block_size ; <nl> + <nl> + SpaceToDepth ( op_params , DimsToShape ( input_dims ) , input_data , <nl> + DimsToShape ( output_dims ) , output_data ) ; <nl> + } <nl> + <nl> template < FusedActivationFunctionType Ac > <nl> void NonGlobalBatchNormalization ( <nl> const float * input_data , const Dims < 4 > & input_dims , const float * mean_data , <nl> inline void GetIndexRange ( int spatial_index_dim , int block_shape_dim , <nl> } <nl> <nl> template < typename T > <nl> - inline void BatchToSpaceND ( const T * input_data , const Dims < 4 > & input_dims , <nl> - const int32 * block_shape_data , <nl> - const Dims < 4 > & block_shape_dims , <nl> - const int32 * crops_data , const Dims < 4 > & crops_dims , <nl> - T * output_data , const Dims < 4 > & output_dims ) { <nl> + inline void BatchToSpaceND ( <nl> + const RuntimeShape & unextended_input1_shape , const T * input1_data , <nl> + const RuntimeShape & unextended_input2_shape , const int32 * block_shape_data , <nl> + const RuntimeShape & unextended_input3_shape , const int32 * crops_data , <nl> + const RuntimeShape & unextended_output_shape , T * output_data ) { <nl> gemmlowp : : ScopedProfilingLabel label ( " BatchToSpaceND " ) ; <nl> <nl> - const int output_batch_size = ArraySize ( output_dims , 3 ) ; <nl> - const int output_height = ArraySize ( output_dims , 2 ) ; <nl> - const int output_width = ArraySize ( output_dims , 1 ) ; <nl> - const int input_batch_size = ArraySize ( input_dims , 3 ) ; <nl> - const int input_height = ArraySize ( input_dims , 2 ) ; <nl> - const int input_width = ArraySize ( input_dims , 1 ) ; <nl> - const int depth = ArraySize ( input_dims , 0 ) ; <nl> + TFLITE_DCHECK_LE ( unextended_input1_shape . DimensionsCount ( ) , 4 ) ; <nl> + TFLITE_DCHECK_LE ( unextended_output_shape . DimensionsCount ( ) , 4 ) ; <nl> + RuntimeShape input1_shape = <nl> + RuntimeShape : : ExtendedShape ( 4 , unextended_input1_shape ) ; <nl> + RuntimeShape output_shape = <nl> + RuntimeShape : : ExtendedShape ( 4 , unextended_output_shape ) ; <nl> + <nl> + const int output_width = output_shape . Dims ( 2 ) ; <nl> + const int output_height = output_shape . Dims ( 1 ) ; <nl> + const int output_batch_size = output_shape . Dims ( 0 ) ; <nl> + <nl> + const int depth = input1_shape . Dims ( 3 ) ; <nl> + const int input_width = input1_shape . Dims ( 2 ) ; <nl> + const int input_height = input1_shape . Dims ( 1 ) ; <nl> + const int input_batch_size = input1_shape . Dims ( 0 ) ; <nl> + <nl> const int block_shape_width = block_shape_data [ 1 ] ; <nl> const int block_shape_height = block_shape_data [ 0 ] ; <nl> const int crops_top = crops_data [ 0 ] ; <nl> inline void BatchToSpaceND ( const T * input_data , const Dims < 4 > & input_dims , <nl> spatial_offset % block_shape_width - crops_left ; <nl> TFLITE_DCHECK_GE ( out_w , 0 ) ; <nl> TFLITE_DCHECK_LT ( out_w , output_width ) ; <nl> - T * out = output_data + Offset ( output_dims , 0 , out_w , out_h , out_batch ) ; <nl> - const T * in = input_data + Offset ( input_dims , 0 , in_w , in_h , in_batch ) ; <nl> + T * out = output_data + Offset ( output_shape , out_batch , out_h , out_w , 0 ) ; <nl> + const T * in = <nl> + input1_data + Offset ( input1_shape , in_batch , in_h , in_w , 0 ) ; <nl> memcpy ( out , in , depth * sizeof ( T ) ) ; <nl> } <nl> } <nl> } <nl> } <nl> <nl> + / / Legacy Dims < 4 > . <nl> + template < typename T > <nl> + inline void BatchToSpaceND ( const T * input_data , const Dims < 4 > & input_dims , <nl> + const int32 * block_shape_data , <nl> + const Dims < 4 > & block_shape_dims , <nl> + const int32 * crops_data , const Dims < 4 > & crops_dims , <nl> + T * output_data , const Dims < 4 > & output_dims ) { <nl> + BatchToSpaceND ( DimsToShape ( input_dims ) , input_data , <nl> + DimsToShape ( block_shape_dims ) , block_shape_data , <nl> + DimsToShape ( crops_dims ) , crops_data , DimsToShape ( output_dims ) , <nl> + output_data ) ; <nl> + } <nl> + <nl> template < typename T > <nl> void TypedMemset ( void * ptr , T value , size_t num ) { <nl> / / Optimization for common cases where memset ( ) will suffice . <nl> mmm a / tensorflow / contrib / lite / kernels / internal / reference / reference_ops . h <nl> ppp b / tensorflow / contrib / lite / kernels / internal / reference / reference_ops . h <nl> void Conv ( const uint8 * input_data , const Dims < 4 > & input_dims , <nl> } <nl> <nl> template < typename T > <nl> - inline void DepthToSpace ( const T * input_data , const Dims < 4 > & input_dims , <nl> - int block_size , T * output_data , <nl> - const Dims < 4 > & output_dims ) { <nl> - const int input_depth = ArraySize ( input_dims , 0 ) ; <nl> - const int input_width = ArraySize ( input_dims , 1 ) ; <nl> - const int input_height = ArraySize ( input_dims , 2 ) ; <nl> - const int input_batch = ArraySize ( input_dims , 3 ) ; <nl> + inline void DepthToSpace ( const tflite : : DepthToSpaceParams & op_params , <nl> + const RuntimeShape & unextended_input_shape , <nl> + const T * input_data , <nl> + const RuntimeShape & unextended_output_shape , <nl> + T * output_data ) { <nl> + TFLITE_DCHECK_LE ( unextended_input_shape . DimensionsCount ( ) , 4 ) ; <nl> + TFLITE_DCHECK_LE ( unextended_output_shape . DimensionsCount ( ) , 4 ) ; <nl> + RuntimeShape input_shape = <nl> + RuntimeShape : : ExtendedShape ( 4 , unextended_input_shape ) ; <nl> + RuntimeShape output_shape = <nl> + RuntimeShape : : ExtendedShape ( 4 , unextended_output_shape ) ; <nl> <nl> - const int output_depth = ArraySize ( output_dims , 0 ) ; <nl> - const int output_width = ArraySize ( output_dims , 1 ) ; <nl> - const int output_height = ArraySize ( output_dims , 2 ) ; <nl> - const int output_batch = ArraySize ( output_dims , 3 ) ; <nl> + const int input_depth = input_shape . Dims ( 3 ) ; <nl> + const int input_width = input_shape . Dims ( 2 ) ; <nl> + const int input_height = input_shape . Dims ( 1 ) ; <nl> + const int input_batch = input_shape . Dims ( 0 ) ; <nl> + <nl> + const int output_depth = output_shape . Dims ( 3 ) ; <nl> + const int output_width = output_shape . Dims ( 2 ) ; <nl> + const int output_height = output_shape . Dims ( 1 ) ; <nl> + const int output_batch = output_shape . Dims ( 0 ) ; <nl> + <nl> + const int32 block_size = op_params . block_size ; <nl> <nl> TFLITE_DCHECK_EQ ( input_width * block_size , output_width ) ; <nl> TFLITE_DCHECK_EQ ( input_height * block_size , output_height ) ; <nl> inline void DepthToSpace ( const T * input_data , const Dims < 4 > & input_dims , <nl> const int in_h = out_h / block_size ; <nl> const int in_b = out_b ; <nl> <nl> + const int input_index = Offset ( input_shape , in_b , in_h , in_w , in_d ) ; <nl> const int output_index = <nl> - Offset ( output_dims , out_d , out_w , out_h , out_b ) ; <nl> - const int input_index = Offset ( input_dims , in_d , in_w , in_h , in_b ) ; <nl> + Offset ( output_shape , out_b , out_h , out_w , out_d ) ; <nl> <nl> output_data [ output_index ] = input_data [ input_index ] ; <nl> } <nl> inline void DepthToSpace ( const T * input_data , const Dims < 4 > & input_dims , <nl> } <nl> } <nl> <nl> + / / Legacy Dims < 4 > . <nl> template < typename T > <nl> - inline void SpaceToDepth ( const T * input_data , const Dims < 4 > & input_dims , <nl> + inline void DepthToSpace ( const T * input_data , const Dims < 4 > & input_dims , <nl> int block_size , T * output_data , <nl> const Dims < 4 > & output_dims ) { <nl> - const int input_depth = ArraySize ( input_dims , 0 ) ; <nl> - const int input_width = ArraySize ( input_dims , 1 ) ; <nl> - const int input_height = ArraySize ( input_dims , 2 ) ; <nl> - const int input_batch = ArraySize ( input_dims , 3 ) ; <nl> + tflite : : DepthToSpaceParams op_params ; <nl> + op_params . block_size = block_size ; <nl> <nl> - const int output_depth = ArraySize ( output_dims , 0 ) ; <nl> - const int output_width = ArraySize ( output_dims , 1 ) ; <nl> - const int output_height = ArraySize ( output_dims , 2 ) ; <nl> - const int output_batch = ArraySize ( output_dims , 3 ) ; <nl> + DepthToSpace ( op_params , DimsToShape ( input_dims ) , input_data , <nl> + DimsToShape ( output_dims ) , output_data ) ; <nl> + } <nl> + <nl> + template < typename T > <nl> + inline void SpaceToDepth ( const tflite : : SpaceToDepthParams & op_params , <nl> + const RuntimeShape & unextended_input_shape , <nl> + const T * input_data , <nl> + const RuntimeShape & unextended_output_shape , <nl> + T * output_data ) { <nl> + TFLITE_DCHECK_LE ( unextended_input_shape . DimensionsCount ( ) , 4 ) ; <nl> + TFLITE_DCHECK_LE ( unextended_output_shape . DimensionsCount ( ) , 4 ) ; <nl> + RuntimeShape input_shape = <nl> + RuntimeShape : : ExtendedShape ( 4 , unextended_input_shape ) ; <nl> + RuntimeShape output_shape = <nl> + RuntimeShape : : ExtendedShape ( 4 , unextended_output_shape ) ; <nl> + <nl> + const int input_depth = input_shape . Dims ( 3 ) ; <nl> + const int input_width = input_shape . Dims ( 2 ) ; <nl> + const int input_height = input_shape . Dims ( 1 ) ; <nl> + const int input_batch = input_shape . Dims ( 0 ) ; <nl> + <nl> + const int output_depth = output_shape . Dims ( 3 ) ; <nl> + const int output_width = output_shape . Dims ( 2 ) ; <nl> + const int output_height = output_shape . Dims ( 1 ) ; <nl> + const int output_batch = output_shape . Dims ( 0 ) ; <nl> + <nl> + const int32 block_size = op_params . block_size ; <nl> <nl> TFLITE_DCHECK_EQ ( input_width , output_width * block_size ) ; <nl> TFLITE_DCHECK_EQ ( input_height , output_height * block_size ) ; <nl> inline void SpaceToDepth ( const T * input_data , const Dims < 4 > & input_dims , <nl> const int out_h = in_h / block_size ; <nl> const int out_b = in_b ; <nl> <nl> + const int input_index = Offset ( input_shape , in_b , in_h , in_w , in_d ) ; <nl> const int output_index = <nl> - Offset ( output_dims , out_d , out_w , out_h , out_b ) ; <nl> - const int input_index = Offset ( input_dims , in_d , in_w , in_h , in_b ) ; <nl> + Offset ( output_shape , out_b , out_h , out_w , out_d ) ; <nl> <nl> output_data [ output_index ] = input_data [ input_index ] ; <nl> } <nl> inline void SpaceToDepth ( const T * input_data , const Dims < 4 > & input_dims , <nl> } <nl> } <nl> <nl> + / / Legacy Dims < 4 > . <nl> + template < typename T > <nl> + inline void SpaceToDepth ( const T * input_data , const Dims < 4 > & input_dims , <nl> + int block_size , T * output_data , <nl> + const Dims < 4 > & output_dims ) { <nl> + tflite : : SpaceToDepthParams op_params ; <nl> + op_params . block_size = block_size ; <nl> + <nl> + SpaceToDepth ( op_params , DimsToShape ( input_dims ) , input_data , <nl> + DimsToShape ( output_dims ) , output_data ) ; <nl> + } <nl> + <nl> inline void FullyConnected ( const float * input_data , const Dims < 4 > & input_dims , <nl> const float * weights_data , <nl> const Dims < 4 > & weights_dims , const float * bias_data , <nl> inline void ResizeBilinear ( const uint8 * input_data , const Dims < 4 > & input_dims , <nl> } <nl> <nl> template < typename T > <nl> - inline void SpaceToBatchND ( const T * input_data , const Dims < 4 > & input_dims , <nl> - const int32 * block_shape_data , <nl> - const Dims < 4 > & block_shape_dims , <nl> - const int32 * paddings_data , <nl> - const Dims < 4 > & paddings_dims , T * output_data , <nl> - const Dims < 4 > & output_dims , <nl> - const int32_t pad_value ) { <nl> - const int output_batch_size = ArraySize ( output_dims , 3 ) ; <nl> - const int output_height = ArraySize ( output_dims , 2 ) ; <nl> - const int output_width = ArraySize ( output_dims , 1 ) ; <nl> - const int input_batch_size = ArraySize ( input_dims , 3 ) ; <nl> - const int input_height = ArraySize ( input_dims , 2 ) ; <nl> - const int input_width = ArraySize ( input_dims , 1 ) ; <nl> - const int depth = ArraySize ( input_dims , 0 ) ; <nl> + inline void SpaceToBatchND ( <nl> + const SpaceToBatchParams & params , <nl> + const RuntimeShape & unextended_input1_shape , const T * input1_data , <nl> + const RuntimeShape & unextended_input2_shape , const int32 * block_shape_data , <nl> + const RuntimeShape & unextended_input3_shape , const int32 * paddings_data , <nl> + const RuntimeShape & unextended_output_shape , T * output_data ) { <nl> + TFLITE_DCHECK_LE ( unextended_input1_shape . DimensionsCount ( ) , 4 ) ; <nl> + TFLITE_DCHECK_LE ( unextended_output_shape . DimensionsCount ( ) , 4 ) ; <nl> + RuntimeShape input1_shape = <nl> + RuntimeShape : : ExtendedShape ( 4 , unextended_input1_shape ) ; <nl> + RuntimeShape output_shape = <nl> + RuntimeShape : : ExtendedShape ( 4 , unextended_output_shape ) ; <nl> + <nl> + const int depth = input1_shape . Dims ( 3 ) ; <nl> + const int input_width = input1_shape . Dims ( 2 ) ; <nl> + const int input_height = input1_shape . Dims ( 1 ) ; <nl> + const int input_batch_size = input1_shape . Dims ( 0 ) ; <nl> + <nl> + const int output_width = output_shape . Dims ( 2 ) ; <nl> + const int output_height = output_shape . Dims ( 1 ) ; <nl> + const int output_batch_size = output_shape . Dims ( 0 ) ; <nl> + <nl> const int block_shape_height = block_shape_data [ 0 ] ; <nl> const int block_shape_width = block_shape_data [ 1 ] ; <nl> const int padding_top = paddings_data [ 0 ] ; <nl> const int padding_left = paddings_data [ 2 ] ; <nl> <nl> + / / For uint8 quantized , the correct padding " zero value " is the output offset . <nl> + const int32_t pad_value = params . output_offset ; <nl> + <nl> for ( int out_b = 0 ; out_b < output_batch_size ; + + out_b ) { <nl> int input_batch = out_b % input_batch_size ; <nl> int shift_w = ( out_b / input_batch_size ) % block_shape_width ; <nl> int shift_h = ( out_b / input_batch_size ) / block_shape_width ; <nl> for ( int out_h = 0 ; out_h < output_height ; + + out_h ) { <nl> for ( int out_w = 0 ; out_w < output_width ; + + out_w ) { <nl> - T * out = output_data + Offset ( output_dims , 0 , out_w , out_h , out_b ) ; <nl> + T * out = output_data + Offset ( output_shape , out_b , out_h , out_w , 0 ) ; <nl> if ( out_h * block_shape_height + shift_h < padding_top | | <nl> out_h * block_shape_height + shift_h > = <nl> padding_top + input_height | | <nl> out_w * block_shape_width + shift_w < padding_left | | <nl> out_w * block_shape_width + shift_w > = padding_left + input_width ) { <nl> + / / This may not execute correctly when pad_value ! = 0 and T ! = uint8 . <nl> memset ( out , pad_value , depth * sizeof ( T ) ) ; <nl> } else { <nl> const T * in = <nl> - input_data + <nl> - Offset ( input_dims , 0 , <nl> - ( out_w * block_shape_width + shift_w ) - padding_left , <nl> + input1_data + <nl> + Offset ( input1_shape , input_batch , <nl> ( out_h * block_shape_height + shift_h ) - padding_top , <nl> - input_batch ) ; <nl> + ( out_w * block_shape_width + shift_w ) - padding_left , 0 ) ; <nl> memcpy ( out , in , depth * sizeof ( T ) ) ; <nl> } <nl> } <nl> inline void SpaceToBatchND ( const T * input_data , const Dims < 4 > & input_dims , <nl> } <nl> } <nl> <nl> + / / Legacy Dims < 4 > . <nl> template < typename T > <nl> inline void SpaceToBatchND ( const T * input_data , const Dims < 4 > & input_dims , <nl> const int32 * block_shape_data , <nl> const Dims < 4 > & block_shape_dims , <nl> const int32 * paddings_data , <nl> const Dims < 4 > & paddings_dims , T * output_data , <nl> - const Dims < 4 > & output_dims ) { <nl> - SpaceToBatchND ( input_data , input_dims , block_shape_data , block_shape_dims , <nl> - paddings_data , paddings_dims , output_data , output_dims , 0 ) ; <nl> + const Dims < 4 > & output_dims , <nl> + const int32_t pad_value ) { <nl> + tflite : : SpaceToBatchParams op_params ; <nl> + op_params . output_offset = pad_value ; <nl> + <nl> + SpaceToBatchND ( op_params , DimsToShape ( input_dims ) , input_data , <nl> + DimsToShape ( block_shape_dims ) , block_shape_data , <nl> + DimsToShape ( paddings_dims ) , paddings_data , <nl> + DimsToShape ( output_dims ) , output_data ) ; <nl> } <nl> <nl> + / / Legacy if no good reason to have signature with pad_value = 0 . <nl> template < typename T > <nl> - inline void BatchToSpaceND ( const T * input_data , const Dims < 4 > & input_dims , <nl> + inline void SpaceToBatchND ( const T * input_data , const Dims < 4 > & input_dims , <nl> const int32 * block_shape_data , <nl> const Dims < 4 > & block_shape_dims , <nl> - const int32 * crops_data , const Dims < 4 > & crops_dims , <nl> - T * output_data , const Dims < 4 > & output_dims ) { <nl> - const int output_batch_size = ArraySize ( output_dims , 3 ) ; <nl> - const int output_height = ArraySize ( output_dims , 2 ) ; <nl> - const int output_width = ArraySize ( output_dims , 1 ) ; <nl> - const int input_batch_size = ArraySize ( input_dims , 3 ) ; <nl> - const int input_height = ArraySize ( input_dims , 2 ) ; <nl> - const int input_width = ArraySize ( input_dims , 1 ) ; <nl> - const int depth = ArraySize ( input_dims , 0 ) ; <nl> + const int32 * paddings_data , <nl> + const Dims < 4 > & paddings_dims , T * output_data , <nl> + const Dims < 4 > & output_dims ) { <nl> + tflite : : SpaceToBatchParams op_params ; <nl> + op_params . output_offset = 0 ; <nl> + <nl> + SpaceToBatchND ( op_params , DimsToShape ( input_dims ) , input_data , <nl> + DimsToShape ( block_shape_dims ) , block_shape_data , <nl> + DimsToShape ( paddings_dims ) , paddings_data , <nl> + DimsToShape ( output_dims ) , output_data ) ; <nl> + } <nl> + <nl> + template < typename T > <nl> + inline void BatchToSpaceND ( <nl> + const RuntimeShape & unextended_input1_shape , const T * input1_data , <nl> + const RuntimeShape & unextended_input2_shape , const int32 * block_shape_data , <nl> + const RuntimeShape & unextended_input3_shape , const int32 * crops_data , <nl> + const RuntimeShape & unextended_output_shape , T * output_data ) { <nl> + TFLITE_DCHECK_LE ( unextended_input1_shape . DimensionsCount ( ) , 4 ) ; <nl> + TFLITE_DCHECK_LE ( unextended_output_shape . DimensionsCount ( ) , 4 ) ; <nl> + RuntimeShape input1_shape = <nl> + RuntimeShape : : ExtendedShape ( 4 , unextended_input1_shape ) ; <nl> + RuntimeShape output_shape = <nl> + RuntimeShape : : ExtendedShape ( 4 , unextended_output_shape ) ; <nl> + <nl> + const int output_width = output_shape . Dims ( 2 ) ; <nl> + const int output_height = output_shape . Dims ( 1 ) ; <nl> + const int output_batch_size = output_shape . Dims ( 0 ) ; <nl> + <nl> + const int depth = input1_shape . Dims ( 3 ) ; <nl> + const int input_width = input1_shape . Dims ( 2 ) ; <nl> + const int input_height = input1_shape . Dims ( 1 ) ; <nl> + const int input_batch_size = input1_shape . Dims ( 0 ) ; <nl> + <nl> const int block_shape_width = block_shape_data [ 1 ] ; <nl> const int block_shape_height = block_shape_data [ 0 ] ; <nl> const int crops_top = crops_data [ 0 ] ; <nl> inline void BatchToSpaceND ( const T * input_data , const Dims < 4 > & input_dims , <nl> if ( out_w < 0 | | out_w > = output_width ) { <nl> continue ; <nl> } <nl> - T * out = output_data + Offset ( output_dims , 0 , out_w , out_h , out_batch ) ; <nl> - const T * in = input_data + Offset ( input_dims , 0 , in_w , in_h , in_batch ) ; <nl> + T * out = output_data + Offset ( output_shape , out_batch , out_h , out_w , 0 ) ; <nl> + const T * in = <nl> + input1_data + Offset ( input1_shape , in_batch , in_h , in_w , 0 ) ; <nl> memcpy ( out , in , depth * sizeof ( T ) ) ; <nl> } <nl> } <nl> } <nl> } <nl> <nl> + / / Legacy Dims < 4 > . <nl> + template < typename T > <nl> + inline void BatchToSpaceND ( const T * input_data , const Dims < 4 > & input_dims , <nl> + const int32 * block_shape_data , <nl> + const Dims < 4 > & block_shape_dims , <nl> + const int32 * crops_data , const Dims < 4 > & crops_dims , <nl> + T * output_data , const Dims < 4 > & output_dims ) { <nl> + BatchToSpaceND ( DimsToShape ( input_dims ) , input_data , <nl> + DimsToShape ( block_shape_dims ) , block_shape_data , <nl> + DimsToShape ( crops_dims ) , crops_data , DimsToShape ( output_dims ) , <nl> + output_data ) ; <nl> + } <nl> + <nl> / / There are two versions of pad : Pad and PadV2 . In PadV2 there is a second <nl> / / scalar input that provides the padding value . Therefore pad_value_ptr can be <nl> / / equivalent to a simple input1_data . For Pad , it should point to a zero <nl> mmm a / tensorflow / contrib / lite / kernels / internal / types . h <nl> ppp b / tensorflow / contrib / lite / kernels / internal / types . h <nl> struct ConvParams { <nl> } ; <nl> <nl> struct DepthToSpaceParams { <nl> - int16 block_size ; <nl> + int32 block_size ; <nl> } ; <nl> <nl> struct DepthwiseParams { <nl> struct SoftmaxParams { <nl> int diff_min ; <nl> } ; <nl> <nl> + struct SpaceToBatchParams { <nl> + / / " Zero " padding for uint8 means padding with the output offset . <nl> + int32 output_offset ; <nl> + } ; <nl> + <nl> struct SpaceToDepthParams { <nl> - int16 block_size ; <nl> + int32 block_size ; <nl> } ; <nl> <nl> struct SplitParams { <nl> | Convert more kernel signatures to use runtime shapes . | tensorflow/tensorflow | d7682bb16f575eb0c4cbb1622d8098c592fed2b7 | 2018-08-23T20:27:24Z |
new file mode 100644 <nl> index 00000000 . . 1650cc5c <nl> mmm / dev / null <nl> ppp b / src / openalpr / segmentation / segment . cpp <nl> <nl> + / * <nl> + * Copyright ( c ) 2013 New Designs Unlimited , LLC <nl> + * Opensource Automated License Plate Recognition [ http : / / www . openalpr . com ] <nl> + * <nl> + * This file is part of OpenAlpr . <nl> + * <nl> + * OpenAlpr is free software : you can redistribute it and / or modify <nl> + * it under the terms of the GNU Affero General Public License <nl> + * version 3 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> + # include " segment . h " <nl> + <nl> + Segment : : Segment ( cv : : Rect newSegment ) <nl> + { <nl> + this - > segment = newSegment ; <nl> + } <nl> + <nl> + Segment : : ~ Segment ( ) <nl> + { <nl> + <nl> + } <nl> + <nl> + bool Segment : : matches ( cv : : Rect newSegment ) <nl> + { <nl> + / / Compare the two segments with a given leniency <nl> + const float WIDTH_LENIENCY_MIN = 0 . 25 ; <nl> + const float WIDTH_LENIENCY_MAX = 0 . 20 ; <nl> + <nl> + float left_min = segment . x - ( ( ( float ) segment . width ) * WIDTH_LENIENCY_MIN ) ; <nl> + float left_max = segment . x + ( ( ( float ) segment . width ) * WIDTH_LENIENCY_MAX ) ; <nl> + float right_min = ( segment . x + segment . width ) - ( ( ( float ) segment . width ) * WIDTH_LENIENCY_MIN ) ; <nl> + float right_max = ( segment . x + segment . width ) + ( ( ( float ) segment . width ) * WIDTH_LENIENCY_MAX ) ; <nl> + <nl> + int newSegRight = newSegment . x + newSegment . width ; <nl> + if ( newSegment . x > = left_min & & newSegment . x < = left_max & & <nl> + newSegRight > = right_min & & newSegRight < = right_max ) <nl> + return true ; <nl> + <nl> + return false ; <nl> + } <nl> + <nl> new file mode 100644 <nl> index 00000000 . . 7743ab66 <nl> mmm / dev / null <nl> ppp b / src / openalpr / segmentation / segment . h <nl> <nl> + / * <nl> + * Copyright ( c ) 2013 New Designs Unlimited , LLC <nl> + * Opensource Automated License Plate Recognition [ http : / / www . openalpr . com ] <nl> + * <nl> + * This file is part of OpenAlpr . <nl> + * <nl> + * OpenAlpr is free software : you can redistribute it and / or modify <nl> + * it under the terms of the GNU Affero General Public License <nl> + * version 3 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> + # ifndef OPENALPR_SEGMENT_H <nl> + # define OPENALPR_SEGMENT_H <nl> + <nl> + # include < vector > <nl> + # include < stdio . h > <nl> + <nl> + # include " opencv2 / imgproc / imgproc . hpp " <nl> + <nl> + class Segment <nl> + { <nl> + <nl> + public : <nl> + Segment ( cv : : Rect newSegment ) ; <nl> + virtual ~ Segment ( ) ; <nl> + <nl> + cv : : Rect segment ; <nl> + <nl> + bool matches ( cv : : Rect newSegment ) ; <nl> + <nl> + } ; <nl> + <nl> + # endif / / OPENALPR_SEGMENTATIONGROUP_H <nl> new file mode 100644 <nl> index 00000000 . . a1463649 <nl> mmm / dev / null <nl> ppp b / src / openalpr / segmentation / segmentationgroup . cpp <nl> <nl> + / * <nl> + * Copyright ( c ) 2013 New Designs Unlimited , LLC <nl> + * Opensource Automated License Plate Recognition [ http : / / www . openalpr . com ] <nl> + * <nl> + * This file is part of OpenAlpr . <nl> + * <nl> + * OpenAlpr is free software : you can redistribute it and / or modify <nl> + * it under the terms of the GNU Affero General Public License <nl> + * version 3 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> + # include " segmentationgroup . h " <nl> + <nl> + SegmentationGroup : : SegmentationGroup ( ) <nl> + { <nl> + <nl> + } <nl> + <nl> + SegmentationGroup : : ~ SegmentationGroup ( ) <nl> + { <nl> + <nl> + } <nl> + <nl> + void SegmentationGroup : : add ( int segmentID ) <nl> + { <nl> + this - > segmentIDs . push_back ( segmentID ) ; <nl> + } <nl> + <nl> + bool SegmentationGroup : : equals ( SegmentationGroup otherGroup ) <nl> + { <nl> + if ( segmentIDs . size ( ) ! = otherGroup . segmentIDs . size ( ) ) <nl> + return false ; <nl> + <nl> + for ( int i = 0 ; i < segmentIDs . size ( ) ; i + + ) <nl> + { <nl> + if ( otherGroup . segmentIDs [ i ] ! = segmentIDs [ i ] ) <nl> + return false ; <nl> + } <nl> + <nl> + return true ; <nl> + } <nl> \ No newline at end of file <nl> new file mode 100644 <nl> index 00000000 . . d9cc633d <nl> mmm / dev / null <nl> ppp b / src / openalpr / segmentation / segmentationgroup . h <nl> <nl> + / * <nl> + * Copyright ( c ) 2013 New Designs Unlimited , LLC <nl> + * Opensource Automated License Plate Recognition [ http : / / www . openalpr . com ] <nl> + * <nl> + * This file is part of OpenAlpr . <nl> + * <nl> + * OpenAlpr is free software : you can redistribute it and / or modify <nl> + * it under the terms of the GNU Affero General Public License <nl> + * version 3 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> + # ifndef OPENALPR_SEGMENTATIONGROUP_H <nl> + # define OPENALPR_SEGMENTATIONGROUP_H <nl> + <nl> + # include < vector > <nl> + # include < stdio . h > <nl> + <nl> + # include " opencv2 / imgproc / imgproc . hpp " <nl> + <nl> + # include " segment . h " <nl> + <nl> + <nl> + class SegmentationGroup <nl> + { <nl> + <nl> + public : <nl> + SegmentationGroup ( ) ; <nl> + virtual ~ SegmentationGroup ( ) ; <nl> + <nl> + void add ( int segmentID ) ; <nl> + <nl> + std : : vector < int > segmentIDs ; <nl> + <nl> + bool equals ( SegmentationGroup otherGroup ) ; <nl> + <nl> + <nl> + private : <nl> + float strength ; / / Debuggin purposes - - how many threshold segmentations match this one perfectly <nl> + <nl> + } ; <nl> + <nl> + # endif / / OPENALPR_SEGMENTATIONGROUP_H <nl> | Added segment / segmentationgroup | openalpr/openalpr | 43b025b6233717f60da3aa177cabfb0174f349c0 | 2014-07-01T23:35:27Z |
mmm a / include / swift / Driver / Job . h <nl> ppp b / include / swift / Driver / Job . h <nl> class Job { <nl> const llvm : : opt : : ArgStringList & Args ) ; <nl> } ; <nl> <nl> + / / / A BatchJob comprises a _set_ of jobs , each of which is sufficiently similar <nl> + / / / to the others that the whole set can be combined into a single subprocess <nl> + / / / ( and thus run potentially more - efficiently than running each Job in the set <nl> + / / / individually ) . <nl> + / / / <nl> + / / / Not all Jobs can be combined into a BatchJob : at present , only those Jobs <nl> + / / / that come from CompileJobActions , and which otherwise have the exact same <nl> + / / / input file list and arguments as one another , aside from their primary - file . <nl> + / / / See ToolChain : : jobsAreBatchCombinable for details . <nl> + <nl> + class BatchJob : public Job { <nl> + SmallVector < const Job * , 4 > CombinedJobs ; <nl> + public : <nl> + BatchJob ( const JobAction & Source , SmallVectorImpl < const Job * > & & Inputs , <nl> + std : : unique_ptr < CommandOutput > Output , const char * Executable , <nl> + llvm : : opt : : ArgStringList Arguments , <nl> + EnvironmentVector ExtraEnvironment , <nl> + std : : vector < FilelistInfo > Infos , <nl> + ArrayRef < const Job * > Combined ) ; <nl> + <nl> + ArrayRef < const Job * > getCombinedJobs ( ) const { <nl> + return CombinedJobs ; <nl> + } <nl> + } ; <nl> + <nl> } / / end namespace driver <nl> } / / end namespace swift <nl> <nl> mmm a / lib / Driver / Job . cpp <nl> ppp b / lib / Driver / Job . cpp <nl> void Job : : printSummary ( raw_ostream & os ) const { <nl> } <nl> os < < " } " ; <nl> } <nl> + <nl> + BatchJob : : BatchJob ( const JobAction & Source , <nl> + SmallVectorImpl < const Job * > & & Inputs , <nl> + std : : unique_ptr < CommandOutput > Output , <nl> + const char * Executable , llvm : : opt : : ArgStringList Arguments , <nl> + EnvironmentVector ExtraEnvironment , <nl> + std : : vector < FilelistInfo > Infos , <nl> + ArrayRef < const Job * > Combined ) <nl> + : Job ( Source , std : : move ( Inputs ) , std : : move ( Output ) , Executable , Arguments , <nl> + ExtraEnvironment , Infos ) , <nl> + CombinedJobs ( Combined . begin ( ) , Combined . end ( ) ) { } <nl> | [ BatchMode ] Add BatchJob subclass of Job , for use with BatchModeCompile . | apple/swift | 10c0abea5dade0814288ca2f8b69781be4249401 | 2018-01-24T18:31:19Z |
mmm a / build / cocos2d_libs . xcodeproj / project . pbxproj <nl> ppp b / build / cocos2d_libs . xcodeproj / project . pbxproj <nl> <nl> 3E26D40518ACB5D100834404 / * CCImage . cpp in Sources * / = { isa = PBXBuildFile ; fileRef = 3E26D40418ACB5D100834404 / * CCImage . cpp * / ; } ; <nl> 3E26D40618ACB5D100834404 / * CCImage . cpp in Sources * / = { isa = PBXBuildFile ; fileRef = 3E26D40418ACB5D100834404 / * CCImage . cpp * / ; } ; <nl> 3E26D40818ACB63900834404 / * CCDevice . mm in Sources * / = { isa = PBXBuildFile ; fileRef = 3E26D40718ACB63900834404 / * CCDevice . mm * / ; } ; <nl> + 3EA0FB5B191B92CC00B170C8 / * UIVideoWidget . h in Headers * / = { isa = PBXBuildFile ; fileRef = 3EA0FB59191B92CC00B170C8 / * UIVideoWidget . h * / ; } ; <nl> + 3EA0FB5C191B92CC00B170C8 / * UIVideoWidgetIOS . mm in Sources * / = { isa = PBXBuildFile ; fileRef = 3EA0FB5A191B92CC00B170C8 / * UIVideoWidgetIOS . mm * / ; } ; <nl> 460E468118080832000CDD6D / * cocos - ext . h in Headers * / = { isa = PBXBuildFile ; fileRef = 46A167D21807AF4D005B8026 / * cocos - ext . h * / ; } ; <nl> 460E468218080836000CDD6D / * cocos - ext . h in Headers * / = { isa = PBXBuildFile ; fileRef = 46A167D21807AF4D005B8026 / * cocos - ext . h * / ; } ; <nl> 460E477B180808F5000CDD6D / * ExtensionMacros . h in Headers * / = { isa = PBXBuildFile ; fileRef = 46A168321807AF4E005B8026 / * ExtensionMacros . h * / ; } ; <nl> <nl> 37936A3E1869B76800E974DD / * writer . h * / = { isa = PBXFileReference ; fileEncoding = 4 ; lastKnownFileType = sourcecode . c . h ; path = writer . h ; sourceTree = " < group > " ; } ; <nl> 3E26D40418ACB5D100834404 / * CCImage . cpp * / = { isa = PBXFileReference ; fileEncoding = 4 ; lastKnownFileType = sourcecode . cpp . cpp ; path = CCImage . cpp ; sourceTree = " < group > " ; } ; <nl> 3E26D40718ACB63900834404 / * CCDevice . mm * / = { isa = PBXFileReference ; fileEncoding = 4 ; lastKnownFileType = sourcecode . cpp . objcpp ; path = CCDevice . mm ; sourceTree = " < group > " ; } ; <nl> + 3EA0FB59191B92CC00B170C8 / * UIVideoWidget . h * / = { isa = PBXFileReference ; fileEncoding = 4 ; lastKnownFileType = sourcecode . c . h ; path = UIVideoWidget . h ; sourceTree = " < group > " ; } ; <nl> + 3EA0FB5A191B92CC00B170C8 / * UIVideoWidgetIOS . mm * / = { isa = PBXFileReference ; fileEncoding = 4 ; lastKnownFileType = sourcecode . cpp . objcpp ; path = UIVideoWidgetIOS . mm ; sourceTree = " < group > " ; } ; <nl> 46A15FCC1807A544005B8026 / * AUTHORS * / = { isa = PBXFileReference ; lastKnownFileType = text ; name = AUTHORS ; path = . . / AUTHORS ; sourceTree = " < group > " ; } ; <nl> 46A15FCE1807A544005B8026 / * README . md * / = { isa = PBXFileReference ; lastKnownFileType = text ; name = README . md ; path = . . / README . md ; sourceTree = " < group > " ; } ; <nl> 46A15FE11807A56F005B8026 / * Export . h * / = { isa = PBXFileReference ; lastKnownFileType = sourcecode . c . h ; path = Export . h ; sourceTree = " < group > " ; } ; <nl> <nl> 2905F9E618CF08D000240AA3 / * ui * / = { <nl> isa = PBXGroup ; <nl> children = ( <nl> + 3EA0FB59191B92CC00B170C8 / * UIVideoWidget . h * / , <nl> + 3EA0FB5A191B92CC00B170C8 / * UIVideoWidgetIOS . mm * / , <nl> 2905F9E918CF08D000240AA3 / * CocosGUI . cpp * / , <nl> 2905F9EA18CF08D000240AA3 / * CocosGUI . h * / , <nl> 2905F9EB18CF08D000240AA3 / * GUIDefine . h * / , <nl> <nl> 1A5701A0180BCB590088DEC7 / * CCFont . h in Headers * / , <nl> 1A5701A4180BCB590088DEC7 / * CCFontAtlas . h in Headers * / , <nl> 1A5701A8180BCB590088DEC7 / * CCFontAtlasCache . h in Headers * / , <nl> + 3EA0FB5B191B92CC00B170C8 / * UIVideoWidget . h in Headers * / , <nl> 500DC98919106300007B91BF / * CCNS . h in Headers * / , <nl> 1A5701B4180BCB590088DEC7 / * CCFontFNT . h in Headers * / , <nl> 1A5701B8180BCB5A0088DEC7 / * CCFontFreeType . h in Headers * / , <nl> <nl> 50FCEB9818C72017004AD434 / * CheckBoxReader . cpp in Sources * / , <nl> 1A570076180BC5A10088DEC7 / * CCActionGrid3D . cpp in Sources * / , <nl> 500DC99D19106300007B91BF / * CCValue . cpp in Sources * / , <nl> + 3EA0FB5C191B92CC00B170C8 / * UIVideoWidgetIOS . mm in Sources * / , <nl> B37510851823ACA100B3BA6A / * CCPhysicsWorldInfo_chipmunk . cpp in Sources * / , <nl> 1A57007A180BC5A10088DEC7 / * CCActionInstant . cpp in Sources * / , <nl> 1A57007E180BC5A10088DEC7 / * CCActionInterval . cpp in Sources * / , <nl> mmm a / build / cocos2d_tests . xcodeproj / project . pbxproj <nl> ppp b / build / cocos2d_tests . xcodeproj / project . pbxproj <nl> <nl> 29080DE4191B595E0066F8DF / * UIWidgetAddNodeTest . cpp in Sources * / = { isa = PBXBuildFile ; fileRef = 29080D89191B595E0066F8DF / * UIWidgetAddNodeTest . cpp * / ; } ; <nl> 29080DE5191B595E0066F8DF / * UIWidgetAddNodeTest_Editor . cpp in Sources * / = { isa = PBXBuildFile ; fileRef = 29080D8B191B595E0066F8DF / * UIWidgetAddNodeTest_Editor . cpp * / ; } ; <nl> 29080DE6191B595E0066F8DF / * UIWidgetAddNodeTest_Editor . cpp in Sources * / = { isa = PBXBuildFile ; fileRef = 29080D8B191B595E0066F8DF / * UIWidgetAddNodeTest_Editor . cpp * / ; } ; <nl> + 3EA0FB5E191B92F100B170C8 / * cocosvideo . mp4 in Resources * / = { isa = PBXBuildFile ; fileRef = 3EA0FB5D191B92F100B170C8 / * cocosvideo . mp4 * / ; } ; <nl> + 3EA0FB64191B931500B170C8 / * UIVideoWidgetTest . cpp in Sources * / = { isa = PBXBuildFile ; fileRef = 3EA0FB62191B931500B170C8 / * UIVideoWidgetTest . cpp * / ; } ; <nl> + 3EA0FB66191B933000B170C8 / * MediaPlayer . framework in Frameworks * / = { isa = PBXBuildFile ; fileRef = 3EA0FB65191B933000B170C8 / * MediaPlayer . framework * / ; } ; <nl> A05FCACA177C124500BE600E / * Cocoa . framework in Frameworks * / = { isa = PBXBuildFile ; fileRef = 15C64822165F391E007D4F18 / * Cocoa . framework * / ; } ; <nl> A07A521E1783A1D20073F6A7 / * libz . dylib in Frameworks * / = { isa = PBXBuildFile ; fileRef = 15C6482E165F399D007D4F18 / * libz . dylib * / ; } ; <nl> A07A521F1783A1D20073F6A7 / * Foundation . framework in Frameworks * / = { isa = PBXBuildFile ; fileRef = 15C64832165F3AFD007D4F18 / * Foundation . framework * / ; } ; <nl> <nl> 29080D8A191B595E0066F8DF / * UIWidgetAddNodeTest . h * / = { isa = PBXFileReference ; fileEncoding = 4 ; lastKnownFileType = sourcecode . c . h ; path = UIWidgetAddNodeTest . h ; sourceTree = " < group > " ; } ; <nl> 29080D8B191B595E0066F8DF / * UIWidgetAddNodeTest_Editor . cpp * / = { isa = PBXFileReference ; fileEncoding = 4 ; lastKnownFileType = sourcecode . cpp . cpp ; path = UIWidgetAddNodeTest_Editor . cpp ; sourceTree = " < group > " ; } ; <nl> 29080D8C191B595E0066F8DF / * UIWidgetAddNodeTest_Editor . h * / = { isa = PBXFileReference ; fileEncoding = 4 ; lastKnownFileType = sourcecode . c . h ; path = UIWidgetAddNodeTest_Editor . h ; sourceTree = " < group > " ; } ; <nl> + 3EA0FB5D191B92F100B170C8 / * cocosvideo . mp4 * / = { isa = PBXFileReference ; lastKnownFileType = file ; name = cocosvideo . mp4 ; path = " . . / tests / cpp - tests / Resources / cocosvideo . mp4 " ; sourceTree = " < group > " ; } ; <nl> + 3EA0FB62191B931500B170C8 / * UIVideoWidgetTest . cpp * / = { isa = PBXFileReference ; fileEncoding = 4 ; lastKnownFileType = sourcecode . cpp . cpp ; path = UIVideoWidgetTest . cpp ; sourceTree = " < group > " ; } ; <nl> + 3EA0FB63191B931500B170C8 / * UIVideoWidgetTest . h * / = { isa = PBXFileReference ; fileEncoding = 4 ; lastKnownFileType = sourcecode . c . h ; path = UIVideoWidgetTest . h ; sourceTree = " < group > " ; } ; <nl> + 3EA0FB65191B933000B170C8 / * MediaPlayer . framework * / = { isa = PBXFileReference ; lastKnownFileType = wrapper . framework ; name = MediaPlayer . framework ; path = Platforms / iPhoneOS . platform / Developer / SDKs / iPhoneOS7 . 1 . sdk / System / Library / Frameworks / MediaPlayer . framework ; sourceTree = DEVELOPER_DIR ; } ; <nl> 46A15F9C1807A4F8005B8026 / * cocos2d_libs . xcodeproj * / = { isa = PBXFileReference ; lastKnownFileType = " wrapper . pb - project " ; path = cocos2d_libs . xcodeproj ; sourceTree = " < group > " ; } ; <nl> A035A71117822E9E00987F6C / * libsqlite3 . dylib * / = { isa = PBXFileReference ; lastKnownFileType = " compiled . mach - o . dylib " ; name = libsqlite3 . dylib ; path = usr / lib / libsqlite3 . dylib ; sourceTree = SDKROOT ; } ; <nl> A07A52291783A1D20073F6A7 / * cpp - tests iOS . app * / = { isa = PBXFileReference ; explicitFileType = wrapper . application ; includeInIndex = 0 ; path = " cpp - tests iOS . app " ; sourceTree = BUILT_PRODUCTS_DIR ; } ; <nl> <nl> isa = PBXFrameworksBuildPhase ; <nl> buildActionMask = 2147483647 ; <nl> files = ( <nl> + 3EA0FB66191B933000B170C8 / * MediaPlayer . framework in Frameworks * / , <nl> 1AAF53FE180E39D4000584C8 / * libbox2d iOS . a in Frameworks * / , <nl> 1AAF53FF180E39D4000584C8 / * libchipmunk iOS . a in Frameworks * / , <nl> 1AAF5400180E39D4000584C8 / * libcocos2dx iOS . a in Frameworks * / , <nl> <nl> 1AC35CA818CED83500F37B72 / * Resources * / = { <nl> isa = PBXGroup ; <nl> children = ( <nl> + 3EA0FB5D191B92F100B170C8 / * cocosvideo . mp4 * / , <nl> 1AC35CA918CED84500F37B72 / * animations * / , <nl> 1AC35CAE18CED84500F37B72 / * ccb * / , <nl> 1A221C9B191771E300FD2BE4 / * ccs - res * / , <nl> <nl> 29080D1E191B595E0066F8DF / * CocoStudioGUITest * / = { <nl> isa = PBXGroup ; <nl> children = ( <nl> + 3EA0FB61191B931500B170C8 / * UIVideoWidgetTest * / , <nl> 29080D1F191B595E0066F8DF / * CocosGUIScene . cpp * / , <nl> 29080D20191B595E0066F8DF / * CocosGUIScene . h * / , <nl> 29080D21191B595E0066F8DF / * CocoStudioGUITest . cpp * / , <nl> <nl> 29B97323FDCFA39411CA2CEA / * Frameworks * / = { <nl> isa = PBXGroup ; <nl> children = ( <nl> + 3EA0FB65191B933000B170C8 / * MediaPlayer . framework * / , <nl> 1ABCA3AF18CDA06D0087CE3A / * libz . dylib * / , <nl> 1ABCA3A818CD9F130087CE3A / * AudioToolbox . framework * / , <nl> 1ABCA3A618CD9F0D0087CE3A / * OpenAL . framework * / , <nl> <nl> name = Frameworks ; <nl> sourceTree = " < group > " ; <nl> } ; <nl> + 3EA0FB61191B931500B170C8 / * UIVideoWidgetTest * / = { <nl> + isa = PBXGroup ; <nl> + children = ( <nl> + 3EA0FB62191B931500B170C8 / * UIVideoWidgetTest . cpp * / , <nl> + 3EA0FB63191B931500B170C8 / * UIVideoWidgetTest . h * / , <nl> + ) ; <nl> + path = UIVideoWidgetTest ; <nl> + sourceTree = " < group > " ; <nl> + } ; <nl> 46A15F9D1807A4F8005B8026 / * Products * / = { <nl> isa = PBXGroup ; <nl> children = ( <nl> <nl> 1AC35D0518CED84500F37B72 / * Shaders in Resources * / , <nl> 1AC35CD318CED84500F37B72 / * background . ogg in Resources * / , <nl> 1AC35CCB18CED84500F37B72 / * animations in Resources * / , <nl> + 3EA0FB5E191B92F100B170C8 / * cocosvideo . mp4 in Resources * / , <nl> 1AC35C8C18CECF1400F37B72 / * Icon - 114 . png in Resources * / , <nl> 1AC35CF118CED84500F37B72 / * hd in Resources * / , <nl> 1AC35C9318CECF1400F37B72 / * Icon - 57 . png in Resources * / , <nl> <nl> 1AC35B4218CECF0C00F37B72 / * QuestionContainerSprite . cpp in Sources * / , <nl> 1AC35B6218CECF0C00F37B72 / * DrawPrimitivesTest . cpp in Sources * / , <nl> 29080DDC191B595E0066F8DF / * UITextFieldTest . cpp in Sources * / , <nl> + 3EA0FB64191B931500B170C8 / * UIVideoWidgetTest . cpp in Sources * / , <nl> 1AC35C1818CECF0C00F37B72 / * MotionStreakTest . cpp in Sources * / , <nl> 1AC35C0618CECF0C00F37B72 / * FontTest . cpp in Sources * / , <nl> 1AC35C3818CECF0C00F37B72 / * PerformanceTest . cpp in Sources * / , <nl> | Update XCode project . pbxproj for add files related to VideoWidget . | cocos2d/cocos2d-x | 52d7d804f7650a24e77ff8d5236107fed2e95030 | 2014-05-08T10:28:28Z |
mmm a / src / mongo / db / s / shard_local_test . cpp <nl> ppp b / src / mongo / db / s / shard_local_test . cpp <nl> <nl> # include " mongo / client / read_preference . h " <nl> # include " mongo / db / catalog_raii . h " <nl> # include " mongo / db / client . h " <nl> + # include " mongo / db / dbdirectclient . h " <nl> # include " mongo / db / query / cursor_response . h " <nl> # include " mongo / db / query / find_and_modify_request . h " <nl> # include " mongo / db / repl / replication_coordinator . h " <nl> <nl> # include " mongo / db / service_context_d_test_fixture . h " <nl> # include " mongo / db / write_concern_options . h " <nl> # include " mongo / s / client / shard_registry . h " <nl> + # include " mongo / unittest / death_test . h " <nl> <nl> namespace mongo { <nl> namespace { <nl> TEST_F ( ShardLocalTest , CreateIndex ) { <nl> ASSERT_EQ ( 2U , indexes . size ( ) ) ; <nl> } <nl> <nl> + DEATH_TEST_REGEX_F ( ShardLocalTest , CreateIndexNonEmptyCollection , " Invariant failure . * isEmpty " ) { <nl> + NamespaceString nss ( " config . foo " ) ; <nl> + <nl> + ASSERT_EQUALS ( ErrorCodes : : NamespaceNotFound , getIndexes ( nss ) . getStatus ( ) ) ; <nl> + <nl> + / / Inserting the document should implicitly create the collection <nl> + DBDirectClient dbDirectClient ( _opCtx . get ( ) ) ; <nl> + dbDirectClient . insert ( nss . toString ( ) , BSON ( " _id " < < 1 < < " a " < < 1 ) ) ; <nl> + <nl> + _shardLocal - > createIndexOnConfig ( _opCtx . get ( ) , nss , BSON ( " a " < < 1 ) , false ) . ignore ( ) ; <nl> + } <nl> + <nl> } / / namespace <nl> } / / namespace mongo <nl> | SERVER - 51733 add test case for ShardLocal : : createIndexOnConfig ( ) with non - empty collections | mongodb/mongo | 3aafc656417787ad650701cc55f3a95dc8e75741 | 2020-10-27T16:27:22Z |
mmm a / scripts / global_metadata . json <nl> ppp b / scripts / global_metadata . json <nl> <nl> { <nl> + " bernoulli_naive_bayes " : { <nl> + " location " : " code / artificial_intelligence / src / Bernoulli Naive Bayes " , <nl> + " opengenus_discuss " : " " , <nl> + " opengenus_iq " : " https : / / iq . opengenus . org / bernoulli - naive - bayes / " , <nl> + " files " : [ <nl> + " README . md " , <nl> + " bernoulli . py " <nl> + ] , <nl> + " updated " : " 31 - 05 - 2020 14 : 30 : 00 " <nl> + } , <nl> " square_root_decomposition " : { <nl> " mos_algorithm " : { <nl> " location " : " code / square_root_decomposition / src / mos_algorithm " , <nl> <nl> ] , <nl> " updated " : " 30 - 05 - 2020 04 : 57 : 47 " <nl> } <nl> - } <nl> \ No newline at end of file <nl> + } <nl> | Update global_metadata . json | OpenGenus/cosmos | 4528a0adafa9988df474ee8f9618d7813f847c28 | 2020-05-31T08:59:36Z |
mmm a / hphp / hack / src / server / serverCheckUtils . ml <nl> ppp b / hphp / hack / src / server / serverCheckUtils . ml <nl> let should_do_remote <nl> let t = Unix . gettimeofday ( ) in <nl> let attempt_fix = genv . local_config . attempt_fix_credentials in <nl> match Security . check_credentials ~ attempt_fix with <nl> - | Ok fixes_applied - > <nl> + | Ok success - > <nl> HackEventLogger . credentials_check_end <nl> - ( Printf . sprintf <nl> - " should_do_remote : OK ; fixed credentials : % b " <nl> - fixes_applied ) <nl> + ( Printf . sprintf " should_do_remote : % s " ( Security . show_success success ) ) <nl> t ; <nl> true <nl> | Error error - > <nl> mmm a / hphp / hack / src / server / serverLazyInit . ml <nl> ppp b / hphp / hack / src / server / serverLazyInit . ml <nl> let saved_state_init <nl> let attempt_fix = genv . local_config . SLC . attempt_fix_credentials in <nl> let ( ) = <nl> match Security . check_credentials ~ attempt_fix with <nl> - | Ok fixes_applied - > <nl> + | Ok success - > <nl> HackEventLogger . credentials_check_end <nl> - ( Printf . sprintf <nl> - " saved_state_init : OK ; fixed credentials : % b " <nl> - fixes_applied ) <nl> + ( Printf . sprintf " saved_state_init : % s " ( Security . show_success success ) ) <nl> t <nl> | Error error - > <nl> let kind = Security . to_error_kind_string error in <nl> mmm a / hphp / hack / src / stubs / security . ml <nl> ppp b / hphp / hack / src / stubs / security . ml <nl> <nl> <nl> type error = string <nl> <nl> + type success = Checks_skipped [ @ @ deriving show ] <nl> + <nl> let check_credentials ~ attempt_fix = <nl> ignore attempt_fix ; <nl> - Ok false <nl> + Ok Checks_skipped <nl> <nl> let to_error_message_string error = error <nl> <nl> | Security checks don ' t apply to OnDemand or Sandcastle - skip them | facebook/hhvm | 4da98da2f5ddc0989d3d150dddc1b06ee4087440 | 2020-07-18T19:41:38Z |
mmm a / modules / planning / pipeline / feature_generator . cc <nl> ppp b / modules / planning / pipeline / feature_generator . cc <nl> void FeatureGenerator : : Close ( ) { <nl> < < total_learning_data_frame_num_ ; <nl> } <nl> <nl> - void FeatureGenerator : : OnLocalization ( <nl> - const apollo : : localization : : LocalizationEstimate & le ) { <nl> + void FeatureGenerator : : OnLocalization ( const LocalizationEstimate & le ) { <nl> localization_for_label_ . push_back ( le ) ; <nl> <nl> const int localization_msg_start_cnt = <nl> void FeatureGenerator : : GenerateRoutingFeature ( <nl> } <nl> <nl> void FeatureGenerator : : GenerateADCTrajectoryPoints ( <nl> - const std : : list < apollo : : localization : : LocalizationEstimate > & <nl> - localization_for_label , <nl> + const std : : list < LocalizationEstimate > & localization_for_label , <nl> LearningDataFrame * learning_data_frame ) { <nl> constexpr double kSearchRadius = 1 . 0 ; <nl> <nl> void FeatureGenerator : : GenerateADCTrajectoryPoints ( <nl> std : : string yield_sign_id ; <nl> double yield_sign_distance = 0 . 0 ; <nl> <nl> - int trajectory_point_index = 0 ; <nl> int i = - 1 ; <nl> const int localization_sample_interval_for_trajectory_point = <nl> FLAGS_localization_freq / FLAGS_planning_freq ; <nl> + <nl> + / / use a vector to help reverse traverse list of mutable field <nl> + std : : vector < LocalizationEstimate > localization_points ; <nl> for ( const auto & le : localization_for_label ) { <nl> + + i ; <nl> if ( ( i % localization_sample_interval_for_trajectory_point ) ! = 0 ) { <nl> continue ; <nl> } <nl> - auto adc_trajectory_point = learning_data_frame - > add_adc_trajectory_point ( ) ; <nl> - adc_trajectory_point - > set_timestamp_sec ( le . measurement_time ( ) ) ; <nl> + localization_points . insert ( localization_points . begin ( ) , le ) ; <nl> + } <nl> + <nl> + int trajectory_point_index = 0 ; <nl> + for ( const auto & localization_point : localization_points ) { <nl> + auto adc_trajectory_point = <nl> + learning_data_frame - > add_adc_trajectory_point ( ) ; <nl> + adc_trajectory_point - > set_timestamp_sec ( <nl> + localization_point . measurement_time ( ) ) ; <nl> <nl> auto trajectory_point = adc_trajectory_point - > mutable_trajectory_point ( ) ; <nl> - auto & pose = le . pose ( ) ; <nl> + auto & pose = localization_point . pose ( ) ; <nl> trajectory_point - > mutable_path_point ( ) - > set_x ( pose . position ( ) . x ( ) ) ; <nl> trajectory_point - > mutable_path_point ( ) - > set_y ( pose . position ( ) . y ( ) ) ; <nl> trajectory_point - > mutable_path_point ( ) - > set_z ( pose . position ( ) . z ( ) ) ; <nl> void FeatureGenerator : : GenerateADCTrajectoryPoints ( <nl> <nl> + + trajectory_point_index ; <nl> } <nl> + <nl> + / / planning_tag <nl> + if ( learning_data_frame - > adc_trajectory_point_size ( ) > 0 ) { <nl> + learning_data_frame - > mutable_planning_tag ( ) - > set_lane_turn ( <nl> + learning_data_frame - > adc_trajectory_point ( 0 ) . planning_tag ( ) <nl> + . lane_turn ( ) ) ; <nl> + } <nl> / / AINFO < < " number of ADC trajectory points in one frame : " <nl> / / < < trajectory_point_index ; <nl> } <nl> | planning : fixed bugs in learning data | ApolloAuto/apollo | 45fdf9b0031ee6b18def5f7bcc7b4c73657a96a2 | 2020-04-06T16:57:26Z |
new file mode 100644 <nl> index 00000000000 . . 5d9bd64ff1c <nl> mmm / dev / null <nl> ppp b / python / examples / mgpcg_smoke_3d . py <nl> <nl> + from taichi . util import * <nl> + from taichi . core import tc_core <nl> + from taichi . tools . video import VideoManager <nl> + from taichi . visual . post_process import LDRDisplay <nl> + from taichi . visual . camera import Camera <nl> + from taichi . visual . particle_renderer import ParticleRenderer <nl> + import math <nl> + import random <nl> + import time <nl> + import cv2 <nl> + <nl> + class Smoke3 : <nl> + def __init__ ( self , * * kwargs ) : <nl> + self . c = tc_core . Smoke3D ( ) <nl> + self . c . initialize ( P ( * * kwargs ) ) <nl> + self . video_manager = VideoManager ( get_uuid ( ) , 512 , 1024 ) <nl> + self . particle_renderer = ParticleRenderer ( ' shadow_map ' , <nl> + shadow_map_resolution = 0 . 5 , alpha = 0 . 5 , shadowing = 0 . 1 , ambient_light = 0 . 2 , <nl> + light_direction = ( - 1 , 1 , - 1 ) ) <nl> + self . resolution = ( kwargs [ ' simulation_width ' ] , kwargs [ ' simulation_height ' ] , kwargs [ ' simulation_depth ' ] ) <nl> + <nl> + def step ( self , step_t ) : <nl> + t = self . c . get_current_time ( ) <nl> + print ' Simulation time : ' , t <nl> + T = time . time ( ) <nl> + self . c . step ( step_t ) <nl> + print ' Time : ' , time . time ( ) - T <nl> + image_buffer = tc_core . RGBImageFloat ( self . video_manager . width , self . video_manager . height , Vector ( 0 , 0 , 0 . 0 ) ) <nl> + particles = self . c . get_render_particles ( ) <nl> + res = map ( float , self . resolution ) <nl> + radius = res [ 0 ] * 4 <nl> + theta = t * 0 . 6 + 1 . 7 <nl> + camera = Camera ( ' perspective ' , origin = ( radius * math . cos ( theta ) , radius * 0 . 3 , radius * math . sin ( theta ) ) , <nl> + look_at = ( 0 , 0 , 0 ) , up = ( 0 , 1 , 0 ) , fov_angle = 70 , <nl> + width = self . video_manager . width , height = self . video_manager . height ) <nl> + self . particle_renderer . set_camera ( camera ) <nl> + self . particle_renderer . render ( image_buffer , particles ) <nl> + img = image_buffer_to_ndarray ( image_buffer ) <nl> + # img = LDRDisplay ( exposure = 0 . 1 ) . process ( img ) <nl> + cv2 . imshow ( ' Vis ' , img ) <nl> + cv2 . waitKey ( 1 ) <nl> + self . video_manager . write_frame ( img ) <nl> + <nl> + def make_video ( self ) : <nl> + self . video_manager . make_video ( ) <nl> + <nl> + if __name__ = = ' __main__ ' : <nl> + resolution = [ 64 ] * 3 <nl> + resolution [ 1 ] * = 2 <nl> + smoke = Smoke3 ( simulation_width = resolution [ 0 ] , simulation_height = resolution [ 1 ] , <nl> + simulation_depth = resolution [ 2 ] , delta_x = 1 . 0 / resolution [ 0 ] , gravity = ( 0 , - 10 ) , <nl> + advection_order = 1 , cfl = 0 . 5 , smoke_alpha = 80 . 0 , smoke_beta = 200 , <nl> + temperature_decay = 0 . 05 , pressure_tolerance = 1e - 4 , density_scaling = 2 , <nl> + initial_speed = ( 0 , 0 , 0 ) , <nl> + tracker_generation = 20 , perturbation = 0 , <nl> + pressure_solver = ' mgpcg ' , num_threads = 8 ) <nl> + for i in range ( 300 ) : <nl> + smoke . step ( 0 . 05 ) <nl> + <nl> + smoke . make_video ( ) <nl> + <nl> + <nl> mmm a / python / examples / mpm_snow_3d . py <nl> ppp b / python / examples / mpm_snow_3d . py <nl> <nl> from taichi . tools . video import VideoManager <nl> from taichi . visual . post_process import LDRDisplay <nl> from taichi . visual . camera import Camera <nl> + from taichi . visual . particle_renderer import ParticleRenderer <nl> import math <nl> import random <nl> import time <nl> import cv2 <nl> <nl> - class ParticleRenderer : <nl> - def __init__ ( self , name , * * kwargs ) : <nl> - self . c = tc_core . create_particle_renderer ( name ) <nl> - self . c . initialize ( config_from_dict ( kwargs ) ) <nl> - <nl> - def set_camera ( self , camera ) : <nl> - self . c . set_camera ( camera . c ) <nl> - <nl> - def __getattr__ ( self , key ) : <nl> - return self . c . __getattribute__ ( key ) <nl> - <nl> class MPM3 : <nl> def __init__ ( self , * * kwargs ) : <nl> self . c = tc_core . MPM3D ( ) <nl> self . c . initialize ( P ( * * kwargs ) ) <nl> - self . video_manager = VideoManager ( get_uuid ( ) , 256 , 256 ) <nl> + self . video_manager = VideoManager ( get_uuid ( ) , 512 , 512 ) <nl> self . particle_renderer = ParticleRenderer ( ' shadow_map ' , <nl> - shadow_map_resolution = 1 . 0 , alpha = 0 . 5 , shadowing = 0 . 1 , ambient_light = 0 . 2 , <nl> + shadow_map_resolution = 0 . 5 , alpha = 0 . 5 , shadowing = 0 . 1 , ambient_light = 0 . 2 , <nl> light_direction = ( - 1 , 1 , - 1 ) ) <nl> self . resolution = ( kwargs [ ' simulation_width ' ] , kwargs [ ' simulation_height ' ] , kwargs [ ' simulation_depth ' ] ) <nl> <nl> def step ( self , step_t ) : <nl> particles = self . c . get_render_particles ( ) <nl> res = map ( float , self . resolution ) <nl> radius = res [ 0 ] * 2 . 5 <nl> - theta = t + 1 . 7 <nl> + theta = t * 0 . 6 + 1 . 7 <nl> camera = Camera ( ' perspective ' , origin = ( radius * math . cos ( theta ) , radius * 0 . 3 , radius * math . sin ( theta ) ) , <nl> look_at = ( 0 , 0 , 0 ) , up = ( 0 , 1 , 0 ) , fov_angle = 50 , <nl> width = 10 , height = 10 ) <nl> def make_video ( self ) : <nl> self . video_manager . make_video ( ) <nl> <nl> if __name__ = = ' __main__ ' : <nl> - resolution = [ 64 ] * 3 <nl> + resolution = [ 128 , 128 , 64 ] <nl> mpm = MPM3 ( simulation_width = resolution [ 0 ] , simulation_height = resolution [ 1 ] , simulation_depth = resolution [ 2 ] , <nl> - gravity = ( 0 , - 10 , 0 ) , initial_velocity = ( 0 , - 30 , 0 ) , delta_t = 0 . 002 , num_threads = 8 ) <nl> + gravity = ( 0 , - 10 , 0 ) , initial_velocity = ( 0 , - 30 , 0 ) , delta_t = 0 . 003 , num_threads = 8 ) <nl> for i in range ( 300 ) : <nl> mpm . step ( 0 . 05 ) <nl> <nl> deleted file mode 100644 <nl> index 0f7fd85d02b . . 00000000000 <nl> mmm a / python / taichi / run_smoke_3d . py <nl> ppp / dev / null <nl> <nl> - from vfx import * <nl> - <nl> - class SmokeSimulator3D ( FluidSimulator ) : <nl> - def __init__ ( self , * * kwargs ) : <nl> - super ( SmokeSimulator3D , self ) . __init__ ( * * kwargs ) <nl> - <nl> - def get_background_image ( self , width , height ) : <nl> - return image_buffer_to_image ( self . get_visualization ( width , height ) ) <nl> - <nl> - def get_levelset_images ( self , width , height , color_scheme ) : <nl> - return [ ] <nl> - <nl> - def get_particles ( self ) : <nl> - return [ ] <nl> - <nl> - if __name__ = = ' __main__ ' : <nl> - resolution = [ 64 ] * 3 <nl> - resolution [ 1 ] * = 2 <nl> - simulator = SmokeSimulator3D ( simulator = ' Smoke3D ' , simulation_width = resolution [ 0 ] , simulation_height = resolution [ 1 ] , <nl> - simulation_depth = resolution [ 2 ] , delta_x = 1 . 0 / resolution [ 0 ] , gravity = ( 0 , - 10 ) , <nl> - advection_order = 1 , cfl = 0 . 5 , simulation_time = 30 , dt = 0 . 1 , smoke_alpha = 80 . 0 , smoke_beta = 200 , <nl> - temperature_decay = 0 . 05 , pressure_tolerance = 1e - 4 , density_scaling = 2 , <nl> - initial_speed = ( 0 , 10 , 0 ) , <nl> - tracker_generation = 20 , shadow_map_resolution = 2048 , shadowing = 0 . 03 , perturbation = 0 , <nl> - light_direction = ( 1 , 1 , 1 ) , viewport_rotation = 0 . 1 , pressure_solver = ' mgpcg ' ) <nl> - <nl> - window = SimulationWindow ( 800 , simulator , color_schemes [ ' smoke ' ] , rescale = True ) <nl> - <nl> new file mode 100644 <nl> index 00000000000 . . 8e0fbbe4d2f <nl> mmm / dev / null <nl> ppp b / python / taichi / visual / particle_renderer . py <nl> <nl> + from taichi . util import * <nl> + from taichi . core import tc_core <nl> + <nl> + class ParticleRenderer : <nl> + def __init__ ( self , name , * * kwargs ) : <nl> + self . c = tc_core . create_particle_renderer ( name ) <nl> + self . c . initialize ( config_from_dict ( kwargs ) ) <nl> + <nl> + def set_camera ( self , camera ) : <nl> + self . c . set_camera ( camera . c ) <nl> + <nl> + def __getattr__ ( self , key ) : <nl> + return self . c . __getattribute__ ( key ) <nl> mmm a / src / fluid / fluid_3d . cpp <nl> ppp b / src / fluid / fluid_3d . cpp <nl> void Smoke3D : : initialize ( const Config & config ) { <nl> density_scaling = config . get ( " density_scaling " , 1 . 0f ) ; <nl> initial_speed = config . get ( " initial_speed " , Vector3 ( 0 , 0 , 0 ) ) ; <nl> tracker_generation = config . get ( " tracker_generation " , 100 . 0f ) ; <nl> + num_threads = config . get_int ( " num_threads " ) ; <nl> <nl> - / / TODO : refactor here <nl> - <nl> - show_trackers = config . get ( " show_trackers " , true ) ; <nl> perturbation = config . get ( " perturbation " , 0 . 0f ) ; <nl> - viewport_rotation = config . get ( " viewport_rotation " , 0 . 0f ) ; <nl> Config solver_config ; <nl> - solver_config . set ( " width " , width ) . set ( " height " , height ) . set ( " depth " , depth ) ; <nl> + solver_config . set ( " width " , width ) . set ( " height " , height ) . set ( " depth " , depth ) <nl> + . set ( " num_threads " , num_threads ) ; <nl> pressure_solver = create_pressure_solver_3d ( config . get_string ( " pressure_solver " ) , solver_config ) ; <nl> u = Array ( width + 1 , height , depth , 0 . 0f , Vector3 ( 0 . 0f , 0 . 5f , 0 . 5f ) ) ; <nl> v = Array ( width , height + 1 , depth , 0 . 0f , Vector3 ( 0 . 5f , 0 . 0f , 0 . 5f ) ) ; <nl> mmm a / src / fluid / fluid_3d . h <nl> ppp b / src / fluid / fluid_3d . h <nl> class Smoke3D : public Fluid3D { <nl> float pressure_tolerance ; <nl> float density_scaling ; <nl> Vector3 initial_speed ; <nl> - bool show_trackers ; <nl> float tracker_generation ; <nl> float perturbation ; <nl> - float viewport_rotation ; <nl> + int num_threads ; <nl> std : : vector < Tracker3D > trackers ; <nl> std : : shared_ptr < PressureSolver3D > pressure_solver ; <nl> - std : : shared_ptr < ParticleShadowMapRenderer > particle_renderer ; <nl> <nl> Smoke3D ( ) { } <nl> <nl> mmm a / src / fluid / pressure_solver . cpp <nl> ppp b / src / fluid / pressure_solver . cpp <nl> TC_NAMESPACE_BEGIN <nl> int width , height , depth , max_level ; <nl> std : : vector < Array > pressures , residuals , tmp_residuals ; <nl> const int size_threshould = 64 ; <nl> + int num_threads ; <nl> <nl> void initialize ( const Config & config ) { <nl> this - > width = config . get_int ( " width " ) ; <nl> this - > height = config . get_int ( " height " ) ; <nl> this - > depth = config . get_int ( " depth " ) ; <nl> + this - > num_threads = config . get_int ( " num_threads " ) ; <nl> this - > max_level = 0 ; <nl> int width = this - > width ; <nl> int height = this - > height ; <nl> TC_NAMESPACE_BEGIN <nl> } while ( width * height * depth * 8 > = size_threshould ) ; <nl> } <nl> <nl> - static void gauss_seidel ( const Array & residual , Array & pressure , int rounds ) { <nl> + void parallel_for_each_cell ( Array & arr , int threshold , const std : : function < void ( const Index3D & index ) > & func ) { <nl> + int max_side = std : : max ( std : : max ( arr . get_width ( ) , arr . get_height ( ) ) , arr . get_depth ( ) ) ; <nl> + int num_threads ; <nl> + if ( max_side > = 32 ) { <nl> + num_threads = this - > num_threads ; <nl> + } <nl> + else { <nl> + num_threads = 1 ; <nl> + } <nl> + ThreadedTaskManager : : run ( arr . get_width ( ) , num_threads , [ & ] ( int x ) { <nl> + const int height = arr . get_height ( ) ; <nl> + const int depth = arr . get_depth ( ) ; <nl> + for ( int y = 0 ; y < height ; y + + ) { <nl> + for ( int z = 0 ; z < depth ; z + + ) { <nl> + func ( Index3D ( x , y , z ) ) ; <nl> + } <nl> + } <nl> + } ) ; <nl> + } <nl> + <nl> + void gauss_seidel ( const Array & residual , Array & pressure , int rounds ) { <nl> for ( int i = 0 ; i < rounds ; i + + ) { <nl> for ( int c = 0 ; c < 2 ; c + + ) { <nl> - for ( auto & ind : pressure . get_region ( ) ) { <nl> + parallel_for_each_cell ( pressure , 128 , [ & ] ( const Index3D & ind ) { <nl> int sum = ind . i + ind . j + ind . k ; <nl> if ( ( sum ) % 2 = = c ) { <nl> float res = residual [ ind ] ; <nl> TC_NAMESPACE_BEGIN <nl> } <nl> pressure [ ind ] = res / numerator ; <nl> } <nl> - } <nl> + } ) ; <nl> } <nl> } <nl> } <nl> TC_NAMESPACE_BEGIN <nl> } <nl> <nl> void compute_residual ( const Array & pressure , const Array & div , Array & residual ) { <nl> - for ( auto & ind : pressure . get_region ( ) ) { <nl> + parallel_for_each_cell ( residual , 128 , [ & ] ( const Index3D & ind ) { <nl> float pressure_center = pressure [ ind ] ; <nl> float res = 0 . 0f ; <nl> for ( auto & offset : offsets ) { <nl> TC_NAMESPACE_BEGIN <nl> res + = pressure_center - p ; <nl> } <nl> residual [ ind ] = div [ ind ] - res ; <nl> - } <nl> + } ) ; <nl> } <nl> <nl> void downsample ( const Array & x , Array & x_downsampled ) { / / Restriction <nl> mmm a / src / math / array_3d . h <nl> ppp b / src / math / array_3d . h <nl> class Index3D { <nl> this - > storage_offset = storage_offset ; <nl> } <nl> <nl> + Index3D ( int i , int j , int k ) { <nl> + this - > i = i ; <nl> + this - > j = j ; <nl> + this - > k = k ; <nl> + } <nl> + <nl> + <nl> void next ( ) { <nl> k + + ; <nl> if ( k = = z [ 1 ] ) { <nl> | Smoke3D | taichi-dev/taichi | edc27aee1af52b277a3b92c4040cbed74131eb89 | 2016-12-08T14:20:42Z |
mmm a / xbmc / cores / dvdplayer / DVDSubtitles / DllLibass . h <nl> ppp b / xbmc / cores / dvdplayer / DVDSubtitles / DllLibass . h <nl> class DllLibass : public DllDynamic , DllLibassInterface <nl> virtual void ass_free_track ( ASS_Track * track ) <nl> { return : : ass_free_track ( track ) ; } <nl> virtual void ass_set_fonts ( ASS_Renderer * priv , const char * default_font , const char * default_family , int fc , const char * config , int update ) <nl> - # ifndef _ARMEL <nl> + # ifdef LIBASS_VERSION <nl> { return : : ass_set_fonts ( priv , default_font , default_family , fc , config , update ) ; } <nl> - # else / * Libass version on armel is too old . * / <nl> + # else / * Legacy version . * / <nl> { : : ass_set_fonts ( priv , default_font , default_family ) ; return ; } <nl> # endif <nl> virtual void ass_set_style_overrides ( ASS_Library * priv , char * * list ) <nl> class DllLibass : public DllDynamic , DllLibassInterface <nl> virtual void ass_set_message_cb ( ASS_Library * priv <nl> , void ( * msg_cb ) ( int level , const char * fmt , va_list args , void * data ) <nl> , void * data ) <nl> - # ifndef _ARMEL <nl> + # ifdef LIBASS_VERSION <nl> { return : : ass_set_message_cb ( priv , msg_cb , data ) ; } <nl> - # else / * Libass version on armel is too old . * / <nl> + # else / * Legacy version . * / <nl> { return ; } <nl> # endif <nl> <nl> | Libass versioning check for legacy code | xbmc/xbmc | ef11052a68cdc4ad611055324ac48886e64c42f2 | 2011-04-20T10:04:20Z |
mmm a / src / builtins / mips / builtins - mips . cc <nl> ppp b / src / builtins / mips / builtins - mips . cc <nl> void CallApiFunctionAndReturn ( MacroAssembler * masm , Register function_address , <nl> <nl> void Builtins : : Generate_CallApiCallback ( MacroAssembler * masm ) { <nl> / / mmmmmmmmm - - S t a t e mmmmmmmmmmmm - <nl> - / / - - cp : kTargetContext <nl> - / / - - a1 : kApiFunctionAddress <nl> - / / - - a2 : kArgc <nl> + / / - - cp : context <nl> + / / - - a1 : api function address <nl> + / / - - a2 : arguments count ( not including the receiver ) <nl> + / / - - a3 : call data <nl> + / / - - a0 : holder <nl> / / - - <nl> / / - - sp [ 0 ] : last argument <nl> / / - - . . . <nl> / / - - sp [ ( argc - 1 ) * 4 ] : first argument <nl> / / - - sp [ ( argc + 0 ) * 4 ] : receiver <nl> - / / - - sp [ ( argc + 1 ) * 4 ] : kHolder <nl> - / / - - sp [ ( argc + 2 ) * 4 ] : kCallData <nl> / / mmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmm - - <nl> <nl> Register api_function_address = a1 ; <nl> Register argc = a2 ; <nl> + Register call_data = a3 ; <nl> + Register holder = a0 ; <nl> Register scratch = t0 ; <nl> Register base = t1 ; / / For addressing MemOperands on the stack . <nl> <nl> - DCHECK ( ! AreAliased ( api_function_address , argc , scratch , base ) ) ; <nl> - <nl> - / / Stack offsets ( without argc ) . <nl> - static constexpr int kReceiverOffset = 0 * kPointerSize ; <nl> - static constexpr int kHolderOffset = kReceiverOffset + kPointerSize ; <nl> - static constexpr int kCallDataOffset = kHolderOffset + kPointerSize ; <nl> - <nl> - / / Extra stack arguments are : the receiver , kHolder , kCallData . <nl> - static constexpr int kExtraStackArgumentCount = 3 ; <nl> + DCHECK ( ! AreAliased ( api_function_address , argc , call_data , <nl> + holder , scratch , base ) ) ; <nl> <nl> typedef FunctionCallbackArguments FCA ; <nl> <nl> void Builtins : : Generate_CallApiCallback ( MacroAssembler * masm ) { <nl> __ Subu ( sp , sp , Operand ( FCA : : kArgsLength * kPointerSize ) ) ; <nl> <nl> / / kHolder . <nl> - __ lw ( scratch , MemOperand ( base , kHolderOffset ) ) ; <nl> - __ sw ( scratch , MemOperand ( sp , 0 * kPointerSize ) ) ; <nl> + __ sw ( holder , MemOperand ( sp , 0 * kPointerSize ) ) ; <nl> <nl> / / kIsolate . <nl> __ li ( scratch , ExternalReference : : isolate_address ( masm - > isolate ( ) ) ) ; <nl> __ sw ( scratch , MemOperand ( sp , 1 * kPointerSize ) ) ; <nl> <nl> - / / kReturnValueDefaultValue , kReturnValue , and kNewTarget . <nl> + / / kReturnValueDefaultValue and kReturnValue . <nl> __ LoadRoot ( scratch , RootIndex : : kUndefinedValue ) ; <nl> __ sw ( scratch , MemOperand ( sp , 2 * kPointerSize ) ) ; <nl> __ sw ( scratch , MemOperand ( sp , 3 * kPointerSize ) ) ; <nl> - __ sw ( scratch , MemOperand ( sp , 5 * kPointerSize ) ) ; <nl> <nl> / / kData . <nl> - __ lw ( scratch , MemOperand ( base , kCallDataOffset ) ) ; <nl> - __ sw ( scratch , MemOperand ( sp , 4 * kPointerSize ) ) ; <nl> + __ sw ( call_data , MemOperand ( sp , 4 * kPointerSize ) ) ; <nl> + <nl> + / / kNewTarget . <nl> + __ sw ( scratch , MemOperand ( sp , 5 * kPointerSize ) ) ; <nl> <nl> / / Keep a pointer to kHolder ( = implicit_args ) in a scratch register . <nl> / / We use it below to set up the FunctionCallbackInfo object . <nl> void Builtins : : Generate_CallApiCallback ( MacroAssembler * masm ) { <nl> / / from the API function here . <nl> / / Note : Unlike on other architectures , this stores the number of slots to <nl> / / drop , not the number of bytes . <nl> - __ Addu ( scratch , argc , Operand ( FCA : : kArgsLength + kExtraStackArgumentCount ) ) ; <nl> + __ Addu ( scratch , argc , Operand ( FCA : : kArgsLength + 1 / * receiver * / ) ) ; <nl> __ sw ( scratch , MemOperand ( sp , 4 * kPointerSize ) ) ; <nl> <nl> / / v8 : : InvocationCallback ' s argument . <nl> mmm a / src / builtins / mips64 / builtins - mips64 . cc <nl> ppp b / src / builtins / mips64 / builtins - mips64 . cc <nl> void CallApiFunctionAndReturn ( MacroAssembler * masm , Register function_address , <nl> <nl> void Builtins : : Generate_CallApiCallback ( MacroAssembler * masm ) { <nl> / / mmmmmmmmm - - S t a t e mmmmmmmmmmmm - <nl> - / / - - cp : kTargetContext <nl> - / / - - a1 : kApiFunctionAddress <nl> - / / - - a2 : kArgc <nl> + / / - - cp : context <nl> + / / - - a1 : api function address <nl> + / / - - a2 : arguments count ( not including the receiver ) <nl> + / / - - a3 : call data <nl> + / / - - a0 : holder <nl> / / - - <nl> / / - - sp [ 0 ] : last argument <nl> / / - - . . . <nl> / / - - sp [ ( argc - 1 ) * 8 ] : first argument <nl> / / - - sp [ ( argc + 0 ) * 8 ] : receiver <nl> - / / - - sp [ ( argc + 1 ) * 8 ] : kHolder <nl> - / / - - sp [ ( argc + 2 ) * 8 ] : kCallData <nl> / / mmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmm - - <nl> <nl> Register api_function_address = a1 ; <nl> Register argc = a2 ; <nl> + Register call_data = a3 ; <nl> + Register holder = a0 ; <nl> Register scratch = t0 ; <nl> Register base = t1 ; / / For addressing MemOperands on the stack . <nl> <nl> - DCHECK ( ! AreAliased ( api_function_address , argc , scratch , base ) ) ; <nl> - <nl> - / / Stack offsets ( without argc ) . <nl> - static constexpr int kReceiverOffset = 0 * kPointerSize ; <nl> - static constexpr int kHolderOffset = kReceiverOffset + kPointerSize ; <nl> - static constexpr int kCallDataOffset = kHolderOffset + kPointerSize ; <nl> - <nl> - / / Extra stack arguments are : the receiver , kHolder , kCallData . <nl> - static constexpr int kExtraStackArgumentCount = 3 ; <nl> + DCHECK ( ! AreAliased ( api_function_address , argc , call_data , <nl> + holder , scratch , base ) ) ; <nl> <nl> typedef FunctionCallbackArguments FCA ; <nl> <nl> void Builtins : : Generate_CallApiCallback ( MacroAssembler * masm ) { <nl> __ Dsubu ( sp , sp , Operand ( FCA : : kArgsLength * kPointerSize ) ) ; <nl> <nl> / / kHolder . <nl> - __ Ld ( scratch , MemOperand ( base , kHolderOffset ) ) ; <nl> - __ Sd ( scratch , MemOperand ( sp , 0 * kPointerSize ) ) ; <nl> + __ Sd ( holder , MemOperand ( sp , 0 * kPointerSize ) ) ; <nl> <nl> / / kIsolate . <nl> __ li ( scratch , ExternalReference : : isolate_address ( masm - > isolate ( ) ) ) ; <nl> __ Sd ( scratch , MemOperand ( sp , 1 * kPointerSize ) ) ; <nl> <nl> - / / kReturnValueDefaultValue , kReturnValue , and kNewTarget . <nl> + / / kReturnValueDefaultValue and kReturnValue . <nl> __ LoadRoot ( scratch , RootIndex : : kUndefinedValue ) ; <nl> __ Sd ( scratch , MemOperand ( sp , 2 * kPointerSize ) ) ; <nl> __ Sd ( scratch , MemOperand ( sp , 3 * kPointerSize ) ) ; <nl> - __ Sd ( scratch , MemOperand ( sp , 5 * kPointerSize ) ) ; <nl> <nl> / / kData . <nl> - __ Ld ( scratch , MemOperand ( base , kCallDataOffset ) ) ; <nl> - __ Sd ( scratch , MemOperand ( sp , 4 * kPointerSize ) ) ; <nl> + __ Sd ( call_data , MemOperand ( sp , 4 * kPointerSize ) ) ; <nl> + <nl> + / / kNewTarget . <nl> + __ Sd ( scratch , MemOperand ( sp , 5 * kPointerSize ) ) ; <nl> <nl> / / Keep a pointer to kHolder ( = implicit_args ) in a scratch register . <nl> / / We use it below to set up the FunctionCallbackInfo object . <nl> void Builtins : : Generate_CallApiCallback ( MacroAssembler * masm ) { <nl> / / from the API function here . <nl> / / Note : Unlike on other architectures , this stores the number of slots to <nl> / / drop , not the number of bytes . <nl> - __ Daddu ( scratch , argc , Operand ( FCA : : kArgsLength + kExtraStackArgumentCount ) ) ; <nl> + __ Daddu ( scratch , argc , Operand ( FCA : : kArgsLength + 1 / * receiver * / ) ) ; <nl> __ Sd ( scratch , MemOperand ( sp , 4 * kPointerSize ) ) ; <nl> <nl> / / v8 : : InvocationCallback ' s argument . <nl> mmm a / src / mips / interface - descriptors - mips . cc <nl> ppp b / src / mips / interface - descriptors - mips . cc <nl> void ArgumentsAdaptorDescriptor : : InitializePlatformSpecific ( <nl> void ApiCallbackDescriptor : : InitializePlatformSpecific ( <nl> CallInterfaceDescriptorData * data ) { <nl> Register registers [ ] = { <nl> - JavaScriptFrame : : context_register ( ) , / / kTargetContext <nl> a1 , / / kApiFunctionAddress <nl> a2 , / / kArgc <nl> + a3 , / / kCallData <nl> + a0 , / / kHolder <nl> } ; <nl> data - > InitializePlatformSpecific ( arraysize ( registers ) , registers ) ; <nl> } <nl> mmm a / src / mips64 / interface - descriptors - mips64 . cc <nl> ppp b / src / mips64 / interface - descriptors - mips64 . cc <nl> void ArgumentsAdaptorDescriptor : : InitializePlatformSpecific ( <nl> void ApiCallbackDescriptor : : InitializePlatformSpecific ( <nl> CallInterfaceDescriptorData * data ) { <nl> Register registers [ ] = { <nl> - JavaScriptFrame : : context_register ( ) , / / kTargetContext <nl> a1 , / / kApiFunctionAddress <nl> a2 , / / kArgc <nl> + a3 , / / kCallData <nl> + a0 , / / kHolder <nl> } ; <nl> data - > InitializePlatformSpecific ( arraysize ( registers ) , registers ) ; <nl> } <nl> | [ mips ] [ builtin ] Improve CallApiCallback calling convention . | v8/v8 | d9b59c7d046ada3eece04357a44ffbe95be59b2a | 2019-03-06T10:29:32Z |
mmm a / hphp / doc / ir . specification <nl> ppp b / hphp / doc / ir . specification <nl> D : StkPtr = CallArray S0 : StkPtr <nl> arguments is pushed . CallArray pops the array off the stack , pushes the <nl> elements of the array as arguments , and invokes the function in the ActRec . <nl> <nl> - D : StkPtr = Call S0 : StkPtr S1 : FramePtr S2 : ConstInt S3 : Func S4 . . . <nl> + D : StkPtr = Call < returnOff , funcd , destroyLocals > S0 : StkPtr S1 : FramePtr [ S2 . . . SN ] <nl> <nl> - Invoke the function S3 with ActRec S0 and variadic arguments S4 . . . <nl> - representing values to pass to the function . A value of type None means the <nl> - value to be passed is already on the stack . S1 is the caller FP and S2 is <nl> - the bytecode offset of the next instruction to execute when the call returns . <nl> + Transfer control to a callee , based on the pre - live activation record pointed <nl> + to by S0 . S1 is the current caller frame pointer , and a variadic list of <nl> + SSATmps is passed for the arguments . The ` funcd ' in the extra data is a Func * <nl> + for the callee if we know the callee statically . <nl> <nl> NativeImpl = S0 : ConstFunc S1 : FramePtr <nl> <nl> mmm a / hphp / runtime / vm / jit / code - gen - arm . cpp <nl> ppp b / hphp / runtime / vm / jit / code - gen - arm . cpp <nl> void CodeGenerator : : cgCallBuiltin ( IRInstruction * inst ) { <nl> } <nl> <nl> void CodeGenerator : : cgCall ( IRInstruction * inst ) { <nl> - auto spReg = x2a ( srcLoc ( 0 ) . reg ( ) ) ; <nl> - auto fpReg = x2a ( srcLoc ( 1 ) . reg ( ) ) ; <nl> - auto * returnBcOffset = inst - > src ( 2 ) ; <nl> - auto * func = inst - > src ( 3 ) ; <nl> - SrcRange args = inst - > srcs ( ) . subpiece ( 4 ) ; <nl> + auto const spReg = x2a ( srcLoc ( 0 ) . reg ( ) ) ; <nl> + auto const fpReg = x2a ( srcLoc ( 1 ) . reg ( ) ) ; <nl> + auto const extra = inst - > extra < Call > ( ) ; <nl> + SrcRange args = inst - > srcs ( ) . subpiece ( 2 ) ; <nl> int32_t numArgs = args . size ( ) ; <nl> <nl> int64_t adjustment = cellsToBytes ( ( int64_t ) - numArgs ) ; <nl> for ( int32_t i = 0 ; i < numArgs ; + + i ) { <nl> - emitStore ( spReg , cellsToBytes ( - ( i + 1 ) ) , args [ i ] , srcLoc ( i + 4 ) ) ; <nl> + emitStore ( spReg , cellsToBytes ( - ( i + 1 ) ) , args [ i ] , srcLoc ( i + 2 ) ) ; <nl> } <nl> <nl> m_as . Str ( fpReg , spReg [ AROFF ( m_sfp ) ] ) ; <nl> - m_as . Mov ( rAsm . W ( ) , returnBcOffset - > intVal ( ) ) ; <nl> + m_as . Mov ( rAsm . W ( ) , extra - > after ) ; <nl> m_as . Str ( rAsm . W ( ) , spReg [ AROFF ( m_soff ) ] ) ; <nl> emitRegGetsRegPlusImm ( m_as , spReg , spReg , adjustment ) ; <nl> <nl> assert ( m_curInst - > marker ( ) . valid ( ) ) ; <nl> - SrcKey srcKey = m_curInst - > marker ( ) . sk ( ) ; <nl> - bool isImmutable = func - > isConst ( ) & & ! func - > isA ( Type : : Null ) ; <nl> - const Func * funcd = isImmutable ? func - > funcVal ( ) : nullptr ; <nl> - int32_t adjust = emitBindCall ( mcg - > code . main ( ) , mcg - > code . stubs ( ) , <nl> - srcKey , funcd , numArgs ) ; <nl> + auto const srcKey = m_curInst - > marker ( ) . sk ( ) ; <nl> + int32_t adjust = emitBindCall ( mcg - > code . main ( ) , <nl> + mcg - > code . stubs ( ) , <nl> + srcKey , <nl> + extra - > callee , <nl> + numArgs ) ; <nl> <nl> emitRegGetsRegPlusImm ( m_as , rVmSp , rVmSp , adjust ) ; <nl> } <nl> mmm a / hphp / runtime / vm / jit / code - gen - x64 . cpp <nl> ppp b / hphp / runtime / vm / jit / code - gen - x64 . cpp <nl> void CodeGenerator : : cgCallArray ( IRInstruction * inst ) { <nl> } <nl> <nl> void CodeGenerator : : cgCall ( IRInstruction * inst ) { <nl> - auto spReg = srcLoc ( 0 ) . reg ( ) ; <nl> - auto fpReg = srcLoc ( 1 ) . reg ( ) ; <nl> - SSATmp * returnBcOffset = inst - > src ( 2 ) ; <nl> - SSATmp * func = inst - > src ( 3 ) ; <nl> - SrcRange args = inst - > srcs ( ) . subpiece ( 4 ) ; <nl> - int numArgs = args . size ( ) ; <nl> + auto const extra = inst - > extra < Call > ( ) ; <nl> + auto const spReg = srcLoc ( 0 ) . reg ( ) ; <nl> + auto const fpReg = srcLoc ( 1 ) . reg ( ) ; <nl> + auto const args = inst - > srcs ( ) . subpiece ( 2 ) ; <nl> + auto const numArgs = args . size ( ) ; <nl> <nl> / / put all outgoing arguments onto the VM stack <nl> int adjustment = - numArgs * sizeof ( Cell ) ; <nl> for ( int i = 0 ; i < numArgs ; i + + ) { <nl> - cgStore ( spReg [ - ( i + 1 ) * sizeof ( Cell ) ] , args [ i ] , srcLoc ( i + 4 ) , Width : : Full ) ; <nl> + cgStore ( spReg [ - ( i + 1 ) * sizeof ( Cell ) ] , args [ i ] , <nl> + srcLoc ( i + 2 ) , Width : : Full ) ; <nl> } <nl> / / store the return bytecode offset into the outgoing actrec <nl> - auto returnBc = safe_cast < int32_t > ( returnBcOffset - > intVal ( ) ) ; <nl> + auto returnBc = safe_cast < int32_t > ( extra - > after ) ; <nl> m_as . storeq ( fpReg , spReg [ AROFF ( m_sfp ) ] ) ; <nl> m_as . storel ( returnBc , spReg [ AROFF ( m_soff ) ] ) ; <nl> if ( adjustment ! = 0 ) { <nl> void CodeGenerator : : cgCall ( IRInstruction * inst ) { <nl> } <nl> <nl> assert ( m_curInst - > marker ( ) . valid ( ) ) ; <nl> - SrcKey srcKey = m_curInst - > marker ( ) . sk ( ) ; <nl> - bool isImmutable = func - > isConst ( Type : : Func ) ; <nl> - const Func * funcd = isImmutable ? func - > funcVal ( ) : nullptr ; <nl> + auto const srcKey = m_curInst - > marker ( ) . sk ( ) ; <nl> assert ( m_as . base ( ) = = m_mainCode . base ( ) ) ; <nl> - int32_t adjust = emitBindCall ( m_mainCode , m_stubsCode , <nl> - srcKey , funcd , numArgs ) ; <nl> + int32_t adjust = emitBindCall ( m_mainCode , <nl> + m_stubsCode , <nl> + srcKey , <nl> + extra - > callee , <nl> + numArgs ) ; <nl> if ( adjust ) { <nl> m_as . addq ( adjust , rVmSp ) ; <nl> } <nl> mmm a / hphp / runtime / vm / jit / extra - data . h <nl> ppp b / hphp / runtime / vm / jit / extra - data . h <nl> struct DefInlineFPData : IRExtraData { <nl> Type retTypePred ; <nl> } ; <nl> <nl> - / * <nl> - * FCallArray offsets <nl> - * / <nl> struct CallArrayData : IRExtraData { <nl> - explicit CallArrayData ( Offset pcOffset , Offset aft , bool destroyLocals ) <nl> + explicit CallArrayData ( Offset pcOffset , Offset after , bool destroyLocals ) <nl> : pc ( pcOffset ) <nl> - , after ( aft ) <nl> + , after ( after ) <nl> , destroyLocals ( destroyLocals ) <nl> { } <nl> <nl> std : : string show ( ) const { <nl> return folly : : to < std : : string > ( pc , " , " , after , <nl> - destroyLocals ? " destroy locals " : " " ) ; <nl> + destroyLocals ? " , destroyLocals " : " " ) ; <nl> + } <nl> + <nl> + Offset pc ; / / XXX why isn ' t this available in the marker ? <nl> + Offset after ; <nl> + bool destroyLocals ; <nl> + } ; <nl> + <nl> + struct CallBuiltinData : IRExtraData { <nl> + explicit CallBuiltinData ( bool destroyLocals ) <nl> + : destroyLocals ( destroyLocals ) <nl> + { } <nl> + <nl> + std : : string show ( ) const { <nl> + return destroyLocals ? " destroyLocals " : " " ; <nl> } <nl> <nl> - Offset pc , after ; <nl> bool destroyLocals ; <nl> } ; <nl> <nl> struct CallData : IRExtraData { <nl> - explicit CallData ( bool destroy ) <nl> - : destroyLocals ( destroy ) <nl> + explicit CallData ( Offset after , <nl> + const Func * callee , <nl> + bool destroy ) <nl> + : after ( after ) <nl> + , callee ( callee ) <nl> + , destroyLocals ( destroy ) <nl> { } <nl> <nl> std : : string show ( ) const { <nl> - return destroyLocals ? " destroy locals " : " " ; <nl> + return folly : : to < std : : string > ( <nl> + after , <nl> + callee <nl> + ? folly : : format ( " , { } " , callee - > fullName ( ) - > data ( ) ) . str ( ) <nl> + : std : : string { } , <nl> + destroyLocals ? " , destroyLocals " : " " <nl> + ) ; <nl> } <nl> <nl> + Offset after ; <nl> + const Func * callee ; / / nullptr if not statically known <nl> bool destroyLocals ; <nl> } ; <nl> <nl> X ( ReqRetranslateOpt , ReqRetransOptData ) ; <nl> X ( CheckCold , TransIDData ) ; <nl> X ( IncProfCounter , TransIDData ) ; <nl> X ( Call , CallData ) ; <nl> - X ( CallBuiltin , CallData ) ; <nl> + X ( CallBuiltin , CallBuiltinData ) ; <nl> X ( CallArray , CallArrayData ) ; <nl> X ( RetCtrl , RetCtrlData ) ; <nl> X ( FunctionExitSurpriseHook , RetCtrlData ) ; <nl> mmm a / hphp / runtime / vm / jit / frame - state . cpp <nl> ppp b / hphp / runtime / vm / jit / frame - state . cpp <nl> void FrameState : : getLocalEffects ( const IRInstruction * inst , <nl> } ; <nl> <nl> auto killedCallLocals = false ; <nl> - if ( ( inst - > is ( CallArray ) & & inst - > extra < CallArrayData > ( ) - > destroyLocals ) | | <nl> - ( inst - > is ( Call , CallBuiltin ) & & inst - > extra < CallData > ( ) - > destroyLocals ) ) { <nl> + if ( ( inst - > is ( CallArray ) & & inst - > extra < CallArray > ( ) - > destroyLocals ) | | <nl> + ( inst - > is ( Call ) & & inst - > extra < Call > ( ) - > destroyLocals ) | | <nl> + ( inst - > is ( CallBuiltin ) & & inst - > extra < CallBuiltin > ( ) - > destroyLocals ) ) { <nl> clearLocals ( hook ) ; <nl> killedCallLocals = true ; <nl> } <nl> mmm a / hphp / runtime / vm / jit / hhbc - translator . cpp <nl> ppp b / hphp / runtime / vm / jit / hhbc - translator . cpp <nl> void HhbcTranslator : : emitFPushClsMethodF ( int32_t numParams ) { <nl> void HhbcTranslator : : emitFCallArray ( const Offset pcOffset , <nl> const Offset after , <nl> bool destroyLocals ) { <nl> - SSATmp * stack = spillStack ( ) ; <nl> - gen ( CallArray , CallArrayData ( pcOffset , after , destroyLocals ) , stack ) ; <nl> + auto const stack = spillStack ( ) ; <nl> + gen ( CallArray , CallArrayData { pcOffset , after , destroyLocals } , stack ) ; <nl> } <nl> <nl> void HhbcTranslator : : emitFCall ( uint32_t numParams , <nl> Offset returnBcOffset , <nl> const Func * callee , <nl> bool destroyLocals ) { <nl> - SSATmp * params [ numParams + 4 ] ; <nl> + SSATmp * params [ numParams + 2 ] ; <nl> std : : memset ( params , 0 , sizeof params ) ; <nl> for ( uint32_t i = 0 ; i < numParams ; i + + ) { <nl> / / DataTypeGeneric is used because the Call instruction just spills the <nl> / / values to the stack unmodified . <nl> - params [ numParams + 4 - i - 1 ] = popF ( DataTypeGeneric ) ; <nl> + params [ numParams + 2 - i - 1 ] = popF ( DataTypeGeneric ) ; <nl> } <nl> <nl> params [ 0 ] = spillStack ( ) ; <nl> params [ 1 ] = m_irb - > fp ( ) ; <nl> - params [ 2 ] = cns ( returnBcOffset ) ; <nl> - params [ 3 ] = callee ? cns ( callee ) : cns ( Type : : InitNull ) ; <nl> <nl> if ( RuntimeOption : : EvalRuntimeTypeProfile ) { <nl> for ( uint32_t i = 0 ; i < numParams ; i + + ) { <nl> if ( callee ! = nullptr & & <nl> - params [ numParams + 4 - i - 1 ] ) { <nl> + params [ numParams + 2 - i - 1 ] ) { <nl> gen ( TypeProfileFunc , TypeProfileData ( i ) , <nl> - params [ numParams + 4 - i - 1 ] , cns ( callee ) ) ; <nl> + params [ numParams + 2 - i - 1 ] , cns ( callee ) ) ; <nl> } else { <nl> - SSATmp * func = gen ( LdARFuncPtr , m_irb - > sp ( ) , cns ( 0 ) ) ; <nl> + auto const func = gen ( LdARFuncPtr , m_irb - > sp ( ) , cns ( 0 ) ) ; <nl> gen ( TypeProfileFunc , TypeProfileData ( i ) , <nl> - params [ numParams + 4 - i - 1 ] , func ) ; <nl> + params [ numParams + 2 - i - 1 ] , func ) ; <nl> } <nl> } <nl> } <nl> <nl> SSATmp * * decayedPtr = params ; <nl> - gen ( Call , CallData ( destroyLocals ) , std : : make_pair ( numParams + 4 , decayedPtr ) ) ; <nl> + gen ( <nl> + Call , <nl> + CallData { returnBcOffset , callee , destroyLocals } , <nl> + std : : make_pair ( numParams + 2 , decayedPtr ) <nl> + ) ; <nl> if ( ! m_fpiStack . empty ( ) ) { <nl> m_fpiStack . pop ( ) ; <nl> } <nl> void HhbcTranslator : : emitFCallBuiltin ( uint32_t numArgs , <nl> auto const ret = gen ( <nl> CallBuiltin , <nl> retType , <nl> - CallData ( destroyLocals ) , <nl> + CallBuiltinData { destroyLocals } , <nl> makeCatch ( ) , <nl> std : : make_pair ( argsSize , ( SSATmp * * ) & args ) <nl> ) ; <nl> mmm a / hphp / runtime / vm / jit / ir - instruction . cpp <nl> ppp b / hphp / runtime / vm / jit / ir - instruction . cpp <nl> bool IRInstruction : : consumesReference ( int srcNo ) const { <nl> return srcNo = = 2 ; <nl> <nl> case Call : <nl> - / / Inputs 3 + are arguments to the function <nl> - return srcNo > = 4 ; <nl> + / / Inputs past 2 are arguments to the function <nl> + return srcNo > = 2 ; <nl> <nl> case ColAddElemC : <nl> / / value at index 2 <nl> mmm a / hphp / runtime / vm / jit / ir . h <nl> ppp b / hphp / runtime / vm / jit / ir . h <nl> O ( Clone , D ( Obj ) , S ( Obj ) , N | E | PRc | Er ) \ <nl> O ( LdRaw , DLdRaw , S ( Str , Obj , Func ) , NF ) \ <nl> O ( FreeActRec , D ( FramePtr ) , S ( FramePtr ) , NF ) \ <nl> / * name dstinfo srcinfo flags * / \ <nl> - O ( Call , D ( StkPtr ) , SUnk , E | CRc ) \ <nl> + O ( Call , D ( StkPtr ) , S ( StkPtr ) \ <nl> + S ( FramePtr ) \ <nl> + SSpills , E | CRc ) \ <nl> O ( CallArray , D ( StkPtr ) , S ( StkPtr ) , E | N | CRc ) \ <nl> O ( CallBuiltin , DBuiltin , SUnk , E | Er | N | PRc ) \ <nl> O ( NativeImpl , ND , C ( Func ) S ( FramePtr ) , E | N ) \ <nl> mmm a / hphp / runtime / vm / jit / reg - alloc - x64 . h <nl> ppp b / hphp / runtime / vm / jit / reg - alloc - x64 . h <nl> bool mayUseConst ( const IRInstruction & inst , unsigned i ) { <nl> if ( i = = 1 ) return okStore ( cint ) ; <nl> break ; <nl> case Call : <nl> - if ( i = = 3 ) return true ; / / func <nl> - if ( i > = 4 ) return okStore ( cint ) ; <nl> + if ( i > = 2 ) return okStore ( cint ) ; <nl> break ; <nl> case CallBuiltin : <nl> if ( i > = 2 ) return true ; / / args - > ArgGroup . ssa ( ) <nl> bool storesCell ( const IRInstruction & inst , uint32_t srcIdx ) { <nl> return srcIdx > = 2 & & srcIdx < inst . numSrcs ( ) ; <nl> <nl> case Call : <nl> - return srcIdx > = 4 & & srcIdx < inst . numSrcs ( ) ; <nl> + return srcIdx > = 2 & & srcIdx < inst . numSrcs ( ) ; <nl> <nl> case CallBuiltin : <nl> return srcIdx > = 1 & & srcIdx < inst . numSrcs ( ) ; <nl> mmm a / hphp / runtime / vm / jit / reg - alloc . cpp <nl> ppp b / hphp / runtime / vm / jit / reg - alloc . cpp <nl> bool mustUseConst ( const IRInstruction & inst , int i ) { <nl> / / handle special cases we can ' t derive from IR_OPCODES macro <nl> switch ( inst . op ( ) ) { <nl> case LdAddr : return check ( i = = 1 ) ; / / offset <nl> - case Call : return check ( i = = 2 ) ; / / returnBcOffset <nl> case CallBuiltin : return check ( i = = 0 ) ; / / f <nl> default : break ; <nl> } <nl> | Some cleanup on the IR Call instruction | facebook/hhvm | 85fb9bbc3a18a9b18dbb71f0a7cd4bc776eb6161 | 2014-05-08T04:56:07Z |
mmm a / arangod / IndexOperators / index - operator . h <nl> ppp b / arangod / IndexOperators / index - operator . h <nl> <nl> / / - - SECTION - - public types <nl> / / mmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmm - - <nl> <nl> + / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / <nl> + / / / Explanation of what an index operator is capable of and how one has to <nl> + / / / use it : <nl> + / / / <nl> + / / / An index operator is a binary tree of AND , OR or NOT nodes ( with 2 , 2 <nl> + / / / and 1 child respectively , of type TRI_logical_index_operator_t ) in <nl> + / / / which the leaves are relational nodes ( type TRI_relation_index_operator_t ) . <nl> + / / / These leaf nodes have a list of parameters . The length of this <nl> + / / / parameter list indicates how many of the attributes of the index <nl> + / / / are used , starting from the first and not skipping any . Depending <nl> + / / / on the type of index , only certain comparisons are allowed . <nl> + / / / <nl> + / / / For example for a hash index , only the EQ relation is supported and <nl> + / / / there must be exactly as many parameters as attributes used in the <nl> + / / / hash index . This is clear from how a hash index works . <nl> + / / / <nl> + / / / For a skiplist index , an EQ node can have a parameter list of length <nl> + / / / k which must be at least 1 and at most the number of attributes <nl> + / / / given in the index . NE nodes are not ( yet ) supported . The other four <nl> + / / / relational nodes need a parameter list as above and the meaning is <nl> + / / / that the values 1 . . k - 1 mean equality and k mean the relation given . <nl> + / / / This is again clear by how a skiplist index works , since for one <nl> + / / / relational condition it just wants to do a single lookup to find <nl> + / / / the boundary . <nl> + / / / <nl> + / / / Note that OR and NOT nodes are not ( yet ) supported by the skiplist index . <nl> + / / / <nl> + / / / Finally , note that the boundaries of LE , GE , LT and GT nodes can not <nl> + / / / be arrays or lists at this stage since these would potentially give <nl> + / / / rise to new shapes in the shaper which we must not allow . For EQ nodes , <nl> + / / / arbitrary JSON values are allowed as parameters . <nl> + / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / <nl> + <nl> / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / <nl> / / / @ brief select clause type <nl> / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / <nl> | Add an explanation of index operators . | arangodb/arangodb | 23723d8e484f0ceb4dae0cfa541e801079c59f0e | 2014-08-27T10:10:51Z |
mmm a / Code / CryEngine / Cry3DEngine / 3DEngineRender . cpp <nl> ppp b / Code / CryEngine / Cry3DEngine / 3DEngineRender . cpp <nl> void C3DEngine : : DisplayInfo ( float & fTextPosX , float & fTextPosY , float & fTextStep <nl> # pragma warning ( disable : 4267 ) <nl> # endif <nl> <nl> - DrawTextRightAligned ( fTextPosX , fTextPosY + = fTextStepY , " DLights = % s ( % d / % d ) " , sLightsList , m_nRealLightsNum + m_nDeferredLightsNum , m_lstDynLights . Count ( ) ) ; <nl> + DrawTextRightAligned ( fTextPosX , fTextPosY + = fTextStepY , " Probes = ( % d ) DLights = % s ( % d / % d ) " , m_nDeferredProbesNum , sLightsList , m_nRealLightsNum + m_nDeferredLightsNum , m_lstDynLights . Count ( ) ) ; <nl> } <nl> else <nl> { <nl> void C3DEngine : : DisplayInfo ( float & fTextPosX , float & fTextPosY , float & fTextStep <nl> float nVidMemMB = ( float ) vidMemUsedThisFrame / ( 1024 * 1024 ) ; <nl> int nPeakMemMB = ( int ) ( processMemInfo . PeakPagefileUsage > > 20 ) ; <nl> int nVirtMemMB = ( int ) ( processMemInfo . PagefileUsage > > 20 ) ; <nl> - DrawTextRightAligned ( fTextPosX , fTextPosY + = fTextStepY , " Vid = % . 2f Mem = % d Peak = % d DLights = ( % d / % d ) " , nVidMemMB , nVirtMemMB , nPeakMemMB , m_nRealLightsNum + m_nDeferredLightsNum , ( int ) m_lstDynLights . Count ( ) ) ; <nl> + DrawTextRightAligned ( fTextPosX , fTextPosY + = fTextStepY , " Vid = % . 2f Mem = % d Peak = % d Probes = ( % d ) DLights = ( % d / % d ) " , nVidMemMB , nVirtMemMB , nPeakMemMB , m_nDeferredProbesNum , m_nRealLightsNum + m_nDeferredLightsNum , ( int ) m_lstDynLights . Count ( ) ) ; <nl> <nl> if ( GetCVars ( ) - > e_StreamInstances ) <nl> { <nl> void C3DEngine : : DisplayInfo ( float & fTextPosX , float & fTextPosY , float & fTextStep <nl> } <nl> <nl> m_nDeferredLightsNum = 0 ; <nl> + m_nDeferredProbesNum = 0 ; <nl> } <nl> # if CAPTURE_REPLAY_LOG <nl> { <nl> void C3DEngine : : DisplayInfo ( float & fTextPosX , float & fTextPosY , float & fTextStep <nl> for ( int i = 0 ; i < GetDynamicLightSources ( ) - > Count ( ) ; i + + ) <nl> { <nl> SRenderLight * pL = GetDynamicLightSources ( ) - > GetAt ( i ) ; <nl> - DrawTextRightAligned ( fTextPosX , fTextPosY + = fTextStepY , " % s - % d ) " , pL - > m_sName , pL - > m_Id ) ; <nl> + DrawTextRightAligned ( fTextPosX , fTextPosY + = fTextStepY , " % s - % d ) " , pL - > m_sName , pL - > m_Id ) ; <nl> } <nl> DrawTextRightAligned ( fTextPosX , fTextPosY + = fTextStepY , " mmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmm " ) ; <nl> } <nl> mmm a / Code / CryEngine / Cry3DEngine / 3dEngine . cpp <nl> ppp b / Code / CryEngine / Cry3DEngine / 3dEngine . cpp <nl> C3DEngine : : C3DEngine ( ISystem * pSystem ) <nl> m_fSunClipPlaneRange = 256 . 0f ; <nl> m_fSunClipPlaneRangeShift = 0 . 0f ; <nl> <nl> - m_nRealLightsNum = m_nDeferredLightsNum = 0 ; <nl> + m_nRealLightsNum = m_nDeferredLightsNum = m_nDeferredProbesNum = 0 ; <nl> <nl> union <nl> { <nl> mmm a / Code / CryEngine / Cry3DEngine / 3dEngine . h <nl> ppp b / Code / CryEngine / Cry3DEngine / 3dEngine . h <nl> class C3DEngine : public I3DEngine , public Cry3DEngineBase <nl> / / passInfo . GetIRenderView ( ) - > AddLight ( eDLT_DeferredLight , light ) ; <nl> GetRenderer ( ) - > EF_AddDeferredLight ( light , fMult , passInfo ) ; <nl> Get3DEngine ( ) - > m_LightVolumesMgr . RegisterLight ( light , nLightID , passInfo ) ; <nl> - m_nDeferredLightsNum + + ; <nl> + <nl> + if ( light . m_Flags & DLF_DEFERRED_CUBEMAPS ) <nl> + m_nDeferredProbesNum + + ; <nl> + else <nl> + m_nDeferredLightsNum + + ; <nl> } <nl> <nl> virtual void ApplyForceToEnvironment ( Vec3 vPos , float fRadius , float fAmountOfForce ) ; <nl> class C3DEngine : public I3DEngine , public Cry3DEngineBase <nl> CREHDRSky * m_pREHDRSky ; <nl> <nl> int m_nDeferredLightsNum ; <nl> + int m_nDeferredProbesNum ; <nl> <nl> private : <nl> / / not sorted <nl> mmm a / Code / CryEngine / Cry3DEngine / LightEntity . cpp <nl> ppp b / Code / CryEngine / Cry3DEngine / LightEntity . cpp <nl> void CLightEntity : : Render ( const SRendParams & rParams , const SRenderingPassInfo & <nl> <nl> if ( GetCVars ( ) - > e_DynamicLights & & m_fWSMaxViewDist ) <nl> { <nl> - if ( GetCVars ( ) - > e_DynamicLights = = 2 ) <nl> + SRenderLight * pL = & m_light ; <nl> + const bool isEnvProbe = ( pL - > m_Flags & DLF_DEFERRED_CUBEMAPS ) ! = 0 ; <nl> + if ( GetCVars ( ) - > e_DynamicLights = = 2 & & ! isEnvProbe ) <nl> { <nl> - SRenderLight * pL = & m_light ; <nl> float fSize = 0 . 05f * ( sinf ( GetCurTimeSec ( ) * 10 . f ) + 2 . 0f ) ; <nl> DrawSphere ( pL - > m_Origin , fSize , pL - > m_Color ) ; <nl> - IRenderAuxText : : DrawLabelF ( pL - > m_Origin , 1 . 3f , " id = % d , rad = % . 1f , vdr = % d " , pL - > m_Id , pL - > m_fRadius , ( int ) m_ucViewDistRatio ) ; <nl> + { <nl> + IRenderAuxText : : DrawLabelF ( pL - > m_Origin , 1 . 3f , " id = % d , rad = % . 1f , vdr = % d " , pL - > m_Id , pL - > m_fRadius , ( int ) m_ucViewDistRatio ) ; <nl> + } <nl> + } <nl> + else if ( GetCVars ( ) - > e_DynamicLights = = 3 & & isEnvProbe ) <nl> + { <nl> + float fSize = 0 . 05f * ( sinf ( GetCurTimeSec ( ) * 10 . f ) + 2 . 0f ) ; <nl> + DrawSphere ( pL - > m_Origin , fSize , pL - > m_Color ) ; <nl> + { <nl> + IRenderAuxText : : DrawLabelF ( pL - > m_Origin , 1 . 3f , " id = % d , rad = % . 1f , vdr = % d " , pL - > m_Id , pL - > m_fRadius , ( int ) m_ucViewDistRatio ) ; <nl> + } <nl> } <nl> <nl> const float mult = SATURATE ( 6 . f * ( 1 . f - ( rParams . fDistance / m_fWSMaxViewDist ) ) ) ; <nl> mmm a / Code / CryEngine / Cry3DEngine / cvars . cpp <nl> ppp b / Code / CryEngine / Cry3DEngine / cvars . cpp <nl> void CVars : : Init ( ) <nl> " Sets maximum amount of dynamic light sources " ) ; <nl> <nl> DefineConstIntCVar ( e_DynamicLights , 1 , VF_CHEAT , <nl> - " Activates dynamic light sources " ) ; <nl> + " Activates dynamic light sources \ n " <nl> + " 0 - Disable dynamic lights \ n " <nl> + " 1 - Enable dynamic lights \ n " <nl> + " 2 - Show entity debug info on regular lights \ n " <nl> + " 3 - Show entity debug info on environment probes " ) ; <nl> DefineConstIntCVar ( e_DynamicLightsForceDeferred , 1 , VF_CHEAT , <nl> " Convert all lights to deferred ( except sun ) " ) ; <nl> REGISTER_CVAR ( e_DynamicLightsFrameIdVisTest , 1 , VF_NULL , <nl> | ! R ( 3DEngine ) ( CE - 19414 ) Added description for e_dynamiclights | CRYTEK/CRYENGINE | 6536c6a378d6b0afc93f922f0de55b19e0aba2ca | 2019-01-31T09:22:47Z |
mmm a / . gitignore <nl> ppp b / . gitignore <nl> local . properties <nl> <nl> compile_commands . json <nl> generated_resmoke_config <nl> + <nl> + # Code review tool config <nl> + codereview . rc <nl> | SERVER - 40701 Add codereview . rc to . gitignore | mongodb/mongo | c7ade3a11f763093bdbf0a6d573c2bfe697f9e84 | 2019-04-23T13:46:30Z |
mmm a / Telegram / SourceFiles / boxes / rate_call_box . cpp <nl> ppp b / Telegram / SourceFiles / boxes / rate_call_box . cpp <nl> constexpr auto kMaxRating = 5 ; <nl> <nl> RateCallBox : : RateCallBox ( QWidget * , uint64 callId , uint64 callAccessHash ) <nl> : _callId ( callId ) <nl> - , _callAccessHash ( callAccessHash ) <nl> - , _label ( this , lang ( lng_call_rate_label ) , Ui : : FlatLabel : : InitType : : Simple , st : : boxLabel ) { <nl> + , _callAccessHash ( callAccessHash ) { <nl> } <nl> <nl> void RateCallBox : : prepare ( ) { <nl> + auto titleWidth = st : : boxWideWidth - 2 * st : : boxTitlePosition . x ( ) ; <nl> + auto titleText = st : : boxTitleFont - > elided ( lang ( lng_call_rate_label ) , titleWidth ) ; <nl> + setTitle ( titleText ) ; <nl> addButton ( lang ( lng_cancel ) , [ this ] { closeBox ( ) ; } ) ; <nl> <nl> for ( auto i = 0 ; i < kMaxRating ; + + i ) { <nl> void RateCallBox : : prepare ( ) { <nl> void RateCallBox : : resizeEvent ( QResizeEvent * e ) { <nl> BoxContent : : resizeEvent ( e ) ; <nl> <nl> - _label - > moveToLeft ( st : : callRatingPadding . left ( ) , st : : callRatingPadding . top ( ) ) ; <nl> - auto starLeft = st : : callRatingPadding . left ( ) + st : : callRatingStarLeft ; <nl> - auto starTop = _label - > bottomNoMargins ( ) + st : : callRatingStarTop ; <nl> + auto starsWidth = ( _stars . size ( ) * st : : callRatingStar . width ) ; <nl> + auto starLeft = ( width ( ) - starsWidth ) / 2 ; <nl> + auto starTop = st : : callRatingStarTop ; <nl> for ( auto & star : _stars ) { <nl> star - > moveToLeft ( starLeft , starTop ) ; <nl> starLeft + = star - > width ( ) ; <nl> void RateCallBox : : onSend ( ) { <nl> } <nl> <nl> void RateCallBox : : updateMaxHeight ( ) { <nl> - auto newHeight = st : : callRatingPadding . top ( ) + _label - > heightNoMargins ( ) + st : : callRatingStarTop + _stars . back ( ) - > heightNoMargins ( ) + st : : callRatingPadding . bottom ( ) ; <nl> + auto newHeight = st : : callRatingPadding . top ( ) + st : : callRatingStarTop + _stars . back ( ) - > heightNoMargins ( ) + st : : callRatingPadding . bottom ( ) ; <nl> if ( _comment ) { <nl> newHeight + = st : : callRatingCommentTop + _comment - > height ( ) ; <nl> } <nl> - setDimensions ( st : : boxWidth , newHeight ) ; <nl> + setDimensions ( st : : boxWideWidth , newHeight ) ; <nl> } <nl> mmm a / Telegram / SourceFiles / boxes / rate_call_box . h <nl> ppp b / Telegram / SourceFiles / boxes / rate_call_box . h <nl> private slots : <nl> uint64 _callAccessHash = 0 ; <nl> int _rating = 0 ; <nl> <nl> - object_ptr < Ui : : FlatLabel > _label ; <nl> std : : vector < object_ptr < Ui : : IconButton > > _stars ; <nl> object_ptr < Ui : : InputArea > _comment = { nullptr } ; <nl> <nl> mmm a / Telegram / SourceFiles / calls / calls . style <nl> ppp b / Telegram / SourceFiles / calls / calls . style <nl> callReDial : IconButton { <nl> rippleAreaSize : 40px ; <nl> } <nl> <nl> - callRatingPadding : margins ( 24px , 26px , 24px , 8px ) ; <nl> + callRatingPadding : margins ( 24px , 26px , 24px , 0px ) ; <nl> callRatingStar : IconButton { <nl> width : 36px ; <nl> height : 36px ; <nl> callRatingStar : IconButton { <nl> rippleAreaSize : 36px ; <nl> } <nl> callRatingStarFilled : icon { { " call_rating_filled " , lightButtonFg } } ; <nl> - callRatingStarLeft : - 7px ; <nl> - callRatingStarTop : 6px ; <nl> + callRatingStarTop : 4px ; <nl> callRatingComment : InputField ( defaultInputField ) { <nl> textMargins : margins ( 1px , 26px , 1px , 4px ) ; <nl> heightMax : 135px ; <nl> } <nl> - callRatingCommentTop : 2px ; <nl> + callRatingCommentTop : 8px ; <nl> <nl> callDebugLabel : FlatLabel ( defaultFlatLabel ) { <nl> margin : margins ( 24px , 0px , 24px , 0px ) ; <nl> | Improve RateCallBox design . | telegramdesktop/tdesktop | 96062039c75dddaeb4bf92431fa6ec4aa7866f6f | 2017-05-09T20:46:43Z |
mmm a / hphp / hack / man / hh_client . 1 <nl> ppp b / hphp / hack / man / hh_client . 1 <nl> Autocompletes text on STDIN where the cursor is replaced with <nl> . I AUTO332 . <nl> Returns a newline - separated list . <nl> <nl> + . TP <nl> + . BI \ - \ - search " STRING " <nl> + Fuzzy search symbol definitions for <nl> + . I STRING . <nl> + Returns a newline - separated list . <nl> <nl> . SS start <nl> <nl> mmm a / hphp / hack / src / client / clientArgs . ml <nl> ppp b / hphp / hack / src / client / clientArgs . ml <nl> let parse_check_args cmd = <nl> " - - refactor " , Arg . Unit ( set_mode MODE_REFACTOR ) , <nl> " " ; <nl> " - - search " , Arg . String ( fun x - > set_mode ( MODE_SEARCH ( x , " " ) ) ( ) ) , <nl> - " " ; <nl> + " ( mode ) fuzzy search symbol definitions " ; <nl> " - - search - class " , <nl> Arg . String ( fun x - > set_mode <nl> ( MODE_SEARCH ( x , " class " ) ) ( ) ) , <nl> - " " ; <nl> + " ( mode ) fuzzy search class definitions " ; <nl> " - - search - function " , <nl> Arg . String ( fun x - > set_mode <nl> ( MODE_SEARCH ( x , " function " ) ) ( ) ) , <nl> - " " ; <nl> + " ( mode ) fuzzy search function definitions " ; <nl> " - - search - typedef " , <nl> Arg . String ( fun x - > set_mode <nl> ( MODE_SEARCH ( x , " typedef " ) ) ( ) ) , <nl> - " " ; <nl> + " ( mode ) fuzzy search typedef definitions " ; <nl> " - - search - constant " , <nl> Arg . String ( fun x - > set_mode <nl> ( MODE_SEARCH ( x , " constant " ) ) ( ) ) , <nl> - " " ; <nl> + " ( mode ) fuzzy search constant definitions " ; <nl> " - - outline " , Arg . Unit ( set_mode MODE_OUTLINE ) , <nl> " ( mode ) prints an outline of the text on stdin " ; <nl> " - - inheritance - children " , Arg . String ( fun x - > set_mode ( MODE_METHOD_JUMP_CHILDREN x ) ( ) ) , <nl> | Document hh_client - - search in help | facebook/hhvm | 68e5384473283ef2d8f5159caed5fa7059716fd2 | 2015-01-08T04:00:34Z |
mmm a / src / core / utils / misc . cpp <nl> ppp b / src / core / utils / misc . cpp <nl> const int UNLEN = 256 ; <nl> # endif <nl> # endif / / DISABLE_GUI <nl> <nl> + # ifndef DISABLE_GUI <nl> + # include < QDesktopServices > <nl> + # include < QProcess > <nl> + # endif <nl> + <nl> # include " core / utils / string . h " <nl> # include " core / unicodestrings . h " <nl> # include " core / logger . h " <nl> # include " misc . h " <nl> + # include " fs . h " <nl> <nl> static struct { const char * source ; const char * comment ; } units [ ] = { <nl> QT_TRANSLATE_NOOP3 ( " misc " , " B " , " bytes " ) , <nl> QString Utils : : Misc : : parseHtmlLinks ( const QString & raw_text ) <nl> return result ; <nl> } <nl> <nl> + # ifndef DISABLE_GUI <nl> + / / Open the given path with an appropriate application <nl> + void Utils : : Misc : : openPath ( const QString & absolutePath ) <nl> + { <nl> + const QString path = Utils : : Fs : : fromNativePath ( absolutePath ) ; <nl> + / / Hack to access samba shares with QDesktopServices : : openUrl <nl> + if ( path . startsWith ( " / / " ) ) <nl> + QDesktopServices : : openUrl ( Utils : : Fs : : toNativePath ( " file : " + path ) ) ; <nl> + else <nl> + QDesktopServices : : openUrl ( QUrl : : fromLocalFile ( path ) ) ; <nl> + } <nl> + <nl> + / / Open the parent directory of the given path with a file manager and select <nl> + / / ( if possible ) the item at the given path <nl> + void Utils : : Misc : : openFolderSelect ( const QString & absolutePath ) <nl> + { <nl> + const QString path = Utils : : Fs : : fromNativePath ( absolutePath ) ; <nl> + # ifdef Q_OS_WIN <nl> + if ( QFileInfo ( path ) . exists ( ) ) { <nl> + / / Syntax is : explorer / select , " C : \ Folder1 \ Folder2 \ file_to_select " <nl> + / / Dir separators MUST be win - style slashes <nl> + QProcess : : startDetached ( " explorer . exe " , QStringList ( ) < < " / select , " < < Utils : : Fs : : toNativePath ( absolutePath ) ) ; <nl> + } <nl> + else { <nl> + / / If the item to select doesn ' t exist , try to open its parent <nl> + openPath ( path . left ( path . lastIndexOf ( " / " ) ) ) ; <nl> + } <nl> + # elif defined ( Q_OS_UNIX ) & & ! defined ( Q_OS_MAC ) <nl> + if ( QFileInfo ( path ) . exists ( ) ) { <nl> + QProcess proc ; <nl> + QString output ; <nl> + proc . start ( " xdg - mime " , QStringList ( ) < < " query " < < " default " < < " inode / directory " ) ; <nl> + proc . waitForFinished ( ) ; <nl> + output = proc . readLine ( ) . simplified ( ) ; <nl> + if ( output = = " dolphin . desktop " ) <nl> + proc . startDetached ( " dolphin " , QStringList ( ) < < " - - select " < < Utils : : Fs : : toNativePath ( path ) ) ; <nl> + else if ( output = = " nautilus . desktop " | | output = = " org . gnome . Nautilus . desktop " <nl> + | | output = = " nautilus - folder - handler . desktop " ) <nl> + proc . startDetached ( " nautilus " , QStringList ( ) < < " - - no - desktop " < < Utils : : Fs : : toNativePath ( path ) ) ; <nl> + else if ( output = = " caja - folder - handler . desktop " ) <nl> + proc . startDetached ( " caja " , QStringList ( ) < < " - - no - desktop " < < Utils : : Fs : : toNativePath ( path ) ) ; <nl> + else if ( output = = " nemo . desktop " ) <nl> + proc . startDetached ( " nemo " , QStringList ( ) < < " - - no - desktop " < < Utils : : Fs : : toNativePath ( path ) ) ; <nl> + else if ( output = = " kfmclient_dir . desktop " ) <nl> + proc . startDetached ( " konqueror " , QStringList ( ) < < " - - select " < < Utils : : Fs : : toNativePath ( path ) ) ; <nl> + else <nl> + openPath ( path . left ( path . lastIndexOf ( " / " ) ) ) ; <nl> + } <nl> + else { <nl> + / / If the item to select doesn ' t exist , try to open its parent <nl> + openPath ( path . left ( path . lastIndexOf ( " / " ) ) ) ; <nl> + } <nl> + # else <nl> + openPath ( path . left ( path . lastIndexOf ( " / " ) ) ) ; <nl> + # endif <nl> + } <nl> + # endif / / DISABLE_GUI <nl> + <nl> namespace <nl> { <nl> / / Trick to get a portable sleep ( ) function <nl> mmm a / src / core / utils / misc . h <nl> ppp b / src / core / utils / misc . h <nl> namespace Utils <nl> QList < int > intListfromStringList ( const QStringList & l ) ; <nl> QList < bool > boolListfromStringList ( const QStringList & l ) ; <nl> <nl> + # ifndef DISABLE_GUI <nl> + void openPath ( const QString & absolutePath ) ; <nl> + void openFolderSelect ( const QString & absolutePath ) ; <nl> + # endif <nl> + <nl> void msleep ( unsigned long msecs ) ; <nl> } <nl> } <nl> mmm a / src / gui / properties / propertieswidget . cpp <nl> ppp b / src / gui / properties / propertieswidget . cpp <nl> <nl> # include < QMessageBox > <nl> # include < QMenu > <nl> # include < QFileDialog > <nl> - # include < QDesktopServices > <nl> # include < QBitArray > <nl> <nl> # include " core / bittorrent / session . h " <nl> void PropertiesWidget : : openFile ( const QModelIndex & index ) { <nl> qDebug ( " Trying to open file at % s " , qPrintable ( file_path ) ) ; <nl> / / Flush data <nl> m_torrent - > flushCache ( ) ; <nl> - if ( QFile : : exists ( file_path ) ) { <nl> - if ( file_path . startsWith ( " / / " ) ) <nl> - QDesktopServices : : openUrl ( Utils : : Fs : : toNativePath ( " file : " + file_path ) ) ; <nl> - else <nl> - QDesktopServices : : openUrl ( QUrl : : fromLocalFile ( file_path ) ) ; <nl> - } <nl> - else { <nl> - QMessageBox : : warning ( this , tr ( " I / O Error " ) , tr ( " This file does not exist yet . " ) ) ; <nl> - } <nl> + Utils : : Misc : : openPath ( file_path ) ; <nl> } <nl> <nl> void PropertiesWidget : : openFolder ( const QModelIndex & index , bool containing_folder ) { <nl> void PropertiesWidget : : openFolder ( const QModelIndex & index , bool containing_fold <nl> } <nl> if ( path_items . isEmpty ( ) ) <nl> return ; <nl> - # if ! ( defined ( Q_OS_WIN ) | | ( defined ( Q_OS_UNIX ) & & ! defined ( Q_OS_MAC ) ) ) <nl> - if ( containing_folder ) <nl> - path_items . removeLast ( ) ; <nl> - # endif <nl> const QDir saveDir ( m_torrent - > actualSavePath ( ) ) ; <nl> const QString relative_path = path_items . join ( " / " ) ; <nl> absolute_path = Utils : : Fs : : expandPath ( saveDir . absoluteFilePath ( relative_path ) ) ; <nl> void PropertiesWidget : : openFolder ( const QModelIndex & index , bool containing_fold <nl> const QDir saveDir ( m_torrent - > actualSavePath ( ) ) ; <nl> const QString relative_path = m_torrent - > filePath ( i ) ; <nl> absolute_path = Utils : : Fs : : expandPath ( saveDir . absoluteFilePath ( relative_path ) ) ; <nl> - <nl> - # if ! ( defined ( Q_OS_WIN ) | | ( defined ( Q_OS_UNIX ) & & ! defined ( Q_OS_MAC ) ) ) <nl> - if ( containing_folder ) <nl> - absolute_path = Utils : : Fs : : folderName ( absolute_path ) ; <nl> - # endif <nl> } <nl> <nl> / / Flush data <nl> m_torrent - > flushCache ( ) ; <nl> - if ( ! QFile : : exists ( absolute_path ) ) <nl> - return ; <nl> - qDebug ( " Trying to open folder at % s " , qPrintable ( absolute_path ) ) ; <nl> - <nl> - # ifdef Q_OS_WIN <nl> - if ( containing_folder ) { <nl> - / / Syntax is : explorer / select , " C : \ Folder1 \ Folder2 \ file_to_select " <nl> - / / Dir separators MUST be win - style slashes <nl> - QProcess : : startDetached ( " explorer . exe " , QStringList ( ) < < " / select , " < < Utils : : Fs : : toNativePath ( absolute_path ) ) ; <nl> - } else { <nl> - # elif defined ( Q_OS_UNIX ) & & ! defined ( Q_OS_MAC ) <nl> - if ( containing_folder ) { <nl> - QProcess proc ; <nl> - QString output ; <nl> - proc . start ( " xdg - mime " , QStringList ( ) < < " query " < < " default " < < " inode / directory " ) ; <nl> - proc . waitForFinished ( ) ; <nl> - output = proc . readLine ( ) . simplified ( ) ; <nl> - if ( output = = " dolphin . desktop " ) <nl> - proc . startDetached ( " dolphin " , QStringList ( ) < < " - - select " < < Utils : : Fs : : toNativePath ( absolute_path ) ) ; <nl> - else if ( output = = " nautilus - folder - handler . desktop " ) <nl> - proc . startDetached ( " nautilus " , QStringList ( ) < < " - - no - desktop " < < Utils : : Fs : : toNativePath ( absolute_path ) ) ; <nl> - else if ( output = = " kfmclient_dir . desktop " ) <nl> - proc . startDetached ( " konqueror " , QStringList ( ) < < " - - select " < < Utils : : Fs : : toNativePath ( absolute_path ) ) ; <nl> - else <nl> - QDesktopServices : : openUrl ( QUrl : : fromLocalFile ( QFileInfo ( absolute_path ) . absolutePath ( ) ) ) ; <nl> - } else { <nl> - # endif <nl> - if ( QFile : : exists ( absolute_path ) ) { <nl> - / / Hack to access samba shares with QDesktopServices : : openUrl <nl> - if ( absolute_path . startsWith ( " / / " ) ) <nl> - QDesktopServices : : openUrl ( Utils : : Fs : : toNativePath ( " file : " + absolute_path ) ) ; <nl> - else <nl> - QDesktopServices : : openUrl ( QUrl : : fromLocalFile ( absolute_path ) ) ; <nl> - } else { <nl> - QMessageBox : : warning ( this , tr ( " I / O Error " ) , tr ( " This folder does not exist yet . " ) ) ; <nl> - } <nl> - # if defined ( Q_OS_WIN ) | | ( defined ( Q_OS_UNIX ) & & ! defined ( Q_OS_MAC ) ) <nl> - } <nl> - # endif <nl> + if ( containing_folder ) <nl> + Utils : : Misc : : openFolderSelect ( absolute_path ) ; <nl> + else <nl> + Utils : : Misc : : openPath ( absolute_path ) ; <nl> } <nl> <nl> void PropertiesWidget : : displayFilesListMenu ( const QPoint & ) { <nl> mmm a / src / gui / transferlistwidget . cpp <nl> ppp b / src / gui / transferlistwidget . cpp <nl> <nl> # include < QShortcut > <nl> # include < QStandardItemModel > <nl> # include < QSortFilterProxyModel > <nl> - # include < QDesktopServices > <nl> # include < QTimer > <nl> # include < QClipboard > <nl> # include < QColor > <nl> TorrentModel * TransferListWidget : : getSourceModel ( ) const <nl> <nl> void TransferListWidget : : previewFile ( QString filePath ) <nl> { <nl> - openUrl ( filePath ) ; <nl> + Utils : : Misc : : openPath ( filePath ) ; <nl> } <nl> <nl> inline QModelIndex TransferListWidget : : mapToSource ( const QModelIndex & index ) const <nl> void TransferListWidget : : torrentDoubleClicked ( const QModelIndex & index ) <nl> torrent - > pause ( ) ; <nl> break ; <nl> case OPEN_DEST : <nl> - openUrl ( torrent - > rootPath ( ) ) ; <nl> + if ( torrent - > filesCount ( ) = = 1 ) <nl> + Utils : : Misc : : openFolderSelect ( QDir ( torrent - > rootPath ( ) ) . absoluteFilePath ( torrent - > filePath ( 0 ) ) ) ; <nl> + else <nl> + Utils : : Misc : : openPath ( torrent - > rootPath ( ) ) ; <nl> + break ; <nl> } <nl> } <nl> <nl> void TransferListWidget : : openSelectedTorrentsFolder ( ) const <nl> { <nl> QSet < QString > pathsList ; <nl> foreach ( BitTorrent : : TorrentHandle * const torrent , getSelectedTorrents ( ) ) { <nl> - QString rootFolder = torrent - > rootPath ( ) ; <nl> - qDebug ( " Opening path at % s " , qPrintable ( rootFolder ) ) ; <nl> - if ( ! pathsList . contains ( rootFolder ) ) { <nl> - pathsList . insert ( rootFolder ) ; <nl> - openUrl ( rootFolder ) ; <nl> + QString path ; <nl> + if ( torrent - > filesCount ( ) = = 1 ) { <nl> + path = QDir ( torrent - > rootPath ( ) ) . absoluteFilePath ( torrent - > filePath ( 0 ) ) ; <nl> + if ( ! pathsList . contains ( path ) ) <nl> + Utils : : Misc : : openFolderSelect ( path ) ; <nl> + } <nl> + else { <nl> + path = torrent - > rootPath ( ) ; <nl> + if ( ! pathsList . contains ( path ) ) <nl> + Utils : : Misc : : openPath ( path ) ; <nl> } <nl> + pathsList . insert ( path ) ; <nl> } <nl> } <nl> <nl> void TransferListWidget : : askNewLabelForSelection ( ) <nl> } while ( invalid ) ; <nl> } <nl> <nl> - bool TransferListWidget : : openUrl ( const QString & _path ) const <nl> - { <nl> - const QString path = Utils : : Fs : : fromNativePath ( _path ) ; <nl> - / / Hack to access samba shares with QDesktopServices : : openUrl <nl> - if ( path . startsWith ( " / / " ) ) <nl> - return QDesktopServices : : openUrl ( Utils : : Fs : : toNativePath ( " file : " + path ) ) ; <nl> - else <nl> - return QDesktopServices : : openUrl ( QUrl : : fromLocalFile ( path ) ) ; <nl> - } <nl> - <nl> void TransferListWidget : : renameSelectedTorrent ( ) <nl> { <nl> const QModelIndexList selectedIndexes = selectionModel ( ) - > selectedRows ( ) ; <nl> mmm a / src / gui / transferlistwidget . h <nl> ppp b / src / gui / transferlistwidget . h <nl> protected slots : <nl> void askNewLabelForSelection ( ) ; <nl> void saveSettings ( ) ; <nl> <nl> - private : <nl> - bool openUrl ( const QString & _path ) const ; <nl> - <nl> signals : <nl> void currentTorrentChanged ( BitTorrent : : TorrentHandle * const torrent ) ; <nl> <nl> | Merge pull request from pmzqla / select - destination | qbittorrent/qBittorrent | f3c3912923a89221142647f7f6509d7321d47dd4 | 2015-08-29T17:49:52Z |
mmm a / src / python / grpcio / requirements . txt <nl> ppp b / src / python / grpcio / requirements . txt <nl> <nl> - enum34 = = 1 . 0 . 4 <nl> - futures = = 2 . 2 . 0 <nl> + enum34 > = 1 . 0 . 4 <nl> + futures > = 2 . 2 . 0 <nl> mmm a / src / python / grpcio / setup . py <nl> ppp b / src / python / grpcio / setup . py <nl> <nl> } <nl> <nl> _INSTALL_REQUIRES = ( <nl> - ' enum34 = = 1 . 0 . 4 ' , <nl> - ' futures = = 2 . 2 . 0 ' , <nl> - ' protobuf = = 3 . 0 . 0a3 ' , <nl> + ' enum34 > = 1 . 0 . 4 ' , <nl> + ' futures > = 2 . 2 . 0 ' , <nl> ) <nl> <nl> _SETUP_REQUIRES = ( <nl> mmm a / src / python / grpcio_test / setup . py <nl> ppp b / src / python / grpcio_test / setup . py <nl> <nl> _INSTALL_REQUIRES = ( <nl> ' oauth2client > = 1 . 4 . 7 ' , <nl> ' grpcio > = 0 . 11 . 0b0 ' , <nl> + # TODO ( issue 3321 ) : Unpin protobuf dependency . <nl> + ' protobuf = = 3 . 0 . 0a3 ' , <nl> ) <nl> <nl> _COMMAND_CLASS = { <nl> | Further maintenance of Python dependencies | grpc/grpc | a1880228aa63d579b772a403090616ade95b41d5 | 2015-09-10T22:16:04Z |
mmm a / src / core / CMakeLists . txt <nl> ppp b / src / core / CMakeLists . txt <nl> set ( HEADERS <nl> create_directory_groups ( $ { SRCS } $ { HEADERS } ) <nl> add_library ( core STATIC $ { SRCS } $ { HEADERS } ) <nl> target_link_libraries ( core PUBLIC common PRIVATE audio_core video_core ) <nl> - target_link_libraries ( core PUBLIC Boost : : boost PRIVATE cryptopp dynarmic ) <nl> + target_link_libraries ( core PUBLIC Boost : : boost PRIVATE cryptopp dynarmic fmt ) <nl> mmm a / src / core / hle / kernel / hle_ipc . cpp <nl> ppp b / src / core / hle / kernel / hle_ipc . cpp <nl> void SessionRequestHandler : : ClientDisconnected ( SharedPtr < ServerSession > server_s <nl> boost : : range : : remove_erase ( connected_sessions , server_session ) ; <nl> } <nl> <nl> + HLERequestContext : : ~ HLERequestContext ( ) = default ; <nl> + <nl> } / / namespace Kernel <nl> mmm a / src / core / hle / kernel / hle_ipc . h <nl> ppp b / src / core / hle / kernel / hle_ipc . h <nl> <nl> # include < memory > <nl> # include < vector > <nl> # include " core / hle / kernel / kernel . h " <nl> + # include " core / hle / kernel / server_session . h " <nl> <nl> - namespace Kernel { <nl> + namespace Service { <nl> + class ServiceFrameworkBase ; <nl> + } <nl> <nl> - class ServerSession ; <nl> + namespace Kernel { <nl> <nl> / * * <nl> * Interface implemented by HLE Session handlers . <nl> class SessionRequestHandler : public std : : enable_shared_from_this < SessionRequest <nl> std : : vector < SharedPtr < ServerSession > > connected_sessions ; <nl> } ; <nl> <nl> + / * * <nl> + * Class containing information about an in - flight IPC request being handled by an HLE service <nl> + * implementation . Services should avoid using old global APIs ( e . g . Kernel : : GetCommandBuffer ( ) ) and <nl> + * when possible use the APIs in this class to service the request . <nl> + * / <nl> + class HLERequestContext { <nl> + public : <nl> + ~ HLERequestContext ( ) ; <nl> + <nl> + / / / Returns a pointer to the IPC command buffer for this request . <nl> + u32 * CommandBuffer ( ) const { <nl> + return cmd_buf ; <nl> + } <nl> + <nl> + / * * <nl> + * Returns the session through which this request was made . This can be used as a map key to <nl> + * access per - client data on services . <nl> + * / <nl> + SharedPtr < ServerSession > Session ( ) const { <nl> + return session ; <nl> + } <nl> + <nl> + private : <nl> + friend class Service : : ServiceFrameworkBase ; <nl> + <nl> + u32 * cmd_buf = nullptr ; <nl> + SharedPtr < ServerSession > session ; <nl> + } ; <nl> + <nl> } / / namespace Kernel <nl> mmm a / src / core / hle / service / service . cpp <nl> ppp b / src / core / hle / service / service . cpp <nl> <nl> / / Licensed under GPLv2 or any later version <nl> / / Refer to the license . txt file included . <nl> <nl> + # include < fmt / format . h > <nl> # include " common / logging / log . h " <nl> # include " common / string_util . h " <nl> # include " core / hle / kernel / client_port . h " <nl> <nl> # include " core / hle / service / ssl_c . h " <nl> # include " core / hle / service / y2r_u . h " <nl> <nl> + using Kernel : : ClientPort ; <nl> + using Kernel : : ServerPort ; <nl> + using Kernel : : ServerSession ; <nl> + using Kernel : : SharedPtr ; <nl> + <nl> namespace Service { <nl> <nl> std : : unordered_map < std : : string , Kernel : : SharedPtr < Kernel : : ClientPort > > g_kernel_named_ports ; <nl> void Interface : : Register ( const FunctionInfo * functions , size_t n ) { <nl> } <nl> } <nl> <nl> + / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / <nl> + <nl> + ServiceFrameworkBase : : ServiceFrameworkBase ( const char * service_name , u32 max_sessions , <nl> + InvokerFn * handler_invoker ) <nl> + : service_name ( service_name ) , max_sessions ( max_sessions ) , handler_invoker ( handler_invoker ) { } <nl> + <nl> + ServiceFrameworkBase : : ~ ServiceFrameworkBase ( ) = default ; <nl> + <nl> + void ServiceFrameworkBase : : InstallAsService ( SM : : ServiceManager & service_manager ) { <nl> + ASSERT ( port = = nullptr ) ; <nl> + port = service_manager . RegisterService ( service_name , max_sessions ) . Unwrap ( ) ; <nl> + port - > SetHleHandler ( shared_from_this ( ) ) ; <nl> + } <nl> + <nl> + void ServiceFrameworkBase : : InstallAsNamedPort ( ) { <nl> + ASSERT ( port = = nullptr ) ; <nl> + SharedPtr < ServerPort > server_port ; <nl> + SharedPtr < ClientPort > client_port ; <nl> + std : : tie ( server_port , client_port ) = ServerPort : : CreatePortPair ( max_sessions , service_name ) ; <nl> + server_port - > SetHleHandler ( shared_from_this ( ) ) ; <nl> + AddNamedPort ( service_name , std : : move ( client_port ) ) ; <nl> + } <nl> + <nl> + void ServiceFrameworkBase : : RegisterHandlersBase ( const FunctionInfoBase * functions , size_t n ) { <nl> + handlers . reserve ( handlers . size ( ) + n ) ; <nl> + for ( size_t i = 0 ; i < n ; + + i ) { <nl> + / / Usually this array is sorted by id already , so hint to insert at the end <nl> + handlers . emplace_hint ( handlers . cend ( ) , functions [ i ] . expected_header , functions [ i ] ) ; <nl> + } <nl> + } <nl> + <nl> + void ServiceFrameworkBase : : ReportUnimplementedFunction ( u32 * cmd_buf , const FunctionInfoBase * info ) { <nl> + IPC : : Header header { cmd_buf [ 0 ] } ; <nl> + int num_params = header . normal_params_size + header . translate_params_size ; <nl> + std : : string function_name = info = = nullptr ? fmt : : format ( " { : # 08x } " , cmd_buf [ 0 ] ) : info - > name ; <nl> + <nl> + fmt : : MemoryWriter w ; <nl> + w . write ( " function ' { } ' : port = ' { } ' cmd_buf = { { [ 0 ] = { : # x } " , function_name , service_name , <nl> + cmd_buf [ 0 ] ) ; <nl> + for ( int i = 1 ; i < = num_params ; + + i ) { <nl> + w . write ( " , [ { } ] = { : # x } " , i , cmd_buf [ i ] ) ; <nl> + } <nl> + w < < ' } ' ; <nl> + <nl> + LOG_ERROR ( Service , " unknown / unimplemented % s " , w . c_str ( ) ) ; <nl> + / / TODO ( bunnei ) : Hack - ignore error <nl> + cmd_buf [ 1 ] = 0 ; <nl> + } <nl> + <nl> + void ServiceFrameworkBase : : HandleSyncRequest ( SharedPtr < ServerSession > server_session ) { <nl> + u32 * cmd_buf = Kernel : : GetCommandBuffer ( ) ; <nl> + <nl> + / / TODO ( yuriks ) : The kernel should be the one handling this as part of translation after <nl> + / / everything else is migrated <nl> + Kernel : : HLERequestContext context ; <nl> + context . cmd_buf = cmd_buf ; <nl> + context . session = std : : move ( server_session ) ; <nl> + <nl> + u32 header_code = cmd_buf [ 0 ] ; <nl> + auto itr = handlers . find ( header_code ) ; <nl> + const FunctionInfoBase * info = itr = = handlers . end ( ) ? nullptr : & itr - > second ; <nl> + if ( info = = nullptr | | info - > handler_callback = = nullptr ) { <nl> + return ReportUnimplementedFunction ( cmd_buf , info ) ; <nl> + } <nl> + <nl> + LOG_TRACE ( Service , " % s " , <nl> + MakeFunctionString ( info - > name , GetServiceName ( ) . c_str ( ) , cmd_buf ) . c_str ( ) ) ; <nl> + handler_invoker ( this , info - > handler_callback , context ) ; <nl> + } <nl> + <nl> / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / <nl> / / Module interface <nl> <nl> + / / TODO ( yuriks ) : Move to kernel <nl> + void AddNamedPort ( std : : string name , SharedPtr < ClientPort > port ) { <nl> + g_kernel_named_ports . emplace ( std : : move ( name ) , std : : move ( port ) ) ; <nl> + } <nl> + <nl> static void AddNamedPort ( Interface * interface_ ) { <nl> Kernel : : SharedPtr < Kernel : : ServerPort > server_port ; <nl> Kernel : : SharedPtr < Kernel : : ClientPort > client_port ; <nl> static void AddNamedPort ( Interface * interface_ ) { <nl> Kernel : : ServerPort : : CreatePortPair ( interface_ - > GetMaxSessions ( ) , interface_ - > GetPortName ( ) ) ; <nl> <nl> server_port - > SetHleHandler ( std : : shared_ptr < Interface > ( interface_ ) ) ; <nl> - g_kernel_named_ports . emplace ( interface_ - > GetPortName ( ) , std : : move ( client_port ) ) ; <nl> + AddNamedPort ( interface_ - > GetPortName ( ) , std : : move ( client_port ) ) ; <nl> } <nl> <nl> void AddService ( Interface * interface_ ) { <nl> mmm a / src / core / hle / service / service . h <nl> ppp b / src / core / hle / service / service . h <nl> <nl> <nl> namespace Kernel { <nl> class ClientPort ; <nl> + class ServerPort ; <nl> class ServerSession ; <nl> } <nl> <nl> namespace Service { <nl> <nl> + namespace SM { <nl> + class ServiceManager ; <nl> + } <nl> + <nl> static const int kMaxPortSize = 8 ; / / / < Maximum size of a port name ( 8 characters ) <nl> / / / Arbitrary default number of maximum connections to an HLE service . <nl> static const u32 DefaultMaxSessions = 10 ; <nl> static const u32 DefaultMaxSessions = 10 ; <nl> / * * <nl> * Framework for implementing HLE service handlers which dispatch incoming SyncRequests based on a <nl> * table mapping header ids to handler functions . <nl> + * <nl> + * @ deprecated Use ServiceFramework for new services instead . It allows services to be stateful and <nl> + * is more extensible going forward . <nl> * / <nl> class Interface : public Kernel : : SessionRequestHandler { <nl> public : <nl> class Interface : public Kernel : : SessionRequestHandler { <nl> boost : : container : : flat_map < u32 , FunctionInfo > m_functions ; <nl> } ; <nl> <nl> + / * * <nl> + * This is an non - templated base of ServiceFramework to reduce code bloat and compilation times , it <nl> + * is not meant to be used directly . <nl> + * <nl> + * @ see ServiceFramework <nl> + * / <nl> + class ServiceFrameworkBase : public Kernel : : SessionRequestHandler { <nl> + public : <nl> + / / / Returns the string identifier used to connect to the service . <nl> + std : : string GetServiceName ( ) const { <nl> + return service_name ; <nl> + } <nl> + <nl> + / * * <nl> + * Returns the maximum number of sessions that can be connected to this service at the same <nl> + * time . <nl> + * / <nl> + u32 GetMaxSessions ( ) const { <nl> + return max_sessions ; <nl> + } <nl> + <nl> + / / / Creates a port pair and registers this service with the given ServiceManager . <nl> + void InstallAsService ( SM : : ServiceManager & service_manager ) ; <nl> + / / / Creates a port pair and registers it on the kernel ' s global port registry . <nl> + void InstallAsNamedPort ( ) ; <nl> + <nl> + void HandleSyncRequest ( Kernel : : SharedPtr < Kernel : : ServerSession > server_session ) override ; <nl> + <nl> + protected : <nl> + / / / Member - function pointer type of SyncRequest handlers . <nl> + template < typename Self > <nl> + using HandlerFnP = void ( Self : : * ) ( Kernel : : HLERequestContext & ) ; <nl> + <nl> + private : <nl> + template < typename T > <nl> + friend class ServiceFramework ; <nl> + <nl> + struct FunctionInfoBase { <nl> + u32 expected_header ; <nl> + HandlerFnP < ServiceFrameworkBase > handler_callback ; <nl> + const char * name ; <nl> + } ; <nl> + <nl> + using InvokerFn = void ( ServiceFrameworkBase * object , HandlerFnP < ServiceFrameworkBase > member , <nl> + Kernel : : HLERequestContext & ctx ) ; <nl> + <nl> + ServiceFrameworkBase ( const char * service_name , u32 max_sessions , InvokerFn * handler_invoker ) ; <nl> + ~ ServiceFrameworkBase ( ) ; <nl> + <nl> + void RegisterHandlersBase ( const FunctionInfoBase * functions , size_t n ) ; <nl> + void ReportUnimplementedFunction ( u32 * cmd_buf , const FunctionInfoBase * info ) ; <nl> + <nl> + / / / Identifier string used to connect to the service . <nl> + std : : string service_name ; <nl> + / / / Maximum number of concurrent sessions that this service can handle . <nl> + u32 max_sessions ; <nl> + <nl> + / * * <nl> + * Port where incoming connections will be received . Only created when InstallAsService ( ) or <nl> + * InstallAsNamedPort ( ) are called . <nl> + * / <nl> + Kernel : : SharedPtr < Kernel : : ServerPort > port ; <nl> + <nl> + / / / Function used to safely up - cast pointers to the derived class before invoking a handler . <nl> + InvokerFn * handler_invoker ; <nl> + boost : : container : : flat_map < u32 , FunctionInfoBase > handlers ; <nl> + } ; <nl> + <nl> + / * * <nl> + * Framework for implementing HLE services . Dispatches on the header id of incoming SyncRequests <nl> + * based on a table mapping header ids to handler functions . Service implementations should inherit <nl> + * from ServiceFramework using the CRTP ( ` class Foo : public ServiceFramework < Foo > { . . . } ; ` ) and <nl> + * populate it with handlers by calling # RegisterHandlers . <nl> + * <nl> + * In order to avoid duplicating code in the binary and exposing too many implementation details in <nl> + * the header , this class is split into a non - templated base ( ServiceFrameworkBase ) and a template <nl> + * deriving from it ( ServiceFramework ) . The functions in this class will mostly only erase the type <nl> + * of the passed in function pointers and then delegate the actual work to the implementation in the <nl> + * base class . <nl> + * / <nl> + template < typename Self > <nl> + class ServiceFramework : public ServiceFrameworkBase { <nl> + protected : <nl> + / / / Contains information about a request type which is handled by the service . <nl> + struct FunctionInfo : FunctionInfoBase { <nl> + / / TODO ( yuriks ) : This function could be constexpr , but clang is the only compiler that <nl> + / / doesn ' t emit an ICE or a wrong diagnostic because of the static_cast . <nl> + <nl> + / * * <nl> + * Constructs a FunctionInfo for a function . <nl> + * <nl> + * @ param expected_header request header in the command buffer which will trigger dispatch <nl> + * to this handler <nl> + * @ param handler_callback member function in this service which will be called to handle <nl> + * the request <nl> + * @ param name human - friendly name for the request . Used mostly for logging purposes . <nl> + * / <nl> + FunctionInfo ( u32 expected_header , HandlerFnP < Self > handler_callback , const char * name ) <nl> + : FunctionInfoBase { <nl> + expected_header , <nl> + / / Type - erase member function pointer by casting it down to the base class . <nl> + static_cast < HandlerFnP < ServiceFrameworkBase > > ( handler_callback ) , name } { } <nl> + } ; <nl> + <nl> + / * * <nl> + * Initializes the handler with no functions installed . <nl> + * @ param max_sessions Maximum number of sessions that can be <nl> + * connected to this service at the same time . <nl> + * / <nl> + ServiceFramework ( const char * service_name , u32 max_sessions = DefaultMaxSessions ) <nl> + : ServiceFrameworkBase ( service_name , max_sessions , Invoker ) { } <nl> + <nl> + / / / Registers handlers in the service . <nl> + template < size_t N > <nl> + void RegisterHandlers ( const FunctionInfo ( & functions ) [ N ] ) { <nl> + RegisterHandlers ( functions , N ) ; <nl> + } <nl> + <nl> + / * * <nl> + * Registers handlers in the service . Usually prefer using the other RegisterHandlers <nl> + * overload in order to avoid needing to specify the array size . <nl> + * / <nl> + void RegisterHandlers ( const FunctionInfo * functions , size_t n ) { <nl> + RegisterHandlersBase ( functions , n ) ; <nl> + } <nl> + <nl> + private : <nl> + / * * <nl> + * This function is used to allow invocation of pointers to handlers stored in the base class <nl> + * without needing to expose the type of this derived class . Pointers - to - member may require a <nl> + * fixup when being up or downcast , and thus code that does that needs to know the concrete type <nl> + * of the derived class in order to invoke one of it ' s functions through a pointer . <nl> + * / <nl> + static void Invoker ( ServiceFrameworkBase * object , HandlerFnP < ServiceFrameworkBase > member , <nl> + Kernel : : HLERequestContext & ctx ) { <nl> + / / Cast back up to our original types and call the member function <nl> + ( static_cast < Self * > ( object ) - > * static_cast < HandlerFnP < Self > > ( member ) ) ( ctx ) ; <nl> + } <nl> + } ; <nl> + <nl> / / / Initialize ServiceManager <nl> void Init ( ) ; <nl> <nl> void Shutdown ( ) ; <nl> / / / Map of named ports managed by the kernel , which can be retrieved using the ConnectToPort SVC . <nl> extern std : : unordered_map < std : : string , Kernel : : SharedPtr < Kernel : : ClientPort > > g_kernel_named_ports ; <nl> <nl> + / / / Adds a port to the named port table <nl> + void AddNamedPort ( std : : string name , Kernel : : SharedPtr < Kernel : : ClientPort > port ) ; <nl> / / / Adds a service to the services table <nl> void AddService ( Interface * interface_ ) ; <nl> <nl> | Service : Add new ServiceFramework framework for writing HLE services | yuzu-emu/yuzu | 84c497292a27d75b83305d053e734ab5659ffe41 | 2017-06-08T07:11:37Z |
mmm a / PowerEditor / src / ScitillaComponent / ScintillaEditView . cpp <nl> ppp b / PowerEditor / src / ScitillaComponent / ScintillaEditView . cpp <nl> void ScintillaEditView : : recalcHorizontalScrollbar ( ) { <nl> if ( currentLength ! = maxPixel ) / / And if it is not the same <nl> execute ( SCI_SETSCROLLWIDTH , maxPixel ) ; / / update it <nl> <nl> - : : ShowScrollBar ( _hSelf , SB_HORZ , TRUE ) ; / / Force scrollbar visible to prevent ' twitchy ' behaviour <nl> + / / : : ShowScrollBar ( _hSelf , SB_HORZ , TRUE ) ; / / Force scrollbar visible to prevent ' twitchy ' behaviour <nl> } <nl> \ No newline at end of file <nl> mmm a / PowerEditor / src / ScitillaComponent / columnEditor . rc <nl> ppp b / PowerEditor / src / ScitillaComponent / columnEditor . rc <nl> BEGIN <nl> <nl> RTEXT " Increase by : " , IDC_COL_INCRNUM_STATIC , 16 , 112 , 75 , 8 <nl> EDITTEXT IDC_COL_INCREASENUM_EDIT , 95 , 110 , 38 , 12 , ES_NUMBER <nl> - CONTROL " Leadng zeros " , IDC_COL_LEADZERO_CHECK , " Button " , BS_AUTOCHECKBOX | WS_TABSTOP , 140 , 112 , 70 , 10 <nl> + CONTROL " Leading zeros " , IDC_COL_LEADZERO_CHECK , " Button " , BS_AUTOCHECKBOX | WS_TABSTOP , 140 , 112 , 70 , 10 <nl> <nl> CONTROL " Dec " , IDC_COL_DEC_RADIO , " Button " , BS_AUTORADIOBUTTON | WS_TABSTOP , 30 , 148 , 50 , 10 <nl> CONTROL " Hex " , IDC_COL_HEX_RADIO , " Button " , BS_AUTORADIOBUTTON | WS_TABSTOP , 124 , 148 , 50 , 10 <nl> | [ BUG_FIXED ] Fix the horizon scroll bar bug . | notepad-plus-plus/notepad-plus-plus | 95e2c6d52972487cf31ef04232211271b6baf932 | 2008-01-10T01:06:28Z |
mmm a / src / wallet . cpp <nl> ppp b / src / wallet . cpp <nl> bool CWallet : : AddToWallet ( const CWalletTx & wtxIn , bool fFromLoadWallet ) <nl> bool CWallet : : AddToWalletIfInvolvingMe ( const uint256 & hash , const CTransaction & tx , const CBlock * pblock , bool fUpdate ) <nl> { <nl> { <nl> - LOCK ( cs_wallet ) ; <nl> + AssertLockHeld ( cs_wallet ) ; <nl> bool fExisted = mapWallet . count ( hash ) ; <nl> if ( fExisted & & ! fUpdate ) return false ; <nl> if ( fExisted | | IsMine ( tx ) | | IsFromMe ( tx ) ) <nl> bool CWallet : : AddToWalletIfInvolvingMe ( const uint256 & hash , const CTransaction & <nl> <nl> void CWallet : : SyncTransaction ( const uint256 & hash , const CTransaction & tx , const CBlock * pblock ) <nl> { <nl> - AddToWalletIfInvolvingMe ( hash , tx , pblock , true ) ; <nl> - <nl> - if ( mapWallet . count ( hash ) = = 0 ) <nl> + LOCK ( cs_wallet ) ; <nl> + if ( ! AddToWalletIfInvolvingMe ( hash , tx , pblock , true ) ) <nl> return ; / / Not one of ours <nl> <nl> / / If a transaction changes ' conflicted ' state , that changes the balance <nl> | Fix missing wallet lock in CWallet : : SyncTransaction ( . . ) | bitcoin/bitcoin | 53d56881a80906bc18cf243deac3e9a721876278 | 2014-03-11T22:39:51Z |
mmm a / src / core / file_sys / program_metadata . cpp <nl> ppp b / src / core / file_sys / program_metadata . cpp <nl> <nl> / / Refer to the license . txt file included . <nl> <nl> # include < cstddef > <nl> - # include < cstring > <nl> # include < vector > <nl> <nl> # include " common / logging / log . h " <nl> ProgramMetadata : : ProgramMetadata ( ) = default ; <nl> ProgramMetadata : : ~ ProgramMetadata ( ) = default ; <nl> <nl> Loader : : ResultStatus ProgramMetadata : : Load ( VirtualFile file ) { <nl> - std : : size_t total_size = static_cast < std : : size_t > ( file - > GetSize ( ) ) ; <nl> - if ( total_size < sizeof ( Header ) ) <nl> + const std : : size_t total_size = file - > GetSize ( ) ; <nl> + if ( total_size < sizeof ( Header ) ) { <nl> return Loader : : ResultStatus : : ErrorBadNPDMHeader ; <nl> + } <nl> <nl> - / / TODO ( DarkLordZach ) : Use ReadObject when Header / AcidHeader becomes trivially copyable . <nl> - std : : vector < u8 > npdm_header_data = file - > ReadBytes ( sizeof ( Header ) ) ; <nl> - if ( sizeof ( Header ) ! = npdm_header_data . size ( ) ) <nl> + if ( sizeof ( Header ) ! = file - > ReadObject ( & npdm_header ) ) { <nl> return Loader : : ResultStatus : : ErrorBadNPDMHeader ; <nl> - std : : memcpy ( & npdm_header , npdm_header_data . data ( ) , sizeof ( Header ) ) ; <nl> + } <nl> <nl> - std : : vector < u8 > acid_header_data = file - > ReadBytes ( sizeof ( AcidHeader ) , npdm_header . acid_offset ) ; <nl> - if ( sizeof ( AcidHeader ) ! = acid_header_data . size ( ) ) <nl> + if ( sizeof ( AcidHeader ) ! = file - > ReadObject ( & acid_header , npdm_header . acid_offset ) ) { <nl> return Loader : : ResultStatus : : ErrorBadACIDHeader ; <nl> - std : : memcpy ( & acid_header , acid_header_data . data ( ) , sizeof ( AcidHeader ) ) ; <nl> + } <nl> <nl> - if ( sizeof ( AciHeader ) ! = file - > ReadObject ( & aci_header , npdm_header . aci_offset ) ) <nl> + if ( sizeof ( AciHeader ) ! = file - > ReadObject ( & aci_header , npdm_header . aci_offset ) ) { <nl> return Loader : : ResultStatus : : ErrorBadACIHeader ; <nl> + } <nl> <nl> - if ( sizeof ( FileAccessControl ) ! = file - > ReadObject ( & acid_file_access , acid_header . fac_offset ) ) <nl> + if ( sizeof ( FileAccessControl ) ! = file - > ReadObject ( & acid_file_access , acid_header . fac_offset ) ) { <nl> return Loader : : ResultStatus : : ErrorBadFileAccessControl ; <nl> - if ( sizeof ( FileAccessHeader ) ! = file - > ReadObject ( & aci_file_access , aci_header . fah_offset ) ) <nl> + } <nl> + <nl> + if ( sizeof ( FileAccessHeader ) ! = file - > ReadObject ( & aci_file_access , aci_header . fah_offset ) ) { <nl> return Loader : : ResultStatus : : ErrorBadFileAccessHeader ; <nl> + } <nl> <nl> aci_kernel_capabilities . resize ( aci_header . kac_size / sizeof ( u32 ) ) ; <nl> const u64 read_size = aci_header . kac_size ; <nl> mmm a / src / core / file_sys / program_metadata . h <nl> ppp b / src / core / file_sys / program_metadata . h <nl> class ProgramMetadata { <nl> void Print ( ) const ; <nl> <nl> private : <nl> - / / TODO ( DarkLordZach ) : BitField is not trivially copyable . <nl> struct Header { <nl> std : : array < char , 4 > magic ; <nl> std : : array < u8 , 8 > reserved ; <nl> class ProgramMetadata { <nl> <nl> static_assert ( sizeof ( Header ) = = 0x80 , " NPDM header structure size is wrong " ) ; <nl> <nl> - / / TODO ( DarkLordZach ) : BitField is not trivially copyable . <nl> struct AcidHeader { <nl> std : : array < u8 , 0x100 > signature ; <nl> std : : array < u8 , 0x100 > nca_modulus ; <nl> | Merge pull request from lioncash / todo | yuzu-emu/yuzu | b8fbd125e682b17bf373d406eec65011f7e16f5f | 2019-04-06T03:35:54Z |
new file mode 100644 <nl> index 000000000000 . . e4d7ab4abf34 <nl> mmm / dev / null <nl> ppp b / validation - test / compiler_crashers / 28703 - swift - typebase - getdesugaredtype . swift <nl> <nl> + / / This source file is part of the Swift . org open source project <nl> + / / Copyright ( c ) 2014 - 2017 Apple Inc . and the Swift project authors <nl> + / / Licensed under Apache License v2 . 0 with Runtime Library Exception <nl> + / / <nl> + / / See https : / / swift . org / LICENSE . txt for license information <nl> + / / See https : / / swift . org / CONTRIBUTORS . txt for the list of Swift project authors <nl> + <nl> + / / RUN : not - - crash % target - swift - frontend % s - emit - ir <nl> + func b ( UInt = 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 as ? Int ) { a <nl> | Merge remote - tracking branch ' origin / master ' into master - next | apple/swift | 35d463a2a548ce1470d9e309a17b8559ff5c65aa | 2017-02-27T14:48:40Z |
mmm a / src / raster / layer . cpp <nl> ppp b / src / raster / layer . cpp <nl> LayerImage : : LayerImage ( Sprite * sprite ) <nl> <nl> LayerImage : : ~ LayerImage ( ) <nl> { <nl> - destroy_all_cels ( ) ; <nl> + destroyAllCels ( ) ; <nl> } <nl> <nl> int LayerImage : : getMemSize ( ) const <nl> int LayerImage : : getMemSize ( ) const <nl> return size ; <nl> } <nl> <nl> - void LayerImage : : destroy_all_cels ( ) <nl> + void LayerImage : : destroyAllCels ( ) <nl> { <nl> CelIterator it = getCelBegin ( ) ; <nl> CelIterator end = getCelEnd ( ) ; <nl> mmm a / src / raster / layer . h <nl> ppp b / src / raster / layer . h <nl> class LayerImage : public Layer <nl> int getCelsCount ( ) const { return m_cels . size ( ) ; } <nl> <nl> private : <nl> - void destroy_all_cels ( ) ; <nl> + void destroyAllCels ( ) ; <nl> <nl> CelList m_cels ; / / List of all cels inside this layer used by frames . <nl> } ; <nl> | Rename Layer : : destroy_all_cels ( ) to destroyAllCels ( ) . | aseprite/aseprite | bf3232c640660d2908e058b981d879d18027a15d | 2011-03-24T16:15:09Z |
mmm a / src / webui / www / private / index . html <nl> ppp b / src / webui / www / private / index . html <nl> < h1 class = " applicationTitle " > qBittorrent Web User Interface < span class = " version <nl> < li > < a href = " # Pause " > < img src = " theme / media - playback - pause " alt = " _ ( Pause ) " / > _ ( Pause ) < / a > < / li > <nl> < li class = " separator " > < a href = " # Delete " > < img src = " theme / list - remove " alt = " _ ( Delete ) " / > _ ( Delete ) < / a > < / li > <nl> < li id = " queueingMenuItems " class = " separator " > <nl> - < a href = " # priority " class = " arrow - right " > _ ( Priority ) < / a > <nl> + < a href = " # priority " class = " arrow - right " > < span style = " display : inline - block ; width : 16px " > < / span > _ ( Priority ) < / a > <nl> < ul > <nl> < li > < a href = " # prioTop " > < img src = " theme / go - top " alt = " _ ( Move to top ) " / > _ ( Move to top ) < / a > < / li > <nl> < li > < a href = " # prioUp " > < img src = " theme / go - up " alt = " _ ( Move up ) " / > _ ( Move up ) < / a > < / li > <nl> | Add space before priority menu item | qbittorrent/qBittorrent | 2c93330ce905f7478a4877e56844cf1aec7d9bd8 | 2014-12-10T03:45:24Z |
new file mode 100644 <nl> index 0000000000 . . a7339f6280 <nl> mmm / dev / null <nl> ppp b / PowerEditor / Test / UrlDetection / plugins / Config / startup . lua <nl> <nl> + - - Startup script for URL detection verification test <nl> + endNppAfterUrlTest = 1 <nl> + local nppDir = npp : GetNppDirectory ( ) <nl> + local verifyUrlDetection = loadfile ( nppDir . . " \ \ " . . " . . \ \ Test \ \ UrlDetection \ \ verifyUrlDetection . lua " ) <nl> + pcall ( verifyUrlDetection ) <nl> + <nl> new file mode 100644 <nl> index 0000000000 . . 6b2867128f <nl> Binary files / dev / null and b / PowerEditor / Test / UrlDetection / plugins / LuaScript / Lua . dll differ <nl> new file mode 100644 <nl> index 0000000000 . . 68b449e25e <nl> Binary files / dev / null and b / PowerEditor / Test / UrlDetection / plugins / LuaScript / LuaScript . dll differ <nl> new file mode 100644 <nl> index 0000000000 . . b6a2d75d4b <nl> mmm / dev / null <nl> ppp b / PowerEditor / Test / UrlDetection / readMe . txt <nl> <nl> + What is the URL detection test <nl> + mmmmmmmmmmmmmmmmmmmmmmmmmmmmmm <nl> + <nl> + The URL detection test is designed to check , <nl> + whether the clickable detection works as expected or not . <nl> + <nl> + It uses text files as input . These text files contain a pair of <nl> + lines for each URL to test . The first line contains the URL , the <nl> + second line contains a sequence of characters , which are a mask , <nl> + consisting of ' 0 ' or ' 1 ' characters , describing whether this <nl> + position in the line should be detected as URL . <nl> + <nl> + Example : <nl> + <nl> + u http : / / dot . com u <nl> + m 11111111111111 m <nl> + <nl> + As can be seen , the URL is enclosed in " u " and " u " , the mask <nl> + is enclosed in " m " and " m " . The mask line must follow the URL <nl> + line immediately . A ' 1 ' in the mask line says , that this position <nl> + should be detected as URL , a ' 0 ' says the opposite . <nl> + <nl> + It is possible , to put arbitrary text between the pairs of test <nl> + lines , to comment the test cases . Obviously , none of the comment <nl> + lines should start and end with a single ' u ' or ' m ' character . <nl> + <nl> + The test files can also be regarded as living document about what <nl> + is currently detected as URL and what not . <nl> + <nl> + <nl> + <nl> + How to conduct the URL detection test <nl> + mmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmm - <nl> + <nl> + Since the URL detection only takes place in the visible part of <nl> + the edit windows , the test can only be run from inside an opened <nl> + Notepad + + with a visible edit window . <nl> + <nl> + Since the test script is written in Lua , a prerequisite to conduct <nl> + the test is , that the Lua plugin is installed . The plugin can be found <nl> + at https : / / github . com / dail8859 / LuaScript / releases . <nl> + <nl> + To conduct the test : <nl> + <nl> + 1 . Open the verifyUrlDetection . lua with Notepad + + . <nl> + 2 . Display the Lua console window ( Plugins - - > LuaScript - - > Show Console ) <nl> + 3 . Execute the opened script file ( Plugins - - > LuaScript - - > Execute Current File ) <nl> + <nl> + The test results will be displayed in the Lua console window . <nl> + <nl> + ! ! ! Please be aware , that there should NO keyboard or mouse or whatever <nl> + input be applied to Notepad + + while this test is running . <nl> + <nl> + <nl> + <nl> + <nl> + How to extend the URL detection test <nl> + mmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmm <nl> + <nl> + It is possible to add test files to the URL detection test <nl> + by copying the new files into this directory and include the filenames <nl> + in the testFiles list at the beginning of verifyUrlDetection . lua . <nl> + <nl> + <nl> + <nl> + Automated version of the URL detection test <nl> + mmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmm - <nl> + <nl> + An automated version of the test can be conducted by running verifyUrlDetection . ps1 . <nl> + This is mainly to run the test in Appveyor . <nl> new file mode 100644 <nl> index 0000000000 . . 6c7a321aa6 <nl> mmm / dev / null <nl> ppp b / PowerEditor / Test / UrlDetection / verifyUrlDetection . lua <nl> <nl> + local testFiles = { " verifyUrlDetection_1a " , <nl> + " verifyUrlDetection_1b " } <nl> + local URL_INDIC = 8 <nl> + local timerInterval = 10 <nl> + <nl> + local function verifyUrlDetection ( ) <nl> + <nl> + local curPos = 0 <nl> + local task = - 1 <nl> + local uFrom = 0 <nl> + local uTo = 0 <nl> + local mFrom = 0 <nl> + local mTo = 0 <nl> + local OKorKO = " OK " <nl> + local nFile = 1 <nl> + local testResults = { } <nl> + local outFile = nil <nl> + <nl> + local function Summary ( ) <nl> + local resLine = " " <nl> + local i = 1 <nl> + while testFiles [ i ] ~ = nil do <nl> + if testResults [ i ] = = nil then <nl> + testResults [ i ] = ' KO ' <nl> + end <nl> + print ( testFiles [ i ] . . " : " . . testResults [ i ] ) <nl> + i = i + 1 <nl> + end <nl> + print ( resLine ) <nl> + if endNppAfterUrlTest ~ = nil then <nl> + print ( " good bye " ) <nl> + npp : MenuCommand ( IDM_FILE_EXIT ) <nl> + end <nl> + end <nl> + <nl> + local function nextFile ( ) <nl> + local fileAvail = false <nl> + if outFile ~ = nil then <nl> + io . close ( outFile ) <nl> + end <nl> + while ( not fileAvail ) and ( testFiles [ nFile ] ~ = nil ) do <nl> + local fileName = npp : GetNppDirectory ( ) . . " \ \ . . \ \ Test \ \ UrlDetection \ \ " . . testFiles [ nFile ] <nl> + fileAvail = npp : SwitchToFile ( fileName ) <nl> + if not fileAvail then <nl> + local f = io . open ( fileName , " r " ) <nl> + if f ~ = nil then <nl> + io . close ( f ) <nl> + fileAvail = npp : DoOpen ( fileName ) <nl> + end <nl> + end <nl> + - - print ( " Verifying " . . testFiles [ nFile ] . . " . . . " ) <nl> + print ( " Verifying " . . npp : GetFileName ( ) . . " . . . " ) <nl> + if fileAvail then <nl> + local outFileName = fileName . . " . result " <nl> + outFile = io . open ( outFileName , " w " ) <nl> + if outFile = = nil then <nl> + testResults [ nFile ] = " KO " <nl> + print ( " KO " , " Cannot open output file \ " " . . fileName . . " \ " " ) <nl> + print ( ) <nl> + nFile = nFile + 1 ; <nl> + end <nl> + else <nl> + testResults [ nFile ] = " KO " <nl> + print ( " KO " , " Cannot open file \ " " . . fileName . . " \ " " ) <nl> + print ( ) <nl> + nFile = nFile + 1 ; <nl> + end <nl> + end <nl> + return fileAvail <nl> + end <nl> + <nl> + local function scrollToNextURL ( ) <nl> + editor . TargetStart = curPos <nl> + editor . TargetEnd = editor . Length <nl> + editor . SearchFlags = SCFIND_REGEXP <nl> + local iRes = editor : SearchInTarget ( " ^ u . + u $ " ) <nl> + if iRes > = 0 then <nl> + uFrom = editor . TargetStart <nl> + uTo = editor . TargetEnd <nl> + editor . TargetStart = uFrom <nl> + editor . TargetEnd = editor . Length <nl> + iRes = editor : SearchInTarget ( " ^ m . + m $ " ) <nl> + if iRes > = 0 then <nl> + mFrom = editor . TargetStart <nl> + mTo = editor . TargetEnd <nl> + local ln1 = editor : LineFromPosition ( uFrom ) <nl> + local ln2 = editor : LineFromPosition ( mFrom ) <nl> + if ( ln1 + 1 ) = = ln2 then <nl> + editor : ScrollRange ( mTo , uFrom ) <nl> + return 1 <nl> + else <nl> + editor : GotoPos ( mFrom ) <nl> + OKorKO = " KO " <nl> + print ( " KO " , " Mask line not following immediately after URL line " ) <nl> + return - 1 <nl> + end <nl> + else <nl> + OKorKO = " KO " <nl> + print ( " KO " , " Mask line not found " ) <nl> + return - 1 <nl> + end <nl> + else <nl> + return 0 <nl> + end <nl> + end <nl> + <nl> + local function verifyURL ( ) <nl> + local mMsk = editor : textrange ( mFrom , mTo ) <nl> + editor : GotoPos ( uFrom + 2 ) <nl> + local uMsk = " m " <nl> + local limit = mTo - mFrom - - if something goes wrong , edit . CurrentPos may never reach ( uTo - 2 ) . <nl> + while ( editor . CurrentPos < uTo - 2 ) and ( limit > = 0 ) do <nl> + if editor : IndicatorValueAt ( URL_INDIC , editor . CurrentPos ) = = 0 then <nl> + uMsk = uMsk . . " 0 " <nl> + else <nl> + uMsk = uMsk . . " 1 " <nl> + end <nl> + editor : CharRight ( ) <nl> + limit = limit - 1 <nl> + end <nl> + local Res = 0 <nl> + if limit > = 0 then <nl> + if editor : textrange ( editor . CurrentPos , editor . CurrentPos + 2 ) = = " u " then <nl> + uMsk = uMsk . . " m " <nl> + if uMsk = = mMsk then <nl> + outFile : write ( " OK " , " \ t " , editor : textrange ( uFrom , uTo ) , " \ n " ) <nl> + Res = 1 <nl> + else <nl> + outFile : write ( " KO " , " \ t " , editor : textrange ( uFrom , uTo ) , " \ n " ) <nl> + outFile : write ( " ok " , " \ t " , mMsk , " \ n " ) <nl> + outFile : write ( " ko " , " \ t " , uMsk , " \ n " ) <nl> + OKorKO = " KO " <nl> + Res = 1 <nl> + end <nl> + end <nl> + else <nl> + outFile : write ( " KO " , " \ t " , " internal error " , " \ n " ) <nl> + OKorKO = " KO " <nl> + end <nl> + return Res <nl> + end <nl> + <nl> + local function goForward ( timer ) <nl> + if task < 0 then <nl> + task = task + 1 <nl> + if task = = 0 then <nl> + if not nextFile ( ) then <nl> + npp . StopTimer ( timer ) <nl> + Summary ( ) <nl> + end <nl> + end <nl> + elseif task = = 0 then <nl> + local urlAvail = scrollToNextURL ( ) <nl> + if urlAvail = = 1 then <nl> + task = 1 <nl> + else <nl> + npp . StopTimer ( timer ) <nl> + print ( OKorKO ) <nl> + print ( ) <nl> + testResults [ nFile ] = OKorKO <nl> + if urlAvail = = 0 then <nl> + nFile = nFile + 1 <nl> + if nextFile ( ) then <nl> + task = 0 <nl> + curPos = 0 <nl> + OKorKO = " OK " <nl> + npp . StartTimer ( timerInterval , goForward ) <nl> + else <nl> + Summary ( ) <nl> + end <nl> + else <nl> + Summary ( ) <nl> + end <nl> + end <nl> + elseif task = = 1 then <nl> + if verifyURL ( ) = = 0 then <nl> + npp . StopTimer ( timer ) <nl> + print ( ) <nl> + Summary ( ) <nl> + else <nl> + curPos = mTo <nl> + task = 0 <nl> + end <nl> + else <nl> + npp . stopTimer ( timer ) <nl> + print ( " KOmmm " , " Internal impossibility " ) <nl> + print ( ) <nl> + Summary ( ) <nl> + end <nl> + end <nl> + <nl> + npp . StartTimer ( timerInterval , goForward ) <nl> + <nl> + end <nl> + <nl> + npp . ClearConsole ( ) <nl> + verifyUrlDetection ( ) <nl> new file mode 100644 <nl> index 0000000000 . . d35554382d <nl> mmm / dev / null <nl> ppp b / PowerEditor / Test / UrlDetection / verifyUrlDetection . ps1 <nl> <nl> + try { <nl> + if ( Test - Path - Path ' . . \ . . \ Bin \ plugins ' - PathType Container ) <nl> + { <nl> + if ( Test - Path - Path ' . . \ . . \ Bin \ plugins_save ' - PathType Container ) <nl> + { <nl> + " Backup for plugins directory already exists " <nl> + exit - 1 <nl> + } <nl> + " Backing up plugin directory . . . " <nl> + Move - Item . . \ . . \ Bin \ plugins . . \ . . \ bin \ plugins_save <nl> + } <nl> + " Installing Lua plugin for testing . . . " <nl> + Copy - Item - Path . \ plugins - Destination . . \ . . \ bin - Recurse <nl> + <nl> + " Testing . . . " <nl> + . . \ . . \ bin \ notepad + + . exe | Out - Null <nl> + <nl> + if ( Test - Path - Path ' . . \ . . \ Bin \ plugins_save ' - PathType Container ) <nl> + { <nl> + " Removing Lua plugin . . . " <nl> + Remove - Item - Path . . \ . . \ Bin \ plugins - Recurse - Force <nl> + " Restoring plugin directory . . . " <nl> + Move - Item . . \ . . \ Bin \ plugins_save . . \ . . \ bin \ plugins <nl> + } <nl> + <nl> + $ expectedRes = Get - Content . \ verifyUrlDetection_1a . expected . result <nl> + $ generatedRes = Get - Content . \ verifyUrlDetection_1a . result <nl> + <nl> + if ( Compare - Object - ReferenceObject $ expectedRes - DifferenceObject $ generatedRes ) <nl> + { <nl> + " Unexpected test results for verifyUrlDetection_1a " <nl> + exit - 1 <nl> + } <nl> + else <nl> + { <nl> + Remove - Item . \ verifyUrlDetection_1a . result <nl> + $ expectedRes = Get - Content . \ verifyUrlDetection_1b . expected . result <nl> + $ generatedRes = Get - Content . \ verifyUrlDetection_1b . result <nl> + if ( Compare - Object - ReferenceObject $ expectedRes - DifferenceObject $ generatedRes ) <nl> + { <nl> + " Unexpected test results for verifyUrlDetection_1b " <nl> + exit - 1 <nl> + } <nl> + else <nl> + { <nl> + Remove - Item . \ verifyUrlDetection_1b . result <nl> + " URL detection test OK " <nl> + exit 0 <nl> + } <nl> + } <nl> + } <nl> + catch <nl> + { <nl> + " Unexpected behavior while URL detection test " <nl> + exit - 1 <nl> + } <nl> + <nl> new file mode 100644 <nl> index 0000000000 . . f0944c4ade <nl> mmm / dev / null <nl> ppp b / PowerEditor / Test / UrlDetection / verifyUrlDetection_1a <nl> <nl> + = = = URLs which are handled OK so far = = = <nl> + <nl> + u http : / / test . com u <nl> + m 111111111111111 m <nl> + <nl> + u HTTP : / / UPCASE . UP u <nl> + m 1111111111111111 m <nl> + <nl> + u http : u <nl> + m 00000 m <nl> + <nl> + u mailto : u <nl> + m 0000000 m <nl> + <nl> + <nl> + <nl> + Preceding none - whitespace characters : <nl> + <nl> + u ! http : / / test . com u <nl> + m 0111111111111111 m <nl> + <nl> + u " http : / / test . com u <nl> + m 0111111111111111 m <nl> + <nl> + u # http : / / test . com u <nl> + m 0111111111111111 m <nl> + <nl> + u $ http : / / test . com u <nl> + m 0111111111111111 m <nl> + <nl> + u % http : / / test . com u <nl> + m 0111111111111111 m <nl> + <nl> + u & http : / / test . com u <nl> + m 0111111111111111 m <nl> + <nl> + u ' http : / / test . com u <nl> + m 0111111111111111 m <nl> + <nl> + u ( http : / / test . com u <nl> + m 0111111111111111 m <nl> + <nl> + u ) http : / / test . com u <nl> + m 0111111111111111 m <nl> + <nl> + u * http : / / test . com u <nl> + m 0111111111111111 m <nl> + <nl> + u + http : / / test . com u <nl> + m 0111111111111111 m <nl> + <nl> + u , http : / / test . com u <nl> + m 0111111111111111 m <nl> + <nl> + u - http : / / test . com u <nl> + m 0111111111111111 m <nl> + <nl> + u . http : / / test . com u <nl> + m 0111111111111111 m <nl> + <nl> + u / http : / / test . com u <nl> + m 0111111111111111 m <nl> + <nl> + u 1http : / / test . com u <nl> + m 0000000000000000 m <nl> + <nl> + u 9http : / / test . com u <nl> + m 0000000000000000 m <nl> + <nl> + u : http : / / test . com u <nl> + m 0111111111111111 m <nl> + <nl> + u ; http : / / test . com u <nl> + m 0111111111111111 m <nl> + <nl> + u < http : / / test . com u <nl> + m 0111111111111111 m <nl> + <nl> + u > http : / / test . com u <nl> + m 0111111111111111 m <nl> + <nl> + u ? http : / / test . com u <nl> + m 0111111111111111 m <nl> + <nl> + u @ http : / / test . com u <nl> + m 0111111111111111 m <nl> + <nl> + u Ahttp : / / test . com u <nl> + m 0000000000000000 m <nl> + <nl> + u Zhttp : / / test . com u <nl> + m 0000000000000000 m <nl> + <nl> + u [ http : / / test . com u <nl> + m 0111111111111111 m <nl> + <nl> + u \ http : / / test . com u <nl> + m 0111111111111111 m <nl> + <nl> + u ] http : / / test . com u <nl> + m 0111111111111111 m <nl> + <nl> + u ^ http : / / test . com u <nl> + m 0111111111111111 m <nl> + <nl> + u _http : / / test . com u <nl> + m 0000000000000000 m <nl> + <nl> + u ` http : / / test . com u <nl> + m 0111111111111111 m <nl> + <nl> + u ahttp : / / test . com u <nl> + m 0000000000000000 m <nl> + <nl> + u zhttp : / / test . com u <nl> + m 0000000000000000 m <nl> + <nl> + u { http : / / test . com u <nl> + m 0111111111111111 m <nl> + <nl> + u | http : / / test . com u <nl> + m 0111111111111111 m <nl> + <nl> + u } http : / / test . com u <nl> + m 0111111111111111 m <nl> + <nl> + u ~ http : / / test . com u <nl> + m 0111111111111111 m <nl> + <nl> + <nl> + <nl> + Query parsing : <nl> + <nl> + u https : / / duckduckgo . com / ? q = windows + delete + " GameBarPresenceWriter . exe " u <nl> + m 11111111111111111111111111111111111111111111111111111111111111111111 m <nl> + <nl> + u " https : / / duckduckgo . com / ? q = windows + delete + " GameBarPresenceWriter . exe " " u <nl> + m 0111111111111111111111111111111111111111111111111111111111111111111110 m <nl> + <nl> + u " https : / / duckduckgo . com / ? q = windows + delete + " GameBarPresenceWriter . exe " u <nl> + m 011111111111111111111111111111111111111111111111111111111111111111111 m <nl> + <nl> + u " https : / / duckduckgo / com / ? q = windows + delete + GameBarPresenceWriter . exe " u <nl> + m 01111111111111111111111111111111111111111111111111111111111111111110 m <nl> + <nl> + u " https : / / duckduckgo . com / ? q = windows + delete + " " GameBarPresenceWriter . exe " u <nl> + m 0111111111111111111111111111111111111111111100000000000000000000000000 m <nl> + <nl> + u https : / / www . youtube . com / watch ? v = VmcftreqQ6E & list = PnQIRE5O5JpiLL & index = xxx u <nl> + m 1111111111111111111111111111111111111111111111111111111111111111111111111 m <nl> + <nl> + <nl> + <nl> + Space detection : <nl> + <nl> + u " http : / / github . com / notepad - plus - plus / notepad - plus - plus " u <nl> + m 0111111111111111111111111111111111111111111111111111110 m <nl> + <nl> + u " https : / / github . com / notepad - plus - plus / notepad - plus - plus " u <nl> + m 011111111111111111100000000000000000000000000000000000000 m <nl> + <nl> + u " https : / / github . com / notepad plus plus / notepad - plus - plus " u <nl> + m 01111111111111111111111111100000000000000000000000000000 m <nl> + <nl> + <nl> + <nl> + Unwanted trailing character removal : <nl> + <nl> + u ( https : / / github . com / notepad - plus - plus / notepad - plus - plus ) u <nl> + m 01111111111111111111111111111111111111111111111111111110 m <nl> + <nl> + u https : / / github . com / notepad - plus - plus / notepad - plus - plus ; u <nl> + m 1111111111111111111111111111111111111111111111111111110 m <nl> + <nl> + u https : / / github . com / notepad - plus - plus / notepad - plus - plus ? u <nl> + m 1111111111111111111111111111111111111111111111111111110 m <nl> + <nl> + u https : / / github . com / notepad - plus - plus / notepad - plus - plus ! u <nl> + m 1111111111111111111111111111111111111111111111111111110 m <nl> + <nl> + u https : / / github . com / notepad - plus - plus / notepad - plus - plus # u <nl> + m 1111111111111111111111111111111111111111111111111111110 m <nl> + <nl> + u http : / / github . com / notepad - plus - plus / notepad - plus - plus # fragment u <nl> + m 11111111111111111111111111111111111111111111111111111111111111 m <nl> + <nl> + u ( e . g . , https : / / en . wikipedia . org / wiki / Saw_ ( 2003_film ) ) ? u <nl> + m 000000011111111111111111111111111111111111111111111100 m <nl> + <nl> + u ( https : / / en . wikipedia . org / wiki / Saw_ ( 2003_film ) ) u <nl> + m 01111111111111111111111111111111111111111111110 m <nl> + <nl> + u ( https : / / en . wikipedia . org / wiki / Saw_2003_film ) u <nl> + m 011111111111111111111111111111111111111111110 m <nl> + <nl> + <nl> + <nl> + International characters : <nl> + <nl> + u https : / / apache - windows . ru / как - установить - сервер - apache - c - php - mysql - и - phpmyadmin - на - windows / u <nl> + m 1111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111 m <nl> + <nl> + u https : / / www . rnids . rs / национални - домени / регистрација - националних - домена u <nl> + m 1111111111111111111111111111111111111111111111111111111111111111111111 m <nl> + <nl> + u https : / / www . morfix . co . il / שלום u <nl> + m 11111111111111111111111111111 m <nl> + <nl> + u https : / / www . amazon . fr / GRÜNTEK - Ebrancheur - Cisailles - crémaillère - SATISFAIT / dp / B01COZUA4E / u <nl> + m 111111111111111111111111111111111111111111111111111111111111111111111111111111111111111 m <nl> + <nl> + u https : / / www . amazon . fr / Gardena - coupe - branches - TeleCut - 520 - 670 - télescopiques / dp / B07JLJ4N44 / u <nl> + m 11111111111111111111111111111111111111111111111111111111111111111111111111111111111111111 m <nl> + <nl> + <nl> + <nl> + Instagram links : <nl> + <nl> + u https : / / ig . com / ? query = c761 & vars = { " id " : " 0815 " , " first " : 100 } u <nl> + m 111111111111111111111111111111111111111111111111111111111 m <nl> + <nl> + u { https : / / ig . com / ? query = c761 & vars = { " id " : " 0815 " , " first " : 100 } } u <nl> + m 01111111111111111111111111111111111111111111111111111111110 m <nl> + <nl> + u [ https : / / ig . com / ? query = c761 & vars = { " id " : " 0815 " , " first " : 100 } ] u <nl> + m 01111111111111111111111111111111111111111111111111111111110 m <nl> + <nl> + u " https : / / ig . com / ? query = c761 & vars = { " id " : " 0815 " , " first " : 100 } " u <nl> + m 01111111111111111111111111111111111111111111111111111111110 m <nl> + <nl> + <nl> + <nl> + Links in LaTeX : <nl> + <nl> + u \ href { https : / / weblink . com / } { click me } u <nl> + m 0000001111111111111111111100000000000 m <nl> + <nl> + u \ href { https : / / ig . com / ? query = c761 & vars = { " id " : " 0815 " , " first " : 100 } } { click me } u <nl> + m 00000011111111111111111111111111111111111111111111111111111111100000000000 m <nl> + <nl> + <nl> + <nl> + Mail : <nl> + <nl> + u mailto : don . h @ free . fr u <nl> + m 11111111111111111111 m <nl> + <nl> + u < don . h @ free . fr > u <nl> + m 000000000000000 m <nl> + <nl> + u < mailto : don . h @ free . fr > u <nl> + m 0111111111111111111110 m <nl> + <nl> + u http : don . h @ free . fr u <nl> + m 000000000000000000 m <nl> + <nl> + <nl> + <nl> + FTP : <nl> + <nl> + u < ftp : / / ds . internic . net / rfc / rfc977 . txt > u <nl> + m 01111111111111111111111111111111111110 m <nl> + <nl> + u ftp : / / host : 444 / 0a_gopher_selector % 09 % 09some_gplus_stuff u <nl> + m 1111111111111111111111111111111111111111111111111111111 m <nl> + <nl> + u ftp : / / host : abc / 0a_gopher_selector % 09 % 09some_gplus_stuff u <nl> + m 0000000000000000000000000000000000000000000000000000000 m <nl> + <nl> + <nl> + <nl> + FILE : <nl> + <nl> + u file : / / Hello % 20world . txt u <nl> + m 111111111111111111111111 m <nl> + <nl> + u " file : / / Hello % 20world . txt " u <nl> + m 01111111111111111111111110 m <nl> + <nl> + u " file : / / Hello world . txt " u <nl> + m 011111111111100000000000 m <nl> + <nl> + u file : / / 127 . 0 . 0 . 1 / c $ / Tools \ Npp % 20Test % 20Data / Test3 / 3812 . pdf u <nl> + m 1111111111111111111111111111111111111111111111111111111111 m <nl> new file mode 100644 <nl> index 0000000000 . . 0ef6e70576 <nl> mmm / dev / null <nl> ppp b / PowerEditor / Test / UrlDetection / verifyUrlDetection_1a . expected . result <nl> <nl> + OK u http : / / test . com u <nl> + OK u HTTP : / / UPCASE . UP u <nl> + OK u http : u <nl> + OK u mailto : u <nl> + OK u ! http : / / test . com u <nl> + OK u " http : / / test . com u <nl> + OK u # http : / / test . com u <nl> + OK u $ http : / / test . com u <nl> + OK u % http : / / test . com u <nl> + OK u & http : / / test . com u <nl> + OK u ' http : / / test . com u <nl> + OK u ( http : / / test . com u <nl> + OK u ) http : / / test . com u <nl> + OK u * http : / / test . com u <nl> + OK u + http : / / test . com u <nl> + OK u , http : / / test . com u <nl> + OK u - http : / / test . com u <nl> + OK u . http : / / test . com u <nl> + OK u / http : / / test . com u <nl> + OK u 1http : / / test . com u <nl> + OK u 9http : / / test . com u <nl> + OK u : http : / / test . com u <nl> + OK u ; http : / / test . com u <nl> + OK u < http : / / test . com u <nl> + OK u > http : / / test . com u <nl> + OK u ? http : / / test . com u <nl> + OK u @ http : / / test . com u <nl> + OK u Ahttp : / / test . com u <nl> + OK u Zhttp : / / test . com u <nl> + OK u [ http : / / test . com u <nl> + OK u \ http : / / test . com u <nl> + OK u ] http : / / test . com u <nl> + OK u ^ http : / / test . com u <nl> + OK u _http : / / test . com u <nl> + OK u ` http : / / test . com u <nl> + OK u ahttp : / / test . com u <nl> + OK u zhttp : / / test . com u <nl> + OK u { http : / / test . com u <nl> + OK u | http : / / test . com u <nl> + OK u } http : / / test . com u <nl> + OK u ~ http : / / test . com u <nl> + OK u https : / / duckduckgo . com / ? q = windows + delete + " GameBarPresenceWriter . exe " u <nl> + OK u " https : / / duckduckgo . com / ? q = windows + delete + " GameBarPresenceWriter . exe " " u <nl> + OK u " https : / / duckduckgo . com / ? q = windows + delete + " GameBarPresenceWriter . exe " u <nl> + OK u " https : / / duckduckgo / com / ? q = windows + delete + GameBarPresenceWriter . exe " u <nl> + OK u " https : / / duckduckgo . com / ? q = windows + delete + " " GameBarPresenceWriter . exe " u <nl> + OK u https : / / www . youtube . com / watch ? v = VmcftreqQ6E & list = PnQIRE5O5JpiLL & index = xxx u <nl> + OK u " http : / / github . com / notepad - plus - plus / notepad - plus - plus " u <nl> + OK u " https : / / github . com / notepad - plus - plus / notepad - plus - plus " u <nl> + OK u " https : / / github . com / notepad plus plus / notepad - plus - plus " u <nl> + OK u ( https : / / github . com / notepad - plus - plus / notepad - plus - plus ) u <nl> + OK u https : / / github . com / notepad - plus - plus / notepad - plus - plus ; u <nl> + OK u https : / / github . com / notepad - plus - plus / notepad - plus - plus ? u <nl> + OK u https : / / github . com / notepad - plus - plus / notepad - plus - plus ! u <nl> + OK u https : / / github . com / notepad - plus - plus / notepad - plus - plus # u <nl> + OK u http : / / github . com / notepad - plus - plus / notepad - plus - plus # fragment u <nl> + OK u ( e . g . , https : / / en . wikipedia . org / wiki / Saw_ ( 2003_film ) ) ? u <nl> + OK u ( https : / / en . wikipedia . org / wiki / Saw_ ( 2003_film ) ) u <nl> + OK u ( https : / / en . wikipedia . org / wiki / Saw_2003_film ) u <nl> + OK u https : / / apache - windows . ru / как - установить - сервер - apache - c - php - mysql - и - phpmyadmin - на - windows / u <nl> + OK u https : / / www . rnids . rs / национални - домени / регистрација - националних - домена u <nl> + OK u https : / / www . morfix . co . il / שלום u <nl> + OK u https : / / www . amazon . fr / GRÜNTEK - Ebrancheur - Cisailles - crémaillère - SATISFAIT / dp / B01COZUA4E / u <nl> + OK u https : / / www . amazon . fr / Gardena - coupe - branches - TeleCut - 520 - 670 - télescopiques / dp / B07JLJ4N44 / u <nl> + OK u https : / / ig . com / ? query = c761 & vars = { " id " : " 0815 " , " first " : 100 } u <nl> + OK u { https : / / ig . com / ? query = c761 & vars = { " id " : " 0815 " , " first " : 100 } } u <nl> + OK u [ https : / / ig . com / ? query = c761 & vars = { " id " : " 0815 " , " first " : 100 } ] u <nl> + OK u " https : / / ig . com / ? query = c761 & vars = { " id " : " 0815 " , " first " : 100 } " u <nl> + OK u \ href { https : / / weblink . com / } { click me } u <nl> + OK u \ href { https : / / ig . com / ? query = c761 & vars = { " id " : " 0815 " , " first " : 100 } } { click me } u <nl> + OK u mailto : don . h @ free . fr u <nl> + OK u < don . h @ free . fr > u <nl> + OK u < mailto : don . h @ free . fr > u <nl> + OK u http : don . h @ free . fr u <nl> + OK u < ftp : / / ds . internic . net / rfc / rfc977 . txt > u <nl> + OK u ftp : / / host : 444 / 0a_gopher_selector % 09 % 09some_gplus_stuff u <nl> + OK u ftp : / / host : abc / 0a_gopher_selector % 09 % 09some_gplus_stuff u <nl> + OK u file : / / Hello % 20world . txt u <nl> + OK u " file : / / Hello % 20world . txt " u <nl> + OK u " file : / / Hello world . txt " u <nl> + OK u file : / / 127 . 0 . 0 . 1 / c $ / Tools \ Npp % 20Test % 20Data / Test3 / 3812 . pdf u <nl> new file mode 100644 <nl> index 0000000000 . . 338a6110a6 <nl> mmm / dev / null <nl> ppp b / PowerEditor / Test / UrlDetection / verifyUrlDetection_1b <nl> <nl> + = = = URLs which can be handled better = = = <nl> + <nl> + International characters directly before URL : <nl> + <nl> + u ähttp : / / test . com u <nl> + m 0000000000000000 m <nl> + <nl> + u домhttp : / / test . com u <nl> + m 000000000000000000 m <nl> + <nl> + <nl> + <nl> + Apostrophes : <nl> + <nl> + u https : / / en . wikipedia . org / wiki / Murphy ' s_law u <nl> + m 111111111111111111111111111111111111111111 m <nl> + <nl> + u http : / / xxx . xxx / Tom ' s % 20sisters ' % 20careers u <nl> + m 11111111111111111111111111111111111111111 m <nl> + <nl> + u http : / / xxx . xxx / Tom ' s % 20sisters ' u <nl> + m 1111111111111111111111111111111 m <nl> + <nl> + u http : / / xxx . xxx / Tom ' s % 20sisters ' ' u <nl> + m 11111111111111111111111111111111 m <nl> new file mode 100644 <nl> index 0000000000 . . 3f230fcc1d <nl> mmm / dev / null <nl> ppp b / PowerEditor / Test / UrlDetection / verifyUrlDetection_1b . expected . result <nl> <nl> + KO u ähttp : / / test . com u <nl> + ok m 0000000000000000 m <nl> + ko m 0111111111111111 m <nl> + KO u домhttp : / / test . com u <nl> + ok m 000000000000000000 m <nl> + ko m 000111111111111111 m <nl> + KO u https : / / en . wikipedia . org / wiki / Murphy ' s_law u <nl> + ok m 111111111111111111111111111111111111111111 m <nl> + ko m 111111111111111111111111111111111111000000 m <nl> + KO u http : / / xxx . xxx / Tom ' s % 20sisters ' % 20careers u <nl> + ok m 11111111111111111111111111111111111111111 m <nl> + ko m 11111111111111111100000000000000000000000 m <nl> + KO u http : / / xxx . xxx / Tom ' s % 20sisters ' u <nl> + ok m 1111111111111111111111111111111 m <nl> + ko m 1111111111111111110000000000000 m <nl> + KO u http : / / xxx . xxx / Tom ' s % 20sisters ' ' u <nl> + ok m 11111111111111111111111111111111 m <nl> + ko m 11111111111111111100000000000000 m <nl> mmm a / PowerEditor / src / NppNotification . cpp <nl> ppp b / PowerEditor / src / NppNotification . cpp <nl> BOOL Notepad_plus : : notify ( SCNotification * notification ) <nl> / / replacement for obsolete custom SCN_SCROLLED <nl> if ( notification - > updated & SC_UPDATE_V_SCROLL ) <nl> { <nl> - addHotSpot ( ) ; <nl> + addHotSpot ( notifyView ) ; <nl> } <nl> <nl> / / if it ' s searching / replacing , then do nothing <nl> mmm a / appveyor . yml <nl> ppp b / appveyor . yml <nl> after_build : <nl> . \ unitTestLauncher . ps1 <nl> . \ unitTestLauncher . ps1 <nl> # ATTENTION : current working dir is no longer at APPVEYOR_BUILD_FOLDER <nl> + cd . . \ UrlDetection <nl> + . \ verifyUrlDetection . ps1 <nl> } <nl> <nl> if ( $ env : PLATFORM_INPUT - eq " mingw " ) { <nl> | Test tool to verify URL parser | notepad-plus-plus/notepad-plus-plus | 9cd6e6513ff3ad080cff16b5c053d596b40c3e56 | 2020-10-26T13:38:47Z |
mmm a / hphp / hack / src / hhbc / emit_memoize_function . ml <nl> ppp b / hphp / hack / src / hhbc / emit_memoize_function . ml <nl> open Core_kernel <nl> open Instruction_sequence <nl> open Emit_memoize_helpers <nl> <nl> + module R = Hhbc_string_utils . Reified <nl> + <nl> let make_memoize_function_no_params_code <nl> ~ deprecation_info env renamed_function_id is_async = <nl> let notfound = Label . next_regular ( ) in <nl> let make_memoize_function_no_params_code <nl> ] <nl> <nl> let make_memoize_function_with_params_code <nl> - ~ pos ~ deprecation_info env params ast_params renamed_method_id is_async = <nl> + ~ pos ~ deprecation_info <nl> + env params ast_params renamed_method_id is_async is_reified = <nl> let param_count = List . length params in <nl> let notfound = Label . next_regular ( ) in <nl> let suspended_get = Label . next_regular ( ) in <nl> let eager_set = Label . next_regular ( ) in <nl> - let first_local = Local . Unnamed param_count in <nl> + ( * The local that contains the reified generics is the first non parameter <nl> + * local , so the first local is parameter count + 1 when there are reified = <nl> + * generics * ) <nl> + let add_reified = if is_reified then 1 else 0 in <nl> + let first_local = Local . Unnamed ( param_count + add_reified ) in <nl> let begin_label , default_value_setters = <nl> ( * Default value setters belong in the wrapper function not in the original function * ) <nl> Emit_param . emit_param_default_value_setter env pos params <nl> let make_memoize_function_with_params_code <nl> if is_async then make_fcall_args ~ async_eager_label : eager_set param_count <nl> else make_fcall_args param_count <nl> in <nl> + let fcall_instrs = <nl> + if not is_reified <nl> + then instr_fcallfuncd fcall_args renamed_method_id <nl> + else gather [ <nl> + instr_cgetl ( Local . Named R . reified_generics_local_name ) ; <nl> + instr_reified_name <nl> + ( Hhbc_id . Function . to_raw_string renamed_method_id ) ; <nl> + instr_fcallfunc fcall_args [ ] <nl> + ] <nl> + in <nl> + let reified_memokeym = <nl> + if not is_reified then empty else <nl> + gather @ @ getmemokeyl param_count ( param_count + add_reified ) <nl> + R . reified_generics_local_name in <nl> + let param_count = param_count + add_reified in <nl> gather [ <nl> begin_label ; <nl> Emit_body . emit_method_prolog <nl> ~ env ~ pos ~ params ~ ast_params ~ should_emit_init_this : false ; <nl> deprecation_body ; <nl> param_code_sets params param_count ; <nl> + reified_memokeym ; <nl> if is_async then <nl> gather [ <nl> instr_memoget_eager notfound suspended_get ( Some ( first_local , param_count ) ) ; <nl> let make_memoize_function_with_params_code <nl> instr_label notfound ; <nl> instr_nulluninit ; instr_nulluninit ; instr_nulluninit ; <nl> param_code_gets params ; <nl> - instr_fcallfuncd fcall_args renamed_method_id ; <nl> + fcall_instrs ; <nl> instr_memoset ( Some ( first_local , param_count ) ) ; <nl> if is_async then <nl> gather [ <nl> let make_memoize_function_with_params_code <nl> ] <nl> <nl> let make_memoize_function_code <nl> - ~ pos ~ deprecation_info env params ast_params renamed_method_id is_async = <nl> + ~ pos ~ deprecation_info <nl> + env params ast_params renamed_method_id is_async is_reified = <nl> Emit_pos . emit_pos_then pos @ @ <nl> - if List . is_empty params <nl> + if List . is_empty params & & not is_reified <nl> then make_memoize_function_no_params_code <nl> ~ deprecation_info env renamed_method_id is_async <nl> else make_memoize_function_with_params_code <nl> ~ pos ~ deprecation_info env params ast_params renamed_method_id <nl> - is_async <nl> + is_async is_reified <nl> <nl> ( * Construct the wrapper function body * ) <nl> - let make_wrapper_body env return_type params instrs = <nl> + let make_wrapper_body env return_type params instrs is_reified = <nl> Emit_body . make_body <nl> instrs <nl> - [ ] ( * decl_vars * ) <nl> + ( if is_reified then [ R . reified_generics_local_name ] else [ ] ) ( * decl_vars * ) <nl> true ( * is_memoize_wrapper * ) <nl> false ( * is_memoize_wrapper_lsb * ) <nl> params <nl> let emit_wrapper_function <nl> ~ scope ast_fun . Ast . f_params in <nl> let function_attributes = <nl> Emit_attribute . from_asts namespace ast_fun . Ast . f_user_attributes in <nl> + let function_attributes = Emit_attribute . add_reified_attribute <nl> + function_attributes ast_fun . Ast . f_tparams in <nl> let function_is_async = ast_fun . Ast . f_fun_kind = Ast_defs . FAsync in <nl> let scope = [ Ast_scope . ScopeItem . Function ast_fun ] in <nl> let return_type_info = <nl> Emit_body . emit_return_type_info <nl> ~ scope ~ skipawaitable : function_is_async ~ namespace ast_fun . Ast . f_ret in <nl> + let is_reified = <nl> + List . exists ~ f : ( fun t - > t . A . tp_reified ) ast_fun . Ast . f_tparams in <nl> let body_instrs = <nl> make_memoize_function_code <nl> - ~ pos ~ deprecation_info env params ast_fun . Ast . f_params renamed_id function_is_async <nl> + ~ pos ~ deprecation_info <nl> + env params ast_fun . Ast . f_params renamed_id function_is_async is_reified <nl> in <nl> let function_rx_level = Rx . rx_level_from_ast ast_fun . Ast . f_user_attributes <nl> | > Option . value ~ default : Rx . NonRx in <nl> let env = Emit_env . with_rx_body ( function_rx_level < > Rx . NonRx ) env in <nl> let memoized_body = <nl> - make_wrapper_body env return_type_info params body_instrs in <nl> + make_wrapper_body env return_type_info params body_instrs is_reified in <nl> let is_interceptable = <nl> Interceptable . is_function_interceptable namespace ast_fun in <nl> Hhas_function . make <nl> mmm a / hphp / hack / src / hhbc / emit_memoize_helpers . ml <nl> ppp b / hphp / hack / src / hhbc / emit_memoize_helpers . ml <nl> open Instruction_sequence <nl> <nl> let memoize_suffix = " $ memoize_impl " <nl> <nl> + let getmemokeyl local index name = <nl> + [ instr_getmemokeyl ( Local . Named name ) <nl> + ; instr_setl ( Local . Unnamed ( local + index ) ) <nl> + ; instr_popc <nl> + ] <nl> + <nl> let param_code_sets params local = <nl> - gather @ @ List . concat_mapi params ( fun index param - > <nl> - [ instr_getmemokeyl ( Local . Named ( Hhas_param . name param ) ) ; <nl> - instr_setl ( Local . Unnamed ( local + index ) ) ; <nl> - instr_popc ] ) <nl> + gather @ @ List . concat_mapi params <nl> + ( fun index param - > getmemokeyl local index @ @ Hhas_param . name param ) <nl> <nl> let param_code_gets params = <nl> gather @ @ List . map params ( fun param - > <nl> mmm a / hphp / hack / src / hhbc / emit_memoize_method . ml <nl> ppp b / hphp / hack / src / hhbc / emit_memoize_method . ml <nl> open Instruction_sequence <nl> open Emit_memoize_helpers <nl> open Hhbc_ast <nl> <nl> + module R = Hhbc_string_utils . Reified <nl> + <nl> ( * Precomputed information required for generation of memoized methods * ) <nl> type memoize_info = { <nl> ( * Prefix on method and property names * ) <nl> let make_info ast_class class_id ast_methods = <nl> memoize_class_id = class_id ; <nl> } <nl> <nl> - let call_cls_method info fcall_args method_id with_lsb = <nl> - let method_id = <nl> - Hhbc_id . Method . add_suffix method_id memoize_suffix in <nl> - if info . memoize_is_trait | | with_lsb <nl> - then <nl> + let reified_call_body method_id = <nl> + gather [ <nl> + instr_cgetl ( Local . Named R . reified_generics_local_name ) ; <nl> + instr_reified_name ( Hhbc_id . Method . to_raw_string method_id ) ; <nl> + ] <nl> + <nl> + let call_cls_method info fcall_args method_id with_lsb is_reified = <nl> + let method_id = Hhbc_id . Method . add_suffix method_id memoize_suffix in <nl> + match info . memoize_is_trait | | with_lsb , is_reified with <nl> + | true , false - > <nl> instr_fcallclsmethodsd fcall_args SpecialClsRef . Self method_id <nl> - else <nl> + | true , true - > <nl> + gather [ <nl> + reified_call_body method_id ; <nl> + instr_fcallclsmethods fcall_args SpecialClsRef . Self <nl> + ] <nl> + | false , false - > <nl> instr_fcallclsmethodd fcall_args method_id info . memoize_class_id <nl> + | false , true - > <nl> + gather [ <nl> + reified_call_body method_id ; <nl> + instr_string ( Hhbc_id . Class . to_raw_string info . memoize_class_id ) ; <nl> + instr_clsrefgetc ; <nl> + instr_fcallclsmethod fcall_args [ ] <nl> + ] <nl> <nl> let make_memoize_instance_method_no_params_code <nl> scope deprecation_info method_id is_async = <nl> let make_memoize_instance_method_no_params_code <nl> <nl> ( * md is the already - renamed memoize method that must be wrapped * ) <nl> let make_memoize_instance_method_with_params_code ~ pos <nl> - env scope deprecation_info method_id params ast_params is_async = <nl> + env scope deprecation_info method_id params ast_params <nl> + is_async is_reified = <nl> let renamed_name = <nl> Hhbc_id . Method . add_suffix method_id memoize_suffix in <nl> let param_count = List . length params in <nl> let notfound = Label . next_regular ( ) in <nl> let suspended_get = Label . next_regular ( ) in <nl> let eager_set = Label . next_regular ( ) in <nl> - let first_local = Local . Unnamed param_count in <nl> + ( * The local that contains the reified generics is the first non parameter <nl> + * local , so the first local is parameter count + 1 when there are reified = <nl> + * generics * ) <nl> + let add_reified = if is_reified then 1 else 0 in <nl> + let first_local = Local . Unnamed ( param_count + add_reified ) in <nl> let begin_label , default_value_setters = <nl> ( * Default value setters belong in the <nl> * wrapper method not in the original method * ) <nl> let make_memoize_instance_method_with_params_code ~ pos <nl> if is_async then make_fcall_args ~ async_eager_label : eager_set param_count <nl> else make_fcall_args param_count <nl> in <nl> + let fcall_instrs = <nl> + if not is_reified then <nl> + instr_fcallobjmethodd_nullthrows fcall_args renamed_name <nl> + else <nl> + gather [ <nl> + instr_cgetl ( Local . Named R . reified_generics_local_name ) ; <nl> + instr_fcallobjmethodrd fcall_args renamed_name Ast . OG_nullthrows <nl> + ] <nl> + in <nl> + let reified_memokeym = <nl> + if not is_reified then empty else <nl> + gather @ @ getmemokeyl param_count ( param_count + add_reified ) <nl> + R . reified_generics_local_name in <nl> + let param_count = param_count + add_reified in <nl> gather [ <nl> begin_label ; <nl> Emit_body . emit_method_prolog <nl> let make_memoize_instance_method_with_params_code ~ pos <nl> deprecation_body ; <nl> instr_checkthis ; <nl> param_code_sets params param_count ; <nl> + reified_memokeym ; <nl> if is_async then <nl> gather [ <nl> instr_memoget_eager notfound suspended_get ( Some ( first_local , param_count ) ) ; <nl> let make_memoize_instance_method_with_params_code ~ pos <nl> instr_label notfound ; <nl> instr_this ; instr_nulluninit ; instr_nulluninit ; <nl> param_code_gets params ; <nl> - instr_fcallobjmethodd_nullthrows fcall_args renamed_name ; <nl> + fcall_instrs ; <nl> instr_memoset ( Some ( first_local , param_count ) ) ; <nl> if is_async then <nl> gather [ <nl> let make_memoize_static_method_no_params_code <nl> ] ; <nl> instr_label notfound ; <nl> instr_nulluninit ; instr_nulluninit ; instr_nulluninit ; <nl> - call_cls_method info fcall_args method_id with_lsb ; <nl> + call_cls_method info fcall_args method_id with_lsb false ; <nl> instr_memoset None ; <nl> if is_async then <nl> gather [ <nl> let make_memoize_static_method_no_params_code <nl> ] <nl> <nl> let make_memoize_static_method_with_params_code ~ pos <nl> - env info scope deprecation_info method_id with_lsb params ast_params is_async = <nl> + env info scope deprecation_info method_id with_lsb params ast_params <nl> + is_async is_reified = <nl> let param_count = List . length params in <nl> let notfound = Label . next_regular ( ) in <nl> let suspended_get = Label . next_regular ( ) in <nl> let eager_set = Label . next_regular ( ) in <nl> - let first_local = Local . Unnamed param_count in <nl> + ( * The local that contains the reified generics is the first non parameter <nl> + * local , so the first local is parameter count + 1 when there are reified = <nl> + * generics * ) <nl> + let add_reified = if is_reified then 1 else 0 in <nl> + let first_local = Local . Unnamed ( param_count + add_reified ) in <nl> let deprecation_body = <nl> Emit_body . emit_deprecation_warning scope deprecation_info <nl> in <nl> let make_memoize_static_method_with_params_code ~ pos <nl> if is_async then make_fcall_args ~ async_eager_label : eager_set param_count <nl> else make_fcall_args param_count <nl> in <nl> + let reified_memokeym = <nl> + if not is_reified then empty else <nl> + gather @ @ getmemokeyl param_count ( param_count + add_reified ) <nl> + R . reified_generics_local_name in <nl> + let param_count = param_count + add_reified in <nl> gather [ <nl> begin_label ; <nl> Emit_body . emit_method_prolog <nl> ~ env ~ pos ~ params ~ ast_params ~ should_emit_init_this : false ; <nl> deprecation_body ; <nl> param_code_sets params param_count ; <nl> + reified_memokeym ; <nl> if is_async then <nl> gather [ <nl> instr_memoget_eager notfound suspended_get ( Some ( first_local , param_count ) ) ; <nl> let make_memoize_static_method_with_params_code ~ pos <nl> instr_label notfound ; <nl> instr_nulluninit ; instr_nulluninit ; instr_nulluninit ; <nl> param_code_gets params ; <nl> - call_cls_method info fcall_args method_id with_lsb ; <nl> + call_cls_method info fcall_args method_id with_lsb is_reified ; <nl> instr_memoset ( Some ( first_local , param_count ) ) ; <nl> if is_async then <nl> gather [ <nl> let make_memoize_static_method_with_params_code ~ pos <nl> ] <nl> <nl> let make_memoize_static_method_code <nl> - ~ pos env info scope deprecation_info method_id with_lsb params ast_params is_async = <nl> - if List . is_empty params then <nl> + ~ pos env info scope deprecation_info method_id with_lsb <nl> + params ast_params is_async is_reified = <nl> + if List . is_empty params & & not is_reified then <nl> make_memoize_static_method_no_params_code <nl> info scope deprecation_info method_id with_lsb is_async <nl> else <nl> make_memoize_static_method_with_params_code <nl> ~ pos env info scope <nl> - deprecation_info method_id with_lsb params ast_params is_async <nl> + deprecation_info method_id with_lsb params ast_params <nl> + is_async is_reified <nl> <nl> let make_memoize_instance_method_code <nl> - ~ pos env scope deprecation_info method_id params ast_params is_async = <nl> - if List . is_empty params <nl> + ~ pos env scope deprecation_info method_id params ast_params <nl> + is_async is_reified = <nl> + if List . is_empty params & & not is_reified <nl> then make_memoize_instance_method_no_params_code <nl> scope deprecation_info method_id is_async <nl> else make_memoize_instance_method_with_params_code <nl> - ~ pos env scope deprecation_info method_id params ast_params is_async <nl> + ~ pos env scope deprecation_info method_id params ast_params <nl> + is_async is_reified <nl> <nl> ( * Construct the wrapper function * ) <nl> - let make_wrapper env return_type params instrs with_lsb = <nl> + let make_wrapper env return_type params instrs with_lsb is_reified = <nl> Emit_body . make_body <nl> instrs <nl> - [ ] ( * decl_vars * ) <nl> + ( if is_reified then [ R . reified_generics_local_name ] else [ ] ) ( * decl_vars * ) <nl> true ( * is_memoize_wrapper * ) <nl> with_lsb ( * is_memoize_wrapper_lsb * ) <nl> params <nl> let make_wrapper env return_type params instrs with_lsb = <nl> None ( * doc * ) <nl> ( Some env ) <nl> <nl> - let emit ~ pos env info return_type_info scope <nl> - deprecation_info params ast_params is_static method_id with_lsb is_async = <nl> + let emit <nl> + ~ pos env info return_type_info scope <nl> + deprecation_info params ast_params is_static method_id with_lsb <nl> + is_async is_reified = <nl> let instrs = <nl> Emit_pos . emit_pos_then pos @ @ <nl> if is_static <nl> then make_memoize_static_method_code <nl> - ~ pos env info scope deprecation_info method_id with_lsb params ast_params is_async <nl> + ~ pos env info scope deprecation_info method_id with_lsb params <nl> + ast_params is_async is_reified <nl> else make_memoize_instance_method_code <nl> - ~ pos env scope deprecation_info method_id params ast_params is_async <nl> + ~ pos env scope deprecation_info method_id params <nl> + ast_params is_async is_reified <nl> in <nl> - make_wrapper env return_type_info params instrs with_lsb <nl> + make_wrapper env return_type_info params instrs with_lsb is_reified <nl> <nl> - let emit_memoize_wrapper_body env memoize_info ast_method <nl> - ~ namespace scope deprecation_info params ret is_async = <nl> + let emit_memoize_wrapper_body <nl> + env memoize_info ast_method ~ namespace scope <nl> + deprecation_info params ret is_async is_reified = <nl> let is_static = List . mem ~ equal : ( = ) ast_method . Ast . m_kind Ast . Static in <nl> let tparams = <nl> List . map ( Ast_scope . Scope . get_tparams scope ) ~ f : ( fun t - > snd t . Ast . tp_name ) in <nl> let emit_memoize_wrapper_body env memoize_info ast_method <nl> Hhbc_id . Method . from_ast_name original_name in <nl> let with_lsb = <nl> Emit_attribute . ast_any_is_memoize_lsb ast_method . Ast . m_user_attributes in <nl> - emit ~ pos env memoize_info return_type_info scope deprecation_info <nl> - params ast_method . Ast . m_params is_static method_id with_lsb is_async <nl> + emit <nl> + ~ pos env memoize_info return_type_info scope deprecation_info <nl> + params ast_method . Ast . m_params is_static method_id with_lsb is_async <nl> + is_reified <nl> <nl> let make_memoize_wrapper_method env info ast_class ast_method = <nl> ( * This is cut - and - paste from emit_method above , with special casing for <nl> let make_memoize_wrapper_method env info ast_class ast_method = <nl> Interceptable . is_method_interceptable namespace ast_class method_id in <nl> let method_attributes = <nl> Emit_attribute . from_asts namespace ast_method . Ast . m_user_attributes in <nl> + let method_attributes = Emit_attribute . add_reified_attribute <nl> + method_attributes ast_method . Ast . m_tparams in <nl> let method_is_async = ast_method . Ast . m_fun_kind = Ast_defs . FAsync in <nl> let deprecation_info = Hhas_attribute . deprecation_info method_attributes in <nl> ( * __Memoize is not allowed on lambdas , so we never need to inherit the rx <nl> let make_memoize_wrapper_method env info ast_class ast_method = <nl> Rx . rx_level_from_ast ast_method . Ast . m_user_attributes <nl> | > Option . value ~ default : Rx . NonRx in <nl> let env = Emit_env . with_rx_body ( method_rx_level < > Rx . NonRx ) env in <nl> + let is_reified = <nl> + List . exists ~ f : ( fun t - > t . A . tp_reified ) ast_method . Ast . m_tparams in <nl> let method_body = <nl> emit_memoize_wrapper_body env info ast_method <nl> - ~ namespace scope deprecation_info ast_method . Ast . m_params ret method_is_async in <nl> + ~ namespace scope deprecation_info ast_method . Ast . m_params ret <nl> + method_is_async is_reified in <nl> Hhas_method . make <nl> method_attributes <nl> method_is_protected <nl> new file mode 100644 <nl> index 00000000000 . . 08276b8b95d <nl> mmm / dev / null <nl> ppp b / hphp / test / slow / reified_generics / memoize_func . php <nl> <nl> + < ? hh <nl> + <nl> + echo " multiple argument \ n " ; <nl> + < < __Memoize > > <nl> + function f < reify Ta , Tb , reify Tc > ( $ x , $ y , $ z ) { <nl> + var_dump ( " hi " ) ; <nl> + } <nl> + <nl> + f < int , string , bool > ( 1 , 2 , 3 ) ; / / print <nl> + f < int , string , bool > ( 1 , 2 , 3 ) ; / / nope <nl> + f < string , string , bool > ( 1 , 2 , 3 ) ; / / print <nl> + f < string , string , bool > ( 1 , 2 , 3 ) ; / / nope <nl> + f < string , string , string > ( 1 , 2 , 3 ) ; / / print <nl> + f < int , string , bool > ( 1 , 2 , 3 ) ; / / nope <nl> + f < int , string , bool > ( 1 , 1 , 3 ) ; / / print <nl> + f < int , string , bool > ( 1 , 2 , 3 ) ; / / nope <nl> + <nl> + echo " no argument \ n " ; <nl> + < < __Memoize > > <nl> + function g < reify Ta , Tb , reify Tc > ( ) { <nl> + var_dump ( " hi " ) ; <nl> + } <nl> + <nl> + g < int , string , bool > ( ) ; / / print <nl> + g < int , string , bool > ( ) ; / / nope <nl> + g < string , string , bool > ( ) ; / / print <nl> + g < string , string , bool > ( ) ; / / nope <nl> + g < string , string , string > ( ) ; / / print <nl> + g < int , string , bool > ( ) ; / / nope <nl> + g < int , string , bool > ( ) ; / / nope <nl> new file mode 100644 <nl> index 00000000000 . . 1d25ac846b0 <nl> mmm / dev / null <nl> ppp b / hphp / test / slow / reified_generics / memoize_func . php . expect <nl> <nl> + multiple argument <nl> + string ( 2 ) " hi " <nl> + string ( 2 ) " hi " <nl> + string ( 2 ) " hi " <nl> + string ( 2 ) " hi " <nl> + no argument <nl> + string ( 2 ) " hi " <nl> + string ( 2 ) " hi " <nl> + string ( 2 ) " hi " <nl> new file mode 100644 <nl> index 00000000000 . . c113adfcfe5 <nl> mmm / dev / null <nl> ppp b / hphp / test / slow / reified_generics / memoize_instance_method . php <nl> <nl> + < ? hh <nl> + <nl> + echo " multiple argument \ n " ; <nl> + class C { <nl> + < < __Memoize > > <nl> + public function f < reify Ta , Tb , reify Tc > ( $ x , $ y , $ z ) { <nl> + var_dump ( " hi " ) ; <nl> + } <nl> + } <nl> + <nl> + $ c = new C ( ) ; <nl> + $ c - > f < int , string , bool > ( 1 , 2 , 3 ) ; / / print <nl> + $ c - > f < int , string , bool > ( 1 , 2 , 3 ) ; / / nope <nl> + $ c - > f < string , string , bool > ( 1 , 2 , 3 ) ; / / print <nl> + $ c - > f < string , string , bool > ( 1 , 2 , 3 ) ; / / nope <nl> + $ c - > f < string , string , string > ( 1 , 2 , 3 ) ; / / print <nl> + $ c - > f < int , string , bool > ( 1 , 2 , 3 ) ; / / nope <nl> + $ c - > f < int , string , bool > ( 1 , 1 , 3 ) ; / / print <nl> + $ c - > f < int , string , bool > ( 1 , 2 , 3 ) ; / / nope <nl> + <nl> + <nl> + echo " no argument \ n " ; <nl> + class D { <nl> + < < __Memoize > > <nl> + public function g < reify Ta , Tb , reify Tc > ( ) { <nl> + var_dump ( " hi " ) ; <nl> + } <nl> + } <nl> + <nl> + $ d = new D ( ) ; <nl> + $ d - > g < int , string , bool > ( ) ; / / print <nl> + $ d - > g < int , string , bool > ( ) ; / / nope <nl> + $ d - > g < string , string , bool > ( ) ; / / print <nl> + $ d - > g < string , string , bool > ( ) ; / / nope <nl> + $ d - > g < string , string , string > ( ) ; / / print <nl> + $ d - > g < int , string , bool > ( ) ; / / nope <nl> + $ d - > g < int , string , bool > ( ) ; / / nope <nl> new file mode 100644 <nl> index 00000000000 . . 1d25ac846b0 <nl> mmm / dev / null <nl> ppp b / hphp / test / slow / reified_generics / memoize_instance_method . php . expect <nl> <nl> + multiple argument <nl> + string ( 2 ) " hi " <nl> + string ( 2 ) " hi " <nl> + string ( 2 ) " hi " <nl> + string ( 2 ) " hi " <nl> + no argument <nl> + string ( 2 ) " hi " <nl> + string ( 2 ) " hi " <nl> + string ( 2 ) " hi " <nl> new file mode 100644 <nl> index 00000000000 . . 40897224227 <nl> mmm / dev / null <nl> ppp b / hphp / test / slow / reified_generics / memoize_static_method . php . disabled <nl> <nl> + < ? hh <nl> + <nl> + echo " multiple argument \ n " ; <nl> + class C { <nl> + < < __Memoize > > <nl> + public static function f < reify Ta , Tb , reify Tc > ( $ x , $ y , $ z ) { <nl> + var_dump ( " hi " ) ; <nl> + } <nl> + } <nl> + <nl> + C : : f < int , string , bool > ( 1 , 2 , 3 ) ; / / print <nl> + C : : f < int , string , bool > ( 1 , 2 , 3 ) ; / / nope <nl> + C : : f < string , string , bool > ( 1 , 2 , 3 ) ; / / print <nl> + C : : f < string , string , bool > ( 1 , 2 , 3 ) ; / / nope <nl> + C : : f < string , string , string > ( 1 , 2 , 3 ) ; / / print <nl> + C : : f < int , string , bool > ( 1 , 2 , 3 ) ; / / nope <nl> + C : : f < int , string , bool > ( 1 , 1 , 3 ) ; / / print <nl> + C : : f < int , string , bool > ( 1 , 2 , 3 ) ; / / nope <nl> + <nl> + <nl> + echo " no argument \ n " ; <nl> + class D { <nl> + < < __Memoize > > <nl> + public static function g < reify Ta , Tb , reify Tc > ( ) { <nl> + var_dump ( " hi " ) ; <nl> + } <nl> + } <nl> + <nl> + D : : g < int , string , bool > ( ) ; / / print <nl> + D : : g < int , string , bool > ( ) ; / / nope <nl> + D : : g < string , string , bool > ( ) ; / / print <nl> + D : : g < string , string , bool > ( ) ; / / nope <nl> + D : : g < string , string , string > ( ) ; / / print <nl> + D : : g < int , string , bool > ( ) ; / / nope <nl> + D : : g < int , string , bool > ( ) ; / / nope <nl> + <nl> + echo " traits \ n " ; <nl> + <nl> + trait T { <nl> + < < __Memoize > > <nl> + public static function h < reify Ta , Tb , reify Tc > ( mixed $ x ) { <nl> + var_dump ( " hi " ) ; <nl> + } <nl> + } <nl> + <nl> + class E { <nl> + use T ; <nl> + } <nl> + <nl> + E : : h < int , string , bool > ( 1 ) ; / / print <nl> + E : : h < int , string , bool > ( 1 ) ; / / nope <nl> + E : : h < string , string , bool > ( 1 ) ; / / print <nl> + E : : h < string , string , bool > ( 1 ) ; / / nope <nl> + E : : h < string , string , string > ( 1 ) ; / / print <nl> + E : : h < int , string , bool > ( 1 ) ; / / nope <nl> + E : : h < int , string , bool > ( 1 ) ; / / nope <nl> + E : : h < int , string , bool > ( 2 ) ; / / print <nl> + E : : h < int , string , bool > ( 1 ) ; / / nope <nl> new file mode 100644 <nl> index 00000000000 . . 3e2817abec5 <nl> mmm / dev / null <nl> ppp b / hphp / test / slow / reified_generics / memoize_static_method . php . expect <nl> <nl> + multiple argument <nl> + string ( 2 ) " hi " <nl> + string ( 2 ) " hi " <nl> + string ( 2 ) " hi " <nl> + string ( 2 ) " hi " <nl> + no argument <nl> + string ( 2 ) " hi " <nl> + string ( 2 ) " hi " <nl> + string ( 2 ) " hi " <nl> + traits <nl> + string ( 2 ) " hi " <nl> + string ( 2 ) " hi " <nl> + string ( 2 ) " hi " <nl> + string ( 2 ) " hi " <nl> | Add memoization support to reified functions and methods | facebook/hhvm | fab788f397349e324f2ae72f384d1d9517dfc6d7 | 2019-04-10T16:28:38Z |
mmm a / include / swift / Basic / SourceLoc . h <nl> ppp b / include / swift / Basic / SourceLoc . h <nl> class CharSourceRange { <nl> / / / \ brief Constructs an invalid range . <nl> CharSourceRange ( ) = default ; <nl> <nl> - CharSourceRange & operator = ( const CharSourceRange & ) = default ; <nl> - <nl> CharSourceRange ( SourceLoc Start , unsigned ByteLength ) <nl> : Start ( Start ) , ByteLength ( ByteLength ) { } <nl> <nl> mmm a / include / swift / Basic / TreeScopedHashTable . h <nl> ppp b / include / swift / Basic / TreeScopedHashTable . h <nl> template < typename K , typename V > class TreeScopedHashTableVal { <nl> TreeScopedHashTableVal ( const K & Key , const V & Val ) : Key ( Key ) , Val ( Val ) { } <nl> <nl> public : <nl> + ~ TreeScopedHashTableVal ( ) = default ; <nl> TreeScopedHashTableVal ( const TreeScopedHashTableVal & ) = delete ; <nl> TreeScopedHashTableVal ( TreeScopedHashTableVal & & ) = delete ; <nl> TreeScopedHashTableVal & operator = ( const TreeScopedHashTableVal & ) = delete ; <nl> | [ NFC ] Rule of five / zero feedback | apple/swift | 8b86fdef1b2ecbea1d6b2433f97af9d4bd0b643b | 2018-11-26T21:48:24Z |
mmm a / Marlin / language . h <nl> ppp b / Marlin / language . h <nl> <nl> # ifndef LANGUAGE_H <nl> # define LANGUAGE_H <nl> <nl> + # include " Configuration . h " <nl> + <nl> # define LANGUAGE_CONCAT ( M ) # M <nl> # define GENERATE_LANGUAGE_INCLUDE ( M ) LANGUAGE_CONCAT ( language_ # # M . h ) <nl> <nl> <nl> <nl> / / LCD Menu Messages <nl> <nl> + # define STR_Ae " Ae " / / no charset we know now . Will be overruled when we know . <nl> + # define STR_ae " ae " <nl> + # define STR_Oe " Oe " <nl> + # define STR_oe " oe " <nl> + # define STR_Ue " Ue " <nl> + # define STR_ue " ue " <nl> + # define STR_sz " ss " <nl> + # define STR_Deg " " <nl> + # define STR_THERMOMETER " \ 302 " <nl> + <nl> + # ifdef DISPLAY_CHARSET_DOGM <nl> + # define STR_Ae " \ 304 " / / U8glib <nl> + # define STR_ae " \ 344 " <nl> + # define STR_Oe " \ 326 " <nl> + # define STR_oe STR_Oe <nl> + # define STR_Ue " \ 334 " <nl> + # define STR_ue STR_Ue <nl> + # define STR_sz " \ 337 " <nl> + # define STR_Deg " \ 260 " <nl> + # define STR_THERMOMETER " \ 377 " <nl> + # endif <nl> + # ifdef DISPLAY_CHARSET_HD44870_JAPAN / / HD44870 ROM Code : A00 ( Japan ) <nl> + # define STR_ae " \ xe1 " <nl> + # define STR_Ae STR_ae <nl> + # define STR_oe " \ 357 " <nl> + # define STR_Oe STR_oe <nl> + # define STR_ue " \ 365 " <nl> + # define STR_Ue STR_ue <nl> + # define STR_sz " \ 342 " <nl> + # define STR_Deg " \ 271 " <nl> + # define STR_THERMOMETER " \ 302 " <nl> + # endif <nl> + # ifdef DISPLAY_CHARSET_HD44870_WESTERN / / HD44870 ROM Code : A02 ( Western ) <nl> + # define STR_Ae " \ 216 " <nl> + # define STR_ae " \ 204 " <nl> + # define STR_Oe " \ 211 " <nl> + # define STR_oe " \ 204 " <nl> + # define STR_Ue " \ 212 " <nl> + # define STR_ue " \ 201 " <nl> + # define STR_sz " \ 160 " <nl> + # define STR_Deg " \ 337 " <nl> + # define STR_THERMOMETER " \ 302 " <nl> + # endif <nl> + <nl> + / * <nl> + # define TESTSTRING000 " \ 000 \ 001 \ 002 \ 003 \ 004 \ 005 \ 006 \ 007 \ 010 \ 011 \ 012 \ 013 \ 014 \ 015 \ 016 \ 017 " <nl> + # define TESTSTRING020 " \ 020 \ 021 \ 022 \ 023 \ 024 \ 025 \ 026 \ 027 \ 030 \ 031 \ 032 \ 033 \ 034 \ 035 \ 036 \ 037 " <nl> + # define TESTSTRING040 " \ 040 \ 041 \ 042 \ 043 \ 044 \ 045 \ 046 \ 047 \ 050 \ 051 \ 052 \ 053 \ 054 \ 055 \ 056 \ 057 " <nl> + # define TESTSTRING060 " \ 060 \ 061 \ 062 \ 063 \ 064 \ 065 \ 066 \ 067 \ 070 \ 071 \ 072 \ 073 \ 074 \ 075 \ 076 \ 077 " <nl> + # define TESTSTRING100 " \ 100 \ 101 \ 102 \ 103 \ 104 \ 105 \ 106 \ 107 \ 110 \ 111 \ 112 \ 113 \ 114 \ 115 \ 116 \ 117 " <nl> + # define TESTSTRING120 " \ 120 \ 121 \ 122 \ 123 \ 124 \ 125 \ 126 \ 127 \ 130 \ 131 \ 132 \ 133 \ 134 \ 135 \ 136 \ 137 " <nl> + # define TESTSTRING140 " \ 140 \ 141 \ 142 \ 143 \ 144 \ 145 \ 146 \ 147 \ 150 \ 151 \ 152 \ 153 \ 154 \ 155 \ 156 \ 157 " <nl> + # define TESTSTRING160 " \ 160 \ 161 \ 162 \ 163 \ 164 \ 165 \ 166 \ 167 \ 170 \ 171 \ 172 \ 173 \ 174 \ 175 \ 176 \ 177 " <nl> + # define TESTSTRING200 " \ 200 \ 201 \ 202 \ 203 \ 204 \ 205 \ 206 \ 207 \ 210 \ 211 \ 212 \ 213 \ 214 \ 215 \ 216 \ 217 " <nl> + # define TESTSTRING220 " \ 220 \ 221 \ 222 \ 223 \ 224 \ 225 \ 226 \ 227 \ 230 \ 231 \ 232 \ 233 \ 234 \ 235 \ 236 \ 237 " <nl> + # define TESTSTRING240 " \ 240 \ 241 \ 242 \ 243 \ 244 \ 245 \ 246 \ 247 \ 250 \ 251 \ 252 \ 253 \ 254 \ 255 \ 256 \ 257 " <nl> + # define TESTSTRING260 " \ 260 \ 261 \ 262 \ 263 \ 264 \ 265 \ 266 \ 267 \ 270 \ 271 \ 272 \ 273 \ 274 \ 275 \ 276 \ 277 " <nl> + # define TESTSTRING300 " \ 300 \ 301 \ 302 \ 303 \ 304 \ 305 \ 306 \ 307 \ 310 \ 311 \ 312 \ 313 \ 314 \ 315 \ 316 \ 317 " <nl> + # define TESTSTRING320 " \ 320 \ 321 \ 322 \ 323 \ 324 \ 325 \ 326 \ 327 \ 330 \ 331 \ 332 \ 333 \ 334 \ 335 \ 336 \ 337 " <nl> + # define TESTSTRING340 " \ 340 \ 341 \ 342 \ 343 \ 344 \ 345 \ 346 \ 347 \ 350 \ 351 \ 352 \ 353 \ 354 \ 355 \ 356 \ 357 " <nl> + # define TESTSTRING360 " \ 360 \ 361 \ 362 \ 363 \ 364 \ 365 \ 366 \ 367 \ 370 \ 371 \ 372 \ 373 \ 374 \ 375 \ 376 \ 377 " <nl> + * / <nl> + <nl> # include LANGUAGE_INCLUDE <nl> <nl> # endif / / __LANGUAGE_H <nl> | Included Configuration . h to read the defined charsets . | MarlinFirmware/Marlin | e045034c3f90b7fe7f19a691ea63f659bbc18397 | 2015-01-30T09:31:58Z |
mmm a / project / cmake / addons / addons / pvr . vdr . vnsi / pvr . vdr . vnsi . txt <nl> ppp b / project / cmake / addons / addons / pvr . vdr . vnsi / pvr . vdr . vnsi . txt <nl> @ @ - 1 + 1 @ @ <nl> - pvr . vdr . vnsi https : / / github . com / FernetMenta / pvr . vdr . vnsi 9bebee1 <nl> \ No newline at end of file <nl> + pvr . vdr . vnsi https : / / github . com / kodi - pvr / pvr . vdr . vnsi 9bebee1 <nl> \ No newline at end of file <nl> | [ pvr . vnsi ] change repo location to kodi - pvr | xbmc/xbmc | cb10ef08f937d59afdfaf4afe5f8e3924cf7de34 | 2015-03-07T10:48:45Z |
mmm a / Telegram / SourceFiles / platform / linux / specific_linux . cpp <nl> ppp b / Telegram / SourceFiles / platform / linux / specific_linux . cpp <nl> std : : optional < crl : : time > LastUserInputTime ( ) { <nl> QDBusError : : NotSupported , <nl> } ; <nl> <nl> + const auto notSupportedErrorsToLog = { <nl> + QDBusError : : Disconnected , <nl> + QDBusError : : AccessDenied , <nl> + } ; <nl> + <nl> if ( reply . isValid ( ) ) { <nl> return ( crl : : now ( ) - static_cast < crl : : time > ( reply . value ( ) ) ) ; <nl> } else if ( ranges : : contains ( notSupportedErrors , reply . error ( ) . type ( ) ) ) { <nl> NotSupported = true ; <nl> } else { <nl> - if ( reply . error ( ) . type ( ) = = QDBusError : : AccessDenied ) { <nl> + if ( ranges : : contains ( notSupportedErrorsToLog , reply . error ( ) . type ( ) ) ) { <nl> NotSupported = true ; <nl> } <nl> <nl> | Don ' t spam logs if there are no dbus | telegramdesktop/tdesktop | 15041368287931e09cac95c36d06eea27626e150 | 2020-05-26T03:24:18Z |
mmm a / test / Interpreter / SDK / libc . swift <nl> ppp b / test / Interpreter / SDK / libc . swift <nl> <nl> import Glibc <nl> # elseif os ( Windows ) <nl> import MSVCRT <nl> + <nl> + let S_IRUSR : Int32 = ucrt . _S_IREAD <nl> + let S_IWUSR : Int32 = 0 <nl> + let S_IXUSR : Int32 = 0 <nl> + <nl> + let S_IRGRP : Int32 = 0o0040 <nl> + let S_IROTH : Int32 = 0o0004 <nl> # else <nl> # error ( " Unsupported platform " ) <nl> # endif <nl> if errFile ! = - 1 { <nl> } <nl> <nl> / / CHECK - NOT : error <nl> - / / CHECK : created mode * 33216 * * 33216 * <nl> + / / CHECK : created mode * { { 33216 | 33060 } } * * { { 33216 | 33060 } } * <nl> let tempFile = <nl> open ( tempPath , O_RDWR | O_CREAT | O_EXCL , S_IRUSR | S_IWUSR | S_IXUSR ) <nl> if tempFile = = - 1 { <nl> if err ! = 0 { <nl> <nl> print ( " created mode * \ ( statbuf1 . st_mode ) * * \ ( statbuf2 . st_mode ) * " ) <nl> <nl> + # if os ( Windows ) <nl> + assert ( statbuf1 . st_mode = = S_IFREG | S_IRUSR | S_IRGRP | S_IROTH ) <nl> + # else <nl> assert ( statbuf1 . st_mode = = S_IFREG | S_IRUSR | S_IWUSR | S_IXUSR ) <nl> + # endif <nl> assert ( statbuf1 . st_mode = = statbuf2 . st_mode ) <nl> <nl> | Merge pull request from compnerd / we - have - an - intrepter | apple/swift | 9f8e4de2fd8f9eb5a43f13efb3f32abbbe575071 | 2019-02-18T23:16:44Z |
mmm a / tensorflow / compiler / mlir / tensorflow / translate / import_model . cc <nl> ppp b / tensorflow / compiler / mlir / tensorflow / translate / import_model . cc <nl> limitations under the License . <nl> # include " mlir / IR / MLIRContext . h " / / from @ llvm - project <nl> # include " mlir / IR / Module . h " / / from @ llvm - project <nl> # include " mlir / IR / OpDefinition . h " / / from @ llvm - project <nl> - # include " mlir / IR / OperationSupport . h " / / from @ llvm - project <nl> # include " mlir / IR / StandardTypes . h " / / from @ llvm - project <nl> # include " mlir / IR / Types . h " / / from @ llvm - project <nl> # include " mlir / IR / Verifier . h " / / from @ llvm - project <nl> StatusOr < mlir : : OwningModuleRef > ConvertSavedModelV1ToMlir ( <nl> context ) ; <nl> } <nl> <nl> - std : : string MlirModuleToString ( mlir : : ModuleOp module , bool show_debug_info ) { <nl> + std : : string MlirModuleToString ( mlir : : ModuleOp module , <nl> + mlir : : OpPrintingFlags flags ) { <nl> std : : string txt_module ; <nl> { <nl> - mlir : : OpPrintingFlags flags ; <nl> - if ( show_debug_info ) flags . enableDebugInfo ( ) ; <nl> llvm : : raw_string_ostream os { txt_module } ; <nl> module . print ( os , flags ) ; <nl> } <nl> return txt_module ; <nl> } <nl> <nl> + std : : string MlirModuleToString ( mlir : : ModuleOp module , bool show_debug_info ) { <nl> + mlir : : OpPrintingFlags flags ; <nl> + if ( show_debug_info ) flags . enableDebugInfo ( ) ; <nl> + return MlirModuleToString ( module , flags ) ; <nl> + } <nl> + <nl> } / / namespace tensorflow <nl> mmm a / tensorflow / compiler / mlir / tensorflow / translate / import_model . h <nl> ppp b / tensorflow / compiler / mlir / tensorflow / translate / import_model . h <nl> limitations under the License . <nl> <nl> # include " mlir / IR / MLIRContext . h " / / from @ llvm - project <nl> # include " mlir / IR / Module . h " / / from @ llvm - project <nl> + # include " mlir / IR / OperationSupport . h " / / from @ llvm - project <nl> # include " mlir / Support / LLVM . h " / / from @ llvm - project <nl> # include " tensorflow / cc / saved_model / bundle_v2 . h " <nl> # include " tensorflow / cc / saved_model / loader . h " <nl> ConvertSavedModelV1ToMlir ( const SavedModelBundle & saved_model , <nl> mlir : : MLIRContext * context ) ; <nl> <nl> / / Serialize a MLIR module to a string . <nl> + std : : string MlirModuleToString ( mlir : : ModuleOp module , <nl> + mlir : : OpPrintingFlags flags ) ; <nl> std : : string MlirModuleToString ( mlir : : ModuleOp m , bool show_debug_info = false ) ; <nl> <nl> } / / namespace tensorflow <nl> | Add an overload of tensorflow : : MlirModuleToString ( ) that takes OpPrintingFlags . | tensorflow/tensorflow | feb5afe4e83841cdbca9e72d022e45140fb2ae61 | 2020-06-26T21:53:39Z |
mmm a / tensorflow / contrib / quantize / python / quantize . py <nl> ppp b / tensorflow / contrib / quantize / python / quantize . py <nl> def _FindLayersToQuantize ( graph ) : <nl> yield _LayerMatch ( layer_op , weight_tensor , activation_op , bypass_op , <nl> bias_add_op ) <nl> <nl> + # Match the final layer , where there will not be an activation and instead <nl> + # the output of the final BiasAdd must be quantized , so we treat it as the <nl> + # ' activation_op ' in the _LayerMatch . <nl> + # TODO ( suharshs ) : Figure out how to quantize this final layer across many <nl> + # models . <nl> + final_layer_matcher = graph_matcher . GraphMatcher ( bias_add_pattern ) <nl> + for match_result in final_layer_matcher . match_graph ( graph ) : <nl> + layer_op = match_result . get_op ( layer_pattern ) <nl> + weight_tensor = match_result . get_tensor ( weight_pattern ) <nl> + activation_op = match_result . get_op ( bias_add_pattern ) <nl> + yield _LayerMatch ( layer_op , weight_tensor , activation_op , None , None ) <nl> + <nl> <nl> class _LayerMatch ( object ) : <nl> " " " Contains all information related to a matched Layer . " " " <nl> mmm a / tensorflow / contrib / quantize / python / quantize_test . py <nl> ppp b / tensorflow / contrib / quantize / python / quantize_test . py <nl> def _TestInsertQuantOpForAddAfterSeparableConv2d ( self , is_training ) : <nl> quantization_node_name ) <nl> self . assertEqual ( add_quant . type , quantization_node_name ) <nl> <nl> + def testFinalLayerQuantized ( self ) : <nl> + self . _RunTestOverParameters ( self . _TestFinalLayerQuantized ) <nl> + <nl> + def _TestFinalLayerQuantized ( self , is_training ) : <nl> + graph = ops . Graph ( ) <nl> + with graph . as_default ( ) : <nl> + batch_size , height , width , depth = 5 , 128 , 128 , 3 <nl> + input1 = array_ops . zeros ( ( batch_size , height , width , depth ) ) <nl> + _ = conv2d ( <nl> + input1 , <nl> + 32 , [ 5 , 5 ] , <nl> + stride = 2 , <nl> + padding = ' SAME ' , <nl> + weights_initializer = self . _WeightInit ( 0 . 09 ) , <nl> + activation_fn = None , <nl> + scope = ' test ' ) <nl> + # Ensure that the a FakeQuant operation is in the outputs of the BiasAdd . <nl> + bias_add_op = graph . get_operation_by_name ( ' test / BiasAdd ' ) <nl> + quantize . Quantize ( graph , is_training , weight_bits = 8 , activation_bits = 8 ) <nl> + self . assertTrue ( ' FakeQuantWithMinMaxVars ' in <nl> + [ op . type for op in bias_add_op . outputs [ 0 ] . consumers ( ) ] ) <nl> + <nl> def _WeightInit ( self , stddev ) : <nl> " " " Returns truncated normal variable initializer . <nl> <nl> | Ensure that final layer of networks ( which doesn ' t have an activation ) get correctly quantized . | tensorflow/tensorflow | 9dfb73b26c846038ef8101b2624de3b2cbf49c61 | 2018-02-21T21:00:38Z |
mmm a / dbms / tests / clickhouse - test <nl> ppp b / dbms / tests / clickhouse - test <nl> def main ( args ) : <nl> print ( " Won ' t run stateful tests because test data wasn ' t loaded . See README . txt . " ) <nl> continue <nl> <nl> - for case in sorted ( filter ( lambda case : re . search ( args . test , case ) if args . test else True , os . listdir ( suite_dir ) ) ) : <nl> + # Reverse sort order : we want run newest test first . <nl> + # And not reverse subtests <nl> + def key_func ( item ) : <nl> + prefix , suffix = item . split ( ' _ ' , 1 ) <nl> + return - int ( prefix ) , suffix <nl> + for case in sorted ( filter ( lambda case : re . search ( args . test , case ) if args . test else True , os . listdir ( suite_dir ) ) , key = key_func ) : <nl> if SERVER_DIED : <nl> break <nl> <nl> | Better test reverse ( ) | ClickHouse/ClickHouse | ea19c4494f1279fabc6575e9c77c37b4ad0a10bc | 2017-09-06T20:13:21Z |
mmm a / tensorflow / contrib / boosted_trees / estimator_batch / dnn_tree_combined_estimator_test . py <nl> ppp b / tensorflow / contrib / boosted_trees / estimator_batch / dnn_tree_combined_estimator_test . py <nl> def testTrainEvaluateInferDoesNotThrowErrorWithNoDnnInput ( self ) : <nl> <nl> # Train for a few steps . <nl> est . train ( input_fn = _train_input_fn , steps = 1000 ) <nl> - # 10 steps for dnn + 3 for 1 tree of depth 3 + 1 after the tree finished <nl> - # + 1 for resource variables . <nl> + # 10 steps for dnn , 3 for 1 tree of depth 3 + 1 after the tree finished <nl> self . _assert_checkpoint ( est . model_dir , global_step = 14 ) <nl> res = est . evaluate ( input_fn = _eval_input_fn , steps = 1 ) <nl> self . assertLess ( 0 . 5 , res [ " auc " ] ) <nl> mmm a / tensorflow / contrib / boosted_trees / estimator_batch / estimator_test . py <nl> ppp b / tensorflow / contrib / boosted_trees / estimator_batch / estimator_test . py <nl> def testDoesNotOverrideGlobalSteps ( self ) : <nl> output_leaf_index = False ) <nl> <nl> classifier . fit ( input_fn = _train_input_fn , steps = 15 ) <nl> - # When no override of global steps , 6 steps were used . <nl> - self . _assert_checkpoint ( classifier . model_dir , global_step = 6 ) <nl> + # When no override of global steps , 5 steps were used . <nl> + self . _assert_checkpoint ( classifier . model_dir , global_step = 5 ) <nl> <nl> def testOverridesGlobalSteps ( self ) : <nl> learner_config = learner_pb2 . LearnerConfig ( ) <nl> | Automated rollback of commit 70f071f7afb2deffddbd9937d7a76b1e1c0b2b75 | tensorflow/tensorflow | abd5c32c0fa6451e73b491affdd86d852a74177f | 2018-09-29T01:32:08Z |
mmm a / dbms / src / Storages / Kafka / KafkaBlockInputStream . cpp <nl> ppp b / dbms / src / Storages / Kafka / KafkaBlockInputStream . cpp <nl> Block KafkaBlockInputStream : : readImpl ( ) <nl> } ; <nl> <nl> size_t total_rows = 0 ; <nl> - while ( total_rows < max_block_size ) <nl> + <nl> + buffer - > allowNext ( ) ; <nl> + / / some formats ( like RowBinaryWithNamesAndTypes / CSVWithNames ) <nl> + / / throw an exception when buffer in empty , so just <nl> + while ( ! buffer - > eof ( ) ) <nl> { <nl> auto new_rows = read_kafka_message ( ) ; <nl> total_rows = total_rows + new_rows ; <nl> buffer - > allowNext ( ) ; <nl> - if ( ! new_rows | | ! checkTimeLimit ( ) ) <nl> + if ( ! new_rows | | total_rows > = max_block_size | | ! checkTimeLimit ( ) ) <nl> break ; <nl> } <nl> <nl> | Make the formats like RowBinaryWithNamesAndTypes work in Kafka & do not try to parse buffer when it at eof | ClickHouse/ClickHouse | 6e426592a7599a373ce19baae50b34ded9bee737 | 2019-12-03T21:03:22Z |
mmm a / tensorflow / core / grappler / costs / virtual_scheduler . h <nl> ppp b / tensorflow / core / grappler / costs / virtual_scheduler . h <nl> class FIFOManager : public ReadyNodeManager { <nl> FIFOManager ( ) : ReadyNodeManager ( ) { } <nl> ~ FIFOManager ( ) override { } <nl> void AddNode ( const NodeDef * node ) override { nodes_ . push_back ( node ) ; } <nl> - const NodeDef * GetCurrNode ( ) override { return nodes_ . front ( ) ; } <nl> + const NodeDef * GetCurrNode ( ) override { <nl> + CHECK ( ! nodes_ . empty ( ) ) < < " GetCurrNode ( ) , but there ' s no ready node " ; <nl> + return nodes_ . front ( ) ; <nl> + } <nl> void RemoveCurrNode ( ) override { nodes_ . pop_front ( ) ; } <nl> bool Empty ( ) const override { return nodes_ . empty ( ) ; } <nl> <nl> class LIFOManager : public ReadyNodeManager { <nl> ~ LIFOManager ( ) override { } <nl> void AddNode ( const NodeDef * node ) override { nodes_ . push_back ( node ) ; } <nl> const NodeDef * GetCurrNode ( ) override { <nl> - curr_pos_ = nodes_ . end ( ) ; <nl> - curr_pos_ - - ; <nl> - return nodes_ . back ( ) ; <nl> + CHECK ( ! nodes_ . empty ( ) ) < < " GetCurrNode ( ) , but there ' s no ready node " ; <nl> + if ( curr_pos_ = = nodes_ . end ( ) ) { <nl> + curr_pos_ = - - ( nodes_ . rbegin ( ) . base ( ) ) ; / / Last one in the list . <nl> + } <nl> + / / Once curr_pos_ is set to a valid entry in the list , we keep using the <nl> + / / cached curr_pos_ until RemoveCurrNode ( ) is called . AddNode ( ) will not <nl> + / / change the GetCurrNode ( ) return value . <nl> + return * curr_pos_ ; <nl> } <nl> void RemoveCurrNode ( ) override { <nl> - if ( curr_pos_ ! = nodes_ . end ( ) ) { <nl> - nodes_ . erase ( curr_pos_ ) ; <nl> - } else if ( ! nodes_ . empty ( ) ) { <nl> - nodes_ . pop_back ( ) ; <nl> - } <nl> - curr_pos_ = nodes_ . end ( ) ; <nl> - curr_pos_ - - ; <nl> + / / Make sure we have curr_pos_ ready to be removed . <nl> + GetCurrNode ( ) ; <nl> + / / Note curr_pos_ may not be pointing the last element if some nodes are <nl> + / / added . <nl> + nodes_ . erase ( curr_pos_ ) ; <nl> + <nl> + curr_pos_ = nodes_ . end ( ) ; / / Reset curr_pos_ . <nl> } <nl> bool Empty ( ) const override { return nodes_ . empty ( ) ; } <nl> <nl> mmm a / tensorflow / core / grappler / costs / virtual_scheduler_test . cc <nl> ppp b / tensorflow / core / grappler / costs / virtual_scheduler_test . cc <nl> versions { <nl> ExpectSetEq ( expected , nodes_at_peak_mem_usage ) ; <nl> } <nl> <nl> + / / Helper method for checking nodes dependency . <nl> + void ValidateDependencyChain ( <nl> + const std : : unordered_map < string , int64 > & start_times , <nl> + const std : : vector < string > & nodes_in_dependency_order ) { <nl> + int64 prev_node_time = - 1 ; <nl> + for ( const auto & node : nodes_in_dependency_order ) { <nl> + int64 curr_node_time = start_times . at ( node ) ; <nl> + EXPECT_GE ( curr_node_time , prev_node_time ) ; <nl> + prev_node_time = curr_node_time ; <nl> + } <nl> + } <nl> + <nl> / / Helper method for converting shape vector to TensorProperty . <nl> OpInfo : : TensorProperties ShapeToTensorProperty ( <nl> const std : : vector < int > shape , const DataType & data_type ) const { <nl> TEST_F ( VirtualSchedulerTest , AddAndRemoveMultipleFIFOManager ) { <nl> manager . RemoveCurrNode ( ) ; <nl> EXPECT_EQ ( " Node2 " , manager . GetCurrNode ( ) - > name ( ) ) ; <nl> manager . AddNode ( & node5_ ) ; <nl> + / / GetCurrNode ( ) should return the same node even if some nodes are added , <nl> + / / until RemoveCurrNode ( ) is called . <nl> + EXPECT_EQ ( " Node2 " , manager . GetCurrNode ( ) - > name ( ) ) ; <nl> manager . RemoveCurrNode ( ) ; <nl> EXPECT_EQ ( " Node3 " , manager . GetCurrNode ( ) - > name ( ) ) ; <nl> manager . RemoveCurrNode ( ) ; <nl> EXPECT_EQ ( " Node4 " , manager . GetCurrNode ( ) - > name ( ) ) ; <nl> manager . AddNode ( & node6_ ) ; <nl> + EXPECT_EQ ( " Node4 " , manager . GetCurrNode ( ) - > name ( ) ) ; <nl> manager . RemoveCurrNode ( ) ; <nl> EXPECT_EQ ( " Node5 " , manager . GetCurrNode ( ) - > name ( ) ) ; <nl> manager . RemoveCurrNode ( ) ; <nl> TEST_F ( VirtualSchedulerTest , AddAndRemoveMultipleLIFOManager ) { <nl> manager . RemoveCurrNode ( ) ; <nl> EXPECT_EQ ( " Node3 " , manager . GetCurrNode ( ) - > name ( ) ) ; <nl> manager . AddNode ( & node5_ ) ; <nl> + / / GetCurrNode ( ) should return the same node even if some nodes are added , <nl> + / / until RemoveCurrNode ( ) is called . <nl> + EXPECT_EQ ( " Node3 " , manager . GetCurrNode ( ) - > name ( ) ) ; <nl> manager . RemoveCurrNode ( ) ; <nl> EXPECT_EQ ( " Node5 " , manager . GetCurrNode ( ) - > name ( ) ) ; <nl> manager . RemoveCurrNode ( ) ; <nl> EXPECT_EQ ( " Node2 " , manager . GetCurrNode ( ) - > name ( ) ) ; <nl> manager . AddNode ( & node6_ ) ; <nl> + EXPECT_EQ ( " Node2 " , manager . GetCurrNode ( ) - > name ( ) ) ; <nl> manager . RemoveCurrNode ( ) ; <nl> EXPECT_EQ ( " Node6 " , manager . GetCurrNode ( ) - > name ( ) ) ; <nl> manager . RemoveCurrNode ( ) ; <nl> TEST_F ( VirtualSchedulerTest , GetCurrNodeFirstReadyManager ) { <nl> / / should return it . <nl> EXPECT_EQ ( " Node6 " , manager . GetCurrNode ( ) - > name ( ) ) ; <nl> / / Now insret a few other nodes , but their time_ready ' s are even smaller than <nl> - / / that of Node6 . Befor calling RemoveCurrNode ( ) , GetCurrNode ( ) should return <nl> + / / that of Node6 . Before calling RemoveCurrNode ( ) , GetCurrNode ( ) should return <nl> / / the same node , Node6 , in this case . <nl> <nl> NodeDef node7 ; <nl> TEST_F ( VirtualSchedulerTest , WhileLoop ) { <nl> RunMetadata metadata ; <nl> scheduler_ - > Summary ( & metadata ) ; <nl> <nl> - / / Nodes in topological order ( each node takes 1 usec ) and possible start <nl> - / / time usec : <nl> - / / * const , ones : 0 , 1 usec <nl> - / / * while / Enter , while / Enter_1 : 2 , 3 usec <nl> - / / * while / Merge , while / Merge_1 : 4 , 5 usec <nl> - / / * while / Less / y : 6 usec <nl> - / / * while / Less : 7 usec <nl> - / / * while / LoopCond : 8 usec <nl> - / / * while / Switch , while / Switch_1 : 9 , 10 usec <nl> - / / * while / Identity , while / Identity_1 , while / Exit , while / Exit_1 : 11 - 14 usec <nl> - / / * while / add / y , while / concat / Axis : 15 , 16 usec <nl> - / / * while / add , while / concat : 17 , 18 usec <nl> - / / * while / NextIteration , while / NextIteration_1 : 19 , 20 usec <nl> + / / Nodes in topological order : <nl> + / / * const , ones <nl> + / / * while / Enter , while / Enter_1 <nl> + / / * while / Merge , while / Merge_1 <nl> + / / * while / Less / y <nl> + / / * while / Less <nl> + / / * while / LoopCond <nl> + / / * while / Switch , while / Switch_1 <nl> + / / * while / Identity , while / Identity_1 , while / Exit , while / Exit_1 <nl> + / / * while / add / y , while / concat / axis <nl> + / / * while / add , while / concat <nl> + / / * while / NextIteration , while / NextIteration_1 <nl> <nl> int num_next_iteration = 0 ; <nl> int num_next_iteration_1 = 0 ; <nl> TEST_F ( VirtualSchedulerTest , WhileLoop ) { <nl> int64 next_iter_1_start_micro ; <nl> int64 exit_start_micro ; <nl> int64 exit_1_start_micro ; <nl> + <nl> + std : : unordered_map < string , int64 > start_times ; <nl> for ( const auto & device_step_stats : metadata . step_stats ( ) . dev_stats ( ) ) { <nl> for ( const auto & stats : device_step_stats . node_stats ( ) ) { <nl> - std : : cout < < stats . DebugString ( ) < < std : : endl ; <nl> - / / Start micro for while / Less / y , while / Less , and while / LoopCond are fixed <nl> - / / regardless of scheduling method . <nl> - if ( stats . node_name ( ) = = " while / Less / y " ) { <nl> - EXPECT_EQ ( 6 , stats . all_start_micros ( ) ) ; <nl> - } else if ( stats . node_name ( ) = = " while / Less " ) { <nl> - EXPECT_EQ ( 7 , stats . all_start_micros ( ) ) ; <nl> - } else if ( stats . node_name ( ) = = " while / LoopCond " ) { <nl> - EXPECT_EQ ( 8 , stats . all_start_micros ( ) ) ; <nl> - } else if ( stats . node_name ( ) = = " while / NextIteration " ) { <nl> + start_times [ stats . node_name ( ) ] = stats . all_start_micros ( ) ; <nl> + if ( stats . node_name ( ) = = " while / NextIteration " ) { <nl> + + num_next_iteration ; <nl> - / / Start time can be either 19 or 20 depending on how the scheduler <nl> - / / picks a node among ready nodes . <nl> next_iter_start_micro = stats . all_start_micros ( ) ; <nl> - EXPECT_LE ( 19 , next_iter_start_micro ) ; <nl> - EXPECT_GE ( 20 , next_iter_start_micro ) ; <nl> } else if ( stats . node_name ( ) = = " while / NextIteration_1 " ) { <nl> + + num_next_iteration_1 ; <nl> - / / Start time can be either 19 or 20 depending on how the scheduler <nl> - / / picks a node among ready nodes . <nl> next_iter_1_start_micro = stats . all_start_micros ( ) ; <nl> - EXPECT_LE ( 19 , next_iter_1_start_micro ) ; <nl> - EXPECT_GE ( 20 , next_iter_1_start_micro ) ; <nl> } else if ( stats . node_name ( ) = = " while / Exit " ) { <nl> + + num_exit ; <nl> - / / Start time can be between 11 and 14 ( inclusive ) depending on how <nl> - / / the scheduler picks a node among ready nodes . <nl> exit_start_micro = stats . all_start_micros ( ) ; <nl> - EXPECT_LE ( 11 , exit_start_micro ) ; <nl> - EXPECT_GE ( 14 , exit_start_micro ) ; <nl> } else if ( stats . node_name ( ) = = " while / Exit_1 " ) { <nl> + + num_exit_1 ; <nl> - / / Start time can be between 11 and 14 ( inclusive ) depending on how <nl> - / / the scheduler picks a node among ready nodes . <nl> exit_1_start_micro = stats . all_start_micros ( ) ; <nl> - EXPECT_LE ( 11 , exit_1_start_micro ) ; <nl> - EXPECT_GE ( 14 , exit_1_start_micro ) ; <nl> } <nl> } <nl> } <nl> TEST_F ( VirtualSchedulerTest , WhileLoop ) { <nl> / / different , so should be those of while / Exit and while / Exit_1 . <nl> EXPECT_NE ( next_iter_start_micro , next_iter_1_start_micro ) ; <nl> EXPECT_NE ( exit_start_micro , exit_1_start_micro ) ; <nl> + <nl> + / / Check dependency among the nodes ; no matter what scheduling mechanism we <nl> + / / use , the scheduled ops should follow these depedency chains . <nl> + / / Note that currently , VirtualScheduler executes while / Merge twice ; hence , <nl> + / / we ' re not testing dependency chains related to while / Merge . <nl> + / / TODO ( dyoon ) : after fixing while loop behavior correctly ( run nodes in the <nl> + / / order of Enter , Merge , . . . loop condition . . . , . . . loop body . . . , <nl> + / / NextIteration , Merge , . . . loop condition . . . , Exit ) , re - enable dependency <nl> + / / chaing test w / Merge nodes . <nl> + ValidateDependencyChain ( <nl> + start_times , <nl> + { " Const " , " while / Enter " , / / " while / Merge " , <nl> + " while / Less / y " , " while / Less " , " while / LoopCond " , " while / Switch " , <nl> + " while / Identity " , " while / add / y " , " while / add " , " while / NextIteration " } ) ; <nl> + / / ValidateDependencyChain ( start_times , { " while / Merge " , " while / Less " } ) ; <nl> + ValidateDependencyChain ( start_times , <nl> + { " ones " , " while / Enter_1 " , / / " while / Merge_1 " , <nl> + " while / Switch_1 " , " while / Identity_1 " , " while / concat " , <nl> + " while / NextIteration_1 " } ) ; <nl> + ValidateDependencyChain ( start_times , { " while / Switch " , " while / Exit " } ) ; <nl> + ValidateDependencyChain ( <nl> + start_times , { " while / Identity " , " while / concat / axis " , " while / concat " } ) ; <nl> + ValidateDependencyChain ( start_times , { " while / Identity " , " while / add " } ) ; <nl> + ValidateDependencyChain ( start_times , { " while / Switch_1 " , " while / Exit_1 " } ) ; <nl> } <nl> <nl> TEST_F ( VirtualSchedulerTest , InterDeviceTransfer ) { <nl> | ( 1 ) Make LIFO ' s GetCurrNode ( ) returns the same node until RemoveCurrNode ( ) is | tensorflow/tensorflow | ec60b0b9fb7c50399c7760ca28d390d07bf8e540 | 2017-11-14T06:13:59Z |
mmm a / cocos / scripting / js - bindings / auto / api / jsb_cocos2dx_3d_auto_api . js <nl> ppp b / cocos / scripting / js - bindings / auto / api / jsb_cocos2dx_3d_auto_api . js <nl> getDuration : function ( <nl> return 0 ; <nl> } , <nl> <nl> - / * * <nl> - * @ method create <nl> - * @ param { String } arg0 <nl> - * @ param { String } arg1 <nl> - * @ return { cc . Animation3D } <nl> - * / <nl> - create : function ( <nl> - str , <nl> - str <nl> - ) <nl> - { <nl> - return cc . Animation3D ; <nl> - } , <nl> - <nl> / * * <nl> * @ method Animation3D <nl> * @ constructor <nl> mmm a / cocos / scripting / js - bindings / auto / api / jsb_cocos2dx_auto_api . js <nl> ppp b / cocos / scripting / js - bindings / auto / api / jsb_cocos2dx_auto_api . js <nl> getElapsed : function ( <nl> * / <nl> cc . Sequence = { <nl> <nl> + / * * <nl> + * @ method init <nl> + * @ param { Array } arg0 <nl> + * @ return { bool } <nl> + * / <nl> + init : function ( <nl> + array <nl> + ) <nl> + { <nl> + return false ; <nl> + } , <nl> + <nl> + / * * <nl> + * @ method initWithTwoActions <nl> + * @ param { cc . FiniteTimeAction } arg0 <nl> + * @ param { cc . FiniteTimeAction } arg1 <nl> + * @ return { bool } <nl> + * / <nl> + initWithTwoActions : function ( <nl> + finitetimeaction , <nl> + finitetimeaction <nl> + ) <nl> + { <nl> + return false ; <nl> + } , <nl> + <nl> / * * <nl> * @ method Sequence <nl> * @ constructor <nl> RepeatForever : function ( <nl> * / <nl> cc . Spawn = { <nl> <nl> + / * * <nl> + * @ method init <nl> + * @ param { Array } arg0 <nl> + * @ return { bool } <nl> + * / <nl> + init : function ( <nl> + array <nl> + ) <nl> + { <nl> + return false ; <nl> + } , <nl> + <nl> + / * * <nl> + * @ method initWithTwoActions <nl> + * @ param { cc . FiniteTimeAction } arg0 <nl> + * @ param { cc . FiniteTimeAction } arg1 <nl> + * @ return { bool } <nl> + * / <nl> + initWithTwoActions : function ( <nl> + finitetimeaction , <nl> + finitetimeaction <nl> + ) <nl> + { <nl> + return false ; <nl> + } , <nl> + <nl> / * * <nl> * @ method Spawn <nl> * @ constructor <nl> mmm a / cocos / scripting / js - bindings / auto / jsb_cocos2dx_3d_auto . cpp <nl> ppp b / cocos / scripting / js - bindings / auto / jsb_cocos2dx_3d_auto . cpp <nl> bool js_cocos2dx_3d_Animation3D_getDuration ( JSContext * cx , uint32_t argc , jsval <nl> JS_ReportError ( cx , " js_cocos2dx_3d_Animation3D_getDuration : wrong number of arguments : % d , was expecting % d " , argc , 0 ) ; <nl> return false ; <nl> } <nl> - bool js_cocos2dx_3d_Animation3D_create ( JSContext * cx , uint32_t argc , jsval * vp ) <nl> - { <nl> - JS : : CallArgs args = JS : : CallArgsFromVp ( argc , vp ) ; <nl> - bool ok = true ; <nl> - if ( argc = = 1 ) { <nl> - std : : string arg0 ; <nl> - ok & = jsval_to_std_string ( cx , args . get ( 0 ) , & arg0 ) ; <nl> - JSB_PRECONDITION2 ( ok , cx , false , " js_cocos2dx_3d_Animation3D_create : Error processing arguments " ) ; <nl> - <nl> - auto ret = cocos2d : : Animation3D : : create ( arg0 ) ; <nl> - js_type_class_t * typeClass = js_get_type_from_native < cocos2d : : Animation3D > ( ret ) ; <nl> - JS : : RootedObject jsret ( cx , jsb_ref_autoreleased_create_jsobject ( cx , ret , typeClass , " cocos2d : : Animation3D " ) ) ; <nl> - args . rval ( ) . set ( OBJECT_TO_JSVAL ( jsret ) ) ; <nl> - return true ; <nl> - } <nl> - if ( argc = = 2 ) { <nl> - std : : string arg0 ; <nl> - std : : string arg1 ; <nl> - ok & = jsval_to_std_string ( cx , args . get ( 0 ) , & arg0 ) ; <nl> - ok & = jsval_to_std_string ( cx , args . get ( 1 ) , & arg1 ) ; <nl> - JSB_PRECONDITION2 ( ok , cx , false , " js_cocos2dx_3d_Animation3D_create : Error processing arguments " ) ; <nl> - <nl> - auto ret = cocos2d : : Animation3D : : create ( arg0 , arg1 ) ; <nl> - js_type_class_t * typeClass = js_get_type_from_native < cocos2d : : Animation3D > ( ret ) ; <nl> - JS : : RootedObject jsret ( cx , jsb_ref_autoreleased_create_jsobject ( cx , ret , typeClass , " cocos2d : : Animation3D " ) ) ; <nl> - args . rval ( ) . set ( OBJECT_TO_JSVAL ( jsret ) ) ; <nl> - return true ; <nl> - } <nl> - JS_ReportError ( cx , " js_cocos2dx_3d_Animation3D_create : wrong number of arguments " ) ; <nl> - return false ; <nl> - } <nl> - <nl> bool js_cocos2dx_3d_Animation3D_constructor ( JSContext * cx , uint32_t argc , jsval * vp ) <nl> { <nl> JS : : CallArgs args = JS : : CallArgsFromVp ( argc , vp ) ; <nl> void js_register_cocos2dx_3d_Animation3D ( JSContext * cx , JS : : HandleObject global ) <nl> JS_FS_END <nl> } ; <nl> <nl> - static JSFunctionSpec st_funcs [ ] = { <nl> - JS_FN ( " create " , js_cocos2dx_3d_Animation3D_create , 1 , JSPROP_PERMANENT | JSPROP_ENUMERATE ) , <nl> - JS_FS_END <nl> - } ; <nl> + JSFunctionSpec * st_funcs = NULL ; <nl> <nl> jsb_cocos2d_Animation3D_prototype = JS_InitClass ( <nl> cx , global , <nl> mmm a / cocos / scripting / js - bindings / auto / jsb_cocos2dx_3d_auto . hpp <nl> ppp b / cocos / scripting / js - bindings / auto / jsb_cocos2dx_3d_auto . hpp <nl> bool js_cocos2dx_3d_Animation3D_initWithFile ( JSContext * cx , uint32_t argc , jsval <nl> bool js_cocos2dx_3d_Animation3D_init ( JSContext * cx , uint32_t argc , jsval * vp ) ; <nl> bool js_cocos2dx_3d_Animation3D_getBoneCurveByName ( JSContext * cx , uint32_t argc , jsval * vp ) ; <nl> bool js_cocos2dx_3d_Animation3D_getDuration ( JSContext * cx , uint32_t argc , jsval * vp ) ; <nl> - bool js_cocos2dx_3d_Animation3D_create ( JSContext * cx , uint32_t argc , jsval * vp ) ; <nl> bool js_cocos2dx_3d_Animation3D_Animation3D ( JSContext * cx , uint32_t argc , jsval * vp ) ; <nl> <nl> extern JSClass * jsb_cocos2d_Animate3D_class ; <nl> mmm a / cocos / scripting / js - bindings / auto / jsb_cocos2dx_auto . cpp <nl> ppp b / cocos / scripting / js - bindings / auto / jsb_cocos2dx_auto . cpp <nl> bool js_cocos2dx_Director_getInstance ( JSContext * cx , uint32_t argc , jsval * vp ) <nl> <nl> auto ret = cocos2d : : Director : : getInstance ( ) ; <nl> js_type_class_t * typeClass = js_get_type_from_native < cocos2d : : Director > ( ret ) ; <nl> - JS : : RootedObject jsret ( cx , jsb_ref_singleton_get_or_create_jsobject ( cx , ret , typeClass , " cocos2d : : Director " ) ) ; <nl> + JS : : RootedObject jsret ( cx , jsb_ref_autoreleased_get_or_create_jsobject ( cx , ret , typeClass , " cocos2d : : Director " ) ) ; <nl> args . rval ( ) . set ( OBJECT_TO_JSVAL ( jsret ) ) ; <nl> return true ; <nl> } <nl> void js_register_cocos2dx_ActionInterval ( JSContext * cx , JS : : HandleObject global ) <nl> JSClass * jsb_cocos2d_Sequence_class ; <nl> JSObject * jsb_cocos2d_Sequence_prototype ; <nl> <nl> + bool js_cocos2dx_Sequence_init ( JSContext * cx , uint32_t argc , jsval * vp ) <nl> + { <nl> + JS : : CallArgs args = JS : : CallArgsFromVp ( argc , vp ) ; <nl> + bool ok = true ; <nl> + JS : : RootedObject obj ( cx , args . thisv ( ) . toObjectOrNull ( ) ) ; <nl> + js_proxy_t * proxy = jsb_get_js_proxy ( obj ) ; <nl> + cocos2d : : Sequence * cobj = ( cocos2d : : Sequence * ) ( proxy ? proxy - > ptr : NULL ) ; <nl> + JSB_PRECONDITION2 ( cobj , cx , false , " js_cocos2dx_Sequence_init : Invalid Native Object " ) ; <nl> + if ( argc = = 1 ) { <nl> + cocos2d : : Vector < cocos2d : : FiniteTimeAction * > arg0 ; <nl> + ok & = jsval_to_ccvector ( cx , args . get ( 0 ) , & arg0 ) ; <nl> + JSB_PRECONDITION2 ( ok , cx , false , " js_cocos2dx_Sequence_init : Error processing arguments " ) ; <nl> + bool ret = cobj - > init ( arg0 ) ; <nl> + jsval jsret = JSVAL_NULL ; <nl> + jsret = BOOLEAN_TO_JSVAL ( ret ) ; <nl> + args . rval ( ) . set ( jsret ) ; <nl> + return true ; <nl> + } <nl> + <nl> + JS_ReportError ( cx , " js_cocos2dx_Sequence_init : wrong number of arguments : % d , was expecting % d " , argc , 1 ) ; <nl> + return false ; <nl> + } <nl> + bool js_cocos2dx_Sequence_initWithTwoActions ( JSContext * cx , uint32_t argc , jsval * vp ) <nl> + { <nl> + JS : : CallArgs args = JS : : CallArgsFromVp ( argc , vp ) ; <nl> + bool ok = true ; <nl> + JS : : RootedObject obj ( cx , args . thisv ( ) . toObjectOrNull ( ) ) ; <nl> + js_proxy_t * proxy = jsb_get_js_proxy ( obj ) ; <nl> + cocos2d : : Sequence * cobj = ( cocos2d : : Sequence * ) ( proxy ? proxy - > ptr : NULL ) ; <nl> + JSB_PRECONDITION2 ( cobj , cx , false , " js_cocos2dx_Sequence_initWithTwoActions : Invalid Native Object " ) ; <nl> + if ( argc = = 2 ) { <nl> + cocos2d : : FiniteTimeAction * arg0 = nullptr ; <nl> + cocos2d : : FiniteTimeAction * arg1 = nullptr ; <nl> + do { <nl> + if ( args . get ( 0 ) . isNull ( ) ) { arg0 = nullptr ; break ; } <nl> + if ( ! args . get ( 0 ) . isObject ( ) ) { ok = false ; break ; } <nl> + js_proxy_t * jsProxy ; <nl> + JS : : RootedObject tmpObj ( cx , args . get ( 0 ) . toObjectOrNull ( ) ) ; <nl> + jsProxy = jsb_get_js_proxy ( tmpObj ) ; <nl> + arg0 = ( cocos2d : : FiniteTimeAction * ) ( jsProxy ? jsProxy - > ptr : NULL ) ; <nl> + JSB_PRECONDITION2 ( arg0 , cx , false , " Invalid Native Object " ) ; <nl> + } while ( 0 ) ; <nl> + do { <nl> + if ( args . get ( 1 ) . isNull ( ) ) { arg1 = nullptr ; break ; } <nl> + if ( ! args . get ( 1 ) . isObject ( ) ) { ok = false ; break ; } <nl> + js_proxy_t * jsProxy ; <nl> + JS : : RootedObject tmpObj ( cx , args . get ( 1 ) . toObjectOrNull ( ) ) ; <nl> + jsProxy = jsb_get_js_proxy ( tmpObj ) ; <nl> + arg1 = ( cocos2d : : FiniteTimeAction * ) ( jsProxy ? jsProxy - > ptr : NULL ) ; <nl> + JSB_PRECONDITION2 ( arg1 , cx , false , " Invalid Native Object " ) ; <nl> + } while ( 0 ) ; <nl> + JSB_PRECONDITION2 ( ok , cx , false , " js_cocos2dx_Sequence_initWithTwoActions : Error processing arguments " ) ; <nl> + bool ret = cobj - > initWithTwoActions ( arg0 , arg1 ) ; <nl> + jsval jsret = JSVAL_NULL ; <nl> + jsret = BOOLEAN_TO_JSVAL ( ret ) ; <nl> + args . rval ( ) . set ( jsret ) ; <nl> + return true ; <nl> + } <nl> + <nl> + JS_ReportError ( cx , " js_cocos2dx_Sequence_initWithTwoActions : wrong number of arguments : % d , was expecting % d " , argc , 2 ) ; <nl> + return false ; <nl> + } <nl> bool js_cocos2dx_Sequence_constructor ( JSContext * cx , uint32_t argc , jsval * vp ) <nl> { <nl> JS : : CallArgs args = JS : : CallArgsFromVp ( argc , vp ) ; <nl> void js_register_cocos2dx_Sequence ( JSContext * cx , JS : : HandleObject global ) { <nl> } ; <nl> <nl> static JSFunctionSpec funcs [ ] = { <nl> + JS_FN ( " init " , js_cocos2dx_Sequence_init , 1 , JSPROP_PERMANENT | JSPROP_ENUMERATE ) , <nl> + JS_FN ( " initWithTwoActions " , js_cocos2dx_Sequence_initWithTwoActions , 2 , JSPROP_PERMANENT | JSPROP_ENUMERATE ) , <nl> JS_FN ( " ctor " , js_cocos2dx_Sequence_ctor , 0 , JSPROP_PERMANENT | JSPROP_ENUMERATE ) , <nl> JS_FS_END <nl> } ; <nl> void js_register_cocos2dx_RepeatForever ( JSContext * cx , JS : : HandleObject global ) <nl> JSClass * jsb_cocos2d_Spawn_class ; <nl> JSObject * jsb_cocos2d_Spawn_prototype ; <nl> <nl> + bool js_cocos2dx_Spawn_init ( JSContext * cx , uint32_t argc , jsval * vp ) <nl> + { <nl> + JS : : CallArgs args = JS : : CallArgsFromVp ( argc , vp ) ; <nl> + bool ok = true ; <nl> + JS : : RootedObject obj ( cx , args . thisv ( ) . toObjectOrNull ( ) ) ; <nl> + js_proxy_t * proxy = jsb_get_js_proxy ( obj ) ; <nl> + cocos2d : : Spawn * cobj = ( cocos2d : : Spawn * ) ( proxy ? proxy - > ptr : NULL ) ; <nl> + JSB_PRECONDITION2 ( cobj , cx , false , " js_cocos2dx_Spawn_init : Invalid Native Object " ) ; <nl> + if ( argc = = 1 ) { <nl> + cocos2d : : Vector < cocos2d : : FiniteTimeAction * > arg0 ; <nl> + ok & = jsval_to_ccvector ( cx , args . get ( 0 ) , & arg0 ) ; <nl> + JSB_PRECONDITION2 ( ok , cx , false , " js_cocos2dx_Spawn_init : Error processing arguments " ) ; <nl> + bool ret = cobj - > init ( arg0 ) ; <nl> + jsval jsret = JSVAL_NULL ; <nl> + jsret = BOOLEAN_TO_JSVAL ( ret ) ; <nl> + args . rval ( ) . set ( jsret ) ; <nl> + return true ; <nl> + } <nl> + <nl> + JS_ReportError ( cx , " js_cocos2dx_Spawn_init : wrong number of arguments : % d , was expecting % d " , argc , 1 ) ; <nl> + return false ; <nl> + } <nl> + bool js_cocos2dx_Spawn_initWithTwoActions ( JSContext * cx , uint32_t argc , jsval * vp ) <nl> + { <nl> + JS : : CallArgs args = JS : : CallArgsFromVp ( argc , vp ) ; <nl> + bool ok = true ; <nl> + JS : : RootedObject obj ( cx , args . thisv ( ) . toObjectOrNull ( ) ) ; <nl> + js_proxy_t * proxy = jsb_get_js_proxy ( obj ) ; <nl> + cocos2d : : Spawn * cobj = ( cocos2d : : Spawn * ) ( proxy ? proxy - > ptr : NULL ) ; <nl> + JSB_PRECONDITION2 ( cobj , cx , false , " js_cocos2dx_Spawn_initWithTwoActions : Invalid Native Object " ) ; <nl> + if ( argc = = 2 ) { <nl> + cocos2d : : FiniteTimeAction * arg0 = nullptr ; <nl> + cocos2d : : FiniteTimeAction * arg1 = nullptr ; <nl> + do { <nl> + if ( args . get ( 0 ) . isNull ( ) ) { arg0 = nullptr ; break ; } <nl> + if ( ! args . get ( 0 ) . isObject ( ) ) { ok = false ; break ; } <nl> + js_proxy_t * jsProxy ; <nl> + JS : : RootedObject tmpObj ( cx , args . get ( 0 ) . toObjectOrNull ( ) ) ; <nl> + jsProxy = jsb_get_js_proxy ( tmpObj ) ; <nl> + arg0 = ( cocos2d : : FiniteTimeAction * ) ( jsProxy ? jsProxy - > ptr : NULL ) ; <nl> + JSB_PRECONDITION2 ( arg0 , cx , false , " Invalid Native Object " ) ; <nl> + } while ( 0 ) ; <nl> + do { <nl> + if ( args . get ( 1 ) . isNull ( ) ) { arg1 = nullptr ; break ; } <nl> + if ( ! args . get ( 1 ) . isObject ( ) ) { ok = false ; break ; } <nl> + js_proxy_t * jsProxy ; <nl> + JS : : RootedObject tmpObj ( cx , args . get ( 1 ) . toObjectOrNull ( ) ) ; <nl> + jsProxy = jsb_get_js_proxy ( tmpObj ) ; <nl> + arg1 = ( cocos2d : : FiniteTimeAction * ) ( jsProxy ? jsProxy - > ptr : NULL ) ; <nl> + JSB_PRECONDITION2 ( arg1 , cx , false , " Invalid Native Object " ) ; <nl> + } while ( 0 ) ; <nl> + JSB_PRECONDITION2 ( ok , cx , false , " js_cocos2dx_Spawn_initWithTwoActions : Error processing arguments " ) ; <nl> + bool ret = cobj - > initWithTwoActions ( arg0 , arg1 ) ; <nl> + jsval jsret = JSVAL_NULL ; <nl> + jsret = BOOLEAN_TO_JSVAL ( ret ) ; <nl> + args . rval ( ) . set ( jsret ) ; <nl> + return true ; <nl> + } <nl> + <nl> + JS_ReportError ( cx , " js_cocos2dx_Spawn_initWithTwoActions : wrong number of arguments : % d , was expecting % d " , argc , 2 ) ; <nl> + return false ; <nl> + } <nl> bool js_cocos2dx_Spawn_constructor ( JSContext * cx , uint32_t argc , jsval * vp ) <nl> { <nl> JS : : CallArgs args = JS : : CallArgsFromVp ( argc , vp ) ; <nl> void js_register_cocos2dx_Spawn ( JSContext * cx , JS : : HandleObject global ) { <nl> } ; <nl> <nl> static JSFunctionSpec funcs [ ] = { <nl> + JS_FN ( " init " , js_cocos2dx_Spawn_init , 1 , JSPROP_PERMANENT | JSPROP_ENUMERATE ) , <nl> + JS_FN ( " initWithTwoActions " , js_cocos2dx_Spawn_initWithTwoActions , 2 , JSPROP_PERMANENT | JSPROP_ENUMERATE ) , <nl> JS_FN ( " ctor " , js_cocos2dx_Spawn_ctor , 0 , JSPROP_PERMANENT | JSPROP_ENUMERATE ) , <nl> JS_FS_END <nl> } ; <nl> bool js_cocos2dx_Configuration_getInstance ( JSContext * cx , uint32_t argc , jsval * <nl> <nl> auto ret = cocos2d : : Configuration : : getInstance ( ) ; <nl> js_type_class_t * typeClass = js_get_type_from_native < cocos2d : : Configuration > ( ret ) ; <nl> - JS : : RootedObject jsret ( cx , jsb_ref_singleton_get_or_create_jsobject ( cx , ret , typeClass , " cocos2d : : Configuration " ) ) ; <nl> + JS : : RootedObject jsret ( cx , jsb_ref_autoreleased_get_or_create_jsobject ( cx , ret , typeClass , " cocos2d : : Configuration " ) ) ; <nl> args . rval ( ) . set ( OBJECT_TO_JSVAL ( jsret ) ) ; <nl> return true ; <nl> } <nl> bool js_cocos2dx_GLProgramCache_getInstance ( JSContext * cx , uint32_t argc , jsval <nl> <nl> auto ret = cocos2d : : GLProgramCache : : getInstance ( ) ; <nl> js_type_class_t * typeClass = js_get_type_from_native < cocos2d : : GLProgramCache > ( ret ) ; <nl> - JS : : RootedObject jsret ( cx , jsb_ref_singleton_get_or_create_jsobject ( cx , ret , typeClass , " cocos2d : : GLProgramCache " ) ) ; <nl> + JS : : RootedObject jsret ( cx , jsb_ref_autoreleased_get_or_create_jsobject ( cx , ret , typeClass , " cocos2d : : GLProgramCache " ) ) ; <nl> args . rval ( ) . set ( OBJECT_TO_JSVAL ( jsret ) ) ; <nl> return true ; <nl> } <nl> bool js_cocos2dx_AnimationCache_getInstance ( JSContext * cx , uint32_t argc , jsval <nl> <nl> auto ret = cocos2d : : AnimationCache : : getInstance ( ) ; <nl> js_type_class_t * typeClass = js_get_type_from_native < cocos2d : : AnimationCache > ( ret ) ; <nl> - JS : : RootedObject jsret ( cx , jsb_ref_singleton_get_or_create_jsobject ( cx , ret , typeClass , " cocos2d : : AnimationCache " ) ) ; <nl> + JS : : RootedObject jsret ( cx , jsb_ref_autoreleased_get_or_create_jsobject ( cx , ret , typeClass , " cocos2d : : AnimationCache " ) ) ; <nl> args . rval ( ) . set ( OBJECT_TO_JSVAL ( jsret ) ) ; <nl> return true ; <nl> } <nl> bool js_cocos2dx_SpriteFrameCache_getInstance ( JSContext * cx , uint32_t argc , jsva <nl> <nl> auto ret = cocos2d : : SpriteFrameCache : : getInstance ( ) ; <nl> js_type_class_t * typeClass = js_get_type_from_native < cocos2d : : SpriteFrameCache > ( ret ) ; <nl> - JS : : RootedObject jsret ( cx , jsb_ref_singleton_get_or_create_jsobject ( cx , ret , typeClass , " cocos2d : : SpriteFrameCache " ) ) ; <nl> + JS : : RootedObject jsret ( cx , jsb_ref_autoreleased_get_or_create_jsobject ( cx , ret , typeClass , " cocos2d : : SpriteFrameCache " ) ) ; <nl> args . rval ( ) . set ( OBJECT_TO_JSVAL ( jsret ) ) ; <nl> return true ; <nl> } <nl> mmm a / cocos / scripting / js - bindings / auto / jsb_cocos2dx_auto . hpp <nl> ppp b / cocos / scripting / js - bindings / auto / jsb_cocos2dx_auto . hpp <nl> bool js_cocos2dx_Sequence_constructor ( JSContext * cx , uint32_t argc , jsval * vp ) ; <nl> void js_cocos2dx_Sequence_finalize ( JSContext * cx , JSObject * obj ) ; <nl> void js_register_cocos2dx_Sequence ( JSContext * cx , JS : : HandleObject global ) ; <nl> void register_all_cocos2dx ( JSContext * cx , JS : : HandleObject obj ) ; <nl> + bool js_cocos2dx_Sequence_init ( JSContext * cx , uint32_t argc , jsval * vp ) ; <nl> + bool js_cocos2dx_Sequence_initWithTwoActions ( JSContext * cx , uint32_t argc , jsval * vp ) ; <nl> bool js_cocos2dx_Sequence_Sequence ( JSContext * cx , uint32_t argc , jsval * vp ) ; <nl> <nl> extern JSClass * jsb_cocos2d_Repeat_class ; <nl> bool js_cocos2dx_Spawn_constructor ( JSContext * cx , uint32_t argc , jsval * vp ) ; <nl> void js_cocos2dx_Spawn_finalize ( JSContext * cx , JSObject * obj ) ; <nl> void js_register_cocos2dx_Spawn ( JSContext * cx , JS : : HandleObject global ) ; <nl> void register_all_cocos2dx ( JSContext * cx , JS : : HandleObject obj ) ; <nl> + bool js_cocos2dx_Spawn_init ( JSContext * cx , uint32_t argc , jsval * vp ) ; <nl> + bool js_cocos2dx_Spawn_initWithTwoActions ( JSContext * cx , uint32_t argc , jsval * vp ) ; <nl> bool js_cocos2dx_Spawn_Spawn ( JSContext * cx , uint32_t argc , jsval * vp ) ; <nl> <nl> extern JSClass * jsb_cocos2d_RotateTo_class ; <nl> mmm a / cocos / scripting / js - bindings / auto / jsb_cocos2dx_studio_auto . cpp <nl> ppp b / cocos / scripting / js - bindings / auto / jsb_cocos2dx_studio_auto . cpp <nl> bool js_cocos2dx_studio_ActionManagerEx_getInstance ( JSContext * cx , uint32_t argc <nl> <nl> auto ret = cocostudio : : ActionManagerEx : : getInstance ( ) ; <nl> js_type_class_t * typeClass = js_get_type_from_native < cocostudio : : ActionManagerEx > ( ret ) ; <nl> - JS : : RootedObject jsret ( cx , jsb_ref_singleton_get_or_create_jsobject ( cx , ret , typeClass , " cocostudio : : ActionManagerEx " ) ) ; <nl> + JS : : RootedObject jsret ( cx , jsb_ref_autoreleased_get_or_create_jsobject ( cx , ret , typeClass , " cocostudio : : ActionManagerEx " ) ) ; <nl> args . rval ( ) . set ( OBJECT_TO_JSVAL ( jsret ) ) ; <nl> return true ; <nl> } <nl> bool js_cocos2dx_studio_ArmatureDataManager_getInstance ( JSContext * cx , uint32_t <nl> <nl> auto ret = cocostudio : : ArmatureDataManager : : getInstance ( ) ; <nl> js_type_class_t * typeClass = js_get_type_from_native < cocostudio : : ArmatureDataManager > ( ret ) ; <nl> - JS : : RootedObject jsret ( cx , jsb_ref_singleton_get_or_create_jsobject ( cx , ret , typeClass , " cocostudio : : ArmatureDataManager " ) ) ; <nl> + JS : : RootedObject jsret ( cx , jsb_ref_autoreleased_get_or_create_jsobject ( cx , ret , typeClass , " cocostudio : : ArmatureDataManager " ) ) ; <nl> args . rval ( ) . set ( OBJECT_TO_JSVAL ( jsret ) ) ; <nl> return true ; <nl> } <nl> mmm a / cocos / scripting / js - bindings / manual / 3d / jsb_cocos2dx_3d_manual . cpp <nl> ppp b / cocos / scripting / js - bindings / manual / 3d / jsb_cocos2dx_3d_manual . cpp <nl> static bool js_cocos2dx_Sprite3D_createAsync ( JSContext * cx , uint32_t argc , jsval <nl> auto lambda = [ = ] ( Sprite3D * larg0 , void * larg1 ) - > void { <nl> <nl> jsval largv [ 2 ] ; <nl> - js_proxy_t * proxy = js_get_or_create_proxy ( cx , larg0 ) ; <nl> - largv [ 0 ] = proxy ? OBJECT_TO_JSVAL ( proxy - > obj ) : JS : : UndefinedValue ( ) ; <nl> + JSB_AUTOCOMPARTMENT_WITH_GLOBAL_OBJCET <nl> + largv [ 0 ] = OBJECT_TO_JSVAL ( js_get_or_create_jsobject < Sprite3D > ( cx , larg0 ) ) ; <nl> JSB_HeapValueWrapper * v = ( JSB_HeapValueWrapper * ) larg1 ; <nl> largv [ 1 ] = v - > get ( ) ; <nl> <nl> bool js_cocos2dx_Terrain_create ( JSContext * cx , uint32_t argc , jsval * vp ) <nl> ret = Terrain : : create ( arg0 , arg1 ) ; <nl> } <nl> <nl> - js_proxy_t * jsProxy = js_get_or_create_proxy < Terrain > ( cx , ( Terrain * ) ret ) ; <nl> - args . rval ( ) . set ( OBJECT_TO_JSVAL ( jsProxy - > obj ) ) ; <nl> + args . rval ( ) . set ( OBJECT_TO_JSVAL ( js_get_or_create_jsobject < Terrain > ( cx , ret ) ) ) ; <nl> return true ; <nl> } <nl> JS_ReportError ( cx , " wrong number of arguments " ) ; <nl> bool js_cocos2dx_Terrain_getHeightData ( JSContext * cx , uint32_t argc , jsval * vp ) <nl> return false ; <nl> } <nl> <nl> + / / this code cannot be automated since it must use <nl> + / / get_or_create_jsobject instead of create_jsobject <nl> + / / since Animation3D : : create ( ) might return an existing copy <nl> + / / since it caches them <nl> + bool js_cocos2dx_3d_Animation3D_create ( JSContext * cx , uint32_t argc , jsval * vp ) <nl> + { <nl> + JS : : CallArgs args = JS : : CallArgsFromVp ( argc , vp ) ; <nl> + bool ok = true ; <nl> + if ( argc = = 1 ) { <nl> + std : : string arg0 ; <nl> + ok & = jsval_to_std_string ( cx , args . get ( 0 ) , & arg0 ) ; <nl> + JSB_PRECONDITION2 ( ok , cx , false , " js_cocos2dx_3d_Animation3D_create : Error processing arguments " ) ; <nl> + <nl> + auto ret = cocos2d : : Animation3D : : create ( arg0 ) ; <nl> + js_type_class_t * typeClass = js_get_type_from_native < cocos2d : : Animation3D > ( ret ) ; <nl> + JS : : RootedObject jsret ( cx , jsb_ref_autoreleased_get_or_create_jsobject ( cx , ret , typeClass , " cocos2d : : Animation3D " ) ) ; <nl> + args . rval ( ) . set ( OBJECT_TO_JSVAL ( jsret ) ) ; <nl> + return true ; <nl> + } <nl> + if ( argc = = 2 ) { <nl> + std : : string arg0 ; <nl> + std : : string arg1 ; <nl> + ok & = jsval_to_std_string ( cx , args . get ( 0 ) , & arg0 ) ; <nl> + ok & = jsval_to_std_string ( cx , args . get ( 1 ) , & arg1 ) ; <nl> + JSB_PRECONDITION2 ( ok , cx , false , " js_cocos2dx_3d_Animation3D_create : Error processing arguments " ) ; <nl> + <nl> + auto ret = cocos2d : : Animation3D : : create ( arg0 , arg1 ) ; <nl> + js_type_class_t * typeClass = js_get_type_from_native < cocos2d : : Animation3D > ( ret ) ; <nl> + JS : : RootedObject jsret ( cx , jsb_ref_autoreleased_get_or_create_jsobject ( cx , ret , typeClass , " cocos2d : : Animation3D " ) ) ; <nl> + args . rval ( ) . set ( OBJECT_TO_JSVAL ( jsret ) ) ; <nl> + return true ; <nl> + } <nl> + JS_ReportError ( cx , " js_cocos2dx_3d_Animation3D_create : wrong number of arguments " ) ; <nl> + return false ; <nl> + } <nl> + <nl> void register_all_cocos2dx_3d_manual ( JSContext * cx , JS : : HandleObject global ) <nl> { <nl> JS : : RootedValue tmpVal ( cx ) ; <nl> void register_all_cocos2dx_3d_manual ( JSContext * cx , JS : : HandleObject global ) <nl> tmpObj . set ( tmpVal . toObjectOrNull ( ) ) ; <nl> JS_DefineFunction ( cx , tmpObj , " create " , js_cocos2dx_Terrain_create , 2 , JSPROP_READONLY | JSPROP_PERMANENT ) ; <nl> <nl> + JS_GetProperty ( cx , ccObj , " Animation3D " , & tmpVal ) ; <nl> + tmpObj . set ( tmpVal . toObjectOrNull ( ) ) ; <nl> + JS_DefineFunction ( cx , tmpObj , " create " , js_cocos2dx_3d_Animation3D_create , 2 , JSPROP_READONLY | JSPROP_PERMANENT ) ; <nl> + <nl> JS_GetProperty ( cx , ccObj , " Bundle3D " , & tmpVal ) ; <nl> tmpObj . set ( tmpVal . toObjectOrNull ( ) ) ; <nl> JS_DefineFunction ( cx , tmpObj , " getTrianglesList " , js_cocos2dx_Bundle3D_getTrianglesList , 1 , JSPROP_READONLY | JSPROP_PERMANENT ) ; <nl> mmm a / cocos / scripting / js - bindings / manual / ScriptingCore . cpp <nl> ppp b / cocos / scripting / js - bindings / manual / ScriptingCore . cpp <nl> JSObject * jsb_ref_autoreleased_create_jsobject ( JSContext * cx , cocos2d : : Ref * ref , <nl> return js_obj ; <nl> } <nl> <nl> - JSObject * jsb_ref_singleton_create_jsobject ( JSContext * cx , cocos2d : : Ref * ref , js_type_class_t * typeClass , const char * debug ) <nl> - { <nl> - JS : : RootedObject proto ( cx , typeClass - > proto . ref ( ) ) ; <nl> - JS : : RootedObject parent ( cx , typeClass - > parentProto . ref ( ) ) ; <nl> - JS : : RootedObject js_obj ( cx , JS_NewObject ( cx , typeClass - > jsclass , proto , parent ) ) ; <nl> - js_proxy_t * newproxy = jsb_new_proxy ( ref , js_obj ) ; <nl> - jsb_ref_singleton_init ( cx , & newproxy - > obj , ref , debug ) ; <nl> - return js_obj ; <nl> - } <nl> - <nl> / / get_or_create <nl> JSObject * jsb_ref_get_or_create_jsobject ( JSContext * cx , cocos2d : : Ref * ref , js_type_class_t * typeClass , const char * debug ) <nl> { <nl> JSObject * jsb_ref_get_or_create_jsobject ( JSContext * cx , cocos2d : : Ref * ref , js_ty <nl> return jsb_ref_create_jsobject ( cx , ref , typeClass , debug ) ; <nl> } <nl> <nl> - JSObject * jsb_ref_singleton_get_or_create_jsobject ( JSContext * cx , cocos2d : : Ref * ref , js_type_class_t * typeClass , const char * debug ) <nl> + / / get_or_create : REf is already autoreleased ( or created ) <nl> + JSObject * jsb_ref_autoreleased_get_or_create_jsobject ( JSContext * cx , cocos2d : : Ref * ref , js_type_class_t * typeClass , const char * debug ) <nl> { <nl> auto proxy = jsb_get_native_proxy ( ref ) ; <nl> if ( proxy ) <nl> return proxy - > obj ; <nl> / / else <nl> - return jsb_ref_singleton_create_jsobject ( cx , ref , typeClass , debug ) ; <nl> + return jsb_ref_autoreleased_create_jsobject ( cx , ref , typeClass , debug ) ; <nl> } <nl> <nl> / / ref_init <nl> void jsb_ref_autoreleased_init ( JSContext * cx , JS : : Heap < JSObject * > * obj , Ref * ref <nl> ( void ) obj ; <nl> ref - > _scriptOwned = true ; <nl> / / retain it , since the object is autoreleased <nl> - ret - > retain ( ) ; <nl> + ref - > retain ( ) ; <nl> # else <nl> / / don ' t autorelease it , since it is already autoreleased <nl> JS : : AddNamedObjectRoot ( cx , obj , debug ) ; <nl> # endif <nl> } <nl> <nl> - void jsb_ref_singleton_init ( JSContext * cx , JS : : Heap < JSObject * > * obj , Ref * ref , const char * debug ) <nl> - { <nl> - / / CCLOG ( " jsb_ref_singleton_init : JSObject address = % p . % s " , obj - > get ( ) , debug ) ; <nl> - # if CC_ENABLE_GC_FOR_NATIVE_OBJECTS <nl> - ( void ) cx ; <nl> - ( void ) obj ; <nl> - ref - > _scriptOwned = true ; <nl> - / / don ' t retain it : it is a singleton <nl> - # else <nl> - / / don ' t autorelease it : it is a singleton <nl> - JS : : AddNamedObjectRoot ( cx , obj , debug ) ; <nl> - # endif <nl> - } <nl> - <nl> / / finalize <nl> void jsb_ref_finalize ( JSFreeOp * fop , JSObject * obj ) <nl> { <nl> # if CC_ENABLE_GC_FOR_NATIVE_OBJECTS <nl> js_proxy_t * nproxy ; <nl> js_proxy_t * jsproxy ; <nl> - jsproxy = jsb_get_js_proxy ( obj ) ; <nl> + <nl> + JS : : RootedObject jsobj ( ScriptingCore : : getInstance ( ) - > getGlobalContext ( ) , obj ) ; <nl> + jsproxy = jsb_get_js_proxy ( jsobj ) ; <nl> if ( jsproxy ) <nl> { <nl> auto ref = static_cast < cocos2d : : Ref * > ( jsproxy - > ptr ) ; <nl> mmm a / cocos / scripting / js - bindings / manual / ScriptingCore . h <nl> ppp b / cocos / scripting / js - bindings / manual / ScriptingCore . h <nl> void jsb_ref_init ( JSContext * cx , JS : : Heap < JSObject * > * obj , cocos2d : : Ref * ref , co <nl> * / <nl> void jsb_ref_autoreleased_init ( JSContext * cx , JS : : Heap < JSObject * > * obj , cocos2d : : Ref * ref , const char * debug ) ; <nl> <nl> - / * * <nl> - * Generic initialization function for Singletons <nl> - * Similar to jsb_ref_init ( ) , but call it to initialize singletons <nl> - * / <nl> - void jsb_ref_singleton_init ( JSContext * cx , JS : : Heap < JSObject * > * obj , cocos2d : : Ref * ref , const char * debug ) ; <nl> - <nl> / * * <nl> * Generic finalize used by objects that are subclass of Ref <nl> * / <nl> JSObject * jsb_ref_create_jsobject ( JSContext * cx , cocos2d : : Ref * ref , js_type_clas <nl> * / <nl> JSObject * jsb_ref_autoreleased_create_jsobject ( JSContext * cx , cocos2d : : Ref * ref , js_type_class_t * typeClass , const char * debug ) ; <nl> <nl> - / * * <nl> - * Creates a new JSObject of a certain type ( typeClass ) and creates a proxy associated with and the Singleton ( ref ) <nl> - * Similar to jsb_ref_create_jsobject ( ) , but call it if you know that Ref is a Singleton <nl> - * / <nl> - JSObject * jsb_ref_singleton_create_jsobject ( JSContext * cx , cocos2d : : Ref * ref , js_type_class_t * typeClass , const char * debug ) ; <nl> - <nl> / * * <nl> It will try to get the associated JSObjct for ref . <nl> If it can ' t find it , it will create a new one associating it to Ref <nl> JSObject * jsb_ref_get_or_create_jsobject ( JSContext * cx , cocos2d : : Ref * ref , js_ty <nl> It will try to get the associated JSObjct for ref . <nl> If it can ' t find it , it will create a new one associating it to Ref <nl> * / <nl> - JSObject * jsb_ref_singleton_get_or_create_jsobject ( JSContext * cx , cocos2d : : Ref * ref , js_type_class_t * typeClass , const char * debug ) ; <nl> + JSObject * jsb_ref_autoreleased_get_or_create_jsobject ( JSContext * cx , cocos2d : : Ref * ref , js_type_class_t * typeClass , const char * debug ) ; <nl> + <nl> <nl> void removeJSObject ( JSContext * cx , void * nativeObj ) ; <nl> <nl> mmm a / cocos / scripting / js - bindings / manual / cocos2d_specifics . cpp <nl> ppp b / cocos / scripting / js - bindings / manual / cocos2d_specifics . cpp <nl> bool js_cocos2dx_EventTouch_getTouches ( JSContext * cx , uint32_t argc , jsval * vp ) <nl> JS : : RootedValue arrElement ( cx ) ; <nl> <nl> / / First , check whether object is associated with js object . <nl> - js_proxy_t * jsproxy = js_get_or_create_proxy < cocos2d : : Touch > ( cx , touchObj ) ; <nl> - if ( jsproxy ) { <nl> - arrElement = OBJECT_TO_JSVAL ( jsproxy - > obj ) ; <nl> - } <nl> + auto jsobj = js_get_or_create_jsobject < cocos2d : : Touch > ( cx , touchObj ) ; <nl> + if ( jsobj ) <nl> + arrElement = OBJECT_TO_JSVAL ( jsobj ) ; <nl> if ( ! JS_SetElement ( cx , jsretArr , i , arrElement ) ) { <nl> break ; <nl> } <nl> bool js_PlistParser_getInstance ( JSContext * cx , unsigned argc , JS : : Value * vp ) <nl> jsret = OBJECT_TO_JSVAL ( p - > obj ) ; <nl> } else { <nl> / / create a new js obj of that class <nl> - js_proxy_t * proxy = js_get_or_create_proxy < SAXParser > ( cx , parser ) ; <nl> - jsret = OBJECT_TO_JSVAL ( proxy - > obj ) ; <nl> + jsret = OBJECT_TO_JSVAL ( js_get_or_create_jsobject < SAXParser > ( cx , parser ) ) ; <nl> } <nl> } else { <nl> jsret = JSVAL_NULL ; <nl> bool js_cocos2dx_RenderTexture_saveToFile ( JSContext * cx , uint32_t argc , jsval * v <nl> jsval largv [ 2 ] ; <nl> do { <nl> if ( larg0 ) { <nl> - js_proxy_t * jsProxy = js_get_or_create_proxy < cocos2d : : RenderTexture > ( cx , ( cocos2d : : RenderTexture * ) larg0 ) ; <nl> - largv [ 0 ] = OBJECT_TO_JSVAL ( jsProxy - > obj ) ; <nl> + JSB_AUTOCOMPARTMENT_WITH_GLOBAL_OBJCET <nl> + largv [ 0 ] = OBJECT_TO_JSVAL ( js_get_or_create_jsobject < cocos2d : : RenderTexture > ( cx , ( cocos2d : : RenderTexture * ) larg0 ) ) ; <nl> } else { <nl> largv [ 0 ] = JSVAL_NULL ; <nl> } <nl> bool js_cocos2dx_RenderTexture_saveToFile ( JSContext * cx , uint32_t argc , jsval * v <nl> jsval largv [ 2 ] ; <nl> do { <nl> if ( larg0 ) { <nl> - js_proxy_t * jsProxy = js_get_or_create_proxy < cocos2d : : RenderTexture > ( cx , ( cocos2d : : RenderTexture * ) larg0 ) ; <nl> - largv [ 0 ] = OBJECT_TO_JSVAL ( jsProxy - > obj ) ; <nl> + JSB_AUTOCOMPARTMENT_WITH_GLOBAL_OBJCET <nl> + largv [ 0 ] = OBJECT_TO_JSVAL ( js_get_or_create_jsobject < cocos2d : : RenderTexture > ( cx , ( cocos2d : : RenderTexture * ) larg0 ) ) ; <nl> } else { <nl> largv [ 0 ] = JSVAL_NULL ; <nl> } <nl> bool js_cocos2dx_Scene_getPhysics3DWorld ( JSContext * cx , uint32_t argc , jsval * vp <nl> { <nl> cocos2d : : Physics3DWorld * ret = cobj - > getPhysics3DWorld ( ) ; <nl> jsval jsret = JSVAL_NULL ; <nl> - do <nl> - { <nl> - if ( ret ) <nl> - { <nl> - js_proxy_t * jsProxy = js_get_or_create_proxy < cocos2d : : Physics3DWorld > ( cx , ( cocos2d : : Physics3DWorld * ) ret ) ; <nl> - jsret = OBJECT_TO_JSVAL ( jsProxy - > obj ) ; <nl> - } else <nl> - { <nl> - jsret = JSVAL_NULL ; <nl> - } <nl> - } while ( 0 ) ; <nl> + if ( ret ) <nl> + jsret = OBJECT_TO_JSVAL ( js_get_or_create_jsobject < cocos2d : : Physics3DWorld > ( cx , ( cocos2d : : Physics3DWorld * ) ret ) ) ; <nl> + else <nl> + jsret = JSVAL_NULL ; <nl> args . rval ( ) . set ( jsret ) ; <nl> return true ; <nl> } <nl> bool js_cocos2dx_Scene_getNavMesh ( JSContext * cx , uint32_t argc , jsval * vp ) <nl> if ( argc = = 0 ) { <nl> cocos2d : : NavMesh * ret = cobj - > getNavMesh ( ) ; <nl> jsval jsret = JSVAL_NULL ; <nl> - do { <nl> - if ( ret ) { <nl> - js_proxy_t * jsProxy = js_get_or_create_proxy < cocos2d : : NavMesh > ( cx , ( cocos2d : : NavMesh * ) ret ) ; <nl> - jsret = OBJECT_TO_JSVAL ( jsProxy - > obj ) ; <nl> - } <nl> - else { <nl> - jsret = JSVAL_NULL ; <nl> - } <nl> - } while ( 0 ) ; <nl> + if ( ret ) <nl> + jsret = OBJECT_TO_JSVAL ( js_get_or_create_jsobject < cocos2d : : NavMesh > ( cx , ( cocos2d : : NavMesh * ) ret ) ) ; <nl> + else <nl> + jsret = JSVAL_NULL ; <nl> args . rval ( ) . set ( jsret ) ; <nl> return true ; <nl> } <nl> bool js_cocos2dx_AutoPolygon_generatePolygon ( JSContext * cx , uint32_t argc , jsval <nl> JSB_PRECONDITION2 ( ok , cx , false , " js_cocos2dx_AutoPolygon_generatePolygon : Error processing arguments " ) ; <nl> cocos2d : : PolygonInfo * ret = new cocos2d : : PolygonInfo ( cocos2d : : AutoPolygon : : generatePolygon ( arg0 ) ) ; <nl> jsval jsret = JSVAL_NULL ; <nl> - do { <nl> - if ( ret ) { <nl> - js_proxy_t * jsProxy = js_get_or_create_proxy < cocos2d : : PolygonInfo > ( cx , ret ) ; <nl> - jsret = OBJECT_TO_JSVAL ( jsProxy - > obj ) ; <nl> - } else { <nl> - jsret = JSVAL_NULL ; <nl> - } <nl> - } while ( 0 ) ; <nl> + if ( ret ) { <nl> + jsret = OBJECT_TO_JSVAL ( js_get_or_create_jsobject < cocos2d : : PolygonInfo > ( cx , ret ) ) ; <nl> + } else { <nl> + jsret = JSVAL_NULL ; <nl> + } <nl> args . rval ( ) . set ( jsret ) ; <nl> return true ; <nl> } <nl> bool js_cocos2dx_AutoPolygon_generatePolygon ( JSContext * cx , uint32_t argc , jsval <nl> JSB_PRECONDITION2 ( ok , cx , false , " js_cocos2dx_AutoPolygon_generatePolygon : Error processing arguments " ) ; <nl> cocos2d : : PolygonInfo * ret = new cocos2d : : PolygonInfo ( cocos2d : : AutoPolygon : : generatePolygon ( arg0 , arg1 ) ) ; <nl> jsval jsret = JSVAL_NULL ; <nl> - do { <nl> - if ( ret ) { <nl> - js_proxy_t * jsProxy = js_get_or_create_proxy < cocos2d : : PolygonInfo > ( cx , ret ) ; <nl> - jsret = OBJECT_TO_JSVAL ( jsProxy - > obj ) ; <nl> - } else { <nl> - jsret = JSVAL_NULL ; <nl> - } <nl> - } while ( 0 ) ; <nl> + if ( ret ) { <nl> + jsret = OBJECT_TO_JSVAL ( js_get_or_create_jsobject < cocos2d : : PolygonInfo > ( cx , ret ) ) ; <nl> + } else { <nl> + jsret = JSVAL_NULL ; <nl> + } <nl> args . rval ( ) . set ( jsret ) ; <nl> return true ; <nl> } <nl> bool js_cocos2dx_AutoPolygon_generatePolygon ( JSContext * cx , uint32_t argc , jsval <nl> JSB_PRECONDITION2 ( ok , cx , false , " js_cocos2dx_AutoPolygon_generatePolygon : Error processing arguments " ) ; <nl> cocos2d : : PolygonInfo * ret = new cocos2d : : PolygonInfo ( cocos2d : : AutoPolygon : : generatePolygon ( arg0 , arg1 , arg2 ) ) ; <nl> jsval jsret = JSVAL_NULL ; <nl> - do { <nl> - if ( ret ) { <nl> - js_proxy_t * jsProxy = js_get_or_create_proxy < cocos2d : : PolygonInfo > ( cx , ret ) ; <nl> - jsret = OBJECT_TO_JSVAL ( jsProxy - > obj ) ; <nl> - } else { <nl> - jsret = JSVAL_NULL ; <nl> - } <nl> - } while ( 0 ) ; <nl> + if ( ret ) { <nl> + jsret = OBJECT_TO_JSVAL ( js_get_or_create_jsobject < cocos2d : : PolygonInfo > ( cx , ret ) ) ; <nl> + } else { <nl> + jsret = JSVAL_NULL ; <nl> + } <nl> args . rval ( ) . set ( jsret ) ; <nl> return true ; <nl> } <nl> bool js_cocos2dx_AutoPolygon_generatePolygon ( JSContext * cx , uint32_t argc , jsval <nl> JSB_PRECONDITION2 ( ok , cx , false , " js_cocos2dx_AutoPolygon_generatePolygon : Error processing arguments " ) ; <nl> cocos2d : : PolygonInfo * ret = new cocos2d : : PolygonInfo ( cocos2d : : AutoPolygon : : generatePolygon ( arg0 , arg1 , arg2 , arg3 ) ) ; <nl> jsval jsret = JSVAL_NULL ; <nl> - do { <nl> - if ( ret ) { <nl> - js_proxy_t * jsProxy = js_get_or_create_proxy < cocos2d : : PolygonInfo > ( cx , ret ) ; <nl> - jsret = OBJECT_TO_JSVAL ( jsProxy - > obj ) ; <nl> - } else { <nl> - jsret = JSVAL_NULL ; <nl> - } <nl> - } while ( 0 ) ; <nl> + if ( ret ) { <nl> + jsret = OBJECT_TO_JSVAL ( js_get_or_create_jsobject < cocos2d : : PolygonInfo > ( cx , ret ) ) ; <nl> + } else { <nl> + jsret = JSVAL_NULL ; <nl> + } <nl> args . rval ( ) . set ( jsret ) ; <nl> return true ; <nl> } <nl> mmm a / cocos / scripting / js - bindings / script / jsb_create_apis . js <nl> ppp b / cocos / scripting / js - bindings / script / jsb_create_apis . js <nl> cc . ActionInterval . prototype . _ctor = function ( d ) { <nl> } ; <nl> <nl> cc . Sequence . prototype . _ctor = function ( tempArray ) { <nl> - var paramArray = ( tempArray instanceof Array ) ? tempArray : arguments ; <nl> + var paramArray = ( tempArray instanceof Array ) ? tempArray : Array . prototype . slice . call ( arguments ) ; <nl> var last = paramArray . length - 1 ; <nl> if ( ( last > = 0 ) & & ( paramArray [ last ] = = null ) ) <nl> cc . log ( " parameters should not be ending with null in Javascript " ) ; <nl> <nl> if ( last > = 0 ) { <nl> - var prev = paramArray [ 0 ] ; <nl> - for ( var i = 1 ; i < last ; i + + ) { <nl> - if ( paramArray [ i ] ) { <nl> - prev = cc . Sequence . create ( prev , paramArray [ i ] ) ; <nl> - } <nl> - } <nl> - this . initWithTwoActions ( prev , paramArray [ last ] ) ; <nl> + this . init ( paramArray ) ; <nl> } <nl> } ; <nl> <nl> cc . RepeatForever . prototype . _ctor = function ( action ) { <nl> } ; <nl> <nl> cc . Spawn . prototype . _ctor = function ( tempArray ) { <nl> - var paramArray = ( tempArray instanceof Array ) ? tempArray : arguments ; <nl> + var paramArray = ( tempArray instanceof Array ) ? tempArray : Array . prototype . slice . call ( arguments ) ; <nl> var last = paramArray . length - 1 ; <nl> if ( ( last > = 0 ) & & ( paramArray [ last ] = = null ) ) <nl> cc . log ( " parameters should not be ending with null in Javascript " ) ; <nl> <nl> if ( last > = 0 ) { <nl> - var prev = paramArray [ 0 ] ; <nl> - for ( var i = 1 ; i < last ; i + + ) { <nl> - if ( paramArray [ i ] ) { <nl> - prev = cc . Spawn . create ( prev , paramArray [ i ] ) ; <nl> - } <nl> - } <nl> - this . initWithTwoActions ( prev , paramArray [ last ] ) ; <nl> + this . init ( paramArray ) ; <nl> } <nl> } ; <nl> <nl> cc . Menu . create = function ( menuItems ) { <nl> return cc . Menu . _create . apply ( null , items ) ; <nl> } ; <nl> <nl> - cc . TMXLayer . prototype . tileFlagsAt = cc . TMXLayer . prototype . getTileFlagsAt ; <nl> \ No newline at end of file <nl> + cc . TMXLayer . prototype . tileFlagsAt = cc . TMXLayer . prototype . getTileFlagsAt ; <nl> mmm a / tools / bindings - generator <nl> ppp b / tools / bindings - generator <nl> @ @ - 1 + 1 @ @ <nl> - Subproject commit b940871c1dfff94c0220364539dd9d0583995719 <nl> + Subproject commit 522eff18a6c87ee8473d0d9cd05959e374a6d602 <nl> mmm a / tools / tojs / cocos2dx . ini <nl> ppp b / tools / tojs / cocos2dx . ini <nl> skip = Node : : [ ^ setPosition $ setGLServerState description getUserObject . * UserDat <nl> Range : : [ * ] , <nl> NotificationObserver : : [ * ] , <nl> Image : : [ initWithString initWithImageData ] , <nl> - Sequence : : [ create init ] , <nl> - Spawn : : [ create init ] , <nl> + Sequence : : [ create ] , <nl> + Spawn : : [ create ] , <nl> RotateTo : : [ calculateAngles ] , <nl> GLProgram : : [ getProgram setUniformLocationWith ( 1 | 2 | 3 | 4 ) fv setUniformLocationWith ( 2 | 3 | 4 ) iv setUniformLocationWithMatrix ( 2 | 3 | 4 ) fv ] , <nl> GLProgramState : : [ setUniformVec4 setVertexAttribPointer ] , <nl> mmm a / tools / tojs / cocos2dx_3d . ini <nl> ppp b / tools / tojs / cocos2dx_3d . ini <nl> skip = Skeleton3D : : [ create ] , <nl> Sprite3D : : [ getAABB getMeshArrayByName createAsync ] , <nl> Mesh : : [ create getMeshCommand getAABB getDefaultGLProgram getMeshVertexAttribute draw setTexture getTexture ] , <nl> Sprite3DCache : : [ addSprite3DData getSpriteData ] , <nl> - Animation3D : : [ getBoneCurves ] , <nl> + Animation3D : : [ create getBoneCurves ] , <nl> Animate3D : : [ getKeyFrameUserInfo ] , <nl> TextureCube : : [ setTexParameters ] , <nl> Terrain : : [ getAABB getQuadTree create getHeightData ] , <nl> | Squashed commit of the following : | cocos2d/cocos2d-x | 96d391ea30751d0c3057f33ca9136dd4da64f383 | 2015-12-11T02:02:55Z |
mmm a / tensorflow / core / ops / compat / ops_history . v1 . pbtxt <nl> ppp b / tensorflow / core / ops / compat / ops_history . v1 . pbtxt <nl> op { <nl> } <nl> } <nl> } <nl> + op { <nl> + name : " AvgPool " <nl> + input_arg { <nl> + name : " value " <nl> + type_attr : " T " <nl> + } <nl> + output_arg { <nl> + name : " output " <nl> + type_attr : " T " <nl> + } <nl> + attr { <nl> + name : " ksize " <nl> + type : " list ( int ) " <nl> + has_minimum : true <nl> + minimum : 4 <nl> + } <nl> + attr { <nl> + name : " strides " <nl> + type : " list ( int ) " <nl> + has_minimum : true <nl> + minimum : 4 <nl> + } <nl> + attr { <nl> + name : " padding " <nl> + type : " string " <nl> + allowed_values { <nl> + list { <nl> + s : " SAME " <nl> + s : " VALID " <nl> + } <nl> + } <nl> + } <nl> + attr { <nl> + name : " data_format " <nl> + type : " string " <nl> + default_value { <nl> + s : " NHWC " <nl> + } <nl> + allowed_values { <nl> + list { <nl> + s : " NHWC " <nl> + s : " NCHW " <nl> + s : " HWNC " <nl> + s : " HWCN " <nl> + } <nl> + } <nl> + } <nl> + attr { <nl> + name : " T " <nl> + type : " type " <nl> + allowed_values { <nl> + list { <nl> + type : DT_HALF <nl> + type : DT_BFLOAT16 <nl> + type : DT_FLOAT <nl> + type : DT_DOUBLE <nl> + } <nl> + } <nl> + } <nl> + } <nl> op { <nl> name : " AvgPool3D " <nl> input_arg { <nl> op { <nl> } <nl> } <nl> } <nl> + op { <nl> + name : " AvgPoolGrad " <nl> + input_arg { <nl> + name : " orig_input_shape " <nl> + type : DT_INT32 <nl> + } <nl> + input_arg { <nl> + name : " grad " <nl> + type_attr : " T " <nl> + } <nl> + output_arg { <nl> + name : " output " <nl> + type_attr : " T " <nl> + } <nl> + attr { <nl> + name : " ksize " <nl> + type : " list ( int ) " <nl> + has_minimum : true <nl> + minimum : 4 <nl> + } <nl> + attr { <nl> + name : " strides " <nl> + type : " list ( int ) " <nl> + has_minimum : true <nl> + minimum : 4 <nl> + } <nl> + attr { <nl> + name : " padding " <nl> + type : " string " <nl> + allowed_values { <nl> + list { <nl> + s : " SAME " <nl> + s : " VALID " <nl> + } <nl> + } <nl> + } <nl> + attr { <nl> + name : " data_format " <nl> + type : " string " <nl> + default_value { <nl> + s : " NHWC " <nl> + } <nl> + allowed_values { <nl> + list { <nl> + s : " NHWC " <nl> + s : " NCHW " <nl> + s : " HWNC " <nl> + s : " HWCN " <nl> + } <nl> + } <nl> + } <nl> + attr { <nl> + name : " T " <nl> + type : " type " <nl> + allowed_values { <nl> + list { <nl> + type : DT_HALF <nl> + type : DT_BFLOAT16 <nl> + type : DT_FLOAT <nl> + type : DT_DOUBLE <nl> + } <nl> + } <nl> + } <nl> + } <nl> op { <nl> name : " Barrier " <nl> output_arg { <nl> op { <nl> } <nl> } <nl> } <nl> + op { <nl> + name : " BiasAdd " <nl> + input_arg { <nl> + name : " value " <nl> + type_attr : " T " <nl> + } <nl> + input_arg { <nl> + name : " bias " <nl> + type_attr : " T " <nl> + } <nl> + output_arg { <nl> + name : " output " <nl> + type_attr : " T " <nl> + } <nl> + attr { <nl> + name : " T " <nl> + type : " type " <nl> + allowed_values { <nl> + list { <nl> + type : DT_FLOAT <nl> + type : DT_DOUBLE <nl> + type : DT_INT32 <nl> + type : DT_UINT8 <nl> + type : DT_INT16 <nl> + type : DT_INT8 <nl> + type : DT_COMPLEX64 <nl> + type : DT_INT64 <nl> + type : DT_QINT8 <nl> + type : DT_QUINT8 <nl> + type : DT_QINT32 <nl> + type : DT_BFLOAT16 <nl> + type : DT_UINT16 <nl> + type : DT_COMPLEX128 <nl> + type : DT_HALF <nl> + type : DT_UINT32 <nl> + type : DT_UINT64 <nl> + } <nl> + } <nl> + } <nl> + attr { <nl> + name : " data_format " <nl> + type : " string " <nl> + default_value { <nl> + s : " NHWC " <nl> + } <nl> + allowed_values { <nl> + list { <nl> + s : " NHWC " <nl> + s : " NCHW " <nl> + s : " HWNC " <nl> + s : " HWCN " <nl> + } <nl> + } <nl> + } <nl> + } <nl> op { <nl> name : " BiasAddGrad " <nl> input_arg { <nl> op { <nl> } <nl> } <nl> } <nl> + op { <nl> + name : " BiasAddGrad " <nl> + input_arg { <nl> + name : " out_backprop " <nl> + type_attr : " T " <nl> + } <nl> + output_arg { <nl> + name : " output " <nl> + type_attr : " T " <nl> + } <nl> + attr { <nl> + name : " T " <nl> + type : " type " <nl> + allowed_values { <nl> + list { <nl> + type : DT_FLOAT <nl> + type : DT_DOUBLE <nl> + type : DT_INT32 <nl> + type : DT_UINT8 <nl> + type : DT_INT16 <nl> + type : DT_INT8 <nl> + type : DT_COMPLEX64 <nl> + type : DT_INT64 <nl> + type : DT_QINT8 <nl> + type : DT_QUINT8 <nl> + type : DT_QINT32 <nl> + type : DT_BFLOAT16 <nl> + type : DT_UINT16 <nl> + type : DT_COMPLEX128 <nl> + type : DT_HALF <nl> + type : DT_UINT32 <nl> + type : DT_UINT64 <nl> + } <nl> + } <nl> + } <nl> + attr { <nl> + name : " data_format " <nl> + type : " string " <nl> + default_value { <nl> + s : " NHWC " <nl> + } <nl> + allowed_values { <nl> + list { <nl> + s : " NHWC " <nl> + s : " NCHW " <nl> + s : " HWNC " <nl> + s : " HWCN " <nl> + } <nl> + } <nl> + } <nl> + } <nl> op { <nl> name : " BiasAddV1 " <nl> input_arg { <nl> op { <nl> } <nl> } <nl> op { <nl> - name : " Conv2DBackpropFilter " <nl> + name : " Conv2D " <nl> input_arg { <nl> name : " input " <nl> type_attr : " T " <nl> } <nl> input_arg { <nl> - name : " filter_sizes " <nl> - type : DT_INT32 <nl> - } <nl> - input_arg { <nl> - name : " out_backprop " <nl> + name : " filter " <nl> type_attr : " T " <nl> } <nl> output_arg { <nl> op { <nl> allowed_values { <nl> list { <nl> type : DT_HALF <nl> + type : DT_BFLOAT16 <nl> type : DT_FLOAT <nl> + type : DT_DOUBLE <nl> } <nl> } <nl> } <nl> op { <nl> list { <nl> s : " NHWC " <nl> s : " NCHW " <nl> + s : " HWNC " <nl> + s : " HWCN " <nl> + } <nl> + } <nl> + } <nl> + attr { <nl> + name : " dilations " <nl> + type : " list ( int ) " <nl> + default_value { <nl> + list { <nl> + i : 1 <nl> + i : 1 <nl> + i : 1 <nl> + i : 1 <nl> } <nl> } <nl> } <nl> op { <nl> allowed_values { <nl> list { <nl> type : DT_HALF <nl> - type : DT_BFLOAT16 <nl> type : DT_FLOAT <nl> } <nl> } <nl> op { <nl> } <nl> } <nl> } <nl> - attr { <nl> - name : " dilations " <nl> - type : " list ( int ) " <nl> - default_value { <nl> - list { <nl> - i : 1 <nl> - i : 1 <nl> - i : 1 <nl> - i : 1 <nl> - } <nl> - } <nl> + } <nl> + op { <nl> + name : " Conv2DBackpropFilter " <nl> + input_arg { <nl> + name : " input " <nl> + type_attr : " T " <nl> + } <nl> + input_arg { <nl> + name : " filter_sizes " <nl> + type : DT_INT32 <nl> + } <nl> + input_arg { <nl> + name : " out_backprop " <nl> + type_attr : " T " <nl> + } <nl> + output_arg { <nl> + name : " output " <nl> + type_attr : " T " <nl> + } <nl> + attr { <nl> + name : " T " <nl> + type : " type " <nl> + allowed_values { <nl> + list { <nl> + type : DT_HALF <nl> + type : DT_BFLOAT16 <nl> + type : DT_FLOAT <nl> + } <nl> + } <nl> + } <nl> + attr { <nl> + name : " strides " <nl> + type : " list ( int ) " <nl> + } <nl> + attr { <nl> + name : " use_cudnn_on_gpu " <nl> + type : " bool " <nl> + default_value { <nl> + b : true <nl> + } <nl> + } <nl> + attr { <nl> + name : " padding " <nl> + type : " string " <nl> + allowed_values { <nl> + list { <nl> + s : " SAME " <nl> + s : " VALID " <nl> + } <nl> + } <nl> + } <nl> + attr { <nl> + name : " data_format " <nl> + type : " string " <nl> + default_value { <nl> + s : " NHWC " <nl> + } <nl> + allowed_values { <nl> + list { <nl> + s : " NHWC " <nl> + s : " NCHW " <nl> + } <nl> + } <nl> + } <nl> + attr { <nl> + name : " dilations " <nl> + type : " list ( int ) " <nl> + default_value { <nl> + list { <nl> + i : 1 <nl> + i : 1 <nl> + i : 1 <nl> + i : 1 <nl> + } <nl> + } <nl> + } <nl> + } <nl> + op { <nl> + name : " Conv2DBackpropFilter " <nl> + input_arg { <nl> + name : " input " <nl> + type_attr : " T " <nl> + } <nl> + input_arg { <nl> + name : " filter_sizes " <nl> + type : DT_INT32 <nl> + } <nl> + input_arg { <nl> + name : " out_backprop " <nl> + type_attr : " T " <nl> + } <nl> + output_arg { <nl> + name : " output " <nl> + type_attr : " T " <nl> + } <nl> + attr { <nl> + name : " T " <nl> + type : " type " <nl> + allowed_values { <nl> + list { <nl> + type : DT_HALF <nl> + type : DT_BFLOAT16 <nl> + type : DT_FLOAT <nl> + type : DT_DOUBLE <nl> + } <nl> + } <nl> + } <nl> + attr { <nl> + name : " strides " <nl> + type : " list ( int ) " <nl> + } <nl> + attr { <nl> + name : " use_cudnn_on_gpu " <nl> + type : " bool " <nl> + default_value { <nl> + b : true <nl> + } <nl> + } <nl> + attr { <nl> + name : " padding " <nl> + type : " string " <nl> + allowed_values { <nl> + list { <nl> + s : " SAME " <nl> + s : " VALID " <nl> + } <nl> + } <nl> + } <nl> + attr { <nl> + name : " data_format " <nl> + type : " string " <nl> + default_value { <nl> + s : " NHWC " <nl> + } <nl> + allowed_values { <nl> + list { <nl> + s : " NHWC " <nl> + s : " NCHW " <nl> + } <nl> + } <nl> + } <nl> + attr { <nl> + name : " dilations " <nl> + type : " list ( int ) " <nl> + default_value { <nl> + list { <nl> + i : 1 <nl> + i : 1 <nl> + i : 1 <nl> + i : 1 <nl> + } <nl> + } <nl> } <nl> } <nl> op { <nl> op { <nl> list { <nl> s : " NHWC " <nl> s : " NCHW " <nl> + s : " HWNC " <nl> + s : " HWCN " <nl> } <nl> } <nl> } <nl> op { <nl> } <nl> } <nl> } <nl> + op { <nl> + name : " Conv2DBackpropInput " <nl> + input_arg { <nl> + name : " input_sizes " <nl> + type : DT_INT32 <nl> + } <nl> + input_arg { <nl> + name : " filter " <nl> + type_attr : " T " <nl> + } <nl> + input_arg { <nl> + name : " out_backprop " <nl> + type_attr : " T " <nl> + } <nl> + output_arg { <nl> + name : " output " <nl> + type_attr : " T " <nl> + } <nl> + attr { <nl> + name : " T " <nl> + type : " type " <nl> + allowed_values { <nl> + list { <nl> + type : DT_HALF <nl> + type : DT_BFLOAT16 <nl> + type : DT_FLOAT <nl> + type : DT_DOUBLE <nl> + } <nl> + } <nl> + } <nl> + attr { <nl> + name : " strides " <nl> + type : " list ( int ) " <nl> + } <nl> + attr { <nl> + name : " use_cudnn_on_gpu " <nl> + type : " bool " <nl> + default_value { <nl> + b : true <nl> + } <nl> + } <nl> + attr { <nl> + name : " padding " <nl> + type : " string " <nl> + allowed_values { <nl> + list { <nl> + s : " SAME " <nl> + s : " VALID " <nl> + } <nl> + } <nl> + } <nl> + attr { <nl> + name : " data_format " <nl> + type : " string " <nl> + default_value { <nl> + s : " NHWC " <nl> + } <nl> + allowed_values { <nl> + list { <nl> + s : " NHWC " <nl> + s : " NCHW " <nl> + s : " HWNC " <nl> + s : " HWCN " <nl> + } <nl> + } <nl> + } <nl> + attr { <nl> + name : " dilations " <nl> + type : " list ( int ) " <nl> + default_value { <nl> + list { <nl> + i : 1 <nl> + i : 1 <nl> + i : 1 <nl> + i : 1 <nl> + } <nl> + } <nl> + } <nl> + } <nl> op { <nl> name : " Conv3D " <nl> input_arg { <nl> op { <nl> } <nl> } <nl> op { <nl> - name : " DepthwiseConv2dNativeBackpropFilter " <nl> + name : " DepthwiseConv2dNative " <nl> input_arg { <nl> name : " input " <nl> type_attr : " T " <nl> } <nl> input_arg { <nl> - name : " filter_sizes " <nl> - type : DT_INT32 <nl> - } <nl> - input_arg { <nl> - name : " out_backprop " <nl> + name : " filter " <nl> type_attr : " T " <nl> } <nl> output_arg { <nl> op { <nl> type : " type " <nl> allowed_values { <nl> list { <nl> + type : DT_HALF <nl> + type : DT_BFLOAT16 <nl> type : DT_FLOAT <nl> type : DT_DOUBLE <nl> } <nl> op { <nl> } <nl> } <nl> } <nl> - } <nl> - op { <nl> - name : " DepthwiseConv2dNativeBackpropFilter " <nl> - input_arg { <nl> - name : " input " <nl> - type_attr : " T " <nl> - } <nl> - input_arg { <nl> - name : " filter_sizes " <nl> - type : DT_INT32 <nl> - } <nl> - input_arg { <nl> - name : " out_backprop " <nl> - type_attr : " T " <nl> - } <nl> - output_arg { <nl> - name : " output " <nl> + attr { <nl> + name : " data_format " <nl> + type : " string " <nl> + default_value { <nl> + s : " NHWC " <nl> + } <nl> + allowed_values { <nl> + list { <nl> + s : " NHWC " <nl> + s : " NCHW " <nl> + s : " HWNC " <nl> + s : " HWCN " <nl> + } <nl> + } <nl> + } <nl> + attr { <nl> + name : " dilations " <nl> + type : " list ( int ) " <nl> + default_value { <nl> + list { <nl> + i : 1 <nl> + i : 1 <nl> + i : 1 <nl> + i : 1 <nl> + } <nl> + } <nl> + } <nl> + } <nl> + op { <nl> + name : " DepthwiseConv2dNativeBackpropFilter " <nl> + input_arg { <nl> + name : " input " <nl> + type_attr : " T " <nl> + } <nl> + input_arg { <nl> + name : " filter_sizes " <nl> + type : DT_INT32 <nl> + } <nl> + input_arg { <nl> + name : " out_backprop " <nl> + type_attr : " T " <nl> + } <nl> + output_arg { <nl> + name : " output " <nl> + type_attr : " T " <nl> + } <nl> + attr { <nl> + name : " T " <nl> + type : " type " <nl> + allowed_values { <nl> + list { <nl> + type : DT_FLOAT <nl> + type : DT_DOUBLE <nl> + } <nl> + } <nl> + } <nl> + attr { <nl> + name : " strides " <nl> + type : " list ( int ) " <nl> + } <nl> + attr { <nl> + name : " padding " <nl> + type : " string " <nl> + allowed_values { <nl> + list { <nl> + s : " SAME " <nl> + s : " VALID " <nl> + } <nl> + } <nl> + } <nl> + } <nl> + op { <nl> + name : " DepthwiseConv2dNativeBackpropFilter " <nl> + input_arg { <nl> + name : " input " <nl> + type_attr : " T " <nl> + } <nl> + input_arg { <nl> + name : " filter_sizes " <nl> + type : DT_INT32 <nl> + } <nl> + input_arg { <nl> + name : " out_backprop " <nl> + type_attr : " T " <nl> + } <nl> + output_arg { <nl> + name : " output " <nl> + type_attr : " T " <nl> + } <nl> + attr { <nl> + name : " T " <nl> + type : " type " <nl> + allowed_values { <nl> + list { <nl> + type : DT_FLOAT <nl> + type : DT_DOUBLE <nl> + } <nl> + } <nl> + } <nl> + attr { <nl> + name : " strides " <nl> + type : " list ( int ) " <nl> + } <nl> + attr { <nl> + name : " padding " <nl> + type : " string " <nl> + allowed_values { <nl> + list { <nl> + s : " SAME " <nl> + s : " VALID " <nl> + } <nl> + } <nl> + } <nl> + attr { <nl> + name : " data_format " <nl> + type : " string " <nl> + default_value { <nl> + s : " NHWC " <nl> + } <nl> + allowed_values { <nl> + list { <nl> + s : " NHWC " <nl> + s : " NCHW " <nl> + } <nl> + } <nl> + } <nl> + } <nl> + op { <nl> + name : " DepthwiseConv2dNativeBackpropFilter " <nl> + input_arg { <nl> + name : " input " <nl> + type_attr : " T " <nl> + } <nl> + input_arg { <nl> + name : " filter_sizes " <nl> + type : DT_INT32 <nl> + } <nl> + input_arg { <nl> + name : " out_backprop " <nl> + type_attr : " T " <nl> + } <nl> + output_arg { <nl> + name : " output " <nl> type_attr : " T " <nl> } <nl> attr { <nl> op { <nl> type : " type " <nl> allowed_values { <nl> list { <nl> + type : DT_BFLOAT16 <nl> type : DT_FLOAT <nl> type : DT_DOUBLE <nl> } <nl> op { <nl> } <nl> } <nl> } <nl> + attr { <nl> + name : " dilations " <nl> + type : " list ( int ) " <nl> + default_value { <nl> + list { <nl> + i : 1 <nl> + i : 1 <nl> + i : 1 <nl> + i : 1 <nl> + } <nl> + } <nl> + } <nl> } <nl> op { <nl> name : " DepthwiseConv2dNativeBackpropFilter " <nl> op { <nl> type : " type " <nl> allowed_values { <nl> list { <nl> + type : DT_HALF <nl> type : DT_BFLOAT16 <nl> type : DT_FLOAT <nl> type : DT_DOUBLE <nl> op { <nl> list { <nl> s : " NHWC " <nl> s : " NCHW " <nl> + s : " HWNC " <nl> + s : " HWCN " <nl> } <nl> } <nl> } <nl> op { <nl> } <nl> } <nl> } <nl> + op { <nl> + name : " DepthwiseConv2dNativeBackpropInput " <nl> + input_arg { <nl> + name : " input_sizes " <nl> + type : DT_INT32 <nl> + } <nl> + input_arg { <nl> + name : " filter " <nl> + type_attr : " T " <nl> + } <nl> + input_arg { <nl> + name : " out_backprop " <nl> + type_attr : " T " <nl> + } <nl> + output_arg { <nl> + name : " output " <nl> + type_attr : " T " <nl> + } <nl> + attr { <nl> + name : " T " <nl> + type : " type " <nl> + allowed_values { <nl> + list { <nl> + type : DT_HALF <nl> + type : DT_BFLOAT16 <nl> + type : DT_FLOAT <nl> + type : DT_DOUBLE <nl> + } <nl> + } <nl> + } <nl> + attr { <nl> + name : " strides " <nl> + type : " list ( int ) " <nl> + } <nl> + attr { <nl> + name : " padding " <nl> + type : " string " <nl> + allowed_values { <nl> + list { <nl> + s : " SAME " <nl> + s : " VALID " <nl> + } <nl> + } <nl> + } <nl> + attr { <nl> + name : " data_format " <nl> + type : " string " <nl> + default_value { <nl> + s : " NHWC " <nl> + } <nl> + allowed_values { <nl> + list { <nl> + s : " NHWC " <nl> + s : " NCHW " <nl> + s : " HWNC " <nl> + s : " HWCN " <nl> + } <nl> + } <nl> + } <nl> + attr { <nl> + name : " dilations " <nl> + type : " list ( int ) " <nl> + default_value { <nl> + list { <nl> + i : 1 <nl> + i : 1 <nl> + i : 1 <nl> + i : 1 <nl> + } <nl> + } <nl> + } <nl> + } <nl> op { <nl> name : " Dequantize " <nl> input_arg { <nl> op { <nl> } <nl> } <nl> op { <nl> - name : " MaxPoolGradGrad " <nl> + name : " MaxPoolGrad " <nl> input_arg { <nl> name : " orig_input " <nl> type_attr : " T " <nl> op { <nl> list { <nl> s : " NHWC " <nl> s : " NCHW " <nl> + s : " HWNC " <nl> + s : " HWCN " <nl> } <nl> } <nl> } <nl> attr { <nl> name : " T " <nl> type : " type " <nl> + default_value { <nl> + type : DT_FLOAT <nl> + } <nl> allowed_values { <nl> list { <nl> type : DT_FLOAT <nl> type : DT_DOUBLE <nl> type : DT_INT32 <nl> - type : DT_INT64 <nl> type : DT_UINT8 <nl> type : DT_INT16 <nl> type : DT_INT8 <nl> + type : DT_INT64 <nl> + type : DT_BFLOAT16 <nl> type : DT_UINT16 <nl> type : DT_HALF <nl> + type : DT_UINT32 <nl> + type : DT_UINT64 <nl> } <nl> } <nl> } <nl> op { <nl> type : DT_INT8 <nl> type : DT_UINT16 <nl> type : DT_HALF <nl> - type : DT_UINT32 <nl> - type : DT_UINT64 <nl> } <nl> } <nl> } <nl> op { <nl> type : DT_HALF <nl> type : DT_UINT32 <nl> type : DT_UINT64 <nl> - type : DT_BFLOAT16 <nl> } <nl> } <nl> } <nl> op { <nl> type : DT_FLOAT <nl> type : DT_DOUBLE <nl> type : DT_INT32 <nl> + type : DT_INT64 <nl> type : DT_UINT8 <nl> type : DT_INT16 <nl> type : DT_INT8 <nl> - type : DT_INT64 <nl> - type : DT_BFLOAT16 <nl> type : DT_UINT16 <nl> type : DT_HALF <nl> type : DT_UINT32 <nl> type : DT_UINT64 <nl> + type : DT_BFLOAT16 <nl> } <nl> } <nl> } <nl> } <nl> op { <nl> - name : " MaxPoolGradGradV2 " <nl> + name : " MaxPoolGradGrad " <nl> input_arg { <nl> name : " orig_input " <nl> type_attr : " T " <nl> op { <nl> name : " grad " <nl> type_attr : " T " <nl> } <nl> - input_arg { <nl> - name : " ksize " <nl> - type : DT_INT32 <nl> - } <nl> - input_arg { <nl> - name : " strides " <nl> - type : DT_INT32 <nl> - } <nl> output_arg { <nl> name : " output " <nl> type_attr : " T " <nl> } <nl> attr { <nl> - name : " padding " <nl> - type : " string " <nl> - allowed_values { <nl> - list { <nl> + name : " ksize " <nl> + type : " list ( int ) " <nl> + has_minimum : true <nl> + minimum : 4 <nl> + } <nl> + attr { <nl> + name : " strides " <nl> + type : " list ( int ) " <nl> + has_minimum : true <nl> + minimum : 4 <nl> + } <nl> + attr { <nl> + name : " padding " <nl> + type : " string " <nl> + allowed_values { <nl> + list { <nl> + s : " SAME " <nl> + s : " VALID " <nl> + } <nl> + } <nl> + } <nl> + attr { <nl> + name : " data_format " <nl> + type : " string " <nl> + default_value { <nl> + s : " NHWC " <nl> + } <nl> + allowed_values { <nl> + list { <nl> + s : " NHWC " <nl> + s : " NCHW " <nl> + } <nl> + } <nl> + } <nl> + attr { <nl> + name : " T " <nl> + type : " type " <nl> + allowed_values { <nl> + list { <nl> + type : DT_FLOAT <nl> + type : DT_DOUBLE <nl> + type : DT_INT32 <nl> + type : DT_UINT8 <nl> + type : DT_INT16 <nl> + type : DT_INT8 <nl> + type : DT_INT64 <nl> + type : DT_BFLOAT16 <nl> + type : DT_UINT16 <nl> + type : DT_HALF <nl> + type : DT_UINT32 <nl> + type : DT_UINT64 <nl> + } <nl> + } <nl> + } <nl> + } <nl> + op { <nl> + name : " MaxPoolGradGrad " <nl> + input_arg { <nl> + name : " orig_input " <nl> + type_attr : " T " <nl> + } <nl> + input_arg { <nl> + name : " orig_output " <nl> + type_attr : " T " <nl> + } <nl> + input_arg { <nl> + name : " grad " <nl> + type_attr : " T " <nl> + } <nl> + output_arg { <nl> + name : " output " <nl> + type_attr : " T " <nl> + } <nl> + attr { <nl> + name : " ksize " <nl> + type : " list ( int ) " <nl> + has_minimum : true <nl> + minimum : 4 <nl> + } <nl> + attr { <nl> + name : " strides " <nl> + type : " list ( int ) " <nl> + has_minimum : true <nl> + minimum : 4 <nl> + } <nl> + attr { <nl> + name : " padding " <nl> + type : " string " <nl> + allowed_values { <nl> + list { <nl> + s : " SAME " <nl> + s : " VALID " <nl> + } <nl> + } <nl> + } <nl> + attr { <nl> + name : " data_format " <nl> + type : " string " <nl> + default_value { <nl> + s : " NHWC " <nl> + } <nl> + allowed_values { <nl> + list { <nl> + s : " NHWC " <nl> + s : " NCHW " <nl> + s : " HWNC " <nl> + s : " HWCN " <nl> + } <nl> + } <nl> + } <nl> + attr { <nl> + name : " T " <nl> + type : " type " <nl> + allowed_values { <nl> + list { <nl> + type : DT_FLOAT <nl> + type : DT_DOUBLE <nl> + type : DT_INT32 <nl> + type : DT_UINT8 <nl> + type : DT_INT16 <nl> + type : DT_INT8 <nl> + type : DT_INT64 <nl> + type : DT_BFLOAT16 <nl> + type : DT_UINT16 <nl> + type : DT_HALF <nl> + type : DT_UINT32 <nl> + type : DT_UINT64 <nl> + } <nl> + } <nl> + } <nl> + } <nl> + op { <nl> + name : " MaxPoolGradGradV2 " <nl> + input_arg { <nl> + name : " orig_input " <nl> + type_attr : " T " <nl> + } <nl> + input_arg { <nl> + name : " orig_output " <nl> + type_attr : " T " <nl> + } <nl> + input_arg { <nl> + name : " grad " <nl> + type_attr : " T " <nl> + } <nl> + input_arg { <nl> + name : " ksize " <nl> + type : DT_INT32 <nl> + } <nl> + input_arg { <nl> + name : " strides " <nl> + type : DT_INT32 <nl> + } <nl> + output_arg { <nl> + name : " output " <nl> + type_attr : " T " <nl> + } <nl> + attr { <nl> + name : " padding " <nl> + type : " string " <nl> + allowed_values { <nl> + list { <nl> s : " SAME " <nl> s : " VALID " <nl> } <nl> op { <nl> } <nl> } <nl> } <nl> + op { <nl> + name : " MaxPoolGradGradV2 " <nl> + input_arg { <nl> + name : " orig_input " <nl> + type_attr : " T " <nl> + } <nl> + input_arg { <nl> + name : " orig_output " <nl> + type_attr : " T " <nl> + } <nl> + input_arg { <nl> + name : " grad " <nl> + type_attr : " T " <nl> + } <nl> + input_arg { <nl> + name : " ksize " <nl> + type : DT_INT32 <nl> + } <nl> + input_arg { <nl> + name : " strides " <nl> + type : DT_INT32 <nl> + } <nl> + output_arg { <nl> + name : " output " <nl> + type_attr : " T " <nl> + } <nl> + attr { <nl> + name : " padding " <nl> + type : " string " <nl> + allowed_values { <nl> + list { <nl> + s : " SAME " <nl> + s : " VALID " <nl> + } <nl> + } <nl> + } <nl> + attr { <nl> + name : " data_format " <nl> + type : " string " <nl> + default_value { <nl> + s : " NHWC " <nl> + } <nl> + allowed_values { <nl> + list { <nl> + s : " NHWC " <nl> + s : " NCHW " <nl> + s : " HWNC " <nl> + s : " HWCN " <nl> + } <nl> + } <nl> + } <nl> + attr { <nl> + name : " T " <nl> + type : " type " <nl> + allowed_values { <nl> + list { <nl> + type : DT_FLOAT <nl> + type : DT_DOUBLE <nl> + type : DT_INT32 <nl> + type : DT_UINT8 <nl> + type : DT_INT16 <nl> + type : DT_INT8 <nl> + type : DT_INT64 <nl> + type : DT_BFLOAT16 <nl> + type : DT_UINT16 <nl> + type : DT_HALF <nl> + type : DT_UINT32 <nl> + type : DT_UINT64 <nl> + } <nl> + } <nl> + } <nl> + } <nl> op { <nl> name : " MaxPoolGradGradWithArgmax " <nl> input_arg { <nl> op { <nl> } <nl> } <nl> } <nl> + op { <nl> + name : " MaxPoolGradV2 " <nl> + input_arg { <nl> + name : " orig_input " <nl> + type_attr : " T " <nl> + } <nl> + input_arg { <nl> + name : " orig_output " <nl> + type_attr : " T " <nl> + } <nl> + input_arg { <nl> + name : " grad " <nl> + type_attr : " T " <nl> + } <nl> + input_arg { <nl> + name : " ksize " <nl> + type : DT_INT32 <nl> + } <nl> + input_arg { <nl> + name : " strides " <nl> + type : DT_INT32 <nl> + } <nl> + output_arg { <nl> + name : " output " <nl> + type_attr : " T " <nl> + } <nl> + attr { <nl> + name : " padding " <nl> + type : " string " <nl> + allowed_values { <nl> + list { <nl> + s : " SAME " <nl> + s : " VALID " <nl> + } <nl> + } <nl> + } <nl> + attr { <nl> + name : " data_format " <nl> + type : " string " <nl> + default_value { <nl> + s : " NHWC " <nl> + } <nl> + allowed_values { <nl> + list { <nl> + s : " NHWC " <nl> + s : " NCHW " <nl> + s : " HWNC " <nl> + s : " HWCN " <nl> + } <nl> + } <nl> + } <nl> + attr { <nl> + name : " T " <nl> + type : " type " <nl> + default_value { <nl> + type : DT_FLOAT <nl> + } <nl> + allowed_values { <nl> + list { <nl> + type : DT_FLOAT <nl> + type : DT_DOUBLE <nl> + type : DT_INT32 <nl> + type : DT_UINT8 <nl> + type : DT_INT16 <nl> + type : DT_INT8 <nl> + type : DT_INT64 <nl> + type : DT_BFLOAT16 <nl> + type : DT_UINT16 <nl> + type : DT_HALF <nl> + type : DT_UINT32 <nl> + type : DT_UINT64 <nl> + } <nl> + } <nl> + } <nl> + } <nl> op { <nl> name : " MaxPoolGradWithArgmax " <nl> input_arg { <nl> mmm a / tensorflow / core / ops / ops . pbtxt <nl> ppp b / tensorflow / core / ops / ops . pbtxt <nl> op { <nl> list { <nl> s : " NHWC " <nl> s : " NCHW " <nl> + s : " HWNC " <nl> + s : " HWCN " <nl> } <nl> } <nl> } <nl> op { <nl> list { <nl> s : " NHWC " <nl> s : " NCHW " <nl> + s : " HWNC " <nl> + s : " HWCN " <nl> } <nl> } <nl> } <nl> op { <nl> list { <nl> s : " NHWC " <nl> s : " NCHW " <nl> + s : " HWNC " <nl> + s : " HWCN " <nl> } <nl> } <nl> } <nl> op { <nl> list { <nl> s : " NHWC " <nl> s : " NCHW " <nl> + s : " HWNC " <nl> + s : " HWCN " <nl> } <nl> } <nl> } <nl> op { <nl> list { <nl> s : " NHWC " <nl> s : " NCHW " <nl> + s : " HWNC " <nl> + s : " HWCN " <nl> } <nl> } <nl> } <nl> op { <nl> list { <nl> s : " NHWC " <nl> s : " NCHW " <nl> + s : " HWNC " <nl> + s : " HWCN " <nl> } <nl> } <nl> } <nl> op { <nl> list { <nl> s : " NHWC " <nl> s : " NCHW " <nl> + s : " HWNC " <nl> + s : " HWCN " <nl> } <nl> } <nl> } <nl> op { <nl> list { <nl> s : " NHWC " <nl> s : " NCHW " <nl> + s : " HWNC " <nl> + s : " HWCN " <nl> } <nl> } <nl> } <nl> op { <nl> list { <nl> s : " NHWC " <nl> s : " NCHW " <nl> + s : " HWNC " <nl> + s : " HWCN " <nl> } <nl> } <nl> } <nl> op { <nl> list { <nl> s : " NHWC " <nl> s : " NCHW " <nl> + s : " HWNC " <nl> + s : " HWCN " <nl> } <nl> } <nl> } <nl> op { <nl> list { <nl> s : " NHWC " <nl> s : " NCHW " <nl> + s : " HWNC " <nl> + s : " HWCN " <nl> } <nl> } <nl> } <nl> op { <nl> list { <nl> s : " NHWC " <nl> s : " NCHW " <nl> + s : " HWNC " <nl> + s : " HWCN " <nl> } <nl> } <nl> } <nl> op { <nl> list { <nl> s : " NHWC " <nl> s : " NCHW " <nl> + s : " HWNC " <nl> + s : " HWCN " <nl> } <nl> } <nl> } <nl> op { <nl> list { <nl> s : " NHWC " <nl> s : " NCHW " <nl> + s : " HWNC " <nl> + s : " HWCN " <nl> } <nl> } <nl> } <nl> | Update ops - related pbtxt files . | tensorflow/tensorflow | c6c4116931a42dfafbcece3c4a4791c22120ed3b | 2018-06-23T00:24:17Z |
mmm a / arangod / Aql / ExecutionBlock . h <nl> ppp b / arangod / Aql / ExecutionBlock . h <nl> namespace triagens { <nl> / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / <nl> / / / @ brief static analysis , walker class and information collector <nl> / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / <nl> - <nl> + <nl> struct VarInfo { <nl> unsigned int const depth ; <nl> RegisterId const registerId ; <nl> namespace triagens { <nl> } <nl> } <nl> <nl> - <nl> bool getBlock ( size_t atLeast , size_t atMost ) { <nl> AqlItemBlock * docs = _dependencies [ 0 ] - > getSome ( atLeast , atMost ) ; <nl> if ( docs = = nullptr ) { <nl> namespace triagens { <nl> virtual AqlItemBlock * getOne ( ) { <nl> return getSome ( 1 , 1 ) ; <nl> } <nl> + <nl> + AqlItemBlock * getSome ( size_t atLeast , size_t atMost ) { <nl> + size_t skipped = 0 ; <nl> + AqlItemBlock * result = nullptr ; <nl> + int out = getOrSkipSome ( atLeast , atMost , false , result , skipped ) ; <nl> + if ( out ! = TRI_ERROR_NO_ERROR ) { <nl> + THROW_ARANGO_EXCEPTION ( out ) ; <nl> + } <nl> + return result ; <nl> + } <nl> + <nl> + size_t skipSome ( size_t atLeast , size_t atMost ) { <nl> + size_t skipped = 0 ; <nl> + AqlItemBlock * result = nullptr ; <nl> + int out = getOrSkipSome ( atLeast , atMost , true , result , skipped ) ; <nl> + TRI_ASSERT ( result = = nullptr ) ; <nl> + if ( out ! = TRI_ERROR_NO_ERROR ) { <nl> + THROW_ARANGO_EXCEPTION ( out ) ; <nl> + } <nl> + return skipped ; <nl> + } <nl> <nl> - virtual AqlItemBlock * getSome ( size_t atLeast , <nl> - size_t atMost ) { <nl> + / / skip exactly < number > outputs , returns < true > if _done after <nl> + / / skipping , and < false > otherwise . . . <nl> + bool skip ( size_t number ) { <nl> + size_t skipped = skipSome ( number , number ) ; <nl> + size_t nr = skipped ; <nl> + while ( nr ! = 0 & & skipped < number ) { <nl> + nr = skipSome ( number - skipped , number - skipped ) ; <nl> + skipped + = nr ; <nl> + } <nl> + if ( nr = = 0 ) { <nl> + return true ; <nl> + } <nl> + return ! hasMore ( ) ; <nl> + } <nl> + <nl> + virtual bool hasMore ( ) { <nl> if ( _done ) { <nl> - return nullptr ; <nl> + return false ; <nl> + } <nl> + if ( ! _buffer . empty ( ) ) { <nl> + return true ; <nl> + } <nl> + if ( getBlock ( DefaultBatchSize , DefaultBatchSize ) ) { <nl> + return true ; <nl> + } <nl> + _done = true ; <nl> + return false ; <nl> + } <nl> + <nl> + virtual int64_t count ( ) { <nl> + return _dependencies [ 0 ] - > count ( ) ; <nl> + } <nl> + <nl> + virtual int64_t remaining ( ) { <nl> + int64_t sum = 0 ; <nl> + for ( auto it = _buffer . begin ( ) ; it ! = _buffer . end ( ) ; + + it ) { <nl> + sum + = ( * it ) - > size ( ) ; <nl> + } <nl> + return sum + _dependencies [ 0 ] - > remaining ( ) ; <nl> + } <nl> + <nl> + ExecutionNode const * getPlanNode ( ) { <nl> + return _exeNode ; <nl> + } <nl> + <nl> + <nl> + protected : <nl> + <nl> + / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / <nl> + / / / @ brief generic method to get or skip some . . . <nl> + / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / <nl> + <nl> + virtual int getOrSkipSome ( size_t atLeast , size_t atMost , bool skip , <nl> + AqlItemBlock * & result , size_t & skipped ) { <nl> + if ( _done ) { <nl> + return TRI_ERROR_NO_ERROR ; <nl> } <nl> <nl> / / Here , if _buffer . size ( ) is > 0 then _pos points to a valid place <nl> / / in it . <nl> - size_t total = 0 ; <nl> + <nl> vector < AqlItemBlock * > collector ; <nl> AqlItemBlock * res ; <nl> - while ( total < atLeast ) { <nl> + while ( skipped < atLeast ) { <nl> if ( _buffer . empty ( ) ) { <nl> - if ( ! getBlock ( atLeast - total , std : : max ( atMost - total , DefaultBatchSize ) ) ) { <nl> + if ( ! getBlock ( atLeast - skipped , std : : max ( atMost - skipped , DefaultBatchSize ) ) ) { <nl> _done = true ; <nl> break ; <nl> } <nl> _pos = 0 ; <nl> } <nl> AqlItemBlock * cur = _buffer . front ( ) ; <nl> - if ( cur - > size ( ) - _pos + total > atMost ) { <nl> + if ( cur - > size ( ) - _pos + skipped > atMost ) { <nl> / / The current block is too large for atMost : <nl> - collector . push_back ( cur - > slice ( _pos , _pos + ( atMost - total ) ) ) ; <nl> - _pos + = atMost - total ; <nl> - total = atMost ; <nl> + collector . push_back ( cur - > slice ( _pos , _pos + ( atMost - skipped ) ) ) ; <nl> + _pos + = atMost - skipped ; <nl> + skipped = atMost ; <nl> } <nl> else if ( _pos > 0 ) { <nl> / / The current block fits into our result , but it is already <nl> / / half - eaten : <nl> collector . push_back ( cur - > slice ( _pos , cur - > size ( ) ) ) ; <nl> - total + = cur - > size ( ) - _pos ; <nl> + skipped + = cur - > size ( ) - _pos ; <nl> delete cur ; <nl> _buffer . pop_front ( ) ; <nl> _pos = 0 ; <nl> namespace triagens { <nl> else { <nl> / / The current block fits into our result and is fresh : <nl> collector . push_back ( cur ) ; <nl> - total + = cur - > size ( ) ; <nl> + skipped + = cur - > size ( ) ; <nl> _buffer . pop_front ( ) ; <nl> _pos = 0 ; <nl> } <nl> namespace triagens { <nl> } <nl> } <nl> <nl> - virtual bool hasMore ( ) { <nl> - if ( _done ) { <nl> - return false ; <nl> - } <nl> - if ( ! _buffer . empty ( ) ) { <nl> - return true ; <nl> - } <nl> - if ( getBlock ( DefaultBatchSize , DefaultBatchSize ) ) { <nl> - return true ; <nl> - } <nl> - _done = true ; <nl> - return false ; <nl> - } <nl> - <nl> - / / skip between atLeast and atMost using the same setup as getSome , <nl> - / / returns the number actually skipped . . . <nl> - / / will only return less than atLeast if there aren ' t atLeast many <nl> - / / things to skip overall . <nl> - virtual size_t skipSome ( size_t atLeast , size_t atMost ) { <nl> - size_t skipped = 0 ; <nl> - <nl> - if ( _done ) { <nl> - return skipped ; <nl> - } <nl> - <nl> - while ( skipped < atLeast ) { <nl> - if ( _buffer . empty ( ) ) { <nl> - if ( ! getBlock ( atLeast - skipped , <nl> - std : : max ( atMost - skipped , DefaultBatchSize ) ) ) { <nl> - _done = true ; <nl> - break ; <nl> - } <nl> - _pos = 0 ; <nl> - } <nl> - / / get the current block <nl> - AqlItemBlock * cur = _buffer . front ( ) ; <nl> - <nl> - if ( cur - > size ( ) - _pos + skipped > atMost ) { <nl> - / / eat just enough of the current block . . . <nl> - _pos + = atMost - skipped ; <nl> - skipped = atMost ; <nl> - } <nl> - else { <nl> - / / eat the rest of the current block and then proceed to the next <nl> - / / course if any . . . <nl> - skipped + = cur - > size ( ) - _pos ; <nl> - delete cur ; <nl> - _buffer . pop_front ( ) ; <nl> - _pos = 0 ; <nl> - } <nl> - } <nl> - return skipped ; <nl> - } <nl> - <nl> - / / skip exactly < number > outputs , returns < true > if _done after <nl> - / / skipping , and < false > otherwise . . . <nl> - bool skip ( size_t number ) { <nl> - size_t skipped = skipSome ( number , number ) ; <nl> - size_t nr = skipped ; <nl> - while ( nr ! = 0 & & skipped < number ) { <nl> - nr = skipSome ( number - skipped , number - skipped ) ; <nl> - skipped + = nr ; <nl> - } <nl> - if ( nr = = 0 ) { <nl> - return true ; <nl> - } <nl> - return ! hasMore ( ) ; <nl> - } <nl> - <nl> - virtual int64_t count ( ) { <nl> - return _dependencies [ 0 ] - > count ( ) ; <nl> - } <nl> - <nl> - virtual int64_t remaining ( ) { <nl> - int64_t sum = 0 ; <nl> - for ( auto it = _buffer . begin ( ) ; it ! = _buffer . end ( ) ; + + it ) { <nl> - sum + = ( * it ) - > size ( ) ; <nl> - } <nl> - return sum + _dependencies [ 0 ] - > remaining ( ) ; <nl> - } <nl> - <nl> - ExecutionNode const * getPlanNode ( ) { <nl> - return _exeNode ; <nl> - } <nl> - <nl> / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / <nl> / / / @ brief the transaction for this query <nl> / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / <nl> <nl> - protected : <nl> - <nl> AQL_TRANSACTION_V8 * _trx ; <nl> <nl> / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / <nl> namespace triagens { <nl> / / / @ brief getSome <nl> / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / <nl> <nl> - AqlItemBlock * getSome ( size_t atLeast , size_t atMost ) { <nl> + <nl> + int getOrSkipSome ( size_t atLeast , size_t atMost , bool skip , AqlItemBlock * & result , <nl> + size_t & skipped ) { <nl> + <nl> if ( _done ) { <nl> return nullptr ; <nl> } <nl> | want to inspect previous version of function | arangodb/arangodb | 835c30edbc299d0891d4ae471d9b3733c853d933 | 2014-08-12T08:18:00Z |
new file mode 100644 <nl> index 0000000000 . . bc15bd57ef <nl> mmm / dev / null <nl> ppp b / kokoro / release / csharp / windows / build_nuget . bat <nl> <nl> + @ rem enter repo root <nl> + cd / d % ~ dp0 \ . . \ . . \ . . \ . . <nl> + <nl> + cd csharp \ src <nl> + call build_packages . bat <nl> new file mode 100644 <nl> index 0000000000 . . f508c65bda <nl> mmm / dev / null <nl> ppp b / kokoro / release / csharp / windows / release . cfg <nl> <nl> + # Config file for running tests in Kokoro <nl> + <nl> + # Location of the build script in repository <nl> + build_file : " protobuf / kokoro / release / csharp / windows / build_nuget . bat " <nl> + timeout_mins : 60 <nl> + <nl> + action { <nl> + define_artifacts { <nl> + regex : " * * / * . nupkg " <nl> + } <nl> + } <nl> | Merge pull request from jtattermusch / csharp_artifact_build | protocolbuffers/protobuf | 029dbfd714f1dbeb7c60c93d6949f35232e53221 | 2018-07-12T14:27:23Z |
mmm a / libraries / chain / transaction . cpp <nl> ppp b / libraries / chain / transaction . cpp <nl> flat_set < public_key_type > transaction : : get_signature_keys ( const vector < signatur <nl> using boost : : adaptors : : transformed ; <nl> <nl> constexpr size_t recovery_cache_size = 1000 ; <nl> - static recovery_cache_type recovery_cache ; <nl> + static thread_local recovery_cache_type recovery_cache ; <nl> const digest_type digest = sig_digest ( chain_id , cfd ) ; <nl> <nl> flat_set < public_key_type > recovered_pub_keys ; <nl> | Move recovery_cache to thread_local | EOSIO/eos | f023a235a98f47fc6431a727ad67c22503a10f47 | 2018-10-18T15:41:51Z |
mmm a / src / Parsers / obfuscateQueries . cpp <nl> ppp b / src / Parsers / obfuscateQueries . cpp <nl> <nl> <nl> # include < Parsers / obfuscateQueries . h > <nl> # include < Parsers / Lexer . h > <nl> + # include < Poco / String . h > <nl> # include < Common / Exception . h > <nl> # include < Common / StringUtils / StringUtils . h > <nl> # include < Common / BitHelpers . h > <nl> void obfuscateQueries ( <nl> <nl> if ( token . type = = TokenType : : BareWord ) <nl> { <nl> - if ( keywords . count ( whole_token ) <nl> + std : : string whole_token_uppercase ( whole_token ) ; <nl> + Poco : : toUpperInPlace ( whole_token_uppercase ) ; <nl> + <nl> + if ( keywords . count ( whole_token_uppercase ) <nl> | | known_identifier_func ( whole_token ) ) <nl> { <nl> / / / Keep keywords as is . <nl> | Keywords are case - insensitive | ClickHouse/ClickHouse | f3349c8d138e882793e01f8708b7e0fadb7ad937 | 2020-09-26T02:13:20Z |
mmm a / tools / depends / . gitignore <nl> ppp b / tools / depends / . gitignore <nl> <nl> / autom4te . cache / <nl> / * * / . gitignore <nl> / * * / . installed - * <nl> + <nl> + / native / * / . installed - * <nl> + / native / * / x86 - native / * <nl> + / native / * / x86_64 - linux - gnu - native / * <nl> + / native / * / x86_64 - darwin * . * . * - native / <nl> + / native / * / armeabi - v7a - native / * <nl> + <nl> / target / * / . patched - * <nl> / target / * / . installed - * <nl> - / native / * / . installed - * <nl> / target / * / x86 / * <nl> - / native / * / x86 - native / * <nl> + / target / * / x86_64 - linux - gnu / * <nl> / target / * / armeabi - v7a / * <nl> - / native / * / armeabi - v7a - native / * <nl> / target / * / arm - linux - gnueabihf / * <nl> - / native / * / x86_64 - linux - gnu - native / * <nl> / target / * / arm - linux - androideabi - * / * <nl> - / target / * / x86_64 - linux - gnu / * <nl> / target / * / arm - linux - gnueabi / * <nl> - / native / * / x86_64 - darwin * . * . * - native / <nl> - / target / * / iphoneos * . * _arm * - target / * <nl> + / target / * / macosx * . * _x86_64 - target / <nl> / target / * / macosx * . * _x86_64 - target / * <nl> + / target / * / macosx * . * _i386 - target / <nl> / target / * / macosx * . * _i386 - target / * <nl> / target / * / iphoneos * . * _arm * - target / <nl> - / target / * / macosx * . * _x86_64 - target / <nl> - / target / * / macosx * . * _i386 - target / <nl> + / target / * / iphoneos * . * _arm * - target / * <nl> + / target / * / iphonesimulator * . * _i386 * - target / <nl> + / target / * / iphonesimulator * . * _i386 * - target / * <nl> + / target / * / iphonesimulator * . * _x86_64 * - target / <nl> + / target / * / iphonesimulator * . * _x86_64 * - target / * <nl> + / target / * / appletvos * . * _arm64 * - target / <nl> + / target / * / appletvos * . * _arm64 * - target / * <nl> + / target / * / appletvsimulator * . * _x86_64 * - target / <nl> + / target / * / appletvsimulator * . * _x86_64 * - target / * <nl> + <nl> / pre - depends / <nl> / pre - build - deps / <nl> Toolchain . cmake <nl> config . site <nl> config . site . native <nl> + / native / * / * native / <nl> + / JsonSchemaBuilder / bin / <nl> + / libsquish - native / squish - install / <nl> + / TexturePacker / bin / <nl> + / target / ffmpeg / . ffmpeg - installed <nl> + / target / ffmpeg / ffmpeg - * - * . tar . gz <nl> + / target / ffmpeg / ffmpeg - * - * / <nl> + / tools / depends / target / ffmpeg / ffmpeg - install / <nl> + / tools / depends / target / Toolchain_binaddons . cmake <nl> + / tools / depends / target / config - binaddons . site <nl> mmm a / tools / depends / Makefile . include . in <nl> ppp b / tools / depends / Makefile . include . in <nl> NATIVE_CPPFLAGS = - I @ prefix @ / @ tool_dir @ / include <nl> NATIVE_CXXFLAGS = - I @ prefix @ / @ tool_dir @ / include <nl> <nl> <nl> + ifeq ( $ ( CPU ) , arm64 ) <nl> + export GASPP_FIX_XCODE5 = 1 <nl> + endif <nl> export AUTOM4TE = @ prefix @ / @ tool_dir @ / bin / autom4te <nl> export AUTOMAKE = @ prefix @ / @ tool_dir @ / bin / automake <nl> export AUTOCONF = @ prefix @ / @ tool_dir @ / bin / autoconf <nl> mmm a / tools / depends / README <nl> ppp b / tools / depends / README <nl> <nl> - Temporary readme : <nl> - <nl> Examples : <nl> <nl> - OSX : <nl> - x64 : <nl> - . / configure - - host = x86_64 - apple - darwin # ( defaults chosen ) <nl> - x86 : <nl> + # - Darwin <nl> + # mmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmm - <nl> + <nl> + OSX ( i386 ) : <nl> . / configure - - host = i386 - apple - darwin <nl> <nl> - IOS : <nl> - . / configure - - host = arm - apple - darwin # ( defaults chosen ) <nl> - . / configure - - host = arm - apple - darwin - - with - sdk = 4 . 3 - - prefix = home / foo / xbmc - deps <nl> + OSX ( x86_64 ) : <nl> + . / configure - - host = x86_64 - apple - darwin <nl> + <nl> + IOS ( armv7 ) : <nl> + . / configure - - host = arm - apple - darwin <nl> + <nl> + IOS ( arm64 ) : <nl> + . / configure - - host = arm - apple - darwin - - with - cpu = arm64 <nl> + <nl> + TVOS : <nl> + . / configure - - host = arm - apple - darwin - - with - platform = tvos <nl> + <nl> + You can target the same - - prefix path , each setup will be done in an isolated directory . The <nl> + last configure / make you do is the one used for Kodi / Xcode . <nl> + <nl> + # - Android ( the pathes are examples and have to match those of docs / READM . android ) <nl> + # mmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmm - <nl> <nl> - Android ( the pathes are examples and have to match those of docs / READM . android ) : <nl> arm : <nl> . / configure - - with - tarballs = / opt / xbmc - tarballs - - host = arm - linux - androideabi - - with - sdk - path = / opt / android - sdk - linux - - with - ndk = / opt / android - ndk - r10d - - with - toolchain = / opt / arm - linux - androideabi - 4 . 8 - vanilla / android - 17 - - prefix = / opt / xbmc - depends <nl> + <nl> x86 : <nl> . / configure - - with - tarballs = / opt / xbmc - tarballs - - host = i686 - linux - android - - with - sdk - path = / opt / android - sdk - linux - - with - ndk = / opt / android - ndk - r10d - - with - toolchain = / opt / x86 - linux - 4 . 8 - vanilla / android - 17 - - prefix = / opt / xbmc - depends <nl> <nl> - <nl> + # - Linux <nl> + # mmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmm - <nl> <nl> - Linux : <nl> ARM toolchain ( codesourcery / lenaro / etc ) <nl> . / configure - - with - toolchain = / opt / toolchains / my - example - toolchain / - - prefix = / opt / xbmc - deps - - host = arm - linux - gnueabi <nl> + <nl> RASPBERRY - PI : <nl> PATH = " / opt / rbp - dev / tools / arm - bcm2708 / gcc - linaro - arm - linux - gnueabihf - raspbian / bin : $ PATH " . / configure - - with - platform = raspberry - pi - - host = arm - linux - gnueabihf - - prefix = / opt / xbmc - deps - - with - tarballs = / opt / xbmc - tarballs - - with - toolchain = / opt / rbp - dev / tools / arm - bcm2708 / arm - bcm2708hardfp - linux - gnueabi / arm - bcm2708hardfp - linux - gnueabi / sysroot - - with - firmware = / opt / rbp - dev / firmware - - build = i686 - linux <nl> <nl> Native toolchain <nl> . / configure - - with - toolchain = / usr - - prefix = / opt / xbmc - deps - - host = x86_64 - linux - gnu <nl> <nl> - <nl> + # mmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmm - <nl> + # mmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmm - <nl> Details : <nl> We build a native tools for platforms that do not have the native tools we need . OSX is <nl> the largest builder of native tools as there is not much present . No cmake , no autotools , etc . <nl> mmm a / tools / depends / configure . ac <nl> ppp b / tools / depends / configure . ac <nl> m4_include ( [ . . / . . / m4 / xbmc_arch . m4 ] ) <nl> m4_include ( [ . . / . . / m4 / ax_cxx_compile_stdcxx_11 . m4 ] ) <nl> AX_CXX_COMPILE_STDCXX_11 ( , [ optional ] ) <nl> <nl> + # check for not same cpu value <nl> + AC_DEFUN ( [ MC_CHECK_NOT_CPU ] , <nl> + [ <nl> + AC_MSG_CHECKING ( [ for $ 2 ] ) <nl> + case $ 1 in <nl> + $ 2 * ) <nl> + AC_MSG_ERROR ( error in configure of - - with - cpu = $ 1 ) <nl> + ; ; <nl> + * ) <nl> + AC_MSG_RESULT ( [ $ 1 is not $ 2 ] ) <nl> + esac <nl> + ] ) <nl> + <nl> AC_ARG_WITH ( [ toolchain ] , <nl> [ AS_HELP_STRING ( [ - - with - toolchain ] , <nl> [ specify path to toolchain . Required for android . Defaults to xcode root for darwin , / usr for linux ] ) ] , <nl> fi <nl> <nl> use_host = $ host_alias <nl> <nl> + cross_compiling = " yes " <nl> if test " x $ host " = " x $ build " ; then <nl> - use_host = $ build_cpu - $ build_os <nl> + use_host = $ build_cpu - $ build_os <nl> + cross_compiling = " no " <nl> fi <nl> <nl> deps_dir = $ use_host <nl> tool_dir = $ build_cpu - $ build_os - native <nl> cross_compiling = " yes " <nl> <nl> - if test " x $ host " = " x $ build " ; then <nl> - cross_compiling = " no " <nl> - fi <nl> - <nl> passed_cflags = " $ CFLAGS " <nl> passed_ldflags = " $ LDFLAGS " <nl> passed_cxxflags = " $ CXXFLAGS " <nl> case $ host in <nl> AC_MSG_RESULT ( found xcodebuild at $ use_xcodebuild ) <nl> use_build_toolchain = $ use_xcodepath <nl> <nl> - # darwin builds are always cross <nl> + # darwin builds are always cross <nl> cross_compiling = " yes " <nl> <nl> platform_cflags = " - std = gnu99 - no_compact_linkedit - no - cpp - precomp " <nl> case $ host in <nl> esac <nl> case $ host in <nl> * 86 * - apple - darwin ) <nl> - found_sdk_version = [ ` $ use_xcodebuild - showsdks | sed - E - n ' s / . * macosx ( [ 0 - 9 ] + ) \ . ( [ 0 - 9 ] + ) / \ 1 . \ 2 / p ' | sort - n - t . - k1 , 1 - k2 , 2 | tail - n 1 ` ] <nl> - case $ use_xcode in <nl> - 5 . * | 5 . * . * ) <nl> - use_toolchain = " $ { use_xcodepath } / Toolchains / XcodeDefault . xctoolchain " <nl> - ; ; <nl> + MC_CHECK_NOT_CPU ( [ $ use_cpu ] , " arm " ) <nl> + <nl> + # setup which cpu to use <nl> + case $ host in <nl> + x86_64 - apple - darwin * ) <nl> + if test " x $ use_cpu " = " xauto " ; then <nl> + use_cpu = x86_64 <nl> + fi <nl> + ; ; <nl> + i * 86 - apple - darwin * ) <nl> + if test " x $ use_cpu " = " xauto " ; then <nl> + use_cpu = i386 <nl> + fi <nl> + platform_ldflags + = " - read_only_relocs suppress " <nl> + ; ; <nl> * ) <nl> - use_toolchain = " $ { use_toolchain : - $ use_xcodepath } " <nl> - ; ; <nl> + AC_MSG_ERROR ( error in configure of - - with - arch = $ use_cpu ) <nl> esac <nl> + <nl> + # setup which sdk to use <nl> + found_sdk_version = [ ` $ use_xcodebuild - showsdks | sed - E - n ' s / . * macosx ( [ 0 - 9 ] + ) \ . ( [ 0 - 9 ] + ) / \ 1 . \ 2 / p ' | sort - n - t . - k1 , 1 - k2 , 2 | tail - n 1 ` ] <nl> use_sdk = " $ { use_sdk : - $ found_sdk_version } " <nl> - if test " $ use_cpu " = " armv7 " ; then <nl> - AC_MSG_ERROR ( error in configure of - - with - arch = $ use_cpu ) <nl> - fi <nl> + <nl> + # now that we know which sdk , error check sdk_name <nl> case $ use_sdk in <nl> 10 . 5 ) ; ; <nl> 10 . 6 ) ; ; <nl> case $ host in <nl> AC_MSG_ERROR ( error in configure of - - with - sdk = $ use_sdk ) <nl> esac <nl> sdk_name = macosx $ use_sdk <nl> - use_sdk_path = [ ` $ use_xcodebuild - version - sdk $ sdk_name Path ` ] <nl> + platform_min_version = " macosx - version - min = 10 . 7 " <nl> <nl> - case $ host in <nl> - x86_64 - apple - darwin * ) <nl> - if test " x $ use_cpu " = " xauto " ; then <nl> - use_cpu = x86_64 <nl> - fi <nl> - ; ; <nl> - i * 86 - apple - darwin * ) <nl> - if test " x $ use_cpu " = " xauto " ; then <nl> - use_cpu = i386 <nl> - fi <nl> - ; ; <nl> - * ) <nl> - AC_MSG_ERROR ( error in configure of - - with - arch = $ use_cpu ) <nl> - esac <nl> + use_sdk_path = [ ` $ use_xcodebuild - version - sdk $ sdk_name Path ` ] <nl> platform_os = " osx " <nl> - platform_min_version = macosx - version - min = 10 . 7 <nl> - ; ; <nl> <nl> - arm - apple - darwin * ) <nl> - if test " x $ use_cpu " = " xauto " ; then <nl> - use_cpu = armv7 <nl> - fi <nl> - if test " $ use_cpu " ! = " armv7 " ; then <nl> - AC_MSG_ERROR ( error in configure of - - with - arch = $ use_cpu ) <nl> - fi <nl> - platform_min_version = " iphoneos - version - min = 5 . 1 " <nl> - found_sdk_version = [ ` $ use_xcodebuild - showsdks | grep iphoneos | sort | tail - n 1 | awk ' { print $ 2 } ' ` ] <nl> - use_sdk = " $ { use_sdk : - $ found_sdk_version } " <nl> - sdk_name = iphoneos $ use_sdk <nl> + # find the matching toolchain <nl> case $ use_xcode in <nl> - 3 . * . * | 4 . * | 4 . * . * ) <nl> - use_toolchain = " $ { use_toolchain : - ` $ use_xcodebuild - version - sdk $ sdk_name PlatformPath ` / Developer } " <nl> + 5 . * | 5 . * . * ) <nl> + use_toolchain = " $ { use_xcodepath } / Toolchains / XcodeDefault . xctoolchain " <nl> ; ; <nl> * ) <nl> - use_toolchain = " $ { use_xcodepath } / Toolchains / XcodeDefault . xctoolchain " <nl> + use_toolchain = " $ { use_toolchain : - $ use_xcodepath } " <nl> ; ; <nl> esac <nl> - <nl> + ; ; <nl> + <nl> + arm - apple - darwin * ) <nl> + MC_CHECK_NOT_CPU ( [ $ use_cpu ] , " * 86 " ) <nl> + <nl> + # setup which sdk to use <nl> + if test " $ use_platform " = " tvos " ; then <nl> + # setup which cpu to use <nl> + if test " x $ use_cpu " = " xauto " ; then <nl> + use_cpu = arm64 <nl> + fi <nl> + <nl> + target_platform = appletvos <nl> + <nl> + found_sdk_version = [ ` $ use_xcodebuild - showsdks | grep $ target_platform | sort | tail - n 1 | awk ' { print $ 2 } ' ` ] <nl> + use_sdk = " $ { use_sdk : - $ found_sdk_version } " <nl> + platform_cflags + = " - fembed - bitcode " <nl> + platform_cxxflags + = " - fembed - bitcode " <nl> + sdk_name = $ target_platform $ use_sdk <nl> + platform_min_version = " $ target_platform - version - min = 9 . 0 " <nl> + else <nl> + # setup which cpu to use <nl> + if test " x $ use_cpu " = " xauto " ; then <nl> + use_cpu = armv7 <nl> + fi <nl> + <nl> + target_platform = iphoneos <nl> + <nl> + found_sdk_version = [ ` $ use_xcodebuild - showsdks | grep $ target_platform | sort | tail - n 1 | awk ' { print $ 2 } ' ` ] <nl> + use_sdk = " $ { use_sdk : - $ found_sdk_version } " <nl> + sdk_name = $ target_platform $ use_sdk <nl> + platform_min_version = " $ target_platform - version - min = 5 . 1 " <nl> + fi <nl> case $ use_sdk in <nl> 4 . * ) ; ; <nl> 5 . * ) ; ; <nl> case $ host in <nl> AC_MSG_ERROR ( error in configure of - - with - sdk = $ use_sdk ) <nl> ; ; <nl> esac <nl> - use_sdk_path = [ ` $ use_xcodebuild - version - sdk $ sdk_name | grep ^ Path | awk ' { print $ 2 } ' ` ] <nl> + <nl> + # find the matching toolchain <nl> + case $ use_xcode in <nl> + 3 . * . * | 4 . * | 4 . * . * ) <nl> + use_toolchain = " $ { use_toolchain : - ` $ use_xcodebuild - version - sdk $ sdk_name PlatformPath ` / Developer } " <nl> + ; ; <nl> + * ) <nl> + use_toolchain = " $ { use_xcodepath } / Toolchains / XcodeDefault . xctoolchain " <nl> + ; ; <nl> + esac <nl> + <nl> platform_os = " ios " <nl> - tmp_flags = " - mcpu = cortex - a8 - mfpu = neon - ftree - vectorize - mfloat - abi = softfp - pipe - Wno - trigraphs - fpascal - strings - O3 - Wreturn - type - Wunused - variable - fmessage - length = 0 - gdwarf - 2 " <nl> - platform_cflags + = " $ tmp_flags " <nl> - platform_ldflags + = " - L $ use_sdk_path / usr / lib / system - Wl , - segalign , 4000 " <nl> - platform_cxxflags + = " $ tmp_flags " <nl> + <nl> + if [ ! test " x $ use_cpu " = " xarm64 " ] ; then <nl> + platform_cflags + = " - mcpu = cortex - a8 - mfpu = neon " <nl> + platform_ldflags + = " - Wl , - segalign , 4000 " <nl> + fi <nl> + platform_cflags + = " - ftree - vectorize - pipe - Wno - trigraphs - fpascal - strings - O3 " <nl> + platform_cflags + = " - Wreturn - type - Wunused - variable - fmessage - length = 0 - gdwarf - 2 " <nl> + platform_cflags + = " - Wno - error = implicit - function - declaration " <nl> + platform_ldflags + = " - L $ use_sdk_path / usr / lib / system " <nl> + platform_cxxflags + = " $ cpu_flags " <nl> + use_sdk_path = [ ` $ use_xcodebuild - version - sdk $ sdk_name | grep ^ Path | awk ' { print $ 2 } ' ` ] <nl> ; ; <nl> esac <nl> platform_cflags + = " - arch $ use_cpu - m $ platform_min_version " <nl> - platform_ldflags + = " - arch $ use_cpu - m $ platform_min_version - isysroot $ use_sdk_path " <nl> + platform_ldflags + = " - arch $ use_cpu - m $ platform_min_version - isysroot $ use_sdk_path - stdlib = libc + + " <nl> platform_cxxflags + = " - arch $ use_cpu - m $ platform_min_version - std = c + + 11 - stdlib = libc + + " <nl> platform_includes = " - isysroot $ use_sdk_path " <nl> deps_dir = $ sdk_name " _ " $ use_cpu - target <nl> if test " $ platform_os " = = " android " ; then <nl> fi <nl> <nl> if test " $ platform_os " = = " ios " ; then <nl> - simulator_sdk_path = [ ` $ use_xcodebuild - version - sdk iphonesimulator $ use_sdk | grep ^ Path | awk ' { print $ 2 } ' ` ] <nl> + if test " $ use_platform " = " tvos " ; then <nl> + simulator_sdk_path = [ ` $ use_xcodebuild - version - sdk appletvsimulator $ use_sdk | grep ^ Path | awk ' { print $ 2 } ' ` ] <nl> + else <nl> + simulator_sdk_path = [ ` $ use_xcodebuild - version - sdk iphonesimulator $ use_sdk | grep ^ Path | awk ' { print $ 2 } ' ` ] <nl> + fi <nl> cp - vf $ simulator_sdk_path / usr / include / crt_externs . h $ prefix / $ deps_dir / include <nl> fi <nl> + echo - e " use simulator : \ t $ use_simulator " <nl> <nl> if test " x $ has_localeconv " = = " xno " & & test " $ platform_os " = = " android " ; then <nl> cp - vf target / android - libc - replacements / locale . h $ prefix / $ deps_dir / include / <nl> mmm a / tools / depends / native / TexturePacker / Makefile <nl> ppp b / tools / depends / native / TexturePacker / Makefile <nl> $ ( APP ) : $ ( PLATFORM ) <nl> # TEMP workaround for skins : create legacy link . Remove me when skins are fixed <nl> @ mkdir - p $ ( XBMCROOT ) / tools / TexturePacker <nl> @ [ - f $ ( XBMCROOT ) / tools / TexturePacker / TexturePacker ] & & rm $ ( XBMCROOT ) / tools / TexturePacker / TexturePacker | | : <nl> - @ ln - s $ ( APPBIN ) $ ( XBMCROOT ) / tools / TexturePacker / TexturePacker <nl> + @ ln - sf $ ( APPBIN ) $ ( XBMCROOT ) / tools / TexturePacker / TexturePacker <nl> @ echo " all : " > $ ( XBMCROOT ) / tools / TexturePacker / Makefile <nl> @ echo " \ t @ echo " WARNING : use of tools / TexturePacker / TexturePacker is deprecated , please update your skins Makefile " " > > $ ( XBMCROOT ) / tools / TexturePacker / Makefile <nl> <nl> mmm a / tools / depends / target / Makefile <nl> ppp b / tools / depends / target / Makefile <nl> endif <nl> <nl> ifeq ( $ ( OS ) , ios ) <nl> EXCLUDED_DEPENDS = libcec libusb <nl> + ifeq ( $ ( TARGET_PLATFORM ) , appletvos ) <nl> + DEPENDS + = boblight <nl> + endif <nl> endif <nl> <nl> ifeq ( $ ( OS ) , osx ) <nl> python27 : expat gettext libxml2 sqlite3 openssl libffi <nl> libcdio : $ ( ICONV ) <nl> libplist : libxml2 $ ( ZLIB ) <nl> libbluray : $ ( ICONV ) libxml2 <nl> - libssh : openssl $ ( ZLIB ) <nl> + libssh : libgcrypt openssl $ ( ZLIB ) <nl> mysql : openssl <nl> libzip : $ ( ZLIB ) <nl> libpng : $ ( ZLIB ) <nl> new file mode 100644 <nl> index 000000000000 . . 646abeab9e41 <nl> mmm / dev / null <nl> ppp b / tools / depends / target / boblight / 03 - fixtvos . patch <nl> <nl> + diff - uPr appletvos9 . 0_arm64 - target / src / util / daemonize . cpp works / src / util / daemonize . cpp <nl> + mmm src / util / daemonize . cpp 2015 - 12 - 18 18 : 20 : 26 . 000000000 + 0100 <nl> ppp + src / util / daemonize . cpp 2015 - 12 - 13 16 : 15 : 19 . 000000000 + 0100 <nl> + <nl> + void Daemonize ( ) <nl> + { <nl> + / / fork a child process <nl> + - pid_t pid = fork ( ) ; <nl> + + pid_t pid = - 1 ; / / fork ( ) ; <nl> + if ( pid = = - 1 ) <nl> + fprintf ( stderr , " fork ( ) : % s " , GetErrno ( ) . c_str ( ) ) ; <nl> + else if ( pid > 0 ) <nl> + diff - uPr appletvos9 . 0_arm64 - target / src / util / tcpsocket . cpp works / src / util / tcpsocket . cpp <nl> + mmm src / util / tcpsocket . cpp 2014 - 11 - 27 19 : 26 : 33 . 000000000 + 0100 <nl> ppp + src / util / tcpsocket . cpp 2015 - 12 - 18 18 : 19 : 24 . 000000000 + 0100 <nl> + <nl> + # include " tcpsocket . h " <nl> + # include " misc . h " <nl> + <nl> + - using namespace std ; <nl> + - <nl> + void CTcpData : : SetData ( uint8_t * data , int size , bool append ) <nl> + { <nl> + CopyData ( reinterpret_cast < char * > ( data ) , size , append ) ; <nl> + diff - uPr appletvos9 . 0_arm64 - target / src / device / deviceltbl . cpp works / src / device / deviceltbl . cpp <nl> + mmm src / device / deviceltbl . cpp 2014 - 11 - 27 19 : 26 : 33 . 000000000 + 0100 <nl> ppp + src / device / deviceltbl . cpp 2015 - 12 - 13 16 : 14 : 49 . 000000000 + 0100 <nl> + <nl> + <nl> + bool CDeviceLtbl : : WriteOutput ( ) <nl> + { <nl> + - uint8_t prefix [ 4 ] = { 0x55 , 0xAA , 0x00 , m_channels . size ( ) } ; <nl> + + uint8_t prefix [ 4 ] = { 0x55 , 0xAA , 0x00 , ( uint8_t ) m_channels . size ( ) } ; <nl> + <nl> + / / get the channel values from the clienshandler <nl> + int64_t now = GetTimeUs ( ) ; <nl> + <nl> + uint8_t buff [ 512 ] ; <nl> + uint8_t prefix [ 2 ] = { 0x55 , 0xAA } ; <nl> + uint8_t open [ 2 ] = { 0x83 , 0x00 } ; <nl> + - uint8_t getvalues [ 4 ] = { 0x81 , 0x02 , 0x00 , m_channels . size ( ) } ; <nl> + + uint8_t getvalues [ 4 ] = { 0x81 , 0x02 , 0x00 , ( uint8_t ) m_channels . size ( ) } ; <nl> + <nl> + if ( m_isopened ) <nl> + return true ; / / nothing to do here <nl> mmm a / tools / depends / target / boblight / Makefile <nl> ppp b / tools / depends / target / boblight / Makefile <nl> $ ( PLATFORM ) : $ ( TARBALLS_LOCATION ) / $ ( ARCHIVE ) $ ( DEPS ) <nl> cd $ ( PLATFORM ) ; patch - p0 < . . / 02 - fixandroid . patch <nl> cd $ ( PLATFORM ) ; autoreconf - vif <nl> cd $ ( PLATFORM ) ; $ ( CONFIGURE ) <nl> + ifeq ( $ ( CPU ) , arm64 ) <nl> + cd $ ( PLATFORM ) ; patch - p0 < . . / 03 - fixtvos . patch <nl> + cd $ ( PLATFORM ) ; sed - ie " s | - bind_at_load | | " . / libtool <nl> + cd $ ( PLATFORM ) ; sed - ie " s | - bind_at_load | | " . / ltmain . sh <nl> + endif <nl> <nl> $ ( LIBDYLIB ) : $ ( PLATFORM ) <nl> $ ( MAKE ) - C $ ( PLATFORM ) <nl> ifeq ( $ ( OS ) , android ) <nl> $ ( RPL ) - e " libboblight . so . 0 " " libboblight . so \ x00 \ x00 " $ ( PLATFORM ) / src / . libs / libboblight . so <nl> - $ ( READELF ) - - dynamic $ ( PLATFORM ) / src / . libs / libboblight . so | grep ibrary <nl> endif <nl> + ifeq ( $ ( OS ) , ios ) <nl> + ifeq ( $ ( TARGET_PLATFORM ) , appletvos ) <nl> + # deploy into source tree for tvos - we distribute libboblight with the bundle . . . <nl> + cp $ ( PLATFORM ) / src / . libs / libboblight . 0 . dylib $ ( XBMCROOT ) / system / libboblight - tvos . 0 . dylib <nl> + endif <nl> + else <nl> echo " libboblight isn ' t a dependency of XBMC and won ' t be installed " <nl> + endif <nl> touch $ @ <nl> clean : <nl> $ ( MAKE ) - C $ ( PLATFORM ) clean <nl> mmm a / tools / depends / target / config . site . in <nl> ppp b / tools / depends / target / config . site . in <nl> libreplace_cv_HAVE_GETADDRINFO = no <nl> if test " $ { PACKAGE_NAME } " = " Samba " - a " @ platform_os @ " = " ios " ; then <nl> # disable python support <nl> export PYTHON_VER = 0 . 0 <nl> - # ios / osx - 10 . 6 issue with collision of _MD5 exported from a system lib <nl> - export LDFLAGS = " $ { LDFLAGS } - Wl , - unexported_symbol , _MD5 * - lc " <nl> + if test " @ use_cpu @ " ! = " arm64 " ; then <nl> + # ios / osx - 10 . 6 issue with collision of _MD5 exported from a system lib <nl> + export LDFLAGS = " $ { LDFLAGS } - Wl , - unexported_symbol , _MD5 * - lc " <nl> + fi <nl> + samba_cv_HAVE_IFACE_GETIFADDRS = yes <nl> fi <nl> <nl> if test " $ { PACKAGE_NAME } " = " Samba " - a " @ platform_os @ " = " osx " ; then <nl> if test " $ { PACKAGE_NAME } " = " Samba " - a " @ platform_os @ " = " osx " ; then <nl> ac_cv_header_execinfo_h = no <nl> # fixes crash on 10 . 6 if xbmc is built using 10 . 7 SDK with 10 . 6 min <nl> ac_cv_func_vdprintf = no <nl> + samba_cv_HAVE_IFACE_GETIFADDRS = yes <nl> fi <nl> <nl> if test " @ platform_os @ " = " android " ; then <nl> if test " @ platform_os @ " = " ios " ; then <nl> export CPP = " @ use_toolchain @ / usr / bin / clang - E " <nl> ; ; <nl> esac <nl> + <nl> + if test " @ use_cpu @ " = " arm64 " ; then <nl> + host = aarch64 - apple - darwin <nl> + host_alias = aarch64 - apple - darwin <nl> + fi <nl> + <nl> unset AS <nl> unset CCAS <nl> fi <nl> mmm a / tools / depends / target / curl / Makefile <nl> ppp b / tools / depends / target / curl / Makefile <nl> SOURCE = $ ( LIBNAME ) - $ ( VERSION ) <nl> ARCHIVE = $ ( SOURCE ) . tar . bz2 <nl> # configuration settings <nl> CONFIGURE = cp - f $ ( CONFIG_SUB ) $ ( CONFIG_GUESS ) . ; \ <nl> - . / configure - - prefix = $ ( PREFIX ) - - without - libssh2 \ <nl> + . / configure - - prefix = $ ( PREFIX ) \ <nl> + - - without - libssh2 - - disable - ntlm - wb <nl> <nl> LIBDYLIB = $ ( PLATFORM ) / lib / . libs / lib $ ( LIBNAME ) . a <nl> <nl> mmm a / tools / depends / target / ffmpeg / Makefile <nl> ppp b / tools / depends / target / ffmpeg / Makefile <nl> ifeq ( $ ( OS ) , android ) <nl> ffmpg_config + = - - target - os = linux <nl> endif <nl> ifeq ( $ ( OS ) , ios ) <nl> - ffmpg_config + = - - cpu = cortex - a8 - - yasmexe = $ ( NATIVEPREFIX ) / bin / yasm <nl> - ffmpg_config + = - - disable - decoder = mpeg_xvmc - - enable - vda - - disable - crystalhd <nl> + ifneq ( $ ( CPU ) , arm64 ) <nl> + ffmpg_config + = - - cpu = cortex - a8 <nl> + endif <nl> + ffmpg_config + = - - yasmexe = $ ( NATIVEPREFIX ) / bin / yasm <nl> + ffmpg_config + = - - disable - decoder = mpeg_xvmc - - disable - vda - - disable - crystalhd <nl> ffmpg_config + = - - target - os = darwin <nl> endif <nl> ifeq ( $ ( OS ) , osx ) <nl> mmm a / tools / depends / target / fontconfig / Makefile <nl> ppp b / tools / depends / target / fontconfig / Makefile <nl> <nl> include . . / . . / Makefile . include <nl> - DEPS = . . / . . / Makefile . include lconv . patch Makefile <nl> + DEPS = . . / . . / Makefile . include lconv . patch fix - aarch64_atomics . patch Makefile <nl> <nl> # lib name , version <nl> LIBNAME = fontconfig <nl> $ ( TARBALLS_LOCATION ) / $ ( ARCHIVE ) : <nl> $ ( PLATFORM ) : $ ( TARBALLS_LOCATION ) / $ ( ARCHIVE ) $ ( DEPS ) <nl> rm - rf $ ( PLATFORM ) / * ; mkdir - p $ ( PLATFORM ) <nl> cd $ ( PLATFORM ) ; $ ( ARCHIVE_TOOL ) $ ( ARCHIVE_TOOL_FLAGS ) $ ( TARBALLS_LOCATION ) / $ ( ARCHIVE ) <nl> - cd $ ( PLATFORM ) ; patch - p1 < . . / lconv . patch <nl> + cd $ ( PLATFORM ) ; patch - p1 < . . / lconv . patch <nl> + cd $ ( PLATFORM ) ; patch - p1 < . . / fix - aarch64_atomics . patch <nl> cd $ ( PLATFORM ) ; $ ( AUTORECONF ) - vif <nl> cd $ ( PLATFORM ) ; $ ( CONFIGURE ) <nl> <nl> new file mode 100644 <nl> index 000000000000 . . 1d95acda1663 <nl> mmm / dev / null <nl> ppp b / tools / depends / target / fontconfig / fix - aarch64_atomics . patch <nl> <nl> + mmm a / src / fcatomic . h - org 2015 - 10 - 31 21 : 15 : 56 . 000000000 - 0400 <nl> ppp + b / src / fcatomic . h 2015 - 10 - 31 21 : 19 : 10 . 000000000 - 0400 <nl> + typedef LONG fc_atomic_int_t ; <nl> + # elif ! defined ( FC_NO_MT ) & & defined ( __APPLE__ ) <nl> + <nl> + # include < libkern / OSAtomic . h > <nl> + - # ifdef __MAC_OS_X_MIN_REQUIRED <nl> + # include < AvailabilityMacros . h > <nl> + - # elif defined ( __IPHONE_OS_MIN_REQUIRED ) <nl> + - # include < Availability . h > <nl> + - # endif <nl> + <nl> + typedef int fc_atomic_int_t ; <nl> + # define fc_atomic_int_add ( AI , V ) ( OSAtomicAdd32Barrier ( ( V ) , & ( AI ) ) - ( V ) ) <nl> + <nl> + # define fc_atomic_ptr_get ( P ) ( OSMemoryBarrier ( ) , ( void * ) * ( P ) ) <nl> + # if ( MAC_OS_X_VERSION_MIN_REQUIRED > MAC_OS_X_VERSION_10_4 | | __IPHONE_VERSION_MIN_REQUIRED > = 20100 ) <nl> + + # if __aarch64__ <nl> + + # define fc_atomic_ptr_cmpexch ( P , O , N ) OSAtomicCompareAndSwap64Barrier ( ( int64_t ) ( O ) , ( int64_t ) ( N ) , ( int64_t * ) ( P ) ) <nl> + + # else <nl> + # define fc_atomic_ptr_cmpexch ( P , O , N ) OSAtomicCompareAndSwapPtrBarrier ( ( void * ) ( O ) , ( void * ) ( N ) , ( void * * ) ( P ) ) <nl> + + # endif <nl> + # else <nl> + # if __ppc64__ | | __x86_64__ <nl> + # define fc_atomic_ptr_cmpexch ( P , O , N ) OSAtomicCompareAndSwap64Barrier ( ( int64_t ) ( O ) , ( int64_t ) ( N ) , ( int64_t * ) ( P ) ) <nl> + <nl> mmm a / tools / depends / target / gnutls / Makefile <nl> ppp b / tools / depends / target / gnutls / Makefile <nl> ARCHIVE = $ ( SOURCE ) . tar . xz <nl> ifeq ( darwin , $ ( findstring darwin , $ ( HOST ) ) ) <nl> # darwins tar doesn ' t know about xz - so we need our native version of tar here <nl> ARCHIVE_TOOL = $ ( ARCHIVE_TOOL_NATIVE ) <nl> + CONFIGURE_HACKS = ac_cv_func_vfork_works = no <nl> + CONFIGURE_HACKS + = ac_cv_func_fork = no <nl> endif <nl> <nl> # configuration settings <nl> CONFIGURE = cp - f $ ( CONFIG_SUB ) $ ( CONFIG_GUESS ) . ; \ <nl> - . / configure - - prefix = $ ( PREFIX ) - - disable - shared - - without - p11 - kit - - disable - nls - - enable - local - libopts - - disable - doc <nl> + . / configure - - prefix = $ ( PREFIX ) - - disable - shared - - without - p11 - kit - - disable - nls - - enable - local - libopts - - disable - doc - - disable - tests $ ( CONFIGURE_HACKS ) <nl> <nl> LIBDYLIB = $ ( PLATFORM ) / lib / . libs / lib $ ( LIBNAME ) . a <nl> <nl> deleted file mode 100644 <nl> index 6a1aeb38d851 . . 000000000000 <nl> mmm a / tools / depends / target / libffi / 01_ios_arm_align_fix . patch <nl> ppp / dev / null <nl> <nl> - diff - ru iphoneos5 . 1_armv7 - target / src / arm / sysv . S iphoneos5 . 1_armv7 - target . patched / src / arm / sysv . S <nl> mmm - src / arm / sysv . S 2012 - 04 - 12 10 : 46 : 06 . 000000000 + 0800 <nl> - ppp src / arm / sysv . S 2013 - 03 - 15 09 : 43 : 06 . 000000000 + 0800 <nl> - <nl> - # if defined ( __thumb__ ) & & ! defined ( __THUMB_INTERWORK__ ) <nl> - . macro ARM_FUNC_START name <nl> - . text <nl> - - . align 0 <nl> - + . align 2 <nl> - . thumb <nl> - . thumb_func <nl> - # ifdef __APPLE__ <nl> - <nl> - # else <nl> - . macro ARM_FUNC_START name <nl> - . text <nl> - - . align 0 <nl> - + . align 2 <nl> - . arm <nl> - # ifdef __APPLE__ <nl> - ENTRY ( $ 0 ) <nl> mmm a / tools / depends / target / libffi / Makefile <nl> ppp b / tools / depends / target / libffi / Makefile <nl> DEPS = . . / . . / Makefile . include Makefile <nl> <nl> # lib name , version <nl> LIBNAME = libffi <nl> - VERSION = 3 . 0 . 11 <nl> + VERSION = 3 . 2 . 1 <nl> SOURCE = $ ( LIBNAME ) - $ ( VERSION ) <nl> ARCHIVE = $ ( SOURCE ) . tar . gz <nl> <nl> # configuration settings <nl> CONFIGURE = . / configure - - prefix = $ ( PREFIX ) - - disable - shared - - disable - builddir <nl> ifeq ( $ ( OS ) , ios ) <nl> + ifneq ( $ ( CPU ) , arm64 ) <nl> CONFIGURE + = CCASFLAGS = - no - integrated - as <nl> endif <nl> + endif <nl> <nl> <nl> LIBDYLIB = $ ( PLATFORM ) / . libs / $ ( LIBNAME ) . a <nl> $ ( TARBALLS_LOCATION ) / $ ( ARCHIVE ) : <nl> $ ( PLATFORM ) : $ ( TARBALLS_LOCATION ) / $ ( ARCHIVE ) $ ( DEPS ) <nl> rm - rf $ ( PLATFORM ) ; mkdir - p $ ( PLATFORM ) <nl> cd $ ( PLATFORM ) ; $ ( ARCHIVE_TOOL ) $ ( ARCHIVE_TOOL_FLAGS ) $ ( TARBALLS_LOCATION ) / $ ( ARCHIVE ) <nl> - cd $ ( PLATFORM ) ; patch - p0 < . . / 01_ios_arm_align_fix . patch <nl> cd $ ( PLATFORM ) ; $ ( CONFIGURE ) <nl> <nl> $ ( LIBDYLIB ) : $ ( PLATFORM ) <nl> mmm a / tools / depends / target / libgcrypt / Makefile <nl> ppp b / tools / depends / target / libgcrypt / Makefile <nl> VERSION = 1 . 6 . 2 <nl> SOURCE = $ ( LIBNAME ) - $ ( VERSION ) <nl> ARCHIVE = $ ( SOURCE ) . tar . bz2 <nl> <nl> + ifeq ( $ ( OS ) , osx ) <nl> + CONFIGURE_FLAGS + = - - disable - asm - - disable - avx - support - - disable - avx2 - support <nl> + endif <nl> + ifeq ( $ ( CPU ) , arm64 ) <nl> + CONFIGURE_FLAGS + = - - disable - asm - - disable - neon - support <nl> + endif <nl> + <nl> # configuration settings <nl> CONFIGURE = cp - f $ ( CONFIG_SUB ) $ ( CONFIG_GUESS ) . ; \ <nl> . / configure - - prefix = $ ( PREFIX ) - - disable - shared \ <nl> - <nl> - ifeq ( $ ( OS ) , osx ) <nl> - CONFIGURE + = - - disable - asm - - disable - avx - support - - disable - avx2 - support <nl> - endif <nl> + $ ( CONFIGURE_FLAGS ) <nl> <nl> LIBDYLIB = $ ( PLATFORM ) / src / . libs / $ ( LIBNAME ) . a <nl> <nl> $ ( PLATFORM ) : $ ( TARBALLS_LOCATION ) / $ ( ARCHIVE ) $ ( DEPS ) <nl> # cd $ ( PLATFORM ) ; patch - p0 < . . / 02 - armasm . patch <nl> cd $ ( PLATFORM ) ; patch - p0 < . . / 03 - gcrypt - android - select . patch <nl> # cd $ ( PLATFORM ) ; patch - p0 < . . / 04 - oflagmunging . patch <nl> + # do not build the tests or docs <nl> + sed - ie " s | doc tests | | " " $ ( PLATFORM ) / Makefile . am " <nl> + sed - ie " s | ! defined ( __arm__ ) | ! defined ( __arm__ ) \ & \ & ! defined ( __arm64__ ) | " " $ ( PLATFORM ) / src / hwf - arm . c " <nl> + cd $ ( PLATFORM ) ; $ ( AUTORECONF ) - vif <nl> cd $ ( PLATFORM ) ; $ ( CONFIGURE ) <nl> <nl> $ ( LIBDYLIB ) : $ ( PLATFORM ) <nl> mmm a / tools / depends / target / libssh / Makefile <nl> ppp b / tools / depends / target / libssh / Makefile <nl> ARCHIVE = $ ( SOURCE ) . tar . gz <nl> <nl> LIBDYLIB = $ ( PLATFORM ) / build / src / $ ( LIBNAME ) . a <nl> <nl> + ifeq ( $ ( OS ) , ios ) <nl> + # _tlv_bootstrap aka __thread is private under ios / tvos . That is thread local storage , so disable it <nl> + CMAKE_EXTRAFLAGS = - DHAVE_GCC_THREAD_LOCAL_STORAGE = 0 <nl> + endif <nl> + <nl> all : . installed - $ ( PLATFORM ) <nl> <nl> $ ( TARBALLS_LOCATION ) / $ ( ARCHIVE ) : <nl> $ ( PLATFORM ) : $ ( TARBALLS_LOCATION ) / $ ( ARCHIVE ) $ ( DEPS ) <nl> cd $ ( PLATFORM ) ; patch - p0 < . . / md5 . patch <nl> cd $ ( PLATFORM ) ; patch - p1 < . . / darwin . patch <nl> cd $ ( PLATFORM ) ; patch - p0 < . . / fix - gcc - 5 - compile . patch <nl> + ifeq ( $ ( OS ) , ios ) <nl> + cd $ ( PLATFORM ) ; patch - p1 < . . / darwin - no - fork . patch <nl> + endif <nl> sed - ie " s | - fstack - protector | - fno - stack - protector | " " $ ( PLATFORM ) / cmake / Modules / DefineCompilerFlags . cmake " <nl> sed - ie " s | add_subdirectory ( examples ) | | " " $ ( PLATFORM ) / CMakeLists . txt " <nl> - cd $ ( PLATFORM ) / build ; $ ( CMAKE ) - DWITH_STATIC_LIB = 1 - DWITH_EXAMPLES = 0 - DTHREADS_PTHREAD_ARG = 0 - DWITH_GSSAPI = 0 VERBOSE = 1 . . <nl> + cd $ ( PLATFORM ) / build ; $ ( CMAKE ) - DWITH_STATIC_LIB = 1 - DWITH_EXAMPLES = 0 - DTHREADS_PTHREAD_ARG = 0 $ ( CMAKE_EXTRAFLAGS ) - DWITH_GSSAPI = 0 VERBOSE = 1 . . <nl> <nl> $ ( LIBDYLIB ) : $ ( PLATFORM ) <nl> make - j 1 - C $ ( PLATFORM ) / build <nl> new file mode 100644 <nl> index 000000000000 . . f3bdf8844ae9 <nl> mmm / dev / null <nl> ppp b / tools / depends / target / libssh / darwin - no - fork . patch <nl> <nl> + mmm a / src / socket . c - org 2015 - 09 - 20 17 : 19 : 13 . 000000000 - 0400 <nl> ppp + b / src / socket . c 2015 - 09 - 20 17 : 19 : 56 . 000000000 - 0400 <nl> + int ssh_socket_connect ( ssh_socket s , con <nl> + return SSH_OK ; <nl> + } <nl> + <nl> + - # ifndef _WIN32 <nl> + + # if 0 <nl> + / * * <nl> + * @ internal <nl> + * @ brief executes a command and redirect input and outputs <nl> + mmm a / include / libssh / socket . h - org 2015 - 09 - 20 17 : 19 : 28 . 000000000 - 0400 <nl> ppp + b / include / libssh / socket . h 2015 - 09 - 20 17 : 20 : 49 . 000000000 - 0400 <nl> + void ssh_socket_set_fd ( ssh_socket s , soc <nl> + socket_t ssh_socket_get_fd_in ( ssh_socket s ) ; <nl> + # ifndef _WIN32 <nl> + int ssh_socket_unix ( ssh_socket s , const char * path ) ; <nl> + + # if 0 <nl> + void ssh_execute_command ( const char * command , socket_t in , socket_t out ) ; <nl> + int ssh_socket_connect_proxycommand ( ssh_socket s , const char * command ) ; <nl> + # endif <nl> + + # endif <nl> + void ssh_socket_close ( ssh_socket s ) ; <nl> + int ssh_socket_write ( ssh_socket s , const void * buffer , int len ) ; <nl> + int ssh_socket_is_open ( ssh_socket s ) ; <nl> + mmm a / src / client . c - org 2015 - 09 - 20 17 : 19 : 37 . 000000000 - 0400 <nl> ppp + b / src / client . c 2015 - 09 - 20 17 : 20 : 04 . 000000000 - 0400 <nl> + int ssh_connect ( ssh_session session ) { <nl> + session - > session_state = SSH_SESSION_STATE_SOCKET_CONNECTED ; <nl> + ssh_socket_set_fd ( session - > socket , session - > opts . fd ) ; <nl> + ret = SSH_OK ; <nl> + - # ifndef _WIN32 <nl> + + # if 0 <nl> + } else if ( session - > opts . ProxyCommand ! = NULL ) { <nl> + ret = ssh_socket_connect_proxycommand ( session - > socket , <nl> + session - > opts . ProxyCommand ) ; <nl> mmm a / tools / depends / target / libvorbis / Makefile <nl> ppp b / tools / depends / target / libvorbis / Makefile <nl> $ ( PLATFORM ) : $ ( TARBALLS_LOCATION ) / $ ( ARCHIVE ) $ ( DEPS ) <nl> rm - rf $ ( PLATFORM ) / * ; mkdir - p $ ( PLATFORM ) <nl> cd $ ( PLATFORM ) ; $ ( ARCHIVE_TOOL ) $ ( ARCHIVE_TOOL_FLAGS ) $ ( TARBALLS_LOCATION ) / $ ( ARCHIVE ) <nl> sed - ie " s | SUBDIRS = m4 include vq lib examples test doc | SUBDIRS = m4 include lib | " " $ ( PLATFORM ) / Makefile . in " <nl> + ifeq ( $ ( CPU ) , arm64 ) <nl> + sed - ie " s | - force_cpusubtype_ALL | | " " $ ( PLATFORM ) / Configure " <nl> + sed - ie " s | - force_cpusubtype_ALL | | " " $ ( PLATFORM ) / Makefile . in " <nl> + endif <nl> cd $ ( PLATFORM ) ; $ ( CONFIGURE ) <nl> <nl> $ ( LIBDYLIB ) : $ ( PLATFORM ) <nl> new file mode 100644 <nl> index 000000000000 . . ae037d8e541c <nl> mmm / dev / null <nl> ppp b / tools / depends / target / mysql / 05 - mysqlclient - ios64 . patch <nl> <nl> + mmm a / include / my_global . h 2015 - 09 - 19 16 : 09 : 00 . 000000000 - 0400 <nl> ppp + b / include / my_global . h - org 2015 - 09 - 19 16 : 05 : 28 . 000000000 - 0400 <nl> + <nl> + # if defined ( __i386__ ) | | defined ( __ppc__ ) | | defined ( __arm__ ) <nl> + # define SIZEOF_CHARP 4 <nl> + # define SIZEOF_LONG 4 <nl> + - # elif defined ( __x86_64__ ) | | defined ( __ppc64__ ) <nl> + + # elif defined ( __x86_64__ ) | | defined ( __ppc64__ ) | | defined ( __arm64__ ) <nl> + # define SIZEOF_CHARP 8 <nl> + # define SIZEOF_LONG 8 <nl> + # else <nl> mmm a / tools / depends / target / mysql / Makefile <nl> ppp b / tools / depends / target / mysql / Makefile <nl> <nl> include . . / . . / Makefile . include <nl> - DEPS = . . / . . / Makefile . include 01 - mysqlclient - cross - compile . patch 02 - mysqlclient - ios . patch 03 - mysqlclient - android . patch Makefile <nl> + DEPS = . . / . . / Makefile . include 01 - mysqlclient - cross - compile . patch 02 - mysqlclient - ios . patch 03 - mysqlclient - android . patch 04 - strnlen . patch 05 - mysqlclient - ios64 . patch Makefile <nl> <nl> # lib name , version <nl> LIBNAME = mysql <nl> $ ( PLATFORM ) : $ ( TARBALLS_LOCATION ) / $ ( ARCHIVE ) $ ( DEPS ) <nl> cd $ ( PLATFORM ) ; patch - Np1 - i . . / 02 - mysqlclient - ios . patch <nl> cd $ ( PLATFORM ) ; patch - Np1 - i . . / 03 - mysqlclient - android . patch <nl> cd $ ( PLATFORM ) ; patch - p0 < . . / 04 - strnlen . patch <nl> + cd $ ( PLATFORM ) ; patch - p1 < . . / 05 - mysqlclient - ios64 . patch <nl> cd $ ( PLATFORM ) ; autoconf <nl> cd $ ( PLATFORM ) ; $ ( CONFIGURE ) <nl> <nl> mmm a / tools / depends / target / nettle / Makefile <nl> ppp b / tools / depends / target / nettle / Makefile <nl> SOURCE = $ ( LIBNAME ) - $ ( VERSION ) <nl> ARCHIVE = $ ( SOURCE ) . tar . gz <nl> <nl> ifeq ( $ ( OS ) , ios ) <nl> - ifneq ( , $ ( findstring 3 . , $ ( XCODE_VERSION ) ) ) <nl> - CONFIGURE_FLAGS = - disable - assembler <nl> - endif <nl> + CONFIGURE_FLAGS = - disable - assembler <nl> endif <nl> <nl> # configuration settings <nl> mmm a / tools / depends / target / openssl / Makefile <nl> ppp b / tools / depends / target / openssl / Makefile <nl> ifeq ( $ ( OS ) , android ) <nl> endif <nl> ifeq ( $ ( OS ) , ios ) <nl> # No darwin - arm - cc so use darwin - i386 - cc and patch files after configure <nl> - CONFIGURE = . / Configure darwin - i386 - cc zlib no - asm no - krb5 shared - - openssldir = $ ( PREFIX ) <nl> + CONFIGURE = . / Configure darwin - i386 - cc zlib no - asm no - krb5 - - openssldir = $ ( PREFIX ) <nl> endif <nl> ifeq ( $ ( OS ) , osx ) <nl> ifeq ( $ ( CPU ) , x86_64 ) <nl> $ ( PLATFORM ) : $ ( TARBALLS_LOCATION ) / $ ( ARCHIVE ) $ ( DEPS ) <nl> fi <nl> if test " $ ( OS ) " = " ios " ; then \ <nl> sed - ie " s | CFLAG = | CFLAG = $ ( CFLAGS ) | " " $ ( PLATFORM ) / Makefile " ; \ <nl> - sed - ie " s | - arch i386 | - arch armv7 | " " $ ( PLATFORM ) / Makefile " ; \ <nl> + sed - ie " s | - arch i386 | - arch $ ( CPU ) | " " $ ( PLATFORM ) / Makefile " ; \ <nl> sed - ie " s | static volatile sig_atomic_t intr_signal ; | static volatile intr_signal ; | " " $ ( PLATFORM ) / crypto / ui / ui_openssl . c " ; \ <nl> fi <nl> + sed - ie " s | apps test | | " " $ ( PLATFORM ) / Makefile " ; \ <nl> <nl> $ ( LIBDYLIB ) : $ ( PLATFORM ) <nl> $ ( MAKE ) - C $ ( PLATFORM ) <nl> mmm a / tools / depends / target / pcre / Makefile <nl> ppp b / tools / depends / target / pcre / Makefile <nl> <nl> include . . / . . / Makefile . include <nl> - DEPS = . . / . . / Makefile . include Makefile <nl> + DEPS = . . / . . / Makefile . include Makefile tvos - bitcode - fix . patch <nl> <nl> # lib name , version <nl> LIBNAME = pcre <nl> - VERSION = 8 . 33 <nl> + VERSION = 8 . 36 <nl> SOURCE = $ ( LIBNAME ) - $ ( VERSION ) <nl> ARCHIVE = $ ( SOURCE ) . tar . gz <nl> <nl> $ ( TARBALLS_LOCATION ) / $ ( ARCHIVE ) : <nl> $ ( PLATFORM ) : $ ( TARBALLS_LOCATION ) / $ ( ARCHIVE ) $ ( DEPS ) <nl> rm - rf $ ( PLATFORM ) / * ; mkdir - p $ ( PLATFORM ) <nl> cd $ ( PLATFORM ) ; $ ( ARCHIVE_TOOL ) $ ( ARCHIVE_TOOL_FLAGS ) $ ( TARBALLS_LOCATION ) / $ ( ARCHIVE ) <nl> + cd $ ( PLATFORM ) ; patch - p1 < . . / tvos - bitcode - fix . patch <nl> cd $ ( PLATFORM ) ; $ ( CONFIGURE ) <nl> <nl> $ ( LIBDYLIB ) : $ ( PLATFORM ) <nl> new file mode 100644 <nl> index 000000000000 . . 7f04f5adc705 <nl> mmm / dev / null <nl> ppp b / tools / depends / target / pcre / tvos - bitcode - fix . patch <nl> <nl> + mmm a / ltmain . sh - org 2015 - 10 - 30 16 : 21 : 22 . 000000000 - 0400 <nl> ppp + b / ltmain . sh 2015 - 10 - 30 16 : 22 : 21 . 000000000 - 0400 <nl> + EOF <nl> + <nl> + case $ host in <nl> + * - * - darwin * ) <nl> + - # Don ' t allow lazy linking , it breaks C + + global constructors <nl> + - # But is supposedly fixed on 10 . 4 or later ( yay ! ) . <nl> + - if test " $ tagname " = CXX ; then <nl> + - case $ { MACOSX_DEPLOYMENT_TARGET - 10 . 0 } in <nl> + - 10 . [ 0123 ] ) <nl> + - func_append compile_command " $ { wl } - bind_at_load " <nl> + - func_append finalize_command " $ { wl } - bind_at_load " <nl> + - ; ; <nl> + - esac <nl> + - fi <nl> + # Time to change all our " foo . ltframework " stuff back to " - framework foo " <nl> + compile_deplibs = ` $ ECHO " $ compile_deplibs " | $ SED ' s % \ ( [ ^ $ ] * \ ) . ltframework % - framework \ 1 % g ' ` <nl> + finalize_deplibs = ` $ ECHO " $ finalize_deplibs " | $ SED ' s % \ ( [ ^ $ ] * \ ) . ltframework % - framework \ 1 % g ' ` <nl> mmm a / tools / depends / target / python27 / Makefile <nl> ppp b / tools / depends / target / python27 / Makefile <nl> <nl> include . . / . . / Makefile . include <nl> DEPS = . . / . . / Makefile . include Makefile Python - 2 . 7 . 10 - crosscompile . patch Python - 2 . 7 . 10 - android . patch Python - no - export - path . patch \ <nl> - Python - setup . patch fix - datetime . patch Python - 2 . 6 . 5 - urllib . diff modules . setup <nl> + Python - setup . patch fix - datetime . patch Python - 2 . 6 . 5 - urllib . diff modules . setup make - fork - optional . patch <nl> <nl> # lib name , version <nl> LIBNAME = Python <nl> $ ( PLATFORM ) : $ ( TARBALLS_LOCATION ) / $ ( ARCHIVE ) $ ( DEPS ) <nl> cd $ ( PLATFORM ) ; patch - p0 < . . / fix - ffi . patch <nl> # cd $ ( PLATFORM ) ; patch - p1 < . . / urllib - ssl - no - cert_check . patch <nl> ifeq ( $ ( OS ) , ios ) <nl> + cd $ ( PLATFORM ) ; patch - p0 < . . / make - fork - optional . patch <nl> cd $ ( PLATFORM ) ; patch - p0 < . . / Python - 2 . 6 . 5 - urllib . diff <nl> cd $ ( PLATFORM ) ; sed - ie ' s | MACHDEP = " unknown " | MACHDEP = " darwin " | ' configure . ac <nl> endif <nl> new file mode 100644 <nl> index 000000000000 . . 049d078014e6 <nl> mmm / dev / null <nl> ppp b / tools / depends / target / python27 / make - fork - optional . patch <nl> <nl> + mmm Modules / posixmodule . c . orig 2015 - 12 - 12 17 : 13 : 12 . 000000000 + 0100 <nl> ppp + Modules / posixmodule . c 2015 - 12 - 12 17 : 13 : 47 . 000000000 + 0100 <nl> + <nl> + # endif / * ! __WATCOMC__ | | __QNX__ * / <nl> + # endif / * ! __IBMC__ * / <nl> + <nl> + + <nl> + + # undef HAVE_FORK <nl> + + # undef HAVE_EXECV <nl> + + # undef HAVE_SYSTEM <nl> + + <nl> + + <nl> + # ifndef _MSC_VER <nl> + <nl> + # if defined ( __sgi ) & & _COMPILER_VERSION > = 700 <nl> mmm a / tools / depends / target / pythonmodule - pil / Makefile <nl> ppp b / tools / depends / target / pythonmodule - pil / Makefile <nl> CROSSFLAGS = PYTHONXCPREFIX = " $ ( PREFIX ) " CC = " $ ( CC ) $ ( CFLAGS ) " CCSHARED = " $ ( CC ) $ ( CFL <nl> endif <nl> ifeq ( $ ( OS ) , ios ) <nl> PYTHON_O = $ ( abs_top_srcdir ) / target / python27 / $ ( PLATFORM ) / Modules / python . o <nl> + ifeq ( $ ( CPU ) , arm64 ) <nl> + # ensure that there is no - fembed - bitcode in the linkerflags - its not compatible with - bundle <nl> + LDSHARED : = $ ( CC ) - bundle - undefined dynamic_lookup $ ( LDFLAGS ) <nl> + CROSSFLAGS = PYTHONXCPREFIX = " $ ( PREFIX ) " CC = " $ ( CC ) $ ( CFLAGS ) " CCSHARED = " $ ( CC ) $ ( CFLAGS ) $ ( PYTHON_O ) " LDFLAGS = " $ ( LDFLAGS ) " PYTHONPATH = " $ ( PREFIX ) / lib / python2 . 7 / site - packages / " LDSHARED = " $ ( LDSHARED ) " <nl> + else <nl> CROSSFLAGS = PYTHONXCPREFIX = " $ ( PREFIX ) " CC = " $ ( CC ) $ ( CFLAGS ) " CCSHARED = " $ ( CC ) $ ( CFLAGS ) $ ( PYTHON_O ) " LDFLAGS = " $ ( LDFLAGS ) " PYTHONPATH = " $ ( PREFIX ) / lib / python2 . 7 / site - packages / " <nl> endif <nl> + endif <nl> <nl> LIBDYLIB = $ ( PLATFORM ) / dist / PIL - $ ( VERSION ) - py2 . 7 - $ ( OS ) - $ ( CPU ) . egg <nl> ifeq ( $ ( OS ) , android ) <nl> mmm a / tools / depends / target / samba - gplv3 / Makefile <nl> ppp b / tools / depends / target / samba - gplv3 / Makefile <nl> <nl> include . . / . . / Makefile . include <nl> - DEPS = . . / . . / Makefile . include Makefile samba_android . patch <nl> + DEPS = . . / . . / Makefile . include Makefile samba_android . patch no_fork_and_exec . patch <nl> <nl> # lib name , version <nl> LIBNAME = samba <nl> VERSION = 3 . 6 . 12 <nl> SOURCE = $ ( LIBNAME ) - $ ( VERSION ) <nl> ARCHIVE = $ ( SOURCE ) . tar . gz <nl> <nl> + ifeq ( $ ( OS ) , ios ) <nl> + ifeq ( $ ( CPU ) , arm64 ) <nl> + # clang issue with optimizing out functions <nl> + CONFIGURE_EXTRAS = - - without - libmsrpc samba_cv_optimize_out_funcation_calls = no ac_cv_func_yp_get_default_domain = no <nl> + endif <nl> + endif <nl> + <nl> CONFIGURE = cp - f $ ( CONFIG_SUB ) $ ( CONFIG_GUESS ) . ; \ <nl> . / configure - - prefix = $ ( PREFIX ) \ <nl> - - without - cluster - support - - disable - swat - - without - ldap \ <nl> $ ( PLATFORM ) : $ ( TARBALLS_LOCATION ) / $ ( ARCHIVE ) $ ( DEPS ) <nl> cd $ ( PLATFORM ) ; $ ( ARCHIVE_TOOL ) $ ( ARCHIVE_TOOL_FLAGS ) $ ( TARBALLS_LOCATION ) / $ ( ARCHIVE ) <nl> ifeq ( $ ( OS ) , android ) <nl> cd $ ( PLATFORM ) ; patch - p0 < . . / samba_android . patch <nl> + endif <nl> + ifeq ( $ ( TARGET_PLATFORM ) , appletvos ) <nl> + cd $ ( PLATFORM ) ; patch - p0 < . . / no_fork_and_exec . patch <nl> endif <nl> cd $ ( PLATFORM ) / source3 ; $ ( CONFIGURE ) <nl> <nl> new file mode 100644 <nl> index 000000000000 . . b50f688d4580 <nl> mmm / dev / null <nl> ppp b / tools / depends / target / samba - gplv3 / no_fork_and_exec . patch <nl> <nl> + mmm lib / util / system . c . orig 2015 - 12 - 12 17 : 56 : 12 . 000000000 + 0100 <nl> ppp + lib / util / system . c 2015 - 12 - 12 17 : 56 : 46 . 000000000 + 0100 <nl> + <nl> + <nl> + _PUBLIC_ pid_t sys_fork ( void ) <nl> + { <nl> + - pid_t forkret = fork ( ) ; <nl> + + pid_t forkret = ( pid_t ) - 1 ; <nl> + <nl> + if ( forkret = = ( pid_t ) 0 ) { <nl> + / * Child - reset mypid so sys_getpid does a system call . * / <nl> + mmm source3 / lib / system . orig 2015 - 12 - 12 17 : 58 : 30 . 000000000 + 0100 <nl> ppp + source3 / lib / system . c 2015 - 12 - 12 17 : 58 : 45 . 000000000 + 0100 <nl> + <nl> + for ( p = popen_chain ; p ; p = p - > next ) <nl> + close ( p - > fd ) ; <nl> + <nl> + - execv ( argl [ 0 ] , argl ) ; <nl> + + / / execv ( argl [ 0 ] , argl ) ; <nl> + _exit ( 127 ) ; <nl> + } <nl> + <nl> + mmm source3 / lib / util . c . orig 2015 - 12 - 12 18 : 01 : 38 . 000000000 + 0100 <nl> ppp + source3 / lib / util . c 2015 - 12 - 12 18 : 01 : 58 . 000000000 + 0100 <nl> + <nl> + cmd = lp_panic_action ( ) ; <nl> + if ( cmd & & * cmd ) { <nl> + DEBUG ( 0 , ( " smb_panic ( ) : calling panic action [ % s ] \ n " , cmd ) ) ; <nl> + - result = system ( cmd ) ; <nl> + + result = - 1 ; <nl> + <nl> + if ( result = = - 1 ) <nl> + DEBUG ( 0 , ( " smb_panic ( ) : fork failed in panic action : % s \ n " , <nl> + mmm source3 / lib / sock_exec . c . orig 2015 - 12 - 12 18 : 06 : 28 . 000000000 + 0100 <nl> ppp + source3 / lib / sock_exec . c 2015 - 12 - 12 18 : 06 : 41 . 000000000 + 0100 <nl> + <nl> + DEBUG ( 0 , ( " socketpair_tcp failed ( % s ) \ n " , strerror ( errno ) ) ) ; <nl> + return - 1 ; <nl> + } <nl> + - if ( fork ( ) = = 0 ) { <nl> + + if ( - 1 = = 0 ) { <nl> + close ( fd [ 0 ] ) ; <nl> + close ( 0 ) ; <nl> + close ( 1 ) ; <nl> + <nl> + if ( dup ( fd [ 1 ] ) = = - 1 ) { <nl> + exit ( 1 ) ; <nl> + } <nl> + - exit ( system ( prog ) ) ; <nl> + + exit ( - 1 ) ; <nl> + } <nl> + close ( fd [ 1 ] ) ; <nl> + return fd [ 0 ] ; <nl> + mmm source3 / lib / smbrun . c . orig 2015 - 12 - 12 18 : 00 : 04 . 000000000 + 0100 <nl> ppp + source3 / lib / smbrun . c 2015 - 12 - 12 18 : 00 : 57 . 000000000 + 0100 <nl> + <nl> + exit ( 82 ) ; <nl> + } <nl> + <nl> + - execl ( " / bin / sh " , " sh " , " - c " , <nl> + - newcmd ? ( const char * ) newcmd : cmd , NULL ) ; <nl> + + / / execl ( " / bin / sh " , " sh " , " - c " , <nl> + + / / newcmd ? ( const char * ) newcmd : cmd , NULL ) ; <nl> + <nl> + SAFE_FREE ( newcmd ) ; <nl> + } <nl> + <nl> + } <nl> + # endif <nl> + <nl> + - execl ( " / bin / sh " , " sh " , " - c " , cmd , NULL ) ; <nl> + + / / execl ( " / bin / sh " , " sh " , " - c " , cmd , NULL ) ; <nl> + <nl> + / * not reached * / <nl> + exit ( 82 ) ; <nl> mmm a / tools / depends / target / sqlite3 / Makefile <nl> ppp b / tools / depends / target / sqlite3 / Makefile <nl> endif <nl> ifneq ( $ ( OS ) , android ) <nl> cd $ ( PLATFORM ) ; patch - p1 < . . / sqlite3 . c . patch <nl> endif <nl> + # do not build the program sqlite3 <nl> + sed - ie " s | bin_PROGRAMS = sqlite3 | | " " $ ( PLATFORM ) / Makefile . am " ; <nl> + cd $ ( PLATFORM ) ; $ ( AUTORECONF ) - vif <nl> cd $ ( PLATFORM ) ; $ ( CONFIGURE ) <nl> <nl> $ ( LIBDYLIB ) : $ ( PLATFORM ) <nl> | Merge pull request from Memphiz / tvos_depends | xbmc/xbmc | 4d2010b3af338911e562cb3275a2f09d30f27c85 | 2016-01-06T15:26:08Z |
mmm a / plugins / producer_plugin / CMakeLists . txt <nl> ppp b / plugins / producer_plugin / CMakeLists . txt <nl> add_library ( producer_plugin <nl> $ { HEADERS } <nl> ) <nl> <nl> - target_link_libraries ( producer_plugin chain_plugin appbase eosio_chain eos_utilities ) <nl> + target_link_libraries ( producer_plugin chain_plugin appbase eosio_chain eos_utilities net_plugin ) <nl> target_include_directories ( producer_plugin <nl> PUBLIC " $ { CMAKE_CURRENT_SOURCE_DIR } / include " ) <nl> <nl> mmm a / plugins / producer_plugin / producer_plugin . cpp <nl> ppp b / plugins / producer_plugin / producer_plugin . cpp <nl> <nl> * @ copyright defined in eos / LICENSE . txt <nl> * / <nl> # include < eosio / producer_plugin / producer_plugin . hpp > <nl> - <nl> + # include < eos / net_plugin / net_plugin . hpp > <nl> # include < eosio / chain / producer_object . hpp > <nl> <nl> # include < fc / io / json . hpp > <nl> block_production_condition : : block_production_condition_enum producer_plugin_impl <nl> <nl> capture ( " n " , block . block_num ( ) ) ( " t " , block . timestamp ) ( " c " , now ) ( " count " , block . input_transactions . size ( ) ) ( " id " , string ( block . id ( ) ) . substr ( 8 , 8 ) ) ; <nl> <nl> + app ( ) . get_plugin < net_plugin > ( ) . broadcast_block ( block ) ; <nl> return block_production_condition : : produced ; <nl> } <nl> <nl> | have producer_plugin indicate new blocks to the net_plugin | EOSIO/eos | c59f5f47aaff5eab8407c13f1c7046555c194490 | 2017-12-08T21:17:21Z |
mmm a / src / help . hpp <nl> ppp b / src / help . hpp <nl> <nl> # include < stdio . h > <nl> # include < stdlib . h > <nl> # include < stdarg . h > <nl> + # include < sys / ioctl . h > <nl> + # include < unistd . h > <nl> + # include " errors . hpp " <nl> <nl> / / TODO make sure this doesn ' t get messed up if we run on a machine that doesn ' t <nl> / / have less installed <nl> <nl> * stderr <nl> * / <nl> <nl> + # define MAX_HELP_MSG_LEN ( 1024 * 1024 ) <nl> + <nl> class Help_Pager { <nl> private : <nl> - FILE * help_fp ; <nl> + char msg [ MAX_HELP_MSG_LEN ] ; <nl> + char * msg_hd ; <nl> + <nl> + / * ! < \ brief the number of lines in the terminal <nl> + * / <nl> + int term_lines ( ) { <nl> + # ifdef TIOCGSIZE <nl> + struct ttysize ts ; <nl> + ioctl ( STDIN_FILENO , TIOCGSIZE , & ts ) ; <nl> + return ts . ts_lines ; <nl> + # elif defined ( TIOCGWINSZ ) <nl> + struct winsize ts ; <nl> + ioctl ( STDIN_FILENO , TIOCGWINSZ , & ts ) ; <nl> + return ts . ws_row ; <nl> + # endif / * TIOCGSIZE * / <nl> + } <nl> + <nl> + / * ! < \ brief The number of lines in the message <nl> + * / <nl> + int msg_lines ( ) { <nl> + char * c = msg ; <nl> + int nlines = 0 ; <nl> + <nl> + while ( c ! = msg_hd ) <nl> + if ( * c + + = = ' \ n ' ) nlines + + ; <nl> + <nl> + return nlines ; <nl> + } <nl> + <nl> Help_Pager ( ) { <nl> - help_fp = popen ( HELP_VIEWER , " w " ) ; <nl> + msg [ 0 ] = ' \ 0 ' ; / / in case someone tries to print an empty message <nl> + msg_hd = msg ; <nl> } <nl> + <nl> ~ Help_Pager ( ) { <nl> - fclose ( help_fp ) ; <nl> + FILE * print_to ; <nl> + if ( msg_lines ( ) > term_lines ( ) ) { <nl> + print_to = popen ( HELP_VIEWER , " w " ) ; <nl> + } else { <nl> + print_to = stderr ; <nl> + } <nl> + <nl> + msg_hd = ' \ 0 ' ; / / Null terminate it ; <nl> + fprintf ( print_to , " % s " , msg ) ; <nl> + <nl> + if ( print_to ! = stderr ) <nl> + fclose ( print_to ) ; <nl> } <nl> <nl> public : <nl> class Help_Pager { <nl> return & help ; <nl> } <nl> int pagef ( const char * format , . . . ) { <nl> + int res ; <nl> va_list arg ; <nl> va_start ( arg , format ) ; <nl> <nl> - int res = vfprintf ( help_fp , format , arg ) ; <nl> + if ( msg_hd < msg + MAX_HELP_MSG_LEN - 1 ) <nl> + res = vsnprintf ( msg_hd , ( msg + MAX_HELP_MSG_LEN - 1 ) - msg_hd , format , arg ) ; <nl> + else <nl> + unreachable ( " Help message is too big , increase MAX_HELP_MSG_LEN " ) ; <nl> + <nl> + msg_hd + = res ; <nl> va_end ( arg ) ; <nl> return res ; <nl> } <nl> | Improve help message interface . | rethinkdb/rethinkdb | 6d1a790784401cef88ef8f866783e1d5ea33dfbd | 2011-01-11T20:27:08Z |
mmm a / HelloLua / Classes / AppDelegate . cpp <nl> ppp b / HelloLua / Classes / AppDelegate . cpp <nl> <nl> + # include " cocos2d . h " <nl> # include " AppDelegate . h " <nl> + / / # include " SimpleAudioEngine . h " <nl> <nl> - # include " cocos2d . h " <nl> # include " SimpleAudioEngine . h " <nl> <nl> + # include " SimpleAudioEngine . h " <nl> + # define IPAD 0 <nl> + <nl> + # if IPAD <nl> + # define CC_WIDTH 1024 <nl> + # define CC_HEIGHT 768 <nl> + # elif IPHONE_4 <nl> + # define CC_WIDTH 960 <nl> + # define CC_HEIGHT 640 <nl> + # else <nl> + # define CC_WIDTH 480 <nl> + # define CC_HEIGHT 320 <nl> + # endif <nl> + <nl> USING_NS_CC ; <nl> using namespace CocosDenshion ; <nl> <nl> AppDelegate : : AppDelegate ( ) <nl> : m_pLuaEngine ( NULL ) <nl> { <nl> + _CrtSetDbgFlag ( _CRTDBG_ALLOC_MEM_DF | _CRTDBG_LEAK_CHECK_DF ) ; <nl> } <nl> <nl> AppDelegate : : ~ AppDelegate ( ) <nl> bool AppDelegate : : initInstance ( ) <nl> / / The HelloWorld is designed as HVGA . <nl> CCEGLView * pMainWnd = new CCEGLView ( ) ; <nl> CC_BREAK_IF ( ! pMainWnd <nl> - | | ! pMainWnd - > Create ( TEXT ( " cocos2d : Hello World " ) , 480 , 320 ) ) ; <nl> + | | ! pMainWnd - > Create ( TEXT ( " cocos2d : Hello World " ) , CC_WIDTH , CC_HEIGHT ) ) ; <nl> <nl> # endif / / CC_PLATFORM_WIN32 <nl> <nl> mmm a / HelloLua / Resource / hello . lua <nl> ppp b / HelloLua / Resource / hello . lua <nl> spriteDog = cocos2d . CCSprite : spriteWithSpriteFrame ( frame0 ) <nl> spriteDog : setPosition ( cocos2d . CCPoint ( 0 , winSize . height / 4 * 3 ) ) <nl> layerFarm : addChild ( spriteDog ) <nl> <nl> + animation = cocos2d . CCAnimation : animation ( ) <nl> + animation : addFrame ( frame0 ) <nl> + animation : addFrame ( frame1 ) <nl> + animation : setDelay ( 0 . 5 ) <nl> + animation : setName ( ' wait ' ) <nl> + - - [ [ <nl> animFrames = cocos2d . CCMutableArray_CCSpriteFrame__ : new ( 2 ) <nl> animFrames : addObject ( frame0 ) <nl> animFrames : addObject ( frame1 ) <nl> + - - animation = cocos2d . CCAnimation : animationWithName ( " wait " , 0 . 5 , animFrames ) <nl> + animation = cocos2d . CCAnimation : animationWithFrames ( animFrames , 0 . 5 ) <nl> + - - ] ] <nl> <nl> animation = cocos2d . CCAnimation : animationWithFrames ( animFrames , 0 . 5 ) <nl> <nl> mmm a / cocos2dx / CCDirector . cpp <nl> ppp b / cocos2dx / CCDirector . cpp <nl> void CCDirector : : end ( ) <nl> { <nl> m_bPurgeDirecotorInNextLoop = true ; <nl> } <nl> - <nl> + <nl> + <nl> + void CCDirector : : resetDirector ( ) <nl> + { <nl> + / / don ' t release the event handlers <nl> + / / They are needed in case the director is run again <nl> + CCTouchDispatcher : : sharedDispatcher ( ) - > removeAllDelegates ( ) ; <nl> + <nl> + if ( m_pRunningScene ) <nl> + { <nl> + m_pRunningScene - > onExit ( ) ; <nl> + m_pRunningScene - > cleanup ( ) ; <nl> + m_pRunningScene - > release ( ) ; <nl> + } <nl> + <nl> + m_pRunningScene = NULL ; <nl> + m_pNextScene = NULL ; <nl> + <nl> + / / remove all objects , but don ' t release it . <nl> + / / runWithScene might be executed after ' end ' . <nl> + m_pobScenesStack - > removeAllObjects ( ) ; <nl> + <nl> + stopAnimation ( ) ; <nl> + <nl> + CC_SAFE_RELEASE_NULL ( m_pProjectionDelegate ) ; <nl> + <nl> + / / purge bitmap cache <nl> + CCLabelBMFont : : purgeCachedData ( ) ; <nl> + <nl> + / / purge all managers <nl> + CCAnimationCache : : purgeSharedAnimationCache ( ) ; <nl> + CCSpriteFrameCache : : purgeSharedSpriteFrameCache ( ) ; <nl> + CCActionManager : : sharedManager ( ) - > purgeSharedManager ( ) ; <nl> + CCScheduler : : purgeSharedScheduler ( ) ; <nl> + CCTextureCache : : purgeSharedTextureCache ( ) ; <nl> + } <nl> + <nl> + <nl> void CCDirector : : purgeDirector ( ) <nl> { <nl> / / don ' t release the event handlers <nl> mmm a / cocos2dx / CCScheduler . cpp <nl> ppp b / cocos2dx / CCScheduler . cpp <nl> void CCScheduler : : unscheduleAllSelectors ( void ) <nl> { <nl> unscheduleUpdateForTarget ( pEntry - > target ) ; <nl> } <nl> + <nl> + / / unschedule all script functions <nl> + for ( tHashScriptFuncEntry * elt = m_pHashForScriptFunctions ; elt ! = NULL ; ) <nl> + { <nl> + tHashScriptFuncEntry * pNextElement = ( tHashScriptFuncEntry * ) elt - > hh . next ; <nl> + elt - > timer - > release ( ) ; <nl> + HASH_DEL ( m_pHashForScriptFunctions , elt ) ; <nl> + free ( elt ) ; <nl> + elt = pNextElement ; <nl> + } <nl> } <nl> <nl> void CCScheduler : : unscheduleAllSelectorsForTarget ( SelectorProtocol * pTarget ) <nl> mmm a / cocos2dx / include / CCDirector . h <nl> ppp b / cocos2dx / include / CCDirector . h <nl> class CC_DLL CCDirector : public CCObject <nl> public : <nl> / * * returns a shared instance of the director * / <nl> static CCDirector * sharedDirector ( void ) ; <nl> + void resetDirector ( ) ; <nl> <nl> protected : <nl> <nl> mmm a / cocos2dx / include / CCMutableArray . h <nl> ppp b / cocos2dx / include / CCMutableArray . h <nl> class CCMutableArray : public CCObject <nl> return m_array . rbegin ( ) ; <nl> } <nl> <nl> + CCMutableArrayIterator getLastValidIterator ( void ) <nl> + { <nl> + CCMutableArrayIterator iter ; <nl> + CCMutableArrayIterator ret ; <nl> + for ( iter = m_array . begin ( ) ; iter ! = m_array . end ( ) ; + + iter ) <nl> + { <nl> + ret = iter ; <nl> + if ( ! ( * iter ) ) <nl> + { <nl> + break ; <nl> + } <nl> + } <nl> + <nl> + return ret ; <nl> + } <nl> + <nl> / * <nl> * end is a keyword of lua , so should use other name <nl> * to export to lua <nl> old mode 100755 <nl> new mode 100644 <nl> index 3c65b602d0c5 . . 46cb27ab4b5e <nl> mmm a / cocos2dx / include / ccMacros . h <nl> ppp b / cocos2dx / include / ccMacros . h <nl> It should work same as apples CFSwapInt32LittleToHost ( . . ) <nl> # define CC_SWAP_INT32_BIG_TO_HOST ( i ) ( ( CC_HOST_IS_BIG_ENDIAN = = true ) ? ( i ) : CC_SWAP32 ( i ) ) <nl> # define CC_SWAP_INT16_BIG_TO_HOST ( i ) ( ( CC_HOST_IS_BIG_ENDIAN = = true ) ? ( i ) : CC_SWAP16 ( i ) ) <nl> <nl> - # endif / / __CCMACROS_H__ <nl> + # endif / / __CCMACROS_H__ <nl> \ No newline at end of file <nl> mmm a / cocos2dx / menu_nodes / CCMenu . cpp <nl> ppp b / cocos2dx / menu_nodes / CCMenu . cpp <nl> namespace cocos2d { <nl> bool CCMenu : : init ( ) <nl> { <nl> va_list args ; <nl> - return initWithItems ( 0 , args ) ; <nl> + return initWithItems ( 0 , NULL ) ; <nl> } <nl> <nl> bool CCMenu : : initWithItems ( CCMenuItem * item , va_list args ) <nl> mmm a / cocos2dx / menu_nodes / CCMenuItem . cpp <nl> ppp b / cocos2dx / menu_nodes / CCMenuItem . cpp <nl> namespace cocos2d { <nl> const unsigned int kCurrentItem = 0xc0c05001 ; <nl> const unsigned int kZoomActionTag = 0xc0c05002 ; <nl> <nl> + const unsigned int kNormalTag = 0x1 ; <nl> + const unsigned int kSelectedTag = 0x2 ; <nl> + const unsigned int kDisableTag = 0x3 ; <nl> / / <nl> / / CCMenuItem <nl> / / <nl> namespace cocos2d { <nl> { <nl> if ( var ) <nl> { <nl> - addChild ( var ) ; <nl> + addChild ( var , 0 , kNormalTag ) ; <nl> var - > setAnchorPoint ( ccp ( 0 , 0 ) ) ; <nl> var - > setIsVisible ( true ) ; <nl> } <nl> namespace cocos2d { <nl> { <nl> if ( var ) <nl> { <nl> - addChild ( var ) ; <nl> + addChild ( var , 0 , kSelectedTag ) ; <nl> var - > setAnchorPoint ( ccp ( 0 , 0 ) ) ; <nl> var - > setIsVisible ( false ) ; <nl> } <nl> namespace cocos2d { <nl> { <nl> if ( var ) <nl> { <nl> - addChild ( var ) ; <nl> + addChild ( var , 0 , kDisableTag ) ; <nl> var - > setAnchorPoint ( ccp ( 0 , 0 ) ) ; <nl> var - > setIsVisible ( false ) ; <nl> } <nl> mmm a / cocos2dx / platform / win32 / CCEGLView_win32 . cpp <nl> ppp b / cocos2dx / platform / win32 / CCEGLView_win32 . cpp <nl> LRESULT CCEGLView : : WindowProc ( UINT message , WPARAM wParam , LPARAM lParam ) <nl> else if ( VK_ESCAPE = = wParam ) <nl> { <nl> / / ESC input <nl> + CCDirector : : sharedDirector ( ) - > end ( ) ; <nl> } <nl> } <nl> else if ( wParam < 128 ) <nl> mmm a / cocos2dx / proj . wophone / cocos2d - wophone . vcproj <nl> ppp b / cocos2dx / proj . wophone / cocos2d - wophone . vcproj <nl> <nl> < Tool <nl> Name = " VCCLCompilerTool " <nl> Optimization = " 0 " <nl> - AdditionalIncludeDirectories = " . . \ . . \ . . \ PRJ_TG3 \ Include ; . . \ . . \ . . \ PRJ_TG3 \ Include \ MTAPI ; . . \ . . \ . . \ PRJ_TG3 \ Include \ ThirdParty ; . . \ . . \ . . \ PRJ_TG3 \ Include \ TCOM ; . . \ . . \ . . \ PRJ_TG3 \ TG3 \ Include ; . . \ . . \ . . \ PRJ_TG3 \ TG3 \ TG3_Implement ; . . \ . . \ . . \ PRJ_TG3 \ EOS_SYS ; . . \ . . \ . . \ PRJ_TG3 \ Common \ SoftSupport ; . . \ . . \ . . \ PRJ_TG3 \ Common \ ICU \ Include " <nl> + AdditionalIncludeDirectories = " . . \ include ; . . \ . . \ cocos2dx \ platform ; . . \ . . \ . . \ PRJ_TG3 \ Include ; . . \ . . \ . . \ PRJ_TG3 \ Include \ MTAPI ; . . \ . . \ . . \ PRJ_TG3 \ Include \ ThirdParty ; . . \ . . \ . . \ PRJ_TG3 \ Include \ TCOM ; . . \ . . \ . . \ PRJ_TG3 \ TG3 \ Include ; . . \ . . \ . . \ PRJ_TG3 \ TG3 \ TG3_Implement ; . . \ . . \ . . \ PRJ_TG3 \ EOS_SYS ; . . \ . . \ . . \ PRJ_TG3 \ Common \ SoftSupport ; . . \ . . \ . . \ PRJ_TG3 \ Common \ ICU \ Include " <nl> PreprocessorDefinitions = " WIN32 ; _DEBUG ; _CONSOLE ; _TRANZDA_VM_ ; SS_MAKEDLL " <nl> MinimalRebuild = " true " <nl> BasicRuntimeChecks = " 3 " <nl> mmm a / lua / cocos2dx_support / LuaCocos2d . cpp . REMOVED . git - id <nl> ppp b / lua / cocos2dx_support / LuaCocos2d . cpp . REMOVED . git - id <nl> @ @ - 1 + 1 @ @ <nl> - 445474251b15e1ea13cdde8cd5a9fc2776f16a77 <nl> \ No newline at end of file <nl> + dd5941759f1e46eade02974d86ba7cbe12e19a17 <nl> \ No newline at end of file <nl> mmm a / lua / cocos2dx_support / LuaEngine . cpp <nl> ppp b / lua / cocos2dx_support / LuaEngine . cpp <nl> THE SOFTWARE . <nl> <nl> using namespace cocos2d ; <nl> <nl> + LuaEngine : : ~ LuaEngine ( ) <nl> + { <nl> + CCLuaScriptModule : : purgeSharedLuaScriptModule ( ) ; <nl> + } <nl> + <nl> / / functions for excute touch event <nl> bool LuaEngine : : executeTouchEvent ( const char * pszFuncName , CCTouch * pTouch ) <nl> { <nl> mmm a / lua / cocos2dx_support / LuaEngine . h <nl> ppp b / lua / cocos2dx_support / LuaEngine . h <nl> THE SOFTWARE . <nl> class LuaEngine : public cocos2d : : CCScriptEngineProtocol <nl> { <nl> public : <nl> + virtual ~ LuaEngine ( ) ; <nl> + <nl> / / functions for excute touch event <nl> virtual bool executeTouchEvent ( const char * pszFuncName , cocos2d : : CCTouch * pTouch ) ; <nl> virtual bool executeTouchesEvent ( const char * pszFuncName , cocos2d : : CCSet * pTouches ) ; <nl> mmm a / tools / tolua + + / Cocos2d . pkg <nl> ppp b / tools / tolua + + / Cocos2d . pkg <nl> $ pfile " CCMenu . pkg " <nl> $ pfile " CCMenuItem . pkg " <nl> $ pfile " CCMotionStreak . pkg " <nl> <nl> - $ pfile " CCParticleSystem . pkg " <nl> - <nl> $ pfile " CCCommon . pkg " <nl> + $ pfile " CCFileUtils . pkg " <nl> + <nl> + $ pfile " CCParticleSystem . pkg " <nl> mmm a / tools / tolua + + / README <nl> ppp b / tools / tolua + + / README <nl> <nl> 1 . Generating the lua < - - > C bindings with tolua + + <nl> + tolua + + . exe - tCocos2d - o LuaCocos2d . cpp Cocos2d . pkg <nl> <nl> An ant script has been provided to generate the relevant files , to do this after <nl> modifying the . pkg files you should use the following command in this directory : <nl> | Merge pull request from jbyu / master | cocos2d/cocos2d-x | a7d6c90adb72bba47bd3c6413acadc5a04ec9ce8 | 2011-11-18T02:53:14Z |
mmm a / folly / ssl / OpenSSLPtrTypes . h <nl> ppp b / folly / ssl / OpenSSLPtrTypes . h <nl> <nl> namespace folly { <nl> namespace ssl { <nl> <nl> - / / helper which translates ( DEFINE_SSL_PTR_TYPE ( Foo , FOO , FOO_free ) ; into <nl> - / / using FooDeleter = folly : : static_function_deleter < FOO , & FOO_free > ; <nl> - / / using FooUniquePtr = std : : unique_ptr < FOO , FooDeleter > ; <nl> - # define DEFINE_SSL_PTR_TYPE ( alias , object , deleter ) \ <nl> + / / helper which translates : <nl> + / / FOLLY_SSL_DETAIL_DEFINE_PTR_TYPE ( Foo , FOO , FOO_free ) ; <nl> + / / into <nl> + / / using FooDeleter = folly : : static_function_deleter < FOO , & FOO_free > ; <nl> + / / using FooUniquePtr = std : : unique_ptr < FOO , FooDeleter > ; <nl> + # define FOLLY_SSL_DETAIL_DEFINE_PTR_TYPE ( alias , object , deleter ) \ <nl> using alias # # Deleter = folly : : static_function_deleter < object , & deleter > ; \ <nl> using alias # # UniquePtr = std : : unique_ptr < object , alias # # Deleter > <nl> <nl> / / ASN1 <nl> - DEFINE_SSL_PTR_TYPE ( ASN1Time , ASN1_TIME , ASN1_TIME_free ) ; <nl> - DEFINE_SSL_PTR_TYPE ( ASN1Ia5Str , ASN1_IA5STRING , ASN1_IA5STRING_free ) ; <nl> - DEFINE_SSL_PTR_TYPE ( ASN1Int , ASN1_INTEGER , ASN1_INTEGER_free ) ; <nl> - DEFINE_SSL_PTR_TYPE ( ASN1Obj , ASN1_OBJECT , ASN1_OBJECT_free ) ; <nl> - DEFINE_SSL_PTR_TYPE ( ASN1Str , ASN1_STRING , ASN1_STRING_free ) ; <nl> - DEFINE_SSL_PTR_TYPE ( ASN1Type , ASN1_TYPE , ASN1_TYPE_free ) ; <nl> - DEFINE_SSL_PTR_TYPE ( ASN1UTF8Str , ASN1_UTF8STRING , ASN1_UTF8STRING_free ) ; <nl> + FOLLY_SSL_DETAIL_DEFINE_PTR_TYPE ( ASN1Time , ASN1_TIME , ASN1_TIME_free ) ; <nl> + FOLLY_SSL_DETAIL_DEFINE_PTR_TYPE ( <nl> + ASN1Ia5Str , <nl> + ASN1_IA5STRING , <nl> + ASN1_IA5STRING_free ) ; <nl> + FOLLY_SSL_DETAIL_DEFINE_PTR_TYPE ( ASN1Int , ASN1_INTEGER , ASN1_INTEGER_free ) ; <nl> + FOLLY_SSL_DETAIL_DEFINE_PTR_TYPE ( ASN1Obj , ASN1_OBJECT , ASN1_OBJECT_free ) ; <nl> + FOLLY_SSL_DETAIL_DEFINE_PTR_TYPE ( ASN1Str , ASN1_STRING , ASN1_STRING_free ) ; <nl> + FOLLY_SSL_DETAIL_DEFINE_PTR_TYPE ( ASN1Type , ASN1_TYPE , ASN1_TYPE_free ) ; <nl> + FOLLY_SSL_DETAIL_DEFINE_PTR_TYPE ( <nl> + ASN1UTF8Str , <nl> + ASN1_UTF8STRING , <nl> + ASN1_UTF8STRING_free ) ; <nl> <nl> / / X509 <nl> - DEFINE_SSL_PTR_TYPE ( X509 , X509 , X509_free ) ; <nl> - DEFINE_SSL_PTR_TYPE ( X509Extension , X509_EXTENSION , X509_EXTENSION_free ) ; <nl> - DEFINE_SSL_PTR_TYPE ( X509Store , X509_STORE , X509_STORE_free ) ; <nl> - DEFINE_SSL_PTR_TYPE ( X509StoreCtx , X509_STORE_CTX , X509_STORE_CTX_free ) ; <nl> + FOLLY_SSL_DETAIL_DEFINE_PTR_TYPE ( X509 , X509 , X509_free ) ; <nl> + FOLLY_SSL_DETAIL_DEFINE_PTR_TYPE ( <nl> + X509Extension , <nl> + X509_EXTENSION , <nl> + X509_EXTENSION_free ) ; <nl> + FOLLY_SSL_DETAIL_DEFINE_PTR_TYPE ( X509Store , X509_STORE , X509_STORE_free ) ; <nl> + FOLLY_SSL_DETAIL_DEFINE_PTR_TYPE ( <nl> + X509StoreCtx , <nl> + X509_STORE_CTX , <nl> + X509_STORE_CTX_free ) ; <nl> using X509VerifyParamDeleter = <nl> folly : : static_function_deleter < X509_VERIFY_PARAM , & X509_VERIFY_PARAM_free > ; <nl> using X509VerifyParam = <nl> std : : unique_ptr < X509_VERIFY_PARAM , X509VerifyParamDeleter > ; <nl> <nl> - DEFINE_SSL_PTR_TYPE ( GeneralName , GENERAL_NAME , GENERAL_NAME_free ) ; <nl> - DEFINE_SSL_PTR_TYPE ( GeneralNames , GENERAL_NAMES , GENERAL_NAMES_free ) ; <nl> - DEFINE_SSL_PTR_TYPE ( <nl> + FOLLY_SSL_DETAIL_DEFINE_PTR_TYPE ( GeneralName , GENERAL_NAME , GENERAL_NAME_free ) ; <nl> + FOLLY_SSL_DETAIL_DEFINE_PTR_TYPE ( <nl> + GeneralNames , <nl> + GENERAL_NAMES , <nl> + GENERAL_NAMES_free ) ; <nl> + FOLLY_SSL_DETAIL_DEFINE_PTR_TYPE ( <nl> AccessDescription , <nl> ACCESS_DESCRIPTION , <nl> ACCESS_DESCRIPTION_free ) ; <nl> - DEFINE_SSL_PTR_TYPE ( <nl> + FOLLY_SSL_DETAIL_DEFINE_PTR_TYPE ( <nl> AuthorityInfoAccess , <nl> AUTHORITY_INFO_ACCESS , <nl> AUTHORITY_INFO_ACCESS_free ) ; <nl> - DEFINE_SSL_PTR_TYPE ( DistPointName , DIST_POINT_NAME , DIST_POINT_NAME_free ) ; <nl> - DEFINE_SSL_PTR_TYPE ( DistPoint , DIST_POINT , DIST_POINT_free ) ; <nl> - DEFINE_SSL_PTR_TYPE ( CrlDistPoints , CRL_DIST_POINTS , CRL_DIST_POINTS_free ) ; <nl> - DEFINE_SSL_PTR_TYPE ( X509Crl , X509_CRL , X509_CRL_free ) ; <nl> - DEFINE_SSL_PTR_TYPE ( X509Name , X509_NAME , X509_NAME_free ) ; <nl> - DEFINE_SSL_PTR_TYPE ( X509Req , X509_REQ , X509_REQ_free ) ; <nl> - DEFINE_SSL_PTR_TYPE ( X509Revoked , X509_REVOKED , X509_REVOKED_free ) ; <nl> + FOLLY_SSL_DETAIL_DEFINE_PTR_TYPE ( <nl> + DistPointName , <nl> + DIST_POINT_NAME , <nl> + DIST_POINT_NAME_free ) ; <nl> + FOLLY_SSL_DETAIL_DEFINE_PTR_TYPE ( DistPoint , DIST_POINT , DIST_POINT_free ) ; <nl> + FOLLY_SSL_DETAIL_DEFINE_PTR_TYPE ( <nl> + CrlDistPoints , <nl> + CRL_DIST_POINTS , <nl> + CRL_DIST_POINTS_free ) ; <nl> + FOLLY_SSL_DETAIL_DEFINE_PTR_TYPE ( X509Crl , X509_CRL , X509_CRL_free ) ; <nl> + FOLLY_SSL_DETAIL_DEFINE_PTR_TYPE ( X509Name , X509_NAME , X509_NAME_free ) ; <nl> + FOLLY_SSL_DETAIL_DEFINE_PTR_TYPE ( X509Req , X509_REQ , X509_REQ_free ) ; <nl> + FOLLY_SSL_DETAIL_DEFINE_PTR_TYPE ( X509Revoked , X509_REVOKED , X509_REVOKED_free ) ; <nl> <nl> / / EVP <nl> - DEFINE_SSL_PTR_TYPE ( EvpPkey , EVP_PKEY , EVP_PKEY_free ) ; <nl> + FOLLY_SSL_DETAIL_DEFINE_PTR_TYPE ( EvpPkey , EVP_PKEY , EVP_PKEY_free ) ; <nl> using EvpPkeySharedPtr = std : : shared_ptr < EVP_PKEY > ; <nl> <nl> / / No EVP_PKEY_CTX < = 0 . 9 . 8b <nl> # if OPENSSL_VERSION_NUMBER > = 0x10000002L <nl> - DEFINE_SSL_PTR_TYPE ( EvpPkeyCtx , EVP_PKEY_CTX , EVP_PKEY_CTX_free ) ; <nl> + FOLLY_SSL_DETAIL_DEFINE_PTR_TYPE ( EvpPkeyCtx , EVP_PKEY_CTX , EVP_PKEY_CTX_free ) ; <nl> # else <nl> struct EVP_PKEY_CTX ; <nl> # endif <nl> <nl> - DEFINE_SSL_PTR_TYPE ( EvpMdCtx , EVP_MD_CTX , EVP_MD_CTX_free ) ; <nl> - DEFINE_SSL_PTR_TYPE ( EvpCipherCtx , EVP_CIPHER_CTX , EVP_CIPHER_CTX_free ) ; <nl> + FOLLY_SSL_DETAIL_DEFINE_PTR_TYPE ( EvpMdCtx , EVP_MD_CTX , EVP_MD_CTX_free ) ; <nl> + FOLLY_SSL_DETAIL_DEFINE_PTR_TYPE ( <nl> + EvpCipherCtx , <nl> + EVP_CIPHER_CTX , <nl> + EVP_CIPHER_CTX_free ) ; <nl> <nl> / / HMAC <nl> - DEFINE_SSL_PTR_TYPE ( HmacCtx , HMAC_CTX , HMAC_CTX_free ) ; <nl> + FOLLY_SSL_DETAIL_DEFINE_PTR_TYPE ( HmacCtx , HMAC_CTX , HMAC_CTX_free ) ; <nl> <nl> / / BIO <nl> - DEFINE_SSL_PTR_TYPE ( BioMethod , BIO_METHOD , BIO_meth_free ) ; <nl> - DEFINE_SSL_PTR_TYPE ( Bio , BIO , BIO_vfree ) ; <nl> - DEFINE_SSL_PTR_TYPE ( BioChain , BIO , BIO_free_all ) ; <nl> + FOLLY_SSL_DETAIL_DEFINE_PTR_TYPE ( BioMethod , BIO_METHOD , BIO_meth_free ) ; <nl> + FOLLY_SSL_DETAIL_DEFINE_PTR_TYPE ( Bio , BIO , BIO_vfree ) ; <nl> + FOLLY_SSL_DETAIL_DEFINE_PTR_TYPE ( BioChain , BIO , BIO_free_all ) ; <nl> inline void BIO_free_fb ( BIO * bio ) { <nl> CHECK_EQ ( 1 , BIO_free ( bio ) ) ; <nl> } <nl> using BioDeleterFb = folly : : static_function_deleter < BIO , & BIO_free_fb > ; <nl> using BioUniquePtrFb = std : : unique_ptr < BIO , BioDeleterFb > ; <nl> <nl> / / RSA and EC <nl> - DEFINE_SSL_PTR_TYPE ( Rsa , RSA , RSA_free ) ; <nl> + FOLLY_SSL_DETAIL_DEFINE_PTR_TYPE ( Rsa , RSA , RSA_free ) ; <nl> # ifndef OPENSSL_NO_EC <nl> - DEFINE_SSL_PTR_TYPE ( EcKey , EC_KEY , EC_KEY_free ) ; <nl> - DEFINE_SSL_PTR_TYPE ( EcGroup , EC_GROUP , EC_GROUP_free ) ; <nl> - DEFINE_SSL_PTR_TYPE ( EcPoint , EC_POINT , EC_POINT_free ) ; <nl> - DEFINE_SSL_PTR_TYPE ( EcdsaSig , ECDSA_SIG , ECDSA_SIG_free ) ; <nl> + FOLLY_SSL_DETAIL_DEFINE_PTR_TYPE ( EcKey , EC_KEY , EC_KEY_free ) ; <nl> + FOLLY_SSL_DETAIL_DEFINE_PTR_TYPE ( EcGroup , EC_GROUP , EC_GROUP_free ) ; <nl> + FOLLY_SSL_DETAIL_DEFINE_PTR_TYPE ( EcPoint , EC_POINT , EC_POINT_free ) ; <nl> + FOLLY_SSL_DETAIL_DEFINE_PTR_TYPE ( EcdsaSig , ECDSA_SIG , ECDSA_SIG_free ) ; <nl> # endif <nl> <nl> / / BIGNUMs <nl> - DEFINE_SSL_PTR_TYPE ( BIGNUM , BIGNUM , BN_clear_free ) ; <nl> - DEFINE_SSL_PTR_TYPE ( BNCtx , BN_CTX , BN_CTX_free ) ; <nl> + FOLLY_SSL_DETAIL_DEFINE_PTR_TYPE ( BIGNUM , BIGNUM , BN_clear_free ) ; <nl> + FOLLY_SSL_DETAIL_DEFINE_PTR_TYPE ( BNCtx , BN_CTX , BN_CTX_free ) ; <nl> <nl> / / SSL and SSL_CTX <nl> - DEFINE_SSL_PTR_TYPE ( SSL , SSL , SSL_free ) ; <nl> - DEFINE_SSL_PTR_TYPE ( SSLSession , SSL_SESSION , SSL_SESSION_free ) ; <nl> + FOLLY_SSL_DETAIL_DEFINE_PTR_TYPE ( SSL , SSL , SSL_free ) ; <nl> + FOLLY_SSL_DETAIL_DEFINE_PTR_TYPE ( SSLSession , SSL_SESSION , SSL_SESSION_free ) ; <nl> <nl> - # undef DEFINE_SSL_PTR_TYPE <nl> + # undef FOLLY_SSL_DETAIL_DEFINE_PTR_TYPE <nl> } / / namespace ssl <nl> } / / namespace folly <nl> | Namespace the helper macro in folly / ssl / OpenSSLPtrTypes . h | facebook/folly | d0ab8a25c975d8810a4ce999e0ce32b4ba152cbb | 2019-05-18T23:58:18Z |
mmm a / tensorflow / python / ops / array_ops . py <nl> ppp b / tensorflow / python / ops / array_ops . py <nl> def broadcast_static_shape ( shape_x , shape_y ) : <nl> @ dispatch . add_dispatch_support <nl> def shape_v2 ( input , out_type = dtypes . int32 , name = None ) : <nl> # pylint : disable = redefined - builtin <nl> - " " " Returns the shape of a tensor . <nl> - <nl> + " " " Returns a tensor containing the shape of the input tensor . <nl> + <nl> See also ` tf . size ` , ` tf . rank ` . <nl> <nl> ` tf . shape ` returns a 1 - D integer tensor representing the shape of ` input ` . <nl> + For a scalar input , the tensor returned has a shape of ( 0 , ) and its value is <nl> + the empty vector ( i . e . [ ] ) . <nl> <nl> For example : <nl> <nl> + > > > tf . shape ( 1 . ) <nl> + < tf . Tensor : shape = ( 0 , ) , dtype = int32 , numpy = array ( [ ] , dtype = int32 ) > <nl> + <nl> > > > t = tf . constant ( [ [ [ 1 , 1 , 1 ] , [ 2 , 2 , 2 ] ] , [ [ 3 , 3 , 3 ] , [ 4 , 4 , 4 ] ] ] ) <nl> > > > tf . shape ( t ) <nl> < tf . Tensor : shape = ( 3 , ) , dtype = int32 , numpy = array ( [ 2 , 2 , 3 ] , dtype = int32 ) > <nl> def shape_v2 ( input , out_type = dtypes . int32 , name = None ) : <nl> <nl> > > > a . shape <nl> TensorShape ( [ None , None , 10 ] ) <nl> - <nl> + <nl> ( The first ` None ` represents the as yet unknown batch size . ) <nl> <nl> ` tf . shape ` and ` Tensor . shape ` should be identical in eager mode . Within <nl> | Add a note for what tf . shape returns if an input is a scalar tensor . | tensorflow/tensorflow | 835c175c6ea6721d9a34b0de4534fbf51afffe08 | 2020-09-18T23:18:55Z |
mmm a / src / mongo / unittest / bson_test_util . h <nl> ppp b / src / mongo / unittest / bson_test_util . h <nl> <nl> / * * <nl> * BSON comparison utility macro . Do not use directly . <nl> * / <nl> - # define ASSERT_BSON_COMPARISON ( NAME , a , b ) \ <nl> - : : mongo : : unittest : : assertComparison_ # # NAME ( __FILE__ , __LINE__ , # a , # b , a , b ) <nl> + # define ASSERT_BSON_COMPARISON ( NAME , a , b , astr , bstr ) \ <nl> + : : mongo : : unittest : : assertComparison_ # # NAME ( __FILE__ , __LINE__ , astr , bstr , a , b ) <nl> <nl> / * * <nl> * Use to compare two instances of type BSONObj under the default comparator in unit tests . <nl> * / <nl> - # define ASSERT_BSONOBJ_EQ ( a , b ) ASSERT_BSON_COMPARISON ( BSONObjEQ , a , b ) <nl> - # define ASSERT_BSONOBJ_LT ( a , b ) ASSERT_BSON_COMPARISON ( BSONObjLT , a , b ) <nl> - # define ASSERT_BSONOBJ_LTE ( a , b ) ASSERT_BSON_COMPARISON ( BSONObjLTE , a , b ) <nl> - # define ASSERT_BSONOBJ_GT ( a , b ) ASSERT_BSON_COMPARISON ( BSONObjGT , a , b ) <nl> - # define ASSERT_BSONOBJ_GTE ( a , b ) ASSERT_BSON_COMPARISON ( BSONObjGTE , a , b ) <nl> - # define ASSERT_BSONOBJ_NE ( a , b ) ASSERT_BSON_COMPARISON ( BSONObjNE , a , b ) <nl> + # define ASSERT_BSONOBJ_EQ ( a , b ) ASSERT_BSON_COMPARISON ( BSONObjEQ , a , b , # a , # b ) <nl> + # define ASSERT_BSONOBJ_LT ( a , b ) ASSERT_BSON_COMPARISON ( BSONObjLT , a , b , # a , # b ) <nl> + # define ASSERT_BSONOBJ_LTE ( a , b ) ASSERT_BSON_COMPARISON ( BSONObjLTE , a , b , # a , # b ) <nl> + # define ASSERT_BSONOBJ_GT ( a , b ) ASSERT_BSON_COMPARISON ( BSONObjGT , a , b , # a , # b ) <nl> + # define ASSERT_BSONOBJ_GTE ( a , b ) ASSERT_BSON_COMPARISON ( BSONObjGTE , a , b , # a , # b ) <nl> + # define ASSERT_BSONOBJ_NE ( a , b ) ASSERT_BSON_COMPARISON ( BSONObjNE , a , b , # a , # b ) <nl> <nl> / * * <nl> * Use to compare two instances of type BSONElement under the default comparator in unit tests . <nl> * / <nl> - # define ASSERT_BSONELT_EQ ( a , b ) ASSERT_BSON_COMPARISON ( BSONElementEQ , a , b ) <nl> - # define ASSERT_BSONELT_LT ( a , b ) ASSERT_BSON_COMPARISON ( BSONElementLT , a , b ) <nl> - # define ASSERT_BSONELT_LTE ( a , b ) ASSERT_BSON_COMPARISON ( BSONElementLTE , a , b ) <nl> - # define ASSERT_BSONELT_GT ( a , b ) ASSERT_BSON_COMPARISON ( BSONElementGT , a , b ) <nl> - # define ASSERT_BSONELT_GTE ( a , b ) ASSERT_BSON_COMPARISON ( BSONElementGTE , a , b ) <nl> - # define ASSERT_BSONELT_NE ( a , b ) ASSERT_BSON_COMPARISON ( BSONElementNE , a , b ) <nl> + # define ASSERT_BSONELT_EQ ( a , b ) ASSERT_BSON_COMPARISON ( BSONElementEQ , a , b , # a , # b ) <nl> + # define ASSERT_BSONELT_LT ( a , b ) ASSERT_BSON_COMPARISON ( BSONElementLT , a , b , # a , # b ) <nl> + # define ASSERT_BSONELT_LTE ( a , b ) ASSERT_BSON_COMPARISON ( BSONElementLTE , a , b , # a , # b ) <nl> + # define ASSERT_BSONELT_GT ( a , b ) ASSERT_BSON_COMPARISON ( BSONElementGT , a , b , # a , # b ) <nl> + # define ASSERT_BSONELT_GTE ( a , b ) ASSERT_BSON_COMPARISON ( BSONElementGTE , a , b , # a , # b ) <nl> + # define ASSERT_BSONELT_NE ( a , b ) ASSERT_BSON_COMPARISON ( BSONElementNE , a , b , # a , # b ) <nl> <nl> namespace mongo { <nl> namespace unittest { <nl> | SERVER - 19249 Stringify arguments in ASSERT_BSON * before they are macro - expanded | mongodb/mongo | 20af425dabe7201c8a48d748b4e9d6bed086372e | 2017-02-23T00:03:06Z |
mmm a / examples / php / composer . json <nl> ppp b / examples / php / composer . json <nl> <nl> } <nl> ] , <nl> " require " : { <nl> - " grpc / grpc " : " dev - release - 0_13 " <nl> + " grpc / grpc " : " v0 . 15 . 0 " <nl> } <nl> } <nl> mmm a / src / php / composer . json <nl> ppp b / src / php / composer . json <nl> <nl> " name " : " grpc / grpc " , <nl> " type " : " library " , <nl> " description " : " gRPC library for PHP " , <nl> - " version " : " 0 . 14 . 0 " , <nl> " keywords " : [ " rpc " ] , <nl> " homepage " : " http : / / grpc . io " , <nl> " license " : " BSD - 3 - Clause " , <nl> mmm a / src / php / ext / grpc / php_grpc . c <nl> ppp b / src / php / ext / grpc / php_grpc . c <nl> PHP_MSHUTDOWN_FUNCTION ( grpc ) { <nl> / * uncomment this line if you have INI entries <nl> UNREGISTER_INI_ENTRIES ( ) ; <nl> * / <nl> + / / WARNING : This function IS being called by PHP when the extension <nl> + / / is unloaded but the logs were somehow suppressed . <nl> grpc_shutdown_timeval ( TSRMLS_C ) ; <nl> grpc_php_shutdown_completion_queue ( TSRMLS_C ) ; <nl> grpc_shutdown ( ) ; <nl> | Merge pull request from stanley - cheung / php - add - comment - shutdown - warning | grpc/grpc | 2bece9e0e1d76910ca2e7e56eb3568983b17e6d4 | 2016-07-08T17:13:27Z |
mmm a / test / stdlib / NSSlowString . swift <nl> ppp b / test / stdlib / NSSlowString . swift <nl> tests . test ( " Iterator " ) { <nl> expectEqualSequence ( opaque . utf8 . reversed ( ) , native . utf8 . reversed ( ) ) <nl> } <nl> <nl> - tests . test ( " Unicode 9 grapheme breaking " ) { <nl> + tests . test ( " Unicode 9 grapheme breaking " ) <nl> + . xfail ( . osxMinor ( 10 , 9 , reason : " Mac OS X 10 . 9 has an old version of ICU " ) ) <nl> + . xfail ( . iOSMajor ( 7 , reason : " iOS 7 has an old version of ICU " ) ) <nl> + . code { <nl> <nl> / / Test string lengths that correspond to smaller than our fixed size code <nl> / / unit buffer , larger than it , and exactly it . <nl> tests . test ( " Unicode 9 grapheme breaking " ) { <nl> check ( strJustRight as String , expectedCount : 5 , expectedCodeUnitCount : 16 ) <nl> } <nl> <nl> - tests . test ( " Zalgo " ) { <nl> + tests . test ( " Zalgo " ) <nl> + . xfail ( . osxMinor ( 10 , 9 , reason : " Mac OS X 10 . 9 has an old version of ICU " ) ) <nl> + . xfail ( . iOSMajor ( 7 , reason : " iOS 7 has an old version of ICU " ) ) <nl> + . code { <nl> + <nl> / / Check that we handle absurdly long graphemes <nl> var zalgo = " a 👩 👩 👧 👦 c " <nl> for combo in 0x300 . . . 0x36f { <nl> mmm a / test / stdlib / subString . swift <nl> ppp b / test / stdlib / subString . swift <nl> SubstringTests . test ( " Equality " ) { <nl> expectEqual ( " fg " as String , s . suffix ( 2 ) ) <nl> <nl> # if _runtime ( _ObjC ) <nl> - let emoji : String = s + " 😄 👍 🏽 🇫 🇷 👩 👩 👧 👦 🙈 " + " 😡 🇧 🇪 🇨 🇦 🇮 🇳 " <nl> expectTrue ( s = = s [ . . . ] ) <nl> expectTrue ( s [ . . . ] = = s ) <nl> expectTrue ( s . dropFirst ( 2 ) ! = s ) <nl> SubstringTests . test ( " Equality " ) { <nl> expectNotEqual ( s . dropLast ( 2 ) , s . dropLast ( 1 ) ) <nl> expectEqual ( s . dropFirst ( 1 ) , s . dropFirst ( 1 ) ) <nl> expectTrue ( s ! = s [ . . . ] . dropFirst ( 1 ) ) <nl> + # endif <nl> + <nl> + / / equatable conformance <nl> + expectTrue ( " one , two , three " . split ( separator : " , " ) . contains ( " two " ) ) <nl> + expectTrue ( " one , two , three " . split ( separator : " , " ) = = [ " one " , " two " , " three " ] ) <nl> + } <nl> + <nl> + # if _runtime ( _ObjC ) <nl> + SubstringTests . test ( " Equality / Emoji " ) <nl> + . xfail ( . osxMinor ( 10 , 9 , reason : " Mac OS X 10 . 9 has an old ICU " ) ) <nl> + . xfail ( . iOSMajor ( 7 , reason : " iOS 7 has an old ICU " ) ) <nl> + . code { <nl> + let s = " abcdefg " <nl> + let emoji : String = s + " 😄 👍 🏽 🇫 🇷 👩 👩 👧 👦 🙈 " + " 😡 🇧 🇪 🇨 🇦 🇮 🇳 " <nl> let i = emoji . firstIndex ( of : " 😄 " ) ! <nl> expectEqual ( " 😄 👍 🏽 " as String , emoji [ i . . . ] . prefix ( 2 ) ) <nl> expectTrue ( " 😄 👍 🏽 🇫 🇷 👩 👩 👧 👦 🙈 😡 🇧 🇪 " as String = = emoji [ i . . . ] . dropLast ( 2 ) ) <nl> SubstringTests . test ( " Equality " ) { <nl> expectTrue ( s as String ! = emoji [ i . . . ] . dropLast ( 2 ) . dropFirst ( 2 ) ) <nl> expectEqualSequence ( " 😄 👍 🏽 🇫 🇷 👩 👩 👧 👦 🙈 😡 🇧 🇪 " as String , emoji [ i . . . ] . dropLast ( 2 ) ) <nl> expectEqualSequence ( " 🇫 🇷 👩 👩 👧 👦 🙈 😡 🇧 🇪 " as String , emoji [ i . . . ] . dropLast ( 2 ) . dropFirst ( 2 ) ) <nl> - # endif <nl> - / / equatable conformance <nl> - expectTrue ( " one , two , three " . split ( separator : " , " ) . contains ( " two " ) ) <nl> - expectTrue ( " one , two , three " . split ( separator : " , " ) = = [ " one " , " two " , " three " ] ) <nl> } <nl> + # endif <nl> <nl> SubstringTests . test ( " Comparison " ) { <nl> var s = " abc " <nl> | [ test ] XFAIL some String tests on older Apple OSs | apple/swift | 38b3c25b15f60d0f953fda1dbab37d2666664044 | 2018-10-03T23:54:38Z |
mmm a / dbms / src / Common / ThreadFuzzer . cpp <nl> ppp b / dbms / src / Common / ThreadFuzzer . cpp <nl> void ThreadFuzzer : : setup ( ) <nl> <nl> static constexpr UInt32 TIMER_PRECISION = 1000000 ; <nl> <nl> - struct timeval interval { . tv_sec = long ( cpu_time_period_us / TIMER_PRECISION ) , . tv_usec = long ( cpu_time_period_us % TIMER_PRECISION ) } ; <nl> + struct timeval interval ; <nl> + interval . tv_sec = cpu_time_period_us / TIMER_PRECISION ; <nl> + interval . tv_usec = cpu_time_period_us % TIMER_PRECISION ; <nl> + <nl> struct itimerval timer = { . it_interval = interval , . it_value = interval } ; <nl> <nl> if ( 0 ! = setitimer ( ITIMER_PROF , & timer , nullptr ) ) <nl> | Fixed build on Mac OS X | ClickHouse/ClickHouse | 57ab54c124341afdfac325c7ea9a1935e4bfcf55 | 2020-03-02T14:09:56Z |
mmm a / taichi / backends / codegen_llvm . h <nl> ppp b / taichi / backends / codegen_llvm . h <nl> class CodeGenLLVM : public IRVisitor , public ModuleBuilder { <nl> } else if ( stmt - > op_type = = SNodeOpType : : probe ) { <nl> TC_ASSERT ( snode - > type = = SNodeType : : dynamic ) ; <nl> stmt - > value = call ( snode , stmt - > ptr - > value , " get_num_elements " , { } ) ; <nl> + } else if ( stmt - > op_type = = SNodeOpType : : deactivate ) { <nl> + TC_ASSERT ( snode - > type = = SNodeType : : pointer | | <nl> + snode - > type = = SNodeType : : dynamic ) ; <nl> + stmt - > value = call ( snode , stmt - > ptr - > value , " deactivate " , { } ) ; <nl> } else { <nl> TC_NOT_IMPLEMENTED <nl> } <nl> mmm a / taichi / runtime / node_pointer . h <nl> ppp b / taichi / runtime / node_pointer . h <nl> void Pointer_activate ( Ptr meta , Ptr node , int i ) { <nl> Ptr & data_ptr = * ( Ptr * ) ( node + 8 ) ; <nl> if ( data_ptr = = nullptr ) { <nl> auto smeta = ( StructMeta * ) meta ; <nl> - auto rt = ( Runtime * ) smeta - > context - > runtime ; <nl> + auto rt = smeta - > context - > runtime ; <nl> auto alloc = rt - > node_allocators [ smeta - > snode_id ] ; <nl> data_ptr = alloc - > allocate ( ) ; <nl> } <nl> } ) ; <nl> } <nl> <nl> + void Pointer_deactivate ( Ptr meta , Ptr node ) { <nl> + Ptr lock = node ; <nl> + locked_task ( lock , [ & ] { <nl> + Ptr & data_ptr = * ( Ptr * ) ( node + 8 ) ; <nl> + if ( data_ptr ! = nullptr ) { <nl> + auto smeta = ( StructMeta * ) meta ; <nl> + auto rt = smeta - > context - > runtime ; <nl> + auto alloc = rt - > node_allocators [ smeta - > snode_id ] ; <nl> + alloc - > recycle ( data_ptr ) ; <nl> + data_ptr = nullptr ; <nl> + } <nl> + } ) ; <nl> + } <nl> + <nl> bool Pointer_is_active ( Ptr meta , Ptr node , int i ) { <nl> auto data_ptr = * ( Ptr * ) ( node + 8 ) ; <nl> return data_ptr ! = nullptr ; <nl> void * Pointer_lookup_element ( Ptr meta , Ptr node , int i ) { <nl> int Pointer_get_num_elements ( Ptr meta , Ptr node ) { <nl> return 1 ; <nl> } <nl> - <nl> mmm a / tests / python / test_sparse_deactivate . py <nl> ppp b / tests / python / test_sparse_deactivate . py <nl> def func ( ) : <nl> <nl> @ ti . kernel <nl> def deactivate ( ) : <nl> - ti . deactivate ( x . parent ( ) . parent ( ) , 4 ) <nl> + # TODO : why not x . parent ( ) . parent ( ) ? <nl> + ti . deactivate ( x . parent ( ) , 4 ) <nl> <nl> deactivate ( ) <nl> s [ None ] = 0 <nl> | pointer deactivation works | taichi-dev/taichi | 95b7b522b2763e3b77c1739e97ed6e0c488581a8 | 2020-01-28T20:59:09Z |
similarity index 96 % <nl> rename from AirLib / include / vehicles / configs / Px4QuadX . hpp <nl> rename to AirLib / include / vehicles / configs / PX4QuadX . hpp <nl> mmm a / AirLib / include / vehicles / configs / Px4QuadX . hpp <nl> ppp b / AirLib / include / vehicles / configs / PX4QuadX . hpp <nl> class Px4QuadX : public MultiRotorParams { <nl> changed | = child . setBool ( " UseSerial " , connection_info . use_serial ) ; <nl> changed | = child . setString ( " UdpIp " , connection_info . ip_address ) ; <nl> changed | = child . setInt ( " UdpPort " , connection_info . ip_port ) ; <nl> - changed | = changed | = child . setString ( " SerialPort " , connection_info . serial_port ) ; <nl> + changed | = child . setString ( " SerialPort " , connection_info . serial_port ) ; <nl> changed | = child . setInt ( " SerialBaudRate " , connection_info . baud_rate ) ; <nl> <nl> if ( changed ) { <nl> mmm a / Unreal / Plugins / AirSim / AirSim . uplugin <nl> ppp b / Unreal / Plugins / AirSim / AirSim . uplugin <nl> <nl> " Description " : " Aerial Informatics and Robotics Simulator for Unreal Engine " , <nl> " Category " : " Science " , <nl> " CreatedBy " : " Shital Shah " , <nl> - " CreatedByURL " : " http : / / github . com / microsoft / air " , <nl> + " CreatedByURL " : " http : / / github . com / Microsoft / AirSim " , <nl> " DocsURL " : " " , <nl> " MarketplaceURL " : " " , <nl> " SupportURL " : " " , <nl> mmm a / build . sh <nl> ppp b / build . sh <nl> popd & > / dev / null <nl> <nl> <nl> mkdir - p AirLib / lib / x64 / Debug <nl> - mkdir - p AirLib / deps / rpclib <nl> - mkdir - p AirLib / deps / MavLinkCom <nl> + mkdir - p AirLib / deps / rpclib / lib <nl> + mkdir - p AirLib / deps / MavLinkCom / lib <nl> + cp $ build_dir / output / lib / libAirLib . a AirLib / lib <nl> + cp $ build_dir / output / lib / libMavLinkCom . a AirLib / deps / MavLinkCom / lib <nl> + cp $ build_dir / output / lib / libAirSim - rpclib . a AirLib / deps / rpclib / lib / librpc . a <nl> rsync - a - - delete $ build_dir / output / lib / AirLib / lib / x64 / Debug <nl> rsync - a - - delete external / rpclib / include AirLib / deps / rpclib <nl> rsync - a - - delete MavLinkCom / include AirLib / deps / MavLinkCom <nl> | Updated Linux build script to place libraries in correct directories and change filename case issue and typo | microsoft/AirSim | c0c4fa7856214b12587b879574b69e6d4f0f085f | 2017-03-10T14:12:35Z |
mmm a / lib / IDE / CodeCompletion . cpp <nl> ppp b / lib / IDE / CodeCompletion . cpp <nl> class ArchetypeTransformer { <nl> SelfDerived = true ; <nl> } <nl> if ( SelfDerived ) { <nl> - if ( auto MT = checkMemberType ( * DC , BaseTy , Names ) ) { <nl> - Result = MT - > getKind ( ) = = TypeKind : : NameAlias ? <nl> - MT - > getDesugaredType ( ) : MT ; <nl> + if ( auto MT = checkMemberType ( * DC , BaseTy , Names ) ) { <nl> + if ( auto NAT = dyn_cast < NameAliasType > ( MT . getPointer ( ) ) ) { <nl> + Result = NAT - > getSinglyDesugaredType ( ) ; <nl> + } else { <nl> + Result = MT ; <nl> + } <nl> } <nl> } <nl> Cache [ Ty . getPointer ( ) ] = Result ; <nl> mmm a / test / IDE / complete_from_stdlib . swift <nl> ppp b / test / IDE / complete_from_stdlib . swift <nl> <nl> / / RUN : FileCheck % s - check - prefix = PRIVATE_NOMINAL_MEMBERS_8 < % t . members8 . txt <nl> / / RUN : FileCheck % s - check - prefix = NO_STDLIB_PRIVATE < % t . members8 . txt <nl> <nl> + / / RUN : % target - swift - ide - test - code - completion - source - filename % s - code - completion - token = PRIVATE_NOMINAL_MEMBERS_9 > % t . members9 . txt <nl> + / / RUN : FileCheck % s - check - prefix = PRIVATE_NOMINAL_MEMBERS_9 < % t . members9 . txt <nl> + / / RUN : FileCheck % s - check - prefix = NO_STDLIB_PRIVATE < % t . members9 . txt <nl> + <nl> / / RUN : % target - swift - ide - test - code - completion - source - filename % s - code - completion - token = RETURNS_ANY_SEQUENCE | FileCheck % s - check - prefix = RETURNS_ANY_SEQUENCE <nl> <nl> / / NO_STDLIB_PRIVATE : Begin completions <nl> func testArchetypeReplacement3 ( a : [ Int ] ) { <nl> / / PRIVATE_NOMINAL_MEMBERS_7 - DAG : Decl [ InstanceMethod ] / Super : prefix ( { # ( maxLength ) : Int # } ) [ # AnySequence < Int > # ] <nl> / / PRIVATE_NOMINAL_MEMBERS_7 - DAG : Decl [ InstanceMethod ] / Super : elementsEqual ( { # ( other ) : OtherSequence # } , { # isEquivalent : ( Int , Int ) throws - > Bool # # ( Int , Int ) throws - > Bool # } ) [ ' rethrows ' ] [ # Bool # ] <nl> <nl> - func testArchetypeReplacement4 ( a : String ) { <nl> - a . characters . # ^ PRIVATE_NOMINAL_MEMBERS_8 ^ # <nl> + <nl> + protocol P2 { <nl> + typealias MyElement <nl> + } <nl> + <nl> + extension P2 { <nl> + func foo ( x : MyElement ) { } <nl> + } <nl> + <nl> + typealias MyInt = Int <nl> + <nl> + class MyClass1 : P2 { <nl> + typealias MyElement = MyInt <nl> } <nl> <nl> + class MyClass2 : P2 { <nl> + typealias MyElement = Int <nl> + } <nl> + <nl> + func testArchetypeReplacement4 ( a : MyClass1 ) { <nl> + a . # ^ PRIVATE_NOMINAL_MEMBERS_8 ^ # <nl> + } <nl> / / PRIVATE_NOMINAL_MEMBERS_8 : Begin completions <nl> - / / PRIVATE_NOMINAL_MEMBERS_8 - DAG : Decl [ InstanceMethod ] / CurrNominal : append ( { # ( c ) : Character # } ) [ # Void # ] { { ; name = . + } } <nl> - / / PRIVATE_NOMINAL_MEMBERS_8 - DAG : Decl [ InstanceMethod ] / CurrNominal : appendContentsOf ( { # ( newElements ) : S # } ) [ # Void # ] { { ; name = . + } } <nl> - / / PRIVATE_NOMINAL_MEMBERS_8 - DAG : Decl [ InstanceMethod ] / Super : generate ( ) [ # IndexingGenerator < String . CharacterView > # ] { { ; name = . + } } <nl> - / / PRIVATE_NOMINAL_MEMBERS_8 - DAG : Decl [ InstanceMethod ] / Super : popFirst ( ) [ # Character ? # ] { { ; name = . + } } <nl> - / / PRIVATE_NOMINAL_MEMBERS_8 - DAG : Decl [ InstanceMethod ] / Super : popLast ( ) [ # Character ? # ] { { ; name = . + } } <nl> - / / PRIVATE_NOMINAL_MEMBERS_8 - DAG : Decl [ InstanceVar ] / Super : isEmpty [ # Bool # ] { { ; name = . + } } <nl> - / / PRIVATE_NOMINAL_MEMBERS_8 - DAG : Decl [ InstanceVar ] / Super : first [ # Character ? # ] { { ; name = . + } } <nl> - / / PRIVATE_NOMINAL_MEMBERS_8 - DAG : Decl [ InstanceMethod ] / Super : split ( { # ( separator ) : Character # } ) [ # [ String . CharacterView ] # ] { { ; name = . + } } <nl> - / / PRIVATE_NOMINAL_MEMBERS_8 - DAG : Decl [ InstanceMethod ] / Super : split ( { # ( separator ) : Character # } , { # maxSplit : Int # } , { # allowEmptySlices : Bool # } ) [ # [ String . CharacterView ] # ] { { ; name = . + } } <nl> - / / PRIVATE_NOMINAL_MEMBERS_8 - DAG : Decl [ InstanceMethod ] / Super : removeFirst ( ) [ # Character # ] { { ; name = . + } } <nl> - / / PRIVATE_NOMINAL_MEMBERS_8 - DAG : Decl [ InstanceVar ] / Super : last [ # Character ? # ] { { ; name = . + } } <nl> + / / PRIVATE_NOMINAL_MEMBERS_8 - DAG : Decl [ InstanceMethod ] / Super : foo ( { # ( x ) : MyInt # } ) [ # Void # ] { { ; name = . + } } <nl> + <nl> + func testArchetypeReplacement5 ( a : MyClass2 ) { <nl> + a . # ^ PRIVATE_NOMINAL_MEMBERS_9 ^ # <nl> + } <nl> + <nl> + / / PRIVATE_NOMINAL_MEMBERS_9 : Begin completions <nl> + / / PRIVATE_NOMINAL_MEMBERS_9 - DAG : Decl [ InstanceMethod ] / Super : foo ( { # ( x ) : Int # } ) [ # Void # ] { { ; name = . + } } <nl> <nl> / / rdar : / / problem / 22334700 <nl> struct Test1000 : SequenceType { <nl> | [ CodeComplete ] Get singly desugared type and update tests . | apple/swift | 2fe26c966ca6ea0125033bc3ae5bd5b4a8d720c4 | 2015-09-03T22:49:02Z |
mmm a / xbmc / video / VideoDatabase . cpp <nl> ppp b / xbmc / video / VideoDatabase . cpp <nl> bool CVideoDatabase : : GetTvShowSeasonArt ( int showId , map < int , map < string , string > <nl> return false ; <nl> } <nl> <nl> + bool CVideoDatabase : : GetArtTypes ( const std : : string & mediaType , std : : vector < std : : string > & artTypes ) <nl> + { <nl> + try <nl> + { <nl> + if ( NULL = = m_pDB . get ( ) ) return false ; <nl> + if ( NULL = = m_pDS . get ( ) ) return false ; <nl> + <nl> + CStdString sql = PrepareSQL ( " SELECT DISTINCT type FROM art WHERE media_type = ' % s ' " , mediaType . c_str ( ) ) ; <nl> + int numRows = RunQuery ( sql ) ; <nl> + if ( numRows < = 0 ) <nl> + return numRows = = 0 ; <nl> + <nl> + while ( ! m_pDS - > eof ( ) ) <nl> + { <nl> + artTypes . push_back ( m_pDS - > fv ( 0 ) . get_asString ( ) ) ; <nl> + m_pDS - > next ( ) ; <nl> + } <nl> + m_pDS - > close ( ) ; <nl> + return true ; <nl> + } <nl> + catch ( . . . ) <nl> + { <nl> + CLog : : Log ( LOGERROR , " % s ( % s ) failed " , __FUNCTION__ , mediaType . c_str ( ) ) ; <nl> + } <nl> + return false ; <nl> + } <nl> + <nl> / / / \ brief GetStackTimes ( ) obtains any saved video times for the stacked file <nl> / / / \ retval Returns true if the stack times exist , false otherwise . <nl> bool CVideoDatabase : : GetStackTimes ( const CStdString & filePath , vector < int > & times ) <nl> mmm a / xbmc / video / VideoDatabase . h <nl> ppp b / xbmc / video / VideoDatabase . h <nl> class CVideoDatabase : public CDatabase <nl> bool GetArtForItem ( int mediaId , const std : : string & mediaType , std : : map < std : : string , std : : string > & art ) ; <nl> std : : string GetArtForItem ( int mediaId , const std : : string & mediaType , const std : : string & artType ) ; <nl> bool GetTvShowSeasonArt ( int mediaId , std : : map < int , std : : map < std : : string , std : : string > > & seasonArt ) ; <nl> + bool GetArtTypes ( const std : : string & mediaType , std : : vector < std : : string > & artTypes ) ; <nl> <nl> int AddTag ( const std : : string & tag ) ; <nl> void AddTagToItem ( int idItem , int idTag , const std : : string & type ) ; <nl> mmm a / xbmc / video / dialogs / GUIDialogVideoInfo . cpp <nl> ppp b / xbmc / video / dialogs / GUIDialogVideoInfo . cpp <nl> string CGUIDialogVideoInfo : : ChooseArtType ( const CFileItem & videoItem , map < string <nl> artTypes . push_back ( i - > first ) ; <nl> } <nl> <nl> + / / add any art types that exist for other media items of the same type <nl> + vector < string > dbArtTypes ; <nl> + db . GetArtTypes ( videoItem . GetVideoInfoTag ( ) - > m_type , dbArtTypes ) ; <nl> + for ( vector < string > : : const_iterator it = dbArtTypes . begin ( ) ; it ! = dbArtTypes . end ( ) ; it + + ) <nl> + { <nl> + if ( find ( artTypes . begin ( ) , artTypes . end ( ) , * it ) = = artTypes . end ( ) ) <nl> + artTypes . push_back ( * it ) ; <nl> + } <nl> + <nl> for ( vector < string > : : const_iterator i = artTypes . begin ( ) ; i ! = artTypes . end ( ) ; + + i ) <nl> { <nl> string type = * i ; <nl> | Merge pull request from Montellese / chooseart_all_artwork | xbmc/xbmc | 9c1e76361dfea0825afaa68fc599ec64165fd646 | 2013-03-07T09:26:40Z |
mmm a / include / mlir / Transforms / CFGFunctionViewGraph . h <nl> ppp b / include / mlir / Transforms / CFGFunctionViewGraph . h <nl> llvm : : raw_ostream & writeGraph ( llvm : : raw_ostream & os , <nl> bool shortNames = false , const Twine & title = " " ) ; <nl> <nl> / / / Creates a pass to print CFG graphs . <nl> - CFGFunctionPass * createPrintCFGGraphPass ( llvm : : raw_ostream & os = llvm : : errs ( ) , <nl> - bool shortNames = false , <nl> - const llvm : : Twine & title = " " ) ; <nl> + FunctionPass * createPrintCFGGraphPass ( llvm : : raw_ostream & os = llvm : : errs ( ) , <nl> + bool shortNames = false , <nl> + const llvm : : Twine & title = " " ) ; <nl> <nl> } / / end namespace mlir <nl> <nl> mmm a / include / mlir / Transforms / Pass . h <nl> ppp b / include / mlir / Transforms / Pass . h <nl> <nl> # include " llvm / Support / Compiler . h " <nl> <nl> namespace mlir { <nl> + class Function ; <nl> class CFGFunction ; <nl> class MLFunction ; <nl> class Module ; <nl> class Pass { <nl> <nl> static PassResult success ( ) { return PassResult : : Success ; } <nl> static PassResult failure ( ) { return PassResult : : Failure ; } <nl> + <nl> + private : <nl> + / / / Out of line virtual method to ensure vtables and metadata are emitted to a <nl> + / / / single . o file . <nl> + virtual void anchor ( ) ; <nl> } ; <nl> <nl> class ModulePass : public Pass { <nl> public : <nl> virtual PassResult runOnModule ( Module * m ) override = 0 ; <nl> + <nl> + private : <nl> + / / / Out of line virtual method to ensure vtables and metadata are emitted to a <nl> + / / / single . o file . <nl> + virtual void anchor ( ) ; <nl> } ; <nl> <nl> + / / / FunctionPass ' s are run on every function in a module , and multiple functions <nl> + / / / may be optimized concurrently by different instances of the function pass . <nl> + / / / By subclassing this , your pass promises only to look at the function psased <nl> + / / / in to it , it isn ' t allowed to inspect or modify other functions in the <nl> + / / / module . <nl> class FunctionPass : public Pass { <nl> public : <nl> - virtual PassResult runOnCFGFunction ( CFGFunction * f ) = 0 ; <nl> - virtual PassResult runOnMLFunction ( MLFunction * f ) = 0 ; <nl> + / / / Implement this function to be run on every function in the module . If you <nl> + / / / do not implement this , the default implementation will dispatch to <nl> + / / / runOnCFGFunction or runOnMLFunction . <nl> + virtual PassResult runOnFunction ( Function * fn ) ; <nl> <nl> - / / Iterates over all functions in a module , halting upon failure . <nl> - virtual PassResult runOnModule ( Module * m ) override ; <nl> - } ; <nl> + / / / Implement this function if you want to see CFGFunction ' s specifically . <nl> + virtual PassResult runOnCFGFunction ( CFGFunction * fn ) { return success ( ) ; } <nl> <nl> - class CFGFunctionPass : public FunctionPass { <nl> - public : <nl> - virtual PassResult runOnMLFunction ( MLFunction * f ) override { <nl> - / / Skip over MLFunction . <nl> - return success ( ) ; <nl> - } <nl> - virtual PassResult runOnCFGFunction ( CFGFunction * f ) override = 0 ; <nl> - } ; <nl> + / / / Implement this function if you want to see MLFunction ' s specifically . <nl> + virtual PassResult runOnMLFunction ( MLFunction * fn ) { return success ( ) ; } <nl> <nl> - class MLFunctionPass : public FunctionPass { <nl> - public : <nl> - virtual PassResult runOnCFGFunction ( CFGFunction * f ) override { <nl> - / / Skip over CFGFunction . <nl> - return success ( ) ; <nl> - } <nl> - virtual PassResult runOnMLFunction ( MLFunction * f ) override = 0 ; <nl> + / / Iterates over all functions in a module , halting upon failure . <nl> + virtual PassResult runOnModule ( Module * m ) override ; <nl> } ; <nl> <nl> } / / end namespace mlir <nl> mmm a / include / mlir / Transforms / Passes . h <nl> ppp b / include / mlir / Transforms / Passes . h <nl> <nl> namespace mlir { <nl> <nl> class FunctionPass ; <nl> - class MLFunctionPass ; <nl> class ModulePass ; <nl> <nl> / / / Creates a constant folding pass . <nl> FunctionPass * createCanonicalizerPass ( ) ; <nl> <nl> / / / Creates a pass to vectorize loops , operations and data types using a <nl> / / / target - independent , n - D virtual vector abstraction . <nl> - MLFunctionPass * createVectorizePass ( ) ; <nl> + FunctionPass * createVectorizePass ( ) ; <nl> <nl> / / / Creates a loop unrolling pass . Default option or command - line options take <nl> / / / effect if - 1 is passed as parameter . <nl> - MLFunctionPass * createLoopUnrollPass ( int unrollFactor = - 1 , <nl> - int unrollFull = - 1 ) ; <nl> + FunctionPass * createLoopUnrollPass ( int unrollFactor = - 1 , int unrollFull = - 1 ) ; <nl> <nl> / / / Creates a loop unroll jam pass to unroll jam by the specified factor . A <nl> / / / factor of - 1 lets the pass use the default factor or the one on the command <nl> / / / line if provided . <nl> - MLFunctionPass * createLoopUnrollAndJamPass ( int unrollJamFactor = - 1 ) ; <nl> + FunctionPass * createLoopUnrollAndJamPass ( int unrollJamFactor = - 1 ) ; <nl> <nl> / / / Creates an simplification pass for affine structures . <nl> FunctionPass * createSimplifyAffineStructuresPass ( ) ; <nl> <nl> / / / Creates a pass to pipeline explicit movement of data across levels of the <nl> / / / memory hierarchy . <nl> - MLFunctionPass * createPipelineDataTransferPass ( ) ; <nl> + FunctionPass * createPipelineDataTransferPass ( ) ; <nl> <nl> / / / Creates a pass which composes all affine maps applied to loads and stores . <nl> - MLFunctionPass * createComposeAffineMapsPass ( ) ; <nl> + FunctionPass * createComposeAffineMapsPass ( ) ; <nl> <nl> / / / Replaces all ML functions in the module with equivalent CFG functions . <nl> / / / Function references are appropriately patched to refer to the newly <nl> mmm a / lib / Transforms / CFGFunctionViewGraph . cpp <nl> ppp b / lib / Transforms / CFGFunctionViewGraph . cpp <nl> void mlir : : CFGFunction : : viewGraph ( ) const { <nl> } <nl> <nl> namespace { <nl> - struct PrintCFGPass : public CFGFunctionPass { <nl> + struct PrintCFGPass : public FunctionPass { <nl> PrintCFGPass ( llvm : : raw_ostream & os , bool shortNames , const llvm : : Twine & title ) <nl> : os ( os ) , shortNames ( shortNames ) , title ( title ) { } <nl> PassResult runOnCFGFunction ( CFGFunction * function ) override { <nl> struct PrintCFGPass : public CFGFunctionPass { <nl> } ; <nl> } / / namespace <nl> <nl> - CFGFunctionPass * mlir : : createPrintCFGGraphPass ( llvm : : raw_ostream & os , <nl> - bool shortNames , <nl> - const llvm : : Twine & title ) { <nl> + FunctionPass * mlir : : createPrintCFGGraphPass ( llvm : : raw_ostream & os , <nl> + bool shortNames , <nl> + const llvm : : Twine & title ) { <nl> return new PrintCFGPass ( os , shortNames , title ) ; <nl> } <nl> mmm a / lib / Transforms / Canonicalizer . cpp <nl> ppp b / lib / Transforms / Canonicalizer . cpp <nl> namespace { <nl> <nl> / / / Canonicalize operations in functions . <nl> struct Canonicalizer : public FunctionPass { <nl> - PassResult runOnCFGFunction ( CFGFunction * f ) override ; <nl> - PassResult runOnMLFunction ( MLFunction * f ) override ; <nl> - PassResult runOnFunction ( Function * fn ) ; <nl> + PassResult runOnFunction ( Function * fn ) override ; <nl> } ; <nl> } / / end anonymous namespace <nl> <nl> - <nl> - PassResult Canonicalizer : : runOnCFGFunction ( CFGFunction * fn ) { <nl> - return runOnFunction ( fn ) ; <nl> - } <nl> - <nl> - PassResult Canonicalizer : : runOnMLFunction ( MLFunction * fn ) { <nl> - return runOnFunction ( fn ) ; <nl> - } <nl> - <nl> PassResult Canonicalizer : : runOnFunction ( Function * fn ) { <nl> auto * context = fn - > getContext ( ) ; <nl> OwningPatternList patterns ; <nl> mmm a / lib / Transforms / ComposeAffineMaps . cpp <nl> ppp b / lib / Transforms / ComposeAffineMaps . cpp <nl> namespace { <nl> / / also AffineApplyOps . After forward subtituting its results , AffineApplyOps <nl> / / with no remaining uses are collected and erased after the walk . <nl> / / TODO ( andydavis ) Remove this when Chris adds instruction combiner pass . <nl> - struct ComposeAffineMaps : public MLFunctionPass , <nl> - StmtWalker < ComposeAffineMaps > { <nl> + struct ComposeAffineMaps : public FunctionPass , StmtWalker < ComposeAffineMaps > { <nl> std : : vector < OperationStmt * > affineApplyOpsToErase ; <nl> <nl> explicit ComposeAffineMaps ( ) { } <nl> using StmtListType = llvm : : iplist < Statement > ; <nl> void walk ( StmtListType : : iterator Start , StmtListType : : iterator End ) ; <nl> void visitOperationStmt ( OperationStmt * stmt ) ; <nl> - PassResult runOnMLFunction ( MLFunction * f ) ; <nl> + PassResult runOnMLFunction ( MLFunction * f ) override ; <nl> using StmtWalker < ComposeAffineMaps > : : walk ; <nl> } ; <nl> <nl> } / / end anonymous namespace <nl> <nl> - MLFunctionPass * mlir : : createComposeAffineMapsPass ( ) { <nl> + FunctionPass * mlir : : createComposeAffineMapsPass ( ) { <nl> return new ComposeAffineMaps ( ) ; <nl> } <nl> <nl> mmm a / lib / Transforms / LoopUnroll . cpp <nl> ppp b / lib / Transforms / LoopUnroll . cpp <nl> namespace { <nl> / / / full unroll threshold was specified , in which case , fully unrolls all loops <nl> / / / with trip count less than the specified threshold . The latter is for testing <nl> / / / purposes , especially for testing outer loop unrolling . <nl> - struct LoopUnroll : public MLFunctionPass { <nl> + struct LoopUnroll : public FunctionPass { <nl> Optional < unsigned > unrollFactor ; <nl> Optional < bool > unrollFull ; <nl> <nl> struct LoopUnroll : public MLFunctionPass { <nl> : unrollFactor ( unrollFactor ) , unrollFull ( unrollFull ) { } <nl> <nl> PassResult runOnMLFunction ( MLFunction * f ) override ; <nl> + <nl> / / / Unroll this for stmt . Returns false if nothing was done . <nl> bool runOnForStmt ( ForStmt * forStmt ) ; <nl> } ; <nl> } / / end anonymous namespace <nl> <nl> - MLFunctionPass * mlir : : createLoopUnrollPass ( int unrollFactor , int unrollFull ) { <nl> + FunctionPass * mlir : : createLoopUnrollPass ( int unrollFactor , int unrollFull ) { <nl> return new LoopUnroll ( unrollFactor = = - 1 ? None <nl> : Optional < unsigned > ( unrollFactor ) , <nl> unrollFull = = - 1 ? None : Optional < bool > ( unrollFull ) ) ; <nl> mmm a / lib / Transforms / LoopUnrollAndJam . cpp <nl> ppp b / lib / Transforms / LoopUnrollAndJam . cpp <nl> static llvm : : cl : : opt < unsigned > <nl> namespace { <nl> / / / Loop unroll jam pass . Currently , this just unroll jams the first <nl> / / / outer loop in an MLFunction . <nl> - struct LoopUnrollAndJam : public MLFunctionPass { <nl> + struct LoopUnrollAndJam : public FunctionPass { <nl> Optional < unsigned > unrollJamFactor ; <nl> static const unsigned kDefaultUnrollJamFactor = 4 ; <nl> <nl> struct LoopUnrollAndJam : public MLFunctionPass { <nl> } ; <nl> } / / end anonymous namespace <nl> <nl> - MLFunctionPass * mlir : : createLoopUnrollAndJamPass ( int unrollJamFactor ) { <nl> + FunctionPass * mlir : : createLoopUnrollAndJamPass ( int unrollJamFactor ) { <nl> return new LoopUnrollAndJam ( <nl> unrollJamFactor = = - 1 ? None : Optional < unsigned > ( unrollJamFactor ) ) ; <nl> } <nl> mmm a / lib / Transforms / PipelineDataTransfer . cpp <nl> ppp b / lib / Transforms / PipelineDataTransfer . cpp <nl> using namespace mlir ; <nl> <nl> namespace { <nl> <nl> - struct PipelineDataTransfer : public MLFunctionPass , <nl> + struct PipelineDataTransfer : public FunctionPass , <nl> StmtWalker < PipelineDataTransfer > { <nl> PassResult runOnMLFunction ( MLFunction * f ) override ; <nl> PassResult runOnForStmt ( ForStmt * forStmt ) ; <nl> struct PipelineDataTransfer : public MLFunctionPass , <nl> <nl> / / / Creates a pass to pipeline explicit movement of data across levels of the <nl> / / / memory hierarchy . <nl> - MLFunctionPass * mlir : : createPipelineDataTransferPass ( ) { <nl> + FunctionPass * mlir : : createPipelineDataTransferPass ( ) { <nl> return new PipelineDataTransfer ( ) ; <nl> } <nl> <nl> mmm a / lib / Transforms / SimplifyAffineExpr . cpp <nl> ppp b / lib / Transforms / SimplifyAffineExpr . cpp <nl> struct SimplifyAffineStructures : public FunctionPass , <nl> StmtWalker < SimplifyAffineStructures > { <nl> explicit SimplifyAffineStructures ( ) { } <nl> <nl> - PassResult runOnMLFunction ( MLFunction * f ) ; <nl> + PassResult runOnMLFunction ( MLFunction * f ) override ; <nl> / / Does nothing on CFG functions for now . No reusable walkers / visitors exist <nl> / / for this yet ? TODO ( someone ) . <nl> - PassResult runOnCFGFunction ( CFGFunction * f ) { return success ( ) ; } <nl> + PassResult runOnCFGFunction ( CFGFunction * f ) override { return success ( ) ; } <nl> <nl> void visitIfStmt ( IfStmt * ifStmt ) ; <nl> void visitOperationStmt ( OperationStmt * opStmt ) ; <nl> mmm a / lib / Transforms / Utils / Pass . cpp <nl> ppp b / lib / Transforms / Utils / Pass . cpp <nl> <nl> # include " mlir / IR / CFGFunction . h " <nl> # include " mlir / IR / MLFunction . h " <nl> # include " mlir / IR / Module . h " <nl> - <nl> using namespace mlir ; <nl> <nl> + / / / Out of line virtual method to ensure vtables and metadata are emitted to a <nl> + / / / single . o file . <nl> + void Pass : : anchor ( ) { } <nl> + <nl> + / / / Out of line virtual method to ensure vtables and metadata are emitted to a <nl> + / / / single . o file . <nl> + void ModulePass : : anchor ( ) { } <nl> + <nl> / / / Function passes walk a module and look at each function with their <nl> / / / corresponding hooks and terminates upon error encountered . <nl> PassResult FunctionPass : : runOnModule ( Module * m ) { <nl> for ( auto & fn : * m ) { <nl> - if ( auto * mlFunc = dyn_cast < MLFunction > ( & fn ) ) <nl> - if ( runOnMLFunction ( mlFunc ) ) <nl> - return failure ( ) ; <nl> - if ( auto * cfgFunc = dyn_cast < CFGFunction > ( & fn ) ) <nl> - if ( runOnCFGFunction ( cfgFunc ) ) <nl> - return failure ( ) ; <nl> + if ( runOnFunction ( & fn ) ) <nl> + return failure ( ) ; <nl> } <nl> return success ( ) ; <nl> } <nl> + <nl> + PassResult FunctionPass : : runOnFunction ( Function * fn ) { <nl> + if ( auto * mlFunc = dyn_cast < MLFunction > ( fn ) ) <nl> + return runOnMLFunction ( mlFunc ) ; <nl> + if ( auto * cfgFunc = dyn_cast < CFGFunction > ( fn ) ) <nl> + return runOnCFGFunction ( cfgFunc ) ; <nl> + <nl> + return success ( ) ; <nl> + } <nl> mmm a / lib / Transforms / Vectorize . cpp <nl> ppp b / lib / Transforms / Vectorize . cpp <nl> static cl : : list < unsigned > clVirtualVectorSize ( <nl> <nl> namespace { <nl> <nl> - struct Vectorize : public MLFunctionPass { <nl> + struct Vectorize : public FunctionPass { <nl> PassResult runOnMLFunction ( MLFunction * f ) override ; <nl> <nl> / / Thread - safe RAII contexts local to pass , BumpPtrAllocator freed on exit . <nl> PassResult Vectorize : : runOnMLFunction ( MLFunction * f ) { <nl> return PassResult : : Success ; <nl> } <nl> <nl> - MLFunctionPass * mlir : : createVectorizePass ( ) { return new Vectorize ( ) ; } <nl> + FunctionPass * mlir : : createVectorizePass ( ) { return new Vectorize ( ) ; } <nl> | Simplify FunctionPass to eliminate the CFGFunctionPass / MLFunctionPass | tensorflow/tensorflow | ab49fb293d21ccec39ecbfe9c9e808db719a6837 | 2019-03-29T20:40:05Z |
mmm a / docs / model_zoo . md <nl> ppp b / docs / model_zoo . md <nl> title : Model Zoo <nl> mmm <nl> # Caffe Model Zoo <nl> <nl> - Lots of people have used Caffe to train models of different architectures and applied to different problems , ranging from simple regression to AlexNet - alikes to Siamese networks for image similarity to speech applications . <nl> - To lower the friction of sharing these models , we introduce the model zoo framework : <nl> + Lots of researchers and engineers have made Caffe models for different tasks with all kinds of architectures and data . <nl> + These models are learned and applied for problems ranging from simple regression , to large - scale visual classification , to Siamese networks for image similarity , to speech and robotics applications . <nl> + <nl> + To help share these models , we introduce the model zoo framework : <nl> <nl> - A standard format for packaging Caffe model info . <nl> - Tools to upload / download model info to / from Github Gists , and to download trained ` . caffemodel ` binaries . <nl> To lower the friction of sharing these models , we introduce the model zoo framew <nl> <nl> # # Where to get trained models <nl> <nl> - First of all , we provide some trained models out of the box . <nl> + First of all , we bundle BVLC - trained models for unrestricted , out of the box use . <nl> + < br > <nl> + See the [ BVLC model license ] ( # bvlc - model - license ) for details . <nl> Each one of these can be downloaded by running ` scripts / download_model_binary . py < dirname > ` where ` < dirname > ` is specified below : <nl> <nl> - - * * BVLC Reference CaffeNet * * in ` models / bvlc_reference_caffenet ` : AlexNet trained on ILSVRC 2012 , with a minor variation from the version as described in the NIPS 2012 paper . ( Trained by Jeff Donahue @ jeffdonahue ) <nl> - - * * BVLC AlexNet * * in ` models / bvlc_alexnet ` : AlexNet trained on ILSVRC 2012 , almost exactly as described in NIPS 2012 . ( Trained by Evan Shelhamer @ shelhamer ) <nl> - - * * BVLC Reference R - CNN ILSVRC - 2013 * * in ` models / bvlc_reference_rcnn_ilsvrc13 ` : pure Caffe implementation of [ R - CNN ] ( https : / / github . com / rbgirshick / rcnn ) . ( Trained by Ross Girshick @ rbgirshick ) <nl> - - * * BVLC GoogleNet * * in ` models / bvlc_googlenet ` : GoogleNet trained on ILSVRC 2012 , almost exactly as described in [ GoogleNet ] ( http : / / arxiv . org / abs / 1409 . 4842 ) . ( Trained by Sergio Guadarrama @ sguada ) <nl> + - * * BVLC Reference CaffeNet * * in ` models / bvlc_reference_caffenet ` : AlexNet trained on ILSVRC 2012 , with a minor variation from the version as described in [ ImageNet classification with deep convolutional neural networks ] ( http : / / papers . nips . cc / paper / 4824 - imagenet - classification - with - deep - convolutional - neural - networks ) by Krizhevsky et al . in NIPS 2012 . ( Trained by Jeff Donahue @ jeffdonahue ) <nl> + - * * BVLC AlexNet * * in ` models / bvlc_alexnet ` : AlexNet trained on ILSVRC 2012 , almost exactly as described in [ ImageNet classification with deep convolutional neural networks ] ( http : / / papers . nips . cc / paper / 4824 - imagenet - classification - with - deep - convolutional - neural - networks ) by Krizhevsky et al . in NIPS 2012 . ( Trained by Evan Shelhamer @ shelhamer ) <nl> + - * * BVLC Reference R - CNN ILSVRC - 2013 * * in ` models / bvlc_reference_rcnn_ilsvrc13 ` : pure Caffe implementation of [ R - CNN ] ( https : / / github . com / rbgirshick / rcnn ) as described by Girshick et al . in CVPR 2014 . ( Trained by Ross Girshick @ rbgirshick ) <nl> + - * * BVLC GoogLeNet * * in ` models / bvlc_googlenet ` : GoogLeNet trained on ILSVRC 2012 , almost exactly as described in [ Going Deeper with Convolutions ] ( http : / / arxiv . org / abs / 1409 . 4842 ) by Szegedy et al . in ILSVRC 2014 . ( Trained by Sergio Guadarrama @ sguada ) <nl> <nl> - User - provided models are posted to a public - editable [ wiki page ] ( https : / / github . com / BVLC / caffe / wiki / Model - Zoo ) . <nl> + * * Community models * * made by Caffe users are posted to a publicly editable [ wiki page ] ( https : / / github . com / BVLC / caffe / wiki / Model - Zoo ) . <nl> + These models are subject to conditions of their respective authors such as citation and license . <nl> + Thank you for sharing your models ! <nl> <nl> # # Model info format <nl> <nl> A caffe model is distributed as a directory containing : <nl> - License information . <nl> - [ optional ] Other helpful scripts . <nl> <nl> - # # Hosting model info <nl> + # # # Hosting model info <nl> <nl> Github Gist is a good format for model info distribution because it can contain multiple files , is versionable , and has in - browser syntax highlighting and markdown rendering . <nl> <nl> - - ` scripts / upload_model_to_gist . sh < dirname > ` : uploads non - binary files in the model directory as a Github Gist and prints the Gist ID . If ` gist_id ` is already part of the ` < dirname > / readme . md ` frontmatter , then updates existing Gist . <nl> + ` scripts / upload_model_to_gist . sh < dirname > ` uploads non - binary files in the model directory as a Github Gist and prints the Gist ID . If ` gist_id ` is already part of the ` < dirname > / readme . md ` frontmatter , then updates existing Gist . <nl> <nl> Try doing ` scripts / upload_model_to_gist . sh models / bvlc_alexnet ` to test the uploading ( don ' t forget to delete the uploaded gist afterward ) . <nl> <nl> It is up to the user where to host the ` . caffemodel ` file . <nl> We host our BVLC - provided models on our own server . <nl> Dropbox also works fine ( tip : make sure that ` ? dl = 1 ` is appended to the end of the URL ) . <nl> <nl> - - ` scripts / download_model_binary . py < dirname > ` : downloads the ` . caffemodel ` from the URL specified in the ` < dirname > / readme . md ` frontmatter and confirms SHA1 . <nl> + ` scripts / download_model_binary . py < dirname > ` downloads the ` . caffemodel ` from the URL specified in the ` < dirname > / readme . md ` frontmatter and confirms SHA1 . <nl> + <nl> + # # BVLC model license <nl> + <nl> + The Caffe models bundled by the BVLC are released for unrestricted use . <nl> + <nl> + These models are trained on data from the [ ImageNet project ] ( http : / / www . image - net . org / ) and training data includes internet photos that may be subject to copyright . <nl> + <nl> + Our present understanding as researchers is that there is no restriction placed on the open release of these learned model weights , since none of the original images are distributed in whole or in part . <nl> + To the extent that the interpretation arises that weights are derivative works of the original copyright holder and they assert such a copyright , UC Berkeley makes no representations as to what use is allowed other than to consider our present release in the spirit of fair use in the academic mission of the university to disseminate knowledge and tools as broadly as possible without restriction . <nl> mmm a / examples / classification . ipynb <nl> ppp b / examples / classification . ipynb <nl> <nl> " \ n " , <nl> " Caffe provides a general Python interface for models with ` caffe . Net ` in ` python / caffe / pycaffe . py ` , but to make off - the - shelf classification easy we provide a ` caffe . Classifier ` class and ` classify . py ` script . Both Python and MATLAB wrappers are provided . However , the Python wrapper has more features so we will describe it here . For MATLAB , refer to ` matlab / caffe / matcaffe_demo . m ` . \ n " , <nl> " \ n " , <nl> - " Before we begin , you must compile Caffe and install the python wrapper by setting your ` PYTHONPATH ` . If you haven ' t yet done so , please refer to the [ installation instructions ] ( installation . html ) . This example uses our pre - trained CaffeNet model , an ILSVRC12 image classifier . You can download it by running ` . / scripts / download_model_binary . py models / bvlc_reference_caffenet ` . Note that this pre - trained model is licensed for academic research / non - commercial use only . \ n " , <nl> + " Before we begin , you must compile Caffe and install the python wrapper by setting your ` PYTHONPATH ` . If you haven ' t yet done so , please refer to the [ installation instructions ] ( installation . html ) . This example uses our pre - trained CaffeNet model , an ILSVRC12 image classifier . You can download it by running ` . / scripts / download_model_binary . py models / bvlc_reference_caffenet ` . \ n " , <nl> " \ n " , <nl> " Ready ? Let ' s start . " <nl> ] <nl> mmm a / models / bvlc_alexnet / readme . md <nl> ppp b / models / bvlc_alexnet / readme . md <nl> This model was trained by Evan Shelhamer @ shelhamer <nl> <nl> # # License <nl> <nl> - The data used to train this model comes from the ImageNet project , which distributes its database to researchers who agree to a following term of access : <nl> - " Researcher shall use the Database only for non - commercial research and educational purposes . " <nl> - Accordingly , this model is distributed under a non - commercial license . <nl> + This model is released for unrestricted use . <nl> mmm a / models / bvlc_googlenet / readme . md <nl> ppp b / models / bvlc_googlenet / readme . md <nl> This model was trained by Sergio Guadarrama @ sguada <nl> <nl> # # License <nl> <nl> - The data used to train this model comes from the ImageNet project , which distributes its database to researchers who agree to a following term of access : <nl> - " Researcher shall use the Database only for non - commercial research and educational purposes . " <nl> - Accordingly , this model is distributed under a non - commercial license . <nl> + This model is released for unrestricted use . <nl> mmm a / models / bvlc_reference_caffenet / readme . md <nl> ppp b / models / bvlc_reference_caffenet / readme . md <nl> This model was trained by Jeff Donahue @ jeffdonahue <nl> <nl> # # License <nl> <nl> - The data used to train this model comes from the ImageNet project , which distributes its database to researchers who agree to a following term of access : <nl> - " Researcher shall use the Database only for non - commercial research and educational purposes . " <nl> - Accordingly , this model is distributed under a non - commercial license . <nl> + This model is released for unrestricted use . <nl> mmm a / models / bvlc_reference_rcnn_ilsvrc13 / readme . md <nl> ppp b / models / bvlc_reference_rcnn_ilsvrc13 / readme . md <nl> This model was trained by Ross Girshick @ rbgirshick <nl> <nl> # # License <nl> <nl> - The data used to train this model comes from the ImageNet project , which distributes its database to researchers who agree to a following term of access : <nl> - " Researcher shall use the Database only for non - commercial research and educational purposes . " <nl> - Accordingly , this model is distributed under a non - commercial license . <nl> + This model is released for unrestricted use . <nl> | Merge pull request from shelhamer / unrestricted - bvlc - models | BVLC/caffe | 15bbd410b914bc5b93a425a48cf757aadd228310 | 2015-01-02T18:08:47Z |
mmm a / modules / monitor / proto / system_status . proto <nl> ppp b / modules / monitor / proto / system_status . proto <nl> message HardwareStatus { <nl> / / HW error , can ' t be used . <nl> ERR = 3 ; <nl> <nl> - / / For internal use only . <nl> UNDEF = - 1 ; <nl> } <nl> <nl> - optional Status status = 1 ; <nl> + optional Status status = 1 [ default = UNDEF ] ; <nl> <nl> / / Additional message for current status . <nl> optional string msg = 2 ; <nl> | Monitor : Set default hardware status as UNDEF to fix DV display . ( ) | ApolloAuto/apollo | cb902eb3ef1ab5245d21c4c62397d059a2f5a90a | 2017-11-15T00:22:19Z |
mmm a / stdlib / core / Arrays . swift . gyb <nl> ppp b / stdlib / core / Arrays . swift . gyb <nl> public struct $ { Self } < T > : MutableCollectionType , Sliceable , _DestructorSafeCont <nl> <nl> / / / Access the ` index ` \ th element . Reading is O ( 1 ) . Writing is <nl> / / / $ { O1 } . <nl> + # if _runtime ( _ObjC ) <nl> + / / FIXME : Code is duplicated here between the Objective - C and non - Objective - C <nl> + / / runtimes because config blocks can ' t appear inside a subscript function <nl> + / / without causing parse errors . When this is fixed , they should be merged <nl> + / / as described in the comment below . <nl> + / / rdar : / / problem / 19553956 <nl> public subscript ( index : Int ) - > Element { <nl> % if Self = = ' Array ' : <nl> get { <nl> _checkSubscript ( index ) <nl> return _getElement ( index ) <nl> } <nl> + / / on non - Objective - C , this should just be NativeOwner for all other <nl> + / / cases , including Slice . <nl> % elif Self = = ' Slice ' : <nl> addressWithOwner { <nl> _checkSubscript ( index ) <nl> public struct $ { Self } < T > : MutableCollectionType , Sliceable , _DestructorSafeCont <nl> Builtin . tryPin ( Builtin . castToNativeObject ( _buffer . owner ) ) ) <nl> } <nl> } <nl> + # else <nl> + public subscript ( index : Int ) - > Element { <nl> + addressWithNativeOwner { <nl> + _checkSubscript ( index ) <nl> + return ( UnsafePointer ( _buffer . baseAddress + index ) , <nl> + Builtin . castToNativeObject ( _buffer . owner ) ) <nl> + } <nl> + mutableAddressWithPinnedNativeOwner { <nl> + _makeMutableAndUniqueOrPinned ( ) <nl> + _checkSubscript ( index ) <nl> + return ( _getElementAddress ( index ) , <nl> + Builtin . tryPin ( Builtin . castToNativeObject ( _buffer . owner ) ) ) <nl> + } <nl> + } <nl> + # endif <nl> <nl> / / / Return a * generator * over the elements . <nl> / / / <nl> | Don ' t use UnknownObject on non - Objective - C . | apple/swift | 9752dc68ef059e62040887a06bfac9439fcf772f | 2015-01-22T18:20:21Z |
mmm a / drivers / python / rethinkdb / ast . py <nl> ppp b / drivers / python / rethinkdb / ast . py <nl> def distinct ( self ) : <nl> # NB : Can ' t overload __len__ because Python doesn ' t <nl> # allow us to return a non - integer <nl> def count ( self , filter = ( ) ) : <nl> - if filter = = ( ) : <nl> + if filter is ( ) : <nl> return Count ( self ) <nl> else : <nl> return Count ( self , func_wrap ( filter ) ) <nl> | Improved check for count filter argument . | rethinkdb/rethinkdb | 7b21b27fdfe8a0c2745ec802d7cd3b791d8d55c4 | 2014-02-23T07:23:27Z |
mmm a / cocos / scripting / js - bindings / script / debugger / actors / webconsole . js <nl> ppp b / cocos / scripting / js - bindings / script / debugger / actors / webconsole . js <nl> <nl> / / . ServerLoggingListener ; <nl> / / } ) ; <nl> <nl> - / / for ( let name of [ " WebConsoleUtils " , " ConsoleServiceListener " , <nl> - / / " ConsoleAPIListener " , " addWebConsoleCommands " , " JSPropertyProvider " , <nl> - / / " ConsoleReflowListener " , " CONSOLE_WORKER_IDS " ] ) { <nl> - / / Object . defineProperty ( this , name , { <nl> - / / get : function ( prop ) { <nl> - / / if ( prop = = " WebConsoleUtils " ) { <nl> - / / prop = " Utils " ; <nl> - / / } <nl> - / / return require ( " devtools / toolkit / webconsole / utils " ) [ prop ] ; <nl> - / / } . bind ( null , name ) , <nl> - / / configurable : true , <nl> - / / enumerable : true <nl> - / / } ) ; <nl> - / / } <nl> + let webutils = require ( ' script / debugger / webconsole / utils . js ' , ' debug ' ) ; <nl> + <nl> + Object . defineProperty ( this , " JSPropertyProvider " , { <nl> + get : function ( ) { <nl> + / / if ( prop = = " WebConsoleUtils " ) { <nl> + / / prop = " Utils " ; <nl> + / / } <nl> + return webutils [ " JSPropertyProvider " ] ; <nl> + } . bind ( null , " JSPropertyProvider " ) , <nl> + configurable : true , <nl> + enumerable : true <nl> + } ) ; <nl> + <nl> <nl> / * * <nl> * The WebConsoleActor implements capabilities needed for the Web Console <nl> WebConsoleActor . prototype = <nl> let listener = aRequest . listeners . shift ( ) ; <nl> switch ( listener ) { <nl> case " PageError " : <nl> - if ( ! this . consoleServiceListener ) { <nl> - this . consoleServiceListener = <nl> - new ConsoleServiceListener ( window , this ) ; <nl> - this . consoleServiceListener . init ( ) ; <nl> - } <nl> - startedListeners . push ( listener ) ; <nl> + / / if ( ! this . consoleServiceListener ) { <nl> + / / this . consoleServiceListener = <nl> + / / new ConsoleServiceListener ( window , this ) ; <nl> + / / this . consoleServiceListener . init ( ) ; <nl> + / / } <nl> + / / startedListeners . push ( listener ) ; <nl> break ; <nl> case " ConsoleAPI " : <nl> if ( ! this . consoleAPIListener ) { <nl> WebConsoleActor . prototype = <nl> / / startedListeners . push ( listener ) ; <nl> break ; <nl> case " FileActivity " : <nl> - if ( this . window instanceof Ci . nsIDOMWindow ) { <nl> - if ( ! this . consoleProgressListener ) { <nl> - this . consoleProgressListener = <nl> - new ConsoleProgressListener ( this . window , this ) ; <nl> - } <nl> - this . consoleProgressListener . startMonitor ( this . consoleProgressListener . <nl> - MONITOR_FILE_ACTIVITY ) ; <nl> - startedListeners . push ( listener ) ; <nl> - } <nl> + / / if ( this . window instanceof Ci . nsIDOMWindow ) { <nl> + / / if ( ! this . consoleProgressListener ) { <nl> + / / this . consoleProgressListener = <nl> + / / new ConsoleProgressListener ( this . window , this ) ; <nl> + / / } <nl> + / / this . consoleProgressListener . startMonitor ( this . consoleProgressListener . <nl> + / / MONITOR_FILE_ACTIVITY ) ; <nl> + / / startedListeners . push ( listener ) ; <nl> + / / } <nl> break ; <nl> case " ReflowActivity " : <nl> if ( ! this . consoleReflowListener ) { <nl> WebConsoleActor . prototype = <nl> environment = frame . environment ; <nl> } <nl> else { <nl> - Cu . reportError ( " Web Console Actor : the frame actor was not found : " + <nl> + log ( " Web Console Actor : the frame actor was not found : " + <nl> frameActorId ) ; <nl> } <nl> } <nl> WebConsoleActor . prototype = <nl> / / helpers like cd ( ) , where we users sometimes want to pass a cross - origin <nl> / / window . To circumvent this restriction , we use exportFunction along <nl> / / with a special option designed for this purpose . See bug 1051224 . <nl> - obj [ name ] = <nl> - Cu . exportFunction ( obj [ name ] , evalWindow , { allowCrossOriginArguments : true } ) ; <nl> + / / obj [ name ] = <nl> + / / Cu . exportFunction ( obj [ name ] , evalWindow , { allowCrossOriginArguments : true } ) ; <nl> } <nl> for ( let name in helpers . sandbox ) { <nl> let desc = Object . getOwnPropertyDescriptor ( helpers . sandbox , name ) ; <nl> mmm a / cocos / scripting / js - bindings / script / debugger / main . js <nl> ppp b / cocos / scripting / js - bindings / script / debugger / main . js <nl> DebuggerServerConnection . prototype = { <nl> this . transport . send ( this . _unknownError ( <nl> " error occurred while processing ' " + aPacket . type , <nl> e ) ) ; <nl> + / / log ( e . stack ) ; <nl> } finally { <nl> this . currentPacket = undefined ; <nl> } <nl> mmm a / cocos / scripting / js - bindings / script / debugger / transport . js <nl> ppp b / cocos / scripting / js - bindings / script / debugger / transport . js <nl> DebuggerTransport . prototype = { <nl> if ( this . _outgoing . length > 0 ) { <nl> / / var threadManager = Cc [ " @ mozilla . org / thread - manager ; 1 " ] . getService ( ) ; <nl> / / this . _output . asyncWait ( this , 0 , 0 , threadManager . currentThread ) ; <nl> + / / log ( ' send : ' + this . _outgoing ) ; <nl> _bufferWrite ( this . _outgoing ) ; <nl> } <nl> } , <nl> new file mode 100644 <nl> index 000000000000 . . f43e0cfc806b <nl> mmm / dev / null <nl> ppp b / cocos / scripting / js - bindings / script / debugger / webconsole / utils . js <nl> <nl> + / * - * - js - indent - level : 2 ; indent - tabs - mode : nil - * - * / <nl> + / * vim : set ft = javascript ts = 2 et sw = 2 tw = 80 : * / <nl> + / * This Source Code Form is subject to the terms of the Mozilla Public <nl> + * License , v . 2 . 0 . If a copy of the MPL was not distributed with this file , <nl> + * You can obtain one at http : / / mozilla . org / MPL / 2 . 0 / . * / <nl> + <nl> + " use strict " ; <nl> + <nl> + / / const { Cc , Ci , Cu , components } = require ( " chrome " ) ; <nl> + / / const { isWindowIncluded } = require ( " devtools / toolkit / layout / utils " ) ; <nl> + <nl> + / / Cu . import ( " resource : / / gre / modules / XPCOMUtils . jsm " ) ; <nl> + <nl> + / / loader . lazyImporter ( this , " Services " , " resource : / / gre / modules / Services . jsm " ) ; <nl> + <nl> + / / TODO : Bug 842672 - browser / imports modules from toolkit / . <nl> + / / Note that these are only used in WebConsoleCommands , see $ 0 and pprint ( ) . <nl> + / / loader . lazyImporter ( this , " VariablesView " , " resource : / / / modules / devtools / VariablesView . jsm " ) ; <nl> + / / const DevToolsUtils = require ( " devtools / toolkit / DevToolsUtils " ) ; <nl> + <nl> + / / Match the function name from the result of toString ( ) or toSource ( ) . <nl> + / / <nl> + / / Examples : <nl> + / / ( function foobar ( a , b ) { . . . <nl> + / / function foobar2 ( a ) { . . . <nl> + / / function ( ) { . . . <nl> + <nl> + var exports = exports | | { } ; <nl> + <nl> + <nl> + const REGEX_MATCH_FUNCTION_NAME = / ^ \ ( ? function \ s + ( [ ^ ( \ s ] + ) \ s * \ ( / ; <nl> + <nl> + / / Match the function arguments from the result of toString ( ) or toSource ( ) . <nl> + const REGEX_MATCH_FUNCTION_ARGS = / ^ \ ( ? function \ s * [ ^ \ s ( ] * \ s * \ ( ( . + ? ) \ ) / ; <nl> + <nl> + / / Number of terminal entries for the self - xss prevention to go away <nl> + const CONSOLE_ENTRY_THRESHOLD = 5 ; <nl> + <nl> + / / Provide an easy way to bail out of even attempting an autocompletion <nl> + / / if an object has way too many properties . Protects against large objects <nl> + / / with numeric values that wouldn ' t be tallied towards MAX_AUTOCOMPLETIONS . <nl> + const MAX_AUTOCOMPLETE_ATTEMPTS = exports . MAX_AUTOCOMPLETE_ATTEMPTS = 100000 ; <nl> + <nl> + const CONSOLE_WORKER_IDS = exports . CONSOLE_WORKER_IDS = [ ' SharedWorker ' , ' ServiceWorker ' , ' Worker ' ] ; <nl> + <nl> + / / Prevent iterating over too many properties during autocomplete suggestions . <nl> + const MAX_AUTOCOMPLETIONS = exports . MAX_AUTOCOMPLETIONS = 1500 ; <nl> + <nl> + var WebConsoleUtils = { <nl> + <nl> + / * * <nl> + * Wrap a string in an nsISupportsString object . <nl> + * <nl> + * @ param string aString <nl> + * @ return nsISupportsString <nl> + * / <nl> + supportsString : function WCU_supportsString ( aString ) <nl> + { <nl> + let str = Cc [ " @ mozilla . org / supports - string ; 1 " ] . <nl> + createInstance ( Ci . nsISupportsString ) ; <nl> + str . data = aString ; <nl> + return str ; <nl> + } , <nl> + <nl> + / * * <nl> + * Clone an object . <nl> + * <nl> + * @ param object aObject <nl> + * The object you want cloned . <nl> + * @ param boolean aRecursive <nl> + * Tells if you want to dig deeper into the object , to clone <nl> + * recursively . <nl> + * @ param function [ aFilter ] <nl> + * Optional , filter function , called for every property . Three <nl> + * arguments are passed : key , value and object . Return true if the <nl> + * property should be added to the cloned object . Return false to skip <nl> + * the property . <nl> + * @ return object <nl> + * The cloned object . <nl> + * / <nl> + cloneObject : function WCU_cloneObject ( aObject , aRecursive , aFilter ) <nl> + { <nl> + if ( typeof aObject ! = " object " ) { <nl> + return aObject ; <nl> + } <nl> + <nl> + let temp ; <nl> + <nl> + if ( Array . isArray ( aObject ) ) { <nl> + temp = [ ] ; <nl> + Array . forEach ( aObject , function ( aValue , aIndex ) { <nl> + if ( ! aFilter | | aFilter ( aIndex , aValue , aObject ) ) { <nl> + temp . push ( aRecursive ? WCU_cloneObject ( aValue ) : aValue ) ; <nl> + } <nl> + } ) ; <nl> + } <nl> + else { <nl> + temp = { } ; <nl> + for ( let key in aObject ) { <nl> + let value = aObject [ key ] ; <nl> + if ( aObject . hasOwnProperty ( key ) & & <nl> + ( ! aFilter | | aFilter ( key , value , aObject ) ) ) { <nl> + temp [ key ] = aRecursive ? WCU_cloneObject ( value ) : value ; <nl> + } <nl> + } <nl> + } <nl> + <nl> + return temp ; <nl> + } , <nl> + <nl> + / * * <nl> + * Copies certain style attributes from one element to another . <nl> + * <nl> + * @ param nsIDOMNode aFrom <nl> + * The target node . <nl> + * @ param nsIDOMNode aTo <nl> + * The destination node . <nl> + * / <nl> + copyTextStyles : function WCU_copyTextStyles ( aFrom , aTo ) <nl> + { <nl> + let win = aFrom . ownerDocument . defaultView ; <nl> + let style = win . getComputedStyle ( aFrom ) ; <nl> + aTo . style . fontFamily = style . getPropertyCSSValue ( " font - family " ) . cssText ; <nl> + aTo . style . fontSize = style . getPropertyCSSValue ( " font - size " ) . cssText ; <nl> + aTo . style . fontWeight = style . getPropertyCSSValue ( " font - weight " ) . cssText ; <nl> + aTo . style . fontStyle = style . getPropertyCSSValue ( " font - style " ) . cssText ; <nl> + } , <nl> + <nl> + / * * <nl> + * Gets the ID of the inner window of this DOM window . <nl> + * <nl> + * @ param nsIDOMWindow aWindow <nl> + * @ return integer <nl> + * Inner ID for the given aWindow . <nl> + * / <nl> + getInnerWindowId : function WCU_getInnerWindowId ( aWindow ) <nl> + { <nl> + return aWindow . QueryInterface ( Ci . nsIInterfaceRequestor ) . <nl> + getInterface ( Ci . nsIDOMWindowUtils ) . currentInnerWindowID ; <nl> + } , <nl> + <nl> + / * * <nl> + * Recursively gather a list of inner window ids given a <nl> + * top level window . <nl> + * <nl> + * @ param nsIDOMWindow aWindow <nl> + * @ return Array <nl> + * list of inner window ids . <nl> + * / <nl> + getInnerWindowIDsForFrames : function WCU_getInnerWindowIDsForFrames ( aWindow ) <nl> + { <nl> + let innerWindowID = this . getInnerWindowId ( aWindow ) ; <nl> + let ids = [ innerWindowID ] ; <nl> + <nl> + if ( aWindow . frames ) { <nl> + for ( let i = 0 ; i < aWindow . frames . length ; i + + ) { <nl> + let frame = aWindow . frames [ i ] ; <nl> + ids = ids . concat ( this . getInnerWindowIDsForFrames ( frame ) ) ; <nl> + } <nl> + } <nl> + <nl> + return ids ; <nl> + } , <nl> + <nl> + <nl> + / * * <nl> + * Gets the ID of the outer window of this DOM window . <nl> + * <nl> + * @ param nsIDOMWindow aWindow <nl> + * @ return integer <nl> + * Outer ID for the given aWindow . <nl> + * / <nl> + getOuterWindowId : function WCU_getOuterWindowId ( aWindow ) <nl> + { <nl> + return aWindow . QueryInterface ( Ci . nsIInterfaceRequestor ) . <nl> + getInterface ( Ci . nsIDOMWindowUtils ) . outerWindowID ; <nl> + } , <nl> + <nl> + / * * <nl> + * Abbreviates the given source URL so that it can be displayed flush - right <nl> + * without being too distracting . <nl> + * <nl> + * @ param string aSourceURL <nl> + * The source URL to shorten . <nl> + * @ param object [ aOptions ] <nl> + * Options : <nl> + * - onlyCropQuery : boolean that tells if the URL abbreviation function <nl> + * should only remove the query parameters and the hash fragment from <nl> + * the given URL . <nl> + * @ return string <nl> + * The abbreviated form of the source URL . <nl> + * / <nl> + abbreviateSourceURL : <nl> + function WCU_abbreviateSourceURL ( aSourceURL , aOptions = { } ) <nl> + { <nl> + if ( ! aOptions . onlyCropQuery & & aSourceURL . substr ( 0 , 5 ) = = " data : " ) { <nl> + let commaIndex = aSourceURL . indexOf ( " , " ) ; <nl> + if ( commaIndex > - 1 ) { <nl> + aSourceURL = " data : " + aSourceURL . substring ( commaIndex + 1 ) ; <nl> + } <nl> + } <nl> + <nl> + / / Remove any query parameters . <nl> + let hookIndex = aSourceURL . indexOf ( " ? " ) ; <nl> + if ( hookIndex > - 1 ) { <nl> + aSourceURL = aSourceURL . substring ( 0 , hookIndex ) ; <nl> + } <nl> + <nl> + / / Remove any hash fragments . <nl> + let hashIndex = aSourceURL . indexOf ( " # " ) ; <nl> + if ( hashIndex > - 1 ) { <nl> + aSourceURL = aSourceURL . substring ( 0 , hashIndex ) ; <nl> + } <nl> + <nl> + / / Remove a trailing " / " . <nl> + if ( aSourceURL [ aSourceURL . length - 1 ] = = " / " ) { <nl> + aSourceURL = aSourceURL . replace ( / \ / + $ / , " " ) ; <nl> + } <nl> + <nl> + / / Remove all but the last path component . <nl> + if ( ! aOptions . onlyCropQuery ) { <nl> + let slashIndex = aSourceURL . lastIndexOf ( " / " ) ; <nl> + if ( slashIndex > - 1 ) { <nl> + aSourceURL = aSourceURL . substring ( slashIndex + 1 ) ; <nl> + } <nl> + } <nl> + <nl> + return aSourceURL ; <nl> + } , <nl> + <nl> + / * * <nl> + * Tells if the given function is native or not . <nl> + * <nl> + * @ param function aFunction <nl> + * The function you want to check if it is native or not . <nl> + * @ return boolean <nl> + * True if the given function is native , false otherwise . <nl> + * / <nl> + isNativeFunction : function WCU_isNativeFunction ( aFunction ) <nl> + { <nl> + return typeof aFunction = = " function " & & ! ( " prototype " in aFunction ) ; <nl> + } , <nl> + <nl> + / * * <nl> + * Tells if the given property of the provided object is a non - native getter or <nl> + * not . <nl> + * <nl> + * @ param object aObject <nl> + * The object that contains the property . <nl> + * @ param string aProp <nl> + * The property you want to check if it is a getter or not . <nl> + * @ return boolean <nl> + * True if the given property is a getter , false otherwise . <nl> + * / <nl> + isNonNativeGetter : function WCU_isNonNativeGetter ( aObject , aProp ) <nl> + { <nl> + if ( typeof aObject ! = " object " ) { <nl> + return false ; <nl> + } <nl> + let desc = this . getPropertyDescriptor ( aObject , aProp ) ; <nl> + return desc & & desc . get & & ! this . isNativeFunction ( desc . get ) ; <nl> + } , <nl> + <nl> + / * * <nl> + * Get the property descriptor for the given object . <nl> + * <nl> + * @ param object aObject <nl> + * The object that contains the property . <nl> + * @ param string aProp <nl> + * The property you want to get the descriptor for . <nl> + * @ return object <nl> + * Property descriptor . <nl> + * / <nl> + getPropertyDescriptor : function WCU_getPropertyDescriptor ( aObject , aProp ) <nl> + { <nl> + let desc = null ; <nl> + while ( aObject ) { <nl> + try { <nl> + if ( ( desc = Object . getOwnPropertyDescriptor ( aObject , aProp ) ) ) { <nl> + break ; <nl> + } <nl> + } catch ( ex ) { <nl> + / / Native getters throw here . See bug 520882 . <nl> + / / null throws TypeError . <nl> + if ( ex . name ! = " NS_ERROR_XPC_BAD_CONVERT_JS " & & <nl> + ex . name ! = " NS_ERROR_XPC_BAD_OP_ON_WN_PROTO " & & <nl> + ex . name ! = " TypeError " ) { <nl> + throw ex ; <nl> + } <nl> + } <nl> + <nl> + try { <nl> + aObject = Object . getPrototypeOf ( aObject ) ; <nl> + } catch ( ex ) { <nl> + if ( ex . name = = " TypeError " ) { <nl> + return desc ; <nl> + } <nl> + throw ex ; <nl> + } <nl> + } <nl> + return desc ; <nl> + } , <nl> + <nl> + / * * <nl> + * Sort function for object properties . <nl> + * <nl> + * @ param object a <nl> + * Property descriptor . <nl> + * @ param object b <nl> + * Property descriptor . <nl> + * @ return integer <nl> + * - 1 if a . name < b . name , <nl> + * 1 if a . name > b . name , <nl> + * 0 otherwise . <nl> + * / <nl> + propertiesSort : function WCU_propertiesSort ( a , b ) <nl> + { <nl> + / / Convert the pair . name to a number for later sorting . <nl> + let aNumber = parseFloat ( a . name ) ; <nl> + let bNumber = parseFloat ( b . name ) ; <nl> + <nl> + / / Sort numbers . <nl> + if ( ! isNaN ( aNumber ) & & isNaN ( bNumber ) ) { <nl> + return - 1 ; <nl> + } <nl> + else if ( isNaN ( aNumber ) & & ! isNaN ( bNumber ) ) { <nl> + return 1 ; <nl> + } <nl> + else if ( ! isNaN ( aNumber ) & & ! isNaN ( bNumber ) ) { <nl> + return aNumber - bNumber ; <nl> + } <nl> + / / Sort string . <nl> + else if ( a . name < b . name ) { <nl> + return - 1 ; <nl> + } <nl> + else if ( a . name > b . name ) { <nl> + return 1 ; <nl> + } <nl> + else { <nl> + return 0 ; <nl> + } <nl> + } , <nl> + <nl> + / * * <nl> + * Create a grip for the given value . If the value is an object , <nl> + * an object wrapper will be created . <nl> + * <nl> + * @ param mixed aValue <nl> + * The value you want to create a grip for , before sending it to the <nl> + * client . <nl> + * @ param function aObjectWrapper <nl> + * If the value is an object then the aObjectWrapper function is <nl> + * invoked to give us an object grip . See this . getObjectGrip ( ) . <nl> + * @ return mixed <nl> + * The value grip . <nl> + * / <nl> + createValueGrip : function WCU_createValueGrip ( aValue , aObjectWrapper ) <nl> + { <nl> + switch ( typeof aValue ) { <nl> + case " boolean " : <nl> + return aValue ; <nl> + case " string " : <nl> + return aObjectWrapper ( aValue ) ; <nl> + case " number " : <nl> + if ( aValue = = = Infinity ) { <nl> + return { type : " Infinity " } ; <nl> + } <nl> + else if ( aValue = = = - Infinity ) { <nl> + return { type : " - Infinity " } ; <nl> + } <nl> + else if ( Number . isNaN ( aValue ) ) { <nl> + return { type : " NaN " } ; <nl> + } <nl> + else if ( ! aValue & & 1 / aValue = = = - Infinity ) { <nl> + return { type : " - 0 " } ; <nl> + } <nl> + return aValue ; <nl> + case " undefined " : <nl> + return { type : " undefined " } ; <nl> + case " object " : <nl> + if ( aValue = = = null ) { <nl> + return { type : " null " } ; <nl> + } <nl> + case " function " : <nl> + return aObjectWrapper ( aValue ) ; <nl> + default : <nl> + Cu . reportError ( " Failed to provide a grip for value of " + typeof aValue <nl> + + " : " + aValue ) ; <nl> + return null ; <nl> + } <nl> + } , <nl> + <nl> + / * * <nl> + * Check if the given object is an iterator or a generator . <nl> + * <nl> + * @ param object aObject <nl> + * The object you want to check . <nl> + * @ return boolean <nl> + * True if the given object is an iterator or a generator , otherwise <nl> + * false is returned . <nl> + * / <nl> + isIteratorOrGenerator : function WCU_isIteratorOrGenerator ( aObject ) <nl> + { <nl> + if ( aObject = = = null ) { <nl> + return false ; <nl> + } <nl> + <nl> + if ( typeof aObject = = " object " ) { <nl> + if ( typeof aObject . __iterator__ = = " function " | | <nl> + aObject . constructor & & aObject . constructor . name = = " Iterator " ) { <nl> + return true ; <nl> + } <nl> + <nl> + try { <nl> + let str = aObject . toString ( ) ; <nl> + if ( typeof aObject . next = = " function " & & <nl> + str . indexOf ( " [ object Generator " ) = = 0 ) { <nl> + return true ; <nl> + } <nl> + } <nl> + catch ( ex ) { <nl> + / / window . history . next throws in the typeof check above . <nl> + return false ; <nl> + } <nl> + } <nl> + <nl> + return false ; <nl> + } , <nl> + <nl> + / * * <nl> + * Determine if the given request mixes HTTP with HTTPS content . <nl> + * <nl> + * @ param string aRequest <nl> + * Location of the requested content . <nl> + * @ param string aLocation <nl> + * Location of the current page . <nl> + * @ return boolean <nl> + * True if the content is mixed , false if not . <nl> + * / <nl> + isMixedHTTPSRequest : function WCU_isMixedHTTPSRequest ( aRequest , aLocation ) <nl> + { <nl> + try { <nl> + let requestURI = Services . io . newURI ( aRequest , null , null ) ; <nl> + let contentURI = Services . io . newURI ( aLocation , null , null ) ; <nl> + return ( contentURI . scheme = = " https " & & requestURI . scheme ! = " https " ) ; <nl> + } <nl> + catch ( ex ) { <nl> + return false ; <nl> + } <nl> + } , <nl> + <nl> + / * * <nl> + * Helper function to deduce the name of the provided function . <nl> + * <nl> + * @ param funtion aFunction <nl> + * The function whose name will be returned . <nl> + * @ return string <nl> + * Function name . <nl> + * / <nl> + getFunctionName : function WCF_getFunctionName ( aFunction ) <nl> + { <nl> + let name = null ; <nl> + if ( aFunction . name ) { <nl> + name = aFunction . name ; <nl> + } <nl> + else { <nl> + let desc ; <nl> + try { <nl> + desc = aFunction . getOwnPropertyDescriptor ( " displayName " ) ; <nl> + } <nl> + catch ( ex ) { } <nl> + if ( desc & & typeof desc . value = = " string " ) { <nl> + name = desc . value ; <nl> + } <nl> + } <nl> + if ( ! name ) { <nl> + try { <nl> + let str = ( aFunction . toString ( ) | | aFunction . toSource ( ) ) + " " ; <nl> + name = ( str . match ( REGEX_MATCH_FUNCTION_NAME ) | | [ ] ) [ 1 ] ; <nl> + } <nl> + catch ( ex ) { } <nl> + } <nl> + return name ; <nl> + } , <nl> + <nl> + / * * <nl> + * Get the object class name . For example , the | window | object has the Window <nl> + * class name ( based on [ object Window ] ) . <nl> + * <nl> + * @ param object aObject <nl> + * The object you want to get the class name for . <nl> + * @ return string <nl> + * The object class name . <nl> + * / <nl> + getObjectClassName : function WCU_getObjectClassName ( aObject ) <nl> + { <nl> + if ( aObject = = = null ) { <nl> + return " null " ; <nl> + } <nl> + if ( aObject = = = undefined ) { <nl> + return " undefined " ; <nl> + } <nl> + <nl> + let type = typeof aObject ; <nl> + if ( type ! = " object " ) { <nl> + / / Grip class names should start with an uppercase letter . <nl> + return type . charAt ( 0 ) . toUpperCase ( ) + type . substr ( 1 ) ; <nl> + } <nl> + <nl> + let className ; <nl> + <nl> + try { <nl> + className = ( ( aObject + " " ) . match ( / ^ \ [ object ( \ S + ) \ ] $ / ) | | [ ] ) [ 1 ] ; <nl> + if ( ! className ) { <nl> + className = ( ( aObject . constructor + " " ) . match ( / ^ \ [ object ( \ S + ) \ ] $ / ) | | [ ] ) [ 1 ] ; <nl> + } <nl> + if ( ! className & & typeof aObject . constructor = = " function " ) { <nl> + className = this . getFunctionName ( aObject . constructor ) ; <nl> + } <nl> + } <nl> + catch ( ex ) { } <nl> + <nl> + return className ; <nl> + } , <nl> + <nl> + / * * <nl> + * Check if the given value is a grip with an actor . <nl> + * <nl> + * @ param mixed aGrip <nl> + * Value you want to check if it is a grip with an actor . <nl> + * @ return boolean <nl> + * True if the given value is a grip with an actor . <nl> + * / <nl> + isActorGrip : function WCU_isActorGrip ( aGrip ) <nl> + { <nl> + return aGrip & & typeof ( aGrip ) = = " object " & & aGrip . actor ; <nl> + } , <nl> + / * * <nl> + * Value of devtools . selfxss . count preference <nl> + * <nl> + * @ type number <nl> + * @ private <nl> + * / <nl> + _usageCount : 0 , <nl> + get usageCount ( ) { <nl> + if ( WebConsoleUtils . _usageCount < CONSOLE_ENTRY_THRESHOLD ) { <nl> + WebConsoleUtils . _usageCount = Services . prefs . getIntPref ( " devtools . selfxss . count " ) ; <nl> + if ( Services . prefs . getBoolPref ( " devtools . chrome . enabled " ) ) { <nl> + WebConsoleUtils . usageCount = CONSOLE_ENTRY_THRESHOLD ; <nl> + } <nl> + } <nl> + return WebConsoleUtils . _usageCount ; <nl> + } , <nl> + set usageCount ( newUC ) { <nl> + if ( newUC < = CONSOLE_ENTRY_THRESHOLD ) { <nl> + WebConsoleUtils . _usageCount = newUC ; <nl> + Services . prefs . setIntPref ( " devtools . selfxss . count " , newUC ) ; <nl> + } <nl> + } , <nl> + / * * <nl> + * The inputNode " paste " event handler generator . Helps prevent self - xss attacks <nl> + * <nl> + * @ param nsIDOMElement inputField <nl> + * @ param nsIDOMElement notificationBox <nl> + * @ returns A function to be added as a handler to ' paste ' and ' drop ' events on the input field <nl> + * / <nl> + pasteHandlerGen : function WCU_pasteHandlerGen ( inputField , notificationBox , msg , okstring ) { <nl> + let handler = function WCU_pasteHandler ( aEvent ) { <nl> + if ( WebConsoleUtils . usageCount > = CONSOLE_ENTRY_THRESHOLD ) { <nl> + inputField . removeEventListener ( " paste " , handler ) ; <nl> + inputField . removeEventListener ( " drop " , handler ) ; <nl> + return true ; <nl> + } <nl> + if ( notificationBox . getNotificationWithValue ( " selfxss - notification " ) ) { <nl> + aEvent . preventDefault ( ) ; <nl> + aEvent . stopPropagation ( ) ; <nl> + return false ; <nl> + } <nl> + <nl> + <nl> + let notification = notificationBox . appendNotification ( msg , <nl> + " selfxss - notification " , null , notificationBox . PRIORITY_WARNING_HIGH , null , <nl> + function ( eventType ) { <nl> + / / Cleanup function if notification is dismissed <nl> + if ( eventType = = " removed " ) { <nl> + inputField . removeEventListener ( " keyup " , pasteKeyUpHandler ) ; <nl> + } <nl> + } ) ; <nl> + <nl> + function pasteKeyUpHandler ( aEvent2 ) { <nl> + let value = inputField . value | | inputField . textContent ; <nl> + if ( value . includes ( okstring ) ) { <nl> + notificationBox . removeNotification ( notification ) ; <nl> + inputField . removeEventListener ( " keyup " , pasteKeyUpHandler ) ; <nl> + WebConsoleUtils . usageCount = CONSOLE_ENTRY_THRESHOLD ; <nl> + } <nl> + } <nl> + inputField . addEventListener ( " keyup " , pasteKeyUpHandler ) ; <nl> + <nl> + aEvent . preventDefault ( ) ; <nl> + aEvent . stopPropagation ( ) ; <nl> + return false ; <nl> + } ; <nl> + return handler ; <nl> + } , <nl> + <nl> + <nl> + } ; <nl> + <nl> + exports . Utils = WebConsoleUtils ; <nl> + <nl> + / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / <nl> + / / Localization <nl> + / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / <nl> + <nl> + WebConsoleUtils . l10n = function WCU_l10n ( aBundleURI ) <nl> + { <nl> + this . _bundleUri = aBundleURI ; <nl> + } ; <nl> + <nl> + WebConsoleUtils . l10n . prototype = { <nl> + _stringBundle : null , <nl> + <nl> + get stringBundle ( ) <nl> + { <nl> + if ( ! this . _stringBundle ) { <nl> + this . _stringBundle = Services . strings . createBundle ( this . _bundleUri ) ; <nl> + } <nl> + return this . _stringBundle ; <nl> + } , <nl> + <nl> + / * * <nl> + * Generates a formatted timestamp string for displaying in console messages . <nl> + * <nl> + * @ param integer [ aMilliseconds ] <nl> + * Optional , allows you to specify the timestamp in milliseconds since <nl> + * the UNIX epoch . <nl> + * @ return string <nl> + * The timestamp formatted for display . <nl> + * / <nl> + timestampString : function WCU_l10n_timestampString ( aMilliseconds ) <nl> + { <nl> + let d = new Date ( aMilliseconds ? aMilliseconds : null ) ; <nl> + let hours = d . getHours ( ) , minutes = d . getMinutes ( ) ; <nl> + let seconds = d . getSeconds ( ) , milliseconds = d . getMilliseconds ( ) ; <nl> + let parameters = [ hours , minutes , seconds , milliseconds ] ; <nl> + return this . getFormatStr ( " timestampFormat " , parameters ) ; <nl> + } , <nl> + <nl> + / * * <nl> + * Retrieve a localized string . <nl> + * <nl> + * @ param string aName <nl> + * The string name you want from the Web Console string bundle . <nl> + * @ return string <nl> + * The localized string . <nl> + * / <nl> + getStr : function WCU_l10n_getStr ( aName ) <nl> + { <nl> + let result ; <nl> + try { <nl> + result = this . stringBundle . GetStringFromName ( aName ) ; <nl> + } <nl> + catch ( ex ) { <nl> + Cu . reportError ( " Failed to get string : " + aName ) ; <nl> + throw ex ; <nl> + } <nl> + return result ; <nl> + } , <nl> + <nl> + / * * <nl> + * Retrieve a localized string formatted with values coming from the given <nl> + * array . <nl> + * <nl> + * @ param string aName <nl> + * The string name you want from the Web Console string bundle . <nl> + * @ param array aArray <nl> + * The array of values you want in the formatted string . <nl> + * @ return string <nl> + * The formatted local string . <nl> + * / <nl> + getFormatStr : function WCU_l10n_getFormatStr ( aName , aArray ) <nl> + { <nl> + let result ; <nl> + try { <nl> + result = this . stringBundle . formatStringFromName ( aName , aArray , aArray . length ) ; <nl> + } <nl> + catch ( ex ) { <nl> + Cu . reportError ( " Failed to format string : " + aName ) ; <nl> + throw ex ; <nl> + } <nl> + return result ; <nl> + } , <nl> + } ; <nl> + <nl> + <nl> + / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / <nl> + / / JS Completer <nl> + / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / <nl> + <nl> + ( function _JSPP ( WCU ) { <nl> + const STATE_NORMAL = 0 ; <nl> + const STATE_QUOTE = 2 ; <nl> + const STATE_DQUOTE = 3 ; <nl> + <nl> + const OPEN_BODY = " { [ ( " . split ( " " ) ; <nl> + const CLOSE_BODY = " } ] ) " . split ( " " ) ; <nl> + const OPEN_CLOSE_BODY = { <nl> + " { " : " } " , <nl> + " [ " : " ] " , <nl> + " ( " : " ) " , <nl> + } ; <nl> + <nl> + / * * <nl> + * Analyses a given string to find the last statement that is interesting for <nl> + * later completion . <nl> + * <nl> + * @ param string aStr <nl> + * A string to analyse . <nl> + * <nl> + * @ returns object <nl> + * If there was an error in the string detected , then a object like <nl> + * <nl> + * { err : " ErrorMesssage " } <nl> + * <nl> + * is returned , otherwise a object like <nl> + * <nl> + * { <nl> + * state : STATE_NORMAL | STATE_QUOTE | STATE_DQUOTE , <nl> + * startPos : index of where the last statement begins <nl> + * } <nl> + * / <nl> + function findCompletionBeginning ( aStr ) <nl> + { <nl> + let bodyStack = [ ] ; <nl> + <nl> + let state = STATE_NORMAL ; <nl> + let start = 0 ; <nl> + let c ; <nl> + for ( let i = 0 ; i < aStr . length ; i + + ) { <nl> + c = aStr [ i ] ; <nl> + <nl> + switch ( state ) { <nl> + / / Normal JS state . <nl> + case STATE_NORMAL : <nl> + if ( c = = ' " ' ) { <nl> + state = STATE_DQUOTE ; <nl> + } <nl> + else if ( c = = " ' " ) { <nl> + state = STATE_QUOTE ; <nl> + } <nl> + else if ( c = = " ; " ) { <nl> + start = i + 1 ; <nl> + } <nl> + else if ( c = = " " ) { <nl> + start = i + 1 ; <nl> + } <nl> + else if ( OPEN_BODY . indexOf ( c ) ! = - 1 ) { <nl> + bodyStack . push ( { <nl> + token : c , <nl> + start : start <nl> + } ) ; <nl> + start = i + 1 ; <nl> + } <nl> + else if ( CLOSE_BODY . indexOf ( c ) ! = - 1 ) { <nl> + var last = bodyStack . pop ( ) ; <nl> + if ( ! last | | OPEN_CLOSE_BODY [ last . token ] ! = c ) { <nl> + return { <nl> + err : " syntax error " <nl> + } ; <nl> + } <nl> + if ( c = = " } " ) { <nl> + start = i + 1 ; <nl> + } <nl> + else { <nl> + start = last . start ; <nl> + } <nl> + } <nl> + break ; <nl> + <nl> + / / Double quote state > " < <nl> + case STATE_DQUOTE : <nl> + if ( c = = " \ \ " ) { <nl> + i + + ; <nl> + } <nl> + else if ( c = = " \ n " ) { <nl> + return { <nl> + err : " unterminated string literal " <nl> + } ; <nl> + } <nl> + else if ( c = = ' " ' ) { <nl> + state = STATE_NORMAL ; <nl> + } <nl> + break ; <nl> + <nl> + / / Single quote state > ' < <nl> + case STATE_QUOTE : <nl> + if ( c = = " \ \ " ) { <nl> + i + + ; <nl> + } <nl> + else if ( c = = " \ n " ) { <nl> + return { <nl> + err : " unterminated string literal " <nl> + } ; <nl> + } <nl> + else if ( c = = " ' " ) { <nl> + state = STATE_NORMAL ; <nl> + } <nl> + break ; <nl> + } <nl> + } <nl> + <nl> + return { <nl> + state : state , <nl> + startPos : start <nl> + } ; <nl> + } <nl> + <nl> + / * * <nl> + * Provides a list of properties , that are possible matches based on the passed <nl> + * Debugger . Environment / Debugger . Object and inputValue . <nl> + * <nl> + * @ param object aDbgObject <nl> + * When the debugger is not paused this Debugger . Object wraps the scope for autocompletion . <nl> + * It is null if the debugger is paused . <nl> + * @ param object anEnvironment <nl> + * When the debugger is paused this Debugger . Environment is the scope for autocompletion . <nl> + * It is null if the debugger is not paused . <nl> + * @ param string aInputValue <nl> + * Value that should be completed . <nl> + * @ param number [ aCursor = aInputValue . length ] <nl> + * Optional offset in the input where the cursor is located . If this is <nl> + * omitted then the cursor is assumed to be at the end of the input <nl> + * value . <nl> + * @ returns null or object <nl> + * If no completion valued could be computed , null is returned , <nl> + * otherwise a object with the following form is returned : <nl> + * { <nl> + * matches : [ string , string , string ] , <nl> + * matchProp : Last part of the inputValue that was used to find <nl> + * the matches - strings . <nl> + * } <nl> + * / <nl> + function JSPropertyProvider ( aDbgObject , anEnvironment , aInputValue , aCursor ) <nl> + { <nl> + if ( aCursor = = = undefined ) { <nl> + aCursor = aInputValue . length ; <nl> + } <nl> + <nl> + let inputValue = aInputValue . substring ( 0 , aCursor ) ; <nl> + <nl> + / / Analyse the inputValue and find the beginning of the last part that <nl> + / / should be completed . <nl> + let beginning = findCompletionBeginning ( inputValue ) ; <nl> + <nl> + / / There was an error analysing the string . <nl> + if ( beginning . err ) { <nl> + return null ; <nl> + } <nl> + <nl> + / / If the current state is not STATE_NORMAL , then we are inside of an string <nl> + / / which means that no completion is possible . <nl> + if ( beginning . state ! = STATE_NORMAL ) { <nl> + return null ; <nl> + } <nl> + <nl> + let completionPart = inputValue . substring ( beginning . startPos ) ; <nl> + <nl> + / / Don ' t complete on just an empty string . <nl> + if ( completionPart . trim ( ) = = " " ) { <nl> + return null ; <nl> + } <nl> + <nl> + let lastDot = completionPart . lastIndexOf ( " . " ) ; <nl> + if ( lastDot > 0 & & <nl> + ( completionPart [ 0 ] = = " ' " | | completionPart [ 0 ] = = ' " ' ) & & <nl> + completionPart [ lastDot - 1 ] = = completionPart [ 0 ] ) { <nl> + / / We are completing a string literal . <nl> + let matchProp = completionPart . slice ( lastDot + 1 ) ; <nl> + return getMatchedProps ( String . prototype , matchProp ) ; <nl> + } <nl> + <nl> + / / We are completing a variable / a property lookup . <nl> + let properties = completionPart . split ( " . " ) ; <nl> + let matchProp = properties . pop ( ) . trimLeft ( ) ; <nl> + let obj = aDbgObject ; <nl> + <nl> + / / The first property must be found in the environment if the debugger is <nl> + / / paused . <nl> + if ( anEnvironment ) { <nl> + if ( properties . length = = 0 ) { <nl> + return getMatchedPropsInEnvironment ( anEnvironment , matchProp ) ; <nl> + } <nl> + obj = getVariableInEnvironment ( anEnvironment , properties . shift ( ) ) ; <nl> + } <nl> + <nl> + if ( ! isObjectUsable ( obj ) ) { <nl> + return null ; <nl> + } <nl> + <nl> + / / We get the rest of the properties recursively starting from the Debugger . Object <nl> + / / that wraps the first property <nl> + for ( let prop of properties ) { <nl> + prop = prop . trim ( ) ; <nl> + if ( ! prop ) { <nl> + return null ; <nl> + } <nl> + <nl> + if ( / \ [ \ d + \ ] $ / . test ( prop ) ) { <nl> + / / The property to autocomplete is a member of array . For example <nl> + / / list [ i ] [ j ] . . [ n ] . Traverse the array to get the actual element . <nl> + obj = getArrayMemberProperty ( obj , prop ) ; <nl> + } <nl> + else { <nl> + obj = DevToolsUtils . getProperty ( obj , prop ) ; <nl> + } <nl> + <nl> + if ( ! isObjectUsable ( obj ) ) { <nl> + return null ; <nl> + } <nl> + } <nl> + <nl> + / / If the final property is a primitive <nl> + if ( typeof obj ! = " object " ) { <nl> + return getMatchedProps ( obj , matchProp ) ; <nl> + } <nl> + <nl> + return getMatchedPropsInDbgObject ( obj , matchProp ) ; <nl> + } <nl> + <nl> + / * * <nl> + * Get the array member of aObj for the given aProp . For example , given <nl> + * aProp = ' list [ 0 ] [ 1 ] ' the element at [ 0 ] [ 1 ] of aObj . list is returned . <nl> + * <nl> + * @ param object aObj <nl> + * The object to operate on . <nl> + * @ param string aProp <nl> + * The property to return . <nl> + * @ return null or Object <nl> + * Returns null if the property couldn ' t be located . Otherwise the array <nl> + * member identified by aProp . <nl> + * / <nl> + function getArrayMemberProperty ( aObj , aProp ) <nl> + { <nl> + / / First get the array . <nl> + let obj = aObj ; <nl> + let propWithoutIndices = aProp . substr ( 0 , aProp . indexOf ( " [ " ) ) ; <nl> + obj = DevToolsUtils . getProperty ( obj , propWithoutIndices ) ; <nl> + if ( ! isObjectUsable ( obj ) ) { <nl> + return null ; <nl> + } <nl> + <nl> + / / Then traverse the list of indices to get the actual element . <nl> + let result ; <nl> + let arrayIndicesRegex = / \ [ [ ^ \ ] ] * \ ] / g ; <nl> + while ( ( result = arrayIndicesRegex . exec ( aProp ) ) ! = = null ) { <nl> + let indexWithBrackets = result [ 0 ] ; <nl> + let indexAsText = indexWithBrackets . substr ( 1 , indexWithBrackets . length - 2 ) ; <nl> + let index = parseInt ( indexAsText ) ; <nl> + <nl> + if ( isNaN ( index ) ) { <nl> + return null ; <nl> + } <nl> + <nl> + obj = DevToolsUtils . getProperty ( obj , index ) ; <nl> + <nl> + if ( ! isObjectUsable ( obj ) ) { <nl> + return null ; <nl> + } <nl> + } <nl> + <nl> + return obj ; <nl> + } <nl> + <nl> + / * * <nl> + * Check if the given Debugger . Object can be used for autocomplete . <nl> + * <nl> + * @ param Debugger . Object aObject <nl> + * The Debugger . Object to check . <nl> + * @ return boolean <nl> + * True if further inspection into the object is possible , or false <nl> + * otherwise . <nl> + * / <nl> + function isObjectUsable ( aObject ) <nl> + { <nl> + if ( aObject = = null ) { <nl> + return false ; <nl> + } <nl> + <nl> + if ( typeof aObject = = " object " & & aObject . class = = " DeadObject " ) { <nl> + return false ; <nl> + } <nl> + <nl> + return true ; <nl> + } <nl> + <nl> + / * * <nl> + * @ see getExactMatch_impl ( ) <nl> + * / <nl> + function getVariableInEnvironment ( anEnvironment , aName ) <nl> + { <nl> + return getExactMatch_impl ( anEnvironment , aName , DebuggerEnvironmentSupport ) ; <nl> + } <nl> + <nl> + / * * <nl> + * @ see getMatchedProps_impl ( ) <nl> + * / <nl> + function getMatchedPropsInEnvironment ( anEnvironment , aMatch ) <nl> + { <nl> + return getMatchedProps_impl ( anEnvironment , aMatch , DebuggerEnvironmentSupport ) ; <nl> + } <nl> + <nl> + / * * <nl> + * @ see getMatchedProps_impl ( ) <nl> + * / <nl> + function getMatchedPropsInDbgObject ( aDbgObject , aMatch ) <nl> + { <nl> + return getMatchedProps_impl ( aDbgObject , aMatch , DebuggerObjectSupport ) ; <nl> + } <nl> + <nl> + / * * <nl> + * @ see getMatchedProps_impl ( ) <nl> + * / <nl> + function getMatchedProps ( aObj , aMatch ) <nl> + { <nl> + if ( typeof aObj ! = " object " ) { <nl> + aObj = aObj . constructor . prototype ; <nl> + } <nl> + return getMatchedProps_impl ( aObj , aMatch , JSObjectSupport ) ; <nl> + } <nl> + <nl> + / * * <nl> + * Get all properties in the given object ( and its parent prototype chain ) that <nl> + * match a given prefix . <nl> + * <nl> + * @ param mixed aObj <nl> + * Object whose properties we want to filter . <nl> + * @ param string aMatch <nl> + * Filter for properties that match this string . <nl> + * @ return object <nl> + * Object that contains the matchProp and the list of names . <nl> + * / <nl> + function getMatchedProps_impl ( aObj , aMatch , { chainIterator , getProperties } ) <nl> + { <nl> + let matches = new Set ( ) ; <nl> + let numProps = 0 ; <nl> + <nl> + / / We need to go up the prototype chain . <nl> + let iter = chainIterator ( aObj ) ; <nl> + for ( let obj of iter ) { <nl> + let props = getProperties ( obj ) ; <nl> + numProps + = props . length ; <nl> + <nl> + / / If there are too many properties to event attempt autocompletion , <nl> + / / or if we have already added the max number , then stop looping <nl> + / / and return the partial set that has already been discovered . <nl> + if ( numProps > = MAX_AUTOCOMPLETE_ATTEMPTS | | <nl> + matches . size > = MAX_AUTOCOMPLETIONS ) { <nl> + break ; <nl> + } <nl> + <nl> + for ( let i = 0 ; i < props . length ; i + + ) { <nl> + let prop = props [ i ] ; <nl> + if ( prop . indexOf ( aMatch ) ! = 0 ) { <nl> + continue ; <nl> + } <nl> + if ( prop . indexOf ( ' - ' ) > - 1 ) { <nl> + continue ; <nl> + } <nl> + / / If it is an array index , we can ' t take it . <nl> + / / This uses a trick : converting a string to a number yields NaN if <nl> + / / the operation failed , and NaN is not equal to itself . <nl> + if ( + prop ! = + prop ) { <nl> + matches . add ( prop ) ; <nl> + } <nl> + <nl> + if ( matches . size > = MAX_AUTOCOMPLETIONS ) { <nl> + break ; <nl> + } <nl> + } <nl> + } <nl> + <nl> + return { <nl> + matchProp : aMatch , <nl> + matches : [ . . . matches ] , <nl> + } ; <nl> + } <nl> + <nl> + / * * <nl> + * Returns a property value based on its name from the given object , by <nl> + * recursively checking the object ' s prototype . <nl> + * <nl> + * @ param object aObj <nl> + * An object to look the property into . <nl> + * @ param string aName <nl> + * The property that is looked up . <nl> + * @ returns object | undefined <nl> + * A Debugger . Object if the property exists in the object ' s prototype <nl> + * chain , undefined otherwise . <nl> + * / <nl> + function getExactMatch_impl ( aObj , aName , { chainIterator , getProperty } ) <nl> + { <nl> + / / We need to go up the prototype chain . <nl> + let iter = chainIterator ( aObj ) ; <nl> + for ( let obj of iter ) { <nl> + let prop = getProperty ( obj , aName , aObj ) ; <nl> + if ( prop ) { <nl> + return prop . value ; <nl> + } <nl> + } <nl> + return undefined ; <nl> + } <nl> + <nl> + <nl> + var JSObjectSupport = { <nl> + chainIterator : function * ( aObj ) <nl> + { <nl> + while ( aObj ) { <nl> + yield aObj ; <nl> + aObj = Object . getPrototypeOf ( aObj ) ; <nl> + } <nl> + } , <nl> + <nl> + getProperties : function ( aObj ) <nl> + { <nl> + return Object . getOwnPropertyNames ( aObj ) ; <nl> + } , <nl> + <nl> + getProperty : function ( ) <nl> + { <nl> + / / getProperty is unsafe with raw JS objects . <nl> + throw " Unimplemented ! " ; <nl> + } , <nl> + } ; <nl> + <nl> + var DebuggerObjectSupport = { <nl> + chainIterator : function * ( aObj ) <nl> + { <nl> + while ( aObj ) { <nl> + yield aObj ; <nl> + aObj = aObj . proto ; <nl> + } <nl> + } , <nl> + <nl> + getProperties : function ( aObj ) <nl> + { <nl> + return aObj . getOwnPropertyNames ( ) ; <nl> + } , <nl> + <nl> + getProperty : function ( aObj , aName , aRootObj ) <nl> + { <nl> + / / This is left unimplemented in favor to DevToolsUtils . getProperty ( ) . <nl> + throw " Unimplemented ! " ; <nl> + } , <nl> + } ; <nl> + <nl> + var DebuggerEnvironmentSupport = { <nl> + chainIterator : function * ( aObj ) <nl> + { <nl> + while ( aObj ) { <nl> + yield aObj ; <nl> + aObj = aObj . parent ; <nl> + } <nl> + } , <nl> + <nl> + getProperties : function ( aObj ) <nl> + { <nl> + return aObj . names ( ) ; <nl> + } , <nl> + <nl> + getProperty : function ( aObj , aName ) <nl> + { <nl> + / / TODO : we should use getVariableDescriptor ( ) here - bug 725815 . <nl> + let result = aObj . getVariable ( aName ) ; <nl> + / / FIXME : Need actual UI , bug 941287 . <nl> + if ( result = = = undefined | | result . optimizedOut | | result . missingArguments ) { <nl> + return null ; <nl> + } <nl> + return { value : result } ; <nl> + } , <nl> + } ; <nl> + <nl> + <nl> + exports . JSPropertyProvider = DevToolsUtils . makeInfallible ( JSPropertyProvider ) ; <nl> + } ) ( WebConsoleUtils ) ; <nl> + <nl> + / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / <nl> + / / The page errors listener <nl> + / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / <nl> + <nl> + / * * <nl> + * The nsIConsoleService listener . This is used to send all of the console <nl> + * messages ( JavaScript , CSS and more ) to the remote Web Console instance . <nl> + * <nl> + * @ constructor <nl> + * @ param nsIDOMWindow [ aWindow ] <nl> + * Optional - the window object for which we are created . This is used <nl> + * for filtering out messages that belong to other windows . <nl> + * @ param object aListener <nl> + * The listener object must have one method : <nl> + * - onConsoleServiceMessage ( ) . This method is invoked with one argument , <nl> + * the nsIConsoleMessage , whenever a relevant message is received . <nl> + * / <nl> + function ConsoleServiceListener ( aWindow , aListener ) <nl> + { <nl> + this . window = aWindow ; <nl> + this . listener = aListener ; <nl> + } <nl> + exports . ConsoleServiceListener = ConsoleServiceListener ; <nl> + <nl> + ConsoleServiceListener . prototype = <nl> + { <nl> + / / QueryInterface : XPCOMUtils . generateQI ( [ Ci . nsIConsoleListener ] ) , <nl> + <nl> + / * * <nl> + * The content window for which we listen to page errors . <nl> + * @ type nsIDOMWindow <nl> + * / <nl> + window : null , <nl> + <nl> + / * * <nl> + * The listener object which is notified of messages from the console service . <nl> + * @ type object <nl> + * / <nl> + listener : null , <nl> + <nl> + / * * <nl> + * Initialize the nsIConsoleService listener . <nl> + * / <nl> + init : function CSL_init ( ) <nl> + { <nl> + Services . console . registerListener ( this ) ; <nl> + } , <nl> + <nl> + / * * <nl> + * The nsIConsoleService observer . This method takes all the script error <nl> + * messages belonging to the current window and sends them to the remote Web <nl> + * Console instance . <nl> + * <nl> + * @ param nsIConsoleMessage aMessage <nl> + * The message object coming from the nsIConsoleService . <nl> + * / <nl> + observe : function CSL_observe ( aMessage ) <nl> + { <nl> + if ( ! this . listener ) { <nl> + return ; <nl> + } <nl> + <nl> + if ( this . window ) { <nl> + if ( ! ( aMessage instanceof Ci . nsIScriptError ) | | <nl> + ! aMessage . outerWindowID | | <nl> + ! this . isCategoryAllowed ( aMessage . category ) ) { <nl> + return ; <nl> + } <nl> + <nl> + let errorWindow = Services . wm . getOuterWindowWithId ( aMessage . outerWindowID ) ; <nl> + if ( ! errorWindow | | ! isWindowIncluded ( this . window , errorWindow ) ) { <nl> + return ; <nl> + } <nl> + } <nl> + <nl> + this . listener . onConsoleServiceMessage ( aMessage ) ; <nl> + } , <nl> + <nl> + / * * <nl> + * Check if the given message category is allowed to be tracked or not . <nl> + * We ignore chrome - originating errors as we only care about content . <nl> + * <nl> + * @ param string aCategory <nl> + * The message category you want to check . <nl> + * @ return boolean <nl> + * True if the category is allowed to be logged , false otherwise . <nl> + * / <nl> + isCategoryAllowed : function CSL_isCategoryAllowed ( aCategory ) <nl> + { <nl> + if ( ! aCategory ) { <nl> + return false ; <nl> + } <nl> + <nl> + switch ( aCategory ) { <nl> + case " XPConnect JavaScript " : <nl> + case " component javascript " : <nl> + case " chrome javascript " : <nl> + case " chrome registration " : <nl> + case " XBL " : <nl> + case " XBL Prototype Handler " : <nl> + case " XBL Content Sink " : <nl> + case " xbl javascript " : <nl> + return false ; <nl> + } <nl> + <nl> + return true ; <nl> + } , <nl> + <nl> + / * * <nl> + * Get the cached page errors for the current inner window and its ( i ) frames . <nl> + * <nl> + * @ param boolean [ aIncludePrivate = false ] <nl> + * Tells if you want to also retrieve messages coming from private <nl> + * windows . Defaults to false . <nl> + * @ return array <nl> + * The array of cached messages . Each element is an nsIScriptError or <nl> + * an nsIConsoleMessage <nl> + * / <nl> + getCachedMessages : function CSL_getCachedMessages ( aIncludePrivate = false ) <nl> + { <nl> + let errors = Services . console . getMessageArray ( ) | | [ ] ; <nl> + <nl> + / / if ! this . window , we ' re in a browser console . Still need to filter <nl> + / / private messages . <nl> + if ( ! this . window ) { <nl> + return errors . filter ( ( aError ) = > { <nl> + if ( aError instanceof Ci . nsIScriptError ) { <nl> + if ( ! aIncludePrivate & & aError . isFromPrivateWindow ) { <nl> + return false ; <nl> + } <nl> + } <nl> + <nl> + return true ; <nl> + } ) ; <nl> + } <nl> + <nl> + let ids = WebConsoleUtils . getInnerWindowIDsForFrames ( this . window ) ; <nl> + <nl> + return errors . filter ( ( aError ) = > { <nl> + if ( aError instanceof Ci . nsIScriptError ) { <nl> + if ( ! aIncludePrivate & & aError . isFromPrivateWindow ) { <nl> + return false ; <nl> + } <nl> + if ( ids & & <nl> + ( ids . indexOf ( aError . innerWindowID ) = = - 1 | | <nl> + ! this . isCategoryAllowed ( aError . category ) ) ) { <nl> + return false ; <nl> + } <nl> + } <nl> + else if ( ids & & ids [ 0 ] ) { <nl> + / / If this is not an nsIScriptError and we need to do window - based <nl> + / / filtering we skip this message . <nl> + return false ; <nl> + } <nl> + <nl> + return true ; <nl> + } ) ; <nl> + } , <nl> + <nl> + / * * <nl> + * Remove the nsIConsoleService listener . <nl> + * / <nl> + destroy : function CSL_destroy ( ) <nl> + { <nl> + Services . console . unregisterListener ( this ) ; <nl> + this . listener = this . window = null ; <nl> + } , <nl> + } ; <nl> + <nl> + <nl> + / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / <nl> + / / The window . console API observer <nl> + / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / <nl> + <nl> + / * * <nl> + * The window . console API observer . This allows the window . console API messages <nl> + * to be sent to the remote Web Console instance . <nl> + * <nl> + * @ constructor <nl> + * @ param nsIDOMWindow aWindow <nl> + * Optional - the window object for which we are created . This is used <nl> + * for filtering out messages that belong to other windows . <nl> + * @ param object aOwner <nl> + * The owner object must have the following methods : <nl> + * - onConsoleAPICall ( ) . This method is invoked with one argument , the <nl> + * Console API message that comes from the observer service , whenever <nl> + * a relevant console API call is received . <nl> + * @ param string aConsoleID <nl> + * Options - The consoleID that this listener should listen to <nl> + * / <nl> + function ConsoleAPIListener ( aWindow , aOwner , aConsoleID ) <nl> + { <nl> + this . window = aWindow ; <nl> + this . owner = aOwner ; <nl> + this . consoleID = aConsoleID ; <nl> + } <nl> + exports . ConsoleAPIListener = ConsoleAPIListener ; <nl> + <nl> + ConsoleAPIListener . prototype = <nl> + { <nl> + / / QueryInterface : XPCOMUtils . generateQI ( [ Ci . nsIObserver ] ) , <nl> + <nl> + / * * <nl> + * The content window for which we listen to window . console API calls . <nl> + * @ type nsIDOMWindow <nl> + * / <nl> + window : null , <nl> + <nl> + / * * <nl> + * The owner object which is notified of window . console API calls . It must <nl> + * have a onConsoleAPICall method which is invoked with one argument : the <nl> + * console API call object that comes from the observer service . <nl> + * <nl> + * @ type object <nl> + * @ see WebConsoleActor <nl> + * / <nl> + owner : null , <nl> + <nl> + / * * <nl> + * The consoleID that we listen for . If not null then only messages from this <nl> + * console will be returned . <nl> + * / <nl> + consoleID : null , <nl> + <nl> + / * * <nl> + * Initialize the window . console API observer . <nl> + * / <nl> + init : function CAL_init ( ) <nl> + { <nl> + / / Note that the observer is process - wide . We will filter the messages as <nl> + / / needed , see CAL_observe ( ) . <nl> + / / Services . obs . addObserver ( this , " console - api - log - event " , false ) ; <nl> + } , <nl> + <nl> + / * * <nl> + * The console API message observer . When messages are received from the <nl> + * observer service we forward them to the remote Web Console instance . <nl> + * <nl> + * @ param object aMessage <nl> + * The message object receives from the observer service . <nl> + * @ param string aTopic <nl> + * The message topic received from the observer service . <nl> + * / <nl> + observe : function CAL_observe ( aMessage , aTopic ) <nl> + { <nl> + if ( ! this . owner ) { <nl> + return ; <nl> + } <nl> + <nl> + / / Here , wrappedJSObject is not a security wrapper but a property defined <nl> + / / by the XPCOM component which allows us to unwrap the XPCOM interface and <nl> + / / access the underlying JSObject . <nl> + let apiMessage = aMessage . wrappedJSObject ; <nl> + if ( this . window & & CONSOLE_WORKER_IDS . indexOf ( apiMessage . innerID ) = = - 1 ) { <nl> + let msgWindow = Services . wm . getCurrentInnerWindowWithId ( apiMessage . innerID ) ; <nl> + if ( ! msgWindow | | ! isWindowIncluded ( this . window , msgWindow ) ) { <nl> + / / Not the same window ! <nl> + return ; <nl> + } <nl> + } <nl> + if ( this . consoleID & & apiMessage . consoleID ! = this . consoleID ) { <nl> + return ; <nl> + } <nl> + <nl> + this . owner . onConsoleAPICall ( apiMessage ) ; <nl> + } , <nl> + <nl> + / * * <nl> + * Get the cached messages for the current inner window and its ( i ) frames . <nl> + * <nl> + * @ param boolean [ aIncludePrivate = false ] <nl> + * Tells if you want to also retrieve messages coming from private <nl> + * windows . Defaults to false . <nl> + * @ return array <nl> + * The array of cached messages . <nl> + * / <nl> + getCachedMessages : function CAL_getCachedMessages ( aIncludePrivate = false ) <nl> + { <nl> + let messages = [ ] ; <nl> + / / let ConsoleAPIStorage = Cc [ " @ mozilla . org / consoleAPI - storage ; 1 " ] <nl> + / / . getService ( Ci . nsIConsoleAPIStorage ) ; <nl> + <nl> + / / / / if ! this . window , we ' re in a browser console . Retrieve all events <nl> + / / / / for filtering based on privacy . <nl> + / / if ( ! this . window ) { <nl> + / / messages = ConsoleAPIStorage . getEvents ( ) ; <nl> + / / } else { <nl> + / / let ids = WebConsoleUtils . getInnerWindowIDsForFrames ( this . window ) ; <nl> + / / ids . forEach ( ( id ) = > { <nl> + / / messages = messages . concat ( ConsoleAPIStorage . getEvents ( id ) ) ; <nl> + / / } ) ; <nl> + / / } <nl> + <nl> + / / CONSOLE_WORKER_IDS . forEach ( ( id ) = > { <nl> + / / messages = messages . concat ( ConsoleAPIStorage . getEvents ( id ) ) ; <nl> + / / } ) ; <nl> + <nl> + if ( this . consoleID ) { <nl> + messages = messages . filter ( ( m ) = > m . consoleID = = this . consoleID ) ; <nl> + } <nl> + <nl> + if ( aIncludePrivate ) { <nl> + return messages ; <nl> + } <nl> + <nl> + return messages . filter ( ( m ) = > ! m . private ) ; <nl> + } , <nl> + <nl> + / * * <nl> + * Destroy the console API listener . <nl> + * / <nl> + destroy : function CAL_destroy ( ) <nl> + { <nl> + Services . obs . removeObserver ( this , " console - api - log - event " ) ; <nl> + this . window = this . owner = null ; <nl> + } , <nl> + } ; <nl> + <nl> + / * * <nl> + * WebConsole commands manager . <nl> + * <nl> + * Defines a set of functions / variables ( " commands " ) that are available from <nl> + * the Web Console but not from the web page . <nl> + * <nl> + * / <nl> + var WebConsoleCommands = { <nl> + _registeredCommands : new Map ( ) , <nl> + _originalCommands : new Map ( ) , <nl> + <nl> + / * * <nl> + * @ private <nl> + * Reserved for built - in commands . To register a command from the code of an <nl> + * add - on , see WebConsoleCommands . register instead . <nl> + * <nl> + * @ see WebConsoleCommands . register <nl> + * / <nl> + _registerOriginal : function ( name , command ) { <nl> + this . register ( name , command ) ; <nl> + this . _originalCommands . set ( name , this . getCommand ( name ) ) ; <nl> + } , <nl> + <nl> + / * * <nl> + * Register a new command . <nl> + * @ param { string } name The command name ( exemple : " $ " ) <nl> + * @ param { ( function | object ) } command The command to register . <nl> + * It can be a function so the command is a function ( like " $ ( ) " ) , <nl> + * or it can also be a property descriptor to describe a getter / value ( like <nl> + * " $ 0 " ) . <nl> + * <nl> + * The command function or the command getter are passed a owner object as <nl> + * their first parameter ( see the example below ) . <nl> + * <nl> + * Note that setters don ' t work currently and " enumerable " and " configurable " <nl> + * are forced to true . <nl> + * <nl> + * @ example <nl> + * <nl> + * WebConsoleCommands . register ( " $ " , function JSTH_ $ ( aOwner , aSelector ) <nl> + * { <nl> + * return aOwner . window . document . querySelector ( aSelector ) ; <nl> + * } ) ; <nl> + * <nl> + * WebConsoleCommands . register ( " $ 0 " , { <nl> + * get : function ( aOwner ) { <nl> + * return aOwner . makeDebuggeeValue ( aOwner . selectedNode ) ; <nl> + * } <nl> + * } ) ; <nl> + * / <nl> + register : function ( name , command ) { <nl> + this . _registeredCommands . set ( name , command ) ; <nl> + } , <nl> + <nl> + / * * <nl> + * Unregister a command . <nl> + * <nl> + * If the command being unregister overrode a built - in command , <nl> + * the latter is restored . <nl> + * <nl> + * @ param { string } name The name of the command <nl> + * / <nl> + unregister : function ( name ) { <nl> + this . _registeredCommands . delete ( name ) ; <nl> + if ( this . _originalCommands . has ( name ) ) { <nl> + this . register ( name , this . _originalCommands . get ( name ) ) ; <nl> + } <nl> + } , <nl> + <nl> + / * * <nl> + * Returns a command by its name . <nl> + * <nl> + * @ param { string } name The name of the command . <nl> + * <nl> + * @ return { ( function | object ) } The command . <nl> + * / <nl> + getCommand : function ( name ) { <nl> + return this . _registeredCommands . get ( name ) ; <nl> + } , <nl> + <nl> + / * * <nl> + * Returns true if a command is registered with the given name . <nl> + * <nl> + * @ param { string } name The name of the command . <nl> + * <nl> + * @ return { boolean } True if the command is registered . <nl> + * / <nl> + hasCommand : function ( name ) { <nl> + return this . _registeredCommands . has ( name ) ; <nl> + } , <nl> + } ; <nl> + <nl> + exports . WebConsoleCommands = WebConsoleCommands ; <nl> + <nl> + <nl> + / * <nl> + * Built - in commands . <nl> + * <nl> + * A list of helper functions used by Firebug can be found here : <nl> + * http : / / getfirebug . com / wiki / index . php / Command_Line_API <nl> + * / <nl> + <nl> + / * * <nl> + * Find a node by ID . <nl> + * <nl> + * @ param string aId <nl> + * The ID of the element you want . <nl> + * @ return nsIDOMNode or null <nl> + * The result of calling document . querySelector ( aSelector ) . <nl> + * / <nl> + WebConsoleCommands . _registerOriginal ( " $ " , function JSTH_ $ ( aOwner , aSelector ) <nl> + { <nl> + return aOwner . window . document . querySelector ( aSelector ) ; <nl> + } ) ; <nl> + <nl> + / * * <nl> + * Find the nodes matching a CSS selector . <nl> + * <nl> + * @ param string aSelector <nl> + * A string that is passed to window . document . querySelectorAll . <nl> + * @ return nsIDOMNodeList <nl> + * Returns the result of document . querySelectorAll ( aSelector ) . <nl> + * / <nl> + WebConsoleCommands . _registerOriginal ( " $ $ " , function JSTH_ $ $ ( aOwner , aSelector ) <nl> + { <nl> + let nodes = aOwner . window . document . querySelectorAll ( aSelector ) ; <nl> + <nl> + / / Calling aOwner . window . Array . from ( ) doesn ' t work without accessing the <nl> + / / wrappedJSObject , so just loop through the results instead . <nl> + let result = new aOwner . window . Array ( ) ; <nl> + for ( let i = 0 ; i < nodes . length ; i + + ) { <nl> + result . push ( nodes [ i ] ) ; <nl> + } <nl> + return result ; <nl> + } ) ; <nl> + <nl> + / * * <nl> + * Returns the result of the last console input evaluation <nl> + * <nl> + * @ return object | undefined <nl> + * Returns last console evaluation or undefined <nl> + * / <nl> + WebConsoleCommands . _registerOriginal ( " $ _ " , { <nl> + get : function ( aOwner ) { <nl> + return aOwner . consoleActor . getLastConsoleInputEvaluation ( ) ; <nl> + } <nl> + } ) ; <nl> + <nl> + <nl> + / * * <nl> + * Runs an xPath query and returns all matched nodes . <nl> + * <nl> + * @ param string aXPath <nl> + * xPath search query to execute . <nl> + * @ param [ optional ] nsIDOMNode aContext <nl> + * Context to run the xPath query on . Uses window . document if not set . <nl> + * @ return array of nsIDOMNode <nl> + * / <nl> + WebConsoleCommands . _registerOriginal ( " $ x " , function JSTH_ $ x ( aOwner , aXPath , aContext ) <nl> + { <nl> + let nodes = new aOwner . window . Array ( ) ; <nl> + <nl> + / / Not waiving Xrays , since we want the original Document . evaluate function , <nl> + / / instead of anything that ' s been redefined . <nl> + let doc = aOwner . window . document ; <nl> + aContext = aContext | | doc ; <nl> + <nl> + let results = doc . evaluate ( aXPath , aContext , null , <nl> + Ci . nsIDOMXPathResult . ANY_TYPE , null ) ; <nl> + let node ; <nl> + while ( ( node = results . iterateNext ( ) ) ) { <nl> + nodes . push ( node ) ; <nl> + } <nl> + <nl> + return nodes ; <nl> + } ) ; <nl> + <nl> + / * * <nl> + * Returns the currently selected object in the highlighter . <nl> + * <nl> + * @ return Object representing the current selection in the <nl> + * Inspector , or null if no selection exists . <nl> + * / <nl> + WebConsoleCommands . _registerOriginal ( " $ 0 " , { <nl> + get : function ( aOwner ) { <nl> + return aOwner . makeDebuggeeValue ( aOwner . selectedNode ) ; <nl> + } <nl> + } ) ; <nl> + <nl> + / * * <nl> + * Clears the output of the WebConsole . <nl> + * / <nl> + WebConsoleCommands . _registerOriginal ( " clear " , function JSTH_clear ( aOwner ) <nl> + { <nl> + aOwner . helperResult = { <nl> + type : " clearOutput " , <nl> + } ; <nl> + } ) ; <nl> + <nl> + / * * <nl> + * Clears the input history of the WebConsole . <nl> + * / <nl> + WebConsoleCommands . _registerOriginal ( " clearHistory " , function JSTH_clearHistory ( aOwner ) <nl> + { <nl> + aOwner . helperResult = { <nl> + type : " clearHistory " , <nl> + } ; <nl> + } ) ; <nl> + <nl> + / * * <nl> + * Returns the result of Object . keys ( aObject ) . <nl> + * <nl> + * @ param object aObject <nl> + * Object to return the property names from . <nl> + * @ return array of strings <nl> + * / <nl> + WebConsoleCommands . _registerOriginal ( " keys " , function JSTH_keys ( aOwner , aObject ) <nl> + { <nl> + / / Need to waive Xrays so we can iterate functions and accessor properties <nl> + return Cu . cloneInto ( Object . keys ( Cu . waiveXrays ( aObject ) ) , aOwner . window ) ; <nl> + } ) ; <nl> + <nl> + / * * <nl> + * Returns the values of all properties on aObject . <nl> + * <nl> + * @ param object aObject <nl> + * Object to display the values from . <nl> + * @ return array of string <nl> + * / <nl> + WebConsoleCommands . _registerOriginal ( " values " , function JSTH_values ( aOwner , aObject ) <nl> + { <nl> + let values = [ ] ; <nl> + / / Need to waive Xrays so we can iterate functions and accessor properties <nl> + let waived = Cu . waiveXrays ( aObject ) ; <nl> + let names = Object . getOwnPropertyNames ( waived ) ; <nl> + <nl> + for ( let name of names ) { <nl> + values . push ( waived [ name ] ) ; <nl> + } <nl> + <nl> + return Cu . cloneInto ( values , aOwner . window ) ; <nl> + } ) ; <nl> + <nl> + / * * <nl> + * Opens a help window in MDN . <nl> + * / <nl> + WebConsoleCommands . _registerOriginal ( " help " , function JSTH_help ( aOwner ) <nl> + { <nl> + aOwner . helperResult = { type : " help " } ; <nl> + } ) ; <nl> + <nl> + / * * <nl> + * Change the JS evaluation scope . <nl> + * <nl> + * @ param DOMElement | string | window aWindow <nl> + * The window object to use for eval scope . This can be a string that <nl> + * is used to perform document . querySelector ( ) , to find the iframe that <nl> + * you want to cd ( ) to . A DOMElement can be given as well , the <nl> + * . contentWindow property is used . Lastly , you can directly pass <nl> + * a window object . If you call cd ( ) with no arguments , the current <nl> + * eval scope is cleared back to its default ( the top window ) . <nl> + * / <nl> + WebConsoleCommands . _registerOriginal ( " cd " , function JSTH_cd ( aOwner , aWindow ) <nl> + { <nl> + if ( ! aWindow ) { <nl> + aOwner . consoleActor . evalWindow = null ; <nl> + aOwner . helperResult = { type : " cd " } ; <nl> + return ; <nl> + } <nl> + <nl> + if ( typeof aWindow = = " string " ) { <nl> + aWindow = aOwner . window . document . querySelector ( aWindow ) ; <nl> + } <nl> + if ( aWindow instanceof Ci . nsIDOMElement & & aWindow . contentWindow ) { <nl> + aWindow = aWindow . contentWindow ; <nl> + } <nl> + if ( ! ( aWindow instanceof Ci . nsIDOMWindow ) ) { <nl> + aOwner . helperResult = { type : " error " , message : " cdFunctionInvalidArgument " } ; <nl> + return ; <nl> + } <nl> + <nl> + aOwner . consoleActor . evalWindow = aWindow ; <nl> + aOwner . helperResult = { type : " cd " } ; <nl> + } ) ; <nl> + <nl> + / * * <nl> + * Inspects the passed aObject . This is done by opening the PropertyPanel . <nl> + * <nl> + * @ param object aObject <nl> + * Object to inspect . <nl> + * / <nl> + WebConsoleCommands . _registerOriginal ( " inspect " , function JSTH_inspect ( aOwner , aObject ) <nl> + { <nl> + let dbgObj = aOwner . makeDebuggeeValue ( aObject ) ; <nl> + let grip = aOwner . createValueGrip ( dbgObj ) ; <nl> + aOwner . helperResult = { <nl> + type : " inspectObject " , <nl> + input : aOwner . evalInput , <nl> + object : grip , <nl> + } ; <nl> + } ) ; <nl> + <nl> + / * * <nl> + * Prints aObject to the output . <nl> + * <nl> + * @ param object aObject <nl> + * Object to print to the output . <nl> + * @ return string <nl> + * / <nl> + WebConsoleCommands . _registerOriginal ( " pprint " , function JSTH_pprint ( aOwner , aObject ) <nl> + { <nl> + if ( aObject = = = null | | aObject = = = undefined | | aObject = = = true | | <nl> + aObject = = = false ) { <nl> + aOwner . helperResult = { <nl> + type : " error " , <nl> + message : " helperFuncUnsupportedTypeError " , <nl> + } ; <nl> + return null ; <nl> + } <nl> + <nl> + aOwner . helperResult = { rawOutput : true } ; <nl> + <nl> + if ( typeof aObject = = " function " ) { <nl> + return aObject + " \ n " ; <nl> + } <nl> + <nl> + let output = [ ] ; <nl> + <nl> + let obj = aObject ; <nl> + for ( let name in obj ) { <nl> + let desc = WebConsoleUtils . getPropertyDescriptor ( obj , name ) | | { } ; <nl> + if ( desc . get | | desc . set ) { <nl> + / / TODO : Bug 842672 - toolkit / imports modules from browser / . <nl> + let getGrip = VariablesView . getGrip ( desc . get ) ; <nl> + let setGrip = VariablesView . getGrip ( desc . set ) ; <nl> + let getString = VariablesView . getString ( getGrip ) ; <nl> + let setString = VariablesView . getString ( setGrip ) ; <nl> + output . push ( name + " : " , " get : " + getString , " set : " + setString ) ; <nl> + } <nl> + else { <nl> + let valueGrip = VariablesView . getGrip ( obj [ name ] ) ; <nl> + let valueString = VariablesView . getString ( valueGrip ) ; <nl> + output . push ( name + " : " + valueString ) ; <nl> + } <nl> + } <nl> + <nl> + return " " + output . join ( " \ n " ) ; <nl> + } ) ; <nl> + <nl> + / * * <nl> + * Print the String representation of a value to the output , as - is . <nl> + * <nl> + * @ param any aValue <nl> + * A value you want to output as a string . <nl> + * @ return void <nl> + * / <nl> + WebConsoleCommands . _registerOriginal ( " print " , function JSTH_print ( aOwner , aValue ) <nl> + { <nl> + aOwner . helperResult = { rawOutput : true } ; <nl> + if ( typeof aValue = = = " symbol " ) { <nl> + return Symbol . prototype . toString . call ( aValue ) ; <nl> + } <nl> + / / Waiving Xrays here allows us to see a closer representation of the <nl> + / / underlying object . This may execute arbitrary content code , but that <nl> + / / code will run with content privileges , and the result will be rendered <nl> + / / inert by coercing it to a String . <nl> + return String ( Cu . waiveXrays ( aValue ) ) ; <nl> + } ) ; <nl> + <nl> + / * * <nl> + * Copy the String representation of a value to the clipboard . <nl> + * <nl> + * @ param any aValue <nl> + * A value you want to copy as a string . <nl> + * @ return void <nl> + * / <nl> + WebConsoleCommands . _registerOriginal ( " copy " , function JSTH_copy ( aOwner , aValue ) <nl> + { <nl> + let payload ; <nl> + try { <nl> + if ( aValue instanceof Ci . nsIDOMElement ) { <nl> + payload = aValue . outerHTML ; <nl> + } else if ( typeof aValue = = " string " ) { <nl> + payload = aValue ; <nl> + } else { <nl> + payload = JSON . stringify ( aValue , null , " " ) ; <nl> + } <nl> + } catch ( ex ) { <nl> + payload = " / * " + ex + " * / " ; <nl> + } <nl> + aOwner . helperResult = { <nl> + type : " copyValueToClipboard " , <nl> + value : payload , <nl> + } ; <nl> + } ) ; <nl> + <nl> + <nl> + / * * <nl> + * ( Internal only ) Add the bindings to | owner . sandbox | . <nl> + * This is intended to be used by the WebConsole actor only . <nl> + * <nl> + * @ param object aOwner <nl> + * The owning object . <nl> + * / <nl> + function addWebConsoleCommands ( owner ) { <nl> + if ( ! owner ) { <nl> + throw new Error ( " The owner is required " ) ; <nl> + } <nl> + for ( let [ name , command ] of WebConsoleCommands . _registeredCommands ) { <nl> + if ( typeof command = = = " function " ) { <nl> + owner . sandbox [ name ] = command . bind ( undefined , owner ) ; <nl> + } <nl> + else if ( typeof command = = = " object " ) { <nl> + / / let clone = Object . assign ( { } , command , { <nl> + / / / / We force the enumerability and the configurability ( so the <nl> + / / / / WebConsoleActor can reconfigure the property ) . <nl> + / / enumerable : true , <nl> + / / configurable : true <nl> + / / } ) ; <nl> + let clone = { } ; <nl> + for ( let attr in command ) { <nl> + if ( command . hasOwnProperty ( attr ) ) <nl> + clone [ attr ] = command [ attr ] ; <nl> + } <nl> + clone . enumerable = true ; <nl> + clone . configurable = true ; <nl> + <nl> + if ( typeof command . get = = = " function " ) { <nl> + clone . get = command . get . bind ( undefined , owner ) ; <nl> + } <nl> + if ( typeof command . set = = = " function " ) { <nl> + clone . set = command . set . bind ( undefined , owner ) ; <nl> + } <nl> + <nl> + Object . defineProperty ( owner . sandbox , name , clone ) ; <nl> + } <nl> + } <nl> + } <nl> + <nl> + exports . addWebConsoleCommands = addWebConsoleCommands ; <nl> + <nl> + / * * <nl> + * A ReflowObserver that listens for reflow events from the page . <nl> + * Implements nsIReflowObserver . <nl> + * <nl> + * @ constructor <nl> + * @ param object aWindow <nl> + * The window for which we need to track reflow . <nl> + * @ param object aOwner <nl> + * The listener owner which needs to implement : <nl> + * - onReflowActivity ( aReflowInfo ) <nl> + * / <nl> + <nl> + function ConsoleReflowListener ( aWindow , aListener ) <nl> + { <nl> + this . docshell = aWindow . QueryInterface ( Ci . nsIInterfaceRequestor ) <nl> + . getInterface ( Ci . nsIWebNavigation ) <nl> + . QueryInterface ( Ci . nsIDocShell ) ; <nl> + this . listener = aListener ; <nl> + this . docshell . addWeakReflowObserver ( this ) ; <nl> + } <nl> + <nl> + exports . ConsoleReflowListener = ConsoleReflowListener ; <nl> + <nl> + ConsoleReflowListener . prototype = <nl> + { <nl> + / / QueryInterface : XPCOMUtils . generateQI ( [ Ci . nsIReflowObserver , <nl> + / / Ci . nsISupportsWeakReference ] ) , <nl> + docshell : null , <nl> + listener : null , <nl> + <nl> + / * * <nl> + * Forward reflow event to listener . <nl> + * <nl> + * @ param DOMHighResTimeStamp aStart <nl> + * @ param DOMHighResTimeStamp aEnd <nl> + * @ param boolean aInterruptible <nl> + * / <nl> + sendReflow : function CRL_sendReflow ( aStart , aEnd , aInterruptible ) <nl> + { <nl> + let frame = components . stack . caller . caller ; <nl> + <nl> + let filename = frame . filename ; <nl> + <nl> + if ( filename ) { <nl> + / / Because filename could be of the form " xxx . js - > xxx . js - > xxx . js " , <nl> + / / we only take the last part . <nl> + filename = filename . split ( " " ) . pop ( ) ; <nl> + } <nl> + <nl> + this . listener . onReflowActivity ( { <nl> + interruptible : aInterruptible , <nl> + start : aStart , <nl> + end : aEnd , <nl> + sourceURL : filename , <nl> + sourceLine : frame . lineNumber , <nl> + functionName : frame . name <nl> + } ) ; <nl> + } , <nl> + <nl> + / * * <nl> + * On uninterruptible reflow <nl> + * <nl> + * @ param DOMHighResTimeStamp aStart <nl> + * @ param DOMHighResTimeStamp aEnd <nl> + * / <nl> + reflow : function CRL_reflow ( aStart , aEnd ) <nl> + { <nl> + this . sendReflow ( aStart , aEnd , false ) ; <nl> + } , <nl> + <nl> + / * * <nl> + * On interruptible reflow <nl> + * <nl> + * @ param DOMHighResTimeStamp aStart <nl> + * @ param DOMHighResTimeStamp aEnd <nl> + * / <nl> + reflowInterruptible : function CRL_reflowInterruptible ( aStart , aEnd ) <nl> + { <nl> + this . sendReflow ( aStart , aEnd , true ) ; <nl> + } , <nl> + <nl> + / * * <nl> + * Unregister listener . <nl> + * / <nl> + destroy : function CRL_destroy ( ) <nl> + { <nl> + this . docshell . removeWeakReflowObserver ( this ) ; <nl> + this . listener = this . docshell = null ; <nl> + } , <nl> + } ; <nl> + <nl> + function gSequenceId ( ) <nl> + { <nl> + return gSequenceId . n + + ; <nl> + } <nl> + gSequenceId . n = 0 ; <nl> + <nl> + exports ; <nl> + <nl> mmm a / cocos / scripting / js - bindings / script / jsb_debugger . js <nl> ppp b / cocos / scripting / js - bindings / script / jsb_debugger . js <nl> this . processInput = function ( inputstr ) { <nl> conn . onPacket ( parsed ) ; <nl> } <nl> <nl> + / / log ( ' receive : ' + inputstr ) ; <nl> _processIncoming ( inputstr ) ; <nl> } ; <nl> <nl> this . _prepareDebugger = function ( global ) { <nl> globalDebuggee = global ; <nl> require = global . require ; <nl> cc = global . cc ; <nl> - exports = global ; <nl> + / / exports = global ; <nl> <nl> / / load all functions exported in DevToolsUtils to global ( exports ) <nl> - require ( ' script / debugger / DevToolsUtils . js ' , " debug " ) ; <nl> + require ( ' script / debugger / DevToolsUtils . js ' , ' debug ' ) ; <nl> require ( ' script / debugger / event - emitter . js ' , ' debug ' ) ; <nl> require ( ' script / debugger / actors / utils / ScriptStore . js ' , ' debug ' ) ; <nl> require ( ' script / debugger / actors / common . js ' , ' debug ' ) ; <nl> - require ( ' script / debugger / core / promise . js ' , " debug " ) ; <nl> - require ( ' script / debugger / transport . js ' , " debug " ) ; <nl> - require ( ' script / debugger / main . js ' , " debug " ) ; <nl> + require ( ' script / debugger / core / promise . js ' , ' debug ' ) ; <nl> + require ( ' script / debugger / transport . js ' , ' debug ' ) ; <nl> + require ( ' script / debugger / main . js ' , ' debug ' ) ; <nl> require ( ' script / debugger / actors / object . js ' , ' debug ' ) ; <nl> - require ( ' script / debugger / actors / root . js ' , " debug " ) ; <nl> - require ( ' script / debugger / actors / script . js ' , " debug " ) ; <nl> - require ( ' script / debugger / actors / webconsole . js ' , " debug " ) <nl> + require ( ' script / debugger / actors / root . js ' , ' debug ' ) ; <nl> + require ( ' script / debugger / actors / script . js ' , ' debug ' ) ; <nl> + require ( ' script / debugger / actors / webconsole . js ' , ' debug ' ) <nl> require ( ' script / debugger / actors / utils / TabSources . js ' , ' debug ' ) ; <nl> <nl> / / DebuggerServer . addTestGlobal = function ( aGlobal ) { <nl> | support webconsole | cocos2d/cocos2d-x | 5f9bd06beef6b80c3f74effacbc15336cf85a95b | 2016-01-15T10:05:59Z |
mmm a / php_swoole . h <nl> ppp b / php_swoole . h <nl> static sw_inline zend_string * sw_zend_string_recycle ( zend_string * s , size_t allo <nl> <nl> / / mmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmm - Array APImmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmm <nl> <nl> - # define php_swoole_array_length ( zarray ) zend_hash_num_elements ( Z_ARRVAL_P ( zarray ) ) <nl> - # define php_swoole_array_length_safe ( zarray ) ( ZVAL_IS_ARRAY ( zarray ) ? php_swoole_array_length ( zarray ) : 0 ) <nl> - # define php_swoole_array_get_value ( ht , str , v ) ( ( v = zend_hash_str_find ( ht , str , sizeof ( str ) - 1 ) ) & & ! ZVAL_IS_NULL ( v ) ) <nl> + # define php_swoole_array_length ( zarray ) zend_hash_num_elements ( Z_ARRVAL_P ( zarray ) ) <nl> + # define php_swoole_array_length_safe ( zarray ) ( ZVAL_IS_ARRAY ( zarray ) ? php_swoole_array_length ( zarray ) : 0 ) <nl> + # define php_swoole_array_get_value ( ht , str , v ) ( ( v = zend_hash_str_find ( ht , str , sizeof ( str ) - 1 ) ) & & ! ZVAL_IS_NULL ( v ) ) <nl> <nl> # define SW_HASHTABLE_FOREACH_START ( ht , _val ) ZEND_HASH_FOREACH_VAL ( ht , _val ) ; { <nl> # define SW_HASHTABLE_FOREACH_START2 ( ht , k , klen , ktype , _val ) zend_string * _foreach_key ; \ <nl> static sw_inline int add_assoc_ulong_safe_ex ( zval * arg , const char * key , size_t <nl> } <nl> else <nl> { <nl> - char buf [ MAX_LENGTH_OF_LONG + 1 ] = { 0 } ; <nl> - sprintf ( ( char * ) buf , ZEND_ULONG_FMT , value ) ; <nl> + char buf [ MAX_LENGTH_OF_LONG + 1 ] ; <nl> + sprintf ( ( char * ) buf , ZEND_ULONG_FMT " \ 0 " , value ) ; <nl> return add_assoc_string_ex ( arg , key , key_len , buf ) ; <nl> } <nl> } <nl> mmm a / php_swoole_cxx . h <nl> ppp b / php_swoole_cxx . h <nl> class key_value <nl> <nl> namespace function <nl> { <nl> - inline bool call ( zend_fcall_info_cache * fci_cache , uint32_t argc , zval * argv , zval * retval , const bool enable_coroutine ) <nl> + inline bool call ( zend_fcall_info_cache * fci_cache , uint32_t argc , zval * argv , zval * retval , bool enable_coroutine ) <nl> { <nl> if ( enable_coroutine ) <nl> { <nl> | Code optimization . | swoole/swoole-src | 4a2f7ed82d4cdbc178607c8574456ddd1c662b10 | 2019-05-15T11:34:37Z |
mmm a / src / share / device_properties . hpp <nl> ppp b / src / share / device_properties . hpp <nl> class device_properties final { <nl> product_ = hid_device . find_product ( ) ; <nl> serial_number_ = hid_device . find_serial_number ( ) ; <nl> transport_ = hid_device . find_transport ( ) ; <nl> - is_keyboard_ = iokit_utility : : is_keyboard ( device ) ; <nl> - is_pointing_device_ = iokit_utility : : is_pointing_device ( device ) ; <nl> + is_keyboard_ = iokit_utility : : is_keyboard ( hid_device ) ; <nl> + is_pointing_device_ = iokit_utility : : is_pointing_device ( hid_device ) ; <nl> <nl> if ( product_ & & is_keyboard_ & & is_pointing_device_ ) { <nl> if ( ( * product_ ) . find ( " Apple Internal " ) ! = std : : string : : npos ) { <nl> mmm a / src / share / iokit_utility . hpp <nl> ppp b / src / share / iokit_utility . hpp <nl> <nl> namespace krbn { <nl> class iokit_utility final { <nl> public : <nl> - static bool is_keyboard ( IOHIDDeviceRef _Nonnull device ) { <nl> - if ( device ) { <nl> - return IOHIDDeviceConformsTo ( device , kHIDPage_GenericDesktop , kHIDUsage_GD_Keyboard ) ; <nl> + static bool is_keyboard ( const pqrs : : osx : : iokit_hid_device & device ) { <nl> + if ( device . conforms_to ( pqrs : : osx : : iokit_hid_usage_page_generic_desktop , <nl> + pqrs : : osx : : iokit_hid_usage_generic_desktop_keyboard ) ) { <nl> + return true ; <nl> } <nl> + <nl> return false ; <nl> } <nl> <nl> - static bool is_pointing_device ( IOHIDDeviceRef _Nonnull device ) { <nl> - if ( device ) { <nl> - return IOHIDDeviceConformsTo ( device , kHIDPage_GenericDesktop , kHIDUsage_GD_Pointer ) | | <nl> - IOHIDDeviceConformsTo ( device , kHIDPage_GenericDesktop , kHIDUsage_GD_Mouse ) ; <nl> + static bool is_pointing_device ( const pqrs : : osx : : iokit_hid_device & device ) { <nl> + if ( device . conforms_to ( pqrs : : osx : : iokit_hid_usage_page_generic_desktop , pqrs : : osx : : iokit_hid_usage_generic_desktop_pointer ) | | <nl> + device . conforms_to ( pqrs : : osx : : iokit_hid_usage_page_generic_desktop , pqrs : : osx : : iokit_hid_usage_generic_desktop_mouse ) ) { <nl> + return true ; <nl> } <nl> + <nl> return false ; <nl> } <nl> <nl> | use iokit_hid_device : : device . conforms_to | pqrs-org/Karabiner-Elements | 021afa56578a262a5cf31a974741a456ff85da60 | 2020-01-15T08:47:25Z |
mmm a / include / swift / SILOptimizer / Utils / ValueLifetime . h <nl> ppp b / include / swift / SILOptimizer / Utils / ValueLifetime . h <nl> class ValueLifetimeAnalysis { <nl> / / / The lifetime frontier for the value . It is the list of instructions <nl> / / / following the last uses of the value . All the frontier instructions <nl> / / / end the value ' s lifetime . <nl> - typedef llvm : : SmallVector < SILInstruction * , 4 > Frontier ; <nl> + using Frontier = SmallVector < SILInstruction * , 4 > ; <nl> <nl> - / / / Constructor for the value \ p Def with a specific set of users of Def ' s <nl> - / / / users . <nl> - ValueLifetimeAnalysis ( SILInstruction * def , <nl> - ArrayRef < SILInstruction * > userList ) <nl> - : defValue ( def ) , userSet ( userList . begin ( ) , userList . end ( ) ) { <nl> + / / / Constructor for the value \ p Def with a specific range of users . <nl> + / / / <nl> + / / / We templatize over the RangeTy so that we can initialize <nl> + / / / ValueLifetimeAnalysis with misc iterators including transform <nl> + / / / iterators . <nl> + template < typename RangeTy > <nl> + ValueLifetimeAnalysis ( SILInstruction * def , const RangeTy & userRange ) <nl> + : defValue ( def ) , userSet ( userRange . begin ( ) , userRange . end ( ) ) { <nl> propagateLiveness ( ) ; <nl> } <nl> <nl> mmm a / lib / SILOptimizer / Mandatory / PredictableMemOpt . cpp <nl> ppp b / lib / SILOptimizer / Mandatory / PredictableMemOpt . cpp <nl> <nl> <nl> # include " PMOMemoryUseCollector . h " <nl> # include " swift / Basic / BlotSetVector . h " <nl> + # include " swift / Basic / FrozenMultiMap . h " <nl> # include " swift / Basic / STLExtras . h " <nl> # include " swift / SIL / BasicBlockUtils . h " <nl> # include " swift / SIL / BranchPropagatedUser . h " <nl> SILValue AvailableValueAggregator : : handlePrimitiveValue ( SILType loadTy , <nl> return builder . emitCopyValueOperation ( Loc , eltVal ) ; <nl> } <nl> <nl> - static SILInstruction * getNonPhiBlockIncomingValueDef ( SILValue incomingValue , <nl> - CopyValueInst * phiCopy ) { <nl> + static SILInstruction * <nl> + getNonPhiBlockIncomingValueDef ( SILValue incomingValue , <nl> + SingleValueInstruction * phiCopy ) { <nl> + assert ( isa < CopyValueInst > ( phiCopy ) ) ; <nl> auto * phiBlock = phiCopy - > getParent ( ) ; <nl> if ( phiBlock = = incomingValue - > getParentBlock ( ) ) { <nl> return nullptr ; <nl> class PhiNodeCopyCleanupInserter { <nl> / / / visit our incoming values in visitation order and that within <nl> / / / their own values , also visit them in visitation order with <nl> / / / respect to each other . <nl> - SmallVector < std : : pair < unsigned , CopyValueInst * > , 16 > copiesToCleanup ; <nl> + SmallFrozenMultiMap < unsigned , SingleValueInstruction * , 16 > copiesToCleanup ; <nl> <nl> / / / The lifetime frontier that we use to compute lifetime endpoints <nl> / / / when emitting cleanups . <nl> class PhiNodeCopyCleanupInserter { <nl> auto iter = incomingValues . insert ( entry ) ; <nl> / / If we did not succeed , then iter . first . second is the index of <nl> / / incoming value . Otherwise , it will be nextIndex . <nl> - copiesToCleanup . emplace_back ( iter . first - > second , copy ) ; <nl> + copiesToCleanup . insert ( iter . first - > second , copy ) ; <nl> } <nl> <nl> void emit ( DeadEndBlocks & deadEndBlocks ) & & ; <nl> void PhiNodeCopyCleanupInserter : : emit ( DeadEndBlocks & deadEndBlocks ) & & { <nl> / / first phiNodeCleanupState for a specific phi , we process the phi <nl> / / then . This ensures that we always process the phis in insertion order as <nl> / / well . <nl> - SmallVector < unsigned , 32 > copiesToCleanupIndicesSorted ; <nl> - llvm : : copy ( indices ( copiesToCleanup ) , <nl> - std : : back_inserter ( copiesToCleanupIndicesSorted ) ) ; <nl> - <nl> - stable_sort ( copiesToCleanupIndicesSorted , <nl> - [ & ] ( unsigned lhsIndex , unsigned rhsIndex ) { <nl> - unsigned lhs = copiesToCleanup [ lhsIndex ] . first ; <nl> - unsigned rhs = copiesToCleanup [ rhsIndex ] . first ; <nl> - return lhs < rhs ; <nl> - } ) ; <nl> - <nl> - for ( auto ii = copiesToCleanupIndicesSorted . begin ( ) , <nl> - ie = copiesToCleanupIndicesSorted . end ( ) ; <nl> - ii ! = ie ; ) { <nl> - unsigned incomingValueIndex = copiesToCleanup [ * ii ] . first ; <nl> - <nl> - / / First find the end of the values for which ii does not equal baseValue . <nl> - auto rangeEnd = std : : find_if_not ( std : : next ( ii ) , ie , [ & ] ( unsigned index ) { <nl> - return incomingValueIndex = = copiesToCleanup [ index ] . first ; <nl> - } ) ; <nl> + copiesToCleanup . setFrozen ( ) ; <nl> <nl> - SWIFT_DEFER { <nl> - / / Once we have finished processing , set ii to rangeEnd . This ensures that <nl> - / / the code below does not need to worry about updating the iterator . <nl> - ii = rangeEnd ; <nl> - } ; <nl> + for ( auto keyValue : copiesToCleanup . getRange ( ) ) { <nl> + unsigned incomingValueIndex = keyValue . first ; <nl> + auto copies = keyValue . second ; <nl> <nl> SILValue incomingValue = <nl> std : : next ( incomingValues . begin ( ) , incomingValueIndex ) - > first ; <nl> - CopyValueInst * phiCopy = copiesToCleanup [ * ii ] . second ; <nl> + SingleValueInstruction * phiCopy = copies . front ( ) ; <nl> auto * insertPt = getNonPhiBlockIncomingValueDef ( incomingValue , phiCopy ) ; <nl> auto loc = RegularLocation : : getAutoGeneratedLocation ( ) ; <nl> <nl> void PhiNodeCopyCleanupInserter : : emit ( DeadEndBlocks & deadEndBlocks ) & & { <nl> / / copy and continue . This means that <nl> / / cleanupState . getNonPhiBlockIncomingValueDef ( ) should always return a <nl> / / non - null value in the code below . <nl> - if ( std : : next ( ii ) = = rangeEnd & & isa < SILArgument > ( incomingValue ) & & <nl> - ! insertPt ) { <nl> + if ( copies . size ( ) = = 1 & & isa < SILArgument > ( incomingValue ) & & ! insertPt ) { <nl> SILBasicBlock * phiBlock = phiCopy - > getParent ( ) ; <nl> SILBuilderWithScope builder ( phiBlock - > getTerminator ( ) ) ; <nl> builder . createDestroyValue ( loc , incomingValue ) ; <nl> void PhiNodeCopyCleanupInserter : : emit ( DeadEndBlocks & deadEndBlocks ) & & { <nl> <nl> / / Otherwise , we know that we have for this incomingValue , multiple <nl> / / potential insert pts that we need to handle at the same time with our <nl> - / / lifetime query . Gather up those uses . <nl> - SmallVector < SILInstruction * , 8 > users ; <nl> - transform ( llvm : : make_range ( ii , rangeEnd ) , std : : back_inserter ( users ) , <nl> - [ & ] ( unsigned index ) { return copiesToCleanup [ index ] . second ; } ) ; <nl> - <nl> - / / Then lifetime extend our base over the copy_value . <nl> + / / lifetime query . Lifetime extend our base over these copy_value uses . <nl> assert ( lifetimeFrontier . empty ( ) ) ; <nl> auto * def = getNonPhiBlockIncomingValueDef ( incomingValue , phiCopy ) ; <nl> assert ( def & & " Should never have a nullptr here since we handled all of " <nl> " the single block cases earlier " ) ; <nl> - ValueLifetimeAnalysis analysis ( def , users ) ; <nl> + ValueLifetimeAnalysis analysis ( def , copies ) ; <nl> bool foundCriticalEdges = ! analysis . computeFrontier ( <nl> lifetimeFrontier , ValueLifetimeAnalysis : : DontModifyCFG , & deadEndBlocks ) ; <nl> ( void ) foundCriticalEdges ; <nl> | Merge pull request from gottesmm / pr - 0a06969f425624e1d9d39042fc499975eefdbdac | apple/swift | bf7ac27107f7954643d366d934ef5447f3cc77d1 | 2020-02-18T18:09:32Z |
mmm a / src / backtrace . cc <nl> ppp b / src / backtrace . cc <nl> address_to_line_t : : addr2line_t : : addr2line_t ( const char * executable ) : input ( NULL <nl> const char * args [ ] = { " addr2line " , " - s " , " - e " , executable , NULL } ; <nl> <nl> execvp ( " addr2line " , const_cast < char * const * > ( args ) ) ; <nl> - exit ( EXIT_FAILURE ) ; <nl> + / / A normal ` exit ` can get stuck here it seems . Maybe some ` atexit ` handler ? <nl> + quick_exit ( EXIT_FAILURE ) ; <nl> } <nl> } <nl> <nl> | Fix for . | rethinkdb/rethinkdb | 1f085a43dcfadd27a97e8c3fa4fe68b822efd1e4 | 2016-01-26T01:57:16Z |
mmm a / Marlin / ultralcd . cpp <nl> ppp b / Marlin / ultralcd . cpp <nl> char * ftostr12ns ( const float & x ) <nl> <nl> / / convert float to space - padded string with - _23 . 4_ format <nl> char * ftostr32np ( const float & x ) { <nl> + < < < < < < < HEAD <nl> long xx = abs ( x * 100 ) ; <nl> uint8_t dig ; <nl> <nl> char * ftostr32np ( const float & x ) { <nl> } <nl> conv [ 6 ] = ' \ 0 ' ; <nl> return conv ; <nl> + = = = = = = = <nl> + char * c = ftostr32 ( x ) ; <nl> + if ( c [ 0 ] = = ' 0 ' | | c [ 0 ] = = ' - ' ) { <nl> + if ( c [ 0 ] = = ' 0 ' ) c [ 0 ] = ' ' ; <nl> + if ( c [ 1 ] = = ' 0 ' ) c [ 1 ] = ' ' ; <nl> + } <nl> + if ( c [ 5 ] = = ' 0 ' ) { <nl> + c [ 5 ] = ' ' ; <nl> + if ( c [ 4 ] = = ' 0 ' ) c [ 4 ] = c [ 3 ] = ' ' ; <nl> + } <nl> + return c ; <nl> + > > > > > > > Patch to make Z look more like X and Y on UltraLCD <nl> } <nl> <nl> char * itostr31 ( const int & xx ) <nl> | As it should be | MarlinFirmware/Marlin | d1f21d11890042306ab4d51ff8154127c1382711 | 2014-12-30T15:26:25Z |
mmm a / ChangeLog <nl> ppp b / ChangeLog <nl> <nl> + 2008 - 12 - 02 Tatsuhiro Tsujikawa < t - tujikawa @ users . sourceforge . net > <nl> + <nl> + Changed the package name from ` aria2c ' to ` aria2 ' in order to fix <nl> + the packaging issue in Debian and Fedora . The name of the <nl> + executable is not changed . <nl> + * configure . ac <nl> + <nl> 2008 - 12 - 02 Tatsuhiro Tsujikawa < t - tujikawa @ users . sourceforge . net > <nl> <nl> Fixed typos <nl> mmm a / configure <nl> ppp b / configure <nl> <nl> # ! / bin / sh <nl> # Guess values for system - dependent variables and create Makefiles . <nl> - # Generated by GNU Autoconf 2 . 61 for aria2c 1 . 0 . 1 . <nl> + # Generated by GNU Autoconf 2 . 61 for aria2 1 . 0 . 1 . <nl> # <nl> # Report bugs to < t - tujikawa @ users . sourceforge . net > . <nl> # <nl> MAKEFLAGS = <nl> SHELL = $ { CONFIG_SHELL - / bin / sh } <nl> <nl> # Identity of this package . <nl> - PACKAGE_NAME = ' aria2c ' <nl> - PACKAGE_TARNAME = ' aria2c ' <nl> + PACKAGE_NAME = ' aria2 ' <nl> + PACKAGE_TARNAME = ' aria2 ' <nl> PACKAGE_VERSION = ' 1 . 0 . 1 ' <nl> - PACKAGE_STRING = ' aria2c 1 . 0 . 1 ' <nl> + PACKAGE_STRING = ' aria2 1 . 0 . 1 ' <nl> PACKAGE_BUGREPORT = ' t - tujikawa @ users . sourceforge . net ' <nl> <nl> ac_unique_file = " src / Socket . h " <nl> if test " $ ac_init_help " = " long " ; then <nl> # Omit some internal or obsolete options to make the list less imposing . <nl> # This message is too long to be a string in the A / UX 3 . 1 sh . <nl> cat < < _ACEOF <nl> - \ ` configure ' configures aria2c 1 . 0 . 1 to adapt to many kinds of systems . <nl> + \ ` configure ' configures aria2 1 . 0 . 1 to adapt to many kinds of systems . <nl> <nl> Usage : $ 0 [ OPTION ] . . . [ VAR = VALUE ] . . . <nl> <nl> Fine tuning of the installation directories : <nl> - - infodir = DIR info documentation [ DATAROOTDIR / info ] <nl> - - localedir = DIR locale - dependent data [ DATAROOTDIR / locale ] <nl> - - mandir = DIR man documentation [ DATAROOTDIR / man ] <nl> - - - docdir = DIR documentation root [ DATAROOTDIR / doc / aria2c ] <nl> + - - docdir = DIR documentation root [ DATAROOTDIR / doc / aria2 ] <nl> - - htmldir = DIR html documentation [ DOCDIR ] <nl> - - dvidir = DIR dvi documentation [ DOCDIR ] <nl> - - pdfdir = DIR pdf documentation [ DOCDIR ] <nl> fi <nl> <nl> if test - n " $ ac_init_help " ; then <nl> case $ ac_init_help in <nl> - short | recursive ) echo " Configuration of aria2c 1 . 0 . 1 : " ; ; <nl> + short | recursive ) echo " Configuration of aria2 1 . 0 . 1 : " ; ; <nl> esac <nl> cat < < \ _ACEOF <nl> <nl> fi <nl> test - n " $ ac_init_help " & & exit $ ac_status <nl> if $ ac_init_version ; then <nl> cat < < \ _ACEOF <nl> - aria2c configure 1 . 0 . 1 <nl> + aria2 configure 1 . 0 . 1 <nl> generated by GNU Autoconf 2 . 61 <nl> <nl> Copyright ( C ) 1992 , 1993 , 1994 , 1995 , 1996 , 1998 , 1999 , 2000 , 2001 , <nl> cat > config . log < < _ACEOF <nl> This file contains any messages produced by compilers while <nl> running configure , to aid debugging if configure makes a mistake . <nl> <nl> - It was created by aria2c $ as_me 1 . 0 . 1 , which was <nl> + It was created by aria2 $ as_me 1 . 0 . 1 , which was <nl> generated by GNU Autoconf 2 . 61 . Invocation command line was <nl> <nl> $ $ 0 $ @ <nl> fi <nl> <nl> <nl> # Define the identity of the package . <nl> - PACKAGE = ' aria2c ' <nl> + PACKAGE = ' aria2 ' <nl> VERSION = ' 1 . 0 . 1 ' <nl> <nl> <nl> exec 6 > & 1 <nl> # report actual input values of CONFIG_FILES etc . instead of their <nl> # values after options handling . <nl> ac_log = " <nl> - This file was extended by aria2c $ as_me 1 . 0 . 1 , which was <nl> + This file was extended by aria2 $ as_me 1 . 0 . 1 , which was <nl> generated by GNU Autoconf 2 . 61 . Invocation command line was <nl> <nl> CONFIG_FILES = $ CONFIG_FILES <nl> Report bugs to < bug - autoconf @ gnu . org > . " <nl> _ACEOF <nl> cat > > $ CONFIG_STATUS < < _ACEOF <nl> ac_cs_version = " \ \ <nl> - aria2c config . status 1 . 0 . 1 <nl> + aria2 config . status 1 . 0 . 1 <nl> configured by $ 0 , generated by GNU Autoconf 2 . 61 , <nl> with options \ \ " ` echo " $ ac_configure_args " | sed ' s / ^ / / ; s / [ \ \ " " \ ` \ $ ] / \ \ \ \ & / g ' ` \ \ " <nl> <nl> mmm a / configure . ac <nl> ppp b / configure . ac <nl> <nl> # Process this file with autoconf to produce a configure script . <nl> # <nl> AC_PREREQ ( 2 . 61 ) <nl> - AC_INIT ( aria2c , 1 . 0 . 1 , t - tujikawa @ users . sourceforge . net ) <nl> + AC_INIT ( aria2 , 1 . 0 . 1 , t - tujikawa @ users . sourceforge . net ) <nl> AC_CANONICAL_HOST <nl> AC_CANONICAL_SYSTEM <nl> AM_INIT_AUTOMAKE ( ) <nl> | 2008 - 12 - 02 Tatsuhiro Tsujikawa < t - tujikawa @ users . sourceforge . net > | aria2/aria2 | 94f912ffeffc10b91f1d46587897025f1e3d8293 | 2008-12-02T11:07:21Z |
mmm a / lib / Migrator / SyntacticMigratorPass . cpp <nl> ppp b / lib / Migrator / SyntacticMigratorPass . cpp <nl> using namespace swift : : ide : : api ; <nl> <nl> struct FoundResult { <nl> SourceRange TokenRange ; <nl> + bool Optional ; / / Range has a trailing ? or ! included <nl> bool Suffixable ; / / No need to wrap parens when adding optionality <nl> bool isValid ( ) const { return TokenRange . isValid ( ) ; } <nl> } ; <nl> class ChildIndexFinder : public TypeReprVisitor < ChildIndexFinder , FoundResult > { <nl> return findChild ( Func - > getBodyResultTypeLoc ( ) ) ; <nl> if ( auto Init = dyn_cast < ConstructorDecl > ( Parent ) ) { <nl> SourceLoc End = Init - > getFailabilityLoc ( ) ; <nl> - if ( End . isInvalid ( ) ) <nl> + bool Optional = End . isValid ( ) ; <nl> + if ( ! Optional ) <nl> End = Init - > getNameLoc ( ) ; <nl> - return { SourceRange ( Init - > getNameLoc ( ) , End ) , true } ; <nl> + return { SourceRange ( Init - > getNameLoc ( ) , End ) , Optional , / * suffixable = * / true } ; <nl> } <nl> - return { SourceRange ( ) , false } ; <nl> + return { SourceRange ( ) , false , false } ; <nl> } <nl> <nl> for ( auto * Params : Parent - > getParameterLists ( ) ) { <nl> class ChildIndexFinder : public TypeReprVisitor < ChildIndexFinder , FoundResult > { <nl> } <nl> <nl> private : <nl> - bool hasNextIndex ( ) { <nl> + bool hasNextIndex ( ) const { <nl> return ! ChildIndices . empty ( ) ; <nl> } <nl> <nl> class ChildIndexFinder : public TypeReprVisitor < ChildIndexFinder , FoundResult > { <nl> return Next ; <nl> } <nl> <nl> + bool isUserTypeAlias ( TypeRepr * T ) const { <nl> + if ( auto Ident = dyn_cast < ComponentIdentTypeRepr > ( T ) ) { <nl> + if ( auto Bound = Ident - > getBoundDecl ( ) ) { <nl> + return isa < TypeAliasDecl > ( Bound ) & & <nl> + ! Bound - > getModuleContext ( ) - > isSystemModule ( ) ; <nl> + } <nl> + } <nl> + return false ; <nl> + } <nl> + <nl> FoundResult findChild ( TypeLoc Loc ) { <nl> if ( ! Loc . hasLocation ( ) ) <nl> - return { SourceRange ( ) , false } ; <nl> + return { SourceRange ( ) , false , false } ; <nl> return visit ( Loc . getTypeRepr ( ) ) ; <nl> } <nl> <nl> public : <nl> - FoundResult handleParent ( TypeRepr * Parent , TypeRepr * FirstChild , <nl> - TypeRepr * SecondChild , bool Suffixable = true ) { <nl> - if ( ! hasNextIndex ( ) ) <nl> - return { Parent - > getSourceRange ( ) , Suffixable } ; <nl> - auto NextIndex = consumeNext ( ) ; <nl> - assert ( NextIndex < 2 & & " child index out of bounds " ) ; <nl> - return visit ( NextIndex ? SecondChild : FirstChild ) ; <nl> - } <nl> <nl> template < typename T > <nl> FoundResult handleParent ( TypeRepr * Parent , const ArrayRef < T > Children , <nl> - bool Suffixable = true ) { <nl> + bool Optional = false , bool Suffixable = true ) { <nl> if ( ! hasNextIndex ( ) ) <nl> - return { Parent - > getSourceRange ( ) , Suffixable } ; <nl> + return { Parent - > getSourceRange ( ) , Optional , Suffixable } ; <nl> auto NextIndex = consumeNext ( ) ; <nl> + if ( isUserTypeAlias ( Parent ) ) <nl> + return { SourceRange ( ) , false , false } ; <nl> assert ( NextIndex < Children . size ( ) ) ; <nl> TypeRepr * Child = Children [ NextIndex ] ; <nl> return visit ( Child ) ; <nl> } <nl> <nl> - FoundResult handleParent ( TypeRepr * Parent , TypeRepr * Base , <nl> + FoundResult handleParent ( TypeRepr * Parent , TypeRepr * FirstChild , <nl> + TypeRepr * SecondChild , bool Optional = false , <nl> bool Suffixable = true ) { <nl> - return handleParent ( Parent , llvm : : makeArrayRef ( Base ) , Suffixable ) ; <nl> + TypeRepr * Children [ ] = { FirstChild , SecondChild } ; <nl> + return handleParent ( Parent , llvm : : makeArrayRef ( Children ) , Optional , <nl> + Suffixable ) ; <nl> + } <nl> + <nl> + FoundResult handleParent ( TypeRepr * Parent , TypeRepr * Base , <nl> + bool Optional = false , bool Suffixable = true ) { <nl> + return handleParent ( Parent , llvm : : makeArrayRef ( Base ) , Optional , Suffixable ) ; <nl> } <nl> <nl> FoundResult visitTypeRepr ( TypeRepr * T ) { <nl> class ChildIndexFinder : public TypeReprVisitor < ChildIndexFinder , FoundResult > { <nl> } <nl> <nl> FoundResult visitErrorTypeRepr ( ErrorTypeRepr * T ) { <nl> - return { SourceRange ( ) , false } ; <nl> + return { SourceRange ( ) , false , false } ; <nl> } <nl> <nl> FoundResult visitAttributedTypeRepr ( AttributedTypeRepr * T ) { <nl> class ChildIndexFinder : public TypeReprVisitor < ChildIndexFinder , FoundResult > { <nl> <nl> FoundResult visitFunctionTypeRepr ( FunctionTypeRepr * T ) { <nl> return handleParent ( T , T - > getResultTypeRepr ( ) , T - > getArgsTypeRepr ( ) , <nl> - / * Suffixable = * / false ) ; <nl> + / * Optional = * / false , / * Suffixable = * / false ) ; <nl> } <nl> <nl> FoundResult visitCompositionTypeRepr ( CompositionTypeRepr * T ) { <nl> - return handleParent ( T , T - > getTypes ( ) , / * Suffixable = * / false ) ; <nl> + return handleParent ( T , T - > getTypes ( ) , / * Optional = * / false , <nl> + / * Suffixable = * / false ) ; <nl> } <nl> <nl> FoundResult visitSimpleIdentTypeRepr ( SimpleIdentTypeRepr * T ) { <nl> - if ( ! hasNextIndex ( ) ) <nl> - return { T - > getSourceRange ( ) , true } ; <nl> - / / This may be a typealias so report no match <nl> - return { SourceRange ( ) , false } ; <nl> + return handleParent ( T , ArrayRef < TypeRepr * > ( ) ) ; <nl> } <nl> <nl> FoundResult visitGenericIdentTypeRepr ( GenericIdentTypeRepr * T ) { <nl> - / / FIXME : This could be a generic type alias <nl> return handleParent ( T , T - > getGenericArgs ( ) ) ; <nl> } <nl> <nl> FoundResult visitCompoundIdentTypeRepr ( CompoundIdentTypeRepr * T ) { <nl> - / / FIXME : this could be a nested typealias <nl> - return handleParent ( T , T - > Components ) ; <nl> + return visit ( T - > Components . back ( ) ) ; <nl> } <nl> <nl> FoundResult visitOptionalTypeRepr ( OptionalTypeRepr * T ) { <nl> - return handleParent ( T , T - > getBase ( ) ) ; <nl> + return handleParent ( T , T - > getBase ( ) , / * Optional = * / true ) ; <nl> } <nl> <nl> FoundResult visitImplicitlyUnwrappedOptionalTypeRepr ( ImplicitlyUnwrappedOptionalTypeRepr * T ) { <nl> - return handleParent ( T , T - > getBase ( ) ) ; <nl> + return handleParent ( T , T - > getBase ( ) , / * Optional = * / true ) ; <nl> } <nl> <nl> FoundResult visitProtocolTypeRepr ( ProtocolTypeRepr * T ) { <nl> class ChildIndexFinder : public TypeReprVisitor < ChildIndexFinder , FoundResult > { <nl> } <nl> <nl> FoundResult visitFixedTypeRepr ( FixedTypeRepr * T ) { <nl> - assert ( ! hasNextIndex ( ) ) ; <nl> - return { T - > getSourceRange ( ) , true } ; <nl> + return handleParent ( T , ArrayRef < TypeRepr * > ( ) ) ; <nl> } <nl> } ; <nl> <nl> struct SyntacticMigratorPass : : Implementation : public SourceEntityWalker { <nl> } <nl> break ; <nl> case ide : : api : : NodeAnnotation : : UnwrapOptional : <nl> - Editor . remove ( Result . TokenRange . End ) ; <nl> + if ( Result . Optional ) <nl> + Editor . remove ( Result . TokenRange . End ) ; <nl> break ; <nl> case ide : : api : : NodeAnnotation : : ImplicitOptionalToOptional : <nl> - Editor . replace ( Result . TokenRange . End , " ? " ) ; <nl> + if ( Result . Optional ) <nl> + Editor . replace ( Result . TokenRange . End , " ? " ) ; <nl> break ; <nl> case ide : : api : : NodeAnnotation : : TypeRewritten : <nl> Editor . replace ( Result . TokenRange , DiffItem - > RightComment ) ; <nl> mmm a / test / Migrator / wrap_optional . swift <nl> ppp b / test / Migrator / wrap_optional . swift <nl> class MyExtraCities : ExtraCities { <nl> func blibli ( x : ( String ? , String ) - > String ! ) { } <nl> func currimundi ( x : ( Int , ( Int , Int ) ) ! ) { } <nl> } <nl> + <nl> + typealias IntAnd < T > = ( Int , T ) <nl> + class Outer { <nl> + typealias Inner = ( String ? , String ) - > String ! <nl> + } <nl> + <nl> + class MyExtraCitiesWithAliases : ExtraCities { <nl> + func blibli ( x : Outer . Inner ) { } <nl> + func currimundi ( x : ( Int , IntAnd < Int > ) ! ) { } <nl> + } <nl> + <nl> + typealias OptString = String ? <nl> + typealias ImplicitlyUnwrapped < T > = T ! <nl> + <nl> + class MyExtraCitiesWithMoreAliases : ExtraCities { <nl> + func blibli ( x : ( OptString , String ) - > String ! ) { } <nl> + func currimundi ( x : ImplicitlyUnwrapped < ( Int , ( Int , Int ) ) > ) { } <nl> + } <nl> mmm a / test / Migrator / wrap_optional . swift . expected <nl> ppp b / test / Migrator / wrap_optional . swift . expected <nl> class MyExtraCities : ExtraCities { <nl> func blibli ( x : ( ( String , String ) - > String ? ) ? ) { } <nl> func currimundi ( x : ( Int , ( Int ? , Int ) ) ? ) { } <nl> } <nl> + <nl> + typealias IntAnd < T > = ( Int , T ) <nl> + class Outer { <nl> + typealias Inner = ( String ? , String ) - > String ! <nl> + } <nl> + <nl> + class MyExtraCitiesWithAliases : ExtraCities { <nl> + func blibli ( x : Outer . Inner ? ) { } <nl> + func currimundi ( x : ( Int , IntAnd < Int > ) ? ) { } <nl> + } <nl> + <nl> + typealias OptString = String ? <nl> + typealias ImplicitlyUnwrapped < T > = T ! <nl> + <nl> + class MyExtraCitiesWithMoreAliases : ExtraCities { <nl> + func blibli ( x : ( ( OptString , String ) - > String ? ) ? ) { } <nl> + func currimundi ( x : ImplicitlyUnwrapped < ( Int , ( Int , Int ) ) > ) { } <nl> + } <nl> | Merge remote - tracking branch ' origin / master ' into master - next | apple/swift | 1a5f60732306ced898eebb6e3f3a60dc752fd2b6 | 2017-05-03T01:09:02Z |
mmm a / src / arch / runtime / runtime . cc <nl> ppp b / src / arch / runtime / runtime . cc <nl> <nl> - # include " utils . hpp " <nl> # include " arch / runtime / runtime . hpp " <nl> + # include " arch / runtime / starter . hpp " <nl> + <nl> + # include " utils . hpp " <nl> # include " arch / runtime / thread_pool . hpp " <nl> # include " do_on_thread . hpp " <nl> <nl> mmm a / src / arch / runtime / runtime . hpp <nl> ppp b / src / arch / runtime / runtime . hpp <nl> <nl> # ifndef ARCH_RUNTIME_RUNTIME_HPP_ <nl> # define ARCH_RUNTIME_RUNTIME_HPP_ <nl> <nl> - # include < boost / function . hpp > <nl> - <nl> # include " arch / runtime / runtime_utils . hpp " <nl> # include " arch / runtime / coroutines . hpp " <nl> <nl> continue processing immediately if we are already on the correct thread , but <nl> at the time it didn ' t seem worth rewriting it , so call_later_on_this_thread ( ) <nl> was added to make it easy to simulate the old semantics . * / <nl> <nl> - / * ` run_in_thread_pool ( ) ` starts a RethinkDB thread pool , runs the given <nl> - function in a coroutine inside of it , waits for the function to return , and then <nl> - shuts down the thread pool . * / <nl> - <nl> - void run_in_thread_pool ( const boost : : function < void ( ) > & fun , int num_threads = 1 ) ; <nl> <nl> # endif / * ARCH_RUNTIME_RUNTIME_HPP_ * / <nl> new file mode 100644 <nl> index 00000000000 . . 742623160a4 <nl> mmm / dev / null <nl> ppp b / src / arch / runtime / starter . hpp <nl> <nl> + # ifndef ARCH_RUNTIME_STARTER_HPP_ <nl> + # define ARCH_RUNTIME_STARTER_HPP_ <nl> + <nl> + / / Implementation in runtime . cc . <nl> + <nl> + # include " errors . hpp " <nl> + # include < boost / function . hpp > <nl> + <nl> + / * ` run_in_thread_pool ( ) ` starts a RethinkDB thread pool , runs the given <nl> + function in a coroutine inside of it , waits for the function to return , and then <nl> + shuts down the thread pool . * / <nl> + <nl> + void run_in_thread_pool ( const boost : : function < void ( ) > & fun , int num_threads = 1 ) ; <nl> + <nl> + # endif / / ARCH_RUNTIME_STARTER_HPP_ <nl> mmm a / src / clustering / administration / main / command_line . cc <nl> ppp b / src / clustering / administration / main / command_line . cc <nl> <nl> # include < boost / program_options . hpp > <nl> <nl> # include " arch / arch . hpp " <nl> + # include " arch / runtime / starter . hpp " <nl> # include " arch / os_signal . hpp " <nl> # include " clustering / administration / main / command_line . hpp " <nl> # include " clustering / administration / main / serve . hpp " <nl> mmm a / src / concurrency / watchable . hpp <nl> ppp b / src / concurrency / watchable . hpp <nl> <nl> # ifndef CONCURRENCY_WATCHABLE_HPP_ <nl> # define CONCURRENCY_WATCHABLE_HPP_ <nl> <nl> + # include " errors . hpp " <nl> + # include < boost / function . hpp > <nl> + <nl> # include " concurrency / mutex_assertion . hpp " <nl> # include " concurrency / pubsub . hpp " <nl> # include " containers / clone_ptr . hpp " <nl> mmm a / src / unittest / unittest_utils . hpp <nl> ppp b / src / unittest / unittest_utils . hpp <nl> <nl> # define UNITTEST_UNITTEST_UTILS_HPP_ <nl> <nl> # include " errors . hpp " <nl> - # include < boost / function . hpp > <nl> + <nl> + / / Include run_in_thread_pool for people . <nl> + # include " arch / runtime / starter . hpp " <nl> <nl> # ifndef NDEBUG <nl> # define trace_call ( fn , args . . . ) do { \ <nl> | Moved run_in_thread_pool ( and boost : : function dependency ) to arch / runtime / starter . hpp . | rethinkdb/rethinkdb | a07d6086e0bb62b6e0466c4581bc3e65b79616df | 2012-03-17T00:42:59Z |
mmm a / src / video_core / textures / astc . cpp <nl> ppp b / src / video_core / textures / astc . cpp <nl> constexpr u32 Popcnt ( u32 n ) { <nl> <nl> class InputBitStream { <nl> public : <nl> - explicit InputBitStream ( const u8 * ptr , std : : size_t start_offset = 0 ) <nl> - : cur_byte ( ptr ) , next_bit ( start_offset % 8 ) { } <nl> + constexpr explicit InputBitStream ( const u8 * ptr , std : : size_t start_offset = 0 ) <nl> + : cur_byte { ptr } , next_bit { start_offset % 8 } { } <nl> <nl> - std : : size_t GetBitsRead ( ) const { <nl> - return m_BitsRead ; <nl> + constexpr std : : size_t GetBitsRead ( ) const { <nl> + return bits_read ; <nl> } <nl> <nl> - u32 ReadBit ( ) { <nl> - u32 bit = * cur_byte > > next_bit + + ; <nl> + constexpr bool ReadBit ( ) { <nl> + const bool bit = ( * cur_byte > > next_bit + + ) & 1 ; <nl> while ( next_bit > = 8 ) { <nl> next_bit - = 8 ; <nl> cur_byte + + ; <nl> } <nl> <nl> - m_BitsRead + + ; <nl> - return bit & 1 ; <nl> + bits_read + + ; <nl> + return bit ; <nl> } <nl> <nl> - u32 ReadBits ( std : : size_t nBits ) { <nl> + constexpr u32 ReadBits ( std : : size_t nBits ) { <nl> u32 ret = 0 ; <nl> for ( std : : size_t i = 0 ; i < nBits ; + + i ) { <nl> ret | = ( ReadBit ( ) & 1 ) < < i ; <nl> class InputBitStream { <nl> } <nl> <nl> template < std : : size_t nBits > <nl> - u32 ReadBits ( ) { <nl> + constexpr u32 ReadBits ( ) { <nl> u32 ret = 0 ; <nl> for ( std : : size_t i = 0 ; i < nBits ; + + i ) { <nl> ret | = ( ReadBit ( ) & 1 ) < < i ; <nl> class InputBitStream { <nl> private : <nl> const u8 * cur_byte ; <nl> std : : size_t next_bit = 0 ; <nl> - std : : size_t m_BitsRead = 0 ; <nl> + std : : size_t bits_read = 0 ; <nl> } ; <nl> <nl> class OutputBitStream { <nl> | astc : Make InputBitStream constexpr | yuzu-emu/yuzu | d22a6892506395d7348f42c21288ab5ac9d7be5a | 2020-04-09T05:54:05Z |
mmm a / test / Sanitizers / tsan - norace - deinit - run - time . swift <nl> ppp b / test / Sanitizers / tsan - norace - deinit - run - time . swift <nl> <nl> / / RUN : % target - swiftc_driver % s - g - sanitize = thread % import - libdispatch - target % sanitizers - target - triple - o % t_tsan - binary <nl> / / RUN : % target - codesign % t_tsan - binary <nl> / / RUN : env % env - TSAN_OPTIONS = abort_on_error = 0 % target - run % t_tsan - binary 2 > & 1 | % FileCheck % s - - dump - input = fail - - implicit - check - not = ' ThreadSanitizer ' <nl> - / / REQUIRES : rdar55880585 <nl> / / REQUIRES : executable_test <nl> / / REQUIRES : tsan_runtime <nl> <nl> | Revert " [ XFAIL ] Disable Sanitizers / tsan - norace - deinit - run - time . swift ( 55880585 ) " | apple/swift | 78601b0c6ff87e276518053dff74d1ece79a9388 | 2019-10-16T23:42:30Z |
mmm a / src / buffer_cache / alt / alt . cc <nl> ppp b / src / buffer_cache / alt / alt . cc <nl> <nl> + # define __STDC_LIMIT_MACROS <nl> # include " buffer_cache / alt / alt . hpp " <nl> <nl> # include " concurrency / auto_drainer . hpp " <nl> const void * alt_buf_read_t : : get_data_read ( uint32_t * block_size_out ) { <nl> lock_ - > current_page_acq_ . read_acq_signal ( ) - > wait ( ) ; <nl> page_t * page = lock_ - > current_page_acq_ . current_page_for_read ( ) ; <nl> if ( ! page_acq_ . has ( ) ) { <nl> - page_acq_ . init ( page ) ; <nl> + page_acq_ . init ( page , & lock_ - > cache_ - > page_cache_ ) ; <nl> } <nl> page_acq_ . buf_ready_signal ( ) - > wait ( ) ; <nl> * block_size_out = page_acq_ . get_buf_size ( ) ; <nl> void * alt_buf_write_t : : get_data_write ( uint32_t block_size ) { <nl> lock_ - > current_page_acq_ . write_acq_signal ( ) - > wait ( ) ; <nl> page_t * page = lock_ - > current_page_acq_ . current_page_for_write ( ) ; <nl> if ( ! page_acq_ . has ( ) ) { <nl> - page_acq_ . init ( page ) ; <nl> + page_acq_ . init ( page , & lock_ - > cache_ - > page_cache_ ) ; <nl> } <nl> page_acq_ . buf_ready_signal ( ) - > wait ( ) ; <nl> return page_acq_ . get_buf_write ( ) ; <nl> mmm a / src / buffer_cache / alt / page . cc <nl> ppp b / src / buffer_cache / alt / page . cc <nl> <nl> + # define __STDC_LIMIT_MACROS <nl> # include " buffer_cache / alt / page . hpp " <nl> <nl> # include < algorithm > <nl> namespace alt { <nl> <nl> page_cache_t : : page_cache_t ( serializer_t * serializer ) <nl> : serializer_ ( serializer ) , <nl> + unevictable_pages_ ( & page_t : : eviction_index ) , <nl> + evictable_disk_backed_pages_ ( & page_t : : eviction_index ) , <nl> + evictable_unbacked_pages_ ( & page_t : : eviction_index ) , <nl> + evicted_pages_ ( & page_t : : eviction_index ) , <nl> free_list_ ( serializer ) , <nl> drainer_ ( new auto_drainer_t ) { <nl> { <nl> current_page_t * page_cache_t : : page_for_new_block_id ( block_id_t * block_id_out ) { <nl> if ( current_pages_ [ block_id ] = = NULL ) { <nl> current_pages_ [ block_id ] = <nl> new current_page_t ( serializer_ - > get_block_size ( ) , <nl> - serializer_ - > malloc ( ) ) ; <nl> + serializer_ - > malloc ( ) , <nl> + this ) ; <nl> } else { <nl> current_pages_ [ block_id ] - > make_non_deleted ( serializer_ - > get_block_size ( ) , <nl> - serializer_ - > malloc ( ) ) ; <nl> + serializer_ - > malloc ( ) , <nl> + this ) ; <nl> } <nl> <nl> * block_id_out = block_id ; <nl> current_page_t : : current_page_t ( ) <nl> } <nl> <nl> current_page_t : : current_page_t ( block_size_t block_size , <nl> - scoped_malloc_t < ser_buffer_t > buf ) <nl> - : page_ ( new page_t ( block_size , std : : move ( buf ) ) ) , <nl> + scoped_malloc_t < ser_buffer_t > buf , <nl> + page_cache_t * page_cache ) <nl> + : page_ ( new page_t ( block_size , std : : move ( buf ) , page_cache ) , page_cache ) , <nl> is_deleted_ ( false ) , <nl> last_modifier_ ( NULL ) { <nl> } <nl> current_page_t : : ~ current_page_t ( ) { <nl> } <nl> <nl> void current_page_t : : make_non_deleted ( block_size_t block_size , <nl> - scoped_malloc_t < ser_buffer_t > buf ) { <nl> + scoped_malloc_t < ser_buffer_t > buf , <nl> + page_cache_t * page_cache ) { <nl> rassert ( is_deleted_ ) ; <nl> rassert ( ! page_ . has ( ) ) ; <nl> is_deleted_ = false ; <nl> - page_ . init ( new page_t ( block_size , std : : move ( buf ) ) ) ; <nl> + page_ . init ( new page_t ( block_size , std : : move ( buf ) , page_cache ) , page_cache ) ; <nl> } <nl> <nl> void current_page_t : : add_acquirer ( current_page_acq_t * acq ) { <nl> void current_page_t : : pulse_pulsables ( current_page_acq_t * const acq ) { <nl> / / downgrade itself to readonly and snapshotted for the sake of <nl> / / flushing its version of the page - - and if it deleted the page , <nl> / / this is how it learns . <nl> - cur - > snapshotted_page_ . init ( the_page_for_read_or_deleted ( help ) ) ; <nl> + cur - > snapshotted_page_ . init ( the_page_for_read_or_deleted ( help ) , <nl> + cur - > page_cache ( ) ) ; <nl> cur - > current_page_ = NULL ; <nl> acquirers_ . remove ( cur ) ; <nl> / / RSI : Dedup this with remove_acquirer . <nl> void current_page_t : : pulse_pulsables ( current_page_acq_t * const acq ) { <nl> / / page to a full - sized page . <nl> / / TODO : We should consider whether we really want this behavior . <nl> page_ . init ( new page_t ( help . page_cache - > serializer ( ) - > get_block_size ( ) , <nl> - help . page_cache - > serializer ( ) - > malloc ( ) ) ) ; <nl> + help . page_cache - > serializer ( ) - > malloc ( ) , <nl> + help . page_cache ) , <nl> + help . page_cache ) ; <nl> is_deleted_ = false ; <nl> } <nl> cur - > write_cond_ . pulse_if_not_already_pulsed ( ) ; <nl> void current_page_t : : mark_deleted ( ) { <nl> void current_page_t : : convert_from_serializer_if_necessary ( current_page_help_t help ) { <nl> rassert ( ! is_deleted_ ) ; <nl> if ( ! page_ . has ( ) ) { <nl> - page_ . init ( new page_t ( help . block_id , help . page_cache ) ) ; <nl> + page_ . init ( new page_t ( help . block_id , help . page_cache ) , help . page_cache ) ; <nl> } <nl> } <nl> <nl> page_t : : page_t ( block_id_t block_id , page_cache_t * page_cache ) <nl> : destroy_ptr_ ( NULL ) , <nl> buf_size_ ( block_size_t : : undefined ( ) ) , <nl> snapshot_refcount_ ( 0 ) { <nl> + page_cache - > add_to_unevictable ( this ) ; <nl> coro_t : : spawn_now_dangerously ( std : : bind ( & page_t : : load_with_block_id , <nl> this , <nl> block_id , <nl> page_cache ) ) ; <nl> } <nl> <nl> - page_t : : page_t ( block_size_t block_size , scoped_malloc_t < ser_buffer_t > buf ) <nl> + page_t : : page_t ( block_size_t block_size , scoped_malloc_t < ser_buffer_t > buf , <nl> + page_cache_t * page_cache ) <nl> : destroy_ptr_ ( NULL ) , <nl> buf_size_ ( block_size ) , <nl> buf_ ( std : : move ( buf ) ) , <nl> snapshot_refcount_ ( 0 ) { <nl> rassert ( buf_ . has ( ) ) ; <nl> + page_cache - > add_to_evictable_unbacked ( this ) ; <nl> } <nl> <nl> page_t : : page_t ( page_t * copyee , page_cache_t * page_cache ) <nl> : destroy_ptr_ ( NULL ) , <nl> buf_size_ ( block_size_t : : undefined ( ) ) , <nl> snapshot_refcount_ ( 0 ) { <nl> + page_cache - > add_to_unevictable ( this ) ; <nl> coro_t : : spawn_now_dangerously ( std : : bind ( & page_t : : load_from_copyee , <nl> this , <nl> copyee , <nl> void page_t : : load_from_copyee ( page_t * page , page_t * copyee , <nl> page_cache_t * page_cache ) { <nl> / / This is called using spawn_now_dangerously . We need to atomically set <nl> / / destroy_ptr_ . <nl> - page_ptr_t copyee_ptr ( copyee ) ; <nl> + page_ptr_t copyee_ptr ( copyee , page_cache ) ; <nl> bool page_destroyed = false ; <nl> rassert ( page - > destroy_ptr_ = = NULL ) ; <nl> page - > destroy_ptr_ = & page_destroyed ; <nl> void page_t : : load_from_copyee ( page_t * page , page_t * copyee , <nl> <nl> { <nl> page_acq_t acq ; <nl> - acq . init ( copyee ) ; <nl> + acq . init ( copyee , page_cache ) ; <nl> acq . buf_ready_signal ( ) - > wait ( ) ; <nl> <nl> ASSERT_FINITE_CORO_WAITING ; <nl> void page_t : : load_from_copyee ( page_t * page , page_t * copyee , <nl> page - > buf_ = std : : move ( buf ) ; <nl> page - > destroy_ptr_ = NULL ; <nl> <nl> - page - > pulse_waiters ( ) ; <nl> + page - > pulse_waiters_or_make_evictable ( page_cache ) ; <nl> } <nl> } <nl> } <nl> void page_t : : load_with_block_id ( page_t * page , block_id_t block_id , <nl> page - > buf_ = std : : move ( buf ) ; <nl> page - > block_token_ = std : : move ( block_token ) ; <nl> <nl> - page - > pulse_waiters ( ) ; <nl> + page - > pulse_waiters_or_make_evictable ( page_cache ) ; <nl> } <nl> <nl> void page_t : : add_snapshotter ( ) { <nl> void page_t : : add_snapshotter ( ) { <nl> + + snapshot_refcount_ ; <nl> } <nl> <nl> - void page_t : : remove_snapshotter ( ) { <nl> + void page_t : : remove_snapshotter ( page_cache_t * page_cache ) { <nl> rassert ( snapshot_refcount_ > 0 ) ; <nl> - - snapshot_refcount_ ; <nl> if ( snapshot_refcount_ = = 0 ) { <nl> void page_t : : remove_snapshotter ( ) { <nl> / / load_from_copyee . <nl> rassert ( waiters_ . empty ( ) ) ; <nl> <nl> + page_cache - > remove_page ( this ) ; <nl> / / RSI : Is this what we do ? For now it is . <nl> delete this ; <nl> } <nl> page_t * page_t : : make_copy ( page_cache_t * page_cache ) { <nl> return ret ; <nl> } <nl> <nl> - void page_t : : pulse_waiters ( ) { <nl> - for ( page_acq_t * p = waiters_ . head ( ) ; p ! = NULL ; p = waiters_ . next ( p ) ) { <nl> - / / The waiter ' s not already going to have been pulsed . <nl> - p - > buf_ready_signal_ . pulse ( ) ; <nl> + void page_t : : pulse_waiters_or_make_evictable ( page_cache_t * page_cache ) { <nl> + rassert ( page_cache - > page_is_in_unevictable_bag ( this ) ) ; <nl> + if ( waiters_ . empty ( ) ) { <nl> + page_cache - > move_unevictable_to_evictable ( this ) ; <nl> + } else { <nl> + for ( page_acq_t * p = waiters_ . head ( ) ; p ! = NULL ; p = waiters_ . next ( p ) ) { <nl> + / / The waiter ' s not already going to have been pulsed . <nl> + p - > buf_ready_signal_ . pulse ( ) ; <nl> + } <nl> } <nl> } <nl> <nl> void page_t : : add_waiter ( page_acq_t * acq ) { <nl> + backindex_bag_t < page_t > * old_bag <nl> + = acq - > page_cache ( ) - > correct_eviction_category ( this ) ; <nl> waiters_ . push_back ( acq ) ; <nl> + acq - > page_cache ( ) - > change_eviction_bag ( old_bag , this ) ; <nl> if ( buf_ . has ( ) ) { <nl> acq - > buf_ready_signal_ . pulse ( ) ; <nl> } <nl> void * page_t : : get_page_buf ( ) { <nl> } <nl> <nl> void page_t : : reset_block_token ( ) { <nl> + / / The page is supposed to have its buffer acquired in reset_block_token - - it ' s <nl> + / / the thing modifying the page . We thus assume that the page is unevictable and <nl> + / / resetting block_token_ doesn ' t change that . <nl> + rassert ( ! waiters_ . empty ( ) ) ; <nl> block_token_ . reset ( ) ; <nl> } <nl> <nl> <nl> void page_t : : remove_waiter ( page_acq_t * acq ) { <nl> + backindex_bag_t < page_t > * old_bag <nl> + = acq - > page_cache ( ) - > correct_eviction_category ( this ) ; <nl> waiters_ . remove ( acq ) ; <nl> + acq - > page_cache ( ) - > change_eviction_bag ( old_bag , this ) ; <nl> <nl> / / page_acq_t always has a lesser lifetime than some page_ptr_t . <nl> rassert ( snapshot_refcount_ > 0 ) ; <nl> } <nl> <nl> - page_acq_t : : page_acq_t ( ) : page_ ( NULL ) { <nl> + page_acq_t : : page_acq_t ( ) : page_ ( NULL ) , page_cache_ ( NULL ) { <nl> } <nl> <nl> - void page_acq_t : : init ( page_t * page ) { <nl> + void page_acq_t : : init ( page_t * page , page_cache_t * page_cache ) { <nl> rassert ( page_ = = NULL ) ; <nl> + rassert ( page_cache_ = = NULL ) ; <nl> rassert ( ! buf_ready_signal_ . is_pulsed ( ) ) ; <nl> page_ = page ; <nl> + page_cache_ = page_cache ; <nl> page_ - > add_waiter ( this ) ; <nl> } <nl> <nl> + page_acq_t : : ~ page_acq_t ( ) { <nl> + if ( page_ ! = NULL ) { <nl> + rassert ( page_cache_ ! = NULL ) ; <nl> + page_ - > remove_waiter ( this ) ; <nl> + } <nl> + } <nl> + <nl> bool page_acq_t : : has ( ) const { <nl> return page_ ! = NULL ; <nl> } <nl> const void * page_acq_t : : get_buf_read ( ) { <nl> return page_ - > get_page_buf ( ) ; <nl> } <nl> <nl> - page_acq_t : : ~ page_acq_t ( ) { <nl> - if ( page_ ! = NULL ) { <nl> - page_ - > remove_waiter ( this ) ; <nl> - } <nl> - } <nl> - <nl> free_list_t : : free_list_t ( serializer_t * serializer ) { <nl> on_thread_t th ( serializer - > home_thread ( ) ) ; <nl> <nl> void free_list_t : : release_block_id ( block_id_t block_id ) { <nl> free_ids_ . push_back ( block_id ) ; <nl> } <nl> <nl> - page_ptr_t : : page_ptr_t ( ) : page_ ( NULL ) { <nl> + page_ptr_t : : page_ptr_t ( ) : page_ ( NULL ) , page_cache_ ( NULL ) { <nl> } <nl> <nl> page_ptr_t : : ~ page_ptr_t ( ) { <nl> reset ( ) ; <nl> } <nl> <nl> - page_ptr_t : : page_ptr_t ( page_ptr_t & & movee ) : page_ ( movee . page_ ) { <nl> + page_ptr_t : : page_ptr_t ( page_ptr_t & & movee ) <nl> + : page_ ( movee . page_ ) , page_cache_ ( movee . page_cache_ ) { <nl> movee . page_ = NULL ; <nl> + movee . page_cache_ = NULL ; <nl> } <nl> <nl> page_ptr_t & page_ptr_t : : operator = ( page_ptr_t & & movee ) { <nl> page_ptr_t tmp ( std : : move ( movee ) ) ; <nl> std : : swap ( page_ , tmp . page_ ) ; <nl> + std : : swap ( page_cache_ , tmp . page_cache_ ) ; <nl> return * this ; <nl> } <nl> <nl> - void page_ptr_t : : init ( page_t * page ) { <nl> - rassert ( page_ = = NULL ) ; <nl> + void page_ptr_t : : init ( page_t * page , page_cache_t * page_cache ) { <nl> + rassert ( page_ = = NULL & & page_cache_ = = NULL ) ; <nl> page_ = page ; <nl> + page_cache_ = page_cache ; <nl> + / / RSI : Seriously ? Does anything init with a null page ? <nl> if ( page_ ! = NULL ) { <nl> page_ - > add_snapshotter ( ) ; <nl> } <nl> void page_ptr_t : : init ( page_t * page ) { <nl> void page_ptr_t : : reset ( ) { <nl> if ( page_ ! = NULL ) { <nl> page_t * ptr = page_ ; <nl> + page_cache_t * cache = page_cache_ ; <nl> page_ = NULL ; <nl> - ptr - > remove_snapshotter ( ) ; <nl> + page_cache_ = NULL ; <nl> + ptr - > remove_snapshotter ( cache ) ; <nl> } <nl> } <nl> <nl> page_t * page_ptr_t : : get_page_for_read ( ) { <nl> page_t * page_ptr_t : : get_page_for_write ( page_cache_t * page_cache ) { <nl> rassert ( page_ ! = NULL ) ; <nl> if ( page_ - > num_snapshot_references ( ) > 1 ) { <nl> - page_ptr_t tmp ( page_ - > make_copy ( page_cache ) ) ; <nl> + page_ptr_t tmp ( page_ - > make_copy ( page_cache ) , page_cache ) ; <nl> * this = std : : move ( tmp ) ; <nl> } <nl> return page_ ; <nl> void page_cache_t : : do_flush_txn ( page_cache_t * page_cache , page_txn_t * txn ) { <nl> <nl> rassert ( page - > buf_ . has ( ) ) ; <nl> <nl> + / / RSI : Is there a page_acq_t for this buf we ' re writing ? There had <nl> + / / better be . <nl> write_infos . push_back ( buf_write_info_t ( page - > buf_ . get ( ) , <nl> page - > buf_size_ , <nl> dp - > block_id ) ) ; <nl> void page_cache_t : : im_waiting_for_flush ( page_txn_t * txn ) { <nl> } <nl> } <nl> <nl> + void page_cache_t : : add_to_unevictable ( page_t * page ) { <nl> + unevictable_pages_ . add ( page ) ; <nl> + } <nl> + <nl> + bool page_cache_t : : page_is_in_unevictable_bag ( page_t * page ) const { <nl> + return unevictable_pages_ . has_element ( page ) ; <nl> + } <nl> + <nl> + void page_cache_t : : add_to_evictable_unbacked ( page_t * page ) { <nl> + evictable_unbacked_pages_ . add ( page ) ; <nl> + } <nl> + <nl> + void page_cache_t : : move_unevictable_to_evictable ( page_t * page ) { <nl> + rassert ( unevictable_pages_ . has_element ( page ) ) ; <nl> + unevictable_pages_ . remove ( page ) ; <nl> + backindex_bag_t < page_t > * new_bag = correct_eviction_category ( page ) ; <nl> + rassert ( new_bag = = & evictable_disk_backed_pages_ <nl> + | | new_bag = = & evictable_unbacked_pages_ ) ; <nl> + new_bag - > add ( page ) ; <nl> + } <nl> + <nl> + void page_cache_t : : remove_page ( page_t * page ) { <nl> + rassert ( page - > waiters_ . empty ( ) ) ; <nl> + rassert ( page - > snapshot_refcount_ = = 0 ) ; <nl> + backindex_bag_t < page_t > * bag = correct_eviction_category ( page ) ; <nl> + bag - > remove ( page ) ; <nl> + } <nl> + <nl> + void page_cache_t : : change_eviction_bag ( backindex_bag_t < page_t > * current_bag , <nl> + page_t * page ) { <nl> + rassert ( current_bag - > has_element ( page ) ) ; <nl> + current_bag - > remove ( page ) ; <nl> + backindex_bag_t < page_t > * new_bag = correct_eviction_category ( page ) ; <nl> + new_bag - > add ( page ) ; <nl> + } <nl> + <nl> + backindex_bag_t < page_t > * page_cache_t : : correct_eviction_category ( page_t * page ) { <nl> + if ( page - > destroy_ptr_ ! = NULL | | ! page - > waiters_ . empty ( ) ) { <nl> + return & unevictable_pages_ ; <nl> + } else if ( ! page - > buf_ . has ( ) ) { <nl> + return & evicted_pages_ ; <nl> + } else if ( page - > block_token_ . has ( ) ) { <nl> + return & evictable_disk_backed_pages_ ; <nl> + } else { <nl> + return & evictable_unbacked_pages_ ; <nl> + } <nl> + } <nl> + <nl> <nl> <nl> } / / namespace alt <nl> mmm a / src / buffer_cache / alt / page . hpp <nl> ppp b / src / buffer_cache / alt / page . hpp <nl> <nl> # include < vector > <nl> <nl> # include " concurrency / cond_var . hpp " <nl> + # include " containers / backindex_bag . hpp " <nl> # include " containers / intrusive_list . hpp " <nl> # include " containers / segmented_vector . hpp " <nl> # include " repli_timestamp . hpp " <nl> enum class alt_access_t { read , write } ; <nl> / / in - place , but still a definite known value ) . <nl> class page_t { <nl> public : <nl> - page_t ( block_size_t block_size , scoped_malloc_t < ser_buffer_t > buf ) ; <nl> + page_t ( block_size_t block_size , scoped_malloc_t < ser_buffer_t > buf , <nl> + page_cache_t * page_cache ) ; <nl> page_t ( block_id_t block_id , page_cache_t * page_cache ) ; <nl> page_t ( page_t * copyee , page_cache_t * page_cache ) ; <nl> ~ page_t ( ) ; <nl> class page_t { <nl> <nl> friend class page_ptr_t ; <nl> void add_snapshotter ( ) ; <nl> - void remove_snapshotter ( ) ; <nl> + void remove_snapshotter ( page_cache_t * page_cache ) ; <nl> size_t num_snapshot_references ( ) ; <nl> <nl> <nl> - void pulse_waiters ( ) ; <nl> + void pulse_waiters_or_make_evictable ( page_cache_t * page_cache ) ; <nl> <nl> static void load_with_block_id ( page_t * page , <nl> block_id_t block_id , <nl> class page_t { <nl> <nl> friend class page_cache_t ; <nl> <nl> + static backindex_bag_index_t * eviction_index ( page_t * page ) { <nl> + return & page - > eviction_index_ ; <nl> + } <nl> + <nl> / / One of destroy_ptr_ , buf_ , or block_token_ is non - null . <nl> bool * destroy_ptr_ ; <nl> block_size_t buf_size_ ; <nl> class page_t { <nl> / / are waiters ) expect the value to never be evicted . <nl> / / RSP : This could be a single pointer instead of two . <nl> intrusive_list_t < page_acq_t > waiters_ ; <nl> + <nl> + / / This page_t ' s index into its eviction bag ( managed by the page_cache_t - - one <nl> + / / of unevictable_pages_ , etc ) . Which bag we should be in : <nl> + / / <nl> + / / if destroy_ptr_ is non - null : unevictable_pages_ <nl> + / / else if waiters_ is non - empty : unevictable_pages_ <nl> + / / else if buf_ is null : evicted_pages_ ( and block_token_ is non - null ) <nl> + / / else if block_token_ is non - null : evictable_disk_backed_pages_ <nl> + / / else : evictable_unbacked_pages_ ( buf_ is non - null , block_token_ is null ) <nl> + / / <nl> + / / So , when destroy_ptr_ , waiters_ , buf_ , or block_token_ is touched , we might <nl> + / / need to change this page ' s eviction bag . <nl> + / / <nl> + / / The logic above is implemented in page_cache_t : : appropriate_eviction_bag . <nl> + backindex_bag_index_t eviction_index_ ; <nl> + <nl> DISABLE_COPYING ( page_t ) ; <nl> } ; <nl> <nl> / / A page_ptr_t holds a pointer to a page_t . <nl> class page_ptr_t { <nl> public : <nl> - explicit page_ptr_t ( page_t * page ) : page_ ( NULL ) { init ( page ) ; } <nl> + explicit page_ptr_t ( page_t * page , page_cache_t * page_cache ) <nl> + : page_ ( NULL ) , page_cache_ ( NULL ) { init ( page , page_cache ) ; } <nl> page_ptr_t ( ) ; <nl> + <nl> + / / The page must be reset ( . . . ) before it is destroyed . <nl> ~ page_ptr_t ( ) ; <nl> + <nl> page_ptr_t ( page_ptr_t & & movee ) ; <nl> page_ptr_t & operator = ( page_ptr_t & & movee ) ; <nl> - void init ( page_t * page ) ; <nl> + void init ( page_t * page , page_cache_t * page_cache ) ; <nl> <nl> page_t * get_page_for_read ( ) ; <nl> page_t * get_page_for_write ( page_cache_t * page_cache ) ; <nl> class page_ptr_t { <nl> <nl> private : <nl> page_t * page_ ; <nl> + / / RSI : Get rid of this variable . <nl> + page_cache_t * page_cache_ ; <nl> DISABLE_COPYING ( page_ptr_t ) ; <nl> } ; <nl> <nl> class page_acq_t : public intrusive_list_node_t < page_acq_t > { <nl> <nl> / / RSI : This doesn ' t actually try to make the page loaded , if it ' s not already <nl> / / loaded . <nl> - void init ( page_t * page ) ; <nl> + void init ( page_t * page , page_cache_t * page_cache ) ; <nl> + <nl> + page_cache_t * page_cache ( ) const { <nl> + rassert ( page_cache_ ! = NULL ) ; <nl> + return page_cache_ ; <nl> + } <nl> <nl> signal_t * buf_ready_signal ( ) ; <nl> bool has ( ) const ; <nl> class page_acq_t : public intrusive_list_node_t < page_acq_t > { <nl> friend class page_t ; <nl> <nl> page_t * page_ ; <nl> + page_cache_t * page_cache_ ; <nl> cond_t buf_ready_signal_ ; <nl> DISABLE_COPYING ( page_acq_t ) ; <nl> } ; <nl> struct current_page_help_t ; <nl> class current_page_t { <nl> public : <nl> / / Constructs a fresh , empty page . <nl> - current_page_t ( block_size_t block_size , scoped_malloc_t < ser_buffer_t > buf ) ; <nl> + current_page_t ( block_size_t block_size , scoped_malloc_t < ser_buffer_t > buf , <nl> + page_cache_t * page_cache ) ; <nl> / / Constructs a page to be loaded from the serializer . <nl> current_page_t ( ) ; <nl> ~ current_page_t ( ) ; <nl> class current_page_t { <nl> friend class page_cache_t ; <nl> <nl> void make_non_deleted ( block_size_t block_size , <nl> - scoped_malloc_t < ser_buffer_t > buf ) ; <nl> + scoped_malloc_t < ser_buffer_t > buf , <nl> + page_cache_t * page_cache ) ; <nl> <nl> / / page_ can be null if we haven ' t tried loading the page yet . We don ' t want to <nl> / / prematurely bother loading the page if it ' s going to be deleted . <nl> class page_cache_t { <nl> current_page_t * page_for_block_id ( block_id_t block_id ) ; <nl> current_page_t * page_for_new_block_id ( block_id_t * block_id_out ) ; <nl> <nl> + / / Returns how much memory is being used by all the pages in the cache at this <nl> + / / moment in time . <nl> + size_t total_page_memory ( ) const ; <nl> + size_t evictable_page_memory ( ) const ; <nl> + <nl> private : <nl> friend class page_t ; <nl> + void add_to_unevictable ( page_t * page ) ; <nl> + void add_to_evictable_unbacked ( page_t * page ) ; <nl> + bool page_is_in_unevictable_bag ( page_t * page ) const ; <nl> + void move_unevictable_to_evictable ( page_t * page ) ; <nl> + void change_eviction_bag ( backindex_bag_t < page_t > * current_bag , page_t * page ) ; <nl> + backindex_bag_t < page_t > * correct_eviction_category ( page_t * page ) ; <nl> + void remove_page ( page_t * page ) ; <nl> + <nl> friend class page_txn_t ; <nl> static void do_flush_txn ( page_cache_t * page_cache , page_txn_t * txn ) ; <nl> void im_waiting_for_flush ( page_txn_t * txn ) ; <nl> class page_cache_t { <nl> / / RSP : Array growth slow . <nl> std : : vector < current_page_t * > current_pages_ ; <nl> <nl> + / / These track whether a page ' s eviction status . <nl> + / / RSI : Does anybody use evicted_pages_ ? <nl> + backindex_bag_t < page_t > unevictable_pages_ ; <nl> + backindex_bag_t < page_t > evictable_disk_backed_pages_ ; <nl> + backindex_bag_t < page_t > evictable_unbacked_pages_ ; <nl> + backindex_bag_t < page_t > evicted_pages_ ; <nl> + <nl> free_list_t free_list_ ; <nl> <nl> scoped_ptr_t < auto_drainer_t > drainer_ ; <nl> new file mode 100644 <nl> index 00000000000 . . dbe7087d61f <nl> mmm / dev / null <nl> ppp b / src / containers / backindex_bag . hpp <nl> <nl> + # ifndef CONTAINERS_BACKINDEX_BAG_HPP_ <nl> + # define CONTAINERS_BACKINDEX_BAG_HPP_ <nl> + <nl> + # ifndef __STDC_LIMIT_MACROS <nl> + # define __STDC_LIMIT_MACROS <nl> + # endif <nl> + <nl> + # include < stdint . h > <nl> + <nl> + # include " containers / segmented_vector . hpp " <nl> + <nl> + class backindex_bag_index_t { <nl> + public : <nl> + backindex_bag_index_t ( ) : index_ ( SIZE_MAX ) { } <nl> + <nl> + ~ backindex_bag_index_t ( ) { <nl> + guarantee ( index_ = = SIZE_MAX ) ; <nl> + } <nl> + <nl> + private : <nl> + template < class T > <nl> + friend class backindex_bag_t ; <nl> + <nl> + backindex_bag_index_t ( size_t index ) : index_ ( index ) { } <nl> + <nl> + / / The item ' s index into a ( specific ) backindex_bag_t , or SIZE_MAX if it doesn ' t <nl> + / / belong to the backindex_bag_t . <nl> + size_t index_ ; <nl> + DISABLE_COPYING ( backindex_bag_index_t ) ; <nl> + } ; <nl> + <nl> + / / A bag of elements that it _does not own_ . <nl> + template < class T > <nl> + class backindex_bag_t { <nl> + public : <nl> + typedef backindex_bag_index_t * ( * backindex_bag_index_accessor_t ) ( T * ) ; <nl> + <nl> + explicit backindex_bag_t ( backindex_bag_index_accessor_t accessor ) <nl> + : accessor_ ( accessor ) { } <nl> + <nl> + / / Retruns true if the potential element of this container is in fact an element <nl> + / / of this container . The idea behind this function is that some value of type T <nl> + / / could be a member of one of several backindex_bag_t ' s ( or none ) . We see if <nl> + / / it ' s a memory of this one . <nl> + bool has_element ( T * potential_element ) const { <nl> + const backindex_bag_index_t * const backindex = accessor_ ( potential_element ) ; <nl> + return backindex - > index_ < vector_ . size ( ) <nl> + & & vector_ [ backindex - > index_ ] = = potential_element ; <nl> + } <nl> + <nl> + / / Removes the element from the bag . <nl> + void remove ( T * element ) { <nl> + backindex_bag_index_t * const backindex = accessor_ ( element ) ; <nl> + rassert ( backindex - > index_ ! = SIZE_MAX ) ; <nl> + guarantee ( backindex - > index_ < vector_ . size ( ) ) ; <nl> + <nl> + const size_t index = backindex - > index_ ; <nl> + <nl> + / / Move the element in the last position to the removed element ' s position . <nl> + / / The code here feels weird when back_element = = element ( i . e . when <nl> + / / backindex - > index_ = = back_element_backindex - > index_ ) but it works ( I <nl> + / / hope ) . <nl> + T * const back_element = vector_ . back ( ) ; <nl> + backindex_bag_index_t * const back_element_backindex = accessor_ ( back_element ) ; <nl> + <nl> + rassert ( back_element_backindex - > index_ = = vector_ . size ( ) - 1 ) ; <nl> + <nl> + back_element_backindex - > index_ = index ; <nl> + vector_ [ index ] = back_element ; <nl> + <nl> + vector_ . pop_back ( ) ; <nl> + <nl> + backindex - > index_ = SIZE_MAX ; <nl> + } <nl> + <nl> + / / Adds the element to the bag . <nl> + void add ( T * element ) { <nl> + backindex_bag_index_t * const backindex = accessor_ ( element ) ; <nl> + guarantee ( backindex - > index_ = = SIZE_MAX ) ; <nl> + <nl> + backindex - > index_ = vector_ . size ( ) ; <nl> + vector_ . push_back ( element ) ; <nl> + } <nl> + <nl> + size_t size ( ) const { <nl> + return vector_ . size ( ) ; <nl> + } <nl> + <nl> + T * access_random ( size_t index ) const { <nl> + rassert ( index ! = SIZE_MAX ) ; <nl> + guarantee ( index < vector_ . size ( ) ) ; <nl> + return vector_ [ index ] ; <nl> + } <nl> + <nl> + private : <nl> + const backindex_bag_index_accessor_t accessor_ ; <nl> + <nl> + segmented_vector_t < T * > vector_ ; <nl> + <nl> + DISABLE_COPYING ( backindex_bag_t ) ; <nl> + } ; <nl> + <nl> + <nl> + <nl> + <nl> + # endif / / CONTAINERS_BACKINDEX_BAG_HPP_ <nl> mmm a / src / containers / counted . hpp <nl> ppp b / src / containers / counted . hpp <nl> inline intptr_t counted_use_count ( const slow_atomic_countable_t < T > * p ) { <nl> template < class T > <nl> class movable_t { <nl> public : <nl> - movable_t ( const counted_t < T > & copyee ) : ptr_ ( copyee ) { } <nl> + explicit movable_t ( const counted_t < T > & copyee ) : ptr_ ( copyee ) { } <nl> movable_t ( movable_t & & movee ) : ptr_ ( std : : move ( movee . ptr_ ) ) { } <nl> movable_t & operator = ( movable_t & & movee ) { <nl> ptr_ = std : : move ( movee . ptr_ ) ; <nl> mmm a / src / containers / segmented_vector . hpp <nl> ppp b / src / containers / segmented_vector . hpp <nl> <nl> <nl> template < class element_t , size_t ELEMENTS_PER_SEGMENT = ( 1 < < 14 ) > <nl> class segmented_vector_t { <nl> - private : <nl> - struct segment_t { <nl> - element_t elements [ ELEMENTS_PER_SEGMENT ] ; <nl> - } ; <nl> - <nl> - std : : vector < segment_t * > segments_ ; <nl> - size_t size_ ; <nl> - <nl> public : <nl> explicit segmented_vector_t ( size_t size = 0 ) : size_ ( 0 ) { <nl> set_size ( size ) ; <nl> class segmented_vector_t { <nl> set_size ( 0 ) ; <nl> } <nl> <nl> - public : <nl> size_t size ( ) const { <nl> return size_ ; <nl> } <nl> class segmented_vector_t { <nl> } <nl> <nl> element_t & operator [ ] ( size_t index ) { <nl> - guarantee ( index < size_ , " index = % zu , size_ = % zu " , index , size_ ) ; <nl> - segment_t * seg = segments_ [ index / ELEMENTS_PER_SEGMENT ] ; <nl> - return seg - > elements [ index % ELEMENTS_PER_SEGMENT ] ; <nl> + return get_element ( index ) ; <nl> + } <nl> + <nl> + const element_t & operator [ ] ( size_t index ) const { <nl> + return get_element ( index ) ; <nl> } <nl> <nl> void push_back ( const element_t & element ) { <nl> class segmented_vector_t { <nl> } <nl> <nl> private : <nl> + / / Gets a non - const element with a const function . . . which breaks the guarantees <nl> + / / but compiles and lets this be called by both the const and non - const versions <nl> + / / of operator [ ] . <nl> + element_t & get_element ( size_t index ) const { <nl> + guarantee ( index < size_ , " index = % zu , size_ = % zu " , index , size_ ) ; <nl> + segment_t * seg = segments_ [ index / ELEMENTS_PER_SEGMENT ] ; <nl> + return seg - > elements [ index % ELEMENTS_PER_SEGMENT ] ; <nl> + } <nl> + <nl> / / Note : sometimes elements will be initialized before you ask the <nl> / / array to grow to that size ( e . g . one hundred elements might be <nl> / / initialized even though the array might be of size 1 ) . <nl> class segmented_vector_t { <nl> size_ = new_size ; <nl> } <nl> <nl> + struct segment_t { <nl> + element_t elements [ ELEMENTS_PER_SEGMENT ] ; <nl> + } ; <nl> + <nl> + std : : vector < segment_t * > segments_ ; <nl> + size_t size_ ; <nl> + <nl> DISABLE_COPYING ( segmented_vector_t ) ; <nl> } ; <nl> <nl> mmm a / src / unittest / page_test . cc <nl> ppp b / src / unittest / page_test . cc <nl> void run_OneWriteAcqWait ( ) { <nl> current_page_acq_t acq ( & txn , alt_access_t : : write ) ; <nl> page_acq_t page_acq ; <nl> page_t * page = acq . current_page_for_write ( ) ; <nl> - page_acq . init ( page ) ; <nl> + page_acq . init ( page , & page_cache ) ; <nl> ASSERT_TRUE ( page_acq . buf_ready_signal ( ) - > is_pulsed ( ) ) ; <nl> void * buf = page_acq . get_buf_write ( ) ; <nl> ASSERT_TRUE ( buf ! = NULL ) ; <nl> class bigger_test_t { <nl> <nl> void make_empty ( const scoped_ptr_t < current_page_acq_t > & acq ) { <nl> page_acq_t page_acq ; <nl> - page_acq . init ( acq - > current_page_for_write ( ) ) ; <nl> + page_acq . init ( acq - > current_page_for_write ( ) , & c ) ; <nl> const uint32_t n = page_acq . get_buf_size ( ) ; <nl> ASSERT_EQ ( 4080u , n ) ; <nl> memset ( page_acq . get_buf_write ( ) , 0 , n ) ; <nl> class bigger_test_t { <nl> void check_value ( const scoped_ptr_t < current_page_acq_t > & acq , <nl> const std : : string & expected ) { <nl> page_acq_t page_acq ; <nl> - page_acq . init ( acq - > current_page_for_read ( ) ) ; <nl> + page_acq . init ( acq - > current_page_for_read ( ) , & c ) ; <nl> check_page_acq ( & page_acq , expected ) ; <nl> } <nl> <nl> class bigger_test_t { <nl> { <nl> page_acq_t page_acq ; <nl> page_t * page_for_write = acq - > current_page_for_write ( ) ; <nl> - page_acq . init ( page_for_write ) ; <nl> + page_acq . init ( page_for_write , & c ) ; <nl> check_page_acq ( & page_acq , expected ) ; <nl> <nl> char * const p = static_cast < char * > ( page_acq . get_buf_write ( ) ) ; <nl> | Made proper eviction tracking in page_t and page_cache_t using backindex_bag_t . | rethinkdb/rethinkdb | 437720d0584aa81c46336f7ba7396eda034385f0 | 2013-10-30T12:14:45Z |
mmm a / 3rdParty / curl / curl - 7 . 50 . 3 / lib / hostip . c <nl> ppp b / 3rdParty / curl / curl - 7 . 50 . 3 / lib / hostip . c <nl> int Curl_resolv_timeout ( struct connectdata * conn , <nl> / * USE_ALARM_TIMEOUT defined , but no timeout actually requested * / <nl> return Curl_resolv ( conn , hostname , port , entry ) ; <nl> <nl> - if ( timeout < 1000 ) <nl> + if ( timeout < 1000 ) { <nl> / * The alarm ( ) function only provides integer second resolution , so if <nl> we want to wait less than one second we must bail out already now . * / <nl> + failf ( data , <nl> + " remaining timeout of % ld too small to resolve via SIGALRM method " , <nl> + timeout ) ; <nl> return CURLRESOLV_TIMEDOUT ; <nl> - <nl> + } <nl> / * This allows us to time - out from the name resolver , as the timeout <nl> will generate a signal and we will siglongjmp ( ) from that here . <nl> This technique has problems ( see alarmfunc ) . <nl> | In case of timeout in curl report an error message . | arangodb/arangodb | b9af20e15d3dcbaa1a71d18c50fd69fd7e1e8665 | 2016-10-21T10:24:22Z |
mmm a / src / network / Timer . c <nl> ppp b / src / network / Timer . c <nl> swTimer_node * swTimer_add ( swTimer * timer , int _msec , int interval , void * data ) <nl> if ( timer - > _next_msec > _msec ) <nl> { <nl> timer - > set ( timer , _msec ) ; <nl> + timer - > _next_msec = _msec ; <nl> } <nl> <nl> tnode - > id = timer - > _next_id + + ; <nl> | fixed swoole_timer next_timer invalid . | swoole/swoole-src | 316d19252d48c12d93e209cbab3d45e743da5d68 | 2016-06-30T06:39:01Z |
mmm a / include / swift / SIL / SILCoverageMap . h <nl> ppp b / include / swift / SIL / SILCoverageMap . h <nl> <nl> # include " swift / SIL / SILAllocated . h " <nl> # include " swift / SIL / SILFunction . h " <nl> # include " swift / SIL / SILPrintContext . h " <nl> - # include " llvm / ADT / ilist . h " <nl> # include " llvm / ADT / ilist_node . h " <nl> + # include " llvm / ADT / ilist . h " <nl> # include " llvm / ProfileData / Coverage / CoverageMapping . h " <nl> <nl> namespace llvm { <nl> namespace coverage { <nl> struct CounterExpression ; <nl> struct Counter ; <nl> - } / / namespace coverage <nl> - } / / namespace llvm <nl> + } <nl> + } <nl> <nl> namespace swift { <nl> <nl> class SILCoverageMap : public llvm : : ilist_node < SILCoverageMap > , <nl> void dump ( ) const ; <nl> } ; <nl> <nl> - } / / namespace swift <nl> + } / / end swift namespace <nl> <nl> namespace llvm { <nl> <nl> namespace llvm { <nl> / / = = = mmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmm - = = = / / <nl> <nl> template < > <nl> - struct ilist_traits < : : swift : : SILCoverageMap > <nl> - : public ilist_default_traits < : : swift : : SILCoverageMap > { <nl> + struct ilist_traits < : : swift : : SILCoverageMap > : <nl> + public ilist_default_traits < : : swift : : SILCoverageMap > { <nl> typedef : : swift : : SILCoverageMap SILCoverageMap ; <nl> <nl> public : <nl> struct ilist_traits < : : swift : : SILCoverageMap > <nl> void createNode ( const SILCoverageMap & ) ; <nl> } ; <nl> <nl> - } / / namespace llvm <nl> + } / / end llvm namespace <nl> <nl> # endif / / SWIFT_SIL_SILCOVERAGEMAP_H <nl> mmm a / include / swift / SIL / SILModule . h <nl> ppp b / include / swift / SIL / SILModule . h <nl> class SILModule { <nl> using coverage_map_const_iterator = CoverageMapListType : : const_iterator ; <nl> CoverageMapListType & getCoverageMapList ( ) { return coverageMaps ; } <nl> const CoverageMapListType & getCoverageMapList ( ) const { return coverageMaps ; } <nl> + coverage_map_iterator coverage_map_begin ( ) { return coverageMaps . begin ( ) ; } <nl> + coverage_map_iterator coverage_map_end ( ) { return coverageMaps . end ( ) ; } <nl> + coverage_map_const_iterator coverage_map_begin ( ) const { <nl> + return coverageMaps . begin ( ) ; <nl> + } <nl> + coverage_map_const_iterator coverage_map_end ( ) const { <nl> + return coverageMaps . end ( ) ; <nl> + } <nl> + iterator_range < coverage_map_iterator > getCoverageMaps ( ) { <nl> + return { coverageMaps . begin ( ) , coverageMaps . end ( ) } ; <nl> + } <nl> + iterator_range < coverage_map_const_iterator > getCoverageMaps ( ) const { <nl> + return { coverageMaps . begin ( ) , coverageMaps . end ( ) } ; <nl> + } <nl> <nl> llvm : : yaml : : Output * getOptRecordStream ( ) { return OptRecordStream . get ( ) ; } <nl> void setOptRecordStream ( std : : unique_ptr < llvm : : yaml : : Output > & & Stream , <nl> mmm a / include / swift / SIL / SILProfiler . h <nl> ppp b / include / swift / SIL / SILProfiler . h <nl> <nl> # include " swift / AST / Stmt . h " <nl> # include " swift / Basic / ProfileCounter . h " <nl> # include " swift / SIL / FormalLinkage . h " <nl> - # include " swift / SIL / SILAllocated . h " <nl> # include " llvm / ADT / DenseMap . h " <nl> <nl> namespace swift { <nl> class SILProfiler : public SILAllocated < SILProfiler > { <nl> <nl> std : : string PGOFuncName ; <nl> <nl> - uint64_t PGOFuncHash = 0 ; <nl> + uint64_t FunctionHash = 0 ; <nl> <nl> unsigned NumRegionCounters = 0 ; <nl> <nl> llvm : : DenseMap < ASTNode , unsigned > RegionCounterMap ; <nl> <nl> - llvm : : DenseMap < ASTNode , ProfileCounter > RegionLoadedCounterMap ; <nl> + llvm : : DenseMap < ASTNode , ProfileCounter > PGORegionLoadedCounterMap ; <nl> <nl> - llvm : : DenseMap < ASTNode , ASTNode > RegionCondToParentMap ; <nl> + llvm : : DenseMap < ASTNode , ASTNode > PGORegionCondToParentMap ; <nl> <nl> std : : vector < std : : tuple < std : : string , uint64_t , std : : string > > CoverageData ; <nl> <nl> class SILProfiler : public SILAllocated < SILProfiler > { <nl> StringRef getPGOFuncName ( ) const { return PGOFuncName ; } <nl> <nl> / / / Get the function hash . <nl> - uint64_t getPGOFuncHash ( ) const { return PGOFuncHash ; } <nl> + uint64_t getPGOFuncHash ( ) const { return FunctionHash ; } <nl> <nl> / / / Get the number of region counters . <nl> unsigned getNumRegionCounters ( ) const { return NumRegionCounters ; } <nl> mmm a / lib / SIL / SILProfiler . cpp <nl> ppp b / lib / SIL / SILProfiler . cpp <nl> <nl> / / <nl> / / = = = mmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmm - = = = / / <nl> <nl> - # include " swift / SIL / SILProfiler . h " <nl> # include " swift / AST / ASTWalker . h " <nl> # include " swift / AST / Decl . h " <nl> # include " swift / Parse / Lexer . h " <nl> # include " swift / SIL / SILModule . h " <nl> + # include " swift / SIL / SILProfiler . h " <nl> # include " llvm / IR / GlobalValue . h " <nl> # include " llvm / IR / Intrinsics . h " <nl> # include " llvm / ProfileData / Coverage / CoverageMapping . h " <nl> static void walkFunctionForProfiling ( AbstractFunctionDecl * Root , <nl> <nl> / / We treat class initializers as part of the constructor for profiling . <nl> if ( auto * CD = dyn_cast < ConstructorDecl > ( Root ) ) { <nl> - auto * NominalType = <nl> - CD - > getDeclContext ( ) - > getAsNominalTypeOrNominalTypeExtensionContext ( ) ; <nl> + auto * NominalType = CD - > getDeclContext ( ) <nl> + - > getAsNominalTypeOrNominalTypeExtensionContext ( ) ; <nl> for ( auto * Member : NominalType - > getMembers ( ) ) { <nl> / / Find pattern binding declarations that have initializers . <nl> if ( auto * PBD = dyn_cast < PatternBindingDecl > ( Member ) ) <nl> class CounterExpr { <nl> assert ( K = = Kind : : Node & & " only valid for Node " ) ; <nl> } <nl> <nl> - CounterExpr ( Kind K , const CounterExpr & LHS ) : K ( K ) , LHS ( & LHS ) { <nl> + CounterExpr ( Kind K , const CounterExpr & LHS ) <nl> + : K ( K ) , LHS ( & LHS ) { <nl> assert ( ( K = = Kind : : Ref ) & & " only valid for Ref " ) ; <nl> } <nl> <nl> struct PGOMapping : public ASTWalker { <nl> <nl> PGOMapping ( llvm : : DenseMap < ASTNode , ProfileCounter > & LoadedCounterMap , <nl> llvm : : Expected < llvm : : InstrProfRecord > & LoadedCounts , <nl> - llvm : : DenseMap < ASTNode , ASTNode > & RegionCondToParentMap ) <nl> + llvm : : DenseMap < ASTNode , ASTNode > & PGORegionCondToParentMap ) <nl> : NextCounter ( 0 ) , LoadedCounterMap ( LoadedCounterMap ) , <nl> - LoadedCounts ( LoadedCounts ) , CondToParentMap ( RegionCondToParentMap ) { } <nl> + LoadedCounts ( LoadedCounts ) , CondToParentMap ( PGORegionCondToParentMap ) { } <nl> <nl> unsigned getParentCounter ( ) const { <nl> if ( Parent . isNull ( ) ) <nl> struct CoverageMapping : public ASTWalker { <nl> if ( ControlFlowAdjust ) <nl> Count = & createCounter ( CounterExpr : : Sub ( * Count , * ControlFlowAdjust ) ) ; <nl> <nl> + / / RegionStack . emplace_back ( ASTNode ( ) , * Count , getEndLoc ( Scope ) , None ) ; <nl> RegionStack . emplace_back ( ASTNode ( ) , * Count , getEndLoc ( Scope ) , None ) ; <nl> } <nl> <nl> struct CoverageMapping : public ASTWalker { <nl> <nl> } else if ( auto * RWS = dyn_cast < RepeatWhileStmt > ( S ) ) { <nl> assert ( RepeatWhileStack . back ( ) = = RWS & & " Malformed repeat - while stack " ) ; <nl> - ( void ) RWS ; <nl> + ( void ) RWS ; <nl> RepeatWhileStack . pop_back ( ) ; <nl> <nl> } else if ( auto * CS = dyn_cast < ContinueStmt > ( S ) ) { <nl> struct CoverageMapping : public ASTWalker { <nl> <nl> return E ; <nl> } <nl> + <nl> } ; <nl> <nl> } / / end anonymous namespace <nl> void SILProfiler : : assignRegionCounters ( ) { <nl> <nl> NumRegionCounters = Mapper . NextCounter ; <nl> / / TODO : Mapper needs to calculate a function hash as it goes . <nl> - PGOFuncHash = 0x0 ; <nl> + FunctionHash = 0x0 ; <nl> <nl> if ( EmitCoverageMapping ) { <nl> CoverageMapping Coverage ( SM ) ; <nl> void SILProfiler : : assignRegionCounters ( ) { <nl> M , CurrentFuncName , <nl> ! llvm : : GlobalValue : : isLocalLinkage ( <nl> getEquivalentPGOLinkage ( CurrentFuncLinkage ) ) , <nl> - PGOFuncHash , RegionCounterMap , CurrentFileName ) ; <nl> + FunctionHash , RegionCounterMap , CurrentFileName ) ; <nl> } <nl> <nl> if ( llvm : : IndexedInstrProfReader * IPR = M . getPGOReader ( ) ) { <nl> - auto LoadedCounts = IPR - > getInstrProfRecord ( PGOFuncName , PGOFuncHash ) ; <nl> + auto LoadedCounts = IPR - > getInstrProfRecord ( PGOFuncName , FunctionHash ) ; <nl> if ( auto E = LoadedCounts . takeError ( ) ) { <nl> llvm : : handleAllErrors ( std : : move ( E ) , [ ] ( const llvm : : InstrProfError & Err ) { <nl> Err . log ( llvm : : dbgs ( ) ) ; <nl> void SILProfiler : : assignRegionCounters ( ) { <nl> llvm : : dbgs ( ) < < PGOFuncName < < " \ n " ; <nl> return ; <nl> } <nl> - PGOMapping pgoMapper ( RegionLoadedCounterMap , LoadedCounts , <nl> - RegionCondToParentMap ) ; <nl> + PGOMapping pgoMapper ( PGORegionLoadedCounterMap , LoadedCounts , <nl> + PGORegionCondToParentMap ) ; <nl> walkForProfiling ( Root , pgoMapper ) ; <nl> } <nl> } <nl> ProfileCounter SILProfiler : : getExecutionCount ( ASTNode Node ) { <nl> if ( ! Node | | ! M . getPGOReader ( ) | | ! hasRegionCounters ( ) ) { <nl> return ProfileCounter ( ) ; <nl> } <nl> - auto it = RegionLoadedCounterMap . find ( Node ) ; <nl> - if ( it = = RegionLoadedCounterMap . end ( ) ) { <nl> + auto it = PGORegionLoadedCounterMap . find ( Node ) ; <nl> + if ( it = = PGORegionLoadedCounterMap . end ( ) ) { <nl> return ProfileCounter ( ) ; <nl> } <nl> return it - > getSecond ( ) ; <nl> Optional < ASTNode > SILProfiler : : getPGOParent ( ASTNode Node ) { <nl> if ( ! Node | | ! M . getPGOReader ( ) | | ! hasRegionCounters ( ) ) { <nl> return None ; <nl> } <nl> - auto it = RegionCondToParentMap . find ( Node ) ; <nl> - if ( it = = RegionCondToParentMap . end ( ) ) { <nl> + auto it = PGORegionCondToParentMap . find ( Node ) ; <nl> + if ( it = = PGORegionCondToParentMap . end ( ) ) { <nl> return None ; <nl> } <nl> return it - > getSecond ( ) ; <nl> | Merge pull request from apple / revert - 13705 - master | apple/swift | 78d993a4df134ab78555b5d01d6e3a4a40afb394 | 2018-01-04T05:57:36Z |
mmm a / src / isolate . cc <nl> ppp b / src / isolate . cc <nl> void Isolate : : PushStackTraceAndDie ( unsigned int magic , void * ptr1 , void * ptr2 , <nl> base : : OS : : Abort ( ) ; <nl> } <nl> <nl> - <nl> - / / Determines whether the given stack frame should be displayed in <nl> - / / a stack trace . The caller is the error constructor that asked <nl> - / / for the stack trace to be collected . The first time a construct <nl> - / / call to this function is encountered it is skipped . The seen_caller <nl> - / / in / out parameter is used to remember if the caller has been seen <nl> - / / yet . <nl> - static bool IsVisibleInStackTrace ( JSFunction * fun , <nl> - Object * caller , <nl> - bool * seen_caller ) { <nl> - if ( ( fun = = caller ) & & ! ( * seen_caller ) ) { <nl> - * seen_caller = true ; <nl> - return false ; <nl> - } <nl> - / / Skip all frames until we ' ve seen the caller . <nl> - if ( ! ( * seen_caller ) ) return false ; <nl> - / / Functions defined in native scripts are not visible unless directly <nl> - / / exposed , in which case the native flag is set . <nl> - / / The - - builtins - in - stack - traces command line flag allows including <nl> - / / internal call sites in the stack trace for debugging purposes . <nl> - if ( ! FLAG_builtins_in_stack_traces & & fun - > shared ( ) - > IsBuiltin ( ) ) { <nl> - return fun - > shared ( ) - > native ( ) ; <nl> - } <nl> - return true ; <nl> - } <nl> - <nl> static Handle < FixedArray > MaybeGrow ( Isolate * isolate , <nl> Handle < FixedArray > elements , <nl> int cur_position , int new_size ) { <nl> static Handle < FixedArray > MaybeGrow ( Isolate * isolate , <nl> return elements ; <nl> } <nl> <nl> + class StackTraceHelper { <nl> + public : <nl> + StackTraceHelper ( Isolate * isolate , Handle < Object > caller ) <nl> + : isolate_ ( isolate ) , caller_ ( caller ) { <nl> + / / If the caller parameter is a function we skip frames until we ' re <nl> + / / under it before starting to collect . <nl> + seen_caller_ = ! caller - > IsJSFunction ( ) ; <nl> + encountered_strict_function_ = false ; <nl> + sloppy_frames_ = 0 ; <nl> + } <nl> + <nl> + / / The stack trace API should not expose receivers and function <nl> + / / objects on frames deeper than the top - most one with a strict mode <nl> + / / function . The number of sloppy frames is stored as first element in <nl> + / / the result array . <nl> + void CountSloppyFrames ( JSFunction * fun ) { <nl> + if ( ! encountered_strict_function_ ) { <nl> + if ( is_strict ( fun - > shared ( ) - > language_mode ( ) ) ) { <nl> + encountered_strict_function_ = true ; <nl> + } else { <nl> + sloppy_frames_ + + ; <nl> + } <nl> + } <nl> + } <nl> + <nl> + / / Determines whether the given stack frame should be displayed in a stack <nl> + / / trace . <nl> + bool IsVisibleInStackTrace ( JSFunction * fun ) { <nl> + return IsAfterCaller ( fun ) & & IsNotInNativeScript ( fun ) & & <nl> + IsInSameSecurityContext ( fun ) ; <nl> + } <nl> + <nl> + int sloppy_frames ( ) const { return sloppy_frames_ ; } <nl> + <nl> + private : <nl> + / / The caller is the error constructor that asked <nl> + / / for the stack trace to be collected . The first time a construct <nl> + / / call to this function is encountered it is skipped . The seen_caller <nl> + / / in / out parameter is used to remember if the caller has been seen <nl> + / / yet . <nl> + bool IsAfterCaller ( JSFunction * fun ) { <nl> + if ( ( fun = = * caller_ ) & & ! ( seen_caller_ ) ) { <nl> + seen_caller_ = true ; <nl> + return false ; <nl> + } <nl> + / / Skip all frames until we ' ve seen the caller . <nl> + if ( ! seen_caller_ ) return false ; <nl> + return true ; <nl> + } <nl> + <nl> + bool IsNotInNativeScript ( JSFunction * fun ) { <nl> + / / Functions defined in native scripts are not visible unless directly <nl> + / / exposed , in which case the native flag is set . <nl> + / / The - - builtins - in - stack - traces command line flag allows including <nl> + / / internal call sites in the stack trace for debugging purposes . <nl> + if ( ! FLAG_builtins_in_stack_traces & & fun - > shared ( ) - > IsBuiltin ( ) ) { <nl> + return fun - > shared ( ) - > native ( ) ; <nl> + } <nl> + return true ; <nl> + } <nl> + <nl> + bool IsInSameSecurityContext ( JSFunction * fun ) { <nl> + return isolate_ - > context ( ) - > HasSameSecurityTokenAs ( fun - > context ( ) ) ; <nl> + } <nl> + <nl> + Isolate * isolate_ ; <nl> + Handle < Object > caller_ ; <nl> + <nl> + bool seen_caller_ ; <nl> + int sloppy_frames_ ; <nl> + bool encountered_strict_function_ ; <nl> + } ; <nl> + <nl> Handle < Object > Isolate : : CaptureSimpleStackTrace ( Handle < JSReceiver > error_object , <nl> Handle < Object > caller ) { <nl> / / Get stack trace limit . <nl> Handle < Object > Isolate : : CaptureSimpleStackTrace ( Handle < JSReceiver > error_object , <nl> Handle < FixedArray > elements = <nl> factory ( ) - > NewFixedArrayWithHoles ( initial_size * 4 + 1 ) ; <nl> <nl> - / / If the caller parameter is a function we skip frames until we ' re <nl> - / / under it before starting to collect . <nl> - bool seen_caller = ! caller - > IsJSFunction ( ) ; <nl> + StackTraceHelper helper ( this , caller ) ; <nl> + <nl> / / First element is reserved to store the number of sloppy frames . <nl> int cursor = 1 ; <nl> int frames_seen = 0 ; <nl> - int sloppy_frames = 0 ; <nl> - bool encountered_strict_function = false ; <nl> for ( StackFrameIterator iter ( this ) ; ! iter . done ( ) & & frames_seen < limit ; <nl> iter . Advance ( ) ) { <nl> StackFrame * frame = iter . frame ( ) ; <nl> Handle < Object > Isolate : : CaptureSimpleStackTrace ( Handle < JSReceiver > error_object , <nl> js_frame - > Summarize ( & frames ) ; <nl> for ( int i = frames . length ( ) - 1 ; i > = 0 ; i - - ) { <nl> Handle < JSFunction > fun = frames [ i ] . function ( ) ; <nl> - Handle < Object > recv = frames [ i ] . receiver ( ) ; <nl> + <nl> / / Filter out internal frames that we do not want to show . <nl> - if ( ! IsVisibleInStackTrace ( * fun , * caller , & seen_caller ) ) continue ; <nl> - / / Filter out frames from other security contexts . <nl> - if ( ! this - > context ( ) - > HasSameSecurityTokenAs ( fun - > context ( ) ) ) { <nl> - continue ; <nl> - } <nl> - elements = MaybeGrow ( this , elements , cursor , cursor + 4 ) ; <nl> + if ( ! helper . IsVisibleInStackTrace ( * fun ) ) continue ; <nl> + helper . CountSloppyFrames ( * fun ) ; <nl> <nl> + Handle < Object > recv = frames [ i ] . receiver ( ) ; <nl> Handle < AbstractCode > abstract_code = frames [ i ] . abstract_code ( ) ; <nl> - <nl> Handle < Smi > offset ( Smi : : FromInt ( frames [ i ] . code_offset ( ) ) , this ) ; <nl> - / / The stack trace API should not expose receivers and function <nl> - / / objects on frames deeper than the top - most one with a strict mode <nl> - / / function . The number of sloppy frames is stored as first element in <nl> - / / the result array . <nl> - if ( ! encountered_strict_function ) { <nl> - if ( is_strict ( fun - > shared ( ) - > language_mode ( ) ) ) { <nl> - encountered_strict_function = true ; <nl> - } else { <nl> - sloppy_frames + + ; <nl> - } <nl> - } <nl> + <nl> + elements = MaybeGrow ( this , elements , cursor , cursor + 4 ) ; <nl> elements - > set ( cursor + + , * recv ) ; <nl> elements - > set ( cursor + + , * fun ) ; <nl> elements - > set ( cursor + + , * abstract_code ) ; <nl> Handle < Object > Isolate : : CaptureSimpleStackTrace ( Handle < JSReceiver > error_object , <nl> case StackFrame : : BUILTIN_EXIT : { <nl> BuiltinExitFrame * exit_frame = BuiltinExitFrame : : cast ( frame ) ; <nl> Handle < JSFunction > fun = handle ( exit_frame - > function ( ) , this ) ; <nl> + <nl> + / / Filter out internal frames that we do not want to show . <nl> + if ( ! helper . IsVisibleInStackTrace ( * fun ) ) continue ; <nl> + helper . CountSloppyFrames ( * fun ) ; <nl> + <nl> Handle < Code > code = handle ( exit_frame - > LookupCode ( ) , this ) ; <nl> int offset = <nl> static_cast < int > ( exit_frame - > pc ( ) - code - > instruction_start ( ) ) ; <nl> Handle < Object > Isolate : : CaptureSimpleStackTrace ( Handle < JSReceiver > error_object , <nl> break ; <nl> } <nl> } <nl> - elements - > set ( 0 , Smi : : FromInt ( sloppy_frames ) ) ; <nl> + elements - > set ( 0 , Smi : : FromInt ( helper . sloppy_frames ( ) ) ) ; <nl> elements - > Shrink ( cursor ) ; <nl> Handle < JSArray > result = factory ( ) - > NewJSArrayWithElements ( elements ) ; <nl> result - > set_length ( Smi : : FromInt ( cursor ) ) ; <nl> | Enable visibility and security checks for builtin exit frames | v8/v8 | 59705072ad4be7601f7ad0b061b48aca2eeeb1d8 | 2016-07-11T07:50:46Z |
mmm a / tensorflow / compiler / xla / BUILD <nl> ppp b / tensorflow / compiler / xla / BUILD <nl> cc_library ( <nl> name = " util " , <nl> srcs = [ " util . cc " ] , <nl> hdrs = [ <nl> + " iterator_util . h " , <nl> " map_util . h " , <nl> " ptr_util . h " , <nl> " util . h " , <nl> tf_cc_test ( <nl> ] , <nl> ) <nl> <nl> + tf_cc_test ( <nl> + name = " iterator_util_test " , <nl> + srcs = [ " iterator_util_test . cc " ] , <nl> + deps = [ <nl> + " : test " , <nl> + " : util " , <nl> + " / / tensorflow / core : test_main " , <nl> + ] , <nl> + ) <nl> + <nl> cc_library ( <nl> name = " shape_util " , <nl> srcs = [ <nl> new file mode 100644 <nl> index 0000000000000 . . a39999705eddc <nl> mmm / dev / null <nl> ppp b / tensorflow / compiler / xla / iterator_util . h <nl> <nl> + / * Copyright 2017 The TensorFlow Authors . All Rights Reserved . <nl> + <nl> + Licensed under the Apache License , Version 2 . 0 ( the " License " ) ; <nl> + you may not use this file except in compliance with the License . <nl> + You may obtain a copy of the License at <nl> + <nl> + http : / / www . apache . org / licenses / LICENSE - 2 . 0 <nl> + <nl> + Unless required by applicable law or agreed to in writing , software <nl> + distributed under the License is distributed on an " AS IS " BASIS , <nl> + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND , either express or implied . <nl> + See the License for the specific language governing permissions and <nl> + limitations under the License . <nl> + = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = * / <nl> + <nl> + # ifndef THIRD_PARTY_TENSORFLOW_COMPILER_XLA_SERVICE_ITERATOR_UTIL_H_ <nl> + # define THIRD_PARTY_TENSORFLOW_COMPILER_XLA_SERVICE_ITERATOR_UTIL_H_ <nl> + <nl> + # include < iterator > <nl> + # include < utility > <nl> + <nl> + namespace xla { <nl> + <nl> + / / UnwrappingIterator is a transforming iterator that calls get ( ) on the <nl> + / / elements it returns . <nl> + / / <nl> + / / Together with tensorflow : : gtl : : iterator_range , this lets classes which <nl> + / / contain a collection of smart pointers expose a view of raw pointers to <nl> + / / consumers . For example : <nl> + / / <nl> + / / class MyContainer { <nl> + / / public : <nl> + / / tensorflow : : gtl : : iterator_range < <nl> + / / UnwrappingIterator < std : : vector < std : : unique_ptr < Thing > > : : iterator > > <nl> + / / things ( ) { <nl> + / / return { MakeUnwrappingIterator ( things_ . begin ( ) ) , <nl> + / / MakeUnwrappingIterator ( things_ . end ( ) ) } ; <nl> + / / } <nl> + / / <nl> + / / tensorflow : : gtl : : iterator_range < UnwrappingIterator < <nl> + / / std : : vector < std : : unique_ptr < Thing > > : : const_iterator > > <nl> + / / things ( ) const { <nl> + / / return { MakeUnwrappingIterator ( things_ . begin ( ) ) , <nl> + / / MakeUnwrappingIterator ( things_ . end ( ) ) } ; <nl> + / / } <nl> + / / <nl> + / / private : <nl> + / / std : : vector < std : : unique_ptr < Thing > > things_ ; <nl> + / / } ; <nl> + / / <nl> + / / MyContainer container = . . . ; <nl> + / / for ( Thing * t : container . things ( ) ) { <nl> + / / . . . <nl> + / / } <nl> + / / <nl> + / / For simplicity , UnwrappingIterator is currently unconditionally an <nl> + / / input_iterator - - it doesn ' t inherit any superpowers NestedIterator may have . <nl> + template < typename NestedIter > <nl> + class UnwrappingIterator <nl> + : public std : : iterator < std : : input_iterator_tag , <nl> + decltype ( std : : declval < NestedIter > ( ) - > get ( ) ) > { <nl> + private : <nl> + NestedIter iter_ ; <nl> + <nl> + public : <nl> + explicit UnwrappingIterator ( NestedIter iter ) : iter_ ( std : : move ( iter ) ) { } <nl> + <nl> + auto operator * ( ) - > decltype ( iter_ - > get ( ) ) { return iter_ - > get ( ) ; } <nl> + auto operator - > ( ) - > decltype ( iter_ - > get ( ) ) { return iter_ - > get ( ) ; } <nl> + UnwrappingIterator & operator + + ( ) { <nl> + + + iter_ ; <nl> + return * this ; <nl> + } <nl> + UnwrappingIterator operator + + ( int ) { <nl> + UnwrappingIterator temp ( iter_ ) ; <nl> + operator + + ( ) ; <nl> + return temp ; <nl> + } <nl> + <nl> + friend bool operator = = ( const UnwrappingIterator & a , <nl> + const UnwrappingIterator & b ) { <nl> + return a . iter_ = = b . iter_ ; <nl> + } <nl> + <nl> + friend bool operator ! = ( const UnwrappingIterator & a , <nl> + const UnwrappingIterator & b ) { <nl> + return ! ( a = = b ) ; <nl> + } <nl> + } ; <nl> + <nl> + template < typename NestedIter > <nl> + UnwrappingIterator < NestedIter > MakeUnwrappingIterator ( NestedIter iter ) { <nl> + return UnwrappingIterator < NestedIter > ( std : : move ( iter ) ) ; <nl> + } <nl> + <nl> + } / / namespace xla <nl> + <nl> + # endif / / THIRD_PARTY_TENSORFLOW_COMPILER_XLA_SERVICE_ITERATOR_UTIL_H_ <nl> new file mode 100644 <nl> index 0000000000000 . . 7bc3189507ec5 <nl> mmm / dev / null <nl> ppp b / tensorflow / compiler / xla / iterator_util_test . cc <nl> <nl> + / * Copyright 2017 The TensorFlow Authors . All Rights Reserved . <nl> + <nl> + Licensed under the Apache License , Version 2 . 0 ( the " License " ) ; <nl> + you may not use this file except in compliance with the License . <nl> + You may obtain a copy of the License at <nl> + <nl> + http : / / www . apache . org / licenses / LICENSE - 2 . 0 <nl> + <nl> + Unless required by applicable law or agreed to in writing , software <nl> + distributed under the License is distributed on an " AS IS " BASIS , <nl> + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND , either express or implied . <nl> + See the License for the specific language governing permissions and <nl> + limitations under the License . <nl> + = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = * / <nl> + <nl> + # include " tensorflow / compiler / xla / iterator_util . h " <nl> + <nl> + # include < algorithm > <nl> + # include < list > <nl> + <nl> + # include " tensorflow / compiler / xla / ptr_util . h " <nl> + # include " tensorflow / compiler / xla / test . h " <nl> + <nl> + namespace xla { <nl> + namespace { <nl> + <nl> + TEST ( UnwrappingIteratorTest , Simple ) { <nl> + std : : vector < std : : unique_ptr < int > > v ; <nl> + for ( int i = 0 ; i < 3 ; + + i ) { <nl> + v . push_back ( MakeUnique < int > ( i ) ) ; <nl> + } <nl> + int i = 0 ; <nl> + for ( auto iter = MakeUnwrappingIterator ( v . begin ( ) ) ; <nl> + iter ! = MakeUnwrappingIterator ( v . end ( ) ) ; + + iter ) { <nl> + EXPECT_EQ ( * iter , v [ i ] . get ( ) ) ; <nl> + + + i ; <nl> + } <nl> + } <nl> + <nl> + TEST ( UnwrappingIteratorTest , PostincrementOperator ) { <nl> + std : : vector < std : : shared_ptr < int > > v ; <nl> + for ( int i = 0 ; i < 3 ; + + i ) { <nl> + v . push_back ( std : : make_shared < int > ( i ) ) ; <nl> + } <nl> + auto iter = MakeUnwrappingIterator ( v . begin ( ) ) ; <nl> + EXPECT_EQ ( * ( iter + + ) , v [ 0 ] . get ( ) ) ; <nl> + EXPECT_EQ ( * iter , v [ 1 ] . get ( ) ) ; <nl> + } <nl> + <nl> + / / std : : find relies on various iterator traits being properly defined . <nl> + TEST ( UnwrappingIteratorTest , StdFind ) { <nl> + std : : list < std : : unique_ptr < int > > l ; <nl> + for ( int i = 0 ; i < 3 ; + + i ) { <nl> + l . push_back ( MakeUnique < int > ( i ) ) ; <nl> + } <nl> + EXPECT_EQ ( l . begin ( ) - > get ( ) , <nl> + * std : : find ( MakeUnwrappingIterator ( l . begin ( ) ) , <nl> + MakeUnwrappingIterator ( l . end ( ) ) , l . begin ( ) - > get ( ) ) ) ; <nl> + } <nl> + <nl> + } / / namespace <nl> + } / / namespace xla <nl> mmm a / tensorflow / compiler / xla / service / algebraic_simplifier . cc <nl> ppp b / tensorflow / compiler / xla / service / algebraic_simplifier . cc <nl> static bool IsOrContainsSendOrRecv ( const HloInstruction * instr ) ; <nl> <nl> / / Determines whether the given computation contains a send or recv node . <nl> static bool ContainsSendOrRecv ( const HloComputation * comp ) { <nl> - for ( const auto & instr : comp - > instructions ( ) ) { <nl> - if ( IsOrContainsSendOrRecv ( instr . get ( ) ) ) { <nl> + for ( const auto * instr : comp - > instructions ( ) ) { <nl> + if ( IsOrContainsSendOrRecv ( instr ) ) { <nl> return true ; <nl> } <nl> } <nl> mmm a / tensorflow / compiler / xla / service / buffer_assignment . cc <nl> ppp b / tensorflow / compiler / xla / service / buffer_assignment . cc <nl> Status GatherComputationsByAllocationType ( <nl> global_set . insert ( computation ) ; <nl> } <nl> <nl> - for ( auto & instruction : computation - > instructions ( ) ) { <nl> + for ( auto * instruction : computation - > instructions ( ) ) { <nl> for ( HloComputation * subcomputation : <nl> instruction - > called_computations ( ) ) { <nl> switch ( instruction - > opcode ( ) ) { <nl> Status BufferAssigner : : AssignBuffersForComputation ( <nl> / / Buffers are sorted and assigned to BufferAllocations in decreasing order of <nl> / / size . <nl> std : : vector < const LogicalBuffer * > sorted_buffers ; <nl> - for ( auto & instruction : computation - > instructions ( ) ) { <nl> + for ( auto * instruction : computation - > instructions ( ) ) { <nl> / / Add all buffers which this instruction defines . Instruction which don ' t <nl> / / define buffers ( eg , bitcast which just forwards a pointer ) don ' t need <nl> / / any allocations . <nl> for ( const LogicalBuffer * buffer : <nl> assignment - > points_to_analysis ( ) . GetBuffersDefinedByInstruction ( <nl> - instruction . get ( ) ) ) { <nl> + instruction ) ) { <nl> sorted_buffers . push_back ( buffer ) ; <nl> } <nl> } <nl> mmm a / tensorflow / compiler / xla / service / buffer_liveness . cc <nl> ppp b / tensorflow / compiler / xla / service / buffer_liveness . cc <nl> tensorflow : : Status BufferLiveness : : Analyze ( ) { <nl> / / element in other instruction ' s output . <nl> for ( const auto & instruction : computation - > instructions ( ) ) { <nl> for ( const LogicalBuffer * aliased_buffer : <nl> - points_to_analysis_ - > GetPointsToSet ( instruction . get ( ) ) <nl> + points_to_analysis_ - > GetPointsToSet ( instruction ) <nl> . CreateFlattenedSet ( ) ) { <nl> - if ( aliased_buffer - > instruction ( ) ! = instruction . get ( ) ) { <nl> + if ( aliased_buffer - > instruction ( ) ! = instruction ) { <nl> aliased_buffers_ . insert ( aliased_buffer ) ; <nl> } <nl> } <nl> mmm a / tensorflow / compiler / xla / service / call_graph . cc <nl> ppp b / tensorflow / compiler / xla / service / call_graph . cc <nl> std : : unique_ptr < CallGraph > CallGraph : : Build ( const HloModule * module ) { <nl> call_graph - > nodes_ . emplace_back ( computation . get ( ) ) ; <nl> <nl> / / Add all callsites in this computation . <nl> - for ( const std : : unique_ptr < HloInstruction > & instruction : <nl> - computation - > instructions ( ) ) { <nl> - call_graph - > nodes_ . back ( ) . AddCallSiteForInstruction ( instruction . get ( ) ) ; <nl> + for ( HloInstruction * instruction : computation - > instructions ( ) ) { <nl> + call_graph - > nodes_ . back ( ) . AddCallSiteForInstruction ( instruction ) ; <nl> } <nl> } <nl> <nl> mmm a / tensorflow / compiler / xla / service / copy_insertion . cc <nl> ppp b / tensorflow / compiler / xla / service / copy_insertion . cc <nl> StatusOr < bool > CopyInsertion : : Run ( HloModule * module ) { <nl> FlatSet < const HloComputation * > while_body_computations ; <nl> std : : vector < HloInstruction * > while_instructions ; <nl> for ( auto & computation : module - > computations ( ) ) { <nl> - for ( auto & instruction : computation - > instructions ( ) ) { <nl> + for ( HloInstruction * instruction : computation - > instructions ( ) ) { <nl> if ( instruction - > opcode ( ) = = HloOpcode : : kWhile ) { <nl> while_body_computations . insert ( instruction - > while_body ( ) ) ; <nl> - while_instructions . push_back ( instruction . get ( ) ) ; <nl> + while_instructions . push_back ( instruction ) ; <nl> } <nl> } <nl> } <nl> mmm a / tensorflow / compiler / xla / service / cpu / cpu_instruction_fusion_test . cc <nl> ppp b / tensorflow / compiler / xla / service / cpu / cpu_instruction_fusion_test . cc <nl> class OpcodeFusionTest : public InstructionFusionTest { <nl> ASSERT_THAT ( root , op : : Fusion ( ) ) ; <nl> EXPECT_EQ ( root - > fusion_kind ( ) , HloInstruction : : FusionKind : : kLoop ) ; <nl> <nl> - std : : vector < HloOpcode > fused_opcodes ( root - > fused_instructions ( ) . size ( ) ) ; <nl> + std : : vector < HloOpcode > fused_opcodes ( root - > fused_instruction_count ( ) ) ; <nl> std : : transform ( root - > fused_instructions ( ) . begin ( ) , <nl> root - > fused_instructions ( ) . end ( ) , fused_opcodes . begin ( ) , <nl> - [ ] ( const std : : unique_ptr < HloInstruction > & hlo ) { <nl> - return hlo - > opcode ( ) ; <nl> - } ) ; <nl> + [ ] ( const HloInstruction * hlo ) { return hlo - > opcode ( ) ; } ) ; <nl> <nl> EXPECT_EQ ( <nl> std : : multiset < HloOpcode > ( fused_opcodes . begin ( ) , fused_opcodes . end ( ) ) , <nl> mmm a / tensorflow / compiler / xla / service / cpu / cpu_parallelization_preparation . cc <nl> ppp b / tensorflow / compiler / xla / service / cpu / cpu_parallelization_preparation . cc <nl> StatusOr < bool > ParallelizationPreparation : : RunParallelTaskAssignment ( <nl> HloCostAnalysis cost_analysis ( shape_size_ ) ; <nl> HloComputation * computation = module - > entry_computation ( ) ; <nl> Status cost_status = computation - > root_instruction ( ) - > Accept ( & cost_analysis ) ; <nl> - for ( auto & instruction : computation - > instructions ( ) ) { <nl> + for ( auto * instruction : computation - > instructions ( ) ) { <nl> / / Currently , we do not assign parallel tasks to instructions with at least <nl> / / one of the following properties : <nl> / / * ) Internal threading ( library calls to kConv , kDot , and kCustomCall ) . <nl> StatusOr < bool > ParallelizationPreparation : : RunParallelTaskAssignment ( <nl> <nl> / / Calculate target parallel task count in [ 1 , max_parallelism_ ] . <nl> const int64 target_parallel_task_count = GetTargetParallelTaskCount ( <nl> - cost_status . ok ( ) ? & cost_analysis : nullptr , instruction . get ( ) ) ; <nl> + cost_status . ok ( ) ? & cost_analysis : nullptr , instruction ) ; <nl> if ( target_parallel_task_count = = 1 ) { <nl> continue ; <nl> } <nl> mmm a / tensorflow / compiler / xla / service / cpu / ir_emitter . cc <nl> ppp b / tensorflow / compiler / xla / service / cpu / ir_emitter . cc <nl> Status IrEmitter : : FinishVisit ( HloInstruction * root ) { <nl> auto * computation = root - > parent ( ) ; <nl> auto * entry_computation = computation - > parent ( ) - > entry_computation ( ) ; <nl> if ( computation ! = entry_computation ) { <nl> - for ( auto & instruction : entry_computation - > instructions ( ) ) { <nl> + for ( HloInstruction * instruction : entry_computation - > instructions ( ) ) { <nl> if ( instruction - > opcode ( ) = = HloOpcode : : kCall & & <nl> instruction - > to_apply ( ) - > root_instruction ( ) = = root ) { <nl> - hlo_to_lookup = instruction . get ( ) ; <nl> + hlo_to_lookup = instruction ; <nl> break ; <nl> } <nl> } <nl> mmm a / tensorflow / compiler / xla / service / cpu / layout_assignment . cc <nl> ppp b / tensorflow / compiler / xla / service / cpu / layout_assignment . cc <nl> Status CpuLayoutAssignment : : AddBackendConstraints ( <nl> } ; <nl> <nl> const HloComputation * computation = constraints - > computation ( ) ; <nl> - for ( auto & instruction : computation - > instructions ( ) ) { <nl> + for ( auto * instruction : computation - > instructions ( ) ) { <nl> if ( instruction - > opcode ( ) = = HloOpcode : : kConvolution & & <nl> PotentiallyImplementedAsEigenConvolution ( * instruction ) ) { <nl> - const HloInstruction * convolution = instruction . get ( ) ; <nl> + const HloInstruction * convolution = instruction ; <nl> const HloInstruction * lhs_instruction = convolution - > operand ( 0 ) ; <nl> const HloInstruction * rhs_instruction = convolution - > operand ( 1 ) ; <nl> <nl> Status CpuLayoutAssignment : : AddBackendConstraints ( <nl> TF_RETURN_IF_ERROR ( <nl> constraints - > SetInstructionLayout ( output_shape , convolution ) ) ; <nl> } else if ( should_make_rhs_col_major ( * instruction ) ) { <nl> - auto * dot = instruction . get ( ) ; <nl> + auto * dot = instruction ; <nl> const auto & rhs_shape = dot - > operand ( 1 ) - > shape ( ) ; <nl> TF_RETURN_IF_ERROR ( <nl> constraints - > SetOperandLayout ( col_major_shape ( rhs_shape ) , dot , 1 ) ) ; <nl> } else if ( PotentiallyImplementedAsEigenDot ( * instruction ) ) { <nl> - const HloInstruction * dot = instruction . get ( ) ; <nl> + const HloInstruction * dot = instruction ; <nl> const HloInstruction * lhs_instruction = dot - > operand ( 0 ) ; <nl> const HloInstruction * rhs_instruction = dot - > operand ( 1 ) ; <nl> <nl> Status CpuLayoutAssignment : : AddBackendConstraints ( <nl> for ( int64 operand_no = 0 ; operand_no < instruction - > operand_count ( ) ; <nl> + + operand_no ) { <nl> / / Skip operands which already have a constraint . <nl> - if ( constraints - > OperandLayout ( instruction . get ( ) , operand_no ) ! = <nl> - nullptr ) { <nl> + if ( constraints - > OperandLayout ( instruction , operand_no ) ! = nullptr ) { <nl> continue ; <nl> } <nl> / / Skip over forwarded operands . <nl> - if ( constraints - > OperandBufferForwarded ( instruction . get ( ) , <nl> - operand_no ) ) { <nl> + if ( constraints - > OperandBufferForwarded ( instruction , operand_no ) ) { <nl> continue ; <nl> } <nl> Shape operand_shape ( <nl> row_major_shape ( instruction - > operand ( operand_no ) - > shape ( ) ) ) ; <nl> TF_RETURN_IF_ERROR ( constraints - > SetOperandLayout ( <nl> - operand_shape , instruction . get ( ) , operand_no ) ) ; <nl> + operand_shape , instruction , operand_no ) ) ; <nl> } <nl> / / Skip over the root instruction for the top - level computation . <nl> if ( computation - > parent ( ) - > entry_computation ( ) = = computation & & <nl> - computation - > root_instruction ( ) = = instruction . get ( ) ) { <nl> + computation - > root_instruction ( ) = = instruction ) { <nl> continue ; <nl> } <nl> / / Skip instructions which don ' t produce array shapes ( tuples , opaque , <nl> mmm a / tensorflow / compiler / xla / service / flatten_call_graph . cc <nl> ppp b / tensorflow / compiler / xla / service / flatten_call_graph . cc <nl> Status FlattenNode ( const CallGraphNode & node ) { <nl> while ( ! worklist . empty ( ) ) { <nl> auto current = worklist . back ( ) ; <nl> worklist . pop_back ( ) ; <nl> - for ( auto & instruction : current - > instructions ( ) ) { <nl> - if ( GetInstructionCallContext ( instruction . get ( ) ) ! = <nl> + for ( auto * instruction : current - > instructions ( ) ) { <nl> + if ( GetInstructionCallContext ( instruction ) ! = <nl> CallContext : : kSequential ) { <nl> continue ; <nl> } <nl> for ( auto callee : instruction - > called_computations ( ) ) { <nl> HloComputation * callee_clone = <nl> module - > AddEmbeddedComputation ( callee - > Clone ( ) ) ; <nl> - ReplaceCalledComputation ( instruction . get ( ) , callee , callee_clone ) ; <nl> + ReplaceCalledComputation ( instruction , callee , callee_clone ) ; <nl> worklist . push_back ( callee_clone ) ; <nl> } <nl> } <nl> mmm a / tensorflow / compiler / xla / service / gpu / convolution_folding . cc <nl> ppp b / tensorflow / compiler / xla / service / gpu / convolution_folding . cc <nl> MatchBackwardInput ( HloInstruction * conv ) { <nl> StatusOr < bool > ConvolutionFolding : : Run ( HloModule * module ) { <nl> HloComputation * entry_computation = module - > entry_computation ( ) ; <nl> std : : vector < HloInstruction * > convs ; <nl> - for ( const auto & hlo : entry_computation - > instructions ( ) ) { <nl> + for ( auto * hlo : entry_computation - > instructions ( ) ) { <nl> if ( hlo - > opcode ( ) = = HloOpcode : : kConvolution ) { <nl> - convs . push_back ( hlo . get ( ) ) ; <nl> + convs . push_back ( hlo ) ; <nl> } <nl> } <nl> <nl> mmm a / tensorflow / compiler / xla / service / gpu / fusion_merger . cc <nl> ppp b / tensorflow / compiler / xla / service / gpu / fusion_merger . cc <nl> double CalculateBytesReadByFusionParameter ( HloInstruction * param ) { <nl> / / Returns the bytes read by all fusion parameters of instruction ' fusion ' . <nl> double CalculateBytesReadByFusionInstruction ( HloInstruction * fusion ) { <nl> double bytes = 0 . 0 ; <nl> - for ( const auto & fused_instruction : fusion - > fused_instructions ( ) ) { <nl> + for ( auto * fused_instruction : fusion - > fused_instructions ( ) ) { <nl> if ( fused_instruction - > opcode ( ) ! = HloOpcode : : kParameter ) { <nl> continue ; <nl> } <nl> - bytes + = CalculateBytesReadByFusionParameter ( fused_instruction . get ( ) ) ; <nl> + bytes + = CalculateBytesReadByFusionParameter ( fused_instruction ) ; <nl> } <nl> return bytes ; <nl> } <nl> Status FusionInstructionMerger : : HandleFusion ( HloInstruction * fusion ) { <nl> / / re - use by the consumer ) , and so we honor that choice here as well . <nl> if ( ! std : : all_of ( fusion - > fused_instructions ( ) . begin ( ) , <nl> fusion - > fused_instructions ( ) . end ( ) , <nl> - [ ] ( const std : : unique_ptr < HloInstruction > & instruction ) { <nl> + [ ] ( const HloInstruction * instruction ) { <nl> if ( instruction - > opcode ( ) ! = HloOpcode : : kParameter & & <nl> GpuInstructionFusion : : IsExpensive ( * instruction ) ) { <nl> return false ; <nl> mmm a / tensorflow / compiler / xla / service / gpu / fusion_merger_test . cc <nl> ppp b / tensorflow / compiler / xla / service / gpu / fusion_merger_test . cc <nl> TEST_F ( FusionMergerTest , MergeSharedFusionInstruction ) { <nl> / / Check operand 0 ( not merged ) . Should have 4 instructions . <nl> auto * operand0 = root - > operand ( 0 ) ; <nl> EXPECT_EQ ( HloOpcode : : kFusion , operand0 - > opcode ( ) ) ; <nl> - EXPECT_EQ ( 4 , operand0 - > fused_instructions ( ) . size ( ) ) ; <nl> + EXPECT_EQ ( 4 , operand0 - > fused_instruction_count ( ) ) ; <nl> / / Check operand 1 ( should have merged in its operand fusion instruction ) . <nl> auto * operand1 = root - > operand ( 1 ) ; <nl> EXPECT_EQ ( HloOpcode : : kFusion , operand1 - > opcode ( ) ) ; <nl> - EXPECT_EQ ( 7 , operand1 - > fused_instructions ( ) . size ( ) ) ; <nl> + EXPECT_EQ ( 7 , operand1 - > fused_instruction_count ( ) ) ; <nl> / / Check operand 2 ( should have merged in its operand fusion instruction ) . <nl> auto * operand2 = root - > operand ( 2 ) ; <nl> EXPECT_EQ ( HloOpcode : : kFusion , operand2 - > opcode ( ) ) ; <nl> - EXPECT_EQ ( 7 , operand2 - > fused_instructions ( ) . size ( ) ) ; <nl> + EXPECT_EQ ( 7 , operand2 - > fused_instruction_count ( ) ) ; <nl> } <nl> <nl> / / Tests that we do not merge a fusion instruction that above flops to bytes <nl> mmm a / tensorflow / compiler / xla / service / gpu / hlo_schedule . cc <nl> ppp b / tensorflow / compiler / xla / service / gpu / hlo_schedule . cc <nl> void BFSLaunchOrder ( const HloComputation * computation , <nl> std : : unordered_map < const HloInstruction * , int64 > incoming_edge_count ; <nl> for ( const auto & hlo : computation - > instructions ( ) ) { <nl> if ( hlo - > operand_count ( ) = = 0 ) { <nl> - queue . push_back ( hlo . get ( ) ) ; <nl> + queue . push_back ( hlo ) ; <nl> } else { <nl> - incoming_edge_count [ hlo . get ( ) ] = <nl> + incoming_edge_count [ hlo ] = <nl> std : : set < HloInstruction * > ( hlo - > operands ( ) . begin ( ) , <nl> hlo - > operands ( ) . end ( ) ) <nl> . size ( ) ; <nl> mmm a / tensorflow / compiler / xla / service / gpu / ir_emitter_nested . cc <nl> ppp b / tensorflow / compiler / xla / service / gpu / ir_emitter_nested . cc <nl> llvm : : Function * IrEmitterNested : : EmitBasePointersForNestedComputation ( <nl> llvm : : ReturnInst : : Create ( function - > getContext ( ) , entry_bb ) ) ; <nl> <nl> std : : vector < const HloInstruction * > non_io_hlos ; <nl> - for ( const auto & hlo : nested_computation . instructions ( ) ) { <nl> + for ( const auto * hlo : nested_computation . instructions ( ) ) { <nl> if ( hlo - > opcode ( ) ! = HloOpcode : : kParameter & & <nl> - hlo . get ( ) ! = nested_computation . root_instruction ( ) ) { <nl> - non_io_hlos . push_back ( hlo . get ( ) ) ; <nl> + hlo ! = nested_computation . root_instruction ( ) ) { <nl> + non_io_hlos . push_back ( hlo ) ; <nl> } <nl> } <nl> bindings_ . EmitBasePointersForHlos ( * io_hlos , non_io_hlos ) ; <nl> mmm a / tensorflow / compiler / xla / service / gpu / layout_assignment . cc <nl> ppp b / tensorflow / compiler / xla / service / gpu / layout_assignment . cc <nl> namespace gpu { <nl> <nl> Status GpuLayoutAssignment : : AddBackendConstraints ( <nl> LayoutConstraints * constraints ) { <nl> - for ( auto & instruction : constraints - > computation ( ) - > instructions ( ) ) { <nl> + for ( auto * instruction : constraints - > computation ( ) - > instructions ( ) ) { <nl> / / cuDNN is called with specific layouts on the input , output , and filter : <nl> / / <nl> / / input : DataLayout : : kBatchDepthYX <nl> Status GpuLayoutAssignment : : AddBackendConstraints ( <nl> if ( instruction - > opcode ( ) = = HloOpcode : : kConvolution ) { <nl> input = instruction - > mutable_operand ( 0 ) ; <nl> filter = instruction - > mutable_operand ( 1 ) ; <nl> - output = instruction . get ( ) ; <nl> + output = instruction ; <nl> } else { <nl> CHECK_EQ ( HloOpcode : : kFusion , instruction - > opcode ( ) ) ; <nl> switch ( instruction - > fusion_kind ( ) ) { <nl> case HloInstruction : : FusionKind : : kConvBackwardFilter : <nl> / / filter = BackwardFilterConvolve ( input , output ) <nl> input = instruction - > mutable_operand ( 0 ) ; <nl> - filter = instruction . get ( ) ; <nl> + filter = instruction ; <nl> output = instruction - > mutable_operand ( 1 ) ; <nl> break ; <nl> case HloInstruction : : FusionKind : : kConvBackwardInput : <nl> / / input = BackwardInputConvolve ( output , filter ) <nl> - input = instruction . get ( ) ; <nl> + input = instruction ; <nl> filter = instruction - > mutable_operand ( 1 ) ; <nl> output = instruction - > mutable_operand ( 0 ) ; <nl> break ; <nl> mmm a / tensorflow / compiler / xla / service / hlo_alias_analysis . cc <nl> ppp b / tensorflow / compiler / xla / service / hlo_alias_analysis . cc <nl> string HloAliasAnalysis : : ToString ( ) const { <nl> StrAppend ( & out , " Buffers at each position : \ n " ) ; <nl> for ( const std : : unique_ptr < HloComputation > & computation : <nl> module_ - > computations ( ) ) { <nl> - for ( const std : : unique_ptr < HloInstruction > & instruction : <nl> - computation - > instructions ( ) ) { <nl> + for ( const HloInstruction * instruction : computation - > instructions ( ) ) { <nl> StrAppend ( & out , " " , instruction - > name ( ) , " : \ n " ) ; <nl> if ( ShapeUtil : : IsTuple ( instruction - > shape ( ) ) ) { <nl> ShapeUtil : : ForEachSubshape ( <nl> string HloAliasAnalysis : : ToString ( ) const { <nl> [ & out , & instruction , this ] ( const Shape & , const ShapeIndex & index ) { <nl> StrAppend ( & out , " tuple index " , index . ToString ( ) , " : \ n " ) ; <nl> for ( const HloBuffer * buffer : <nl> - ComputeBuffersAt ( instruction . get ( ) , index ) ) { <nl> + ComputeBuffersAt ( instruction , index ) ) { <nl> StrAppend ( & out , " " , buffer - > ToString ( ) , " \ n " ) ; <nl> } <nl> } ) ; <nl> } else { <nl> for ( const HloBuffer * buffer : <nl> - ComputeBuffersAt ( instruction . get ( ) , / * index = * / { } ) ) { <nl> + ComputeBuffersAt ( instruction , / * index = * / { } ) ) { <nl> StrAppend ( & out , " " , buffer - > ToString ( ) , " \ n " ) ; <nl> } <nl> } <nl> mmm a / tensorflow / compiler / xla / service / hlo_computation . cc <nl> ppp b / tensorflow / compiler / xla / service / hlo_computation . cc <nl> bool HloComputation : : IsRemovable ( const HloInstruction * instruction ) { <nl> } <nl> <nl> bool HloComputation : : HasSideEffect ( ) const { <nl> - for ( auto & instruction : instructions ( ) ) { <nl> + for ( auto * instruction : instructions ( ) ) { <nl> if ( instruction - > HasSideEffect ( ) ) { <nl> return true ; <nl> } <nl> void ComputeComputationPostOrder ( <nl> return ; <nl> } <nl> <nl> - for ( auto & instruction : computation - > instructions ( ) ) { <nl> + for ( auto * instruction : computation - > instructions ( ) ) { <nl> for ( HloComputation * called_computation : <nl> instruction - > called_computations ( ) ) { <nl> ComputeComputationPostOrder ( called_computation , visited , post_order ) ; <nl> void HloComputation : : UpdateReachabilityThroughInstruction ( <nl> <nl> std : : vector < HloInstruction * > HloComputation : : CollectUnreachableRoots ( ) const { <nl> std : : vector < HloInstruction * > unreachable_roots ; <nl> - for ( auto & instruction : instructions ( ) ) { <nl> + for ( auto * instruction : instructions ( ) ) { <nl> if ( instruction - > user_count ( ) = = 0 & & <nl> instruction - > control_successors ( ) . empty ( ) & & <nl> - instruction . get ( ) ! = root_instruction ( ) ) { <nl> - unreachable_roots . push_back ( instruction . get ( ) ) ; <nl> + instruction ! = root_instruction ( ) ) { <nl> + unreachable_roots . push_back ( instruction ) ; <nl> } <nl> } <nl> VLOG ( 3 ) < < " Unreachable roots : " <nl> mmm a / tensorflow / compiler / xla / service / hlo_computation . h <nl> ppp b / tensorflow / compiler / xla / service / hlo_computation . h <nl> limitations under the License . <nl> # include < utility > <nl> # include < vector > <nl> <nl> + # include " tensorflow / compiler / xla / iterator_util . h " <nl> # include " tensorflow / compiler / xla / map_util . h " <nl> # include " tensorflow / compiler / xla / service / dfs_hlo_visitor . h " <nl> # include " tensorflow / compiler / xla / service / dfs_hlo_visitor_with_default . h " <nl> class HloComputation { <nl> / / Returns a serialized representation of this computation . <nl> HloComputationProto ToProto ( ) const ; <nl> <nl> - const std : : list < std : : unique_ptr < HloInstruction > > & instructions ( ) const { <nl> - return instructions_ ; <nl> + / / Gets the instructions in this computation . <nl> + / / <nl> + / / The returned type is a range of HloInstruction * s , so you can iterate over <nl> + / / it using a range - based for loop in the natural way : <nl> + / / <nl> + / / for ( HloInstruction * instr : computation - > instructions ( ) ) { . . . } <nl> + / / <nl> + tensorflow : : gtl : : iterator_range < UnwrappingIterator < <nl> + std : : list < std : : unique_ptr < HloInstruction > > : : const_iterator > > <nl> + instructions ( ) const { <nl> + return { MakeUnwrappingIterator ( instructions_ . begin ( ) ) , <nl> + MakeUnwrappingIterator ( instructions_ . end ( ) ) } ; <nl> + } <nl> + tensorflow : : gtl : : iterator_range < <nl> + UnwrappingIterator < std : : list < std : : unique_ptr < HloInstruction > > : : iterator > > <nl> + instructions ( ) { <nl> + return { MakeUnwrappingIterator ( instructions_ . begin ( ) ) , <nl> + MakeUnwrappingIterator ( instructions_ . end ( ) ) } ; <nl> } <nl> <nl> / / Compute and return a post - order of the instructions in the computation . In <nl> mmm a / tensorflow / compiler / xla / service / hlo_cse . cc <nl> ppp b / tensorflow / compiler / xla / service / hlo_cse . cc <nl> bool CombineConstants ( HloComputation * computation , bool is_layout_sensitive ) { <nl> <nl> auto inst_it = computation - > instructions ( ) . begin ( ) ; <nl> while ( inst_it ! = computation - > instructions ( ) . end ( ) ) { <nl> - HloInstruction * instruction = inst_it - > get ( ) ; <nl> + HloInstruction * instruction = * inst_it ; <nl> <nl> / / Advance list iterator before loop body because iterator may be <nl> / / invalidated due to deletion . <nl> mmm a / tensorflow / compiler / xla / service / hlo_cse_test . cc <nl> ppp b / tensorflow / compiler / xla / service / hlo_cse_test . cc <nl> TEST_F ( HloCseTest , CombineTwoConstants ) { <nl> EXPECT_TRUE ( cse . Run ( module . get ( ) ) . ValueOrDie ( ) ) ; <nl> <nl> EXPECT_EQ ( 2 , computation - > instruction_count ( ) ) ; <nl> - HloInstruction * constant = computation - > instructions ( ) . begin ( ) - > get ( ) ; <nl> + HloInstruction * constant = * computation - > instructions ( ) . begin ( ) ; <nl> EXPECT_EQ ( 42 . 0f , constant - > literal ( ) . Get < float > ( { } ) ) ; <nl> <nl> auto result = ExecuteAndTransfer ( std : : move ( module ) , { } ) ; <nl> mmm a / tensorflow / compiler / xla / service / hlo_dataflow_analysis . cc <nl> ppp b / tensorflow / compiler / xla / service / hlo_dataflow_analysis . cc <nl> string HloDataflowAnalysis : : ToString ( ) const { <nl> StrAppend ( & out , " Instruction value sets : \ n " ) ; <nl> for ( const std : : unique_ptr < HloComputation > & computation : <nl> module_ - > computations ( ) ) { <nl> - for ( const std : : unique_ptr < HloInstruction > & instruction : <nl> - computation - > instructions ( ) ) { <nl> + for ( const HloInstruction * instruction : computation - > instructions ( ) ) { <nl> StrAppend ( & out , " " , instruction - > name ( ) , " : \ n " ) ; <nl> if ( ShapeUtil : : IsTuple ( instruction - > shape ( ) ) ) { <nl> - GetInstructionValueSet ( instruction . get ( ) ) <nl> + GetInstructionValueSet ( instruction ) <nl> . ForEachElement ( [ this , & instruction , & out ] ( <nl> const ShapeIndex & index , <nl> const HloValueSet & value_set ) { <nl> StrAppend ( & out , " tuple index " , index . ToString ( ) , " : \ n " ) ; <nl> for ( const HloValue * value : value_set . values ( ) ) { <nl> - StrAppend ( <nl> - & out , " " , value - > ToShortString ( ) , <nl> - ValueIsDefinedAt ( instruction . get ( ) , index ) ? " ( def ) " : " " , <nl> - " \ n " ) ; <nl> + StrAppend ( & out , " " , value - > ToShortString ( ) , <nl> + ValueIsDefinedAt ( instruction , index ) ? " ( def ) " : " " , <nl> + " \ n " ) ; <nl> } <nl> } ) ; <nl> } else { <nl> const HloValueSet & top_level_value_set = <nl> - GetValueSet ( instruction . get ( ) , / * index = * / { } ) ; <nl> + GetValueSet ( instruction , / * index = * / { } ) ; <nl> for ( const HloValue * value : top_level_value_set . values ( ) ) { <nl> StrAppend ( & out , " " , value - > ToShortString ( ) , <nl> - ValueIsDefinedAt ( instruction . get ( ) ) ? " ( def ) " : " " , " \ n " ) ; <nl> + ValueIsDefinedAt ( instruction ) ? " ( def ) " : " " , " \ n " ) ; <nl> } <nl> } <nl> } <nl> Status HloDataflowAnalysis : : InitializeInstructionValueSets ( ) { <nl> const CallGraphNode & call_graph_node = <nl> call_graph_ - > GetNode ( computation . get ( ) ) ; <nl> <nl> - for ( const std : : unique_ptr < HloInstruction > & instruction : <nl> - computation - > instructions ( ) ) { <nl> + for ( HloInstruction * instruction : computation - > instructions ( ) ) { <nl> / / Create an empty shape tree . <nl> value_sets_ . emplace ( std : : piecewise_construct , <nl> - std : : forward_as_tuple ( instruction . get ( ) ) , <nl> + std : : forward_as_tuple ( instruction ) , <nl> std : : forward_as_tuple ( instruction - > shape ( ) ) ) ; <nl> <nl> / / Lambda to set the value set to define all values in the output of the <nl> / / instruction . <nl> auto define_all_values = [ this , & instruction ] ( bool is_phi = false ) { <nl> - for ( auto & pair : GetInstructionValueSet ( instruction . get ( ) ) ) { <nl> + for ( auto & pair : GetInstructionValueSet ( instruction ) ) { <nl> const ShapeIndex & index = pair . first ; <nl> - HloValue * value = <nl> - NewHloValue ( instruction . get ( ) , index , / * is_phi = * / false ) ; <nl> - GetValueSet ( instruction . get ( ) , index ) . AddValue ( value ) ; <nl> + HloValue * value = NewHloValue ( instruction , index , / * is_phi = * / false ) ; <nl> + GetValueSet ( instruction , index ) . AddValue ( value ) ; <nl> } <nl> } ; <nl> <nl> Status HloDataflowAnalysis : : InitializeInstructionValueSets ( ) { <nl> / / the instruction ( or from cross - computation dataflow ) . <nl> auto define_top_level_only = [ this , & instruction ] ( ) { <nl> HloValue * value = <nl> - NewHloValue ( instruction . get ( ) , / * index = * / { } , / * is_phi = * / false ) ; <nl> - GetValueSet ( instruction . get ( ) , / * index = * / { } ) . AddValue ( value ) ; <nl> + NewHloValue ( instruction , / * index = * / { } , / * is_phi = * / false ) ; <nl> + GetValueSet ( instruction , / * index = * / { } ) . AddValue ( value ) ; <nl> } ; <nl> <nl> switch ( instruction - > opcode ( ) ) { <nl> StatusOr < std : : unique_ptr < HloDataflowAnalysis > > HloDataflowAnalysis : : Run ( <nl> / / Add in positions to all values . <nl> for ( const std : : unique_ptr < HloComputation > & computation : <nl> module - > computations ( ) ) { <nl> - for ( const std : : unique_ptr < HloInstruction > & instruction : <nl> - computation - > instructions ( ) ) { <nl> + for ( HloInstruction * instruction : computation - > instructions ( ) ) { <nl> for ( const auto & pair : <nl> - dataflow_analysis - > GetInstructionValueSet ( instruction . get ( ) ) ) { <nl> + dataflow_analysis - > GetInstructionValueSet ( instruction ) ) { <nl> const ShapeIndex & index = pair . first ; <nl> const HloValueSet & value_set = pair . second ; <nl> for ( const HloValue * value : value_set . values ( ) ) { <nl> - if ( value - > defining_instruction ( ) ! = instruction . get ( ) ) { <nl> + if ( value - > defining_instruction ( ) ! = instruction ) { <nl> dataflow_analysis - > GetValue ( value - > id ( ) ) <nl> - . AddPosition ( instruction . get ( ) , index ) ; <nl> + . AddPosition ( instruction , index ) ; <nl> } <nl> } <nl> } <nl> Status HloDataflowAnalysis : : Verify ( ) const { <nl> / / appears in the value ' s positions ( ) . <nl> for ( const auto & computation : module_ - > computations ( ) ) { <nl> for ( const auto & instruction : computation - > instructions ( ) ) { <nl> - for ( const auto & pair : GetInstructionValueSet ( instruction . get ( ) ) ) { <nl> + for ( const auto & pair : GetInstructionValueSet ( instruction ) ) { <nl> const ShapeIndex & index = pair . first ; <nl> const HloValueSet & value_set = pair . second ; <nl> - const HloPosition position { instruction . get ( ) , index } ; <nl> + const HloPosition position { instruction , index } ; <nl> for ( const HloValue * value : value_set . values ( ) ) { <nl> TF_RET_CHECK ( std : : find ( value - > positions ( ) . begin ( ) , <nl> value - > positions ( ) . end ( ) , <nl> mmm a / tensorflow / compiler / xla / service / hlo_dce . cc <nl> ppp b / tensorflow / compiler / xla / service / hlo_dce . cc <nl> StatusOr < bool > HloDCE : : Run ( HloModule * module ) { <nl> / / into a separate list first to avoid problems with iterating through the <nl> / / computation ' s instruction while simultaneously removing instructions . <nl> std : : vector < HloInstruction * > dead_roots ; <nl> - for ( auto & instruction : computation - > instructions ( ) ) { <nl> + for ( auto * instruction : computation - > instructions ( ) ) { <nl> if ( instruction - > user_count ( ) = = 0 & & <nl> - live_instructions . count ( instruction . get ( ) ) = = 0 & & <nl> - computation - > IsRemovable ( instruction . get ( ) ) ) { <nl> - dead_roots . push_back ( instruction . get ( ) ) ; <nl> + live_instructions . count ( instruction ) = = 0 & & <nl> + computation - > IsRemovable ( instruction ) ) { <nl> + dead_roots . push_back ( instruction ) ; <nl> } <nl> } <nl> <nl> mmm a / tensorflow / compiler / xla / service / hlo_dce_test . cc <nl> ppp b / tensorflow / compiler / xla / service / hlo_dce_test . cc <nl> class HloDceTest : public HloTestBase { <nl> / / Returns whether the given instruction exists in the given computation . <nl> bool HasInstruction ( const HloComputation & computation , <nl> const HloInstruction * instruction ) { <nl> - for ( auto & inst : computation . instructions ( ) ) { <nl> - if ( inst . get ( ) = = instruction ) { <nl> - return true ; <nl> - } <nl> - } <nl> - return false ; <nl> + return std : : find ( computation . instructions ( ) . begin ( ) , <nl> + computation . instructions ( ) . end ( ) , <nl> + instruction ) ! = computation . instructions ( ) . end ( ) ; <nl> } <nl> } ; <nl> <nl> mmm a / tensorflow / compiler / xla / service / hlo_graph_dumper . cc <nl> ppp b / tensorflow / compiler / xla / service / hlo_graph_dumper . cc <nl> bool HloDotDumper : : ShouldShowSubcomputation ( const HloComputation * subcomp ) { <nl> } <nl> <nl> / / Show the subcomputation if we ' re showing any of its members . <nl> - return std : : any_of ( computation_ - > instructions ( ) . begin ( ) , <nl> - computation_ - > instructions ( ) . end ( ) , <nl> - [ & ] ( const std : : unique_ptr < HloInstruction > & instr ) { <nl> - return filter_ . Show ( instr . get ( ) ) ; <nl> - } ) ; <nl> + return std : : any_of ( <nl> + computation_ - > instructions ( ) . begin ( ) , computation_ - > instructions ( ) . end ( ) , <nl> + [ & ] ( const HloInstruction * instr ) { return filter_ . Show ( instr ) ; } ) ; <nl> } <nl> <nl> string HloDotDumper : : DumpSubcomputation ( const HloComputation * subcomp , <nl> tooltip = " " ; <nl> <nl> string HloDotDumper : : DumpComputation ( const HloComputation * comp ) { <nl> string g ; <nl> - for ( const auto & instr : comp - > instructions ( ) ) { <nl> - if ( ! filter_ . Show ( instr . get ( ) ) ) { <nl> + for ( const auto * instr : comp - > instructions ( ) ) { <nl> + if ( ! filter_ . Show ( instr ) ) { <nl> continue ; <nl> } <nl> <nl> / / Dump subcomputations within instr . <nl> for ( const HloComputation * subcomp : instr - > called_computations ( ) ) { <nl> if ( ShouldShowSubcomputation ( subcomp ) ) { <nl> - StrAppend ( & g , DumpSubcomputation ( subcomp , instr . get ( ) ) ) ; <nl> + StrAppend ( & g , DumpSubcomputation ( subcomp , instr ) ) ; <nl> } <nl> } <nl> <nl> - StrAppend ( & g , DumpInstruction ( instr . get ( ) ) ) ; <nl> + StrAppend ( & g , DumpInstruction ( instr ) ) ; <nl> } <nl> return g ; <nl> } <nl> mmm a / tensorflow / compiler / xla / service / hlo_graph_dumper_test . cc <nl> ppp b / tensorflow / compiler / xla / service / hlo_graph_dumper_test . cc <nl> TEST ( HloGraphDumperTest , NestedFusion ) { <nl> { root_computation , / / <nl> inner_fusion - > fused_instructions_computation ( ) , <nl> outer_fusion - > fused_instructions_computation ( ) } ) { <nl> - for ( const std : : unique_ptr < HloInstruction > & instruction : <nl> - computation - > instructions ( ) ) { <nl> + for ( const HloInstruction * instruction : computation - > instructions ( ) ) { <nl> EXPECT_THAT ( graph , HasSubstr ( instruction - > name ( ) ) ) ; <nl> } <nl> } <nl> TEST ( HloGraphDumperTest , NestedFusion ) { <nl> / / care that the outer nodes are omitted - - whether they are or not is based <nl> / / fiddly heuristics - - but we do care that the node we asked for is printed . <nl> const HloInstruction * inner_sum = nullptr ; <nl> - for ( const std : : unique_ptr < HloInstruction > & instruction : <nl> + for ( const HloInstruction * instruction : <nl> inner_fusion - > fused_instructions_computation ( ) - > instructions ( ) ) { <nl> if ( instruction - > opcode ( ) = = HloOpcode : : kAdd ) { <nl> - inner_sum = instruction . get ( ) ; <nl> + inner_sum = instruction ; <nl> break ; <nl> } <nl> } <nl> mmm a / tensorflow / compiler / xla / service / hlo_instruction . cc <nl> ppp b / tensorflow / compiler / xla / service / hlo_instruction . cc <nl> const std : : vector < HloInstruction * > & HloInstruction : : fused_parameters ( ) const { <nl> return fused_instructions_computation ( ) - > parameter_instructions ( ) ; <nl> } <nl> <nl> - const std : : list < std : : unique_ptr < HloInstruction > > & <nl> + const tensorflow : : gtl : : iterator_range < UnwrappingIterator < <nl> + std : : list < std : : unique_ptr < HloInstruction > > : : const_iterator > > <nl> HloInstruction : : fused_instructions ( ) const { <nl> + CHECK_EQ ( opcode_ , HloOpcode : : kFusion ) ; <nl> + const HloComputation * subcomp = fused_instructions_computation ( ) ; <nl> + return subcomp - > instructions ( ) ; <nl> + } <nl> + <nl> + const tensorflow : : gtl : : iterator_range < <nl> + UnwrappingIterator < std : : list < std : : unique_ptr < HloInstruction > > : : iterator > > <nl> + HloInstruction : : fused_instructions ( ) { <nl> CHECK_EQ ( opcode_ , HloOpcode : : kFusion ) ; <nl> return fused_instructions_computation ( ) - > instructions ( ) ; <nl> } <nl> <nl> + int64 HloInstruction : : fused_instruction_count ( ) const { <nl> + return fused_instructions_computation ( ) - > instruction_count ( ) ; <nl> + } <nl> + <nl> HloInstruction : : HloInstruction ( HloOpcode opcode , const Shape & shape ) <nl> : unique_id_ ( - 1 ) , <nl> opcode_ ( opcode ) , <nl> bool HloInstruction : : IsElementwise ( ) const { <nl> if ( fusion_kind ( ) ! = FusionKind : : kLoop ) { <nl> return false ; <nl> } <nl> - for ( auto & fused : fused_instructions ( ) ) { <nl> + for ( auto * fused : fused_instructions ( ) ) { <nl> if ( fused - > opcode ( ) ! = HloOpcode : : kParameter & & <nl> ! fused - > IsElementwise ( ) ) { <nl> return false ; <nl> mmm a / tensorflow / compiler / xla / service / hlo_instruction . h <nl> ppp b / tensorflow / compiler / xla / service / hlo_instruction . h <nl> limitations under the License . <nl> # include < unordered_set > <nl> # include < vector > <nl> <nl> + # include " tensorflow / compiler / xla / iterator_util . h " <nl> # include " tensorflow / compiler / xla / literal_util . h " <nl> # include " tensorflow / compiler / xla / map_util . h " <nl> # include " tensorflow / compiler / xla / service / dfs_hlo_visitor . h " <nl> limitations under the License . <nl> # include " tensorflow / core / lib / core / stringpiece . h " <nl> # include " tensorflow / core / lib / gtl / array_slice . h " <nl> # include " tensorflow / core / lib / gtl / inlined_vector . h " <nl> + # include " tensorflow / core / lib / gtl / iterator_range . h " <nl> # include " tensorflow / core / platform / logging . h " <nl> # include " tensorflow / core / platform / macros . h " <nl> # include " tensorflow / core / platform / types . h " <nl> class HloInstruction { <nl> / / Precondition : opcode ( ) = = HloOpcode : : kFusion <nl> HloInstruction * fused_expression_root ( ) const ; <nl> <nl> - / / Returns the list of fused instructions inside this fusioninstruction . <nl> + / / Returns the list of fused instructions inside this fusion instruction . The <nl> + / / returned type is a range of HloInstruction * s . <nl> / / <nl> - / / Note : although the list itself is const , the instructions contained in the <nl> - / / list returned here are mutable . <nl> + / / Precondition : opcode ( ) = = HloOpcode : : kFusion <nl> + const tensorflow : : gtl : : iterator_range < UnwrappingIterator < <nl> + std : : list < std : : unique_ptr < HloInstruction > > : : const_iterator > > <nl> + fused_instructions ( ) const ; <nl> + <nl> + const tensorflow : : gtl : : iterator_range < <nl> + UnwrappingIterator < std : : list < std : : unique_ptr < HloInstruction > > : : iterator > > <nl> + fused_instructions ( ) ; <nl> + <nl> + / / Gets the number of instructions inside this fusion instruction . <nl> / / <nl> / / Precondition : opcode ( ) = = HloOpcode : : kFusion <nl> - const std : : list < std : : unique_ptr < HloInstruction > > & fused_instructions ( ) const ; <nl> + int64 fused_instruction_count ( ) const ; <nl> <nl> / / Returns the fused parameter instruction in this fusion instruction <nl> / / corresponding to the given parameter number . <nl> mmm a / tensorflow / compiler / xla / service / hlo_module . cc <nl> ppp b / tensorflow / compiler / xla / service / hlo_module . cc <nl> HloModule : : HloModule ( const string & name , const HloModuleConfig & config ) <nl> HloComputation * HloModule : : AddComputationInternal ( <nl> std : : unique_ptr < HloComputation > computation ) { <nl> computation - > UniquifyName ( & computation_name_uniquer_ ) ; <nl> - for ( auto & instruction : computation - > instructions ( ) ) { <nl> + for ( auto * instruction : computation - > instructions ( ) ) { <nl> instruction - > UniquifyName ( & instruction_name_uniquer_ ) ; <nl> instruction - > SetUniqueId ( NewUniqueInstructionId ( ) ) ; <nl> } <nl> void HloModule : : ReplaceComputations ( <nl> new_computations . reserve ( computations_ . size ( ) ) ; <nl> <nl> for ( std : : unique_ptr < HloComputation > & computation : computations_ ) { <nl> - for ( auto & instruction : computation - > instructions ( ) ) { <nl> + for ( auto * instruction : computation - > instructions ( ) ) { <nl> switch ( instruction - > opcode ( ) ) { <nl> case HloOpcode : : kCall : <nl> case HloOpcode : : kMap : <nl> std : : list < HloComputation * > HloModule : : MakeComputationPostOrder ( ) const { <nl> / / module ) . <nl> std : : set < HloComputation * > nonroot_computations ; <nl> for ( auto & computation : computations_ ) { <nl> - for ( auto & instruction : computation - > instructions ( ) ) { <nl> + for ( auto * instruction : computation - > instructions ( ) ) { <nl> for ( HloComputation * called_computation : <nl> instruction - > called_computations ( ) ) { <nl> nonroot_computations . insert ( called_computation ) ; <nl> std : : unique_ptr < HloModule > HloModule : : Clone ( const string & suffix ) const { <nl> } <nl> <nl> for ( auto & cloned_computation : module - > computations_ ) { <nl> - for ( auto & instruction : cloned_computation - > instructions ( ) ) { <nl> + for ( auto * instruction : cloned_computation - > instructions ( ) ) { <nl> / / Rewrite instruction ' s called_computation to point to the cloned <nl> / / computations . <nl> instruction - > ReplaceCalledComputations ( <nl> mmm a / tensorflow / compiler / xla / service / hlo_rematerialization . cc <nl> ppp b / tensorflow / compiler / xla / service / hlo_rematerialization . cc <nl> bool MemoryUsageTracker : : Check ( ) const { <nl> } ; <nl> <nl> / / Verify buffers_defined per instruction . <nl> - for ( auto & instruction : computation_ - > instructions ( ) ) { <nl> + for ( auto * instruction : computation_ - > instructions ( ) ) { <nl> const BufferIdList & defined_buffers = <nl> - instruction_list_ . GetItem ( instruction . get ( ) ) - > buffers_defined ; <nl> + instruction_list_ . GetItem ( instruction ) - > buffers_defined ; <nl> CHECK ( elements_are_unique ( defined_buffers ) ) <nl> < < " Instruction " < < instruction - > name ( ) <nl> < < " does not have unique defined buffers : " <nl> bool MemoryUsageTracker : : Check ( ) const { <nl> } ) ; <nl> <nl> for ( const Buffer & buffer : buffers_ ) { <nl> - if ( buffer . defining_instruction - > instruction = = instruction . get ( ) ) { <nl> + if ( buffer . defining_instruction - > instruction = = instruction ) { <nl> CHECK ( std : : find ( defined_buffers . begin ( ) , defined_buffers . end ( ) , <nl> buffer . id ) ! = defined_buffers . end ( ) ) <nl> < < " Instruction " < < instruction - > name ( ) <nl> bool MemoryUsageTracker : : Check ( ) const { <nl> } <nl> <nl> / / Verify buffers_used per instruction . <nl> - for ( auto & instruction : computation_ - > instructions ( ) ) { <nl> + for ( auto * instruction : computation_ - > instructions ( ) ) { <nl> const BufferIdList & used_buffers = <nl> - instruction_list_ . GetItem ( instruction . get ( ) ) - > buffers_used ; <nl> + instruction_list_ . GetItem ( instruction ) - > buffers_used ; <nl> CHECK ( elements_are_unique ( used_buffers ) ) <nl> < < " Instruction " < < instruction - > name ( ) <nl> < < " does not have unique used buffers : " <nl> StatusOr < bool > HloRematerialization : : RematerializeComputation ( <nl> <nl> / / Verify some invariants on the memory tracker . <nl> CHECK_EQ ( memory_tracker . memory_usage ( ) , 0 ) ; <nl> - for ( auto & instruction : computation - > instructions ( ) ) { <nl> - CHECK ( memory_tracker . IsPlaced ( instruction . get ( ) ) ) ; <nl> + for ( auto * instruction : computation - > instructions ( ) ) { <nl> + CHECK ( memory_tracker . IsPlaced ( instruction ) ) ; <nl> } <nl> <nl> VLOG ( 1 ) < < " In computation " < < computation - > name ( ) < < " rematerialized " <nl> StatusOr < bool > HloRematerialization : : Run ( <nl> / / order by removing the deleted instructions from the order . <nl> tensorflow : : gtl : : FlatSet < const HloInstruction * > instruction_set ; <nl> for ( const auto & instruction : computation - > instructions ( ) ) { <nl> - instruction_set . insert ( instruction . get ( ) ) ; <nl> + instruction_set . insert ( instruction ) ; <nl> } <nl> / / Move the old order into a temporary vector , then build new order <nl> / / inplace . <nl> mmm a / tensorflow / compiler / xla / service / hlo_rematerialization_test . cc <nl> ppp b / tensorflow / compiler / xla / service / hlo_rematerialization_test . cc <nl> TEST_F ( HloRematerializationTest , InstructionRematerializedMultipleTimes ) { <nl> <nl> auto count_broadcasts = [ ] ( const HloComputation * computation ) { <nl> int64 bcast_count = 0 ; <nl> - for ( auto & instruction : computation - > instructions ( ) ) { <nl> + for ( auto * instruction : computation - > instructions ( ) ) { <nl> if ( instruction - > opcode ( ) = = HloOpcode : : kBroadcast ) { <nl> bcast_count + + ; <nl> } <nl> mmm a / tensorflow / compiler / xla / service / hlo_scheduling . cc <nl> ppp b / tensorflow / compiler / xla / service / hlo_scheduling . cc <nl> class ListScheduler { <nl> / / instruction . An HLO instruction " uses " a LogicalBuffer if the <nl> / / LogicalBuffer is in an operand of the instruction as indicated by <nl> / / points - to analysis . <nl> - for ( auto & instruction : computation . instructions ( ) ) { <nl> + for ( auto * instruction : computation . instructions ( ) ) { <nl> std : : unordered_set < const LogicalBuffer * > instr_uses ; <nl> for ( auto * operand : instruction - > operands ( ) ) { <nl> for ( const LogicalBuffer * buffer : <nl> class ListScheduler { <nl> instr_uses . insert ( buffer ) ; <nl> } <nl> } <nl> - buffer_uses_ [ instruction . get ( ) ] = std : : vector < const LogicalBuffer * > ( <nl> + buffer_uses_ [ instruction ] = std : : vector < const LogicalBuffer * > ( <nl> instr_uses . begin ( ) , instr_uses . end ( ) ) ; <nl> } <nl> <nl> / / Create map containing the number of unscheduled uses ( hlo instructions ) <nl> / / of each logical buffer . <nl> - for ( auto & instruction : computation . instructions ( ) ) { <nl> - for ( auto * buffer : points_to_analysis . GetBuffersDefinedByInstruction ( <nl> - instruction . get ( ) ) ) { <nl> + for ( auto * instruction : computation . instructions ( ) ) { <nl> + for ( auto * buffer : <nl> + points_to_analysis . GetBuffersDefinedByInstruction ( instruction ) ) { <nl> unscheduled_use_count_ [ buffer ] = 0 ; <nl> } <nl> } <nl> - for ( auto & instruction : computation . instructions ( ) ) { <nl> - for ( const LogicalBuffer * buffer : buffer_uses_ . at ( instruction . get ( ) ) ) { <nl> + for ( auto * instruction : computation . instructions ( ) ) { <nl> + for ( const LogicalBuffer * buffer : buffer_uses_ . at ( instruction ) ) { <nl> + + unscheduled_use_count_ [ buffer ] ; <nl> } <nl> } <nl> class ListScheduler { <nl> / / Populate the ready list with instructions which have no operands or <nl> / / control predecessors . <nl> std : : unordered_map < const HloInstruction * , int64 > unscheduled_pred_count ; <nl> - for ( auto & instruction : computation_ . instructions ( ) ) { <nl> + for ( auto * instruction : computation_ . instructions ( ) ) { <nl> / / TODO ( b / 34466113 ) : Replace this and above with successors ( ) or <nl> / / predecessors ( ) when these methods are added to HloInstruction . <nl> for ( const HloInstruction * user : instruction - > users ( ) ) { <nl> class ListScheduler { <nl> } <nl> <nl> std : : list < ReadyListEntry > ready_list ; <nl> - for ( auto & instruction : computation_ . instructions ( ) ) { <nl> + for ( auto * instruction : computation_ . instructions ( ) ) { <nl> / / Instruction with no operands or control predecessors will <nl> / / not be in the map . <nl> - if ( unscheduled_pred_count . count ( instruction . get ( ) ) = = 0 ) { <nl> - ready_list . push_back ( MakeReadyListEntry ( instruction . get ( ) ) ) ; <nl> + if ( unscheduled_pred_count . count ( instruction ) = = 0 ) { <nl> + ready_list . push_back ( MakeReadyListEntry ( instruction ) ) ; <nl> } <nl> } <nl> <nl> class ListScheduler { <nl> update_pred_count ( succ ) ; <nl> } <nl> } <nl> - CHECK_EQ ( schedule . size ( ) , computation_ . instructions ( ) . size ( ) ) ; <nl> - CHECK_EQ ( scheduled_instructions_ . size ( ) , <nl> - computation_ . instructions ( ) . size ( ) ) ; <nl> + CHECK_EQ ( schedule . size ( ) , computation_ . instruction_count ( ) ) ; <nl> + CHECK_EQ ( scheduled_instructions_ . size ( ) , computation_ . instruction_count ( ) ) ; <nl> <nl> return schedule ; <nl> } <nl> StatusOr < std : : vector < const HloInstruction * > > RunDFSMemoryScheduler ( <nl> total_sizes [ hlo ] + = total_sizes [ operand ] ; <nl> } <nl> } <nl> - CHECK_EQ ( extra_users . size ( ) , computation . instructions ( ) . size ( ) ) ; <nl> - CHECK_EQ ( total_sizes . size ( ) , computation . instructions ( ) . size ( ) ) ; <nl> + CHECK_EQ ( extra_users . size ( ) , computation . instruction_count ( ) ) ; <nl> + CHECK_EQ ( total_sizes . size ( ) , computation . instruction_count ( ) ) ; <nl> <nl> / / Construct a total order based on DFS post - order , visiting operands in <nl> / / decreasing cumulative extra user order , and next by cumulative size , with a <nl> StatusOr < std : : vector < const HloInstruction * > > RunDFSMemoryScheduler ( <nl> } <nl> return a - > name ( ) < b - > name ( ) ; <nl> } ) ) ; <nl> - CHECK_EQ ( sequence . size ( ) , computation . instructions ( ) . size ( ) ) ; <nl> + CHECK_EQ ( sequence . size ( ) , computation . instruction_count ( ) ) ; <nl> return sequence ; <nl> } <nl> <nl> mmm a / tensorflow / compiler / xla / service / hlo_tfgraph_builder . cc <nl> ppp b / tensorflow / compiler / xla / service / hlo_tfgraph_builder . cc <nl> void CleanNodeName ( string * name ) { <nl> Status HloTfGraphBuilder : : AddComputation ( const HloComputation & computation ) { <nl> VLOG ( 2 ) < < " Adding computation " < < computation . name ( ) ; <nl> for ( auto embedded : computation . MakeEmbeddedComputationsList ( ) ) { <nl> - for ( auto & instruction : embedded - > instructions ( ) ) { <nl> - TF_RETURN_IF_ERROR ( AddInstruction ( instruction . get ( ) ) ) ; <nl> + for ( auto * instruction : embedded - > instructions ( ) ) { <nl> + TF_RETURN_IF_ERROR ( AddInstruction ( instruction ) ) ; <nl> } <nl> } <nl> - for ( auto & instruction : computation . instructions ( ) ) { <nl> - TF_RETURN_IF_ERROR ( AddInstruction ( instruction . get ( ) ) ) ; <nl> + for ( auto * instruction : computation . instructions ( ) ) { <nl> + TF_RETURN_IF_ERROR ( AddInstruction ( instruction ) ) ; <nl> } <nl> return Status : : OK ( ) ; <nl> } <nl> Status HloTfGraphBuilder : : AddInstruction ( const HloInstruction * instruction ) { <nl> node_def - > set_op ( GetOpDefName ( instruction ) ) ; <nl> SetNodeAttrs ( instruction , node_def ) ; <nl> if ( instruction - > opcode ( ) = = HloOpcode : : kFusion ) { <nl> - for ( auto & fused_instruction : instruction - > fused_instructions ( ) ) { <nl> - TF_RETURN_IF_ERROR ( AddInstruction ( fused_instruction . get ( ) ) ) ; <nl> + for ( auto * fused_instruction : instruction - > fused_instructions ( ) ) { <nl> + TF_RETURN_IF_ERROR ( AddInstruction ( fused_instruction ) ) ; <nl> } <nl> } <nl> / / Add all edges including control edges . <nl> mmm a / tensorflow / compiler / xla / service / hlo_verifier . cc <nl> ppp b / tensorflow / compiler / xla / service / hlo_verifier . cc <nl> Status HloVerifier : : CheckFusionInstruction ( HloInstruction * fusion ) const { <nl> fusion - > fused_parameters ( ) ; <nl> const HloInstruction * fused_root = fusion - > fused_expression_root ( ) ; <nl> std : : vector < bool > parameter_owned ( fused_parameters . size ( ) , false ) ; <nl> - for ( auto & instruction : fused_computation - > instructions ( ) ) { <nl> - if ( fused_root = = instruction . get ( ) ) { <nl> + for ( auto * instruction : fused_computation - > instructions ( ) ) { <nl> + if ( fused_root = = instruction ) { <nl> if ( root_owned ) { <nl> return FailedPrecondition ( " Root appears more than once in % s . " , <nl> fusion - > ToString ( ) . c_str ( ) ) ; <nl> Status HloVerifier : : CheckFusionInstruction ( HloInstruction * fusion ) const { <nl> root_owned = true ; <nl> } <nl> for ( int i = 0 ; i < fused_parameters . size ( ) ; + + i ) { <nl> - if ( fused_parameters [ i ] = = instruction . get ( ) ) { <nl> + if ( fused_parameters [ i ] = = instruction ) { <nl> if ( parameter_owned [ i ] ) { <nl> return FailedPrecondition ( " Parameter appears more than once in % s . " , <nl> fusion - > ToString ( ) . c_str ( ) ) ; <nl> Status HloVerifier : : CheckFusionInstruction ( HloInstruction * fusion ) const { <nl> <nl> / / All uses of fused instructions must be in the fusion computation , and every <nl> / / non - root instruction must have at least one use . <nl> - for ( auto & instruction : <nl> + for ( auto * instruction : <nl> fusion - > fused_instructions_computation ( ) - > instructions ( ) ) { <nl> - if ( instruction . get ( ) ! = fused_root ) { <nl> + if ( instruction ! = fused_root ) { <nl> if ( instruction - > user_count ( ) = = 0 ) { <nl> return FailedPrecondition ( <nl> " Non - root instruction % s in % s must have users . " , <nl> StatusOr < bool > HloVerifier : : Run ( HloModule * module ) { <nl> for ( const auto & instruction : computation - > instructions ( ) ) { <nl> TF_RET_CHECK ( instruction - > parent ( ) = = computation . get ( ) ) ; <nl> if ( instruction - > opcode ( ) = = HloOpcode : : kFusion ) { <nl> - TF_RETURN_IF_ERROR ( CheckFusionInstruction ( instruction . get ( ) ) ) ; <nl> + TF_RETURN_IF_ERROR ( CheckFusionInstruction ( instruction ) ) ; <nl> TF_RET_CHECK ( <nl> ContainersEqual ( instruction - > called_computations ( ) , <nl> { instruction - > fused_instructions_computation ( ) } ) ) <nl> StatusOr < bool > HloVerifier : : Run ( HloModule * module ) { <nl> < < " \ nPrevious HLO with same name : \ n " <nl> < < previous - > second - > ToString ( ) <nl> < < " in computation : " < < previous - > second - > parent ( ) - > name ( ) ; <nl> - instructions [ instruction - > name ( ) ] = instruction . get ( ) ; <nl> + instructions [ instruction - > name ( ) ] = instruction ; <nl> } <nl> <nl> TF_RETURN_IF_ERROR ( computation - > Accept ( & shape_verifier ) ) ; <nl> mmm a / tensorflow / compiler / xla / service / layout_assignment . cc <nl> ppp b / tensorflow / compiler / xla / service / layout_assignment . cc <nl> string ResultLayoutConstraint : : ToString ( ) const { <nl> <nl> LayoutConstraints : : LayoutConstraints ( <nl> const TuplePointsToAnalysis & points_to_analysis , <nl> - const HloComputation * computation ) <nl> + HloComputation * computation ) <nl> : points_to_analysis_ ( points_to_analysis ) , computation_ ( computation ) { <nl> / / Gather all array - shaped logical buffers into unconstrained_buffer_ids . <nl> for ( LogicalBuffer : : Id id = 0 ; id < points_to_analysis_ . num_logical_buffers ( ) ; <nl> Status LayoutAssignment : : AddMandatoryConstraints ( <nl> <nl> / / Constrain layouts of instructions which define values with pre - existing <nl> / / layouts . <nl> - for ( auto & instruction : computation - > instructions ( ) ) { <nl> + for ( auto * instruction : computation - > instructions ( ) ) { <nl> Shape const * shape_with_layout = nullptr ; <nl> if ( instruction - > opcode ( ) = = HloOpcode : : kInfeed ) { <nl> / / Infeed layouts must match the layout of the original inserted <nl> Status LayoutAssignment : : AddMandatoryConstraints ( <nl> / / TODO ( b / 31425034 ) : Change infeeds to be more like parameters , with <nl> / / shapes in the ComputationLayout . <nl> DCHECK ( ! LayoutUtil : : IsPadded ( instruction - > shape ( ) ) ) ; <nl> - TF_RETURN_IF_ERROR ( constraints - > SetInstructionLayout ( instruction - > shape ( ) , <nl> - instruction . get ( ) ) ) ; <nl> + TF_RETURN_IF_ERROR ( <nl> + constraints - > SetInstructionLayout ( instruction - > shape ( ) , instruction ) ) ; <nl> } else if ( instruction - > opcode ( ) = = HloOpcode : : kOutfeed ) { <nl> / / Constrain the input to the Outfeed instruction to be the expected <nl> / / layout of the Outfeed . <nl> TF_RETURN_IF_ERROR ( constraints - > SetOperandLayout ( <nl> - instruction - > outfeed_shape ( ) , instruction . get ( ) , 0 , <nl> + instruction - > outfeed_shape ( ) , instruction , 0 , <nl> / * mandatory = * / true ) ) ; <nl> } else if ( instruction - > opcode ( ) = = HloOpcode : : kParameter ) { <nl> / / Parameter layouts must match the respective layout in <nl> Status LayoutAssignment : : AddMandatoryConstraints ( <nl> . shape ( ) ; <nl> } <nl> if ( shape_with_layout ! = nullptr ) { <nl> - TF_RETURN_IF_ERROR ( constraints - > SetInstructionLayout ( * shape_with_layout , <nl> - instruction . get ( ) ) ) ; <nl> + TF_RETURN_IF_ERROR ( <nl> + constraints - > SetInstructionLayout ( * shape_with_layout , instruction ) ) ; <nl> } <nl> } <nl> <nl> Status LayoutAssignment : : AddMandatoryConstraints ( <nl> / / already been assigned layouts . Instructions which call computations in a <nl> / / parallel element - wise context ( eg , map or reduce ) do not need layout <nl> / / constraints because they operate on scalars . <nl> - for ( auto & instruction : computation - > instructions ( ) ) { <nl> + for ( auto * instruction : computation - > instructions ( ) ) { <nl> if ( instruction - > opcode ( ) = = HloOpcode : : kCall ) { <nl> / / kCall instruction operands and output must match the ComputationLayout <nl> / / of the called computation . <nl> const ComputationLayout & called_computation_layout = <nl> FindOrDie ( computation_layouts_ , instruction - > to_apply ( ) ) ; <nl> TF_RETURN_IF_ERROR ( constraints - > SetInstructionLayout ( <nl> - called_computation_layout . result_layout ( ) . shape ( ) , <nl> - instruction . get ( ) ) ) ; <nl> + called_computation_layout . result_layout ( ) . shape ( ) , instruction ) ) ; <nl> TF_RET_CHECK ( instruction - > operand_count ( ) = = <nl> called_computation_layout . parameter_count ( ) ) ; <nl> for ( int64 i = 0 ; i < instruction - > operand_count ( ) ; + + i ) { <nl> TF_RETURN_IF_ERROR ( constraints - > SetOperandLayout ( <nl> - called_computation_layout . parameter_layout ( i ) . shape ( ) , <nl> - instruction . get ( ) , i , / * mandatory = * / true ) ) ; <nl> + called_computation_layout . parameter_layout ( i ) . shape ( ) , instruction , <nl> + i , / * mandatory = * / true ) ) ; <nl> } <nl> } else if ( instruction - > opcode ( ) = = HloOpcode : : kWhile ) { <nl> / / Layout of input and output of kWhile instruction must be equal and must <nl> Status LayoutAssignment : : AddMandatoryConstraints ( <nl> / / Constrain the output and the operand of the while instruction to match <nl> / / the computations . <nl> TF_RETURN_IF_ERROR ( constraints - > SetInstructionLayout ( <nl> - body_layout . result_shape ( ) , instruction . get ( ) ) ) ; <nl> + body_layout . result_shape ( ) , instruction ) ) ; <nl> TF_RETURN_IF_ERROR ( constraints - > SetOperandLayout ( <nl> - body_layout . result_shape ( ) , instruction . get ( ) , 0 , <nl> + body_layout . result_shape ( ) , instruction , 0 , <nl> / * mandatory = * / true ) ) ; <nl> } else if ( instruction - > opcode ( ) = = HloOpcode : : kCustomCall ) { <nl> / / Add constraints for kCustomCall instruction operands and instructions . <nl> Status LayoutAssignment : : AddMandatoryConstraints ( <nl> <nl> Shape result_shape ( row_major_shape ( instruction - > shape ( ) ) ) ; <nl> TF_RETURN_IF_ERROR ( <nl> - constraints - > SetInstructionLayout ( result_shape , instruction . get ( ) ) ) ; <nl> + constraints - > SetInstructionLayout ( result_shape , instruction ) ) ; <nl> for ( int64 i = 0 ; i < instruction - > operand_count ( ) ; + + i ) { <nl> const Shape & operand_shape = instruction - > operand ( i ) - > shape ( ) ; <nl> / / Opaque operands don ' t get a layout constraint . <nl> Status LayoutAssignment : : AddMandatoryConstraints ( <nl> <nl> Shape row_major_operand_shape ( row_major_shape ( operand_shape ) ) ; <nl> TF_RETURN_IF_ERROR ( constraints - > SetOperandLayout ( <nl> - row_major_operand_shape , instruction . get ( ) , i , / * mandatory = * / true ) ) ; <nl> + row_major_operand_shape , instruction , i , / * mandatory = * / true ) ) ; <nl> } <nl> } <nl> } <nl> Status CheckLayouts ( <nl> if ( computation - > IsFusionComputation ( ) ) { <nl> continue ; <nl> } <nl> - for ( auto & instruction : computation - > instructions ( ) ) { <nl> + for ( auto * instruction : computation - > instructions ( ) ) { <nl> / / Verify every instruction has a layout and the layout is valid for the <nl> / / shape . <nl> TF_RET_CHECK ( LayoutUtil : : HasLayout ( instruction - > shape ( ) ) ) ; <nl> Status CheckLayouts ( <nl> / / output of the instruction matches the layout of the logical buffer <nl> / / which could be the source of the subshape value . <nl> const PointsToSet & points_to_set = <nl> - points_to_analysis - > GetPointsToSet ( instruction . get ( ) ) ; <nl> + points_to_analysis - > GetPointsToSet ( instruction ) ; <nl> TF_RETURN_IF_ERROR ( points_to_set . ForEachElementWithStatus ( <nl> [ & instruction ] ( ShapeIndex index , <nl> const PointsToSet : : BufferList & buffers ) - > Status { <nl> Status CheckLayouts ( <nl> switch ( instruction - > opcode ( ) ) { <nl> case HloOpcode : : kCall : <nl> TF_RETURN_IF_ERROR ( CheckCallLayout ( <nl> - instruction . get ( ) , <nl> + instruction , <nl> FindOrDie ( computation_layouts , instruction - > to_apply ( ) ) ) ) ; <nl> break ; <nl> case HloOpcode : : kCustomCall : <nl> - TF_RETURN_IF_ERROR ( CheckCustomCallLayout ( instruction . get ( ) ) ) ; <nl> + TF_RETURN_IF_ERROR ( CheckCustomCallLayout ( instruction ) ) ; <nl> break ; <nl> case HloOpcode : : kFusion : <nl> - TF_RETURN_IF_ERROR ( CheckFusionLayout ( instruction . get ( ) ) ) ; <nl> + TF_RETURN_IF_ERROR ( CheckFusionLayout ( instruction ) ) ; <nl> break ; <nl> case HloOpcode : : kParameter : <nl> TF_RETURN_IF_ERROR ( CheckParameterLayout ( <nl> - instruction . get ( ) , <nl> + instruction , <nl> FindOrDie ( computation_layouts , instruction - > parent ( ) ) ) ) ; <nl> break ; <nl> case HloOpcode : : kConstant : <nl> - TF_RETURN_IF_ERROR ( CheckConstantLayout ( instruction . get ( ) ) ) ; <nl> + TF_RETURN_IF_ERROR ( CheckConstantLayout ( instruction ) ) ; <nl> break ; <nl> case HloOpcode : : kWhile : <nl> TF_RETURN_IF_ERROR ( CheckWhileLayout ( <nl> - instruction . get ( ) , <nl> + instruction , <nl> FindOrDie ( computation_layouts , instruction - > while_condition ( ) ) , <nl> FindOrDie ( computation_layouts , instruction - > while_body ( ) ) ) ) ; <nl> break ; <nl> Status CopyOperandIfLayoutsDiffer ( const ShapeLayout & operand_layout , <nl> / / element array pointer load can be added . <nl> Status SetFusionLayouts ( HloInstruction * fusion ) { <nl> TF_RET_CHECK ( fusion - > opcode ( ) = = HloOpcode : : kFusion ) ; <nl> - for ( auto & fused_instruction : fusion - > fused_instructions ( ) ) { <nl> + for ( auto * fused_instruction : fusion - > fused_instructions ( ) ) { <nl> if ( fused_instruction - > opcode ( ) = = HloOpcode : : kParameter ) { <nl> const HloInstruction * fusion_operand = <nl> fusion - > operand ( fused_instruction - > parameter_number ( ) ) ; <nl> Status SetFusionLayouts ( HloInstruction * fusion ) { <nl> fused_instruction - > shape ( ) ) ) ; <nl> TF_RETURN_IF_ERROR ( LayoutUtil : : CopyLayoutBetweenShapes ( <nl> fusion_operand - > shape ( ) , fused_instruction - > mutable_shape ( ) ) ) ; <nl> - } else if ( fused_instruction . get ( ) = = fusion - > fused_expression_root ( ) ) { <nl> + } else if ( fused_instruction = = fusion - > fused_expression_root ( ) ) { <nl> / / The layout of the root of the fused expression must match the fusion <nl> / / instruction layout . <nl> DCHECK ( <nl> mmm a / tensorflow / compiler / xla / service / layout_assignment . h <nl> ppp b / tensorflow / compiler / xla / service / layout_assignment . h <nl> class ResultLayoutConstraint : public LayoutConstraint { <nl> class LayoutConstraints { <nl> public : <nl> LayoutConstraints ( const TuplePointsToAnalysis & points_to_analysis , <nl> - const HloComputation * computation ) ; <nl> + HloComputation * computation ) ; <nl> ~ LayoutConstraints ( ) = default ; <nl> <nl> const HloComputation * computation ( ) const { return computation_ ; } <nl> + HloComputation * computation ( ) { return computation_ ; } <nl> const TuplePointsToAnalysis & points_to_analysis ( ) const { <nl> return points_to_analysis_ ; <nl> } <nl> class LayoutConstraints { <nl> / / Array - shaped buffers which have not yet been constrained . <nl> std : : set < LogicalBuffer : : Id > unconstrained_buffer_ids_ ; <nl> <nl> - const HloComputation * computation_ ; <nl> + HloComputation * computation_ ; <nl> } ; <nl> <nl> / / HLO pass which assigns layouts to all instructions in the HLO module while <nl> mmm a / tensorflow / compiler / xla / service / logical_buffer_analysis . cc <nl> ppp b / tensorflow / compiler / xla / service / logical_buffer_analysis . cc <nl> Status LogicalBufferAnalysis : : Analyze ( ) { <nl> continue ; <nl> } <nl> TF_RETURN_IF_ERROR ( computation - > Accept ( this ) ) ; <nl> - for ( auto & instruction : computation - > instructions ( ) ) { <nl> + for ( auto * instruction : computation - > instructions ( ) ) { <nl> if ( instruction - > opcode ( ) ! = HloOpcode : : kFusion ) { <nl> continue ; <nl> } <nl> mmm a / tensorflow / compiler / xla / service / reduce_precision_insertion . cc <nl> ppp b / tensorflow / compiler / xla / service / reduce_precision_insertion . cc <nl> std : : vector < HloInstruction * > ReducePrecisionInsertion : : instructions_to_modify ( <nl> case HloReducePrecisionOptions : : OP_INPUTS : <nl> case HloReducePrecisionOptions : : OP_OUTPUTS : <nl> case HloReducePrecisionOptions : : UNFUSED_OP_OUTPUTS : <nl> - for ( auto & instruction : computation - > instructions ( ) ) { <nl> + for ( auto * instruction : computation - > instructions ( ) ) { <nl> VLOG ( 4 ) < < " Visited instruction : " < < instruction - > ToString ( ) ; <nl> - if ( instruction_filter_function_ ( instruction . get ( ) ) ) { <nl> - instruction_list . push_back ( instruction . get ( ) ) ; <nl> + if ( instruction_filter_function_ ( instruction ) ) { <nl> + instruction_list . push_back ( instruction ) ; <nl> } <nl> } <nl> break ; <nl> <nl> case HloReducePrecisionOptions : : FUSION_INPUTS_BY_CONTENT : <nl> case HloReducePrecisionOptions : : FUSION_OUTPUTS_BY_CONTENT : <nl> - for ( auto & instruction : computation - > instructions ( ) ) { <nl> + for ( auto * instruction : computation - > instructions ( ) ) { <nl> VLOG ( 4 ) < < " Visited instruction : " < < instruction - > ToString ( ) ; <nl> if ( instruction - > opcode ( ) ! = HloOpcode : : kFusion ) { <nl> continue ; <nl> } <nl> - for ( auto & fused_instruction : <nl> + for ( auto * fused_instruction : <nl> instruction - > fused_instructions_computation ( ) - > instructions ( ) ) { <nl> VLOG ( 4 ) < < " Checking sub - instruction : " <nl> < < fused_instruction - > ToString ( ) ; <nl> - if ( instruction_filter_function_ ( fused_instruction . get ( ) ) ) { <nl> - instruction_list . push_back ( instruction . get ( ) ) ; <nl> + if ( instruction_filter_function_ ( fused_instruction ) ) { <nl> + instruction_list . push_back ( instruction ) ; <nl> break ; <nl> } <nl> } <nl> mmm a / tensorflow / compiler / xla / service / transpose_folding_test . cc <nl> ppp b / tensorflow / compiler / xla / service / transpose_folding_test . cc <nl> TEST_F ( TransposeFoldingTest , FoldDotTranspose ) { <nl> FoldTranspose ( & module ) ; <nl> <nl> / / Instructions after folding : x , y , and the fusion . <nl> - std : : unordered_set < HloInstruction * > instruction_set ; <nl> - for ( auto & instruction : entry_computation - > instructions ( ) ) { <nl> - instruction_set . insert ( instruction . get ( ) ) ; <nl> - } <nl> + std : : unordered_set < HloInstruction * > instruction_set ( <nl> + entry_computation - > instructions ( ) . begin ( ) , <nl> + entry_computation - > instructions ( ) . end ( ) ) ; <nl> CHECK_EQ ( 1 , instruction_set . erase ( x ) ) < < " x is not in entry_computation . " ; <nl> CHECK_EQ ( 1 , instruction_set . erase ( y ) ) < < " y is not in entry_computation . " ; <nl> CHECK_EQ ( 1 , instruction_set . size ( ) ) <nl> TEST_F ( TransposeFoldingTest , FoldDotTranspose ) { <nl> <nl> / / The fusion instruction should contain two parameters , one transpose and <nl> / / one dot . <nl> - EXPECT_EQ ( 4 , fusion - > fused_instructions ( ) . size ( ) ) ; <nl> + EXPECT_EQ ( 4 , fusion - > fused_instruction_count ( ) ) ; <nl> } <nl> <nl> TEST_F ( TransposeFoldingTest , FoldDotTransposeConstant ) { <nl> TEST_F ( TransposeFoldingTest , FoldDotTransposeConstant ) { <nl> module . AddEntryComputation ( builder . Build ( dot ) ) ; <nl> FoldTranspose ( & module ) ; <nl> <nl> - for ( auto & instruction : entry_computation - > instructions ( ) ) { <nl> + for ( auto * instruction : entry_computation - > instructions ( ) ) { <nl> if ( instruction - > opcode ( ) = = HloOpcode : : kFusion ) { <nl> CHECK_EQ ( 2 , instruction - > operand_count ( ) ) ; <nl> EXPECT_EQ ( const0 , instruction - > operand ( 0 ) ) ; <nl> TEST_F ( TransposeFoldingTest , FoldDotTransposeConstant ) { <nl> / / The created fusion instruction should contain two parameters , two <nl> / / transposes ( one for each parameter ) and one dot . <nl> EXPECT_EQ ( 5 , <nl> - entry_computation - > root_instruction ( ) - > fused_instructions ( ) . size ( ) ) ; <nl> + entry_computation - > root_instruction ( ) - > fused_instruction_count ( ) ) ; <nl> } <nl> <nl> TEST_F ( TransposeFoldingTest , FuseDotWithConstantOperands ) { <nl> TEST_F ( TransposeFoldingTest , FuseDotWithConstantOperands ) { <nl> : : testing : : UnorderedElementsAre ( const1 , const2 , const3 ) ) ; <nl> <nl> / / The callee should contain 3 parameters and 3 binary operators . <nl> - EXPECT_EQ ( 6 , callee_computation - > instructions ( ) . size ( ) ) ; <nl> + EXPECT_EQ ( 6 , callee_computation - > instruction_count ( ) ) ; <nl> } <nl> <nl> TEST_F ( TransposeFoldingTest , FoldDotTransposeInWhile ) { <nl> TEST_F ( TransposeFoldingTest , FoldDotTransposeInWhile ) { <nl> FoldTranspose ( & module ) ; <nl> <nl> / / Instructions after folding : x , y , and the fusion . <nl> - std : : unordered_set < HloInstruction * > instruction_set ; <nl> - for ( auto & instruction : entry_computation - > instructions ( ) ) { <nl> - instruction_set . insert ( instruction . get ( ) ) ; <nl> - } <nl> + std : : unordered_set < HloInstruction * > instruction_set ( <nl> + entry_computation - > instructions ( ) . begin ( ) , <nl> + entry_computation - > instructions ( ) . end ( ) ) ; <nl> CHECK_EQ ( 1 , instruction_set . erase ( x ) ) < < " x is not in entry_computation . " ; <nl> CHECK_EQ ( 1 , instruction_set . erase ( y ) ) < < " y is not in entry_computation . " ; <nl> CHECK_EQ ( 1 , instruction_set . erase ( call ) ) <nl> TEST_F ( TransposeFoldingTest , FoldDotTransposeInWhile ) { <nl> <nl> / / The fusion instruction should contain two parameters , one transpose and <nl> / / one dot . <nl> - EXPECT_EQ ( 4 , fusion - > fused_instructions ( ) . size ( ) ) ; <nl> + EXPECT_EQ ( 4 , fusion - > fused_instruction_count ( ) ) ; <nl> } <nl> <nl> / / Test that a two dimension swap of the kernel gets folded into convolution . <nl> TEST_F ( TransposeFoldingTest , FoldConvDimSwapTransposeRhs ) { <nl> FoldTranspose ( & module ) ; <nl> <nl> / / Instructions after folding : x , y , and the convolution . <nl> - std : : unordered_set < HloInstruction * > instruction_set ; <nl> - for ( auto & instruction : entry_computation - > instructions ( ) ) { <nl> - instruction_set . insert ( instruction . get ( ) ) ; <nl> - } <nl> + std : : unordered_set < HloInstruction * > instruction_set ( <nl> + entry_computation - > instructions ( ) . begin ( ) , <nl> + entry_computation - > instructions ( ) . end ( ) ) ; <nl> CHECK_EQ ( 1 , instruction_set . erase ( x ) ) < < " x is not in entry_computation . " ; <nl> CHECK_EQ ( 1 , instruction_set . erase ( y ) ) < < " y is not in entry_computation . " ; <nl> CHECK_EQ ( 1 , instruction_set . size ( ) ) <nl> TEST_F ( TransposeFoldingTest , FoldConvComplexTransposeRhs ) { <nl> FoldTranspose ( & module ) ; <nl> <nl> / / Instructions after folding : x , y , and the convolution . <nl> - std : : unordered_set < HloInstruction * > instruction_set ; <nl> - for ( auto & instruction : entry_computation - > instructions ( ) ) { <nl> - instruction_set . insert ( instruction . get ( ) ) ; <nl> - } <nl> + std : : unordered_set < HloInstruction * > instruction_set ( <nl> + entry_computation - > instructions ( ) . begin ( ) , <nl> + entry_computation - > instructions ( ) . end ( ) ) ; <nl> CHECK_EQ ( 1 , instruction_set . erase ( x ) ) < < " x is not in entry_computation . " ; <nl> CHECK_EQ ( 1 , instruction_set . erase ( y ) ) < < " y is not in entry_computation . " ; <nl> CHECK_EQ ( 1 , instruction_set . size ( ) ) <nl> TEST_F ( TransposeFoldingTest , FoldConvTransposeLhs ) { <nl> FoldTranspose ( & module ) ; <nl> <nl> / / Instructions after folding : transpose_x , y , and the convolution . <nl> - std : : unordered_set < HloInstruction * > instruction_set ; <nl> - for ( auto & instruction : entry_computation - > instructions ( ) ) { <nl> - instruction_set . insert ( instruction . get ( ) ) ; <nl> - } <nl> + std : : unordered_set < HloInstruction * > instruction_set ( <nl> + entry_computation - > instructions ( ) . begin ( ) , <nl> + entry_computation - > instructions ( ) . end ( ) ) ; <nl> CHECK_EQ ( 1 , instruction_set . erase ( x ) ) < < " x is not in entry_computation . " ; <nl> CHECK_EQ ( 1 , instruction_set . erase ( y ) ) < < " y is not in entry_computation . " ; <nl> CHECK_EQ ( 1 , instruction_set . erase ( transpose_x ) ) <nl> mmm a / tensorflow / compiler / xla / service / tuple_points_to_analysis . cc <nl> ppp b / tensorflow / compiler / xla / service / tuple_points_to_analysis . cc <nl> Status TuplePointsToAnalysis : : Analyze ( ) { <nl> TF_RETURN_IF_ERROR ( <nl> PopulateDefinedBuffersAndAliases ( computation - > instructions ( ) ) ) ; <nl> / / Run points - to analysis on fusion instructions in ' computation ' . <nl> - for ( auto & instruction : computation - > instructions ( ) ) { <nl> + for ( auto * instruction : computation - > instructions ( ) ) { <nl> if ( instruction - > opcode ( ) ! = HloOpcode : : kFusion ) { <nl> continue ; <nl> } <nl> Status TuplePointsToAnalysis : : Analyze ( ) { <nl> return Status : : OK ( ) ; <nl> } <nl> <nl> - Status TuplePointsToAnalysis : : PopulateDefinedBuffersAndAliases ( <nl> - const std : : list < std : : unique_ptr < HloInstruction > > & instructions ) { <nl> - for ( auto & instruction : instructions ) { <nl> - PerInstruction * pi = PerInst ( instruction . get ( ) ) ; <nl> + Status TuplePointsToAnalysis : : PopulateDefinedBuffersAndAliases ( const decltype ( <nl> + std : : declval < HloComputation > ( ) . instructions ( ) ) & instructions ) { <nl> + for ( auto * instruction : instructions ) { <nl> + PerInstruction * pi = PerInst ( instruction ) ; <nl> TF_RETURN_IF_ERROR ( GatherBuffersDefinedByInstruction ( <nl> - instruction . get ( ) , & pi - > instruction_defined_buffers ) ) ; <nl> + instruction , & pi - > instruction_defined_buffers ) ) ; <nl> <nl> - const PointsToSet & points_to_set = GetPointsToSet ( instruction . get ( ) ) ; <nl> + const PointsToSet & points_to_set = GetPointsToSet ( instruction ) ; <nl> points_to_set . ForEachElement ( <nl> [ this , & instruction ] ( <nl> const ShapeIndex & index , <nl> const PointsToSet : : BufferList & pointed_to_buffers ) { <nl> for ( const LogicalBuffer * buffer : pointed_to_buffers ) { <nl> - logical_buffer_aliases_ [ buffer - > id ( ) ] . emplace_back ( <nl> - instruction . get ( ) , index ) ; <nl> + logical_buffer_aliases_ [ buffer - > id ( ) ] . emplace_back ( instruction , <nl> + index ) ; <nl> } <nl> } ) ; <nl> } <nl> string TuplePointsToAnalysis : : ToString ( ) const { <nl> computation - > MakeInstructionPostOrder ( ) ) { <nl> InstructionToString ( instruction , & output ) ; <nl> if ( instruction - > opcode ( ) = = HloOpcode : : kFusion ) { <nl> - for ( auto & fused : instruction - > fused_instructions ( ) ) { <nl> - InstructionToString ( fused . get ( ) , & output ) ; <nl> + for ( auto * fused : instruction - > fused_instructions ( ) ) { <nl> + InstructionToString ( fused , & output ) ; <nl> } <nl> } <nl> } <nl> mmm a / tensorflow / compiler / xla / service / tuple_points_to_analysis . h <nl> ppp b / tensorflow / compiler / xla / service / tuple_points_to_analysis . h <nl> class TuplePointsToAnalysis : public DfsHloVisitorWithDefault { <nl> Status Analyze ( ) ; <nl> <nl> / / Populates instruction - defined buffers and aliases for each instruction <nl> - / / in ' instructions ' . The parameter ' instructions ' is passed in a form <nl> - / / common to how both HloComputation , and fusion instructions maintain a <nl> - / / list of instructions . <nl> - Status PopulateDefinedBuffersAndAliases ( <nl> - const std : : list < std : : unique_ptr < HloInstruction > > & instructions ) ; <nl> + / / in ' instructions ' . <nl> + Status PopulateDefinedBuffersAndAliases ( const decltype ( <nl> + std : : declval < HloComputation > ( ) . instructions ( ) ) & instructions ) ; <nl> <nl> / / Creates an empty PointsToSet in the points_to_ map for the given <nl> / / instruction . <nl> mmm a / tensorflow / compiler / xla / service / tuple_points_to_analysis_test . cc <nl> ppp b / tensorflow / compiler / xla / service / tuple_points_to_analysis_test . cc <nl> class FusionPointsToAnalysisTest : public TuplePointsToAnalysisTest { <nl> HloInstruction * operand ) { <nl> auto it = std : : find_if ( <nl> fusion - > fused_instructions ( ) . begin ( ) , <nl> - fusion - > fused_instructions ( ) . end ( ) , <nl> - [ = ] ( const std : : unique_ptr < HloInstruction > & fused ) { <nl> + fusion - > fused_instructions ( ) . end ( ) , [ = ] ( const HloInstruction * fused ) { <nl> return fused - > opcode ( ) = = HloOpcode : : kParameter & & <nl> fusion - > operand ( fused - > parameter_number ( ) ) = = operand ; <nl> } ) ; <nl> CHECK ( it ! = fusion - > fused_instructions ( ) . end ( ) ) ; <nl> - return ( * it ) . get ( ) ; <nl> + return * it ; <nl> } <nl> <nl> / / Returns all users of ' fusion_paran ' at ' tuple_index ' . <nl> mmm a / tensorflow / compiler / xla / service / tuple_simplifier . cc <nl> ppp b / tensorflow / compiler / xla / service / tuple_simplifier . cc <nl> StatusOr < bool > TupleSimplifier : : Run ( HloModule * module ) { <nl> / / Initially add all GTE and Tuple instructions to the worklist . <nl> std : : queue < HloInstruction * > worklist ; <nl> for ( auto & computation : module - > computations ( ) ) { <nl> - for ( auto & instruction : computation - > instructions ( ) ) { <nl> + for ( auto * instruction : computation - > instructions ( ) ) { <nl> if ( instruction - > opcode ( ) = = HloOpcode : : kTuple | | <nl> instruction - > opcode ( ) = = HloOpcode : : kGetTupleElement ) { <nl> - worklist . push ( instruction . get ( ) ) ; <nl> + worklist . push ( instruction ) ; <nl> } <nl> } <nl> } <nl> mmm a / tensorflow / compiler / xla / tests / fusion_test . cc <nl> ppp b / tensorflow / compiler / xla / tests / fusion_test . cc <nl> XLA_TEST_F ( FusionTest , SharedConstant ) { <nl> HloComputation * entry_comp = hlo_module - > entry_computation ( ) ; <nl> <nl> / / entry computation contains the constant ( 0 ) and the fusion <nl> - EXPECT_EQ ( entry_comp - > instructions ( ) . size ( ) , 2 ) ; <nl> + EXPECT_EQ ( entry_comp - > instruction_count ( ) , 2 ) ; <nl> <nl> / / fused instruction contains the constant ( 2 ) , the parameter , and 4 adds <nl> - EXPECT_EQ ( entry_comp - > root_instruction ( ) - > fused_instructions ( ) . size ( ) , 6 ) ; <nl> + EXPECT_EQ ( entry_comp - > root_instruction ( ) - > fused_instruction_count ( ) , 6 ) ; <nl> <nl> LiteralTestUtil : : ExpectEqual ( * Literal : : CreateR1 < int32 > ( { 8 } ) , <nl> * ExecuteAndTransfer ( std : : move ( hlo_module ) , { } ) ) ; <nl> | [ XLA ] Make HloComputation : : instructions ( ) return a view of HloInstruction * s . | tensorflow/tensorflow | 9b1b5d85b9ce3c812dc772da1f3f5d09581e5b49 | 2017-09-29T06:14:07Z |
mmm a / xbmc / interfaces / legacy / Dialog . cpp <nl> ppp b / xbmc / interfaces / legacy / Dialog . cpp <nl> namespace XBMCAddon <nl> if ( ! shares ) <nl> throw WindowException ( " Error : GetSources given % s is NULL . " , s_shares . c_str ( ) ) ; <nl> <nl> - if ( useFileDirectories & & ( ! maskparam . empty ( ) & & maskparam . size ( ) ! = 0 ) ) <nl> + if ( useFileDirectories & & ! maskparam . empty ( ) ) <nl> mask + = " | . rar | . zip " ; <nl> <nl> value = defaultt ; <nl> namespace XBMCAddon <nl> if ( ! shares ) <nl> throw WindowException ( " Error : GetSources given % s is NULL . " , s_shares . c_str ( ) ) ; <nl> <nl> - if ( useFileDirectories & & ( ! lmask . empty ( ) & & ! ( lmask . size ( ) = = 0 ) ) ) <nl> + if ( useFileDirectories & & ! lmask . empty ( ) ) <nl> lmask + = " | . rar | . zip " ; <nl> <nl> if ( type = = 1 ) <nl> | optimize two if conditions | xbmc/xbmc | 43d46392ead4c6dc271a778bc41f028e2f284b08 | 2014-05-10T05:59:53Z |
mmm a / src / core / channel / channel_args . c <nl> ppp b / src / core / channel / channel_args . c <nl> grpc_channel_args * grpc_channel_args_set_compression_algorithm ( <nl> return grpc_channel_args_copy_and_add ( a , & tmp , 1 ) ; <nl> } <nl> <nl> - / * * Returns the compression algorithm ' s enabled states bitset from \ a a . If not <nl> - * found , return a biset with all algorithms enabled * / <nl> - static gpr_uint32 find_compression_algorithm_states_bitset ( <nl> - const grpc_channel_args * a ) { <nl> - gpr_uint32 states_bitset = ( 1u < < GRPC_COMPRESS_ALGORITHMS_COUNT ) - 1 ; <nl> + / * * Returns 1 if the argument for compression algorithm ' s enabled states bitset <nl> + * was found in \ a a , returning the arg ' s value in \ a states . Otherwise , returns <nl> + * 0 . * / <nl> + static int find_compression_algorithm_states_bitset ( <nl> + const grpc_channel_args * a , int * * states_arg ) { <nl> if ( a ! = NULL ) { <nl> size_t i ; <nl> for ( i = 0 ; i < a - > num_args ; + + i ) { <nl> if ( a - > args [ i ] . type = = GRPC_ARG_INTEGER & & <nl> ! strcmp ( GRPC_COMPRESSION_ALGORITHM_STATE_ARG , a - > args [ i ] . key ) ) { <nl> - states_bitset = a - > args [ i ] . value . integer ; <nl> - break ; <nl> + * states_arg = & a - > args [ i ] . value . integer ; <nl> + return 1 ; / * GPR_TRUE * / <nl> } <nl> } <nl> } <nl> - return states_bitset ; <nl> + return 0 ; / * GPR_FALSE * / <nl> } <nl> <nl> grpc_channel_args * grpc_channel_args_compression_algorithm_set_state ( <nl> grpc_channel_args * a , <nl> grpc_compression_algorithm algorithm , <nl> int state ) { <nl> - gpr_uint32 states_bitset = find_compression_algorithm_states_bitset ( a ) ; <nl> - grpc_arg tmp ; <nl> + int * states_arg ; <nl> + grpc_channel_args * result = a ; <nl> + const int states_arg_found = <nl> + find_compression_algorithm_states_bitset ( a , & states_arg ) ; <nl> + <nl> + if ( ! states_arg_found ) { <nl> + / * create a new arg * / <nl> + grpc_arg tmp ; <nl> + tmp . type = GRPC_ARG_INTEGER ; <nl> + tmp . key = GRPC_COMPRESSION_ALGORITHM_STATE_ARG ; <nl> + states_arg = & tmp . value . integer ; <nl> + result = grpc_channel_args_copy_and_add ( a , & tmp , 1 ) ; <nl> + } <nl> <nl> + / * update either the new arg ' s value or the already present one * / <nl> if ( state ! = 0 ) { <nl> - GPR_BITSET ( & states_bitset , algorithm ) ; <nl> + GPR_BITSET ( states_arg , algorithm ) ; <nl> } else { <nl> - GPR_BITCLEAR ( & states_bitset , algorithm ) ; <nl> + GPR_BITCLEAR ( states_arg , algorithm ) ; <nl> } <nl> <nl> - tmp . type = GRPC_ARG_INTEGER ; <nl> - tmp . key = GRPC_COMPRESSION_ALGORITHM_STATE_ARG ; <nl> - tmp . value . integer = states_bitset ; <nl> - return grpc_channel_args_copy_and_add ( a , & tmp , 1 ) ; <nl> + return result ; <nl> } <nl> <nl> int grpc_channel_args_compression_algorithm_get_states ( <nl> const grpc_channel_args * a ) { <nl> - return find_compression_algorithm_states_bitset ( a ) ; <nl> + int * states_arg ; <nl> + if ( find_compression_algorithm_states_bitset ( a , & states_arg ) ) { <nl> + return * states_arg ; <nl> + } else { <nl> + return ( 1u < < GRPC_COMPRESS_ALGORITHMS_COUNT ) - 1 ; / * All algs . enabled * / <nl> + } <nl> } <nl> mmm a / src / core / channel / compress_filter . c <nl> ppp b / src / core / channel / compress_filter . c <nl> static void init_channel_elem ( grpc_channel_element * elem , grpc_channel * master , <nl> channel_data * channeld = elem - > channel_data ; <nl> grpc_compression_algorithm algo_idx ; <nl> const char * supported_algorithms_names [ GRPC_COMPRESS_ALGORITHMS_COUNT - 1 ] ; <nl> + size_t supported_algorithms_idx = 0 ; <nl> char * accept_encoding_str ; <nl> size_t accept_encoding_str_len ; <nl> <nl> static void init_channel_elem ( grpc_channel_element * elem , grpc_channel * master , <nl> GRPC_MDSTR_REF ( channeld - > mdstr_outgoing_compression_algorithm_key ) , <nl> grpc_mdstr_from_string ( mdctx , algorithm_name , 0 ) ) ; <nl> if ( algo_idx > 0 ) { <nl> - supported_algorithms_names [ algo_idx - 1 ] = algorithm_name ; <nl> + supported_algorithms_names [ supported_algorithms_idx + + ] = algorithm_name ; <nl> } <nl> } <nl> <nl> / * TODO ( dgq ) : gpr_strjoin_sep could be made to work with statically allocated <nl> * arrays , as to avoid the heap allocs * / <nl> - accept_encoding_str = gpr_strjoin_sep ( <nl> - supported_algorithms_names , GPR_ARRAY_SIZE ( supported_algorithms_names ) , <nl> - " , " , & accept_encoding_str_len ) ; <nl> + accept_encoding_str = <nl> + gpr_strjoin_sep ( supported_algorithms_names , supported_algorithms_idx , <nl> + " , " , & accept_encoding_str_len ) ; <nl> <nl> channeld - > mdelem_accept_encoding = grpc_mdelem_from_metadata_strings ( <nl> mdctx , GRPC_MDSTR_REF ( channeld - > mdstr_compression_capabilities_key ) , <nl> mmm a / src / cpp / server / server . cc <nl> ppp b / src / cpp / server / server . cc <nl> class Server : : SyncRequest GRPC_FINAL : public CompletionQueueTag { <nl> <nl> static grpc_server * CreateServer ( <nl> int max_message_size , const grpc_compression_options & compression_options ) { <nl> + grpc_arg args [ 2 ] ; <nl> + size_t args_idx = 0 ; <nl> if ( max_message_size > 0 ) { <nl> - grpc_arg args [ 2 ] ; <nl> - args [ 0 ] . type = GRPC_ARG_INTEGER ; <nl> - args [ 0 ] . key = const_cast < char * > ( GRPC_ARG_MAX_MESSAGE_LENGTH ) ; <nl> - args [ 0 ] . value . integer = max_message_size ; <nl> - <nl> - args [ 1 ] . type = GRPC_ARG_INTEGER ; <nl> - args [ 1 ] . key = const_cast < char * > ( GRPC_COMPRESSION_ALGORITHM_STATE_ARG ) ; <nl> - args [ 1 ] . value . integer = compression_options . enabled_algorithms_bitset ; <nl> - <nl> - grpc_channel_args channel_args = { 2 , args } ; <nl> - return grpc_server_create ( & channel_args , nullptr ) ; <nl> - } else { <nl> - return grpc_server_create ( nullptr , nullptr ) ; <nl> + args [ args_idx ] . type = GRPC_ARG_INTEGER ; <nl> + args [ args_idx ] . key = const_cast < char * > ( GRPC_ARG_MAX_MESSAGE_LENGTH ) ; <nl> + args [ args_idx ] . value . integer = max_message_size ; <nl> + args_idx + + ; <nl> } <nl> + <nl> + args [ args_idx ] . type = GRPC_ARG_INTEGER ; <nl> + args [ args_idx ] . key = const_cast < char * > ( GRPC_COMPRESSION_ALGORITHM_STATE_ARG ) ; <nl> + args [ args_idx ] . value . integer = compression_options . enabled_algorithms_bitset ; <nl> + args_idx + + ; <nl> + <nl> + grpc_channel_args channel_args = { args_idx , args } ; <nl> + return grpc_server_create ( & channel_args , nullptr ) ; <nl> } <nl> <nl> Server : : Server ( ThreadPoolInterface * thread_pool , bool thread_pool_owned , <nl> | Comments and derived bugfixes . | grpc/grpc | cb30410b1063845cc3a0205741a72c9c96e07638 | 2015-08-19T22:50:54Z |
mmm a / src / counters . cc <nl> ppp b / src / counters . cc <nl> void RuntimeCallStats : : Leave ( RuntimeCallStats * stats , RuntimeCallTimer * timer ) { <nl> / / static <nl> void RuntimeCallStats : : CorrectCurrentCounterId ( RuntimeCallStats * stats , <nl> CounterId counter_id ) { <nl> - DCHECK_NOT_NULL ( stats - > current_timer_ . Value ( ) ) ; <nl> - RuntimeCallCounter * counter = & ( stats - > * counter_id ) ; <nl> - stats - > current_timer_ . Value ( ) - > counter_ = counter ; <nl> + RuntimeCallTimer * timer = stats - > current_timer_ . Value ( ) ; <nl> + / / When RCS are enabled dynamically there might be no current timer set up . <nl> + if ( timer = = nullptr ) return ; <nl> + timer - > counter_ = & ( stats - > * counter_id ) ; <nl> } <nl> <nl> void RuntimeCallStats : : Print ( std : : ostream & os ) { <nl> | [ runtime stats ] Fix crash when RCS are enabled dynamically . | v8/v8 | ddfdd3b8f9757905f88458cf92e75ff8110014d1 | 2016-11-08T18:17:09Z |
mmm a / SConstruct <nl> ppp b / SConstruct <nl> if selected_platform in platform_list : <nl> env . Append ( CCFLAGS = [ ' - Wall ' , ' - Wno - unused ' ] ) <nl> else : # ' no ' <nl> env . Append ( CCFLAGS = [ ' - w ' ] ) <nl> + env . Append ( CCFLAGS = [ ' - Werror = return - type ' ] ) <nl> <nl> # env [ ' platform_libsuffix ' ] = env [ ' LIBSUFFIX ' ] <nl> <nl> | Merge pull request from bruvzg / missing_return_error | godotengine/godot | 79a225ac2a2f2353f2f626809b56229397dfe52d | 2018-02-22T10:16:30Z |
mmm a / src / compiler / pipeline . cc <nl> ppp b / src / compiler / pipeline . cc <nl> class PipelineData { <nl> zone_stats_ ( zone_stats ) , <nl> pipeline_statistics_ ( pipeline_statistics ) , <nl> graph_zone_scope_ ( zone_stats_ , ZONE_NAME ) , <nl> + graph_zone_ ( graph_zone_scope_ . zone ( ) ) , <nl> graph_ ( mcgraph - > graph ( ) ) , <nl> source_positions_ ( source_positions ) , <nl> node_origins_ ( node_origins ) , <nl> | [ wasm ] Correctly init zone in PipelineData | v8/v8 | 72e062aa8293562951dffdb435b52687b66a0b67 | 2018-06-11T13:20:58Z |
mmm a / src / library_pthread . js <nl> ppp b / src / library_pthread . js <nl> var LibraryPThread = { <nl> var threadId = PThread . pthreadIdCounter + + ; <nl> { { { makeSetValue ( ' thread ' , 0 , ' threadId ' , ' i32 ' ) } } } ; <nl> <nl> - var stackSize = { { { makeGetValue ( ' attr ' , 0 , ' i32 ' ) } } } + 81920 / * DEFAULT_STACK_SIZE * / ; <nl> - if ( ! stackSize ) stackSize = 1024 * 1024 ; / / Default stack size is 1MB if not explicitly specified . <nl> - var stackBase = { { { makeGetValue ( ' attr ' , 8 , ' i32 ' ) } } } ; <nl> + var stackSize = 0 ; <nl> + var stackBase = 0 ; <nl> + if ( attr ) { <nl> + stackSize = { { { makeGetValue ( ' attr ' , 0 , ' i32 ' ) } } } ; <nl> + stackBase = { { { makeGetValue ( ' attr ' , 8 , ' i32 ' ) } } } ; <nl> + } <nl> + stackSize + = 81920 / * DEFAULT_STACK_SIZE * / ; <nl> var allocatedOwnStack = ! stackBase ; <nl> if ( allocatedOwnStack ) { <nl> stackBase = _malloc ( stackSize ) ; / / Allocate a stack if the user doesn ' t want to place the stack in a custom memory area . <nl> | Fix null pointer dereference in pthread_create . | emscripten-core/emscripten | 689e461b007e447e4f41b44d01f9033236601c01 | 2015-06-01T12:09:26Z |
mmm a / test / core / surface / secure_channel_create_test . c <nl> ppp b / test / core / surface / secure_channel_create_test . c <nl> void test_unknown_scheme_target ( void ) { <nl> grpc_resolver_registry_init ( ) ; <nl> grpc_channel_credentials * creds = <nl> grpc_fake_transport_security_credentials_create ( ) ; <nl> - grpc_channel * chan = grpc_secure_channel_create ( creds , " blah : / / blah " , NULL , <nl> - NULL ) ; <nl> + grpc_channel * chan = <nl> + grpc_secure_channel_create ( creds , " blah : / / blah " , NULL , NULL ) ; <nl> grpc_channel_element * elem = <nl> grpc_channel_stack_element ( grpc_channel_get_channel_stack ( chan ) , 0 ) ; <nl> GPR_ASSERT ( 0 = = strcmp ( elem - > filter - > name , " lame - client " ) ) ; <nl> | clang - format | grpc/grpc | 6c44ff103934f1d6c3ec8a9f41407efee77ac505 | 2017-02-02T20:11:21Z |
mmm a / lib / Parse / ParseDecl . cpp <nl> ppp b / lib / Parse / ParseDecl . cpp <nl> Parser : : parseDeclFunc ( SourceLoc StaticLoc , unsigned Flags ) { <nl> GenericParams = maybeParseGenericParams ( ) ; <nl> } <nl> <nl> - / / We force first type of a func declaration to be a tuple for consistency . <nl> - / / <nl> - if ( ! Tok . is ( tok : : l_paren ) ) { <nl> - diagnose ( Tok , diag : : func_decl_without_paren ) ; <nl> - return nullptr ; <nl> - } <nl> - <nl> SmallVector < Pattern * , 8 > ArgParams ; <nl> SmallVector < Pattern * , 8 > BodyParams ; <nl> <nl> Parser : : parseDeclFunc ( SourceLoc StaticLoc , unsigned Flags ) { <nl> bool HadSignatureParseError = false ; <nl> TypeRepr * FuncRetTy = nullptr ; <nl> { <nl> - ParserStatus SignatureStatus = <nl> - parseFunctionSignature ( ArgParams , BodyParams , FuncRetTy ) ; <nl> + ParserStatus SignatureStatus ; <nl> + / / We force first type of a func declaration to be a tuple for consistency . <nl> + if ( Tok . is ( tok : : l_paren ) ) { <nl> + SignatureStatus = <nl> + parseFunctionSignature ( ArgParams , BodyParams , FuncRetTy ) ; <nl> + } else { <nl> + diagnose ( Tok , diag : : func_decl_without_paren ) ; <nl> + SignatureStatus = makeParserError ( ) ; <nl> + } <nl> <nl> if ( SignatureStatus . isError ( ) ) { <nl> HadSignatureParseError = true ; <nl> | parseDeclFunc ( ) : improve recovery when the function parameter tuple is missing | apple/swift | 6d34a127eeec51679a5ae33c5bbbc7e5f62a82f6 | 2013-08-29T00:37:05Z |
mmm a / test / core / client_channel / resolvers / dns_resolver_connectivity_test . cc <nl> ppp b / test / core / client_channel / resolvers / dns_resolver_connectivity_test . cc <nl> static void my_resolve_address ( const char * addr , const char * / * default_port * / , <nl> gpr_malloc ( sizeof ( * ( * addrs ) - > addrs ) ) ) ; <nl> ( * addrs ) - > addrs [ 0 ] . len = 123 ; <nl> } <nl> - GRPC_CLOSURE_SCHED ( on_done , error ) ; <nl> + grpc_core : : ExecCtx : : Run ( DEBUG_LOCATION , on_done , error ) ; <nl> } <nl> <nl> static grpc_address_resolver_vtable test_resolver = { my_resolve_address , <nl> static grpc_ares_request * my_dns_lookup_ares_locked ( <nl> dummy_resolved_address . len = 123 ; <nl> ( * addresses ) - > emplace_back ( dummy_resolved_address , nullptr ) ; <nl> } <nl> - GRPC_CLOSURE_SCHED ( on_done , error ) ; <nl> + grpc_core : : ExecCtx : : Run ( DEBUG_LOCATION , on_done , error ) ; <nl> return nullptr ; <nl> } <nl> <nl> mmm a / test / core / end2end / fuzzers / api_fuzzer . cc <nl> ppp b / test / core / end2end / fuzzers / api_fuzzer . cc <nl> static void finish_resolve ( void * arg , grpc_error * error ) { <nl> dummy_resolved_address . len = 0 ; <nl> ( * r - > addresses ) - > emplace_back ( dummy_resolved_address , nullptr ) ; <nl> } <nl> - GRPC_CLOSURE_SCHED ( r - > on_done , GRPC_ERROR_NONE ) ; <nl> + grpc_core : : ExecCtx : : Run ( DEBUG_LOCATION , r - > on_done , GRPC_ERROR_NONE ) ; <nl> } else { <nl> - GRPC_CLOSURE_SCHED ( r - > on_done , <nl> - GRPC_ERROR_CREATE_REFERENCING_FROM_STATIC_STRING ( <nl> - " Resolution failed " , & error , 1 ) ) ; <nl> + grpc_core : : ExecCtx : : Run ( DEBUG_LOCATION , r - > on_done , <nl> + GRPC_ERROR_CREATE_REFERENCING_FROM_STATIC_STRING ( <nl> + " Resolution failed " , & error , 1 ) ) ; <nl> } <nl> <nl> gpr_free ( r - > addr ) ; <nl> static void do_connect ( void * arg , grpc_error * error ) { <nl> future_connect * fc = static_cast < future_connect * > ( arg ) ; <nl> if ( error ! = GRPC_ERROR_NONE ) { <nl> * fc - > ep = nullptr ; <nl> - GRPC_CLOSURE_SCHED ( fc - > closure , GRPC_ERROR_REF ( error ) ) ; <nl> + grpc_core : : ExecCtx : : Run ( DEBUG_LOCATION , fc - > closure , GRPC_ERROR_REF ( error ) ) ; <nl> } else if ( g_server ! = nullptr ) { <nl> grpc_endpoint * client ; <nl> grpc_endpoint * server ; <nl> static void do_connect ( void * arg , grpc_error * error ) { <nl> grpc_server_setup_transport ( g_server , transport , nullptr , nullptr , nullptr ) ; <nl> grpc_chttp2_transport_start_reading ( transport , nullptr , nullptr ) ; <nl> <nl> - GRPC_CLOSURE_SCHED ( fc - > closure , GRPC_ERROR_NONE ) ; <nl> + grpc_core : : ExecCtx : : Run ( DEBUG_LOCATION , fc - > closure , GRPC_ERROR_NONE ) ; <nl> } else { <nl> sched_connect ( fc - > closure , fc - > ep , fc - > deadline ) ; <nl> } <nl> static void sched_connect ( grpc_closure * closure , grpc_endpoint * * ep , <nl> gpr_timespec deadline ) { <nl> if ( gpr_time_cmp ( deadline , gpr_now ( deadline . clock_type ) ) < 0 ) { <nl> * ep = nullptr ; <nl> - GRPC_CLOSURE_SCHED ( closure , GRPC_ERROR_CREATE_FROM_STATIC_STRING ( <nl> - " Connect deadline exceeded " ) ) ; <nl> + grpc_core : : ExecCtx : : Run ( <nl> + DEBUG_LOCATION , closure , <nl> + GRPC_ERROR_CREATE_FROM_STATIC_STRING ( " Connect deadline exceeded " ) ) ; <nl> return ; <nl> } <nl> <nl> mmm a / test / core / end2end / goaway_server_test . cc <nl> ppp b / test / core / end2end / goaway_server_test . cc <nl> static void my_resolve_address ( const char * addr , const char * default_port , <nl> ( * addrs ) - > addrs [ 0 ] . len = static_cast < socklen_t > ( sizeof ( * sa ) ) ; <nl> gpr_mu_unlock ( & g_mu ) ; <nl> } <nl> - GRPC_CLOSURE_SCHED ( on_done , error ) ; <nl> + grpc_core : : ExecCtx : : Run ( DEBUG_LOCATION , on_done , error ) ; <nl> } <nl> <nl> static grpc_error * my_blocking_resolve_address ( <nl> static grpc_ares_request * my_dns_lookup_ares_locked ( <nl> ( * addresses ) - > emplace_back ( & sa , sizeof ( sa ) , nullptr ) ; <nl> gpr_mu_unlock ( & g_mu ) ; <nl> } <nl> - GRPC_CLOSURE_SCHED ( on_done , error ) ; <nl> + grpc_core : : ExecCtx : : Run ( DEBUG_LOCATION , on_done , error ) ; <nl> return nullptr ; <nl> } <nl> <nl> mmm a / test / core / iomgr / udp_server_test . cc <nl> ppp b / test / core / iomgr / udp_server_test . cc <nl> class TestGrpcUdpHandler : public GrpcUdpHandler { <nl> void * / * user_data * / ) override { <nl> gpr_log ( GPR_INFO , " gRPC FD about to be orphaned : % d " , <nl> grpc_fd_wrapped_fd ( emfd ( ) ) ) ; <nl> - GRPC_CLOSURE_SCHED ( orphan_fd_closure , GRPC_ERROR_NONE ) ; <nl> + grpc_core : : ExecCtx : : Run ( DEBUG_LOCATION , orphan_fd_closure , GRPC_ERROR_NONE ) ; <nl> g_number_of_orphan_calls + + ; <nl> } <nl> <nl> mmm a / test / core / security / credentials_test . cc <nl> ppp b / test / core / security / credentials_test . cc <nl> static int compute_engine_httpcli_get_success_override ( <nl> grpc_closure * on_done , grpc_httpcli_response * response ) { <nl> validate_compute_engine_http_request ( request ) ; <nl> * response = http_response ( 200 , valid_oauth2_json_response ) ; <nl> - GRPC_CLOSURE_SCHED ( on_done , GRPC_ERROR_NONE ) ; <nl> + grpc_core : : ExecCtx : : Run ( DEBUG_LOCATION , on_done , GRPC_ERROR_NONE ) ; <nl> return 1 ; <nl> } <nl> <nl> static int compute_engine_httpcli_get_failure_override ( <nl> grpc_closure * on_done , grpc_httpcli_response * response ) { <nl> validate_compute_engine_http_request ( request ) ; <nl> * response = http_response ( 403 , " Not Authorized . " ) ; <nl> - GRPC_CLOSURE_SCHED ( on_done , GRPC_ERROR_NONE ) ; <nl> + grpc_core : : ExecCtx : : Run ( DEBUG_LOCATION , on_done , GRPC_ERROR_NONE ) ; <nl> return 1 ; <nl> } <nl> <nl> static int refresh_token_httpcli_post_success ( <nl> grpc_httpcli_response * response ) { <nl> validate_refresh_token_http_request ( request , body , body_size ) ; <nl> * response = http_response ( 200 , valid_oauth2_json_response ) ; <nl> - GRPC_CLOSURE_SCHED ( on_done , GRPC_ERROR_NONE ) ; <nl> + grpc_core : : ExecCtx : : Run ( DEBUG_LOCATION , on_done , GRPC_ERROR_NONE ) ; <nl> return 1 ; <nl> } <nl> <nl> static int token_httpcli_post_failure ( const grpc_httpcli_request * / * request * / , <nl> grpc_closure * on_done , <nl> grpc_httpcli_response * response ) { <nl> * response = http_response ( 403 , " Not Authorized . " ) ; <nl> - GRPC_CLOSURE_SCHED ( on_done , GRPC_ERROR_NONE ) ; <nl> + grpc_core : : ExecCtx : : Run ( DEBUG_LOCATION , on_done , GRPC_ERROR_NONE ) ; <nl> return 1 ; <nl> } <nl> <nl> static int sts_token_httpcli_post_success ( const grpc_httpcli_request * request , <nl> grpc_httpcli_response * response ) { <nl> validate_sts_token_http_request ( request , body , body_size ) ; <nl> * response = http_response ( 200 , valid_sts_json_response ) ; <nl> - GRPC_CLOSURE_SCHED ( on_done , GRPC_ERROR_NONE ) ; <nl> + grpc_core : : ExecCtx : : Run ( DEBUG_LOCATION , on_done , GRPC_ERROR_NONE ) ; <nl> return 1 ; <nl> } <nl> <nl> static int default_creds_metadata_server_detection_httpcli_get_success_override ( <nl> response - > hdrs = headers ; <nl> GPR_ASSERT ( strcmp ( request - > http . path , " / " ) = = 0 ) ; <nl> GPR_ASSERT ( strcmp ( request - > host , " metadata . google . internal . " ) = = 0 ) ; <nl> - GRPC_CLOSURE_SCHED ( on_done , GRPC_ERROR_NONE ) ; <nl> + grpc_core : : ExecCtx : : Run ( DEBUG_LOCATION , on_done , GRPC_ERROR_NONE ) ; <nl> return 1 ; <nl> } <nl> <nl> static int default_creds_gce_detection_httpcli_get_failure_override ( <nl> GPR_ASSERT ( strcmp ( request - > http . path , " / " ) = = 0 ) ; <nl> GPR_ASSERT ( strcmp ( request - > host , " metadata . google . internal . " ) = = 0 ) ; <nl> * response = http_response ( 200 , " " ) ; <nl> - GRPC_CLOSURE_SCHED ( on_done , GRPC_ERROR_NONE ) ; <nl> + grpc_core : : ExecCtx : : Run ( DEBUG_LOCATION , on_done , GRPC_ERROR_NONE ) ; <nl> return 1 ; <nl> } <nl> <nl> mmm a / test / core / security / jwt_verifier_test . cc <nl> ppp b / test / core / security / jwt_verifier_test . cc <nl> static int httpcli_get_google_keys_for_email ( <nl> " / robot / v1 / metadata / x509 / " <nl> " 777 - abaslkan11hlb6nmim3bpspl31ud @ developer . " <nl> " gserviceaccount . com " ) = = 0 ) ; <nl> - GRPC_CLOSURE_SCHED ( on_done , GRPC_ERROR_NONE ) ; <nl> + grpc_core : : ExecCtx : : Run ( DEBUG_LOCATION , on_done , GRPC_ERROR_NONE ) ; <nl> return 1 ; <nl> } <nl> <nl> static int httpcli_get_custom_keys_for_email ( <nl> GPR_ASSERT ( request - > handshaker = = & grpc_httpcli_ssl ) ; <nl> GPR_ASSERT ( strcmp ( request - > host , " keys . bar . com " ) = = 0 ) ; <nl> GPR_ASSERT ( strcmp ( request - > http . path , " / jwk / foo @ bar . com " ) = = 0 ) ; <nl> - GRPC_CLOSURE_SCHED ( on_done , GRPC_ERROR_NONE ) ; <nl> + grpc_core : : ExecCtx : : Run ( DEBUG_LOCATION , on_done , GRPC_ERROR_NONE ) ; <nl> return 1 ; <nl> } <nl> <nl> static int httpcli_get_jwk_set ( const grpc_httpcli_request * request , <nl> GPR_ASSERT ( request - > handshaker = = & grpc_httpcli_ssl ) ; <nl> GPR_ASSERT ( strcmp ( request - > host , " www . googleapis . com " ) = = 0 ) ; <nl> GPR_ASSERT ( strcmp ( request - > http . path , " / oauth2 / v3 / certs " ) = = 0 ) ; <nl> - GRPC_CLOSURE_SCHED ( on_done , GRPC_ERROR_NONE ) ; <nl> + grpc_core : : ExecCtx : : Run ( DEBUG_LOCATION , on_done , GRPC_ERROR_NONE ) ; <nl> return 1 ; <nl> } <nl> <nl> static int httpcli_get_openid_config ( const grpc_httpcli_request * request , <nl> GPR_ASSERT ( strcmp ( request - > http . path , GRPC_OPENID_CONFIG_URL_SUFFIX ) = = 0 ) ; <nl> grpc_httpcli_set_override ( httpcli_get_jwk_set , <nl> httpcli_post_should_not_be_called ) ; <nl> - GRPC_CLOSURE_SCHED ( on_done , GRPC_ERROR_NONE ) ; <nl> + grpc_core : : ExecCtx : : Run ( DEBUG_LOCATION , on_done , GRPC_ERROR_NONE ) ; <nl> return 1 ; <nl> } <nl> <nl> static int httpcli_get_bad_json ( const grpc_httpcli_request * request , <nl> grpc_httpcli_response * response ) { <nl> * response = http_response ( 200 , gpr_strdup ( " { \ " bad \ " : \ " stuff \ " } " ) ) ; <nl> GPR_ASSERT ( request - > handshaker = = & grpc_httpcli_ssl ) ; <nl> - GRPC_CLOSURE_SCHED ( on_done , GRPC_ERROR_NONE ) ; <nl> + grpc_core : : ExecCtx : : Run ( DEBUG_LOCATION , on_done , GRPC_ERROR_NONE ) ; <nl> return 1 ; <nl> } <nl> <nl> mmm a / test / core / util / mock_endpoint . cc <nl> ppp b / test / core / util / mock_endpoint . cc <nl> static void me_read ( grpc_endpoint * ep , grpc_slice_buffer * slices , <nl> gpr_mu_lock ( & m - > mu ) ; <nl> if ( m - > read_buffer . count > 0 ) { <nl> grpc_slice_buffer_swap ( & m - > read_buffer , slices ) ; <nl> - GRPC_CLOSURE_SCHED ( cb , GRPC_ERROR_NONE ) ; <nl> + grpc_core : : ExecCtx : : Run ( DEBUG_LOCATION , cb , GRPC_ERROR_NONE ) ; <nl> } else { <nl> m - > on_read = cb ; <nl> m - > on_read_out = slices ; <nl> static void me_write ( grpc_endpoint * ep , grpc_slice_buffer * slices , <nl> for ( size_t i = 0 ; i < slices - > count ; i + + ) { <nl> m - > on_write ( slices - > slices [ i ] ) ; <nl> } <nl> - GRPC_CLOSURE_SCHED ( cb , GRPC_ERROR_NONE ) ; <nl> + grpc_core : : ExecCtx : : Run ( DEBUG_LOCATION , cb , GRPC_ERROR_NONE ) ; <nl> } <nl> <nl> static void me_add_to_pollset ( grpc_endpoint * / * ep * / , <nl> static void me_shutdown ( grpc_endpoint * ep , grpc_error * why ) { <nl> mock_endpoint * m = reinterpret_cast < mock_endpoint * > ( ep ) ; <nl> gpr_mu_lock ( & m - > mu ) ; <nl> if ( m - > on_read ) { <nl> - GRPC_CLOSURE_SCHED ( m - > on_read , <nl> - GRPC_ERROR_CREATE_REFERENCING_FROM_STATIC_STRING ( <nl> - " Endpoint Shutdown " , & why , 1 ) ) ; <nl> + grpc_core : : ExecCtx : : Run ( DEBUG_LOCATION , m - > on_read , <nl> + GRPC_ERROR_CREATE_REFERENCING_FROM_STATIC_STRING ( <nl> + " Endpoint Shutdown " , & why , 1 ) ) ; <nl> m - > on_read = nullptr ; <nl> } <nl> gpr_mu_unlock ( & m - > mu ) ; <nl> void grpc_mock_endpoint_put_read ( grpc_endpoint * ep , grpc_slice slice ) { <nl> gpr_mu_lock ( & m - > mu ) ; <nl> if ( m - > on_read ! = nullptr ) { <nl> grpc_slice_buffer_add ( m - > on_read_out , slice ) ; <nl> - GRPC_CLOSURE_SCHED ( m - > on_read , GRPC_ERROR_NONE ) ; <nl> + grpc_core : : ExecCtx : : Run ( DEBUG_LOCATION , m - > on_read , GRPC_ERROR_NONE ) ; <nl> m - > on_read = nullptr ; <nl> } else { <nl> grpc_slice_buffer_add ( & m - > read_buffer , slice ) ; <nl> mmm a / test / core / util / passthru_endpoint . cc <nl> ppp b / test / core / util / passthru_endpoint . cc <nl> static void me_read ( grpc_endpoint * ep , grpc_slice_buffer * slices , <nl> half * m = reinterpret_cast < half * > ( ep ) ; <nl> gpr_mu_lock ( & m - > parent - > mu ) ; <nl> if ( m - > parent - > shutdown ) { <nl> - GRPC_CLOSURE_SCHED ( <nl> - cb , GRPC_ERROR_CREATE_FROM_STATIC_STRING ( " Already shutdown " ) ) ; <nl> + grpc_core : : ExecCtx : : Run ( <nl> + DEBUG_LOCATION , cb , <nl> + GRPC_ERROR_CREATE_FROM_STATIC_STRING ( " Already shutdown " ) ) ; <nl> } else if ( m - > read_buffer . count > 0 ) { <nl> grpc_slice_buffer_swap ( & m - > read_buffer , slices ) ; <nl> - GRPC_CLOSURE_SCHED ( cb , GRPC_ERROR_NONE ) ; <nl> + grpc_core : : ExecCtx : : Run ( DEBUG_LOCATION , cb , GRPC_ERROR_NONE ) ; <nl> } else { <nl> m - > on_read = cb ; <nl> m - > on_read_out = slices ; <nl> static void me_write ( grpc_endpoint * ep , grpc_slice_buffer * slices , <nl> for ( size_t i = 0 ; i < slices - > count ; i + + ) { <nl> grpc_slice_buffer_add ( m - > on_read_out , grpc_slice_copy ( slices - > slices [ i ] ) ) ; <nl> } <nl> - GRPC_CLOSURE_SCHED ( m - > on_read , GRPC_ERROR_NONE ) ; <nl> + grpc_core : : ExecCtx : : Run ( DEBUG_LOCATION , m - > on_read , GRPC_ERROR_NONE ) ; <nl> m - > on_read = nullptr ; <nl> } else { <nl> for ( size_t i = 0 ; i < slices - > count ; i + + ) { <nl> static void me_write ( grpc_endpoint * ep , grpc_slice_buffer * slices , <nl> } <nl> } <nl> gpr_mu_unlock ( & m - > parent - > mu ) ; <nl> - GRPC_CLOSURE_SCHED ( cb , error ) ; <nl> + grpc_core : : ExecCtx : : Run ( DEBUG_LOCATION , cb , error ) ; <nl> } <nl> <nl> static void me_add_to_pollset ( grpc_endpoint * / * ep * / , <nl> static void me_shutdown ( grpc_endpoint * ep , grpc_error * why ) { <nl> gpr_mu_lock ( & m - > parent - > mu ) ; <nl> m - > parent - > shutdown = true ; <nl> if ( m - > on_read ) { <nl> - GRPC_CLOSURE_SCHED ( <nl> - m - > on_read , <nl> + grpc_core : : ExecCtx : : Run ( <nl> + DEBUG_LOCATION , m - > on_read , <nl> GRPC_ERROR_CREATE_REFERENCING_FROM_STATIC_STRING ( " Shutdown " , & why , 1 ) ) ; <nl> m - > on_read = nullptr ; <nl> } <nl> m = other_half ( m ) ; <nl> if ( m - > on_read ) { <nl> - GRPC_CLOSURE_SCHED ( <nl> - m - > on_read , <nl> + grpc_core : : ExecCtx : : Run ( <nl> + DEBUG_LOCATION , m - > on_read , <nl> GRPC_ERROR_CREATE_REFERENCING_FROM_STATIC_STRING ( " Shutdown " , & why , 1 ) ) ; <nl> m - > on_read = nullptr ; <nl> } <nl> mmm a / test / core / util / trickle_endpoint . cc <nl> ppp b / test / core / util / trickle_endpoint . cc <nl> static void maybe_call_write_cb_locked ( trickle_endpoint * te ) { <nl> if ( te - > write_cb ! = nullptr & & <nl> ( te - > error ! = GRPC_ERROR_NONE | | <nl> te - > write_buffer . length < = WRITE_BUFFER_SIZE ) ) { <nl> - GRPC_CLOSURE_SCHED ( te - > write_cb , GRPC_ERROR_REF ( te - > error ) ) ; <nl> + grpc_core : : ExecCtx : : Run ( DEBUG_LOCATION , te - > write_cb , <nl> + GRPC_ERROR_REF ( te - > error ) ) ; <nl> te - > write_cb = nullptr ; <nl> } <nl> } <nl> mmm a / test / cpp / microbenchmarks / bm_call_create . cc <nl> ppp b / test / cpp / microbenchmarks / bm_call_create . cc <nl> void SetPollsetSet ( grpc_transport * / * self * / , grpc_stream * / * stream * / , <nl> / * implementation of grpc_transport_perform_stream_op * / <nl> void PerformStreamOp ( grpc_transport * / * self * / , grpc_stream * / * stream * / , <nl> grpc_transport_stream_op_batch * op ) { <nl> - GRPC_CLOSURE_SCHED ( op - > on_complete , GRPC_ERROR_NONE ) ; <nl> + grpc_core : : ExecCtx : : Run ( DEBUG_LOCATION , op - > on_complete , GRPC_ERROR_NONE ) ; <nl> } <nl> <nl> / * implementation of grpc_transport_perform_op * / <nl> static void StartTransportOp ( grpc_channel_element * / * elem * / , <nl> if ( op - > disconnect_with_error ! = GRPC_ERROR_NONE ) { <nl> GRPC_ERROR_UNREF ( op - > disconnect_with_error ) ; <nl> } <nl> - GRPC_CLOSURE_SCHED ( op - > on_consumed , GRPC_ERROR_NONE ) ; <nl> + grpc_core : : ExecCtx : : Run ( DEBUG_LOCATION , op - > on_consumed , GRPC_ERROR_NONE ) ; <nl> } <nl> <nl> static grpc_error * InitCallElem ( grpc_call_element * elem , <nl> static void SetPollsetOrPollsetSet ( grpc_call_element * / * elem * / , <nl> static void DestroyCallElem ( grpc_call_element * / * elem * / , <nl> const grpc_call_final_info * / * final_info * / , <nl> grpc_closure * then_sched_closure ) { <nl> - GRPC_CLOSURE_SCHED ( then_sched_closure , GRPC_ERROR_NONE ) ; <nl> + grpc_core : : ExecCtx : : Run ( DEBUG_LOCATION , then_sched_closure , GRPC_ERROR_NONE ) ; <nl> } <nl> <nl> grpc_error * InitChannelElem ( grpc_channel_element * / * elem * / , <nl> mmm a / test / cpp / microbenchmarks / bm_chttp2_transport . cc <nl> ppp b / test / cpp / microbenchmarks / bm_chttp2_transport . cc <nl> class DummyEndpoint : public grpc_endpoint { <nl> return ; <nl> } <nl> grpc_slice_buffer_add ( slices_ , slice ) ; <nl> - GRPC_CLOSURE_SCHED ( read_cb_ , GRPC_ERROR_NONE ) ; <nl> + grpc_core : : ExecCtx : : Run ( DEBUG_LOCATION , read_cb_ , GRPC_ERROR_NONE ) ; <nl> read_cb_ = nullptr ; <nl> } <nl> <nl> class DummyEndpoint : public grpc_endpoint { <nl> if ( have_slice_ ) { <nl> have_slice_ = false ; <nl> grpc_slice_buffer_add ( slices , buffered_slice_ ) ; <nl> - GRPC_CLOSURE_SCHED ( cb , GRPC_ERROR_NONE ) ; <nl> + grpc_core : : ExecCtx : : Run ( DEBUG_LOCATION , cb , GRPC_ERROR_NONE ) ; <nl> return ; <nl> } <nl> read_cb_ = cb ; <nl> class DummyEndpoint : public grpc_endpoint { <nl> <nl> static void write ( grpc_endpoint * / * ep * / , grpc_slice_buffer * / * slices * / , <nl> grpc_closure * cb , void * / * arg * / ) { <nl> - GRPC_CLOSURE_SCHED ( cb , GRPC_ERROR_NONE ) ; <nl> + grpc_core : : ExecCtx : : Run ( DEBUG_LOCATION , cb , GRPC_ERROR_NONE ) ; <nl> } <nl> <nl> static void add_to_pollset ( grpc_endpoint * / * ep * / , grpc_pollset * / * pollset * / ) { <nl> class DummyEndpoint : public grpc_endpoint { <nl> <nl> static void shutdown ( grpc_endpoint * ep , grpc_error * why ) { <nl> grpc_resource_user_shutdown ( static_cast < DummyEndpoint * > ( ep ) - > ru_ ) ; <nl> - GRPC_CLOSURE_SCHED ( static_cast < DummyEndpoint * > ( ep ) - > read_cb_ , why ) ; <nl> + grpc_core : : ExecCtx : : Run ( DEBUG_LOCATION , <nl> + static_cast < DummyEndpoint * > ( ep ) - > read_cb_ , why ) ; <nl> } <nl> <nl> static void destroy ( grpc_endpoint * ep ) { <nl> static void BM_StreamCreateSendInitialMetadataDestroy ( benchmark : : State & state ) { <nl> s - > Op ( & op ) ; <nl> s - > DestroyThen ( start . get ( ) ) ; <nl> } ) ; <nl> - GRPC_CLOSURE_SCHED ( start . get ( ) , GRPC_ERROR_NONE ) ; <nl> + grpc_core : : ExecCtx : : Run ( DEBUG_LOCATION , start . get ( ) , GRPC_ERROR_NONE ) ; <nl> f . FlushExecCtx ( ) ; <nl> gpr_event_wait ( & bm_done , gpr_inf_future ( GPR_CLOCK_REALTIME ) ) ; <nl> grpc_metadata_batch_destroy ( & b ) ; <nl> static void BM_TransportEmptyOp ( benchmark : : State & state ) { <nl> op . on_complete = c . get ( ) ; <nl> s - > Op ( & op ) ; <nl> } ) ; <nl> - GRPC_CLOSURE_SCHED ( c . get ( ) , GRPC_ERROR_NONE ) ; <nl> + grpc_core : : ExecCtx : : Run ( DEBUG_LOCATION , c . get ( ) , GRPC_ERROR_NONE ) ; <nl> f . FlushExecCtx ( ) ; <nl> reset_op ( ) ; <nl> op . cancel_stream = true ; <nl> static void BM_TransportStreamRecv ( benchmark : : State & state ) { <nl> do { <nl> if ( received = = recv_stream - > length ( ) ) { <nl> recv_stream . reset ( ) ; <nl> - GRPC_CLOSURE_SCHED ( c . get ( ) , GRPC_ERROR_NONE ) ; <nl> + grpc_core : : ExecCtx : : Run ( DEBUG_LOCATION , c . get ( ) , GRPC_ERROR_NONE ) ; <nl> return ; <nl> } <nl> } while ( recv_stream - > Next ( recv_stream - > length ( ) - received , <nl> mmm a / test / cpp / microbenchmarks / bm_closure . cc <nl> ppp b / test / cpp / microbenchmarks / bm_closure . cc <nl> static void BM_ClosureSchedOnExecCtx ( benchmark : : State & state ) { <nl> GRPC_CLOSURE_INIT ( & c , DoNothing , nullptr , grpc_schedule_on_exec_ctx ) ; <nl> grpc_core : : ExecCtx exec_ctx ; <nl> for ( auto _ : state ) { <nl> - GRPC_CLOSURE_SCHED ( & c , GRPC_ERROR_NONE ) ; <nl> + grpc_core : : ExecCtx : : Run ( DEBUG_LOCATION , & c , GRPC_ERROR_NONE ) ; <nl> grpc_core : : ExecCtx : : Get ( ) - > Flush ( ) ; <nl> } <nl> <nl> static void BM_ClosureSched2OnExecCtx ( benchmark : : State & state ) { <nl> GRPC_CLOSURE_INIT ( & c2 , DoNothing , nullptr , grpc_schedule_on_exec_ctx ) ; <nl> grpc_core : : ExecCtx exec_ctx ; <nl> for ( auto _ : state ) { <nl> - GRPC_CLOSURE_SCHED ( & c1 , GRPC_ERROR_NONE ) ; <nl> - GRPC_CLOSURE_SCHED ( & c2 , GRPC_ERROR_NONE ) ; <nl> + grpc_core : : ExecCtx : : Run ( DEBUG_LOCATION , & c1 , GRPC_ERROR_NONE ) ; <nl> + grpc_core : : ExecCtx : : Run ( DEBUG_LOCATION , & c2 , GRPC_ERROR_NONE ) ; <nl> grpc_core : : ExecCtx : : Get ( ) - > Flush ( ) ; <nl> } <nl> <nl> static void BM_ClosureSched3OnExecCtx ( benchmark : : State & state ) { <nl> GRPC_CLOSURE_INIT ( & c3 , DoNothing , nullptr , grpc_schedule_on_exec_ctx ) ; <nl> grpc_core : : ExecCtx exec_ctx ; <nl> for ( auto _ : state ) { <nl> - GRPC_CLOSURE_SCHED ( & c1 , GRPC_ERROR_NONE ) ; <nl> - GRPC_CLOSURE_SCHED ( & c2 , GRPC_ERROR_NONE ) ; <nl> - GRPC_CLOSURE_SCHED ( & c3 , GRPC_ERROR_NONE ) ; <nl> + grpc_core : : ExecCtx : : Run ( DEBUG_LOCATION , & c1 , GRPC_ERROR_NONE ) ; <nl> + grpc_core : : ExecCtx : : Run ( DEBUG_LOCATION , & c2 , GRPC_ERROR_NONE ) ; <nl> + grpc_core : : ExecCtx : : Run ( DEBUG_LOCATION , & c3 , GRPC_ERROR_NONE ) ; <nl> grpc_core : : ExecCtx : : Get ( ) - > Flush ( ) ; <nl> } <nl> <nl> class Rescheduler { <nl> GRPC_CLOSURE_INIT ( & closure_ , Step , this , scheduler ) ; <nl> } <nl> <nl> - void ScheduleFirst ( ) { GRPC_CLOSURE_SCHED ( & closure_ , GRPC_ERROR_NONE ) ; } <nl> + void ScheduleFirst ( ) { <nl> + grpc_core : : ExecCtx : : Run ( DEBUG_LOCATION , & closure_ , GRPC_ERROR_NONE ) ; <nl> + } <nl> <nl> void ScheduleFirstAgainstDifferentScheduler ( <nl> grpc_closure_scheduler * scheduler ) { <nl> - GRPC_CLOSURE_SCHED ( GRPC_CLOSURE_CREATE ( Step , this , scheduler ) , <nl> - GRPC_ERROR_NONE ) ; <nl> + grpc_core : : ExecCtx : : Run ( DEBUG_LOCATION , <nl> + GRPC_CLOSURE_CREATE ( Step , this , scheduler ) , <nl> + GRPC_ERROR_NONE ) ; <nl> } <nl> <nl> private : <nl> class Rescheduler { <nl> static void Step ( void * arg , grpc_error * / * error * / ) { <nl> Rescheduler * self = static_cast < Rescheduler * > ( arg ) ; <nl> if ( self - > state_ . KeepRunning ( ) ) { <nl> - GRPC_CLOSURE_SCHED ( & self - > closure_ , GRPC_ERROR_NONE ) ; <nl> + grpc_core : : ExecCtx : : Run ( DEBUG_LOCATION , & self - > closure_ , GRPC_ERROR_NONE ) ; <nl> } <nl> } <nl> } ; <nl> mmm a / test / cpp / microbenchmarks / bm_cq_multiple_threads . cc <nl> ppp b / test / cpp / microbenchmarks / bm_cq_multiple_threads . cc <nl> static grpc_completion_queue * g_cq ; <nl> static grpc_event_engine_vtable g_vtable ; <nl> <nl> static void pollset_shutdown ( grpc_pollset * / * ps * / , grpc_closure * closure ) { <nl> - GRPC_CLOSURE_SCHED ( closure , GRPC_ERROR_NONE ) ; <nl> + grpc_core : : ExecCtx : : Run ( DEBUG_LOCATION , closure , GRPC_ERROR_NONE ) ; <nl> } <nl> <nl> static void pollset_init ( grpc_pollset * ps , gpr_mu * * mu ) { <nl> | test changes | grpc/grpc | 3a189d7e08e7416fe74304281f5606f889fbcdb0 | 2019-11-01T00:09:38Z |
mmm a / imgui . cpp <nl> ppp b / imgui . cpp <nl> <nl> # include < math . h > / / sqrtf <nl> # include < stdint . h > / / intptr_t <nl> # include < stdio . h > / / vsnprintf <nl> - # include < string . h > / / memset <nl> # include < new > / / new ( ptr ) <nl> <nl> # ifdef _MSC_VER <nl> mmm a / imgui . h <nl> ppp b / imgui . h <nl> struct ImGuiWindow ; <nl> # include < stdarg . h > / / va_list <nl> # include < stddef . h > / / ptrdiff_t <nl> # include < stdlib . h > / / NULL , malloc <nl> + # include < string . h > / / memset , memmove <nl> <nl> # ifndef IM_ASSERT <nl> # include < assert . h > <nl> | Fix for Clang | ocornut/imgui | f8c58fe3286feb2ca006804c91d9bd0bbc736885 | 2014-12-30T16:55:32Z |
mmm a / googletest / src / gtest - port . cc <nl> ppp b / googletest / src / gtest - port . cc <nl> <nl> <nl> # if GTEST_OS_AIX <nl> # include < procinfo . h > <nl> + # include < sys / types . h > <nl> # endif / / GTEST_OS_AIX <nl> <nl> # include " gtest / gtest - spi . h " <nl> | Add include of sys / types . h . | google/googletest | bf7e9e8c2bb3892d9b4dedda81c988aad6fea5c7 | 2015-10-02T21:38:02Z |
mmm a / stdlib / public / Concurrency / CMakeLists . txt <nl> ppp b / stdlib / public / Concurrency / CMakeLists . txt <nl> add_swift_target_library ( swift_Concurrency $ { SWIFT_STDLIB_LIBRARY_BUILD_TYPES } I <nl> PartialAsyncTask . swift <nl> Task . cpp <nl> Task . swift <nl> + TaskCancellation . swift <nl> + _TimeTypes . swift <nl> TaskAlloc . cpp <nl> TaskStatus . cpp <nl> Mutex . cpp <nl> mmm a / stdlib / public / Concurrency / Task . swift <nl> ppp b / stdlib / public / Concurrency / Task . swift <nl> public enum Task { <nl> extension Task { <nl> <nl> / / / Returns the current task ' s priority . <nl> + / / / <nl> + / / / # # # Suspension <nl> + / / / This function returns instantly and will never suspend . <nl> + / * @ instantaneous * / <nl> public static func currentPriority ( ) async - > Priority { <nl> fatalError ( " \ ( # function ) not implemented yet . " ) <nl> } <nl> extension Task { <nl> / / / The operation functions must resume the continuation * exactly once * . <nl> / / / <nl> / / / The continuation will not begin executing until the operation function returns . <nl> + / / / <nl> + / / / # # # Suspension <nl> + / / / This function returns instantly and will never suspend . <nl> + / * @ instantaneous * / <nl> public static func withUnsafeContinuation < T > ( <nl> operation : ( UnsafeContinuation < T > ) - > Void <nl> ) async - > T { <nl> extension Task { <nl> / / / The operation functions must resume the continuation * exactly once * . <nl> / / / <nl> / / / The continuation will not begin executing until the operation function returns . <nl> + / / / <nl> + / / / # # # Suspension <nl> + / / / This function returns instantly and will never suspend . <nl> + / * @ instantaneous * / <nl> public static func withUnsafeThrowingContinuation < T > ( <nl> operation : ( UnsafeThrowingContinuation < T , Error > ) - > Void <nl> ) async throws - > T { <nl> new file mode 100644 <nl> index 000000000000 . . 4e3f069a03d2 <nl> mmm / dev / null <nl> ppp b / stdlib / public / Concurrency / TaskCancellation . swift <nl> <nl> + / / / / = = = mmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmm - = = = / / <nl> + / / / / <nl> + / / / / This source file is part of the Swift . org open source project <nl> + / / / / <nl> + / / / / Copyright ( c ) 2020 Apple Inc . and the Swift project authors <nl> + / / / / Licensed under Apache License v2 . 0 with Runtime Library Exception <nl> + / / / / <nl> + / / / / See https : / / swift . org / LICENSE . txt for license information <nl> + / / / / See https : / / swift . org / CONTRIBUTORS . txt for the list of Swift project authors <nl> + / / / / <nl> + / / / / = = = mmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmm - = = = / / <nl> + <nl> + import Swift <nl> + @ _implementationOnly import _SwiftConcurrencyShims <nl> + <nl> + / / = = = = Task Cancellation mmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmm <nl> + <nl> + extension Task { <nl> + <nl> + / / / Returns ` true ` if the task is cancelled , and should stop executing . <nl> + / / / <nl> + / / / # # # Suspension <nl> + / / / This function returns instantly and will never suspend . <nl> + / / / <nl> + / / / - SeeAlso : ` checkCancellation ( ) ` <nl> + / * @ instantaneous * / <nl> + public static func isCancelled ( ) async - > Bool { <nl> + / / let task = __getTask ( ) / / TODO : pending internal API to get tasks <nl> + / / task . isCancelled | | task . deadline . isOverdue <nl> + fatalError ( " \ ( # function ) not implemented yet . " ) <nl> + } <nl> + <nl> + / / / Check if the task is cancelled and throw an ` CancellationError ` if it was . <nl> + / / / <nl> + / / / It is intentional that no information is passed to the task about why it <nl> + / / / was cancelled . A task may be cancelled for many reasons , and additional <nl> + / / / reasons may accrue / after the initial cancellation ( for example , if the <nl> + / / / task fails to immediately exit , it may pass a deadline ) . <nl> + / / / <nl> + / / / The goal of cancellation is to allow tasks to be cancelled in a <nl> + / / / lightweight way , not to be a secondary method of inter - task communication . <nl> + / / / <nl> + / / / # # # Suspension <nl> + / / / This function returns instantly and will never suspend . <nl> + / / / <nl> + / / / - SeeAlso : ` isCancelled ( ) ` <nl> + / * @ instantaneous * / <nl> + public static func checkCancellation ( ) async throws { <nl> + if await Task . isCancelled ( ) { <nl> + throw CancellationError ( ) <nl> + } <nl> + } <nl> + <nl> + / / / Execute an operation with cancellation handler which will immediately be <nl> + / / / invoked if the current task is cancelled . <nl> + / / / <nl> + / / / This differs from the operation cooperatively checking for cancellation <nl> + / / / and reacting to it in that the cancellation handler is _always_ and <nl> + / / / _immediately_ invoked when the task is cancelled . For example , even if the <nl> + / / / operation is running code which never checks for cancellation , a cancellation <nl> + / / / handler still would run and give us a chance to run some cleanup code . <nl> + / / / <nl> + / / / Does not check for cancellation , and always executes the passed ` operation ` . <nl> + / / / <nl> + / / / # # # Suspension <nl> + / / / This function returns instantly and will never suspend . <nl> + / * @ instantaneous * / <nl> + public static func withCancellationHandler < T > ( <nl> + handler : / * @ concurrent * / ( ) - > ( ) , <nl> + operation : ( ) async throws - > T <nl> + ) async throws - > T { <nl> + fatalError ( " \ ( # function ) not implemented yet . " ) <nl> + } <nl> + <nl> + / / / The default cancellation thrown when a task is cancelled . <nl> + / / / <nl> + / / / This error is also thrown automatically by ` Task . checkCancellation ( ) ` , <nl> + / / / if the current task has been cancelled . <nl> + public struct CancellationError : Error { <nl> + / / no extra information , cancellation is intended to be light - weight <nl> + } <nl> + <nl> + } <nl> + <nl> + / / = = = = Task Deadlines mmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmm <nl> + <nl> + extension Task { <nl> + <nl> + / / / Returns the earliest deadline set on the current task . <nl> + / / / <nl> + / / / If no deadline was set for the task the ` Deadline . distantFuture ` is returned , <nl> + / / / as it is effective in conveying that there still is time remaining and the <nl> + / / / deadline is not overdue yet . <nl> + / / / <nl> + / / / # # # Suspension <nl> + / / / This function returns instantly and will never suspend . <nl> + / * @ instantaneous * / <nl> + public static func currentDeadline ( ) async - > Deadline { <nl> + fatalError ( " \ ( # function ) not implemented yet . " ) <nl> + } <nl> + <nl> + / / / Execute a code block with a deadline in ` interval ` . <nl> + / / / <nl> + / / / If the current task already has a deadline set that is _prior_ <nl> + / / / to the newly set deadline with this API , that deadline will remain in effect . <nl> + / / / <nl> + / / / This allows higher level tasks to set an upper bound on the deadline they <nl> + / / / are willing cumulatively willing to wait for the entire task to execute , <nl> + / / / regardless of the inner deadlines of the specific child tasks . <nl> + / / / <nl> + / / / Cancellation is co - operative and must be checked for by the operation , e . g . <nl> + / / / by invoking ` Task . checkCancellation ` , or ` Task . isCancelled ` . <nl> + / / / <nl> + / / / # # # Suspension <nl> + / / / This function returns instantly and will never suspend . <nl> + / / / <nl> + / / / - Parameters : <nl> + / / / - interval : interval after which ( from ` now ( ) ` ) the operation task should <nl> + / / / be considered cancelled . <nl> + / / / - operation : the operation to execute <nl> + / * @ instantaneous * / <nl> + public static func withDeadline < T > ( <nl> + in interval : _TimeInterval , <nl> + operation : ( ) async throws - > T <nl> + ) async rethrows - > T { <nl> + fatalError ( " \ ( # function ) not implemented yet . " ) <nl> + } <nl> + <nl> + / / / Execute a code block with the passed in deadline ( unless a shorter deadline is already set ) . <nl> + / / / <nl> + / / / If the current task already has a deadline set that is _prior_ <nl> + / / / to the newly set deadline with this API , that deadline will remain in effect . <nl> + / / / <nl> + / / / This allows higher level tasks to set an upper bound on the deadline they <nl> + / / / are willing cumulatively willing to wait for the entire task to execute , <nl> + / / / regardless of the inner deadlines of the specific child tasks . <nl> + / / / <nl> + / / / Cancellation is co - operative and must be checked for by the operation , e . g . <nl> + / / / by invoking ` Task . checkCancellation ` or ` Task . isCancelled ` . <nl> + / / / <nl> + / / / # # # Suspension <nl> + / / / This function returns instantly and will never suspend . <nl> + / / / <nl> + / / / - Parameters : <nl> + / / / - deadline : the point in time after which the operation task should be <nl> + / / / considered cancelled . <nl> + / / / - operation : the operation to execute <nl> + / * @ instantaneous * / <nl> + public static func withDeadline < T > ( <nl> + _ deadline : Deadline , <nl> + operation : ( ) async throws - > T <nl> + ) async rethrows - > T { <nl> + fatalError ( " \ ( # function ) not implemented yet . " ) <nl> + } <nl> + <nl> + / / / A deadline is a point in time past - which a task should be considered cancelled . <nl> + / / / <nl> + / / / Deadlines function the same was as pure cancellation , in the sense that they <nl> + / / / are cooperative and require the cancelled ( deadline exceeding ) task to check <nl> + / / / for this as it is performing its execution . <nl> + / / / <nl> + / / / Generally tasks ( or partial tasks ) should perform such check before they <nl> + / / / start executing , however this is not a strict rule , and some tasks may <nl> + / / / choose to be un - cancellable . <nl> + public struct Deadline { <nl> + public typealias WallTime = UInt64 / / equivalent to DispatchWallTime <nl> + internal let time : WallTime <nl> + <nl> + public init ( at time : WallTime ) { <nl> + self . time = time <nl> + } <nl> + <nl> + public static var distantFuture : Self { <nl> + . init ( time : . max ) <nl> + } <nl> + <nl> + public static func ` in ` ( _ interval : _TimeInterval ) - > Self { <nl> + / / now ( ) + interval <nl> + fatalError ( " # \ ( # function ) not implemented yet . " ) <nl> + } <nl> + <nl> + / / / Returns ` true ` if the deadline is overdue and deadline should be <nl> + / / / considered overdue ( or " exceeded " ) . <nl> + / / / <nl> + / / / If this deadline was related to a ` Task ` , that task should be considered <nl> + / / / cancelled if the deadline is overdue . <nl> + public var isOverdue : Bool { <nl> + ! self . hasTimeLeft <nl> + } <nl> + <nl> + / / / Returns ` true ` if the deadline is still pending with respect to " now " . <nl> + public var hasTimeLeft : Bool { <nl> + fatalError ( " \ ( # function ) not implemented yet . " ) / / self . hasTimeLeft ( until : now ( ) ) <nl> + } <nl> + <nl> + / / TODO : public func hasTimeLeft ( until : DispatchWallTime or whichever time type we ' ll use ) - > Bool <nl> + <nl> + } <nl> + } <nl> new file mode 100644 <nl> index 000000000000 . . 903674039ae4 <nl> mmm / dev / null <nl> ppp b / stdlib / public / Concurrency / _TimeTypes . swift <nl> <nl> + / / / / = = = mmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmm - = = = / / <nl> + / / / / <nl> + / / / / This source file is part of the Swift . org open source project <nl> + / / / / <nl> + / / / / Copyright ( c ) 2020 Apple Inc . and the Swift project authors <nl> + / / / / Licensed under Apache License v2 . 0 with Runtime Library Exception <nl> + / / / / <nl> + / / / / See https : / / swift . org / LICENSE . txt for license information <nl> + / / / / See https : / / swift . org / CONTRIBUTORS . txt for the list of Swift project authors <nl> + / / / / <nl> + / / / / = = = mmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmm - = = = / / <nl> + <nl> + import Swift <nl> + @ _implementationOnly import _SwiftConcurrencyShims <nl> + <nl> + / / FIXME : This file and all " time types " defined here are temporary until we decide what types to use . <nl> + / / It was suggested to avoid Dispatch types in public API of Swift Concurrency , <nl> + / / so for now we use " bare minimum " types just to be able to continue prototyping . <nl> + extension Task { <nl> + / / / Represents a time interval , i . e . a number of seconds . <nl> + / / / <nl> + / / / It can be used to express deadlines , in the form of time interval from " now . " <nl> + / / / <nl> + / / / - Note : This is equivalent to ` DispatchTimeInterval ` if we were to use it . <nl> + public struct _TimeInterval : Equatable , Comparable { <nl> + let nanoseconds : UInt64 <nl> + <nl> + private init ( nanoseconds : UInt64 ) { <nl> + self . nanoseconds = nanoseconds <nl> + } <nl> + <nl> + public static func seconds ( _ s : UInt64 ) - > Self { <nl> + . init ( nanoseconds : clampedInt64Product ( s , 1_000_000_000 ) ) <nl> + } <nl> + <nl> + public static func milliseconds ( _ ms : UInt64 ) - > Self { <nl> + . init ( nanoseconds : clampedInt64Product ( ms , 1_000_000 ) ) <nl> + } <nl> + <nl> + public static func microseconds ( _ us : UInt64 ) - > Self { <nl> + . init ( nanoseconds : clampedInt64Product ( us , 1000 ) ) <nl> + } <nl> + <nl> + public static func nanoseconds ( _ ns : UInt64 ) - > Self { <nl> + . init ( nanoseconds : ns ) <nl> + } <nl> + <nl> + public static var never : Self { <nl> + . init ( nanoseconds : . max ) <nl> + } <nl> + <nl> + public static func < ( lhs : Self , rhs : Self ) - > Bool { <nl> + lhs . nanoseconds < rhs . nanoseconds <nl> + } <nl> + } <nl> + <nl> + } <nl> + <nl> + / / Returns m1 * m2 , clamped to the range [ UInt64 . min , UInt64 . max ] . <nl> + private func clampedInt64Product ( _ m1 : UInt64 , _ m2 : UInt64 ) - > UInt64 { <nl> + let ( result , overflow ) = m1 . multipliedReportingOverflow ( by : m2 ) <nl> + if overflow { <nl> + return UInt64 . max <nl> + } <nl> + return result <nl> + } <nl> new file mode 100644 <nl> index 000000000000 . . df0120c2dd68 <nl> mmm / dev / null <nl> ppp b / test / Concurrency / async_cancellation . swift <nl> <nl> + / / RUN : % target - typecheck - verify - swift - enable - experimental - concurrency <nl> + / / REQUIRES : concurrency <nl> + <nl> + enum PictureData { <nl> + case value ( String ) <nl> + case failedToLoadImagePlaceholder <nl> + } <nl> + <nl> + func test_cancellation_checkCancellation ( ) async throws { <nl> + await try Task . checkCancellation ( ) <nl> + } <nl> + <nl> + func test_cancellation_guard_isCancelled ( _ any : Any ) async - > PictureData { <nl> + guard await ! Task . isCancelled ( ) else { <nl> + return PictureData . failedToLoadImagePlaceholder <nl> + } <nl> + <nl> + return PictureData . value ( " . . . " ) <nl> + } <nl> + <nl> + struct SomeFile { <nl> + func close ( ) { } <nl> + } <nl> + <nl> + func test_cancellation_withCancellationHandler ( _ anything : Any ) async - > PictureData { <nl> + let handle = Task . runDetached { ( ) - > PictureData in <nl> + let file = SomeFile ( ) <nl> + <nl> + return await try Task . withCancellationHandler ( <nl> + handler : { file . close ( ) } , <nl> + operation : { <nl> + await test_cancellation_guard_isCancelled ( file ) <nl> + } ) <nl> + } <nl> + <nl> + handle . cancel ( ) <nl> + } <nl> + <nl> + func test_cancellation_loop ( ) async - > Int { <nl> + struct SampleTask { func process ( ) async { } } <nl> + <nl> + let tasks = [ SampleTask ( ) , SampleTask ( ) ] <nl> + var processed = 0 <nl> + for t in tasks where await ! Task . isCancelled ( ) { <nl> + await t . process ( ) <nl> + processed + = 1 <nl> + } <nl> + return processed <nl> + } <nl> + <nl> + / / = = = = Deadlines mmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmm - - <nl> + <nl> + func int ( ) async - > Int { 42 } <nl> + <nl> + func test_cancellation_withDeadline_in ( ) async throws - > Int { <nl> + / * missing await * / Task . withDeadline ( in : . seconds ( 5 ) , operation : { / / FIXME : rdar : / / 70751405 async rethrows functions are not detected as async <nl> + await int ( ) <nl> + } ) <nl> + } <nl> + <nl> + func test_cancellation_withDeadline ( specificDeadline : Task . Deadline ) async - > Int { <nl> + / * missing ` await ` * / <nl> + Task . withDeadline ( specificDeadline ) { / / FIXME : rdar : / / 70751405 async rethrows functions are not detected as async <nl> + await int ( ) <nl> + } <nl> + } <nl> mmm a / test / expr / unary / async_await . swift <nl> ppp b / test / expr / unary / async_await . swift <nl> func invalidAsyncFunction ( ) async { <nl> <nl> func validAsyncFunction ( ) async throws { <nl> _ = try await throwingAndAsync ( ) <nl> - } <nl> \ No newline at end of file <nl> + } <nl> | [ Concurrency ] Task cancellation and deadline stubs | apple/swift | 9e8f2cc0315a026f335b0f4cb6e77576d0403e72 | 2020-11-02T11:51:00Z |
mmm a / src / mongo / platform / atomic_word_cxx11 . h <nl> ppp b / src / mongo / platform / atomic_word_cxx11 . h <nl> <nl> # error " Cannot use atomic_word_cxx11 . h without C + + 11 < atomic > support " <nl> # endif <nl> <nl> + / / This file is a bit unusual . Most other source files in this codebase assume that C + + 11 <nl> + / / things are only usable if __cplusplus > = 201103L . However , we have made an explicit decision <nl> + / / to use < atomic > when available , even if full C + + 11 conformance is not advertised . As a <nl> + / / result , we unconditionally include < atomic > , but guard all other C + + 11 features under <nl> + / / __cplusplus > = 201103L so that we can work on platforms that don ' t yet offer those features , but <nl> + / / do offer < atomic > <nl> + <nl> # include < atomic > <nl> <nl> + # if __cplusplus > = 201103L <nl> + # include < type_traits > <nl> + # endif <nl> + <nl> # include < boost / static_assert . hpp > <nl> <nl> + # include " mongo / base / disallow_copying . h " <nl> + <nl> namespace mongo { <nl> <nl> / * * <nl> namespace mongo { <nl> template < typename _WordType > <nl> class AtomicWord { <nl> <nl> + # if __cplusplus < 201103L <nl> + / / AtomicWords are not copyable in C + + 03 . <nl> + MONGO_DISALLOW_COPYING ( AtomicWord ) ; <nl> + # endif <nl> + <nl> public : <nl> / * * <nl> * Underlying value type . <nl> namespace mongo { <nl> * / <nl> explicit AtomicWord ( WordType value = WordType ( 0 ) ) : _value ( value ) { } <nl> <nl> + # if __cplusplus > = 201103L <nl> + / / In C + + 11 , AtomicWords are not copyable or movable . <nl> + AtomicWord ( AtomicWord & ) = delete ; <nl> + AtomicWord & operator = ( const AtomicWord & ) = delete ; <nl> + AtomicWord ( AtomicWord & & ) = delete ; <nl> + AtomicWord & operator = ( AtomicWord & & ) = delete ; <nl> + # endif <nl> + <nl> / * * <nl> * Gets the current value of this AtomicWord . <nl> * <nl> namespace mongo { <nl> std : : atomic < WordType > _value ; <nl> } ; <nl> <nl> + # if __cplusplus > = 201103L <nl> # define _ATOMIC_WORD_DECLARE ( NAME , WTYPE ) \ <nl> typedef class AtomicWord < WTYPE > NAME ; \ <nl> - namespace { BOOST_STATIC_ASSERT ( sizeof ( NAME ) = = sizeof ( WTYPE ) ) ; } <nl> + namespace { \ <nl> + BOOST_STATIC_ASSERT ( sizeof ( NAME ) = = sizeof ( WTYPE ) ) ; \ <nl> + BOOST_STATIC_ASSERT ( std : : is_standard_layout < WTYPE > : : value ) ; \ <nl> + } / / namespace <nl> + # else <nl> + # define _ATOMIC_WORD_DECLARE ( NAME , WTYPE ) \ <nl> + typedef class AtomicWord < WTYPE > NAME ; \ <nl> + namespace { \ <nl> + BOOST_STATIC_ASSERT ( sizeof ( NAME ) = = sizeof ( WTYPE ) ) ; \ <nl> + } / / namespace <nl> + # endif <nl> <nl> _ATOMIC_WORD_DECLARE ( AtomicUInt32 , unsigned ) ; <nl> _ATOMIC_WORD_DECLARE ( AtomicUInt64 , unsigned long long ) ; <nl> mmm a / src / mongo / platform / atomic_word_intrinsics . h <nl> ppp b / src / mongo / platform / atomic_word_intrinsics . h <nl> <nl> <nl> # include < boost / static_assert . hpp > <nl> <nl> + # include " mongo / base / disallow_copying . h " <nl> # include " mongo / platform / atomic_intrinsics . h " <nl> # include " mongo / platform / compiler . h " <nl> <nl> namespace mongo { <nl> * / <nl> template < typename _WordType > <nl> class AtomicWord { <nl> + MONGO_DISALLOW_COPYING ( AtomicWord ) ; <nl> + <nl> public : <nl> / * * <nl> * Underlying value type . <nl> | SERVER - 6018 SERVER - 13913 Make AtomicWord objects non - copyable and non - movable | mongodb/mongo | 87b350a0eeafb6a7933e9be3ffc453b690741653 | 2014-05-17T19:46:28Z |
mmm a / hphp / hack / src / client / clientCheck . ml <nl> ppp b / hphp / hack / src / client / clientCheck . ml <nl> let main ( args : client_check_env ) : Exit_status . t Lwt . t = <nl> | MODE_GEN_HOT_CLASSES ( threshold , filename ) - > <nl> let % lwt content = rpc args @ @ Rpc . GEN_HOT_CLASSES threshold in <nl> ( try % lwt <nl> - let oc = Pervasives . open_out filename in <nl> + let oc = Stdlib . open_out filename in <nl> Out_channel . output_string oc content ; <nl> - Pervasives . close_out oc ; <nl> + Stdlib . close_out oc ; <nl> Lwt . return Exit_status . No_error <nl> with exn - > <nl> Printf . eprintf " Failed to save hot classes file : % s \ n " <nl> mmm a / hphp / hack / src / client / clientConnect . ml <nl> ppp b / hphp / hack / src / client / clientConnect . ml <nl> type conn = { <nl> let get_finale_data ( server_finale_file : string ) : <nl> ServerCommandTypes . finale_data option = <nl> try <nl> - let ic = Pervasives . open_in_bin server_finale_file in <nl> + let ic = Stdlib . open_in_bin server_finale_file in <nl> let contents : ServerCommandTypes . finale_data = Marshal . from_channel ic in <nl> - Pervasives . close_in ic ; <nl> + Stdlib . close_in ic ; <nl> Some contents <nl> with _ - > None <nl> <nl> let rec connect <nl> threshold ; <nl> ( try Timeout . shutdown_connection ic with _ - > ( ) ) ; <nl> Timeout . close_in_noerr ic ; <nl> - Pervasives . close_out_noerr oc ; <nl> + Stdlib . close_out_noerr oc ; <nl> <nl> ( * allow_macos_hack : false is a defensive measure against infinite connection loops * ) <nl> connect ~ allow_macos_hack : false env start_time <nl> mmm a / hphp / hack / src / monitor / monitorConnection . ml <nl> ppp b / hphp / hack / src / monitor / monitorConnection . ml <nl> let verify_cstate ic cstate = <nl> <nl> ( * Consume sequence of Prehandoff messages . * ) <nl> let rec consume_prehandoff_messages <nl> - ~ ( timeout : Timeout . t ) <nl> - ( ic : Timeout . in_channel ) <nl> - ( oc : Pervasives . out_channel ) : <nl> - ( Timeout . in_channel * Pervasives . out_channel * string , <nl> + ~ ( timeout : Timeout . t ) ( ic : Timeout . in_channel ) ( oc : Stdlib . out_channel ) : <nl> + ( Timeout . in_channel * Stdlib . out_channel * string , <nl> ServerMonitorUtils . connection_error ) <nl> result = <nl> let module PH = Prehandoff in <nl> let rec consume_prehandoff_messages <nl> Error Server_died <nl> <nl> let consume_prehandoff_messages <nl> - ~ ( timeout : int ) ( ic : Timeout . in_channel ) ( oc : Pervasives . out_channel ) : <nl> - ( Timeout . in_channel * Pervasives . out_channel * string , <nl> + ~ ( timeout : int ) ( ic : Timeout . in_channel ) ( oc : Stdlib . out_channel ) : <nl> + ( Timeout . in_channel * Stdlib . out_channel * string , <nl> ServerMonitorUtils . connection_error ) <nl> result = <nl> Timeout . with_timeout <nl> mmm a / hphp / hack / src / parser / rust_aast_parser_types . ml <nl> ppp b / hphp / hack / src / parser / rust_aast_parser_types . ml <nl> type env = { <nl> type ' aast result_ = { <nl> file_mode : FileInfo . mode ; <nl> scoured_comments : Scoured_comments . t ; <nl> - aast : ( ' aast , string ) Pervasives . result ; <nl> + aast : ( ' aast , string ) Stdlib . result ; <nl> lowpri_errors : ( Pos . t * string ) list ; <nl> syntax_errors : Full_fidelity_syntax_error . t list ; <nl> errors : Errors . error list ; <nl> mmm a / hphp / hack / src / procs / worker . ml <nl> ppp b / hphp / hack / src / procs / worker . ml <nl> let unix_worker_main restore ( state , controller_fd ) ( ic , oc ) = <nl> | Unix . WEXITED code - > <nl> Printf . printf " Worker exited ( code : % d ) \ n " code ; <nl> flush stdout ; <nl> - Pervasives . exit code <nl> + Stdlib . exit code <nl> | Unix . WSIGNALED x - > <nl> let sig_str = PrintSignal . string_of_signal x in <nl> Printf . printf " Worker interrupted with signal : % s \ n " sig_str ; <nl> mmm a / hphp / hack / src / server / saveStateService . ml <nl> ppp b / hphp / hack / src / server / saveStateService . ml <nl> let partition_error_files_tf <nl> ( * If the contents doesn ' t contain the value of the expected type , the result <nl> is undefined behavior . We may crash , or we may continue with a bogus value . * ) <nl> let load_contents_unsafe ( input_filename : string ) : ' a = <nl> - let ic = Pervasives . open_in_bin input_filename in <nl> + let ic = Stdlib . open_in_bin input_filename in <nl> let contents = Marshal . from_channel ic in <nl> - Pervasives . close_in ic ; <nl> + Stdlib . close_in ic ; <nl> contents <nl> <nl> let load_class_decls ( input_filename : string ) : unit = <nl> let load_saved_state <nl> <nl> ( * Writes some OCaml object to a file with the given filename . * ) <nl> let dump_contents ( output_filename : string ) ( contents : ' a ) : unit = <nl> - let chan = Pervasives . open_out_bin output_filename in <nl> + let chan = Stdlib . open_out_bin output_filename in <nl> Marshal . to_channel chan contents [ ] ; <nl> - Pervasives . close_out chan <nl> + Stdlib . close_out chan <nl> <nl> let get_hot_classes_filename ( ) = <nl> let prefix = Relative_path . ( path_of_prefix Root ) in <nl> mmm a / hphp / hack / src / server / serverApi . ml <nl> ppp b / hphp / hack / src / server / serverApi . ml <nl> let make_local_server_api <nl> in <nl> ( changed_file_path , File_provider . get_contents changed_file_path ) ) <nl> in <nl> - let chan = Pervasives . open_out_bin destination_path in <nl> + let chan = Stdlib . open_out_bin destination_path in <nl> Marshal . to_channel chan changed_files [ ] ; <nl> - Pervasives . close_out chan <nl> + Stdlib . close_out chan <nl> end : LocalServerApi ) <nl> <nl> let make_remote_server_api <nl> mmm a / hphp / hack / src / server / serverCommandTypes . ml <nl> ppp b / hphp / hack / src / server / serverCommandTypes . ml <nl> module Infer_return_type = struct <nl> | Function of string <nl> | Method of string * string <nl> <nl> - type result = ( string , string ) Pervasives . result <nl> + type result = ( string , string ) Stdlib . result <nl> end <nl> <nl> module Ide_refactor_type = struct <nl> type _ t = <nl> - > [ ` Ok of ServerRefactorTypes . patch list | ` Error of string ] t <nl> | REWRITE_LAMBDA_PARAMETERS : string list - > ServerRefactorTypes . patch list t <nl> | REWRITE_TYPE_PARAMS_TYPE : string list - > ServerRefactorTypes . patch list t <nl> - | IN_MEMORY_DEP_TABLE_SIZE : ( int , string ) Pervasives . result t <nl> + | IN_MEMORY_DEP_TABLE_SIZE : ( int , string ) Stdlib . result t <nl> | SAVE_NAMING : <nl> string <nl> - - > ( SaveStateServiceTypes . save_naming_result , string ) Pervasives . result t <nl> + - > ( SaveStateServiceTypes . save_naming_result , string ) Stdlib . result t <nl> | SAVE_STATE : <nl> ( string * bool * bool ) <nl> - - > ( SaveStateServiceTypes . save_state_result , string ) Pervasives . result t <nl> + - > ( SaveStateServiceTypes . save_state_result , string ) Stdlib . result t <nl> | SEARCH : string * string - > SearchUtils . result t <nl> | COVERAGE_COUNTS : string - > ServerCoverageMetricTypes . result t <nl> | LINT : string list - > ServerLintTypes . result t <nl> mmm a / hphp / hack / src / server / serverFormatTypes . ml <nl> ppp b / hphp / hack / src / server / serverFormatTypes . ml <nl> <nl> <nl> type action = string * int * int ( * file contents , offset start , offset end * ) <nl> <nl> - type result = ( string , string ) Pervasives . result <nl> + type result = ( string , string ) Stdlib . result <nl> <nl> type ide_action = <nl> | Document <nl> type ide_response = { <nl> range : Ide_api_types . range ; ( * what range was actually replaced ? * ) <nl> } <nl> <nl> - type ide_result = ( ide_response , string ) Pervasives . result <nl> + type ide_result = ( ide_response , string ) Stdlib . result <nl> mmm a / hphp / hack / src / server / serverInit . ml <nl> ppp b / hphp / hack / src / server / serverInit . ml <nl> let init <nl> let finale_file = ServerFiles . server_finale_file ( Unix . getpid ( ) ) in <nl> begin <nl> try <nl> - let oc = Pervasives . open_out_bin finale_file in <nl> + let oc = Stdlib . open_out_bin finale_file in <nl> Marshal . to_channel oc finale_data [ ] ; <nl> - Pervasives . close_out oc <nl> + Stdlib . close_out oc <nl> with _ - > ( ) <nl> end ; <nl> Exit_status . exit next_step ) <nl> mmm a / hphp / hack / src / typing / typing_log . mli <nl> ppp b / hphp / hack / src / typing / typing_log . mli <nl> <nl> * <nl> * ) <nl> <nl> - val out_channel : Pervasives . out_channel ref <nl> + val out_channel : Stdlib . out_channel ref <nl> <nl> val log_key : string - > unit <nl> <nl> mmm a / hphp / hack / src / utils / core / exit_status . ml <nl> ppp b / hphp / hack / src / utils / core / exit_status . ml <nl> let exit_code = function <nl> <nl> let exit t = <nl> let ec = exit_code t in <nl> - Pervasives . exit ec <nl> + Stdlib . exit ec <nl> <nl> let to_string = function <nl> | No_error - > " Ok " <nl> mmm a / hphp / hack / src / utils / core / measure . ml <nl> ppp b / hphp / hack / src / utils / core / measure . ml <nl> let sample ? record ? ( weight = 1 . 0 ) name value = <nl> let variance_sum = <nl> variance_sum + . ( weight * . ( value - . old_mean ) * . ( value - . mean ) ) <nl> in <nl> - let max = Pervasives . max max value in <nl> - let min = Pervasives . min min value in <nl> + let max = Stdlib . max max value in <nl> + let min = Stdlib . min min value in <nl> let distribution = update_distribution ~ weight value distribution in <nl> let entry = { count ; mean ; variance_sum ; max ; min ; distribution } in <nl> record : = SMap . add name entry ! record <nl> let merge_entries name from into = <nl> + . into . variance_sum <nl> + . ( delta * . delta * . into . count * . from . count / . count ) <nl> in <nl> - let max = Pervasives . max from . max into . max in <nl> - let min = Pervasives . min from . min into . min in <nl> + let max = Stdlib . max from . max into . max in <nl> + let min = Stdlib . min from . min into . min in <nl> let distribution = <nl> match ( from . distribution , into . distribution ) with <nl> | ( None , into ) - > into <nl> mmm a / hphp / hack / src / utils / hh_json / hh_json . ml <nl> ppp b / hphp / hack / src / utils / hh_json / hh_json . ml <nl> module Buffer_stream : Output_stream_intf with type t = Buffer . t = struct <nl> let add_substring b s ofs len = Buffer . add_substring b s ofs len <nl> end <nl> <nl> - module Channel_stream : <nl> - Output_stream_intf with type t = Pervasives . out_channel = struct <nl> - type t = Pervasives . out_channel <nl> + module Channel_stream : Output_stream_intf with type t = Stdlib . out_channel = <nl> + struct <nl> + type t = Stdlib . out_channel <nl> <nl> - let add_char b c = Pervasives . output_char b c <nl> + let add_char b c = Stdlib . output_char b c <nl> <nl> - let add_string b s = Pervasives . output_string b s <nl> + let add_string b s = Stdlib . output_string b s <nl> <nl> - let add_substring b s ofs len = Pervasives . output_substring b s ofs len <nl> + let add_substring b s ofs len = Stdlib . output_substring b s ofs len <nl> end <nl> <nl> module Make_streamer ( Out : Output_stream_intf ) = struct <nl> mmm a / hphp / hack / src / utils / http_lite / http_lite . ml <nl> ppp b / hphp / hack / src / utils / http_lite / http_lite . ml <nl> let read_message_utf8 ( reader : Buffered_line_reader . t ) : string = <nl> ( * * write_message : writes " Content - Length : . . . body " * ) <nl> let write_message ( outchan : out_channel ) ( body : string ) : unit = <nl> ( * Without this , Windows will change the \ r \ n to \ r \ r \ n * ) <nl> - Pervasives . set_binary_mode_out outchan true ; <nl> + Stdlib . set_binary_mode_out outchan true ; <nl> <nl> Printf . fprintf outchan " Content - Length : % n \ r \ n " ( String . length body ) ; <nl> Printf . fprintf outchan " \ r \ n " ; <nl> mmm a / hphp / hack / src / utils / opaque_digest / opaqueDigest . mli <nl> ppp b / hphp / hack / src / utils / opaque_digest / opaqueDigest . mli <nl> val substring : string - > int - > int - > t <nl> <nl> val subbytes : bytes - > int - > int - > t <nl> <nl> - val channel : Pervasives . in_channel - > int - > t <nl> + val channel : Stdlib . in_channel - > int - > t <nl> <nl> val file : string - > t <nl> <nl> - val output : Pervasives . out_channel - > t - > unit <nl> + val output : Stdlib . out_channel - > t - > unit <nl> <nl> - val input : Pervasives . in_channel - > t <nl> + val input : Stdlib . in_channel - > t <nl> <nl> val to_hex : t - > string <nl> <nl> mmm a / hphp / hack / src / utils / sys / daemon . ml <nl> ppp b / hphp / hack / src / utils / sys / daemon . ml <nl> <nl> <nl> type ' a in_channel = Timeout . in_channel <nl> <nl> - type ' a out_channel = Pervasives . out_channel <nl> + type ' a out_channel = Stdlib . out_channel <nl> <nl> type ( ' in_ , ' out ) channel_pair = ' in_ in_channel * ' out out_channel <nl> <nl> let to_channel : <nl> let from_channel : ? timeout : Timeout . t - > ' a in_channel - > ' a = <nl> ( fun ? timeout ic - > Timeout . input_value ? timeout ic ) <nl> <nl> - let flush : ' a out_channel - > unit = Pervasives . flush <nl> + let flush : ' a out_channel - > unit = Stdlib . flush <nl> <nl> let descr_of_in_channel : ' a in_channel - > Unix . file_descr = <nl> Timeout . descr_of_in_channel <nl> mmm a / hphp / hack / src / utils / sys / daemon . mli <nl> ppp b / hphp / hack / src / utils / sys / daemon . mli <nl> <nl> * <nl> * ) <nl> <nl> - ( * * Type - safe versions of the channels in Pervasives . * ) <nl> + ( * * Type - safe versions of the channels in Stdlib . * ) <nl> <nl> type ' a in_channel <nl> <nl> val descr_of_out_channel : ' a out_channel - > Unix . file_descr <nl> <nl> val cast_in : ' a in_channel - > Timeout . in_channel <nl> <nl> - val cast_out : ' a out_channel - > Pervasives . out_channel <nl> + val cast_out : ' a out_channel - > Stdlib . out_channel <nl> <nl> val close_out : ' a out_channel - > unit <nl> <nl> mmm a / hphp / hack / src / utils / sys / timeout . ml <nl> ppp b / hphp / hack / src / utils / sys / timeout . ml <nl> module Alarm_timeout = struct <nl> <nl> ( * * Channel * ) <nl> <nl> - type in_channel = Pervasives . in_channel * int option <nl> + type in_channel = Stdlib . in_channel * int option <nl> <nl> let ignore_timeout f ? timeout : _ ( ic , _pid ) = f ic <nl> <nl> - let input = ignore_timeout Pervasives . input <nl> + let input = ignore_timeout Stdlib . input <nl> <nl> - let really_input = ignore_timeout Pervasives . really_input <nl> + let really_input = ignore_timeout Stdlib . really_input <nl> <nl> - let input_char = ignore_timeout Pervasives . input_char <nl> + let input_char = ignore_timeout Stdlib . input_char <nl> <nl> - let input_line = ignore_timeout Pervasives . input_line <nl> + let input_line = ignore_timeout Stdlib . input_line <nl> <nl> let input_value_with_workaround ic = <nl> ( * OCaml 4 . 03 . 0 changed the behavior of input_value to no longer <nl> module Alarm_timeout = struct <nl> * behavior , however , by trying to read a byte afterwards , which WILL <nl> * raise End_of_file if the pipe has closed <nl> * http : / / caml . inria . fr / mantis / view . php ? id = 7142 * ) <nl> - try Pervasives . input_value ic <nl> + try Stdlib . input_value ic <nl> with Failure msg as e - > <nl> if msg = " input_value : truncated object " then <nl> - Pervasives . input_char ic | > ignore ; <nl> + Stdlib . input_char ic | > ignore ; <nl> raise e <nl> <nl> let input_value = ignore_timeout input_value_with_workaround <nl> <nl> - let open_in name = ( Pervasives . open_in name , None ) <nl> + let open_in name = ( Stdlib . open_in name , None ) <nl> <nl> - let close_in ( ic , _ ) = Pervasives . close_in ic <nl> + let close_in ( ic , _ ) = Stdlib . close_in ic <nl> <nl> - let close_in_noerr ( ic , _ ) = Pervasives . close_in_noerr ic <nl> + let close_in_noerr ( ic , _ ) = Stdlib . close_in_noerr ic <nl> <nl> let in_channel_of_descr fd = ( Unix . in_channel_of_descr fd , None ) <nl> <nl> module Alarm_timeout = struct <nl> match pid with <nl> | None - > invalid_arg " Timeout . close_process_in " <nl> | Some pid - > <nl> - Pervasives . close_in ic ; <nl> + Stdlib . close_in ic ; <nl> snd ( Sys_utils . waitpid_non_intr [ ] pid ) <nl> <nl> let read_process ~ timeout ~ on_timeout ~ reader cmd args = <nl> mmm a / hphp / hack / src / utils / sys / timeout . mli <nl> ppp b / hphp / hack / src / utils / sys / timeout . mli <nl> type t <nl> On Unix , the function ` check_timeout ` is no - op . <nl> <nl> On Unix , the type ` in_channel ` is in fact an alias for <nl> - ` Pervasives . in_channel ` . <nl> + ` Stdlib . in_channel ` . <nl> <nl> * ) <nl> val with_timeout : timeout : int - > on_timeout : ( unit - > ' a ) - > do_ : ( t - > ' a ) - > ' a <nl> mmm a / hphp / hack / test / integration / test_harness . ml <nl> ppp b / hphp / hack / test / integration / test_harness . ml <nl> let run_test ? ( stop_server_in_teardown = true ) config test_case = <nl> <nl> let with_local_conf local_conf_str test_case harness = <nl> let conf_file = Path . concat harness . repo_dir " hh . conf " in <nl> - let oc = Pervasives . open_out ( Path . to_string conf_file ) in <nl> - let ( ) = Pervasives . output_string oc local_conf_str in <nl> - let ( ) = Pervasives . close_out oc in <nl> + let oc = Stdlib . open_out ( Path . to_string conf_file ) in <nl> + let ( ) = Stdlib . output_string oc local_conf_str in <nl> + let ( ) = Stdlib . close_out oc in <nl> test_case harness <nl> mmm a / hphp / hack / test / rust / rust_ocaml_test . ml <nl> ppp b / hphp / hack / test / rust / rust_ocaml_test . ml <nl> <nl> * <nl> * ) <nl> <nl> - module OcamlPervasives = Pervasives <nl> module OcamlPrintf = Printf <nl> open Core_kernel <nl> - module Pervasives = OcamlPervasives <nl> module Printf = OcamlPrintf <nl> <nl> [ @ @ @ warning " - 3 " ] <nl> module WithSyntax ( Syntax : Syntax_sig . Syntax_S ) = struct <nl> with <nl> | ( Some text_from_ocaml , Some text_from_rust ) <nl> when text_from_ocaml < > text_from_rust - > <nl> - let oc = Pervasives . open_out " / tmp / rust . php " in <nl> + let oc = Stdlib . open_out " / tmp / rust . php " in <nl> Printf . fprintf oc " % s \ n " text_from_rust ; <nl> close_out oc ; <nl> - let oc = Pervasives . open_out " / tmp / ocaml . php " in <nl> + let oc = Stdlib . open_out " / tmp / ocaml . php " in <nl> Printf . fprintf oc " % s \ n " text_from_ocaml ; <nl> close_out oc ; <nl> Printf . printf " Printed tree not equal : % s \ n " path ; <nl> module WithSyntax ( Syntax : Syntax_sig . Syntax_S ) = struct <nl> if syntax_from_rust < > syntax_from_ocaml then ( <nl> let syntax_from_rust_as_json = to_json syntax_from_rust in <nl> let syntax_from_ocaml_as_json = to_json syntax_from_ocaml in <nl> - let oc = Pervasives . open_out " / tmp / rust . json " in <nl> + let oc = Stdlib . open_out " / tmp / rust . json " in <nl> Printf . fprintf oc " % s \ n " syntax_from_rust_as_json ; <nl> close_out oc ; <nl> - let oc = Pervasives . open_out " / tmp / ocaml . json " in <nl> + let oc = Stdlib . open_out " / tmp / ocaml . json " in <nl> Printf . fprintf oc " % s \ n " syntax_from_ocaml_as_json ; <nl> close_out oc ; <nl> <nl> module LowererTest_ = struct <nl> | Skip <nl> <nl> let print_err path s = <nl> - let oc = Pervasives . open_out path in <nl> + let oc = Stdlib . open_out path in <nl> Printf . fprintf oc " % s \ n " s <nl> <nl> let print_lid ~ skip_lid fmt lid = <nl> module LowererTest_ = struct <nl> String . concat ~ sep : " \ n " <nl> @ @ List . map ~ f : Full_fidelity_syntax_error . show errs <nl> in <nl> - let oc = Pervasives . open_out path in <nl> + let oc = Stdlib . open_out path in <nl> Rust_aast_parser_types . ( <nl> Printf . fprintf <nl> oc <nl> module ClosureConvertTest_ = struct <nl> <nl> let print_result path aast = <nl> let res = LowererTest_ . print_aast_result ~ skip_lid : true ( Ok aast ) in <nl> - let oc = Pervasives . open_out path in <nl> + let oc = Stdlib . open_out path in <nl> Printf . fprintf oc " % s " res ; <nl> - Pervasives . close_out oc ; <nl> + Stdlib . close_out oc ; <nl> res <nl> <nl> let test ( args : args ) file contents = <nl> module ClosureConvertTest_ = struct <nl> let rust_state = Emit_env . global_state_to_string rust_state in <nl> <nl> if ocaml_state < > rust_state then begin <nl> - let oc = Pervasives . open_out " / tmp / ocaml . state " in <nl> + let oc = Stdlib . open_out " / tmp / ocaml . state " in <nl> Printf . fprintf oc " % s \ n " ocaml_state ; <nl> close_out oc ; <nl> <nl> - let oc = Pervasives . open_out " / tmp / rust . state " in <nl> + let oc = Stdlib . open_out " / tmp / rust . state " in <nl> Printf . fprintf oc " % s \ n " rust_state ; <nl> close_out oc ; <nl> <nl> | Remove I / O usage of Pervasives in favor of Stdlib | facebook/hhvm | f3faa211a925d702a9ca1990f1caf1ce8db268b9 | 2020-03-26T20:49:52Z |
mmm a / lib / IRGen / IRGenDebugInfo . cpp <nl> ppp b / lib / IRGen / IRGenDebugInfo . cpp <nl> IRGenDebugInfoImpl : : IRGenDebugInfoImpl ( const IRGenOptions & Opts , <nl> llvm : : sys : : path : : remove_filename ( AbsMainFile ) ; <nl> MainModule = getOrCreateModule ( IGM . getSwiftModule ( ) , TheCU , Opts . ModuleName , <nl> AbsMainFile ) ; <nl> - DBuilder . createImportedModule ( MainFile , MainModule , 1 ) ; <nl> + DBuilder . createImportedModule ( MainFile , MainModule , MainFile , 0 ) ; <nl> <nl> / / Macro definitions that were defined by the user with " - Xcc - D " on the <nl> / / command line . This does not include any macros defined by ClangImporter . <nl> void IRGenDebugInfoImpl : : finalize ( ) { <nl> ModuleDecl : : ImportFilter : : All ) ; <nl> for ( auto M : ModuleWideImports ) <nl> if ( ! ImportedModules . count ( M . second ) ) <nl> - DBuilder . createImportedModule ( MainFile , getOrCreateModule ( M ) , 0 ) ; <nl> + DBuilder . createImportedModule ( MainFile , getOrCreateModule ( M ) , MainFile , <nl> + 0 ) ; <nl> <nl> / / Finalize all replaceable forward declarations . <nl> for ( auto & Ty : ReplaceMap ) { <nl> void IRGenDebugInfoImpl : : emitImport ( ImportDecl * D ) { <nl> ModuleDecl : : ImportedModule Imported = { D - > getModulePath ( ) , M } ; <nl> auto DIMod = getOrCreateModule ( Imported ) ; <nl> auto L = getDebugLoc ( * this , D ) ; <nl> - DBuilder . createImportedModule ( getOrCreateFile ( L . Filename ) , DIMod , L . Line ) ; <nl> + auto * File = getOrCreateFile ( L . Filename ) ; <nl> + DBuilder . createImportedModule ( File , DIMod , File , L . Line ) ; <nl> ImportedModules . insert ( Imported . second ) ; <nl> } <nl> <nl> mmm a / test / DebugInfo / ImportClangSubmodule . swift <nl> ppp b / test / DebugInfo / ImportClangSubmodule . swift <nl> <nl> / / CHECK - SAME : { { . . } } - DFOO = foo { { . . } } <nl> / / CHECK - SAME : { { . . } } - UBAR { { . . } } <nl> <nl> - / / CHECK : ! DIImportedEntity ( { { . * } } , entity : ! [ [ SUBMODULE ] ] , line : [ [ @ LINE + 1 ] ] ) <nl> + / / CHECK : ! DIImportedEntity ( { { . * } } , entity : ! [ [ SUBMODULE ] ] , file : <nl> + / / CHECK - SAME : line : [ [ @ LINE + 1 ] ] ) <nl> import ClangModule . SubModule <nl> / / CHECK : ! DIImportedEntity ( { { . * } } , entity : ! [ [ OTHERSUBMODULE ] ] , <nl> / / CHECK - SAME : line : [ [ @ LINE + 1 ] ] ) <nl> mmm a / test / DebugInfo / basic . swift <nl> ppp b / test / DebugInfo / basic . swift <nl> func foo ( _ a : Int64 , _ b : Int64 ) - > Int64 { <nl> / / CHECK - DAG : ! [ [ INT64 : . * ] ] = ! DICompositeType ( tag : DW_TAG_structure_type , name : " Int64 " , { { . * } } , identifier : " _T0s5Int64VD " ) <nl> / / CHECK - DAG : ! [ [ PARAMTYPES ] ] = ! { ! [ [ INT64 ] ] , ! [ [ INT64 ] ] , ! [ [ INT64 ] ] } <nl> / / Import of the main module with the implicit name . <nl> - / / CHECK - DAG : ! DIImportedEntity ( tag : DW_TAG_imported_module , scope : ! [ [ MAINFILE ] ] , entity : ! [ [ MAINMODULE : [ 0 - 9 ] + ] ] , line : 1 ) <nl> + / / CHECK - DAG : ! DIImportedEntity ( tag : DW_TAG_imported_module , scope : ! [ [ MAINFILE ] ] , entity : ! [ [ MAINMODULE : [ 0 - 9 ] + ] ] , file : ! [ [ MAINFILE ] ] , line : 1 ) <nl> / / CHECK - DAG : ! [ [ MAINMODULE ] ] = ! DIModule ( { { . * } } , name : " basic " <nl> <nl> / / DWARF Version <nl> | Update for LLVM IR metadata changes ( DIImportedEntity now needs a DIFile ) . | apple/swift | b85f1d679bfdf016b39183fa0c11a2d4f3fca051 | 2017-07-19T01:09:55Z |
mmm a / transportsender . cpp <nl> ppp b / transportsender . cpp <nl> void TransportSender < MyState > : : send_in_fragments ( string diff , uint64_t new_num <nl> connection - > send ( i - > tostring ( ) ) ; <nl> <nl> if ( verbose ) { <nl> - fprintf ( stderr , " [ % u ] Sent [ % d = > % d ] id % d , frag % d ack = % d , throwaway = % d , len = % d , frame rate = % . 2f , timeout = % d \ n " , <nl> + fprintf ( stderr , " [ % u ] Sent [ % d = > % d ] id % d , frag % d ack = % d , throwaway = % d , len = % d , frame rate = % . 2f , timeout = % d , srtt = % . 1f \ n " , <nl> ( unsigned int ) ( timestamp ( ) % 100000 ) , ( int ) inst . old_num ( ) , ( int ) inst . new_num ( ) , ( int ) i - > id , ( int ) i - > fragment_num , <nl> ( int ) inst . ack_num ( ) , ( int ) inst . throwaway_num ( ) , ( int ) i - > contents . size ( ) , <nl> 1000 . 0 / ( double ) send_interval ( ) , <nl> - ( int ) connection - > timeout ( ) ) ; <nl> + ( int ) connection - > timeout ( ) , connection - > get_SRTT ( ) ) ; <nl> } <nl> <nl> } <nl> | Print SRTT | mobile-shell/mosh | bbc836b40d961d0921f32248735b25e9fea6ab34 | 2011-10-30T07:38:22Z |
mmm a / browser / native_window . cc <nl> ppp b / browser / native_window . cc <nl> content : : WebContents * NativeWindow : : GetWebContents ( ) const { <nl> return inspectable_web_contents_ - > GetWebContents ( ) ; <nl> } <nl> <nl> + / / Window opened by window . open . <nl> + void NativeWindow : : WebContentsCreated ( <nl> + content : : WebContents * source_contents , <nl> + int64 source_frame_id , <nl> + const string16 & frame_name , <nl> + const GURL & target_url , <nl> + content : : WebContents * new_contents ) { <nl> + LOG ( WARNING ) < < " Please use node - style Window API to create window , " <nl> + " using window . open has very strict constrains . " ; <nl> + <nl> + scoped_ptr < base : : DictionaryValue > options ( new base : : DictionaryValue ) ; <nl> + options - > SetInteger ( switches : : kWidth , 800 ) ; <nl> + options - > SetInteger ( switches : : kHeight , 600 ) ; <nl> + <nl> + NativeWindow * window = Create ( new_contents , options . get ( ) ) ; <nl> + window - > InitFromOptions ( options . get ( ) ) ; <nl> + } <nl> + <nl> void NativeWindow : : Observe ( int type , <nl> const content : : NotificationSource & source , <nl> const content : : NotificationDetails & details ) { <nl> mmm a / browser / native_window . h <nl> ppp b / browser / native_window . h <nl> class NativeWindow : public content : : WebContentsDelegate , <nl> return inspectable_web_contents_ . get ( ) ; <nl> } <nl> <nl> + / / Implementations of content : : WebContentsDelegate . <nl> + virtual void WebContentsCreated ( content : : WebContents * source_contents , <nl> + int64 source_frame_id , <nl> + const string16 & frame_name , <nl> + const GURL & target_url , <nl> + content : : WebContents * new_contents ) OVERRIDE ; <nl> + <nl> / / Implementations of content : : NotificationObserver <nl> virtual void Observe ( int type , <nl> const content : : NotificationSource & source , <nl> | Implement window . open . | electron/electron | 7f581973c35a2bc1ff1461c3c0eed16a1d203386 | 2013-04-20T05:56:01Z |
mmm a / xbmc / FileSystem / IDirectory . cpp <nl> ppp b / xbmc / FileSystem / IDirectory . cpp <nl> bool IDirectory : : IsAllowed ( const CStdString & strFile ) const <nl> <nl> strExtension . ToLower ( ) ; <nl> strExtension + = ' | ' ; / / ensures that we have a | at the end of it <nl> - if ( ( size_t ) m_strFileMask . Find ( strExtension ) ! = CStdString : : npos ) <nl> + if ( ( size_t ) m_strFileMask . Find ( strExtension ) ! = - 1 ) <nl> { / / it ' s allowed , but we should also ignore all non dvd related ifo files . <nl> if ( strExtension . Equals ( " . ifo | " ) ) <nl> { <nl> mmm a / xbmc / VideoDatabase . cpp <nl> ppp b / xbmc / VideoDatabase . cpp <nl> bool CVideoDatabase : : GetTvShowsByWhere ( const CStdString & strBaseDir , const CStdS <nl> CTimeUtils : : GetTimeMS ( ) - time ) ; <nl> <nl> CStdString order ( where ) ; <nl> - bool maintainOrder = ( size_t ) order . ToLower ( ) . Find ( " order by " ) ! = CStdString : : npos ; <nl> + bool maintainOrder = ( size_t ) order . ToLower ( ) . Find ( " order by " ) ! = - 1 ; <nl> Stack ( items , VIDEODB_CONTENT_TVSHOWS , maintainOrder ) ; <nl> <nl> / / cleanup <nl> mmm a / xbmc / utils / LCD . cpp <nl> ppp b / xbmc / utils / LCD . cpp <nl> void ILCD : : LoadSkin ( const CStdString & xmlFile ) <nl> / / load our settings <nl> CStdString disableOnPlay ; <nl> XMLUtils : : GetString ( element , " disableonplay " , disableOnPlay ) ; <nl> - if ( disableOnPlay . Find ( " video " ) ! = ( int ) CStdString : : npos ) <nl> + if ( disableOnPlay . Find ( " video " ) ! = - 1 ) <nl> m_disableOnPlay | = DISABLE_ON_PLAY_VIDEO ; <nl> - if ( disableOnPlay . Find ( " music " ) ! = ( int ) CStdString : : npos ) <nl> + if ( disableOnPlay . Find ( " music " ) ! = - 1 ) <nl> m_disableOnPlay | = DISABLE_ON_PLAY_MUSIC ; <nl> <nl> TiXmlElement * mode = element - > FirstChildElement ( ) ; <nl> mmm a / xbmc / utils / ScraperParser . cpp <nl> ppp b / xbmc / utils / ScraperParser . cpp <nl> void CScraperParser : : ParseExpression ( const CStdString & input , CStdString & dest , <nl> { <nl> CStdString strResultNoCase = strResult ; <nl> strResultNoCase . ToLower ( ) ; <nl> - if ( ( size_t ) strResultNoCase . Find ( m_param [ iCompare - 1 ] ) ! = CStdString : : npos ) <nl> + if ( ( size_t ) strResultNoCase . Find ( m_param [ iCompare - 1 ] ) ! = - 1 ) <nl> dest + = strResult ; <nl> } <nl> else <nl> void CScraperParser : : Clean ( CStdString & strDirty ) <nl> { <nl> size_t i = 0 ; <nl> CStdString strBuffer ; <nl> - while ( ( i = strDirty . Find ( " ! ! ! CLEAN ! ! ! " , i ) ) ! = CStdString : : npos ) <nl> + while ( ( i = strDirty . Find ( " ! ! ! CLEAN ! ! ! " , i ) ) ! = - 1 ) <nl> { <nl> size_t i2 ; <nl> - if ( ( i2 = strDirty . Find ( " ! ! ! CLEAN ! ! ! " , i + 11 ) ) ! = CStdString : : npos ) <nl> + if ( ( i2 = strDirty . Find ( " ! ! ! CLEAN ! ! ! " , i + 11 ) ) ! = - 1 ) <nl> { <nl> strBuffer = strDirty . substr ( i + 11 , i2 - i - 11 ) ; <nl> CStdString strConverted ( strBuffer ) ; <nl> void CScraperParser : : Clean ( CStdString & strDirty ) <nl> break ; <nl> } <nl> i = 0 ; <nl> - while ( ( i = strDirty . Find ( " ! ! ! TRIM ! ! ! " , i ) ) ! = CStdString : : npos ) <nl> + while ( ( i = strDirty . Find ( " ! ! ! TRIM ! ! ! " , i ) ) ! = - 1 ) <nl> { <nl> size_t i2 ; <nl> - if ( ( i2 = strDirty . Find ( " ! ! ! TRIM ! ! ! " , i + 10 ) ) ! = CStdString : : npos ) <nl> + if ( ( i2 = strDirty . Find ( " ! ! ! TRIM ! ! ! " , i + 10 ) ) ! = - 1 ) <nl> { <nl> strBuffer = strDirty . substr ( i + 10 , i2 - i - 10 ) ; <nl> const char * szTrimmed = RemoveWhiteSpace ( strBuffer . c_str ( ) ) ; <nl> void CScraperParser : : Clean ( CStdString & strDirty ) <nl> break ; <nl> } <nl> i = 0 ; <nl> - while ( ( i = strDirty . Find ( " ! ! ! ENCODE ! ! ! " , i ) ) ! = CStdString : : npos ) <nl> + while ( ( i = strDirty . Find ( " ! ! ! ENCODE ! ! ! " , i ) ) ! = - 1 ) <nl> { <nl> size_t i2 ; <nl> - if ( ( i2 = strDirty . Find ( " ! ! ! ENCODE ! ! ! " , i + 12 ) ) ! = CStdString : : npos ) <nl> + if ( ( i2 = strDirty . Find ( " ! ! ! ENCODE ! ! ! " , i + 12 ) ) ! = - 1 ) <nl> { <nl> strBuffer = strDirty . substr ( i + 12 , i2 - i - 12 ) ; <nl> CUtil : : URLEncode ( strBuffer ) ; <nl> void CScraperParser : : InsertToken ( CStdString & strOutput , int buf , const char * tok <nl> char temp [ 4 ] ; <nl> sprintf ( temp , " \ \ % i " , buf ) ; <nl> size_t i2 = 0 ; <nl> - while ( ( i2 = strOutput . Find ( temp , i2 ) ) ! = CStdString : : npos ) <nl> + while ( ( i2 = strOutput . Find ( temp , i2 ) ) ! = - 1 ) <nl> { <nl> strOutput . Insert ( i2 , token ) ; <nl> i2 + = strlen ( token ) ; <nl> | fixed , CStdString : : Find ( ) returns - 1 not CStdString : : npos | xbmc/xbmc | a91c7684a57c3c0a0ab232c52d43fbec23adfb33 | 2010-04-14T01:08:30Z |
Subsets and Splits