diff
stringlengths 41
2.03M
| msg
stringlengths 1
1.5k
β | repo
stringlengths 5
40
| sha
stringlengths 40
40
| time
stringlengths 20
20
|
---|---|---|---|---|
mmm a / src / video_core / renderer_opengl / gl_state . cpp <nl> ppp b / src / video_core / renderer_opengl / gl_state . cpp <nl> void OpenGLState : : Apply ( ) const { <nl> / / Textures <nl> for ( unsigned i = 0 ; i < ARRAY_SIZE ( texture_units ) ; + + i ) { <nl> if ( texture_units [ i ] . texture_2d ! = cur_state . texture_units [ i ] . texture_2d ) { <nl> - glActiveTexture ( TextureUnits : : PicaTexture ( i ) . Enum ( ) ) ; <nl> + glActiveTexture ( TextureUnits : : MaxwellTexture ( i ) . Enum ( ) ) ; <nl> glBindTexture ( GL_TEXTURE_2D , texture_units [ i ] . texture_2d ) ; <nl> } <nl> if ( texture_units [ i ] . sampler ! = cur_state . texture_units [ i ] . sampler ) { <nl> mmm a / src / video_core / renderer_opengl / gl_state . h <nl> ppp b / src / video_core / renderer_opengl / gl_state . h <nl> struct TextureUnit { <nl> } <nl> } ; <nl> <nl> - constexpr TextureUnit PicaTexture ( int unit ) { <nl> + constexpr TextureUnit MaxwellTexture ( int unit ) { <nl> return TextureUnit { unit } ; <nl> } <nl> <nl> | GL : Rename PicaTexture to MaxwellTexture . | yuzu-emu/yuzu | 0171ec606bd9d6d66f7c566838aebf525d8e6dee | 2018-04-07T02:40:24Z |
mmm a / tools / jenkins / run_interop . sh <nl> ppp b / tools / jenkins / run_interop . sh <nl> <nl> set - ex <nl> <nl> # Enter the gRPC repo root <nl> - cd ` dirname $ 0 ` / . . / . . <nl> + cd $ ( dirname $ 0 ) / . . / . . <nl> <nl> tools / run_tests / run_interop_tests . py - - l all - - s all - - cloud_to_prod - - use_docker - t - j 8 <nl> | use recommended syntax for command subtitution | grpc/grpc | 265dfc0d038d37009f752a476021c396efffced5 | 2015-10-13T16:37:49Z |
mmm a / core / input_map . cpp <nl> ppp b / core / input_map . cpp <nl> void InputMap : : _bind_methods ( ) { <nl> ClassDB : : bind_method ( D_METHOD ( " add_action " , " action " , " deadzone " ) , & InputMap : : add_action , DEFVAL ( 0 . 5f ) ) ; <nl> ClassDB : : bind_method ( D_METHOD ( " erase_action " , " action " ) , & InputMap : : erase_action ) ; <nl> <nl> - ClassDB : : bind_method ( D_METHOD ( " action_set_deadzone " , " deadzone " ) , & InputMap : : action_set_deadzone ) ; <nl> + ClassDB : : bind_method ( D_METHOD ( " action_set_deadzone " , " action " , " deadzone " ) , & InputMap : : action_set_deadzone ) ; <nl> ClassDB : : bind_method ( D_METHOD ( " action_add_event " , " action " , " event " ) , & InputMap : : action_add_event ) ; <nl> ClassDB : : bind_method ( D_METHOD ( " action_has_event " , " action " , " event " ) , & InputMap : : action_has_event ) ; <nl> ClassDB : : bind_method ( D_METHOD ( " action_erase_event " , " action " , " event " ) , & InputMap : : action_erase_event ) ; <nl> mmm a / editor / spatial_editor_gizmos . cpp <nl> ppp b / editor / spatial_editor_gizmos . cpp <nl> void EditorSpatialGizmo : : _bind_methods ( ) { <nl> ClassDB : : bind_method ( D_METHOD ( " add_collision_segments " , " segments " ) , & EditorSpatialGizmo : : add_collision_segments ) ; <nl> ClassDB : : bind_method ( D_METHOD ( " add_collision_triangles " , " triangles " ) , & EditorSpatialGizmo : : add_collision_triangles ) ; <nl> ClassDB : : bind_method ( D_METHOD ( " add_unscaled_billboard " , " material " , " default_scale " ) , & EditorSpatialGizmo : : add_unscaled_billboard , DEFVAL ( 1 ) ) ; <nl> - ClassDB : : bind_method ( D_METHOD ( " add_handles " , " handles " , " billboard " , " secondary " ) , & EditorSpatialGizmo : : add_handles , DEFVAL ( false ) , DEFVAL ( false ) ) ; <nl> + ClassDB : : bind_method ( D_METHOD ( " add_handles " , " handles " , " material " , " billboard " , " secondary " ) , & EditorSpatialGizmo : : add_handles , DEFVAL ( false ) , DEFVAL ( false ) ) ; <nl> ClassDB : : bind_method ( D_METHOD ( " set_spatial_node " , " node " ) , & EditorSpatialGizmo : : _set_spatial_node ) ; <nl> ClassDB : : bind_method ( D_METHOD ( " clear " ) , & EditorSpatialGizmo : : clear ) ; <nl> ClassDB : : bind_method ( D_METHOD ( " set_hidden " , " hidden " ) , & EditorSpatialGizmo : : set_hidden ) ; <nl> mmm a / scene / 2d / skeleton_2d . cpp <nl> ppp b / scene / 2d / skeleton_2d . cpp <nl> void Skeleton2D : : _bind_methods ( ) { <nl> ClassDB : : bind_method ( D_METHOD ( " _update_transform " ) , & Skeleton2D : : _update_transform ) ; <nl> <nl> ClassDB : : bind_method ( D_METHOD ( " get_bone_count " ) , & Skeleton2D : : get_bone_count ) ; <nl> - ClassDB : : bind_method ( D_METHOD ( " get_bone " ) , & Skeleton2D : : get_bone ) ; <nl> + ClassDB : : bind_method ( D_METHOD ( " get_bone " , " idx " ) , & Skeleton2D : : get_bone ) ; <nl> <nl> ClassDB : : bind_method ( D_METHOD ( " get_skeleton " ) , & Skeleton2D : : get_skeleton ) ; <nl> } <nl> mmm a / scene / animation / animation_node_state_machine . cpp <nl> ppp b / scene / animation / animation_node_state_machine . cpp <nl> void AnimationNodeStateMachine : : _bind_methods ( ) { <nl> ClassDB : : bind_method ( D_METHOD ( " set_node_position " , " name " , " position " ) , & AnimationNodeStateMachine : : set_node_position ) ; <nl> ClassDB : : bind_method ( D_METHOD ( " get_node_position " , " name " ) , & AnimationNodeStateMachine : : get_node_position ) ; <nl> <nl> - ClassDB : : bind_method ( D_METHOD ( " has_transition " , " from " , " to " ) , & AnimationNodeStateMachine : : add_transition ) ; <nl> + ClassDB : : bind_method ( D_METHOD ( " has_transition " , " from " , " to " ) , & AnimationNodeStateMachine : : has_transition ) ; <nl> ClassDB : : bind_method ( D_METHOD ( " add_transition " , " from " , " to " , " transition " ) , & AnimationNodeStateMachine : : add_transition ) ; <nl> ClassDB : : bind_method ( D_METHOD ( " get_transition " , " idx " ) , & AnimationNodeStateMachine : : get_transition ) ; <nl> ClassDB : : bind_method ( D_METHOD ( " get_transition_from " , " idx " ) , & AnimationNodeStateMachine : : get_transition_from ) ; <nl> mmm a / scene / resources / mesh . cpp <nl> ppp b / scene / resources / mesh . cpp <nl> void ArrayMesh : : _bind_methods ( ) { <nl> ClassDB : : set_method_flags ( get_class_static ( ) , _scs_create ( " center_geometry " ) , METHOD_FLAGS_DEFAULT | METHOD_FLAG_EDITOR ) ; <nl> ClassDB : : bind_method ( D_METHOD ( " regen_normalmaps " ) , & ArrayMesh : : regen_normalmaps ) ; <nl> ClassDB : : set_method_flags ( get_class_static ( ) , _scs_create ( " regen_normalmaps " ) , METHOD_FLAGS_DEFAULT | METHOD_FLAG_EDITOR ) ; <nl> - ClassDB : : bind_method ( D_METHOD ( " lightmap_unwrap " ) , & ArrayMesh : : lightmap_unwrap ) ; <nl> + ClassDB : : bind_method ( D_METHOD ( " lightmap_unwrap " , " transform " , " texel_size " ) , & ArrayMesh : : lightmap_unwrap ) ; <nl> ClassDB : : set_method_flags ( get_class_static ( ) , _scs_create ( " lightmap_unwrap " ) , METHOD_FLAGS_DEFAULT | METHOD_FLAG_EDITOR ) ; <nl> ClassDB : : bind_method ( D_METHOD ( " get_faces " ) , & ArrayMesh : : get_faces ) ; <nl> ClassDB : : bind_method ( D_METHOD ( " generate_triangle_mesh " ) , & ArrayMesh : : generate_triangle_mesh ) ; <nl> mmm a / scene / resources / texture . cpp <nl> ppp b / scene / resources / texture . cpp <nl> void TextureLayered : : _bind_methods ( ) { <nl> <nl> ClassDB : : bind_method ( D_METHOD ( " create " , " width " , " height " , " depth " , " format " , " flags " ) , & TextureLayered : : create , DEFVAL ( FLAGS_DEFAULT ) ) ; <nl> ClassDB : : bind_method ( D_METHOD ( " set_layer_data " , " image " , " layer " ) , & TextureLayered : : set_layer_data ) ; <nl> - ClassDB : : bind_method ( D_METHOD ( " get_layer_data " , " layer " ) , & TextureLayered : : set_layer_data ) ; <nl> + ClassDB : : bind_method ( D_METHOD ( " get_layer_data " , " layer " ) , & TextureLayered : : get_layer_data ) ; <nl> ClassDB : : bind_method ( D_METHOD ( " set_data_partial " , " image " , " x_offset " , " y_offset " , " layer " , " mipmap " ) , & TextureLayered : : set_data_partial , DEFVAL ( 0 ) ) ; <nl> <nl> ClassDB : : bind_method ( D_METHOD ( " _set_data " , " data " ) , & TextureLayered : : _set_data ) ; <nl> mmm a / servers / audio_server . cpp <nl> ppp b / servers / audio_server . cpp <nl> void AudioServer : : _bind_methods ( ) { <nl> ClassDB : : bind_method ( D_METHOD ( " get_mix_rate " ) , & AudioServer : : get_mix_rate ) ; <nl> ClassDB : : bind_method ( D_METHOD ( " get_device_list " ) , & AudioServer : : get_device_list ) ; <nl> ClassDB : : bind_method ( D_METHOD ( " get_device " ) , & AudioServer : : get_device ) ; <nl> - ClassDB : : bind_method ( D_METHOD ( " set_device " ) , & AudioServer : : set_device ) ; <nl> + ClassDB : : bind_method ( D_METHOD ( " set_device " , " device " ) , & AudioServer : : set_device ) ; <nl> <nl> ClassDB : : bind_method ( D_METHOD ( " capture_get_device_list " ) , & AudioServer : : capture_get_device_list ) ; <nl> ClassDB : : bind_method ( D_METHOD ( " capture_get_device " ) , & AudioServer : : capture_get_device ) ; <nl> - ClassDB : : bind_method ( D_METHOD ( " capture_set_device " ) , & AudioServer : : capture_set_device ) ; <nl> + ClassDB : : bind_method ( D_METHOD ( " capture_set_device " , " name " ) , & AudioServer : : capture_set_device ) ; <nl> <nl> ClassDB : : bind_method ( D_METHOD ( " set_bus_layout " , " bus_layout " ) , & AudioServer : : set_bus_layout ) ; <nl> ClassDB : : bind_method ( D_METHOD ( " generate_bus_layout " ) , & AudioServer : : generate_bus_layout ) ; <nl> mmm a / servers / visual_server . cpp <nl> ppp b / servers / visual_server . cpp <nl> void VisualServer : : _bind_methods ( ) { <nl> ClassDB : : bind_method ( D_METHOD ( " gi_probe_get_bounds " , " probe " ) , & VisualServer : : gi_probe_get_bounds ) ; <nl> ClassDB : : bind_method ( D_METHOD ( " gi_probe_set_cell_size " , " probe " , " range " ) , & VisualServer : : gi_probe_set_cell_size ) ; <nl> ClassDB : : bind_method ( D_METHOD ( " gi_probe_get_cell_size " , " probe " ) , & VisualServer : : gi_probe_get_cell_size ) ; <nl> - ClassDB : : bind_method ( D_METHOD ( " gi_probe_set_to_cell_xform " , " xform " ) , & VisualServer : : gi_probe_set_to_cell_xform ) ; <nl> - ClassDB : : bind_method ( D_METHOD ( " gi_probe_get_to_cell_xform " ) , & VisualServer : : gi_probe_get_to_cell_xform ) ; <nl> - ClassDB : : bind_method ( D_METHOD ( " gi_probe_set_dynamic_data " , " data " ) , & VisualServer : : gi_probe_set_dynamic_data ) ; <nl> - ClassDB : : bind_method ( D_METHOD ( " gi_probe_get_dynamic_data " ) , & VisualServer : : gi_probe_get_dynamic_data ) ; <nl> - ClassDB : : bind_method ( D_METHOD ( " gi_probe_set_dynamic_range " , " range " ) , & VisualServer : : gi_probe_set_dynamic_range ) ; <nl> - ClassDB : : bind_method ( D_METHOD ( " gi_probe_get_dynamic_range " ) , & VisualServer : : gi_probe_get_dynamic_range ) ; <nl> - ClassDB : : bind_method ( D_METHOD ( " gi_probe_set_energy " , " energy " ) , & VisualServer : : gi_probe_set_energy ) ; <nl> - ClassDB : : bind_method ( D_METHOD ( " gi_probe_get_energy " ) , & VisualServer : : gi_probe_get_energy ) ; <nl> - ClassDB : : bind_method ( D_METHOD ( " gi_probe_set_bias " , " bias " ) , & VisualServer : : gi_probe_set_bias ) ; <nl> - ClassDB : : bind_method ( D_METHOD ( " gi_probe_get_bias " ) , & VisualServer : : gi_probe_get_bias ) ; <nl> - ClassDB : : bind_method ( D_METHOD ( " gi_probe_set_normal_bias " , " bias " ) , & VisualServer : : gi_probe_set_normal_bias ) ; <nl> - ClassDB : : bind_method ( D_METHOD ( " gi_probe_get_normal_bias " ) , & VisualServer : : gi_probe_get_normal_bias ) ; <nl> - ClassDB : : bind_method ( D_METHOD ( " gi_probe_set_propagation " , " propagation " ) , & VisualServer : : gi_probe_set_propagation ) ; <nl> - ClassDB : : bind_method ( D_METHOD ( " gi_probe_get_propagation " ) , & VisualServer : : gi_probe_get_propagation ) ; <nl> - ClassDB : : bind_method ( D_METHOD ( " gi_probe_set_interior " , " enable " ) , & VisualServer : : gi_probe_set_interior ) ; <nl> - ClassDB : : bind_method ( D_METHOD ( " gi_probe_is_interior " ) , & VisualServer : : gi_probe_is_interior ) ; <nl> - ClassDB : : bind_method ( D_METHOD ( " gi_probe_set_compress " , " enable " ) , & VisualServer : : gi_probe_set_compress ) ; <nl> - ClassDB : : bind_method ( D_METHOD ( " gi_probe_is_compressed " ) , & VisualServer : : gi_probe_is_compressed ) ; <nl> + ClassDB : : bind_method ( D_METHOD ( " gi_probe_set_to_cell_xform " , " probe " , " xform " ) , & VisualServer : : gi_probe_set_to_cell_xform ) ; <nl> + ClassDB : : bind_method ( D_METHOD ( " gi_probe_get_to_cell_xform " , " probe " ) , & VisualServer : : gi_probe_get_to_cell_xform ) ; <nl> + ClassDB : : bind_method ( D_METHOD ( " gi_probe_set_dynamic_data " , " probe " , " data " ) , & VisualServer : : gi_probe_set_dynamic_data ) ; <nl> + ClassDB : : bind_method ( D_METHOD ( " gi_probe_get_dynamic_data " , " probe " ) , & VisualServer : : gi_probe_get_dynamic_data ) ; <nl> + ClassDB : : bind_method ( D_METHOD ( " gi_probe_set_dynamic_range " , " probe " , " range " ) , & VisualServer : : gi_probe_set_dynamic_range ) ; <nl> + ClassDB : : bind_method ( D_METHOD ( " gi_probe_get_dynamic_range " , " probe " ) , & VisualServer : : gi_probe_get_dynamic_range ) ; <nl> + ClassDB : : bind_method ( D_METHOD ( " gi_probe_set_energy " , " probe " , " energy " ) , & VisualServer : : gi_probe_set_energy ) ; <nl> + ClassDB : : bind_method ( D_METHOD ( " gi_probe_get_energy " , " probe " ) , & VisualServer : : gi_probe_get_energy ) ; <nl> + ClassDB : : bind_method ( D_METHOD ( " gi_probe_set_bias " , " probe " , " bias " ) , & VisualServer : : gi_probe_set_bias ) ; <nl> + ClassDB : : bind_method ( D_METHOD ( " gi_probe_get_bias " , " probe " ) , & VisualServer : : gi_probe_get_bias ) ; <nl> + ClassDB : : bind_method ( D_METHOD ( " gi_probe_set_normal_bias " , " probe " , " bias " ) , & VisualServer : : gi_probe_set_normal_bias ) ; <nl> + ClassDB : : bind_method ( D_METHOD ( " gi_probe_get_normal_bias " , " probe " ) , & VisualServer : : gi_probe_get_normal_bias ) ; <nl> + ClassDB : : bind_method ( D_METHOD ( " gi_probe_set_propagation " , " probe " , " propagation " ) , & VisualServer : : gi_probe_set_propagation ) ; <nl> + ClassDB : : bind_method ( D_METHOD ( " gi_probe_get_propagation " , " probe " ) , & VisualServer : : gi_probe_get_propagation ) ; <nl> + ClassDB : : bind_method ( D_METHOD ( " gi_probe_set_interior " , " probe " , " enable " ) , & VisualServer : : gi_probe_set_interior ) ; <nl> + ClassDB : : bind_method ( D_METHOD ( " gi_probe_is_interior " , " probe " ) , & VisualServer : : gi_probe_is_interior ) ; <nl> + ClassDB : : bind_method ( D_METHOD ( " gi_probe_set_compress " , " probe " , " enable " ) , & VisualServer : : gi_probe_set_compress ) ; <nl> + ClassDB : : bind_method ( D_METHOD ( " gi_probe_is_compressed " , " probe " ) , & VisualServer : : gi_probe_is_compressed ) ; <nl> <nl> ClassDB : : bind_method ( D_METHOD ( " lightmap_capture_create " ) , & VisualServer : : lightmap_capture_create ) ; <nl> ClassDB : : bind_method ( D_METHOD ( " lightmap_capture_set_bounds " , " capture " , " bounds " ) , & VisualServer : : lightmap_capture_set_bounds ) ; <nl> | Fix arg name in docs , some copy - paste errors | godotengine/godot | 76adef27042b5185ab8a1db991cfff8ab872b928 | 2018-08-20T18:51:19Z |
mmm a / fdbserver / workloads / ReadWrite . actor . cpp <nl> ppp b / fdbserver / workloads / ReadWrite . actor . cpp <nl> struct ReadWriteWorkload : KVWorkload { <nl> elapsed + = self - > periodicLoggingInterval ; <nl> wait ( delayUntil ( start + elapsed ) ) ; <nl> <nl> - TraceEvent ( ( self - > description ( ) + " _RowReadLatency " ) . c_str ( ) ) . detail ( " Mean " , self - > readLatencies . mean ( ) ) . detail ( " Median " , self - > readLatencies . median ( ) ) . detail ( " Percentile5 " , self - > readLatencies . percentile ( . 05 ) ) . detail ( " Percentile95 " , self - > readLatencies . percentile ( . 95 ) ) . detail ( " Count " , self - > readLatencyCount ) . detail ( " Elapsed " , elapsed ) ; <nl> - TraceEvent ( ( self - > description ( ) + " _GRVLatency " ) . c_str ( ) ) . detail ( " Mean " , self - > GRVLatencies . mean ( ) ) . detail ( " Median " , self - > GRVLatencies . median ( ) ) . detail ( " Percentile5 " , self - > GRVLatencies . percentile ( . 05 ) ) . detail ( " Percentile95 " , self - > GRVLatencies . percentile ( . 95 ) ) ; <nl> - TraceEvent ( ( self - > description ( ) + " _CommitLatency " ) . c_str ( ) ) . detail ( " Mean " , self - > commitLatencies . mean ( ) ) . detail ( " Median " , self - > commitLatencies . median ( ) ) . detail ( " Percentile5 " , self - > commitLatencies . percentile ( . 05 ) ) . detail ( " Percentile95 " , self - > commitLatencies . percentile ( . 95 ) ) ; <nl> - TraceEvent ( ( self - > description ( ) + " _TotalLatency " ) . c_str ( ) ) . detail ( " Mean " , self - > latencies . mean ( ) ) . detail ( " Median " , self - > latencies . median ( ) ) . detail ( " Percentile5 " , self - > latencies . percentile ( . 05 ) ) . detail ( " Percentile95 " , self - > latencies . percentile ( . 95 ) ) ; <nl> + TraceEvent ( ( self - > description ( ) + " _RowReadLatency " ) . c_str ( ) ) <nl> + . detail ( " Mean " , self - > readLatencies . mean ( ) ) <nl> + . detail ( " Median " , self - > readLatencies . median ( ) ) <nl> + . detail ( " Percentile5 " , self - > readLatencies . percentile ( . 05 ) ) <nl> + . detail ( " Percentile95 " , self - > readLatencies . percentile ( . 95 ) ) <nl> + . detail ( " Percentile99 " , self - > readLatencies . percentile ( . 99 ) ) <nl> + . detail ( " Percentile99_9 " , self - > readLatencies . percentile ( . 999 ) ) <nl> + . detail ( " Max " , self - > readLatencies . max ( ) ) <nl> + . detail ( " Count " , self - > readLatencyCount ) <nl> + . detail ( " Elapsed " , elapsed ) ; <nl> + <nl> + TraceEvent ( ( self - > description ( ) + " _GRVLatency " ) . c_str ( ) ) <nl> + . detail ( " Mean " , self - > GRVLatencies . mean ( ) ) <nl> + . detail ( " Median " , self - > GRVLatencies . median ( ) ) <nl> + . detail ( " Percentile5 " , self - > GRVLatencies . percentile ( . 05 ) ) <nl> + . detail ( " Percentile95 " , self - > GRVLatencies . percentile ( . 95 ) ) <nl> + . detail ( " Percentile99 " , self - > GRVLatencies . percentile ( . 99 ) ) <nl> + . detail ( " Percentile99_9 " , self - > GRVLatencies . percentile ( . 999 ) ) <nl> + . detail ( " Max " , self - > GRVLatencies . max ( ) ) ; <nl> + <nl> + TraceEvent ( ( self - > description ( ) + " _CommitLatency " ) . c_str ( ) ) <nl> + . detail ( " Mean " , self - > commitLatencies . mean ( ) ) <nl> + . detail ( " Median " , self - > commitLatencies . median ( ) ) <nl> + . detail ( " Percentile5 " , self - > commitLatencies . percentile ( . 05 ) ) <nl> + . detail ( " Percentile95 " , self - > commitLatencies . percentile ( . 95 ) ) <nl> + . detail ( " Percentile99 " , self - > commitLatencies . percentile ( . 99 ) ) <nl> + . detail ( " Percentile99_9 " , self - > commitLatencies . percentile ( . 999 ) ) <nl> + . detail ( " Max " , self - > commitLatencies . max ( ) ) ; <nl> + <nl> + TraceEvent ( ( self - > description ( ) + " _TotalLatency " ) . c_str ( ) ) <nl> + . detail ( " Mean " , self - > latencies . mean ( ) ) <nl> + . detail ( " Median " , self - > latencies . median ( ) ) <nl> + . detail ( " Percentile5 " , self - > latencies . percentile ( . 05 ) ) <nl> + . detail ( " Percentile95 " , self - > latencies . percentile ( . 95 ) ) <nl> + . detail ( " Percentile99 " , self - > latencies . percentile ( . 99 ) ) <nl> + . detail ( " Percentile99_9 " , self - > latencies . percentile ( . 999 ) ) <nl> + . detail ( " Max " , self - > latencies . max ( ) ) ; <nl> <nl> int64_t ops = ( self - > aTransactions . getValue ( ) * ( self - > readsPerTransactionA + self - > writesPerTransactionA ) ) + <nl> ( self - > bTransactions . getValue ( ) * ( self - > readsPerTransactionB + self - > writesPerTransactionB ) ) ; <nl> | Merge pull request from ajbeamon / readwrite - workload - tail - latencies | apple/foundationdb | fb0bf1b426e298b9e9db99c21fe1a8dc4ed200d1 | 2020-02-24T19:53:19Z |
mmm a / test / cpp / qps / json_run_localhost . cc <nl> ppp b / test / cpp / qps / json_run_localhost . cc <nl> <nl> * <nl> * / <nl> <nl> + # include < signal . h > <nl> + # include < string . h > <nl> + <nl> # include < memory > <nl> + # include < mutex > <nl> # include < sstream > <nl> # include < string > <nl> <nl> <nl> # include " test / cpp / util / subprocess . h " <nl> <nl> using grpc : : SubProcess ; <nl> + typedef std : : unique_ptr < SubProcess > SubProcessPtr ; <nl> + std : : vector < SubProcessPtr > g_workers ; <nl> + SubProcessPtr g_driver ; <nl> <nl> template < class T > <nl> std : : string as_string ( const T & val ) { <nl> std : : string as_string ( const T & val ) { <nl> return out . str ( ) ; <nl> } <nl> <nl> + static void sighandler ( int sig ) { <nl> + g_driver - > Interrupt ( ) ; <nl> + for ( auto it = g_workers . begin ( ) ; it ! = g_workers . end ( ) ; + + it ) { <nl> + ( * it ) - > Interrupt ( ) ; <nl> + } <nl> + } <nl> + <nl> + static void register_sighandler ( ) { <nl> + struct sigaction act ; <nl> + memset ( & act , 0 , sizeof ( act ) ) ; <nl> + act . sa_handler = sighandler ; <nl> + <nl> + sigaction ( SIGINT , & act , NULL ) ; <nl> + sigaction ( SIGTERM , & act , NULL ) ; <nl> + } <nl> + <nl> int main ( int argc , char * * argv ) { <nl> - typedef std : : unique_ptr < SubProcess > SubProcessPtr ; <nl> - std : : vector < SubProcessPtr > jobs ; <nl> + register_sighandler ( ) ; <nl> <nl> std : : string my_bin = argv [ 0 ] ; <nl> std : : string bin_dir = my_bin . substr ( 0 , my_bin . rfind ( ' / ' ) ) ; <nl> int main ( int argc , char * * argv ) { <nl> auto port = grpc_pick_unused_port_or_die ( ) ; <nl> std : : vector < std : : string > args = { bin_dir + " / qps_worker " , " - driver_port " , <nl> as_string ( port ) } ; <nl> - jobs . emplace_back ( new SubProcess ( args ) ) ; <nl> + g_workers . emplace_back ( new SubProcess ( args ) ) ; <nl> if ( ! first ) env < < " , " ; <nl> env < < " localhost : " < < port ; <nl> first = false ; <nl> int main ( int argc , char * * argv ) { <nl> for ( int i = 1 ; i < argc ; i + + ) { <nl> args . push_back ( argv [ i ] ) ; <nl> } <nl> - GPR_ASSERT ( SubProcess ( args ) . Join ( ) = = 0 ) ; <nl> <nl> - for ( auto it = jobs . begin ( ) ; it ! = jobs . end ( ) ; + + it ) { <nl> + g_driver . reset ( new SubProcess ( args ) ) ; <nl> + const int driver_join_status = g_driver - > Join ( ) ; <nl> + for ( auto it = g_workers . begin ( ) ; it ! = g_workers . end ( ) ; + + it ) { <nl> ( * it ) - > Interrupt ( ) ; <nl> } <nl> - for ( auto it = jobs . begin ( ) ; it ! = jobs . end ( ) ; + + it ) { <nl> + for ( auto it = g_workers . begin ( ) ; it ! = g_workers . end ( ) ; + + it ) { <nl> ( * it ) - > Join ( ) ; <nl> } <nl> + GPR_ASSERT ( driver_join_status = = 0 ) ; <nl> } <nl> | Propagate termination signals to subprocesses | grpc/grpc | 6deadf5b8881d17e0960a46e5f995e0250e715d3 | 2016-11-29T02:02:37Z |
mmm a / brightray / brightray . gyp <nl> ppp b / brightray / brightray . gyp <nl> <nl> ' $ ( SDKROOT ) / System / Library / Frameworks / CoreMIDI . framework ' , <nl> ' $ ( SDKROOT ) / System / Library / Frameworks / CoreVideo . framework ' , <nl> ' $ ( SDKROOT ) / System / Library / Frameworks / OpenGL . framework ' , <nl> - ' $ ( SDKROOT ) / System / Library / Frameworks / QTKit . framework ' , <nl> # surface . gyp : <nl> ' $ ( SDKROOT ) / System / Library / Frameworks / IOSurface . framework ' , <nl> # content_common . gypi : <nl> | Control linking of QTKit in electron | electron/electron | 7caaad2c7acaf976a99ce1f2e906d8f469849bfa | 2015-10-09T13:29:51Z |
mmm a / tensorflow / core / kernels / histogram_op . cc <nl> ppp b / tensorflow / core / kernels / histogram_op . cc <nl> class HistogramFixedWidthOp : public OpKernel { <nl> TF_CALL_REAL_NUMBER_TYPES ( REGISTER_KERNELS ) ; <nl> # undef REGISTER_KERNELS <nl> <nl> - # if GOOGLE_CUDA <nl> + # if GOOGLE_CUDA | | TENSORFLOW_USE_ROCM <nl> # define REGISTER_KERNELS ( type ) \ <nl> REGISTER_KERNEL_BUILDER ( Name ( " HistogramFixedWidth " ) \ <nl> . Device ( DEVICE_GPU ) \ <nl> TF_CALL_REAL_NUMBER_TYPES ( REGISTER_KERNELS ) ; <nl> TF_CALL_GPU_NUMBER_TYPES ( REGISTER_KERNELS ) ; <nl> # undef REGISTER_KERNELS <nl> <nl> - # endif / / GOOGLE_CUDA <nl> + # endif / / GOOGLE_CUDA | | TENSORFLOW_USE_ROCM <nl> <nl> } / / end namespace tensorflow <nl> mmm a / tensorflow / core / kernels / histogram_op_gpu . cu . cc <nl> ppp b / tensorflow / core / kernels / histogram_op_gpu . cu . cc <nl> See the License for the specific language governing permissions and <nl> limitations under the License . <nl> = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = * / <nl> <nl> - # if GOOGLE_CUDA <nl> + # if GOOGLE_CUDA | | TENSORFLOW_USE_ROCM <nl> <nl> # define EIGEN_USE_GPU <nl> <nl> # include " third_party / eigen3 / unsupported / Eigen / CXX11 / Tensor " <nl> + # if GOOGLE_CUDA <nl> # include " third_party / cub / device / device_histogram . cuh " <nl> + # elif TENSORFLOW_USE_ROCM <nl> + # include " external / rocprim_archive / hipcub / include / hipcub / hipcub . hpp " <nl> + # endif <nl> # include " tensorflow / core / framework / op_kernel . h " <nl> # include " tensorflow / core / framework / register_types . h " <nl> # include " tensorflow / core / framework / tensor . h " <nl> limitations under the License . <nl> # include " tensorflow / core / platform / types . h " <nl> # include " tensorflow / core / util / gpu_kernel_helper . h " <nl> <nl> + # if GOOGLE_CUDA <nl> + namespace gpuprim = : : cub ; <nl> + # elif TENSORFLOW_USE_ROCM <nl> + namespace gpuprim = : : hipcub ; <nl> + # endif <nl> + <nl> namespace tensorflow { <nl> <nl> typedef Eigen : : GpuDevice GPUDevice ; <nl> struct HistogramFixedWidthFunctor < GPUDevice , T , Tout > { <nl> int num_levels = levels . size ( ) ; <nl> T * d_levels = levels . data ( ) ; <nl> int num_samples = values . size ( ) ; <nl> - const cudaStream_t & stream = GetCudaStream ( context ) ; <nl> + const gpuStream_t & stream = GetGpuStream ( context ) ; <nl> <nl> / / The first HistogramRange is to obtain the temp storage size required <nl> / / with d_temp_storage = NULL passed to the call . <nl> - auto err = cub : : DeviceHistogram : : HistogramRange ( <nl> + auto err = gpuprim : : DeviceHistogram : : HistogramRange ( <nl> / * d_temp_storage * / NULL , <nl> / * temp_storage_bytes * / temp_storage_bytes , <nl> / * d_samples * / d_samples , <nl> struct HistogramFixedWidthFunctor < GPUDevice , T , Tout > { <nl> / * d_levels * / d_levels , <nl> / * num_samples * / num_samples , <nl> / * stream * / stream ) ; <nl> - if ( err ! = cudaSuccess ) { <nl> + if ( err ! = gpuSuccess ) { <nl> return errors : : Internal ( <nl> " Could not launch HistogramRange to get temp storage : " , <nl> - cudaGetErrorString ( err ) , " . " ) ; <nl> + GpuGetErrorString ( err ) , " . " ) ; <nl> } <nl> <nl> Tensor temp_storage ; <nl> struct HistogramFixedWidthFunctor < GPUDevice , T , Tout > { <nl> <nl> / / The second HistogramRange is to actual run with d_temp_storage <nl> / / allocated with temp_storage_bytes . <nl> - err = cub : : DeviceHistogram : : HistogramRange ( <nl> + err = gpuprim : : DeviceHistogram : : HistogramRange ( <nl> / * d_temp_storage * / d_temp_storage , <nl> / * temp_storage_bytes * / temp_storage_bytes , <nl> / * d_samples * / d_samples , <nl> struct HistogramFixedWidthFunctor < GPUDevice , T , Tout > { <nl> / * d_levels * / d_levels , <nl> / * num_samples * / num_samples , <nl> / * stream * / stream ) ; <nl> - if ( err ! = cudaSuccess ) { <nl> + if ( err ! = gpuSuccess ) { <nl> return errors : : Internal ( <nl> - " Could not launch HistogramRange : " , cudaGetErrorString ( err ) , " . " ) ; <nl> + " Could not launch HistogramRange : " , GpuGetErrorString ( err ) , " . " ) ; <nl> } <nl> <nl> return Status : : OK ( ) ; <nl> | Merge pull request from ROCmSoftwarePlatform : google_upstream_histogram_op | tensorflow/tensorflow | 107c9e2d1a695e6bb21f89ca9a1faf0dce0f3729 | 2019-06-26T18:06:56Z |
mmm a / arangod / VocBase / general - cursor . c <nl> ppp b / arangod / VocBase / general - cursor . c <nl> TRI_general_cursor_result_t * TRI_CreateCursorResult ( void * data , <nl> <nl> TRI_general_cursor_result_t * result ; <nl> <nl> - if ( ! data ) { <nl> + if ( data = = NULL ) { <nl> return NULL ; <nl> } <nl> <nl> result = ( TRI_general_cursor_result_t * ) TRI_Allocate ( TRI_UNKNOWN_MEM_ZONE , sizeof ( TRI_general_cursor_result_t ) , false ) ; <nl> - if ( ! result ) { <nl> + if ( result = = NULL ) { <nl> return NULL ; <nl> } <nl> <nl> TRI_general_cursor_result_t * TRI_CreateCursorResult ( void * data , <nl> void TRI_DestroyCursorResult ( TRI_general_cursor_result_t * const result ) { <nl> assert ( result ) ; <nl> <nl> - if ( ! result - > _freed ) { <nl> + if ( ! result - > _freed ) { <nl> result - > freeData ( result ) ; <nl> result - > _freed = true ; <nl> } <nl> static inline TRI_general_cursor_row_t NextGeneralCursor ( TRI_general_cursor_t * <nl> return cursor - > _result - > getAt ( cursor - > _result , cursor - > _currentRow + + ) ; <nl> } <nl> <nl> - if ( ! cursor - > _result - > _freed ) { <nl> + if ( ! cursor - > _result - > _freed ) { <nl> cursor - > _result - > _freed = true ; <nl> cursor - > _result - > freeData ( cursor - > _result ) ; <nl> } <nl> | indenting | arangodb/arangodb | b2ce00f8a98495219e33bd265fae5d2f6ed5ff25 | 2013-06-24T17:24:21Z |
mmm a / hphp / hack / src / monitor / serverMonitor . ml <nl> ppp b / hphp / hack / src / monitor / serverMonitor . ml <nl> <nl> <nl> open Hh_core <nl> open ServerProcess <nl> - open ServerProcessTools <nl> open ServerMonitorUtils <nl> <nl> exception Malformed_build_id <nl> module Make_monitor ( SC : ServerMonitorUtils . Server_config ) <nl> let oom_code = Exit_status . ( exit_code Out_of_shared_memory ) in <nl> let was_oom = match proc_stat with <nl> | Unix . WEXITED code when code = oom_code - > true <nl> - | _ - > check_dmesg_for_oom process in <nl> + | _ - > Sys_utils . check_dmesg_for_oom process . pid " hh_server " in <nl> SC . on_server_exit monitor_config ; <nl> ServerProcessTools . check_exit_status proc_stat process monitor_config ; <nl> Died_unexpectedly ( proc_stat , was_oom ) ) <nl> mmm a / hphp / hack / src / monitor / serverProcessTools . ml <nl> ppp b / hphp / hack / src / monitor / serverProcessTools . ml <nl> <nl> * <nl> * ) <nl> <nl> - open Hh_core <nl> open ServerProcess <nl> open ServerMonitorUtils <nl> <nl> - let find_oom_in_dmesg_output process lines = <nl> - let re = Str . regexp ( Printf . sprintf <nl> - " Out of memory : Kill process \ \ ( [ 0 - 9 ] + \ \ ) ( hh_server ) " ) in <nl> - List . exists lines begin fun line - > <nl> - try <nl> - ignore @ @ Str . search_forward re line 0 ; <nl> - let pid_s = Str . matched_group 1 line in <nl> - int_of_string pid_s = process . pid <nl> - with Not_found - > false <nl> - end <nl> - <nl> - let check_dmesg_for_oom process = <nl> - let dmesg = Sys_utils . exec_read_lines ~ reverse : true " dmesg " in <nl> - find_oom_in_dmesg_output process dmesg <nl> - <nl> let check_exit_status proc_stat process monitor_config = <nl> match proc_stat with <nl> | Unix . WEXITED 0 - > ( ) <nl> | _ - > <nl> let exit_kind , exit_code = Exit_status . unpack proc_stat in <nl> Hh_logger . log " % s % s with exit code % d \ n " process . name exit_kind exit_code ; <nl> - let is_oom = try check_dmesg_for_oom process with _ - > false in <nl> + let is_oom = try Sys_utils . check_dmesg_for_oom process . pid " hh_server " with _ - > false in <nl> let time_taken = Unix . time ( ) - . process . start_t in <nl> HackEventLogger . bad_exit <nl> time_taken proc_stat <nl> mmm a / hphp / hack / src / utils / sys / sys_utils . ml <nl> ppp b / hphp / hack / src / utils / sys / sys_utils . ml <nl> let rec select_non_intr read write exn timeout = <nl> let rec waitpid_non_intr flags pid = <nl> try Unix . waitpid flags pid <nl> with Unix . Unix_error ( Unix . EINTR , _ , _ ) - > waitpid_non_intr flags pid <nl> + <nl> + ( * Exposing this for a unit test * ) <nl> + let find_oom_in_dmesg_output pid name lines = <nl> + let re = Str . regexp ( Printf . sprintf <nl> + " Out of memory : Kill process \ \ ( [ 0 - 9 ] + \ \ ) ( % s ) " name ) in <nl> + List . exists lines begin fun line - > <nl> + try <nl> + ignore @ @ Str . search_forward re line 0 ; <nl> + let pid_s = Str . matched_group 1 line in <nl> + int_of_string pid_s = pid <nl> + with Not_found - > false <nl> + end <nl> + <nl> + let check_dmesg_for_oom pid name = <nl> + let dmesg = exec_read_lines ~ reverse : true " dmesg " in <nl> + find_oom_in_dmesg_output pid name dmesg <nl> mmm a / hphp / hack / test / unit / server_tests . ml <nl> ppp b / hphp / hack / test / unit / server_tests . ml <nl> let test_dmesg_parser ( ) = <nl> " [ 3034339 . 262439 ] Out of memory : Kill process 2758734 ( hh_server ) \ <nl> score 253 or sacrifice child " ; <nl> ] in <nl> - ServerProcessTools . find_oom_in_dmesg_output test_process_data input <nl> + Sys_utils . find_oom_in_dmesg_output test_process_data . ServerProcess . pid " hh_server " input <nl> <nl> let tests = [ <nl> " test_dmesg_parser " , test_dmesg_parser ; <nl> | Log when oom killer kills Flow processes | facebook/hhvm | 583fb4e025eaf124f85575899620d3449d5234c9 | 2017-11-16T09:40:04Z |
mmm a / validation - test / compiler_crashers_fixed / DISABLED - 28277 - swift - archetypebuilder - getgenericsignature . swift <nl> ppp b / validation - test / compiler_crashers_fixed / DISABLED - 28277 - swift - archetypebuilder - getgenericsignature . swift <nl> <nl> / / See http : / / swift . org / LICENSE . txt for license information <nl> / / See http : / / swift . org / CONTRIBUTORS . txt for the list of Swift project authors <nl> <nl> - / / NOTRUN : not % target - swift - frontend % s - parse <nl> + / / RUN - DISABLED : not % target - swift - frontend % s - parse <nl> / / REQUIRES : asserts <nl> { <nl> protocol A { <nl> mmm a / validation - test / stdlib / Hashing - DISABLED . swift <nl> ppp b / validation - test / stdlib / Hashing - DISABLED . swift <nl> <nl> / / for it to be reliable and useful . <nl> / / <nl> <nl> - / / NOTRUN : % target - run - stdlib - swift <nl> + / / RUN - DISABLED : % target - run - stdlib - swift <nl> / / REQUIRES : executable_test <nl> <nl> import Swift <nl> | Try and disable these two tests for real . | apple/swift | dcc093f1797ea829389892b01c39cc716c9ea8c3 | 2016-03-26T14:55:41Z |
mmm a / lib / IRGen / GenCall . cpp <nl> ppp b / lib / IRGen / GenCall . cpp <nl> <nl> # include " swift / AST / ASTContext . h " <nl> # include " swift / AST / GenericEnvironment . h " <nl> # include " swift / Runtime / Config . h " <nl> + # include " swift / SIL / SILModule . h " <nl> # include " swift / SIL / SILType . h " <nl> # include " clang / AST / ASTContext . h " <nl> # include " clang / AST / RecordLayout . h " <nl> AsyncContextLayout irgen : : getAsyncContextLayout ( <nl> / / SelfType self ? ; <nl> bool hasLocalContextParameter = hasSelfContextParameter ( substitutedType ) ; <nl> bool canHaveValidError = substitutedType - > hasErrorResult ( ) ; <nl> - bool hasLocalContext = ( hasLocalContextParameter | | canHaveValidError | | <nl> - substitutedType - > getRepresentation ( ) = = <nl> - SILFunctionTypeRepresentation : : Thick ) ; <nl> + bool hasLocalContext = ( hasLocalContextParameter | | canHaveValidError ) ; <nl> SILParameterInfo localContextParameter = <nl> hasLocalContextParameter ? parameters . back ( ) : SILParameterInfo ( ) ; <nl> if ( hasLocalContextParameter ) { <nl> void SignatureExpansion : : addAsyncParameters ( ) { <nl> ParamIRTypes . push_back ( IGM . SwiftContextPtrTy ) ; <nl> / / TODO : Add actor . <nl> / / TODO : Add task . <nl> + if ( FnType - > getRepresentation ( ) = = SILFunctionTypeRepresentation : : Thick ) { <nl> + IGM . addSwiftSelfAttributes ( Attrs , ParamIRTypes . size ( ) ) ; <nl> + ParamIRTypes . push_back ( IGM . RefCountedPtrTy ) ; <nl> + } <nl> } <nl> <nl> void SignatureExpansion : : addCoroutineContextParameter ( ) { <nl> static void externalizeArguments ( IRGenFunction & IGF , const Callee & callee , <nl> Explosion & in , Explosion & out , <nl> TemporarySet & temporaries , bool isOutlined ) ; <nl> <nl> + llvm : : Value * irgen : : getDynamicAsyncContextSize ( IRGenFunction & IGF , <nl> + AsyncContextLayout layout , <nl> + CanSILFunctionType functionType , <nl> + llvm : : Value * thickContext ) { <nl> + switch ( functionType - > getRepresentation ( ) ) { <nl> + case SILFunctionTypeRepresentation : : Thick : { <nl> + / / If the called function is thick , the size of the called function ' s <nl> + / / async context may not be statically knowable . <nl> + / / <nl> + / / Specifically , if the thick function was produced by a partial_apply , <nl> + / / the function which was originally partially applied determines the <nl> + / / size of the needed async context . That original function isn ' t known <nl> + / / statically . The dynamic size is available within the context as an <nl> + / / i32 at the first index : < { % swift . refcounted * , / * size * / i32 , . . . } > . <nl> + / / <nl> + / / On the other hand , if the thick function was produced by a <nl> + / / thin_to_thick_function , then the context will be nullptr . In that <nl> + / / case , the size of the needed async context is known statically to <nl> + / / be the size dictated by the function signature . <nl> + / / <nl> + / / We are currently emitting into some basic block . To handle these two <nl> + / / cases , we need to branch based on whether the context is nullptr ; each <nl> + / / branch must then determine the size in the manner appropriate to it . <nl> + / / Finally , both blocks must join back together to make the call : <nl> + / / <nl> + / / SIL : IR : <nl> + / / + mmm - - + + mmmmmmmmmmmmmmmmmmmmmmmm - + <nl> + / / | . . . . . | | % cond = % ctx = = nullptr | <nl> + / / | apply | | br % cond , static , dynamic | <nl> + / / | . . . . . | + mmmmmm - - / mmmmmmmmmmmm - - \ - + <nl> + / / + mmm - - + / \ <nl> + / / + - staticmmmmmm - + + - dynamicmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmm - + <nl> + / / | % size = K | | % layout = bitcast % context to < { % swift . context * , i32 } > | <nl> + / / | br join ( % size ) | | % size_addr = getelementptr % layout , i32 1 , i32 0 | <nl> + / / + mmm - - \ mmmmmm - - + | % size = load % size_addr | <nl> + / / \ | br join ( % size ) | <nl> + / / \ + mmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmm + <nl> + / / \ / <nl> + / / + - join ( % size ) mmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmm - - + <nl> + / / | % dataAddr = swift_taskAlloc ( % task , % size ) | <nl> + / / | % async_context = bitcast % dataAddr to ASYNC_CONTEXT ( static_callee_type ) | <nl> + / / | . . . / / populate the fields % context with arguments | <nl> + / / | call % callee ( % async_context , % context ) | <nl> + / / + mmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmm - - + <nl> + auto * staticSizeBlock = llvm : : BasicBlock : : Create ( IGF . IGM . getLLVMContext ( ) ) ; <nl> + auto * dynamicSizeBlock = llvm : : BasicBlock : : Create ( IGF . IGM . getLLVMContext ( ) ) ; <nl> + auto * joinBlock = llvm : : BasicBlock : : Create ( IGF . IGM . getLLVMContext ( ) ) ; <nl> + <nl> + auto hasThickContext = <nl> + IGF . Builder . CreateICmpNE ( thickContext , IGF . IGM . RefCountedNull ) ; <nl> + IGF . Builder . CreateCondBr ( hasThickContext , dynamicSizeBlock , <nl> + staticSizeBlock ) ; <nl> + <nl> + SmallVector < std : : pair < llvm : : BasicBlock * , llvm : : Value * > , 2 > phiValues ; <nl> + { <nl> + IGF . Builder . emitBlock ( staticSizeBlock ) ; <nl> + auto size = getAsyncContextSize ( layout ) ; <nl> + auto * sizeValue = <nl> + llvm : : ConstantInt : : get ( IGF . IGM . Int32Ty , size . getValue ( ) ) ; <nl> + phiValues . push_back ( { staticSizeBlock , sizeValue } ) ; <nl> + IGF . Builder . CreateBr ( joinBlock ) ; <nl> + } <nl> + <nl> + { <nl> + IGF . Builder . emitBlock ( dynamicSizeBlock ) ; <nl> + SmallVector < const TypeInfo * , 4 > argTypeInfos ; <nl> + SmallVector < SILType , 4 > argValTypes ; <nl> + auto int32ASTType = <nl> + BuiltinIntegerType : : get ( 32 , IGF . IGM . IRGen . SIL . getASTContext ( ) ) <nl> + - > getCanonicalType ( ) ; <nl> + auto int32SILType = SILType : : getPrimitiveObjectType ( int32ASTType ) ; <nl> + const TypeInfo & int32TI = IGF . IGM . getTypeInfo ( int32SILType ) ; <nl> + argValTypes . push_back ( int32SILType ) ; <nl> + argTypeInfos . push_back ( & int32TI ) ; <nl> + HeapLayout layout ( IGF . IGM , LayoutStrategy : : Optimal , argValTypes , <nl> + argTypeInfos , <nl> + / * typeToFill * / nullptr , NecessaryBindings ( ) ) ; <nl> + auto castThickContext = <nl> + layout . emitCastTo ( IGF , thickContext , " context . prefix " ) ; <nl> + auto sizeLayout = layout . getElement ( 0 ) ; <nl> + auto sizeAddr = sizeLayout . project ( IGF , castThickContext , <nl> + / * NonFixedOffsets * / llvm : : None ) ; <nl> + auto * sizeValue = IGF . Builder . CreateLoad ( sizeAddr ) ; <nl> + phiValues . push_back ( { dynamicSizeBlock , sizeValue } ) ; <nl> + IGF . Builder . CreateBr ( joinBlock ) ; <nl> + } <nl> + <nl> + { <nl> + IGF . Builder . emitBlock ( joinBlock ) ; <nl> + auto * phi = IGF . Builder . CreatePHI ( IGF . IGM . Int32Ty , phiValues . size ( ) ) ; <nl> + for ( auto & entry : phiValues ) { <nl> + phi - > addIncoming ( entry . second , entry . first ) ; <nl> + } <nl> + return phi ; <nl> + } <nl> + } <nl> + case SILFunctionTypeRepresentation : : Thin : <nl> + case SILFunctionTypeRepresentation : : CFunctionPointer : <nl> + case SILFunctionTypeRepresentation : : Method : <nl> + case SILFunctionTypeRepresentation : : ObjCMethod : <nl> + case SILFunctionTypeRepresentation : : WitnessMethod : <nl> + case SILFunctionTypeRepresentation : : Closure : <nl> + case SILFunctionTypeRepresentation : : Block : { <nl> + auto size = getAsyncContextSize ( layout ) ; <nl> + auto * sizeValue = llvm : : ConstantInt : : get ( IGF . IGM . Int32Ty , size . getValue ( ) ) ; <nl> + return sizeValue ; <nl> + } <nl> + } <nl> + } <nl> + <nl> namespace { <nl> <nl> class SyncCallEmission final : public CallEmission { <nl> class AsyncCallEmission final : public CallEmission { <nl> Address contextBuffer ; <nl> Size contextSize ; <nl> Address context ; <nl> + llvm : : Value * thickContext = nullptr ; <nl> <nl> AsyncContextLayout getAsyncContextLayout ( ) { <nl> return : : getAsyncContextLayout ( IGF , getCallee ( ) . getOrigFunctionType ( ) , <nl> class AsyncCallEmission final : public CallEmission { <nl> super : : begin ( ) ; <nl> assert ( ! contextBuffer . isValid ( ) ) ; <nl> assert ( ! context . isValid ( ) ) ; <nl> - / / Allocate space for the async arguments . <nl> auto layout = getAsyncContextLayout ( ) ; <nl> - std : : tie ( contextBuffer , contextSize ) = emitAllocAsyncContext ( IGF , layout ) ; <nl> + / / Allocate space for the async arguments . <nl> + auto * dynamicContextSize32 = getDynamicAsyncContextSize ( <nl> + IGF , layout , CurCallee . getOrigFunctionType ( ) , thickContext ) ; <nl> + auto * dynamicContextSize = <nl> + IGF . Builder . CreateZExt ( dynamicContextSize32 , IGF . IGM . SizeTy ) ; <nl> + std : : tie ( contextBuffer , contextSize ) = emitAllocAsyncContext ( <nl> + IGF , layout , dynamicContextSize , getAsyncContextSize ( layout ) ) ; <nl> context = layout . emitCastTo ( IGF , contextBuffer . getAddress ( ) ) ; <nl> if ( layout . canHaveError ( ) ) { <nl> auto fieldLayout = layout . getErrorLayout ( ) ; <nl> class AsyncCallEmission final : public CallEmission { <nl> emitDeallocAsyncContext ( IGF , contextBuffer , contextSize ) ; <nl> super : : end ( ) ; <nl> } <nl> - void setFromCallee ( ) override { super : : setFromCallee ( ) ; } <nl> + void setFromCallee ( ) override { <nl> + super : : setFromCallee ( ) ; <nl> + thickContext = CurCallee . getSwiftContext ( ) ; <nl> + } <nl> SILType getParameterType ( unsigned index ) override { <nl> return getAsyncContextLayout ( ) . getParameterType ( index ) ; <nl> } <nl> class AsyncCallEmission final : public CallEmission { <nl> WitnessMetadata * witnessMetadata ) override { <nl> Explosion asyncExplosion ; <nl> asyncExplosion . add ( contextBuffer . getAddress ( ) ) ; <nl> + if ( getCallee ( ) . getRepresentation ( ) = = <nl> + SILFunctionTypeRepresentation : : Thick ) { <nl> + asyncExplosion . add ( getCallee ( ) . getSwiftContext ( ) ) ; <nl> + } <nl> super : : setArgs ( asyncExplosion , false , witnessMetadata ) ; <nl> SILFunctionConventions fnConv ( getCallee ( ) . getSubstFunctionType ( ) , <nl> IGF . getSILModule ( ) ) ; <nl> void irgen : : emitTaskDealloc ( IRGenFunction & IGF , Address address , <nl> llvm : : Attribute : : ReadNone ) ; <nl> } <nl> <nl> + std : : pair < Address , Size > irgen : : emitAllocAsyncContext ( IRGenFunction & IGF , <nl> + AsyncContextLayout layout , <nl> + llvm : : Value * sizeValue , <nl> + Size sizeLowerBound ) { <nl> + auto alignment = getAsyncContextAlignment ( IGF . IGM ) ; <nl> + auto address = emitTaskAlloc ( IGF , sizeValue , alignment ) ; <nl> + IGF . Builder . CreateLifetimeStart ( address , sizeLowerBound ) ; <nl> + return { address , sizeLowerBound } ; <nl> + } <nl> + <nl> std : : pair < Address , Size > <nl> irgen : : emitAllocAsyncContext ( IRGenFunction & IGF , AsyncContextLayout layout ) { <nl> auto size = getAsyncContextSize ( layout ) ; <nl> auto * sizeValue = llvm : : ConstantInt : : get ( IGF . IGM . SizeTy , size . getValue ( ) ) ; <nl> - auto alignment = getAsyncContextAlignment ( IGF . IGM ) ; <nl> - auto address = emitTaskAlloc ( IGF , sizeValue , alignment ) ; <nl> - IGF . Builder . CreateLifetimeStart ( address , size ) ; <nl> - return { address , size } ; <nl> + return emitAllocAsyncContext ( IGF , layout , sizeValue , size ) ; <nl> } <nl> <nl> void irgen : : emitDeallocAsyncContext ( IRGenFunction & IGF , Address context , <nl> mmm a / lib / IRGen / GenCall . h <nl> ppp b / lib / IRGen / GenCall . h <nl> namespace irgen { <nl> / / SwiftPartialFunction * __ptrauth ( . . . ) yieldToCaller ? ; <nl> / / SwiftError * errorResult ; <nl> / / IndirectResultTypes * indirectResults . . . ; <nl> - / / SelfType self ? ; <nl> - / / ArgTypes formalArguments . . . ; <nl> / / union { <nl> / / struct { <nl> / / SwiftPartialFunction * __ptrauth ( . . . ) resumeFromYield ? ; <nl> namespace irgen { <nl> assert ( hasLocalContext ( ) ) ; <nl> return getElement ( getLocalContextIndex ( ) ) ; <nl> } <nl> - ParameterConvention getLocalContextConvention ( ) { <nl> - assert ( hasLocalContext ( ) ) ; <nl> - return localContextInfo - > convention ; <nl> - } <nl> SILType getLocalContextType ( ) { <nl> assert ( hasLocalContext ( ) ) ; <nl> return localContextInfo - > type ; <nl> namespace irgen { <nl> Optional < ArgumentInfo > localContextInfo ) ; <nl> } ; <nl> <nl> + llvm : : Value * getDynamicAsyncContextSize ( IRGenFunction & IGF , <nl> + AsyncContextLayout layout , <nl> + CanSILFunctionType functionType , <nl> + llvm : : Value * thickContext ) ; <nl> AsyncContextLayout getAsyncContextLayout ( IRGenFunction & IGF , <nl> SILFunction * function ) ; <nl> <nl> namespace irgen { <nl> Address emitTaskAlloc ( IRGenFunction & IGF , llvm : : Value * size , <nl> Alignment alignment ) ; <nl> void emitTaskDealloc ( IRGenFunction & IGF , Address address , llvm : : Value * size ) ; <nl> + / / / Allocate task local storage for the specified layout but using the <nl> + / / / provided dynamic size . Allowing the size to be specified dynamically is <nl> + / / / necessary for applies of thick functions the sizes of whose async contexts <nl> + / / / are dependent on the underlying , already partially applied , called <nl> + / / / function . The provided sizeLowerBound will be used to track the lifetime <nl> + / / / of the allocation that is known statically . <nl> + std : : pair < Address , Size > emitAllocAsyncContext ( IRGenFunction & IGF , <nl> + AsyncContextLayout layout , <nl> + llvm : : Value * sizeValue , <nl> + Size sizeLowerBound ) ; <nl> std : : pair < Address , Size > emitAllocAsyncContext ( IRGenFunction & IGF , <nl> AsyncContextLayout layout ) ; <nl> void emitDeallocAsyncContext ( IRGenFunction & IGF , Address context , Size size ) ; <nl> mmm a / lib / IRGen / GenFunc . cpp <nl> ppp b / lib / IRGen / GenFunc . cpp <nl> static unsigned findSinglePartiallyAppliedParameterIndexIgnoringEmptyTypes ( <nl> return firstNonEmpty ; <nl> } <nl> <nl> - / / / Emit the forwarding stub function for a partial application . <nl> - / / / <nl> - / / / If ' layout ' is null , there is a single captured value of <nl> - / / / Swift - refcountable type that is being used directly as the <nl> - / / / context object . <nl> - static llvm : : Function * emitPartialApplicationForwarder ( IRGenModule & IGM , <nl> - const Optional < FunctionPointer > & staticFnPtr , <nl> - bool calleeHasContext , <nl> - const Signature & origSig , <nl> - CanSILFunctionType origType , <nl> - CanSILFunctionType substType , <nl> - CanSILFunctionType outType , <nl> - SubstitutionMap subs , <nl> - HeapLayout const * layout , <nl> - ArrayRef < ParameterConvention > conventions ) { <nl> - auto outSig = IGM . getSignature ( outType ) ; <nl> - llvm : : AttributeList outAttrs = outSig . getAttributes ( ) ; <nl> - llvm : : FunctionType * fwdTy = outSig . getType ( ) ; <nl> - SILFunctionConventions outConv ( outType , IGM . getSILModule ( ) ) ; <nl> - <nl> - StringRef FnName ; <nl> - if ( staticFnPtr ) <nl> - FnName = staticFnPtr - > getPointer ( ) - > getName ( ) ; <nl> - <nl> - IRGenMangler Mangler ; <nl> - std : : string thunkName = Mangler . manglePartialApplyForwarder ( FnName ) ; <nl> - <nl> - / / FIXME : Maybe cache the thunk by function and closure types ? . <nl> - llvm : : Function * fwd = <nl> - llvm : : Function : : Create ( fwdTy , llvm : : Function : : InternalLinkage , <nl> - llvm : : StringRef ( thunkName ) , & IGM . Module ) ; <nl> - fwd - > setCallingConv ( outSig . getCallingConv ( ) ) ; <nl> - <nl> - fwd - > setAttributes ( outAttrs ) ; <nl> - / / Merge initial attributes with outAttrs . <nl> - llvm : : AttrBuilder b ; <nl> - IGM . constructInitialFnAttributes ( b ) ; <nl> - fwd - > addAttributes ( llvm : : AttributeList : : FunctionIndex , b ) ; <nl> - <nl> - IRGenFunction subIGF ( IGM , fwd ) ; <nl> - if ( IGM . DebugInfo ) <nl> - IGM . DebugInfo - > emitArtificialFunction ( subIGF , fwd ) ; <nl> - <nl> - Explosion origParams = subIGF . collectParameters ( ) ; <nl> - <nl> + namespace { <nl> + class PartialApplicationForwarderEmission { <nl> + protected : <nl> + IRGenModule & IGM ; <nl> + IRGenFunction & subIGF ; <nl> + llvm : : Function * fwd ; <nl> + const Optional < FunctionPointer > & staticFnPtr ; <nl> + bool calleeHasContext ; <nl> + const Signature & origSig ; <nl> + CanSILFunctionType origType ; <nl> + CanSILFunctionType substType ; <nl> + CanSILFunctionType outType ; <nl> + SubstitutionMap subs ; <nl> + HeapLayout const * layout ; <nl> + const ArrayRef < ParameterConvention > conventions ; <nl> + SILFunctionConventions origConv ; <nl> + SILFunctionConventions outConv ; <nl> + Explosion origParams ; <nl> + <nl> + PartialApplicationForwarderEmission ( <nl> + IRGenModule & IGM , IRGenFunction & subIGF , llvm : : Function * fwd , <nl> + const Optional < FunctionPointer > & staticFnPtr , bool calleeHasContext , <nl> + const Signature & origSig , CanSILFunctionType origType , <nl> + CanSILFunctionType substType , CanSILFunctionType outType , <nl> + SubstitutionMap subs , HeapLayout const * layout , <nl> + ArrayRef < ParameterConvention > conventions ) <nl> + : IGM ( IGM ) , subIGF ( subIGF ) , fwd ( fwd ) , staticFnPtr ( staticFnPtr ) , <nl> + calleeHasContext ( calleeHasContext ) , origSig ( origSig ) , <nl> + origType ( origType ) , substType ( substType ) , outType ( outType ) , subs ( subs ) , <nl> + conventions ( conventions ) , origConv ( origType , IGM . getSILModule ( ) ) , <nl> + outConv ( outType , IGM . getSILModule ( ) ) , <nl> + origParams ( subIGF . collectParameters ( ) ) { } <nl> + <nl> + public : <nl> + enum class DynamicFunctionKind { <nl> + Witness , <nl> + PartialApply , <nl> + } ; <nl> + virtual void begin ( ) { } ; <nl> + virtual void gatherArgumentsFromApply ( ) = 0 ; <nl> + virtual unsigned getCurrentArgumentIndex ( ) = 0 ; <nl> + virtual bool transformArgumentToNative ( SILParameterInfo origParamInfo , <nl> + Explosion & in , Explosion & out ) = 0 ; <nl> + virtual void addArgument ( Explosion & explosion ) = 0 ; <nl> + virtual void addArgument ( llvm : : Value * argValue ) = 0 ; <nl> + virtual void addArgument ( Explosion & explosion , unsigned index ) = 0 ; <nl> + virtual void addArgument ( llvm : : Value * argValue , unsigned index ) = 0 ; <nl> + virtual SILParameterInfo getParameterInfo ( unsigned index ) = 0 ; <nl> + virtual llvm : : Value * getContext ( ) = 0 ; <nl> + virtual llvm : : Value * getDynamicFunctionPointer ( ) = 0 ; <nl> + virtual llvm : : Value * getDynamicFunctionContext ( ) = 0 ; <nl> + virtual void addDynamicFunctionContext ( Explosion & explosion , <nl> + DynamicFunctionKind kind ) = 0 ; <nl> + virtual void addDynamicFunctionPointer ( Explosion & explosion , <nl> + DynamicFunctionKind kind ) = 0 ; <nl> + virtual void addSelf ( Explosion & explosion ) = 0 ; <nl> + virtual void addWitnessSelfMetadata ( llvm : : Value * value ) = 0 ; <nl> + virtual void addWitnessSelfWitnessTable ( llvm : : Value * value ) = 0 ; <nl> + virtual void forwardErrorResult ( ) = 0 ; <nl> + virtual bool originalParametersConsumed ( ) = 0 ; <nl> + virtual void addPolymorphicArguments ( Explosion polyArgs ) = 0 ; <nl> + virtual llvm : : CallInst * createCall ( FunctionPointer & fnPtr ) = 0 ; <nl> + virtual void createReturn ( llvm : : CallInst * call ) = 0 ; <nl> + virtual void end ( ) { } ; <nl> + virtual ~ PartialApplicationForwarderEmission ( ) { } <nl> + } ; <nl> + class SyncPartialApplicationForwarderEmission <nl> + : public PartialApplicationForwarderEmission { <nl> + using super = PartialApplicationForwarderEmission ; <nl> / / Create a new explosion for potentially reabstracted parameters . <nl> Explosion args ; <nl> - <nl> Address resultValueAddr ; <nl> <nl> - { <nl> + public : <nl> + SyncPartialApplicationForwarderEmission ( <nl> + IRGenModule & IGM , IRGenFunction & subIGF , llvm : : Function * fwd , <nl> + const Optional < FunctionPointer > & staticFnPtr , bool calleeHasContext , <nl> + const Signature & origSig , CanSILFunctionType origType , <nl> + CanSILFunctionType substType , CanSILFunctionType outType , <nl> + SubstitutionMap subs , HeapLayout const * layout , <nl> + ArrayRef < ParameterConvention > conventions ) <nl> + : PartialApplicationForwarderEmission ( <nl> + IGM , subIGF , fwd , staticFnPtr , calleeHasContext , origSig , origType , <nl> + substType , outType , subs , layout , conventions ) { } <nl> + <nl> + void begin ( ) override { super : : begin ( ) ; } <nl> + void gatherArgumentsFromApply ( ) override { <nl> / / Lower the forwarded arguments in the original function ' s generic context . <nl> GenericContextScope scope ( IGM , origType - > getInvocationGenericSignature ( ) ) ; <nl> <nl> static llvm : : Function * emitPartialApplicationForwarder ( IRGenModule & IGM , <nl> nativeApplyArg . transferInto ( args , nativeApplyArg . size ( ) ) ; <nl> } <nl> } <nl> + unsigned getCurrentArgumentIndex ( ) override { return args . size ( ) ; } <nl> + bool transformArgumentToNative ( SILParameterInfo origParamInfo , Explosion & in , <nl> + Explosion & out ) override { <nl> + return addNativeArgument ( subIGF , in , origType , origParamInfo , out , false ) ; <nl> + } <nl> + void addArgument ( Explosion & explosion ) override { <nl> + args . add ( explosion . claimAll ( ) ) ; <nl> + } <nl> + void addArgument ( llvm : : Value * argValue ) override { args . add ( argValue ) ; } <nl> + void addArgument ( Explosion & explosion , unsigned index ) override { <nl> + addArgument ( explosion ) ; <nl> + } <nl> + void addArgument ( llvm : : Value * argValue , unsigned index ) override { <nl> + addArgument ( argValue ) ; <nl> + } <nl> + SILParameterInfo getParameterInfo ( unsigned index ) override { <nl> + return substType - > getParameters ( ) [ index ] ; <nl> + } <nl> + llvm : : Value * getContext ( ) override { return origParams . claimNext ( ) ; } <nl> + llvm : : Value * getDynamicFunctionPointer ( ) override { return args . takeLast ( ) ; } <nl> + llvm : : Value * getDynamicFunctionContext ( ) override { return args . takeLast ( ) ; } <nl> + void addDynamicFunctionContext ( Explosion & explosion , <nl> + DynamicFunctionKind kind ) override { <nl> + addArgument ( explosion ) ; <nl> + } <nl> + void addDynamicFunctionPointer ( Explosion & explosion , <nl> + DynamicFunctionKind kind ) override { <nl> + addArgument ( explosion ) ; <nl> + } <nl> + void addSelf ( Explosion & explosion ) override { addArgument ( explosion ) ; } <nl> + void addWitnessSelfMetadata ( llvm : : Value * value ) override { <nl> + addArgument ( value ) ; <nl> + } <nl> + void addWitnessSelfWitnessTable ( llvm : : Value * value ) override { <nl> + addArgument ( value ) ; <nl> + } <nl> + void forwardErrorResult ( ) override { <nl> + llvm : : Value * errorResultPtr = origParams . claimNext ( ) ; <nl> + args . add ( errorResultPtr ) ; <nl> + } <nl> + bool originalParametersConsumed ( ) override { return origParams . empty ( ) ; } <nl> + void addPolymorphicArguments ( Explosion polyArgs ) override { <nl> + polyArgs . transferInto ( args , polyArgs . size ( ) ) ; <nl> + } <nl> + llvm : : CallInst * createCall ( FunctionPointer & fnPtr ) override { <nl> + return subIGF . Builder . CreateCall ( fnPtr , args . claimAll ( ) ) ; <nl> + } <nl> + void createReturn ( llvm : : CallInst * call ) override { <nl> + / / Reabstract the result value as substituted . <nl> + SILFunctionConventions origConv ( origType , IGM . getSILModule ( ) ) ; <nl> + auto & outResultTI = IGM . getTypeInfo ( <nl> + outConv . getSILResultType ( IGM . getMaximalTypeExpansionContext ( ) ) ) ; <nl> + auto & nativeResultSchema = outResultTI . nativeReturnValueSchema ( IGM ) ; <nl> + if ( call - > getType ( ) - > isVoidTy ( ) ) { <nl> + if ( ! resultValueAddr . isValid ( ) ) <nl> + subIGF . Builder . CreateRetVoid ( ) ; <nl> + else { <nl> + / / Okay , we have called a function that expects an indirect return type <nl> + / / but the partially applied return type is direct . <nl> + assert ( ! nativeResultSchema . requiresIndirect ( ) ) ; <nl> + Explosion loadedResult ; <nl> + cast < LoadableTypeInfo > ( outResultTI ) <nl> + . loadAsTake ( subIGF , resultValueAddr , loadedResult ) ; <nl> + Explosion nativeResult = nativeResultSchema . mapIntoNative ( <nl> + IGM , subIGF , loadedResult , <nl> + outConv . getSILResultType ( IGM . getMaximalTypeExpansionContext ( ) ) , <nl> + false ) ; <nl> + outResultTI . deallocateStack ( <nl> + subIGF , resultValueAddr , <nl> + outConv . getSILResultType ( IGM . getMaximalTypeExpansionContext ( ) ) ) ; <nl> + if ( nativeResult . size ( ) = = 1 ) <nl> + subIGF . Builder . CreateRet ( nativeResult . claimNext ( ) ) ; <nl> + else { <nl> + llvm : : Value * nativeAgg = <nl> + llvm : : UndefValue : : get ( nativeResultSchema . getExpandedType ( IGM ) ) ; <nl> + for ( unsigned i = 0 , e = nativeResult . size ( ) ; i ! = e ; + + i ) { <nl> + auto * elt = nativeResult . claimNext ( ) ; <nl> + nativeAgg = subIGF . Builder . CreateInsertValue ( nativeAgg , elt , i ) ; <nl> + } <nl> + subIGF . Builder . CreateRet ( nativeAgg ) ; <nl> + } <nl> + } <nl> + } else { <nl> + llvm : : Value * callResult = call ; <nl> + / / If the result type is dependent on a type parameter we might have to <nl> + / / cast to the result type - it could be substituted . <nl> + if ( origConv . getSILResultType ( IGM . getMaximalTypeExpansionContext ( ) ) <nl> + . hasTypeParameter ( ) ) { <nl> + auto ResType = fwd - > getReturnType ( ) ; <nl> + if ( ResType ! = callResult - > getType ( ) ) <nl> + callResult = <nl> + subIGF . coerceValue ( callResult , ResType , subIGF . IGM . DataLayout ) ; <nl> + } <nl> + subIGF . Builder . CreateRet ( callResult ) ; <nl> + } <nl> + } <nl> + void end ( ) override { super : : end ( ) ; } <nl> + } ; <nl> + class AsyncPartialApplicationForwarderEmission <nl> + : public PartialApplicationForwarderEmission { <nl> + using super = PartialApplicationForwarderEmission ; <nl> + AsyncContextLayout layout ; <nl> + llvm : : Value * contextBuffer ; <nl> + Size contextSize ; <nl> + Address context ; <nl> + llvm : : Value * heapContextBuffer ; <nl> + unsigned currentArgumentIndex ; <nl> + struct DynamicFunction { <nl> + using Kind = DynamicFunctionKind ; <nl> + Kind kind ; <nl> + llvm : : Value * pointer ; <nl> + llvm : : Value * context ; <nl> + } ; <nl> + Optional < DynamicFunction > dynamicFunction = llvm : : None ; <nl> + struct Self { <nl> + enum class Kind { <nl> + Method , <nl> + WitnessMethod , <nl> + } ; <nl> + Kind kind ; <nl> + llvm : : Value * value ; <nl> + } ; <nl> + Optional < Self > self = llvm : : None ; <nl> + <nl> + llvm : : Value * loadValue ( ElementLayout layout ) { <nl> + Address addr = layout . project ( subIGF , context , / * offsets * / llvm : : None ) ; <nl> + auto & ti = cast < LoadableTypeInfo > ( layout . getType ( ) ) ; <nl> + Explosion explosion ; <nl> + ti . loadAsTake ( subIGF , addr , explosion ) ; <nl> + return explosion . claimNext ( ) ; <nl> + } <nl> + void saveValue ( ElementLayout layout , Explosion & explosion ) { <nl> + Address addr = layout . project ( subIGF , context , / * offsets * / llvm : : None ) ; <nl> + auto & ti = cast < LoadableTypeInfo > ( layout . getType ( ) ) ; <nl> + ti . initialize ( subIGF , explosion , addr , / * isOutlined * / false ) ; <nl> + } <nl> + void loadValue ( ElementLayout layout , Explosion & explosion ) { <nl> + Address addr = layout . project ( subIGF , context , / * offsets * / llvm : : None ) ; <nl> + auto & ti = cast < LoadableTypeInfo > ( layout . getType ( ) ) ; <nl> + ti . loadAsTake ( subIGF , addr , explosion ) ; <nl> + } <nl> + <nl> + public : <nl> + AsyncPartialApplicationForwarderEmission ( <nl> + IRGenModule & IGM , IRGenFunction & subIGF , llvm : : Function * fwd , <nl> + const Optional < FunctionPointer > & staticFnPtr , bool calleeHasContext , <nl> + const Signature & origSig , CanSILFunctionType origType , <nl> + CanSILFunctionType substType , CanSILFunctionType outType , <nl> + SubstitutionMap subs , HeapLayout const * layout , <nl> + ArrayRef < ParameterConvention > conventions ) <nl> + : PartialApplicationForwarderEmission ( <nl> + IGM , subIGF , fwd , staticFnPtr , calleeHasContext , origSig , origType , <nl> + substType , outType , subs , layout , conventions ) , <nl> + layout ( getAsyncContextLayout ( subIGF , origType , substType , subs ) ) , <nl> + currentArgumentIndex ( outType - > getNumParameters ( ) ) { <nl> + contextBuffer = origParams . claimNext ( ) ; <nl> + heapContextBuffer = origParams . claimNext ( ) ; <nl> + } <nl> + <nl> + void begin ( ) override { <nl> + super : : begin ( ) ; <nl> + assert ( contextBuffer ) ; <nl> + assert ( heapContextBuffer ) ; <nl> + context = layout . emitCastTo ( subIGF , contextBuffer ) ; <nl> + } <nl> + bool transformArgumentToNative ( SILParameterInfo origParamInfo , Explosion & in , <nl> + Explosion & out ) override { <nl> + out . add ( in . claimAll ( ) ) ; <nl> + return false ; <nl> + } <nl> + unsigned getCurrentArgumentIndex ( ) override { return currentArgumentIndex ; } <nl> + void gatherArgumentsFromApply ( ) override { <nl> + / / The provided % swift . context * already contains all the values from the <nl> + / / apply site . All that remains to do is bind polymorphic parameters . <nl> + for ( unsigned index = 0 ; index < outType - > getParameters ( ) . size ( ) ; + + index ) { <nl> + auto fieldLayout = layout . getArgumentLayout ( index ) ; <nl> + Explosion explosion ; <nl> + loadValue ( fieldLayout , explosion ) ; <nl> + bindPolymorphicParameter ( subIGF , origType , substType , explosion , index ) ; <nl> + ( void ) explosion . claimAll ( ) ; <nl> + / / TODO : Rather than just discard this explosion , avoid loading the <nl> + / / parameters if no polymorphic binding is necessary . <nl> + } <nl> + } <nl> + void addArgument ( llvm : : Value * argValue ) override { <nl> + addArgument ( argValue , currentArgumentIndex ) ; <nl> + } <nl> + void addArgument ( Explosion & explosion ) override { <nl> + addArgument ( explosion , currentArgumentIndex ) ; <nl> + } <nl> + void addArgument ( llvm : : Value * argValue , unsigned index ) override { <nl> + Explosion explosion ; <nl> + explosion . add ( argValue ) ; <nl> + addArgument ( explosion , index ) ; <nl> + } <nl> + void addArgument ( Explosion & explosion , unsigned index ) override { <nl> + currentArgumentIndex = index + 1 ; <nl> + auto isLocalContext = ( hasSelfContextParameter ( origType ) & & <nl> + index = = origType - > getParameters ( ) . size ( ) - 1 ) ; <nl> + if ( isLocalContext ) { <nl> + addSelf ( explosion ) ; <nl> + return ; <nl> + } <nl> + auto fieldLayout = layout . getArgumentLayout ( index ) ; <nl> + saveValue ( fieldLayout , explosion ) ; <nl> + } <nl> + SILParameterInfo getParameterInfo ( unsigned index ) override { <nl> + return origType - > getParameters ( ) [ index ] ; <nl> + } <nl> + llvm : : Value * getContext ( ) override { return heapContextBuffer ; } <nl> + llvm : : Value * getDynamicFunctionPointer ( ) override { <nl> + assert ( dynamicFunction & & dynamicFunction - > pointer ) ; <nl> + return dynamicFunction - > pointer ; <nl> + } <nl> + llvm : : Value * getDynamicFunctionContext ( ) override { <nl> + assert ( ( dynamicFunction & & dynamicFunction - > context ) | | <nl> + ( self & & self - > value ) ) ; <nl> + return dynamicFunction ? dynamicFunction - > context : self - > value ; <nl> + } <nl> + void addDynamicFunctionContext ( Explosion & explosion , <nl> + DynamicFunction : : Kind kind ) override { <nl> + auto * value = explosion . claimNext ( ) ; <nl> + assert ( explosion . empty ( ) ) ; <nl> + if ( dynamicFunction ) { <nl> + assert ( dynamicFunction - > kind = = kind ) ; <nl> + if ( dynamicFunction - > context ) { <nl> + assert ( dynamicFunction - > context = = value ) ; <nl> + } else { <nl> + dynamicFunction - > context = value ; <nl> + } <nl> + return ; <nl> + } <nl> + dynamicFunction = { kind , / * pointer * / nullptr , / * context * / value } ; <nl> + } <nl> + void addDynamicFunctionPointer ( Explosion & explosion , <nl> + DynamicFunction : : Kind kind ) override { <nl> + auto * value = explosion . claimNext ( ) ; <nl> + assert ( explosion . empty ( ) ) ; <nl> + if ( dynamicFunction ) { <nl> + assert ( dynamicFunction - > kind = = kind ) ; <nl> + if ( dynamicFunction - > pointer ) { <nl> + assert ( dynamicFunction - > pointer = = value ) ; <nl> + } else { <nl> + dynamicFunction - > pointer = value ; <nl> + } <nl> + return ; <nl> + } <nl> + dynamicFunction = { kind , / * pointer * / value , / * context * / nullptr } ; <nl> + } <nl> + void addSelf ( Explosion & explosion ) override { <nl> + auto * value = explosion . claimNext ( ) ; <nl> + assert ( explosion . empty ( ) ) ; <nl> + Self : : Kind kind = [ & ] ( SILFunctionTypeRepresentation representation ) { <nl> + switch ( representation ) { <nl> + case SILFunctionTypeRepresentation : : Method : <nl> + return Self : : Kind : : Method ; <nl> + case SILFunctionTypeRepresentation : : WitnessMethod : <nl> + return Self : : Kind : : WitnessMethod ; <nl> + default : <nl> + llvm_unreachable ( " representation does not have a self " ) ; <nl> + } <nl> + } ( origType - > getRepresentation ( ) ) ; <nl> + if ( self ) { <nl> + assert ( self - > kind = = kind ) ; <nl> + if ( self - > value ) { <nl> + assert ( self - > value = = value ) ; <nl> + } else { <nl> + self - > value = value ; <nl> + } <nl> + return ; <nl> + } <nl> + self = { kind , value } ; <nl> + <nl> + Explosion toSave ; <nl> + toSave . add ( value ) ; <nl> + auto fieldLayout = layout . getLocalContextLayout ( ) ; <nl> + saveValue ( fieldLayout , toSave ) ; <nl> + } <nl> + void addWitnessSelfMetadata ( llvm : : Value * value ) override { <nl> + auto fieldLayout = layout . getSelfMetadataLayout ( ) ; <nl> + Explosion explosion ; <nl> + explosion . add ( value ) ; <nl> + saveValue ( fieldLayout , explosion ) ; <nl> + } <nl> + void addWitnessSelfWitnessTable ( llvm : : Value * value ) override { <nl> + auto fieldLayout = layout . getSelfWitnessTableLayout ( ) ; <nl> + Explosion explosion ; <nl> + explosion . add ( value ) ; <nl> + saveValue ( fieldLayout , explosion ) ; <nl> + } <nl> + void forwardErrorResult ( ) override { <nl> + / / Nothing to do here . The error result pointer is already in the <nl> + / / appropriate position . <nl> + } <nl> + bool originalParametersConsumed ( ) override { <nl> + / / The original parameters remain in the initially allocated <nl> + / / % swift . context * , so they have always already been consumed . <nl> + return true ; <nl> + } <nl> + void addPolymorphicArguments ( Explosion polyArgs ) override { <nl> + if ( polyArgs . size ( ) = = 0 ) { <nl> + return ; <nl> + } <nl> + assert ( layout . hasBindings ( ) ) ; <nl> + auto bindingsLayout = layout . getBindingsLayout ( ) ; <nl> + auto bindingsAddr = <nl> + bindingsLayout . project ( subIGF , context , / * offsets * / None ) ; <nl> + layout . getBindings ( ) . save ( subIGF , bindingsAddr , polyArgs ) ; <nl> + } <nl> + llvm : : CallInst * createCall ( FunctionPointer & fnPtr ) override { <nl> + Explosion asyncExplosion ; <nl> + asyncExplosion . add ( contextBuffer ) ; <nl> + if ( dynamicFunction & & <nl> + dynamicFunction - > kind = = DynamicFunction : : Kind : : PartialApply ) { <nl> + assert ( dynamicFunction - > context ) ; <nl> + asyncExplosion . add ( dynamicFunction - > context ) ; <nl> + } <nl> + <nl> + return subIGF . Builder . CreateCall ( fnPtr , asyncExplosion . claimAll ( ) ) ; <nl> + } <nl> + void createReturn ( llvm : : CallInst * call ) override { <nl> + subIGF . Builder . CreateRetVoid ( ) ; <nl> + } <nl> + void end ( ) override { <nl> + assert ( context . isValid ( ) ) ; <nl> + super : : end ( ) ; <nl> + } <nl> + } ; <nl> + std : : unique_ptr < PartialApplicationForwarderEmission > <nl> + getPartialApplicationForwarderEmission ( <nl> + IRGenModule & IGM , IRGenFunction & subIGF , llvm : : Function * fwd , <nl> + const Optional < FunctionPointer > & staticFnPtr , bool calleeHasContext , <nl> + const Signature & origSig , CanSILFunctionType origType , <nl> + CanSILFunctionType substType , CanSILFunctionType outType , <nl> + SubstitutionMap subs , HeapLayout const * layout , <nl> + ArrayRef < ParameterConvention > conventions ) { <nl> + if ( origType - > isAsync ( ) ) { <nl> + return std : : make_unique < AsyncPartialApplicationForwarderEmission > ( <nl> + IGM , subIGF , fwd , staticFnPtr , calleeHasContext , origSig , origType , <nl> + substType , outType , subs , layout , conventions ) ; <nl> + } else { <nl> + return std : : make_unique < SyncPartialApplicationForwarderEmission > ( <nl> + IGM , subIGF , fwd , staticFnPtr , calleeHasContext , origSig , origType , <nl> + substType , outType , subs , layout , conventions ) ; <nl> + } <nl> + } <nl> + <nl> + } / / end anonymous namespace <nl> + <nl> + / / / Emit the forwarding stub function for a partial application . <nl> + / / / <nl> + / / / If ' layout ' is null , there is a single captured value of <nl> + / / / Swift - refcountable type that is being used directly as the <nl> + / / / context object . <nl> + static llvm : : Function * emitPartialApplicationForwarder ( IRGenModule & IGM , <nl> + const Optional < FunctionPointer > & staticFnPtr , <nl> + bool calleeHasContext , <nl> + const Signature & origSig , <nl> + CanSILFunctionType origType , <nl> + CanSILFunctionType substType , <nl> + CanSILFunctionType outType , <nl> + SubstitutionMap subs , <nl> + HeapLayout const * layout , <nl> + ArrayRef < ParameterConvention > conventions ) { <nl> + auto outSig = IGM . getSignature ( outType ) ; <nl> + llvm : : AttributeList outAttrs = outSig . getAttributes ( ) ; <nl> + llvm : : FunctionType * fwdTy = outSig . getType ( ) ; <nl> + SILFunctionConventions outConv ( outType , IGM . getSILModule ( ) ) ; <nl> + <nl> + StringRef FnName ; <nl> + if ( staticFnPtr ) <nl> + FnName = staticFnPtr - > getPointer ( ) - > getName ( ) ; <nl> + <nl> + IRGenMangler Mangler ; <nl> + std : : string thunkName = Mangler . manglePartialApplyForwarder ( FnName ) ; <nl> + <nl> + / / FIXME : Maybe cache the thunk by function and closure types ? . <nl> + llvm : : Function * fwd = <nl> + llvm : : Function : : Create ( fwdTy , llvm : : Function : : InternalLinkage , <nl> + llvm : : StringRef ( thunkName ) , & IGM . Module ) ; <nl> + fwd - > setCallingConv ( outSig . getCallingConv ( ) ) ; <nl> + <nl> + fwd - > setAttributes ( outAttrs ) ; <nl> + / / Merge initial attributes with outAttrs . <nl> + llvm : : AttrBuilder b ; <nl> + IGM . constructInitialFnAttributes ( b ) ; <nl> + fwd - > addAttributes ( llvm : : AttributeList : : FunctionIndex , b ) ; <nl> + <nl> + IRGenFunction subIGF ( IGM , fwd ) ; <nl> + if ( IGM . DebugInfo ) <nl> + IGM . DebugInfo - > emitArtificialFunction ( subIGF , fwd ) ; <nl> + <nl> + auto emission = getPartialApplicationForwarderEmission ( <nl> + IGM , subIGF , fwd , staticFnPtr , calleeHasContext , origSig , origType , <nl> + substType , outType , subs , layout , conventions ) ; <nl> + emission - > begin ( ) ; <nl> + emission - > gatherArgumentsFromApply ( ) ; <nl> <nl> struct AddressToDeallocate { <nl> SILType Type ; <nl> static llvm : : Function * emitPartialApplicationForwarder ( IRGenModule & IGM , <nl> Address data ; <nl> unsigned nextCapturedField = 0 ; <nl> if ( ! layout ) { <nl> - rawData = origParams . claimNext ( ) ; <nl> + rawData = emission - > getContext ( ) ; <nl> } else if ( ! layout - > isKnownEmpty ( ) ) { <nl> - rawData = origParams . claimNext ( ) ; <nl> + rawData = emission - > getContext ( ) ; <nl> data = layout - > emitCastTo ( subIGF , rawData ) ; <nl> + if ( origType - > isAsync ( ) ) { <nl> + / / Async layouts contain the size of the needed async context as their <nl> + / / first element . It is not a parameter and needs to be skipped . <nl> + + + nextCapturedField ; <nl> + } <nl> <nl> / / Restore type metadata bindings , if we have them . <nl> if ( layout - > hasBindings ( ) ) { <nl> static llvm : : Function * emitPartialApplicationForwarder ( IRGenModule & IGM , <nl> / / or there ' s an error result . <nl> } else if ( outType - > getRepresentation ( ) = = SILFunctionTypeRepresentation : : Thick <nl> | | outType - > hasErrorResult ( ) ) { <nl> - llvm : : Value * contextPtr = origParams . claimNext ( ) ; ( void ) contextPtr ; <nl> + llvm : : Value * contextPtr = emission - > getContext ( ) ; ( void ) contextPtr ; <nl> assert ( contextPtr - > getType ( ) = = IGM . RefCountedPtrTy ) ; <nl> } <nl> <nl> static llvm : : Function * emitPartialApplicationForwarder ( IRGenModule & IGM , <nl> / / arguments come before this . <nl> bool isWitnessMethodCallee = origType - > getRepresentation ( ) = = <nl> SILFunctionTypeRepresentation : : WitnessMethod ; <nl> + bool isMethodCallee = <nl> + origType - > getRepresentation ( ) = = SILFunctionTypeRepresentation : : Method ; <nl> Explosion witnessMethodSelfValue ; <nl> <nl> llvm : : Value * lastCapturedFieldPtr = nullptr ; <nl> static llvm : : Function * emitPartialApplicationForwarder ( IRGenModule & IGM , <nl> <nl> / / If there is a context argument , it comes after the polymorphic <nl> / / arguments . <nl> - auto argIndex = args . size ( ) ; <nl> + auto argIndex = emission - > getCurrentArgumentIndex ( ) ; <nl> if ( haveContextArgument ) <nl> argIndex + = polyArgs . size ( ) ; <nl> <nl> static llvm : : Function * emitPartialApplicationForwarder ( IRGenModule & IGM , <nl> } else { <nl> argValue = subIGF . Builder . CreateBitCast ( rawData , expectedArgTy ) ; <nl> } <nl> - args . add ( argValue ) ; <nl> + emission - > addArgument ( argValue ) ; <nl> <nl> / / If there ' s a data pointer required , grab it and load out the <nl> / / extra , previously - curried parameters . <nl> } else { <nl> unsigned origParamI = outType - > getParameters ( ) . size ( ) ; <nl> + unsigned extraFieldIndex = 0 ; <nl> assert ( layout - > getElements ( ) . size ( ) = = conventions . size ( ) <nl> & & " conventions don ' t match context layout " ) ; <nl> <nl> static llvm : : Function * emitPartialApplicationForwarder ( IRGenModule & IGM , <nl> if ( hasPolymorphicParams ) <nl> bindPolymorphicParameter ( subIGF , origType , substType , param , <nl> origParamI ) ; <nl> - emitApplyArgument ( subIGF , <nl> - origType , origParamInfo , <nl> - substType , substType - > getParameters ( ) [ origParamI ] , <nl> - param , origParam ) ; <nl> + emitApplyArgument ( subIGF , origType , origParamInfo , substType , <nl> + emission - > getParameterInfo ( origParamI ) , param , <nl> + origParam ) ; <nl> bool isWitnessMethodCalleeSelf = ( isWitnessMethodCallee & & <nl> origParamI + 1 = = origType - > getParameters ( ) . size ( ) ) ; <nl> - needsAllocas | = addNativeArgument ( <nl> - subIGF , origParam , origType , origParamInfo , <nl> - isWitnessMethodCalleeSelf ? witnessMethodSelfValue : args , false ) ; <nl> + Explosion arg ; <nl> + needsAllocas | = emission - > transformArgumentToNative ( <nl> + origParamInfo , origParam , <nl> + isWitnessMethodCalleeSelf ? witnessMethodSelfValue : arg ) ; <nl> + if ( ! isWitnessMethodCalleeSelf ) { <nl> + emission - > addArgument ( arg , origParamI ) ; <nl> + } <nl> + + origParamI ; <nl> } else { <nl> - args . add ( param . claimAll ( ) ) ; <nl> + switch ( extraFieldIndex ) { <nl> + case 0 : <nl> + emission - > addDynamicFunctionContext ( <nl> + param , isWitnessMethodCallee <nl> + ? PartialApplicationForwarderEmission : : <nl> + DynamicFunctionKind : : Witness <nl> + : PartialApplicationForwarderEmission : : <nl> + DynamicFunctionKind : : PartialApply ) ; <nl> + break ; <nl> + case 1 : <nl> + emission - > addDynamicFunctionPointer ( <nl> + param , isWitnessMethodCallee <nl> + ? PartialApplicationForwarderEmission : : <nl> + DynamicFunctionKind : : Witness <nl> + : PartialApplicationForwarderEmission : : <nl> + DynamicFunctionKind : : PartialApply ) ; <nl> + break ; <nl> + default : <nl> + llvm_unreachable ( " unexpected extra field in thick context " ) ; <nl> + } <nl> + + + extraFieldIndex ; <nl> } <nl> <nl> } <nl> static llvm : : Function * emitPartialApplicationForwarder ( IRGenModule & IGM , <nl> <nl> / / The dynamic function pointer is packed " last " into the context , <nl> / / and we pulled it out as an argument . Just pop it off . <nl> - auto fnPtr = args . takeLast ( ) ; <nl> + auto fnPtr = emission - > getDynamicFunctionPointer ( ) ; <nl> <nl> / / It comes out of the context as an i8 * . Cast to the function type . <nl> fnPtr = subIGF . Builder . CreateBitCast ( fnPtr , fnTy ) ; <nl> static llvm : : Function * emitPartialApplicationForwarder ( IRGenModule & IGM , <nl> / / In either case , it ' s the last thing in ' args ' . <nl> llvm : : Value * fnContext = nullptr ; <nl> if ( haveContextArgument ) <nl> - fnContext = args . takeLast ( ) ; <nl> + fnContext = emission - > getDynamicFunctionContext ( ) ; <nl> <nl> - polyArgs . transferInto ( args , polyArgs . size ( ) ) ; <nl> + emission - > addPolymorphicArguments ( std : : move ( polyArgs ) ) ; <nl> <nl> / / If we have a witness method call , the inner context is the <nl> / / witness table . Metadata for Self is derived inside the partial <nl> static llvm : : Function * emitPartialApplicationForwarder ( IRGenModule & IGM , <nl> <nl> / / Okay , this is where the callee context goes . <nl> } else if ( fnContext ) { <nl> - args . add ( fnContext ) ; <nl> + Explosion explosion ; <nl> + explosion . add ( fnContext ) ; <nl> + if ( isMethodCallee ) { <nl> + emission - > addSelf ( explosion ) ; <nl> + } else { <nl> + emission - > addDynamicFunctionContext ( <nl> + explosion , isWitnessMethodCallee <nl> + ? PartialApplicationForwarderEmission : : <nl> + DynamicFunctionKind : : Witness <nl> + : PartialApplicationForwarderEmission : : <nl> + DynamicFunctionKind : : PartialApply ) ; <nl> + } <nl> <nl> / / Pass a placeholder for thin function calls . <nl> } else if ( origType - > hasErrorResult ( ) ) { <nl> - args . add ( llvm : : UndefValue : : get ( IGM . RefCountedPtrTy ) ) ; <nl> + emission - > addArgument ( llvm : : UndefValue : : get ( IGM . RefCountedPtrTy ) ) ; <nl> } <nl> <nl> / / Add the witness methods self argument before the error parameter after the <nl> / / polymorphic arguments . <nl> if ( isWitnessMethodCallee ) <nl> - witnessMethodSelfValue . transferInto ( args , witnessMethodSelfValue . size ( ) ) ; <nl> + emission - > addSelf ( witnessMethodSelfValue ) ; <nl> <nl> / / Pass down the error result . <nl> if ( origType - > hasErrorResult ( ) ) { <nl> - llvm : : Value * errorResultPtr = origParams . claimNext ( ) ; <nl> - args . add ( errorResultPtr ) ; <nl> + emission - > forwardErrorResult ( ) ; <nl> } <nl> <nl> - assert ( origParams . empty ( ) ) ; <nl> + assert ( emission - > originalParametersConsumed ( ) ) ; <nl> <nl> if ( isWitnessMethodCallee ) { <nl> assert ( witnessMetadata . SelfMetadata - > getType ( ) = = IGM . TypeMetadataPtrTy ) ; <nl> - args . add ( witnessMetadata . SelfMetadata ) ; <nl> + emission - > addWitnessSelfMetadata ( witnessMetadata . SelfMetadata ) ; <nl> assert ( witnessMetadata . SelfWitnessTable - > getType ( ) = = IGM . WitnessTablePtrTy ) ; <nl> - args . add ( witnessMetadata . SelfWitnessTable ) ; <nl> + emission - > addWitnessSelfWitnessTable ( witnessMetadata . SelfWitnessTable ) ; <nl> } <nl> <nl> - llvm : : CallInst * call = subIGF . Builder . CreateCall ( fnPtr , args . claimAll ( ) ) ; <nl> - <nl> + llvm : : CallInst * call = emission - > createCall ( fnPtr ) ; <nl> + <nl> if ( addressesToDeallocate . empty ( ) & & ! needsAllocas & & <nl> ( ! consumesContext | | ! dependsOnContextLifetime ) ) <nl> call - > setTailCall ( ) ; <nl> static llvm : : Function * emitPartialApplicationForwarder ( IRGenModule & IGM , <nl> subIGF . emitNativeStrongRelease ( rawData , subIGF . getDefaultAtomicity ( ) ) ; <nl> } <nl> <nl> - / / Reabstract the result value as substituted . <nl> - SILFunctionConventions origConv ( origType , IGM . getSILModule ( ) ) ; <nl> - auto & outResultTI = IGM . getTypeInfo ( <nl> - outConv . getSILResultType ( IGM . getMaximalTypeExpansionContext ( ) ) ) ; <nl> - auto & nativeResultSchema = outResultTI . nativeReturnValueSchema ( IGM ) ; <nl> - if ( call - > getType ( ) - > isVoidTy ( ) ) { <nl> - if ( ! resultValueAddr . isValid ( ) ) <nl> - subIGF . Builder . CreateRetVoid ( ) ; <nl> - else { <nl> - / / Okay , we have called a function that expects an indirect return type <nl> - / / but the partially applied return type is direct . <nl> - assert ( ! nativeResultSchema . requiresIndirect ( ) ) ; <nl> - Explosion loadedResult ; <nl> - cast < LoadableTypeInfo > ( outResultTI ) <nl> - . loadAsTake ( subIGF , resultValueAddr , loadedResult ) ; <nl> - Explosion nativeResult = nativeResultSchema . mapIntoNative ( <nl> - IGM , subIGF , loadedResult , <nl> - outConv . getSILResultType ( IGM . getMaximalTypeExpansionContext ( ) ) , <nl> - false ) ; <nl> - outResultTI . deallocateStack ( <nl> - subIGF , resultValueAddr , <nl> - outConv . getSILResultType ( IGM . getMaximalTypeExpansionContext ( ) ) ) ; <nl> - if ( nativeResult . size ( ) = = 1 ) <nl> - subIGF . Builder . CreateRet ( nativeResult . claimNext ( ) ) ; <nl> - else { <nl> - llvm : : Value * nativeAgg = <nl> - llvm : : UndefValue : : get ( nativeResultSchema . getExpandedType ( IGM ) ) ; <nl> - for ( unsigned i = 0 , e = nativeResult . size ( ) ; i ! = e ; + + i ) { <nl> - auto * elt = nativeResult . claimNext ( ) ; <nl> - nativeAgg = subIGF . Builder . CreateInsertValue ( nativeAgg , elt , i ) ; <nl> - } <nl> - subIGF . Builder . CreateRet ( nativeAgg ) ; <nl> - } <nl> - } <nl> - } else { <nl> - llvm : : Value * callResult = call ; <nl> - / / If the result type is dependent on a type parameter we might have to <nl> - / / cast to the result type - it could be substituted . <nl> - if ( origConv . getSILResultType ( IGM . getMaximalTypeExpansionContext ( ) ) <nl> - . hasTypeParameter ( ) ) { <nl> - auto ResType = fwd - > getReturnType ( ) ; <nl> - if ( ResType ! = callResult - > getType ( ) ) <nl> - callResult = subIGF . coerceValue ( callResult , ResType , subIGF . IGM . DataLayout ) ; <nl> - } <nl> - subIGF . Builder . CreateRet ( callResult ) ; <nl> - } <nl> + emission - > createReturn ( call ) ; <nl> + emission - > end ( ) ; <nl> <nl> return fwd ; <nl> } <nl> Optional < StackAddress > irgen : : emitFunctionPartialApplication ( <nl> SmallVector < SILType , 4 > argValTypes ; <nl> SmallVector < ParameterConvention , 4 > argConventions ; <nl> <nl> + if ( origType - > isAsync ( ) ) { <nl> + / / Store the size of the partially applied async function ' s context here so <nl> + / / that it can be recovered by at the apply site . <nl> + auto int32ASTType = <nl> + BuiltinIntegerType : : get ( 32 , IGF . IGM . IRGen . SIL . getASTContext ( ) ) <nl> + - > getCanonicalType ( ) ; <nl> + auto int32SILType = SILType : : getPrimitiveObjectType ( int32ASTType ) ; <nl> + const TypeInfo & int32TI = IGF . IGM . getTypeInfo ( int32SILType ) ; <nl> + argValTypes . push_back ( int32SILType ) ; <nl> + argTypeInfos . push_back ( & int32TI ) ; <nl> + argConventions . push_back ( ParameterConvention : : Direct_Unowned ) ; <nl> + } <nl> + <nl> / / A context ' s HeapLayout stores all of the partially applied args . <nl> / / A HeapLayout is " fixed " if all of its fields have a fixed layout . <nl> / / Otherwise the HeapLayout is " non - fixed " . <nl> Optional < StackAddress > irgen : : emitFunctionPartialApplication ( <nl> auto bindings = NecessaryBindings : : forPartialApplyForwarder ( <nl> IGF . IGM , origType , subs , considerParameterSources ) ; <nl> <nl> + if ( origType - > isAsync ( ) ) { <nl> + / / The size of the async context needs to be available at the apply site . <nl> + / / <nl> + / / TODO : In the " single refcounted context " case the async " function <nl> + / / pointer " ( actually a pointer to a <nl> + / / constant { <nl> + / / / * context size * / i32 , <nl> + / / / * relative address of function * / i32 <nl> + / / } <nl> + / / rather than a pointer directly to the function ) would be able to <nl> + / / provide the async context size required . At the apply site , it is <nl> + / / possible to determine whether we ' re in the " single refcounted <nl> + / / context " by looking at the metadata of a nonnull context pointer <nl> + / / and checking whether it is TargetHeapMetadata . <nl> + hasSingleSwiftRefcountedContext = No ; <nl> + } <nl> + <nl> if ( ! bindings . empty ( ) ) { <nl> hasSingleSwiftRefcountedContext = No ; <nl> auto bindingsSize = bindings . getBufferSize ( IGF . IGM ) ; <nl> Optional < StackAddress > irgen : : emitFunctionPartialApplication ( <nl> & & argTypeInfos . size ( ) = = argConventions . size ( ) <nl> & & " argument info lists out of sync " ) ; <nl> HeapLayout layout ( IGF . IGM , LayoutStrategy : : Optimal , argValTypes , argTypeInfos , <nl> - / * typeToFill * / nullptr , <nl> - std : : move ( bindings ) ) ; <nl> + / * typeToFill * / nullptr , std : : move ( bindings ) , <nl> + / * bindingsIndex * / origType - > isAsync ( ) ? 1 : 0 ) ; <nl> <nl> llvm : : Value * data ; <nl> <nl> Optional < StackAddress > irgen : : emitFunctionPartialApplication ( <nl> Address dataAddr = layout . emitCastTo ( IGF , data ) ; <nl> <nl> unsigned i = 0 ; <nl> - <nl> + <nl> + if ( origType - > isAsync ( ) ) { <nl> + auto & fieldLayout = layout . getElement ( i ) ; <nl> + auto & fieldTI = fieldLayout . getType ( ) ; <nl> + Address fieldAddr = fieldLayout . project ( IGF , dataAddr , offsets ) ; <nl> + cast < LoadableTypeInfo > ( fieldTI ) . initialize ( IGF , args , fieldAddr , <nl> + isOutlined ) ; <nl> + + + i ; <nl> + } <nl> + <nl> / / Store necessary bindings , if we have them . <nl> if ( layout . hasBindings ( ) ) { <nl> auto & bindingsLayout = layout . getElement ( i ) ; <nl> mmm a / lib / IRGen / GenHeap . cpp <nl> ppp b / lib / IRGen / GenHeap . cpp <nl> HeapLayout : : HeapLayout ( IRGenModule & IGM , LayoutStrategy strategy , <nl> ArrayRef < SILType > fieldTypes , <nl> ArrayRef < const TypeInfo * > fieldTypeInfos , <nl> llvm : : StructType * typeToFill , <nl> - NecessaryBindings & & bindings ) <nl> - : StructLayout ( IGM , / * decl = * / nullptr , LayoutKind : : HeapObject , strategy , <nl> - fieldTypeInfos , typeToFill ) , <nl> - ElementTypes ( fieldTypes . begin ( ) , fieldTypes . end ( ) ) , <nl> - Bindings ( std : : move ( bindings ) ) <nl> - { <nl> + NecessaryBindings & & bindings , unsigned bindingsIndex ) <nl> + : StructLayout ( IGM , / * decl = * / nullptr , LayoutKind : : HeapObject , strategy , <nl> + fieldTypeInfos , typeToFill ) , <nl> + ElementTypes ( fieldTypes . begin ( ) , fieldTypes . end ( ) ) , <nl> + Bindings ( std : : move ( bindings ) ) , BindingsIndex ( bindingsIndex ) { <nl> # ifndef NDEBUG <nl> assert ( fieldTypeInfos . size ( ) = = fieldTypes . size ( ) <nl> & & " type infos don ' t match types " ) ; <nl> if ( ! Bindings . empty ( ) ) { <nl> - assert ( fieldTypeInfos . size ( ) > = 1 & & " no field for bindings " ) ; <nl> - auto fixedBindingsField = dyn_cast < FixedTypeInfo > ( fieldTypeInfos [ 0 ] ) ; <nl> + assert ( fieldTypeInfos . size ( ) > = ( bindingsIndex + 1 ) & & <nl> + " no field for bindings " ) ; <nl> + auto fixedBindingsField = <nl> + dyn_cast < FixedTypeInfo > ( fieldTypeInfos [ bindingsIndex ] ) ; <nl> assert ( fixedBindingsField <nl> & & " bindings field is not fixed size " ) ; <nl> assert ( fixedBindingsField - > getFixedSize ( ) <nl> static llvm : : Function * createDtorFn ( IRGenModule & IGM , <nl> if ( layout . hasBindings ( ) ) { <nl> / / The type metadata bindings should be at a fixed offset , so we can pass <nl> / / None for NonFixedOffsets . If we didn ' t , we ' d have a chicken - egg problem . <nl> - auto bindingsAddr = layout . getElement ( 0 ) . project ( IGF , structAddr , None ) ; <nl> + auto bindingsAddr = layout . getElement ( layout . getBindingsIndex ( ) ) <nl> + . project ( IGF , structAddr , None ) ; <nl> layout . getBindings ( ) . restore ( IGF , bindingsAddr , MetadataState : : Complete ) ; <nl> } <nl> <nl> mmm a / lib / IRGen / GenHeap . h <nl> ppp b / lib / IRGen / GenHeap . h <nl> namespace irgen { <nl> class HeapLayout : public StructLayout { <nl> SmallVector < SILType , 8 > ElementTypes ; <nl> NecessaryBindings Bindings ; <nl> + unsigned BindingsIndex ; <nl> mutable llvm : : Constant * privateMetadata = nullptr ; <nl> <nl> public : <nl> class HeapLayout : public StructLayout { <nl> ArrayRef < SILType > elementTypes , <nl> ArrayRef < const TypeInfo * > elementTypeInfos , <nl> llvm : : StructType * typeToFill = 0 , <nl> - NecessaryBindings & & bindings = { } ) ; <nl> - <nl> + NecessaryBindings & & bindings = { } , unsigned bindingsIndex = 0 ) ; <nl> + <nl> / / / True if the heap object carries type bindings . <nl> / / / <nl> / / / If true , the first element of the heap layout will be the type metadata <nl> class HeapLayout : public StructLayout { <nl> return Bindings ; <nl> } <nl> <nl> + unsigned getBindingsIndex ( ) const { return BindingsIndex ; } <nl> + <nl> + unsigned getIndexAfterBindings ( ) const { <nl> + return BindingsIndex + ( hasBindings ( ) ? 1 : 0 ) ; <nl> + } <nl> + <nl> / / / Get the types of the elements . <nl> ArrayRef < SILType > getElementTypes ( ) const { <nl> return ElementTypes ; <nl> mmm a / lib / IRGen / GenReflection . cpp <nl> ppp b / lib / IRGen / GenReflection . cpp <nl> class CaptureDescriptorBuilder : public ReflectionMetadataBuilder { <nl> return true ; <nl> } <nl> <nl> - auto ElementTypes = Layout . getElementTypes ( ) . slice ( <nl> - Layout . hasBindings ( ) ? 1 : 0 ) ; <nl> + auto ElementTypes = <nl> + Layout . getElementTypes ( ) . slice ( Layout . getIndexAfterBindings ( ) ) ; <nl> for ( auto ElementType : ElementTypes ) { <nl> auto SwiftType = ElementType . getASTType ( ) ; <nl> if ( SwiftType - > hasOpenedExistential ( ) ) <nl> class CaptureDescriptorBuilder : public ReflectionMetadataBuilder { <nl> / / / We ' ll keep track of how many things are in the bindings struct with its <nl> / / / own count in the capture descriptor . <nl> ArrayRef < SILType > getElementTypes ( ) { <nl> - return Layout . getElementTypes ( ) . slice ( Layout . hasBindings ( ) ? 1 : 0 ) ; <nl> + return Layout . getElementTypes ( ) . slice ( Layout . getIndexAfterBindings ( ) ) ; <nl> } <nl> <nl> / / / Build a map from generic parameter - > source of its metadata at runtime . <nl> mmm a / lib / IRGen / IRGenSIL . cpp <nl> ppp b / lib / IRGen / IRGenSIL . cpp <nl> class AsyncNativeCCEntryPointArgumentEmission final <nl> const Address dataAddr ; <nl> unsigned polymorphicParameterIndex = 0 ; <nl> <nl> - llvm : : Value * loadValue ( ElementLayout layout ) { <nl> + Explosion loadExplosion ( ElementLayout layout ) { <nl> Address addr = layout . project ( IGF , dataAddr , / * offsets * / llvm : : None ) ; <nl> auto & ti = cast < LoadableTypeInfo > ( layout . getType ( ) ) ; <nl> Explosion explosion ; <nl> ti . loadAsTake ( IGF , addr , explosion ) ; <nl> + return explosion ; <nl> + } <nl> + llvm : : Value * loadValue ( ElementLayout layout ) { <nl> + auto explosion = loadExplosion ( layout ) ; <nl> return explosion . claimNext ( ) ; <nl> } <nl> <nl> class AsyncNativeCCEntryPointArgumentEmission final <nl> } <nl> Explosion getArgumentExplosion ( unsigned index , unsigned size ) override { <nl> assert ( size > 0 ) ; <nl> - Explosion result ; <nl> - for ( unsigned i = index , end = index + size ; i < end ; + + i ) { <nl> - auto argumentLayout = layout . getArgumentLayout ( i ) ; <nl> - auto * value = loadValue ( argumentLayout ) ; <nl> - result . add ( value ) ; <nl> - } <nl> + auto argumentLayout = layout . getArgumentLayout ( index ) ; <nl> + auto result = loadExplosion ( argumentLayout ) ; <nl> + assert ( result . size ( ) = = size ) ; <nl> return result ; <nl> } <nl> bool requiresIndirectResult ( SILType retType ) override { return false ; } <nl> class AsyncNativeCCEntryPointArgumentEmission final <nl> return loadValue ( fieldLayout ) ; <nl> } <nl> llvm : : Value * getCoroutineBuffer ( ) override { <nl> - llvm_unreachable ( " unimplemented " ) ; <nl> + llvm_unreachable ( <nl> + " async functions do not use a fixed size coroutine buffer " ) ; <nl> } <nl> } ; <nl> <nl> static bool isSimplePartialApply ( IRGenFunction & IGF , PartialApplyInst * i ) { <nl> } <nl> <nl> void IRGenSILFunction : : visitPartialApplyInst ( swift : : PartialApplyInst * i ) { <nl> - / / TODO : Handle async ! <nl> SILValue v ( i ) ; <nl> <nl> if ( isSimplePartialApply ( * this , i ) ) { <nl> void IRGenSILFunction : : visitPartialApplyInst ( swift : : PartialApplyInst * i ) { <nl> <nl> Explosion llArgs ; <nl> <nl> + if ( i - > getOrigCalleeType ( ) - > isAsync ( ) ) { <nl> + auto result = getPartialApplicationFunction ( * this , i - > getCallee ( ) , <nl> + i - > getSubstitutionMap ( ) , <nl> + i - > getSubstCalleeType ( ) ) ; <nl> + llvm : : Value * innerContext = std : : get < 1 > ( result ) ; <nl> + auto layout = <nl> + getAsyncContextLayout ( * this , i - > getOrigCalleeType ( ) , <nl> + i - > getSubstCalleeType ( ) , i - > getSubstitutionMap ( ) ) ; <nl> + auto size = getDynamicAsyncContextSize ( <nl> + * this , layout , i - > getOrigCalleeType ( ) , innerContext ) ; <nl> + llArgs . add ( size ) ; <nl> + } <nl> + <nl> / / Lower the parameters in the callee ' s generic context . <nl> { <nl> GenericContextScope scope ( IGM , <nl> new file mode 100644 <nl> index 000000000000 . . cf41d13636db <nl> mmm / dev / null <nl> ppp b / test / IRGen / async / partial_apply . sil <nl> <nl> + / / RUN : % empty - directory ( % t ) <nl> + / / RUN : % target - swift - frontend - emit - module - enable - library - evolution - emit - module - path = % t / resilient_struct . swiftmodule - module - name = resilient_struct % S / . . / . . / Inputs / resilient_struct . swift <nl> + / / RUN : % target - swift - frontend - I % t - emit - ir % s | % FileCheck % s - - check - prefix = CHECK - - check - prefix = CHECK - % target - ptrsize <nl> + <nl> + / / REQUIRES : CPU = x86_64 <nl> + / / REQUIRES : concurrency <nl> + <nl> + import Builtin <nl> + import Swift <nl> + import resilient_struct <nl> + <nl> + class SwiftClass { } <nl> + sil_vtable SwiftClass { } <nl> + sil @ $ s13partial_apply10SwiftClassCfD : $ @ async @ convention ( method ) ( SwiftClass ) - > ( ) <nl> + <nl> + sil @ partially_applyable_to_class : $ @ async @ convention ( thin ) ( @ owned SwiftClass ) - > ( ) <nl> + sil @ partially_applyable_to_two_classes : $ @ async @ convention ( thin ) ( @ owned SwiftClass , @ owned SwiftClass ) - > ( ) <nl> + <nl> + sil @ use_closure : $ @ async @ convention ( thin ) ( @ noescape @ async @ callee_guaranteed ( ) - > ( ) ) - > ( ) <nl> + <nl> + / / CHECK : define { { ( dllexport ) ? } } { { ( protected ) ? } } swiftcc void @ partial_apply_class ( % swift . context * { { % [ 0 - 9 ] + } } ) { { # [ 0 - 9 ] + } } { <nl> + sil @ partial_apply_class : $ @ async @ convention ( thin ) ( SwiftClass ) - > @ async @ callee_owned ( ) - > ( ) { <nl> + entry ( % c : $ SwiftClass ) : <nl> + % f = function_ref @ partially_applyable_to_class : $ @ async @ convention ( thin ) ( @ owned SwiftClass ) - > ( ) <nl> + % g = partial_apply % f ( % c ) : $ @ async @ convention ( thin ) ( @ owned SwiftClass ) - > ( ) <nl> + return % g : $ @ async @ callee_owned ( ) - > ( ) <nl> + } <nl> + <nl> + / / CHECK : define { { ( dllexport ) ? } } { { ( protected ) ? } } swiftcc void @ partial_apply_class_on_stack ( % swift . context * { { % [ 0 - 9 ] + } } ) { { # [ 0 - 9 ] + } } { <nl> + sil @ partial_apply_class_on_stack : $ @ async @ convention ( thin ) ( @ owned SwiftClass ) - > ( ) { <nl> + entry ( % a : $ SwiftClass ) : <nl> + % f = function_ref @ partially_applyable_to_class : $ @ async @ convention ( thin ) ( @ owned SwiftClass ) - > ( ) <nl> + % c = partial_apply [ callee_guaranteed ] [ on_stack ] % f ( % a ) : $ @ async @ convention ( thin ) ( @ owned SwiftClass ) - > ( ) <nl> + % use = function_ref @ use_closure : $ @ async @ convention ( thin ) ( @ noescape @ async @ callee_guaranteed ( ) - > ( ) ) - > ( ) <nl> + apply % use ( % c ) : $ @ async @ convention ( thin ) ( @ noescape @ async @ callee_guaranteed ( ) - > ( ) ) - > ( ) <nl> + dealloc_stack % c : $ @ noescape @ async @ callee_guaranteed ( ) - > ( ) <nl> + strong_release % a : $ SwiftClass <nl> + % t = tuple ( ) <nl> + return % t : $ ( ) <nl> + } <nl> + <nl> + / / CHECK : define { { ( dllexport ) ? } } { { ( protected ) ? } } swiftcc void @ partial_apply_two_classes_on_stack ( % swift . context * { { % [ 0 - 9 ] + } } ) { { # [ 0 - 9 ] + } } { <nl> + <nl> + sil @ partial_apply_two_classes_on_stack : $ @ async @ convention ( thin ) ( @ owned SwiftClass , @ owned SwiftClass ) - > ( ) { <nl> + entry ( % a : $ SwiftClass , % b : $ SwiftClass ) : <nl> + % f = function_ref @ partially_applyable_to_two_classes : $ @ async @ convention ( thin ) ( @ owned SwiftClass , @ owned SwiftClass ) - > ( ) <nl> + % c = partial_apply [ callee_guaranteed ] [ on_stack ] % f ( % a , % b ) : $ @ async @ convention ( thin ) ( @ owned SwiftClass , @ owned SwiftClass ) - > ( ) <nl> + % use = function_ref @ use_closure : $ @ async @ convention ( thin ) ( @ noescape @ async @ callee_guaranteed ( ) - > ( ) ) - > ( ) <nl> + apply % use ( % c ) : $ @ async @ convention ( thin ) ( @ noescape @ async @ callee_guaranteed ( ) - > ( ) ) - > ( ) <nl> + dealloc_stack % c : $ @ noescape @ async @ callee_guaranteed ( ) - > ( ) <nl> + strong_release % a : $ SwiftClass <nl> + strong_release % b : $ SwiftClass <nl> + % t = tuple ( ) <nl> + return % t : $ ( ) <nl> + } <nl> + / / CHECK - LABEL : define internal swiftcc void @ " $ s22generic_captured_paramTA " ( % swift . context * { { % [ 0 - 9 ] + } } , % swift . refcounted * swiftself { { % [ 0 - 9 ] + } } ) { { # [ 0 - 9 ] + } } { <nl> + sil public_external @ generic_captured_param : $ @ async @ convention ( thin ) < T > ( Int , @ inout T ) - > Int <nl> + <nl> + sil @ partial_apply_generic_capture : $ @ async @ convention ( thin ) ( Int ) - > @ async @ callee_owned ( Int ) - > Int { <nl> + entry ( % x : $ Int ) : <nl> + % a = alloc_stack $ Int <nl> + store % x to % a : $ * Int <nl> + % f = function_ref @ generic_captured_param : $ @ async @ convention ( thin ) < T > ( Int , @ inout T ) - > Int <nl> + % p = partial_apply % f < Int > ( % a ) : $ @ async @ convention ( thin ) < T > ( Int , @ inout T ) - > Int <nl> + dealloc_stack % a : $ * Int <nl> + return % p : $ @ async @ callee_owned ( Int ) - > Int <nl> + } <nl> + <nl> + sil public_external @ generic_captured_and_open_param : $ @ async @ convention ( thin ) < T > ( @ in T , @ inout T ) - > @ out T <nl> + <nl> + / / CHECK - LABEL : define { { ( dllexport ) ? } } { { ( protected ) ? } } swiftcc void @ partial_apply_open_generic_capture ( % swift . context * { { % [ 0 - 9 ] + } } ) { { # [ 0 - 9 ] + } } { <nl> + sil @ partial_apply_open_generic_capture : $ @ async @ convention ( thin ) < T > ( @ inout T ) - > @ async @ callee_owned ( @ in T ) - > @ out T { <nl> + entry ( % a : $ * T ) : <nl> + % f = function_ref @ generic_captured_and_open_param : $ @ async @ convention ( thin ) < U > ( @ in U , @ inout U ) - > @ out U <nl> + % p = partial_apply % f < T > ( % a ) : $ @ async @ convention ( thin ) < U > ( @ in U , @ inout U ) - > @ out U <nl> + return % p : $ @ async @ callee_owned ( @ in T ) - > @ out T <nl> + } <nl> + <nl> + / * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * / <nl> + / * Swift - refcounted class captures . Optimizable by using the reference * / <nl> + / * as the partial apply context . * / <nl> + / * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * / <nl> + <nl> + sil public_external @ guaranteed_captured_class_param : $ @ async @ convention ( thin ) ( Int , @ guaranteed SwiftClass ) - > Int <nl> + <nl> + / / CHECK - LABEL : define { { ( dllexport ) ? } } { { ( protected ) ? } } swiftcc void @ partial_apply_guaranteed_class_param ( % swift . context * { { % [ 0 - 9 ] + } } ) { { # [ 0 - 9 ] + } } { <nl> + <nl> + sil @ partial_apply_guaranteed_class_param : $ @ async @ convention ( thin ) ( @ owned SwiftClass ) - > @ async @ callee_owned ( Int ) - > Int { <nl> + bb0 ( % x : $ SwiftClass ) : <nl> + % f = function_ref @ guaranteed_captured_class_param : $ @ async @ convention ( thin ) ( Int , @ guaranteed SwiftClass ) - > Int <nl> + % p = partial_apply % f ( % x ) : $ @ async @ convention ( thin ) ( Int , @ guaranteed SwiftClass ) - > Int <nl> + return % p : $ @ async @ callee_owned ( Int ) - > Int <nl> + } <nl> + <nl> + sil public_external @ indirect_guaranteed_captured_class_param : $ @ async @ convention ( thin ) ( Int , @ in_guaranteed SwiftClass ) - > Int <nl> + <nl> + / / CHECK - LABEL : define { { ( dllexport ) ? } } { { ( protected ) ? } } swiftcc void @ partial_apply_indirect_guaranteed_class_param ( % swift . context * { { % [ 0 - 9 ] + } } ) { { # [ 0 - 9 ] + } } { <nl> + / / CHECK - LABEL : define internal swiftcc void @ " $ s40indirect_guaranteed_captured_class_paramTA " ( % swift . context * { { % [ 0 - 9 ] + } } , % swift . refcounted * swiftself { { % [ 0 - 9 ] + } } ) { { # [ 0 - 9 ] + } } { <nl> + <nl> + sil @ partial_apply_indirect_guaranteed_class_param : $ @ async @ convention ( thin ) ( @ in SwiftClass ) - > @ async @ callee_owned ( Int ) - > Int { <nl> + bb0 ( % x : $ * SwiftClass ) : <nl> + % f = function_ref @ indirect_guaranteed_captured_class_param : $ @ async @ convention ( thin ) ( Int , @ in_guaranteed SwiftClass ) - > Int <nl> + % p = partial_apply % f ( % x ) : $ @ async @ convention ( thin ) ( Int , @ in_guaranteed SwiftClass ) - > Int <nl> + return % p : $ @ async @ callee_owned ( Int ) - > Int <nl> + } <nl> + <nl> + sil public_external @ indirect_consumed_captured_class_param : $ @ async @ convention ( thin ) ( Int , @ in SwiftClass ) - > Int <nl> + <nl> + / / CHECK - LABEL : define { { ( dllexport ) ? } } { { ( protected ) ? } } swiftcc void @ partial_apply_indirect_consumed_class_param ( % swift . context * { { % [ 0 - 9 ] + } } ) { { # [ 0 - 9 ] + } } { <nl> + / / CHECK - LABEL : define internal swiftcc void @ " $ s38indirect_consumed_captured_class_paramTA " ( % swift . context * { { % [ 0 - 9 ] + } } , % swift . refcounted * swiftself { { % [ 0 - 9 ] + } } ) { { # [ 0 - 9 ] + } } { <nl> + <nl> + sil @ partial_apply_indirect_consumed_class_param : $ @ async @ convention ( thin ) ( @ in SwiftClass ) - > @ async @ callee_owned ( Int ) - > Int { <nl> + bb0 ( % x : $ * SwiftClass ) : <nl> + % f = function_ref @ indirect_consumed_captured_class_param : $ @ async @ convention ( thin ) ( Int , @ in SwiftClass ) - > Int <nl> + % p = partial_apply % f ( % x ) : $ @ async @ convention ( thin ) ( Int , @ in SwiftClass ) - > Int <nl> + return % p : $ @ async @ callee_owned ( Int ) - > Int <nl> + } <nl> + <nl> + / * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * / <nl> + / * A non - trivial capture . Indirect applications can directly reference the * / <nl> + / * field from the partial apply context . * / <nl> + / * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * / <nl> + <nl> + struct SwiftClassPair { var x : SwiftClass , y : SwiftClass } <nl> + <nl> + sil public_external @ guaranteed_captured_class_pair_param : $ @ async @ convention ( thin ) ( Int , @ guaranteed SwiftClassPair ) - > Int <nl> + <nl> + / / CHECK - LABEL : define { { ( dllexport ) ? } } { { ( protected ) ? } } swiftcc void @ partial_apply_guaranteed_class_pair_param ( % swift . context * { { % [ 0 - 9 ] + } } ) { { # [ 0 - 9 ] + } } { <nl> + / / CHECK - LABEL : define internal swiftcc void @ " $ s36guaranteed_captured_class_pair_paramTA " ( % swift . context * { { % [ 0 - 9 ] + } } , % swift . refcounted * swiftself { { % [ 0 - 9 ] + } } ) { { # [ 0 - 9 ] + } } { <nl> + <nl> + sil @ partial_apply_guaranteed_class_pair_param : $ @ async @ convention ( thin ) ( @ owned SwiftClassPair ) - > @ async @ callee_owned ( Int ) - > Int { <nl> + bb0 ( % x : $ SwiftClassPair ) : <nl> + % f = function_ref @ guaranteed_captured_class_pair_param : $ @ async @ convention ( thin ) ( Int , @ guaranteed SwiftClassPair ) - > Int <nl> + % p = partial_apply % f ( % x ) : $ @ async @ convention ( thin ) ( Int , @ guaranteed SwiftClassPair ) - > Int <nl> + return % p : $ @ async @ callee_owned ( Int ) - > Int <nl> + } <nl> + <nl> + sil public_external @ indirect_guaranteed_captured_class_pair_param : $ @ async @ convention ( thin ) ( Int , @ in_guaranteed SwiftClassPair ) - > Int <nl> + <nl> + / / CHECK - LABEL : define { { ( dllexport ) ? } } { { ( protected ) ? } } swiftcc void @ partial_apply_indirect_guaranteed_class_pair_param ( % swift . context * { { % [ 0 - 9 ] + } } ) { { # [ 0 - 9 ] + } } { <nl> + / / CHECK - LABEL : define internal swiftcc void @ " $ s45indirect_guaranteed_captured_class_pair_paramTA " ( % swift . context * { { % [ 0 - 9 ] + } } , % swift . refcounted * swiftself { { % [ 0 - 9 ] + } } ) { { # [ 0 - 9 ] + } } { <nl> + <nl> + sil @ partial_apply_indirect_guaranteed_class_pair_param : $ @ async @ convention ( thin ) ( @ in SwiftClassPair ) - > @ async @ callee_owned ( Int ) - > Int { <nl> + bb0 ( % x : $ * SwiftClassPair ) : <nl> + % f = function_ref @ indirect_guaranteed_captured_class_pair_param : $ @ async @ convention ( thin ) ( Int , @ in_guaranteed SwiftClassPair ) - > Int <nl> + % p = partial_apply % f ( % x ) : $ @ async @ convention ( thin ) ( Int , @ in_guaranteed SwiftClassPair ) - > Int <nl> + return % p : $ @ async @ callee_owned ( Int ) - > Int <nl> + } <nl> + <nl> + sil public_external @ indirect_consumed_captured_class_pair_param : $ @ async @ convention ( thin ) ( Int , @ in SwiftClassPair ) - > Int <nl> + <nl> + / / CHECK - LABEL : define { { ( dllexport ) ? } } { { ( protected ) ? } } swiftcc void @ partial_apply_indirect_consumed_class_pair_param ( % swift . context * { { % [ 0 - 9 ] + } } ) { { # [ 0 - 9 ] + } } { <nl> + / / CHECK - LABEL : define internal swiftcc void @ " $ s43indirect_consumed_captured_class_pair_paramTA " ( % swift . context * { { % [ 0 - 9 ] + } } , % swift . refcounted * swiftself { { % [ 0 - 9 ] + } } ) { { # [ 0 - 9 ] + } } { <nl> + <nl> + sil @ partial_apply_indirect_consumed_class_pair_param : $ @ async @ convention ( thin ) ( @ in SwiftClassPair ) - > @ async @ callee_owned ( Int ) - > Int { <nl> + bb0 ( % x : $ * SwiftClassPair ) : <nl> + % f = function_ref @ indirect_consumed_captured_class_pair_param : $ @ async @ convention ( thin ) ( Int , @ in SwiftClassPair ) - > Int <nl> + % p = partial_apply % f ( % x ) : $ @ async @ convention ( thin ) ( Int , @ in SwiftClassPair ) - > Int <nl> + return % p : $ @ async @ callee_owned ( Int ) - > Int <nl> + } <nl> + <nl> + sil public_external @ captured_fixed_and_dependent_params : $ @ async @ convention ( thin ) < A > ( @ owned SwiftClass , @ in A , Int ) - > ( ) <nl> + <nl> + / / CHECK - LABEL : define { { ( dllexport ) ? } } { { ( protected ) ? } } swiftcc void @ partial_apply_indirect_non_fixed_layout ( % swift . context * { { % [ 0 - 9 ] + } } ) { { # [ 0 - 9 ] + } } { <nl> + / / CHECK - LABEL : define internal swiftcc void @ " $ s35captured_fixed_and_dependent_paramsTA " ( % swift . context * { { % [ 0 - 9 ] + } } , % swift . refcounted * swiftself { { % [ 0 - 9 ] + } } ) { { # [ 0 - 9 ] + } } { <nl> + sil @ partial_apply_indirect_non_fixed_layout : $ @ async @ convention ( thin ) < T > ( @ owned SwiftClass , @ in T , Int ) - > @ async @ callee_owned ( ) - > ( ) { <nl> + bb0 ( % a : $ SwiftClass , % b : $ * T , % c : $ Int ) : <nl> + % f = function_ref @ captured_fixed_and_dependent_params : $ @ async @ convention ( thin ) < B > ( @ owned SwiftClass , @ in B , Int ) - > ( ) <nl> + % p = partial_apply % f < T > ( % a , % b , % c ) : $ @ async @ convention ( thin ) < C > ( @ owned SwiftClass , @ in C , Int ) - > ( ) <nl> + return % p : $ @ async @ callee_owned ( ) - > ( ) <nl> + } <nl> + <nl> + sil public_external @ captured_dependent_out_param : $ @ async @ convention ( thin ) < A > ( @ in A ) - > @ out A <nl> + <nl> + sil @ partial_apply_with_out_param : $ @ async @ convention ( thin ) < T > ( @ in T ) - > @ async @ callee_owned ( ) - > @ out T { <nl> + bb0 ( % x : $ * T ) : <nl> + % f = function_ref @ captured_dependent_out_param : $ @ async @ convention ( thin ) < B > ( @ in B ) - > @ out B <nl> + % p = partial_apply % f < T > ( % x ) : $ @ async @ convention ( thin ) < C > ( @ in C ) - > @ out C <nl> + return % p : $ @ async @ callee_owned ( ) - > @ out T <nl> + } <nl> + <nl> + / / CHECK - LABEL : define internal swiftcc void @ " $ s28captured_dependent_out_paramTA " ( % swift . context * { { % [ 0 - 9 ] + } } , % swift . refcounted * swiftself { { % [ 0 - 9 ] + } } ) { { # [ 0 - 9 ] + } } { <nl> + <nl> + sil @ partial_apply_dynamic_with_out_param : $ @ async @ convention ( thin ) < T > ( Int32 , @ owned @ async @ callee_owned ( Int32 ) - > @ out T ) - > @ async @ callee_owned ( ) - > @ out T { <nl> + bb0 ( % x : $ Int32 , % f : $ @ async @ callee_owned ( Int32 ) - > @ out T ) : <nl> + % p = partial_apply % f ( % x ) : $ @ async @ callee_owned ( Int32 ) - > @ out T <nl> + return % p : $ @ async @ callee_owned ( ) - > @ out T <nl> + } <nl> + <nl> + / / CHECK - LABEL : define { { ( dllexport ) ? } } { { ( protected ) ? } } swiftcc void @ partial_apply_dynamic_with_out_param ( % swift . context * { { % [ 0 - 9 ] + } } ) { { # [ 0 - 9 ] + } } { <nl> + <nl> + class Base { <nl> + } <nl> + sil_vtable Base { } <nl> + <nl> + class Sub : Base { <nl> + } <nl> + <nl> + sil_vtable Sub { } <nl> + <nl> + sil @ parametric_casting_closure : $ @ async @ convention ( thin ) < C where C : Base > ( @ owned Base ) - > @ owned C { <nl> + bb0 ( % 0 : $ Base ) : <nl> + % 1 = unconditional_checked_cast % 0 : $ Base to C <nl> + return % 1 : $ C <nl> + } <nl> + <nl> + sil public_external @ receive_closure : $ @ async @ convention ( thin ) < C where C : Base > ( @ owned @ async @ callee_owned ( ) - > ( @ owned C ) ) - > ( ) <nl> + <nl> + / / CHECK - LABEL : define { { ( dllexport ) ? } } { { ( protected ) ? } } swiftcc void @ test_partial_apply ( % swift . context * { { % [ 0 - 9 ] + } } ) { { # [ 0 - 9 ] + } } { <nl> + <nl> + / / CHECK - LABEL : define internal swiftcc void @ " $ s26parametric_casting_closureTA " ( % swift . context * { { % [ 0 - 9 ] + } } , % swift . refcounted * swiftself { { % [ 0 - 9 ] + } } ) { { # [ 0 - 9 ] + } } { <nl> + / / CHECK - LABEL : define internal swiftcc void @ " $ s26parametric_casting_closureTA . { { [ 0 - 9 ] + } } " ( % swift . context * { { % [ 0 - 9 ] + } } , % swift . refcounted * swiftself { { % [ 0 - 9 ] + } } ) { { # [ 0 - 9 ] + } } { <nl> + <nl> + sil @ test_partial_apply : $ @ async @ convention ( thin ) ( @ owned Base ) - > ( ) { <nl> + bb0 ( % 0 : $ Base ) : <nl> + % 1 = function_ref @ parametric_casting_closure : $ @ async @ convention ( thin ) < C where C : Base > ( @ owned Base ) - > @ owned C <nl> + % 6 = partial_apply % 1 < Sub > ( ) : $ @ async @ convention ( thin ) < C where C : Base > ( @ owned Base ) - > @ owned C <nl> + % 2 = partial_apply % 1 < Sub > ( % 0 ) : $ @ async @ convention ( thin ) < C where C : Base > ( @ owned Base ) - > @ owned C <nl> + % 3 = function_ref @ receive_closure : $ @ async @ convention ( thin ) < C where C : Base > ( @ owned @ async @ callee_owned ( ) - > ( @ owned C ) ) - > ( ) <nl> + % 4 = apply % 3 < Sub > ( % 2 ) : $ @ async @ convention ( thin ) < C where C : Base > ( @ owned @ async @ callee_owned ( ) - > ( @ owned C ) ) - > ( ) <nl> + % 5 = tuple ( ) <nl> + return % 5 : $ ( ) <nl> + } <nl> + <nl> + sil public_external @ partial_empty_box : $ @ async @ convention ( thin ) ( @ owned < Ο_0_0 > { var Ο_0_0 } < ( ) > , @ inout_aliasable ( ) ) - > ( ) <nl> + <nl> + / / CHECK - LABEL : define { { ( dllexport ) ? } } { { ( protected ) ? } } swiftcc void @ empty_box ( % swift . context * { { % [ 0 - 9 ] + } } ) { { # [ 0 - 9 ] + } } { <nl> + sil @ empty_box : $ @ async @ convention ( thin ) ( ) - > ( ) { <nl> + entry : <nl> + / / CHECK : [ [ BOX : % . * ] ] = call { { . * } } swift_allocEmptyBox <nl> + / / CHECK : store % swift . refcounted * [ [ BOX ] ] <nl> + / / CHECK : store % swift . opaque * undef <nl> + % b = alloc_box $ < Ο_0_0 > { var Ο_0_0 } < ( ) > <nl> + % ba = project_box % b : $ < Ο_0_0 > { var Ο_0_0 } < ( ) > , 0 <nl> + % f = function_ref @ partial_empty_box : $ @ async @ convention ( thin ) ( @ owned < Ο_0_0 > { var Ο_0_0 } < ( ) > , @ inout_aliasable ( ) ) - > ( ) <nl> + % g = partial_apply % f ( % b , % ba ) : $ @ async @ convention ( thin ) ( @ owned < Ο_0_0 > { var Ο_0_0 } < ( ) > , @ inout_aliasable ( ) ) - > ( ) <nl> + return undef : $ ( ) <nl> + } <nl> + <nl> + protocol P0 { } <nl> + protocol P1 { associatedtype X : P0 } <nl> + protocol P2 { associatedtype Y : P1 } <nl> + <nl> + sil hidden_external @ complex_generic_function : $ @ async @ convention ( thin ) < T where T : P2 , T . Y : P2 > ( Int ) - > ( ) <nl> + <nl> + sil @ partial_apply_complex_generic_function : $ @ async @ convention ( thin ) < T where T : P2 , T . Y : P2 > ( Int ) - > ( ) { <nl> + bb0 ( % 0 : $ Int ) : <nl> + % fn = function_ref @ complex_generic_function : $ @ async @ convention ( thin ) < T where T : P2 , T . Y : P2 > ( Int ) - > ( ) <nl> + % pa = partial_apply % fn < T > ( % 0 ) : $ @ async @ convention ( thin ) < T where T : P2 , T . Y : P1 , T . Y : P2 > ( Int ) - > ( ) <nl> + % result = tuple ( ) <nl> + return % result : $ ( ) <nl> + } <nl> + / / CHECK - LABEL : define { { ( dllexport ) ? } } { { ( protected ) ? } } swiftcc void @ partial_apply_complex_generic_function ( % swift . context * { { % [ 0 - 9 ] + } } ) { { # [ 0 - 9 ] + } } { <nl> + / / CHECK - LABEL : define internal swiftcc void @ " $ s24complex_generic_functionTA " ( % swift . context * { { % [ 0 - 9 ] + } } , % swift . refcounted * swiftself { { % [ 0 - 9 ] + } } ) { { # [ 0 - 9 ] + } } { <nl> + <nl> + struct ComplexBoundedType < T : P2 > { } <nl> + <nl> + / / SR - 901 : Ensure that a partial_apply which captures bound generic type <nl> + / / metadata doesn ' t crash when restoring the generic context . <nl> + <nl> + sil hidden_external @ generic_function : $ @ async @ convention ( thin ) < T > ( ) - > ( ) <nl> + sil @ partial_apply_with_generic_type : $ @ async @ convention ( thin ) < U : P2 > ( ) - > ( ) { <nl> + bb0 : <nl> + % fn = function_ref @ generic_function : $ @ async @ convention ( thin ) < T > ( ) - > ( ) <nl> + % pa = partial_apply % fn < ComplexBoundedType < U > > ( ) : $ @ async @ convention ( thin ) < T > ( ) - > ( ) <nl> + % result = tuple ( ) <nl> + return % result : $ ( ) <nl> + } <nl> + <nl> + / / Crash on partial apply of witness_method without generic signature <nl> + <nl> + extension Int : P0 { } <nl> + <nl> + sil hidden_external @ concrete_witness_method : $ @ async @ convention ( witness_method : P0 ) ( Int , Int ) - > ( ) <nl> + <nl> + sil hidden @ partial_apply_witness_method : $ @ async @ convention ( thin ) ( Int ) - > ( ) { <nl> + bb0 ( % 0 : $ Int ) : <nl> + % fn = function_ref @ concrete_witness_method : $ @ async @ convention ( witness_method : P0 ) ( Int , Int ) - > ( ) <nl> + % pa = partial_apply % fn ( % 0 ) : $ @ async @ convention ( witness_method : P0 ) ( Int , Int ) - > ( ) <nl> + % result = tuple ( ) <nl> + return % result : $ ( ) <nl> + } <nl> + <nl> + <nl> + / / Crash on partial apply of a generic enum . <nl> + enum GenericEnum < T > { <nl> + case X ( String ) <nl> + case Y ( T , T , T , T , T ) <nl> + } <nl> + sil public_external @ generic_indirect_return : $ @ async @ convention ( thin ) < T > ( Int ) - > @ owned GenericEnum < T > <nl> + <nl> + / / CHECK - LABEL : define { { ( dllexport ) ? } } { { ( protected ) ? } } swiftcc void @ partial_apply_generic_indirect_return ( % swift . context * { { % [ 0 - 9 ] + } } ) { { # [ 0 - 9 ] + } } { <nl> + / / CHECK - LABEL : define internal swiftcc void @ " $ s23generic_indirect_returnTA " ( % swift . context * { { % [ 0 - 9 ] + } } , % swift . refcounted * swiftself { { % [ 0 - 9 ] + } } ) { { # [ 0 - 9 ] + } } { <nl> + sil @ partial_apply_generic_indirect_return : $ @ async @ convention ( thin ) ( Int ) - > @ async @ callee_owned ( ) - > @ owned GenericEnum < Int > { <nl> + bb0 ( % 0 : $ Int ) : <nl> + % fn = function_ref @ generic_indirect_return : $ @ async @ convention ( thin ) < T > ( Int ) - > @ owned GenericEnum < T > <nl> + % pa = partial_apply % fn < Int > ( % 0 ) : $ @ async @ convention ( thin ) < T > ( Int ) - > @ owned GenericEnum < T > <nl> + return % pa : $ @ async @ callee_owned ( ) - > @ owned GenericEnum < Int > <nl> + <nl> + } <nl> + <nl> + / / Crash on partial apply of a generic enum . <nl> + enum GenericEnum2 < T > { <nl> + case X ( String ) <nl> + case Y ( T ) <nl> + } <nl> + sil public_external @ generic_indirect_return2 : $ @ async @ convention ( thin ) < T > ( Int ) - > @ owned GenericEnum2 < T > <nl> + <nl> + / / CHECK - LABEL : define { { ( dllexport ) ? } } { { ( protected ) ? } } swiftcc void @ partial_apply_generic_indirect_return2 ( % swift . context * { { % [ 0 - 9 ] + } } ) { { # [ 0 - 9 ] + } } { <nl> + / / CHECK - LABEL : define internal swiftcc void @ " $ s24generic_indirect_return2TA " ( % swift . context * { { % [ 0 - 9 ] + } } , % swift . refcounted * swiftself { { % [ 0 - 9 ] + } } ) { { # [ 0 - 9 ] + } } { <nl> + sil @ partial_apply_generic_indirect_return2 : $ @ async @ convention ( thin ) ( Int ) - > @ async @ callee_owned ( ) - > @ owned GenericEnum2 < Int > { <nl> + bb0 ( % 0 : $ Int ) : <nl> + % fn = function_ref @ generic_indirect_return2 : $ @ async @ convention ( thin ) < T > ( Int ) - > @ owned GenericEnum2 < T > <nl> + % pa = partial_apply % fn < Int > ( % 0 ) : $ @ async @ convention ( thin ) < T > ( Int ) - > @ owned GenericEnum2 < T > <nl> + return % pa : $ @ async @ callee_owned ( ) - > @ owned GenericEnum2 < Int > <nl> + } <nl> + <nl> + struct SwiftStruct { } <nl> + <nl> + sil @ fun : $ @ async @ convention ( thin ) ( @ thin SwiftStruct . Type , @ owned SwiftClass ) - > ( ) <nl> + <nl> + / / CHECK - LABEL : define { { ( dllexport ) ? } } { { ( protected ) ? } } swiftcc void @ partial_apply_thin_type ( % swift . context * { { % [ 0 - 9 ] + } } ) { { # [ 0 - 9 ] + } } { <nl> + <nl> + sil @ partial_apply_thin_type : $ @ async @ convention ( thin ) ( @ thin SwiftStruct . Type , @ owned SwiftClass ) - > @ async @ callee_owned ( ) - > ( ) { <nl> + entry ( % 0 : $ @ thin SwiftStruct . Type , % 1 : $ SwiftClass ) : <nl> + % fun = function_ref @ fun : $ @ async @ convention ( thin ) ( @ thin SwiftStruct . Type , @ owned SwiftClass ) - > ( ) <nl> + % closure = partial_apply % fun ( % 0 , % 1 ) : $ @ async @ convention ( thin ) ( @ thin SwiftStruct . Type , @ owned SwiftClass ) - > ( ) <nl> + return % closure : $ @ async @ callee_owned ( ) - > ( ) <nl> + } <nl> + <nl> + sil @ afun : $ @ async @ convention ( thin ) ( Int ) - > @ error Error <nl> + <nl> + / / Check that we don ' t assert on a thin noescape function . <nl> + / / CHECK - LABEL : define { { ( dllexport ) ? } } { { ( protected ) ? } } swiftcc void @ convert_thin_test ( % swift . context * { { % [ 0 - 9 ] + } } ) { { # [ 0 - 9 ] + } } { <nl> + sil @ convert_thin_test : $ @ async @ convention ( thin ) ( Int ) - > ( ) { <nl> + bb ( % 0 : $ Int ) : <nl> + % f = function_ref @ afun : $ @ async @ convention ( thin ) ( Int ) - > @ error Error <nl> + % c = convert_function % f : $ @ async @ convention ( thin ) ( Int ) - > @ error Error to $ @ async @ convention ( thin ) @ noescape ( Int ) - > @ error Error <nl> + try_apply % c ( % 0 ) : $ @ async @ convention ( thin ) @ noescape ( Int ) - > @ error Error , normal bb2 , error bb1 <nl> + <nl> + bb1 ( % err : $ Error ) : <nl> + % t = tuple ( ) <nl> + br bb3 ( % t : $ ( ) ) <nl> + <nl> + bb2 ( % r : $ ( ) ) : <nl> + br bb3 ( % r : $ ( ) ) <nl> + <nl> + bb3 ( % v : $ ( ) ) : <nl> + return % v : $ ( ) <nl> + } <nl> + <nl> + struct A1 { <nl> + let b : ( ) - > ( ) <nl> + } <nl> + <nl> + struct A2 < T > { <nl> + let a : T <nl> + } <nl> + <nl> + class A3 { } <nl> + <nl> + sil @ amethod : $ @ async @ convention ( method ) ( @ in_guaranteed A2 < A3 > ) - > ( @ owned A1 , @ error Error ) <nl> + <nl> + sil @ repo : $ @ async @ convention ( thin ) ( @ in_guaranteed A2 < A3 > ) - > @ owned @ async @ callee_guaranteed ( ) - > ( @ owned A1 , @ error Error ) { <nl> + bb0 ( % 0 : $ * A2 < A3 > ) : <nl> + % 1 = load % 0 : $ * A2 < A3 > <nl> + % 2 = alloc_stack $ A2 < A3 > <nl> + store % 1 to % 2 : $ * A2 < A3 > <nl> + % 4 = function_ref @ amethod : $ @ async @ convention ( method ) ( @ in_guaranteed A2 < A3 > ) - > ( @ owned A1 , @ error Error ) <nl> + % 5 = partial_apply [ callee_guaranteed ] % 4 ( % 2 ) : $ @ async @ convention ( method ) ( @ in_guaranteed A2 < A3 > ) - > ( @ owned A1 , @ error Error ) <nl> + dealloc_stack % 2 : $ * A2 < A3 > <nl> + return % 5 : $ @ async @ callee_guaranteed ( ) - > ( @ owned A1 , @ error Error ) <nl> + } <nl> + <nl> + sil @ capture_class : $ @ async @ convention ( thin ) ( @ guaranteed A3 ) - > ( ) <nl> + <nl> + / / CHECK - LABEL : define { { . * } } swiftcc i8 * @ partial_apply_stack_in_coroutine ( i8 * { { . * } } % 0 , % T13partial_apply2A3C * % 1 ) <nl> + sil @ partial_apply_stack_in_coroutine : $ @ yield_once ( @ owned A3 ) - > ( ) { <nl> + entry ( % 0 : $ A3 ) : <nl> + % f = function_ref @ capture_class : $ @ async @ convention ( thin ) ( @ guaranteed A3 ) - > ( ) <nl> + % p = partial_apply [ callee_guaranteed ] [ on_stack ] % f ( % 0 ) : $ @ async @ convention ( thin ) ( @ guaranteed A3 ) - > ( ) <nl> + apply % p ( ) : $ @ noescape @ async @ callee_guaranteed ( ) - > ( ) <nl> + dealloc_stack % p : $ @ noescape @ async @ callee_guaranteed ( ) - > ( ) <nl> + % 1000 = integer_literal $ Builtin . Int32 , 1000 <nl> + yield ( ) , resume resume , unwind unwind <nl> + <nl> + resume : <nl> + % ret = tuple ( ) <nl> + return % ret : $ ( ) <nl> + <nl> + unwind : <nl> + unwind <nl> + } <nl> + sil_vtable A3 { } <nl> + <nl> + <nl> + / / CHECK - LABEL : define { { ( dllexport ) ? } } { { ( protected ) ? } } swiftcc void @ partial_apply_callee_guaranteed_indirect_guaranteed_class_pair_param ( % swift . context * { { % [ 0 - 9 ] + } } ) { { # [ 0 - 9 ] + } } { <nl> + <nl> + sil @ partial_apply_callee_guaranteed_indirect_guaranteed_class_pair_param : $ @ async @ convention ( thin ) ( @ in SwiftClassPair ) - > @ owned @ async @ callee_guaranteed ( Int ) - > Int { <nl> + bb0 ( % x : $ * SwiftClassPair ) : <nl> + % f = function_ref @ indirect_guaranteed_captured_class_pair_param : $ @ async @ convention ( thin ) ( Int , @ in_guaranteed SwiftClassPair ) - > Int <nl> + % p = partial_apply [ callee_guaranteed ] % f ( % x ) : $ @ async @ convention ( thin ) ( Int , @ in_guaranteed SwiftClassPair ) - > Int <nl> + return % p : $ @ async @ callee_guaranteed ( Int ) - > ( Int ) <nl> + } <nl> + <nl> + sil public_external @ use_closure2 : $ @ async @ convention ( thin ) ( @ noescape @ async @ callee_guaranteed ( Int ) - > Int ) - > ( ) <nl> + <nl> + / / CHECK - LABEL : define { { ( dllexport ) ? } } { { ( protected ) ? } } swiftcc void @ partial_apply_stack_callee_guaranteed_indirect_guaranteed_class_pair_param ( % swift . context * { { % [ 0 - 9 ] + } } ) { { # [ 0 - 9 ] + } } { <nl> + / / CHECK - LABEL : define internal swiftcc void @ " $ s45indirect_guaranteed_captured_class_pair_paramTA . 67 " ( % swift . context * { { % [ 0 - 9 ] + } } , % swift . refcounted * swiftself { { % [ 0 - 9 ] + } } ) { { # [ 0 - 9 ] + } } { <nl> + <nl> + sil @ partial_apply_stack_callee_guaranteed_indirect_guaranteed_class_pair_param : $ @ async @ convention ( thin ) ( @ in_guaranteed SwiftClassPair ) - > ( ) { <nl> + bb0 ( % x : $ * SwiftClassPair ) : <nl> + % f = function_ref @ indirect_guaranteed_captured_class_pair_param : $ @ async @ convention ( thin ) ( Int , @ in_guaranteed SwiftClassPair ) - > Int <nl> + % p = partial_apply [ callee_guaranteed ] [ on_stack ] % f ( % x ) : $ @ async @ convention ( thin ) ( Int , @ in_guaranteed SwiftClassPair ) - > Int <nl> + % u = function_ref @ use_closure2 : $ @ async @ convention ( thin ) ( @ noescape @ async @ callee_guaranteed ( Int ) - > Int ) - > ( ) <nl> + % r = apply % u ( % p ) : $ @ async @ convention ( thin ) ( @ noescape @ async @ callee_guaranteed ( Int ) - > Int ) - > ( ) <nl> + dealloc_stack % p : $ @ noescape @ async @ callee_guaranteed ( Int ) - > ( Int ) <nl> + % t = tuple ( ) <nl> + return % t : $ ( ) <nl> + } <nl> + <nl> + / / CHECK - LABEL : define { { ( dllexport ) ? } } { { ( protected ) ? } } swiftcc void @ partial_apply_stack_callee_guaranteed_indirect_in_class_pair_param ( % swift . context * { { % [ 0 - 9 ] + } } ) { { # [ 0 - 9 ] + } } { <nl> + / / CHECK - LABEL : define internal swiftcc void @ " $ s37indirect_in_captured_class_pair_paramTA " ( % swift . context * { { % [ 0 - 9 ] + } } , % swift . refcounted * swiftself { { % [ 0 - 9 ] + } } ) { { # [ 0 - 9 ] + } } { <nl> + <nl> + sil public_external @ indirect_in_captured_class_pair_param : $ @ async @ convention ( thin ) ( Int , @ in SwiftClassPair ) - > Int <nl> + <nl> + sil @ partial_apply_stack_callee_guaranteed_indirect_in_class_pair_param : $ @ async @ convention ( thin ) ( @ in SwiftClassPair ) - > ( ) { <nl> + bb0 ( % x : $ * SwiftClassPair ) : <nl> + % f = function_ref @ indirect_in_captured_class_pair_param : $ @ async @ convention ( thin ) ( Int , @ in SwiftClassPair ) - > Int <nl> + % p = partial_apply [ callee_guaranteed ] [ on_stack ] % f ( % x ) : $ @ async @ convention ( thin ) ( Int , @ in SwiftClassPair ) - > Int <nl> + % u = function_ref @ use_closure2 : $ @ async @ convention ( thin ) ( @ noescape @ async @ callee_guaranteed ( Int ) - > Int ) - > ( ) <nl> + % r = apply % u ( % p ) : $ @ async @ convention ( thin ) ( @ noescape @ async @ callee_guaranteed ( Int ) - > Int ) - > ( ) <nl> + dealloc_stack % p : $ @ noescape @ async @ callee_guaranteed ( Int ) - > ( Int ) <nl> + destroy_addr % x : $ * SwiftClassPair <nl> + % t = tuple ( ) <nl> + return % t : $ ( ) <nl> + } <nl> + <nl> + <nl> + / / CHECK - LABEL : define { { ( dllexport ) ? } } { { ( protected ) ? } } swiftcc void @ partial_apply_stack_callee_guaranteed_indirect_in_constant_class_pair_param ( % swift . context * { { % [ 0 - 9 ] + } } ) { { # [ 0 - 9 ] + } } { <nl> + / / CHECK - LABEL : define internal swiftcc void @ " $ s46indirect_in_constant_captured_class_pair_paramTA " ( % swift . context * { { % [ 0 - 9 ] + } } , % swift . refcounted * swiftself { { % [ 0 - 9 ] + } } ) { { # [ 0 - 9 ] + } } { <nl> + <nl> + sil public_external @ indirect_in_constant_captured_class_pair_param : $ @ async @ convention ( thin ) ( Int , @ in_constant SwiftClassPair ) - > Int <nl> + <nl> + sil @ partial_apply_stack_callee_guaranteed_indirect_in_constant_class_pair_param : $ @ async @ convention ( thin ) ( @ in SwiftClassPair ) - > ( ) { <nl> + bb0 ( % x : $ * SwiftClassPair ) : <nl> + % f = function_ref @ indirect_in_constant_captured_class_pair_param : $ @ async @ convention ( thin ) ( Int , @ in_constant SwiftClassPair ) - > Int <nl> + % p = partial_apply [ callee_guaranteed ] [ on_stack ] % f ( % x ) : $ @ async @ convention ( thin ) ( Int , @ in_constant SwiftClassPair ) - > Int <nl> + % u = function_ref @ use_closure2 : $ @ async @ convention ( thin ) ( @ noescape @ async @ callee_guaranteed ( Int ) - > Int ) - > ( ) <nl> + % r = apply % u ( % p ) : $ @ async @ convention ( thin ) ( @ noescape @ async @ callee_guaranteed ( Int ) - > Int ) - > ( ) <nl> + dealloc_stack % p : $ @ noescape @ async @ callee_guaranteed ( Int ) - > ( Int ) <nl> + destroy_addr % x : $ * SwiftClassPair <nl> + % t = tuple ( ) <nl> + return % t : $ ( ) <nl> + } <nl> + <nl> + sil public_external @ closure : $ @ async @ convention ( thin ) ( @ in_guaranteed ResilientInt , @ guaranteed SwiftClass ) - > ( ) <nl> + <nl> + / / Make sure that we use the heap header size ( 16 ) for the initial offset . <nl> + / / CHECK - LABEL : define { { ( dllexport ) ? } } { { ( protected ) ? } } swiftcc void @ test_initial_offset ( % swift . context * { { % [ 0 - 9 ] + } } ) { { # [ 0 - 9 ] + } } { <nl> + <nl> + sil @ test_initial_offset : $ @ async @ convention ( thin ) ( @ in_guaranteed ResilientInt , @ guaranteed SwiftClass ) - > ( ) { <nl> + bb0 ( % x : $ * ResilientInt , % y : $ SwiftClass ) : <nl> + % f = function_ref @ closure : $ @ async @ convention ( thin ) ( @ in_guaranteed ResilientInt , @ guaranteed SwiftClass ) - > ( ) <nl> + % p = partial_apply [ callee_guaranteed ] % f ( % x , % y ) : $ @ async @ convention ( thin ) ( @ in_guaranteed ResilientInt , @ guaranteed SwiftClass ) - > ( ) <nl> + release_value % p : $ @ async @ callee_guaranteed ( ) - > ( ) <nl> + % t = tuple ( ) <nl> + return % t : $ ( ) <nl> + } <nl> + <nl> + protocol Proto1 { } <nl> + protocol Proto2 { } <nl> + struct EmptyType : Proto1 { } <nl> + <nl> + struct SomeType : Proto2 { <nl> + var d : ResilientInt / / some resilient type <nl> + var x : Int <nl> + } <nl> + <nl> + sil @ foo : $ @ async @ convention ( thin ) < Ο_0_0 , Ο_0_1 where Ο_0_0 : Proto1 , Ο_0_1 : Proto2 > ( @ in_guaranteed Ο_0_0 , @ in_guaranteed Ο_0_1 ) - > ( ) <nl> + <nl> + / / CHECK - 64 - LABEL : define { { ( dllexport ) ? } } { { ( protected ) ? } } swiftcc void @ empty_followed_by_non_fixed ( % swift . context * { { % [ 0 - 9 ] + } } ) { { # [ 0 - 9 ] + } } { <nl> + <nl> + sil @ empty_followed_by_non_fixed : $ @ async @ convention ( thin ) ( EmptyType , @ in_guaranteed SomeType ) - > ( ) { <nl> + entry ( % 0 : $ EmptyType , % 1 : $ * SomeType ) : <nl> + % 5 = alloc_stack $ EmptyType <nl> + store % 0 to % 5 : $ * EmptyType <nl> + % 31 = function_ref @ foo : $ @ async @ convention ( thin ) < Ο_0_0 , Ο_0_1 where Ο_0_0 : Proto1 , Ο_0_1 : Proto2 > ( @ in_guaranteed Ο_0_0 , @ in_guaranteed Ο_0_1 ) - > ( ) <nl> + % 32 = alloc_stack $ EmptyType <nl> + copy_addr % 5 to [ initialization ] % 32 : $ * EmptyType <nl> + % 34 = alloc_stack $ SomeType <nl> + copy_addr % 1 to [ initialization ] % 34 : $ * SomeType / / id : % 35 <nl> + % 36 = partial_apply [ callee_guaranteed ] % 31 < EmptyType , SomeType > ( % 32 , % 34 ) : $ @ async @ convention ( thin ) < Ο_0_0 , Ο_0_1 where Ο_0_0 : Proto1 , Ο_0_1 : Proto2 > ( @ in_guaranteed Ο_0_0 , @ in_guaranteed Ο_0_1 ) - > ( ) <nl> + release_value % 36 : $ @ async @ callee_guaranteed ( ) - > ( ) <nl> + dealloc_stack % 34 : $ * SomeType <nl> + dealloc_stack % 32 : $ * EmptyType <nl> + dealloc_stack % 5 : $ * EmptyType <nl> + % 40 = tuple ( ) <nl> + return % 40 : $ ( ) <nl> + } <nl> + <nl> + struct FixedType { <nl> + var f : Int32 <nl> + } <nl> + / / CHECK - 64 - LABEL : define { { ( dllexport ) ? } } { { ( protected ) ? } } swiftcc void @ fixed_followed_by_empty_followed_by_non_fixed ( % swift . context * { { % [ 0 - 9 ] + } } ) { { # [ 0 - 9 ] + } } { <nl> + <nl> + sil @ foo2 : $ @ async @ convention ( thin ) < Ο_0_0 , Ο_0_1 , Ο_0_2 > ( @ in_guaranteed Ο_0_0 , @ in_guaranteed Ο_0_1 , @ in_guaranteed Ο_0_2 ) - > ( ) <nl> + sil @ fixed_followed_by_empty_followed_by_non_fixed : $ @ async @ convention ( thin ) ( EmptyType , @ in_guaranteed SomeType , FixedType ) - > ( ) { <nl> + entry ( % 0 : $ EmptyType , % 1 : $ * SomeType , % 3 : $ FixedType ) : <nl> + % 5 = alloc_stack $ EmptyType <nl> + store % 0 to % 5 : $ * EmptyType <nl> + % 7 = alloc_stack $ FixedType <nl> + store % 3 to % 7 : $ * FixedType <nl> + % 31 = function_ref @ foo2 : $ @ async @ convention ( thin ) < Ο_0_0 , Ο_0_1 , Ο_0_2 > ( @ in_guaranteed Ο_0_0 , @ in_guaranteed Ο_0_1 , @ in_guaranteed Ο_0_2 ) - > ( ) <nl> + % 32 = alloc_stack $ EmptyType <nl> + copy_addr % 5 to [ initialization ] % 32 : $ * EmptyType <nl> + % 34 = alloc_stack $ SomeType <nl> + copy_addr % 1 to [ initialization ] % 34 : $ * SomeType / / id : % 35 <nl> + % 36 = partial_apply [ callee_guaranteed ] % 31 < FixedType , EmptyType , SomeType > ( % 7 , % 32 , % 34 ) : $ @ async @ convention ( thin ) < Ο_0_0 , Ο_0_1 , Ο_0_2 > ( @ in_guaranteed Ο_0_0 , @ in_guaranteed Ο_0_1 , @ in_guaranteed Ο_0_2 ) - > ( ) <nl> + release_value % 36 : $ @ async @ callee_guaranteed ( ) - > ( ) <nl> + dealloc_stack % 34 : $ * SomeType <nl> + dealloc_stack % 32 : $ * EmptyType <nl> + dealloc_stack % 7 : $ * FixedType <nl> + dealloc_stack % 5 : $ * EmptyType <nl> + % 40 = tuple ( ) <nl> + return % 40 : $ ( ) <nl> + } <nl> new file mode 100644 <nl> index 000000000000 . . e024f9971508 <nl> mmm / dev / null <nl> ppp b / test / IRGen / async / partial_apply_forwarder . sil <nl> <nl> + / / RUN : % target - swift - frontend - enable - experimental - concurrency - enable - objc - interop - primary - file % s - emit - ir | % FileCheck % s - DINT = i % target - ptrsize - - check - prefixes = CHECK , CHECK - objc <nl> + / / RUN : % target - swift - frontend - enable - experimental - concurrency - disable - objc - interop - primary - file % s - emit - ir | % FileCheck % s - DINT = i % target - ptrsize - - check - prefixes = CHECK , CHECK - native <nl> + <nl> + / / REQUIRES : concurrency <nl> + <nl> + sil_stage canonical <nl> + <nl> + import Builtin <nl> + <nl> + public protocol P { } <nl> + public class C : P { } <nl> + public class D < T : P > { } <nl> + class E { } <nl> + <nl> + public protocol Observable { <nl> + associatedtype Result <nl> + func subscribe < T : Observer > ( o : T ) async - > ( ) <nl> + } <nl> + <nl> + public protocol Observer { <nl> + associatedtype Result <nl> + } <nl> + <nl> + sil hidden @ witness_method : $ @ async @ convention ( thin ) < S where S : Observable > < O where O : Observer , S . Result = = O . Result > ( @ in S ) - > @ owned @ async @ callee_owned ( @ in O ) - > ( ) { <nl> + bb0 ( % 0 : $ * S ) : <nl> + % 1 = witness_method $ S , # Observable . subscribe : $ @ async @ convention ( witness_method : Observable ) < Ο_0_0 where Ο_0_0 : Observable > < Ο_1_0 where Ο_1_0 : Observer , Ο_0_0 . Result = = Ο_1_0 . Result > ( @ in Ο_1_0 , @ in_guaranteed Ο_0_0 ) - > ( ) <nl> + % 2 = partial_apply % 1 < S , O > ( % 0 ) : $ @ async @ convention ( witness_method : Observable ) < Ο_0_0 where Ο_0_0 : Observable > < Ο_1_0 where Ο_1_0 : Observer , Ο_0_0 . Result = = Ο_1_0 . Result > ( @ in Ο_1_0 , @ in_guaranteed Ο_0_0 ) - > ( ) <nl> + return % 2 : $ @ async @ callee_owned ( @ in O ) - > ( ) <nl> + } <nl> + <nl> + / / CHECK - LABEL : define internal swiftcc void @ " $ s23unspecialized_uncurriedTA " ( % swift . context * { { % [ 0 - 9 ] + } } , % swift . refcounted * swiftself { { % [ 0 - 9 ] + } } ) { { # [ 0 - 9 ] + } } { <nl> + <nl> + sil hidden @ specialized_curried : $ @ async @ convention ( thin ) ( @ owned E ) - > @ owned @ async @ callee_owned ( ) - > @ owned D < C > { <nl> + bb0 ( % 0 : $ E ) : <nl> + % 1 = function_ref @ unspecialized_uncurried : $ @ async @ convention ( method ) < Ο_0_0 where Ο_0_0 : P > ( @ guaranteed E ) - > @ owned D < Ο_0_0 > <nl> + % 2 = partial_apply % 1 < C > ( % 0 ) : $ @ async @ convention ( method ) < Ο_0_0 where Ο_0_0 : P > ( @ guaranteed E ) - > @ owned D < Ο_0_0 > <nl> + return % 2 : $ @ async @ callee_owned ( ) - > @ owned D < C > <nl> + } <nl> + <nl> + sil hidden_external @ unspecialized_uncurried : $ @ async @ convention ( method ) < Ο_0_0 where Ο_0_0 : P > ( @ guaranteed E ) - > @ owned D < Ο_0_0 > <nl> + <nl> + <nl> + / / CHECK - LABEL : define internal swiftcc void @ " $ s7takingPTA " ( % swift . context * { { % [ 0 - 9 ] + } } , % swift . refcounted * swiftself { { % [ 0 - 9 ] + } } ) { { # [ 0 - 9 ] + } } { <nl> + sil hidden_external @ takingP : $ @ async @ convention ( method ) < Ο_0_0 where Ο_0_0 : P > ( @ in_guaranteed Ο_0_0 ) - > ( ) <nl> + <nl> + sil hidden @ reabstract_context : $ @ async @ convention ( thin ) ( @ owned C ) - > ( ) { <nl> + bb0 ( % 0 : $ C ) : <nl> + % 6 = alloc_stack $ C <nl> + store % 0 to % 6 : $ * C <nl> + % 8 = function_ref @ takingP : $ @ async @ convention ( method ) < Ο_0_0 where Ο_0_0 : P > ( @ in_guaranteed Ο_0_0 ) - > ( ) <nl> + % 9 = partial_apply % 8 < C > ( % 6 ) : $ @ async @ convention ( method ) < Ο_0_0 where Ο_0_0 : P > ( @ in_guaranteed Ο_0_0 ) - > ( ) <nl> + dealloc_stack % 6 : $ * C <nl> + strong_release % 9 : $ @ async @ callee_owned ( ) - > ( ) <nl> + % 10 = tuple ( ) <nl> + return % 10 : $ ( ) <nl> + } <nl> + <nl> + public protocol Q { <nl> + associatedtype Update <nl> + } <nl> + <nl> + public struct BaseProducer < T > : Q { <nl> + public typealias Update = T <nl> + } <nl> + <nl> + public class WeakBox < T > { } <nl> + <nl> + public struct EmptyType { } <nl> + <nl> + sil hidden_external @ takingQ : $ @ async @ convention ( thin ) < Ο_0_0 where Ο_0_0 : Q > ( @ owned WeakBox < Ο_0_0 > ) - > ( ) <nl> + sil hidden_external @ takingQAndEmpty : $ @ async @ convention ( thin ) < Ο_0_0 where Ο_0_0 : Q > ( @ owned WeakBox < Ο_0_0 > , EmptyType ) - > ( ) <nl> + sil hidden_external @ takingEmptyAndQ : $ @ async @ convention ( thin ) < Ο_0_0 where Ο_0_0 : Q > ( EmptyType , @ owned WeakBox < Ο_0_0 > ) - > ( ) <nl> + <nl> + / / CHECK - LABEL : define { { ( dllexport ) ? } } { { ( protected ) ? } } swiftcc void @ bind_polymorphic_param_from_context ( % swift . context * { { % [ 0 - 9 ] + } } ) { { # [ 0 - 9 ] + } } { <nl> + / / CHECK - LABEL : define internal swiftcc void @ " $ s7takingQTA " ( % swift . context * { { % [ 0 - 9 ] + } } , % swift . refcounted * swiftself { { % [ 0 - 9 ] + } } ) { { # [ 0 - 9 ] + } } { <nl> + <nl> + sil public @ bind_polymorphic_param_from_context : $ @ async @ convention ( thin ) < Ο_0_1 > ( @ in Ο_0_1 ) - > @ owned @ async @ callee_owned ( ) - > ( ) { <nl> + bb0 ( % 0 : $ * Ο_0_1 ) : <nl> + % 1 = alloc_ref $ WeakBox < BaseProducer < Ο_0_1 > > <nl> + % 8 = function_ref @ takingQ : $ @ async @ convention ( thin ) < Ο_0_0 where Ο_0_0 : Q > ( @ owned WeakBox < Ο_0_0 > ) - > ( ) <nl> + % 9 = partial_apply % 8 < BaseProducer < Ο_0_1 > > ( % 1 ) : $ @ async @ convention ( thin ) < Ο_0_0 where Ο_0_0 : Q > ( @ owned WeakBox < Ο_0_0 > ) - > ( ) <nl> + return % 9 : $ @ async @ callee_owned ( ) - > ( ) <nl> + } <nl> + <nl> + / / CHECK - LABEL : define { { ( dllexport ) ? } } { { ( protected ) ? } } swiftcc void @ bind_polymorphic_param_from_context_2 ( % swift . context * { { % [ 0 - 9 ] + } } ) { { # [ 0 - 9 ] + } } { <nl> + sil public @ bind_polymorphic_param_from_context_2 : $ @ async @ convention ( thin ) < Ο_0_1 > ( @ in Ο_0_1 , EmptyType ) - > @ owned @ async @ callee_owned ( ) - > ( ) { <nl> + bb0 ( % 0 : $ * Ο_0_1 , % 2 : $ EmptyType ) : <nl> + % 1 = alloc_ref $ WeakBox < BaseProducer < Ο_0_1 > > <nl> + % 8 = function_ref @ takingQAndEmpty : $ @ async @ convention ( thin ) < Ο_0_0 where Ο_0_0 : Q > ( @ owned WeakBox < Ο_0_0 > , EmptyType ) - > ( ) <nl> + % 9 = partial_apply % 8 < BaseProducer < Ο_0_1 > > ( % 1 , % 2 ) : $ @ async @ convention ( thin ) < Ο_0_0 where Ο_0_0 : Q > ( @ owned WeakBox < Ο_0_0 > , EmptyType ) - > ( ) <nl> + return % 9 : $ @ async @ callee_owned ( ) - > ( ) <nl> + } <nl> + <nl> + / / CHECK - LABEL : define { { ( dllexport ) ? } } { { ( protected ) ? } } swiftcc void @ bind_polymorphic_param_from_context_3 ( % swift . context * { { % [ 0 - 9 ] + } } ) { { # [ 0 - 9 ] + } } { <nl> + sil public @ bind_polymorphic_param_from_context_3 : $ @ async @ convention ( thin ) < Ο_0_1 > ( @ in Ο_0_1 , EmptyType ) - > @ owned @ async @ callee_owned ( ) - > ( ) { <nl> + bb0 ( % 0 : $ * Ο_0_1 , % 2 : $ EmptyType ) : <nl> + % 1 = alloc_ref $ WeakBox < BaseProducer < Ο_0_1 > > <nl> + % 8 = function_ref @ takingEmptyAndQ : $ @ async @ convention ( thin ) < Ο_0_0 where Ο_0_0 : Q > ( EmptyType , @ owned WeakBox < Ο_0_0 > ) - > ( ) <nl> + % 9 = partial_apply % 8 < BaseProducer < Ο_0_1 > > ( % 2 , % 1 ) : $ @ async @ convention ( thin ) < Ο_0_0 where Ο_0_0 : Q > ( EmptyType , @ owned WeakBox < Ο_0_0 > ) - > ( ) <nl> + return % 9 : $ @ async @ callee_owned ( ) - > ( ) <nl> + } <nl> + <nl> + / / CHECK - LABEL : define { { ( dllexport ) ? } } { { ( protected ) ? } } swiftcc void @ bind_polymorphic_param_from_forwarder_parameter ( % swift . context * { { % [ 0 - 9 ] + } } ) { { # [ 0 - 9 ] + } } { <nl> + / / CHECK - LABEL : define internal swiftcc void @ " $ s7takingQTA . 19 " ( % swift . context * { { % [ 0 - 9 ] + } } , % swift . refcounted * swiftself { { % [ 0 - 9 ] + } } ) { { # [ 0 - 9 ] + } } { <nl> + <nl> + sil public @ bind_polymorphic_param_from_forwarder_parameter : $ @ async @ convention ( thin ) < Ο_0_1 > ( @ in Ο_0_1 ) - > ( ) { <nl> + bb0 ( % 0 : $ * Ο_0_1 ) : <nl> + % 1 = alloc_ref $ WeakBox < BaseProducer < Ο_0_1 > > <nl> + % 8 = function_ref @ takingQ : $ @ async @ convention ( thin ) < Ο_0_0 where Ο_0_0 : Q > ( @ owned WeakBox < Ο_0_0 > ) - > ( ) <nl> + % 9 = partial_apply % 8 < BaseProducer < Ο_0_1 > > ( ) : $ @ async @ convention ( thin ) < Ο_0_0 where Ο_0_0 : Q > ( @ owned WeakBox < Ο_0_0 > ) - > ( ) <nl> + % 10 = tuple ( ) <nl> + return % 10 : $ ( ) <nl> + } <nl> + <nl> + struct S { <nl> + var x : Builtin . Int64 <nl> + } <nl> + <nl> + sil hidden_external @ takingQAndS : $ @ async @ convention ( thin ) < Ο_0_0 where Ο_0_0 : Q > ( S , @ owned WeakBox < Ο_0_0 > ) - > ( ) <nl> + <nl> + / / CHECK - LABEL : define { { ( dllexport ) ? } } { { ( protected ) ? } } swiftcc void @ bind_polymorphic_param_from_context_with_layout ( % swift . context * { { % [ 0 - 9 ] + } } ) { { # [ 0 - 9 ] + } } { <nl> + / / CHECK - LABEL : define internal swiftcc void @ " $ s11takingQAndSTA " ( % swift . context * { { % [ 0 - 9 ] + } } , % swift . refcounted * swiftself { { % [ 0 - 9 ] + } } ) { { # [ 0 - 9 ] + } } { <nl> + sil public @ bind_polymorphic_param_from_context_with_layout : $ @ async @ convention ( thin ) < Ο_0_1 > ( @ in Ο_0_1 , S ) - > @ owned @ async @ callee_owned ( ) - > ( ) { <nl> + bb0 ( % 0 : $ * Ο_0_1 , % 1 : $ S ) : <nl> + % 2 = alloc_ref $ WeakBox < BaseProducer < Ο_0_1 > > <nl> + % 8 = function_ref @ takingQAndS : $ @ async @ convention ( thin ) < Ο_0_0 where Ο_0_0 : Q > ( S , @ owned WeakBox < Ο_0_0 > ) - > ( ) <nl> + % 9 = partial_apply % 8 < BaseProducer < Ο_0_1 > > ( % 1 , % 2 ) : $ @ async @ convention ( thin ) < Ο_0_0 where Ο_0_0 : Q > ( S , @ owned WeakBox < Ο_0_0 > ) - > ( ) <nl> + return % 9 : $ @ async @ callee_owned ( ) - > ( ) <nl> + } <nl> + <nl> + public class Empty < T > { } <nl> + <nl> + sil private @ inner_closure : $ @ async @ convention ( thin ) < T > ( Empty < T > ) - > @ owned Empty < T > { <nl> + bb0 ( % 0 : $ Empty < T > ) : <nl> + return % 0 : $ Empty < T > <nl> + } <nl> + <nl> + sil hidden @ returns_closure : $ @ async @ convention ( thin ) < T > ( Empty < T > ) - > ( @ owned Empty < T > , @ async @ callee_guaranteed @ owned ( Empty < T > ) - > @ owned Empty < T > ) { <nl> + bb0 ( % 0 : $ Empty < T > ) : <nl> + % 1 = function_ref @ inner_closure : $ @ async @ convention ( thin ) < Ο_0_0 > ( Empty < Ο_0_0 > ) - > @ owned Empty < Ο_0_0 > <nl> + % 2 = partial_apply [ callee_guaranteed ] % 1 < T > ( ) : $ @ async @ convention ( thin ) < Ο_0_0 > ( Empty < Ο_0_0 > ) - > @ owned Empty < Ο_0_0 > <nl> + % 5 = tuple ( % 0 : $ Empty < T > , % 2 : $ @ async @ callee_guaranteed ( Empty < T > ) - > @ owned Empty < T > ) <nl> + return % 5 : $ ( Empty < T > , @ async @ callee_guaranteed ( Empty < T > ) - > @ owned Empty < T > ) <nl> + } <nl> + <nl> + sil hidden @ specializes_closure_returning_closure : $ @ async @ convention ( thin ) ( ) - > @ async @ callee_guaranteed ( Empty < S > ) - > ( @ owned Empty < S > , @ owned @ async @ callee_guaranteed ( Empty < S > ) - > @ owned Empty < S > ) { <nl> + bb0 : <nl> + % 0 = function_ref @ returns_closure : $ @ async @ convention ( thin ) < Ο_0_0 > ( Empty < Ο_0_0 > ) - > ( @ owned Empty < Ο_0_0 > , @ owned @ async @ callee_guaranteed ( Empty < Ο_0_0 > ) - > @ owned Empty < Ο_0_0 > ) <nl> + % 1 = partial_apply [ callee_guaranteed ] % 0 < S > ( ) : $ @ async @ convention ( thin ) < Ο_0_0 > ( Empty < Ο_0_0 > ) - > ( @ owned Empty < Ο_0_0 > , @ owned @ async @ callee_guaranteed ( Empty < Ο_0_0 > ) - > @ owned Empty < Ο_0_0 > ) <nl> + return % 1 : $ @ async @ callee_guaranteed ( Empty < S > ) - > ( @ owned Empty < S > , @ owned @ async @ callee_guaranteed ( Empty < S > ) - > @ owned Empty < S > ) <nl> + } <nl> + <nl> + / / CHECK - LABEL : define hidden swiftcc void @ specializes_closure_returning_closure ( % swift . context * { { % [ 0 - 9 ] + } } ) { { # [ 0 - 9 ] + } } { <nl> + / / CHECK - LABEL : define internal swiftcc void @ " $ s15returns_closureTA " ( % swift . context * { { % [ 0 - 9 ] + } } , % swift . refcounted * swiftself { { % [ 0 - 9 ] + } } ) { { # [ 0 - 9 ] + } } { <nl> + protocol MyEquatable { <nl> + static func isEqual ( lhs : Self , rhs : Self ) - > Builtin . Int1 <nl> + } <nl> + <nl> + protocol MyExtended : MyEquatable { <nl> + func extended ( ) <nl> + } <nl> + public struct Inner < Element > { <nl> + public init ( ) <nl> + public init ( _ e : Element ) <nl> + } <nl> + <nl> + extension Inner : MyEquatable where Element : MyEquatable { <nl> + public static func isEqual ( lhs : Inner < Element > , rhs : Inner < Element > ) - > Builtin . Int1 <nl> + } <nl> + <nl> + public struct Outer < Value > { <nl> + init ( ) <nl> + } <nl> + <nl> + extension Outer : MyEquatable where Value : MyEquatable { <nl> + public static func isEqual ( lhs : Outer < Value > , rhs : Outer < Value > ) - > Builtin . Int1 <nl> + } <nl> + <nl> + public struct Outermost < Value > { <nl> + } <nl> + <nl> + sil @ $ closure : $ @ async @ convention ( method ) < Value where Value : MyEquatable > ( Outer < Value > , Outer < Value > , @ thin Outer < Value > . Type ) - > Builtin . Int1 <nl> + sil @ $ closure2 : $ @ async @ convention ( method ) < Value where Value : MyEquatable > ( Outermost < Value > , Outermost < Value > , @ thin Outermost < Value > . Type ) - > Builtin . Int1 <nl> + <nl> + sil @ $ dont_crash_test_capture_specialized_conditional_conformance : $ @ async @ convention ( thin ) < Element where Element : MyExtended > ( Outer < Inner < Element > > ) - > ( ) { <nl> + bb0 ( % 0 : $ Outer < Inner < Element > > ) : <nl> + % 2 = alloc_stack $ Outer < Inner < Element > > <nl> + store % 0 to % 2 : $ * Outer < Inner < Element > > <nl> + % 4 = metatype $ @ thin Outer < Inner < Element > > . Type <nl> + % 5 = function_ref @ $ closure : $ @ async @ convention ( method ) < Ο_0_0 where Ο_0_0 : MyEquatable > ( Outer < Ο_0_0 > , Outer < Ο_0_0 > , @ thin Outer < Ο_0_0 > . Type ) - > Builtin . Int1 <nl> + % 6 = partial_apply [ callee_guaranteed ] % 5 < Inner < Element > > ( % 4 ) : $ @ async @ convention ( method ) < Ο_0_0 where Ο_0_0 : MyEquatable > ( Outer < Ο_0_0 > , Outer < Ο_0_0 > , @ thin Outer < Ο_0_0 > . Type ) - > Builtin . Int1 <nl> + strong_release % 6 : $ @ async @ callee_guaranteed ( Outer < Inner < Element > > , Outer < Inner < Element > > ) - > Builtin . Int1 <nl> + dealloc_stack % 2 : $ * Outer < Inner < Element > > <nl> + % 15 = tuple ( ) <nl> + return % 15 : $ ( ) <nl> + } <nl> + <nl> + protocol AssocType { <nl> + associatedtype A : MyExtended <nl> + } <nl> + <nl> + sil @ $ dont_crash_test_capture_specialized_conditional_conformance_associated_type : $ @ async @ convention ( thin ) < Element where Element : AssocType > ( Outer < Inner < Element . A > > ) - > ( ) { <nl> + bb0 ( % 0 : $ Outer < Inner < Element . A > > ) : <nl> + % 2 = alloc_stack $ Outer < Inner < Element . A > > <nl> + store % 0 to % 2 : $ * Outer < Inner < Element . A > > <nl> + % 4 = metatype $ @ thin Outer < Inner < Element . A > > . Type <nl> + % 5 = function_ref @ $ closure : $ @ async @ convention ( method ) < Ο_0_0 where Ο_0_0 : MyEquatable > ( Outer < Ο_0_0 > , Outer < Ο_0_0 > , @ thin Outer < Ο_0_0 > . Type ) - > Builtin . Int1 <nl> + % 6 = partial_apply [ callee_guaranteed ] % 5 < Inner < Element . A > > ( % 4 ) : $ @ async @ convention ( method ) < Ο_0_0 where Ο_0_0 : MyEquatable > ( Outer < Ο_0_0 > , Outer < Ο_0_0 > , @ thin Outer < Ο_0_0 > . Type ) - > Builtin . Int1 <nl> + strong_release % 6 : $ @ async @ callee_guaranteed ( Outer < Inner < Element . A > > , Outer < Inner < Element . A > > ) - > Builtin . Int1 <nl> + dealloc_stack % 2 : $ * Outer < Inner < Element . A > > <nl> + % 15 = tuple ( ) <nl> + return % 15 : $ ( ) <nl> + } <nl> + <nl> + sil @ $ dont_crash_test_capture_specialized_conditional_conformance_nested : $ @ async @ convention ( thin ) < A , B , Element where Element : MyEquatable > ( Outer < Inner < Element > > ) - > ( ) { <nl> + bb0 ( % 0 : $ Outer < Inner < Element > > ) : <nl> + % 4 = metatype $ @ thin Outermost < Outer < Inner < Element > > > . Type <nl> + % 5 = function_ref @ $ closure2 : $ @ async @ convention ( method ) < Value where Value : MyEquatable > ( Outermost < Value > , Outermost < Value > , @ thin Outermost < Value > . Type ) - > Builtin . Int1 <nl> + % 6 = partial_apply [ callee_guaranteed ] % 5 < Outer < Inner < Element > > > ( % 4 ) : $ @ async @ convention ( method ) < Value where Value : MyEquatable > ( Outermost < Value > , Outermost < Value > , @ thin Outermost < Value > . Type ) - > Builtin . Int1 <nl> + strong_release % 6 : $ @ async @ callee_guaranteed ( Outermost < Outer < Inner < Element > > > , Outermost < Outer < Inner < Element > > > ) - > Builtin . Int1 <nl> + % 15 = tuple ( ) <nl> + return % 15 : $ ( ) <nl> + } <nl> + <nl> + <nl> + sil_vtable WeakBox { } <nl> + sil_vtable C { } <nl> + sil_vtable D { } <nl> + sil_vtable E { } <nl> + sil_vtable Empty { } <nl> + sil_witness_table C : P module main { } <nl> new file mode 100644 <nl> index 000000000000 . . fcffde323e0d <nl> mmm / dev / null <nl> ppp b / test / IRGen / async / run - partialapply - capture - class - to - void . sil <nl> <nl> + / / RUN : % empty - directory ( % t ) <nl> + / / RUN : % target - build - swift - dylib ( % t / % target - library - name ( PrintShims ) ) % S / . . / . . / Inputs / print - shims . swift - module - name PrintShims - emit - module - emit - module - path % t / PrintShims . swiftmodule <nl> + / / RUN : % target - codesign % t / % target - library - name ( PrintShims ) <nl> + / / RUN : % target - build - swift - Xfrontend - enable - experimental - concurrency - parse - sil % s - emit - ir - I % t - L % t - lPrintShim | % FileCheck % s - - check - prefix = CHECK - LL <nl> + / / RUN : % target - build - swift - Xfrontend - enable - experimental - concurrency - parse - sil % s - module - name main - o % t / main - I % t - L % t - lPrintShims % target - rpath ( % t ) <nl> + / / RUN : % target - codesign % t / main <nl> + / / RUN : % target - run % t / main % t / % target - library - name ( PrintShims ) | % FileCheck % s <nl> + <nl> + / / REQUIRES : executable_test <nl> + / / REQUIRES : swift_test_mode_optimize_none <nl> + / / REQUIRES : concurrency <nl> + / / UNSUPPORTED : use_os_stdlib <nl> + <nl> + import Builtin <nl> + import Swift <nl> + import PrintShims <nl> + <nl> + sil public_external @ printGeneric : $ @ convention ( thin ) < T > ( @ in_guaranteed T ) - > ( ) <nl> + <nl> + class S { <nl> + deinit <nl> + init ( ) <nl> + } <nl> + <nl> + sil hidden [ exact_self_class ] @ S_allocating_init : $ @ convention ( method ) ( @ thick S . Type ) - > @ owned S { <nl> + bb0 ( % 0 : $ @ thick S . Type ) : <nl> + % 1 = alloc_ref $ S <nl> + % 2 = function_ref @ $ S_init : $ @ convention ( method ) ( @ owned S ) - > @ owned S <nl> + % 3 = apply % 2 ( % 1 ) : $ @ convention ( method ) ( @ owned S ) - > @ owned S <nl> + return % 3 : $ S <nl> + } <nl> + <nl> + sil hidden @ $ S_init : $ @ convention ( method ) ( @ owned S ) - > @ owned S { <nl> + bb0 ( % 0 : $ S ) : <nl> + return % 0 : $ S <nl> + } <nl> + <nl> + sil hidden @ $ S_deinit : $ @ convention ( method ) ( @ guaranteed S ) - > @ owned Builtin . NativeObject { <nl> + bb0 ( % 0 : $ S ) : <nl> + % 2 = unchecked_ref_cast % 0 : $ S to $ Builtin . NativeObject <nl> + return % 2 : $ Builtin . NativeObject <nl> + } <nl> + <nl> + sil hidden @ S_deallocating_deinit : $ @ convention ( method ) ( @ owned S ) - > ( ) { <nl> + bb0 ( % 0 : $ S ) : <nl> + % 2 = function_ref @ $ S_deinit : $ @ convention ( method ) ( @ guaranteed S ) - > @ owned Builtin . NativeObject <nl> + % 3 = apply % 2 ( % 0 ) : $ @ convention ( method ) ( @ guaranteed S ) - > @ owned Builtin . NativeObject <nl> + % 4 = unchecked_ref_cast % 3 : $ Builtin . NativeObject to $ S <nl> + dealloc_ref % 4 : $ S <nl> + % 6 = tuple ( ) <nl> + return % 6 : $ ( ) <nl> + } <nl> + <nl> + sil_vtable S { <nl> + # S . init ! allocator : ( S . Type ) - > ( ) - > S : @ S_allocating_init <nl> + # S . deinit ! deallocator : @ S_deallocating_deinit <nl> + } <nl> + <nl> + / / CHECK - LL : define { { ( dllexport ) ? } } { { ( protected ) ? } } swiftcc void @ classinstanceSToVoid ( % swift . context * { { % [ 0 - 9 ] * } } ) { { # [ 0 - 9 ] * } } { <nl> + sil @ classinstanceSToVoid : $ @ async @ convention ( thin ) ( @ owned S ) - > ( ) { <nl> + entry ( % c : $ S ) : <nl> + % class_addr = alloc_stack $ S <nl> + store % c to % class_addr : $ * S <nl> + % printGeneric = function_ref @ printGeneric : $ @ convention ( thin ) < T > ( @ in_guaranteed T ) - > ( ) <nl> + % result = apply % printGeneric < S > ( % class_addr ) : $ @ convention ( thin ) < T > ( @ in_guaranteed T ) - > ( ) / / CHECK : main . S <nl> + dealloc_stack % class_addr : $ * S <nl> + return % result : $ ( ) <nl> + } <nl> + <nl> + sil @ partial_apply_class : $ @ async @ convention ( thin ) ( S ) - > @ async @ callee_owned ( ) - > ( ) { <nl> + entry ( % instance : $ S ) : <nl> + % classinstanceSToVoid = function_ref @ classinstanceSToVoid : $ @ async @ convention ( thin ) ( @ owned S ) - > ( ) <nl> + % partiallyApplied = partial_apply % classinstanceSToVoid ( % instance ) : $ @ async @ convention ( thin ) ( @ owned S ) - > ( ) <nl> + return % partiallyApplied : $ @ async @ callee_owned ( ) - > ( ) <nl> + } <nl> + <nl> + sil @ main : $ @ convention ( c ) ( Int32 , UnsafeMutablePointer < Optional < UnsafeMutablePointer < Int8 > > > ) - > Int32 { <nl> + bb0 ( % argc : $ Int32 , % argv : $ UnsafeMutablePointer < Optional < UnsafeMutablePointer < Int8 > > > ) : <nl> + % s_type = metatype $ @ thick S . Type <nl> + % allocating_init = function_ref @ S_allocating_init : $ @ convention ( method ) ( @ thick S . Type ) - > @ owned S <nl> + % instance = apply % allocating_init ( % s_type ) : $ @ convention ( method ) ( @ thick S . Type ) - > @ owned S <nl> + strong_retain % instance : $ S <nl> + <nl> + % partial_apply_class = function_ref @ partial_apply_class : $ @ async @ convention ( thin ) ( S ) - > @ async @ callee_owned ( ) - > ( ) <nl> + % partiallyApplied = apply % partial_apply_class ( % instance ) : $ @ async @ convention ( thin ) ( S ) - > @ async @ callee_owned ( ) - > ( ) <nl> + % result = apply % partiallyApplied ( ) : $ @ async @ callee_owned ( ) - > ( ) <nl> + <nl> + strong_release % instance : $ S <nl> + <nl> + % out_literal = integer_literal $ Builtin . Int32 , 0 <nl> + % out = struct $ Int32 ( % out_literal : $ Builtin . Int32 ) <nl> + return % out : $ Int32 <nl> + } <nl> new file mode 100644 <nl> index 000000000000 . . b84751bf93e7 <nl> mmm / dev / null <nl> ppp b / test / IRGen / async / run - partialapply - capture - generic_conformer - and - generic - to - void . sil <nl> <nl> + / / RUN : % empty - directory ( % t ) <nl> + / / RUN : % target - build - swift - dylib ( % t / % target - library - name ( PrintShims ) ) % S / . . / . . / Inputs / print - shims . swift - module - name PrintShims - emit - module - emit - module - path % t / PrintShims . swiftmodule <nl> + / / RUN : % target - codesign % t / % target - library - name ( PrintShims ) <nl> + / / RUN : % target - build - swift - Xfrontend - enable - experimental - concurrency - parse - sil % s - emit - ir - I % t - L % t - lPrintShim | % FileCheck % s - - check - prefix = CHECK - LL <nl> + / / RUN : % target - build - swift - Xfrontend - enable - experimental - concurrency - parse - sil % s - module - name main - o % t / main - I % t - L % t - lPrintShims % target - rpath ( % t ) <nl> + / / RUN : % target - codesign % t / main <nl> + / / RUN : % target - run % t / main % t / % target - library - name ( PrintShims ) | % FileCheck % s <nl> + <nl> + / / REQUIRES : executable_test <nl> + / / REQUIRES : swift_test_mode_optimize_none <nl> + / / REQUIRES : concurrency <nl> + / / UNSUPPORTED : use_os_stdlib <nl> + <nl> + import Builtin <nl> + import Swift <nl> + import PrintShims <nl> + <nl> + sil public_external @ printGeneric : $ @ convention ( thin ) < T > ( @ in_guaranteed T ) - > ( ) <nl> + sil public_external @ printInt64 : $ @ convention ( thin ) ( Int64 ) - > ( ) <nl> + <nl> + public protocol Observable { <nl> + associatedtype Result <nl> + func subscribe < T : Observer > ( o : T ) async - > ( ) <nl> + } <nl> + class ObservableImpl : Observable { <nl> + typealias Result = Void <nl> + func subscribe < T : Observer > ( o : T ) async - > ( ) <nl> + } <nl> + sil_vtable ObservableImpl { <nl> + } <nl> + / / CHECK - LL : define hidden swiftcc void @ subscribe_ObservableImpl_Observable ( % swift . context * { { % [ 0 - 9 ] * } } ) { { # [ 0 - 9 ] * } } { <nl> + sil hidden @ subscribe_ObservableImpl_Observable : $ @ convention ( witness_method : Observable ) @ async < Ο_0_0 where Ο_0_0 : Observer > ( @ in_guaranteed Ο_0_0 , @ in_guaranteed ObservableImpl ) - > ( ) { <nl> + bb0 ( % observer : $ * Ο_0_0 , % self : $ * ObservableImpl ) : <nl> + % printGeneric = function_ref @ printGeneric : $ @ convention ( thin ) < T > ( @ in_guaranteed T ) - > ( ) <nl> + % printGeneric_result1 = apply % printGeneric < Ο_0_0 > ( % observer ) : $ @ convention ( thin ) < T > ( @ in_guaranteed T ) - > ( ) / / CHECK : main . ObserverImpl <nl> + % printGeneric_result2 = apply % printGeneric < ObservableImpl > ( % self ) : $ @ convention ( thin ) < T > ( @ in_guaranteed T ) - > ( ) / / CHECK : main . ObservableImpl <nl> + % result = tuple ( ) <nl> + return % result : $ ( ) <nl> + } <nl> + sil_witness_table ObservableImpl : Observable module main { <nl> + associated_type Result : ( ) <nl> + method # Observable . subscribe : < Self where Self : Observable > < T where T : Observer > ( Self ) - > ( T ) async - > ( ) : @ subscribe_ObservableImpl_Observable <nl> + } <nl> + <nl> + public protocol Observer { <nl> + associatedtype Result <nl> + } <nl> + <nl> + class ObserverImpl : Observer { <nl> + typealias Result = Void <nl> + } <nl> + sil_vtable ObserverImpl { } <nl> + sil_witness_table ObserverImpl : Observer module main { <nl> + associated_type Result : ( ) <nl> + } <nl> + <nl> + / / CHECK - LL : define internal swiftcc void @ " $ sTA " ( % swift . context * { { % [ 0 - 9 ] * } } , % swift . refcounted * swiftself { { % [ 0 - 9 ] * } } ) { { # [ 0 - 9 ] * } } { <nl> + sil hidden @ witness_method : $ @ convention ( thin ) < S where S : Observable > < O where O : Observer , S . Result = = O . Result > ( @ in S ) - > @ owned @ async @ callee_owned ( @ in O ) - > ( ) { <nl> + bb0 ( % 0 : $ * S ) : <nl> + % 1 = witness_method $ S , # Observable . subscribe : $ @ async @ convention ( witness_method : Observable ) < Ο_0_0 where Ο_0_0 : Observable > < Ο_1_0 where Ο_1_0 : Observer , Ο_0_0 . Result = = Ο_1_0 . Result > ( @ in Ο_1_0 , @ in_guaranteed Ο_0_0 ) - > ( ) <nl> + % 2 = partial_apply % 1 < S , O > ( % 0 ) : $ @ async @ convention ( witness_method : Observable ) < Ο_0_0 where Ο_0_0 : Observable > < Ο_1_0 where Ο_1_0 : Observer , Ο_0_0 . Result = = Ο_1_0 . Result > ( @ in Ο_1_0 , @ in_guaranteed Ο_0_0 ) - > ( ) <nl> + return % 2 : $ @ async @ callee_owned ( @ in O ) - > ( ) <nl> + } <nl> + <nl> + <nl> + <nl> + sil @ main : $ @ convention ( c ) ( Int32 , UnsafeMutablePointer < Optional < UnsafeMutablePointer < Int8 > > > ) - > Int32 { <nl> + bb0 ( % argc : $ Int32 , % argv : $ UnsafeMutablePointer < Optional < UnsafeMutablePointer < Int8 > > > ) : <nl> + % observableImpl = alloc_ref $ ObservableImpl <nl> + strong_retain % observableImpl : $ ObservableImpl <nl> + % observableImpl_addr = alloc_stack $ ObservableImpl <nl> + store % observableImpl to % observableImpl_addr : $ * ObservableImpl <nl> + % witness_method = function_ref @ witness_method : $ @ convention ( thin ) < S where S : Observable > < O where O : Observer , S . Result = = O . Result > ( @ in S ) - > @ owned @ async @ callee_owned ( @ in O ) - > ( ) <nl> + % partiallyApplied = apply % witness_method < ObservableImpl , ObserverImpl > ( % observableImpl_addr ) : $ @ convention ( thin ) < S where S : Observable > < O where O : Observer , S . Result = = O . Result > ( @ in S ) - > @ owned @ async @ callee_owned ( @ in O ) - > ( ) <nl> + % observerImpl = alloc_ref $ ObserverImpl <nl> + % observerImpl_addr = alloc_stack $ ObserverImpl <nl> + store % observerImpl to % observerImpl_addr : $ * ObserverImpl <nl> + <nl> + % result = apply % partiallyApplied ( % observerImpl_addr ) : $ @ async @ callee_owned ( @ in ObserverImpl ) - > ( ) <nl> + <nl> + dealloc_stack % observerImpl_addr : $ * ObserverImpl <nl> + dealloc_stack % observableImpl_addr : $ * ObservableImpl <nl> + <nl> + % out_literal = integer_literal $ Builtin . Int32 , 0 <nl> + % out = struct $ Int32 ( % out_literal : $ Builtin . Int32 ) <nl> + return % out : $ Int32 <nl> + } <nl> new file mode 100644 <nl> index 000000000000 . . 5e951d9802f3 <nl> mmm / dev / null <nl> ppp b / test / IRGen / async / run - partialapply - capture - inout - generic - and - in - generic - to - generic . sil <nl> <nl> + / / RUN : % empty - directory ( % t ) <nl> + / / RUN : % target - build - swift - dylib ( % t / % target - library - name ( PrintShims ) ) % S / . . / . . / Inputs / print - shims . swift - module - name PrintShims - emit - module - emit - module - path % t / PrintShims . swiftmodule <nl> + / / RUN : % target - codesign % t / % target - library - name ( PrintShims ) <nl> + / / RUN : % target - build - swift - Xfrontend - enable - experimental - concurrency - parse - sil % s - emit - ir - I % t - L % t - lPrintShim | % FileCheck % s - - check - prefix = CHECK - LL <nl> + / / RUN : % target - build - swift - Xfrontend - enable - experimental - concurrency - parse - sil % s - module - name main - o % t / main - I % t - L % t - lPrintShims % target - rpath ( % t ) <nl> + / / RUN : % target - codesign % t / main <nl> + / / RUN : % target - run % t / main % t / % target - library - name ( PrintShims ) | % FileCheck % s <nl> + <nl> + / / REQUIRES : executable_test <nl> + / / REQUIRES : swift_test_mode_optimize_none <nl> + / / REQUIRES : concurrency <nl> + / / UNSUPPORTED : use_os_stdlib <nl> + <nl> + import Builtin <nl> + import Swift <nl> + import PrintShims <nl> + <nl> + sil public_external @ printGeneric : $ @ convention ( thin ) < T > ( @ in_guaranteed T ) - > ( ) <nl> + sil public_external @ printInt64 : $ @ convention ( thin ) ( Int64 ) - > ( ) <nl> + <nl> + / / CHECK - LL : define { { ( dllexport ) ? } } { { ( protected ) ? } } swiftcc void @ inGenericAndInoutGenericToGeneric ( % swift . context * { { % [ 0 - 9 ] * } } ) { { # [ 0 - 9 ] * } } { <nl> + / / CHECK - LL : define internal swiftcc void @ " $ s017inGenericAndInoutb2ToB0TA " ( % swift . context * { { % [ 0 - 9 ] * } } , % swift . refcounted * swiftself { { % [ 0 - 9 ] * } } ) { { # [ 0 - 9 ] * } } { <nl> + sil @ inGenericAndInoutGenericToGeneric : $ @ async @ convention ( thin ) < T > ( @ in T , @ inout T ) - > @ out T { <nl> + entry ( % out : $ * T , % in : $ * T , % inout : $ * T ) : <nl> + % printGeneric = function_ref @ printGeneric : $ @ convention ( thin ) < T > ( @ in_guaranteed T ) - > ( ) <nl> + % printGeneric_result1 = apply % printGeneric < T > ( % in ) : $ @ convention ( thin ) < T > ( @ in_guaranteed T ) - > ( ) / / CHECK : 876 <nl> + % printGeneric_result2 = apply % printGeneric < T > ( % inout ) : $ @ convention ( thin ) < T > ( @ in_guaranteed T ) - > ( ) / / CHECK : 678 <nl> + copy_addr % inout to [ initialization ] % out : $ * T <nl> + % result = tuple ( ) <nl> + return % result : $ ( ) <nl> + } <nl> + <nl> + sil @ partial_apply_open_generic_capture : $ @ convention ( thin ) < T > ( @ inout T ) - > @ async @ callee_owned ( @ in T ) - > @ out T { <nl> + entry ( % a : $ * T ) : <nl> + % f = function_ref @ inGenericAndInoutGenericToGeneric : $ @ async @ convention ( thin ) < U > ( @ in U , @ inout U ) - > @ out U <nl> + % p = partial_apply % f < T > ( % a ) : $ @ async @ convention ( thin ) < U > ( @ in U , @ inout U ) - > @ out U <nl> + return % p : $ @ async @ callee_owned ( @ in T ) - > @ out T <nl> + } <nl> + <nl> + sil @ main : $ @ convention ( c ) ( Int32 , UnsafeMutablePointer < Optional < UnsafeMutablePointer < Int8 > > > ) - > Int32 { <nl> + bb0 ( % argc : $ Int32 , % argv : $ UnsafeMutablePointer < Optional < UnsafeMutablePointer < Int8 > > > ) : <nl> + % in_literal = integer_literal $ Builtin . Int64 , 876 <nl> + % in = struct $ Int64 ( % in_literal : $ Builtin . Int64 ) <nl> + % inout_literal = integer_literal $ Builtin . Int64 , 678 <nl> + % inout = struct $ Int64 ( % inout_literal : $ Builtin . Int64 ) <nl> + <nl> + % in_addr = alloc_stack $ Int64 <nl> + store % in to % in_addr : $ * Int64 <nl> + % inout_addr = alloc_stack $ Int64 <nl> + store % inout to % inout_addr : $ * Int64 <nl> + % result_addr = alloc_stack $ Int64 <nl> + <nl> + % partial_apply_open_generic_capture = function_ref @ partial_apply_open_generic_capture : $ @ convention ( thin ) < T > ( @ inout T ) - > @ async @ callee_owned ( @ in T ) - > @ out T <nl> + % partiallyApplied = apply % partial_apply_open_generic_capture < Int64 > ( % inout_addr ) : $ @ convention ( thin ) < T > ( @ inout T ) - > @ async @ callee_owned ( @ in T ) - > @ out T <nl> + % void = apply % partiallyApplied ( % result_addr , % in_addr ) : $ @ async @ callee_owned ( @ in Int64 ) - > @ out Int64 <nl> + <nl> + % result = load % result_addr : $ * Int64 <nl> + % printInt64 = function_ref @ printInt64 : $ @ convention ( thin ) ( Int64 ) - > ( ) <nl> + % printInt64_result = apply % printInt64 ( % result ) : $ @ convention ( thin ) ( Int64 ) - > ( ) / / CHECK : 678 <nl> + <nl> + dealloc_stack % result_addr : $ * Int64 <nl> + dealloc_stack % inout_addr : $ * Int64 <nl> + dealloc_stack % in_addr : $ * Int64 <nl> + <nl> + % out_literal = integer_literal $ Builtin . Int32 , 0 <nl> + % out = struct $ Int32 ( % out_literal : $ Builtin . Int32 ) <nl> + return % out : $ Int32 <nl> + } <nl> new file mode 100644 <nl> index 000000000000 . . adf8147ddbeb <nl> mmm / dev / null <nl> ppp b / test / IRGen / async / run - partialapply - capture - int64 - int64 - to - int64 . sil <nl> <nl> + / / RUN : % empty - directory ( % t ) <nl> + / / RUN : % target - build - swift - dylib ( % t / % target - library - name ( PrintShims ) ) % S / . . / . . / Inputs / print - shims . swift - module - name PrintShims - emit - module - emit - module - path % t / PrintShims . swiftmodule <nl> + / / RUN : % target - codesign % t / % target - library - name ( PrintShims ) <nl> + / / RUN : % target - build - swift - Xfrontend - enable - experimental - concurrency - parse - sil % s - emit - ir - I % t - L % t - lPrintShim | % FileCheck % s - - check - prefix = CHECK - LL <nl> + / / RUN : % target - build - swift - Xfrontend - enable - experimental - concurrency - parse - sil % s - module - name main - o % t / main - I % t - L % t - lPrintShims % target - rpath ( % t ) <nl> + / / RUN : % target - codesign % t / main <nl> + / / RUN : % target - run % t / main % t / % target - library - name ( PrintShims ) | % FileCheck % s <nl> + <nl> + / / REQUIRES : executable_test <nl> + / / REQUIRES : swift_test_mode_optimize_none <nl> + / / REQUIRES : concurrency <nl> + / / UNSUPPORTED : use_os_stdlib <nl> + <nl> + import Builtin <nl> + import Swift <nl> + import PrintShims <nl> + <nl> + sil public_external @ printGeneric : $ @ convention ( thin ) < T > ( @ in_guaranteed T ) - > ( ) <nl> + sil public_external @ printInt64 : $ @ convention ( thin ) ( Int64 ) - > ( ) <nl> + <nl> + sil hidden @ createAndInvokeClosure : $ @ convention ( thin ) ( ) - > ( ) { <nl> + bb0 : <nl> + % captured_literal = integer_literal $ Builtin . Int64 , 783247897 <nl> + % captured = struct $ Int64 ( % captured_literal : $ Builtin . Int64 ) <nl> + % createPartialApply = function_ref @ createPartialApply : $ @ convention ( thin ) ( Int64 ) - > @ owned @ async @ callee_guaranteed ( Int64 ) - > Int64 <nl> + % partialApply = apply % createPartialApply ( % captured ) : $ @ convention ( thin ) ( Int64 ) - > @ owned @ async @ callee_guaranteed ( Int64 ) - > Int64 <nl> + strong_retain % partialApply : $ @ async @ callee_guaranteed ( Int64 ) - > Int64 <nl> + % applied_literal = integer_literal $ Builtin . Int64 , 7823478 <nl> + % applied = struct $ Int64 ( % applied_literal : $ Builtin . Int64 ) <nl> + % sum = apply % partialApply ( % applied ) : $ @ async @ callee_guaranteed ( Int64 ) - > Int64 <nl> + strong_release % partialApply : $ @ async @ callee_guaranteed ( Int64 ) - > Int64 <nl> + % printInt64 = function_ref @ printInt64 : $ @ convention ( thin ) ( Int64 ) - > ( ) <nl> + % result = apply % printInt64 ( % sum ) : $ @ convention ( thin ) ( Int64 ) - > ( ) / / CHECK : 791071375 <nl> + strong_release % partialApply : $ @ async @ callee_guaranteed ( Int64 ) - > Int64 <nl> + return % result : $ ( ) <nl> + } <nl> + <nl> + sil @ main : $ @ convention ( c ) ( Int32 , UnsafeMutablePointer < Optional < UnsafeMutablePointer < Int8 > > > ) - > Int32 { <nl> + bb0 ( % argc : $ Int32 , % argv : $ UnsafeMutablePointer < Optional < UnsafeMutablePointer < Int8 > > > ) : <nl> + % createAndInvokeClosure = function_ref @ createAndInvokeClosure : $ @ convention ( thin ) ( ) - > ( ) <nl> + % createAndInvokeClosure_result = apply % createAndInvokeClosure ( ) : $ @ convention ( thin ) ( ) - > ( ) <nl> + % out_literal = integer_literal $ Builtin . Int32 , 0 <nl> + % out = struct $ Int32 ( % out_literal : $ Builtin . Int32 ) <nl> + return % out : $ Int32 <nl> + } <nl> + <nl> + / / CHECK - LL : define internal swiftcc void @ closure ( % swift . context * { { % [ 0 - 9 ] * } } ) { { # [ 0 - 9 ] * } } <nl> + / / CHECK - LL : define internal swiftcc void @ " $ s7closureTA " ( % swift . context * { { % [ 0 - 9 ] * } } , % swift . refcounted * swiftself { { % [ 0 - 9 ] * } } ) { { # [ 0 - 9 ] * } } <nl> + sil hidden @ createPartialApply : $ @ convention ( thin ) ( Int64 ) - > @ owned @ async @ callee_guaranteed ( Int64 ) - > Int64 { <nl> + bb0 ( % captured : $ Int64 ) : <nl> + % closure = function_ref @ closure : $ @ async @ convention ( thin ) ( Int64 , Int64 ) - > Int64 <nl> + % partialApply = partial_apply [ callee_guaranteed ] % closure ( % captured ) : $ @ async @ convention ( thin ) ( Int64 , Int64 ) - > Int64 <nl> + return % partialApply : $ @ async @ callee_guaranteed ( Int64 ) - > Int64 <nl> + } <nl> + <nl> + sil private @ closure : $ @ async @ convention ( thin ) ( Int64 , Int64 ) - > Int64 { <nl> + bb0 ( % one : $ Int64 , % two : $ Int64 ) : <nl> + % printInt64 = function_ref @ printInt64 : $ @ convention ( thin ) ( Int64 ) - > ( ) <nl> + % printInt64_1 = apply % printInt64 ( % one ) : $ @ convention ( thin ) ( Int64 ) - > ( ) <nl> + % printInt64_2 = apply % printInt64 ( % two ) : $ @ convention ( thin ) ( Int64 ) - > ( ) <nl> + % one_builtin = struct_extract % one : $ Int64 , # Int64 . _value <nl> + % two_builtin = struct_extract % two : $ Int64 , # Int64 . _value <nl> + % flag = integer_literal $ Builtin . Int1 , - 1 <nl> + % sumAndOverflowed = builtin " sadd_with_overflow_Int64 " ( % one_builtin : $ Builtin . Int64 , % two_builtin : $ Builtin . Int64 , % flag : $ Builtin . Int1 ) : $ ( Builtin . Int64 , Builtin . Int1 ) <nl> + % sum_builtin = tuple_extract % sumAndOverflowed : $ ( Builtin . Int64 , Builtin . Int1 ) , 0 <nl> + % overflowed = tuple_extract % sumAndOverflowed : $ ( Builtin . Int64 , Builtin . Int1 ) , 1 <nl> + cond_fail % overflowed : $ Builtin . Int1 , " arithmetic overflow " <nl> + % sum = struct $ Int64 ( % sum_builtin : $ Builtin . Int64 ) <nl> + return % sum : $ Int64 <nl> + } <nl> + <nl> new file mode 100644 <nl> index 000000000000 . . b50eca7e86b3 <nl> mmm / dev / null <nl> ppp b / test / IRGen / async / run - partialapply - capture - int64 - to - generic . sil <nl> <nl> + / / RUN : % empty - directory ( % t ) <nl> + / / RUN : % target - build - swift - dylib ( % t / % target - library - name ( PrintShims ) ) % S / . . / . . / Inputs / print - shims . swift - module - name PrintShims - emit - module - emit - module - path % t / PrintShims . swiftmodule <nl> + / / RUN : % target - codesign % t / % target - library - name ( PrintShims ) <nl> + / / RUN : % target - build - swift - Xfrontend - enable - experimental - concurrency - parse - sil % s - emit - ir - I % t - L % t - lPrintShim | % FileCheck % s - - check - prefix = CHECK - LL <nl> + / / RUN : % target - build - swift - Xfrontend - enable - experimental - concurrency - parse - sil % s - module - name main - o % t / main - I % t - L % t - lPrintShims % target - rpath ( % t ) <nl> + / / RUN : % target - codesign % t / main <nl> + / / RUN : % target - run % t / main % t / % target - library - name ( PrintShims ) | % FileCheck % s <nl> + <nl> + / / REQUIRES : executable_test <nl> + / / REQUIRES : swift_test_mode_optimize_none <nl> + / / REQUIRES : concurrency <nl> + / / UNSUPPORTED : use_os_stdlib <nl> + <nl> + import Builtin <nl> + import Swift <nl> + import PrintShims <nl> + <nl> + sil public_external @ printGeneric : $ @ convention ( thin ) < T > ( @ in_guaranteed T ) - > ( ) <nl> + sil public_external @ printInt32 : $ @ convention ( thin ) ( Int32 ) - > ( ) <nl> + <nl> + sil @ partial_apply_dynamic_with_out_param : $ @ convention ( thin ) < T > ( Int32 , @ owned @ async @ callee_owned ( Int32 ) - > @ out T ) - > @ async @ callee_owned ( ) - > @ out T { <nl> + bb0 ( % x : $ Int32 , % f : $ @ async @ callee_owned ( Int32 ) - > @ out T ) : <nl> + % p = partial_apply % f ( % x ) : $ @ async @ callee_owned ( Int32 ) - > @ out T <nl> + return % p : $ @ async @ callee_owned ( ) - > @ out T <nl> + } <nl> + <nl> + / / CHECK - LL : define internal swiftcc void @ " $ sTA " ( % swift . context * { { % [ 0 - 9 ] * } } , % swift . refcounted * swiftself { { % [ 0 - 9 ] * } } ) { { # [ 0 - 9 ] * } } { <nl> + / / CHECK - LL : define internal swiftcc void @ " $ s6calleeTA " ( % swift . context * { { % [ 0 - 9 ] * } } , % swift . refcounted * swiftself { { % [ 0 - 9 ] * } } ) { { # [ 0 - 9 ] * } } { <nl> + sil @ callee : $ @ async @ convention ( thin ) < T > ( Int32 , @ in_guaranteed T ) - > @ out T { <nl> + entry ( % out_t : $ * T , % x : $ Int32 , % in_t : $ * T ) : <nl> + % printGeneric = function_ref @ printGeneric : $ @ convention ( thin ) < T > ( @ in_guaranteed T ) - > ( ) <nl> + % printInt32 = function_ref @ printInt32 : $ @ convention ( thin ) ( Int32 ) - > ( ) <nl> + % result = apply % printGeneric < T > ( % in_t ) : $ @ convention ( thin ) < T > ( @ in_guaranteed T ) - > ( ) / / CHECK : 1 <nl> + % printInt32_result = apply % printInt32 ( % x ) : $ @ convention ( thin ) ( Int32 ) - > ( ) / / CHECK : 6789 <nl> + copy_addr % in_t to [ initialization ] % out_t : $ * T <nl> + return % result : $ ( ) <nl> + } <nl> + <nl> + sil @ main : $ @ convention ( c ) ( Int32 , UnsafeMutablePointer < Optional < UnsafeMutablePointer < Int8 > > > ) - > Int32 { <nl> + bb0 ( % argc : $ Int32 , % argv : $ UnsafeMutablePointer < Optional < UnsafeMutablePointer < Int8 > > > ) : <nl> + % callee = function_ref @ callee : $ @ async @ convention ( thin ) < T > ( Int32 , @ in_guaranteed T ) - > @ out T <nl> + % first_literal = integer_literal $ Builtin . Int32 , 1 <nl> + % first = struct $ Int32 ( % first_literal : $ Builtin . Int32 ) <nl> + % first_addr = alloc_stack $ Int32 <nl> + store % first to % first_addr : $ * Int32 <nl> + % callee1 = partial_apply % callee < Int32 > ( % first_addr ) : $ @ async @ convention ( thin ) < T > ( Int32 , @ in_guaranteed T ) - > @ out T <nl> + % partialApplier = function_ref @ partial_apply_dynamic_with_out_param : $ @ convention ( thin ) < T > ( Int32 , @ owned @ async @ callee_owned ( Int32 ) - > @ out T ) - > @ async @ callee_owned ( ) - > @ out T <nl> + % second_literal = integer_literal $ Builtin . Int32 , 6789 <nl> + % second = struct $ Int32 ( % second_literal : $ Builtin . Int32 ) <nl> + % callee2 = apply % partialApplier < Int32 > ( % second , % callee1 ) : $ @ convention ( thin ) < T > ( Int32 , @ owned @ async @ callee_owned ( Int32 ) - > @ out T ) - > @ async @ callee_owned ( ) - > @ out T <nl> + <nl> + % result_addr = alloc_stack $ Int32 <nl> + % result = apply % callee2 ( % result_addr ) : $ @ async @ callee_owned ( ) - > @ out Int32 <nl> + <nl> + % printGeneric = function_ref @ printGeneric : $ @ convention ( thin ) < T > ( @ in_guaranteed T ) - > ( ) <nl> + % printGeneric_result = apply % printGeneric < Int32 > ( % result_addr ) : $ @ convention ( thin ) < T > ( @ in_guaranteed T ) - > ( ) / / CHECK : 1 <nl> + <nl> + dealloc_stack % result_addr : $ * Int32 <nl> + dealloc_stack % first_addr : $ * Int32 <nl> + <nl> + % out_literal = integer_literal $ Builtin . Int32 , 0 <nl> + % out = struct $ Int32 ( % out_literal : $ Builtin . Int32 ) <nl> + return % out : $ Int32 <nl> + } <nl> new file mode 100644 <nl> index 000000000000 . . bebd7e2cd57d <nl> mmm / dev / null <nl> ppp b / test / IRGen / async / run - partialapply - capture - struct_classinstance_classinstance - and - int64 - to - int64 . sil <nl> <nl> + / / RUN : % empty - directory ( % t ) <nl> + / / RUN : % target - build - swift - dylib ( % t / % target - library - name ( PrintShims ) ) % S / . . / . . / Inputs / print - shims . swift - module - name PrintShims - emit - module - emit - module - path % t / PrintShims . swiftmodule <nl> + / / RUN : % target - codesign % t / % target - library - name ( PrintShims ) <nl> + / / RUN : % target - build - swift - Xfrontend - enable - experimental - concurrency - parse - sil % s - emit - ir - I % t - L % t - lPrintShim | % FileCheck % s - - check - prefix = CHECK - LL <nl> + / / RUN : % target - build - swift - Xfrontend - enable - experimental - concurrency - parse - sil % s - module - name main - o % t / main - I % t - L % t - lPrintShims % target - rpath ( % t ) <nl> + / / RUN : % target - codesign % t / main <nl> + / / RUN : % target - run % t / main % t / % target - library - name ( PrintShims ) | % FileCheck % s <nl> + <nl> + / / REQUIRES : executable_test <nl> + / / REQUIRES : swift_test_mode_optimize_none <nl> + / / REQUIRES : concurrency <nl> + / / UNSUPPORTED : use_os_stdlib <nl> + <nl> + import Builtin <nl> + import Swift <nl> + import PrintShims <nl> + <nl> + sil public_external @ printGeneric : $ @ convention ( thin ) < T > ( @ in_guaranteed T ) - > ( ) <nl> + sil public_external @ printInt64 : $ @ convention ( thin ) ( Int64 ) - > ( ) <nl> + <nl> + class C { <nl> + deinit <nl> + init ( ) <nl> + } <nl> + <nl> + sil hidden [ exact_self_class ] @ S_allocating_init : $ @ convention ( method ) ( @ thick C . Type ) - > @ owned C { <nl> + bb0 ( % 0 : $ @ thick C . Type ) : <nl> + % 1 = alloc_ref $ C <nl> + % 2 = function_ref @ $ S_init : $ @ convention ( method ) ( @ owned C ) - > @ owned C <nl> + % 3 = apply % 2 ( % 1 ) : $ @ convention ( method ) ( @ owned C ) - > @ owned C <nl> + return % 3 : $ C <nl> + } <nl> + <nl> + sil hidden @ $ S_init : $ @ convention ( method ) ( @ owned C ) - > @ owned C { <nl> + bb0 ( % 0 : $ C ) : <nl> + return % 0 : $ C <nl> + } <nl> + <nl> + sil hidden @ $ S_deinit : $ @ convention ( method ) ( @ guaranteed C ) - > @ owned Builtin . NativeObject { <nl> + bb0 ( % 0 : $ C ) : <nl> + % 2 = unchecked_ref_cast % 0 : $ C to $ Builtin . NativeObject <nl> + return % 2 : $ Builtin . NativeObject <nl> + } <nl> + <nl> + sil hidden @ S_deallocating_deinit : $ @ convention ( method ) ( @ owned C ) - > ( ) { <nl> + bb0 ( % 0 : $ C ) : <nl> + % 2 = function_ref @ $ S_deinit : $ @ convention ( method ) ( @ guaranteed C ) - > @ owned Builtin . NativeObject <nl> + % 3 = apply % 2 ( % 0 ) : $ @ convention ( method ) ( @ guaranteed C ) - > @ owned Builtin . NativeObject <nl> + % 4 = unchecked_ref_cast % 3 : $ Builtin . NativeObject to $ C <nl> + dealloc_ref % 4 : $ C <nl> + % 6 = tuple ( ) <nl> + return % 6 : $ ( ) <nl> + } <nl> + <nl> + sil_vtable C { <nl> + # C . init ! allocator : ( C . Type ) - > ( ) - > C : @ S_allocating_init <nl> + # C . deinit ! deallocator : @ S_deallocating_deinit <nl> + } <nl> + <nl> + <nl> + struct S { var x : C , y : C } <nl> + <nl> + / / CHECK - LL : define { { ( dllexport ) ? } } { { ( protected ) ? } } swiftcc void @ structClassInstanceClassInstanceAndInt64ToInt64 ( % swift . context * { { % [ 0 - 9 ] * } } ) { { # [ 0 - 9 ] * } } { <nl> + / / CHECK - LL : define internal swiftcc void @ " $ s019structClassInstancebc10AndInt64ToE0TA " ( % swift . context * { { % [ 0 - 9 ] * } } , % swift . refcounted * swiftself { { % [ 0 - 9 ] * } } ) { { # [ 0 - 9 ] * } } { <nl> + sil @ structClassInstanceClassInstanceAndInt64ToInt64 : $ @ async @ convention ( thin ) ( Int64 , @ guaranteed S ) - > Int64 { <nl> + entry ( % in : $ Int64 , % s : $ S ) : <nl> + % s_addr = alloc_stack $ S <nl> + store % s to % s_addr : $ * S <nl> + % printGeneric = function_ref @ printGeneric : $ @ convention ( thin ) < T > ( @ in_guaranteed T ) - > ( ) <nl> + % printGeneric_result = apply % printGeneric < S > ( % s_addr ) : $ @ convention ( thin ) < T > ( @ in_guaranteed T ) - > ( ) / / CHECK : S ( x : main . C , y : main . C ) <nl> + dealloc_stack % s_addr : $ * S <nl> + % printInt64 = function_ref @ printInt64 : $ @ convention ( thin ) ( Int64 ) - > ( ) <nl> + % printInt64_result = apply % printInt64 ( % in ) : $ @ convention ( thin ) ( Int64 ) - > ( ) / / CHECK : 9999 <nl> + return % in : $ Int64 <nl> + } <nl> + <nl> + sil @ partial_apply_guaranteed_class_pair_param : $ @ convention ( thin ) ( @ owned S ) - > @ async @ callee_owned ( Int64 ) - > Int64 { <nl> + bb0 ( % x : $ S ) : <nl> + % f = function_ref @ structClassInstanceClassInstanceAndInt64ToInt64 : $ @ async @ convention ( thin ) ( Int64 , @ guaranteed S ) - > Int64 <nl> + % p = partial_apply % f ( % x ) : $ @ async @ convention ( thin ) ( Int64 , @ guaranteed S ) - > Int64 <nl> + return % p : $ @ async @ callee_owned ( Int64 ) - > Int64 <nl> + } <nl> + <nl> + sil @ main : $ @ convention ( c ) ( Int32 , UnsafeMutablePointer < Optional < UnsafeMutablePointer < Int8 > > > ) - > Int32 { <nl> + bb0 ( % argc : $ Int32 , % argv : $ UnsafeMutablePointer < Optional < UnsafeMutablePointer < Int8 > > > ) : <nl> + % s_type = metatype $ @ thick C . Type <nl> + % allocating_init = function_ref @ S_allocating_init : $ @ convention ( method ) ( @ thick C . Type ) - > @ owned C <nl> + % instance1 = apply % allocating_init ( % s_type ) : $ @ convention ( method ) ( @ thick C . Type ) - > @ owned C <nl> + % instance2 = apply % allocating_init ( % s_type ) : $ @ convention ( method ) ( @ thick C . Type ) - > @ owned C <nl> + strong_retain % instance1 : $ C <nl> + strong_retain % instance2 : $ C <nl> + % instance = struct $ S ( % instance1 : $ C , % instance2 : $ C ) <nl> + <nl> + % partial_apply_guaranteed_class_pair_param = function_ref @ partial_apply_guaranteed_class_pair_param : $ @ convention ( thin ) ( @ owned S ) - > @ async @ callee_owned ( Int64 ) - > Int64 <nl> + % partiallyApplied = apply % partial_apply_guaranteed_class_pair_param ( % instance ) : $ @ convention ( thin ) ( @ owned S ) - > @ async @ callee_owned ( Int64 ) - > Int64 <nl> + % int_literal = integer_literal $ Builtin . Int64 , 9999 <nl> + % int = struct $ Int64 ( % int_literal : $ Builtin . Int64 ) <nl> + % result = apply % partiallyApplied ( % int ) : $ @ async @ callee_owned ( Int64 ) - > Int64 <nl> + % printInt64 = function_ref @ printInt64 : $ @ convention ( thin ) ( Int64 ) - > ( ) <nl> + % printInt64_result = apply % printInt64 ( % result ) : $ @ convention ( thin ) ( Int64 ) - > ( ) / / CHECK : 9999 <nl> + <nl> + % out_literal = integer_literal $ Builtin . Int32 , 0 <nl> + % out = struct $ Int32 ( % out_literal : $ Builtin . Int32 ) <nl> + return % out : $ Int32 <nl> + } <nl> new file mode 100644 <nl> index 000000000000 . . e9b8aecc7745 <nl> mmm / dev / null <nl> ppp b / test / IRGen / async / run - partialapply - capture - structgeneric_classinstance_to_struct_and_error . sil <nl> <nl> + / / RUN : % empty - directory ( % t ) <nl> + / / RUN : % target - build - swift - dylib ( % t / % target - library - name ( PrintShims ) ) % S / . . / . . / Inputs / print - shims . swift - module - name PrintShims - emit - module - emit - module - path % t / PrintShims . swiftmodule <nl> + / / RUN : % target - codesign % t / % target - library - name ( PrintShims ) <nl> + / / RUN : % target - build - swift - Xfrontend - enable - experimental - concurrency - parse - sil % s - emit - ir - I % t - L % t - lPrintShim | % FileCheck % s - - check - prefix = CHECK - LL <nl> + / / RUN : % target - build - swift - Xfrontend - enable - experimental - concurrency - parse - sil % s - module - name main - o % t / main - I % t - L % t - lPrintShims % target - rpath ( % t ) <nl> + / / RUN : % target - codesign % t / main <nl> + / / RUN : % target - run % t / main % t / % target - library - name ( PrintShims ) | % FileCheck % s <nl> + <nl> + / / REQUIRES : executable_test <nl> + / / REQUIRES : swift_test_mode_optimize_none <nl> + / / REQUIRES : concurrency <nl> + / / UNSUPPORTED : use_os_stdlib <nl> + <nl> + import Builtin <nl> + import Swift <nl> + import PrintShims <nl> + <nl> + sil public_external @ printGeneric : $ @ convention ( thin ) < T > ( @ in_guaranteed T ) - > ( ) <nl> + <nl> + struct A1 { <nl> + let b : ( ) - > ( ) <nl> + } <nl> + <nl> + struct A2 < T > { <nl> + let a : T <nl> + } <nl> + <nl> + class A3 { } <nl> + sil_vtable A3 { } <nl> + <nl> + sil @ printA2AtA3 : $ @ convention ( thin ) ( A2 < A3 > ) - > ( ) { <nl> + entry ( % value : $ A2 < A3 > ) : <nl> + % addr = alloc_stack $ A2 < A3 > <nl> + store % value to % addr : $ * A2 < A3 > <nl> + % printGeneric = function_ref @ printGeneric : $ @ convention ( thin ) < T > ( @ in_guaranteed T ) - > ( ) <nl> + % result = apply % printGeneric < A2 < A3 > > ( % addr ) : $ @ convention ( thin ) < T > ( @ in_guaranteed T ) - > ( ) <nl> + dealloc_stack % addr : $ * A2 < A3 > <nl> + return % result : $ ( ) <nl> + } <nl> + <nl> + / / CHECK - LL : define { { ( dllexport ) ? } } { { ( protected ) ? } } swiftcc void @ amethod ( % swift . context * { { % [ 0 - 9 ] * } } ) { { # [ 0 - 9 ] * } } { <nl> + sil @ amethod : $ @ async @ convention ( method ) ( @ in_guaranteed A2 < A3 > ) - > ( @ owned A1 , @ error Error ) { <nl> + entry ( % a2_at_a3_addr : $ * A2 < A3 > ) : <nl> + % a2_at_a3 = load % a2_at_a3_addr : $ * A2 < A3 > <nl> + % printA2AtA3 = function_ref @ printA2AtA3 : $ @ convention ( thin ) ( A2 < A3 > ) - > ( ) <nl> + % partiallyApplied = partial_apply [ callee_guaranteed ] % printA2AtA3 ( % a2_at_a3 ) : $ @ convention ( thin ) ( A2 < A3 > ) - > ( ) <nl> + % result = struct $ A1 ( % partiallyApplied : $ @ callee_guaranteed ( ) - > ( ) ) <nl> + return % result : $ A1 <nl> + } <nl> + <nl> + / / CHECK - LL : define { { ( dllexport ) ? } } { { ( protected ) ? } } swiftcc void @ repo ( % swift . context * { { % [ 0 - 9 ] * } } ) { { # [ 0 - 9 ] * } } { <nl> + / / CHECK - LL : define internal swiftcc void @ " $ s7amethodTA " ( % swift . context * { { % [ 0 - 9 ] * } } , % swift . refcounted * swiftself { { % [ 0 - 9 ] * } } ) { { # [ 0 - 9 ] * } } { <nl> + sil @ repo : $ @ async @ convention ( thin ) ( @ in_guaranteed A2 < A3 > ) - > @ owned @ async @ callee_guaranteed ( ) - > ( @ owned A1 , @ error Error ) { <nl> + bb0 ( % 0 : $ * A2 < A3 > ) : <nl> + % 1 = load % 0 : $ * A2 < A3 > <nl> + % 2 = alloc_stack $ A2 < A3 > <nl> + store % 1 to % 2 : $ * A2 < A3 > <nl> + % 4 = function_ref @ amethod : $ @ async @ convention ( method ) ( @ in_guaranteed A2 < A3 > ) - > ( @ owned A1 , @ error Error ) <nl> + % 5 = partial_apply [ callee_guaranteed ] % 4 ( % 2 ) : $ @ async @ convention ( method ) ( @ in_guaranteed A2 < A3 > ) - > ( @ owned A1 , @ error Error ) <nl> + dealloc_stack % 2 : $ * A2 < A3 > <nl> + return % 5 : $ @ async @ callee_guaranteed ( ) - > ( @ owned A1 , @ error Error ) <nl> + } <nl> + <nl> + sil @ main : $ @ convention ( c ) ( Int32 , UnsafeMutablePointer < Optional < UnsafeMutablePointer < Int8 > > > ) - > Int32 { <nl> + bb0 ( % argc : $ Int32 , % argv : $ UnsafeMutablePointer < Optional < UnsafeMutablePointer < Int8 > > > ) : <nl> + % a3 = alloc_ref $ A3 <nl> + % a2 = struct $ A2 < A3 > ( % a3 : $ A3 ) <nl> + <nl> + % a2_addr = alloc_stack $ A2 < A3 > <nl> + store % a2 to % a2_addr : $ * A2 < A3 > <nl> + <nl> + % callee = function_ref @ repo : $ @ async @ convention ( thin ) ( @ in_guaranteed A2 < A3 > ) - > @ owned @ async @ callee_guaranteed ( ) - > ( @ owned A1 , @ error Error ) <nl> + % partiallyApplied = apply % callee ( % a2_addr ) : $ @ async @ convention ( thin ) ( @ in_guaranteed A2 < A3 > ) - > @ owned @ async @ callee_guaranteed ( ) - > ( @ owned A1 , @ error Error ) <nl> + try_apply % partiallyApplied ( ) : $ @ async @ callee_guaranteed ( ) - > ( @ owned A1 , @ error Error ) , normal bb_success , error bb_error <nl> + <nl> + bb_success ( % value : $ A1 ) : <nl> + % value_addr = alloc_stack $ A1 <nl> + store % value to % value_addr : $ * A1 <nl> + % printGeneric = function_ref @ printGeneric : $ @ convention ( thin ) < T > ( @ in_guaranteed T ) - > ( ) <nl> + % result = apply % printGeneric < A1 > ( % value_addr ) : $ @ convention ( thin ) < T > ( @ in_guaranteed T ) - > ( ) / / CHECK : A1 ( b : ( Function ) ) <nl> + % closure = struct_extract % value : $ A1 , # A1 . b <nl> + % closure_result = apply % closure ( ) : $ @ callee_guaranteed ( ) - > ( ) / / CHECK : A2 < A3 > ( a : main . A3 ) <nl> + dealloc_stack % value_addr : $ * A1 <nl> + <nl> + br bb_finish <nl> + <nl> + bb_error ( % error : $ Error ) : <nl> + br bb_finish <nl> + <nl> + bb_finish : <nl> + <nl> + dealloc_stack % a2_addr : $ * A2 < A3 > <nl> + <nl> + % out_literal = integer_literal $ Builtin . Int32 , 0 <nl> + % out = struct $ Int32 ( % out_literal : $ Builtin . Int32 ) <nl> + return % out : $ Int32 <nl> + } <nl> new file mode 100644 <nl> index 000000000000 . . 5b5a47e58d89 <nl> mmm / dev / null <nl> ppp b / test / IRGen / async / run - partialapply - capture - structgeneric_polymorphic_constrained - to - void . sil <nl> <nl> + / / RUN : % empty - directory ( % t ) <nl> + / / RUN : % target - build - swift - dylib ( % t / % target - library - name ( PrintShims ) ) % S / . . / . . / Inputs / print - shims . swift - module - name PrintShims - emit - module - emit - module - path % t / PrintShims . swiftmodule <nl> + / / RUN : % target - codesign % t / % target - library - name ( PrintShims ) <nl> + / / RUN : % target - build - swift - Xfrontend - enable - experimental - concurrency - parse - sil % s - emit - ir - I % t - L % t - lPrintShim | % FileCheck % s - - check - prefix = CHECK - LL <nl> + / / RUN : % target - build - swift - Xfrontend - enable - experimental - concurrency - parse - sil % s - module - name main - o % t / main - I % t - L % t - lPrintShims % target - rpath ( % t ) <nl> + / / RUN : % target - codesign % t / main <nl> + / / RUN : % target - run % t / main % t / % target - library - name ( PrintShims ) | % FileCheck % s <nl> + <nl> + / / REQUIRES : executable_test <nl> + / / REQUIRES : swift_test_mode_optimize_none <nl> + / / REQUIRES : concurrency <nl> + / / UNSUPPORTED : use_os_stdlib <nl> + <nl> + import Builtin <nl> + import Swift <nl> + import PrintShims <nl> + <nl> + sil public_external @ printGeneric : $ @ convention ( thin ) < T > ( @ in_guaranteed T ) - > ( ) <nl> + <nl> + public protocol Q { <nl> + associatedtype Update <nl> + } <nl> + <nl> + public struct BaseProducer < T > : Q { <nl> + public typealias Update = T <nl> + } <nl> + sil_witness_table < T > BaseProducer < T > : Q module main { <nl> + associated_type Update : T <nl> + } <nl> + <nl> + public class WeakBox < T > { } <nl> + sil_vtable WeakBox { } <nl> + <nl> + / / CHECK - LL : define internal swiftcc void @ " $ s7takingQTA " ( % swift . context * { { % [ 0 - 9 ] * } } , % swift . refcounted * swiftself { { % [ 0 - 9 ] * } } ) { { # [ 0 - 9 ] * } } { <nl> + sil hidden @ takingQ : $ @ async @ convention ( thin ) < Ο_0_0 where Ο_0_0 : Q > ( @ owned WeakBox < Ο_0_0 > ) - > ( ) { <nl> + entry ( % box : $ WeakBox < Ο_0_0 > ) : <nl> + % box_addr = alloc_stack $ WeakBox < Ο_0_0 > <nl> + store % box to % box_addr : $ * WeakBox < Ο_0_0 > <nl> + % printGeneric = function_ref @ printGeneric : $ @ convention ( thin ) < T > ( @ in_guaranteed T ) - > ( ) <nl> + % result = apply % printGeneric < WeakBox < Ο_0_0 > > ( % box_addr ) : $ @ convention ( thin ) < T > ( @ in_guaranteed T ) - > ( ) / / CHECK : main . WeakBox < main . BaseProducer < Swift . Int64 > > <nl> + dealloc_stack % box_addr : $ * WeakBox < Ο_0_0 > <nl> + return % result : $ ( ) <nl> + } <nl> + <nl> + sil public @ bind_polymorphic_param_from_context : $ @ convention ( thin ) < Ο_0_1 > ( @ in Ο_0_1 ) - > @ owned @ async @ callee_owned ( ) - > ( ) { <nl> + bb0 ( % 0 : $ * Ο_0_1 ) : <nl> + % 1 = alloc_ref $ WeakBox < BaseProducer < Ο_0_1 > > <nl> + % 8 = function_ref @ takingQ : $ @ async @ convention ( thin ) < Ο_0_0 where Ο_0_0 : Q > ( @ owned WeakBox < Ο_0_0 > ) - > ( ) <nl> + % 9 = partial_apply % 8 < BaseProducer < Ο_0_1 > > ( % 1 ) : $ @ async @ convention ( thin ) < Ο_0_0 where Ο_0_0 : Q > ( @ owned WeakBox < Ο_0_0 > ) - > ( ) <nl> + return % 9 : $ @ async @ callee_owned ( ) - > ( ) <nl> + } <nl> + <nl> + sil @ main : $ @ convention ( c ) ( Int32 , UnsafeMutablePointer < Optional < UnsafeMutablePointer < Int8 > > > ) - > Int32 { <nl> + bb0 ( % argc : $ Int32 , % argv : $ UnsafeMutablePointer < Optional < UnsafeMutablePointer < Int8 > > > ) : <nl> + % bind_polymorphic_param_from_context = function_ref @ bind_polymorphic_param_from_context : $ @ convention ( thin ) < Ο_0_1 > ( @ in Ο_0_1 ) - > @ owned @ async @ callee_owned ( ) - > ( ) <nl> + % int_literal = integer_literal $ Builtin . Int64 , 9999 <nl> + % int = struct $ Int64 ( % int_literal : $ Builtin . Int64 ) <nl> + % int_addr = alloc_stack $ Int64 <nl> + store % int to % int_addr : $ * Int64 <nl> + % partiallyApplied = apply % bind_polymorphic_param_from_context < Int64 > ( % int_addr ) : $ @ convention ( thin ) < Ο_0_1 > ( @ in Ο_0_1 ) - > @ owned @ async @ callee_owned ( ) - > ( ) <nl> + dealloc_stack % int_addr : $ * Int64 <nl> + <nl> + % result = apply % partiallyApplied ( ) : $ @ async @ callee_owned ( ) - > ( ) <nl> + <nl> + % out_literal = integer_literal $ Builtin . Int32 , 0 <nl> + % out = struct $ Int32 ( % out_literal : $ Builtin . Int32 ) <nl> + return % out : $ Int32 <nl> + } <nl> new file mode 100644 <nl> index 000000000000 . . 92fe600aaead <nl> mmm / dev / null <nl> ppp b / test / IRGen / async / run - partialapply - capture - type_structgeneric_polymorphic_constrained - to - void . sil <nl> <nl> + / / RUN : % empty - directory ( % t ) <nl> + / / RUN : % target - build - swift - dylib ( % t / % target - library - name ( PrintShims ) ) % S / . . / . . / Inputs / print - shims . swift - module - name PrintShims - emit - module - emit - module - path % t / PrintShims . swiftmodule <nl> + / / RUN : % target - codesign % t / % target - library - name ( PrintShims ) <nl> + / / RUN : % target - build - swift - Xfrontend - enable - experimental - concurrency - parse - sil % s - emit - ir - I % t - L % t - lPrintShim | % FileCheck % s - - check - prefix = CHECK - LL <nl> + / / RUN : % target - build - swift - Xfrontend - enable - experimental - concurrency - parse - sil % s - module - name main - o % t / main - I % t - L % t - lPrintShims % target - rpath ( % t ) <nl> + / / RUN : % target - codesign % t / main <nl> + / / RUN : % target - run % t / main % t / % target - library - name ( PrintShims ) | % FileCheck % s <nl> + <nl> + / / REQUIRES : executable_test <nl> + / / REQUIRES : swift_test_mode_optimize_none <nl> + / / REQUIRES : concurrency <nl> + / / UNSUPPORTED : use_os_stdlib <nl> + <nl> + import Builtin <nl> + import Swift <nl> + import PrintShims <nl> + <nl> + sil public_external @ printGeneric : $ @ convention ( thin ) < T > ( @ in_guaranteed T ) - > ( ) <nl> + <nl> + public protocol Q { <nl> + associatedtype Update <nl> + } <nl> + <nl> + public struct BaseProducer < T > : Q { <nl> + public typealias Update = T <nl> + } <nl> + sil_witness_table < T > BaseProducer < T > : Q module main { <nl> + associated_type Update : T <nl> + } <nl> + <nl> + public class WeakBox < T > { } <nl> + sil_vtable WeakBox { } <nl> + <nl> + / / CHECK - LL : define hidden swiftcc void @ takingQ ( % swift . context * { { % [ 0 - 9 ] * } } ) { { # [ 0 - 9 ] * } } { <nl> + sil hidden @ takingQ : $ @ async @ convention ( thin ) < Ο_0_0 where Ο_0_0 : Q > ( @ owned WeakBox < Ο_0_0 > ) - > ( ) { <nl> + entry ( % box : $ WeakBox < Ο_0_0 > ) : <nl> + % box_addr = alloc_stack $ WeakBox < Ο_0_0 > <nl> + store % box to % box_addr : $ * WeakBox < Ο_0_0 > <nl> + % printGeneric = function_ref @ printGeneric : $ @ convention ( thin ) < T > ( @ in_guaranteed T ) - > ( ) <nl> + % result = apply % printGeneric < WeakBox < Ο_0_0 > > ( % box_addr ) : $ @ convention ( thin ) < T > ( @ in_guaranteed T ) - > ( ) / / CHECK : main . WeakBox < main . BaseProducer < Swift . Int64 > > <nl> + dealloc_stack % box_addr : $ * WeakBox < Ο_0_0 > <nl> + return % result : $ ( ) <nl> + } <nl> + <nl> + <nl> + / / CHECK - LL : define internal swiftcc void @ " $ s7takingQTA " ( % swift . context * { { % [ 0 - 9 ] * } } , % swift . refcounted * swiftself { { % [ 0 - 9 ] * } } ) { { # [ 0 - 9 ] * } } { <nl> + sil public @ bind_polymorphic_param_from_forwarder_parameter : $ @ convention ( thin ) < Ο_0_1 > ( @ in Ο_0_1 ) - > @ callee_owned @ async ( @ owned WeakBox < BaseProducer < Ο_0_1 > > ) - > ( ) { <nl> + bb0 ( % 0 : $ * Ο_0_1 ) : <nl> + % 1 = alloc_ref $ WeakBox < BaseProducer < Ο_0_1 > > <nl> + % 8 = function_ref @ takingQ : $ @ async @ convention ( thin ) < Ο_0_0 where Ο_0_0 : Q > ( @ owned WeakBox < Ο_0_0 > ) - > ( ) <nl> + % 9 = partial_apply % 8 < BaseProducer < Ο_0_1 > > ( ) : $ @ async @ convention ( thin ) < Ο_0_0 where Ο_0_0 : Q > ( @ owned WeakBox < Ο_0_0 > ) - > ( ) <nl> + return % 9 : $ @ callee_owned @ async ( @ owned WeakBox < BaseProducer < Ο_0_1 > > ) - > ( ) <nl> + } <nl> + <nl> + sil @ main : $ @ convention ( c ) ( Int32 , UnsafeMutablePointer < Optional < UnsafeMutablePointer < Int8 > > > ) - > Int32 { <nl> + bb0 ( % argc : $ Int32 , % argv : $ UnsafeMutablePointer < Optional < UnsafeMutablePointer < Int8 > > > ) : <nl> + % bind_polymorphic_param_from_forwarder_parameter = function_ref @ bind_polymorphic_param_from_forwarder_parameter : $ @ convention ( thin ) < Ο_0_1 > ( @ in Ο_0_1 ) - > @ callee_owned @ async ( @ owned WeakBox < BaseProducer < Ο_0_1 > > ) - > ( ) <nl> + % int_literal = integer_literal $ Builtin . Int64 , 9999 <nl> + % int = struct $ Int64 ( % int_literal : $ Builtin . Int64 ) <nl> + % int_addr = alloc_stack $ Int64 <nl> + store % int to % int_addr : $ * Int64 <nl> + % partiallyApplied = apply % bind_polymorphic_param_from_forwarder_parameter < Int64 > ( % int_addr ) : $ @ convention ( thin ) < Ο_0_1 > ( @ in Ο_0_1 ) - > @ callee_owned @ async ( @ owned WeakBox < BaseProducer < Ο_0_1 > > ) - > ( ) <nl> + dealloc_stack % int_addr : $ * Int64 <nl> + <nl> + % box = alloc_ref $ WeakBox < BaseProducer < Int64 > > <nl> + % result = apply % partiallyApplied ( % box ) : $ @ callee_owned @ async ( @ owned WeakBox < BaseProducer < Int64 > > ) - > ( ) <nl> + <nl> + % out_literal = integer_literal $ Builtin . Int32 , 0 <nl> + % out = struct $ Int32 ( % out_literal : $ Builtin . Int32 ) <nl> + return % out : $ Int32 <nl> + } <nl> new file mode 100644 <nl> index 000000000000 . . cc2bcb615c74 <nl> mmm / dev / null <nl> ppp b / test / IRGen / async / run - partialapply - capture - type_thin - and - classinstance - to - void . sil <nl> <nl> + / / RUN : % empty - directory ( % t ) <nl> + / / RUN : % target - build - swift - dylib ( % t / % target - library - name ( PrintShims ) ) % S / . . / . . / Inputs / print - shims . swift - module - name PrintShims - emit - module - emit - module - path % t / PrintShims . swiftmodule <nl> + / / RUN : % target - codesign % t / % target - library - name ( PrintShims ) <nl> + / / RUN : % target - build - swift - Xfrontend - enable - experimental - concurrency - parse - sil % s - emit - ir - I % t - L % t - lPrintShim | % FileCheck % s - - check - prefix = CHECK - LL <nl> + / / RUN : % target - build - swift - Xfrontend - enable - experimental - concurrency - parse - sil % s - module - name main - o % t / main - I % t - L % t - lPrintShims % target - rpath ( % t ) <nl> + / / RUN : % target - codesign % t / main <nl> + / / RUN : % target - run % t / main % t / % target - library - name ( PrintShims ) | % FileCheck % s <nl> + <nl> + / / REQUIRES : executable_test <nl> + / / REQUIRES : swift_test_mode_optimize_none <nl> + / / REQUIRES : concurrency <nl> + / / UNSUPPORTED : use_oC_stdlib <nl> + <nl> + import Builtin <nl> + import Swift <nl> + import PrintShims <nl> + <nl> + sil public_external @ printGeneric : $ @ convention ( thin ) < T > ( @ in_guaranteed T ) - > ( ) <nl> + sil public_external @ printInt64 : $ @ convention ( thin ) ( Int64 ) - > ( ) <nl> + <nl> + class C { <nl> + deinit <nl> + init ( ) <nl> + } <nl> + <nl> + sil hidden [ exact_self_class ] @ C_allocating_init : $ @ convention ( method ) ( @ thick C . Type ) - > @ owned C { <nl> + bb0 ( % 0 : $ @ thick C . Type ) : <nl> + % 1 = alloc_ref $ C <nl> + % 2 = function_ref @ $ C_init : $ @ convention ( method ) ( @ owned C ) - > @ owned C <nl> + % 3 = apply % 2 ( % 1 ) : $ @ convention ( method ) ( @ owned C ) - > @ owned C <nl> + return % 3 : $ C <nl> + } <nl> + <nl> + sil hidden @ $ C_init : $ @ convention ( method ) ( @ owned C ) - > @ owned C { <nl> + bb0 ( % 0 : $ C ) : <nl> + return % 0 : $ C <nl> + } <nl> + <nl> + sil hidden @ $ C_deinit : $ @ convention ( method ) ( @ guaranteed C ) - > @ owned Builtin . NativeObject { <nl> + bb0 ( % 0 : $ C ) : <nl> + % 2 = unchecked_ref_cast % 0 : $ C to $ Builtin . NativeObject <nl> + return % 2 : $ Builtin . NativeObject <nl> + } <nl> + <nl> + sil hidden @ C_deallocating_deinit : $ @ convention ( method ) ( @ owned C ) - > ( ) { <nl> + bb0 ( % 0 : $ C ) : <nl> + % 2 = function_ref @ $ C_deinit : $ @ convention ( method ) ( @ guaranteed C ) - > @ owned Builtin . NativeObject <nl> + % 3 = apply % 2 ( % 0 ) : $ @ convention ( method ) ( @ guaranteed C ) - > @ owned Builtin . NativeObject <nl> + % 4 = unchecked_ref_cast % 3 : $ Builtin . NativeObject to $ C <nl> + dealloc_ref % 4 : $ C <nl> + % 6 = tuple ( ) <nl> + return % 6 : $ ( ) <nl> + } <nl> + <nl> + sil_vtable C { <nl> + # C . init ! allocator : ( C . Type ) - > ( ) - > C : @ C_allocating_init <nl> + # C . deinit ! deallocator : @ C_deallocating_deinit <nl> + } <nl> + <nl> + struct S { } <nl> + <nl> + / / CHECK - LL : define { { ( dllexport ) ? } } { { ( protected ) ? } } swiftcc void @ structtypeSAndClassinstanceCToVoid ( % swift . context * { { % [ 0 - 9 ] * } } ) { { # [ 0 - 9 ] * } } { <nl> + / / CHECK - LL : define internal swiftcc void @ " $ s34structtypeSAndClassinstanceCToVoidTA " ( % swift . context * { { % [ 0 - 9 ] * } } , % swift . refcounted * swiftself { { % [ 0 - 9 ] * } } ) { { # [ 0 - 9 ] * } } { <nl> + sil @ structtypeSAndClassinstanceCToVoid : $ @ async @ convention ( thin ) ( @ thin S . Type , @ owned C ) - > ( ) { <nl> + entry ( % S_type : $ @ thin S . Type , % C_instance : $ C ) : <nl> + % S_type_addr = alloc_stack $ @ thick S . Type <nl> + % S_type_thick = metatype $ @ thick S . Type <nl> + store % S_type_thick to % S_type_addr : $ * @ thick S . Type <nl> + % C_instance_addr = alloc_stack $ C <nl> + store % C_instance to % C_instance_addr : $ * C <nl> + % printGeneric = function_ref @ printGeneric : $ @ convention ( thin ) < T > ( @ in_guaranteed T ) - > ( ) <nl> + % printGeneric_result1 = apply % printGeneric < S . Type > ( % S_type_addr ) : $ @ convention ( thin ) < T > ( @ in_guaranteed T ) - > ( ) / / CHECK : S <nl> + % printGeneric_result2 = apply % printGeneric < C > ( % C_instance_addr ) : $ @ convention ( thin ) < T > ( @ in_guaranteed T ) - > ( ) / / CHECK : main . C <nl> + dealloc_stack % C_instance_addr : $ * C <nl> + dealloc_stack % S_type_addr : $ * @ thick S . Type <nl> + return % printGeneric_result2 : $ ( ) <nl> + } <nl> + <nl> + sil @ partial_apply_thin_type : $ @ async @ convention ( thin ) ( @ thin S . Type , @ owned C ) - > @ async @ callee_owned ( ) - > ( ) { <nl> + entry ( % S_type : $ @ thin S . Type , % C_instance : $ C ) : <nl> + % structtypeSAndClassinstanceCToVoid = function_ref @ structtypeSAndClassinstanceCToVoid : $ @ async @ convention ( thin ) ( @ thin S . Type , @ owned C ) - > ( ) <nl> + % closure = partial_apply % structtypeSAndClassinstanceCToVoid ( % S_type , % C_instance ) : $ @ async @ convention ( thin ) ( @ thin S . Type , @ owned C ) - > ( ) <nl> + return % closure : $ @ async @ callee_owned ( ) - > ( ) <nl> + } <nl> + <nl> + sil @ main : $ @ convention ( c ) ( Int32 , UnsafeMutablePointer < Optional < UnsafeMutablePointer < Int8 > > > ) - > Int32 { <nl> + bb0 ( % argc : $ Int32 , % argv : $ UnsafeMutablePointer < Optional < UnsafeMutablePointer < Int8 > > > ) : <nl> + % c_type = metatype $ @ thick C . Type <nl> + % allocating_init = function_ref @ C_allocating_init : $ @ convention ( method ) ( @ thick C . Type ) - > @ owned C <nl> + % instance = apply % allocating_init ( % c_type ) : $ @ convention ( method ) ( @ thick C . Type ) - > @ owned C <nl> + strong_retain % instance : $ C <nl> + <nl> + <nl> + % partial_apply_thin_type = function_ref @ partial_apply_thin_type : $ @ async @ convention ( thin ) ( @ thin S . Type , @ owned C ) - > @ async @ callee_owned ( ) - > ( ) <nl> + % S_type = metatype $ @ thin S . Type <nl> + % partiallyApplied = apply % partial_apply_thin_type ( % S_type , % instance ) : $ @ async @ convention ( thin ) ( @ thin S . Type , @ owned C ) - > @ async @ callee_owned ( ) - > ( ) <nl> + % result = apply % partiallyApplied ( ) : $ @ async @ callee_owned ( ) - > ( ) <nl> + <nl> + % out_literal = integer_literal $ Builtin . Int32 , 0 <nl> + % out = struct $ Int32 ( % out_literal : $ Builtin . Int32 ) <nl> + return % out : $ Int32 <nl> + } <nl> mmm a / test / Inputs / print - shims . swift <nl> ppp b / test / Inputs / print - shims . swift <nl> public func printInt64 ( _ int : Int64 ) { <nl> print ( int ) <nl> } <nl> <nl> + @ _silgen_name ( " printInt32 " ) <nl> + public func printInt32 ( _ int : Int32 ) { <nl> + print ( int ) <nl> + } <nl> + <nl> @ _silgen_name ( " printGeneric " ) <nl> public func printGeneric < T > ( _ t : T ) { <nl> print ( t ) <nl> | [ Async CC ] Supported partial application . | apple/swift | 506473dfba40cde3bfb5480b6d44f2d9c26f2cab | 2020-10-22T19:21:56Z |
mmm a / atom / common / crash_reporter / crash_reporter_linux . cc <nl> ppp b / atom / common / crash_reporter / crash_reporter_linux . cc <nl> void CrashReporterLinux : : InitBreakpad ( const std : : string & product_name , <nl> bool skip_system_crash_handler ) { <nl> EnableCrashDumping ( crashes_dir ) ; <nl> <nl> - crash_keys_ . SetKeyValue ( " prod " , ATOM_PRODUCT_NAME ) ; <nl> - crash_keys_ . SetKeyValue ( " ver " , version . c_str ( ) ) ; <nl> + crash_keys_ . reset ( new CrashKeyStorage ( ) ) ; <nl> + <nl> + crash_keys_ - > SetKeyValue ( " prod " , ATOM_PRODUCT_NAME ) ; <nl> + crash_keys_ - > SetKeyValue ( " ver " , version . c_str ( ) ) ; <nl> upload_url_ = submit_url ; <nl> <nl> for ( StringMap : : const_iterator iter = upload_parameters_ . begin ( ) ; <nl> iter ! = upload_parameters_ . end ( ) ; + + iter ) <nl> - crash_keys_ . SetKeyValue ( iter - > first . c_str ( ) , iter - > second . c_str ( ) ) ; <nl> + crash_keys_ - > SetKeyValue ( iter - > first . c_str ( ) , iter - > second . c_str ( ) ) ; <nl> } <nl> <nl> void CrashReporterLinux : : SetUploadParameters ( ) { <nl> bool CrashReporterLinux : : CrashDone ( const MinidumpDescriptor & minidump , <nl> info . oom_size = base : : g_oom_size ; <nl> info . pid = self - > pid_ ; <nl> info . upload_url = self - > upload_url_ . c_str ( ) ; <nl> - info . crash_keys = & self - > crash_keys_ ; <nl> + info . crash_keys = self - > crash_keys_ . get ( ) ; <nl> HandleCrashDump ( info ) ; <nl> return true ; <nl> } <nl> mmm a / atom / common / crash_reporter / crash_reporter_linux . h <nl> ppp b / atom / common / crash_reporter / crash_reporter_linux . h <nl> class CrashReporterLinux : public CrashReporter { <nl> const bool succeeded ) ; <nl> <nl> std : : unique_ptr < google_breakpad : : ExceptionHandler > breakpad_ ; <nl> - CrashKeyStorage crash_keys_ ; <nl> + std : : unique_ptr < CrashKeyStorage > crash_keys_ ; <nl> <nl> uint64_t process_start_time_ ; <nl> pid_t pid_ ; <nl> | Clear crash keys in InitBreakpad | electron/electron | 9a434af03e34d2aa325f93af6a0e702235dabaa4 | 2017-02-14T17:37:09Z |
mmm a / PowerEditor / src / Notepad_plus . cpp <nl> ppp b / PowerEditor / src / Notepad_plus . cpp <nl> void Notepad_plus : : init ( HINSTANCE hInst , HWND parent , const char * cmdLine , CmdLi <nl> <nl> if ( cmdLine ) <nl> { <nl> + char currPath [ MAX_PATH ] ; <nl> + : : GetCurrentDirectory ( sizeof currPath , currPath ) ; <nl> + : : SetCurrentDirectory ( currPath ) ; <nl> + <nl> LangType lt = cmdLineParams - > _langType ; <nl> int ln = cmdLineParams - > _line2go ; <nl> <nl> if ( PathFileExists ( cmdLine ) ) <nl> { <nl> + <nl> doOpen ( cmdLine , cmdLineParams - > _isReadOnly ) ; <nl> <nl> if ( lt ! = L_TXT ) <nl> bool Notepad_plus : : doOpen ( const char * fileName , bool isReadOnly ) <nl> <nl> if ( ! PathFileExists ( longFileName ) ) <nl> { <nl> - char str2display [ 128 ] ; <nl> - sprintf ( str2display , " % s doesn ' t exist . Create it ? " , longFileName ) ; <nl> + char str2display [ MAX_PATH * 2 ] ; <nl> + char longFileDir [ MAX_PATH ] ; <nl> + <nl> + strcpy ( longFileDir , longFileName ) ; <nl> + PathRemoveFileSpec ( longFileDir ) ; <nl> <nl> - if ( : : MessageBox ( _hSelf , str2display , " Create new file " , MB_YESNO ) = = IDYES ) <nl> + if ( PathFileExists ( longFileDir ) ) <nl> { <nl> - FILE * f = fopen ( longFileName , " w " ) ; <nl> - fclose ( f ) ; <nl> + sprintf ( str2display , " % s doesn ' t exist . Create it ? " , longFileName ) ; <nl> + <nl> + if ( : : MessageBox ( _hSelf , str2display , " Create new file " , MB_YESNO ) = = IDYES ) <nl> + { <nl> + FILE * f = fopen ( longFileName , " w " ) ; <nl> + fclose ( f ) ; <nl> + } <nl> + else <nl> + { <nl> + _lastRecentFileList . remove ( longFileName ) ; <nl> + return false ; <nl> + } <nl> } <nl> else <nl> { <nl> mmm a / PowerEditor / src / WinControls / Preference / preferenceDlg . cpp <nl> ppp b / PowerEditor / src / WinControls / Preference / preferenceDlg . cpp <nl> BOOL CALLBACK DefaultNewDocDlg : : run_dlgProc ( UINT Message , WPARAM wParam , LPARAM <nl> for ( int i = L_TXT ; i < L_END ; i + + ) <nl> { <nl> string str ; <nl> - / / if ( ( LangType ) i ! = L_END ) <nl> + if ( ( LangType ) i ! = L_USER ) <nl> { <nl> int cmdID = pNppParam - > langTypeToCommandID ( ( LangType ) i ) ; <nl> if ( ( cmdID ! = - 1 ) & & ( getNameStrFromCmd ( cmdID , str ) = = TYPE_CMD ) ) <nl> mmm a / PowerEditor / src / winmain . cpp <nl> ppp b / PowerEditor / src / winmain . cpp <nl> int WINAPI WinMain ( HINSTANCE hInstance , HINSTANCE , LPSTR lpszCmdLine , int nCmdSh <nl> cmdLineParams . _isNoPlugin = isInList ( FLAG_NO_PLUGIN , lpszCmdLine ) ; <nl> cmdLineParams . _isReadOnly = isInList ( FLAG_READONLY , lpszCmdLine ) ; <nl> cmdLineParams . _isNoSession = isInList ( FLAG_NOSESSION , lpszCmdLine ) ; <nl> - / / printStr ( cmdLineParams . _isReadOnly ? " RO " : " RW " ) ; <nl> cmdLineParams . _langType = getLangTypeFromParam ( lpszCmdLine ) ; <nl> cmdLineParams . _line2go = getLn2GoFromParam ( lpszCmdLine ) ; <nl> <nl> | [ BUG_FIXED_AND_NEW_FEATURE ] Add open relative file path from command line feature . | notepad-plus-plus/notepad-plus-plus | f5b8eace0a962e427c858b0784414fcb693fca3d | 2007-10-27T23:47:05Z |
mmm a / tools / dockerfile / grpc_interop_http2 / Dockerfile <nl> ppp b / tools / dockerfile / grpc_interop_http2 / Dockerfile <nl> <nl> # ( INCLUDING NEGLIGENCE OR OTHERWISE ) ARISING IN ANY WAY OUT OF THE USE <nl> # OF THIS SOFTWARE , EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE . <nl> <nl> - FROM golang : 1 . 4 <nl> + FROM golang : 1 . 5 <nl> <nl> # Using login shell removes Go from path , so we add it . <nl> - RUN ln - s / usr / src / go / bin / go / usr / local / bin <nl> + RUN ln - s / usr / local / go / bin / go / usr / local / bin <nl> <nl> # Define the default command . <nl> CMD [ " bash " ] <nl> | also update interop_http2 image | grpc/grpc | 549da44e80547401c1dbdb312a42a37f04be14b4 | 2016-04-21T14:23:00Z |
mmm a / include / swift / AST / ASTContext . h <nl> ppp b / include / swift / AST / ASTContext . h <nl> class ASTContext { <nl> / / / Produce a new normal conformance for a property behavior . <nl> NormalProtocolConformance * <nl> getBehaviorConformance ( Type conformingType , <nl> - Type conformingInterfaceType , <nl> ProtocolDecl * protocol , <nl> SourceLoc loc , <nl> AbstractStorageDecl * storage , <nl> mmm a / include / swift / AST / ProtocolConformance . h <nl> ppp b / include / swift / AST / ProtocolConformance . h <nl> class alignas ( 1 < < DeclAlignInBits ) ProtocolConformance { <nl> / / / conformance definition . <nl> Type ConformingType ; <nl> <nl> - / / / \ brief The interface type that conforms to the protocol . <nl> - Type ConformingInterfaceType ; <nl> - <nl> protected : <nl> - ProtocolConformance ( ProtocolConformanceKind kind , Type conformingType , <nl> - Type conformingInterfaceType ) <nl> - : Kind ( kind ) , ConformingType ( conformingType ) , <nl> - ConformingInterfaceType ( conformingInterfaceType ) { } <nl> + ProtocolConformance ( ProtocolConformanceKind kind , Type conformingType ) <nl> + : Kind ( kind ) , ConformingType ( conformingType ) { } <nl> <nl> public : <nl> / / / Determine the kind of protocol conformance . <nl> class alignas ( 1 < < DeclAlignInBits ) ProtocolConformance { <nl> / / / Get the conforming type . <nl> Type getType ( ) const { return ConformingType ; } <nl> <nl> - / / / Get the conforming interface type . <nl> - Type getInterfaceType ( ) const { return ConformingInterfaceType ; } <nl> - <nl> / / / Get the protocol being conformed to . <nl> ProtocolDecl * getProtocol ( ) const ; <nl> <nl> class alignas ( 1 < < DeclAlignInBits ) ProtocolConformance { <nl> return false ; <nl> } <nl> <nl> - / / / Retrieve the non - type witness for the given requirement . <nl> - Witness getWitness ( ValueDecl * requirement , LazyResolver * resolver ) const ; <nl> + / / / Retrieve the value witness declaration corresponding to the given <nl> + / / / requirement . <nl> + ValueDecl * getWitnessDecl ( ValueDecl * requirement , <nl> + LazyResolver * resolver ) const ; <nl> <nl> private : <nl> / / / Determine whether we have a witness for the given requirement . <nl> bool hasWitness ( ValueDecl * requirement ) const ; <nl> <nl> public : <nl> - / / / Apply the given function object to each value witness within this <nl> - / / / protocol conformance . <nl> - / / / <nl> - / / / The function object should accept a \ c ValueDecl * for the requirement <nl> - / / / followed by the \ c Witness for the witness . Note that a generic <nl> - / / / witness will only be specialized if the conformance came from the current <nl> - / / / file . <nl> - template < typename F > <nl> - void forEachValueWitness ( LazyResolver * resolver , F f ) const { <nl> - const ProtocolDecl * protocol = getProtocol ( ) ; <nl> - for ( auto req : protocol - > getMembers ( ) ) { <nl> - auto valueReq = dyn_cast < ValueDecl > ( req ) ; <nl> - if ( ! valueReq | | isa < AssociatedTypeDecl > ( valueReq ) | | <nl> - valueReq - > isInvalid ( ) ) <nl> - continue ; <nl> - <nl> - if ( ! valueReq - > isProtocolRequirement ( ) ) <nl> - continue ; <nl> - <nl> - / / If we don ' t have and cannot resolve witnesses , skip it . <nl> - if ( ! resolver & & ! hasWitness ( valueReq ) ) <nl> - continue ; <nl> - <nl> - f ( valueReq , getWitness ( valueReq , resolver ) ) ; <nl> - } <nl> - } <nl> - <nl> / / / Retrieve the protocol conformance for the inherited protocol . <nl> ProtocolConformance * getInheritedConformance ( ProtocolDecl * protocol ) const ; <nl> <nl> class NormalProtocolConformance : public ProtocolConformance , <nl> NormalProtocolConformance ( Type conformingType , ProtocolDecl * protocol , <nl> SourceLoc loc , DeclContext * dc , <nl> ProtocolConformanceState state ) <nl> - : ProtocolConformance ( ProtocolConformanceKind : : Normal , conformingType , <nl> - / / FIXME : interface type should be passed in <nl> - dc - > getDeclaredInterfaceType ( ) ) , <nl> + : ProtocolConformance ( ProtocolConformanceKind : : Normal , conformingType ) , <nl> ProtocolAndState ( protocol , state ) , Loc ( loc ) , ContextAndInvalid ( dc , false ) <nl> { <nl> } <nl> <nl> NormalProtocolConformance ( Type conformingType , <nl> - Type conformingInterfaceType , <nl> ProtocolDecl * protocol , <nl> SourceLoc loc , AbstractStorageDecl * behaviorStorage , <nl> ProtocolConformanceState state ) <nl> - : ProtocolConformance ( ProtocolConformanceKind : : Normal , conformingType , <nl> - / / FIXME : interface type should be passed in <nl> - conformingInterfaceType ) , <nl> + : ProtocolConformance ( ProtocolConformanceKind : : Normal , conformingType ) , <nl> ProtocolAndState ( protocol , state ) , Loc ( loc ) , <nl> ContextAndInvalid ( behaviorStorage , false ) <nl> { <nl> class NormalProtocolConformance : public ProtocolConformance , <nl> LazyResolver * resolver = nullptr ) const ; <nl> <nl> / / / Retrieve the value witness corresponding to the given requirement . <nl> - / / / <nl> - / / / Note that a generic witness will only be specialized if the conformance <nl> - / / / came from the current file . <nl> - / / / <nl> - / / / FIXME : The ' only specialized if from the same file ' bit is awful . <nl> Witness getWitness ( ValueDecl * requirement , LazyResolver * resolver ) const ; <nl> <nl> / / / Determine whether the protocol conformance has a witness for the given <nl> class NormalProtocolConformance : public ProtocolConformance , <nl> / / / Set the witness for the given requirement . <nl> void setWitness ( ValueDecl * requirement , Witness witness ) const ; <nl> <nl> + / / / Apply the given function object to each value witness within this <nl> + / / / protocol conformance . <nl> + / / / <nl> + / / / The function object should accept a \ c ValueDecl * for the requirement <nl> + / / / followed by the \ c Witness for the witness . Note that a generic <nl> + / / / witness will only be specialized if the conformance came from the current <nl> + / / / file . <nl> + template < typename F > <nl> + void forEachValueWitness ( LazyResolver * resolver , F f ) const { <nl> + const ProtocolDecl * protocol = getProtocol ( ) ; <nl> + for ( auto req : protocol - > getMembers ( ) ) { <nl> + auto valueReq = dyn_cast < ValueDecl > ( req ) ; <nl> + if ( ! valueReq | | isa < AssociatedTypeDecl > ( valueReq ) | | <nl> + valueReq - > isInvalid ( ) ) <nl> + continue ; <nl> + <nl> + if ( ! valueReq - > isProtocolRequirement ( ) ) <nl> + continue ; <nl> + <nl> + / / If we don ' t have and cannot resolve witnesses , skip it . <nl> + if ( ! resolver & & ! hasWitness ( valueReq ) ) <nl> + continue ; <nl> + <nl> + f ( valueReq , getWitness ( valueReq , resolver ) ) ; <nl> + } <nl> + } <nl> + <nl> / / / Retrieve the protocol conformances that satisfy the requirements of the <nl> / / / protocol , which line up with the conformance constraints in the <nl> / / / protocol ' s requirement signature . <nl> class SpecializedProtocolConformance : public ProtocolConformance , <nl> getTypeWitnessAndDecl ( AssociatedTypeDecl * assocType , <nl> LazyResolver * resolver ) const ; <nl> <nl> - / / / Retrieve the value witness corresponding to the given requirement . <nl> - Witness getWitness ( ValueDecl * requirement , LazyResolver * resolver ) const ; <nl> - <nl> - <nl> / / / Given that the requirement signature of the protocol directly states <nl> / / / that the given dependent type must conform to the given protocol , <nl> / / / return its associated conformance . <nl> class SpecializedProtocolConformance : public ProtocolConformance , <nl> } <nl> <nl> void Profile ( llvm : : FoldingSetNodeID & ID ) { <nl> - Profile ( ID , getType ( ) , getGenericConformance ( ) ) ; <nl> + Profile ( ID , getType ( ) , getGenericConformance ( ) , <nl> + getGenericSubstitutions ( ) ) ; <nl> } <nl> <nl> static void Profile ( llvm : : FoldingSetNodeID & ID , Type type , <nl> - ProtocolConformance * genericConformance ) { <nl> - / / FIXME : Consider profiling substitutions here . They could differ in <nl> - / / some crazy cases that also require major diagnostic work , where the <nl> - / / substitutions involve conformances of the same type to the same <nl> - / / protocol drawn from different imported modules . <nl> + ProtocolConformance * genericConformance , <nl> + SubstitutionList subs ) { <nl> ID . AddPointer ( type . getPointer ( ) ) ; <nl> ID . AddPointer ( genericConformance ) ; <nl> + profileSubstitutionList ( ID , subs ) ; <nl> } <nl> <nl> static bool classof ( const ProtocolConformance * conformance ) { <nl> class InheritedProtocolConformance : public ProtocolConformance , <nl> <nl> InheritedProtocolConformance ( Type conformingType , <nl> ProtocolConformance * inheritedConformance ) <nl> - : ProtocolConformance ( ProtocolConformanceKind : : Inherited , conformingType , <nl> - / / FIXME : interface type should be passed in <nl> - inheritedConformance - > getDeclContext ( ) - > getDeclaredInterfaceType ( ) ) , <nl> + : ProtocolConformance ( ProtocolConformanceKind : : Inherited , conformingType ) , <nl> InheritedConformance ( inheritedConformance ) <nl> { <nl> } <nl> class InheritedProtocolConformance : public ProtocolConformance , <nl> return InheritedConformance - > getTypeWitnessAndDecl ( assocType , resolver ) ; <nl> } <nl> <nl> - / / / Retrieve the value witness corresponding to the given requirement . <nl> - Witness getWitness ( ValueDecl * requirement , LazyResolver * resolver ) const { <nl> - / / FIXME : Substitute ! <nl> - return InheritedConformance - > getWitness ( requirement , resolver ) ; <nl> - } <nl> - <nl> / / / Given that the requirement signature of the protocol directly states <nl> / / / that the given dependent type must conform to the given protocol , <nl> / / / return its associated conformance . <nl> mmm a / include / swift / AST / SubstitutionList . h <nl> ppp b / include / swift / AST / SubstitutionList . h <nl> <nl> <nl> # include " swift / AST / Substitution . h " <nl> # include " llvm / ADT / ArrayRef . h " <nl> + # include " llvm / ADT / FoldingSet . h " <nl> + <nl> + namespace llvm { <nl> + class FoldingSetNodeID ; <nl> + } / / end namespace llvm <nl> <nl> namespace swift { <nl> <nl> void dump ( SubstitutionList subs ) ; <nl> SubstitutionList <nl> getCanonicalSubstitutionList ( SubstitutionList subs , <nl> SmallVectorImpl < Substitution > & canSubs ) ; <nl> + <nl> + / / / Profile the substitution list for use in a folding set . <nl> + void profileSubstitutionList ( llvm : : FoldingSetNodeID & id , SubstitutionList subs ) ; <nl> + <nl> } / / end namespace swift <nl> <nl> # endif <nl> mmm a / lib / AST / ASTContext . cpp <nl> ppp b / lib / AST / ASTContext . cpp <nl> void ValueDecl : : setLocalDiscriminator ( unsigned index ) { <nl> <nl> NormalProtocolConformance * <nl> ASTContext : : getBehaviorConformance ( Type conformingType , <nl> - Type conformingInterfaceType , <nl> ProtocolDecl * protocol , <nl> SourceLoc loc , <nl> AbstractStorageDecl * storage , <nl> ProtocolConformanceState state ) { <nl> auto conformance = new ( * this , AllocationArena : : Permanent ) <nl> - NormalProtocolConformance ( conformingType , conformingInterfaceType , <nl> - protocol , loc , storage , state ) ; <nl> + NormalProtocolConformance ( conformingType , protocol , loc , storage , state ) ; <nl> <nl> - if ( auto nominal = conformingInterfaceType - > getAnyNominal ( ) ) { <nl> + if ( auto nominal = conformingType - > getRValueInstanceType ( ) - > getAnyNominal ( ) ) { <nl> / / Note : this is an egregious hack . The conformances need to be associated <nl> / / with the actual storage declarations . <nl> SmallVector < ProtocolConformance * , 2 > conformances ; <nl> ASTContext : : getSpecializedConformance ( Type type , <nl> ProtocolConformance * generic , <nl> SubstitutionList substitutions ) { <nl> llvm : : FoldingSetNodeID id ; <nl> - SpecializedProtocolConformance : : Profile ( id , type , generic ) ; <nl> + SpecializedProtocolConformance : : Profile ( id , type , generic , substitutions ) ; <nl> <nl> / / Figure out which arena this conformance should go into . <nl> AllocationArena arena = getArena ( type - > getRecursiveProperties ( ) ) ; <nl> mmm a / lib / AST / ASTMangler . cpp <nl> ppp b / lib / AST / ASTMangler . cpp <nl> void ASTMangler : : appendProtocolConformance ( const ProtocolConformance * conformanc <nl> appendProtocolName ( conformance - > getProtocol ( ) ) ; <nl> appendIdentifier ( behaviorStorage - > getName ( ) . str ( ) ) ; <nl> } else { <nl> - appendType ( conformance - > getInterfaceType ( ) - > getCanonicalType ( ) ) ; <nl> + auto conformanceDC = conformance - > getDeclContext ( ) ; <nl> + auto conformingType = <nl> + conformanceDC - > mapTypeOutOfContext ( conformance - > getType ( ) ) ; <nl> + appendType ( conformingType - > getCanonicalType ( ) ) ; <nl> appendProtocolName ( conformance - > getProtocol ( ) ) ; <nl> appendModule ( conformance - > getDeclContext ( ) - > getParentModule ( ) ) ; <nl> } <nl> mmm a / lib / AST / ConformanceLookupTable . cpp <nl> ppp b / lib / AST / ConformanceLookupTable . cpp <nl> ConformanceLookupTable : : getSatisfiedProtocolRequirementsForMember ( <nl> if ( conf - > isInvalid ( ) ) <nl> continue ; <nl> <nl> - conf - > forEachValueWitness ( resolver , [ & ] ( ValueDecl * req , <nl> + auto normal = conf - > getRootNormalConformance ( ) ; <nl> + normal - > forEachValueWitness ( resolver , [ & ] ( ValueDecl * req , <nl> ConcreteDeclRef witness ) { <nl> if ( witness . getDecl ( ) = = member ) <nl> reqs . push_back ( req ) ; <nl> mmm a / lib / AST / ProtocolConformance . cpp <nl> ppp b / lib / AST / ProtocolConformance . cpp <nl> Type ProtocolConformance : : getTypeWitness ( AssociatedTypeDecl * assocType , <nl> return getTypeWitnessAndDecl ( assocType , resolver ) . first ; <nl> } <nl> <nl> - Witness ProtocolConformance : : getWitness ( ValueDecl * requirement , <nl> - LazyResolver * resolver ) const { <nl> - CONFORMANCE_SUBCLASS_DISPATCH ( getWitness , ( requirement , resolver ) ) <nl> + ValueDecl * ProtocolConformance : : getWitnessDecl ( ValueDecl * requirement , <nl> + LazyResolver * resolver ) const { <nl> + switch ( getKind ( ) ) { <nl> + case ProtocolConformanceKind : : Normal : <nl> + return cast < NormalProtocolConformance > ( this ) - > getWitness ( requirement , <nl> + resolver ) <nl> + . getDecl ( ) ; <nl> + <nl> + case ProtocolConformanceKind : : Inherited : <nl> + return cast < InheritedProtocolConformance > ( this ) <nl> + - > getInheritedConformance ( ) - > getWitnessDecl ( requirement , resolver ) ; <nl> + <nl> + case ProtocolConformanceKind : : Specialized : <nl> + return cast < SpecializedProtocolConformance > ( this ) <nl> + - > getGenericConformance ( ) - > getWitnessDecl ( requirement , resolver ) ; <nl> + } <nl> } <nl> <nl> / / / Determine whether the witness for the given requirement <nl> usesDefaultDefinition ( AssociatedTypeDecl * requirement ) const { <nl> bool ProtocolConformance : : hasFixedLayout ( ) const { <nl> / / A conformance / witness table has fixed layout if type has a fixed layout in <nl> / / all resilience domains , and the conformance is externally visible . <nl> - if ( auto nominal = getInterfaceType ( ) - > getAnyNominal ( ) ) <nl> + if ( auto nominal = getType ( ) - > getAnyNominal ( ) ) <nl> if ( nominal - > hasFixedLayout ( ) & & <nl> getProtocol ( ) - > getEffectiveAccess ( ) > = Accessibility : : Public & & <nl> nominal - > getEffectiveAccess ( ) > = Accessibility : : Public ) <nl> SpecializedProtocolConformance : : SpecializedProtocolConformance ( <nl> Type conformingType , <nl> ProtocolConformance * genericConformance , <nl> SubstitutionList substitutions ) <nl> - : ProtocolConformance ( ProtocolConformanceKind : : Specialized , conformingType , <nl> - / / FIXME : interface type should be passed in . <nl> - / / assumes specialized conformance is always fully <nl> - / / specialized <nl> - conformingType ) , <nl> + : ProtocolConformance ( ProtocolConformanceKind : : Specialized , conformingType ) , <nl> GenericConformance ( genericConformance ) , <nl> GenericSubstitutions ( substitutions ) <nl> { <nl> SpecializedProtocolConformance : : getTypeWitnessAndDecl ( <nl> return TypeWitnesses [ assocType ] ; <nl> } <nl> <nl> - Witness <nl> - SpecializedProtocolConformance : : getWitness ( ValueDecl * requirement , <nl> - LazyResolver * resolver ) const { <nl> - / / FIXME : Apply substitutions here ! <nl> - return GenericConformance - > getWitness ( requirement , resolver ) ; <nl> - } <nl> - <nl> ProtocolConformanceRef <nl> SpecializedProtocolConformance : : getAssociatedConformance ( Type assocType , <nl> ProtocolDecl * protocol , <nl> bool ProtocolConformance : : isCanonical ( ) const { <nl> <nl> if ( ! getType ( ) - > isCanonical ( ) ) <nl> return false ; <nl> - if ( ! getInterfaceType ( ) - > isCanonical ( ) ) <nl> - return false ; <nl> <nl> switch ( getKind ( ) ) { <nl> case ProtocolConformanceKind : : Normal : { <nl> mmm a / lib / AST / SubstitutionList . cpp <nl> ppp b / lib / AST / SubstitutionList . cpp <nl> <nl> / / = = = mmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmm - = = = / / <nl> <nl> # include " swift / AST / SubstitutionList . h " <nl> + # include " swift / AST / ProtocolConformanceRef . h " <nl> + # include " llvm / ADT / FoldingSet . h " <nl> <nl> using namespace swift ; <nl> + <nl> + void swift : : profileSubstitutionList ( llvm : : FoldingSetNodeID & id , <nl> + SubstitutionList subs ) { <nl> + id . AddInteger ( subs . size ( ) ) ; <nl> + for ( auto & sub : subs ) { <nl> + id . AddPointer ( sub . getReplacement ( ) . getPointer ( ) ) ; <nl> + for ( auto conformance : sub . getConformances ( ) ) <nl> + id . AddPointer ( conformance . getOpaqueValue ( ) ) ; <nl> + } <nl> + } <nl> mmm a / lib / AST / Type . cpp <nl> ppp b / lib / AST / Type . cpp <nl> bool TypeBase : : usesNativeReferenceCounting ( ResilienceExpansion resilience ) { <nl> void SILBoxType : : Profile ( llvm : : FoldingSetNodeID & id , SILLayout * Layout , <nl> SubstitutionList Args ) { <nl> id . AddPointer ( Layout ) ; <nl> - for ( auto & arg : Args ) { <nl> - id . AddPointer ( arg . getReplacement ( ) . getPointer ( ) ) ; <nl> - for ( auto conformance : arg . getConformances ( ) ) <nl> - id . AddPointer ( conformance . getOpaqueValue ( ) ) ; <nl> - } <nl> + profileSubstitutionList ( id , Args ) ; <nl> } <nl> <nl> SILBoxType : : SILBoxType ( ASTContext & C , <nl> mmm a / lib / IRGen / GenReflection . cpp <nl> ppp b / lib / IRGen / GenReflection . cpp <nl> class AssociatedTypeMetadataBuilder : public ReflectionMetadataBuilder { <nl> void layout ( ) override { <nl> / / If the conforming type is generic , we just want to emit the <nl> / / unbound generic type here . <nl> - auto * Nominal = Conformance - > getInterfaceType ( ) - > getAnyNominal ( ) ; <nl> + auto * Nominal = Conformance - > getType ( ) - > getAnyNominal ( ) ; <nl> assert ( Nominal & & " Structural conformance ? " ) ; <nl> <nl> PrettyStackTraceDecl DebugStack ( " emitting associated type metadata " , <nl> mmm a / lib / SILGen / SILGenBridging . cpp <nl> ppp b / lib / SILGen / SILGenBridging . cpp <nl> emitBridgeNativeToObjectiveC ( SILGenFunction & SGF , <nl> if ( ! requirement ) return None ; <nl> <nl> / / Retrieve the _bridgeToObjectiveC witness . <nl> - auto witness = conformance - > getWitness ( requirement , nullptr ) ; <nl> + auto witness = conformance - > getWitnessDecl ( requirement , nullptr ) ; <nl> assert ( witness ) ; <nl> <nl> / / Determine the type we ' re bridging to . <nl> emitBridgeNativeToObjectiveC ( SILGenFunction & SGF , <nl> assert ( objcType ) ; <nl> <nl> / / Create a reference to the witness . <nl> - SILDeclRef witnessConstant ( witness . getDecl ( ) ) ; <nl> + SILDeclRef witnessConstant ( witness ) ; <nl> auto witnessRef = SGF . emitGlobalFunctionRef ( loc , witnessConstant ) ; <nl> <nl> / / Determine the substitutions . <nl> emitBridgeNativeToObjectiveC ( SILGenFunction & SGF , <nl> <nl> / / FIXME : Figure out the right SubstitutionMap stuff if the witness <nl> / / has generic parameters of its own . <nl> - assert ( ! cast < FuncDecl > ( witness . getDecl ( ) ) - > isGeneric ( ) & & <nl> + assert ( ! cast < FuncDecl > ( witness ) - > isGeneric ( ) & & <nl> " Generic witnesses not supported " ) ; <nl> <nl> - auto * dc = cast < FuncDecl > ( witness . getDecl ( ) ) - > getDeclContext ( ) ; <nl> + auto * dc = cast < FuncDecl > ( witness ) - > getDeclContext ( ) ; <nl> auto * genericSig = dc - > getGenericSignatureOfContext ( ) ; <nl> auto typeSubMap = swiftValueType - > getContextSubstitutionMap ( <nl> SGF . SGM . SwiftModule , dc ) ; <nl> emitBridgeObjectiveCToNative ( SILGenFunction & SGF , <nl> if ( ! requirement ) return None ; <nl> <nl> / / Retrieve the _unconditionallyBridgeFromObjectiveC witness . <nl> - auto witness = conformance - > getWitness ( requirement , nullptr ) ; <nl> + auto witness = conformance - > getWitnessDecl ( requirement , nullptr ) ; <nl> assert ( witness ) ; <nl> <nl> / / Create a reference to the witness . <nl> - SILDeclRef witnessConstant ( witness . getDecl ( ) ) ; <nl> + SILDeclRef witnessConstant ( witness ) ; <nl> auto witnessRef = SGF . emitGlobalFunctionRef ( loc , witnessConstant ) ; <nl> <nl> / / Determine the substitutions . <nl> mmm a / lib / SILGen / SILGenConvert . cpp <nl> ppp b / lib / SILGen / SILGenConvert . cpp <nl> ManagedValue SILGenFunction : : emitExistentialErasure ( <nl> / / Devirtualize . Maybe this should be done implicitly by <nl> / / emitPropertyLValue ? <nl> if ( storedNSErrorConformance - > isConcrete ( ) ) { <nl> - if ( auto witnessVar = storedNSErrorConformance - > getConcrete ( ) <nl> - - > getWitness ( nsErrorVar , nullptr ) ) { <nl> - nsErrorVar = cast < VarDecl > ( witnessVar . getDecl ( ) ) ; <nl> - nsErrorVarSubstitutions = witnessVar . getSubstitutions ( ) ; <nl> + if ( auto normal = dyn_cast < NormalProtocolConformance > ( <nl> + storedNSErrorConformance - > getConcrete ( ) ) ) { <nl> + if ( auto witnessVar = normal - > getWitness ( nsErrorVar , nullptr ) ) { <nl> + nsErrorVar = cast < VarDecl > ( witnessVar . getDecl ( ) ) ; <nl> + nsErrorVarSubstitutions = witnessVar . getSubstitutions ( ) ; <nl> + } <nl> } <nl> } <nl> <nl> mmm a / lib / SILGen / SILGenType . cpp <nl> ppp b / lib / SILGen / SILGenType . cpp <nl> SILGenModule : : emitProtocolWitness ( ProtocolConformance * conformance , <nl> genericEnv = witnessRef . getDecl ( ) - > getInnermostDeclContext ( ) <nl> - > getGenericEnvironmentOfContext ( ) ; <nl> <nl> - Type concreteTy = conformance - > getInterfaceType ( ) ; <nl> + auto conformanceDC = conformance - > getDeclContext ( ) ; <nl> + Type concreteTy = conformanceDC - > getSelfInterfaceType ( ) ; <nl> <nl> / / FIXME : conformance substitutions should be in terms of interface types <nl> auto specialized = conformance ; <nl> SILGenModule : : emitProtocolWitness ( ProtocolConformance * conformance , <nl> / / If the witness is a free function , there is no Self type . <nl> if ( ! isFree ) { <nl> if ( conformance ) { <nl> - selfInterfaceType = conformance - > getInterfaceType ( ) ; <nl> + auto conformanceDC = conformance - > getDeclContext ( ) ; <nl> + selfInterfaceType = <nl> + conformanceDC - > mapTypeOutOfContext ( conformance - > getType ( ) ) ; <nl> } else { <nl> auto * proto = cast < ProtocolDecl > ( requirement . getDecl ( ) - > getDeclContext ( ) ) ; <nl> selfInterfaceType = proto - > getSelfInterfaceType ( ) ; <nl> mmm a / lib / Sema / CSApply . cpp <nl> ppp b / lib / Sema / CSApply . cpp <nl> static DeclTy * findNamedWitnessImpl ( <nl> return requirement ; <nl> auto concrete = conformance - > getConcrete ( ) ; <nl> / / FIXME : Dropping substitutions here . <nl> - return cast_or_null < DeclTy > ( concrete - > getWitness ( requirement , & tc ) . getDecl ( ) ) ; <nl> + return cast_or_null < DeclTy > ( concrete - > getWitnessDecl ( requirement , & tc ) ) ; <nl> } <nl> <nl> static bool shouldAccessStorageDirectly ( Expr * base , VarDecl * member , <nl> namespace { <nl> ( ConformanceCheckFlags : : InExpression | <nl> ConformanceCheckFlags : : Used ) ) ; <nl> if ( conformance & & conformance - > isConcrete ( ) ) { <nl> - if ( auto witnessRef = <nl> - conformance - > getConcrete ( ) - > getWitness ( decl , & tc ) ) { <nl> + if ( auto witness = <nl> + conformance - > getConcrete ( ) - > getWitnessDecl ( decl , & tc ) ) { <nl> / / Hack up an AST that we can type - check ( independently ) to get <nl> / / it into the right form . <nl> / / FIXME : the hop through ' getDecl ( ) ' is because <nl> namespace { <nl> / / witnesses ' ConcreteDeclRefs . <nl> Type expectedFnType = simplifiedFnType - > getResult ( ) ; <nl> Expr * refExpr ; <nl> - ValueDecl * witness = witnessRef . getDecl ( ) ; <nl> if ( witness - > getDeclContext ( ) - > isTypeContext ( ) ) { <nl> Expr * base = <nl> TypeExpr : : createImplicitHack ( loc . getBaseNameLoc ( ) , baseTy , <nl> mmm a / lib / Sema / CSRanking . cpp <nl> ppp b / lib / Sema / CSRanking . cpp <nl> static Comparison compareWitnessAndRequirement ( TypeChecker & tc , DeclContext * dc , <nl> <nl> / / If the witness and the potential witness are not the same , there ' s no <nl> / / ordering here . <nl> - if ( conformance - > getConcrete ( ) - > getWitness ( req , & tc ) . getDecl ( ) <nl> - ! = potentialWitness ) <nl> + if ( conformance - > getConcrete ( ) - > getWitnessDecl ( req , & tc ) ! = potentialWitness ) <nl> return Comparison : : Unordered ; <nl> <nl> / / We have a requirement / witness match . <nl> mmm a / lib / Sema / CodeSynthesis . cpp <nl> ppp b / lib / Sema / CodeSynthesis . cpp <nl> void swift : : maybeAddAccessorsToVariable ( VarDecl * var , TypeChecker & TC ) { <nl> / / The conformance will be on the containing ' self ' type , or ' ( ) ' if the <nl> / / property is in a non - type context . <nl> Type behaviorSelf ; <nl> - Type behaviorInterfaceSelf ; <nl> if ( dc - > isTypeContext ( ) ) { <nl> - behaviorInterfaceSelf = dc - > getSelfInterfaceType ( ) ; <nl> - behaviorSelf = dc - > mapTypeIntoContext ( behaviorInterfaceSelf ) ; <nl> + behaviorSelf = dc - > getSelfTypeInContext ( ) ; <nl> assert ( behaviorSelf & & " type context doesn ' t have self type ? ! " ) ; <nl> if ( var - > isStatic ( ) ) <nl> behaviorSelf = MetatypeType : : get ( behaviorSelf ) ; <nl> } else { <nl> - behaviorSelf = behaviorInterfaceSelf = TC . Context . TheEmptyTupleType ; <nl> + behaviorSelf = TC . Context . TheEmptyTupleType ; <nl> } <nl> <nl> conformance = TC . Context . getBehaviorConformance ( behaviorSelf , <nl> - behaviorInterfaceSelf , <nl> behaviorProto , <nl> behavior - > getLoc ( ) , var , <nl> ProtocolConformanceState : : Checking ) ; <nl> mmm a / lib / Sema / TypeCheckDecl . cpp <nl> ppp b / lib / Sema / TypeCheckDecl . cpp <nl> static void checkVarBehavior ( VarDecl * decl , TypeChecker & TC ) { <nl> <nl> auto dc = decl - > getDeclContext ( ) ; <nl> auto behaviorSelf = conformance - > getType ( ) ; <nl> - auto behaviorInterfaceSelf = conformance - > getInterfaceType ( ) ; <nl> + auto behaviorInterfaceSelf = <nl> + conformance - > getDeclContext ( ) - > mapTypeOutOfContext ( behaviorSelf ) ; <nl> auto behaviorProto = conformance - > getProtocol ( ) ; <nl> auto behaviorProtoTy = behaviorProto - > getDeclaredType ( ) ; <nl> <nl> mmm a / lib / Sema / TypeCheckNameLookup . cpp <nl> ppp b / lib / Sema / TypeCheckNameLookup . cpp <nl> namespace { <nl> witness = concrete - > getTypeWitnessAndDecl ( assocType , & TC ) <nl> . second ; <nl> } else if ( found - > isProtocolRequirement ( ) ) { <nl> - witness = concrete - > getWitness ( found , & TC ) . getDecl ( ) ; <nl> + witness = concrete - > getWitnessDecl ( found , & TC ) ; <nl> } <nl> <nl> / / FIXME : the " isa < ProtocolDecl > ( ) " check will be wrong for <nl> mmm a / lib / Sema / TypeCheckProtocol . cpp <nl> ppp b / lib / Sema / TypeCheckProtocol . cpp <nl> ConformanceChecker : : resolveWitnessViaLookup ( ValueDecl * requirement ) { <nl> if ( auto conformance = <nl> TC . conformsToProtocol ( Adoptee , derivableProto , DC , None ) ) { <nl> if ( conformance - > isConcrete ( ) ) <nl> - conformance - > getConcrete ( ) - > getWitness ( derivable , & TC ) ; <nl> + ( void ) conformance - > getConcrete ( ) - > getWitnessDecl ( derivable , & TC ) ; <nl> } <nl> } <nl> } <nl> TypeChecker : : findWitnessedObjCRequirements ( const ValueDecl * witness , <nl> } <nl> if ( ! * conformance ) continue ; <nl> <nl> - const Decl * found = ( * conformance ) - > getWitness ( req , this ) . getDecl ( ) ; <nl> + const Decl * found = ( * conformance ) - > getWitnessDecl ( req , this ) ; <nl> <nl> if ( ! found ) { <nl> / / If we have an optional requirement in an inherited conformance , <nl> | Merge pull request from DougGregor / protocol - conformance - cleanups | apple/swift | 504b6f2a556ca543516b93386f1d75174da23801 | 2017-04-19T07:05:06Z |
mmm a / tests / Aql / SubqueryEndExecutorTest . cpp <nl> ppp b / tests / Aql / SubqueryEndExecutorTest . cpp <nl> <nl> # include " RowFetcherHelper . h " <nl> # include " gtest / gtest . h " <nl> <nl> + # include " Mocks / Death_Test . h " <nl> + <nl> # include " Aql / OutputAqlItemRow . h " <nl> # include " Aql / SubqueryEndExecutor . h " <nl> <nl> TEST_F ( SubqueryEndExecutorTest , empty_input_expects_shadow_rows ) { <nl> SharedAqlItemBlockPtr outputBlock ; <nl> SharedAqlItemBlockPtr inputBlock = buildBlock < 1 > ( itemBlockManager , { { 1 } } , { { 0 , 0 } } ) ; <nl> <nl> - SingleRowFetcherHelper < : : arangodb : : aql : : BlockPassthrough : : Disable > fetcher ( itemBlockManager , inputBlock - > size ( ) , false , inputBlock ) ; <nl> + SingleRowFetcherHelper < : : arangodb : : aql : : BlockPassthrough : : Disable > fetcher ( <nl> + itemBlockManager , inputBlock - > size ( ) , false , inputBlock ) ; <nl> SubqueryEndExecutor testee ( fetcher , _infos ) ; <nl> <nl> ExecutionState state { ExecutionState : : HASMORE } ; <nl> TEST_F ( SubqueryEndExecutorTest , single_input_expects_shadow_rows ) { <nl> SharedAqlItemBlockPtr inputBlock = <nl> buildBlock < 1 > ( itemBlockManager , { { { 1 } } , { { 1 } } } , { { 1 , 0 } } ) ; <nl> <nl> - SingleRowFetcherHelper < : : arangodb : : aql : : BlockPassthrough : : Disable > fetcher ( itemBlockManager , inputBlock - > size ( ) , false , inputBlock ) ; <nl> + SingleRowFetcherHelper < : : arangodb : : aql : : BlockPassthrough : : Disable > fetcher ( <nl> + itemBlockManager , inputBlock - > size ( ) , false , inputBlock ) ; <nl> <nl> SubqueryEndExecutor testee ( fetcher , _infos ) ; <nl> <nl> TEST_F ( SubqueryEndExecutorTest , two_inputs_one_shadowrow ) { <nl> SharedAqlItemBlockPtr inputBlock = <nl> buildBlock < 1 > ( itemBlockManager , { { { 42 } } , { { 34 } } , { { 1 } } } , { { 2 , 0 } } ) ; <nl> <nl> - SingleRowFetcherHelper < : : arangodb : : aql : : BlockPassthrough : : Disable > fetcher ( itemBlockManager , inputBlock - > size ( ) , false , inputBlock ) ; <nl> + SingleRowFetcherHelper < : : arangodb : : aql : : BlockPassthrough : : Disable > fetcher ( <nl> + itemBlockManager , inputBlock - > size ( ) , false , inputBlock ) ; <nl> <nl> SubqueryEndExecutor testee ( fetcher , _infos ) ; <nl> <nl> TEST_F ( SubqueryEndExecutorTest , two_inputs_two_shadowrows ) { <nl> SharedAqlItemBlockPtr outputBlock ; <nl> <nl> SharedAqlItemBlockPtr inputBlock = <nl> - buildBlock < 1 > ( itemBlockManager , { { { 42 } } , { { 1 } } , { { 34 } } , { { 1 } } } , <nl> - { { 1 , 0 } , { 3 , 0 } } ) ; <nl> + buildBlock < 1 > ( itemBlockManager , { { { 42 } } , { { 1 } } , { { 34 } } , { { 1 } } } , { { 1 , 0 } , { 3 , 0 } } ) ; <nl> <nl> - SingleRowFetcherHelper < : : arangodb : : aql : : BlockPassthrough : : Disable > fetcher ( itemBlockManager , inputBlock - > size ( ) , false , inputBlock ) ; <nl> + SingleRowFetcherHelper < : : arangodb : : aql : : BlockPassthrough : : Disable > fetcher ( <nl> + itemBlockManager , inputBlock - > size ( ) , false , inputBlock ) ; <nl> <nl> SubqueryEndExecutor testee ( fetcher , _infos ) ; <nl> <nl> TEST_F ( SubqueryEndExecutorTest , two_input_one_shadowrow_two_irrelevant ) { <nl> buildBlock < 1 > ( itemBlockManager , { { { 42 } } , { { 42 } } , { { 42 } } , { { 42 } } , { { 42 } } } , <nl> { { 2 , 0 } , { 3 , 1 } , { 4 , 2 } } ) ; <nl> <nl> - SingleRowFetcherHelper < : : arangodb : : aql : : BlockPassthrough : : Disable > fetcher ( itemBlockManager , inputBlock - > size ( ) , false , inputBlock ) ; <nl> + SingleRowFetcherHelper < : : arangodb : : aql : : BlockPassthrough : : Disable > fetcher ( <nl> + itemBlockManager , inputBlock - > size ( ) , false , inputBlock ) ; <nl> <nl> SubqueryEndExecutor testee ( fetcher , _infos ) ; <nl> <nl> TEST_F ( SubqueryEndExecutorTest , consume_output_of_subquery_end_executor ) { <nl> buildBlock < 1 > ( itemBlockManager , { { { 42 } } , { { 42 } } , { { 42 } } , { { 42 } } , { { 42 } } } , <nl> { { 2 , 0 } , { 3 , 1 } , { 4 , 2 } } ) ; <nl> <nl> - SingleRowFetcherHelper < : : arangodb : : aql : : BlockPassthrough : : Disable > fetcher ( itemBlockManager , inputBlock - > size ( ) , false , inputBlock ) ; <nl> + SingleRowFetcherHelper < : : arangodb : : aql : : BlockPassthrough : : Disable > fetcher ( <nl> + itemBlockManager , inputBlock - > size ( ) , false , inputBlock ) ; <nl> <nl> SubqueryEndExecutor testee ( fetcher , _infos ) ; <nl> <nl> TEST_F ( SubqueryEndExecutorTest , consume_output_of_subquery_end_executor ) { <nl> <nl> outputBlock = output . stealBlock ( ) ; <nl> inputBlock . swap ( outputBlock ) ; <nl> - SingleRowFetcherHelper < : : arangodb : : aql : : BlockPassthrough : : Disable > fetcher2 ( itemBlockManager , inputBlock - > size ( ) , <nl> - false , inputBlock ) ; <nl> + SingleRowFetcherHelper < : : arangodb : : aql : : BlockPassthrough : : Disable > fetcher2 ( <nl> + itemBlockManager , inputBlock - > size ( ) , false , inputBlock ) ; <nl> SubqueryEndExecutor testee2 ( fetcher2 , _infos ) ; <nl> outputBlock . reset ( new AqlItemBlock ( itemBlockManager , inputBlock - > size ( ) , 1 ) ) ; <nl> OutputAqlItemRow output2 { std : : move ( outputBlock ) , _infos . getOutputRegisters ( ) , <nl> TEST_F ( SubqueryEndExecutorTest , write_to_register_outside ) { <nl> SharedAqlItemBlockPtr inputBlock = <nl> buildBlock < 1 > ( itemBlockManager , { { { 42 } } , { { 23 } } } , { { 1 , 0 } } ) ; <nl> <nl> - SingleRowFetcherHelper < : : arangodb : : aql : : BlockPassthrough : : Disable > fetcher ( itemBlockManager , inputBlock - > size ( ) , false , inputBlock ) ; <nl> + SingleRowFetcherHelper < : : arangodb : : aql : : BlockPassthrough : : Disable > fetcher ( <nl> + itemBlockManager , inputBlock - > size ( ) , false , inputBlock ) ; <nl> <nl> SubqueryEndExecutor testee ( fetcher , infos ) ; <nl> <nl> TEST_F ( SubqueryEndExecutorTest_DeathTest , no_shadow_row ) { <nl> SharedAqlItemBlockPtr outputBlock ; <nl> SharedAqlItemBlockPtr inputBlock = buildBlock < 1 > ( itemBlockManager , { { 1 } } ) ; <nl> <nl> - SingleRowFetcherHelper < : : arangodb : : aql : : BlockPassthrough : : Disable > fetcher ( itemBlockManager , inputBlock - > size ( ) , false , inputBlock ) ; <nl> + SingleRowFetcherHelper < : : arangodb : : aql : : BlockPassthrough : : Disable > fetcher ( <nl> + itemBlockManager , inputBlock - > size ( ) , false , inputBlock ) ; <nl> <nl> SubqueryEndExecutor testee ( fetcher , _infos ) ; <nl> <nl> TEST_F ( SubqueryEndExecutorTest_DeathTest , no_shadow_row ) { <nl> outputBlock . reset ( new AqlItemBlock ( itemBlockManager , inputBlock - > size ( ) , 1 ) ) ; <nl> OutputAqlItemRow output { std : : move ( outputBlock ) , _infos . getOutputRegisters ( ) , <nl> _infos . registersToKeep ( ) , _infos . registersToClear ( ) } ; <nl> - EXPECT_DEATH ( std : : tie ( state , std : : ignore ) = testee . produceRows ( output ) , " . * " ) ; <nl> + EXPECT_DEATH_CORE_FREE ( std : : tie ( state , std : : ignore ) = testee . produceRows ( output ) , <nl> + " . * " ) ; <nl> } <nl> <nl> TEST_F ( SubqueryEndExecutorTest_DeathTest , misplaced_irrelevant_shadowrow ) { <nl> TEST_F ( SubqueryEndExecutorTest_DeathTest , misplaced_irrelevant_shadowrow ) { <nl> SharedAqlItemBlockPtr inputBlock = <nl> buildBlock < 1 > ( itemBlockManager , { { 42 } , { 42 } , { 42 } } , { { 1 , 1 } , { 2 , 1 } } ) ; <nl> <nl> - SingleRowFetcherHelper < : : arangodb : : aql : : BlockPassthrough : : Disable > fetcher ( itemBlockManager , inputBlock - > size ( ) , false , inputBlock ) ; <nl> + SingleRowFetcherHelper < : : arangodb : : aql : : BlockPassthrough : : Disable > fetcher ( <nl> + itemBlockManager , inputBlock - > size ( ) , false , inputBlock ) ; <nl> <nl> SubqueryEndExecutor testee ( fetcher , _infos ) ; <nl> <nl> TEST_F ( SubqueryEndExecutorTest_DeathTest , misplaced_irrelevant_shadowrow ) { <nl> outputBlock . reset ( new AqlItemBlock ( itemBlockManager , inputBlock - > size ( ) , 1 ) ) ; <nl> OutputAqlItemRow output { std : : move ( outputBlock ) , _infos . getOutputRegisters ( ) , <nl> _infos . registersToKeep ( ) , _infos . registersToClear ( ) } ; <nl> - EXPECT_DEATH ( std : : tie ( state , std : : ignore ) = testee . produceRows ( output ) , " . * " ) ; <nl> + EXPECT_DEATH_CORE_FREE ( std : : tie ( state , std : : ignore ) = testee . produceRows ( output ) , <nl> + " . * " ) ; <nl> } <nl> new file mode 100644 <nl> index 00000000000 . . f13282f666e <nl> mmm / dev / null <nl> ppp b / tests / Mocks / Death_Test . h <nl> <nl> + / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / <nl> + / / / DISCLAIMER <nl> + / / / <nl> + / / / Copyright 2018 ArangoDB GmbH , Cologne , Germany <nl> + / / / <nl> + / / / Licensed under the Apache License , Version 2 . 0 ( the " License " ) ; <nl> + / / / you may not use this file except in compliance with the License . <nl> + / / / You may obtain a copy of the License at <nl> + / / / <nl> + / / / http : / / www . apache . org / licenses / LICENSE - 2 . 0 <nl> + / / / <nl> + / / / Unless required by applicable law or agreed to in writing , software <nl> + / / / distributed under the License is distributed on an " AS IS " BASIS , <nl> + / / / WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND , either express or implied . <nl> + / / / See the License for the specific language governing permissions and <nl> + / / / limitations under the License . <nl> + / / / <nl> + / / / Copyright holder is ArangoDB GmbH , Cologne , Germany <nl> + / / / <nl> + / / / @ author Michael Hackstein <nl> + / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / <nl> + <nl> + / / / Google offers a way to run a death test against the system . <nl> + / / / e . g . define set of cade that causes the process to crash . <nl> + / / / this could be used to validate that certain states are considered <nl> + / / / invalid in production code and not accidentially removed on refactorings . <nl> + / / / However every such death test will generate a core - dump , even if the test is successful <nl> + / / / This is inconvenient as it unnecessarily bloats up HDD usage and hides releveant coredumps <nl> + / / / So this thin macro wraps around the GTEST : : EXPECT_DEATH macro and disables coredumps <nl> + / / / only within the expected forked process <nl> + <nl> + # ifndef ARANGODB_TESTS_MOCKS_DEATH_TEST_CHANGER_H <nl> + # define ARANGODB_TESTS_MOCKS_DEATH_TEST_CHANGER_H 1 <nl> + <nl> + # ifndef _WIN32 <nl> + <nl> + / / Enabled on Linux and Mac <nl> + <nl> + # define EXPECT_DEATH_CORE_FREE ( func , assertion ) \ <nl> + EXPECT_DEATH ( \ <nl> + [ & ] ( ) { \ <nl> + rlimit core_limit ; \ <nl> + core_limit . rlim_cur = 0 ; \ <nl> + core_limit . rlim_max = 0 ; \ <nl> + setrlimit ( RLIMIT_CORE , & core_limit ) ; \ <nl> + func ; \ <nl> + } ( ) , \ <nl> + assertion ) <nl> + <nl> + # else <nl> + <nl> + / / Disabled on windows <nl> + / / If anyone knows how to disable core creation of a forked process <nl> + / / please feel free to fix it here . <nl> + <nl> + # define EXPECT_DEATH_CORE_FREE ( func , assertion ) EXPECT_TRUE ( true ) <nl> + <nl> + # endif <nl> + <nl> + # endif <nl> \ No newline at end of file <nl> | Add a way to avoid core - dumps on death tests ( ) | arangodb/arangodb | 1d4584ffab2985964b3b27568feb32a4bee01d42 | 2019-10-07T08:59:21Z |
mmm a / doc / PROTOCOL - HTTP2 . md <nl> ppp b / doc / PROTOCOL - HTTP2 . md <nl> Request - Headers are delivered as HTTP2 headers in HEADERS + CONTINUATION frames . <nl> * * * Message - Type * * β " grpc - message - type " { _type name for message schema_ } <nl> * * * Custom - Metadata * * β Binary - Header / ASCII - Header <nl> * * * Binary - Header * * β { Header - Name " - bin " } { _base64 encoded value_ } <nl> - * * * ASCII - Header * * β Header - Name { _value_ } <nl> + * * * ASCII - Header * * β Header - Name ASCII - Value <nl> * * * Header - Name * * β 1 \ * ( % x30 - 39 / % x61 - 7A / " \ _ " / " - " ) ; 0 - 9 a - z \ _ - <nl> + * * * ASCII - Value * * β 1 \ * ( % x20 - % x7E ) ; space and printable ASCII <nl> <nl> <nl> HTTP2 requires that reserved headers , ones starting with " : " appear before all other headers . Additionally implementations should send * * Timeout * * immediately after the reserved headers and they should send the * * Call - Definition * * headers before sending * * Custom - Metadata * * . <nl> If * * Timeout * * is omitted a server should assume an infinite timeout . Client imp <nl> <nl> Note that HTTP2 does not allow arbitrary octet sequences for header values so binary header values must be encoded using Base64 as per https : / / tools . ietf . org / html / rfc4648 # section - 4 . Implementations MUST accept padded and un - padded values and should emit un - padded values . Applications define binary headers by having their names end with " - bin " . Runtime libraries use this suffix to detect binary headers and properly apply base64 encoding & decoding as headers are sent and received . <nl> <nl> + * * Custom - Metadata * * header order is not guaranteed to be preserved except for <nl> + values with duplicate header names . Duplicate header names may have their values <nl> + joined with " , " as the delimiter and be considered semantically equivalent . <nl> + Implementations must split * * Binary - Header * * s on " , " before decoding the <nl> + Base64 - encoded values . <nl> + <nl> + * * ASCII - Value * * should not have leading or trailing whitespace . If it contains <nl> + leading or trailing whitespace , it may be stripped . The * * ASCII - Value * * <nl> + character range defined is more strict than HTTP . Implementations must not error <nl> + due to receiving an invalid * * ASCII - Value * * but value valid in HTTP , but the <nl> + precise behavior is not strictly defined : they may throw the value away or <nl> + accept the value . If accepted , care must be taken to make sure that the <nl> + application is permitted to echo the value back as metadata . For example , if the <nl> + metadata is provided to the application as a list in a request , the application <nl> + should not trigger an error by providing that same list as the metadata in the <nl> + response . <nl> + <nl> Servers may limit the size of * * Request - Headers * * , with a default of 8 KiB <nl> suggested . Implementations are encouraged to compute total header size like <nl> HTTP / 2 ' s ` SETTINGS_MAX_HEADER_LIST_SIZE ` : the sum of all header fields , for each <nl> mmm a / examples / node / README . md <nl> ppp b / examples / node / README . md <nl> gRPC in 3 minutes ( Node . js ) <nl> PREREQUISITES <nl> mmmmmmmmmmmm - <nl> <nl> - - ` node ` : This requires Node 10 . x or greater . <nl> + - ` node ` : This requires Node 0 . 10 . x or greater . <nl> - [ homebrew ] [ ] on Mac OS X . This simplifies the installation of the gRPC C core . <nl> <nl> INSTALL <nl> mmm a / include / grpc + + / support / channel_arguments . h <nl> ppp b / include / grpc + + / support / channel_arguments . h <nl> class ChannelArguments { <nl> void SetChannelArgs ( grpc_channel_args * channel_args ) const ; <nl> <nl> / / gRPC specific channel argument setters <nl> - / / / Set target name override for SSL host name checking . <nl> + / / / Set target name override for SSL host name checking . This option is for <nl> + / / / testing only and should never be used in production . <nl> void SetSslTargetNameOverride ( const grpc : : string & name ) ; <nl> / / TODO ( yangg ) add flow control options <nl> / / / Set the compression algorithm for the channel . <nl> mmm a / src / core / support / time_win32 . c <nl> ppp b / src / core / support / time_win32 . c <nl> gpr_timespec gpr_now ( gpr_clock_type clock ) { <nl> now_tv . tv_nsec = now_tb . millitm * 1000000 ; <nl> break ; <nl> case GPR_CLOCK_MONOTONIC : <nl> + case GPR_CLOCK_PRECISE : <nl> QueryPerformanceCounter ( & timestamp ) ; <nl> now_dbl = ( timestamp . QuadPart - g_start_time . QuadPart ) * g_time_scale ; <nl> now_tv . tv_sec = ( time_t ) now_dbl ; <nl> now_tv . tv_nsec = ( int ) ( ( now_dbl - ( double ) now_tv . tv_sec ) * 1e9 ) ; <nl> break ; <nl> - case GPR_CLOCK_PRECISE : <nl> - gpr_precise_clock_now ( & now_tv ) ; <nl> - break ; <nl> } <nl> return now_tv ; <nl> } <nl> mmm a / src / node / ext / channel . cc <nl> ppp b / src / node / ext / channel . cc <nl> bool ParseChannelArgs ( Local < Value > args_val , <nl> return false ; <nl> } <nl> grpc_channel_args * channel_args = reinterpret_cast < grpc_channel_args * > ( <nl> - malloc ( sizeof ( channel_args ) ) ) ; <nl> + malloc ( sizeof ( grpc_channel_args ) ) ) ; <nl> * channel_args_ptr = channel_args ; <nl> Local < Object > args_hash = Nan : : To < Object > ( args_val ) . ToLocalChecked ( ) ; <nl> Local < Array > keys = Nan : : GetOwnPropertyNames ( args_hash ) . ToLocalChecked ( ) ; <nl> mmm a / src / node / src / client . js <nl> ppp b / src / node / src / client . js <nl> exports . makeClientConstructor = function ( methods , serviceName ) { <nl> if ( ! options ) { <nl> options = { } ; <nl> } <nl> - options [ ' grpc . primary_user_agent ' ] = ' grpc - node / ' + version ; <nl> + / * Append the grpc - node user agent string after the application user agent <nl> + * string , and put the combination at the beginning of the user agent string <nl> + * / <nl> + if ( options [ ' grpc . primary_user_agent ' ] ) { <nl> + options [ ' grpc . primary_user_agent ' ] + = ' ' ; <nl> + } else { <nl> + options [ ' grpc . primary_user_agent ' ] = ' ' ; <nl> + } <nl> + options [ ' grpc . primary_user_agent ' ] + = ' grpc - node / ' + version ; <nl> / * Private fields use $ as a prefix instead of _ because it is an invalid <nl> * prefix of a method name * / <nl> this . $ channel = new grpc . Channel ( address , credentials , options ) ; <nl> mmm a / src / objective - c / examples / Sample / Podfile <nl> ppp b / src / objective - c / examples / Sample / Podfile <nl> <nl> source ' https : / / github . com / CocoaPods / Specs . git ' <nl> platform : ios , ' 8 . 0 ' <nl> <nl> + pod ' Protobuf ' , : path = > " . . / . . / . . / . . / third_party / protobuf " <nl> pod ' gRPC ' , : path = > " . . / . . / . . / . . " <nl> - pod ' RemoteTest ' , : path = > " . . / . . / generated_libraries / RemoteTestClient " <nl> + pod ' RemoteTest ' , : path = > " . . / RemoteTestClient " <nl> <nl> target ' Sample ' do <nl> end <nl> mmm a / src / objective - c / examples / Sample / Sample / ViewController . m <nl> ppp b / src / objective - c / examples / Sample / Sample / ViewController . m <nl> <nl> # import " ViewController . h " <nl> <nl> # import < GRPCClient / GRPCCall . h > <nl> - # import < GRPCClient / GRPCMethodName . h > <nl> + # import < ProtoRPC / ProtoMethod . h > <nl> # import < RemoteTest / Messages . pbobjc . h > <nl> # import < RemoteTest / Test . pbrpc . h > <nl> # import < RxLibrary / GRXWriter + Immediate . h > <nl> - ( void ) viewDidLoad { <nl> <nl> / / Same example call using the generic gRPC client library : <nl> <nl> - GRPCMethodName * method = [ [ GRPCMethodName alloc ] initWithPackage : @ " grpc . testing " <nl> - interface : @ " TestService " <nl> - method : @ " UnaryCall " ] ; <nl> + ProtoMethod * method = [ [ ProtoMethod alloc ] initWithPackage : @ " grpc . testing " <nl> + service : @ " TestService " <nl> + method : @ " UnaryCall " ] ; <nl> <nl> - id < GRXWriter > requestsWriter = [ GRXWriter writerWithValue : [ request data ] ] ; <nl> + GRXWriter * requestsWriter = [ GRXWriter writerWithValue : [ request data ] ] ; <nl> <nl> GRPCCall * call = [ [ GRPCCall alloc ] initWithHost : kRemoteHost <nl> - method : method <nl> + path : method . HTTPPath <nl> requestsWriter : requestsWriter ] ; <nl> <nl> id < GRXWriteable > responsesWriteable = [ [ GRXWriteable alloc ] initWithValueHandler : ^ ( NSData * value ) { <nl> deleted file mode 100644 <nl> index 23ccffe69da . . 00000000000 <nl> mmm a / src / objective - c / generated_libraries / RouteGuideClient / RouteGuide . podspec <nl> ppp / dev / null <nl> <nl> - Pod : : Spec . new do | s | <nl> - s . name = " RouteGuide " <nl> - s . version = " 0 . 0 . 1 " <nl> - s . license = " New BSD " <nl> - <nl> - s . ios . deployment_target = " 6 . 0 " <nl> - s . osx . deployment_target = " 10 . 8 " <nl> - <nl> - # Run protoc with the Objective - C and gRPC plugins to generate protocol messages and gRPC clients . <nl> - s . prepare_command = < < - CMD <nl> - BINDIR = . . / . . / . . / . . / bins / $ CONFIG <nl> - PROTOC = $ BINDIR / protobuf / protoc <nl> - PLUGIN = $ BINDIR / grpc_objective_c_plugin <nl> - $ PROTOC - - plugin = protoc - gen - grpc = $ PLUGIN - - objc_out = . - - grpc_out = . * . proto <nl> - CMD <nl> - <nl> - s . subspec " Messages " do | ms | <nl> - ms . source_files = " * . pbobjc . { h , m } " <nl> - ms . header_mappings_dir = " . " <nl> - ms . requires_arc = false <nl> - ms . dependency " Protobuf " , " ~ > 3 . 0 . 0 - alpha - 3 " <nl> - end <nl> - <nl> - s . subspec " Services " do | ss | <nl> - ss . source_files = " * . pbrpc . { h , m } " <nl> - ss . header_mappings_dir = " . " <nl> - ss . requires_arc = true <nl> - ss . dependency " gRPC " , " ~ > 0 . 5 " <nl> - ss . dependency " # { s . name } / Messages " <nl> - end <nl> - end <nl> deleted file mode 100644 <nl> index 19592e2ebdd . . 00000000000 <nl> mmm a / src / objective - c / generated_libraries / RouteGuideClient / route_guide . proto <nl> ppp / dev / null <nl> <nl> - / / Copyright 2015 , Google Inc . <nl> - / / All rights reserved . <nl> - / / <nl> - / / Redistribution and use in source and binary forms , with or without <nl> - / / modification , are permitted provided that the following conditions are <nl> - / / met : <nl> - / / <nl> - / / * Redistributions of source code must retain the above copyright <nl> - / / notice , this list of conditions and the following disclaimer . <nl> - / / * Redistributions in binary form must reproduce the above <nl> - / / copyright notice , this list of conditions and the following disclaimer <nl> - / / in the documentation and / or other materials provided with the <nl> - / / distribution . <nl> - / / * Neither the name of Google Inc . nor the names of its <nl> - / / contributors may be used to endorse or promote products derived from <nl> - / / this software without specific prior written permission . <nl> - / / <nl> - / / THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS <nl> - / / " AS IS " AND ANY EXPRESS OR IMPLIED WARRANTIES , INCLUDING , BUT NOT <nl> - / / LIMITED TO , THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR <nl> - / / A PARTICULAR PURPOSE ARE DISCLAIMED . IN NO EVENT SHALL THE COPYRIGHT <nl> - / / OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT , INDIRECT , INCIDENTAL , <nl> - / / SPECIAL , EXEMPLARY , OR CONSEQUENTIAL DAMAGES ( INCLUDING , BUT NOT <nl> - / / LIMITED TO , PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES ; LOSS OF USE , <nl> - / / DATA , OR PROFITS ; OR BUSINESS INTERRUPTION ) HOWEVER CAUSED AND ON ANY <nl> - / / THEORY OF LIABILITY , WHETHER IN CONTRACT , STRICT LIABILITY , OR TORT <nl> - / / ( INCLUDING NEGLIGENCE OR OTHERWISE ) ARISING IN ANY WAY OUT OF THE USE <nl> - / / OF THIS SOFTWARE , EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE . <nl> - <nl> - syntax = " proto3 " ; <nl> - <nl> - package routeguide ; <nl> - <nl> - option objc_class_prefix = " RGD " ; <nl> - <nl> - / / Interface exported by the server . <nl> - service RouteGuide { <nl> - / / A simple RPC . <nl> - / / <nl> - / / Obtains the feature at a given position . <nl> - rpc GetFeature ( Point ) returns ( Feature ) { } <nl> - <nl> - / / A server - to - client streaming RPC . <nl> - / / <nl> - / / Obtains the Features available within the given Rectangle . Results are <nl> - / / streamed rather than returned at once ( e . g . in a response message with a <nl> - / / repeated field ) , as the rectangle may cover a large area and contain a <nl> - / / huge number of features . <nl> - rpc ListFeatures ( Rectangle ) returns ( stream Feature ) { } <nl> - <nl> - / / A client - to - server streaming RPC . <nl> - / / <nl> - / / Accepts a stream of Points on a route being traversed , returning a <nl> - / / RouteSummary when traversal is completed . <nl> - rpc RecordRoute ( stream Point ) returns ( RouteSummary ) { } <nl> - <nl> - / / A Bidirectional streaming RPC . <nl> - / / <nl> - / / Accepts a stream of RouteNotes sent while a route is being traversed , <nl> - / / while receiving other RouteNotes ( e . g . from other users ) . <nl> - rpc RouteChat ( stream RouteNote ) returns ( stream RouteNote ) { } <nl> - } <nl> - <nl> - / / Points are represented as latitude - longitude pairs in the E7 representation <nl> - / / ( degrees multiplied by 10 * * 7 and rounded to the nearest integer ) . <nl> - / / Latitudes should be in the range + / - 90 degrees and longitude should be in <nl> - / / the range + / - 180 degrees ( inclusive ) . <nl> - message Point { <nl> - int32 latitude = 1 ; <nl> - int32 longitude = 2 ; <nl> - } <nl> - <nl> - / / A latitude - longitude rectangle , represented as two diagonally opposite <nl> - / / points " lo " and " hi " . <nl> - message Rectangle { <nl> - / / One corner of the rectangle . <nl> - Point lo = 1 ; <nl> - <nl> - / / The other corner of the rectangle . <nl> - Point hi = 2 ; <nl> - } <nl> - <nl> - / / A feature names something at a given point . <nl> - / / <nl> - / / If a feature could not be named , the name is empty . <nl> - message Feature { <nl> - / / The name of the feature . <nl> - string name = 1 ; <nl> - <nl> - / / The point where the feature is detected . <nl> - Point location = 2 ; <nl> - } <nl> - <nl> - / / A RouteNote is a message sent while at a given point . <nl> - message RouteNote { <nl> - / / The location from which the message is sent . <nl> - Point location = 1 ; <nl> - <nl> - / / The message to be sent . <nl> - string message = 2 ; <nl> - } <nl> - <nl> - / / A RouteSummary is received in response to a RecordRoute rpc . <nl> - / / <nl> - / / It contains the number of individual points received , the number of <nl> - / / detected features , and the total distance covered as the cumulative sum of <nl> - / / the distance between each point . <nl> - message RouteSummary { <nl> - / / The number of points received . <nl> - int32 point_count = 1 ; <nl> - <nl> - / / The number of known features passed while traversing the route . <nl> - int32 feature_count = 2 ; <nl> - <nl> - / / The distance covered in metres . <nl> - int32 distance = 3 ; <nl> - <nl> - / / The duration of the traversal in seconds . <nl> - int32 elapsed_time = 4 ; <nl> - } <nl> mmm a / src / objective - c / tests / Podfile <nl> ppp b / src / objective - c / tests / Podfile <nl> platform : ios , ' 8 . 0 ' <nl> <nl> pod ' Protobuf ' , : path = > " . . / . . / . . / third_party / protobuf " <nl> pod ' gRPC ' , : path = > " . . / . . / . . " <nl> - pod ' RemoteTest ' , : path = > " . . / generated_libraries / RemoteTestClient " <nl> - pod ' RouteGuide ' , : path = > " . . / generated_libraries / RouteGuideClient " <nl> + pod ' RemoteTest ' , : path = > " RemoteTestClient " <nl> <nl> link_with ' AllTests ' , <nl> ' RxLibraryUnitTests ' , <nl> similarity index 100 % <nl> rename from src / objective - c / generated_libraries / RemoteTestClient / RemoteTest . podspec <nl> rename to src / objective - c / tests / RemoteTestClient / RemoteTest . podspec <nl> similarity index 100 % <nl> rename from src / objective - c / generated_libraries / RemoteTestClient / empty . proto <nl> rename to src / objective - c / tests / RemoteTestClient / empty . proto <nl> similarity index 100 % <nl> rename from src / objective - c / generated_libraries / RemoteTestClient / messages . proto <nl> rename to src / objective - c / tests / RemoteTestClient / messages . proto <nl> similarity index 100 % <nl> rename from src / objective - c / generated_libraries / RemoteTestClient / test . proto <nl> rename to src / objective - c / tests / RemoteTestClient / test . proto <nl> mmm a / src / php / lib / Grpc / BaseStub . php <nl> ppp b / src / php / lib / Grpc / BaseStub . php <nl> class BaseStub <nl> * @ param $ opts array <nl> * - ' update_metadata ' : ( optional ) a callback function which takes in a <nl> * metadata array , and returns an updated metadata array <nl> + * - ' grpc . primary_user_agent ' : ( optional ) a user - agent string <nl> * / <nl> public function __construct ( $ hostname , $ opts ) <nl> { <nl> public function __construct ( $ hostname , $ opts ) <nl> } <nl> $ package_config = json_decode ( <nl> file_get_contents ( dirname ( __FILE__ ) . ' / . . / . . / composer . json ' ) , true ) ; <nl> - $ opts [ ' grpc . primary_user_agent ' ] = <nl> + if ( ! empty ( $ opts [ ' grpc . primary_user_agent ' ] ) ) { <nl> + $ opts [ ' grpc . primary_user_agent ' ] . = ' ' ; <nl> + } else { <nl> + $ opts [ ' grpc . primary_user_agent ' ] = ' ' ; <nl> + } <nl> + $ opts [ ' grpc . primary_user_agent ' ] . = <nl> ' grpc - php / ' . $ package_config [ ' version ' ] ; <nl> $ this - > channel = new Channel ( $ hostname , $ opts ) ; <nl> } <nl> mmm a / src / ruby / ext / grpc / rb_call . c <nl> ppp b / src / ruby / ext / grpc / rb_call . c <nl> static const rb_data_type_t grpc_rb_md_ary_data_type = { <nl> { NULL , NULL } } , <nl> NULL , <nl> NULL , <nl> - 0 } ; <nl> + # ifdef RUBY_TYPED_FREE_IMMEDIATELY <nl> + / * it is unsafe to specify RUBY_TYPED_FREE_IMMEDIATELY because <nl> + * grpc_rb_call_destroy <nl> + * touches a hash object . <nl> + * TODO ( yugui ) Directly use st_table and call the free function earlier ? <nl> + * / <nl> + 0 , <nl> + # endif <nl> + } ; <nl> <nl> / * Describes grpc_call struct for RTypedData * / <nl> static const rb_data_type_t grpc_call_data_type = { <nl> static const rb_data_type_t grpc_call_data_type = { <nl> { NULL , NULL } } , <nl> NULL , <nl> NULL , <nl> + # ifdef RUBY_TYPED_FREE_IMMEDIATELY <nl> / * it is unsafe to specify RUBY_TYPED_FREE_IMMEDIATELY because <nl> * grpc_rb_call_destroy <nl> * touches a hash object . <nl> * TODO ( yugui ) Directly use st_table and call the free function earlier ? <nl> * / <nl> - 0 } ; <nl> + 0 , <nl> + # endif <nl> + } ; <nl> <nl> / * Error code details is a hash containing text strings describing errors * / <nl> VALUE rb_error_code_details ; <nl> mmm a / src / ruby / ext / grpc / rb_channel . c <nl> ppp b / src / ruby / ext / grpc / rb_channel . c <nl> static rb_data_type_t grpc_channel_data_type = { <nl> { grpc_rb_channel_mark , grpc_rb_channel_free , GRPC_RB_MEMSIZE_UNAVAILABLE , <nl> { NULL , NULL } } , <nl> NULL , NULL , <nl> + # ifdef RUBY_TYPED_FREE_IMMEDIATELY <nl> RUBY_TYPED_FREE_IMMEDIATELY <nl> + # endif <nl> } ; <nl> <nl> / * Allocates grpc_rb_channel instances . * / <nl> mmm a / src / ruby / ext / grpc / rb_channel_args . c <nl> ppp b / src / ruby / ext / grpc / rb_channel_args . c <nl> static rb_data_type_t grpc_rb_channel_args_data_type = { <nl> { GRPC_RB_GC_NOT_MARKED , GRPC_RB_GC_DONT_FREE , GRPC_RB_MEMSIZE_UNAVAILABLE , <nl> { NULL , NULL } } , <nl> NULL , NULL , <nl> + # ifdef RUBY_TYPED_FREE_IMMEDIATELY <nl> RUBY_TYPED_FREE_IMMEDIATELY <nl> + # endif <nl> } ; <nl> <nl> / * A callback the processes the hash key values in channel_args hash * / <nl> mmm a / src / ruby / ext / grpc / rb_completion_queue . c <nl> ppp b / src / ruby / ext / grpc / rb_completion_queue . c <nl> static rb_data_type_t grpc_rb_completion_queue_data_type = { <nl> { GRPC_RB_GC_NOT_MARKED , grpc_rb_completion_queue_destroy , <nl> GRPC_RB_MEMSIZE_UNAVAILABLE , { NULL , NULL } } , <nl> NULL , NULL , <nl> + # ifdef RUBY_TYPED_FREE_IMMEDIATELY <nl> / * cannot immediately free because grpc_rb_completion_queue_shutdown_drain <nl> * calls rb_thread_call_without_gvl . * / <nl> - 0 <nl> + 0 , <nl> + # endif <nl> } ; <nl> <nl> / * Allocates a completion queue . * / <nl> mmm a / src / ruby / ext / grpc / rb_credentials . c <nl> ppp b / src / ruby / ext / grpc / rb_credentials . c <nl> static rb_data_type_t grpc_rb_credentials_data_type = { <nl> GRPC_RB_MEMSIZE_UNAVAILABLE , { NULL , NULL } } , <nl> NULL , <nl> NULL , <nl> - RUBY_TYPED_FREE_IMMEDIATELY } ; <nl> + # ifdef RUBY_TYPED_FREE_IMMEDIATELY <nl> + RUBY_TYPED_FREE_IMMEDIATELY <nl> + # endif <nl> + } ; <nl> <nl> / * Allocates Credential instances . <nl> Provides safe initial defaults for the instance fields . * / <nl> mmm a / src / ruby / ext / grpc / rb_grpc . c <nl> ppp b / src / ruby / ext / grpc / rb_grpc . c <nl> static rb_data_type_t grpc_rb_timespec_data_type = { <nl> { NULL , NULL } } , <nl> NULL , <nl> NULL , <nl> - RUBY_TYPED_FREE_IMMEDIATELY } ; <nl> + # ifdef RUBY_TYPED_FREE_IMMEDIATELY <nl> + RUBY_TYPED_FREE_IMMEDIATELY <nl> + # endif <nl> + } ; <nl> <nl> / * Alloc func that blocks allocation of a given object by raising an <nl> * exception . * / <nl> static void Init_grpc_time_consts ( ) { <nl> id_tv_nsec = rb_intern ( " tv_nsec " ) ; <nl> } <nl> <nl> + / * <nl> + TODO : find an alternative to ruby_vm_at_exit that is ok in Ruby 2 . 0 where <nl> + RUBY_TYPED_FREE_IMMEDIATELY is not defined . <nl> + <nl> + At the moment , registering a function using ruby_vm_at_exit segfaults in Ruby <nl> + 2 . 0 . This is not an issue with the gRPC handler . More likely , this was an <nl> + in issue with 2 . 0 that got resolved in 2 . 1 and has not been backported . <nl> + * / <nl> + # ifdef RUBY_TYPED_FREE_IMMEDIATELY <nl> static void grpc_rb_shutdown ( ruby_vm_t * vm ) { <nl> ( void ) vm ; <nl> grpc_shutdown ( ) ; <nl> } <nl> + # endif <nl> <nl> / * Initialize the GRPC module structs * / <nl> <nl> VALUE sym_metadata = Qundef ; <nl> <nl> void Init_grpc ( ) { <nl> grpc_init ( ) ; <nl> + <nl> + / * TODO : find alternative to ruby_vm_at_exit that is ok in Ruby 2 . 0 * / <nl> + # ifdef RUBY_TYPED_FREE_IMMEDIATELY <nl> ruby_vm_at_exit ( grpc_rb_shutdown ) ; <nl> + # endif <nl> + <nl> grpc_rb_mGRPC = rb_define_module ( " GRPC " ) ; <nl> grpc_rb_mGrpcCore = rb_define_module_under ( grpc_rb_mGRPC , " Core " ) ; <nl> grpc_rb_sNewServerRpc = <nl> mmm a / src / ruby / ext / grpc / rb_server . c <nl> ppp b / src / ruby / ext / grpc / rb_server . c <nl> static const rb_data_type_t grpc_rb_server_data_type = { <nl> { NULL , NULL } } , <nl> NULL , <nl> NULL , <nl> + # ifdef RUBY_TYPED_FREE_IMMEDIATELY <nl> / * It is unsafe to specify RUBY_TYPED_FREE_IMMEDIATELY because the free function would block <nl> * and we might want to unlock GVL <nl> * TODO ( yugui ) Unlock GVL ? <nl> * / <nl> - 0 } ; <nl> + 0 , <nl> + # endif <nl> + } ; <nl> <nl> / * Allocates grpc_rb_server instances . * / <nl> static VALUE grpc_rb_server_alloc ( VALUE cls ) { <nl> mmm a / src / ruby / ext / grpc / rb_server_credentials . c <nl> ppp b / src / ruby / ext / grpc / rb_server_credentials . c <nl> static const rb_data_type_t grpc_rb_server_credentials_data_type = { <nl> { grpc_rb_server_credentials_mark , grpc_rb_server_credentials_free , <nl> GRPC_RB_MEMSIZE_UNAVAILABLE , { NULL , NULL } } , <nl> NULL , NULL , <nl> + # ifdef RUBY_TYPED_FREE_IMMEDIATELY <nl> RUBY_TYPED_FREE_IMMEDIATELY <nl> + # endif <nl> } ; <nl> <nl> / * Allocates ServerCredential instances . <nl> mmm a / src / ruby / lib / grpc / generic / active_call . rb <nl> ppp b / src / ruby / lib / grpc / generic / active_call . rb <nl> def finished <nl> # marshalled . <nl> def remote_send ( req , marshalled = false ) <nl> GRPC . logger . debug ( " sending # { req } , marshalled ? # { marshalled } " ) <nl> - if marshalled <nl> - payload = req <nl> - else <nl> - payload = @ marshal . call ( req ) <nl> - end <nl> + payload = marshalled ? req : @ marshal . call ( req ) <nl> @ call . run_batch ( @ cq , self , INFINITE_FUTURE , SEND_MESSAGE = > payload ) <nl> end <nl> <nl> def server_streamer ( req , * * kw ) <nl> # @ return [ Enumerator , nil ] a response Enumerator <nl> def bidi_streamer ( requests , * * kw , & blk ) <nl> start_call ( * * kw ) unless @ started <nl> - bd = BidiCall . new ( @ call , @ cq , @ marshal , @ unmarshal ) <nl> + bd = BidiCall . new ( @ call , @ cq , @ marshal , @ unmarshal , <nl> + metadata_tag : @ metadata_tag ) <nl> + @ metadata_tag = nil # run_on_client ensures metadata is read <nl> bd . run_on_client ( requests , @ op_notifier , & blk ) <nl> end <nl> <nl> mmm a / src / ruby / lib / grpc / generic / bidi_call . rb <nl> ppp b / src / ruby / lib / grpc / generic / bidi_call . rb <nl> class BidiCall <nl> # the call <nl> # @ param marshal [ Function ] f ( obj ) - > string that marshal requests <nl> # @ param unmarshal [ Function ] f ( string ) - > obj that unmarshals responses <nl> - def initialize ( call , q , marshal , unmarshal ) <nl> + # @ param metadata_tag [ Object ] tag object used to collect metadata <nl> + def initialize ( call , q , marshal , unmarshal , metadata_tag : nil ) <nl> fail ( ArgumentError , ' not a call ' ) unless call . is_a ? Core : : Call <nl> unless q . is_a ? Core : : CompletionQueue <nl> fail ( ArgumentError , ' not a CompletionQueue ' ) <nl> def initialize ( call , q , marshal , unmarshal ) <nl> @ op_notifier = nil # signals completion on clients <nl> @ readq = Queue . new <nl> @ unmarshal = unmarshal <nl> + @ metadata_tag = metadata_tag <nl> end <nl> <nl> # Begins orchestration of the Bidi stream for a client sending requests . <nl> def notify_done <nl> @ op_notifier . notify ( self ) <nl> end <nl> <nl> + # performs a read using @ call . run_batch , ensures metadata is set up <nl> + def read_using_run_batch <nl> + ops = { RECV_MESSAGE = > nil } <nl> + ops [ RECV_INITIAL_METADATA ] = nil unless @ metadata_tag . nil ? <nl> + batch_result = @ call . run_batch ( @ cq , self , INFINITE_FUTURE , ops ) <nl> + unless @ metadata_tag . nil ? <nl> + @ call . metadata = batch_result . metadata <nl> + @ metadata_tag = nil <nl> + end <nl> + batch_result <nl> + end <nl> + <nl> # each_queued_msg yields each message on this instances readq <nl> # <nl> # - messages are added to the readq by # read_loop <nl> def start_read_loop ( is_client : true ) <nl> loop do <nl> GRPC . logger . debug ( " bidi - read - loop : # { count } " ) <nl> count + = 1 <nl> - # TODO : ensure metadata is read if available , currently it ' s not <nl> - batch_result = @ call . run_batch ( @ cq , read_tag , INFINITE_FUTURE , <nl> - RECV_MESSAGE = > nil ) <nl> + batch_result = read_using_run_batch <nl> <nl> # handle the next message <nl> if batch_result . message . nil ? <nl> mmm a / src / ruby / lib / grpc / generic / rpc_server . rb <nl> ppp b / src / ruby / lib / grpc / generic / rpc_server . rb <nl> def loop_handle_server_calls <nl> an_rpc = @ server . request_call ( @ cq , loop_tag , INFINITE_FUTURE ) <nl> break if ( ! an_rpc . nil ? ) & & an_rpc . call . nil ? <nl> <nl> - c = new_active_server_call ( an_rpc ) <nl> - unless c . nil ? <nl> - mth = an_rpc . method . to_sym <nl> - @ pool . schedule ( c ) do | call | <nl> - rpc_descs [ mth ] . run_server_method ( call , rpc_handlers [ mth ] ) <nl> + active_call = new_active_server_call ( an_rpc ) <nl> + unless active_call . nil ? <nl> + @ pool . schedule ( active_call ) do | ac | <nl> + c , mth = ac <nl> + rpc_descs [ mth ] . run_server_method ( c , rpc_handlers [ mth ] ) <nl> end <nl> end <nl> rescue Core : : CallError , RuntimeError = > e <nl> def new_active_server_call ( an_rpc ) <nl> # allow the metadata to be accessed from the call <nl> handle_call_tag = Object . new <nl> an_rpc . call . metadata = an_rpc . metadata # attaches md to call for handlers <nl> + GRPC . logger . debug ( " call md is # { an_rpc . metadata } " ) <nl> connect_md = nil <nl> unless @ connect_md_proc . nil ? <nl> connect_md = @ connect_md_proc . call ( an_rpc . method , an_rpc . metadata ) <nl> def new_active_server_call ( an_rpc ) <nl> # Create the ActiveCall <nl> GRPC . logger . info ( " deadline is # { an_rpc . deadline } ; ( now = # { Time . now } ) " ) <nl> rpc_desc = rpc_descs [ an_rpc . method . to_sym ] <nl> - ActiveCall . new ( an_rpc . call , @ cq , <nl> - rpc_desc . marshal_proc , rpc_desc . unmarshal_proc ( : input ) , <nl> - an_rpc . deadline ) <nl> + c = ActiveCall . new ( an_rpc . call , @ cq , <nl> + rpc_desc . marshal_proc , rpc_desc . unmarshal_proc ( : input ) , <nl> + an_rpc . deadline ) <nl> + mth = an_rpc . method . to_sym <nl> + [ c , mth ] <nl> end <nl> <nl> protected <nl> mmm a / src / ruby / pb / test / client . rb <nl> ppp b / src / ruby / pb / test / client . rb <nl> <nl> $ LOAD_PATH . unshift ( this_dir ) unless $ LOAD_PATH . include ? ( this_dir ) <nl> <nl> require ' optparse ' <nl> + require ' logger ' <nl> <nl> require ' grpc ' <nl> require ' googleauth ' <nl> <nl> <nl> AUTH_ENV = Google : : Auth : : CredentialsLoader : : ENV_VAR <nl> <nl> + # RubyLogger defines a logger for gRPC based on the standard ruby logger . <nl> + module RubyLogger <nl> + def logger <nl> + LOGGER <nl> + end <nl> + <nl> + LOGGER = Logger . new ( STDOUT ) <nl> + LOGGER . level = Logger : : INFO <nl> + end <nl> + <nl> + # GRPC is the general RPC module <nl> + module GRPC <nl> + # Inject the noop # logger if no module - level logger method has been injected . <nl> + extend RubyLogger <nl> + end <nl> + <nl> # AssertionError is use to indicate interop test failures . <nl> class AssertionError < RuntimeError ; end <nl> <nl> mmm a / src / ruby / pb / test / server . rb <nl> ppp b / src / ruby / pb / test / server . rb <nl> <nl> $ LOAD_PATH . unshift ( this_dir ) unless $ LOAD_PATH . include ? ( this_dir ) <nl> <nl> require ' forwardable ' <nl> + require ' logger ' <nl> require ' optparse ' <nl> <nl> require ' grpc ' <nl> <nl> require ' test / proto / messages ' <nl> require ' test / proto / test_services ' <nl> <nl> + # DebugIsTruncated extends the default Logger to truncate debug messages <nl> + class DebugIsTruncated < Logger <nl> + def debug ( s ) <nl> + super ( truncate ( s , 1024 ) ) <nl> + end <nl> + <nl> + # Truncates a given + text + after a given < tt > length < / tt > if + text + is longer than < tt > length < / tt > : <nl> + # <nl> + # ' Once upon a time in a world far far away ' . truncate ( 27 ) <nl> + # # = > " Once upon a time in a wo . . . " <nl> + # <nl> + # Pass a string or regexp < tt > : separator < / tt > to truncate + text + at a natural break : <nl> + # <nl> + # ' Once upon a time in a world far far away ' . truncate ( 27 , separator : ' ' ) <nl> + # # = > " Once upon a time in a . . . " <nl> + # <nl> + # ' Once upon a time in a world far far away ' . truncate ( 27 , separator : / \ s / ) <nl> + # # = > " Once upon a time in a . . . " <nl> + # <nl> + # The last characters will be replaced with the < tt > : omission < / tt > string ( defaults to " . . . " ) <nl> + # for a total length not exceeding < tt > length < / tt > : <nl> + # <nl> + # ' And they found that many people were sleeping better . ' . truncate ( 25 , omission : ' . . . ( continued ) ' ) <nl> + # # = > " And they f . . . ( continued ) " <nl> + def truncate ( s , truncate_at , options = { } ) <nl> + return s unless s . length > truncate_at <nl> + omission = options [ : omission ] | | ' . . . ' <nl> + with_extra_room = truncate_at - omission . length <nl> + stop = \ <nl> + if options [ : separator ] <nl> + rindex ( options [ : separator ] , with_extra_room ) | | with_extra_room <nl> + else <nl> + with_extra_room <nl> + end <nl> + " # { s [ 0 , stop ] } # { omission } " <nl> + end <nl> + end <nl> + <nl> + # RubyLogger defines a logger for gRPC based on the standard ruby logger . <nl> + module RubyLogger <nl> + def logger <nl> + LOGGER <nl> + end <nl> + <nl> + LOGGER = DebugIsTruncated . new ( STDOUT ) <nl> + LOGGER . level = Logger : : WARN <nl> + end <nl> + <nl> + # GRPC is the general RPC module <nl> + module GRPC <nl> + # Inject the noop # logger if no module - level logger method has been injected . <nl> + extend RubyLogger <nl> + end <nl> + <nl> # loads the certificates by the test server . <nl> def load_test_certs <nl> this_dir = File . expand_path ( File . dirname ( __FILE__ ) ) <nl> def unary_call ( simple_req , _call ) <nl> <nl> def streaming_input_call ( call ) <nl> sizes = call . each_remote_read . map { | x | x . payload . body . length } <nl> - sum = sizes . inject { | s , x | s + x } <nl> + sum = sizes . inject ( 0 ) { | s , x | s + x } <nl> StreamingInputCallResponse . new ( aggregated_payload_size : sum ) <nl> end <nl> <nl> mmm a / src / ruby / spec / pb / health / checker_spec . rb <nl> ppp b / src / ruby / spec / pb / health / checker_spec . rb <nl> <nl> require ' grpc / health / v1alpha / health ' <nl> require ' grpc / health / checker ' <nl> require ' open3 ' <nl> + require ' tmpdir ' <nl> <nl> def can_run_codegen_check <nl> system ( ' which grpc_ruby_plugin ' ) & & system ( ' which protoc ' ) <nl> deleted file mode 100755 <nl> index 0700763dc33 . . 00000000000 <nl> Binary files a / tools / http2_interop / http2_interop . test and / dev / null differ <nl> mmm a / tools / jenkins / run_interop . sh <nl> ppp b / tools / jenkins / run_interop . sh <nl> set - ex <nl> # Enter the gRPC repo root <nl> cd $ ( dirname $ 0 ) / . . / . . <nl> <nl> - tools / run_tests / run_interop_tests . py - l all - s all - - cloud_to_prod - - cloud_to_prod_auth - - use_docker - t - j 12 $ @ | | true <nl> + tools / run_tests / run_interop_tests . py - l all - s all - - cloud_to_prod - - cloud_to_prod_auth - - use_docker - - http2_interop - t - j 12 $ @ | | true <nl> mmm a / tools / run_tests / port_server . py <nl> ppp b / tools / run_tests / port_server . py <nl> <nl> # increment this number whenever making a change to ensure that <nl> # the changes are picked up by running CI servers <nl> # note that all changes must be backwards compatible <nl> - _MY_VERSION = 5 <nl> + _MY_VERSION = 7 <nl> <nl> <nl> if len ( sys . argv ) = = 2 and sys . argv [ 1 ] = = ' dump_version ' : <nl> mmm a / tools / run_tests / run_interop_tests . py <nl> ppp b / tools / run_tests / run_interop_tests . py <nl> def build_interop_image_jobspec ( language , tag = None ) : <nl> docker_image = docker_images . get ( str ( language ) ) ) <nl> jobs . append ( test_job ) <nl> <nl> - if args . http2_interop : <nl> + # TODO ( carl - mastrangelo ) : Currently prod TLS terminators aren ' t spec compliant . Reenable <nl> + # this once a better solution is in place . <nl> + if args . http2_interop and False : <nl> for test_case in _HTTP2_TEST_CASES : <nl> test_job = cloud_to_prod_jobspec ( http2Interop , test_case , <nl> docker_image = docker_images . get ( str ( http2Interop ) ) ) <nl> def build_interop_image_jobspec ( language , tag = None ) : <nl> <nl> if args . http2_interop : <nl> for test_case in _HTTP2_TEST_CASES : <nl> + if server_name = = " go " : <nl> + # TODO ( carl - mastrangelo ) : Reenable after https : / / github . com / grpc / grpc - go / issues / 434 <nl> + continue <nl> test_job = cloud_to_cloud_jobspec ( http2Interop , <nl> test_case , <nl> server_name , <nl> mmm a / tools / run_tests / run_tests . py <nl> ppp b / tools / run_tests / run_tests . py <nl> def _start_port_server ( port_server_port ) : <nl> running = False <nl> if running : <nl> current_version = int ( subprocess . check_output ( <nl> - [ sys . executable , ' tools / run_tests / port_server . py ' , ' dump_version ' ] ) ) <nl> + [ sys . executable , os . path . abspath ( ' tools / run_tests / port_server . py ' ) , <nl> + ' dump_version ' ] ) ) <nl> print ' my port server is version % d ' % current_version <nl> running = ( version > = current_version ) <nl> if not running : <nl> def _start_port_server ( port_server_port ) : <nl> fd , logfile = tempfile . mkstemp ( ) <nl> os . close ( fd ) <nl> print ' starting port_server , with log file % s ' % logfile <nl> - args = [ sys . executable , ' tools / run_tests / port_server . py ' , ' - p ' , ' % d ' % port_server_port , ' - l ' , logfile ] <nl> + args = [ sys . executable , os . path . abspath ( ' tools / run_tests / port_server . py ' ) , <nl> + ' - p ' , ' % d ' % port_server_port , ' - l ' , logfile ] <nl> env = dict ( os . environ ) <nl> env [ ' BUILD_ID ' ] = ' pleaseDontKillMeJenkins ' <nl> if platform . system ( ) = = ' Windows ' : <nl> + # Working directory of port server needs to be outside of Jenkins <nl> + # workspace to prevent file lock issues . <nl> + tempdir = tempfile . mkdtemp ( ) <nl> port_server = subprocess . Popen ( <nl> args , <nl> env = env , <nl> + cwd = tempdir , <nl> creationflags = 0x00000008 , # detached process <nl> close_fds = True ) <nl> else : <nl> | Merge github . com : grpc / grpc into new_op | grpc/grpc | 36da1380afab7c3f081e2008e521f0bd1d851358 | 2015-11-16T19:34:24Z |
mmm a / tensorflow / python / framework / ops . py <nl> ppp b / tensorflow / python / framework / ops . py <nl> def __float__ ( self ) : <nl> return float ( self . _numpy ( ) ) <nl> <nl> def __index__ ( self ) : <nl> - maybe_arr = self . _numpy ( ) <nl> - if isinstance ( maybe_arr , np . ndarray ) : <nl> - return maybe_arr . __index__ ( ) <nl> - return int ( maybe_arr ) # Must be a NumPy scalar . <nl> + return self . _numpy ( ) . __index__ ( ) <nl> <nl> def __bool__ ( self ) : <nl> return bool ( self . _numpy ( ) ) <nl> | EagerTensor . __index__ now fails for non - integral dtypes | tensorflow/tensorflow | 10f93e513d04320ca0a24cd8421bcf46283c887f | 2019-10-12T12:43:52Z |
mmm a / test / cpp / naming / create_private_dns_zone . sh <nl> ppp b / test / cpp / naming / create_private_dns_zone . sh <nl> <nl> <nl> set - ex <nl> <nl> - cd $ ( dirname $ 0 ) / . . / . . / . . <nl> + cd " $ ( dirname " $ 0 " ) / . . / . . / . . " <nl> <nl> gcloud alpha dns managed - zones create \ <nl> resolver - tests - version - 4 - grpctestingexp - zone - id \ <nl> mmm a / test / cpp / naming / private_dns_zone_init . sh <nl> ppp b / test / cpp / naming / private_dns_zone_init . sh <nl> <nl> <nl> set - ex <nl> <nl> - cd $ ( dirname $ 0 ) / . . / . . / . . <nl> + cd " $ ( dirname " $ 0 " ) / . . / . . / . . " <nl> <nl> gcloud dns record - sets transaction start - z = resolver - tests - version - 4 - grpctestingexp - zone - id <nl> <nl> mmm a / test / cpp / naming / resolver_component_tests_runner . sh <nl> ppp b / test / cpp / naming / resolver_component_tests_runner . sh <nl> <nl> set - ex <nl> <nl> # all command args required in this set order <nl> - FLAGS_test_bin_path = ` echo " $ 1 " | grep ' \ - - test_bin_path = ' | cut - d " = " - f 2 ` <nl> - FLAGS_dns_server_bin_path = ` echo " $ 2 " | grep ' \ - - dns_server_bin_path = ' | cut - d " = " - f 2 ` <nl> - FLAGS_records_config_path = ` echo " $ 3 " | grep ' \ - - records_config_path = ' | cut - d " = " - f 2 ` <nl> - FLAGS_test_dns_server_port = ` echo " $ 4 " | grep ' \ - - test_dns_server_port = ' | cut - d " = " - f 2 ` <nl> + FLAGS_test_bin_path = $ ( echo " $ 1 " | grep ' \ - - test_bin_path = ' | cut - d " = " - f 2 ) <nl> + FLAGS_dns_server_bin_path = $ ( echo " $ 2 " | grep ' \ - - dns_server_bin_path = ' | cut - d " = " - f 2 ) <nl> + FLAGS_records_config_path = $ ( echo " $ 3 " | grep ' \ - - records_config_path = ' | cut - d " = " - f 2 ) <nl> + FLAGS_test_dns_server_port = $ ( echo " $ 4 " | grep ' \ - - test_dns_server_port = ' | cut - d " = " - f 2 ) <nl> <nl> for cmd_arg in " $ FLAGS_test_bin_path " " $ FLAGS_dns_server_bin_path " " $ FLAGS_records_config_path " " $ FLAGS_test_dns_server_port " ; do <nl> if [ [ " $ cmd_arg " = = " " ] ] ; then <nl> if [ [ " $ GRPC_DNS_RESOLVER " ! = " " & & " $ GRPC_DNS_RESOLVER " ! = ares ] ] ; then <nl> fi <nl> export GRPC_DNS_RESOLVER = ares <nl> <nl> - " $ FLAGS_dns_server_bin_path " - - records_config_path = " $ FLAGS_records_config_path " - - port = " $ FLAGS_test_dns_server_port " 2 > & 1 > / dev / null & <nl> + " $ FLAGS_dns_server_bin_path " - - records_config_path = " $ FLAGS_records_config_path " - - port = " $ FLAGS_test_dns_server_port " > / dev / null 2 > & 1 & <nl> DNS_SERVER_PID = $ ! <nl> echo " Local DNS server started . PID : $ DNS_SERVER_PID " <nl> <nl> done <nl> <nl> if [ [ $ RETRY = = 1 ] ] ; then <nl> echo " FAILED TO START LOCAL DNS SERVER " <nl> - kill - SIGTERM $ DNS_SERVER_PID <nl> + kill - SIGTERM " $ DNS_SERVER_PID " <nl> wait <nl> exit 1 <nl> fi <nl> <nl> function terminate_all { <nl> echo " Received signal . Terminating $ ! and $ DNS_SERVER_PID " <nl> - kill - SIGTERM $ ! | | true <nl> - kill - SIGTERM $ DNS_SERVER_PID | | true <nl> + kill - SIGTERM " $ ! " | | true <nl> + kill - SIGTERM " $ DNS_SERVER_PID " | | true <nl> wait <nl> exit 1 <nl> } <nl> $ FLAGS_test_bin_path \ <nl> - - expected_addrs = ' 1 . 2 . 3 . 4 : 1234 , True ' \ <nl> - - expected_chosen_service_config = ' ' \ <nl> - - expected_lb_policy = ' ' \ <nl> - - - local_dns_server_address = 127 . 0 . 0 . 1 : $ FLAGS_test_dns_server_port & <nl> - wait $ ! | | EXIT_CODE = 1 <nl> + - - local_dns_server_address = " 127 . 0 . 0 . 1 : $ FLAGS_test_dns_server_port " & <nl> + wait " $ ! " | | EXIT_CODE = 1 <nl> <nl> $ FLAGS_test_bin_path \ <nl> - - target_name = ' srv - ipv4 - multi - target . resolver - tests - version - 4 . grpctestingexp . ' \ <nl> - - expected_addrs = ' 1 . 2 . 3 . 5 : 1234 , True ; 1 . 2 . 3 . 6 : 1234 , True ; 1 . 2 . 3 . 7 : 1234 , True ' \ <nl> - - expected_chosen_service_config = ' ' \ <nl> - - expected_lb_policy = ' ' \ <nl> - - - local_dns_server_address = 127 . 0 . 0 . 1 : $ FLAGS_test_dns_server_port & <nl> - wait $ ! | | EXIT_CODE = 1 <nl> + - - local_dns_server_address = " 127 . 0 . 0 . 1 : $ FLAGS_test_dns_server_port " & <nl> + wait " $ ! " | | EXIT_CODE = 1 <nl> <nl> $ FLAGS_test_bin_path \ <nl> - - target_name = ' srv - ipv6 - single - target . resolver - tests - version - 4 . grpctestingexp . ' \ <nl> - - expected_addrs = ' [ 2607 : f8b0 : 400a : 801 : : 1001 ] : 1234 , True ' \ <nl> - - expected_chosen_service_config = ' ' \ <nl> - - expected_lb_policy = ' ' \ <nl> - - - local_dns_server_address = 127 . 0 . 0 . 1 : $ FLAGS_test_dns_server_port & <nl> - wait $ ! | | EXIT_CODE = 1 <nl> + - - local_dns_server_address = " 127 . 0 . 0 . 1 : $ FLAGS_test_dns_server_port " & <nl> + wait " $ ! " | | EXIT_CODE = 1 <nl> <nl> $ FLAGS_test_bin_path \ <nl> - - target_name = ' srv - ipv6 - multi - target . resolver - tests - version - 4 . grpctestingexp . ' \ <nl> - - expected_addrs = ' [ 2607 : f8b0 : 400a : 801 : : 1002 ] : 1234 , True ; [ 2607 : f8b0 : 400a : 801 : : 1003 ] : 1234 , True ; [ 2607 : f8b0 : 400a : 801 : : 1004 ] : 1234 , True ' \ <nl> - - expected_chosen_service_config = ' ' \ <nl> - - expected_lb_policy = ' ' \ <nl> - - - local_dns_server_address = 127 . 0 . 0 . 1 : $ FLAGS_test_dns_server_port & <nl> - wait $ ! | | EXIT_CODE = 1 <nl> + - - local_dns_server_address = " 127 . 0 . 0 . 1 : $ FLAGS_test_dns_server_port " & <nl> + wait " $ ! " | | EXIT_CODE = 1 <nl> <nl> $ FLAGS_test_bin_path \ <nl> - - target_name = ' srv - ipv4 - simple - service - config . resolver - tests - version - 4 . grpctestingexp . ' \ <nl> - - expected_addrs = ' 1 . 2 . 3 . 4 : 1234 , True ' \ <nl> - - expected_chosen_service_config = ' { " loadBalancingPolicy " : " round_robin " , " methodConfig " : [ { " name " : [ { " method " : " Foo " , " service " : " SimpleService " , " waitForReady " : true } ] } ] } ' \ <nl> - - expected_lb_policy = ' round_robin ' \ <nl> - - - local_dns_server_address = 127 . 0 . 0 . 1 : $ FLAGS_test_dns_server_port & <nl> - wait $ ! | | EXIT_CODE = 1 <nl> + - - local_dns_server_address = " 127 . 0 . 0 . 1 : $ FLAGS_test_dns_server_port " & <nl> + wait " $ ! " | | EXIT_CODE = 1 <nl> <nl> $ FLAGS_test_bin_path \ <nl> - - target_name = ' ipv4 - no - srv - simple - service - config . resolver - tests - version - 4 . grpctestingexp . ' \ <nl> - - expected_addrs = ' 1 . 2 . 3 . 4 : 443 , False ' \ <nl> - - expected_chosen_service_config = ' { " loadBalancingPolicy " : " round_robin " , " methodConfig " : [ { " name " : [ { " method " : " Foo " , " service " : " NoSrvSimpleService " , " waitForReady " : true } ] } ] } ' \ <nl> - - expected_lb_policy = ' round_robin ' \ <nl> - - - local_dns_server_address = 127 . 0 . 0 . 1 : $ FLAGS_test_dns_server_port & <nl> - wait $ ! | | EXIT_CODE = 1 <nl> + - - local_dns_server_address = " 127 . 0 . 0 . 1 : $ FLAGS_test_dns_server_port " & <nl> + wait " $ ! " | | EXIT_CODE = 1 <nl> <nl> $ FLAGS_test_bin_path \ <nl> - - target_name = ' ipv4 - no - config - for - cpp . resolver - tests - version - 4 . grpctestingexp . ' \ <nl> - - expected_addrs = ' 1 . 2 . 3 . 4 : 443 , False ' \ <nl> - - expected_chosen_service_config = ' ' \ <nl> - - expected_lb_policy = ' ' \ <nl> - - - local_dns_server_address = 127 . 0 . 0 . 1 : $ FLAGS_test_dns_server_port & <nl> - wait $ ! | | EXIT_CODE = 1 <nl> + - - local_dns_server_address = " 127 . 0 . 0 . 1 : $ FLAGS_test_dns_server_port " & <nl> + wait " $ ! " | | EXIT_CODE = 1 <nl> <nl> $ FLAGS_test_bin_path \ <nl> - - target_name = ' ipv4 - cpp - config - has - zero - percentage . resolver - tests - version - 4 . grpctestingexp . ' \ <nl> - - expected_addrs = ' 1 . 2 . 3 . 4 : 443 , False ' \ <nl> - - expected_chosen_service_config = ' ' \ <nl> - - expected_lb_policy = ' ' \ <nl> - - - local_dns_server_address = 127 . 0 . 0 . 1 : $ FLAGS_test_dns_server_port & <nl> - wait $ ! | | EXIT_CODE = 1 <nl> + - - local_dns_server_address = " 127 . 0 . 0 . 1 : $ FLAGS_test_dns_server_port " & <nl> + wait " $ ! " | | EXIT_CODE = 1 <nl> <nl> $ FLAGS_test_bin_path \ <nl> - - target_name = ' ipv4 - second - language - is - cpp . resolver - tests - version - 4 . grpctestingexp . ' \ <nl> - - expected_addrs = ' 1 . 2 . 3 . 4 : 443 , False ' \ <nl> - - expected_chosen_service_config = ' { " loadBalancingPolicy " : " round_robin " , " methodConfig " : [ { " name " : [ { " method " : " Foo " , " service " : " CppService " , " waitForReady " : true } ] } ] } ' \ <nl> - - expected_lb_policy = ' round_robin ' \ <nl> - - - local_dns_server_address = 127 . 0 . 0 . 1 : $ FLAGS_test_dns_server_port & <nl> - wait $ ! | | EXIT_CODE = 1 <nl> + - - local_dns_server_address = " 127 . 0 . 0 . 1 : $ FLAGS_test_dns_server_port " & <nl> + wait " $ ! " | | EXIT_CODE = 1 <nl> <nl> $ FLAGS_test_bin_path \ <nl> - - target_name = ' ipv4 - config - with - percentages . resolver - tests - version - 4 . grpctestingexp . ' \ <nl> - - expected_addrs = ' 1 . 2 . 3 . 4 : 443 , False ' \ <nl> - - expected_chosen_service_config = ' { " loadBalancingPolicy " : " round_robin " , " methodConfig " : [ { " name " : [ { " method " : " Foo " , " service " : " AlwaysPickedService " , " waitForReady " : true } ] } ] } ' \ <nl> - - expected_lb_policy = ' round_robin ' \ <nl> - - - local_dns_server_address = 127 . 0 . 0 . 1 : $ FLAGS_test_dns_server_port & <nl> - wait $ ! | | EXIT_CODE = 1 <nl> + - - local_dns_server_address = " 127 . 0 . 0 . 1 : $ FLAGS_test_dns_server_port " & <nl> + wait " $ ! " | | EXIT_CODE = 1 <nl> <nl> $ FLAGS_test_bin_path \ <nl> - - target_name = ' srv - ipv4 - target - has - backend - and - balancer . resolver - tests - version - 4 . grpctestingexp . ' \ <nl> - - expected_addrs = ' 1 . 2 . 3 . 4 : 1234 , True ; 1 . 2 . 3 . 4 : 443 , False ' \ <nl> - - expected_chosen_service_config = ' ' \ <nl> - - expected_lb_policy = ' ' \ <nl> - - - local_dns_server_address = 127 . 0 . 0 . 1 : $ FLAGS_test_dns_server_port & <nl> - wait $ ! | | EXIT_CODE = 1 <nl> + - - local_dns_server_address = " 127 . 0 . 0 . 1 : $ FLAGS_test_dns_server_port " & <nl> + wait " $ ! " | | EXIT_CODE = 1 <nl> <nl> $ FLAGS_test_bin_path \ <nl> - - target_name = ' srv - ipv6 - target - has - backend - and - balancer . resolver - tests - version - 4 . grpctestingexp . ' \ <nl> - - expected_addrs = ' [ 2607 : f8b0 : 400a : 801 : : 1002 ] : 1234 , True ; [ 2607 : f8b0 : 400a : 801 : : 1002 ] : 443 , False ' \ <nl> - - expected_chosen_service_config = ' ' \ <nl> - - expected_lb_policy = ' ' \ <nl> - - - local_dns_server_address = 127 . 0 . 0 . 1 : $ FLAGS_test_dns_server_port & <nl> - wait $ ! | | EXIT_CODE = 1 <nl> + - - local_dns_server_address = " 127 . 0 . 0 . 1 : $ FLAGS_test_dns_server_port " & <nl> + wait " $ ! " | | EXIT_CODE = 1 <nl> <nl> $ FLAGS_test_bin_path \ <nl> - - target_name = ' ipv4 - config - causing - fallback - to - tcp . resolver - tests - version - 4 . grpctestingexp . ' \ <nl> - - expected_addrs = ' 1 . 2 . 3 . 4 : 443 , False ' \ <nl> - - expected_chosen_service_config = ' { " loadBalancingPolicy " : " round_robin " , " methodConfig " : [ { " name " : [ { " method " : " Foo " , " service " : " SimpleService " , " waitForReady " : true } ] } , { " name " : [ { " method " : " FooTwo " , " service " : " SimpleService " , " waitForReady " : true } ] } , { " name " : [ { " method " : " FooThree " , " service " : " SimpleService " , " waitForReady " : true } ] } , { " name " : [ { " method " : " FooFour " , " service " : " SimpleService " , " waitForReady " : true } ] } , { " name " : [ { " method " : " FooFive " , " service " : " SimpleService " , " waitForReady " : true } ] } , { " name " : [ { " method " : " FooSix " , " service " : " SimpleService " , " waitForReady " : true } ] } , { " name " : [ { " method " : " FooSeven " , " service " : " SimpleService " , " waitForReady " : true } ] } , { " name " : [ { " method " : " FooEight " , " service " : " SimpleService " , " waitForReady " : true } ] } , { " name " : [ { " method " : " FooNine " , " service " : " SimpleService " , " waitForReady " : true } ] } , { " name " : [ { " method " : " FooTen " , " service " : " SimpleService " , " waitForReady " : true } ] } , { " name " : [ { " method " : " FooEleven " , " service " : " SimpleService " , " waitForReady " : true } ] } , { " name " : [ { " method " : " FooTwelve " , " service " : " SimpleService " , " waitForReady " : true } ] } , { " name " : [ { " method " : " FooTwelve " , " service " : " SimpleService " , " waitForReady " : true } ] } , { " name " : [ { " method " : " FooTwelve " , " service " : " SimpleService " , " waitForReady " : true } ] } , { " name " : [ { " method " : " FooTwelve " , " service " : " SimpleService " , " waitForReady " : true } ] } ] } ' \ <nl> - - expected_lb_policy = ' ' \ <nl> - - - local_dns_server_address = 127 . 0 . 0 . 1 : $ FLAGS_test_dns_server_port & <nl> - wait $ ! | | EXIT_CODE = 1 <nl> + - - local_dns_server_address = " 127 . 0 . 0 . 1 : $ FLAGS_test_dns_server_port " & <nl> + wait " $ ! " | | EXIT_CODE = 1 <nl> <nl> - kill - SIGTERM $ DNS_SERVER_PID | | true <nl> + kill - SIGTERM " $ DNS_SERVER_PID " | | true <nl> wait <nl> exit $ EXIT_CODE <nl> mmm a / test / cpp / naming / resolver_gce_integration_tests_runner . sh <nl> ppp b / test / cpp / naming / resolver_gce_integration_tests_runner . sh <nl> elif [ [ " $ GRPC_DNS_RESOLVER " ! = ares ] ] ; then <nl> exit 1 <nl> fi <nl> <nl> - cd $ ( dirname $ 0 ) / . . / . . / . . <nl> + cd " $ ( dirname " $ 0 " ) / . . / . . / . . " <nl> <nl> if [ [ " $ CONFIG " = = " " ] ] ; then <nl> export CONFIG = opt <nl> mmm a / tools / openssl / use_openssl . sh <nl> ppp b / tools / openssl / use_openssl . sh <nl> <nl> <nl> set - ex <nl> <nl> - cd $ ( dirname $ 0 ) / . . / . . <nl> + cd " $ ( dirname " $ 0 " ) / . . / . . " <nl> set root = ` pwd ` <nl> CC = $ { CC : - cc } <nl> <nl> | Regenerate projects | grpc/grpc | 37629bacf5cff0bfde844e04e682a8a534b84f2c | 2018-02-07T19:45:34Z |
mmm a / docs / source / optim . rst <nl> ppp b / docs / source / optim . rst <nl> Algorithms <nl> : members : <nl> . . autoclass : : SGD <nl> : members : <nl> + <nl> + How to adjust Learning Rate <nl> + mmmmmmmmmmmmmmmmmmmmmmmmmmm <nl> + <nl> + : mod : ` torch . optim . lr_scheduler ` provides several methods to adjust the learning <nl> + rate based on the number of epoches . : class : ` torch . optim . lr_scheduler . ReduceLROnPlateau ` <nl> + allows dynamic learning rate reducing based on some validation measurements . <nl> + <nl> + . . autoclass : : torch . optim . lr_scheduler . LambdaLR <nl> + : members : <nl> + . . autoclass : : torch . optim . lr_scheduler . StepLR <nl> + : members : <nl> + . . autoclass : : torch . optim . lr_scheduler . MultiStepLR <nl> + : members : <nl> + . . autoclass : : torch . optim . lr_scheduler . ExponentialLR <nl> + : members : <nl> + . . autoclass : : torch . optim . lr_scheduler . ReduceLROnPlateau <nl> + : members : <nl> mmm a / test / test_optim . py <nl> ppp b / test / test_optim . py <nl> <nl> import torch <nl> import torch . optim as optim <nl> import torch . legacy . optim as old_optim <nl> + import torch . nn . functional as F <nl> + from torch . optim import SGD <nl> from torch . autograd import Variable <nl> from torch import sparse <nl> - <nl> + from torch . optim . lr_scheduler import LambdaLR , StepLR , MultiStepLR , ExponentialLR , ReduceLROnPlateau <nl> from common import TestCase , run_tests <nl> <nl> <nl> def test_invalid_param_type ( self ) : <nl> optim . SGD ( Variable ( torch . randn ( 5 , 5 ) ) , lr = 3 ) <nl> <nl> <nl> + class SchedulerTestNet ( torch . nn . Module ) : <nl> + def __init__ ( self ) : <nl> + super ( SchedulerTestNet , self ) . __init__ ( ) <nl> + self . conv1 = torch . nn . Conv2d ( 1 , 1 , 1 ) <nl> + self . conv2 = torch . nn . Conv2d ( 1 , 1 , 1 ) <nl> + <nl> + def forward ( self , x ) : <nl> + return self . conv2 ( F . relu ( self . conv1 ( x ) ) ) <nl> + <nl> + <nl> + class TestLRScheduler ( TestCase ) : <nl> + def setUp ( self ) : <nl> + self . net = SchedulerTestNet ( ) <nl> + self . opt = SGD ( <nl> + [ { ' params ' : self . net . conv1 . parameters ( ) } , { ' params ' : self . net . conv2 . parameters ( ) , ' lr ' : 0 . 5 } ] , <nl> + lr = 0 . 05 ) <nl> + <nl> + def test_step_lr ( self ) : <nl> + # lr = 0 . 05 if epoch < 3 <nl> + # lr = 0 . 005 if 30 < = epoch < 6 <nl> + # lr = 0 . 0005 if epoch > = 9 <nl> + single_targets = [ 0 . 05 ] * 3 + [ 0 . 005 ] * 3 + [ 0 . 0005 ] * 3 + [ 0 . 00005 ] * 3 <nl> + targets = [ single_targets , list ( map ( lambda x : x * 10 , single_targets ) ) ] <nl> + scheduler = StepLR ( self . opt , gamma = 0 . 1 , step_size = 3 ) <nl> + epochs = 10 <nl> + self . _test ( scheduler , targets , epochs ) <nl> + <nl> + def test_multi_step_lr ( self ) : <nl> + # lr = 0 . 05 if epoch < 2 <nl> + # lr = 0 . 005 if 2 < = epoch < 5 <nl> + # lr = 0 . 0005 if epoch < 9 <nl> + # lr = 0 . 00005 if epoch > = 9 <nl> + single_targets = [ 0 . 05 ] * 2 + [ 0 . 005 ] * 3 + [ 0 . 0005 ] * 4 + [ 0 . 00005 ] * 3 <nl> + targets = [ single_targets , list ( map ( lambda x : x * 10 , single_targets ) ) ] <nl> + scheduler = MultiStepLR ( self . opt , gamma = 0 . 1 , milestones = [ 2 , 5 , 9 ] ) <nl> + epochs = 10 <nl> + self . _test ( scheduler , targets , epochs ) <nl> + <nl> + def test_exp_lr ( self ) : <nl> + single_targets = [ 0 . 05 * ( 0 . 9 * * x ) for x in range ( 10 ) ] <nl> + targets = [ single_targets , list ( map ( lambda x : x * 10 , single_targets ) ) ] <nl> + scheduler = ExponentialLR ( self . opt , gamma = 0 . 9 ) <nl> + epochs = 10 <nl> + self . _test ( scheduler , targets , epochs ) <nl> + <nl> + def test_reduce_lr_on_plateau1 ( self ) : <nl> + for param_group in self . opt . param_groups : <nl> + param_group [ ' lr ' ] = 0 . 5 <nl> + targets = [ [ 0 . 5 ] * 20 ] <nl> + metrics = [ 10 - i * 0 . 0167 for i in range ( 20 ) ] <nl> + scheduler = ReduceLROnPlateau ( self . opt , threshold_mode = ' abs ' , mode = ' min ' , <nl> + threshold = 0 . 01 , patience = 5 , cooldown = 5 ) <nl> + epochs = 10 <nl> + self . _test_reduce_lr_on_plateau ( scheduler , targets , metrics , epochs ) <nl> + <nl> + def test_reduce_lr_on_plateau2 ( self ) : <nl> + for param_group in self . opt . param_groups : <nl> + param_group [ ' lr ' ] = 0 . 5 <nl> + targets = [ [ 0 . 5 ] * 6 + [ 0 . 05 ] * 7 + [ 0 . 005 ] * 7 + [ 0 . 0005 ] * 2 ] <nl> + metrics = [ 10 - i * 0 . 0165 for i in range ( 22 ) ] <nl> + scheduler = ReduceLROnPlateau ( self . opt , patience = 5 , cooldown = 0 , threshold_mode = ' abs ' , <nl> + mode = ' min ' , threshold = 0 . 1 ) <nl> + epochs = 22 <nl> + self . _test_reduce_lr_on_plateau ( scheduler , targets , metrics , epochs ) <nl> + <nl> + def test_reduce_lr_on_plateau3 ( self ) : <nl> + for param_group in self . opt . param_groups : <nl> + param_group [ ' lr ' ] = 0 . 5 <nl> + targets = [ [ 0 . 5 ] * ( 2 + 6 ) + [ 0 . 05 ] * ( 5 + 6 ) + [ 0 . 005 ] * 4 ] <nl> + metrics = [ - 0 . 8 ] * 2 + [ - 0 . 234 ] * 20 <nl> + scheduler = ReduceLROnPlateau ( self . opt , mode = ' max ' , patience = 5 , cooldown = 5 , <nl> + threshold_mode = ' abs ' ) <nl> + epochs = 22 <nl> + self . _test_reduce_lr_on_plateau ( scheduler , targets , metrics , epochs ) <nl> + <nl> + def test_reduce_lr_on_plateau4 ( self ) : <nl> + for param_group in self . opt . param_groups : <nl> + param_group [ ' lr ' ] = 0 . 5 <nl> + targets = [ [ 0 . 5 ] * 20 ] <nl> + metrics = [ 1 . 5 * ( 1 . 025 * * i ) for i in range ( 20 ) ] # 1 . 025 > 1 . 1 * * 0 . 25 <nl> + scheduler = ReduceLROnPlateau ( self . opt , mode = ' max ' , patience = 3 , <nl> + threshold_mode = ' rel ' , threshold = 0 . 1 ) <nl> + epochs = 20 <nl> + self . _test_reduce_lr_on_plateau ( scheduler , targets , metrics , epochs ) <nl> + <nl> + def test_reduce_lr_on_plateau5 ( self ) : <nl> + for param_group in self . opt . param_groups : <nl> + param_group [ ' lr ' ] = 0 . 5 <nl> + targets = [ [ 0 . 5 ] * 6 + [ 0 . 05 ] * ( 5 + 6 ) + [ 0 . 005 ] * 4 ] <nl> + metrics = [ 1 . 5 * ( 1 . 005 * * i ) for i in range ( 20 ) ] <nl> + scheduler = ReduceLROnPlateau ( self . opt , mode = ' max ' , threshold_mode = ' rel ' , <nl> + threshold = 0 . 1 , patience = 5 , cooldown = 5 ) <nl> + epochs = 20 <nl> + self . _test_reduce_lr_on_plateau ( scheduler , targets , metrics , epochs ) <nl> + <nl> + def test_reduce_lr_on_plateau6 ( self ) : <nl> + for param_group in self . opt . param_groups : <nl> + param_group [ ' lr ' ] = 0 . 5 <nl> + targets = [ [ 0 . 5 ] * 20 ] <nl> + metrics = [ 1 . 5 * ( 0 . 85 * * i ) for i in range ( 20 ) ] <nl> + scheduler = ReduceLROnPlateau ( self . opt , mode = ' min ' , threshold_mode = ' rel ' , <nl> + threshold = 0 . 1 ) <nl> + epochs = 20 <nl> + self . _test_reduce_lr_on_plateau ( scheduler , targets , metrics , epochs ) <nl> + <nl> + def test_reduce_lr_on_plateau7 ( self ) : <nl> + for param_group in self . opt . param_groups : <nl> + param_group [ ' lr ' ] = 0 . 5 <nl> + targets = [ [ 0 . 5 ] * 6 + [ 0 . 05 ] * ( 5 + 6 ) + [ 0 . 005 ] * 4 ] <nl> + metrics = [ 1 ] * 7 + [ 0 . 6 ] + [ 0 . 5 ] * 12 <nl> + scheduler = ReduceLROnPlateau ( self . opt , mode = ' min ' , threshold_mode = ' rel ' , <nl> + threshold = 0 . 1 , patience = 5 , cooldown = 5 ) <nl> + epochs = 20 <nl> + self . _test_reduce_lr_on_plateau ( scheduler , targets , metrics , epochs ) <nl> + <nl> + def test_reduce_lr_on_plateau8 ( self ) : <nl> + for param_group in self . opt . param_groups : <nl> + param_group [ ' lr ' ] = 0 . 5 <nl> + targets = [ [ 0 . 5 ] * 6 + [ 0 . 4 ] * 14 , [ 0 . 5 ] * 6 + [ 0 . 3 ] * 14 ] <nl> + metrics = [ 1 . 5 * ( 1 . 005 * * i ) for i in range ( 20 ) ] <nl> + scheduler = ReduceLROnPlateau ( self . opt , mode = ' max ' , threshold_mode = ' rel ' , min_lr = [ 0 . 4 , 0 . 3 ] , <nl> + threshold = 0 . 1 , patience = 5 , cooldown = 5 ) <nl> + epochs = 20 <nl> + self . _test_reduce_lr_on_plateau ( scheduler , targets , metrics , epochs ) <nl> + <nl> + def test_lambda_lr ( self ) : <nl> + self . opt . param_groups [ 0 ] [ ' lr ' ] = 0 . 05 <nl> + self . opt . param_groups [ 1 ] [ ' lr ' ] = 0 . 4 <nl> + targets = [ [ 0 . 05 * ( 0 . 9 * * x ) for x in range ( 10 ) ] , [ 0 . 4 * ( 0 . 8 * * x ) for x in range ( 10 ) ] ] <nl> + scheduler = LambdaLR ( self . opt , <nl> + lr_lambda = [ lambda x1 : 0 . 9 * * x1 , lambda x2 : 0 . 8 * * x2 ] ) <nl> + epochs = 10 <nl> + self . _test ( scheduler , targets , epochs ) <nl> + <nl> + def _test ( self , scheduler , targets , epochs = 10 ) : <nl> + for epoch in range ( epochs ) : <nl> + scheduler . step ( epoch ) <nl> + for param_group , target in zip ( self . opt . param_groups , targets ) : <nl> + self . assertAlmostEqual ( target [ epoch ] , param_group [ ' lr ' ] , <nl> + msg = ' LR is wrong in epoch { } : expected { } , got { } ' . format ( <nl> + epoch , target [ epoch ] , param_group [ ' lr ' ] ) , delta = 1e - 5 ) <nl> + <nl> + def _test_reduce_lr_on_plateau ( self , scheduler , targets , metrics , epochs = 10 , verbose = False ) : <nl> + for epoch in range ( epochs ) : <nl> + scheduler . step ( metrics [ epoch ] ) <nl> + if verbose : <nl> + print ( ' epoch { } : \ tlr = { } ' . format ( epoch , self . opt . param_groups [ 0 ] [ ' lr ' ] ) ) <nl> + for param_group , target in zip ( self . opt . param_groups , targets ) : <nl> + self . assertAlmostEqual ( target [ epoch ] , param_group [ ' lr ' ] , <nl> + msg = ' LR is wrong in epoch { } : expected { } , got { } ' . format ( <nl> + epoch , target [ epoch ] , param_group [ ' lr ' ] ) , delta = 1e - 5 ) <nl> + <nl> if __name__ = = ' __main__ ' : <nl> run_tests ( ) <nl> new file mode 100644 <nl> index 000000000000 . . 4069774e453b <nl> mmm / dev / null <nl> ppp b / torch / optim / lr_scheduler . py <nl> <nl> + from bisect import bisect_right <nl> + from . optimizer import Optimizer <nl> + <nl> + <nl> + class _LRScheduler ( object ) : <nl> + def __init__ ( self , optimizer , last_epoch = - 1 ) : <nl> + if not isinstance ( optimizer , Optimizer ) : <nl> + raise TypeError ( ' { } is not an Optimizer ' . format ( <nl> + type ( optimizer ) . __name__ ) ) <nl> + self . optimizer = optimizer <nl> + if last_epoch = = - 1 : <nl> + for group in optimizer . param_groups : <nl> + group . setdefault ( ' initial_lr ' , group [ ' lr ' ] ) <nl> + else : <nl> + for i , group in enumerate ( optimizer . param_groups ) : <nl> + if ' initial_lr ' not in group : <nl> + raise KeyError ( " param ' initial_lr ' is not specified " <nl> + " in param_groups [ { } ] when resuming an optimizer " . format ( i ) ) <nl> + self . base_lrs = list ( map ( lambda group : group [ ' initial_lr ' ] , optimizer . param_groups ) ) <nl> + self . step ( last_epoch + 1 ) <nl> + self . last_epoch = last_epoch <nl> + <nl> + def get_lr ( self ) : <nl> + raise NotImplementedError <nl> + <nl> + def step ( self , epoch = None ) : <nl> + if epoch is None : <nl> + epoch = self . last_epoch + 1 <nl> + self . last_epoch = epoch <nl> + for param_group , lr in zip ( self . optimizer . param_groups , self . get_lr ( ) ) : <nl> + param_group [ ' lr ' ] = lr <nl> + <nl> + <nl> + class LambdaLR ( _LRScheduler ) : <nl> + " " " Sets the learning rate of each parameter group to the initial lr <nl> + times a given function . When last_epoch = - 1 , sets initial lr as lr . <nl> + <nl> + Args : <nl> + optimizer ( Optimizer ) : Wrapped optimizer . <nl> + lr_lambda ( function or list ) : A function which computes a multiplicative <nl> + factor given an integer parameter epoch , or a list of such functions , <nl> + one for each group in optimizer . param_groups . <nl> + last_epoch ( int ) : The index of last epoch . Default : - 1 . <nl> + <nl> + Example : <nl> + > > > # Assuming optimizer has two groups . <nl> + > > > lambda1 = lambda epoch : epoch / / 30 <nl> + > > > lambda2 = lambda epoch : 0 . 95 * * epoch <nl> + > > > scheduler = LambdaLR ( optimizer , lr_lambda = [ lambda1 , lambda2 ] ) <nl> + > > > for epoch in range ( 100 ) : <nl> + > > > scheduler . step ( ) <nl> + > > > train ( . . . ) <nl> + > > > validate ( . . . ) <nl> + " " " <nl> + def __init__ ( self , optimizer , lr_lambda , last_epoch = - 1 ) : <nl> + self . optimizer = optimizer <nl> + if not isinstance ( lr_lambda , list ) and not isinstance ( lr_lambda , tuple ) : <nl> + self . lr_lambdas = [ lr_lambda ] * len ( optimizer . param_groups ) <nl> + else : <nl> + if len ( lr_lambda ) ! = len ( optimizer . param_groups ) : <nl> + raise ValueError ( " Expected { } lr_lambdas , but got { } " . format ( <nl> + len ( optimizer . param_groups ) , len ( lr_lambda ) ) ) <nl> + self . lr_lambdas = list ( lr_lambda ) <nl> + self . last_epoch = last_epoch <nl> + super ( LambdaLR , self ) . __init__ ( optimizer , last_epoch ) <nl> + <nl> + def get_lr ( self ) : <nl> + return [ base_lr * lmbda ( self . last_epoch ) <nl> + for lmbda , base_lr in zip ( self . lr_lambdas , self . base_lrs ) ] <nl> + <nl> + <nl> + class StepLR ( _LRScheduler ) : <nl> + " " " Sets the learning rate of each parameter group to the initial lr <nl> + decayed by gamma every step_size epochs . When last_epoch = - 1 , sets <nl> + initial lr as lr . <nl> + <nl> + Args : <nl> + optimizer ( Optimizer ) : Wrapped optimizer . <nl> + step_size ( int ) : Period of learning rate decay . <nl> + gamma ( float ) : Multiplicative factor of learning rate decay . <nl> + Default : - 0 . 1 . <nl> + last_epoch ( int ) : The index of last epoch . Default : - 1 . <nl> + <nl> + Example : <nl> + > > > # Assuming optimizer uses lr = 0 . 5 for all groups <nl> + > > > # lr = 0 . 05 if epoch < 30 <nl> + > > > # lr = 0 . 005 if 30 < = epoch < 60 <nl> + > > > # lr = 0 . 0005 if 60 < = epoch < 90 <nl> + > > > # . . . <nl> + > > > scheduler = StepLR ( optimizer , step_size = 30 , gamma = 0 . 1 ) <nl> + > > > for epoch in range ( 100 ) : <nl> + > > > scheduler . step ( ) <nl> + > > > train ( . . . ) <nl> + > > > validate ( . . . ) <nl> + " " " <nl> + <nl> + def __init__ ( self , optimizer , step_size , gamma = 0 . 1 , last_epoch = - 1 ) : <nl> + self . step_size = step_size <nl> + self . gamma = gamma <nl> + super ( StepLR , self ) . __init__ ( optimizer , last_epoch ) <nl> + <nl> + def get_lr ( self ) : <nl> + return [ base_lr * self . gamma * * ( self . last_epoch / / self . step_size ) <nl> + for base_lr in self . base_lrs ] <nl> + <nl> + <nl> + class MultiStepLR ( _LRScheduler ) : <nl> + " " " Set the learning rate of each parameter group to the initial lr decayed <nl> + by gamma once the number of epoch reaches one of the milestones . When <nl> + last_epoch = - 1 , sets initial lr as lr . <nl> + <nl> + Args : <nl> + optimizer ( Optimizer ) : Wrapped optimizer . <nl> + milestones ( list ) : List of epoch indices . Must be increasing . <nl> + gamma ( float ) : Multiplicative factor of learning rate decay . <nl> + Default : - 0 . 1 . <nl> + last_epoch ( int ) : The index of last epoch . Default : - 1 . <nl> + <nl> + Example : <nl> + > > > # Assuming optimizer uses lr = 0 . 5 for all groups <nl> + > > > # lr = 0 . 05 if epoch < 30 <nl> + > > > # lr = 0 . 005 if 30 < = epoch < 80 <nl> + > > > # lr = 0 . 0005 if epoch > = 80 <nl> + > > > scheduler = MultiStepLR ( optimizer , milestones = [ 30 , 80 ] , gamma = 0 . 1 ) <nl> + > > > for epoch in range ( 100 ) : <nl> + > > > scheduler . step ( ) <nl> + > > > train ( . . . ) <nl> + > > > validate ( . . . ) <nl> + " " " <nl> + <nl> + def __init__ ( self , optimizer , milestones , gamma = 0 . 1 , last_epoch = - 1 ) : <nl> + if not list ( milestones ) = = sorted ( milestones ) : <nl> + raise ValueError ( ' Milestones should be a list of ' <nl> + ' increasing integers . Got { } ' , milestones ) <nl> + self . milestones = milestones <nl> + self . gamma = gamma <nl> + super ( MultiStepLR , self ) . __init__ ( optimizer , last_epoch ) <nl> + <nl> + def get_lr ( self ) : <nl> + return [ base_lr * self . gamma * * bisect_right ( self . milestones , self . last_epoch ) <nl> + for base_lr in self . base_lrs ] <nl> + <nl> + <nl> + class ExponentialLR ( _LRScheduler ) : <nl> + " " " Set the learning rate of each parameter group to the initial lr decayed <nl> + by gamma every epoch . When last_epoch = - 1 , sets initial lr as lr . <nl> + <nl> + Args : <nl> + optimizer ( Optimizer ) : Wrapped optimizer . <nl> + gamma ( float ) : Multiplicative factor of learning rate decay . <nl> + last_epoch ( int ) : The index of last epoch . Default : - 1 . <nl> + " " " <nl> + <nl> + def __init__ ( self , optimizer , gamma , last_epoch = - 1 ) : <nl> + self . gamma = gamma <nl> + super ( ExponentialLR , self ) . __init__ ( optimizer , last_epoch ) <nl> + <nl> + def get_lr ( self ) : <nl> + return [ base_lr * self . gamma * * self . last_epoch <nl> + for base_lr in self . base_lrs ] <nl> + <nl> + <nl> + class ReduceLROnPlateau ( object ) : <nl> + " " " Reduce learning rate when a metric has stopped improving . <nl> + Models often benefit from reducing the learning rate by a factor <nl> + of 2 - 10 once learning stagnates . This scheduler reads a metrics <nl> + quantity and if no improvement is seen for a ' patience ' number <nl> + of epochs , the learning rate is reduced . <nl> + <nl> + Args : <nl> + optimizer ( Optimizer ) : Wrapped optimizer . <nl> + mode ( str ) : One of ` min ` , ` max ` . In ` min ` mode , lr will <nl> + be reduced when the quantity monitored has stopped <nl> + decreasing ; in ` max ` mode it will be reduced when the <nl> + quantity monitored has stopped increasing . Default : ' min ' . <nl> + factor ( float ) : Factor by which the learning rate will be <nl> + reduced . new_lr = lr * factor . Default : 0 . 1 . <nl> + patience ( int ) : Number of epochs with no improvement after <nl> + which learning rate will be reduced . Default : 10 . <nl> + verbose ( bool ) : If True , prints a message to stdout for <nl> + each update . Default : False . <nl> + threshold ( float ) : Threshold for measuring the new optimum , <nl> + to only focus on significant changes . Default : 1e - 4 . <nl> + threshold_mode ( str ) : One of ` rel ` , ` abs ` . In ` rel ` mode , <nl> + dynamic_threshold = best * ( 1 + threshold ) in ' max ' <nl> + mode or best * ( 1 - threshold ) in ` min ` mode . <nl> + In ` abs ` mode , dynamic_threshold = best + threshold in <nl> + ` max ` mode or best - threshold in ` min ` mode . Default : ' rel ' . <nl> + cooldown ( int ) : Number of epochs to wait before resuming <nl> + normal operation after lr has been reduced . Default : 0 . <nl> + min_lr ( float or list ) : A scalar or a list of scalars . A <nl> + lower bound on the learning rate of all param groups <nl> + or each group respectively . Default : 0 . <nl> + eps ( float ) : Minimal decay applied to lr . If the difference <nl> + between new and old lr is smaller than eps , the update is <nl> + ignored . Default : 1e - 8 . <nl> + <nl> + Example : <nl> + > > > optimizer = torch . optim . SGD ( model . parameters ( ) , lr = 0 . 1 , momentum = 0 . 9 ) <nl> + > > > scheduler = torch . optim . ReduceLROnPlateau ( optimizer , ' min ' ) <nl> + > > > for epoch in range ( 10 ) : <nl> + > > > train ( . . . ) <nl> + > > > val_loss = validate ( . . . ) <nl> + > > > # Note that step should be called after validate ( ) <nl> + > > > scheduler . step ( val_loss ) <nl> + " " " <nl> + <nl> + def __init__ ( self , optimizer , mode = ' min ' , factor = 0 . 1 , patience = 10 , <nl> + verbose = False , threshold = 1e - 4 , threshold_mode = ' rel ' , <nl> + cooldown = 0 , min_lr = 0 , eps = 1e - 8 ) : <nl> + <nl> + if factor > = 1 . 0 : <nl> + raise ValueError ( ' Factor should be < 1 . 0 . ' ) <nl> + self . factor = factor <nl> + <nl> + if not isinstance ( optimizer , Optimizer ) : <nl> + raise TypeError ( ' { } is not an Optimizer ' . format ( <nl> + type ( optimizer ) . __name__ ) ) <nl> + self . optimizer = optimizer <nl> + <nl> + if isinstance ( min_lr , list ) or isinstance ( min_lr , tuple ) : <nl> + if len ( min_lr ) ! = len ( optimizer . param_groups ) : <nl> + raise ValueError ( " expected { } min_lrs , got { } " . format ( <nl> + len ( optimizer . param_groups ) , len ( min_lr ) ) ) <nl> + self . min_lrs = list ( min_lr ) <nl> + else : <nl> + self . min_lrs = [ min_lr ] * len ( optimizer . param_groups ) <nl> + <nl> + self . patience = patience <nl> + self . verbose = verbose <nl> + self . cooldown = cooldown <nl> + self . cooldown_counter = 0 <nl> + self . mode = mode <nl> + self . threshold = threshold <nl> + self . threshold_mode = threshold_mode <nl> + self . best = None <nl> + self . num_bad_epochs = None <nl> + self . mode_worse = None # the worse value for the chosen mode <nl> + self . is_better = None <nl> + self . eps = eps <nl> + self . last_epoch = - 1 <nl> + self . _init_is_better ( mode = mode , threshold = threshold , <nl> + threshold_mode = threshold_mode ) <nl> + self . _reset ( ) <nl> + <nl> + def _reset ( self ) : <nl> + " " " Resets num_bad_epochs counter and cooldown counter . " " " <nl> + self . best = self . mode_worse <nl> + self . cooldown_counter = 0 <nl> + self . num_bad_epochs = 0 <nl> + <nl> + def step ( self , metrics , epoch = None ) : <nl> + current = metrics <nl> + if epoch is None : <nl> + epoch = self . last_epoch = self . last_epoch + 1 <nl> + self . last_epoch = epoch <nl> + <nl> + if self . is_better ( current , self . best ) : <nl> + self . best = current <nl> + self . num_bad_epochs = 0 <nl> + else : <nl> + self . num_bad_epochs + = 1 <nl> + <nl> + if self . in_cooldown : <nl> + self . cooldown_counter - = 1 <nl> + self . num_bad_epochs = 0 # ignore any bad epochs in cooldown <nl> + <nl> + if self . num_bad_epochs > self . patience : <nl> + self . _reduce_lr ( epoch ) <nl> + self . cooldown_counter = self . cooldown <nl> + self . num_bad_epochs = 0 <nl> + <nl> + def _reduce_lr ( self , epoch ) : <nl> + for i , param_group in enumerate ( self . optimizer . param_groups ) : <nl> + old_lr = float ( param_group [ ' lr ' ] ) <nl> + new_lr = max ( old_lr * self . factor , self . min_lrs [ i ] ) <nl> + if old_lr - new_lr > self . eps : <nl> + param_group [ ' lr ' ] = new_lr <nl> + if self . verbose : <nl> + print ( ' Epoch { : 5d } : reducing learning rate ' <nl> + ' of group { } to { : . 4e } . ' . format ( epoch , i , new_lr ) ) <nl> + <nl> + @ property <nl> + def in_cooldown ( self ) : <nl> + return self . cooldown_counter > 0 <nl> + <nl> + def _init_is_better ( self , mode , threshold , threshold_mode ) : <nl> + if mode not in { ' min ' , ' max ' } : <nl> + raise ValueError ( ' mode ' + mode + ' is unknown ! ' ) <nl> + if threshold_mode not in { ' rel ' , ' abs ' } : <nl> + raise ValueError ( ' threshold mode ' + mode + ' is unknown ! ' ) <nl> + if mode = = ' min ' and threshold_mode = = ' rel ' : <nl> + rel_epsilon = 1 . - threshold <nl> + self . is_better = lambda a , best : a < best * rel_epsilon <nl> + self . mode_worse = float ( ' Inf ' ) <nl> + elif mode = = ' min ' and threshold_mode = = ' abs ' : <nl> + self . is_better = lambda a , best : a < best - threshold <nl> + self . mode_worse = float ( ' Inf ' ) <nl> + elif mode = = ' max ' and threshold_mode = = ' rel ' : <nl> + rel_epsilon = threshold + 1 . <nl> + self . is_better = lambda a , best : a > best * rel_epsilon <nl> + self . mode_worse = - float ( ' Inf ' ) <nl> + else : # mode = = ' max ' and epsilon_mode = = ' abs ' : <nl> + self . is_better = lambda a , best : a > best + threshold <nl> + self . mode_worse = - float ( ' Inf ' ) <nl> | add learning rate schedulers ( ) | pytorch/pytorch | 630af4d7d8812efa43a01d938f0fc53c47802b0b | 2017-05-25T20:21:43Z |
mmm a / DEPS <nl> ppp b / DEPS <nl> vars = { <nl> ' download_mips_toolchain ' : False , <nl> ' check_v8_header_includes ' : False , <nl> <nl> + # GN CIPD package version . <nl> + ' gn_version ' : ' git_revision : 0790d3043387c762a6bacb1ae0a9ebe883188ab2 ' , <nl> + <nl> # luci - go CIPD package version . <nl> ' luci_go ' : ' git_revision : 25958d48e89e980e2a97daeddc977fb5e2e1fb8c ' , <nl> } <nl> deps = { <nl> ' v8 / third_party / instrumented_libraries ' : <nl> Var ( ' chromium_url ' ) + ' / chromium / src / third_party / instrumented_libraries . git ' + ' @ ' + ' a959e4f0cb643003f2d75d179cede449979e3e77 ' , <nl> ' v8 / buildtools ' : <nl> - Var ( ' chromium_url ' ) + ' / chromium / src / buildtools . git ' + ' @ ' + ' 62f9eb0d64d6bf48f620b8233d9f7a1dc07f8414 ' , <nl> + Var ( ' chromium_url ' ) + ' / chromium / src / buildtools . git ' + ' @ ' + ' c79f3482c8152172a31e5c17823a27835a511dac ' , <nl> ' v8 / buildtools / clang_format / script ' : <nl> Var ( ' chromium_url ' ) + ' / chromium / llvm - project / cfe / tools / clang - format . git ' + ' @ ' + ' 96636aa0e9f047f17447f2d45a094d0b59ed7917 ' , <nl> + ' v8 / buildtools / linux64 ' : { <nl> + ' packages ' : [ <nl> + { <nl> + ' package ' : ' gn / gn / linux - amd64 ' , <nl> + ' version ' : Var ( ' gn_version ' ) , <nl> + } <nl> + ] , <nl> + ' dep_type ' : ' cipd ' , <nl> + ' condition ' : ' checkout_linux ' , <nl> + } , <nl> + ' v8 / buildtools / mac ' : { <nl> + ' packages ' : [ <nl> + { <nl> + ' package ' : ' gn / gn / mac - amd64 ' , <nl> + ' version ' : Var ( ' gn_version ' ) , <nl> + } <nl> + ] , <nl> + ' dep_type ' : ' cipd ' , <nl> + ' condition ' : ' checkout_mac ' , <nl> + } , <nl> ' v8 / buildtools / third_party / libc + + / trunk ' : <nl> Var ( ' chromium_url ' ) + ' / chromium / llvm - project / libcxx . git ' + ' @ ' + ' a50f5035629b7621e92acef968403f71b7d48553 ' , <nl> ' v8 / buildtools / third_party / libc + + abi / trunk ' : <nl> Var ( ' chromium_url ' ) + ' / chromium / llvm - project / libcxxabi . git ' + ' @ ' + ' 0d529660e32d77d9111912d73f2c74fc5fa2a858 ' , <nl> ' v8 / buildtools / third_party / libunwind / trunk ' : <nl> Var ( ' chromium_url ' ) + ' / external / llvm . org / libunwind . git ' + ' @ ' + ' 69d9b84cca8354117b9fe9705a4430d789ee599b ' , <nl> + ' v8 / buildtools / win ' : { <nl> + ' packages ' : [ <nl> + { <nl> + ' package ' : ' gn / gn / windows - amd64 ' , <nl> + ' version ' : Var ( ' gn_version ' ) , <nl> + } <nl> + ] , <nl> + ' dep_type ' : ' cipd ' , <nl> + ' condition ' : ' checkout_win ' , <nl> + } , <nl> ' v8 / base / trace_event / common ' : <nl> Var ( ' chromium_url ' ) + ' / chromium / src / base / trace_event / common . git ' + ' @ ' + ' 936ba8a963284a6b3737cf2f0474a7131073abee ' , <nl> ' v8 / third_party / android_ndk ' : { <nl> hooks = [ <nl> ' - - platform = linux * ' , <nl> ] , <nl> } , <nl> - # Pull GN using checked - in hashes . <nl> - { <nl> - ' name ' : ' gn_win ' , <nl> - ' pattern ' : ' . ' , <nl> - ' condition ' : ' host_os = = " win " ' , <nl> - ' action ' : [ ' download_from_google_storage ' , <nl> - ' - - no_resume ' , <nl> - ' - - platform = win32 ' , <nl> - ' - - no_auth ' , <nl> - ' - - bucket ' , ' chromium - gn ' , <nl> - ' - s ' , ' v8 / buildtools / win / gn . exe . sha1 ' , <nl> - ] , <nl> - } , <nl> - { <nl> - ' name ' : ' gn_mac ' , <nl> - ' pattern ' : ' . ' , <nl> - ' condition ' : ' host_os = = " mac " ' , <nl> - ' action ' : [ ' download_from_google_storage ' , <nl> - ' - - no_resume ' , <nl> - ' - - platform = darwin ' , <nl> - ' - - no_auth ' , <nl> - ' - - bucket ' , ' chromium - gn ' , <nl> - ' - s ' , ' v8 / buildtools / mac / gn . sha1 ' , <nl> - ] , <nl> - } , <nl> - { <nl> - ' name ' : ' gn_linux ' , <nl> - ' pattern ' : ' . ' , <nl> - ' condition ' : ' host_os = = " linux " ' , <nl> - ' action ' : [ ' download_from_google_storage ' , <nl> - ' - - no_resume ' , <nl> - ' - - platform = linux * ' , <nl> - ' - - no_auth ' , <nl> - ' - - bucket ' , ' chromium - gn ' , <nl> - ' - s ' , ' v8 / buildtools / linux64 / gn . sha1 ' , <nl> - ] , <nl> - } , <nl> { <nl> ' name ' : ' wasm_spec_tests ' , <nl> ' pattern ' : ' . ' , <nl> | [ build ] Port : Use CIPD packages for GN instead of GCS . | v8/v8 | c1f42696225146527f76d4540f64f8a2e484297f | 2019-03-16T12:12:36Z |
mmm a / js / actions / api - cluster . js <nl> ppp b / js / actions / api - cluster . js <nl> actions . defineHttp ( { <nl> } <nl> var ok = true ; <nl> var isLeader ; <nl> + var collInfo ; <nl> try { <nl> - var coll = ArangoClusterInfo . getCollectionInfo ( body . database , <nl> + collInfo = ArangoClusterInfo . getCollectionInfo ( body . database , <nl> body . collection ) ; <nl> - var shards = coll . shards ; <nl> + var shards = collInfo . shards ; <nl> var shard = shards [ body . shard ] ; <nl> var pos = shard . indexOf ( body . fromServer ) ; <nl> if ( pos = = = - 1 ) { <nl> actions . defineHttp ( { <nl> var id = ArangoClusterInfo . uniqid ( ) ; <nl> var todo = { " type " : " moveShard " , <nl> " database " : body . database , <nl> - " collection " : body . collection , <nl> + " collection " : collInfo . id , <nl> " shard " : body . shard , <nl> " fromServer " : body . fromServer , <nl> " toServer " : body . toServer , <nl> | Translate collection name to ID in / _admin / cluster / moveShard . | arangodb/arangodb | d0f0918baf451b995f4ff65ecda8ead1c859d222 | 2016-06-09T12:42:42Z |
mmm a / cocos / 2d / CCSpriteFrameCache . cpp <nl> ppp b / cocos / 2d / CCSpriteFrameCache . cpp <nl> SpriteFrame * SpriteFrameCache : : getSpriteFrameByName ( const std : : string & name ) <nl> } <nl> <nl> NS_CC_END <nl> + <nl> mmm a / cocos / 2d / platform / CCFileUtils . cpp <nl> ppp b / cocos / 2d / platform / CCFileUtils . cpp <nl> static tinyxml2 : : XMLElement * generateElementForObject ( Value & value , tinyxml2 : : XM <nl> / / FIXME : XXX How to deal with Boolean ? ? <nl> <nl> / / object is Array <nl> - if ( value . getType ( ) = = Value : : Type : : ARRAY ) <nl> + if ( value . getType ( ) = = Value : : Type : : VECTOR ) <nl> return generateElementForArray ( value . asValueVector ( ) , pDoc ) ; <nl> <nl> / / object is Dictionary <nl> - if ( value . getType ( ) = = Value : : Type : : DICTIONARY ) <nl> + if ( value . getType ( ) = = Value : : Type : : MAP ) <nl> return generateElementForDict ( value . asValueMap ( ) , pDoc ) ; <nl> <nl> CCLOG ( " This type cannot appear in property list " ) ; <nl> mmm a / cocos / base / CCArray . cpp <nl> ppp b / cocos / base / CCArray . cpp <nl> THE SOFTWARE . <nl> # include " CCArray . h " <nl> # include " CCString . h " <nl> # include " platform / CCFileUtils . h " <nl> + # include < algorithm > / / std : : for_each <nl> <nl> NS_CC_BEGIN <nl> <nl> - <nl> # if CC_USE_ARRAY_VECTOR <nl> <nl> / / mmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmm - <nl> mmm a / cocos / base / CCMap . h <nl> ppp b / cocos / base / CCMap . h <nl> class CC_DLL Map <nl> void remove ( const std : : vector < K > & keys ) <nl> { <nl> std : : for_each ( keys . cbegin ( ) , keys . cend ( ) , [ this ] ( const K & key ) { <nl> - remove ( key ) ; <nl> + this - > remove ( key ) ; <nl> } ) ; <nl> } <nl> <nl> | issue : Fixing compilation errors on linux . | cocos2d/cocos2d-x | 373c3b01bfcfa9d33f23d8ac932d5a655fb39c93 | 2013-12-05T03:44:37Z |
mmm a / python - package / xgboost / plotting . py <nl> ppp b / python - package / xgboost / plotting . py <nl> <nl> import re <nl> import numpy as np <nl> from . core import Booster <nl> + from . sklearn import XGBModel <nl> <nl> from io import BytesIO <nl> <nl> def plot_importance ( booster , ax = None , height = 0 . 2 , <nl> <nl> Parameters <nl> mmmmmmmmm - <nl> - booster : Booster or dict <nl> - Booster instance , or dict taken by Booster . get_fscore ( ) <nl> + booster : Booster , XGBModel or dict <nl> + Booster or XGBModel instance , or dict taken by Booster . get_fscore ( ) <nl> ax : matplotlib Axes , default None <nl> Target axes instance . If None , new figure and axes will be created . <nl> height : float , default 0 . 2 <nl> def plot_importance ( booster , ax = None , height = 0 . 2 , <nl> except ImportError : <nl> raise ImportError ( ' You must install matplotlib to plot importance ' ) <nl> <nl> - if isinstance ( booster , Booster ) : <nl> + if isinstance ( booster , XGBModel ) : <nl> + importance = booster . booster ( ) . get_fscore ( ) <nl> + elif isinstance ( booster , Booster ) : <nl> importance = booster . get_fscore ( ) <nl> elif isinstance ( booster , dict ) : <nl> importance = booster <nl> else : <nl> - raise ValueError ( ' tree must be Booster or dict instance ' ) <nl> + raise ValueError ( ' tree must be Booster , XGBModel or dict instance ' ) <nl> <nl> if len ( importance ) = = 0 : <nl> raise ValueError ( ' Booster . get_fscore ( ) results in empty ' ) <nl> def to_graphviz ( booster , num_trees = 0 , rankdir = ' UT ' , <nl> <nl> Parameters <nl> mmmmmmmmm - <nl> - booster : Booster <nl> - Booster instance <nl> + booster : Booster , XGBModel <nl> + Booster or XGBModel instance <nl> num_trees : int , default 0 <nl> Specify the ordinal number of target tree <nl> rankdir : str , default " UT " <nl> def to_graphviz ( booster , num_trees = 0 , rankdir = ' UT ' , <nl> except ImportError : <nl> raise ImportError ( ' You must install graphviz to plot tree ' ) <nl> <nl> - if not isinstance ( booster , Booster ) : <nl> - raise ValueError ( ' booster must be Booster instance ' ) <nl> + if not isinstance ( booster , ( Booster , XGBModel ) ) : <nl> + raise ValueError ( ' booster must be Booster or XGBModel instance ' ) <nl> + <nl> + if isinstance ( booster , XGBModel ) : <nl> + booster = booster . booster ( ) <nl> <nl> tree = booster . get_dump ( ) [ num_trees ] <nl> tree = tree . split ( ) <nl> def plot_tree ( booster , num_trees = 0 , rankdir = ' UT ' , ax = None , * * kwargs ) : <nl> <nl> Parameters <nl> mmmmmmmmm - <nl> - booster : Booster <nl> - Booster instance <nl> + booster : Booster , XGBModel <nl> + Booster or XGBModel instance <nl> num_trees : int , default 0 <nl> Specify the ordinal number of target tree <nl> rankdir : str , default " UT " <nl> def plot_tree ( booster , num_trees = 0 , rankdir = ' UT ' , ax = None , * * kwargs ) : <nl> except ImportError : <nl> raise ImportError ( ' You must install matplotlib to plot tree ' ) <nl> <nl> - <nl> if ax is None : <nl> _ , ax = plt . subplots ( 1 , 1 ) <nl> <nl> mmm a / scripts / travis_script . sh <nl> ppp b / scripts / travis_script . sh <nl> if [ $ { TASK } = = " python - package " - o $ { TASK } = = " python - package3 " ] ; then <nl> conda create - n myenv python = 2 . 7 <nl> fi <nl> source activate myenv <nl> - conda install numpy scipy pandas matplotlib nose <nl> + conda install numpy scipy pandas matplotlib nose scikit - learn <nl> python - m pip install graphviz <nl> <nl> make all CXX = $ { CXX } | | exit - 1 <nl> mmm a / tests / python / test_basic . py <nl> ppp b / tests / python / test_basic . py <nl> def test_plotting ( self ) : <nl> for p in ax . patches : <nl> assert p . get_facecolor ( ) = = ( 1 . 0 , 0 , 0 , 1 . 0 ) # red <nl> <nl> - <nl> ax = xgb . plot_importance ( bst2 , color = [ ' r ' , ' r ' , ' b ' , ' b ' ] , <nl> title = None , xlabel = None , ylabel = None ) <nl> assert isinstance ( ax , Axes ) <nl> def test_plotting ( self ) : <nl> <nl> g = xgb . to_graphviz ( bst2 , num_trees = 0 ) <nl> assert isinstance ( g , Digraph ) <nl> + <nl> ax = xgb . plot_tree ( bst2 , num_trees = 0 ) <nl> assert isinstance ( ax , Axes ) <nl> + <nl> + def test_sklearn_api ( self ) : <nl> + from sklearn import datasets <nl> + from sklearn . cross_validation import train_test_split <nl> + <nl> + np . random . seed ( 1 ) <nl> + <nl> + iris = datasets . load_iris ( ) <nl> + tr_d , te_d , tr_l , te_l = train_test_split ( iris . data , iris . target , train_size = 120 ) <nl> + <nl> + classifier = xgb . XGBClassifier ( ) <nl> + classifier . fit ( tr_d , tr_l ) <nl> + <nl> + preds = classifier . predict ( te_d ) <nl> + labels = te_l <nl> + err = sum ( [ 1 for p , l in zip ( preds , labels ) if p ! = l ] ) / len ( te_l ) <nl> + # error must be smaller than 10 % <nl> + assert err < 0 . 1 <nl> + <nl> + def test_sklearn_plotting ( self ) : <nl> + from sklearn import datasets <nl> + iris = datasets . load_iris ( ) <nl> + <nl> + classifier = xgb . XGBClassifier ( ) <nl> + classifier . fit ( iris . data , iris . target ) <nl> + <nl> + import matplotlib <nl> + matplotlib . use ( ' Agg ' ) <nl> + <nl> + from matplotlib . axes import Axes <nl> + from graphviz import Digraph <nl> + <nl> + ax = xgb . plot_importance ( classifier ) <nl> + assert isinstance ( ax , Axes ) <nl> + assert ax . get_title ( ) = = ' Feature importance ' <nl> + assert ax . get_xlabel ( ) = = ' F score ' <nl> + assert ax . get_ylabel ( ) = = ' Features ' <nl> + assert len ( ax . patches ) = = 4 <nl> + <nl> + g = xgb . to_graphviz ( classifier , num_trees = 0 ) <nl> + assert isinstance ( g , Digraph ) <nl> + <nl> + ax = xgb . plot_tree ( classifier , num_trees = 0 ) <nl> + assert isinstance ( ax , Axes ) <nl> \ No newline at end of file <nl> | Merge pull request from sinhrks / plot_sklearn | dmlc/xgboost | cb7f331ebcc05a6dc1f0964ff0edd3b69a07c965 | 2015-10-22T15:39:25Z |
mmm a / src / openalpr / edges / platecorners . cpp <nl> ppp b / src / openalpr / edges / platecorners . cpp <nl> vector < Point > PlateCorners : : findPlateCorners ( ) <nl> <nl> void PlateCorners : : scoreVerticals ( int v1 , int v2 ) <nl> { <nl> - float score = 0 ; / / Lower is better <nl> + ScoreKeeper scoreKeeper ; <nl> <nl> LineSegment left ; <nl> LineSegment right ; <nl> void PlateCorners : : scoreVerticals ( int v1 , int v2 ) <nl> left = tlc . centerVerticalLine . getParallelLine ( - 1 * idealPixelWidth / 2 ) ; <nl> right = tlc . centerVerticalLine . getParallelLine ( idealPixelWidth / 2 ) ; <nl> <nl> - missingSegmentPenalty + = SCORING_MISSING_SEGMENT_PENALTY_VERTICAL * 2 ; <nl> + missingSegmentPenalty = 2 ; <nl> confidenceDiff + = 2 ; <nl> } <nl> else if ( v1 ! = NO_LINE & & v2 ! = NO_LINE ) <nl> void PlateCorners : : scoreVerticals ( int v1 , int v2 ) <nl> { <nl> right = this - > plateLines - > verticalLines [ v2 ] . line ; <nl> left = right . getParallelLine ( idealPixelWidth ) ; <nl> - missingSegmentPenalty + = SCORING_MISSING_SEGMENT_PENALTY_VERTICAL ; <nl> + missingSegmentPenalty + + ; <nl> confidenceDiff + = ( 1 . 0 - this - > plateLines - > verticalLines [ v2 ] . confidence ) ; <nl> } <nl> else if ( v1 ! = NO_LINE & & v2 = = NO_LINE ) <nl> { <nl> left = this - > plateLines - > verticalLines [ v1 ] . line ; <nl> right = left . getParallelLine ( - 1 * idealPixelWidth ) ; <nl> - missingSegmentPenalty + = SCORING_MISSING_SEGMENT_PENALTY_VERTICAL ; <nl> + missingSegmentPenalty + + ; <nl> confidenceDiff + = ( 1 . 0 - this - > plateLines - > verticalLines [ v1 ] . confidence ) ; <nl> } <nl> <nl> - score + = confidenceDiff * SCORING_LINE_CONFIDENCE_WEIGHT ; <nl> - score + = missingSegmentPenalty ; <nl> + scoreKeeper . setScore ( " SCORING_LINE_CONFIDENCE_WEIGHT " , confidenceDiff , SCORING_LINE_CONFIDENCE_WEIGHT ) ; <nl> + scoreKeeper . setScore ( " SCORING_MISSING_SEGMENT_PENALTY_VERTICAL " , missingSegmentPenalty , SCORING_MISSING_SEGMENT_PENALTY_VERTICAL ) ; <nl> <nl> / / Make sure that the left and right lines are to the left and right of our text <nl> / / area <nl> if ( tlc . isLeftOfText ( left ) < 1 | | tlc . isLeftOfText ( right ) > - 1 ) <nl> return ; <nl> <nl> - / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / <nl> - / / Score " Distance from the edge . . . <nl> - / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / <nl> - <nl> - float leftDistanceFromEdge = abs ( ( float ) ( left . p1 . x + left . p2 . x ) / 2 ) ; <nl> - float rightDistanceFromEdge = abs ( this - > inputImage . cols - ( ( float ) ( right . p1 . x + right . p2 . x ) / 2 ) ) ; <nl> - <nl> - float distanceFromEdge = leftDistanceFromEdge + rightDistanceFromEdge ; <nl> - score + = distanceFromEdge * SCORING_VERTICALDISTANCE_FROMEDGE_WEIGHT ; <nl> - <nl> - / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / <nl> - / / Score " Boxiness " of the 4 lines . How close is it to a parallelogram ? <nl> - / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / <nl> - <nl> - float verticalAngleDiff = abs ( left . angle - right . angle ) ; <nl> - <nl> - score + = ( verticalAngleDiff ) * SCORING_BOXINESS_WEIGHT ; <nl> <nl> / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / <nl> / / Score angle difference from detected character box <nl> void PlateCorners : : scoreVerticals ( int v1 , int v2 ) <nl> float perpendicularCharAngle = tlc . charAngle - 90 ; <nl> float charanglediff = abs ( perpendicularCharAngle - left . angle ) + abs ( perpendicularCharAngle - right . angle ) ; <nl> <nl> - score + = charanglediff * SCORING_ANGLE_MATCHES_LPCHARS_WEIGHT ; <nl> + scoreKeeper . setScore ( " SCORING_ANGLE_MATCHES_LPCHARS_WEIGHT " , charanglediff , SCORING_ANGLE_MATCHES_LPCHARS_WEIGHT ) ; <nl> <nl> / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / <nl> / / SCORE the shape wrt character position and height relative to position <nl> void PlateCorners : : scoreVerticals ( int v1 , int v2 ) <nl> Point rightMidLinePoint = right . closestPointOnSegmentTo ( tlc . centerVerticalLine . midpoint ( ) ) ; <nl> <nl> float plateDistance = abs ( idealPixelWidth - distanceBetweenPoints ( leftMidLinePoint , rightMidLinePoint ) ) ; <nl> + / / normalize for image width <nl> + plateDistance = plateDistance / ( ( float ) inputImage . cols ) ; <nl> <nl> - score + = plateDistance * SCORING_DISTANCE_WEIGHT_VERTICAL ; <nl> + scoreKeeper . setScore ( " SCORING_DISTANCE_WEIGHT_VERTICAL " , plateDistance , SCORING_DISTANCE_WEIGHT_VERTICAL ) ; <nl> <nl> + float score = scoreKeeper . getTotal ( ) ; <nl> + <nl> if ( score < this - > bestVerticalScore ) <nl> { <nl> - float scorecomponent ; <nl> <nl> if ( pipelineData - > config - > debugPlateCorners ) <nl> { <nl> - cout < < " xx xx Score : charHeight " < < tlc . charHeight < < endl ; <nl> - cout < < " xx xx Score : idealwidth " < < idealPixelWidth < < endl ; <nl> - cout < < " xx xx Score : v1 , v2 = " < < v1 < < " , " < < v2 < < endl ; <nl> - cout < < " xx xx Score : Left = " < < left . str ( ) < < endl ; <nl> - cout < < " xx xx Score : Right = " < < right . str ( ) < < endl ; <nl> - <nl> <nl> cout < < " Vertical breakdown Score : " < < endl ; <nl> <nl> - cout < < " - - Missing Segment Score : " < < missingSegmentPenalty < < " - - Weight ( 1 . 0 ) " < < endl ; <nl> - scorecomponent = missingSegmentPenalty ; <nl> - cout < < " - - - - Score : " < < scorecomponent < < " = " < < scorecomponent / score * 100 < < " % of score " < < endl ; <nl> - <nl> - cout < < " - - Boxiness Score : " < < verticalAngleDiff < < " - - Weight ( " < < SCORING_BOXINESS_WEIGHT < < " ) " < < endl ; <nl> - scorecomponent = verticalAngleDiff * SCORING_BOXINESS_WEIGHT ; <nl> - cout < < " - - - - Score : " < < scorecomponent < < " = " < < scorecomponent / score * 100 < < " % of score " < < endl ; <nl> - <nl> - cout < < " - - Distance From Edge Score : " < < distanceFromEdge < < " - - Weight ( " < < SCORING_VERTICALDISTANCE_FROMEDGE_WEIGHT < < " ) " < < endl ; <nl> - scorecomponent = distanceFromEdge * SCORING_VERTICALDISTANCE_FROMEDGE_WEIGHT ; <nl> - cout < < " - - - - Score : " < < scorecomponent < < " = " < < scorecomponent / score * 100 < < " % of score " < < endl ; <nl> - <nl> - cout < < " - - Distance Score : " < < plateDistance < < " - - Weight ( " < < SCORING_DISTANCE_WEIGHT_VERTICAL < < " ) " < < endl ; <nl> - scorecomponent = plateDistance * SCORING_DISTANCE_WEIGHT_VERTICAL ; <nl> - cout < < " - - - - Score : " < < scorecomponent < < " = " < < scorecomponent / score * 100 < < " % of score " < < endl ; <nl> - <nl> - cout < < " - - Char angle Score : " < < charanglediff < < " - - Weight ( " < < SCORING_ANGLE_MATCHES_LPCHARS_WEIGHT < < " ) " < < endl ; <nl> - scorecomponent = charanglediff * SCORING_ANGLE_MATCHES_LPCHARS_WEIGHT ; <nl> - cout < < " - - - - Score : " < < scorecomponent < < " = " < < scorecomponent / score * 100 < < " % of score " < < endl ; <nl> - <nl> - cout < < " - - Plate line confidence Score : " < < confidenceDiff < < " - - Weight ( " < < SCORING_LINE_CONFIDENCE_WEIGHT < < " ) " < < endl ; <nl> - scorecomponent = confidenceDiff * SCORING_LINE_CONFIDENCE_WEIGHT ; <nl> - cout < < " - - - - Score : " < < scorecomponent < < " = " < < scorecomponent / score * 100 < < " % of score " < < endl ; <nl> - <nl> - cout < < " - - Score : " < < score < < endl ; <nl> + scoreKeeper . printDebugScores ( ) ; <nl> } <nl> <nl> this - > bestVerticalScore = score ; <nl> void PlateCorners : : scoreVerticals ( int v1 , int v2 ) <nl> / / If any segments are missing , extrapolate the missing pieces <nl> void PlateCorners : : scoreHorizontals ( int h1 , int h2 ) <nl> { <nl> - / / if ( this - > debug ) <nl> - / / cout < < " PlateCorners : : scorePlate " < < endl ; <nl> - <nl> - float score = 0 ; / / Lower is better <nl> + <nl> + ScoreKeeper scoreKeeper ; <nl> <nl> LineSegment top ; <nl> LineSegment bottom ; <nl> void PlateCorners : : scoreHorizontals ( int h1 , int h2 ) <nl> top = tlc . centerHorizontalLine . getParallelLine ( idealPixelHeight / 2 ) ; <nl> bottom = tlc . centerHorizontalLine . getParallelLine ( - 1 * idealPixelHeight / 2 ) ; <nl> <nl> - missingSegmentPenalty + = SCORING_MISSING_SEGMENT_PENALTY_HORIZONTAL * 2 ; <nl> + missingSegmentPenalty = 2 ; <nl> confidenceDiff + = 2 ; <nl> } <nl> else if ( h1 ! = NO_LINE & & h2 ! = NO_LINE ) <nl> void PlateCorners : : scoreHorizontals ( int h1 , int h2 ) <nl> { <nl> bottom = this - > plateLines - > horizontalLines [ h2 ] . line ; <nl> top = bottom . getParallelLine ( idealPixelHeight ) ; <nl> - missingSegmentPenalty + = SCORING_MISSING_SEGMENT_PENALTY_HORIZONTAL ; <nl> + missingSegmentPenalty + + ; <nl> confidenceDiff + = ( 1 . 0 - this - > plateLines - > horizontalLines [ h2 ] . confidence ) ; <nl> } <nl> else if ( h1 ! = NO_LINE & & h2 = = NO_LINE ) <nl> { <nl> top = this - > plateLines - > horizontalLines [ h1 ] . line ; <nl> bottom = top . getParallelLine ( - 1 * idealPixelHeight ) ; <nl> - missingSegmentPenalty + = SCORING_MISSING_SEGMENT_PENALTY_HORIZONTAL ; <nl> + missingSegmentPenalty + + ; <nl> confidenceDiff + = ( 1 . 0 - this - > plateLines - > horizontalLines [ h1 ] . confidence ) ; <nl> } <nl> <nl> - score + = confidenceDiff * SCORING_LINE_CONFIDENCE_WEIGHT ; <nl> - score + = missingSegmentPenalty ; <nl> + scoreKeeper . setScore ( " SCORING_MISSING_SEGMENT_PENALTY_HORIZONTAL " , missingSegmentPenalty , SCORING_MISSING_SEGMENT_PENALTY_HORIZONTAL ) ; <nl> + / / scoreKeeper . setScore ( " SCORING_LINE_CONFIDENCE_WEIGHT " , confidenceDiff , SCORING_LINE_CONFIDENCE_WEIGHT ) ; <nl> + <nl> <nl> / / Make sure that the top and bottom lines are above and below <nl> / / the text area <nl> void PlateCorners : : scoreHorizontals ( int h1 , int h2 ) <nl> <nl> / / We now have 4 possible lines . Let ' s put them to the test and score them . . . <nl> <nl> - / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / <nl> - / / Score " Boxiness " of the 4 lines . How close is it to a parallelogram ? <nl> - / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / <nl> - <nl> - float horizontalAngleDiff = abs ( top . angle - bottom . angle ) ; <nl> - <nl> - score + = ( horizontalAngleDiff ) * SCORING_BOXINESS_WEIGHT ; <nl> - / / if ( this - > debug ) <nl> - / / cout < < " PlateCorners boxiness score : " < < ( horizontalAngleDiff + verticalAngleDiff ) * SCORING_BOXINESS_WEIGHT < < endl ; <nl> <nl> / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / <nl> / / SCORE the shape wrt character position and height relative to position <nl> void PlateCorners : : scoreHorizontals ( int h1 , int h2 ) <nl> <nl> float heightRatio = tlc . charHeight / plateHeightPx ; <nl> float idealHeightRatio = ( pipelineData - > config - > charHeightMM / pipelineData - > config - > plateHeightMM ) ; <nl> - / / if ( leftRatio < MIN_CHAR_HEIGHT_RATIO | | leftRatio > MAX_CHAR_HEIGHT_RATIO | | rightRatio < MIN_CHAR_HEIGHT_RATIO | | rightRatio > MAX_CHAR_HEIGHT_RATIO ) <nl> float heightRatioDiff = abs ( heightRatio - idealHeightRatio ) ; <nl> - / / Ideal ratio = = ~ . 45 <nl> - <nl> - / / Get the distance from the top and the distance from the bottom <nl> - / / Take the average distances from the corners of the character region to the top / bottom lines <nl> - / / float topDistance = distanceBetweenPoints ( topMidLinePoint , charRegion - > getCharBoxTop ( ) . midpoint ( ) ) ; <nl> - / / float bottomDistance = distanceBetweenPoints ( bottomMidLinePoint , charRegion - > getCharBoxBottom ( ) . midpoint ( ) ) ; <nl> <nl> - / / float idealTopDistance = charHeight * ( TOP_WHITESPACE_HEIGHT_MM / CHARACTER_HEIGHT_MM ) ; <nl> - / / float idealBottomDistance = charHeight * ( BOTTOM_WHITESPACE_HEIGHT_MM / CHARACTER_HEIGHT_MM ) ; <nl> - / / float distScore = abs ( topDistance - idealTopDistance ) + abs ( bottomDistance - idealBottomDistance ) ; <nl> - <nl> - score + = heightRatioDiff * SCORING_PLATEHEIGHT_WEIGHT ; <nl> + scoreKeeper . setScore ( " SCORING_PLATEHEIGHT_WEIGHT " , heightRatioDiff , SCORING_PLATEHEIGHT_WEIGHT ) ; <nl> <nl> / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / <nl> / / SCORE the middliness of the stuff . We want our top and bottom line to have the characters right towards the middle <nl> void PlateCorners : : scoreHorizontals ( int h1 , int h2 ) <nl> <nl> float idealDistanceFromMiddle = idealPixelHeight / 2 ; <nl> <nl> - float middleScore = abs ( topDistanceFromMiddle - idealDistanceFromMiddle ) + abs ( bottomDistanceFromMiddle - idealDistanceFromMiddle ) ; <nl> + float middleScore = abs ( topDistanceFromMiddle - idealDistanceFromMiddle ) / idealDistanceFromMiddle ; <nl> + middleScore + = abs ( bottomDistanceFromMiddle - idealDistanceFromMiddle ) / idealDistanceFromMiddle ; <nl> + <nl> + scoreKeeper . setScore ( " SCORING_TOP_BOTTOM_SPACE_VS_CHARHEIGHT_WEIGHT " , middleScore , SCORING_TOP_BOTTOM_SPACE_VS_CHARHEIGHT_WEIGHT ) ; <nl> <nl> - score + = middleScore * SCORING_TOP_BOTTOM_SPACE_VS_CHARHEIGHT_WEIGHT ; <nl> <nl> - / / if ( this - > debug ) <nl> - / / { <nl> - / / cout < < " PlateCorners boxiness score : " < < avgRatio * SCORING_TOP_BOTTOM_SPACE_VS_CHARHEIGHT_WEIGHT < < endl ; <nl> - / / cout < < " PlateCorners boxiness score : " < < distScore * SCORING_PLATEHEIGHT_WEIGHT < < endl ; <nl> - / / } <nl> / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / <nl> / / SCORE : the shape for angles matching the character region <nl> / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / <nl> <nl> float charanglediff = abs ( tlc . charAngle - top . angle ) + abs ( tlc . charAngle - bottom . angle ) ; <nl> <nl> - score + = charanglediff * SCORING_ANGLE_MATCHES_LPCHARS_WEIGHT ; <nl> + scoreKeeper . setScore ( " SCORING_ANGLE_MATCHES_LPCHARS_WEIGHT " , charanglediff , SCORING_ANGLE_MATCHES_LPCHARS_WEIGHT ) ; <nl> + <nl> + if ( pipelineData - > config - > debugPlateCorners ) <nl> + { <nl> + scoreKeeper . printDebugScores ( ) ; <nl> + Mat debugImg ( this - > inputImage . size ( ) , this - > inputImage . type ( ) ) ; <nl> + this - > inputImage . copyTo ( debugImg ) ; <nl> + cvtColor ( debugImg , debugImg , CV_GRAY2BGR ) ; <nl> + line ( debugImg , top . p1 , top . p2 , Scalar ( 0 , 0 , 255 ) , 2 ) ; <nl> + line ( debugImg , bottom . p1 , bottom . p2 , Scalar ( 0 , 0 , 255 ) , 2 ) ; <nl> + / / drawAndWait ( & debugImg ) ; <nl> <nl> - / / if ( this - > debug ) <nl> - / / cout < < " PlateCorners boxiness score : " < < charanglediff * SCORING_ANGLE_MATCHES_LPCHARS_WEIGHT < < endl ; <nl> + } <nl> <nl> + float score = scoreKeeper . getTotal ( ) ; <nl> if ( score < this - > bestHorizontalScore ) <nl> { <nl> float scorecomponent ; <nl> <nl> if ( pipelineData - > config - > debugPlateCorners ) <nl> { <nl> - cout < < " xx xx Score : charHeight " < < tlc . charHeight < < endl ; <nl> - cout < < " xx xx Score : idealHeight " < < idealPixelHeight < < endl ; <nl> - cout < < " xx xx Score : h1 , h2 = " < < h1 < < " , " < < h2 < < endl ; <nl> - cout < < " xx xx Score : Top = " < < top . str ( ) < < endl ; <nl> - cout < < " xx xx Score : Bottom = " < < bottom . str ( ) < < endl ; <nl> - <nl> - <nl> cout < < " Horizontal breakdown Score : " < < endl ; <nl> - <nl> - cout < < " - - Missing Segment Score : " < < missingSegmentPenalty < < " - - Weight ( 1 . 0 ) " < < endl ; <nl> - scorecomponent = missingSegmentPenalty ; <nl> - cout < < " - - - - Score : " < < scorecomponent < < " = " < < scorecomponent / score * 100 < < " % of score " < < endl ; <nl> - <nl> - cout < < " - - Boxiness Score : " < < horizontalAngleDiff < < " - - Weight ( " < < SCORING_BOXINESS_WEIGHT < < " ) " < < endl ; <nl> - scorecomponent = horizontalAngleDiff * SCORING_BOXINESS_WEIGHT ; <nl> - cout < < " - - - - Score : " < < scorecomponent < < " = " < < scorecomponent / score * 100 < < " % of score " < < endl ; <nl> - <nl> - cout < < " - - Height Ratio Diff Score : " < < heightRatioDiff < < " - - Weight ( " < < SCORING_PLATEHEIGHT_WEIGHT < < " ) " < < endl ; <nl> - scorecomponent = heightRatioDiff * SCORING_PLATEHEIGHT_WEIGHT ; <nl> - cout < < " - - - - " < < scorecomponent < < " = " < < scorecomponent / score * 100 < < " % of score " < < endl ; <nl> - <nl> - cout < < " - - Distance Score : " < < middleScore < < " - - Weight ( " < < SCORING_TOP_BOTTOM_SPACE_VS_CHARHEIGHT_WEIGHT < < " ) " < < endl ; <nl> - scorecomponent = middleScore * SCORING_TOP_BOTTOM_SPACE_VS_CHARHEIGHT_WEIGHT ; <nl> - cout < < " - - - - Score : " < < scorecomponent < < " = " < < scorecomponent / score * 100 < < " % of score " < < endl ; <nl> - <nl> - cout < < " - - Char angle Score : " < < charanglediff < < " - - Weight ( " < < SCORING_ANGLE_MATCHES_LPCHARS_WEIGHT < < " ) " < < endl ; <nl> - scorecomponent = charanglediff * SCORING_ANGLE_MATCHES_LPCHARS_WEIGHT ; <nl> - cout < < " - - - - Score : " < < scorecomponent < < " = " < < scorecomponent / score * 100 < < " % of score " < < endl ; <nl> - <nl> - cout < < " - - Plate line confidence Score : " < < confidenceDiff < < " - - Weight ( " < < SCORING_LINE_CONFIDENCE_WEIGHT < < " ) " < < endl ; <nl> - scorecomponent = confidenceDiff * SCORING_LINE_CONFIDENCE_WEIGHT ; <nl> - cout < < " - - - - Score : " < < scorecomponent < < " = " < < scorecomponent / score * 100 < < " % of score " < < endl ; <nl> - <nl> - cout < < " - - Score : " < < score < < endl ; <nl> + scoreKeeper . printDebugScores ( ) ; <nl> } <nl> this - > bestHorizontalScore = score ; <nl> bestTop = LineSegment ( top . p1 . x , top . p1 . y , top . p2 . x , top . p2 . y ) ; <nl> mmm a / src / openalpr / edges / platecorners . h <nl> ppp b / src / openalpr / edges / platecorners . h <nl> <nl> # include " utility . h " <nl> # include " config . h " <nl> # include " textlinecollection . h " <nl> + # include " scorekeeper . h " <nl> <nl> # define NO_LINE - 1 <nl> <nl> | Using scorekeeper in platecorners | openalpr/openalpr | 5ee27056759ec44df69692ddc04cf02b189ce1a1 | 2014-10-26T20:45:11Z |
mmm a / cocos / base / CCDirector . cpp <nl> ppp b / cocos / base / CCDirector . cpp <nl> void Director : : onCaptureScreen ( const std : : function < void ( bool , const std : : string & <nl> frameSize = frameSize * _openGLView - > getFrameZoomFactor ( ) * _openGLView - > getRetinaFactor ( ) ; <nl> # endif <nl> <nl> - int originx = 0 ; <nl> - int originy = 0 ; <nl> int width = static_cast < int > ( frameSize . width ) ; <nl> int height = static_cast < int > ( frameSize . height ) ; <nl> <nl> void Director : : onCaptureScreen ( const std : : function < void ( bool , const std : : string & <nl> } <nl> <nl> glPixelStorei ( GL_PACK_ALIGNMENT , 1 ) ; <nl> - glReadPixels ( originx , originy , width , height , GL_RGBA , GL_UNSIGNED_BYTE , buffer . get ( ) ) ; <nl> + glReadPixels ( 0 , 0 , width , height , GL_RGBA , GL_UNSIGNED_BYTE , buffer . get ( ) ) ; <nl> <nl> std : : shared_ptr < GLubyte > flippedBuffer ( new GLubyte [ width * height * 4 ] , [ ] ( GLubyte * p ) { CC_SAFE_DELETE_ARRAY ( p ) ; } ) ; <nl> if ( ! flippedBuffer ) <nl> | remove unused variables | cocos2d/cocos2d-x | 21f7e34d184c7e26caaaf7fbaf52d02517b6576b | 2014-05-26T05:49:00Z |
mmm a / dbms / src / Core / Settings . h <nl> ppp b / dbms / src / Core / Settings . h <nl> struct Settings <nl> M ( SettingUInt64 , max_concurrent_queries_for_user , 0 , " The maximum number of concurrent requests per user . " ) \ <nl> \ <nl> M ( SettingBool , insert_deduplicate , true , " For INSERT queries in the replicated table , specifies that deduplication of insertings blocks should be preformed " ) \ <nl> - M ( SettingBool , insert_sample_with_metadata , false , " For INSERT queries , specifies that the server need to send metadata about column defaults to the client . This will be used to calculate default expressions . " ) \ <nl> \ <nl> M ( SettingUInt64 , insert_quorum , 0 , " For INSERT queries in the replicated table , wait writing for the specified number of replicas and linearize the addition of the data . 0 - disabled . " ) \ <nl> M ( SettingMilliseconds , insert_quorum_timeout , 600000 , " " ) \ <nl> struct Settings <nl> \ <nl> M ( SettingBool , input_format_skip_unknown_fields , false , " Skip columns with unknown names from input data ( it works for JSONEachRow and TSKV formats ) . " ) \ <nl> M ( SettingBool , input_format_import_nested_json , false , " Map nested JSON data to nested tables ( it works for JSONEachRow format ) . " ) \ <nl> + M ( SettingBool , input_format_defaults_for_omitted_fields , false , " For input data calculate default expressions for omitted fields ( it works for JSONEachRow format ) . " ) \ <nl> \ <nl> M ( SettingBool , input_format_values_interpret_expressions , true , " For Values format : if field could not be parsed by streaming parser , run SQL parser and try to interpret it as SQL expression . " ) \ <nl> \ <nl> mmm a / dbms / src / Storages / ColumnsDescription . cpp <nl> ppp b / dbms / src / Storages / ColumnsDescription . cpp <nl> ColumnsDescription ColumnsDescription : : parse ( const String & str ) <nl> <nl> const ColumnsDescription * ColumnsDescription : : loadFromContext ( const Context & context , const String & db , const String & table ) <nl> { <nl> - if ( context . getSettingsRef ( ) . insert_sample_with_metadata ) <nl> + if ( context . getSettingsRef ( ) . input_format_defaults_for_omitted_fields ) <nl> { <nl> if ( context . isTableExist ( db , table ) ) <nl> { <nl> mmm a / dbms / tests / queries / 0_stateless / 00760_insert_json_with_defaults . sql <nl> ppp b / dbms / tests / queries / 0_stateless / 00760_insert_json_with_defaults . sql <nl> <nl> - SET insert_sample_with_metadata = 1 ; <nl> + SET input_format_defaults_for_omitted_fields = 1 ; <nl> <nl> CREATE DATABASE IF NOT EXISTS test ; <nl> DROP TABLE IF EXISTS test . defaults ; <nl> mmm a / dbms / tests / queries / 0_stateless / 00851_http_insert_json_defaults . sh <nl> ppp b / dbms / tests / queries / 0_stateless / 00851_http_insert_json_defaults . sh <nl> CURDIR = $ ( cd " $ ( dirname " $ { BASH_SOURCE [ 0 ] } " ) " & & pwd ) <nl> $ CLICKHOUSE_CLIENT - - query = " DROP TABLE IF EXISTS test . defaults " <nl> $ CLICKHOUSE_CLIENT - - query = " CREATE TABLE test . defaults ( x UInt32 , y UInt32 , a DEFAULT x + y , b Float32 DEFAULT log ( 1 + x + y ) , c UInt32 DEFAULT 42 , e MATERIALIZED x + y , f ALIAS x + y ) ENGINE = Memory " <nl> <nl> - echo - ne ' { " x " : 1 , " y " : 1 } \ n ' | $ { CLICKHOUSE_CURL } - sS " $ { CLICKHOUSE_URL } ? query = INSERT % 20INTO % 20test . defaults % 20FORMAT % 20JSONEachRow % 20SETTINGS % 20insert_sample_with_metadata = 1 " - - data - binary @ - <nl> - echo - ne ' { " x " : 2 , " y " : 2 , " c " : 2 } \ n ' | $ { CLICKHOUSE_CURL } - sS " $ { CLICKHOUSE_URL } ? query = INSERT + INTO + test . defaults + FORMAT + JSONEachRow + SETTINGS + insert_sample_with_metadata = 1 " - - data - binary @ - <nl> - echo - ne ' { " x " : 3 , " y " : 3 , " a " : 3 , " b " : 3 , " c " : 3 } \ n ' | $ { CLICKHOUSE_CURL } - sS " $ { CLICKHOUSE_URL } ? query = INSERT + INTO + test . defaults + FORMAT + JSONEachRow + SETTINGS + insert_sample_with_metadata = 1 " - - data - binary @ - <nl> - echo - ne ' { " x " : 4 } { " y " : 5 , " c " : 5 } { " a " : 6 , " b " : 6 , " c " : 6 } \ n ' | $ { CLICKHOUSE_CURL } - sS " $ { CLICKHOUSE_URL } ? query = INSERT + INTO + test . defaults + FORMAT + JSONEachRow + SETTINGS + insert_sample_with_metadata = 1 " - - data - binary @ - <nl> + echo - ne ' { " x " : 1 , " y " : 1 } \ n ' | $ { CLICKHOUSE_CURL } - sS " $ { CLICKHOUSE_URL } ? query = INSERT % 20INTO % 20test . defaults % 20FORMAT % 20JSONEachRow % 20SETTINGS % 20input_format_defaults_for_omitted_fields = 1 " - - data - binary @ - <nl> + echo - ne ' { " x " : 2 , " y " : 2 , " c " : 2 } \ n ' | $ { CLICKHOUSE_CURL } - sS " $ { CLICKHOUSE_URL } ? query = INSERT + INTO + test . defaults + FORMAT + JSONEachRow + SETTINGS + input_format_defaults_for_omitted_fields = 1 " - - data - binary @ - <nl> + echo - ne ' { " x " : 3 , " y " : 3 , " a " : 3 , " b " : 3 , " c " : 3 } \ n ' | $ { CLICKHOUSE_CURL } - sS " $ { CLICKHOUSE_URL } ? query = INSERT + INTO + test . defaults + FORMAT + JSONEachRow + SETTINGS + input_format_defaults_for_omitted_fields = 1 " - - data - binary @ - <nl> + echo - ne ' { " x " : 4 } { " y " : 5 , " c " : 5 } { " a " : 6 , " b " : 6 , " c " : 6 } \ n ' | $ { CLICKHOUSE_CURL } - sS " $ { CLICKHOUSE_URL } ? query = INSERT + INTO + test . defaults + FORMAT + JSONEachRow + SETTINGS + input_format_defaults_for_omitted_fields = 1 " - - data - binary @ - <nl> <nl> $ CLICKHOUSE_CLIENT - - query = " SELECT * FROM test . defaults ORDER BY x , y FORMAT JSONEachRow " <nl> $ CLICKHOUSE_CLIENT - - query = " DROP TABLE test . defaults " <nl> | rename insert_sample_with_metadata setting | ClickHouse/ClickHouse | 0cc90cf2db312939d1a207e20bd26b7a4e32e794 | 2019-03-22T16:15:44Z |
mmm a / modules / videoio / CMakeLists . txt <nl> ppp b / modules / videoio / CMakeLists . txt <nl> if ( TARGET ocv . 3rdparty . dshow ) <nl> endif ( ) <nl> <nl> if ( TARGET ocv . 3rdparty . msmf ) <nl> - list ( APPEND videoio_srcs $ { CMAKE_CURRENT_LIST_DIR } / src / cap_msmf . hpp ) <nl> - list ( APPEND videoio_srcs $ { CMAKE_CURRENT_LIST_DIR } / src / cap_msmf . cpp ) <nl> - list ( APPEND tgts ocv . 3rdparty . msmf ) <nl> + if ( " msmf " IN_LIST VIDEOIO_PLUGIN_LIST ) <nl> + ocv_create_builtin_videoio_plugin ( " opencv_videoio_msmf " ocv . 3rdparty . msmf " cap_msmf . cpp " ) <nl> + else ( ) <nl> + list ( APPEND videoio_srcs $ { CMAKE_CURRENT_LIST_DIR } / src / cap_msmf . hpp ) <nl> + list ( APPEND videoio_srcs $ { CMAKE_CURRENT_LIST_DIR } / src / cap_msmf . cpp ) <nl> + list ( APPEND tgts ocv . 3rdparty . msmf ) <nl> + endif ( ) <nl> endif ( ) <nl> <nl> if ( TARGET ocv . 3rdparty . xine ) <nl> mmm a / modules / videoio / src / cap_mfx_plugin . cpp <nl> ppp b / modules / videoio / src / cap_mfx_plugin . cpp <nl> CvResult CV_API_CALL cv_capture_retrieve ( CvPluginCapture handle , int stream_idx , <nl> VideoCapture_IntelMFX * instance = ( VideoCapture_IntelMFX * ) handle ; <nl> Mat img ; <nl> if ( instance - > retrieveFrame ( stream_idx , img ) ) <nl> - return callback ( stream_idx , img . data , img . step , img . cols , img . rows , img . channels ( ) , userdata ) ; <nl> + return callback ( stream_idx , img . data , ( int ) img . step , img . cols , img . rows , img . channels ( ) , userdata ) ; <nl> return CV_ERROR_FAIL ; <nl> } <nl> catch ( . . . ) <nl> mmm a / modules / videoio / src / cap_msmf . cpp <nl> ppp b / modules / videoio / src / cap_msmf . cpp <nl> <nl> / / of this distribution and at http : / / opencv . org / license . html <nl> <nl> # include " precomp . hpp " <nl> - # if defined _WIN32 & & defined HAVE_MSMF <nl> / * <nl> Media Foundation - based Video Capturing module is based on <nl> videoInput library by Evgeny Pereguda : <nl> cv : : Ptr < cv : : IVideoWriter > cv : : cvCreateVideoWriter_MSMF ( const std : : string & filen <nl> return cv : : Ptr < cv : : IVideoWriter > ( ) ; <nl> } <nl> <nl> - # endif <nl> + # if defined ( BUILD_PLUGIN ) <nl> + <nl> + # include " plugin_api . hpp " <nl> + <nl> + namespace cv { <nl> + <nl> + typedef CvCapture_MSMF CaptureT ; <nl> + typedef CvVideoWriter_MSMF WriterT ; <nl> + <nl> + static <nl> + CvResult CV_API_CALL cv_capture_open ( const char * filename , int camera_index , CV_OUT CvPluginCapture * handle ) <nl> + { <nl> + if ( ! handle ) <nl> + return CV_ERROR_FAIL ; <nl> + * handle = NULL ; <nl> + if ( ! filename ) <nl> + return CV_ERROR_FAIL ; <nl> + CaptureT * cap = 0 ; <nl> + try <nl> + { <nl> + cap = new CaptureT ( ) ; <nl> + bool res ; <nl> + if ( filename ) <nl> + res = cap - > open ( std : : string ( filename ) ) ; <nl> + else <nl> + res = cap - > open ( camera_index ) ; <nl> + if ( res ) <nl> + { <nl> + * handle = ( CvPluginCapture ) cap ; <nl> + return CV_ERROR_OK ; <nl> + } <nl> + } <nl> + catch ( . . . ) <nl> + { <nl> + } <nl> + if ( cap ) <nl> + delete cap ; <nl> + return CV_ERROR_FAIL ; <nl> + } <nl> + <nl> + static <nl> + CvResult CV_API_CALL cv_capture_release ( CvPluginCapture handle ) <nl> + { <nl> + if ( ! handle ) <nl> + return CV_ERROR_FAIL ; <nl> + CaptureT * instance = ( CaptureT * ) handle ; <nl> + delete instance ; <nl> + return CV_ERROR_OK ; <nl> + } <nl> + <nl> + <nl> + static <nl> + CvResult CV_API_CALL cv_capture_get_prop ( CvPluginCapture handle , int prop , CV_OUT double * val ) <nl> + { <nl> + if ( ! handle ) <nl> + return CV_ERROR_FAIL ; <nl> + if ( ! val ) <nl> + return CV_ERROR_FAIL ; <nl> + try <nl> + { <nl> + CaptureT * instance = ( CaptureT * ) handle ; <nl> + * val = instance - > getProperty ( prop ) ; <nl> + return CV_ERROR_OK ; <nl> + } <nl> + catch ( . . . ) <nl> + { <nl> + return CV_ERROR_FAIL ; <nl> + } <nl> + } <nl> + <nl> + static <nl> + CvResult CV_API_CALL cv_capture_set_prop ( CvPluginCapture handle , int prop , double val ) <nl> + { <nl> + if ( ! handle ) <nl> + return CV_ERROR_FAIL ; <nl> + try <nl> + { <nl> + CaptureT * instance = ( CaptureT * ) handle ; <nl> + return instance - > setProperty ( prop , val ) ? CV_ERROR_OK : CV_ERROR_FAIL ; <nl> + } <nl> + catch ( . . . ) <nl> + { <nl> + return CV_ERROR_FAIL ; <nl> + } <nl> + } <nl> + <nl> + static <nl> + CvResult CV_API_CALL cv_capture_grab ( CvPluginCapture handle ) <nl> + { <nl> + if ( ! handle ) <nl> + return CV_ERROR_FAIL ; <nl> + try <nl> + { <nl> + CaptureT * instance = ( CaptureT * ) handle ; <nl> + return instance - > grabFrame ( ) ? CV_ERROR_OK : CV_ERROR_FAIL ; <nl> + } <nl> + catch ( . . . ) <nl> + { <nl> + return CV_ERROR_FAIL ; <nl> + } <nl> + } <nl> + <nl> + static <nl> + CvResult CV_API_CALL cv_capture_retrieve ( CvPluginCapture handle , int stream_idx , cv_videoio_retrieve_cb_t callback , void * userdata ) <nl> + { <nl> + if ( ! handle ) <nl> + return CV_ERROR_FAIL ; <nl> + try <nl> + { <nl> + CaptureT * instance = ( CaptureT * ) handle ; <nl> + Mat img ; <nl> + if ( instance - > retrieveFrame ( stream_idx , img ) ) <nl> + return callback ( stream_idx , img . data , ( int ) img . step , img . cols , img . rows , img . channels ( ) , userdata ) ; <nl> + return CV_ERROR_FAIL ; <nl> + } <nl> + catch ( . . . ) <nl> + { <nl> + return CV_ERROR_FAIL ; <nl> + } <nl> + } <nl> + <nl> + static <nl> + CvResult CV_API_CALL cv_writer_open ( const char * filename , int fourcc , double fps , int width , int height , int isColor , CV_OUT CvPluginWriter * handle ) <nl> + { <nl> + WriterT * wrt = 0 ; <nl> + try <nl> + { <nl> + wrt = new WriterT ( ) ; <nl> + Size sz ( width , height ) ; <nl> + if ( wrt & & wrt - > open ( filename , fourcc , fps , sz , isColor ) ) <nl> + { <nl> + * handle = ( CvPluginWriter ) wrt ; <nl> + return CV_ERROR_OK ; <nl> + } <nl> + } <nl> + catch ( . . . ) <nl> + { <nl> + } <nl> + if ( wrt ) <nl> + delete wrt ; <nl> + return CV_ERROR_FAIL ; <nl> + } <nl> + <nl> + static <nl> + CvResult CV_API_CALL cv_writer_release ( CvPluginWriter handle ) <nl> + { <nl> + if ( ! handle ) <nl> + return CV_ERROR_FAIL ; <nl> + WriterT * instance = ( WriterT * ) handle ; <nl> + delete instance ; <nl> + return CV_ERROR_OK ; <nl> + } <nl> + <nl> + static <nl> + CvResult CV_API_CALL cv_writer_get_prop ( CvPluginWriter / * handle * / , int / * prop * / , CV_OUT double * / * val * / ) <nl> + { <nl> + return CV_ERROR_FAIL ; <nl> + } <nl> + <nl> + static <nl> + CvResult CV_API_CALL cv_writer_set_prop ( CvPluginWriter / * handle * / , int / * prop * / , double / * val * / ) <nl> + { <nl> + return CV_ERROR_FAIL ; <nl> + } <nl> + <nl> + static <nl> + CvResult CV_API_CALL cv_writer_write ( CvPluginWriter handle , const unsigned char * data , int step , int width , int height , int cn ) <nl> + { <nl> + if ( ! handle ) <nl> + return CV_ERROR_FAIL ; <nl> + try <nl> + { <nl> + CV_Assert ( step > = 0 ) ; <nl> + WriterT * instance = ( WriterT * ) handle ; <nl> + Size sz ( width , height ) ; <nl> + Mat img ( sz , CV_MAKETYPE ( CV_8U , cn ) , ( void * ) data , ( size_t ) step ) ; <nl> + instance - > write ( img ) ; <nl> + return CV_ERROR_OK ; <nl> + } <nl> + catch ( . . . ) <nl> + { <nl> + return CV_ERROR_FAIL ; <nl> + } <nl> + } <nl> + <nl> + static const OpenCV_VideoIO_Plugin_API_preview plugin_api_v0 = <nl> + { <nl> + { <nl> + sizeof ( OpenCV_VideoIO_Plugin_API_preview ) , ABI_VERSION , API_VERSION , <nl> + CV_VERSION_MAJOR , CV_VERSION_MINOR , CV_VERSION_REVISION , CV_VERSION_STATUS , <nl> + " Microsoft Media Foundation OpenCV Video I / O plugin " <nl> + } , <nl> + / * 1 * / CAP_MSMF , <nl> + / * 2 * / cv_capture_open , <nl> + / * 3 * / cv_capture_release , <nl> + / * 4 * / cv_capture_get_prop , <nl> + / * 5 * / cv_capture_set_prop , <nl> + / * 6 * / cv_capture_grab , <nl> + / * 7 * / cv_capture_retrieve , <nl> + / * 8 * / cv_writer_open , <nl> + / * 9 * / cv_writer_release , <nl> + / * 10 * / cv_writer_get_prop , <nl> + / * 11 * / cv_writer_set_prop , <nl> + / * 12 * / cv_writer_write <nl> + } ; <nl> + <nl> + } / / namespace <nl> + <nl> + const OpenCV_VideoIO_Plugin_API_preview * opencv_videoio_plugin_init_v0 ( int requested_abi_version , int requested_api_version , void * / * reserved = NULL * / ) CV_NOEXCEPT <nl> + { <nl> + if ( requested_abi_version ! = 0 ) <nl> + return NULL ; <nl> + if ( requested_api_version ! = 0 ) <nl> + return NULL ; <nl> + return & cv : : plugin_api_v0 ; <nl> + } <nl> + <nl> + # endif / / BUILD_PLUGIN <nl> mmm a / modules / videoio / src / videoio_registry . cpp <nl> ppp b / modules / videoio / src / videoio_registry . cpp <nl> static const struct VideoBackendInfo builtin_backends [ ] = <nl> # ifdef WINRT_VIDEO <nl> DECLARE_STATIC_BACKEND ( CAP_WINRT , " WINRT " , MODE_CAPTURE_BY_INDEX , 0 , create_WRT_capture , 0 ) , <nl> # endif <nl> + <nl> # ifdef HAVE_MSMF <nl> DECLARE_STATIC_BACKEND ( CAP_MSMF , " MSMF " , MODE_CAPTURE_ALL | MODE_WRITER , cvCreateCapture_MSMF , cvCreateCapture_MSMF , cvCreateVideoWriter_MSMF ) , <nl> + # elif defined ( ENABLE_PLUGINS ) <nl> + DECLARE_DYNAMIC_BACKEND ( CAP_MSMF , " MSMF " , MODE_CAPTURE_ALL | MODE_WRITER ) , <nl> # endif <nl> + <nl> # ifdef HAVE_DSHOW <nl> DECLARE_STATIC_BACKEND ( CAP_DSHOW , " DSHOW " , MODE_CAPTURE_BY_INDEX , 0 , create_DShow_capture , 0 ) , <nl> # endif <nl> mmm a / modules / videoio / test / test_video_io . cpp <nl> ppp b / modules / videoio / test / test_video_io . cpp <nl> static const VideoCaptureAPIs backend_params [ ] = { <nl> CAP_AVFOUNDATION , <nl> # endif <nl> <nl> - # ifdef HAVE_MSMF <nl> + # ifdef _WIN32 <nl> CAP_MSMF , <nl> # endif <nl> <nl> inline static std : : ostream & operator < < ( std : : ostream & out , const Ext_Fourcc_PSNR <nl> <nl> static Ext_Fourcc_PSNR synthetic_params [ ] = { <nl> <nl> - # ifdef HAVE_MSMF <nl> + # ifdef _WIN32 <nl> # if ! defined ( _M_ARM ) <nl> { " wmv " , " WMV1 " , 30 . f , CAP_MSMF } , <nl> { " wmv " , " WMV2 " , 30 . f , CAP_MSMF } , <nl> | videoio : added plug - in support to MSMF backend | opencv/opencv | ca6a11e4d2c50040bb9237d72eda4402b0f0e005 | 2020-04-08T12:22:50Z |
mmm a / doc / tutorials / dnn / dnn_android / dnn_android . markdown <nl> ppp b / doc / tutorials / dnn / dnn_android / dnn_android . markdown <nl> Tutorial was written for the following versions of corresponding software : <nl> <nl> - Download and install Android Studio from https : / / developer . android . com / studio . <nl> <nl> - - Get the latest pre - built OpenCV for Android release from https : / / github . com / opencv / opencv / releases and unpack it ( for example , ` opencv - 3 . 4 . 10 - android - sdk . zip ` ) . <nl> + - Get the latest pre - built OpenCV for Android release from https : / / github . com / opencv / opencv / releases and unpack it ( for example , ` opencv - 3 . 4 . 11 - android - sdk . zip ` ) . <nl> <nl> - Download MobileNet object detection model from https : / / github . com / chuanqi305 / MobileNet - SSD . We need a configuration file ` MobileNetSSD_deploy . prototxt ` and weights ` MobileNetSSD_deploy . caffemodel ` . <nl> <nl> mmm a / doc / tutorials / introduction / cross_referencing / tutorial_cross_referencing . markdown <nl> ppp b / doc / tutorials / introduction / cross_referencing / tutorial_cross_referencing . markdown <nl> Open your Doxyfile using your favorite text editor and search for the key <nl> ` TAGFILES ` . Change it as follows : <nl> <nl> @ code <nl> - TAGFILES = . / docs / doxygen - tags / opencv . tag = http : / / docs . opencv . org / 3 . 4 . 10 <nl> + TAGFILES = . / docs / doxygen - tags / opencv . tag = http : / / docs . opencv . org / 3 . 4 . 11 <nl> @ endcode <nl> <nl> If you had other definitions already , you can append the line using a ` \ ` : <nl> <nl> @ code <nl> TAGFILES = . / docs / doxygen - tags / libstdc + + . tag = https : / / gcc . gnu . org / onlinedocs / libstdc + + / latest - doxygen \ <nl> - . / docs / doxygen - tags / opencv . tag = http : / / docs . opencv . org / 3 . 4 . 10 <nl> + . / docs / doxygen - tags / opencv . tag = http : / / docs . opencv . org / 3 . 4 . 11 <nl> @ endcode <nl> <nl> Doxygen can now use the information from the tag file to link to the OpenCV <nl> mmm a / modules / core / include / opencv2 / core / version . hpp <nl> ppp b / modules / core / include / opencv2 / core / version . hpp <nl> <nl> <nl> # define CV_VERSION_MAJOR 3 <nl> # define CV_VERSION_MINOR 4 <nl> - # define CV_VERSION_REVISION 10 <nl> - # define CV_VERSION_STATUS " - dev " <nl> + # define CV_VERSION_REVISION 11 <nl> + # define CV_VERSION_STATUS " - pre " <nl> <nl> # define CVAUX_STR_EXP ( __A ) # __A <nl> # define CVAUX_STR ( __A ) CVAUX_STR_EXP ( __A ) <nl> mmm a / modules / dnn / include / opencv2 / dnn / dnn . hpp <nl> ppp b / modules / dnn / include / opencv2 / dnn / dnn . hpp <nl> <nl> # include " opencv2 / core / async . hpp " <nl> <nl> # if ! defined CV_DOXYGEN & & ! defined CV_STATIC_ANALYSIS & & ! defined CV_DNN_DONT_ADD_EXPERIMENTAL_NS <nl> - # define CV__DNN_EXPERIMENTAL_NS_BEGIN namespace experimental_dnn_34_v17 { <nl> + # define CV__DNN_EXPERIMENTAL_NS_BEGIN namespace experimental_dnn_34_v18 { <nl> # define CV__DNN_EXPERIMENTAL_NS_END } <nl> - namespace cv { namespace dnn { namespace experimental_dnn_34_v17 { } using namespace experimental_dnn_34_v17 ; } } <nl> + namespace cv { namespace dnn { namespace experimental_dnn_34_v18 { } using namespace experimental_dnn_34_v18 ; } } <nl> # else <nl> # define CV__DNN_EXPERIMENTAL_NS_BEGIN <nl> # define CV__DNN_EXPERIMENTAL_NS_END <nl> mmm a / modules / python / package / setup . py <nl> ppp b / modules / python / package / setup . py <nl> def main ( ) : <nl> os . chdir ( SCRIPT_DIR ) <nl> <nl> package_name = ' opencv ' <nl> - package_version = os . environ . get ( ' OPENCV_VERSION ' , ' 3 . 4 . 10 ' ) # TODO <nl> + package_version = os . environ . get ( ' OPENCV_VERSION ' , ' 3 . 4 . 11 ' ) # TODO <nl> <nl> long_description = ' Open Source Computer Vision Library Python bindings ' # TODO <nl> <nl> mmm a / platforms / android / build_sdk . py <nl> ppp b / platforms / android / build_sdk . py <nl> def build_engine ( self , abi , engdest ) : <nl> # Add extra data <nl> apkxmldest = check_dir ( os . path . join ( apkdest , " res " , " xml " ) , create = True ) <nl> apklibdest = check_dir ( os . path . join ( apkdest , " libs " , abi . name ) , create = True ) <nl> - for ver , d in self . extra_packs + [ ( " 3 . 4 . 10 " , os . path . join ( self . libdest , " lib " ) ) ] : <nl> + for ver , d in self . extra_packs + [ ( " 3 . 4 . 11 " , os . path . join ( self . libdest , " lib " ) ) ] : <nl> r = ET . Element ( " library " , attrib = { " version " : ver } ) <nl> log . info ( " Adding libraries from % s " , d ) <nl> <nl> mmm a / platforms / android / service / readme . txt <nl> ppp b / platforms / android / service / readme . txt <nl> manually using adb tool : <nl> <nl> adb install < path - to - OpenCV - sdk > / apk / OpenCV_ < version > _Manager_ < app_version > _ < platform > . apk <nl> <nl> - Example : OpenCV_3 . 4 . 10 - dev_Manager_3 . 49_armeabi - v7a . apk <nl> + Example : OpenCV_3 . 4 . 11 - dev_Manager_3 . 49_armeabi - v7a . apk <nl> <nl> Use the list of platforms below to determine proper OpenCV Manager package for your device : <nl> <nl> mmm a / platforms / maven / opencv - it / pom . xml <nl> ppp b / platforms / maven / opencv - it / pom . xml <nl> <nl> < parent > <nl> < groupId > org . opencv < / groupId > <nl> < artifactId > opencv - parent < / artifactId > <nl> - < version > 3 . 4 . 10 < / version > <nl> + < version > 3 . 4 . 11 < / version > <nl> < / parent > <nl> < groupId > org . opencv < / groupId > <nl> < artifactId > opencv - it < / artifactId > <nl> mmm a / platforms / maven / opencv / pom . xml <nl> ppp b / platforms / maven / opencv / pom . xml <nl> <nl> < parent > <nl> < groupId > org . opencv < / groupId > <nl> < artifactId > opencv - parent < / artifactId > <nl> - < version > 3 . 4 . 10 < / version > <nl> + < version > 3 . 4 . 11 < / version > <nl> < / parent > <nl> < groupId > org . opencv < / groupId > <nl> < artifactId > opencv < / artifactId > <nl> mmm a / platforms / maven / pom . xml <nl> ppp b / platforms / maven / pom . xml <nl> <nl> < modelVersion > 4 . 0 . 0 < / modelVersion > <nl> < groupId > org . opencv < / groupId > <nl> < artifactId > opencv - parent < / artifactId > <nl> - < version > 3 . 4 . 10 < / version > <nl> + < version > 3 . 4 . 11 < / version > <nl> < packaging > pom < / packaging > <nl> < name > OpenCV Parent POM < / name > <nl> < licenses > <nl> | pre : OpenCV 3 . 4 . 11 ( version + + ) | opencv/opencv | a43e3bebe6c4913c183b4cd2378c1c3a4741b9e1 | 2020-06-08T18:46:27Z |
mmm a / swoole_http_v2_client_coro . c <nl> ppp b / swoole_http_v2_client_coro . c <nl> static PHP_METHOD ( swoole_http2_client_coro , goaway ) <nl> int ret ; <nl> char * frame ; <nl> uint8_t error_code = SW_HTTP2_ERROR_NO_ERROR ; <nl> - swString debug_data ; <nl> + char * debug_data = NULL ; <nl> + long debug_data_len = 0 ; <nl> <nl> if ( ! cli | | ! cli - > socket | | cli - > socket - > closed ) <nl> { <nl> static PHP_METHOD ( swoole_http2_client_coro , goaway ) <nl> RETURN_FALSE ; <nl> } <nl> <nl> - bzero ( & debug_data , sizeof ( debug_data ) ) ; <nl> - if ( zend_parse_parameters ( ZEND_NUM_ARGS ( ) TSRMLS_CC , " | ls " , & error_code , & debug_data . str , & debug_data . length ) = = FAILURE ) <nl> + if ( zend_parse_parameters ( ZEND_NUM_ARGS ( ) TSRMLS_CC , " | ls " , & error_code , & debug_data , & debug_data_len ) = = FAILURE ) <nl> { <nl> return ; <nl> } <nl> <nl> - size_t length = SW_HTTP2_FRAME_HEADER_SIZE + SW_HTTP2_GOAWAY_SIZE + debug_data . length ; <nl> + size_t length = SW_HTTP2_FRAME_HEADER_SIZE + SW_HTTP2_GOAWAY_SIZE + debug_data_len ; <nl> frame = emalloc ( length ) ; <nl> bzero ( frame , length ) ; <nl> - swHttp2_set_frame_header ( frame , SW_HTTP2_TYPE_GOAWAY , SW_HTTP2_GOAWAY_SIZE + debug_data . length , error_code , 0 ) ; <nl> + swHttp2_set_frame_header ( frame , SW_HTTP2_TYPE_GOAWAY , SW_HTTP2_GOAWAY_SIZE + debug_data_len , error_code , 0 ) ; <nl> * ( uint32_t * ) ( frame + SW_HTTP2_FRAME_HEADER_SIZE ) = htonl ( hcc - > last_stream_id ) ; <nl> * ( uint32_t * ) ( frame + SW_HTTP2_FRAME_HEADER_SIZE + 4 ) = htonl ( error_code ) ; <nl> - memcpy ( frame + SW_HTTP2_FRAME_HEADER_SIZE + SW_HTTP2_GOAWAY_SIZE , debug_data . str , debug_data . length ) ; <nl> + memcpy ( frame + SW_HTTP2_FRAME_HEADER_SIZE + SW_HTTP2_GOAWAY_SIZE , debug_data , debug_data_len ) ; <nl> swTraceLog ( SW_TRACE_HTTP2 , " [ " SW_ECHO_GREEN " ] Send : last - sid = % d , error - code = % d " , swHttp2_get_type ( SW_HTTP2_TYPE_GOAWAY ) , hcc - > last_stream_id , error_code ) ; <nl> <nl> ret = cli - > send ( cli , frame , length , 0 ) ; <nl> | Optimize goaway . | swoole/swoole-src | 9815b4cb45c98bbf1f3242e77d0a78e1a751aabe | 2018-08-22T10:32:37Z |
mmm a / src / mongo / db / sorter / sorter . cpp <nl> ppp b / src / mongo / db / sorter / sorter . cpp <nl> namespace mongo { <nl> public : <nl> typedef std : : pair < Key , Value > Data ; <nl> <nl> + InMemIterator ( const Data & singleValue ) : _data ( 1 , singleValue ) { } <nl> + <nl> template < typename Container > <nl> InMemIterator ( const Container & input ) : _data ( input . begin ( ) , input . end ( ) ) { } <nl> <nl> namespace mongo { <nl> const SortOptions & opts , <nl> const Comparator & comp ) <nl> : _opts ( opts ) <nl> - , _done ( false ) <nl> + , _remaining ( opts . limit ? opts . limit : numeric_limits < unsigned long long > : : max ( ) ) <nl> , _first ( true ) <nl> , _greater ( comp ) <nl> { <nl> namespace mongo { <nl> } <nl> <nl> if ( _heap . empty ( ) ) { <nl> - _done = true ; <nl> + _remaining = 0 ; <nl> return ; <nl> } <nl> <nl> namespace mongo { <nl> _heap . pop_back ( ) ; <nl> } <nl> <nl> - bool more ( ) { return ! _done & & ( _first | | ! _heap . empty ( ) | | _current - > more ( ) ) ; } <nl> + bool more ( ) { <nl> + if ( _remaining > 0 & & ( _first | | ! _heap . empty ( ) | | _current - > more ( ) ) ) <nl> + return true ; <nl> + <nl> + / / We are done so clean up resources . <nl> + / / Can ' t do this in next ( ) due to lifetime guarantees of unowned Data . <nl> + _heap . clear ( ) ; <nl> + _current . reset ( ) ; <nl> + <nl> + return false ; <nl> + } <nl> + <nl> Data next ( ) { <nl> - verify ( ! _done ) ; <nl> + verify ( _remaining ) ; <nl> + <nl> + _remaining - - ; <nl> <nl> if ( _first ) { <nl> _first = false ; <nl> namespace mongo { <nl> <nl> class STLComparator { / / uses greater rather than less - than to maintain a MinHeap <nl> public : <nl> - STLComparator ( const Comparator & comp ) : _comp ( comp ) { } <nl> + explicit STLComparator ( const Comparator & comp ) : _comp ( comp ) { } <nl> bool operator ( ) ( ptr < const Stream > lhs , ptr < const Stream > rhs ) const { <nl> / / first compare data <nl> int ret = _comp ( lhs - > current ( ) , rhs - > current ( ) ) ; <nl> namespace mongo { <nl> } ; <nl> <nl> SortOptions _opts ; <nl> - bool _done ; <nl> + unsigned long long _remaining ; <nl> bool _first ; <nl> boost : : shared_ptr < Stream > _current ; <nl> std : : vector < boost : : shared_ptr < Stream > > _heap ; / / MinHeap <nl> namespace mongo { <nl> , _settings ( settings ) <nl> , _opts ( opts ) <nl> , _memUsed ( 0 ) <nl> - { } <nl> + { verify ( _opts . limit = = 0 ) ; } <nl> <nl> void add ( const Key & key , const Value & val ) { <nl> _data . push_back ( std : : make_pair ( key , val ) ) ; <nl> namespace mongo { <nl> private : <nl> class STLComparator { <nl> public : <nl> - STLComparator ( const Comparator & comp ) : _comp ( comp ) { } <nl> + explicit STLComparator ( const Comparator & comp ) : _comp ( comp ) { } <nl> bool operator ( ) ( const Data & lhs , const Data & rhs ) const { <nl> return _comp ( lhs , rhs ) < 0 ; <nl> } <nl> namespace mongo { <nl> std : : vector < boost : : shared_ptr < Iterator > > _iters ; / / data that has already been spilled <nl> } ; <nl> <nl> + template < typename Key , typename Value , typename Comparator > <nl> + class LimitOneSorter : public Sorter < Key , Value > { <nl> + / / Since this class is only used for limit = = 1 , it omits all logic to <nl> + / / spill to disk and only tracks memory usage if explicitly requested . <nl> + public : <nl> + typedef std : : pair < Key , Value > Data ; <nl> + typedef SortIteratorInterface < Key , Value > Iterator ; <nl> + <nl> + LimitOneSorter ( const SortOptions & opts , const Comparator & comp ) <nl> + : _comp ( comp ) <nl> + { verify ( opts . limit = = 1 ) ; } <nl> + <nl> + void add ( const Key & key , const Value & val ) { <nl> + Data contender ( key , val ) ; <nl> + if ( _comp ( _best , contender ) < = 0 ) <nl> + return ; / / not good enough <nl> + <nl> + _best = contender ; <nl> + } <nl> + <nl> + Iterator * done ( ) { <nl> + return new sorter : : InMemIterator < Key , Value > ( _best ) ; <nl> + } <nl> + <nl> + / / TEMP these are here for compatibility . Will be replaced with a general stats API <nl> + int numFiles ( ) const { return 0 ; } <nl> + size_t memUsed ( ) const { return _best . first . memUsageForSorter ( ) <nl> + + _best . second . memUsageForSorter ( ) ; } <nl> + <nl> + private : <nl> + const Comparator _comp ; <nl> + Data _best ; <nl> + } ; <nl> + <nl> + template < typename Key , typename Value , typename Comparator > <nl> + class TopKSorter : public Sorter < Key , Value > { <nl> + public : <nl> + typedef std : : pair < Key , Value > Data ; <nl> + typedef SortIteratorInterface < Key , Value > Iterator ; <nl> + typedef std : : pair < typename Key : : SorterDeserializeSettings <nl> + , typename Value : : SorterDeserializeSettings <nl> + > Settings ; <nl> + <nl> + TopKSorter ( const SortOptions & opts , <nl> + const Comparator & comp , <nl> + const Settings & settings = Settings ( ) ) <nl> + : _comp ( comp ) <nl> + , _settings ( settings ) <nl> + , _opts ( opts ) <nl> + , _memUsed ( 0 ) <nl> + { <nl> + / / This also * works * with limit = = 1 but LimitOneSorter should be used instead <nl> + verify ( _opts . limit > 1 ) ; <nl> + <nl> + / / Preallocate a fixed sized vector of the required size if we <nl> + / / don ' t expect it to have a major impact on our memory budget . <nl> + / / This is the common case with small limits . <nl> + if ( ( sizeof ( Data ) * opts . limit ) < opts . maxMemoryUsageBytes / 10 ) { <nl> + _data . reserve ( opts . limit ) ; <nl> + } <nl> + } <nl> + <nl> + void add ( const Key & key , const Value & val ) { <nl> + STLComparator less ( _comp ) ; <nl> + <nl> + if ( _data . size ( ) < _opts . limit ) { <nl> + _data . push_back ( std : : make_pair ( key , val ) ) ; <nl> + <nl> + _memUsed + = key . memUsageForSorter ( ) ; <nl> + _memUsed + = val . memUsageForSorter ( ) ; <nl> + <nl> + if ( _data . size ( ) = = _opts . limit ) <nl> + std : : make_heap ( _data . begin ( ) , _data . end ( ) , less ) ; <nl> + <nl> + if ( _memUsed > _opts . maxMemoryUsageBytes ) <nl> + spill ( ) ; <nl> + <nl> + return ; <nl> + } <nl> + <nl> + verify ( _data . size ( ) = = _opts . limit ) ; <nl> + <nl> + Data contender ( key , val ) ; <nl> + if ( _comp ( _data . front ( ) , contender ) < = 0 ) <nl> + return ; / / not good enough <nl> + <nl> + / / Remove the old worst pair and insert the contender , adjusting _memUsed <nl> + <nl> + _memUsed + = key . memUsageForSorter ( ) ; <nl> + _memUsed + = val . memUsageForSorter ( ) ; <nl> + <nl> + _memUsed - = _data . front ( ) . first . memUsageForSorter ( ) ; <nl> + _memUsed - = _data . front ( ) . second . memUsageForSorter ( ) ; <nl> + <nl> + std : : pop_heap ( _data . begin ( ) , _data . end ( ) , less ) ; <nl> + _data . back ( ) = contender ; <nl> + std : : push_heap ( _data . begin ( ) , _data . end ( ) , less ) ; <nl> + <nl> + if ( _memUsed > _opts . maxMemoryUsageBytes ) <nl> + spill ( ) ; <nl> + } <nl> + <nl> + Iterator * done ( ) { <nl> + if ( _iters . empty ( ) ) { <nl> + sort ( ) ; <nl> + return new sorter : : InMemIterator < Key , Value > ( _data ) ; <nl> + } <nl> + <nl> + spill ( ) ; <nl> + return Iterator : : merge ( _iters , _opts , _comp ) ; <nl> + } <nl> + <nl> + / / TEMP these are here for compatibility . Will be replaced with a general stats API <nl> + int numFiles ( ) const { return _iters . size ( ) ; } <nl> + size_t memUsed ( ) const { return _memUsed ; } <nl> + <nl> + private : <nl> + class STLComparator { <nl> + public : <nl> + explicit STLComparator ( const Comparator & comp ) : _comp ( comp ) { } <nl> + bool operator ( ) ( const Data & lhs , const Data & rhs ) const { <nl> + return _comp ( lhs , rhs ) < 0 ; <nl> + } <nl> + private : <nl> + const Comparator & _comp ; <nl> + } ; <nl> + <nl> + void sort ( ) { <nl> + STLComparator less ( _comp ) ; <nl> + <nl> + if ( _data . size ( ) = = _opts . limit ) { <nl> + std : : sort_heap ( _data . begin ( ) , _data . end ( ) , less ) ; <nl> + } else { <nl> + std : : stable_sort ( _data . begin ( ) , _data . end ( ) , less ) ; <nl> + } <nl> + } <nl> + <nl> + void spill ( ) { <nl> + if ( _data . empty ( ) ) <nl> + return ; <nl> + <nl> + if ( ! _opts . extSortAllowed ) <nl> + uasserted ( 16820 , str : : stream ( ) <nl> + < < " Sort exceeded memory limit of " < < _opts . maxMemoryUsageBytes <nl> + < < " bytes , but did not opt - in to external sorting . Aborting operation . " <nl> + ) ; <nl> + <nl> + sort ( ) ; <nl> + <nl> + SortedFileWriter < Key , Value > writer ( _settings ) ; <nl> + for ( size_t i = 0 ; i < _data . size ( ) ; i + + ) { <nl> + writer . addAlreadySorted ( _data [ i ] . first , _data [ i ] . second ) ; <nl> + } <nl> + <nl> + / / clear _data and release backing array ' s memory <nl> + std : : vector < Data > ( ) . swap ( _data ) ; <nl> + <nl> + _iters . push_back ( boost : : shared_ptr < Iterator > ( writer . done ( ) ) ) ; <nl> + <nl> + _memUsed = 0 ; <nl> + } <nl> + <nl> + const Comparator _comp ; <nl> + const Settings _settings ; <nl> + SortOptions _opts ; <nl> + size_t _memUsed ; <nl> + std : : vector < Data > _data ; / / the " current " data <nl> + std : : vector < boost : : shared_ptr < Iterator > > _iters ; / / data that has already been spilled <nl> + } ; <nl> + <nl> template < typename Key , typename Value > <nl> template < typename Comparator > <nl> Sorter < Key , Value > * Sorter < Key , Value > : : make ( const SortOptions & opts , <nl> const Comparator & comp , <nl> const Settings & settings ) { <nl> - if ( opts . limit = = 0 ) { <nl> - return new NoLimitSorter < Key , Value , Comparator > ( opts , comp , settings ) ; <nl> + switch ( opts . limit ) { <nl> + case 0 : return new NoLimitSorter < Key , Value , Comparator > ( opts , comp , settings ) ; <nl> + case 1 : return new LimitOneSorter < Key , Value , Comparator > ( opts , comp ) ; <nl> + default : return new TopKSorter < Key , Value , Comparator > ( opts , comp , settings ) ; <nl> } <nl> - <nl> - verify ( ! " limit not yet supported " ) ; <nl> } <nl> } <nl> <nl> mmm a / src / mongo / db / sorter / sorter . h <nl> ppp b / src / mongo / db / sorter / sorter . h <nl> namespace mongo { <nl> * Runtime options that control the Sorter ' s behavior <nl> * / <nl> struct SortOptions { <nl> - long long limit ; / / / number of KV pairs to be returned . 0 for no limit . <nl> + unsigned long long limit ; / / / number of KV pairs to be returned . 0 for no limit . <nl> size_t maxMemoryUsageBytes ; / / / Approximate . <nl> bool extSortAllowed ; / / / If false , uassert if more mem needed than allowed . <nl> SortOptions ( ) <nl> namespace mongo { <nl> # define MONGO_CREATE_SORTER ( Key , Value , Comparator ) \ <nl> template class : : mongo : : Sorter < Key , Value > ; \ <nl> template class : : mongo : : NoLimitSorter < Key , Value , Comparator > ; \ <nl> + template class : : mongo : : LimitOneSorter < Key , Value , Comparator > ; \ <nl> + template class : : mongo : : TopKSorter < Key , Value , Comparator > ; \ <nl> template class : : mongo : : SortIteratorInterface < Key , Value > ; \ <nl> template class : : mongo : : SortedFileWriter < Key , Value > ; \ <nl> template class : : mongo : : sorter : : MergeIterator < Key , Value , Comparator > ; \ <nl> | SERVER - 9443 First part of limit support for new framework | mongodb/mongo | 52f8a9555f4dd71a7787d4a7a1412a9e5e8415a2 | 2013-05-13T21:02:42Z |
mmm a / hphp / doc / ir . specification <nl> ppp b / hphp / doc / ir . specification <nl> fields of that struct for holding intermediate values . <nl> Set element with key S1 in S0 to S2 . The dest will be a new Dict that should <nl> replace S0 . <nl> <nl> + | BespokeGet < T , Layout > , DParam ( Cell ) , SBespokeArr S ( Int , Str ) , B <nl> + <nl> + Get element of type T with key S1 in bespoke array S0 using the GetInt / GetStr <nl> + implementations on the layout provided . If no layout is provided , the general <nl> + BespokeArray dispatch is used . <nl> + <nl> + | BespokeSet < T , Layout > , DParam ( ArrLike ) , SBespokeArr S ( Int , Str ) S ( Cell ) , PRc | CRc <nl> + <nl> + Set element with key S1 in bespoke array S0 to S2 , returning an array of type <nl> + T . <nl> + <nl> + NB : Currently , the layout provided is unused and generic BespokeArray <nl> + dispatch is performed . This will be rectified when a suitable <nl> + SetIntMove / SetStrMove layout method is available . <nl> + <nl> + | BespokeAppend < T , Layout > , DParam ( ArrLike ) , SBespokeArr S ( Cell ) , PRc | CRc <nl> + <nl> + Append element S1 to bespoke array S0 using the Append implementation on the <nl> + layout provided , returning an array of type T . If no layout is provided , the <nl> + general BespokeArray dispatch is used . <nl> + <nl> + <nl> | MapSet , ND , S ( Obj ) S ( Int , Str ) S ( Cell ) , CRc <nl> <nl> Set element with key S1 in S0 to S2 . <nl> mmm a / hphp / runtime / base / bespoke - layout . cpp <nl> ppp b / hphp / runtime / base / bespoke - layout . cpp <nl> <nl> # include " hphp / runtime / base / bespoke / layout . h " <nl> # include " hphp / runtime / base / bespoke / logging - array . h " <nl> # include " hphp / runtime / base / bespoke - array . h " <nl> + # include " hphp / runtime / vm / jit / ssa - tmp . h " <nl> <nl> namespace HPHP { <nl> <nl> std : : string BespokeLayout : : describe ( ) const { <nl> return m_layout - > describe ( ) ; <nl> } <nl> <nl> + namespace { <nl> + bool checkLayoutMatches ( const bespoke : : Layout * layout , SSATmp * arr ) { <nl> + auto const DEBUG_ONLY layoutType = <nl> + arr - > type ( ) . unspecialize ( ) . narrowToBespokeLayout ( BespokeLayout ( layout ) ) ; <nl> + assertx ( arr - > type ( ) < = layoutType ) ; <nl> + <nl> + return true ; <nl> + } <nl> + } <nl> + <nl> SSATmp * BespokeLayout : : emitGet ( <nl> IRGS & env , SSATmp * arr , SSATmp * key , Block * taken ) const { <nl> + assertx ( checkLayoutMatches ( m_layout , arr ) ) ; <nl> return m_layout - > emitGet ( env , arr , key , taken ) ; <nl> } <nl> <nl> SSATmp * BespokeLayout : : emitSet ( <nl> IRGS & env , SSATmp * arr , SSATmp * key , SSATmp * val ) const { <nl> + assertx ( checkLayoutMatches ( m_layout , arr ) ) ; <nl> return m_layout - > emitSet ( env , arr , key , val ) ; <nl> } <nl> <nl> SSATmp * BespokeLayout : : emitAppend ( IRGS & env , SSATmp * arr , SSATmp * val ) const { <nl> + assertx ( checkLayoutMatches ( m_layout , arr ) ) ; <nl> return m_layout - > emitAppend ( env , arr , val ) ; <nl> } <nl> <nl> mmm a / hphp / runtime / vm / jit / check . cpp <nl> ppp b / hphp / runtime / vm / jit / check . cpp <nl> bool checkOperandTypes ( const IRInstruction * inst , const IRUnit * / * unit * / ) { <nl> return true ; <nl> } ; <nl> <nl> + auto const checkBespokeArr = [ & ] ( ) { <nl> + auto const t = src ( ) - > type ( ) ; <nl> + check ( t . isKnownDataType ( ) & & t < = TArrLike , t , " Known ArrLike " ) ; <nl> + <nl> + auto const srcLayout = t . arrSpec ( ) . bespokeLayout ( ) ; <nl> + check ( srcLayout . has_value ( ) , t , " Bespoke ArrLike " ) ; <nl> + <nl> + auto const givenLayout = inst - > extra < BespokeLayoutData > ( ) - > layout ; <nl> + if ( givenLayout ) { <nl> + auto const expected = BespokeLayout ( givenLayout ) ; <nl> + auto const errMsg = <nl> + folly : : sformat ( " Bespoke with Layout = { } " , expected . describe ( ) ) . c_str ( ) ; <nl> + check ( expected = = * srcLayout , t , errMsg ) ; <nl> + } <nl> + <nl> + + + curSrc ; <nl> + } ; <nl> + <nl> auto checkArr = [ & ] ( bool is_kv , bool is_const ) { <nl> auto const t = src ( ) - > type ( ) ; <nl> auto const cond_type = RuntimeOption : : EvalHackArrDVArrs <nl> using TypeNames : : TCA ; <nl> } <nl> # define SVArr checkArr ( false / * is_kv * / , false / * is_const * / ) ; <nl> # define SDArr checkArr ( true / * is_kv * / , false / * is_const * / ) ; <nl> + # define SBespokeArr checkBespokeArr ( ) ; <nl> # define CDArr checkArr ( true / * is_kv * / , true / * is_const * / ) ; <nl> # define ND <nl> # define DMulti <nl> using TypeNames : : TCA ; <nl> # undef SVArr <nl> # undef SVArrOrNull <nl> # undef SDArr <nl> + # undef SBespokeArr <nl> # undef CDArr <nl> <nl> # undef ND <nl> mmm a / hphp / runtime / vm / jit / dce . cpp <nl> ppp b / hphp / runtime / vm / jit / dce . cpp <nl> bool canDCE ( IRInstruction * inst ) { <nl> case DictSet : <nl> case MapSet : <nl> case VectorSet : <nl> + case BespokeSet : <nl> + case BespokeAppend : <nl> case SetElem : <nl> case SetRange : <nl> case SetRangeRev : <nl> bool canDCE ( IRInstruction * inst ) { <nl> case ProfileSubClsCns : <nl> case CheckVecBounds : <nl> case CheckVecBoundsLA : <nl> + case BespokeGet : <nl> case LdVectorSize : <nl> case BeginCatch : <nl> case EndCatch : <nl> mmm a / hphp / runtime / vm / jit / extra - data . h <nl> ppp b / hphp / runtime / vm / jit / extra - data . h <nl> <nl> <nl> # include " hphp / runtime / base / collections . h " <nl> # include " hphp / runtime / base / typed - value . h " <nl> + # include " hphp / runtime / base / bespoke / layout . h " <nl> # include " hphp / runtime / vm / bytecode . h " <nl> # include " hphp / runtime / vm / iter . h " <nl> # include " hphp / runtime / vm / srckey . h " <nl> struct MethCallerData : IRExtraData { <nl> bool isCls ; <nl> } ; <nl> <nl> + struct BespokeLayoutData : IRExtraData { <nl> + explicit BespokeLayoutData ( const bespoke : : Layout * layout ) <nl> + : layout ( layout ) <nl> + { } <nl> + <nl> + std : : string show ( ) const { <nl> + return layout ? folly : : sformat ( " { } " , layout - > describe ( ) ) <nl> + : " Generic " ; <nl> + } <nl> + <nl> + const bespoke : : Layout * layout ; <nl> + } ; <nl> + <nl> / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / <nl> <nl> # define X ( op , data ) \ <nl> X ( FuncHasAttr , AttrData ) ; <nl> X ( LdMethCallerName , MethCallerData ) ; <nl> X ( LdRecDescCached , RecNameData ) ; <nl> X ( LdRecDescCachedSafe , RecNameData ) ; <nl> + X ( BespokeGet , BespokeLayoutData ) ; <nl> + X ( BespokeSet , BespokeLayoutData ) ; <nl> + X ( BespokeAppend , BespokeLayoutData ) ; <nl> <nl> # undef X <nl> <nl> mmm a / hphp / runtime / vm / jit / ir - instruction . cpp <nl> ppp b / hphp / runtime / vm / jit / ir - instruction . cpp <nl> bool consumesRefImpl ( const IRInstruction * inst , int srcNo ) { <nl> <nl> case VecSet : <nl> case DictSet : <nl> + case BespokeSet : <nl> + case BespokeAppend : <nl> / / Consumes the reference to its input array , and moves input value <nl> return move = = Consume & & ( srcNo = = 0 | | srcNo = = 2 ) ; <nl> <nl> mmm a / hphp / runtime / vm / jit / ir - opcode . cpp <nl> ppp b / hphp / runtime / vm / jit / ir - opcode . cpp <nl> bool opcodeMayRaise ( Opcode opc ) { <nl> case AllocObj : <nl> case AllocObjReified : <nl> case BaseG : <nl> + case BespokeSet : <nl> + case BespokeAppend : <nl> case Call : <nl> case CallBuiltin : <nl> case CGetElem : <nl> bool opcodeMayRaise ( Opcode opc ) { <nl> case AsyncSwitchFast : <nl> case BeginCatch : <nl> case BeginInlining : <nl> + case BespokeGet : <nl> case Ceil : <nl> case CheckArrayCOW : <nl> case CheckCold : <nl> new file mode 100644 <nl> index 00000000000 . . 3175583352b <nl> mmm / dev / null <nl> ppp b / hphp / runtime / vm / jit / irlower - bespoke . cpp <nl> <nl> + / * <nl> + + mmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmm - + <nl> + | HipHop for PHP | <nl> + + mmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmm - + <nl> + | Copyright ( c ) 2010 - present Facebook , Inc . ( http : / / www . facebook . com ) | <nl> + + mmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmm - + <nl> + | This source file is subject to version 3 . 01 of the PHP license , | <nl> + | that is bundled with this package in the file LICENSE , and is | <nl> + | available through the world - wide - web at the following url : | <nl> + | http : / / www . php . net / license / 3_01 . txt | <nl> + | If you did not receive a copy of the PHP license and are unable to | <nl> + | obtain it through the world - wide - web , please send a note to | <nl> + | license @ php . net so we can mail you a copy immediately . | <nl> + + mmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmm - + <nl> + * / <nl> + <nl> + # include " hphp / runtime / vm / jit / irlower . h " <nl> + # include " hphp / runtime / vm / jit / irlower - internal . h " <nl> + # include " hphp / runtime / vm / jit / ir - opcode . h " <nl> + <nl> + namespace HPHP { namespace jit { namespace irlower { <nl> + <nl> + void cgBespokeSet ( IRLS & env , const IRInstruction * inst ) { <nl> + / / TODO ( mcolavita ) : layout - based dispatch when we have move layout methods <nl> + auto const target = [ & ] { <nl> + if ( inst - > src ( 1 ) - > isA ( TStr ) ) { <nl> + return CallSpec : : direct ( BespokeArray : : SetStrMove ) ; <nl> + } else { <nl> + assertx ( inst - > src ( 1 ) - > isA ( TInt ) ) ; <nl> + return CallSpec : : direct ( BespokeArray : : SetIntMove ) ; <nl> + } <nl> + } ( ) ; <nl> + auto const args = argGroup ( env , inst ) . ssa ( 0 ) . ssa ( 1 ) . typedValue ( 2 ) ; <nl> + auto & v = vmain ( env ) ; <nl> + cgCallHelper ( v , env , target , callDest ( env , inst ) , SyncOptions : : Sync , args ) ; <nl> + } <nl> + <nl> + void cgBespokeAppend ( IRLS & env , const IRInstruction * inst ) { <nl> + auto const target = [ & ] { <nl> + auto const layout = inst - > extra < BespokeLayoutData > ( ) - > layout ; <nl> + if ( layout ) { <nl> + return CallSpec : : direct ( layout - > vtable ( ) - > fnAppend ) ; <nl> + } else { <nl> + return CallSpec : : direct ( BespokeArray : : Append ) ; <nl> + } <nl> + } ( ) ; <nl> + auto const args = argGroup ( env , inst ) . ssa ( 0 ) . typedValue ( 1 ) ; <nl> + auto & v = vmain ( env ) ; <nl> + cgCallHelper ( v , env , target , callDest ( env , inst ) , SyncOptions : : Sync , args ) ; <nl> + } <nl> + <nl> + void cgBespokeGet ( IRLS & env , const IRInstruction * inst ) { <nl> + auto & v = vmain ( env ) ; <nl> + auto const dst = dstLoc ( env , inst , 0 ) ; <nl> + auto const retElem = dst . reg ( 0 ) ; <nl> + auto const retType = dst . reg ( 1 ) ; <nl> + auto const dest = callDest ( retElem , retType ) ; <nl> + auto const target = [ & ] { <nl> + if ( inst - > src ( 1 ) - > isA ( TStr ) ) { <nl> + return CallSpec : : direct ( BespokeArray : : NvGetStr ) ; <nl> + } else { <nl> + assertx ( inst - > src ( 1 ) - > isA ( TInt ) ) ; <nl> + return CallSpec : : direct ( BespokeArray : : NvGetInt ) ; <nl> + } <nl> + } ( ) ; <nl> + auto const args = argGroup ( env , inst ) . ssa ( 0 ) . ssa ( 1 ) ; <nl> + cgCallHelper ( v , env , target , dest , SyncOptions : : Sync , args ) ; <nl> + <nl> + emitTypeTest ( v , env , TUninit , retType , retElem , v . makeReg ( ) , <nl> + [ & ] ( ConditionCode cc , Vreg sf ) { <nl> + fwdJcc ( v , env , cc , sf , inst - > taken ( ) ) ; <nl> + } <nl> + ) ; <nl> + } <nl> + <nl> + } } } <nl> mmm a / hphp / runtime / vm / jit / memory - effects . cpp <nl> ppp b / hphp / runtime / vm / jit / memory - effects . cpp <nl> MemEffects memory_effects_impl ( const IRInstruction & inst ) { <nl> } ; <nl> } <nl> <nl> + case BespokeGet : { <nl> + auto const base = inst . src ( 0 ) ; <nl> + auto const key = inst . src ( 1 ) ; <nl> + if ( key - > isA ( TInt ) ) { <nl> + return PureLoad { <nl> + key - > hasConstVal ( ) ? AElemI { base , key - > intVal ( ) } : AElemIAny <nl> + } ; <nl> + } else { <nl> + return PureLoad { AElemAny } ; <nl> + } <nl> + } <nl> + <nl> case InitVecElemLoop : <nl> { <nl> auto const extra = inst . extra < InitVecElemLoop > ( ) ; <nl> MemEffects memory_effects_impl ( const IRInstruction & inst ) { <nl> case KeysetGet : <nl> case VecSet : <nl> case DictSet : <nl> + case BespokeSet : <nl> + case BespokeAppend : <nl> case ConcatStrStr : <nl> case PrintStr : <nl> case PrintBool : <nl> | Introduce IR ops to dispatch to bespoke layout operations | facebook/hhvm | 3678e76dc5bdc6cbe34992771f379e1adaa69160 | 2020-10-15T03:02:32Z |
mmm a / android / sdk / src / main / java / com / taobao / weex / ui / component / WXScroller . java <nl> ppp b / android / sdk / src / main / java / com / taobao / weex / ui / component / WXScroller . java <nl> public WXComponent createInstance ( WXSDKInstance instance , WXDomObject node , WXVC <nl> / * * <nl> * Map for storing component that is sticky . <nl> * * / <nl> - private Map < String , HashMap < String , WXComponent > > mStickyMap = new HashMap < > ( ) ; <nl> + private Map < String , Map < String , WXComponent > > mStickyMap = new HashMap < > ( ) ; <nl> private FrameLayout mRealView ; <nl> <nl> private int mContentHeight = 0 ; <nl> public int getOrientation ( ) { <nl> return mOrientation ; <nl> } <nl> <nl> - public Map < String , HashMap < String , WXComponent > > getStickMap ( ) { <nl> + public Map < String , Map < String , WXComponent > > getStickMap ( ) { <nl> return mStickyMap ; <nl> } <nl> <nl> mmm a / android / sdk / src / main / java / com / taobao / weex / ui / view / WXScrollView . java <nl> ppp b / android / sdk / src / main / java / com / taobao / weex / ui / view / WXScrollView . java <nl> private void showStickyView ( ) { <nl> } <nl> } <nl> <nl> - private View procSticky ( Map < String , HashMap < String , WXComponent > > mStickyMap ) { <nl> + private View procSticky ( Map < String , Map < String , WXComponent > > mStickyMap ) { <nl> if ( mStickyMap = = null ) { <nl> return null ; <nl> } <nl> - HashMap < String , WXComponent > stickyMap = mStickyMap . get ( mWAScroller . getRef ( ) ) ; <nl> + Map < String , WXComponent > stickyMap = mStickyMap . get ( mWAScroller . getRef ( ) ) ; <nl> if ( stickyMap = = null ) { <nl> return null ; <nl> } <nl> | * [ android ] fix build | apache/incubator-weex | 8c23b93aa39922d5249751a20b980024250bcfc7 | 2017-03-07T02:08:29Z |
mmm a / js / apps / aardvark / aardvark . js <nl> ppp b / js / apps / aardvark / aardvark . js <nl> var FoxxApplication = require ( " org / arangodb / foxx " ) . Application , <nl> app = new FoxxApplication ( applicationContext ) , <nl> underscore = require ( " underscore " ) ; <nl> <nl> - var foxxes = app . createRepository ( <nl> - " foxxes " , <nl> - { <nl> - repository : " repositories / foxxes " <nl> - } <nl> - ) ; <nl> - <nl> - var docus = app . createRepository ( <nl> - " docus " , <nl> - { <nl> - repository : " repositories / swagger " <nl> - } <nl> - ) ; <nl> + var foxxes = new ( require ( " lib / foxxes " ) . Foxxes ) ( ) ; <nl> + var docus = new ( require ( " lib / swagger " ) . Swagger ) ( ) ; <nl> <nl> / / . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . <nl> / / install <nl> new file mode 100644 <nl> index 00000000000 . . 0862789a1ed <nl> mmm / dev / null <nl> ppp b / js / apps / aardvark / lib / foxxes . js <nl> <nl> + / * jslint indent : 2 , nomen : true , maxlen : 100 , white : true , plusplus : true , unparam : true * / <nl> + / * global exports , appCollection * / <nl> + <nl> + / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / <nl> + / / / @ brief A TODO - List Foxx - Application written for ArangoDB <nl> + / / / <nl> + / / / @ file <nl> + / / / <nl> + / / / DISCLAIMER <nl> + / / / <nl> + / / / Copyright 2010 - 2013 triagens GmbH , Cologne , Germany <nl> + / / / <nl> + / / / Licensed under the Apache License , Version 2 . 0 ( the " License " ) ; <nl> + / / / you may not use this file except in compliance with the License . <nl> + / / / You may obtain a copy of the License at <nl> + / / / <nl> + / / / http : / / www . apache . org / licenses / LICENSE - 2 . 0 <nl> + / / / <nl> + / / / Unless required by applicable law or agreed to in writing , software <nl> + / / / distributed under the License is distributed on an " AS IS " BASIS , <nl> + / / / WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND , either express or implied . <nl> + / / / See the License for the specific language governing permissions and <nl> + / / / limitations under the License . <nl> + / / / <nl> + / / / Copyright holder is triAGENS GmbH , Cologne , Germany <nl> + / / / <nl> + / / / @ author Michael Hackstein <nl> + / / / @ author Copyright 2011 - 2013 , triAGENS GmbH , Cologne , Germany <nl> + / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / <nl> + <nl> + exports . Foxxes = function ( ) { <nl> + " use strict " ; <nl> + <nl> + / / Define the Repository <nl> + var aal = require ( " internal " ) . db . _collection ( " _aal " ) , <nl> + foxxmanager = require ( " org / arangodb / foxx - manager " ) , <nl> + <nl> + defaultThumb = " iVBORw0KGgoAAAANSUhEUgAAAKUAAAClCAYAAAA9Kz3aAAAYGWlDQ1BJQ0MgUHJvZmlsZQAAWAmteXk4VW33 / 73PhOM45nme53km8zzPs3DM8zyrZEimMoQSKiqiosGUECKRRIUGZIhMFRUl5LdP6Xne9 / pe73 + / fV1n789e + 3Ove91rrT2sdQBgaSSEhwcjqAAICY2OtDbQ5nJ0cuYimQJIQAMAwAMUwSsqXMvS0hQ + + x / b1jiAiJdeiBN1 / Q / S / xJTe / tEeQEAWcIET + 8orxAYNwKAbPUKj4wGAE3UxxcXHU7E + TCmi4QNhPEVIvb7g1uJ2PMPHvrNsbXWgTkzAJDiCIRIPwAo1mA5V6yXH6wHjwMAQxPqHRAKD + OCsbqXP8EbABYPmCMWEhJGxLkwFvL8Dz1 + / 4EJBM9 / dBIIfv / gP2uBR8IT6wZEhQcTEn6f / P / chQTHwP76vXHAe1xUkI0JfGSA / RbvRdCzgTETjE / 7 + xiZHsirw6O1rQ / k7QHRRrYwpoM5L / 1jDO0O8FJMkJ0WjNlg + W5QmAmRD / sJwRTqaW4BYzgbEHxeUTqw74lzIRQS / W0dDjim3j66ejCGswjhGBlm / ZfvHxVr81eemOivY / 6XH0gwJsYbD / OzCZEw + m0P4pxPsAFxXh5YfiM82pJoJ3Gu4dBg84O1IN77RuoTOUT5T5 + o3 + sl2uYf7W9rCMthm5FU0ZG2RA68RiSbb4C + EYxh25BS / pGGf + Wa4cG / cxoei7SNjLEm + oEPxr4 + oXZEHxLl2d4EXaJvYZ8gy4E + IIBI4AM8QShYBlzAFOgA3YM9FywPhWVeIAwEw79ILsq / V9CL6FH0HHoMPYN + / VcGjzzggQDgDeM / uv5jPCy3AYngI6zVB0T9nQ3FglJHqaJM4b0m / JNBKaGU / 14bXmtZ + 4sPbPWDx4of6NY + sD4W1rj3l + cekBr5Fx + M8fxnxP + 1SR + 8hz3g95chdV1qWWr37 / h / V4zRw + hiDDH6GGFkJvIush / ZjRxAtiNbABfyAbIVOYTsIOIDu / 7OQoAlRK8QPRwFTGAv + oCY32ehf + f7Ly / F / MM40IAXwcsDa3hUKAiCrwX8M4P9b6sD / o + WGJjhCc8YCHNN / onHgV0oAdi78ihtlBrsZ9jHKAYUCxBHycEe10JpwDGQh6X / RvG / VyMOfH97O / b3WoLAIryOkGif + Gg4l4BOWHhCZICffzSXFvy09BHjMgr1khDjkpGSlgXEZy + RA8BX69 / PVIjh2b8ynyUADsF5TDbyryzwDAB1fQAwZv8rE3ABgFkMgNvPvWIiY / / oQxEPaIAFlPBdwQw4AC8Qgj0iAxSAKtAEesAYWABb4ATc4Bz2ByGwxXHgCEgBGSAH5INicB5cBJfBNXAT3AEtoB10g0fgCRgBY + AtmAELYBWsgy2wA0EQCUQB0ULMECfED4lCMpASpA7pQaaQNeQEeUB + UCgUAx2B0qAcqBA6D1VCtdBt6B7UDQ1Ao9BraBZahr5APxFIBA5Bh2BHCCAkEUoILYQJwhZxGOGHiEAkItIRpxHnEFWIG4hmRDfiCWIMMYNYRWwiAZIcyYDkRoojlZA6SAukM9IXGYk8hsxGliCrkPXINjgXXyBnkGvIbRQGRYviQonDkTRE2aG8UBGoY6hc1HnUNVQzqhf1AjWLWkf9QlOg2dCiaBW0EdoR7YeOQ2egS9DV6CZ0H3w / L6C3MBgMA0YQowhnuxMmEJOEycVUYBowXZhRzDxmk4SEhJlElESNxIKEQBJNkkFSSnKD5AHJc5IFkh + k5KScpDKk + qTOpKGkqaQlpHWknaTPST + Q7pBRkfGTqZBZkHmTJZDlkV0hayN7RrZAtoOlxgpi1bC22EBsCvYcth7bh53EfiUnJ + chVya3Ig8gP05 + jvwW + WPyWfJtHA1OBKeDc8XF4E7janBduNe4rxQUFAIUmhTOFNEUpylqKR5STFP8wNPiJfBGeG98Mr4M34x / jv9ESUbJT6lF6UaZSFlCeZfyGeUaFRmVAJUOFYHqGFUZ1T2qCapNalpqaWoL6hDqXOo66gHqJRoSGgEaPRpvmnSayzQPaeZpkbS8tDq0XrRptFdo + 2gX6DB0gnRGdIF0OXQ36Ybp1ulp6OXo7enj6cvoO + hnGJAMAgxGDMEMeQx3GMYZfjKyM2ox + jBmMdYzPmf8zsTKpMnkw5TN1MA0xvSTmYtZjzmIuYC5hXmKBcUiwmLFEsdygaWPZY2VjlWV1Ys1m / UO6xs2BJsImzVbEttltiG2TXYOdgP2cPZS9ofsaxwMHJocgRxFHJ0cy5y0nOqcAZxFnA84V7joubS4grnOcfVyrXOzcRtyx3BXcg9z7 / AI8tjxpPI08EzxYnmVeH15i3h7eNf5OPnM + I7wXed7w0 / Gr8Tvz3 + Wv5 / / u4CggIPASYEWgSVBJkEjwUTB64KTQhRCGkIRQlVCL4UxwkrCQcIVwiMiCBF5EX + RMpFnoghRBdEA0QrRUTG0mLJYqFiV2IQ4TlxLPFb8uvisBIOEqUSqRIvEJ0k + SWfJAsl + yV9S8lLBUlek3krTSBtLp0q3SX + REZHxkimTeSlLIasvmyzbKrshJyrnI3dB7pU8rbyZ / En5Hvk9BUWFSIV6hWVFPkUPxXLFCSU6JUulXKXHymhlbeVk5XblbRUFlWiVOyqfVcVVg1TrVJcOCR7yOXTl0LwajxpBrVJtRp1L3UP9kvqMBrcGQaNKY06TV9Nbs1rzg5awVqDWDa1P2lLakdpN2t91VHSO6nTpInUNdLN1h / Vo9Oz0zutN6 / Po + + lf1183kDdIMugyRBuaGBYYThixG3kZ1RqtGysaHzXuNcGZ2JicN5kzFTGNNG0zQ5gZm50xmzTnNw81b7EAFkYWZyymLAUtIyzvW2GsLK3KrBatpa2PWPfb0Nq429TZbNlq2 + bZvrUTsoux67GntHe1r7X / 7qDrUOgw4yjpeNTxiROLU4BTqzOJs71ztfOmi55LscuCq7xrhuv4YcHD8YcH3Fjcgt063CndCe53PdAeDh51HrsEC0IVYdPTyLPcc91Lx + us16q3pneR97KPmk + hzwdfNd9C3yU / Nb8zfsv + Gv4l / msBOgHnAzYCDQMvBn4PsgiqCdoPdghuCCEN8Qi5F0oTGhTaG8YRFh82Gi4anhE + E6ESURyxHmkSWR0FRR2Oao2mgz9yh2KEYk7EzMaqx5bF / oizj7sbTx0fGj + UIJKQlfAhUT / xahIqySup5wj3kZQjs0e1jlYeg455HutJ5k1OT144bnD8Wgo2JSjlaapUamHqtzSHtLZ09vTj6fMnDE5cz8BnRGZMnFQ9eTETlRmQOZwlm1Wa9SvbO3swRyqnJGc31yt38JT0qXOn9k / 7nh7OU8i7kI / JD80fL9AouFZIXZhYOH / G7ExzEVdRdtG3YvfigRK5kotnsWdjzs6cMz3XWspXml + 6e97 / / FiZdllDOVt5Vvn3Cu + K5xc0L9RfZL + Yc / HnpYBLryoNKpurBKpKLmMux15evGJ / pf + q0tXaapbqnOq9mtCamWvW13prFWtr69jq8q4jrsdcX77hemPkpu7N1nrx + soGhoacW + BWzK2V2x63x + + Y3Om5q3S3vpG / sbyJtim7GWpOaF5v8W + ZaXVqHb1nfK + nTbWt6b7E / Zp27vayDvqOvE5sZ3rn / oPEB5td4V1r3X7d8z3uPW8fOj582WvVO9xn0vf4kf6jh / 1a / Q8eqz1uH1AZuDeoNNjyROFJ85D8UNNT + adNwwrDzc8Un7WOKI + 0jR4a7Xyu8bz7he6LRy + NXj4ZMx8bHbcbfzXhOjHzyvvV0uvg1xtvYt / svD0 + iZ7MnqKaKplmm656J / yuYUZhpmNWd3Zozmbu7bzX / Or7qPe7C + mLFIslHzg / 1C7JLLUv6y + PrLisLKyGr + 6sZXyk / lj + SehT42fNz0PrjusLG5Eb + 19yvzJ / rfkm961n03Jzeitka + d79g / mH9e2lbb7fzr8 / LATt0uye25PeK / tl8mvyf2Q / f1wQiTh97cAEt4jfH0B + FID10VOANCOAIDF / 6mNfjPgz10I5sDYHtJDaCGVUExoLIaURIrUiSwN + wCHoSDgW6iw1ME0g3Ty9OWMgCmIeZhVgS2ffZVTkyuPe5QXy6fM7yQQJBgi5CqsLcIusiH6SKxUPEhCTZJC8p1Ug / RxGStZbtmPcvfkTyhYKbIpLijVK8eraKliVV8cKlfzVhdT / 6LRonlES1sbp / 1Op1O3Tq9Cv8DgmCHBSMOYyXjDZMi03qzCvNKi3XLeGm3DbMtiR2WPtN912HECzmQueFeKw6jDm25z7iMeXYS7ntVepd7ZPgm + fn62 / toBcoEiQdzBzCGUocjQb2Fz4SMR9yOvRJ2OTo7JiG2KRyX4JHYdAUcFjqkkGx13SYlJPZ1WnJ50Qu7EfEbeSctM / izybJCDyKU + JXRaPc8836HAudD5jGORfbFtidVZ83MmpQbntcvUy5UrZC + IXxS5JFVpUpV2eeaqUfWNmtVa6jr + 69I3VG / q1ps1ONxyv + 1 / J / xuXOOxptTmEy2ZrTn38tqK75e3V3c0dvY9mOia6R7vaXjo28vU + 7iv5FFcv + / jwwMOg1ZPTIYMnhoO2z6LGLk0 + voF + UvJMZ1xowm9V0qv + d / g32y / XZp8NdU9ffld2ozfrN2c + bzZe4sFi0XjD8pLjEszy9krciszq9fWEj8afiL9VPvZ4PP8 + uWN + C9uXy2 + mW0GbvX8OPmzZU93f / 8g / tJIFHIZNYOex6yTIskUsP7k5bgZvAhlHNUjGmbaBLqXDDKMqUxTLPKsGWwjHCycjlwF3O08k7ybfFv8KwJPBS8LRQqri5CKvBS9KBYoLi / + S + KR5GkpB2lO6Q8y9bKxcmrykHyfQraihRKt0rhyqYqLKrvqJJwFrurM6hMaZzVdtAS0drTHdG7r5ur56B8yoDZYNGw3KjaONfEx9TTzNw + zCLH0tLKwVrURsWW1w9sj7LccPjiOOz10rncpc80 + nOgW4O7ooUuQ9GTygrxWvMd8en2b / Kr9SwLSA8OCnII1QwRDKeBMmA2fjvgWxR3tHlMa2x33Kn4 + YS1x + wj5UY5jQslcxzHH36U0pealRaa7nbDLcDwZkJmWVZF9M6cpt / lU4 + nbeTfzawuuFl46U1ZUXJxXknU29VxCadh5v7KA8uMVDy4KX7pWJXi58MqLq9s1 + Gsstbx1InAeKN5Ur9dtMLvldDv4Tsbdy42dTaPN0y1LrV / bkPcZ20U7VDs1Hyh2cXcjuud6 + h829db0lT3K7z / xOHEgcjD6SdZQ + zDDs6MjU89ZXmi8tB3zHT8 + cfXVs9ff3tJMik + ZToe / Oztzf / b53PT83PvVRTQc / ZTl0VXqNamP8p8EPlN + / rG + uDHxZfDrvW + Vm8lb9t8Fv2 / 9aN9O / Km6g9vV3Vs + iL8EtIqoQLqhhNEk6A3MMskK6RzZBjkWx0 + hhXemTKG6QT1Ks0 / HT6 / HEMh4gukicyNLH + tjtkfs9zkqOeO5tLl + cl / hMeFZ5c3kE + Tr4Xfj3xYoEpQSHBTyEyYRrhExFPkgmiEmJNYn7iUBJCokD0m + koqBv24aZExllmTT5DjkWuWt5dcUTihyKrbAXy1LyskqDCrXVbVUnx / yOvRJLUmdRL1MQ05jXDNRi0OrVdtC + 7WOv86 + bpWepT6Z / kODI4ZyhitGVcauJkwm46bFZjbmlOYDFmmWqpbfrBqsg2wEbd7bVtodtme2f + mQ52jouO / U5Bzswucy5Vpy2PzwlluRO797o4eWxxtCvCeP5yv4OeLvY + Cr6KfsbxRACAwJIgRrhFCFTIZeDQsJlw / fjXgYmR1lGU0f / TbmYqx3nEDcYvyFBL2EycTgJLqkF0fuH + 081pv88Pi9lNrUkrS09LATLhl6J0Uy0Zkvs0qznXP4cnZyZ049PX0v71L + sQKXQpUzLGe2i8aL75ScPXvqXGFp5fm7ZY / KX1WsXNi5RFHJVSV72fCK69Ww6mM1Wddya4 / XEa4r3sDf + HLzY / 32Ldxtjjsydy0bk5oam3 + 0Kt8Lbyu9f6u9teN + 58CDzW6Dnnu9Nn2b / SUDsoMvh04Ne4wYPdd6qT0e / Bo / uTo3vLL5bZsY / z89MuI7AaMAwJkUABwzALDTAKCgFwCBMbjuxAJgSQGArTJACPgCBG4IQCqz / 7w / ILiPiAHkgBruSXECQSAFVOCeiQVwhivkKLi6zAMXQD3oBM / ALPgGV45skDRkALlDcVABdAN6DC0iMAghhCkiClEB13n7cF0Xi7yH / IUyQJ1BzaFl0ZnodxgVTClmB66wBkkVSWvIWMkKsOTYLHIseT6OBVdDIUfRjlfDt1EqUd6nMqR6Sx1NQ0Vzk1aXdpTOlm6U3oL + OYM7ww / GUiY1pmnmoyysLG2sbmxkbO3ssRxyHF8573BFcstz7 / L085bw + fMfEsALzAjeFcoU9hTREhUQw4vtiH + SeC85JtUknSQjLTMtmyknL / dZvlWhUDFByVvZVEVKlfEQXk1CvUxTVOuU9oDOZz1SfXoDZkM2Iz5jORNz0wizc + a9Fl + seK0dbE7b9tujHHQdM5yGXBhcPQ / Xub33wBCoPTGem14L3pM + K36U / iYBxYEfgg + FFIV + CjeOqIvCRUfEvInTj29NFE + qPsp1rOw4Q0pBGjY95cTmycDM1eyc3JDTTQXUZ1iKPpbUnnM / z1A2UnHqosGlzaq8K3RXM6u3rgXVfrmef1OvgfrWxp3FxqXm1dYPbfPtGw8Yu3UeuvV59NsMaDyRfCr8TGE09MWPCdQbssmL72hnOxfwS0dWtT42fN75ovBNfwv7 / dSPwe2lnws7r3cb9 / J / ee5L / X5 + EONPAvfkaOCeAzcQAbJADRjCfQYPuMOQBLJAKagF9 + A + whRYh9AQCyT1O / oJUBF0CxqGPiIoEbIIZ0Qa4g5iAcmJdEdeQa6hFFDpqDG0MDoFPQnHvowEkPiTjJHqkbaSSZLVYYWxN8jlyB / gLHHzFPF4MnwxJTflLbh + fUsdR8NA00JrT / uR7ig9lv4cgzjDIGMYEyNTF3MACx1LF2sYGx / bJHsphyMnE + drrgpubx4pXsD7ku86f7qAq6AcXMutCA + J3IXfYnniaRJHJKOlvKQ1ZXAyw7LZcibyjPIbCq8V + 5WalatUclUTD8WqZam3anzXktX21snRrdZr1r9vcN + ww2jAeNYUYSZibm9xwrLFas2Gz9bdrsJ + 2pHHKdC52ZXksIPbefc + j1FCj2etV6Z3gI + 1r6Gfk39qQFcQRbBnSHsYS3hixFSUdnRtLGVcePyTRO6k2CMjx + STr6SwphalY08kZaxlErLmchJPSeUh8qcKbxfFlsid / VJ6uyymQuXCz0vVVTKXK658qBas8b92q47xevlNtfqPt0rvKN8dbiI077RWtVm1g47aB6ZdGz0Xez0fqTzmHkQ9efo09hlmJPs57kXVmPuE2evgtzVTH2Y45yzfpyx2LjOu5n8SWH / 6tWgrd9toR2b3wt77XxsH8UcBMrj3ygRHXxTuNekAS7jDFAKOwnd + JWgEj8E0fN / jIAFIEzoMJUFlUAc0iyCDo05AFCNGkPRIH2QHig11HLWCdkI / xehgOuB + SjepKekUWRSWEnuL3B6HxLVQROCl8T8o + 6hKqWNonGiN6IzprRiMGRWZhJnlWdxZE9ii2T05bDnNucy4zXhMec34rPndBaIETwnVCT8WWRajEFeU8JU8LzUuwyLrLdcgv6NoqfRUJeuQkzpaI19zV9tEJw2OYIt + u0Gn4bDRjomJabO5hMUNKwnrZlsdu3GHECes8w1XezdqD3JPd28Xn / d + qv45AYtB1sFDoWZhzyNcIpeik2I54qYTHiV1Ha1Itjv + M7Uy3T6D8 + R6VkdO7infPIMC5sInRb7FW2fTSqnPV5UrVDy96FsJVZVfUbo6VhNTy1r3 + EZyvcEtyTv6jcnNVa15bU7tjB0TD8q6nR6S9F59JNd / f0BvcGIoflhyBDm6 / mJpbHSi4LXgm4q3v6b0prPfPZmlnLObv / R + eVH6Q9DSpeXHKytr6I9sn6Q + 6647bBC + eH + 1 / MbzbXPz1BbbVt135e / nv2 / / cPjRvM2wHbndvL3zU / Nn + s + BHfyOzc7ZnZFd0l3N3fjd27vLe9x7TnuFe4N7e7 + kf3n / Ovvrya9f + 9L7Pvvn9oeI8Y / ylZUhvj0AhNOG24 / T + / tfBQAgKQRgr2B / f6dqf3 / vMlxsTALQFfznfxciGQP3OMvXiWiQu4x4 + K / t / wEZGLhf4 / dDDgAAAAlwSFlzAAALEwAACxMBAJqcGAAAAdVpVFh0WE1MOmNvbS5hZG9iZS54bXAAAAAAADx4OnhtcG1ldGEgeG1sbnM6eD0iYWRvYmU6bnM6bWV0YS8iIHg6eG1wdGs9IlhNUCBDb3JlIDUuMS4yIj4KICAgPHJkZjpSREYgeG1sbnM6cmRmPSJodHRwOi8vd3d3LnczLm9yZy8xOTk5LzAyLzIyLXJkZi1zeW50YXgtbnMjIj4KICAgICAgPHJkZjpEZXNjcmlwdGlvbiByZGY6YWJvdXQ9IiIKICAgICAgICAgICAgeG1sbnM6dGlmZj0iaHR0cDovL25zLmFkb2JlLmNvbS90aWZmLzEuMC8iPgogICAgICAgICA8dGlmZjpDb21wcmVzc2lvbj4xPC90aWZmOkNvbXByZXNzaW9uPgogICAgICAgICA8dGlmZjpQaG90b21ldHJpY0ludGVycHJldGF0aW9uPjI8L3RpZmY6UGhvdG9tZXRyaWNJbnRlcnByZXRhdGlvbj4KICAgICAgICAgPHRpZmY6T3JpZW50YXRpb24 + MTwvdGlmZjpPcmllbnRhdGlvbj4KICAgICAgPC9yZGY6RGVzY3JpcHRpb24 + CiAgIDwvcmRmOlJERj4KPC94OnhtcG1ldGE + CuSSjykAABgNSURBVHgB7V0JfBRF1v9XCBiI4QhRIBwCghAgN4oIyiUeK3gfsOwqoruKtyur + x17eX2f6 + fx4X2sF14IuogH64qCnHJkkkAOQI4ECGcI4QiXQO + rrp4jZJLpmanp6Z6p9 / tlpqb71av3Xv3T3VX9qh7TiKBIecBGHkiwkS5KFeUB3QOJ8e4HbfcasBNHgRYpQGpPv + 7Q6naDHdimn9PS + oAlJvnlc + JBO9of31fKfVvAns8AXsgBij5oFFNs7ybBQ3ys + ONG + Rx3wqb2xzcoiz704ihngrd8aqnLedDO7KEf1VxvnHrWub9tan / cglIf3xU8LwDVc3ijt2434tjAu / Uiq1gC7PnJfdix33a2P25BiS1LCVw7BKjyJgUGV + Z4L0 / h + 96yU0s2tj9uQclc7wk4taCv / tcGhlbrdKDvFYLP9Si0kycC17Exh53tj09QHjsEFL8mIJN1G428k83Bx31F3QewTfPM1bEjl83tj09Qls8CjhloyZtoGjZan19Aa2Wwu94xXc92jDa3Pz5B6XpT4CQ1FVq3IaYxw + cnWfb9gr + EppAO15quaytGm9sff6DcWwGsN269 + VPAGAsOL3k3C / 7j9FUyM7i6duB2gP3xB0rfSfKm5iYbA1B6HtCxlzjrMp5LG + O143EH2B9XoNTn5lxPC6j0vhho2y002Ay8V9TbvBL8NZ1TyCn2xxUoWeVCoIaGzpxyJ4nvED61zJto + C0qssJpIUiIThWn2B9XoITrXR0NWhJ99bsqZGSw0zsAGVeL + oVP0pwlf8B0ADnE / vgB5dGDwKq3dOSwrDuB5u65nRDBlHurqLifLprr54YoxMJqDrI / fkBZ9hnwswCB5h5Bh4EJrc9l0Nxz7q63w5BkUVUH2R8 / oCwQc5PaGelgXQeHjQTWrAVY7kNCTtkn0A5Vhy0zogIcZH98gLJmA7CJBjlELO8BeX2f + 2shi16Ds9Uz5MmVLclh9scHKH2jenJ8on3C7fyO2UB6fyGl4PVwpUWuvsPsj3lQatpJwPW46PA + lwOtu8jt / PzJQl5VEbCzRK5sCdKcaH / Mg1KP5qk1pmxyJ0ro5voi9DnLZsaxIvvFWTrR / pgHJVxicltrScDpO7Y + oiT8YslpNGd5g5DkegraCWOIL0G2FBEOtD + 2QXmE3t6sFhPmLPsempvkyIwA5d0ihNJUKFv / TQQaCFGkQ + 2PbVCW0tykcedGrhHdE2L / NlVN63UJcLrBUfBOU6zWnnOo / bENygIjiqdDT6DLuREDBGvWHMh7RMgv + xR8nbgtyKH2xywotep1QOUygY18unVHmnKMOUuNz1lOj3RrAeU72f6YBaUneodH82SNC9iJYTN0oPnKrrlCzMqXwxYXrgAn2x + ToNRXGhYac5N8xJ3SKdw + Nlc / 7w7Bt70c2E7zllEip9ufGCW / RbRZtvE7wAibhDuaJ6ItGsIHXA98SRFI9NoRRTQV1SnHf6sLnqb1PTX + z5k8qg39HVjyGX65bW + / X629BxlFI9NTUIzRjAkEig / 1lYfskSNA4mnWGfjJL2n57kdi1eMfjoIHbjSgZ9p6g40bnDR3QHtwLVjaOf6Z7W6 / f609R2Pv9s2vQCUf6gay3AesBSRvNUfMWTJaWs7WzvE4ul6heXvSi46E8dfogjcn2F / PGQ1 / xNztW9 / aLuNGYWn + 7Q0tjvARrdfFFIk0kWI3CZX7t / pv7b4N / o9LOOoI + wPYGZu37wBGq9P29kDs3b7t7W + lnQkPKFCacJJisdYDCpTW + lu1ZsIDCpQmnKRYrPWAAqW1 / latmfCAAqUJJykWaz2gQGmtv1VrJjygQGnCSYrFWg8oUFrrb9WaCQ8oUJpwkmKx1gMKlNb6W7VmwgMKlCacpFis9UB8g3JbITBtDHBoj7Ved2BretjtnCnA8lcjrn3Mha6Z9Zi2eQnw7hAwigHGPyjEbcI / zFaNSz5WQHt7LnpG2P5zHTDE2HEuAt6Izyvlxu / B3jIAmdoGGDM1Aq6NLZEaXzefacSpfk1XzO / + GjED4y + ecscq4BXaLY1vUtCOdhC4vTTkDfmrt27AptVLsW93lZ76pGufPHTNGIiWKbTcwWYkQ1e + JQ2bTrvWlX4qrBv7AnC + / OXLcQVK3amv5gPbVtPua + TX324iYHYPGj7F8z7FP9 / 4M6rKCdB + qPfg4Zj42MdIaU97o0eZZOuqnTgG9sHVAF / qQQ9 / 2r1NrBUK0fa4AiXmPQHM / W / hKv4M2Y + cGwQdOXQQ7 / 7XTSid / 7WoRQ8 / 3frl4Oz8EWjeIgmVZctRUfwd + PbibTq0w23PzEH3 / oOCaEEea0R1PbAd2vO0IzJ / Hj9rELTbF4MluLeeC9 + G + AHljmLgxRz61yan8cwQE2YF5b2jdQfwyr2jsbFQ7Lpx0fi7MPbu / 8VpySn15BzYsxNvTrkSm4qWo23HNPxpdhUSm / tZ0Vivltwflui64k1g1m90xbUrngO74AFpRsTPQGf + kwKQHB9j6FkoSJrxt8k6IHnWvGsffhbXP / xSA0BykfyWfe / rC5HeJwO1O6qx7AsatVpMVuiqDZwErftgYdn3D0I7zi + bcig + QMmXndJm + ToN + j3dW7sG5b3yJXOwfDYlCCW66Y + vYvj4B5usz6 + Moyf9SeeZ + / bjTfLKPmmVrowlgI16TFefHW5iOXEIBsYHKEs + E7tWcAcNuC5oN82hQQ2ntG5dcf6VNKdpgnJH3aBvh7lnaxWOHKRkOxaRlbpq3Yd507YUiX1AZZgZH6AspOcfTm0ToXU + T5RNflb9VIyKohU69 + hb / 4iEZuYe6Dlf + y699XrVVZFb5 + 1rhtW6soREsAF3CxXKP5e2BWLMg1Krq / ZuCZj1UNCplF3ffqw7vU3H9jj3CrH7hS8Qmiq369hTP71nG009WUBR0XXAtcIyGkCy9d9KsZJmmmKb2L4tXgMb23DKy9GgVLlqqX4sa / iNAUfRtTu3YvOalahaV4StawtpYPSNXvdonTW376joytO2uKl2s7sU1nfMgxL7tnodlNLRWzZROnnyJCpKftA523cWV71Tqx3 / + RiK532GhTNexMaVi089bdnvqOnaqj3An2j4TnO + F4AwLE / EJ + Moa8I1tLHoTU2K0XbTzP088cDfJKP7pAmZbtaIfu / 3Xim10zu5MyKbarJu724co9gDTu079xAFn8 / dW9bjpckXoqZqh360XXoH9Bt6Fbr2zafXjfk0rzkMB6sNAT71IlGMqq6t6XXtXnpjUFshxbREFNNWyKnnBBZ2mMK7OK9ZMiPTrKxw + HyulHpK5CBkHTpY6 + FO7dTdU + aFnRXlmPrbwTiwex869uqFK + 97Fv2GXIGEBO9jekJC83p1IvkjmrpqbTLB9tJjTu0aKSYm6kEJLdsEFKbvs8gDGMySCZlmRYXFd + Kot7q / vSK9ZxuUDu + n + U2DUtPr377nffCMB5D3v / EjktvSbSyKFE1dWYKx / + fxA1I8kIgpJgV1HgjTvFJUkyTEN + 3dQbrNptYHV1OtnDzBQ4kEJbWq / zpx7TIxiBl05W + iDkiuYTR11Q5sEI9F7QYY3grvy3uvCU + OfWu36eLRTeOgDIJaprTzcNfu9D6bnjxxAnu3iQFU67TOHh7fQl1tNY4e8t7 + fc9FohxNXT0zHG26SzEt5kGp + YCSHdgZlNNatU718Nds98418onxTr376edKFjQM7ODPm / 93c64eLeQREOFC1HTlI8FjhnFtukmxMuanhJjv7XvP + qCcltw2jd7g8FsjsGd7BcT7GSEi / / KbUbXmDyj850wc3DcC + aPHow0luC9b / DWWf / kKkpLb4aysfFSuKgiqzVCZo6ZrjY9Pg4wpaMzWmAelRqBkfIDGpyzKPgIuooAMk8QDK7pk5GBzSRFN + 3ivlLz6yAlTsG7FXKxZNBc / LZ2v / 7nFdskYgDv + / xt97tIqUEZN17LZbrMpuPQCbzmMUsyDUt + wPu9hWlNCUTtbCgmcBK52DeccG / Nh98wLdFBWlon3324 + fgufPPVf + JFC01bPn4Xdm8vpStkN2aOuw6Axk9AiqSWVrwe / rfIlElZQNHTVVv9dDHJ4YqszM6SYGR9Bvvy2 / axx872cctgMnWLaeaWLv8Jr94zR + f / j0xJ06tnfdF2rGS3XdWcJMDVTmHnlS8Cgu6SYHPMDHd1L7Xt5A1KX / Q9lbqAAQJOUMfhytO10ps793XtPmawVHTbLdV36ojCUUfz0gBukGR0foCR3sQuMq2MNTYj / QMA0SfwNzUXjfqdzr / xyGnjQhV3JUl0r6T3 / iteEK / JvazT7WSi + ihtQov + 1FOB7vfDR / MfoPWGpaX / xSPOOvXvro / C3HrkGdbX0ytWmZImux49Cm / Vr4QH + TuGyv0n1RvyAktymjX1JREpr9GPWRFr77fMKsgm38pHthL + 8j8Qk0GrFlXhu0rnYs62iiRr0GpiuqIF4mhQQ4klLdJ3 / BNguYzbimq + Alt753BDVrlctOgOdCCfMrGfhqT9KZgAf3SiOZoyFNn6m / / yJp9aj3 + uWz8Wr948GXyOVckYKLr39CeRf8kvPa8ajh + toFL4OK + ZMw4KPn0P3zKG4 / 42FfiRF / lDEdF36AiVFvU8YkH8rraKTvzAuOqCMdMLMQH3 + / V9piugvgovWfmvjppsG5pa1Lnz06ERsLVvtaaVVu0QKAD4d + 3d5XyueRlOjI2 / + M0ZP / M + AwcEeQZIL0nVd9jIw + 26hZc / hwK + + ALihkik6oJx6Nr0i2RieKfetoyBH33csQYpb / AzA98ThlDcRuO5tvWjmg7 / 7Lvp + JlbOeR8bCr7G4f0n9Wp8A4IO3bPQM28Yho17AMmtve / OzciNBI80XVdR2OJ0ir3l1PcKYBzdcZq3FL8lf0YHlJKNCFnc8tegfXsn2C0 / Al0GhSyG37b5VnlJreRfNUJWqpGKIevKt0ucdiktTz4b2g3TTN9ZGlGjycPxDUrumiP7gKTA8aRNejFeTlLwhUa50 / kqxkiSAmUkvatkh + SBuJoSCslDqpLlHlCgtNzlqsFAHlCgDOQhdd5yDyhQWu5y1WAgDyhQBvKQOm + 5BxQoLXe5ajCQBxQoA3lInbfcAwqUlrtcNRjIAwqUgTykzlvuAQVKy12uGgzkgci + xAzUukPOa3W7wQ5s07XV0vqA8WjfGCFt9xowvt9SCwohD2JLm0iar66UJrzL + LLcF3L0P1b8sYkaDmGh / STZ87QslttW9IFtlFagNNMVXc6DdmYPnVNzvWGmhjN4ij706pkzwVuOckmB0mQHsIEi4ppVLKEA5Z9M1rIvm54queB5oWDP4ba5dXOFFCi5F8xQ5ngvV + H73rJTS1uW0j / XDqF93iRbWaFAabY7WqeLZQCc3 / UoNL7rlYOJud4T2regL7782EakQBlMZ7ivKBSszjbNC6amvXiPHaKtwl8TOmXdRiPvZFvpp0AZRHdofX4BrZVRwfVOEDVtxlo + y7unJF80ZzNSoAyiQ / j8JMu + X9QooSmUw7VB1LYRq + tNoUxqKrRuQ2ykmFBFgTLYLsm7WdQ4Tl8lM4OtHX3 + vRXAeuPRI39K0BnYrDBAgTJYL6fngXKUiFou47ksWBnR5PedJLfR3KSvSxQofb1htjzwXsG5eSX4azqnkD436XpaqNv7Ykqg2s2WqitQhtAtWiZlZ2OiIiucFoKE6FRhlbSvUQ1NHXDKnSS + bfipQBlCp + iZyzKuFjULn6Q5S / 6A6QByvasrqfF4kn5X2VZhBcpQuyb3VlFzP08pPDdUKdbVO3oQWPWW3h7LupP2AXLPbVmngtmWFCjNeuoUPq3PZWKvS37cZX5zrFPEWPez7DPaVls0p7lnEKxrPaiWFCiDcpeXmeeqZLkPiQNln0A7VO09acdSgZib1CjXD + s62I4aenRSoPS4IoRCrrHFMr0GZ6tnhCDAoio1G4BNNMghYnkPWNRo6M0oUIbuO5qvzAbS + wsJBa + HIymydX2jmnJ8op0i22rI0hUoQ3adUTF / sihUFdHm / iXhSpNeX9NoQ1fX40Jun8sB37SA0luTI1CBMkw / 6nOWzQwhRfaLs9SjmWqNKavciWFaa011Bcow / cyS04AMI7GR6yloJ4whbphypVV3icl9je8E3XesNLGRFKRAKcO7ebcIKTQVyNZ / I0OiHBl8l + LVYsKcZd8TsT3K5SjrlaJA6fVFyCWt1yWAe7vzgndCliO9YinNTbpfNuUa0U3SG5EvUIFSgk9Zs + aUYeIRIansU / B14ragAiOKqUNPSjRwri1UMqOEAqUZL5nhyTHmLDU + ZzndTI2I8mjVlNKlcploI59u3Q4iBUpZndWB5it5zmtOKykJUpTJE73Eo5myjPw3UdbJbPMKlGY9ZYYv7w7Btb0c2E7zllEifaVloTE3yUfcKZ2ipElozSpQhuY3 / 7V4llzPnKWYivHPGNmjbON3gBE2CXc0U2SblCpdgVKmO1u1p / TN4jWe5nqW5iyPyZRuXlahETfJo9NoBabTSIFSdo / liDlLRkur2do5sqUHlne4hha0iT2CWC4FX1CGMKdRotMUtru + Wq + LKRJnIsUuEir3b7VcXX1rv4wbRbv5t1vevowGVRo8GV5UMqR6QN2 + pbpTCZPhAQVKGV5UMqR6QIFSqjuVMBkeUKCU4UUlQ6oHFCilulMJk + EBBUoZXlQypHpAgVKqO5UwGR5QoJThRSVDqgcUKKW6UwmT4QEFShleVDKkekCBUqo7lTAZHrAdKDWe3 + Xzuyh6 + + 8y7FMyHOgBU6DUF0LtKAboTzt + JKJmsur1wPJXgI3fhtSOlbqGpKCqFNADpkDppISZTtI1YO / EKYMpUMJJCTNtruveHZux5sdv9L + tawuDgl1dbbWn7pY1BUHVdRKzOVCSRU5KmGlnXfft2oqXJ1 + m / 73 + 4GVBYWXRzFc8dYvn00YDMUqmQQknJcy0sa5nZQ5GyhltdDjVbt + Fqp / oWd0klS6a7eHMHn6tpxxrBfOgdFLCTBvryhhD9kjvOuzSRV + awtSBml2oXLVS522X3gFd + + abqudEJvOg5NY5KWGmjXXNGuG9ypX8MMsUbsqXfA2Ndt / glD3CWIMjfsbcZ1CgdFLCTDvr2jt / BFq2Fq7nVz9 + FQxEJQu / 8LBkjfSC2nMwhgpBgdJJCTPtrGuzxOYYMEzcwvnVr3TxV01C6sTxn1G + RAxsklOT0DP7wib5nX4yKFDqxrrTXfAt5uyeMNPGumaPpN00DCpZ4B3AuI / 5fm9w / QCeBodT5rCbkNDMvQ2HOBZrn8GD0kkJM22sa9 / zLwVlatZpzZJZOP5z47tp1Lt1j7gu1jDYwJ7gQclFOClhpk11bZHUCv2GXq13yDHat2B9wbwGneM + ULpQDIZaJNMuLINog9YYp5BA6aSEmXbWNXuk96rX2C18V + U67K7crMOw / 4XXoXkL523DEuz / UEigdFLCTDvrOmDoGHo + FF1WssD / G5rSRT6j7hHe59BgO9pJ / An4hEaBq0LYeda9xdx + vvn8XHvbbFNdW6a0Re / zR + m + q6nagW0bVjfwo / sKynew7n + B83ZQa2CQiQMJKCZA7io1wVqfxUkJM + 2sa47PKLx0Yf23O0cO7seGggW648 + hgVHS6a3rd0KM / kpAO0pr0FK8iw3GRiclzLSzrpkXXQ1686jTqfOVa1d8i5MnxLlsn7dAwfSTE3kTMOUAMOSh0HR3SsJMbp1NdW2d1hE9cgbp / q8oXIzDB91b8IImzMX + lhy0mcPESD20jnJWrZAGOh4TnZIwkytsY12zjFs4vyquWfYvj3vLFn2ul3vkUmRR6pme47FeCA + U3Ds2T5hZrwNtqqtvgEbZIvHKkQ96andU6 + pnj4qPUbe7r8IGpd0TZroN5d921TWtc0907ttPV7V00UyKBtJQ7y3OsGt8zYj5ctigtH3CTJ8utLOuWaNEONrB6jpsLl + B0h / ErbtzRn + 079zDx4rYL4YNSt1Fdk2Y6a / / bKpr9nDv1XD57LdRUbxc1z5r5A3 + rIjpY1JAaduEmX66zq66pvfKQlq3rrrGC6e / 6g3o9QGrH3Ni8pAUUNo2YaafLrOzrlkj60eUc5BysMYbSQGl7jSbJcxssiNtqmuOT4AG1z97RPzdurnd8vLouBNmbqG1zDxh5vk2zpxqU12700rHqYXGQhzeO3FK8q6U3IE2SZhpqi + dpKspg2KHSS4obZIw01T3OElXUwbFDtO / ASgLynoPygjFAAAAAElFTkSuQmCC " ; <nl> + <nl> + <nl> + / / Define the functionality to create a new foxx <nl> + this . store = function ( content ) { <nl> + throw { <nl> + code : 501 , <nl> + message : " To be implemented . " <nl> + } ; <nl> + } ; <nl> + <nl> + this . thumbnail = function ( app ) { <nl> + var example = aal . firstExample ( { <nl> + app : app , <nl> + type : " app " <nl> + } ) ; <nl> + if ( example = = = undefined | | example = = = null ) { <nl> + return defaultThumb ; <nl> + } <nl> + var thumb = example . thumbnail ; <nl> + if ( thumb = = = undefined | | thumb = = = null ) { <nl> + thumb = defaultThumb ; <nl> + } <nl> + return thumb ; <nl> + } ; <nl> + <nl> + this . install = function ( name , mount , version ) { <nl> + return foxxmanager . mount ( name , mount , version ) ; <nl> + } ; <nl> + <nl> + / / Define the functionality to uninstall an installed foxx <nl> + this . uninstall = function ( key ) { <nl> + return foxxmanager . unmount ( key ) ; <nl> + } ; <nl> + <nl> + / / Define the functionality to deactivate an installed foxx . <nl> + this . deactivate = function ( key ) { <nl> + throw { <nl> + code : 501 , <nl> + message : " To be implemented . " <nl> + } ; <nl> + } ; <nl> + <nl> + / / Define the functionality to activate an installed foxx . <nl> + this . activate = function ( key ) { <nl> + throw { <nl> + code : 501 , <nl> + message : " To be implemented . " <nl> + } ; <nl> + } ; <nl> + <nl> + / / Define the functionality to display all foxxes <nl> + this . viewAll = function ( ) { <nl> + return aal . toArray ( ) ; <nl> + } ; <nl> + <nl> + / / Define the functionality to update one foxx . <nl> + this . update = function ( id , content ) { <nl> + throw { <nl> + code : 501 , <nl> + message : " To be implemented . " <nl> + } ; <nl> + } ; <nl> + <nl> + } ; <nl> similarity index 74 % <nl> rename from js / apps / aardvark / repositories / swagger . js <nl> rename to js / apps / aardvark / lib / swagger . js <nl> mmm a / js / apps / aardvark / repositories / swagger . js <nl> ppp b / js / apps / aardvark / lib / swagger . js <nl> <nl> / / / @ author Copyright 2011 - 2013 , triAGENS GmbH , Cologne , Germany <nl> / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / <nl> <nl> - ( function ( ) { <nl> + exports . Swagger = function ( ) { <nl> " use strict " ; <nl> <nl> / / Define the Repository <nl> <nl> <nl> / / Define the functionality to receive the documentation . <nl> / / And transform it into swagger format . <nl> - exports . Repository = Foxx . Repository . extend ( { <nl> - <nl> - / / Get the overview of all installed foxxes . <nl> - list : function ( basePath ) { <nl> - var result = { } , <nl> - apis = [ ] , <nl> - res = _aal . byExample ( { " type " : " mount " } ) ; <nl> - result . swaggerVersion = " 1 . 1 " ; <nl> - result . basePath = basePath ; <nl> - result . apis = apis ; <nl> - while ( res . hasNext ( ) ) { <nl> - var m = res . next ( ) . mount ; <nl> - if ( m = = = " / aardvark " ) { <nl> - <nl> - } else { <nl> - apis . push ( { <nl> - path : m <nl> - } ) ; <nl> - } <nl> + <nl> + / / Get the overview of all installed foxxes . <nl> + this . list = function ( basePath ) { <nl> + var result = { } , <nl> + apis = [ ] , <nl> + res = _aal . byExample ( { " type " : " mount " } ) ; <nl> + result . swaggerVersion = " 1 . 1 " ; <nl> + result . basePath = basePath ; <nl> + result . apis = apis ; <nl> + while ( res . hasNext ( ) ) { <nl> + var m = res . next ( ) . mount ; <nl> + if ( m = = = " / aardvark " ) { <nl> + <nl> + } else { <nl> + apis . push ( { <nl> + path : m <nl> + } ) ; <nl> } <nl> - return result ; <nl> - } , <nl> - <nl> - listOne : function ( basePath , key ) { <nl> - var result = { } , <nl> - res = _aal . document ( key ) ; <nl> - result . swaggerVersion = " 1 . 1 " ; <nl> - result . basePath = basePath ; <nl> - result . apis = [ <nl> - { path : res . mount } <nl> - ] ; <nl> - return result ; <nl> - } , <nl> - <nl> - / / Get details of one specific installed foxx . <nl> - show : function ( appname ) { <nl> + } <nl> + return result ; <nl> + } , <nl> + <nl> + this . listOne = function ( basePath , key ) { <nl> + var result = { } , <nl> + res = _aal . document ( key ) ; <nl> + result . swaggerVersion = " 1 . 1 " ; <nl> + result . basePath = basePath ; <nl> + result . apis = [ <nl> + { path : res . mount } <nl> + ] ; <nl> + return result ; <nl> + } , <nl> + <nl> + / / Get details of one specific installed foxx . <nl> + this . show = function ( appname ) { <nl> var result = { } , <nl> apis = [ ] , <nl> pathes , <nl> <nl> } <nl> } <nl> return result ; <nl> - } <nl> - } ) ; <nl> - } ( ) ) ; <nl> + } <nl> + } ; <nl> deleted file mode 100644 <nl> index 9846c91c524 . . 00000000000 <nl> mmm a / js / apps / aardvark / repositories / foxxes . js <nl> ppp / dev / null <nl> <nl> - / * jslint indent : 2 , nomen : true , maxlen : 100 , white : true , plusplus : true , unparam : true * / <nl> - / * global exports , appCollection * / <nl> - <nl> - / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / <nl> - / / / @ brief A TODO - List Foxx - Application written for ArangoDB <nl> - / / / <nl> - / / / @ file <nl> - / / / <nl> - / / / DISCLAIMER <nl> - / / / <nl> - / / / Copyright 2010 - 2013 triagens GmbH , Cologne , Germany <nl> - / / / <nl> - / / / Licensed under the Apache License , Version 2 . 0 ( the " License " ) ; <nl> - / / / you may not use this file except in compliance with the License . <nl> - / / / You may obtain a copy of the License at <nl> - / / / <nl> - / / / http : / / www . apache . org / licenses / LICENSE - 2 . 0 <nl> - / / / <nl> - / / / Unless required by applicable law or agreed to in writing , software <nl> - / / / distributed under the License is distributed on an " AS IS " BASIS , <nl> - / / / WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND , either express or implied . <nl> - / / / See the License for the specific language governing permissions and <nl> - / / / limitations under the License . <nl> - / / / <nl> - / / / Copyright holder is triAGENS GmbH , Cologne , Germany <nl> - / / / <nl> - / / / @ author Michael Hackstein <nl> - / / / @ author Copyright 2011 - 2013 , triAGENS GmbH , Cologne , Germany <nl> - / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / <nl> - <nl> - ( function ( ) { <nl> - " use strict " ; <nl> - <nl> - / / Define the Repository <nl> - var Foxx = require ( " org / arangodb / foxx " ) , <nl> - aal = require ( " internal " ) . db . _collection ( " _aal " ) , <nl> - foxxmanager = require ( " org / arangodb / foxx - manager " ) , <nl> - <nl> - defaultThumb = " iVBORw0KGgoAAAANSUhEUgAAAKUAAAClCAYAAAA9Kz3aAAAYGWlDQ1BJQ0MgUHJvZmlsZQAAWAmteXk4VW33 / 73PhOM45nme53km8zzPs3DM8zyrZEimMoQSKiqiosGUECKRRIUGZIhMFRUl5LdP6Xne9 / pe73 + / fV1n789e + 3Ove91rrT2sdQBgaSSEhwcjqAAICY2OtDbQ5nJ0cuYimQJIQAMAwAMUwSsqXMvS0hQ + + x / b1jiAiJdeiBN1 / Q / S / xJTe / tEeQEAWcIET + 8orxAYNwKAbPUKj4wGAE3UxxcXHU7E + TCmi4QNhPEVIvb7g1uJ2PMPHvrNsbXWgTkzAJDiCIRIPwAo1mA5V6yXH6wHjwMAQxPqHRAKD + OCsbqXP8EbABYPmCMWEhJGxLkwFvL8Dz1 + / 4EJBM9 / dBIIfv / gP2uBR8IT6wZEhQcTEn6f / P / chQTHwP76vXHAe1xUkI0JfGSA / RbvRdCzgTETjE / 7 + xiZHsirw6O1rQ / k7QHRRrYwpoM5L / 1jDO0O8FJMkJ0WjNlg + W5QmAmRD / sJwRTqaW4BYzgbEHxeUTqw74lzIRQS / W0dDjim3j66ejCGswjhGBlm / ZfvHxVr81eemOivY / 6XH0gwJsYbD / OzCZEw + m0P4pxPsAFxXh5YfiM82pJoJ3Gu4dBg84O1IN77RuoTOUT5T5 + o3 + sl2uYf7W9rCMthm5FU0ZG2RA68RiSbb4C + EYxh25BS / pGGf + Wa4cG / cxoei7SNjLEm + oEPxr4 + oXZEHxLl2d4EXaJvYZ8gy4E + IIBI4AM8QShYBlzAFOgA3YM9FywPhWVeIAwEw79ILsq / V9CL6FH0HHoMPYN + / VcGjzzggQDgDeM / uv5jPCy3AYngI6zVB0T9nQ3FglJHqaJM4b0m / JNBKaGU / 14bXmtZ + 4sPbPWDx4of6NY + sD4W1rj3l + cekBr5Fx + M8fxnxP + 1SR + 8hz3g95chdV1qWWr37 / h / V4zRw + hiDDH6GGFkJvIush / ZjRxAtiNbABfyAbIVOYTsIOIDu / 7OQoAlRK8QPRwFTGAv + oCY32ehf + f7Ly / F / MM40IAXwcsDa3hUKAiCrwX8M4P9b6sD / o + WGJjhCc8YCHNN / onHgV0oAdi78ihtlBrsZ9jHKAYUCxBHycEe10JpwDGQh6X / RvG / VyMOfH97O / b3WoLAIryOkGif + Gg4l4BOWHhCZICffzSXFvy09BHjMgr1khDjkpGSlgXEZy + RA8BX69 / PVIjh2b8ynyUADsF5TDbyryzwDAB1fQAwZv8rE3ABgFkMgNvPvWIiY / / oQxEPaIAFlPBdwQw4AC8Qgj0iAxSAKtAEesAYWABb4ATc4Bz2ByGwxXHgCEgBGSAH5INicB5cBJfBNXAT3AEtoB10g0fgCRgBY + AtmAELYBWsgy2wA0EQCUQB0ULMECfED4lCMpASpA7pQaaQNeQEeUB + UCgUAx2B0qAcqBA6D1VCtdBt6B7UDQ1Ao9BraBZahr5APxFIBA5Bh2BHCCAkEUoILYQJwhZxGOGHiEAkItIRpxHnEFWIG4hmRDfiCWIMMYNYRWwiAZIcyYDkRoojlZA6SAukM9IXGYk8hsxGliCrkPXINjgXXyBnkGvIbRQGRYviQonDkTRE2aG8UBGoY6hc1HnUNVQzqhf1AjWLWkf9QlOg2dCiaBW0EdoR7YeOQ2egS9DV6CZ0H3w / L6C3MBgMA0YQowhnuxMmEJOEycVUYBowXZhRzDxmk4SEhJlElESNxIKEQBJNkkFSSnKD5AHJc5IFkh + k5KScpDKk + qTOpKGkqaQlpHWknaTPST + Q7pBRkfGTqZBZkHmTJZDlkV0hayN7RrZAtoOlxgpi1bC22EBsCvYcth7bh53EfiUnJ + chVya3Ig8gP05 + jvwW + WPyWfJtHA1OBKeDc8XF4E7janBduNe4rxQUFAIUmhTOFNEUpylqKR5STFP8wNPiJfBGeG98Mr4M34x / jv9ESUbJT6lF6UaZSFlCeZfyGeUaFRmVAJUOFYHqGFUZ1T2qCapNalpqaWoL6hDqXOo66gHqJRoSGgEaPRpvmnSayzQPaeZpkbS8tDq0XrRptFdo + 2gX6DB0gnRGdIF0OXQ36Ybp1ulp6OXo7enj6cvoO + hnGJAMAgxGDMEMeQx3GMYZfjKyM2ox + jBmMdYzPmf8zsTKpMnkw5TN1MA0xvSTmYtZjzmIuYC5hXmKBcUiwmLFEsdygaWPZY2VjlWV1Ys1m / UO6xs2BJsImzVbEttltiG2TXYOdgP2cPZS9ofsaxwMHJocgRxFHJ0cy5y0nOqcAZxFnA84V7joubS4grnOcfVyrXOzcRtyx3BXcg9z7 / AI8tjxpPI08EzxYnmVeH15i3h7eNf5OPnM + I7wXed7w0 / Gr8Tvz3 + Wv5 / / u4CggIPASYEWgSVBJkEjwUTB64KTQhRCGkIRQlVCL4UxwkrCQcIVwiMiCBF5EX + RMpFnoghRBdEA0QrRUTG0mLJYqFiV2IQ4TlxLPFb8uvisBIOEqUSqRIvEJ0k + SWfJAsl + yV9S8lLBUlek3krTSBtLp0q3SX + REZHxkimTeSlLIasvmyzbKrshJyrnI3dB7pU8rbyZ / En5Hvk9BUWFSIV6hWVFPkUPxXLFCSU6JUulXKXHymhlbeVk5XblbRUFlWiVOyqfVcVVg1TrVJcOCR7yOXTl0LwajxpBrVJtRp1L3UP9kvqMBrcGQaNKY06TV9Nbs1rzg5awVqDWDa1P2lLakdpN2t91VHSO6nTpInUNdLN1h / Vo9Oz0zutN6 / Po + + lf1183kDdIMugyRBuaGBYYThixG3kZ1RqtGysaHzXuNcGZ2JicN5kzFTGNNG0zQ5gZm50xmzTnNw81b7EAFkYWZyymLAUtIyzvW2GsLK3KrBatpa2PWPfb0Nq429TZbNlq2 + bZvrUTsoux67GntHe1r7X / 7qDrUOgw4yjpeNTxiROLU4BTqzOJs71ztfOmi55LscuCq7xrhuv4YcHD8YcH3Fjcgt063CndCe53PdAeDh51HrsEC0IVYdPTyLPcc91Lx + us16q3pneR97KPmk + hzwdfNd9C3yU / Nb8zfsv + Gv4l / msBOgHnAzYCDQMvBn4PsgiqCdoPdghuCCEN8Qi5F0oTGhTaG8YRFh82Gi4anhE + E6ESURyxHmkSWR0FRR2Oao2mgz9yh2KEYk7EzMaqx5bF / oizj7sbTx0fGj + UIJKQlfAhUT / xahIqySup5wj3kZQjs0e1jlYeg455HutJ5k1OT144bnD8Wgo2JSjlaapUamHqtzSHtLZ09vTj6fMnDE5cz8BnRGZMnFQ9eTETlRmQOZwlm1Wa9SvbO3swRyqnJGc31yt38JT0qXOn9k / 7nh7OU8i7kI / JD80fL9AouFZIXZhYOH / G7ExzEVdRdtG3YvfigRK5kotnsWdjzs6cMz3XWspXml + 6e97 / / FiZdllDOVt5Vvn3Cu + K5xc0L9RfZL + Yc / HnpYBLryoNKpurBKpKLmMux15evGJ / pf + q0tXaapbqnOq9mtCamWvW13prFWtr69jq8q4jrsdcX77hemPkpu7N1nrx + soGhoacW + BWzK2V2x63x + + Y3Om5q3S3vpG / sbyJtim7GWpOaF5v8W + ZaXVqHb1nfK + nTbWt6b7E / Zp27vayDvqOvE5sZ3rn / oPEB5td4V1r3X7d8z3uPW8fOj582WvVO9xn0vf4kf6jh / 1a / Q8eqz1uH1AZuDeoNNjyROFJ85D8UNNT + adNwwrDzc8Un7WOKI + 0jR4a7Xyu8bz7he6LRy + NXj4ZMx8bHbcbfzXhOjHzyvvV0uvg1xtvYt / svD0 + iZ7MnqKaKplmm656J / yuYUZhpmNWd3Zozmbu7bzX / Or7qPe7C + mLFIslHzg / 1C7JLLUv6y + PrLisLKyGr + 6sZXyk / lj + SehT42fNz0PrjusLG5Eb + 19yvzJ / rfkm961n03Jzeitka + d79g / mH9e2lbb7fzr8 / LATt0uye25PeK / tl8mvyf2Q / f1wQiTh97cAEt4jfH0B + FID10VOANCOAIDF / 6mNfjPgz10I5sDYHtJDaCGVUExoLIaURIrUiSwN + wCHoSDgW6iw1ME0g3Ty9OWMgCmIeZhVgS2ffZVTkyuPe5QXy6fM7yQQJBgi5CqsLcIusiH6SKxUPEhCTZJC8p1Ug / RxGStZbtmPcvfkTyhYKbIpLijVK8eraKliVV8cKlfzVhdT / 6LRonlES1sbp / 1Op1O3Tq9Cv8DgmCHBSMOYyXjDZMi03qzCvNKi3XLeGm3DbMtiR2WPtN912HECzmQueFeKw6jDm25z7iMeXYS7ntVepd7ZPgm + fn62 / toBcoEiQdzBzCGUocjQb2Fz4SMR9yOvRJ2OTo7JiG2KRyX4JHYdAUcFjqkkGx13SYlJPZ1WnJ50Qu7EfEbeSctM / izybJCDyKU + JXRaPc8836HAudD5jGORfbFtidVZ83MmpQbntcvUy5UrZC + IXxS5JFVpUpV2eeaqUfWNmtVa6jr + 69I3VG / q1ps1ONxyv + 1 / J / xuXOOxptTmEy2ZrTn38tqK75e3V3c0dvY9mOia6R7vaXjo28vU + 7iv5FFcv + / jwwMOg1ZPTIYMnhoO2z6LGLk0 + voF + UvJMZ1xowm9V0qv + d / g32y / XZp8NdU9ffld2ozfrN2c + bzZe4sFi0XjD8pLjEszy9krciszq9fWEj8afiL9VPvZ4PP8 + uWN + C9uXy2 + mW0GbvX8OPmzZU93f / 8g / tJIFHIZNYOex6yTIskUsP7k5bgZvAhlHNUjGmbaBLqXDDKMqUxTLPKsGWwjHCycjlwF3O08k7ybfFv8KwJPBS8LRQqri5CKvBS9KBYoLi / + S + KR5GkpB2lO6Q8y9bKxcmrykHyfQraihRKt0rhyqYqLKrvqJJwFrurM6hMaZzVdtAS0drTHdG7r5ur56B8yoDZYNGw3KjaONfEx9TTzNw + zCLH0tLKwVrURsWW1w9sj7LccPjiOOz10rncpc80 + nOgW4O7ooUuQ9GTygrxWvMd8en2b / Kr9SwLSA8OCnII1QwRDKeBMmA2fjvgWxR3tHlMa2x33Kn4 + YS1x + wj5UY5jQslcxzHH36U0pealRaa7nbDLcDwZkJmWVZF9M6cpt / lU4 + nbeTfzawuuFl46U1ZUXJxXknU29VxCadh5v7KA8uMVDy4KX7pWJXi58MqLq9s1 + Gsstbx1InAeKN5Ur9dtMLvldDv4Tsbdy42dTaPN0y1LrV / bkPcZ20U7VDs1Hyh2cXcjuud6 + h829db0lT3K7z / xOHEgcjD6SdZQ + zDDs6MjU89ZXmi8tB3zHT8 + cfXVs9ff3tJMik + ZToe / Oztzf / b53PT83PvVRTQc / ZTl0VXqNamP8p8EPlN + / rG + uDHxZfDrvW + Vm8lb9t8Fv2 / 9aN9O / Km6g9vV3Vs + iL8EtIqoQLqhhNEk6A3MMskK6RzZBjkWx0 + hhXemTKG6QT1Ks0 / HT6 / HEMh4gukicyNLH + tjtkfs9zkqOeO5tLl + cl / hMeFZ5c3kE + Tr4Xfj3xYoEpQSHBTyEyYRrhExFPkgmiEmJNYn7iUBJCokD0m + koqBv24aZExllmTT5DjkWuWt5dcUTihyKrbAXy1LyskqDCrXVbVUnx / yOvRJLUmdRL1MQ05jXDNRi0OrVdtC + 7WOv86 + bpWepT6Z / kODI4ZyhitGVcauJkwm46bFZjbmlOYDFmmWqpbfrBqsg2wEbd7bVtodtme2f + mQ52jouO / U5Bzswucy5Vpy2PzwlluRO797o4eWxxtCvCeP5yv4OeLvY + Cr6KfsbxRACAwJIgRrhFCFTIZeDQsJlw / fjXgYmR1lGU0f / TbmYqx3nEDcYvyFBL2EycTgJLqkF0fuH + 081pv88Pi9lNrUkrS09LATLhl6J0Uy0Zkvs0qznXP4cnZyZ049PX0v71L + sQKXQpUzLGe2i8aL75ScPXvqXGFp5fm7ZY / KX1WsXNi5RFHJVSV72fCK69Ww6mM1Wddya4 / XEa4r3sDf + HLzY / 32Ldxtjjsydy0bk5oam3 + 0Kt8Lbyu9f6u9teN + 58CDzW6Dnnu9Nn2b / SUDsoMvh04Ne4wYPdd6qT0e / Bo / uTo3vLL5bZsY / z89MuI7AaMAwJkUABwzALDTAKCgFwCBMbjuxAJgSQGArTJACPgCBG4IQCqz / 7w / ILiPiAHkgBruSXECQSAFVOCeiQVwhivkKLi6zAMXQD3oBM / ALPgGV45skDRkALlDcVABdAN6DC0iMAghhCkiClEB13n7cF0Xi7yH / IUyQJ1BzaFl0ZnodxgVTClmB66wBkkVSWvIWMkKsOTYLHIseT6OBVdDIUfRjlfDt1EqUd6nMqR6Sx1NQ0Vzk1aXdpTOlm6U3oL + OYM7ww / GUiY1pmnmoyysLG2sbmxkbO3ssRxyHF8573BFcstz7 / L085bw + fMfEsALzAjeFcoU9hTREhUQw4vtiH + SeC85JtUknSQjLTMtmyknL / dZvlWhUDFByVvZVEVKlfEQXk1CvUxTVOuU9oDOZz1SfXoDZkM2Iz5jORNz0wizc + a9Fl + seK0dbE7b9tujHHQdM5yGXBhcPQ / Xub33wBCoPTGem14L3pM + K36U / iYBxYEfgg + FFIV + CjeOqIvCRUfEvInTj29NFE + qPsp1rOw4Q0pBGjY95cTmycDM1eyc3JDTTQXUZ1iKPpbUnnM / z1A2UnHqosGlzaq8K3RXM6u3rgXVfrmef1OvgfrWxp3FxqXm1dYPbfPtGw8Yu3UeuvV59NsMaDyRfCr8TGE09MWPCdQbssmL72hnOxfwS0dWtT42fN75ovBNfwv7 / dSPwe2lnws7r3cb9 / J / ee5L / X5 + EONPAvfkaOCeAzcQAbJADRjCfQYPuMOQBLJAKagF9 + A + whRYh9AQCyT1O / oJUBF0CxqGPiIoEbIIZ0Qa4g5iAcmJdEdeQa6hFFDpqDG0MDoFPQnHvowEkPiTjJHqkbaSSZLVYYWxN8jlyB / gLHHzFPF4MnwxJTflLbh + fUsdR8NA00JrT / uR7ig9lv4cgzjDIGMYEyNTF3MACx1LF2sYGx / bJHsphyMnE + drrgpubx4pXsD7ku86f7qAq6AcXMutCA + J3IXfYnniaRJHJKOlvKQ1ZXAyw7LZcibyjPIbCq8V + 5WalatUclUTD8WqZam3anzXktX21snRrdZr1r9vcN + ww2jAeNYUYSZibm9xwrLFas2Gz9bdrsJ + 2pHHKdC52ZXksIPbefc + j1FCj2etV6Z3gI + 1r6Gfk39qQFcQRbBnSHsYS3hixFSUdnRtLGVcePyTRO6k2CMjx + STr6SwphalY08kZaxlErLmchJPSeUh8qcKbxfFlsid / VJ6uyymQuXCz0vVVTKXK658qBas8b92q47xevlNtfqPt0rvKN8dbiI077RWtVm1g47aB6ZdGz0Xez0fqTzmHkQ9efo09hlmJPs57kXVmPuE2evgtzVTH2Y45yzfpyx2LjOu5n8SWH / 6tWgrd9toR2b3wt77XxsH8UcBMrj3ygRHXxTuNekAS7jDFAKOwnd + JWgEj8E0fN / jIAFIEzoMJUFlUAc0iyCDo05AFCNGkPRIH2QHig11HLWCdkI / xehgOuB + SjepKekUWRSWEnuL3B6HxLVQROCl8T8o + 6hKqWNonGiN6IzprRiMGRWZhJnlWdxZE9ii2T05bDnNucy4zXhMec34rPndBaIETwnVCT8WWRajEFeU8JU8LzUuwyLrLdcgv6NoqfRUJeuQkzpaI19zV9tEJw2OYIt + u0Gn4bDRjomJabO5hMUNKwnrZlsdu3GHECes8w1XezdqD3JPd28Xn / d + qv45AYtB1sFDoWZhzyNcIpeik2I54qYTHiV1Ha1Itjv + M7Uy3T6D8 + R6VkdO7infPIMC5sInRb7FW2fTSqnPV5UrVDy96FsJVZVfUbo6VhNTy1r3 + EZyvcEtyTv6jcnNVa15bU7tjB0TD8q6nR6S9F59JNd / f0BvcGIoflhyBDm6 / mJpbHSi4LXgm4q3v6b0prPfPZmlnLObv / R + eVH6Q9DSpeXHKytr6I9sn6Q + 6647bBC + eH + 1 / MbzbXPz1BbbVt135e / nv2 / / cPjRvM2wHbndvL3zU / Nn + s + BHfyOzc7ZnZFd0l3N3fjd27vLe9x7TnuFe4N7e7 + kf3n / Ovvrya9f + 9L7Pvvn9oeI8Y / ylZUhvj0AhNOG24 / T + / tfBQAgKQRgr2B / f6dqf3 / vMlxsTALQFfznfxciGQP3OMvXiWiQu4x4 + K / t / wEZGLhf4 / dDDgAAAAlwSFlzAAALEwAACxMBAJqcGAAAAdVpVFh0WE1MOmNvbS5hZG9iZS54bXAAAAAAADx4OnhtcG1ldGEgeG1sbnM6eD0iYWRvYmU6bnM6bWV0YS8iIHg6eG1wdGs9IlhNUCBDb3JlIDUuMS4yIj4KICAgPHJkZjpSREYgeG1sbnM6cmRmPSJodHRwOi8vd3d3LnczLm9yZy8xOTk5LzAyLzIyLXJkZi1zeW50YXgtbnMjIj4KICAgICAgPHJkZjpEZXNjcmlwdGlvbiByZGY6YWJvdXQ9IiIKICAgICAgICAgICAgeG1sbnM6dGlmZj0iaHR0cDovL25zLmFkb2JlLmNvbS90aWZmLzEuMC8iPgogICAgICAgICA8dGlmZjpDb21wcmVzc2lvbj4xPC90aWZmOkNvbXByZXNzaW9uPgogICAgICAgICA8dGlmZjpQaG90b21ldHJpY0ludGVycHJldGF0aW9uPjI8L3RpZmY6UGhvdG9tZXRyaWNJbnRlcnByZXRhdGlvbj4KICAgICAgICAgPHRpZmY6T3JpZW50YXRpb24 + MTwvdGlmZjpPcmllbnRhdGlvbj4KICAgICAgPC9yZGY6RGVzY3JpcHRpb24 + CiAgIDwvcmRmOlJERj4KPC94OnhtcG1ldGE + CuSSjykAABgNSURBVHgB7V0JfBRF1v9XCBiI4QhRIBwCghAgN4oIyiUeK3gfsOwqoruKtyur + x17eX2f6 + fx4X2sF14IuogH64qCnHJkkkAOQI4ECGcI4QiXQO + rrp4jZJLpmanp6Z6p9 / tlpqb71av3Xv3T3VX9qh7TiKBIecBGHkiwkS5KFeUB3QOJ8e4HbfcasBNHgRYpQGpPv + 7Q6naDHdimn9PS + oAlJvnlc + JBO9of31fKfVvAns8AXsgBij5oFFNs7ybBQ3ys + ONG + Rx3wqb2xzcoiz704ihngrd8aqnLedDO7KEf1VxvnHrWub9tan / cglIf3xU8LwDVc3ijt2434tjAu / Uiq1gC7PnJfdix33a2P25BiS1LCVw7BKjyJgUGV + Z4L0 / h + 96yU0s2tj9uQclc7wk4taCv / tcGhlbrdKDvFYLP9Si0kycC17Exh53tj09QHjsEFL8mIJN1G428k83Bx31F3QewTfPM1bEjl83tj09Qls8CjhloyZtoGjZan19Aa2Wwu94xXc92jDa3Pz5B6XpT4CQ1FVq3IaYxw + cnWfb9gr + EppAO15quaytGm9sff6DcWwGsN269 + VPAGAsOL3k3C / 7j9FUyM7i6duB2gP3xB0rfSfKm5iYbA1B6HtCxlzjrMp5LG + O143EH2B9XoNTn5lxPC6j0vhho2y002Ay8V9TbvBL8NZ1TyCn2xxUoWeVCoIaGzpxyJ4nvED61zJto + C0qssJpIUiIThWn2B9XoITrXR0NWhJ99bsqZGSw0zsAGVeL + oVP0pwlf8B0ADnE / vgB5dGDwKq3dOSwrDuB5u65nRDBlHurqLifLprr54YoxMJqDrI / fkBZ9hnwswCB5h5Bh4EJrc9l0Nxz7q63w5BkUVUH2R8 / oCwQc5PaGelgXQeHjQTWrAVY7kNCTtkn0A5Vhy0zogIcZH98gLJmA7CJBjlELO8BeX2f + 2shi16Ds9Uz5MmVLclh9scHKH2jenJ8on3C7fyO2UB6fyGl4PVwpUWuvsPsj3lQatpJwPW46PA + lwOtu8jt / PzJQl5VEbCzRK5sCdKcaH / Mg1KP5qk1pmxyJ0ro5voi9DnLZsaxIvvFWTrR / pgHJVxicltrScDpO7Y + oiT8YslpNGd5g5DkegraCWOIL0G2FBEOtD + 2QXmE3t6sFhPmLPsempvkyIwA5d0ihNJUKFv / TQQaCFGkQ + 2PbVCW0tykcedGrhHdE2L / NlVN63UJcLrBUfBOU6zWnnOo / bENygIjiqdDT6DLuREDBGvWHMh7RMgv + xR8nbgtyKH2xywotep1QOUygY18unVHmnKMOUuNz1lOj3RrAeU72f6YBaUneodH82SNC9iJYTN0oPnKrrlCzMqXwxYXrgAn2x + ToNRXGhYac5N8xJ3SKdw + Nlc / 7w7Bt70c2E7zllEip9ufGCW / RbRZtvE7wAibhDuaJ6ItGsIHXA98SRFI9NoRRTQV1SnHf6sLnqb1PTX + z5k8qg39HVjyGX65bW + / X629BxlFI9NTUIzRjAkEig / 1lYfskSNA4mnWGfjJL2n57kdi1eMfjoIHbjSgZ9p6g40bnDR3QHtwLVjaOf6Z7W6 / f609R2Pv9s2vQCUf6gay3AesBSRvNUfMWTJaWs7WzvE4ul6heXvSi46E8dfogjcn2F / PGQ1 / xNztW9 / aLuNGYWn + 7Q0tjvARrdfFFIk0kWI3CZX7t / pv7b4N / o9LOOoI + wPYGZu37wBGq9P29kDs3b7t7W + lnQkPKFCacJJisdYDCpTW + lu1ZsIDCpQmnKRYrPWAAqW1 / latmfCAAqUJJykWaz2gQGmtv1VrJjygQGnCSYrFWg8oUFrrb9WaCQ8oUJpwkmKx1gMKlNb6W7VmwgMKlCacpFis9UB8g3JbITBtDHBoj7Ved2BretjtnCnA8lcjrn3Mha6Z9Zi2eQnw7hAwigHGPyjEbcI / zFaNSz5WQHt7LnpG2P5zHTDE2HEuAt6Izyvlxu / B3jIAmdoGGDM1Aq6NLZEaXzefacSpfk1XzO / + GjED4y + ecscq4BXaLY1vUtCOdhC4vTTkDfmrt27AptVLsW93lZ76pGufPHTNGIiWKbTcwWYkQ1e + JQ2bTrvWlX4qrBv7AnC + / OXLcQVK3amv5gPbVtPua + TX324iYHYPGj7F8z7FP9 / 4M6rKCdB + qPfg4Zj42MdIaU97o0eZZOuqnTgG9sHVAF / qQQ9 / 2r1NrBUK0fa4AiXmPQHM / W / hKv4M2Y + cGwQdOXQQ7 / 7XTSid / 7WoRQ8 / 3frl4Oz8EWjeIgmVZctRUfwd + PbibTq0w23PzEH3 / oOCaEEea0R1PbAd2vO0IzJ / Hj9rELTbF4MluLeeC9 + G + AHljmLgxRz61yan8cwQE2YF5b2jdQfwyr2jsbFQ7Lpx0fi7MPbu / 8VpySn15BzYsxNvTrkSm4qWo23HNPxpdhUSm / tZ0Vivltwflui64k1g1m90xbUrngO74AFpRsTPQGf + kwKQHB9j6FkoSJrxt8k6IHnWvGsffhbXP / xSA0BykfyWfe / rC5HeJwO1O6qx7AsatVpMVuiqDZwErftgYdn3D0I7zi + bcig + QMmXndJm + ToN + j3dW7sG5b3yJXOwfDYlCCW66Y + vYvj4B5usz6 + Moyf9SeeZ + / bjTfLKPmmVrowlgI16TFefHW5iOXEIBsYHKEs + E7tWcAcNuC5oN82hQQ2ntG5dcf6VNKdpgnJH3aBvh7lnaxWOHKRkOxaRlbpq3Yd507YUiX1AZZgZH6AspOcfTm0ToXU + T5RNflb9VIyKohU69 + hb / 4iEZuYe6Dlf + y699XrVVZFb5 + 1rhtW6soREsAF3CxXKP5e2BWLMg1Krq / ZuCZj1UNCplF3ffqw7vU3H9jj3CrH7hS8Qmiq369hTP71nG009WUBR0XXAtcIyGkCy9d9KsZJmmmKb2L4tXgMb23DKy9GgVLlqqX4sa / iNAUfRtTu3YvOalahaV4StawtpYPSNXvdonTW376joytO2uKl2s7sU1nfMgxL7tnodlNLRWzZROnnyJCpKftA523cWV71Tqx3 / + RiK532GhTNexMaVi089bdnvqOnaqj3An2j4TnO + F4AwLE / EJ + Moa8I1tLHoTU2K0XbTzP088cDfJKP7pAmZbtaIfu / 3Xim10zu5MyKbarJu724co9gDTu079xAFn8 / dW9bjpckXoqZqh360XXoH9Bt6Fbr2zafXjfk0rzkMB6sNAT71IlGMqq6t6XXtXnpjUFshxbREFNNWyKnnBBZ2mMK7OK9ZMiPTrKxw + HyulHpK5CBkHTpY6 + FO7dTdU + aFnRXlmPrbwTiwex869uqFK + 97Fv2GXIGEBO9jekJC83p1IvkjmrpqbTLB9tJjTu0aKSYm6kEJLdsEFKbvs8gDGMySCZlmRYXFd + Kot7q / vSK9ZxuUDu + n + U2DUtPr377nffCMB5D3v / EjktvSbSyKFE1dWYKx / + fxA1I8kIgpJgV1HgjTvFJUkyTEN + 3dQbrNptYHV1OtnDzBQ4kEJbWq / zpx7TIxiBl05W + iDkiuYTR11Q5sEI9F7QYY3grvy3uvCU + OfWu36eLRTeOgDIJaprTzcNfu9D6bnjxxAnu3iQFU67TOHh7fQl1tNY4e8t7 + fc9FohxNXT0zHG26SzEt5kGp + YCSHdgZlNNatU718Nds98418onxTr376edKFjQM7ODPm / 93c64eLeQREOFC1HTlI8FjhnFtukmxMuanhJjv7XvP + qCcltw2jd7g8FsjsGd7BcT7GSEi / / KbUbXmDyj850wc3DcC + aPHow0luC9b / DWWf / kKkpLb4aysfFSuKgiqzVCZo6ZrjY9Pg4wpaMzWmAelRqBkfIDGpyzKPgIuooAMk8QDK7pk5GBzSRFN + 3ivlLz6yAlTsG7FXKxZNBc / LZ2v / 7nFdskYgDv + / xt97tIqUEZN17LZbrMpuPQCbzmMUsyDUt + wPu9hWlNCUTtbCgmcBK52DeccG / Nh98wLdFBWlon3324 + fgufPPVf + JFC01bPn4Xdm8vpStkN2aOuw6Axk9AiqSWVrwe / rfIlElZQNHTVVv9dDHJ4YqszM6SYGR9Bvvy2 / axx872cctgMnWLaeaWLv8Jr94zR + f / j0xJ06tnfdF2rGS3XdWcJMDVTmHnlS8Cgu6SYHPMDHd1L7Xt5A1KX / Q9lbqAAQJOUMfhytO10ps793XtPmawVHTbLdV36ojCUUfz0gBukGR0foCR3sQuMq2MNTYj / QMA0SfwNzUXjfqdzr / xyGnjQhV3JUl0r6T3 / iteEK / JvazT7WSi + ihtQov + 1FOB7vfDR / MfoPWGpaX / xSPOOvXvro / C3HrkGdbX0ytWmZImux49Cm / Vr4QH + TuGyv0n1RvyAktymjX1JREpr9GPWRFr77fMKsgm38pHthL + 8j8Qk0GrFlXhu0rnYs62iiRr0GpiuqIF4mhQQ4klLdJ3 / BNguYzbimq + Alt753BDVrlctOgOdCCfMrGfhqT9KZgAf3SiOZoyFNn6m / / yJp9aj3 + uWz8Wr948GXyOVckYKLr39CeRf8kvPa8ajh + toFL4OK + ZMw4KPn0P3zKG4 / 42FfiRF / lDEdF36AiVFvU8YkH8rraKTvzAuOqCMdMLMQH3 + / V9piugvgovWfmvjppsG5pa1Lnz06ERsLVvtaaVVu0QKAD4d + 3d5XyueRlOjI2 / + M0ZP / M + AwcEeQZIL0nVd9jIw + 26hZc / hwK + + ALihkik6oJx6Nr0i2RieKfetoyBH33csQYpb / AzA98ThlDcRuO5tvWjmg7 / 7Lvp + JlbOeR8bCr7G4f0n9Wp8A4IO3bPQM28Yho17AMmtve / OzciNBI80XVdR2OJ0ir3l1PcKYBzdcZq3FL8lf0YHlJKNCFnc8tegfXsn2C0 / Al0GhSyG37b5VnlJreRfNUJWqpGKIevKt0ucdiktTz4b2g3TTN9ZGlGjycPxDUrumiP7gKTA8aRNejFeTlLwhUa50 / kqxkiSAmUkvatkh + SBuJoSCslDqpLlHlCgtNzlqsFAHlCgDOQhdd5yDyhQWu5y1WAgDyhQBvKQOm + 5BxQoLXe5ajCQBxQoA3lInbfcAwqUlrtcNRjIAwqUgTykzlvuAQVKy12uGgzkgci + xAzUukPOa3W7wQ5s07XV0vqA8WjfGCFt9xowvt9SCwohD2JLm0iar66UJrzL + LLcF3L0P1b8sYkaDmGh / STZ87QslttW9IFtlFagNNMVXc6DdmYPnVNzvWGmhjN4ij706pkzwVuOckmB0mQHsIEi4ppVLKEA5Z9M1rIvm54queB5oWDP4ba5dXOFFCi5F8xQ5ngvV + H73rJTS1uW0j / XDqF93iRbWaFAabY7WqeLZQCc3 / UoNL7rlYOJud4T2regL7782EakQBlMZ7ivKBSszjbNC6amvXiPHaKtwl8TOmXdRiPvZFvpp0AZRHdofX4BrZVRwfVOEDVtxlo + y7unJF80ZzNSoAyiQ / j8JMu + X9QooSmUw7VB1LYRq + tNoUxqKrRuQ2ykmFBFgTLYLsm7WdQ4Tl8lM4OtHX3 + vRXAeuPRI39K0BnYrDBAgTJYL6fngXKUiFou47ksWBnR5PedJLfR3KSvSxQofb1htjzwXsG5eSX4azqnkD436XpaqNv7Ykqg2s2WqitQhtAtWiZlZ2OiIiucFoKE6FRhlbSvUQ1NHXDKnSS + bfipQBlCp + iZyzKuFjULn6Q5S / 6A6QByvasrqfF4kn5X2VZhBcpQuyb3VlFzP08pPDdUKdbVO3oQWPWW3h7LupP2AXLPbVmngtmWFCjNeuoUPq3PZWKvS37cZX5zrFPEWPez7DPaVls0p7lnEKxrPaiWFCiDcpeXmeeqZLkPiQNln0A7VO09acdSgZib1CjXD + s62I4aenRSoPS4IoRCrrHFMr0GZ6tnhCDAoio1G4BNNMghYnkPWNRo6M0oUIbuO5qvzAbS + wsJBa + HIymydX2jmnJ8op0i22rI0hUoQ3adUTF / sihUFdHm / iXhSpNeX9NoQ1fX40Jun8sB37SA0luTI1CBMkw / 6nOWzQwhRfaLs9SjmWqNKavciWFaa011Bcow / cyS04AMI7GR6yloJ4whbphypVV3icl9je8E3XesNLGRFKRAKcO7ebcIKTQVyNZ / I0OiHBl8l + LVYsKcZd8TsT3K5SjrlaJA6fVFyCWt1yWAe7vzgndCliO9YinNTbpfNuUa0U3SG5EvUIFSgk9Zs + aUYeIRIansU / B14ragAiOKqUNPSjRwri1UMqOEAqUZL5nhyTHmLDU + ZzndTI2I8mjVlNKlcploI59u3Q4iBUpZndWB5it5zmtOKykJUpTJE73Eo5myjPw3UdbJbPMKlGY9ZYYv7w7Btb0c2E7zllEifaVloTE3yUfcKZ2ipElozSpQhuY3 / 7V4llzPnKWYivHPGNmjbON3gBE2CXc0U2SblCpdgVKmO1u1p / TN4jWe5nqW5iyPyZRuXlahETfJo9NoBabTSIFSdo / liDlLRkur2do5sqUHlne4hha0iT2CWC4FX1CGMKdRotMUtru + Wq + LKRJnIsUuEir3b7VcXX1rv4wbRbv5t1vevowGVRo8GV5UMqR6QN2 + pbpTCZPhAQVKGV5UMqR6QIFSqjuVMBkeUKCU4UUlQ6oHFCilulMJk + EBBUoZXlQypHpAgVKqO5UwGR5QoJThRSVDqgcUKKW6UwmT4QEFShleVDKkekCBUqo7lTAZHrAdKDWe3 + Xzuyh6 + + 8y7FMyHOgBU6DUF0LtKAboTzt + JKJmsur1wPJXgI3fhtSOlbqGpKCqFNADpkDppISZTtI1YO / EKYMpUMJJCTNtruveHZux5sdv9L + tawuDgl1dbbWn7pY1BUHVdRKzOVCSRU5KmGlnXfft2oqXJ1 + m / 73 + 4GVBYWXRzFc8dYvn00YDMUqmQQknJcy0sa5nZQ5GyhltdDjVbt + Fqp / oWd0klS6a7eHMHn6tpxxrBfOgdFLCTBvryhhD9kjvOuzSRV + awtSBml2oXLVS522X3gFd + + abqudEJvOg5NY5KWGmjXXNGuG9ypX8MMsUbsqXfA2Ndt / glD3CWIMjfsbcZ1CgdFLCTDvr2jt / BFq2Fq7nVz9 + FQxEJQu / 8LBkjfSC2nMwhgpBgdJJCTPtrGuzxOYYMEzcwvnVr3TxV01C6sTxn1G + RAxsklOT0DP7wib5nX4yKFDqxrrTXfAt5uyeMNPGumaPpN00DCpZ4B3AuI / 5fm9w / QCeBodT5rCbkNDMvQ2HOBZrn8GD0kkJM22sa9 / zLwVlatZpzZJZOP5z47tp1Lt1j7gu1jDYwJ7gQclFOClhpk11bZHUCv2GXq13yDHat2B9wbwGneM + ULpQDIZaJNMuLINog9YYp5BA6aSEmXbWNXuk96rX2C18V + U67K7crMOw / 4XXoXkL523DEuz / UEigdFLCTDvrOmDoGHo + FF1WssD / G5rSRT6j7hHe59BgO9pJ / An4hEaBq0LYeda9xdx + vvn8XHvbbFNdW6a0Re / zR + m + q6nagW0bVjfwo / sKynew7n + B83ZQa2CQiQMJKCZA7io1wVqfxUkJM + 2sa47PKLx0Yf23O0cO7seGggW648 + hgVHS6a3rd0KM / kpAO0pr0FK8iw3GRiclzLSzrpkXXQ1686jTqfOVa1d8i5MnxLlsn7dAwfSTE3kTMOUAMOSh0HR3SsJMbp1NdW2d1hE9cgbp / q8oXIzDB91b8IImzMX + lhy0mcPESD20jnJWrZAGOh4TnZIwkytsY12zjFs4vyquWfYvj3vLFn2ul3vkUmRR6pme47FeCA + U3Ds2T5hZrwNtqqtvgEbZIvHKkQ96andU6 + pnj4qPUbe7r8IGpd0TZroN5d921TWtc0907ttPV7V00UyKBtJQ7y3OsGt8zYj5ctigtH3CTJ8utLOuWaNEONrB6jpsLl + B0h / ErbtzRn + 079zDx4rYL4YNSt1Fdk2Y6a / / bKpr9nDv1XD57LdRUbxc1z5r5A3 + rIjpY1JAaduEmX66zq66pvfKQlq3rrrGC6e / 6g3o9QGrH3Ni8pAUUNo2YaafLrOzrlkj60eUc5BysMYbSQGl7jSbJcxssiNtqmuOT4AG1z97RPzdurnd8vLouBNmbqG1zDxh5vk2zpxqU12700rHqYXGQhzeO3FK8q6U3IE2SZhpqi + dpKspg2KHSS4obZIw01T3OElXUwbFDtO / ASgLynoPygjFAAAAAElFTkSuQmCC " ; <nl> - <nl> - <nl> - <nl> - <nl> - <nl> - exports . Repository = Foxx . Repository . extend ( { <nl> - / / Define the functionality to create a new foxx <nl> - store : function ( content ) { <nl> - throw { <nl> - code : 501 , <nl> - message : " To be implemented . " <nl> - } ; <nl> - } , <nl> - <nl> - thumbnail : function ( app ) { <nl> - var example = aal . firstExample ( { <nl> - app : app , <nl> - type : " app " <nl> - } ) ; <nl> - if ( example = = = undefined | | example = = = null ) { <nl> - return defaultThumb ; <nl> - } <nl> - var thumb = example . thumbnail ; <nl> - if ( thumb = = = undefined | | thumb = = = null ) { <nl> - thumb = defaultThumb ; <nl> - } <nl> - return thumb ; <nl> - } , <nl> - <nl> - install : function ( name , mount , version ) { <nl> - return foxxmanager . mount ( name , mount , version ) ; <nl> - } , <nl> - <nl> - / / Define the functionality to uninstall an installed foxx <nl> - uninstall : function ( key ) { <nl> - return foxxmanager . unmount ( key ) ; <nl> - } , <nl> - <nl> - / / Define the functionality to deactivate an installed foxx . <nl> - deactivate : function ( key ) { <nl> - throw { <nl> - code : 501 , <nl> - message : " To be implemented . " <nl> - } ; <nl> - } , <nl> - <nl> - / / Define the functionality to activate an installed foxx . <nl> - activate : function ( key ) { <nl> - throw { <nl> - code : 501 , <nl> - message : " To be implemented . " <nl> - } ; <nl> - } , <nl> - <nl> - / / Define the functionality to display all foxxes <nl> - viewAll : function ( ) { <nl> - return aal . toArray ( ) ; <nl> - } , <nl> - <nl> - / / Define the functionality to update one foxx . <nl> - update : function ( id , content ) { <nl> - throw { <nl> - code : 501 , <nl> - message : " To be implemented . " <nl> - } ; <nl> - } <nl> - } ) ; <nl> - } ( ) ) ; <nl> | Aardvark : Moved repositories to libs as they do not need personal collections | arangodb/arangodb | 2979bd98631f17e121d031db0a7b49faa9c0ab23 | 2013-07-26T13:37:36Z |
mmm a / extensions / CCBReader / CCBReader . cpp <nl> ppp b / extensions / CCBReader / CCBReader . cpp <nl> CCNode * CCBReader : : readNodeGraph ( CCNode * pParent ) { <nl> / / Read properties <nl> ccNodeLoader - > parseProperties ( node , pParent , this ) ; <nl> <nl> + bool isCCBFileNode = dynamic_cast < CCBFile * > ( node ) ; <nl> / / Handle sub ccb files ( remove middle node ) <nl> - if ( dynamic_cast < CCBFile * > ( node ) ) <nl> + if ( isCCBFileNode ) <nl> { <nl> CCBFile * ccbFileNode = ( CCBFile * ) node ; <nl> <nl> CCNode * CCBReader : : readNodeGraph ( CCNode * pParent ) { <nl> node - > addChild ( child ) ; <nl> } <nl> <nl> - / / Call onNodeLoaded <nl> - CCNodeLoaderListener * nodeAsCCNodeLoaderListener = dynamic_cast < CCNodeLoaderListener * > ( node ) ; <nl> - if ( nodeAsCCNodeLoaderListener ! = NULL ) { <nl> - nodeAsCCNodeLoaderListener - > onNodeLoaded ( node , ccNodeLoader ) ; <nl> - } else if ( this - > mCCNodeLoaderListener ! = NULL ) { <nl> - this - > mCCNodeLoaderListener - > onNodeLoaded ( node , ccNodeLoader ) ; <nl> + / / FIX ISSUE # 1860 : " onNodeLoaded will be called twice if ccb was added as a CCBFile " . <nl> + / / If it ' s a sub - ccb node , skip notification to CCNodeLoaderListener since it will be <nl> + / / notified at LINE # 734 : CCNode * child = this - > readNodeGraph ( node ) ; <nl> + if ( ! isCCBFileNode ) { <nl> + / / Call onNodeLoaded <nl> + CCNodeLoaderListener * nodeAsCCNodeLoaderListener = dynamic_cast < CCNodeLoaderListener * > ( node ) ; <nl> + if ( nodeAsCCNodeLoaderListener ! = NULL ) { <nl> + nodeAsCCNodeLoaderListener - > onNodeLoaded ( node , ccNodeLoader ) ; <nl> + } else if ( this - > mCCNodeLoaderListener ! = NULL ) { <nl> + this - > mCCNodeLoaderListener - > onNodeLoaded ( node , ccNodeLoader ) ; <nl> + } <nl> } <nl> - <nl> return node ; <nl> } <nl> <nl> mmm a / samples / Cpp / TestCpp / Classes / ExtensionsTest / CocosBuilderTest / TestHeader / TestHeaderLayer . cpp <nl> ppp b / samples / Cpp / TestCpp / Classes / ExtensionsTest / CocosBuilderTest / TestHeader / TestHeaderLayer . cpp <nl> SEL_CCControlHandler TestHeaderLayer : : onResolveCCBCCControlSelector ( CCObject * p <nl> return NULL ; <nl> } <nl> <nl> + void TestHeaderLayer : : onNodeLoaded ( cocos2d : : CCNode * pNode , cocos2d : : extension : : CCNodeLoader * pNodeLoader ) <nl> + { <nl> + CCLOG ( " TestHeaderLayer : : onNodeLoaded " ) ; <nl> + } <nl> + <nl> void TestHeaderLayer : : onBackClicked ( cocos2d : : CCObject * pSender ) { <nl> CCDirector : : sharedDirector ( ) - > popScene ( ) ; <nl> } <nl> \ No newline at end of file <nl> mmm a / samples / Cpp / TestCpp / Classes / ExtensionsTest / CocosBuilderTest / TestHeader / TestHeaderLayer . h <nl> ppp b / samples / Cpp / TestCpp / Classes / ExtensionsTest / CocosBuilderTest / TestHeader / TestHeaderLayer . h <nl> <nl> class TestHeaderLayer <nl> : public cocos2d : : CCLayer <nl> , public cocos2d : : extension : : CCBSelectorResolver <nl> + , public cocos2d : : extension : : CCNodeLoaderListener <nl> { <nl> public : <nl> CCB_STATIC_NEW_AUTORELEASE_OBJECT_WITH_INIT_METHOD ( TestHeaderLayer , create ) ; <nl> <nl> virtual cocos2d : : SEL_MenuHandler onResolveCCBCCMenuItemSelector ( cocos2d : : CCObject * pTarget , const char * pSelectorName ) ; <nl> virtual cocos2d : : extension : : SEL_CCControlHandler onResolveCCBCCControlSelector ( cocos2d : : CCObject * pTarget , const char * pSelectorName ) ; <nl> - <nl> + virtual void onNodeLoaded ( cocos2d : : CCNode * pNode , cocos2d : : extension : : CCNodeLoader * pNodeLoader ) ; <nl> + <nl> void onBackClicked ( cocos2d : : CCObject * pSender ) ; <nl> } ; <nl> <nl> | fixed : onNodeLoaded will be called twice if ccb was added as a CCBFile . | cocos2d/cocos2d-x | a5d78830db00d77d6f85bd609f5075459556b3b8 | 2013-04-15T02:39:44Z |
mmm a / docs / WindowsBuild . md <nl> ppp b / docs / WindowsBuild . md <nl> cmake - B " S : \ b \ toolchain " - G Ninja - S S : \ toolchain \ llvm ^ <nl> - DSWIFT_PATH_TO_LIBDISPATCH_SOURCE = S : \ toolchain \ swift - corelibs - libdispatch ^ <nl> - DLLVM_ENABLE_PDB = YES ^ <nl> - DLLVM_ENABLE_LIBEDIT = NO ^ <nl> - - DLLDB_DISABLE_PYTHON = YES ^ <nl> + - DLLDB_ENABLE_PYTHON = NO ^ <nl> - DSWIFT_WINDOWS_x86_64_ICU_UC_INCLUDE = " S : / Library / icu - 64 / usr / include " ^ <nl> - DSWIFT_WINDOWS_x86_64_ICU_UC = " S : / Library / icu - 64 / usr / lib / icuuc64 . lib " ^ <nl> - DSWIFT_WINDOWS_x86_64_ICU_I18N_INCLUDE = " S : / Library / icu - 64 / usr / include " ^ <nl> | Merge remote - tracking branch ' origin / master ' into master - next | apple/swift | 17ed3e4cd771b3c187d5006239dae1045f8437e8 | 2020-04-22T16:37:30Z |
mmm a / cocos / 2d / CCScene . cpp <nl> ppp b / cocos / 2d / CCScene . cpp <nl> void Scene : : setPhysics3DDebugCamera ( Camera * camera ) <nl> void Scene : : addChild ( Node * child , int zOrder , int tag ) <nl> { <nl> Node : : addChild ( child , zOrder , tag ) ; <nl> + # if CC_USE_PHYSICS <nl> addChildToPhysicsWorld ( child ) ; <nl> + # endif <nl> } <nl> <nl> void Scene : : addChild ( Node * child , int zOrder , const std : : string & name ) <nl> { <nl> Node : : addChild ( child , zOrder , name ) ; <nl> + # if CC_USE_PHYSICS <nl> addChildToPhysicsWorld ( child ) ; <nl> + # endif <nl> } <nl> <nl> Scene * Scene : : createWithPhysics ( ) <nl> bool Scene : : initWithPhysics ( ) <nl> <nl> # if CC_USE_3D_PHYSICS & & CC_ENABLE_BULLET_INTEGRATION <nl> Physics3DWorldDes info ; <nl> - / / TODO : FIX ME <nl> - / / info . isDebugDrawEnabled = true ; <nl> CC_BREAK_IF ( ! ( _physics3DWorld = Physics3DWorld : : create ( & info ) ) ) ; <nl> _physics3DWorld - > retain ( ) ; <nl> # endif <nl> void Scene : : addChildToPhysicsWorld ( Node * child ) <nl> addToPhysicsWorldFunc ( child ) ; <nl> } <nl> # endif <nl> - <nl> - # if CC_USE_3D_PHYSICS & & CC_ENABLE_BULLET_INTEGRATION <nl> - if ( _physics3DWorld ) <nl> - { <nl> - std : : function < void ( Node * ) > addToPhysicsWorldFunc = nullptr ; <nl> - addToPhysicsWorldFunc = [ this , & addToPhysicsWorldFunc ] ( Node * node ) - > void <nl> - { <nl> - static std : : string comName = Physics3DComponent : : getPhysics3DComponentName ( ) ; <nl> - auto com = static_cast < Physics3DComponent * > ( node - > getComponent ( comName ) ) ; <nl> - if ( com ) <nl> - { <nl> - com - > addToPhysicsWorld ( _physics3DWorld ) ; <nl> - } <nl> - <nl> - auto & children = node - > getChildren ( ) ; <nl> - for ( const auto & n : children ) { <nl> - addToPhysicsWorldFunc ( n ) ; <nl> - } <nl> - } ; <nl> - <nl> - addToPhysicsWorldFunc ( child ) ; <nl> - } <nl> - # endif <nl> } <nl> <nl> # endif <nl> | remove addChildToPhysicsWorld for 3d object | cocos2d/cocos2d-x | 761944f5074c8d9b55b5dac63f1531983265c12e | 2015-06-05T05:54:09Z |
mmm a / PowerEditor / src / Notepad_plus . cpp <nl> ppp b / PowerEditor / src / Notepad_plus . cpp <nl> BOOL Notepad_plus : : notify ( SCNotification * notification ) <nl> charAdded ( static_cast < char > ( notification - > ch ) ) ; <nl> const NppGUI & nppGUI = NppParameters : : getInstance ( ) - > getNppGUI ( ) ; <nl> if ( nppGUI . _autocStatus = = nppGUI . autoc_word ) <nl> - autoCompFromCurrentFile ( ) ; <nl> + autoCompFromCurrentFile ( false ) ; <nl> else if ( nppGUI . _autocStatus = = nppGUI . autoc_func ) <nl> showAutoComp ( ) ; <nl> <nl> static bool isInList ( string word , const vector < string > & wordArray ) <nl> return false ; <nl> } ; <nl> <nl> - void Notepad_plus : : autoCompFromCurrentFile ( ) <nl> + void Notepad_plus : : autoCompFromCurrentFile ( bool autoInsert ) <nl> { <nl> int curPos = int ( _pEditView - > execute ( SCI_GETCURRENTPOS ) ) ; <nl> int startPos = int ( _pEditView - > execute ( SCI_WORDSTARTPOSITION , curPos , true ) ) ; <nl> void Notepad_plus : : autoCompFromCurrentFile ( ) <nl> } <nl> if ( wordArray . size ( ) = = 0 ) return ; <nl> <nl> - if ( wordArray . size ( ) = = 1 ) <nl> + if ( wordArray . size ( ) = = 1 & & autoInsert ) <nl> { <nl> _pEditView - > execute ( SCI_SETTARGETSTART , startPos ) ; <nl> _pEditView - > execute ( SCI_SETTARGETEND , curPos ) ; <nl> mmm a / PowerEditor / src / Notepad_plus . h <nl> ppp b / PowerEditor / src / Notepad_plus . h <nl> class Notepad_plus : public Window { <nl> <nl> void updateStatusBar ( ) ; <nl> void showAutoComp ( ) ; <nl> - void autoCompFromCurrentFile ( ) ; <nl> + void autoCompFromCurrentFile ( bool autoInsert = true ) ; <nl> void getApiFileName ( LangType langType , std : : string & fn ) ; <nl> <nl> void changeStyleCtrlsLang ( HWND hDlg , int * idArray , const char * * translatedText ) ; <nl> mmm a / PowerEditor / src / Parameters . cpp <nl> ppp b / PowerEditor / src / Parameters . cpp <nl> void NppParameters : : feedGUIParameters ( TiXmlNode * node ) <nl> _nppGUI . _globalOverride . enableUnderLine = true ; <nl> } <nl> } <nl> + else if ( ! strcmp ( nm , " auto - completion " ) ) <nl> + { <nl> + int i ; <nl> + if ( element - > Attribute ( " autoCAction " , & i ) ) <nl> + _nppGUI . _autocStatus = ( NppGUI : : AutocStatus ) i ; <nl> + } <nl> } <nl> } <nl> <nl> void NppParameters : : writeGUIParams ( ) <nl> bool saveOpenFileInSameDirExist = false ; <nl> bool URLExist = false ; <nl> bool globalOverrideExist = false ; <nl> + bool autocExist = false ; <nl> <nl> TiXmlNode * dockingParamNode = NULL ; <nl> <nl> void NppParameters : : writeGUIParams ( ) <nl> pStr = _nppGUI . _globalOverride . enableUnderLine ? " yes " : " no " ; <nl> element - > SetAttribute ( " underline " , pStr ) ; <nl> } <nl> + <nl> + if ( ! strcmp ( nm , " auto - completion " ) ) <nl> + { <nl> + autocExist = true ; <nl> + element - > SetAttribute ( " autoCAction " , _nppGUI . _autocStatus ) ; <nl> + } <nl> } <nl> <nl> if ( ! autoDetectionExist ) <nl> void NppParameters : : writeGUIParams ( ) <nl> GUIConfigElement - > SetAttribute ( " italic " , _nppGUI . _globalOverride . enableItalic ? " yes " : " no " ) ; <nl> GUIConfigElement - > SetAttribute ( " underline " , _nppGUI . _globalOverride . enableUnderLine ? " yes " : " no " ) ; <nl> } <nl> + <nl> + if ( ! autocExist ) <nl> + { <nl> + TiXmlElement * GUIConfigElement = ( GUIRoot - > InsertEndChild ( TiXmlElement ( " GUIConfig " ) ) ) - > ToElement ( ) ; <nl> + GUIConfigElement - > SetAttribute ( " name " , " auto - completion " ) ; <nl> + GUIConfigElement - > SetAttribute ( " autoCAction " , _nppGUI . _autocStatus ) ; <nl> + } <nl> <nl> if ( ! saveOpenFileInSameDirExist ) <nl> { <nl> mmm a / PowerEditor / src / Parameters . h <nl> ppp b / PowerEditor / src / Parameters . h <nl> struct NppGUI <nl> _splitterPos ( POS_HORIZOTAL ) , _userDefineDlgStatus ( UDD_DOCKED ) , _tabSize ( 8 ) , \ <nl> _tabReplacedBySpace ( false ) , _fileAutoDetection ( cdEnabled ) , _checkHistoryFiles ( true ) , \ <nl> _isMaximized ( false ) , _isMinimizedToTray ( false ) , _rememberLastSession ( true ) , _backup ( bak_none ) , _useDir ( false ) , \ <nl> - _doTaskList ( true ) , _maitainIndent ( true ) , _saveOpenKeepInSameDir ( false ) , _styleMRU ( true ) , _styleURL ( 0 ) { <nl> + _doTaskList ( true ) , _maitainIndent ( true ) , _saveOpenKeepInSameDir ( false ) , _styleMRU ( true ) , _styleURL ( 0 ) , _autocStatus ( autoc_none ) { <nl> _appPos . left = 0 ; <nl> _appPos . top = 0 ; <nl> _appPos . right = 700 ; <nl> | [ NEW_FEATURE ] AutoC finished . | notepad-plus-plus/notepad-plus-plus | 30a7f93cb9c24cfaac528aedd7143bae7da71950 | 2007-09-12T22:45:11Z |
mmm a / modules / observers / net_observer_reporter_print . cc <nl> ppp b / modules / observers / net_observer_reporter_print . cc <nl> <nl> namespace caffe2 { <nl> <nl> const std : : string NetObserverReporterPrint : : IDENTIFIER = " Caffe2Observer " ; <nl> + static std : : string get_op_args ( PerformanceInformation p ) ; <nl> + static std : : string get_tensor_shapes ( PerformanceInformation p ) ; <nl> <nl> void NetObserverReporterPrint : : report ( <nl> NetBase * net , <nl> void NetObserverReporterPrint : : report ( <nl> { " flops " , { { " value " , " - 1 " } , { " unit " , " flops " } } } } ; <nl> } else if ( p . first ! = " NET_DELAY " ) { <nl> / / for operator perf <nl> + std : : string shape_str = get_tensor_shapes ( p . second ) ; <nl> + std : : string args_str = get_op_args ( p . second ) ; <nl> + <nl> caffe2_perf [ p . first ] = { <nl> { " latency " , <nl> { { " value " , caffe2 : : to_string ( p . second . latency * 1000 ) } , <nl> void NetObserverReporterPrint : : report ( <nl> " value " , <nl> caffe2 : : to_string ( p . second . flops ) , <nl> } , <nl> - { " unit " , " flops " } } } } ; <nl> + { " unit " , " flops " } } } , <nl> + { " tensor_shapes " , { { " info_string " , shape_str } , { " unit " , " " } } } , <nl> + { " op_args " , { { " info_string " , args_str } , { " unit " , " " } } } } ; <nl> } <nl> } <nl> <nl> void NetObserverReporterPrint : : report ( <nl> LOG ( INFO ) < < buffer . str ( ) ; <nl> } <nl> } <nl> + <nl> + static std : : string get_tensor_shapes ( PerformanceInformation p ) { <nl> + std : : string shape_str ; <nl> + std : : stringstream shape_stream ; <nl> + if ( ! p . tensor_shapes . empty ( ) ) { <nl> + shape_stream < < " [ " ; <nl> + for ( int i = 0 ; i < p . tensor_shapes . size ( ) ; i + + ) { <nl> + shape_stream < < " [ " ; <nl> + for ( int j = 0 ; j < p . tensor_shapes [ i ] . dims_size ( ) ; j + + ) { <nl> + shape_stream < < p . tensor_shapes [ i ] . dims ( j ) < < " , " ; <nl> + } <nl> + shape_stream < < " ] , " ; <nl> + } <nl> + shape_stream < < " ] " ; <nl> + shape_str = shape_stream . str ( ) ; <nl> + } else { <nl> + shape_str = " [ ] " ; <nl> + } <nl> + return shape_str ; <nl> + } <nl> + <nl> + static std : : string get_op_args ( PerformanceInformation p ) { <nl> + std : : string args_str ; <nl> + if ( ! p . args . empty ( ) ) { <nl> + std : : stringstream args ; <nl> + args < < " [ " ; <nl> + for ( int i = 0 ; i < p . args . size ( ) ; i + + ) { <nl> + args < < " { " < < p . args [ i ] . name ( ) < < " : " ; <nl> + if ( p . args [ i ] . has_i ( ) ) { <nl> + args < < p . args [ i ] . i ( ) ; <nl> + } else if ( p . args [ i ] . has_s ( ) ) { <nl> + args < < p . args [ i ] . s ( ) ; <nl> + } else if ( p . args [ i ] . has_n ( ) ) { <nl> + args < < & p . args [ i ] . n ( ) ; <nl> + } else if ( p . args [ i ] . has_f ( ) ) { <nl> + args < < p . args [ i ] . f ( ) ; <nl> + } else { <nl> + args < < " None " ; <nl> + } <nl> + args < < " } , " ; <nl> + } <nl> + args < < " ] " ; <nl> + args_str = args . str ( ) ; <nl> + } else { <nl> + args_str = " [ ] " ; <nl> + } <nl> + return args_str ; <nl> + } <nl> } <nl> | Additional operator information values ( ) | pytorch/pytorch | c4bff252821743cf64c30336d5ce6ce0457e2a34 | 2018-07-17T00:40:44Z |
mmm a / project / cmake / scripts / common / AddOptions . cmake <nl> ppp b / project / cmake / scripts / common / AddOptions . cmake <nl> <nl> # <nl> # add_options ( CXX RELEASE " - O3 " " - DNDEBUG " " - Wall " ) <nl> <nl> - function ( add_options langs builds ) <nl> + function ( add_options langs builds ) <nl> # special handling of empty language specification <nl> - if ( " $ { langs } " STREQUAL " ALL_LANGUAGES " ) <nl> - set ( langs CXX C Fortran ) <nl> - endif ( " $ { langs } " STREQUAL " ALL_LANGUAGES " ) <nl> - foreach ( lang IN LISTS langs ) <nl> + if ( " $ { langs } " STREQUAL " ALL_LANGUAGES " ) <nl> + set ( langs CXX C Fortran ) <nl> + endif ( " $ { langs } " STREQUAL " ALL_LANGUAGES " ) <nl> + foreach ( lang IN LISTS langs ) <nl> # prepend underscore if necessary <nl> - foreach ( build IN LISTS builds ) <nl> - if ( NOT ( " $ { build } " STREQUAL " ALL_BUILDS " ) ) <nl> - set ( _bld " _ $ { build } " ) <nl> - string ( TOUPPER " $ { _bld } " _bld ) <nl> - else ( NOT ( " $ { build } " STREQUAL " ALL_BUILDS " ) ) <nl> - set ( _bld " " ) <nl> - endif ( NOT ( " $ { build } " STREQUAL " ALL_BUILDS " ) ) <nl> - foreach ( _opt IN LISTS ARGN ) <nl> - set ( _var " CMAKE_ $ { lang } _FLAGS $ { _bld } " ) <nl> - # message ( STATUS " Adding \ " $ { _opt } \ " to \ $ { $ { _var } } " ) <nl> + foreach ( build IN LISTS builds ) <nl> + if ( NOT ( " $ { build } " STREQUAL " ALL_BUILDS " ) ) <nl> + set ( _bld " _ $ { build } " ) <nl> + string ( TOUPPER " $ { _bld } " _bld ) <nl> + else ( NOT ( " $ { build } " STREQUAL " ALL_BUILDS " ) ) <nl> + set ( _bld " " ) <nl> + endif ( NOT ( " $ { build } " STREQUAL " ALL_BUILDS " ) ) <nl> + foreach ( _opt IN LISTS ARGN ) <nl> + set ( _var " CMAKE_ $ { lang } _FLAGS $ { _bld } " ) <nl> + # message ( STATUS " Adding \ " $ { _opt } \ " to \ $ { $ { _var } } " ) <nl> # remove it first <nl> - string ( REPLACE " $ { _opt } " " " _without " $ { $ { _var } } " ) <nl> - string ( STRIP " $ { _without } " _without ) <nl> + string ( REPLACE " $ { _opt } " " " _without " $ { $ { _var } } " ) <nl> + string ( STRIP " $ { _without } " _without ) <nl> # we need to strip this one as well , so they are comparable <nl> - string ( STRIP " $ { $ { _var } } " _stripped ) <nl> + string ( STRIP " $ { $ { _var } } " _stripped ) <nl> # if it wasn ' t there , then add it at the end <nl> - if ( " $ { _without } " STREQUAL " $ { _stripped } " ) <nl> + if ( " $ { _without } " STREQUAL " $ { _stripped } " ) <nl> # don ' t add any extra spaces if no options yet are set <nl> - if ( NOT $ { _stripped } STREQUAL " " ) <nl> - set ( $ { _var } " $ { _stripped } $ { _opt } " ) <nl> - else ( NOT $ { _stripped } STREQUAL " " ) <nl> - set ( $ { _var } " $ { _opt } " ) <nl> - endif ( NOT $ { _stripped } STREQUAL " " ) <nl> - set ( $ { _var } " $ { $ { _var } } " PARENT_SCOPE ) <nl> - endif ( " $ { _without } " STREQUAL " $ { _stripped } " ) <nl> - endforeach ( _opt ) <nl> - endforeach ( build ) <nl> - endforeach ( lang ) <nl> - endfunction ( add_options lang build ) <nl> + if ( NOT $ { _stripped } STREQUAL " " ) <nl> + set ( $ { _var } " $ { _stripped } $ { _opt } " ) <nl> + else ( NOT $ { _stripped } STREQUAL " " ) <nl> + set ( $ { _var } " $ { _opt } " ) <nl> + endif ( NOT $ { _stripped } STREQUAL " " ) <nl> + set ( $ { _var } " $ { $ { _var } } " PARENT_SCOPE ) <nl> + endif ( " $ { _without } " STREQUAL " $ { _stripped } " ) <nl> + endforeach ( _opt ) <nl> + endforeach ( build ) <nl> + endforeach ( lang ) <nl> + endfunction ( add_options lang build ) <nl> <nl> # set varname to flag unless user has specified something that matches regex <nl> - function ( set_default_option varname flag regex ) <nl> - if ( NOT " $ ENV { CXXFLAGS } " MATCHES " $ { regex } " <nl> + function ( set_default_option varname flag regex ) <nl> + if ( NOT " $ ENV { CXXFLAGS } " MATCHES " $ { regex } " <nl> AND NOT " $ { CMAKE_CXX_FLAGS } " MATCHES " $ { regex } " <nl> AND NOT " $ { CMAKE_CXX_FLAGS_ $ { CMAKE_BUILD_TYPE } } " MATCHES " $ { regex } " ) <nl> - set ( $ { varname } $ { flag } PARENT_SCOPE ) <nl> - else ( NOT " $ ENV { CXXFLAGS } " MATCHES " $ { regex } " <nl> + set ( $ { varname } $ { flag } PARENT_SCOPE ) <nl> + else ( NOT " $ ENV { CXXFLAGS } " MATCHES " $ { regex } " <nl> AND NOT " $ { CMAKE_CXX_FLAGS } " MATCHES " $ { regex } " <nl> AND NOT " $ { CMAKE_CXX_FLAGS_ $ { CMAKE_BUILD_TYPE } } " MATCHES " $ { regex } " ) <nl> - set ( $ { varname } PARENT_SCOPE ) <nl> - endif ( NOT " $ ENV { CXXFLAGS } " MATCHES " $ { regex } " <nl> + set ( $ { varname } PARENT_SCOPE ) <nl> + endif ( NOT " $ ENV { CXXFLAGS } " MATCHES " $ { regex } " <nl> AND NOT " $ { CMAKE_CXX_FLAGS } " MATCHES " $ { regex } " <nl> AND NOT " $ { CMAKE_CXX_FLAGS_ $ { CMAKE_BUILD_TYPE } } " MATCHES " $ { regex } " ) <nl> - endfunction ( set_default_option ) <nl> + endfunction ( set_default_option ) <nl> <nl> # note : this must be called before project ( ) <nl> - macro ( no_default_options ) <nl> + macro ( no_default_options ) <nl> # prevent the platform probe to set options <nl> - set ( CMAKE_NOT_USING_CONFIG_FLAGS TRUE ) <nl> - endmacro ( no_default_options ) <nl> + set ( CMAKE_NOT_USING_CONFIG_FLAGS TRUE ) <nl> + endmacro ( no_default_options ) <nl> mmm a / project / cmake / scripts / common / AddonHelpers . cmake <nl> ppp b / project / cmake / scripts / common / AddonHelpers . cmake <nl> endmacro ( ) <nl> <nl> # Grab the version from a given add - on ' s addon . xml <nl> macro ( addon_version dir prefix ) <nl> - IF ( EXISTS $ { PROJECT_SOURCE_DIR } / $ { dir } / addon . xml . in ) <nl> - FILE ( READ $ { PROJECT_SOURCE_DIR } / $ { dir } / addon . xml . in ADDONXML ) <nl> - ELSE ( ) <nl> - FILE ( READ $ { dir } / addon . xml ADDONXML ) <nl> - ENDIF ( ) <nl> - <nl> - STRING ( REGEX MATCH " < addon [ ^ > ] * version . ? = . ? . [ 0 - 9 \ \ . ] + " VERSION_STRING $ { ADDONXML } ) <nl> - STRING ( REGEX REPLACE " . * version = . ( [ 0 - 9 \ \ . ] + ) . * " " \ \ 1 " $ { prefix } _VERSION $ { VERSION_STRING } ) <nl> + if ( EXISTS $ { PROJECT_SOURCE_DIR } / $ { dir } / addon . xml . in ) <nl> + file ( READ $ { PROJECT_SOURCE_DIR } / $ { dir } / addon . xml . in ADDONXML ) <nl> + else ( ) <nl> + file ( READ $ { dir } / addon . xml ADDONXML ) <nl> + endif ( ) <nl> + <nl> + string ( REGEX MATCH " < addon [ ^ > ] * version . ? = . ? . [ 0 - 9 \ \ . ] + " VERSION_STRING $ { ADDONXML } ) <nl> + string ( REGEX REPLACE " . * version = . ( [ 0 - 9 \ \ . ] + ) . * " " \ \ 1 " $ { prefix } _VERSION $ { VERSION_STRING } ) <nl> message ( STATUS $ { prefix } _VERSION = $ { $ { prefix } _VERSION } ) <nl> endmacro ( ) <nl> <nl> endmacro ( ) <nl> macro ( build_addon target prefix libs ) <nl> addon_version ( $ { target } $ { prefix } ) <nl> if ( $ { prefix } _SOURCES ) <nl> - ADD_LIBRARY ( $ { target } $ { $ { prefix } _SOURCES } ) <nl> - TARGET_LINK_LIBRARIES ( $ { target } $ { $ { libs } } ) <nl> - SET_TARGET_PROPERTIES ( $ { target } PROPERTIES VERSION $ { $ { prefix } _VERSION } <nl> + add_library ( $ { target } $ { $ { prefix } _SOURCES } ) <nl> + TARGET_link_libraries ( $ { target } $ { $ { libs } } ) <nl> + set_target_properties ( $ { target } PROPERTIES VERSION $ { $ { prefix } _VERSION } <nl> SOVERSION $ { APP_VERSION_MAJOR } . $ { APP_VERSION_MINOR } <nl> PREFIX " " ) <nl> - IF ( OS STREQUAL " android " ) <nl> - SET_TARGET_PROPERTIES ( $ { target } PROPERTIES PREFIX " lib " ) <nl> - ENDIF ( OS STREQUAL " android " ) <nl> + if ( OS STREQUAL " android " ) <nl> + set_target_properties ( $ { target } PROPERTIES PREFIX " lib " ) <nl> + endif ( OS STREQUAL " android " ) <nl> elseif ( $ { prefix } _CUSTOM_BINARY ) <nl> add_custom_target ( $ { target } ALL ) <nl> list ( GET $ { prefix } _CUSTOM_BINARY 2 dependency ) <nl> macro ( build_addon target prefix libs ) <nl> list ( GET $ { prefix } _CUSTOM_BINARY 0 LIBRARY_LOCATION ) <nl> list ( GET $ { prefix } _CUSTOM_BINARY 1 LIBRARY_FILENAME ) <nl> else ( ) <nl> - SET ( LIBRARY_LOCATION $ < TARGET_FILE : $ { target } > ) <nl> + set ( LIBRARY_LOCATION $ < TARGET_FILE : $ { target } > ) <nl> # get the library ' s filename <nl> if ( " $ { CORE_SYSTEM_NAME } " STREQUAL " android " ) <nl> # for android we need the filename without any version numbers <nl> set ( LIBRARY_FILENAME $ < TARGET_LINKER_FILE_NAME : $ { target } > ) <nl> else ( ) <nl> - SET ( LIBRARY_FILENAME $ < TARGET_FILE_NAME : $ { target } > ) <nl> + set ( LIBRARY_FILENAME $ < TARGET_FILE_NAME : $ { target } > ) <nl> endif ( ) <nl> endif ( ) <nl> <nl> # if there ' s an addon . xml . in we need to generate the addon . xml <nl> - IF ( EXISTS $ { PROJECT_SOURCE_DIR } / $ { target } / addon . xml . in ) <nl> - SET ( PLATFORM $ { CORE_SYSTEM_NAME } ) <nl> + if ( EXISTS $ { PROJECT_SOURCE_DIR } / $ { target } / addon . xml . in ) <nl> + set ( PLATFORM $ { CORE_SYSTEM_NAME } ) <nl> <nl> - FILE ( READ $ { PROJECT_SOURCE_DIR } / $ { target } / addon . xml . in addon_file ) <nl> - STRING ( CONFIGURE " $ { addon_file } " addon_file_conf @ ONLY ) <nl> - FILE ( GENERATE OUTPUT $ { PROJECT_SOURCE_DIR } / $ { target } / addon . xml CONTENT " $ { addon_file_conf } " ) <nl> + file ( READ $ { PROJECT_SOURCE_DIR } / $ { target } / addon . xml . in addon_file ) <nl> + string ( CONFIGURE " $ { addon_file } " addon_file_conf @ ONLY ) <nl> + file ( GENERATE OUTPUT $ { PROJECT_SOURCE_DIR } / $ { target } / addon . xml CONTENT " $ { addon_file_conf } " ) <nl> if ( $ { APP_NAME_UC } _BUILD_DIR ) <nl> - FILE ( GENERATE OUTPUT $ { $ { APP_NAME_UC } _BUILD_DIR } / addons / $ { target } / addon . xml CONTENT " $ { addon_file_conf } " ) <nl> + file ( GENERATE OUTPUT $ { $ { APP_NAME_UC } _BUILD_DIR } / addons / $ { target } / addon . xml CONTENT " $ { addon_file_conf } " ) <nl> endif ( ) <nl> - ENDIF ( ) <nl> + endif ( ) <nl> <nl> # set zip as default if addon - package is called without PACKAGE_XXX <nl> - SET ( CPACK_GENERATOR " ZIP " ) <nl> - SET ( ext " zip " ) <nl> - IF ( PACKAGE_ZIP OR PACKAGE_TGZ ) <nl> - IF ( PACKAGE_TGZ ) <nl> - SET ( CPACK_GENERATOR " TGZ " ) <nl> - SET ( ext " tar . gz " ) <nl> - ENDIF ( PACKAGE_TGZ ) <nl> - SET ( CPACK_INCLUDE_TOPLEVEL_DIRECTORY OFF ) <nl> + set ( CPACK_GENERATOR " ZIP " ) <nl> + set ( ext " zip " ) <nl> + if ( PACKAGE_ZIP OR PACKAGE_TGZ ) <nl> + if ( PACKAGE_TGZ ) <nl> + set ( CPACK_GENERATOR " TGZ " ) <nl> + set ( ext " tar . gz " ) <nl> + endif ( PACKAGE_TGZ ) <nl> + set ( CPACK_INCLUDE_TOPLEVEL_DIRECTORY OFF ) <nl> set ( CPACK_PACKAGE_FILE_NAME addon ) <nl> - IF ( CMAKE_BUILD_TYPE STREQUAL " Release " ) <nl> - SET ( CPACK_STRIP_FILES TRUE ) <nl> - ENDIF ( CMAKE_BUILD_TYPE STREQUAL " Release " ) <nl> + if ( CMAKE_BUILD_TYPE STREQUAL " Release " ) <nl> + set ( CPACK_STRIP_FILES TRUE ) <nl> + endif ( CMAKE_BUILD_TYPE STREQUAL " Release " ) <nl> set ( CPACK_ARCHIVE_COMPONENT_INSTALL ON ) <nl> set ( CPACK_COMPONENTS_IGNORE_GROUPS 1 ) <nl> list ( APPEND CPACK_COMPONENTS_ALL $ { target } - $ { $ { prefix } _VERSION } ) <nl> # Pack files together to create an archive <nl> - INSTALL ( DIRECTORY $ { target } DESTINATION . / COMPONENT $ { target } - $ { $ { prefix } _VERSION } PATTERN " addon . xml . in " EXCLUDE ) <nl> - IF ( WIN32 ) <nl> + install ( DIRECTORY $ { target } DESTINATION . / COMPONENT $ { target } - $ { $ { prefix } _VERSION } PATTERN " addon . xml . in " EXCLUDE ) <nl> + if ( WIN32 ) <nl> if ( NOT CPACK_PACKAGE_DIRECTORY ) <nl> # determine the temporary path <nl> file ( TO_CMAKE_PATH " $ ENV { TEMP } " WIN32_TEMP_PATH ) <nl> macro ( build_addon target prefix libs ) <nl> <nl> if ( $ { prefix } _SOURCES ) <nl> # install the generated DLL file <nl> - INSTALL ( PROGRAMS $ { LIBRARY_LOCATION } DESTINATION $ { target } <nl> + install ( PROGRAMS $ { LIBRARY_LOCATION } DESTINATION $ { target } <nl> COMPONENT $ { target } - $ { $ { prefix } _VERSION } ) <nl> <nl> - IF ( CMAKE_BUILD_TYPE MATCHES Debug ) <nl> + if ( CMAKE_BUILD_TYPE MATCHES Debug ) <nl> # for debug builds also install the PDB file <nl> get_filename_component ( LIBRARY_DIR $ { LIBRARY_LOCATION } DIRECTORY ) <nl> - INSTALL ( FILES $ { LIBRARY_DIR } / $ { target } . pdb DESTINATION $ { target } <nl> + install ( FILES $ { LIBRARY_DIR } / $ { target } . pdb DESTINATION $ { target } <nl> COMPONENT $ { target } - $ { $ { prefix } _VERSION } ) <nl> - ENDIF ( ) <nl> + endif ( ) <nl> endif ( ) <nl> if ( $ { prefix } _CUSTOM_BINARY ) <nl> list ( GET $ { prefix } _CUSTOM_BINARY 0 FROM_BINARY ) <nl> macro ( build_addon target prefix libs ) <nl> if ( $ { prefix } _CUSTOM_DATA ) <nl> install ( DIRECTORY $ { $ { prefix } _CUSTOM_DATA } DESTINATION $ { target } / resources ) <nl> endif ( ) <nl> - ELSE ( WIN32 ) <nl> + else ( WIN32 ) <nl> if ( NOT CPACK_PACKAGE_DIRECTORY ) <nl> set ( CPACK_PACKAGE_DIRECTORY $ { CMAKE_BINARY_DIR } ) <nl> endif ( ) <nl> if ( $ { prefix } _SOURCES ) <nl> - INSTALL ( TARGETS $ { target } DESTINATION $ { target } <nl> + install ( TARGETS $ { target } DESTINATION $ { target } <nl> COMPONENT $ { target } - $ { $ { prefix } _VERSION } ) <nl> endif ( ) <nl> if ( $ { prefix } _CUSTOM_BINARY ) <nl> macro ( build_addon target prefix libs ) <nl> if ( $ { prefix } _CUSTOM_DATA ) <nl> install ( DIRECTORY $ { $ { prefix } _CUSTOM_DATA } DESTINATION $ { target } / resources ) <nl> endif ( ) <nl> - ENDIF ( WIN32 ) <nl> + endif ( WIN32 ) <nl> add_cpack_workaround ( $ { target } $ { $ { prefix } _VERSION } $ { ext } ) <nl> - ELSE ( PACKAGE_ZIP OR PACKAGE_TGZ ) <nl> + else ( PACKAGE_ZIP OR PACKAGE_TGZ ) <nl> if ( CMAKE_SYSTEM_NAME STREQUAL " Linux " ) <nl> if ( CMAKE_INSTALL_PREFIX_INITIALIZED_TO_DEFAULT OR NOT CMAKE_INSTALL_PREFIX ) <nl> message ( STATUS " setting install paths to match $ { APP_NAME } : CMAKE_INSTALL_PREFIX : $ { $ { APP_NAME_UC } _PREFIX } " ) <nl> macro ( build_addon target prefix libs ) <nl> set ( CMAKE_INSTALL_LIBDIR " lib / $ { APP_NAME_LC } " ) <nl> endif ( ) <nl> if ( $ { prefix } _SOURCES ) <nl> - INSTALL ( TARGETS $ { target } DESTINATION $ { CMAKE_INSTALL_LIBDIR } / addons / $ { target } ) <nl> + install ( TARGETS $ { target } DESTINATION $ { CMAKE_INSTALL_LIBDIR } / addons / $ { target } ) <nl> endif ( ) <nl> if ( $ { prefix } _CUSTOM_BINARY ) <nl> list ( GET $ { prefix } _CUSTOM_BINARY 0 FROM_BINARY ) <nl> macro ( build_addon target prefix libs ) <nl> endif ( ) <nl> install ( FILES $ { FROM_BINARY } DESTINATION $ { CMAKE_INSTALL_LIBDIR } / addons / $ { target } RENAME $ { TO_BINARY } ) <nl> endif ( ) <nl> - INSTALL ( DIRECTORY $ { target } DESTINATION share / $ { APP_NAME_LC } / addons PATTERN " addon . xml . in " EXCLUDE ) <nl> + install ( DIRECTORY $ { target } DESTINATION share / $ { APP_NAME_LC } / addons PATTERN " addon . xml . in " EXCLUDE ) <nl> if ( $ { prefix } _CUSTOM_DATA ) <nl> install ( DIRECTORY $ { $ { prefix } _CUSTOM_DATA } DESTINATION share / $ { APP_NAME_LC } / addons / $ { target } / resources ) <nl> endif ( ) <nl> - ENDIF ( PACKAGE_ZIP OR PACKAGE_TGZ ) <nl> + endif ( PACKAGE_ZIP OR PACKAGE_TGZ ) <nl> if ( $ { APP_NAME_UC } _BUILD_DIR ) <nl> file ( GLOB_RECURSE files $ { CMAKE_CURRENT_SOURCE_DIR } / $ { target } / * ) <nl> if ( $ { prefix } _CUSTOM_DATA ) <nl> endfunction ( ) <nl> # Cmake build options <nl> include ( AddOptions ) <nl> include ( TestCXXAcceptsFlag ) <nl> - OPTION ( PACKAGE_ZIP " Package Zip file ? " OFF ) <nl> - OPTION ( PACKAGE_TGZ " Package TGZ file ? " OFF ) <nl> - OPTION ( BUILD_SHARED_LIBS " Build shared libs ? " ON ) <nl> + option ( PACKAGE_ZIP " Package Zip file ? " OFF ) <nl> + option ( PACKAGE_TGZ " Package TGZ file ? " OFF ) <nl> + option ( BUILD_SHARED_LIBS " Build shared libs ? " ON ) <nl> <nl> # LTO support ? <nl> CHECK_CXX_ACCEPTS_FLAG ( " - flto " HAVE_LTO ) <nl> - IF ( HAVE_LTO ) <nl> - OPTION ( USE_LTO " use link time optimization " OFF ) <nl> - IF ( USE_LTO ) <nl> + if ( HAVE_LTO ) <nl> + option ( USE_LTO " use link time optimization " OFF ) <nl> + if ( USE_LTO ) <nl> add_options ( ALL_LANGUAGES ALL_BUILDS " - flto " ) <nl> - ENDIF ( USE_LTO ) <nl> - ENDIF ( HAVE_LTO ) <nl> + endif ( USE_LTO ) <nl> + endif ( HAVE_LTO ) <nl> <nl> # set this to try linking dependencies as static as possible <nl> - IF ( ADDONS_PREFER_STATIC_LIBS ) <nl> - SET ( CMAKE_FIND_LIBRARY_SUFFIXES . lib . a $ { CMAKE_FIND_LIBRARY_SUFFIXES } ) <nl> - ENDIF ( ADDONS_PREFER_STATIC_LIBS ) <nl> + if ( ADDONS_PREFER_STATIC_LIBS ) <nl> + set ( CMAKE_FIND_LIBRARY_SUFFIXES . lib . a $ { CMAKE_FIND_LIBRARY_SUFFIXES } ) <nl> + endif ( ADDONS_PREFER_STATIC_LIBS ) <nl> <nl> if ( $ { APP_NAME_UC } _BUILD_DIR ) <nl> list ( APPEND CMAKE_PREFIX_PATH $ { $ { APP_NAME_UC } _BUILD_DIR } / build ) <nl> mmm a / project / cmake / scripts / common / CheckTargetPlatform . cmake <nl> ppp b / project / cmake / scripts / common / CheckTargetPlatform . cmake <nl> function ( check_target_platform dir target_platform build ) <nl> if ( $ { platform_first } STREQUAL " ! " ) <nl> # extract the platform <nl> string ( LENGTH $ { platform } platform_length ) <nl> - MATH ( EXPR platform_length " $ { platform_length } - 1 " ) <nl> + math ( EXPR platform_length " $ { platform_length } - 1 " ) <nl> string ( SUBSTRING $ { platform } 1 $ { platform_length } platform ) <nl> <nl> # check if the current platform does not match the extracted platform <nl> - if ( NOT $ { platform } STREQUAL $ { target_platform } ) <nl> + if ( NOT $ { platform } STREQUAL $ { target_platform } ) <nl> set ( $ { build } TRUE ) <nl> endif ( ) <nl> endif ( ) <nl> mmm a / project / cmake / scripts / common / HandleDepends . cmake <nl> ppp b / project / cmake / scripts / common / HandleDepends . cmake <nl> function ( add_addon_depends addon searchpath ) <nl> <nl> if ( CMAKE_TOOLCHAIN_FILE ) <nl> list ( APPEND BUILD_ARGS - DCMAKE_TOOLCHAIN_FILE = $ { CMAKE_TOOLCHAIN_FILE } ) <nl> - MESSAGE ( " toolchain specified " ) <nl> - MESSAGE ( $ { BUILD_ARGS } ) <nl> + message ( " toolchain specified " ) <nl> + message ( $ { BUILD_ARGS } ) <nl> endif ( ) <nl> <nl> # if there ' s a CMakeLists . txt use it to prepare the build <nl> function ( add_addon_depends addon searchpath ) <nl> <nl> # if the patch file exists we need to set the PATCH_COMMAND <nl> set ( PATCH_COMMAND " " ) <nl> - if ( EXISTS $ { PATCH_FILE } ) <nl> + if ( EXISTS $ { PATCH_FILE } ) <nl> set ( PATCH_COMMAND $ { CMAKE_COMMAND } - P $ { PATCH_FILE } ) <nl> endif ( ) <nl> <nl> mmm a / project / cmake / scripts / common / Macros . cmake <nl> ppp b / project / cmake / scripts / common / Macros . cmake <nl> endfunction ( ) <nl> # helper macro for optional deps <nl> macro ( setup_enable_switch ) <nl> string ( TOUPPER $ { dep } depup ) <nl> - if ( ARGV1 ) <nl> + if ( ARGV1 ) <nl> set ( enable_switch $ { ARGV1 } ) <nl> else ( ) <nl> set ( enable_switch ENABLE_ $ { depup } ) <nl> macro ( core_add_optional_subdirs_from_filelist pattern ) <nl> endmacro ( ) <nl> <nl> macro ( today RESULT ) <nl> - if ( WIN32 ) <nl> + if ( WIN32 ) <nl> execute_process ( COMMAND " cmd " " / C date / T " OUTPUT_VARIABLE $ { RESULT } ) <nl> string ( REGEX REPLACE " ( . . ) / ( . . ) / . . ( . . ) . * " " \ \ 1 / \ \ 2 / \ \ 3 " $ { RESULT } $ { $ { RESULT } } ) <nl> elseif ( UNIX ) <nl> function ( core_find_git_rev ) <nl> execute_process ( COMMAND $ { GIT_EXECUTABLE } diff - files - - ignore - submodules - - quiet - - <nl> RESULT_VARIABLE status_code <nl> WORKING_DIRECTORY $ { CORE_SOURCE_DIR } ) <nl> - if ( NOT status_code ) <nl> + if ( NOT status_code ) <nl> execute_process ( COMMAND $ { GIT_EXECUTABLE } diff - index - - ignore - submodules - - quiet HEAD - - <nl> RESULT_VARIABLE status_code <nl> WORKING_DIRECTORY $ { CORE_SOURCE_DIR } ) <nl> endif ( ) <nl> - if ( status_code ) <nl> + if ( status_code ) <nl> execute_process ( COMMAND $ { GIT_EXECUTABLE } log - n 1 - - pretty = format : " % h - dirty " HEAD <nl> OUTPUT_VARIABLE HASH <nl> WORKING_DIRECTORY $ { CORE_SOURCE_DIR } ) <nl> mmm a / project / cmake / scripts / common / ManageString . cmake <nl> ppp b / project / cmake / scripts / common / ManageString . cmake <nl> <nl> # Defines the following macros : <nl> # STRING_TRIM ( var str [ NOUNQUOTE ] ) <nl> # - Trim a string by removing the leading and trailing spaces , <nl> - # just like STRING ( STRIP . . . ) in CMake 2 . 6 and later . <nl> - # This macro is needed as CMake 2 . 4 does not support STRING ( STRIP . . ) <nl> + # just like string ( STRIP . . . ) in CMake 2 . 6 and later . <nl> + # This macro is needed as CMake 2 . 4 does not support string ( STRIP . . ) <nl> # This macro also remove quote and double quote marks around the string , <nl> # unless NOUNQUOTE is defined . <nl> # * Parameters : <nl> <nl> # + NOESCAPE_SEMICOLON : ( Optional ) Do not escape semicolons . <nl> # <nl> <nl> - IF ( NOT DEFINED _MANAGE_STRING_CMAKE_ ) <nl> - SET ( _MANAGE_STRING_CMAKE_ " DEFINED " ) <nl> + if ( NOT DEFINED _MANAGE_STRING_CMAKE_ ) <nl> + set ( _MANAGE_STRING_CMAKE_ " DEFINED " ) <nl> <nl> - MACRO ( STRING_TRIM var str ) <nl> - SET ( $ { var } " " ) <nl> - IF ( NOT " $ { ARGN } " STREQUAL " NOUNQUOTE " ) <nl> + macro ( STRING_TRIM var str ) <nl> + set ( $ { var } " " ) <nl> + if ( NOT " $ { ARGN } " STREQUAL " NOUNQUOTE " ) <nl> # Need not trim a quoted string . <nl> STRING_UNQUOTE ( _var " $ { str } " ) <nl> - IF ( NOT _var STREQUAL " " ) <nl> + if ( NOT _var STREQUAL " " ) <nl> # String is quoted <nl> - SET ( $ { var } " $ { _var } " ) <nl> - ENDIF ( NOT _var STREQUAL " " ) <nl> - ENDIF ( NOT " $ { ARGN } " STREQUAL " NOUNQUOTE " ) <nl> - <nl> - IF ( $ { var } STREQUAL " " ) <nl> - SET ( _var_1 " $ { str } " ) <nl> - STRING ( REGEX REPLACE " ^ [ \ t \ r \ n ] + " " " _var_2 " $ { str } " ) <nl> - STRING ( REGEX REPLACE " [ \ t \ r \ n ] + $ " " " _var_3 " $ { _var_2 } " ) <nl> - SET ( $ { var } " $ { _var_3 } " ) <nl> - ENDIF ( $ { var } STREQUAL " " ) <nl> - ENDMACRO ( STRING_TRIM var str ) <nl> + set ( $ { var } " $ { _var } " ) <nl> + endif ( NOT _var STREQUAL " " ) <nl> + endif ( NOT " $ { ARGN } " STREQUAL " NOUNQUOTE " ) <nl> + <nl> + if ( $ { var } STREQUAL " " ) <nl> + set ( _var_1 " $ { str } " ) <nl> + string ( REGEX REPLACE " ^ [ \ t \ r \ n ] + " " " _var_2 " $ { str } " ) <nl> + string ( REGEX REPLACE " [ \ t \ r \ n ] + $ " " " _var_3 " $ { _var_2 } " ) <nl> + set ( $ { var } " $ { _var_3 } " ) <nl> + endif ( $ { var } STREQUAL " " ) <nl> + endmacro ( STRING_TRIM var str ) <nl> <nl> # Internal macro <nl> # Variable cannot be escaped here , as variable is already substituted <nl> # at the time it passes to this macro . <nl> - MACRO ( STRING_ESCAPE var str ) <nl> + macro ( STRING_ESCAPE var str ) <nl> # ' ; ' and ' \ ' are tricky , need to be encoded . <nl> # ' # ' = > ' # H ' <nl> # ' \ ' = > ' # B ' <nl> # ' ; ' = > ' # S ' <nl> - SET ( _NOESCAPE_SEMICOLON " " ) <nl> - SET ( _NOESCAPE_HASH " " ) <nl> - <nl> - FOREACH ( _arg $ { ARGN } ) <nl> - IF ( $ { _arg } STREQUAL " NOESCAPE_SEMICOLON " ) <nl> - SET ( _NOESCAPE_SEMICOLON " NOESCAPE_SEMICOLON " ) <nl> - ELSEIF ( $ { _arg } STREQUAL " NOESCAPE_HASH " ) <nl> - SET ( _NOESCAPE_HASH " NOESCAPE_HASH " ) <nl> - ENDIF ( $ { _arg } STREQUAL " NOESCAPE_SEMICOLON " ) <nl> - ENDFOREACH ( _arg ) <nl> - <nl> - IF ( _NOESCAPE_HASH STREQUAL " " ) <nl> - STRING ( REGEX REPLACE " # " " # H " _ret " $ { str } " ) <nl> - ELSE ( _NOESCAPE_HASH STREQUAL " " ) <nl> - SET ( _ret " $ { str } " ) <nl> - ENDIF ( _NOESCAPE_HASH STREQUAL " " ) <nl> - <nl> - STRING ( REGEX REPLACE " \ \ \ \ " " # B " _ret " $ { _ret } " ) <nl> - IF ( _NOESCAPE_SEMICOLON STREQUAL " " ) <nl> - STRING ( REGEX REPLACE " ; " " # S " _ret " $ { _ret } " ) <nl> - ENDIF ( _NOESCAPE_SEMICOLON STREQUAL " " ) <nl> - SET ( $ { var } " $ { _ret } " ) <nl> - ENDMACRO ( STRING_ESCAPE var str ) <nl> - <nl> - MACRO ( STRING_UNESCAPE var str ) <nl> + set ( _NOESCAPE_SEMICOLON " " ) <nl> + set ( _NOESCAPE_HASH " " ) <nl> + <nl> + foreach ( _arg $ { ARGN } ) <nl> + if ( $ { _arg } STREQUAL " NOESCAPE_SEMICOLON " ) <nl> + set ( _NOESCAPE_SEMICOLON " NOESCAPE_SEMICOLON " ) <nl> + elseif ( $ { _arg } STREQUAL " NOESCAPE_HASH " ) <nl> + set ( _NOESCAPE_HASH " NOESCAPE_HASH " ) <nl> + endif ( $ { _arg } STREQUAL " NOESCAPE_SEMICOLON " ) <nl> + endforeach ( _arg ) <nl> + <nl> + if ( _NOESCAPE_HASH STREQUAL " " ) <nl> + string ( REGEX REPLACE " # " " # H " _ret " $ { str } " ) <nl> + else ( _NOESCAPE_HASH STREQUAL " " ) <nl> + set ( _ret " $ { str } " ) <nl> + endif ( _NOESCAPE_HASH STREQUAL " " ) <nl> + <nl> + string ( REGEX REPLACE " \ \ \ \ " " # B " _ret " $ { _ret } " ) <nl> + if ( _NOESCAPE_SEMICOLON STREQUAL " " ) <nl> + string ( REGEX REPLACE " ; " " # S " _ret " $ { _ret } " ) <nl> + endif ( _NOESCAPE_SEMICOLON STREQUAL " " ) <nl> + set ( $ { var } " $ { _ret } " ) <nl> + endmacro ( STRING_ESCAPE var str ) <nl> + <nl> + macro ( STRING_UNESCAPE var str ) <nl> # ' # B ' = > ' \ ' <nl> # ' # H ' = > ' # ' <nl> # ' # D ' = > ' $ ' <nl> # ' # S ' = > ' ; ' <nl> - SET ( _ESCAPE_VARIABLE " " ) <nl> - SET ( _NOESCAPE_SEMICOLON " " ) <nl> - SET ( _ret " $ { str } " ) <nl> - FOREACH ( _arg $ { ARGN } ) <nl> - IF ( $ { _arg } STREQUAL " NOESCAPE_SEMICOLON " ) <nl> - SET ( _NOESCAPE_SEMICOLON " NOESCAPE_SEMICOLON " ) <nl> - ELSEIF ( $ { _arg } STREQUAL " ESCAPE_VARIABLE " ) <nl> - SET ( _ESCAPE_VARIABLE " ESCAPE_VARIABLE " ) <nl> - STRING ( REGEX REPLACE " # D " " $ " _ret " $ { _ret } " ) <nl> - ENDIF ( $ { _arg } STREQUAL " NOESCAPE_SEMICOLON " ) <nl> - ENDFOREACH ( _arg ) <nl> - <nl> - STRING ( REGEX REPLACE " # B " " \ \ \ \ " _ret " $ { _ret } " ) <nl> - IF ( _NOESCAPE_SEMICOLON STREQUAL " " ) <nl> + set ( _ESCAPE_VARIABLE " " ) <nl> + set ( _NOESCAPE_SEMICOLON " " ) <nl> + set ( _ret " $ { str } " ) <nl> + foreach ( _arg $ { ARGN } ) <nl> + if ( $ { _arg } STREQUAL " NOESCAPE_SEMICOLON " ) <nl> + set ( _NOESCAPE_SEMICOLON " NOESCAPE_SEMICOLON " ) <nl> + elseif ( $ { _arg } STREQUAL " ESCAPE_VARIABLE " ) <nl> + set ( _ESCAPE_VARIABLE " ESCAPE_VARIABLE " ) <nl> + string ( REGEX REPLACE " # D " " $ " _ret " $ { _ret } " ) <nl> + endif ( $ { _arg } STREQUAL " NOESCAPE_SEMICOLON " ) <nl> + endforeach ( _arg ) <nl> + <nl> + string ( REGEX REPLACE " # B " " \ \ \ \ " _ret " $ { _ret } " ) <nl> + if ( _NOESCAPE_SEMICOLON STREQUAL " " ) <nl> # ' ; ' = > ' # S ' <nl> - STRING ( REGEX REPLACE " # S " " \ \ \ \ ; " _ret " $ { _ret } " ) <nl> - ELSE ( _NOESCAPE_SEMICOLON STREQUAL " " ) <nl> - STRING ( REGEX REPLACE " # S " " ; " _ret " $ { _ret } " ) <nl> - ENDIF ( _NOESCAPE_SEMICOLON STREQUAL " " ) <nl> + string ( REGEX REPLACE " # S " " \ \ \ \ ; " _ret " $ { _ret } " ) <nl> + else ( _NOESCAPE_SEMICOLON STREQUAL " " ) <nl> + string ( REGEX REPLACE " # S " " ; " _ret " $ { _ret } " ) <nl> + endif ( _NOESCAPE_SEMICOLON STREQUAL " " ) <nl> <nl> - IF ( NOT _ESCAPE_VARIABLE STREQUAL " " ) <nl> + if ( NOT _ESCAPE_VARIABLE STREQUAL " " ) <nl> # ' # D ' = > ' $ ' <nl> - STRING ( REGEX REPLACE " # D " " $ " _ret " $ { _ret } " ) <nl> - ENDIF ( NOT _ESCAPE_VARIABLE STREQUAL " " ) <nl> - STRING ( REGEX REPLACE " # H " " # " _ret " $ { _ret } " ) <nl> - SET ( $ { var } " $ { _ret } " ) <nl> - ENDMACRO ( STRING_UNESCAPE var str ) <nl> + string ( REGEX REPLACE " # D " " $ " _ret " $ { _ret } " ) <nl> + endif ( NOT _ESCAPE_VARIABLE STREQUAL " " ) <nl> + string ( REGEX REPLACE " # H " " # " _ret " $ { _ret } " ) <nl> + set ( $ { var } " $ { _ret } " ) <nl> + endmacro ( STRING_UNESCAPE var str ) <nl> <nl> <nl> - MACRO ( STRING_UNQUOTE var str ) <nl> + macro ( STRING_UNQUOTE var str ) <nl> STRING_ESCAPE ( _ret " $ { str } " $ { ARGN } ) <nl> - IF ( _ret MATCHES " ^ [ \ t \ r \ n ] + " ) <nl> - STRING ( REGEX REPLACE " ^ [ \ t \ r \ n ] + " " " _ret " $ { _ret } " ) <nl> - ENDIF ( _ret MATCHES " ^ [ \ t \ r \ n ] + " ) <nl> - IF ( _ret MATCHES " ^ \ " " ) <nl> + if ( _ret MATCHES " ^ [ \ t \ r \ n ] + " ) <nl> + string ( REGEX REPLACE " ^ [ \ t \ r \ n ] + " " " _ret " $ { _ret } " ) <nl> + endif ( _ret MATCHES " ^ [ \ t \ r \ n ] + " ) <nl> + if ( _ret MATCHES " ^ \ " " ) <nl> # Double quote <nl> - STRING ( REGEX REPLACE " \ " \ ( . * \ ) \ " [ \ t \ r \ n ] * $ " " \ \ 1 " _ret " $ { _ret } " ) <nl> - ELSEIF ( _ret MATCHES " ^ ' " ) <nl> + string ( REGEX REPLACE " \ " \ ( . * \ ) \ " [ \ t \ r \ n ] * $ " " \ \ 1 " _ret " $ { _ret } " ) <nl> + elseif ( _ret MATCHES " ^ ' " ) <nl> # Single quote <nl> - STRING ( REGEX REPLACE " ' \ ( . * \ ) ' [ \ t \ r \ n ] * $ " " \ \ 1 " _ret " $ { _ret } " ) <nl> - ELSE ( _ret MATCHES " ^ \ " " ) <nl> - SET ( _ret " " ) <nl> - ENDIF ( _ret MATCHES " ^ \ " " ) <nl> + string ( REGEX REPLACE " ' \ ( . * \ ) ' [ \ t \ r \ n ] * $ " " \ \ 1 " _ret " $ { _ret } " ) <nl> + else ( _ret MATCHES " ^ \ " " ) <nl> + set ( _ret " " ) <nl> + endif ( _ret MATCHES " ^ \ " " ) <nl> <nl> # Unencoding <nl> STRING_UNESCAPE ( $ { var } " $ { _ret } " $ { ARGN } ) <nl> - ENDMACRO ( STRING_UNQUOTE var str ) <nl> - <nl> - MACRO ( STRING_JOIN var delimiter str_list ) <nl> - SET ( _ret " " ) <nl> - FOREACH ( _str $ { str_list } ) <nl> - IF ( _ret STREQUAL " " ) <nl> - SET ( _ret " $ { _str } " ) <nl> - ELSE ( _ret STREQUAL " " ) <nl> - SET ( _ret " $ { _ret } $ { delimiter } $ { _str } " ) <nl> - ENDIF ( _ret STREQUAL " " ) <nl> - ENDFOREACH ( _str $ { str_list } ) <nl> - <nl> - FOREACH ( _str $ { ARGN } ) <nl> - IF ( _ret STREQUAL " " ) <nl> - SET ( _ret " $ { _str } " ) <nl> - ELSE ( _ret STREQUAL " " ) <nl> - SET ( _ret " $ { _ret } $ { delimiter } $ { _str } " ) <nl> - ENDIF ( _ret STREQUAL " " ) <nl> - ENDFOREACH ( _str $ { str_list } ) <nl> - SET ( $ { var } " $ { _ret } " ) <nl> - ENDMACRO ( STRING_JOIN var delimiter str_list ) <nl> - <nl> - MACRO ( STRING_SPLIT var delimiter str ) <nl> - SET ( _max_tokens " " ) <nl> - SET ( _NOESCAPE_SEMICOLON " " ) <nl> - SET ( _ESCAPE_VARIABLE " " ) <nl> - FOREACH ( _arg $ { ARGN } ) <nl> - IF ( $ { _arg } STREQUAL " NOESCAPE_SEMICOLON " ) <nl> - SET ( _NOESCAPE_SEMICOLON " NOESCAPE_SEMICOLON " ) <nl> - ELSEIF ( $ { _arg } STREQUAL " ESCAPE_VARIABLE " ) <nl> - SET ( _ESCAPE_VARIABLE " ESCAPE_VARIABLE " ) <nl> - ELSE ( $ { _arg } STREQUAL " NOESCAPE_SEMICOLON " ) <nl> - SET ( _max_tokens $ { _arg } ) <nl> - ENDIF ( $ { _arg } STREQUAL " NOESCAPE_SEMICOLON " ) <nl> - ENDFOREACH ( _arg ) <nl> - <nl> - IF ( NOT _max_tokens ) <nl> - SET ( _max_tokens - 1 ) <nl> - ENDIF ( NOT _max_tokens ) <nl> + endmacro ( STRING_UNQUOTE var str ) <nl> + <nl> + macro ( STRING_JOIN var delimiter str_list ) <nl> + set ( _ret " " ) <nl> + foreach ( _str $ { str_list } ) <nl> + if ( _ret STREQUAL " " ) <nl> + set ( _ret " $ { _str } " ) <nl> + else ( _ret STREQUAL " " ) <nl> + set ( _ret " $ { _ret } $ { delimiter } $ { _str } " ) <nl> + endif ( _ret STREQUAL " " ) <nl> + endforeach ( _str $ { str_list } ) <nl> + <nl> + foreach ( _str $ { ARGN } ) <nl> + if ( _ret STREQUAL " " ) <nl> + set ( _ret " $ { _str } " ) <nl> + else ( _ret STREQUAL " " ) <nl> + set ( _ret " $ { _ret } $ { delimiter } $ { _str } " ) <nl> + endif ( _ret STREQUAL " " ) <nl> + endforeach ( _str $ { str_list } ) <nl> + set ( $ { var } " $ { _ret } " ) <nl> + endmacro ( STRING_JOIN var delimiter str_list ) <nl> + <nl> + macro ( STRING_SPLIT var delimiter str ) <nl> + set ( _max_tokens " " ) <nl> + set ( _NOESCAPE_SEMICOLON " " ) <nl> + set ( _ESCAPE_VARIABLE " " ) <nl> + foreach ( _arg $ { ARGN } ) <nl> + if ( $ { _arg } STREQUAL " NOESCAPE_SEMICOLON " ) <nl> + set ( _NOESCAPE_SEMICOLON " NOESCAPE_SEMICOLON " ) <nl> + elseif ( $ { _arg } STREQUAL " ESCAPE_VARIABLE " ) <nl> + set ( _ESCAPE_VARIABLE " ESCAPE_VARIABLE " ) <nl> + else ( $ { _arg } STREQUAL " NOESCAPE_SEMICOLON " ) <nl> + set ( _max_tokens $ { _arg } ) <nl> + endif ( $ { _arg } STREQUAL " NOESCAPE_SEMICOLON " ) <nl> + endforeach ( _arg ) <nl> + <nl> + if ( NOT _max_tokens ) <nl> + set ( _max_tokens - 1 ) <nl> + endif ( NOT _max_tokens ) <nl> <nl> STRING_ESCAPE ( _str " $ { str } " $ { _NOESCAPE_SEMICOLON } $ { _ESCAPE_VARIABLE } ) <nl> STRING_ESCAPE ( _delimiter " $ { delimiter } " $ { _NOESCAPE_SEMICOLON } $ { _ESCAPE_VARIABLE } ) <nl> <nl> - SET ( _str_list " " ) <nl> - SET ( _token_count 0 ) <nl> - STRING ( LENGTH " $ { _delimiter } " _de_len ) <nl> + set ( _str_list " " ) <nl> + set ( _token_count 0 ) <nl> + string ( LENGTH " $ { _delimiter } " _de_len ) <nl> <nl> - WHILE ( NOT _token_count EQUAL _max_tokens ) <nl> - MATH ( EXPR _token_count $ { _token_count } + 1 ) <nl> - IF ( _token_count EQUAL _max_tokens ) <nl> + while ( NOT _token_count EQUAL _max_tokens ) <nl> + math ( EXPR _token_count $ { _token_count } + 1 ) <nl> + if ( _token_count EQUAL _max_tokens ) <nl> # Last token , no need splitting <nl> - SET ( _str_list $ { _str_list } " $ { _str } " ) <nl> - ELSE ( _token_count EQUAL _max_tokens ) <nl> + set ( _str_list $ { _str_list } " $ { _str } " ) <nl> + else ( _token_count EQUAL _max_tokens ) <nl> # in case encoded characters are delimiters <nl> - STRING ( LENGTH " $ { _str } " _str_len ) <nl> - SET ( _index 0 ) <nl> - SET ( _token " " ) <nl> - SET ( _str_remain " " ) <nl> - MATH ( EXPR _str_end $ { _str_len } - $ { _de_len } + 1 ) <nl> - SET ( _bound " k " ) <nl> - WHILE ( _index LESS _str_end ) <nl> - STRING ( SUBSTRING " $ { _str } " $ { _index } $ { _de_len } _str_cursor ) <nl> - IF ( _str_cursor STREQUAL _delimiter ) <nl> + string ( LENGTH " $ { _str } " _str_len ) <nl> + set ( _index 0 ) <nl> + set ( _token " " ) <nl> + set ( _str_remain " " ) <nl> + math ( EXPR _str_end $ { _str_len } - $ { _de_len } + 1 ) <nl> + set ( _bound " k " ) <nl> + while ( _index LESS _str_end ) <nl> + string ( SUBSTRING " $ { _str } " $ { _index } $ { _de_len } _str_cursor ) <nl> + if ( _str_cursor STREQUAL _delimiter ) <nl> # Get the token <nl> - STRING ( SUBSTRING " $ { _str } " 0 $ { _index } _token ) <nl> + string ( SUBSTRING " $ { _str } " 0 $ { _index } _token ) <nl> # Get the rest <nl> - MATH ( EXPR _rest_index $ { _index } + $ { _de_len } ) <nl> - MATH ( EXPR _rest_len $ { _str_len } - $ { _index } - $ { _de_len } ) <nl> - STRING ( SUBSTRING " $ { _str } " $ { _rest_index } $ { _rest_len } _str_remain ) <nl> - SET ( _index $ { _str_end } ) <nl> - ELSE ( _str_cursor STREQUAL _delimiter ) <nl> - MATH ( EXPR _index $ { _index } + 1 ) <nl> - ENDIF ( _str_cursor STREQUAL _delimiter ) <nl> - ENDWHILE ( _index LESS _str_end ) <nl> - <nl> - IF ( _str_remain STREQUAL " " ) <nl> + math ( EXPR _rest_index $ { _index } + $ { _de_len } ) <nl> + math ( EXPR _rest_len $ { _str_len } - $ { _index } - $ { _de_len } ) <nl> + string ( SUBSTRING " $ { _str } " $ { _rest_index } $ { _rest_len } _str_remain ) <nl> + set ( _index $ { _str_end } ) <nl> + else ( _str_cursor STREQUAL _delimiter ) <nl> + math ( EXPR _index $ { _index } + 1 ) <nl> + endif ( _str_cursor STREQUAL _delimiter ) <nl> + endwhile ( _index LESS _str_end ) <nl> + <nl> + if ( _str_remain STREQUAL " " ) <nl> # Meaning : end of string <nl> - LIST ( APPEND _str_list " $ { _str } " ) <nl> - SET ( _max_tokens $ { _token_count } ) <nl> - ELSE ( _str_remain STREQUAL " " ) <nl> - LIST ( APPEND _str_list " $ { _token } " ) <nl> - SET ( _str " $ { _str_remain } " ) <nl> - ENDIF ( _str_remain STREQUAL " " ) <nl> - ENDIF ( _token_count EQUAL _max_tokens ) <nl> - ENDWHILE ( NOT _token_count EQUAL _max_tokens ) <nl> + list ( APPEND _str_list " $ { _str } " ) <nl> + set ( _max_tokens $ { _token_count } ) <nl> + else ( _str_remain STREQUAL " " ) <nl> + list ( APPEND _str_list " $ { _token } " ) <nl> + set ( _str " $ { _str_remain } " ) <nl> + endif ( _str_remain STREQUAL " " ) <nl> + endif ( _token_count EQUAL _max_tokens ) <nl> + endwhile ( NOT _token_count EQUAL _max_tokens ) <nl> <nl> <nl> # Unencoding <nl> STRING_UNESCAPE ( $ { var } " $ { _str_list } " $ { _NOESCAPE_SEMICOLON } $ { _ESCAPE_VARIABLE } ) <nl> - ENDMACRO ( STRING_SPLIT var delimiter str ) <nl> + endmacro ( STRING_SPLIT var delimiter str ) <nl> <nl> - ENDIF ( NOT DEFINED _MANAGE_STRING_CMAKE_ ) <nl> + endif ( NOT DEFINED _MANAGE_STRING_CMAKE_ ) <nl> <nl> mmm a / project / cmake / scripts / common / PrepareEnv . cmake <nl> ppp b / project / cmake / scripts / common / PrepareEnv . cmake <nl> <nl> # parse version . txt to get the version info <nl> if ( EXISTS " $ { CORE_SOURCE_DIR } / version . txt " ) <nl> file ( STRINGS " $ { CORE_SOURCE_DIR } / version . txt " versions ) <nl> - foreach ( version $ { versions } ) <nl> + foreach ( version $ { versions } ) <nl> if ( version MATCHES " ^ VERSION_ . * " ) <nl> string ( REGEX MATCH " ^ [ ^ ] + " version_name $ { version } ) <nl> string ( REPLACE " $ { version_name } " " " version_value $ { version } ) <nl> foreach ( binding $ { bindings } ) <nl> # auto - generate header files for backwards compatibility to xbmc with deprecation warning <nl> # but only do it if the file doesn ' t already exist <nl> get_filename_component ( headerfile $ { header } NAME ) <nl> - if ( NOT EXISTS " $ { XBMC_INCLUDE_DIR } / $ { headerfile } " ) <nl> + if ( NOT EXISTS " $ { XBMC_INCLUDE_DIR } / $ { headerfile } " ) <nl> file ( WRITE $ { XBMC_INCLUDE_DIR } / $ { headerfile } <nl> " # pragma once <nl> # define DEPRECATION_WARNING \ " Including xbmc / $ { headerfile } has been deprecated , please use kodi / $ { headerfile } \ " <nl> mmm a / project / cmake / scripts / linux / Install . cmake <nl> ppp b / project / cmake / scripts / linux / Install . cmake <nl> if ( ENABLE_X11 AND XRANDR_FOUND ) <nl> endif ( ) <nl> <nl> if ( NOT EXISTS $ { libdir } / xbmc ) <nl> - install ( CODE " execute_process ( COMMAND ln - sf $ { APP_NAME_LC } / xbmc WORKING_DIRECTORY $ { libdir } ) " ) <nl> + install ( CODE " execute_process ( COMMAND ln - sf $ { APP_NAME_LC } / xbmc WORKING_DIRECTORY $ { libdir } ) " ) <nl> endif ( ) <nl> install ( FILES $ { addon_bindings } DESTINATION $ { includedir } / $ { APP_NAME_LC } ) <nl> if ( NOT EXISTS $ { includedir } / xbmc ) <nl> - install ( CODE " execute_process ( COMMAND ln - sf $ { APP_NAME_LC } / xbmc WORKING_DIRECTORY $ { includedir } ) " ) <nl> + install ( CODE " execute_process ( COMMAND ln - sf $ { APP_NAME_LC } / xbmc WORKING_DIRECTORY $ { includedir } ) " ) <nl> endif ( ) <nl> <nl> install ( PROGRAMS $ { CMAKE_BINARY_DIR } / $ { CORE_BUILD_DIR } / scripts / $ { APP_NAME_LC } <nl> $ { CMAKE_BINARY_DIR } / $ { CORE_BUILD_DIR } / scripts / $ { APP_NAME_LC } - standalone <nl> DESTINATION $ { bindir } ) <nl> - install ( CODE " execute_process ( COMMAND ln - sf $ { APP_NAME_LC } xbmc WORKING_DIRECTORY $ { bindir } ) " ) <nl> - install ( CODE " execute_process ( COMMAND ln - sf $ { APP_NAME_LC } - standalone xbmc - standalone WORKING_DIRECTORY $ { bindir } ) " ) <nl> + install ( CODE " execute_process ( COMMAND ln - sf $ { APP_NAME_LC } xbmc WORKING_DIRECTORY $ { bindir } ) " ) <nl> + install ( CODE " execute_process ( COMMAND ln - sf $ { APP_NAME_LC } - standalone xbmc - standalone WORKING_DIRECTORY $ { bindir } ) " ) <nl> <nl> configure_file ( $ { CORE_SOURCE_DIR } / tools / Linux / kodi - xsession . desktop . in <nl> $ { CORE_BUILD_DIR } / $ { APP_NAME_LC } . desktop ) <nl> install ( FILES $ { CMAKE_BINARY_DIR } / $ { CORE_BUILD_DIR } / $ { APP_NAME_LC } . desktop <nl> DESTINATION $ { datarootdir } / xsessions ) <nl> - install ( CODE " execute_process ( COMMAND ln - sf $ { APP_NAME_LC } . desktop xbmc . desktop WORKING_DIRECTORY $ { datarootdir } / xsessions / ) " ) <nl> + install ( CODE " execute_process ( COMMAND ln - sf $ { APP_NAME_LC } . desktop xbmc . desktop WORKING_DIRECTORY $ { datarootdir } / xsessions / ) " ) <nl> <nl> if ( NOT EXISTS $ { datarootdir } / xbmc ) <nl> - install ( CODE " execute_process ( COMMAND ln - sf $ { APP_NAME_LC } / xbmc WORKING_DIRECTORY $ { datarootdir } ) " ) <nl> + install ( CODE " execute_process ( COMMAND ln - sf $ { APP_NAME_LC } / xbmc WORKING_DIRECTORY $ { datarootdir } ) " ) <nl> endif ( ) <nl> <nl> install ( FILES $ { CORE_SOURCE_DIR } / copying . txt <nl> | [ cmake ] Cosmetics : change project / cmake / scripts / * commands to lowercase | xbmc/xbmc | 6da0eadaf0fbcc428486861daf59b68dd1234a43 | 2016-06-01T08:39:15Z |
mmm a / BUCK <nl> ppp b / BUCK <nl> cxx_library ( <nl> soname = ' libyogacore . $ ( ext ) ' , <nl> srcs = glob ( [ ' yoga / * . c ' ] ) , <nl> tests = [ ' : YogaTests ' ] , <nl> - fbobjc_macosx_tests_override = [ ] , <nl> exported_headers = subdir_glob ( [ ( ' ' , ' yoga / * . h ' ) ] ) , <nl> header_namespace = ' ' , <nl> compiler_flags = COMPILER_FLAGS , <nl> | Fix BUCK | facebook/yoga | abad796c44e4ef3c4dc9499df8ac9f6d1e838498 | 2016-12-23T19:24:37Z |
mmm a / android / sdk / src / main / java / com / taobao / weex / WXSDKEngine . java <nl> ppp b / android / sdk / src / main / java / com / taobao / weex / WXSDKEngine . java <nl> public static boolean registerComponent ( Class < ? extends WXComponent > clazz , bool <nl> * { @ link WXModuleManager # registerModule ( String , ModuleFactory , boolean ) } <nl> * / <nl> public static < T extends WXModule > boolean registerModule ( String moduleName , Class < T > moduleClass , boolean global ) throws WXException { <nl> - return registerModule ( moduleName , new TypeModuleFactory ( moduleClass ) , global ) ; <nl> + return moduleClass ! = null & & registerModule ( moduleName , new TypeModuleFactory < > ( moduleClass ) , global ) ; <nl> } <nl> <nl> / * * <nl> | * [ android ] stop register when class is null | apache/incubator-weex | 77148e8f5065d1333875329f0d6c545578def19c | 2016-07-27T09:31:04Z |
mmm a / example / image - classification / symbol_googlenet . py <nl> ppp b / example / image - classification / symbol_googlenet . py <nl> def InceptionFactory ( data , num_1x1 , num_3x3red , num_3x3 , num_d5x5red , num_d5x5 , <nl> c3x3 = ConvFactory ( data = c3x3r , num_filter = num_3x3 , kernel = ( 3 , 3 ) , pad = ( 1 , 1 ) , name = ( ' % s_3x3 ' % name ) ) <nl> # double 3x3 reduce + double 3x3 <nl> cd5x5r = ConvFactory ( data = data , num_filter = num_d5x5red , kernel = ( 1 , 1 ) , name = ( ' % s_5x5 ' % name ) , suffix = ' _reduce ' ) <nl> - cd5x5 = ConvFactory ( data = cd5x5r , num_filter = num_d5x5 , kernel = ( 3 , 3 ) , pad = ( 1 , 1 ) , name = ( ' % s_5x5 ' % name ) ) <nl> + cd5x5 = ConvFactory ( data = cd5x5r , num_filter = num_d5x5 , kernel = ( 5 , 5 ) , pad = ( 2 , 2 ) , name = ( ' % s_5x5 ' % name ) ) <nl> # pool + proj <nl> pooling = mx . symbol . Pooling ( data = data , kernel = ( 3 , 3 ) , stride = ( 1 , 1 ) , pad = ( 1 , 1 ) , pool_type = pool , name = ( ' % s_pool_ % s_pool ' % ( pool , name ) ) ) <nl> cproj = ConvFactory ( data = pooling , num_filter = proj , kernel = ( 1 , 1 ) , name = ( ' % s_proj ' % name ) ) <nl> | [ example ] fix googlenet | apache/incubator-mxnet | c551ff47ce783a4810fd7e954f89226889e5e033 | 2015-11-22T20:22:57Z |
mmm a / doc / build . md <nl> ppp b / doc / build . md <nl> even better to send pull request if you can fix the problem . <nl> # # Build the Shared Library <nl> <nl> Our goal is to build the shared library : <nl> - - On Linux / OSX the target library is ` ` ` libxgboost . so ` ` ` <nl> - - On Windows the target library is ` ` ` libxgboost . dll ` ` ` <nl> + - On Linux / OSX the target library is ` libxgboost . so ` <nl> + - On Windows the target library is ` libxgboost . dll ` <nl> <nl> The minimal building requirement is <nl> <nl> | Fix ( ) | dmlc/xgboost | d85e287b99b5fa887211adecc22d6dff20d91926 | 2016-08-18T18:57:13Z |
mmm a / modules / planning / optimizer / st_graph / st_boundary_mapper . cc <nl> ppp b / modules / planning / optimizer / st_graph / st_boundary_mapper . cc <nl> Status StBoundaryMapper : : MapObstacleWithoutDecision ( <nl> if ( ! GetOverlapBoundaryPoints ( path_data_ . discretized_path ( ) . path_points ( ) , <nl> * ( path_obstacle . Obstacle ( ) ) , & upper_points , <nl> & lower_points ) ) { <nl> - return Status ( ErrorCode : : PLANNING_ERROR , " PLANNING_ERROR " ) ; <nl> + return Status ( ErrorCode : : PLANNING_SKIP , " PLANNING_SKIP " ) ; <nl> } <nl> <nl> if ( lower_points . size ( ) > 0 & & upper_points . size ( ) > 0 ) { <nl> | Planning : do not return error when no mapping of obstacles . | ApolloAuto/apollo | fe24508c245d181bda49349ae5e2f3f883f77e3a | 2017-08-11T22:55:51Z |
mmm a / drivers / javascript / ast . coffee <nl> ppp b / drivers / javascript / ast . coffee <nl> class Func extends RDBOp <nl> return super ( optargs , argsArr , body ) <nl> <nl> compose : ( args ) - > <nl> - if hasImplicit ( args [ 1 ] ) <nl> + if hasImplicit ( args [ 1 ] ) is true <nl> [ args [ 1 ] ] <nl> else <nl> [ ' function ( ' , ( Var : : compose ( arg ) for arg in args [ 0 ] [ 1 . . . - 1 ] ) , ' ) { return ' , args [ 1 ] , ' ; } ' ] <nl> | Check if hasImplicit returns true and not if it coerce to true ( style ) | rethinkdb/rethinkdb | 4773c15b2fc6c7b5994e634779f68cd9ca5221d7 | 2014-01-22T23:02:42Z |
mmm a / tensorflow / core / util / event . proto <nl> ppp b / tensorflow / core / util / event . proto <nl> message Event { <nl> message LogMessage { <nl> enum Level { <nl> UNKNOWN = 0 ; <nl> - DEBUG = 10 ; <nl> + / / Note : The logging level 10 cannot be named DEBUG . Some software <nl> + / / projects compile their C / C + + code with - DDEBUG in debug builds . So the <nl> + / / C + + code generated from this file should not have an identifier named <nl> + / / DEBUG . <nl> + DEBUGGING = 10 ; <nl> INFO = 20 ; <nl> WARN = 30 ; <nl> ERROR = 40 ; <nl> mmm a / tensorflow / python / training / tensorboard_logging . py <nl> ppp b / tensorflow / python / training / tensorboard_logging . py <nl> <nl> # Map from the tensorboard_logging logging enum values to the proto ' s enum <nl> # values . <nl> _LEVEL_PROTO_MAP = { <nl> - DEBUG : event_pb2 . LogMessage . DEBUG , <nl> + DEBUG : event_pb2 . LogMessage . DEBUGGING , <nl> INFO : event_pb2 . LogMessage . INFO , <nl> WARN : event_pb2 . LogMessage . WARN , <nl> ERROR : event_pb2 . LogMessage . ERROR , <nl> mmm a / tensorflow / python / training / tensorboard_logging_test . py <nl> ppp b / tensorflow / python / training / tensorboard_logging_test . py <nl> def testVerbosity ( self ) : <nl> tensorboard_logging . debug ( " debug " ) <nl> <nl> self . assertLoggedMessagesAre ( [ ( event_pb2 . LogMessage . ERROR , " error " ) , <nl> - ( event_pb2 . LogMessage . DEBUG , " debug " ) ] ) <nl> + ( event_pb2 . LogMessage . DEBUGGING , " debug " ) ] ) <nl> # All message should be logged because tensorboard_logging verbosity doesn ' t <nl> # affect logging verbosity . <nl> self . assertEqual ( 3 , self . logged_message_count ) <nl> | Rename the DEBUG logging level to DEBUGGING . | tensorflow/tensorflow | 3db4be73d69569bc4a343e6a35adf4c98979f535 | 2017-02-07T23:28:41Z |
mmm a / include / swift / FrontendTool / FrontendTool . h <nl> ppp b / include / swift / FrontendTool / FrontendTool . h <nl> class FrontendObserver { <nl> virtual void configuredCompiler ( CompilerInstance & instance ) ; <nl> } ; <nl> <nl> + namespace frontend { <nl> + namespace utils { <nl> + StringRef escapeForMake ( StringRef raw , llvm : : SmallVectorImpl < char > & buffer ) ; <nl> + } <nl> + } <nl> + <nl> / / / Perform all the operations of the frontend , exactly as if invoked <nl> / / / with - frontend . <nl> / / / <nl> mmm a / lib / FrontendTool / FrontendTool . cpp <nl> ppp b / lib / FrontendTool / FrontendTool . cpp <nl> static std : : string displayName ( StringRef MainExecutablePath ) { <nl> return Name ; <nl> } <nl> <nl> + StringRef <nl> + swift : : frontend : : utils : : escapeForMake ( StringRef raw , <nl> + llvm : : SmallVectorImpl < char > & buffer ) { <nl> + buffer . clear ( ) ; <nl> + <nl> + / / The escaping rules for GNU make are complicated due to the various <nl> + / / subsitutions and use of the tab in the leading position for recipes . <nl> + / / Various symbols have significance in different contexts . It is not <nl> + / / possible to correctly quote all characters in Make ( as of 3 . 7 ) . Match <nl> + / / gcc and clang ' s behaviour for the escaping which covers only a subset of <nl> + / / characters . <nl> + for ( unsigned I = 0 , E = raw . size ( ) ; I ! = E ; + + I ) { <nl> + switch ( raw [ I ] ) { <nl> + case ' # ' : / / Handle ' # ' the broken GCC way <nl> + buffer . push_back ( ' \ \ ' ) ; <nl> + break ; <nl> + <nl> + case ' ' : <nl> + for ( unsigned J = I ; J & & raw [ J - 1 ] = = ' \ \ ' ; - - J ) <nl> + buffer . push_back ( ' \ \ ' ) ; <nl> + buffer . push_back ( ' \ \ ' ) ; <nl> + break ; <nl> + <nl> + case ' $ ' : / / $ is escaped by $ <nl> + buffer . push_back ( ' $ ' ) ; <nl> + break ; <nl> + } <nl> + buffer . push_back ( raw [ I ] ) ; <nl> + } <nl> + buffer . push_back ( ' \ 0 ' ) ; <nl> + <nl> + return buffer . data ( ) ; <nl> + } <nl> + <nl> / / / Emits a Make - style dependencies file . <nl> static bool emitMakeDependenciesIfNeeded ( DiagnosticEngine & diags , <nl> DependencyTracker * depTracker , <nl> static bool emitMakeDependenciesIfNeeded ( DiagnosticEngine & diags , <nl> return true ; <nl> } <nl> <nl> - / / Declare a helper for escaping file names for use in Makefiles . <nl> - llvm : : SmallString < 256 > pathBuf ; <nl> - auto escape = [ & ] ( StringRef raw ) - > StringRef { <nl> - pathBuf . clear ( ) ; <nl> - <nl> - static const char badChars [ ] = " $ # : \ n " ; <nl> - size_t prev = 0 ; <nl> - for ( auto index = raw . find_first_of ( badChars ) ; index ! = StringRef : : npos ; <nl> - index = raw . find_first_of ( badChars , index + 1 ) ) { <nl> - pathBuf . append ( raw . slice ( prev , index ) ) ; <nl> - if ( raw [ index ] = = ' $ ' ) <nl> - pathBuf . push_back ( ' $ ' ) ; <nl> - else <nl> - pathBuf . push_back ( ' \ \ ' ) ; <nl> - prev = index ; <nl> - } <nl> - pathBuf . append ( raw . substr ( prev ) ) ; <nl> - return pathBuf ; <nl> - } ; <nl> + llvm : : SmallString < 256 > buffer ; <nl> <nl> / / FIXME : Xcode can ' t currently handle multiple targets in a single <nl> / / dependency line . <nl> opts . forAllOutputPaths ( input , [ & ] ( const StringRef targetName ) { <nl> - out < < escape ( targetName ) < < " : " ; <nl> + out < < swift : : frontend : : utils : : escapeForMake ( targetName , buffer ) < < " : " ; <nl> / / First include all other files in the module . Make - style dependencies <nl> / / need to be conservative ! <nl> for ( auto const & path : <nl> reversePathSortedFilenames ( opts . InputsAndOutputs . getInputFilenames ( ) ) ) <nl> - out < < ' ' < < escape ( path ) ; <nl> + out < < ' ' < < swift : : frontend : : utils : : escapeForMake ( path , buffer ) ; <nl> / / Then print dependencies we ' ve picked up during compilation . <nl> for ( auto const & path : <nl> reversePathSortedFilenames ( depTracker - > getDependencies ( ) ) ) <nl> - out < < ' ' < < escape ( path ) ; <nl> + out < < ' ' < < swift : : frontend : : utils : : escapeForMake ( path , buffer ) ; <nl> out < < ' \ n ' ; <nl> } ) ; <nl> <nl> mmm a / unittests / CMakeLists . txt <nl> ppp b / unittests / CMakeLists . txt <nl> if ( SWIFT_INCLUDE_TOOLS ) <nl> add_subdirectory ( AST ) <nl> add_subdirectory ( Basic ) <nl> add_subdirectory ( Driver ) <nl> + add_subdirectory ( FrontendTool ) <nl> add_subdirectory ( IDE ) <nl> add_subdirectory ( Parse ) <nl> add_subdirectory ( SwiftDemangle ) <nl> new file mode 100644 <nl> index 000000000000 . . a5abc9d3ceb7 <nl> mmm / dev / null <nl> ppp b / unittests / FrontendTool / CMakeLists . txt <nl> <nl> + add_swift_unittest ( SwiftFrontendTests <nl> + FrontendToolTests . cpp ) <nl> + target_link_libraries ( SwiftFrontendTests PRIVATE swiftFrontendTool ) <nl> new file mode 100644 <nl> index 000000000000 . . 15d2be60839b <nl> mmm / dev / null <nl> ppp b / unittests / FrontendTool / FrontendToolTests . cpp <nl> <nl> + / / = = = mmm FrontendTests . cpp mmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmm = = = / / <nl> + / / <nl> + / / This source file is part of the Swift . org open source project <nl> + / / <nl> + / / Copyright ( c ) 2014 - 2017 Apple Inc . and the Swift project authors <nl> + / / Licensed under Apache License v2 . 0 with Runtime Library Exception <nl> + / / <nl> + / / See https : / / swift . org / LICENSE . txt for license information <nl> + / / See https : / / swift . org / CONTRIBUTORS . txt for the list of Swift project authors <nl> + / / <nl> + / / = = = mmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmm - = = = / / <nl> + <nl> + # include " gtest / gtest . h " <nl> + # include " swift / FrontendTool / FrontendTool . h " <nl> + # include " llvm / ADT / SmallString . h " <nl> + <nl> + using namespace swift ; <nl> + <nl> + namespace { <nl> + <nl> + TEST ( FrontendTests , MakefileQuotingTest ) { <nl> + using namespace frontend : : utils ; <nl> + <nl> + llvm : : SmallString < 256 > buffer ; <nl> + EXPECT_EQ ( escapeForMake ( " S : \ \ b \ \ llvm " , buffer ) , " S : \ \ b \ \ llvm " ) ; <nl> + EXPECT_EQ ( escapeForMake ( " S : \ \ b \ \ swift \ \ $ sBoWV " , buffer ) , <nl> + " S : \ \ b \ \ swift \ \ $ $ sBoWV " ) ; <nl> + EXPECT_EQ ( escapeForMake ( " S : \ \ b \ \ swift \ \ # hashtag " , buffer ) , <nl> + " S : \ \ b \ \ swift \ \ \ \ # hashtag " ) ; <nl> + <nl> + } <nl> + <nl> + } / / end anonymous namespace <nl> + <nl> | Merge pull request from compnerd / planning - an - escape | apple/swift | 26188cce832f1f04c6daf57e7ef6700a2ca075b1 | 2019-02-19T23:06:02Z |
mmm a / src / wasm / baseline / mips / liftoff - assembler - mips . h <nl> ppp b / src / wasm / baseline / mips / liftoff - assembler - mips . h <nl> void LiftoffAssembler : : emit_i32x4_mul ( LiftoffRegister dst , LiftoffRegister lhs , <nl> bailout ( kSimd , " emit_i32x4_mul " ) ; <nl> } <nl> <nl> + void LiftoffAssembler : : emit_i32x4_min_s ( LiftoffRegister dst , <nl> + LiftoffRegister lhs , <nl> + LiftoffRegister rhs ) { <nl> + / / TODO ( mips ) : Support this on loongson 3a4000 . Currently , the main MIPS <nl> + / / CPU , Loongson 3a3000 does not support MSA ( simd128 ) , but the upcoming <nl> + / / 3a4000 support MSA . <nl> + bailout ( kSimd , " emit_i32x4_min_s " ) ; <nl> + } <nl> + <nl> + void LiftoffAssembler : : emit_i32x4_min_u ( LiftoffRegister dst , <nl> + LiftoffRegister lhs , <nl> + LiftoffRegister rhs ) { <nl> + / / TODO ( mips ) : Support this on loongson 3a4000 . Currently , the main MIPS <nl> + / / CPU , Loongson 3a3000 does not support MSA ( simd128 ) , but the upcoming <nl> + / / 3a4000 support MSA . <nl> + bailout ( kSimd , " emit_i32x4_min_u " ) ; <nl> + } <nl> + <nl> void LiftoffAssembler : : emit_i16x8_splat ( LiftoffRegister dst , <nl> LiftoffRegister src ) { <nl> / / TODO ( mips ) : Support this on loongson 3a4000 . Currently , the main MIPS <nl> void LiftoffAssembler : : emit_i16x8_add_saturate_u ( LiftoffRegister dst , <nl> bailout ( kSimd , " emit_i16x8_add_saturate_u " ) ; <nl> } <nl> <nl> + void LiftoffAssembler : : emit_i16x8_min_s ( LiftoffRegister dst , <nl> + LiftoffRegister lhs , <nl> + LiftoffRegister rhs ) { <nl> + / / TODO ( mips ) : Support this on loongson 3a4000 . Currently , the main MIPS <nl> + / / CPU , Loongson 3a3000 does not support MSA ( simd128 ) , but the upcoming <nl> + / / 3a4000 support MSA . <nl> + bailout ( kSimd , " emit_i16x8_min_s " ) ; <nl> + } <nl> + <nl> + void LiftoffAssembler : : emit_i16x8_min_u ( LiftoffRegister dst , <nl> + LiftoffRegister lhs , <nl> + LiftoffRegister rhs ) { <nl> + / / TODO ( mips ) : Support this on loongson 3a4000 . Currently , the main MIPS <nl> + / / CPU , Loongson 3a3000 does not support MSA ( simd128 ) , but the upcoming <nl> + / / 3a4000 support MSA . <nl> + bailout ( kSimd , " emit_i16x8_min_u " ) ; <nl> + } <nl> + <nl> void LiftoffAssembler : : emit_i8x16_splat ( LiftoffRegister dst , <nl> LiftoffRegister src ) { <nl> / / TODO ( mips ) : Support this on loongson 3a4000 . Currently , the main MIPS <nl> void LiftoffAssembler : : emit_i8x16_add_saturate_u ( LiftoffRegister dst , <nl> bailout ( kSimd , " emit_i8x16_add_saturate_u " ) ; <nl> } <nl> <nl> + void LiftoffAssembler : : emit_i8x16_min_s ( LiftoffRegister dst , <nl> + LiftoffRegister lhs , <nl> + LiftoffRegister rhs ) { <nl> + / / TODO ( mips ) : Support this on loongson 3a4000 . Currently , the main MIPS <nl> + / / CPU , Loongson 3a3000 does not support MSA ( simd128 ) , but the upcoming <nl> + / / 3a4000 support MSA . <nl> + bailout ( kSimd , " emit_i8x16_min_s " ) ; <nl> + } <nl> + <nl> + void LiftoffAssembler : : emit_i8x16_min_u ( LiftoffRegister dst , <nl> + LiftoffRegister lhs , <nl> + LiftoffRegister rhs ) { <nl> + / / TODO ( mips ) : Support this on loongson 3a4000 . Currently , the main MIPS <nl> + / / CPU , Loongson 3a3000 does not support MSA ( simd128 ) , but the upcoming <nl> + / / 3a4000 support MSA . <nl> + bailout ( kSimd , " emit_i8x16_min_u " ) ; <nl> + } <nl> + <nl> void LiftoffAssembler : : StackCheck ( Label * ool_code , Register limit_address ) { <nl> TurboAssembler : : Ulw ( limit_address , MemOperand ( limit_address ) ) ; <nl> TurboAssembler : : Branch ( ool_code , ule , sp , Operand ( limit_address ) ) ; <nl> mmm a / src / wasm / baseline / mips64 / liftoff - assembler - mips64 . h <nl> ppp b / src / wasm / baseline / mips64 / liftoff - assembler - mips64 . h <nl> void LiftoffAssembler : : emit_i32x4_mul ( LiftoffRegister dst , LiftoffRegister lhs , <nl> bailout ( kSimd , " emit_i32x4_mul " ) ; <nl> } <nl> <nl> + void LiftoffAssembler : : emit_i32x4_min_s ( LiftoffRegister dst , <nl> + LiftoffRegister lhs , <nl> + LiftoffRegister rhs ) { <nl> + / / TODO ( mips ) : Support this on loongson 3a4000 . Currently , the main MIPS <nl> + / / CPU , Loongson 3a3000 does not support MSA ( simd128 ) , but the upcoming <nl> + / / 3a4000 support MSA . <nl> + bailout ( kSimd , " emit_i32x4_min_s " ) ; <nl> + } <nl> + <nl> + void LiftoffAssembler : : emit_i32x4_min_u ( LiftoffRegister dst , <nl> + LiftoffRegister lhs , <nl> + LiftoffRegister rhs ) { <nl> + / / TODO ( mips ) : Support this on loongson 3a4000 . Currently , the main MIPS <nl> + / / CPU , Loongson 3a3000 does not support MSA ( simd128 ) , but the upcoming <nl> + / / 3a4000 support MSA . <nl> + bailout ( kSimd , " emit_i32x4_min_u " ) ; <nl> + } <nl> + <nl> void LiftoffAssembler : : emit_i16x8_splat ( LiftoffRegister dst , <nl> LiftoffRegister src ) { <nl> / / TODO ( mips ) : Support this on loongson 3a4000 . Currently , the main MIPS <nl> void LiftoffAssembler : : emit_i16x8_add_saturate_u ( LiftoffRegister dst , <nl> bailout ( kSimd , " emit_i16x8_add_saturate_u " ) ; <nl> } <nl> <nl> + void LiftoffAssembler : : emit_i16x8_min_s ( LiftoffRegister dst , <nl> + LiftoffRegister lhs , <nl> + LiftoffRegister rhs ) { <nl> + / / TODO ( mips ) : Support this on loongson 3a4000 . Currently , the main MIPS <nl> + / / CPU , Loongson 3a3000 does not support MSA ( simd128 ) , but the upcoming <nl> + / / 3a4000 support MSA . <nl> + bailout ( kSimd , " emit_i16x8_min_s " ) ; <nl> + } <nl> + <nl> + void LiftoffAssembler : : emit_i16x8_min_u ( LiftoffRegister dst , <nl> + LiftoffRegister lhs , <nl> + LiftoffRegister rhs ) { <nl> + / / TODO ( mips ) : Support this on loongson 3a4000 . Currently , the main MIPS <nl> + / / CPU , Loongson 3a3000 does not support MSA ( simd128 ) , but the upcoming <nl> + / / 3a4000 support MSA . <nl> + bailout ( kSimd , " emit_i16x8_min_u " ) ; <nl> + } <nl> + <nl> void LiftoffAssembler : : emit_i8x16_splat ( LiftoffRegister dst , <nl> LiftoffRegister src ) { <nl> / / TODO ( mips ) : Support this on loongson 3a4000 . Currently , the main MIPS <nl> void LiftoffAssembler : : emit_i8x16_add_saturate_u ( LiftoffRegister dst , <nl> bailout ( kSimd , " emit_i8x16_add_saturate_u " ) ; <nl> } <nl> <nl> + void LiftoffAssembler : : emit_i8x16_min_s ( LiftoffRegister dst , <nl> + LiftoffRegister lhs , <nl> + LiftoffRegister rhs ) { <nl> + / / TODO ( mips ) : Support this on loongson 3a4000 . Currently , the main MIPS <nl> + / / CPU , Loongson 3a3000 does not support MSA ( simd128 ) , but the upcoming <nl> + / / 3a4000 support MSA . <nl> + bailout ( kSimd , " emit_i8x16_min_s " ) ; <nl> + } <nl> + <nl> + void LiftoffAssembler : : emit_i8x16_min_u ( LiftoffRegister dst , <nl> + LiftoffRegister lhs , <nl> + LiftoffRegister rhs ) { <nl> + / / TODO ( mips ) : Support this on loongson 3a4000 . Currently , the main MIPS <nl> + / / CPU , Loongson 3a3000 does not support MSA ( simd128 ) , but the upcoming <nl> + / / 3a4000 support MSA . <nl> + bailout ( kSimd , " emit_i8x16_min_u " ) ; <nl> + } <nl> + <nl> void LiftoffAssembler : : StackCheck ( Label * ool_code , Register limit_address ) { <nl> TurboAssembler : : Uld ( limit_address , MemOperand ( limit_address ) ) ; <nl> TurboAssembler : : Branch ( ool_code , ule , sp , Operand ( limit_address ) ) ; <nl> | [ mips ] [ wasm - simd ] [ liftoff ] Implement min of i8x16 , i16x8 , i32x4 | v8/v8 | 1bb1d634e1977dd9996c95eb10049f891fe8209e | 2020-04-03T10:51:14Z |
mmm a / dbms / src / DataStreams / FilterBlockInputStream . cpp <nl> ppp b / dbms / src / DataStreams / FilterBlockInputStream . cpp <nl> Block FilterBlockInputStream : : readImpl ( ) <nl> const Block & sample_block = expression - > getSampleBlock ( ) ; <nl> <nl> / / / ΠΠ°ΠΉΠ΄ΡΠΌ Π½Π°ΡΡΠΎΡΡΡΡ ΠΏΠΎΠ·ΠΈΡΠΈΡ ΡΡΠΎΠ»Π±ΡΠ° Ρ ΡΠΈΠ»ΡΡΡΠΎΠΌ Π² Π±Π»ΠΎΠΊΠ΅ . <nl> - if ( filter_column = = - 1 ) <nl> - filter_column = sample_block . getPositionByName ( filter_column_name ) ; <nl> + / * * sample_block ΠΈΠΌΠ΅Π΅Ρ ΡΡΡΡΠΊΡΡΡΡ ΡΠ΅Π·ΡΠ»ΡΡΠ°ΡΠ° Π²ΡΡΠΈΡΠ»Π΅Π½ΠΈΡ Π²ΡΡΠ°ΠΆΠ΅Π½ΠΈΡ . <nl> + * ΠΠΎ ΡΡΠ° ΡΡΡΡΠΊΡΡΡΠ° Π½Π΅ ΠΎΠ±ΡΠ·Π°ΡΠ΅Π»ΡΠ½ΠΎ ΡΠΎΠ²ΠΏΠ°Π΄Π°Π΅Ρ Ρ expression - > execute ( res ) Π½ΠΈΠΆΠ΅ , <nl> + * ΠΏΠΎΡΠΎΠΌΡ ΡΡΠΎ Π²ΡΡΠ°ΠΆΠ΅Π½ΠΈΠ΅ ΠΌΠΎΠΆΠ΅Ρ ΠΏΡΠΈΠΌΠ΅Π½ΡΡΡΡΡ ΠΊ Π±Π»ΠΎΠΊΡ , ΠΊΠΎΡΠΎΡΡΠΉ ΡΠ°ΠΊΠΆΠ΅ ΡΠΎΠ΄Π΅ΡΠΆΠΈΡ Π΄ΠΎΠΏΠΎΠ»Π½ΠΈΡΠ΅Π»ΡΠ½ΡΠ΅ , <nl> + * Π½Π΅Π½ΡΠΆΠ½ΡΠ΅ Π΄Π»Ρ Π΄Π°Π½Π½ΠΎΠ³ΠΎ Π²ΡΡΠ°ΠΆΠ΅Π½ΠΈΡ ΡΡΠΎΠ»Π±ΡΡ , Π½ΠΎ Π½ΡΠΆΠ½ΡΠ΅ ΠΏΠΎΠ·ΠΆΠ΅ , Π² ΡΠ»Π΅Π΄ΡΡΡΠΈΡ
ΡΡΠ°Π΄ΠΈΡΡ
ΠΊΠΎΠ½Π²Π΅ΠΉΠ΅ΡΠ° Π²ΡΠΏΠΎΠ»Π½Π΅Π½ΠΈΡ Π·Π°ΠΏΡΠΎΡΠ° . <nl> + * Π’Π°ΠΊΠΈΡ
ΡΡΠΎΠ»Π±ΡΠΎΠ² Π² sample_block Π½Π΅ Π±ΡΠ΄Π΅Ρ . <nl> + * ΠΠΎΡΡΠΎΠΌΡ , ΠΏΠΎΠ·ΠΈΡΠΈΡ ΡΡΠΎΠ»Π±ΡΠ° - ΡΠΈΠ»ΡΡΡΠ° Π² Π½ΡΠΌ ΠΌΠΎΠΆΠ΅Ρ Π±ΡΡΡ Π΄ΡΡΠ³ΠΎΠΉ . <nl> + * / <nl> + ssize_t filter_column_in_sample_block = filter_column ; <nl> + if ( filter_column_in_sample_block = = - 1 ) <nl> + filter_column_in_sample_block = sample_block . getPositionByName ( filter_column_name ) ; <nl> <nl> / / / ΠΡΠΎΠ²Π΅ΡΠΈΠΌ , Π½Π΅ ΡΠ²Π»ΡΠ΅ΡΡΡ Π»ΠΈ ΡΡΠΎΠ»Π±Π΅Ρ Ρ ΡΠΈΠ»ΡΡΡΠΎΠΌ ΠΊΠΎΠ½ΡΡΠ°Π½ΡΠΎΠΉ , ΡΠΎΠ΄Π΅ΡΠΆΠ°ΡΠ΅ΠΉ 0 ΠΈΠ»ΠΈ 1 . <nl> - ColumnPtr column = sample_block . getByPosition ( filter_column ) . column ; <nl> + ColumnPtr column = sample_block . getByPosition ( filter_column_in_sample_block ) . column ; <nl> <nl> if ( column ) <nl> { <nl> Block FilterBlockInputStream : : readImpl ( ) <nl> if ( filter_always_true ) <nl> return res ; <nl> <nl> + / / / ΠΠ°ΠΉΠ΄ΡΠΌ Π½Π°ΡΡΠΎΡΡΡΡ ΠΏΠΎΠ·ΠΈΡΠΈΡ ΡΡΠΎΠ»Π±ΡΠ° Ρ ΡΠΈΠ»ΡΡΡΠΎΠΌ Π² Π±Π»ΠΎΠΊΠ΅ . <nl> + if ( filter_column = = - 1 ) <nl> + filter_column = res . getPositionByName ( filter_column_name ) ; <nl> + <nl> size_t columns = res . columns ( ) ; <nl> ColumnPtr column = res . getByPosition ( filter_column ) . column ; <nl> <nl> | dbms : fixed error [ # METR - 19758 ] . | ClickHouse/ClickHouse | 5688369bb14a934bb518f6a81f9c62f6d3f9b2a2 | 2016-01-24T06:56:55Z |
mmm a / util / env_posix . cc <nl> ppp b / util / env_posix . cc <nl> class PosixEnv : public Env { <nl> } else { <nl> int fd = fileno ( f ) ; <nl> SetFD_CLOEXEC ( fd , nullptr ) ; <nl> - result - > reset ( new PosixLogger ( f , & PosixEnv : : gettid ) ) ; <nl> + result - > reset ( new PosixLogger ( f , & PosixEnv : : gettid , this ) ) ; <nl> return Status : : OK ( ) ; <nl> } <nl> } <nl> mmm a / util / posix_logger . h <nl> ppp b / util / posix_logger . h <nl> class PosixLogger : public Logger { <nl> uint64_t ( * gettid_ ) ( ) ; / / Return the thread id for the current thread <nl> std : : atomic_size_t log_size_ ; <nl> int fd_ ; <nl> + const static uint64_t flush_every_seconds_ = 5 ; <nl> + uint64_t last_flush_micros_ ; <nl> + Env * env_ ; <nl> public : <nl> - PosixLogger ( FILE * f , uint64_t ( * gettid ) ( ) ) : <nl> - file_ ( f ) , gettid_ ( gettid ) , log_size_ ( 0 ) , fd_ ( fileno ( f ) ) { } <nl> + PosixLogger ( FILE * f , uint64_t ( * gettid ) ( ) , Env * env ) : <nl> + file_ ( f ) , gettid_ ( gettid ) , log_size_ ( 0 ) , fd_ ( fileno ( f ) ) , <nl> + last_flush_micros_ ( 0 ) , env_ ( env ) { } <nl> virtual ~ PosixLogger ( ) { <nl> fclose ( file_ ) ; <nl> } <nl> class PosixLogger : public Logger { <nl> size_t sz = fwrite ( base , 1 , write_size , file_ ) ; <nl> assert ( sz = = write_size ) ; <nl> if ( sz > 0 ) { <nl> - fflush ( file_ ) ; <nl> + if ( env_ - > NowMicros ( ) - last_flush_micros_ > = <nl> + flush_every_seconds_ * 1000000 ) { <nl> + fflush ( file_ ) ; <nl> + last_flush_micros_ = env_ - > NowMicros ( ) ; <nl> + } <nl> log_size_ + = write_size ; <nl> } <nl> if ( base ! = buffer ) { <nl> | Flush Log every 5 seconds | facebook/rocksdb | b572e81f942e4305569be2d2b0a80678b87f34dd | 2013-10-31T22:36:40Z |
mmm a / ports / pdcurses / portfile . cmake <nl> ppp b / ports / pdcurses / portfile . cmake <nl> if ( NOT VCPKG_CRT_LINKAGE STREQUAL " dynamic " ) <nl> endif ( ) <nl> <nl> include ( vcpkg_common_functions ) <nl> - set ( SOURCE_PATH $ { CURRENT_BUILDTREES_DIR } / src - $ { TARGET_TRIPLET } ) <nl> find_program ( NMAKE nmake ) <nl> <nl> - vcpkg_download_distfile ( ARCHIVE <nl> - URLS " http : / / downloads . sourceforge . net / project / pdcurses / pdcurses / 3 . 4 / pdcurs34 . zip " <nl> - FILENAME " pdcurs34 . zip " <nl> - SHA512 0b916bfe37517abb80df7313608cc4e1ed7659a41ce82763000dfdfa5b8311ffd439193c74fc84a591f343147212bf1caf89e7db71f1f7e4fa70f534834cb039 <nl> + vcpkg_from_github ( <nl> + OUT_SOURCE_PATH SOURCE_PATH <nl> + REPO wmcbrine / PDCurses <nl> + REF PDCurses_3_4 <nl> + SHA512 a05065c2e43771bf769f25f229b6058c4dc6add65d993f2e304e98bded8a8af88e674638c7385383451fddc45cf3bd8c9a95febffc7abcbcce0e6384e4f397b3 <nl> + HEAD_REF master <nl> ) <nl> <nl> - if ( EXISTS $ { CURRENT_BUILDTREES_DIR } / src ) <nl> - file ( REMOVE_RECURSE $ { CURRENT_BUILDTREES_DIR } / src ) <nl> - endif ( ) <nl> + file ( REMOVE_RECURSE <nl> + $ { CURRENT_BUILDTREES_DIR } / $ { TARGET_TRIPLET } <nl> + ) <nl> + <nl> + file ( GLOB SOURCES $ { SOURCE_PATH } / * ) <nl> + <nl> + file ( COPY $ { SOURCES } DESTINATION $ { CURRENT_BUILDTREES_DIR } / $ { TARGET_TRIPLET } ) <nl> <nl> - vcpkg_extract_source_archive ( $ { ARCHIVE } $ { SOURCE_PATH } ) <nl> + set ( SOURCE_PATH " $ { CURRENT_BUILDTREES_DIR } / $ { TARGET_TRIPLET } " ) <nl> <nl> file ( READ $ { SOURCE_PATH } / win32 / vcwin32 . mak PDC_MAK_ORIG ) <nl> string ( REPLACE " - pdb : none " " " PDC_MAK_ORIG $ { PDC_MAK_ORIG } ) <nl> | [ pdcurses ] Use out - of - source builds . Use official github . Fixes . | microsoft/vcpkg | 67573ccf2c18704137071b1309ff3b0f7231a547 | 2018-03-22T08:51:09Z |
new file mode 100755 <nl> index 00000000000 . . 25c6bef4216 <nl> mmm / dev / null <nl> ppp b / tools / fuzz - harness . sh <nl> <nl> + # ! / bin / bash <nl> + # Copyright 2012 the V8 project authors . All rights reserved . <nl> + # Redistribution and use in source and binary forms , with or without <nl> + # modification , are permitted provided that the following conditions are <nl> + # met : <nl> + # <nl> + # * Redistributions of source code must retain the above copyright <nl> + # notice , this list of conditions and the following disclaimer . <nl> + # * Redistributions in binary form must reproduce the above <nl> + # copyright notice , this list of conditions and the following <nl> + # disclaimer in the documentation and / or other materials provided <nl> + # with the distribution . <nl> + # * Neither the name of Google Inc . nor the names of its <nl> + # contributors may be used to endorse or promote products derived <nl> + # from this software without specific prior written permission . <nl> + # <nl> + # THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS <nl> + # " AS IS " AND ANY EXPRESS OR IMPLIED WARRANTIES , INCLUDING , BUT NOT <nl> + # LIMITED TO , THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR <nl> + # A PARTICULAR PURPOSE ARE DISCLAIMED . IN NO EVENT SHALL THE COPYRIGHT <nl> + # OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT , INDIRECT , INCIDENTAL , <nl> + # SPECIAL , EXEMPLARY , OR CONSEQUENTIAL DAMAGES ( INCLUDING , BUT NOT <nl> + # LIMITED TO , PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES ; LOSS OF USE , <nl> + # DATA , OR PROFITS ; OR BUSINESS INTERRUPTION ) HOWEVER CAUSED AND ON ANY <nl> + # THEORY OF LIABILITY , WHETHER IN CONTRACT , STRICT LIABILITY , OR TORT <nl> + # ( INCLUDING NEGLIGENCE OR OTHERWISE ) ARISING IN ANY WAY OUT OF THE USE <nl> + # OF THIS SOFTWARE , EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE . <nl> + <nl> + # A simple harness that downloads and runs ' jsfunfuzz ' against d8 . This <nl> + # takes a long time because it runs many iterations and is intended for <nl> + # automated usage . The package containing ' jsfunfuzz ' can be found as an <nl> + # attachment to this bug : <nl> + # https : / / bugzilla . mozilla . org / show_bug . cgi ? id = jsfunfuzz <nl> + <nl> + JSFUNFUZZ_URL = " https : / / bugzilla . mozilla . org / attachment . cgi ? id = 310631 " <nl> + JSFUNFUZZ_MD5 = " d0e497201c5cd7bffbb1cdc1574f4e32 " <nl> + <nl> + v8_root = $ ( readlink - f $ ( dirname $ BASH_SOURCE ) / . . / ) <nl> + <nl> + if [ - n " $ 1 " ] ; then <nl> + d8 = " $ { v8_root } / $ 1 " <nl> + else <nl> + d8 = " $ { v8_root } / d8 " <nl> + fi <nl> + <nl> + if [ ! - f " $ d8 " ] ; then <nl> + echo " Failed to find d8 binary : $ d8 " <nl> + exit 1 <nl> + fi <nl> + <nl> + jsfunfuzz_file = " $ v8_root / tools / jsfunfuzz . zip " <nl> + if [ ! - f " $ jsfunfuzz_file " ] ; then <nl> + echo " Downloading $ jsfunfuzz_file . . . " <nl> + wget - q - O " $ jsfunfuzz_file " $ JSFUNFUZZ_URL | | exit 1 <nl> + fi <nl> + <nl> + jsfunfuzz_sum = $ ( md5sum " $ jsfunfuzz_file " | awk ' { print $ 1 } ' ) <nl> + if [ $ jsfunfuzz_sum ! = $ JSFUNFUZZ_MD5 ] ; then <nl> + echo " Failed to verify checksum ! " <nl> + exit 1 <nl> + fi <nl> + <nl> + jsfunfuzz_dir = " $ v8_root / tools / jsfunfuzz " <nl> + if [ ! - d " $ jsfunfuzz_dir " ] ; then <nl> + echo " Unpacking into $ jsfunfuzz_dir . . . " <nl> + unzip " $ jsfunfuzz_file " - d " $ jsfunfuzz_dir " | | exit 1 <nl> + fi <nl> + <nl> + flags = ' - - debug - code - - expose - gc - - verify - gc ' <nl> + python - u " $ jsfunfuzz_dir / jsfunfuzz / multi_timed_run . py " 300 \ <nl> + " $ d8 " $ flags " $ jsfunfuzz_dir / jsfunfuzz / jsfunfuzz . js " <nl> + exit_code = $ ( cat w * | grep " looking good " - c ) <nl> + exit_code = $ ( ( 100 - exit_code ) ) <nl> + tar - cjf fuzz - results - $ ( date + % y % m % d ) . tar . bz2 err - * w * <nl> + rm - f err - * w * <nl> + <nl> + echo " Total failures : $ exit_code " <nl> + exit $ exit_code <nl> | Add harness script for JavaScript language fuzzer . | v8/v8 | 99d69e0f2903b2798b02313053e909b060c71675 | 2012-05-22T15:15:44Z |
mmm a / src / mongo / db / btree . cpp <nl> ppp b / src / mongo / db / btree . cpp <nl> <nl> # include " mongo / db / db . h " <nl> # include " mongo / db / dbhelpers . h " <nl> # include " mongo / db / dur_commitjob . h " <nl> + # include " mongo / db / index / btree_index_cursor . h " / / for aboutToDeleteBucket <nl> + # include " mongo / db / intervalbtreecursor . h " / / also for aboutToDeleteBucket <nl> # include " mongo / db / json . h " <nl> # include " mongo / db / kill_current_op . h " <nl> # include " mongo / db / pdfile . h " <nl> namespace mongo { <nl> <nl> template < class V > <nl> void BtreeBucket < V > : : delBucket ( const DiskLoc thisLoc , const IndexDetails & id ) { <nl> - ClientCursor : : informAboutToDeleteBucket ( thisLoc ) ; / / slow . . . <nl> + BtreeIndexCursor : : aboutToDeleteBucket ( thisLoc ) ; <nl> + IntervalBtreeCursor : : aboutToDeleteBucket ( thisLoc ) ; <nl> verify ( ! isHead ( ) ) ; <nl> <nl> DiskLoc ll = this - > parent ; <nl> namespace mongo { <nl> ll . btree < V > ( ) - > childForPos ( indexInParent ( thisLoc ) ) . writing ( ) = this - > nextChild ; <nl> } <nl> BTREE ( this - > nextChild ) - > parent . writing ( ) = this - > parent ; <nl> - ClientCursor : : informAboutToDeleteBucket ( thisLoc ) ; <nl> + BtreeIndexCursor : : aboutToDeleteBucket ( thisLoc ) ; <nl> + IntervalBtreeCursor : : aboutToDeleteBucket ( thisLoc ) ; <nl> deallocBucket ( thisLoc , id ) ; <nl> } <nl> <nl> mmm a / src / mongo / db / btreecursor . cpp <nl> ppp b / src / mongo / db / btreecursor . cpp <nl> namespace mongo { <nl> return _indexCursor - > getKeyOfs ( ) ; <nl> } <nl> <nl> - void BtreeCursor : : aboutToDeleteBucket ( const DiskLoc & b ) { <nl> - _indexCursor - > aboutToDeleteBucket ( b ) ; <nl> - } <nl> - <nl> BSONObj BtreeCursor : : currKey ( ) const { <nl> return _indexCursor - > getKey ( ) ; <nl> } <nl> mmm a / src / mongo / db / btreecursor . h <nl> ppp b / src / mongo / db / btreecursor . h <nl> namespace mongo { <nl> virtual const DiskLoc getBucket ( ) const ; <nl> / / XXX ( hk ) : geo uses this too . : ( <nl> virtual int getKeyOfs ( ) const ; <nl> - / / XXX ( hk ) : deletions go through a lengthy , scary path ( btree . cpp - > clientcursor . cpp - > <nl> - / / cursor . cpp - > btreecursor . cpp ) and this is part of it . . . for now . <nl> - virtual void aboutToDeleteBucket ( const DiskLoc & b ) ; <nl> <nl> private : <nl> BtreeCursor ( NamespaceDetails * nsd , int theIndexNo , const IndexDetails & idxDetails ) ; <nl> mmm a / src / mongo / db / clientcursor . cpp <nl> ppp b / src / mongo / db / clientcursor . cpp <nl> namespace mongo { <nl> } <nl> } <nl> <nl> - / * must call when a btree bucket going away . <nl> - note this is potentially slow <nl> - * / <nl> - void ClientCursor : : informAboutToDeleteBucket ( const DiskLoc & b ) { <nl> - recursive_scoped_lock lock ( ccmutex ) ; <nl> - Database * db = cc ( ) . database ( ) ; <nl> - CCByLoc & bl = db - > ccByLoc ( ) ; <nl> - RARELY if ( bl . size ( ) > 70 ) { <nl> - log ( ) < < " perf warning : byLoc . size = " < < bl . size ( ) < < " in aboutToDeleteBucket " < < endl ; <nl> - } <nl> - for ( CCByLoc : : iterator i = bl . begin ( ) ; i ! = bl . end ( ) ; i + + ) <nl> - i - > second - > _c - > aboutToDeleteBucket ( b ) ; <nl> - } <nl> - void aboutToDeleteBucket ( const DiskLoc & b ) { <nl> - ClientCursor : : informAboutToDeleteBucket ( b ) ; <nl> - } <nl> - <nl> / * must call this on a delete so we clean up the cursors . * / <nl> void ClientCursor : : aboutToDelete ( const StringData & ns , <nl> const NamespaceDetails * nsd , <nl> mmm a / src / mongo / db / clientcursor . h <nl> ppp b / src / mongo / db / clientcursor . h <nl> namespace mongo { <nl> <nl> static void appendStats ( BSONObjBuilder & result ) ; <nl> static unsigned numCursors ( ) { return clientCursorsById . size ( ) ; } <nl> - static void informAboutToDeleteBucket ( const DiskLoc & b ) ; <nl> static void aboutToDelete ( const StringData & ns , <nl> const NamespaceDetails * nsd , <nl> const DiskLoc & dl ) ; <nl> mmm a / src / mongo / db / cursor . h <nl> ppp b / src / mongo / db / cursor . h <nl> namespace mongo { <nl> return false ; <nl> } <nl> <nl> - virtual void aboutToDeleteBucket ( const DiskLoc & b ) { } <nl> - <nl> / * optional to implement . if implemented , means ' this ' is a prototype * / <nl> virtual Cursor * clone ( ) { <nl> return 0 ; <nl> mmm a / src / mongo / db / index / 2d_index_cursor . cpp <nl> ppp b / src / mongo / db / index / 2d_index_cursor . cpp <nl> namespace mongo { <nl> _underlyingCursor - > checkLocation ( ) ; <nl> return Status : : OK ( ) ; <nl> } <nl> - void TwoDIndexCursor : : aboutToDeleteBucket ( const DiskLoc & bucket ) { } <nl> void TwoDIndexCursor : : explainDetails ( BSONObjBuilder * b ) { <nl> _underlyingCursor - > explainDetails ( * b ) ; <nl> } <nl> mmm a / src / mongo / db / index / 2d_index_cursor . h <nl> ppp b / src / mongo / db / index / 2d_index_cursor . h <nl> namespace mongo { <nl> virtual Status savePosition ( ) ; <nl> virtual Status restorePosition ( ) ; <nl> <nl> - virtual void aboutToDeleteBucket ( const DiskLoc & bucket ) ; <nl> virtual void explainDetails ( BSONObjBuilder * b ) ; <nl> <nl> private : <nl> mmm a / src / mongo / db / index / btree_access_method . h <nl> ppp b / src / mongo / db / index / btree_access_method . h <nl> namespace mongo { <nl> <nl> virtual Status newCursor ( IndexCursor * * out ) ; <nl> <nl> - / / TODO ( hk ) : Keep bucket deletion internal to this class . <nl> - <nl> private : <nl> virtual void getKeys ( const BSONObj & obj , BSONObjSet * keys ) ; <nl> <nl> mmm a / src / mongo / db / index / btree_index_cursor . cpp <nl> ppp b / src / mongo / db / index / btree_index_cursor . cpp <nl> <nl> # include " mongo / db / jsobj . h " <nl> # include " mongo / db / index / index_cursor . h " <nl> # include " mongo / db / index / index_descriptor . h " <nl> + # include " mongo / platform / unordered_set . h " <nl> <nl> namespace mongo { <nl> <nl> + unordered_set < BtreeIndexCursor * > BtreeIndexCursor : : _activeCursors ; <nl> + SimpleMutex BtreeIndexCursor : : _activeCursorsMutex ( " active_btree_index_cursors " ) ; <nl> + <nl> / / Go forward by default . <nl> BtreeIndexCursor : : BtreeIndexCursor ( IndexDescriptor * descriptor , Ordering ordering , <nl> BtreeInterface * interface ) <nl> : _direction ( 1 ) , _descriptor ( descriptor ) , _ordering ( ordering ) , _interface ( interface ) , <nl> - _bucket ( descriptor - > getHead ( ) ) , _keyOffset ( 0 ) { } <nl> + _bucket ( descriptor - > getHead ( ) ) , _keyOffset ( 0 ) { <nl> + <nl> + SimpleMutex : : scoped_lock lock ( _activeCursorsMutex ) ; <nl> + _activeCursors . insert ( this ) ; <nl> + } <nl> + <nl> + BtreeIndexCursor : : ~ BtreeIndexCursor ( ) { <nl> + SimpleMutex : : scoped_lock lock ( _activeCursorsMutex ) ; <nl> + _activeCursors . erase ( this ) ; <nl> + } <nl> <nl> bool BtreeIndexCursor : : isEOF ( ) const { return _bucket . isNull ( ) ; } <nl> <nl> - / / XXX SHORT TERM HACKS THAT MUST DIE : 2d index <nl> + / / XXX TWO SHORT TERM HACKS THAT MUST DIE USED BY 2D INDEX : <nl> DiskLoc BtreeIndexCursor : : getBucket ( ) const { return _bucket ; } <nl> - <nl> - / / XXX SHORT TERM HACKS THAT MUST DIE : 2d index <nl> int BtreeIndexCursor : : getKeyOfs ( ) const { return _keyOffset ; } <nl> <nl> - / / XXX SHORT TERM HACKS THAT MUST DIE : btree deletion <nl> void BtreeIndexCursor : : aboutToDeleteBucket ( const DiskLoc & bucket ) { <nl> - if ( bucket = = _bucket ) { <nl> - _keyOffset = - 1 ; <nl> + SimpleMutex : : scoped_lock lock ( _activeCursorsMutex ) ; <nl> + for ( unordered_set < BtreeIndexCursor * > : : iterator i = _activeCursors . begin ( ) ; <nl> + i ! = _activeCursors . end ( ) ; + + i ) { <nl> + <nl> + BtreeIndexCursor * ic = * i ; <nl> + if ( bucket = = ic - > _bucket ) { <nl> + ic - > _keyOffset = - 1 ; <nl> + } <nl> } <nl> } <nl> <nl> mmm a / src / mongo / db / index / btree_index_cursor . h <nl> ppp b / src / mongo / db / index / btree_index_cursor . h <nl> namespace mongo { <nl> <nl> class BtreeIndexCursor : public IndexCursor { <nl> public : <nl> - virtual ~ BtreeIndexCursor ( ) { } <nl> + virtual ~ BtreeIndexCursor ( ) ; <nl> <nl> bool isEOF ( ) const ; <nl> <nl> - / / XXX SHORT TERM HACKS THAT MUST DIE : 2d index <nl> + / / See nasty comment in . cpp <nl> virtual DiskLoc getBucket ( ) const ; <nl> - <nl> - / / XXX SHORT TERM HACKS THAT MUST DIE : 2d index <nl> virtual int getKeyOfs ( ) const ; <nl> <nl> - / / XXX SHORT TERM HACKS THAT MUST DIE : btree deletion <nl> - virtual void aboutToDeleteBucket ( const DiskLoc & bucket ) ; <nl> + / * * <nl> + * Called from btree . cpp when we ' re about to delete a Btree bucket . <nl> + * / <nl> + static void aboutToDeleteBucket ( const DiskLoc & bucket ) ; <nl> <nl> virtual Status setOptions ( const CursorOptions & options ) ; <nl> <nl> namespace mongo { <nl> / / We keep the constructor private and only allow the AM to create us . <nl> friend class BtreeAccessMethod ; <nl> <nl> + / / For handling bucket deletion . <nl> + static unordered_set < BtreeIndexCursor * > _activeCursors ; <nl> + static SimpleMutex _activeCursorsMutex ; <nl> + <nl> / / Go forward by default . <nl> BtreeIndexCursor ( IndexDescriptor * descriptor , Ordering ordering , BtreeInterface * interface ) ; <nl> <nl> mmm a / src / mongo / db / index / emulated_cursor . h <nl> ppp b / src / mongo / db / index / emulated_cursor . h <nl> namespace mongo { <nl> } <nl> } <nl> <nl> - virtual void aboutToDeleteBucket ( const DiskLoc & b ) { <nl> - _indexCursor - > aboutToDeleteBucket ( b ) ; <nl> - } <nl> - <nl> private : <nl> EmulatedCursor ( IndexDescriptor * descriptor , IndexAccessMethod * indexAccessMethod , <nl> const BSONObj & order , int numWanted , const BSONObj & keyPattern ) <nl> mmm a / src / mongo / db / index / hash_index_cursor . cpp <nl> ppp b / src / mongo / db / index / hash_index_cursor . cpp <nl> namespace mongo { <nl> Status HashIndexCursor : : savePosition ( ) { _oldCursor - > noteLocation ( ) ; return Status : : OK ( ) ; } <nl> Status HashIndexCursor : : restorePosition ( ) { _oldCursor - > checkLocation ( ) ; return Status : : OK ( ) ; } <nl> <nl> - void HashIndexCursor : : aboutToDeleteBucket ( const DiskLoc & bucket ) { <nl> - _oldCursor - > aboutToDeleteBucket ( bucket ) ; <nl> - } <nl> - <nl> } / / namespace mongo <nl> mmm a / src / mongo / db / index / hash_index_cursor . h <nl> ppp b / src / mongo / db / index / hash_index_cursor . h <nl> namespace mongo { <nl> Status savePosition ( ) ; <nl> Status restorePosition ( ) ; <nl> <nl> - void aboutToDeleteBucket ( const DiskLoc & bucket ) ; <nl> - <nl> private : <nl> string _hashedField ; <nl> scoped_ptr < BtreeCursor > _oldCursor ; <nl> mmm a / src / mongo / db / index / index_cursor . h <nl> ppp b / src / mongo / db / index / index_cursor . h <nl> namespace mongo { <nl> / / XXX SHORT TERM HACKS THAT MUST DIE : 2d index <nl> virtual int getKeyOfs ( ) const { return 0 ; } <nl> <nl> - / / XXX SHORT TERM HACKS THAT MUST DIE : btree deletion <nl> - virtual void aboutToDeleteBucket ( const DiskLoc & bucket ) { } <nl> - <nl> / * * <nl> * Set options on the cursor ( direction ) . See CursorOptions below . <nl> * / <nl> mmm a / src / mongo / db / index / s2_index_cursor . cpp <nl> ppp b / src / mongo / db / index / s2_index_cursor . cpp <nl> namespace mongo { <nl> Status S2IndexCursor : : savePosition ( ) { return _underlyingCursor - > savePosition ( ) ; } <nl> Status S2IndexCursor : : restorePosition ( ) { return _underlyingCursor - > restorePosition ( ) ; } <nl> <nl> - void S2IndexCursor : : aboutToDeleteBucket ( const DiskLoc & bucket ) { <nl> - _underlyingCursor - > aboutToDeleteBucket ( bucket ) ; <nl> - } <nl> - <nl> } / / namespace mongo <nl> mmm a / src / mongo / db / index / s2_index_cursor . h <nl> ppp b / src / mongo / db / index / s2_index_cursor . h <nl> namespace mongo { <nl> virtual Status savePosition ( ) ; <nl> virtual Status restorePosition ( ) ; <nl> <nl> - virtual void aboutToDeleteBucket ( const DiskLoc & bucket ) ; <nl> - <nl> private : <nl> S2IndexingParams _params ; <nl> IndexDescriptor * _descriptor ; <nl> mmm a / src / mongo / db / index / s2_simple_cursor . cpp <nl> ppp b / src / mongo / db / index / s2_simple_cursor . cpp <nl> namespace mongo { <nl> BSONObj S2SimpleCursor : : getKey ( ) const { return _btreeCursor - > currKey ( ) ; } <nl> DiskLoc S2SimpleCursor : : getValue ( ) const { return _btreeCursor - > currLoc ( ) ; } <nl> <nl> - void S2SimpleCursor : : aboutToDeleteBucket ( const DiskLoc & bucket ) { <nl> - _btreeCursor - > aboutToDeleteBucket ( bucket ) ; <nl> - } <nl> - <nl> void S2SimpleCursor : : next ( ) { <nl> for ( ; _btreeCursor - > ok ( ) ; _btreeCursor - > advance ( ) ) { <nl> + + _nscanned ; <nl> mmm a / src / mongo / db / index / s2_simple_cursor . h <nl> ppp b / src / mongo / db / index / s2_simple_cursor . h <nl> namespace mongo { <nl> virtual Status savePosition ( ) ; <nl> virtual Status restorePosition ( ) ; <nl> <nl> - virtual void aboutToDeleteBucket ( const DiskLoc & bucket ) ; <nl> private : <nl> IndexDescriptor * _descriptor ; <nl> <nl> mmm a / src / mongo / db / intervalbtreecursor . cpp <nl> ppp b / src / mongo / db / intervalbtreecursor . cpp <nl> <nl> <nl> namespace mongo { <nl> <nl> + unordered_set < IntervalBtreeCursor * > IntervalBtreeCursor : : _activeCursors ; <nl> + SimpleMutex IntervalBtreeCursor : : _activeCursorsMutex ( " active_interval_btree_cursors " ) ; <nl> + <nl> / * * <nl> * Advance ' loc ' until it does not reference an unused key , or the end of the btree is reached . <nl> * / <nl> namespace mongo { <nl> _currRecoverable ( _indexDetails , _ordering , _curr ) , <nl> _nscanned ( ) , <nl> _multikeyFlag ( ) { <nl> + <nl> + SimpleMutex : : scoped_lock lock ( _activeCursorsMutex ) ; <nl> + _activeCursors . insert ( this ) ; <nl> + } <nl> + <nl> + IntervalBtreeCursor : : ~ IntervalBtreeCursor ( ) { <nl> + SimpleMutex : : scoped_lock lock ( _activeCursorsMutex ) ; <nl> + _activeCursors . erase ( this ) ; <nl> + } <nl> + <nl> + void IntervalBtreeCursor : : aboutToDeleteBucket ( const DiskLoc & bucket ) { <nl> + SimpleMutex : : scoped_lock lock ( _activeCursorsMutex ) ; <nl> + for ( unordered_set < IntervalBtreeCursor * > : : iterator i = _activeCursors . begin ( ) ; <nl> + i ! = _activeCursors . end ( ) ; + + i ) { <nl> + <nl> + IntervalBtreeCursor * ic = * i ; <nl> + if ( bucket = = ic - > _curr . bucket ) { <nl> + ic - > _currRecoverable . invalidateInitialLocation ( ) ; <nl> + } <nl> + } <nl> } <nl> <nl> void IntervalBtreeCursor : : init ( ) { <nl> namespace mongo { <nl> return _curr . bucket . btree < V1 > ( ) - > keyNode ( _curr . pos ) . key . toBson ( ) ; <nl> } <nl> <nl> - void IntervalBtreeCursor : : aboutToDeleteBucket ( const DiskLoc & b ) { <nl> - if ( b = = _curr . bucket ) { <nl> - _currRecoverable . invalidateInitialLocation ( ) ; <nl> - } <nl> - } <nl> <nl> void IntervalBtreeCursor : : noteLocation ( ) { <nl> _currRecoverable = LogicalBtreePosition ( _indexDetails , _ordering , _curr ) ; <nl> mmm a / src / mongo / db / intervalbtreecursor . h <nl> ppp b / src / mongo / db / intervalbtreecursor . h <nl> namespace mongo { <nl> <nl> virtual DiskLoc refLoc ( ) { return currLoc ( ) ; } <nl> <nl> - virtual void aboutToDeleteBucket ( const DiskLoc & b ) ; <nl> + static void aboutToDeleteBucket ( const DiskLoc & b ) ; <nl> <nl> virtual BSONObj indexKeyPattern ( ) { return _indexDetails . keyPattern ( ) ; } <nl> <nl> namespace mongo { <nl> <nl> virtual void setMatcher ( shared_ptr < CoveredIndexMatcher > matcher ) { _matcher = matcher ; } <nl> <nl> + virtual ~ IntervalBtreeCursor ( ) ; <nl> + <nl> private : <nl> IntervalBtreeCursor ( NamespaceDetails * namespaceDetails , <nl> const IndexDetails & indexDetails , <nl> namespace mongo { <nl> const BSONObj & upperBound , <nl> bool upperBoundInclusive ) ; <nl> <nl> + / / For handling bucket deletion . <nl> + static unordered_set < IntervalBtreeCursor * > _activeCursors ; <nl> + static SimpleMutex _activeCursorsMutex ; <nl> + <nl> void init ( ) ; <nl> <nl> / * * <nl> | SERVER - 8791 SERVER - 9212 keep btree bucket deletion inside of btree class | mongodb/mongo | a6766a1b1d9cdbcdad70ed1115e129bb0bb17366 | 2013-07-02T16:22:24Z |
mmm a / torch / csrc / jit / python / pybind_utils . h <nl> ppp b / torch / csrc / jit / python / pybind_utils . h <nl> inline InferredType tryToInferContainerType ( py : : handle input ) { <nl> element_type = * unified_type ; <nl> } <nl> return InferredType ( ListType : : create ( element_type ) ) ; <nl> - # ifdef USE_DISTRIBUTED <nl> - } else if ( py : : isinstance < torch : : distributed : : rpc : : PyRRef > ( input ) ) { <nl> - auto rref_ivalue = input . cast < torch : : distributed : : rpc : : PyRRef > ( ) . toIValue ( ) ; <nl> - return InferredType ( RRefType : : create ( rref_ivalue . type ( ) ) ) ; <nl> - # endif <nl> } else { <nl> / / TODO : this message is not correct anymore , since this InferredType is <nl> / / used from a bunch of circumstances unrelated to tracing . We can re - use <nl> mmm a / torch / testing / _internal / distributed / rpc / jit / rpc_test . py <nl> ppp b / torch / testing / _internal / distributed / rpc / jit / rpc_test . py <nl> def one_arg ( value ) : <nl> return value + 1 <nl> <nl> <nl> - class MyScriptModuleWithRRefs ( torch . jit . ScriptModule ) : <nl> - def __init__ ( self , dst_worker ) : <nl> - super ( ) . __init__ ( ) <nl> - self . rrefs = [ ] <nl> - for _ in range ( 4 ) : <nl> - self . rrefs . append ( rpc_return_rref ( dst_worker ) ) <nl> - <nl> - @ torch . jit . script_method <nl> - def forward ( self ) : <nl> - # type : ( ) - > Tensor <nl> - res_tensor = torch . ones ( 2 , 2 ) <nl> - for rref in self . rrefs : <nl> - res_tensor + = rref . to_here ( ) <nl> - <nl> - return res_tensor <nl> - <nl> - <nl> @ torch . jit . script <nl> class MyScriptClass : <nl> def __init__ ( self ) : <nl> def rref_tensor_is_owner ( rref_var ) : <nl> res = rref_tensor_is_owner ( rref_var ) <nl> self . assertEqual ( res , False ) <nl> <nl> - @ dist_init <nl> - def test_my_script_module_with_rrefs ( self ) : <nl> - n = self . rank + 1 <nl> - dst_rank = n % self . world_size <nl> - <nl> - module_with_rrefs = MyScriptModuleWithRRefs ( " worker { } " . format ( dst_rank ) ) <nl> - res = module_with_rrefs ( ) <nl> - self . assertEqual ( res , torch . ones ( 2 , 2 ) * 9 ) <nl> - <nl> @ dist_init <nl> def test_rref_python_annotation ( self ) : <nl> n = self . rank + 1 <nl> | [ Revert ] manual revert of D19918320 ( ) | pytorch/pytorch | 5029ff001bfe8b7de5c86c117d567e7856170236 | 2020-02-28T05:22:36Z |
mmm a / CMakeLists . txt <nl> ppp b / CMakeLists . txt <nl> project ( foundationdb <nl> set ( CMAKE_MODULE_PATH " $ { CMAKE_MODULE_PATH } ; $ { PROJECT_SOURCE_DIR } / cmake " ) <nl> message ( STATUS " $ { PROJECT_SOURCE_DIR } $ { PROJECT_BINARY_DIR } " ) <nl> if ( " $ { PROJECT_SOURCE_DIR } " STREQUAL " $ { PROJECT_BINARY_DIR } " ) <nl> - message ( FATAL_ERROR " In - source builds are forbidden , unsupported , and stupid ! ! " ) <nl> + message ( FATAL_ERROR " In - source builds are forbidden " ) <nl> endif ( ) <nl> <nl> if ( NOT CMAKE_BUILD_TYPE AND NOT CMAKE_CONFIGURATION_TYPES ) <nl> mmm a / FDBLibTLS / CMakeLists . txt <nl> ppp b / FDBLibTLS / CMakeLists . txt <nl> set ( SRCS <nl> FDBLibTLSSession . cpp <nl> FDBLibTLSSession . h <nl> FDBLibTLSVerify . cpp <nl> - FDBLibTLSVerify . h <nl> - ReferenceCounted . h ) <nl> + FDBLibTLSVerify . h ) <nl> <nl> add_library ( FDBLibTLS $ { SRCS } ) <nl> - target_link_libraries ( FDBLibTLS PUBLIC LibreSSL boost_target ) <nl> + target_link_libraries ( FDBLibTLS PUBLIC LibreSSL boost_target PRIVATE flow ) <nl> mmm a / FDBLibTLS / FDBLibTLSPlugin . h <nl> ppp b / FDBLibTLS / FDBLibTLSPlugin . h <nl> <nl> # pragma once <nl> <nl> # include " fdbrpc / ITLSPlugin . h " <nl> - # include " ReferenceCounted . h " <nl> + # include " flow / FastRef . h " <nl> <nl> # include < tls . h > <nl> <nl> mmm a / FDBLibTLS / FDBLibTLSPolicy . h <nl> ppp b / FDBLibTLS / FDBLibTLSPolicy . h <nl> <nl> # pragma once <nl> <nl> # include " fdbrpc / ITLSPlugin . h " <nl> - # include " ReferenceCounted . h " <nl> + # include " flow / FastRef . h " <nl> <nl> # include " FDBLibTLS / FDBLibTLSPlugin . h " <nl> # include " FDBLibTLS / FDBLibTLSVerify . h " <nl> mmm a / FDBLibTLS / FDBLibTLSSession . cpp <nl> ppp b / FDBLibTLS / FDBLibTLSSession . cpp <nl> <nl> * / <nl> <nl> # include " FDBLibTLS / FDBLibTLSSession . h " <nl> + <nl> + # include " flow / flow . h " <nl> # include " flow / Trace . h " <nl> <nl> # include < openssl / bio . h > <nl> static ssize_t tls_write_func ( struct tls * ctx , const void * buf , size_t buflen , v <nl> <nl> FDBLibTLSSession : : FDBLibTLSSession ( Reference < FDBLibTLSPolicy > policy , bool is_client , const char * servername , TLSSendCallbackFunc send_func , void * send_ctx , TLSRecvCallbackFunc recv_func , void * recv_ctx , void * uidptr ) : <nl> tls_ctx ( NULL ) , tls_sctx ( NULL ) , is_client ( is_client ) , policy ( policy ) , send_func ( send_func ) , send_ctx ( send_ctx ) , <nl> - recv_func ( recv_func ) , recv_ctx ( recv_ctx ) , handshake_completed ( false ) { <nl> + recv_func ( recv_func ) , recv_ctx ( recv_ctx ) , handshake_completed ( false ) , lastVerifyFailureLogged ( 0 . 0 ) { <nl> if ( uidptr ) <nl> uid = * ( UID * ) uidptr ; <nl> <nl> bool FDBLibTLSSession : : verify_peer ( ) { <nl> <nl> if ( ! rc ) { <nl> / / log the various failure reasons <nl> - for ( std : : string reason : verify_failure_reasons ) { <nl> - TraceEvent ( " FDBLibTLSVerifyFailure " , uid ) . suppressFor ( 1 . 0 ) . detail ( " Reason " , reason ) ; <nl> + if ( now ( ) - lastVerifyFailureLogged > 1 . 0 ) { <nl> + for ( std : : string reason : verify_failure_reasons ) { <nl> + lastVerifyFailureLogged = now ( ) ; <nl> + TraceEvent ( " FDBLibTLSVerifyFailure " , uid ) . detail ( " Reason " , reason ) ; <nl> + } <nl> } <nl> } <nl> <nl> mmm a / FDBLibTLS / FDBLibTLSSession . h <nl> ppp b / FDBLibTLS / FDBLibTLSSession . h <nl> <nl> # pragma once <nl> <nl> # include " fdbrpc / ITLSPlugin . h " <nl> - # include " ReferenceCounted . h " <nl> + # include " flow / FastRef . h " <nl> <nl> # include " FDBLibTLS / FDBLibTLSPolicy . h " <nl> # include " FDBLibTLS / FDBLibTLSVerify . h " <nl> struct FDBLibTLSSession : ITLSSession , ReferenceCounted < FDBLibTLSSession > { <nl> bool handshake_completed ; <nl> <nl> UID uid ; <nl> + double lastVerifyFailureLogged ; <nl> } ; <nl> <nl> # endif / * FDB_LIBTLS_SESSION_H * / <nl> mmm a / FDBLibTLS / FDBLibTLSVerify . h <nl> ppp b / FDBLibTLS / FDBLibTLSVerify . h <nl> <nl> <nl> # include < stdint . h > <nl> <nl> - # include " ReferenceCounted . h " <nl> + # include " flow / FastRef . h " <nl> <nl> # include < map > <nl> # include < string > <nl> deleted file mode 100644 <nl> index 6321339018 . . 0000000000 <nl> mmm a / FDBLibTLS / ReferenceCounted . h <nl> ppp / dev / null <nl> <nl> - / * <nl> - * ReferenceCounted . h <nl> - * <nl> - * This source file is part of the FoundationDB open source project <nl> - * <nl> - * Copyright 2013 - 2018 Apple Inc . and the FoundationDB project authors <nl> - * <nl> - * Licensed under the Apache License , Version 2 . 0 ( the " License " ) ; <nl> - * you may not use this file except in compliance with the License . <nl> - * You may obtain a copy of the License at <nl> - * <nl> - * http : / / www . apache . org / licenses / LICENSE - 2 . 0 <nl> - * <nl> - * Unless required by applicable law or agreed to in writing , software <nl> - * distributed under the License is distributed on an " AS IS " BASIS , <nl> - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND , either express or implied . <nl> - * See the License for the specific language governing permissions and <nl> - * limitations under the License . <nl> - * / <nl> - <nl> - # ifndef FDB_REFERENCE_COUNTED_H <nl> - # define FDB_REFERENCE_COUNTED_H <nl> - <nl> - # pragma once <nl> - <nl> - # include < stdlib . h > <nl> - <nl> - template < class T > <nl> - struct ReferenceCounted { <nl> - void addref ( ) { + + referenceCount ; } <nl> - void delref ( ) { if ( - - referenceCount = = 0 ) { delete ( T * ) this ; } } <nl> - <nl> - ReferenceCounted ( ) : referenceCount ( 1 ) { } <nl> - <nl> - private : <nl> - ReferenceCounted ( const ReferenceCounted & ) = delete ; <nl> - void operator = ( const ReferenceCounted & ) = delete ; <nl> - int32_t referenceCount ; <nl> - } ; <nl> - <nl> - template < class P > <nl> - void addref ( P * ptr ) { ptr - > addref ( ) ; } <nl> - template < class P > <nl> - void delref ( P * ptr ) { ptr - > delref ( ) ; } <nl> - <nl> - template < class P > <nl> - struct Reference { <nl> - Reference ( ) : ptr ( NULL ) { } <nl> - explicit Reference ( P * ptr ) : ptr ( ptr ) { } <nl> - static Reference < P > addRef ( P * ptr ) { ptr - > addref ( ) ; return Reference ( ptr ) ; } <nl> - <nl> - Reference ( const Reference & r ) : ptr ( r . getPtr ( ) ) { if ( ptr ) addref ( ptr ) ; } <nl> - Reference ( Reference & & r ) : ptr ( r . getPtr ( ) ) { r . ptr = NULL ; } <nl> - <nl> - template < class Q > <nl> - Reference ( const Reference < Q > & r ) : ptr ( r . getPtr ( ) ) { if ( ptr ) addref ( ptr ) ; } <nl> - template < class Q > <nl> - Reference ( Reference < Q > & & r ) : ptr ( r . getPtr ( ) ) { r . setPtrUnsafe ( NULL ) ; } <nl> - <nl> - ~ Reference ( ) { if ( ptr ) delref ( ptr ) ; } <nl> - Reference & operator = ( const Reference & r ) { <nl> - P * oldPtr = ptr ; <nl> - P * newPtr = r . ptr ; <nl> - if ( oldPtr ! = newPtr ) { <nl> - if ( newPtr ) addref ( newPtr ) ; <nl> - ptr = newPtr ; <nl> - if ( oldPtr ) delref ( oldPtr ) ; <nl> - } <nl> - return * this ; <nl> - } <nl> - Reference & operator = ( Reference & & r ) { <nl> - P * oldPtr = ptr ; <nl> - P * newPtr = r . ptr ; <nl> - if ( oldPtr ! = newPtr ) { <nl> - r . ptr = NULL ; <nl> - ptr = newPtr ; <nl> - if ( oldPtr ) delref ( oldPtr ) ; <nl> - } <nl> - return * this ; <nl> - } <nl> - <nl> - void clear ( ) { <nl> - P * oldPtr = ptr ; <nl> - if ( oldPtr ) { <nl> - ptr = NULL ; <nl> - delref ( oldPtr ) ; <nl> - } <nl> - } <nl> - <nl> - P * operator - > ( ) const { return ptr ; } <nl> - P & operator * ( ) const { return * ptr ; } <nl> - P * getPtr ( ) const { return ptr ; } <nl> - <nl> - void setPtrUnsafe ( P * p ) { ptr = p ; } <nl> - <nl> - P * extractPtr ( ) { auto * p = ptr ; ptr = NULL ; return p ; } <nl> - <nl> - bool boolean_test ( ) const { return ptr ! = 0 ; } <nl> - private : <nl> - P * ptr ; <nl> - } ; <nl> - <nl> - template < class P > <nl> - bool operator = = ( const Reference < P > & lhs , const Reference < P > & rhs ) { <nl> - return lhs . getPtr ( ) = = rhs . getPtr ( ) ; <nl> - } <nl> - <nl> - # endif / * FDB_REFERENCE_COUNTED_H * / <nl> mmm a / FDBLibTLS / plugin - test . cpp <nl> ppp b / FDBLibTLS / plugin - test . cpp <nl> <nl> # include < boost / circular_buffer . hpp > <nl> <nl> # include " fdbrpc / ITLSPlugin . h " <nl> - # include " ReferenceCounted . h " <nl> <nl> # include " FDBLibTLS / FDBLibTLSPlugin . h " <nl> <nl> mmm a / FDBLibTLS / verify - test . cpp <nl> ppp b / FDBLibTLS / verify - test . cpp <nl> <nl> # include < openssl / objects . h > <nl> <nl> # include " fdbrpc / ITLSPlugin . h " <nl> - # include " ReferenceCounted . h " <nl> <nl> # include " FDBLibTLS / FDBLibTLSPlugin . h " <nl> # include " FDBLibTLS / FDBLibTLSPolicy . h " <nl> mmm a / documentation / sphinx / conf . py <nl> ppp b / documentation / sphinx / conf . py <nl> <nl> ] <nl> <nl> # Add any paths that contain templates here , relative to this directory . <nl> - templates_path = [ sys . prefix + ' / _templates ' ] <nl> + templates_path = [ ] <nl> <nl> # The suffix of source filenames . <nl> source_suffix = ' . rst ' <nl> <nl> # Add any paths that contain custom static files ( such as style sheets ) here , <nl> # relative to this directory . They are copied after the builtin static files , <nl> # so a file named " default . css " will overwrite the builtin " default . css " . <nl> - html_static_path = [ sys . prefix + ' / _static ' ] <nl> + html_static_path = [ ] <nl> <nl> # If not ' ' , a ' Last updated on : ' timestamp is inserted at every page bottom , <nl> # using the given strftime format . <nl> mmm a / documentation / sphinx / source / administration . rst <nl> ppp b / documentation / sphinx / source / administration . rst <nl> The procedures for adding and removing machines can be combined into a recipe fo <nl> Converting an existing cluster to use TLS <nl> = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = <nl> <nl> - A FoundationDB cluster has the option of supporting : doc : ` Transport Layer Security ( TLS ) < tls > ` . To enable TLS on an existing , non - TLS cluster , see : ref : ` Converting a running cluster < converting - existing - cluster > ` . <nl> + A FoundationDB cluster has the option of supporting : doc : ` Transport Layer Security ( TLS ) < tls > ` . To enable TLS on an existing , non - TLS cluster , see : ref : ` Converting a running cluster < converting - existing - cluster - after - 6 . 1 > ` . <nl> <nl> . . _administration - monitoring - cluster - status : <nl> <nl> mmm a / documentation / sphinx / source / api - c . rst <nl> ppp b / documentation / sphinx / source / api - c . rst <nl> <nl> . . | node - subspace | replace : : FIXME <nl> . . | content - subspace | replace : : FIXME <nl> . . | allow - manual - prefixes | replace : : FIXME <nl> + . . | retry - limit - transaction - option | replace : : FIXME <nl> + . . | timeout - transaction - option | replace : : FIXME <nl> + . . | max - retry - delay - transaction - option | replace : : FIXME <nl> + . . | snapshot - ryw - enable - transaction - option | replace : : FIXME <nl> + . . | snapshot - ryw - disable - transaction - option | replace : : FIXME <nl> + . . | snapshot - ryw - enable - database - option | replace : : FIXME <nl> + . . | snapshot - ryw - disable - database - option | replace : : FIXME <nl> + . . | retry - limit - database - option | replace : : FIXME <nl> + . . | max - retry - delay - database - option | replace : : FIXME <nl> + . . | timeout - database - option | replace : : FIXME <nl> <nl> . . include : : api - common . rst . inc <nl> <nl> - . . | future - warning | replace : : : data : ` future ` must represent a result of the appropriate type ( i . e . must have been returned by a function documented as returning this type ) , or the results are undefined . <nl> + . . | future - warning | replace : : ` ` future ` ` must represent a result of the appropriate type ( i . e . must have been returned by a function documented as returning this type ) , or the results are undefined . <nl> <nl> - . . | future - get - return1 | replace : : Returns zero if : data : ` future ` is ready and not in an error state , and a non - zero : ref : ` error code < developer - guide - error - codes > ` otherwise <nl> + . . | future - get - return1 | replace : : Returns zero if ` ` future ` ` is ready and not in an error state , and a non - zero : ref : ` error code < developer - guide - error - codes > ` otherwise <nl> <nl> . . | future - get - return2 | replace : : ( in which case the value of any out parameter is undefined ) <nl> <nl> <nl> <nl> . . | snapshot | replace : : Non - zero if this is a : ref : ` snapshot read < snapshots > ` . <nl> <nl> - . . | sets - and - clears1 | replace : : Modify the database snapshot represented by : data : ` transaction ` <nl> + . . | sets - and - clears1 | replace : : Modify the database snapshot represented by ` ` transaction ` ` <nl> <nl> - . . | sets - and - clears2 | replace : : The modification affects the actual database only if : data : ` transaction ` is later committed with : func : ` fdb_transaction_commit ( ) ` . <nl> + . . | sets - and - clears2 | replace : : The modification affects the actual database only if ` ` transaction ` ` is later committed with : func : ` fdb_transaction_commit ( ) ` . <nl> <nl> = = = = = <nl> C API <nl> The FoundationDB C bindings are provided as a shared object which may be linked <nl> Linux <nl> mmm - - <nl> <nl> - When linking against ` ` libfdb_c . so ` ` , you must also link against ` ` libm ` ` , ` ` libpthread ` ` and ` ` librt ` ` . These dependencies will be resolved by the dynamic linker when using this API via : func : ` dlopen ( ) ` or an FFI . <nl> + When linking against ` ` libfdb_c . so ` ` , you must also link against ` ` libm ` ` , ` ` libpthread ` ` and ` ` librt ` ` . These dependencies will be resolved by the dynamic linker when using this API via ` ` dlopen ( ) ` ` or an FFI . <nl> <nl> macOS <nl> mmmmmm - - <nl> When linking against ` ` libfdb_c . dylib ` ` , no additional libraries are required . <nl> API versioning <nl> = = = = = = = = = = = = = = <nl> <nl> - Prior to including ` ` fdb_c . h ` ` , you must define the : macro : ` FDB_API_VERSION ` macro . This , together with the : func : ` fdb_select_api_version ( ) ` function , allows programs written against an older version of the API to compile and run with newer versions of the C library . The current version of the FoundationDB C API is | api - version | . : : <nl> + Prior to including ` ` fdb_c . h ` ` , you must define the ` ` FDB_API_VERSION ` ` macro . This , together with the : func : ` fdb_select_api_version ( ) ` function , allows programs written against an older version of the API to compile and run with newer versions of the C library . The current version of the FoundationDB C API is | api - version | . : : <nl> <nl> # define FDB_API_VERSION 610 <nl> # include < foundationdb / fdb_c . h > <nl> <nl> . . function : : fdb_error_t fdb_select_api_version ( int version ) <nl> <nl> - Must be called before any other API functions . : data : ` version ` must be less than or equal to : macro : ` FDB_API_VERSION ` ( and should almost always be equal ) . <nl> + Must be called before any other API functions . ` ` version ` ` must be less than or equal to ` ` FDB_API_VERSION ` ` ( and should almost always be equal ) . <nl> <nl> - Language bindings implemented in C which themselves expose API versioning will usually pass the version requested by the application , instead of always passing : macro : ` FDB_API_VERSION ` . <nl> + Language bindings implemented in C which themselves expose API versioning will usually pass the version requested by the application , instead of always passing ` ` FDB_API_VERSION ` ` . <nl> <nl> - Passing a version less than : macro : ` FDB_API_VERSION ` will cause the API to behave as it did in the older version . <nl> + Passing a version less than ` ` FDB_API_VERSION ` ` will cause the API to behave as it did in the older version . <nl> <nl> It is an error to call this function after it has returned successfully . It is not thread safe , and if called from more than one thread simultaneously its behavior is undefined . <nl> <nl> - . . note : : This is actually implemented as a macro . If you are accessing this API via : func : ` dlopen ( ) ` or an FFI , you will need to use : func : ` fdb_select_api_version_impl ( ) ` . <nl> + . . note : : This is actually implemented as a macro . If you are accessing this API via ` ` dlopen ( ) ` ` or an FFI , you will need to use : func : ` fdb_select_api_version_impl ( ) ` . <nl> <nl> . . warning : : | api - version - multi - version - warning | <nl> <nl> . . function : : fdb_error_t fdb_select_api_version_impl ( int runtime_version , int header_version ) <nl> <nl> - This is the actual entry point called by the : func : ` fdb_select_api_version ` macro . It should never be called directly from C , but if you are accessing this API via : func : ` dlopen ( ) ` or an FFI , you will need to use it . ` ` fdb_select_api_version ( v ) ` ` is equivalent to ` ` fdb_select_api_version_impl ( v , FDB_API_VERSION ) ` ` . <nl> + This is the actual entry point called by the : func : ` fdb_select_api_version ` macro . It should never be called directly from C , but if you are accessing this API via ` ` dlopen ( ) ` ` or an FFI , you will need to use it . ` ` fdb_select_api_version ( v ) ` ` is equivalent to ` ` fdb_select_api_version_impl ( v , FDB_API_VERSION ) ` ` . <nl> <nl> It is an error to call this function after it has returned successfully . It is not thread safe , and if called from more than one thread simultaneously its behavior is undefined . <nl> <nl> - : data : ` runtime_version ` <nl> - The version of run - time behavior the API is requested to provide . Must be less than or equal to : data : ` header_version ` , and should almost always be equal . <nl> + ` ` runtime_version ` ` <nl> + The version of run - time behavior the API is requested to provide . Must be less than or equal to ` ` header_version ` ` , and should almost always be equal . <nl> <nl> Language bindings which themselves expose API versioning will usually pass the version requested by the application . <nl> <nl> - : data : ` header_version ` <nl> + ` ` header_version ` ` <nl> The version of the ABI ( application binary interface ) that the calling code expects to find in the shared library . If you are using an FFI , this * must * correspond to the version of the API you are using as a reference ( currently | api - version | ) . For example , the number of arguments that a function takes may be affected by this value , and an incorrect value is unlikely to yield success . <nl> <nl> . . warning : : | api - version - multi - version - warning | <nl> See : ref : ` developer - guide - programming - with - futures ` for further ( language - indepe <nl> <nl> . . type : : FDBCallback <nl> <nl> - A pointer to a function which takes : type : ` FDBFuture * ` and : type : ` void * ` and returns : type : ` void ` . <nl> + A pointer to a function which takes : type : ` FDBFuture * ` and ` ` void * ` ` and returns ` ` void ` ` . <nl> <nl> . . function : : void fdb_future_release_memory ( FDBFuture * future ) <nl> <nl> See : ref : ` developer - guide - programming - with - futures ` for further ( language - indepe <nl> <nl> . . function : : fdb_error_t fdb_future_get_version ( FDBFuture * future , int64_t * out_version ) <nl> <nl> - Extracts a value of type version from an : type : ` FDBFuture ` into a caller - provided variable of type : type : ` int64_t ` . | future - warning | <nl> + Extracts a version from an : type : ` FDBFuture ` into a caller - provided variable of type ` ` int64_t ` ` . | future - warning | <nl> <nl> | future - get - return1 | | future - get - return2 | . <nl> <nl> . . function : : fdb_error_t fdb_future_get_key ( FDBFuture * future , uint8_t const * * out_key , int * out_key_length ) <nl> <nl> - Extracts a value of type key from an : type : ` FDBFuture ` into caller - provided variables of type : type : ` uint8_t * ` ( a pointer to the beginning of the key ) and : type : ` int ` ( the length of the key ) . | future - warning | <nl> + Extracts a key from an : type : ` FDBFuture ` into caller - provided variables of type ` ` uint8_t * ` ` ( a pointer to the beginning of the key ) and ` ` int ` ` ( the length of the key ) . | future - warning | <nl> <nl> | future - get - return1 | | future - get - return2 | . <nl> <nl> See : ref : ` developer - guide - programming - with - futures ` for further ( language - indepe <nl> <nl> | future - get - return1 | | future - get - return2 | . <nl> <nl> - : data : ` * out_present ` <nl> + ` ` * out_present ` ` <nl> Set to non - zero if ( and only if ) the requested value was present in the database . ( If zero , the other outputs are meaningless . ) <nl> <nl> - : data : ` * out_value ` <nl> + ` ` * out_value ` ` <nl> Set to point to the first byte of the value . <nl> <nl> - : data : ` * out_value_length ` <nl> + ` ` * out_value_length ` ` <nl> Set to the length of the value ( in bytes ) . <nl> <nl> | future - memory - mine | <nl> See : ref : ` developer - guide - programming - with - futures ` for further ( language - indepe <nl> <nl> | future - get - return1 | | future - get - return2 | . <nl> <nl> - : data : ` * out_strings ` <nl> + ` ` * out_strings ` ` <nl> Set to point to the first string in the array . <nl> <nl> - : data : ` * out_count ` <nl> + ` ` * out_count ` ` <nl> Set to the number of strings in the array . <nl> <nl> | future - memory - mine | <nl> See : ref : ` developer - guide - programming - with - futures ` for further ( language - indepe <nl> <nl> | future - get - return1 | | future - get - return2 | . <nl> <nl> - : data : ` * out_kv ` <nl> + ` ` * out_kv ` ` <nl> Set to point to the first : type : ` FDBKeyValue ` object in the array . <nl> <nl> - : data : ` * out_count ` <nl> + ` ` * out_count ` ` <nl> Set to the number of : type : ` FDBKeyValue ` objects in the array . <nl> <nl> - : data : ` * out_more ` <nl> + ` ` * out_more ` ` <nl> Set to true if ( but not necessarily only if ) values remain in the * key * range requested ( possibly beyond the limits requested ) . <nl> <nl> | future - memory - mine | <nl> See : ref : ` developer - guide - programming - with - futures ` for further ( language - indepe <nl> int value_length ; <nl> } FDBKeyValue ; <nl> <nl> - : data : ` key ` <nl> + ` ` key ` ` <nl> A pointer to a key . <nl> <nl> - : data : ` key_length ` <nl> - The length of the key pointed to by : data : ` key ` . <nl> + ` ` key_length ` ` <nl> + The length of the key pointed to by ` ` key ` ` . <nl> <nl> - : data : ` value ` <nl> + ` ` value ` ` <nl> A pointer to a value . <nl> <nl> - : data : ` value_length ` <nl> - The length of the value pointed to by : data : ` value ` . <nl> + ` ` value_length ` ` <nl> + The length of the value pointed to by ` ` value ` ` . <nl> <nl> Database <nl> = = = = = = = = <nl> An | database - blurb1 | Modifications to a database are performed via transactions . <nl> <nl> Creates a new database connected the specified cluster . The caller assumes ownership of the : type : ` FDBDatabase ` object and must destroy it with : func : ` fdb_database_destroy ( ) ` . <nl> <nl> - : data : ` cluster_file_path ` <nl> + ` ` cluster_file_path ` ` <nl> A NULL - terminated string giving a local path of a : ref : ` cluster file < foundationdb - cluster - file > ` ( often called ' fdb . cluster ' ) which contains connection information for the FoundationDB cluster . If cluster_file_path is NULL or an empty string , then a : ref : ` default cluster file < default - cluster - file > ` will be used . <nl> <nl> - : data : ` * out_database ` <nl> + ` ` * out_database ` ` <nl> Set to point to the newly created : type : ` FDBDatabase ` . <nl> <nl> . . function : : void fdb_database_destroy ( FDBDatabase * database ) <nl> An | database - blurb1 | Modifications to a database are performed via transactions . <nl> <nl> Creates a new transaction on the given database . The caller assumes ownership of the : type : ` FDBTransaction ` object and must destroy it with : func : ` fdb_transaction_destroy ( ) ` . <nl> <nl> - : data : ` * out_transaction ` <nl> + ` ` * out_transaction ` ` <nl> Set to point to the newly created : type : ` FDBTransaction ` . <nl> <nl> Transaction <nl> Applications must provide error handling and an appropriate retry loop around th <nl> <nl> . . function : : FDBFuture * fdb_transaction_get ( FDBTransaction * transaction , uint8_t const * key_name , int key_name_length , fdb_bool_t snapshot ) <nl> <nl> - Reads a value from the database snapshot represented by : data : ` transaction ` . <nl> + Reads a value from the database snapshot represented by ` ` transaction ` ` . <nl> <nl> - | future - return0 | the value of : data : ` key_name ` in the database . | future - return1 | call : func : ` fdb_future_get_value ( ) ` to extract the value , | future - return2 | <nl> + | future - return0 | the value of ` ` key_name ` ` in the database . | future - return1 | call : func : ` fdb_future_get_value ( ) ` to extract the value , | future - return2 | <nl> <nl> - See : func : ` fdb_future_get_value ( ) ` to see exactly how results are unpacked . If : data : ` key_name ` is not present in the database , the result is not an error , but a zero for : data : ` * out_present ` returned from that function . <nl> + See : func : ` fdb_future_get_value ( ) ` to see exactly how results are unpacked . If ` ` key_name ` ` is not present in the database , the result is not an error , but a zero for ` ` * out_present ` ` returned from that function . <nl> <nl> - : data : ` key_name ` <nl> + ` ` key_name ` ` <nl> A pointer to the name of the key to be looked up in the database . | no - null | <nl> <nl> - : data : ` key_name_length ` <nl> - | length - of | : data : ` key_name ` . <nl> + ` ` key_name_length ` ` <nl> + | length - of | ` ` key_name ` ` . <nl> <nl> - : data : ` snapshot ` <nl> + ` ` snapshot ` ` <nl> | snapshot | <nl> <nl> . . function : : FDBFuture * fdb_transaction_get_key ( FDBTransaction * transaction , uint8_t const * key_name , int key_name_length , fdb_bool_t or_equal , int offset , fdb_bool_t snapshot ) <nl> <nl> - Resolves a : ref : ` key selector < key - selectors > ` against the keys in the database snapshot represented by : data : ` transaction ` . <nl> + Resolves a : ref : ` key selector < key - selectors > ` against the keys in the database snapshot represented by ` ` transaction ` ` . <nl> <nl> | future - return0 | the key in the database matching the : ref : ` key selector < key - selectors > ` . | future - return1 | call : func : ` fdb_future_get_key ( ) ` to extract the key , | future - return2 | <nl> <nl> - : data : ` key_name ` , : data : ` key_name_length ` , : data : ` or_equal ` , : data : ` offset ` <nl> + ` ` key_name ` ` , ` ` key_name_length ` ` , ` ` or_equal ` ` , ` ` offset ` ` <nl> The four components of a : ref : ` key selector < key - selectors > ` . <nl> <nl> - : data : ` snapshot ` <nl> + ` ` snapshot ` ` <nl> | snapshot | <nl> <nl> . . function : : FDBFuture * fdb_transaction_get_addresses_for_key ( FDBTransaction * transaction , uint8_t const * key_name , int key_name_length ) <nl> <nl> - Returns a list of public network addresses as strings , one for each of the storage servers responsible for storing : data : ` key_name ` and its associated value . <nl> + Returns a list of public network addresses as strings , one for each of the storage servers responsible for storing ` ` key_name ` ` and its associated value . <nl> <nl> | future - return0 | an array of strings . | future - return1 | call : func : ` fdb_future_get_string_array ( ) ` to extract the string array , | future - return2 | <nl> <nl> - : data : ` key_name ` <nl> + ` ` key_name ` ` <nl> A pointer to the name of the key whose location is to be queried . <nl> <nl> - : data : ` key_name_length ` <nl> - | length - of | : data : ` key_name ` . <nl> + ` ` key_name_length ` ` <nl> + | length - of | ` ` key_name ` ` . <nl> <nl> - . . | range - limited - by | replace : : If this limit was reached before the end of the specified range , then the : data : ` * more ` return of : func : ` fdb_future_get_keyvalue_array ( ) ` will be set to a non - zero value . <nl> + . . | range - limited - by | replace : : If this limit was reached before the end of the specified range , then the ` ` * more ` ` return of : func : ` fdb_future_get_keyvalue_array ( ) ` will be set to a non - zero value . <nl> <nl> . . function : : FDBFuture * fdb_transaction_get_range ( FDBTransaction * transaction , uint8_t const * begin_key_name , int begin_key_name_length , fdb_bool_t begin_or_equal , int begin_offset , uint8_t const * end_key_name , int end_key_name_length , fdb_bool_t end_or_equal , int end_offset , int limit , int target_bytes , FDBStreamingMode mode , int iteration , fdb_bool_t snapshot , fdb_bool_t reverse ) <nl> <nl> - Reads all key - value pairs in the database snapshot represented by : data : ` transaction ` ( potentially limited by : data : ` limit ` , : data : ` target_bytes ` , or : data : ` mode ` ) which have a key lexicographically greater than or equal to the key resolved by the begin : ref : ` key selector < key - selectors > ` and lexicographically less than the key resolved by the end : ref : ` key selector < key - selectors > ` . <nl> + Reads all key - value pairs in the database snapshot represented by ` ` transaction ` ` ( potentially limited by : data : ` limit ` , : data : ` target_bytes ` , or : data : ` mode ` ) which have a key lexicographically greater than or equal to the key resolved by the begin : ref : ` key selector < key - selectors > ` and lexicographically less than the key resolved by the end : ref : ` key selector < key - selectors > ` . <nl> <nl> | future - return0 | an : type : ` FDBKeyValue ` array . | future - return1 | call : func : ` fdb_future_get_keyvalue_array ( ) ` to extract the key - value array , | future - return2 | <nl> <nl> - : data : ` begin_key_name ` , : data : ` begin_key_name_length ` , : data : ` begin_or_equal ` , : data : ` begin_offset ` <nl> + ` ` begin_key_name ` ` , : data : ` begin_key_name_length ` , : data : ` begin_or_equal ` , : data : ` begin_offset ` <nl> The four components of a : ref : ` key selector < key - selectors > ` describing the beginning of the range . <nl> <nl> - : data : ` end_key_name ` , : data : ` end_key_name_length ` , : data : ` end_or_equal ` , : data : ` end_offset ` <nl> + ` ` end_key_name ` ` , : data : ` end_key_name_length ` , : data : ` end_or_equal ` , : data : ` end_offset ` <nl> The four components of a : ref : ` key selector < key - selectors > ` describing the end of the range . <nl> <nl> - : data : ` limit ` <nl> + ` ` limit ` ` <nl> If non - zero , indicates the maximum number of key - value pairs to return . | range - limited - by | <nl> <nl> - : data : ` target_bytes ` <nl> + ` ` target_bytes ` ` <nl> If non - zero , indicates a ( soft ) cap on the combined number of bytes of keys and values to return . | range - limited - by | <nl> <nl> - : data : ` mode ` <nl> + ` ` mode ` ` <nl> One of the : type : ` FDBStreamingMode ` values indicating how the caller would like the data in the range returned . <nl> <nl> - : data : ` iteration ` <nl> - If : data : ` mode ` is : data : ` FDB_STREAMING_MODE_ITERATOR ` , this parameter should start at 1 and be incremented by 1 for each successive call while reading this range . In all other cases it is ignored . <nl> + ` ` iteration ` ` <nl> + If ` ` mode ` ` is : data : ` FDB_STREAMING_MODE_ITERATOR ` , this parameter should start at 1 and be incremented by 1 for each successive call while reading this range . In all other cases it is ignored . <nl> <nl> - : data : ` snapshot ` <nl> + ` ` snapshot ` ` <nl> | snapshot | <nl> <nl> - : data : ` reverse ` <nl> + ` ` reverse ` ` <nl> <nl> If non - zero , key - value pairs will be returned in reverse lexicographical order beginning at the end of the range . <nl> <nl> Applications must provide error handling and an appropriate retry loop around th <nl> <nl> An enumeration of available streaming modes to be passed to : func : ` fdb_transaction_get_range ( ) ` . <nl> <nl> - : data : ` FDB_STREAMING_MODE_ITERATOR ` <nl> + ` ` FDB_STREAMING_MODE_ITERATOR ` ` <nl> <nl> - The caller is implementing an iterator ( most likely in a binding to a higher level language ) . The amount of data returned depends on the value of the : data : ` iteration ` parameter to : func : ` fdb_transaction_get_range ( ) ` . <nl> + The caller is implementing an iterator ( most likely in a binding to a higher level language ) . The amount of data returned depends on the value of the ` ` iteration ` ` parameter to : func : ` fdb_transaction_get_range ( ) ` . <nl> <nl> - : data : ` FDB_STREAMING_MODE_SMALL ` <nl> + ` ` FDB_STREAMING_MODE_SMALL ` ` <nl> <nl> Data is returned in small batches ( not much more expensive than reading individual key - value pairs ) . <nl> <nl> - : data : ` FDB_STREAMING_MODE_MEDIUM ` <nl> + ` ` FDB_STREAMING_MODE_MEDIUM ` ` <nl> <nl> Data is returned in batches between _SMALL and _LARGE . <nl> <nl> - : data : ` FDB_STREAMING_MODE_LARGE ` <nl> + ` ` FDB_STREAMING_MODE_LARGE ` ` <nl> <nl> Data is returned in batches large enough to be , in a high - concurrency environment , nearly as efficient as possible . If the caller does not need the entire range , some disk and network bandwidth may be wasted . The batch size may be still be too small to allow a single client to get high throughput from the database . <nl> <nl> - : data : ` FDB_STREAMING_MODE_SERIAL ` <nl> + ` ` FDB_STREAMING_MODE_SERIAL ` ` <nl> <nl> Data is returned in batches large enough that an individual client can get reasonable read bandwidth from the database . If the caller does not need the entire range , considerable disk and network bandwidth may be wasted . <nl> <nl> - : data : ` FDB_STREAMING_MODE_WANT_ALL ` <nl> + ` ` FDB_STREAMING_MODE_WANT_ALL ` ` <nl> <nl> The caller intends to consume the entire range and would like it all transferred as early as possible . <nl> <nl> - : data : ` FDB_STREAMING_MODE_EXACT ` <nl> + ` ` FDB_STREAMING_MODE_EXACT ` ` <nl> <nl> The caller has passed a specific row limit and wants that many rows delivered in a single batch . <nl> <nl> Applications must provide error handling and an appropriate retry loop around th <nl> <nl> | sets - and - clears2 | <nl> <nl> - : data : ` key_name ` <nl> + ` ` key_name ` ` <nl> A pointer to the name of the key to be inserted into the database . | no - null | <nl> <nl> - : data : ` key_name_length ` <nl> - | length - of | : data : ` key_name ` . <nl> + ` ` key_name_length ` ` <nl> + | length - of | ` ` key_name ` ` . <nl> <nl> - : data : ` value ` <nl> + ` ` value ` ` <nl> A pointer to the value to be inserted into the database . | no - null | <nl> <nl> - : data : ` value_length ` <nl> - | length - of | : data : ` value ` . <nl> + ` ` value_length ` ` <nl> + | length - of | ` ` value ` ` . <nl> <nl> . . function : : void fdb_transaction_clear ( FDBTransaction * transaction , uint8_t const * key_name , int key_name_length ) <nl> <nl> Applications must provide error handling and an appropriate retry loop around th <nl> <nl> | sets - and - clears2 | <nl> <nl> - : data : ` key_name ` <nl> + ` ` key_name ` ` <nl> A pointer to the name of the key to be removed from the database . | no - null | <nl> <nl> - : data : ` key_name_length ` <nl> - | length - of | : data : ` key_name ` . <nl> + ` ` key_name_length ` ` <nl> + | length - of | ` ` key_name ` ` . <nl> <nl> . . function : : void fdb_transaction_clear_range ( FDBTransaction * transaction , uint8_t const * begin_key_name , int begin_key_name_length , uint8_t const * end_key_name , int end_key_name_length ) <nl> <nl> Applications must provide error handling and an appropriate retry loop around th <nl> <nl> | sets - and - clears2 | <nl> <nl> - : data : ` begin_key_name ` <nl> + ` ` begin_key_name ` ` <nl> A pointer to the name of the key specifying the beginning of the range to clear . | no - null | <nl> <nl> - : data : ` begin_key_name_length ` <nl> - | length - of | : data : ` begin_key_name ` . <nl> + ` ` begin_key_name_length ` ` <nl> + | length - of | ` ` begin_key_name ` ` . <nl> <nl> - : data : ` end_key_name ` <nl> + ` ` end_key_name ` ` <nl> A pointer to the name of the key specifying the end of the range to clear . | no - null | <nl> <nl> - : data : ` end_key_name_length ` <nl> - | length - of | : data : ` end_key_name_length ` . <nl> + ` ` end_key_name_length ` ` <nl> + | length - of | ` ` end_key_name_length ` ` . <nl> <nl> . . function : : void fdb_transaction_atomic_op ( FDBTransaction * transaction , uint8_t const * key_name , int key_name_length , uint8_t const * param , int param_length , FDBMutationType operationType ) <nl> <nl> Applications must provide error handling and an appropriate retry loop around th <nl> <nl> | sets - and - clears2 | <nl> <nl> - : data : ` key_name ` <nl> + ` ` key_name ` ` <nl> A pointer to the name of the key whose value is to be mutated . <nl> <nl> - : data : ` key_name_length ` <nl> - | length - of | : data : ` key_name ` . <nl> + ` ` key_name_length ` ` <nl> + | length - of | ` ` key_name ` ` . <nl> <nl> - : data : ` param ` <nl> - A pointer to the parameter with which the atomic operation will mutate the value associated with : data : ` key_name ` . <nl> + ` ` param ` ` <nl> + A pointer to the parameter with which the atomic operation will mutate the value associated with ` ` key_name ` ` . <nl> <nl> - : data : ` param_length ` <nl> - | length - of | : data : ` param ` . <nl> + ` ` param_length ` ` <nl> + | length - of | ` ` param ` ` . <nl> <nl> - : data : ` operation_type ` <nl> + ` ` operation_type ` ` <nl> One of the : type : ` FDBMutationType ` values indicating which operation should be performed . <nl> <nl> . . type : : FDBMutationType <nl> <nl> An enumeration of available opcodes to be passed to : func : ` fdb_transaction_atomic_op ( ) ` <nl> <nl> - : data : ` FDB_MUTATION_TYPE_ADD ` <nl> + ` ` FDB_MUTATION_TYPE_ADD ` ` <nl> <nl> | atomic - add1 | <nl> <nl> | atomic - add2 | <nl> <nl> - : data : ` FDB_MUTATION_TYPE_AND ` <nl> + ` ` FDB_MUTATION_TYPE_AND ` ` <nl> <nl> | atomic - and | <nl> <nl> - : data : ` FDB_MUTATION_TYPE_OR ` <nl> + ` ` FDB_MUTATION_TYPE_OR ` ` <nl> <nl> | atomic - or | <nl> <nl> - : data : ` FDB_MUTATION_TYPE_XOR ` <nl> + ` ` FDB_MUTATION_TYPE_XOR ` ` <nl> <nl> | atomic - xor | <nl> <nl> - : data : ` FDB_MUTATION_TYPE_MAX ` <nl> + ` ` FDB_MUTATION_TYPE_MAX ` ` <nl> <nl> | atomic - max1 | <nl> <nl> | atomic - max - min | <nl> <nl> - : data : ` FDB_MUTATION_TYPE_BYTE_MAX ` <nl> + ` ` FDB_MUTATION_TYPE_BYTE_MAX ` ` <nl> <nl> | atomic - byte - max | <nl> <nl> - : data : ` FDB_MUTATION_TYPE_MIN ` <nl> + ` ` FDB_MUTATION_TYPE_MIN ` ` <nl> <nl> | atomic - min1 | <nl> <nl> | atomic - max - min | <nl> <nl> - : data : ` FDB_MUTATION_TYPE_BYTE_MIN ` <nl> + ` ` FDB_MUTATION_TYPE_BYTE_MIN ` ` <nl> <nl> | atomic - byte - min | <nl> <nl> - : data : ` FDB_MUTATION_TYPE_SET_VERSIONSTAMPED_KEY ` <nl> + ` ` FDB_MUTATION_TYPE_SET_VERSIONSTAMPED_KEY ` ` <nl> <nl> | atomic - set - versionstamped - key - 1 | <nl> <nl> Applications must provide error handling and an appropriate retry loop around th <nl> <nl> . . warning : : | atomic - versionstamps - tuple - warning - key | <nl> <nl> - : data : ` FDB_MUTATION_TYPE_SET_VERSIONSTAMPED_VALUE ` <nl> + ` ` FDB_MUTATION_TYPE_SET_VERSIONSTAMPED_VALUE ` ` <nl> <nl> | atomic - set - versionstamped - value | <nl> <nl> Applications must provide error handling and an appropriate retry loop around th <nl> <nl> . . function : : FDBFuture * fdb_transaction_commit ( FDBTransaction * transaction ) <nl> <nl> - Attempts to commit the sets and clears previously applied to the database snapshot represented by : data : ` transaction ` to the actual database . The commit may or may not succeed - - in particular , if a conflicting transaction previously committed , then the commit must fail in order to preserve transactional isolation . If the commit does succeed , the transaction is durably committed to the database and all subsequently started transactions will observe its effects . <nl> + Attempts to commit the sets and clears previously applied to the database snapshot represented by ` ` transaction ` ` to the actual database . The commit may or may not succeed - - in particular , if a conflicting transaction previously committed , then the commit must fail in order to preserve transactional isolation . If the commit does succeed , the transaction is durably committed to the database and all subsequently started transactions will observe its effects . <nl> <nl> It is not necessary to commit a read - only transaction - - you can simply call : func : ` fdb_transaction_destroy ( ) ` . <nl> <nl> Applications must provide error handling and an appropriate retry loop around th <nl> <nl> . . function : : fdb_error_t fdb_transaction_get_committed_version ( FDBTransaction * transaction , int64_t * out_version ) <nl> <nl> - Retrieves the database version number at which a given transaction was committed . : func : ` fdb_transaction_commit ( ) ` must have been called on : data : ` transaction ` and the resulting future must be ready and not an error before this function is called , or the behavior is undefined . Read - only transactions do not modify the database when committed and will have a committed version of - 1 . Keep in mind that a transaction which reads keys and then sets them to their current values may be optimized to a read - only transaction . <nl> + Retrieves the database version number at which a given transaction was committed . : func : ` fdb_transaction_commit ( ) ` must have been called on ` ` transaction ` ` and the resulting future must be ready and not an error before this function is called , or the behavior is undefined . Read - only transactions do not modify the database when committed and will have a committed version of - 1 . Keep in mind that a transaction which reads keys and then sets them to their current values may be optimized to a read - only transaction . <nl> <nl> Note that database versions are not necessarily unique to a given transaction and so cannot be used to determine in what order two transactions completed . The only use for this function is to manually enforce causal consistency when calling : func : ` fdb_transaction_set_read_version ( ) ` on another subsequent transaction . <nl> <nl> Applications must provide error handling and an appropriate retry loop around th <nl> <nl> | transaction - watch - limit - blurb | <nl> <nl> - : data : ` key_name ` <nl> + ` ` key_name ` ` <nl> A pointer to the name of the key to watch . | no - null | <nl> <nl> - : data : ` key_name_length ` <nl> - | length - of | : data : ` key_name ` . <nl> + ` ` key_name_length ` ` <nl> + | length - of | ` ` key_name ` ` . <nl> <nl> <nl> . . function : : FDBFuture * fdb_transaction_on_error ( FDBTransaction * transaction , fdb_error_t error ) <nl> Applications must provide error handling and an appropriate retry loop around th <nl> <nl> . . function : : void fdb_transaction_reset ( FDBTransaction * transaction ) <nl> <nl> - Reset : data : ` transaction ` to its initial state . This is similar to calling : func : ` fdb_transaction_destroy ( ) ` followed by : func : ` fdb_database_create_transaction ( ) ` . It is not necessary to call : func : ` fdb_transaction_reset ( ) ` when handling an error with : func : ` fdb_transaction_on_error ( ) ` since the transaction has already been reset . <nl> + Reset ` ` transaction ` ` to its initial state . This is similar to calling : func : ` fdb_transaction_destroy ( ) ` followed by : func : ` fdb_database_create_transaction ( ) ` . It is not necessary to call : func : ` fdb_transaction_reset ( ) ` when handling an error with : func : ` fdb_transaction_on_error ( ) ` since the transaction has already been reset . <nl> <nl> . . function : : void fdb_transaction_cancel ( FDBTransaction * transaction ) <nl> <nl> Applications must provide error handling and an appropriate retry loop around th <nl> <nl> . . note : : | conflict - range - note | <nl> <nl> - : data : ` begin_key_name ` <nl> + ` ` begin_key_name ` ` <nl> A pointer to the name of the key specifying the beginning of the conflict range . | no - null | <nl> <nl> - : data : ` begin_key_name_length ` <nl> - | length - of | : data : ` begin_key_name ` . <nl> + ` ` begin_key_name_length ` ` <nl> + | length - of | ` ` begin_key_name ` ` . <nl> <nl> - : data : ` end_key_name ` <nl> + ` ` end_key_name ` ` <nl> A pointer to the name of the key specifying the end of the conflict range . | no - null | <nl> <nl> - : data : ` end_key_name_length ` <nl> - | length - of | : data : ` end_key_name_length ` . <nl> + ` ` end_key_name_length ` ` <nl> + | length - of | ` ` end_key_name_length ` ` . <nl> <nl> - : data : ` type ` <nl> + ` ` type ` ` <nl> One of the : type : ` FDBConflictRangeType ` values indicating what type of conflict range is being set . <nl> <nl> . . type : : FDBConflictRangeType <nl> <nl> An enumeration of available conflict range types to be passed to : func : ` fdb_transaction_add_conflict_range ( ) ` . <nl> <nl> - : data : ` FDB_CONFLICT_RANGE_TYPE_READ ` <nl> + ` ` FDB_CONFLICT_RANGE_TYPE_READ ` ` <nl> <nl> | add - read - conflict - range - blurb | <nl> <nl> - : data : ` FDB_CONFLICT_RANGE_TYPE_WRITE ` <nl> + ` ` FDB_CONFLICT_RANGE_TYPE_WRITE ` ` <nl> <nl> | add - write - conflict - range - blurb | <nl> <nl> mmm a / documentation / sphinx / source / api - ruby . rst <nl> ppp b / documentation / sphinx / source / api - ruby . rst <nl> <nl> . . | snapshot - ryw - disable - database - option | replace : : : meth : ` Database . options . set_snapshot_ryw_disable ` <nl> . . | future - type - string | replace : : a : class : ` Future ` <nl> . . | read - your - writes - disable - option | replace : : : meth : ` Transaction . options . set_read_your_writes_disable ` <nl> - . . | read - your - writes - disable - option | replace : : : meth : ` Transaction . options . set_read_your_writes_disable ` <nl> . . | retry - limit - transaction - option | replace : : : meth : ` Transaction . options . set_retry_limit ` <nl> . . | timeout - transaction - option | replace : : : meth : ` Transaction . options . set_timeout ` <nl> . . | max - retry - delay - transaction - option | replace : : : meth : ` Transaction . options . set_max_retry_delay ` <nl> mmm a / documentation / sphinx / source / backups . rst <nl> ppp b / documentation / sphinx / source / backups . rst <nl> The ` ` start ` ` subcommand is used to start a backup . If there is already a backu <nl> . . program : : fdbbackup modify <nl> <nl> ` ` modify ` ` <nl> mmmmmmmmm - <nl> + mmmmmmmmm - <nl> <nl> The ` ` modify ` ` subcommand is used to modify parameters of a running backup . All specified changes are made in a single transaction . <nl> <nl> mmm a / documentation / sphinx / source / data - modeling . rst <nl> ppp b / documentation / sphinx / source / data - modeling . rst <nl> <nl> . . | node - subspace | replace : : FIXME <nl> . . | content - subspace | replace : : FIXME <nl> . . | allow - manual - prefixes | replace : : FIXME <nl> + . . | retry - limit - transaction - option | replace : : FIXME <nl> + . . | timeout - transaction - option | replace : : FIXME <nl> + . . | max - retry - delay - transaction - option | replace : : FIXME <nl> + . . | snapshot - ryw - enable - transaction - option | replace : : FIXME <nl> + . . | snapshot - ryw - disable - transaction - option | replace : : FIXME <nl> + . . | snapshot - ryw - enable - database - option | replace : : FIXME <nl> + . . | snapshot - ryw - disable - database - option | replace : : FIXME <nl> + . . | retry - limit - database - option | replace : : FIXME <nl> + . . | max - retry - delay - database - option | replace : : FIXME <nl> + . . | timeout - database - option | replace : : FIXME <nl> <nl> . . include : : api - common . rst . inc <nl> <nl> mmm a / documentation / sphinx / source / developer - guide . rst <nl> ppp b / documentation / sphinx / source / developer - guide . rst <nl> <nl> . . | node - subspace | replace : : FIXME <nl> . . | content - subspace | replace : : FIXME <nl> . . | allow - manual - prefixes | replace : : FIXME <nl> + . . | retry - limit - transaction - option | replace : : FIXME <nl> + . . | timeout - transaction - option | replace : : FIXME <nl> + . . | max - retry - delay - transaction - option | replace : : FIXME <nl> + . . | snapshot - ryw - enable - transaction - option | replace : : FIXME <nl> + . . | snapshot - ryw - disable - transaction - option | replace : : FIXME <nl> + . . | snapshot - ryw - enable - database - option | replace : : FIXME <nl> + . . | snapshot - ryw - disable - database - option | replace : : FIXME <nl> + . . | retry - limit - database - option | replace : : FIXME <nl> + . . | max - retry - delay - database - option | replace : : FIXME <nl> + . . | timeout - database - option | replace : : FIXME <nl> <nl> . . include : : api - common . rst . inc <nl> <nl> mmm a / documentation / sphinx / source / downloads . rst <nl> ppp b / documentation / sphinx / source / downloads . rst <nl> macOS <nl> <nl> The macOS installation package is supported on macOS 10 . 7 + . It includes the client and ( optionally ) the server . <nl> <nl> - * ` FoundationDB - 6 . 1 . 7 . pkg < https : / / www . foundationdb . org / downloads / 6 . 1 . 7 / macOS / installers / FoundationDB - 6 . 1 . 7 . pkg > ` _ <nl> + * ` FoundationDB - 6 . 1 . 8 . pkg < https : / / www . foundationdb . org / downloads / 6 . 1 . 8 / macOS / installers / FoundationDB - 6 . 1 . 8 . pkg > ` _ <nl> <nl> Ubuntu <nl> mmmmmm <nl> <nl> The Ubuntu packages are supported on 64 - bit Ubuntu 12 . 04 + , but beware of the Linux kernel bug in Ubuntu 12 . x . <nl> <nl> - * ` foundationdb - clients - 6 . 1 . 7 - 1_amd64 . deb < https : / / www . foundationdb . org / downloads / 6 . 1 . 7 / ubuntu / installers / foundationdb - clients_6 . 1 . 7 - 1_amd64 . deb > ` _ <nl> - * ` foundationdb - server - 6 . 1 . 7 - 1_amd64 . deb < https : / / www . foundationdb . org / downloads / 6 . 1 . 7 / ubuntu / installers / foundationdb - server_6 . 1 . 7 - 1_amd64 . deb > ` _ ( depends on the clients package ) <nl> + * ` foundationdb - clients - 6 . 1 . 8 - 1_amd64 . deb < https : / / www . foundationdb . org / downloads / 6 . 1 . 8 / ubuntu / installers / foundationdb - clients_6 . 1 . 7 - 1_amd64 . deb > ` _ <nl> + * ` foundationdb - server - 6 . 1 . 8 - 1_amd64 . deb < https : / / www . foundationdb . org / downloads / 6 . 1 . 8 / ubuntu / installers / foundationdb - server_6 . 1 . 7 - 1_amd64 . deb > ` _ ( depends on the clients package ) <nl> <nl> RHEL / CentOS EL6 <nl> mmmmmmmmmmmmmmm <nl> <nl> The RHEL / CentOS EL6 packages are supported on 64 - bit RHEL / CentOS 6 . x . <nl> <nl> - * ` foundationdb - clients - 6 . 1 . 7 - 1 . el6 . x86_64 . rpm < https : / / www . foundationdb . org / downloads / 6 . 1 . 7 / rhel6 / installers / foundationdb - clients - 6 . 1 . 7 - 1 . el6 . x86_64 . rpm > ` _ <nl> - * ` foundationdb - server - 6 . 1 . 7 - 1 . el6 . x86_64 . rpm < https : / / www . foundationdb . org / downloads / 6 . 1 . 7 / rhel6 / installers / foundationdb - server - 6 . 1 . 7 - 1 . el6 . x86_64 . rpm > ` _ ( depends on the clients package ) <nl> + * ` foundationdb - clients - 6 . 1 . 8 - 1 . el6 . x86_64 . rpm < https : / / www . foundationdb . org / downloads / 6 . 1 . 8 / rhel6 / installers / foundationdb - clients - 6 . 1 . 8 - 1 . el6 . x86_64 . rpm > ` _ <nl> + * ` foundationdb - server - 6 . 1 . 8 - 1 . el6 . x86_64 . rpm < https : / / www . foundationdb . org / downloads / 6 . 1 . 8 / rhel6 / installers / foundationdb - server - 6 . 1 . 8 - 1 . el6 . x86_64 . rpm > ` _ ( depends on the clients package ) <nl> <nl> RHEL / CentOS EL7 <nl> mmmmmmmmmmmmmmm <nl> <nl> The RHEL / CentOS EL7 packages are supported on 64 - bit RHEL / CentOS 7 . x . <nl> <nl> - * ` foundationdb - clients - 6 . 1 . 7 - 1 . el7 . x86_64 . rpm < https : / / www . foundationdb . org / downloads / 6 . 1 . 7 / rhel7 / installers / foundationdb - clients - 6 . 1 . 7 - 1 . el7 . x86_64 . rpm > ` _ <nl> - * ` foundationdb - server - 6 . 1 . 7 - 1 . el7 . x86_64 . rpm < https : / / www . foundationdb . org / downloads / 6 . 1 . 7 / rhel7 / installers / foundationdb - server - 6 . 1 . 7 - 1 . el7 . x86_64 . rpm > ` _ ( depends on the clients package ) <nl> + * ` foundationdb - clients - 6 . 1 . 8 - 1 . el7 . x86_64 . rpm < https : / / www . foundationdb . org / downloads / 6 . 1 . 8 / rhel7 / installers / foundationdb - clients - 6 . 1 . 8 - 1 . el7 . x86_64 . rpm > ` _ <nl> + * ` foundationdb - server - 6 . 1 . 8 - 1 . el7 . x86_64 . rpm < https : / / www . foundationdb . org / downloads / 6 . 1 . 8 / rhel7 / installers / foundationdb - server - 6 . 1 . 8 - 1 . el7 . x86_64 . rpm > ` _ ( depends on the clients package ) <nl> <nl> Windows <nl> mmmmmm - <nl> <nl> The Windows installer is supported on 64 - bit Windows XP and later . It includes the client and ( optionally ) the server . <nl> <nl> - * ` foundationdb - 6 . 1 . 7 - x64 . msi < https : / / www . foundationdb . org / downloads / 6 . 1 . 7 / windows / installers / foundationdb - 6 . 1 . 7 - x64 . msi > ` _ <nl> + * ` foundationdb - 6 . 1 . 8 - x64 . msi < https : / / www . foundationdb . org / downloads / 6 . 1 . 8 / windows / installers / foundationdb - 6 . 1 . 8 - x64 . msi > ` _ <nl> <nl> API Language Bindings <nl> = = = = = = = = = = = = = = = = = = = = = <nl> On macOS and Windows , the FoundationDB Python API bindings are installed as part <nl> <nl> If you need to use the FoundationDB Python API from other Python installations or paths , download the Python package : <nl> <nl> - * ` foundationdb - 6 . 1 . 7 . tar . gz < https : / / www . foundationdb . org / downloads / 6 . 1 . 7 / bindings / python / foundationdb - 6 . 1 . 7 . tar . gz > ` _ <nl> + * ` foundationdb - 6 . 1 . 8 . tar . gz < https : / / www . foundationdb . org / downloads / 6 . 1 . 8 / bindings / python / foundationdb - 6 . 1 . 8 . tar . gz > ` _ <nl> <nl> Ruby 1 . 9 . 3 / 2 . 0 . 0 + <nl> mmmmmmmmmmmmmmm - - <nl> <nl> - * ` fdb - 6 . 1 . 7 . gem < https : / / www . foundationdb . org / downloads / 6 . 1 . 7 / bindings / ruby / fdb - 6 . 1 . 7 . gem > ` _ <nl> + * ` fdb - 6 . 1 . 8 . gem < https : / / www . foundationdb . org / downloads / 6 . 1 . 8 / bindings / ruby / fdb - 6 . 1 . 8 . gem > ` _ <nl> <nl> Java 8 + <nl> mmmmmm - <nl> <nl> - * ` fdb - java - 6 . 1 . 7 . jar < https : / / www . foundationdb . org / downloads / 6 . 1 . 7 / bindings / java / fdb - java - 6 . 1 . 7 . jar > ` _ <nl> - * ` fdb - java - 6 . 1 . 7 - javadoc . jar < https : / / www . foundationdb . org / downloads / 6 . 1 . 7 / bindings / java / fdb - java - 6 . 1 . 7 - javadoc . jar > ` _ <nl> + * ` fdb - java - 6 . 1 . 8 . jar < https : / / www . foundationdb . org / downloads / 6 . 1 . 8 / bindings / java / fdb - java - 6 . 1 . 8 . jar > ` _ <nl> + * ` fdb - java - 6 . 1 . 8 - javadoc . jar < https : / / www . foundationdb . org / downloads / 6 . 1 . 8 / bindings / java / fdb - java - 6 . 1 . 8 - javadoc . jar > ` _ <nl> <nl> Go 1 . 11 + <nl> mmmmmm - <nl> mmm a / documentation / sphinx / source / mr - status - json - schemas . rst . inc <nl> ppp b / documentation / sphinx / source / mr - status - json - schemas . rst . inc <nl> <nl> . . - * - mode : rst ; - * - <nl> <nl> - . . | json - status - format | replace : : <nl> + . . code - block : : javascript <nl> + <nl> " cluster " : { <nl> " layers " : { <nl> " _valid " : true , <nl> mmm a / documentation / sphinx / source / mr - status . rst <nl> ppp b / documentation / sphinx / source / mr - status . rst <nl> JSON format <nl> <nl> The following format informally describes the JSON containing the status data . The possible values of ` ` < name_string > ` ` and ` ` < description_string > ` ` are described in : ref : ` mr - status - message ` . The format is representative : * any field can be missing at any time * , depending on the database state . Clients should be prepared to flexibly handle format variations resulting from different database states . <nl> <nl> - . . code - block : : javascript <nl> . . include : : mr - status - json - schemas . rst . inc <nl> <nl> - . . node : : | json - status - format | <nl> - <nl> - . . mr - status - message : <nl> + . . _mr - status - message : <nl> <nl> Message components <nl> mmmmmmmmmmmmmmmmmm <nl> cluster . processes . < process > . messages incorrect_cluster_file_contents Clus <nl> cluster . processes . < process > . messages io_error < error > occured in < subsystem > <nl> cluster . processes . < process > . messages platform_error < error > occured in < subsystem > <nl> cluster . processes . < process > . messages process_error < error > occured in < subsystem > <nl> - = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = <nl> + = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = <nl> <nl> The JSON path ` ` cluster . recovery_state ` ` , when it exists , is an Object containing at least ` ` " name " ` ` and ` ` " description " ` ` . The possible values for those fields are in the following table : <nl> <nl> mmm a / documentation / sphinx / source / old - release - notes / release - notes - 600 . rst <nl> ppp b / documentation / sphinx / source / old - release - notes / release - notes - 600 . rst <nl> Bindings <nl> * C API calls made on the network thread could be reordered with calls made from other threads . [ 6 . 0 . 2 ] ` ( Issue # 518 ) < https : / / github . com / apple / foundationdb / issues / 518 > ` _ <nl> * The TLS_PLUGIN option is now a no - op and has been deprecated . [ 6 . 0 . 10 ] ` ( PR # 710 ) < https : / / github . com / apple / foundationdb / pull / 710 > ` _ <nl> * Java : the ` Versionstamp : : getUserVersion ( ) < / javadoc / com / apple / foundationdb / tuple / Versionstamp . html # getUserVersion - - > ` _ method did not handle user versions greater than ` ` 0x00FF ` ` due to operator precedence errors . [ 6 . 0 . 11 ] ` ( Issue # 761 ) < https : / / github . com / apple / foundationdb / issues / 761 > ` _ <nl> - * Python : bindings didn ' t work with Python 3 . 7 because of the new ` async ` keyword . [ 6 . 0 . 13 ] ` ( Issue # 830 ) < https : / / github . com / apple / foundationdb / issues / 830 > ` _ <nl> - * Go : ` PrefixRange ` didn ' t correctly return an error if it failed to generate the range . [ 6 . 0 . 15 ] ` ( PR # 878 ) < https : / / github . com / apple / foundationdb / pull / 878 > ` _ <nl> - * Go : Add Tuple layer support for ` uint ` , ` uint64 ` , and ` * big . Int ` integers up to 255 bytes . Integer values will be decoded into the first of ` int64 ` , ` uint64 ` , or ` * big . Int ` in which they fit . ` ( PR # 915 ) < https : / / github . com / apple / foundationdb / pull / 915 > ` _ [ 6 . 0 . 15 ] <nl> + * Python : bindings didn ' t work with Python 3 . 7 because of the new ` ` async ` ` keyword . [ 6 . 0 . 13 ] ` ( Issue # 830 ) < https : / / github . com / apple / foundationdb / issues / 830 > ` _ <nl> + * Go : ` ` PrefixRange ` ` didn ' t correctly return an error if it failed to generate the range . [ 6 . 0 . 15 ] ` ( PR # 878 ) < https : / / github . com / apple / foundationdb / pull / 878 > ` _ <nl> + * Go : Add Tuple layer support for ` ` uint ` ` , ` ` uint64 ` ` , and ` ` * big . Int ` ` integers up to 255 bytes . Integer values will be decoded into the first of ` ` int64 ` ` , ` ` uint64 ` ` , or ` ` * big . Int ` ` in which they fit . ` ( PR # 915 ) < https : / / github . com / apple / foundationdb / pull / 915 > ` _ [ 6 . 0 . 15 ] <nl> * Ruby : Add Tuple layer support for integers up to 255 bytes . ` ( PR # 915 ) < https : / / github . com / apple / foundationdb / pull / 915 > ` _ [ 6 . 0 . 15 ] <nl> * Python : bindings didn ' t work with Python 3 . 7 because of the new ` ` async ` ` keyword . [ 6 . 0 . 13 ] ` ( Issue # 830 ) < https : / / github . com / apple / foundationdb / issues / 830 > ` _ <nl> * Go : ` ` PrefixRange ` ` didn ' t correctly return an error if it failed to generate the range . [ 6 . 0 . 15 ] ` ( PR # 878 ) < https : / / github . com / apple / foundationdb / pull / 878 > ` _ <nl> mmm a / documentation / sphinx / source / old - release - notes / release - notes - 610 . rst <nl> ppp b / documentation / sphinx / source / old - release - notes / release - notes - 610 . rst <nl> <nl> Release Notes <nl> # # # # # # # # # # # # # <nl> <nl> - 6 . 1 . 7 <nl> + 6 . 1 . 8 <nl> = = = = = <nl> <nl> Features <nl> Features <nl> * Separated data distribution from the master into its own role . ` ( PR # 1062 ) < https : / / github . com / apple / foundationdb / pull / 1062 > ` _ <nl> * Separated ratekeeper from the master into its own role . ` ( PR # 1176 ) < https : / / github . com / apple / foundationdb / pull / 1176 > ` _ <nl> * Added a ` ` CompareAndClear ` ` atomic op that clears a key if its value matches the supplied value . ` ( PR # 1105 ) < https : / / github . com / apple / foundationdb / pull / 1105 > ` _ <nl> - * Added support for IPv6 . ` ( PR # 1176 ) < https : / / github . com / apple / foundationdb / pull / 1178 > ` _ <nl> + * Added support for IPv6 . ` ( PR # 1178 ) < https : / / github . com / apple / foundationdb / pull / 1178 > ` _ <nl> * FDB can now simultaneously listen to TLS and unencrypted ports to facilitate smoother migration to and from TLS . ` ( PR # 1157 ) < https : / / github . com / apple / foundationdb / pull / 1157 > ` _ <nl> * Added ` ` DISABLE_POSIX_KERNEL_AIO ` ` knob to fallback to libeio instead of kernel async I / O ( KAIO ) for systems that do not support KAIO or O_DIRECT flag . ` ( PR # 1283 ) < https : / / github . com / apple / foundationdb / pull / 1283 > ` _ <nl> * Added support for configuring the cluster to use the primary and remote DC ' s as satellites . ` ( PR # 1320 ) < https : / / github . com / apple / foundationdb / pull / 1320 > ` _ <nl> Fixes <nl> * The ` ` configure ` ` command in ` ` fdbcli ` ` returned successfully even when the configuration was not changed for some error types . [ 6 . 1 . 4 ] ` ( PR # 1509 ) < https : / / github . com / apple / foundationdb / pull / 1509 > ` _ <nl> * Safety protections in the ` ` configure ` ` command in ` ` fdbcli ` ` would trigger spuriously when changing between ` ` three_datacenter ` ` replication and a region configuration . [ 6 . 1 . 4 ] ` ( PR # 1509 ) < https : / / github . com / apple / foundationdb / pull / 1509 > ` _ <nl> * Status could report an incorrect reason for ongoing data movement . [ 6 . 1 . 5 ] ` ( PR # 1544 ) < https : / / github . com / apple / foundationdb / pull / 1544 > ` _ <nl> + * Storage servers were considered failed as soon as they were rebooted , instead of waiting to see if they rejoin the cluster . [ 6 . 1 . 8 ] ` ( PR # 1618 ) < https : / / github . com / apple / foundationdb / pull / 1618 > ` _ <nl> <nl> Status <nl> mmmmmm <nl> Fixes only impacting 6 . 1 . 0 + <nl> * TLogs will replace a large file with an empty file rather than doing a large truncate operation . [ 6 . 1 . 5 ] ` ( PR # 1545 ) < https : / / github . com / apple / foundationdb / pull / 1545 > ` _ <nl> * Fix PR # 1545 to work on Windows and Linux . [ 6 . 1 . 6 ] ` ( PR # 1556 ) < https : / / github . com / apple / foundationdb / pull / 1556 > ` _ <nl> * Adding a read conflict range for the metadata version key no longer requires read access to the system keys . [ 6 . 1 . 6 ] ` ( PR # 1556 ) < https : / / github . com / apple / foundationdb / pull / 1556 > ` _ <nl> + * The TLog ' s disk queue files would grow indefinitely after a storage server was removed from the cluster . [ 6 . 1 . 8 ] ` ( PR # 1617 ) < https : / / github . com / apple / foundationdb / pull / 1617 > ` _ <nl> <nl> Earlier release notes <nl> mmmmmmmmmmmmmmmmmmmmm <nl> Earlier release notes <nl> * : doc : ` Beta 2 ( API Version 22 ) < / old - release - notes / release - notes - 022 > ` <nl> * : doc : ` Beta 1 ( API Version 21 ) < / old - release - notes / release - notes - 021 > ` <nl> * : doc : ` Alpha 6 ( API Version 16 ) < / old - release - notes / release - notes - 016 > ` <nl> - * : doc : ` Alpha 5 ( API Version 14 ) < / old - release - notes / release - notes - 014 > ` <nl> \ No newline at end of file <nl> + * : doc : ` Alpha 5 ( API Version 14 ) < / old - release - notes / release - notes - 014 > ` <nl> mmm a / documentation / sphinx / source / time - series . rst <nl> ppp b / documentation / sphinx / source / time - series . rst <nl> <nl> - . . default - domain : : rb <nl> . . highlight : : ruby <nl> - . . module : : FDB <nl> <nl> # # # # # # # # # # # # # # # # <nl> Time - Series Data <nl> Ordering and Transactions <nl> <nl> FoundationDB β s ability to let you structure your data in different ways , keep track of metrics , and search it with varying granularity is a direct result of two key features of our key - value store : global ordering and ACID transactions . And as you β ve seen from the code included above , the direct impact of these properties is simpler application code and overall faster development . <nl> <nl> - Global ordering makes a big difference if you β re attempting to process significant amounts of sequential information because the database can retrieve that information quickly and efficiently . So rather than having to package your data into a single database object or broadcast a request for many individual data elements that correspond to a given range of application data ( e . g . time0 , time1 , time2 , . . . , timen ) , a globally ordered storage system , like FoundationDB , can generate a single range request to the database for the matching data . And internally , FoundationDB can further optimize requests by knowing which data resides on which machines , so there β s no need to broadcast the data request to all machines in the cluster . <nl> + Global ordering makes a big difference if you β re attempting to process significant amounts of sequential information because the database can retrieve that information quickly and efficiently . So rather than having to package your data into a single database object or broadcast a request for many individual data elements that correspond to a given range of application data ( e . g . time0 , time1 , time2 , . . . , timeN ) , a globally ordered storage system , like FoundationDB , can generate a single range request to the database for the matching data . And internally , FoundationDB can further optimize requests by knowing which data resides on which machines , so there β s no need to broadcast the data request to all machines in the cluster . <nl> <nl> Global indexing also makes a huge difference in terms of application complexity and database efficiency . Many non - relational databases provide node - specific indexing and secondary indexing , but if you wanted global indexes , you would have to build those at the application level to ensure the index and related data get updated atomically . <nl> <nl> mmm a / documentation / sphinx / source / tls . rst <nl> ppp b / documentation / sphinx / source / tls . rst <nl> Parameters and client bindings <nl> mmmmmmmmmmmmmmmmmmmmmmmmmmmmmm <nl> <nl> Automatic TLS certificate refresh <nl> mmmmmmmmmmmmmmmmmmmmmmmmmmmmmm - <nl> + mmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmm <nl> <nl> The TLS certificate will be automatically refreshed on a configurable cadence . The server will inspect the CA , certificate , and key files in the specified locations periodically , and will begin using the new versions if following criterion were met : <nl> <nl> mmm a / fdbserver / DataDistribution . actor . cpp <nl> ppp b / fdbserver / DataDistribution . actor . cpp <nl> ACTOR Future < Void > waitHealthyZoneChange ( DDTeamCollection * self ) { <nl> tr . setOption ( FDBTransactionOptions : : READ_SYSTEM_KEYS ) ; <nl> tr . setOption ( FDBTransactionOptions : : LOCK_AWARE ) ; <nl> Optional < Value > val = wait ( tr . get ( healthyZoneKey ) ) ; <nl> + state Future < Void > healthyZoneTimeout = Never ( ) ; <nl> if ( val . present ( ) ) { <nl> auto p = decodeHealthyZoneValue ( val . get ( ) ) ; <nl> if ( p . second > tr . getReadVersion ( ) . get ( ) ) { <nl> + healthyZoneTimeout = delay ( ( p . second - tr . getReadVersion ( ) . get ( ) ) / ( double ) SERVER_KNOBS - > VERSIONS_PER_SECOND ) ; <nl> self - > healthyZone . set ( p . first ) ; <nl> } else { <nl> self - > healthyZone . set ( Optional < Key > ( ) ) ; <nl> ACTOR Future < Void > waitHealthyZoneChange ( DDTeamCollection * self ) { <nl> } else { <nl> self - > healthyZone . set ( Optional < Key > ( ) ) ; <nl> } <nl> + <nl> state Future < Void > watchFuture = tr . watch ( healthyZoneKey ) ; <nl> wait ( tr . commit ( ) ) ; <nl> - wait ( watchFuture ) ; <nl> + wait ( watchFuture | | healthyZoneTimeout ) ; <nl> tr . reset ( ) ; <nl> } catch ( Error & e ) { <nl> wait ( tr . onError ( e ) ) ; <nl> ACTOR Future < Void > storageServerFailureTracker ( <nl> if ( status - > isFailed ) <nl> self - > restartRecruiting . trigger ( ) ; <nl> <nl> - state double startTime = now ( ) ; <nl> Future < Void > healthChanged = Never ( ) ; <nl> if ( status - > isFailed ) { <nl> ASSERT ( ! inHealthyZone ) ; <nl> healthChanged = IFailureMonitor : : failureMonitor ( ) . onStateEqual ( interf . waitFailure . getEndpoint ( ) , FailureStatus ( false ) ) ; <nl> } else if ( ! inHealthyZone ) { <nl> - healthChanged = waitFailureClient ( interf . waitFailure , SERVER_KNOBS - > DATA_DISTRIBUTION_FAILURE_REACTION_TIME , 0 , TaskDataDistribution ) ; <nl> + healthChanged = waitFailureClientStrict ( interf . waitFailure , SERVER_KNOBS - > DATA_DISTRIBUTION_FAILURE_REACTION_TIME , TaskDataDistribution ) ; <nl> } <nl> choose { <nl> when ( wait ( healthChanged ) ) { <nl> - double elapsed = now ( ) - startTime ; <nl> - if ( ! status - > isFailed & & elapsed < SERVER_KNOBS - > DATA_DISTRIBUTION_FAILURE_REACTION_TIME ) { <nl> - wait ( delay ( SERVER_KNOBS - > DATA_DISTRIBUTION_FAILURE_REACTION_TIME - elapsed ) ) ; <nl> - if ( ! IFailureMonitor : : failureMonitor ( ) . getState ( interf . waitFailure . getEndpoint ( ) ) . isFailed ( ) ) { <nl> - continue ; <nl> - } <nl> - } <nl> - <nl> status - > isFailed = ! status - > isFailed ; <nl> if ( ! status - > isFailed & & ! server - > teams . size ( ) ) { <nl> self - > doBuildTeams = true ; <nl> mmm a / fdbserver / OldTLogServer_6_0 . actor . cpp <nl> ppp b / fdbserver / OldTLogServer_6_0 . actor . cpp <nl> struct LogData : NonCopyable , public ReferenceCounted < LogData > { <nl> specialCounter ( cc , " PersistentDataVersion " , [ this ] ( ) { return this - > persistentDataVersion ; } ) ; <nl> specialCounter ( cc , " PersistentDataDurableVersion " , [ this ] ( ) { return this - > persistentDataDurableVersion ; } ) ; <nl> specialCounter ( cc , " KnownCommittedVersion " , [ this ] ( ) { return this - > knownCommittedVersion ; } ) ; <nl> + specialCounter ( cc , " QueuePoppedVersion " , [ this ] ( ) { return this - > persistentDataDurableVersion ; } ) ; <nl> specialCounter ( cc , " SharedBytesInput " , [ tLogData ] ( ) { return tLogData - > bytesInput ; } ) ; <nl> specialCounter ( cc , " SharedBytesDurable " , [ tLogData ] ( ) { return tLogData - > bytesDurable ; } ) ; <nl> specialCounter ( cc , " SharedOverheadBytesInput " , [ tLogData ] ( ) { return tLogData - > overheadBytesInput ; } ) ; <nl> mmm a / fdbserver / QuietDatabase . actor . cpp <nl> ppp b / fdbserver / QuietDatabase . actor . cpp <nl> <nl> # include " fdbserver / ServerDBInfo . h " <nl> # include " fdbserver / Status . h " <nl> # include " fdbclient / ManagementAPI . actor . h " <nl> + # include < boost / lexical_cast . hpp > <nl> # include " flow / actorcompiler . h " / / This must be the last # include . <nl> <nl> ACTOR Future < vector < WorkerDetails > > getWorkers ( Reference < AsyncVar < ServerDBInfo > > dbInfo , int flags = 0 ) { <nl> ACTOR Future < int64_t > getDataInFlight ( Database cx , WorkerInterface distributorW <nl> TraceEvent ( " DataInFlight " ) . detail ( " Stage " , " ContactingDataDistributor " ) ; <nl> TraceEventFields md = wait ( timeoutError ( distributorWorker . eventLogRequest . getReply ( <nl> EventLogRequest ( LiteralStringRef ( " TotalDataInFlight " ) ) ) , 1 . 0 ) ) ; <nl> - int64_t dataInFlight ; <nl> - sscanf ( md . getValue ( " TotalBytes " ) . c_str ( ) , " % " SCNd64 , & dataInFlight ) ; <nl> + int64_t dataInFlight = boost : : lexical_cast < int64_t > ( md . getValue ( " TotalBytes " ) ) ; <nl> return dataInFlight ; <nl> } catch ( Error & e ) { <nl> TraceEvent ( " QuietDatabaseFailure " , distributorWorker . id ( ) ) . error ( e ) . detail ( " Reason " , " Failed to extract DataInFlight " ) ; <nl> int64_t getQueueSize ( const TraceEventFields & md ) { <nl> return inputBytes - durableBytes ; <nl> } <nl> <nl> + / / Computes the popped version lag for tlogs <nl> + int64_t getPoppedVersionLag ( const TraceEventFields & md ) { <nl> + int64_t persistentDataDurableVersion = boost : : lexical_cast < int64_t > ( md . getValue ( " PersistentDataDurableVersion " ) ) ; <nl> + int64_t queuePoppedVersion = boost : : lexical_cast < int64_t > ( md . getValue ( " QueuePoppedVersion " ) ) ; <nl> + <nl> + return persistentDataDurableVersion - queuePoppedVersion ; <nl> + } <nl> + <nl> / / This is not robust in the face of a TLog failure <nl> - ACTOR Future < int64_t > getMaxTLogQueueSize ( Database cx , Reference < AsyncVar < ServerDBInfo > > dbInfo ) { <nl> + ACTOR Future < std : : pair < int64_t , int64_t > > getTLogQueueInfo ( Database cx , Reference < AsyncVar < ServerDBInfo > > dbInfo ) { <nl> TraceEvent ( " MaxTLogQueueSize " ) . detail ( " Stage " , " ContactingLogs " ) ; <nl> <nl> state std : : vector < WorkerDetails > workers = wait ( getWorkers ( dbInfo ) ) ; <nl> ACTOR Future < int64_t > getMaxTLogQueueSize ( Database cx , Reference < AsyncVar < Serve <nl> TraceEvent ( " MaxTLogQueueSize " ) . detail ( " Stage " , " ComputingMax " ) . detail ( " MessageCount " , messages . size ( ) ) ; <nl> <nl> state int64_t maxQueueSize = 0 ; <nl> + state int64_t maxPoppedVersionLag = 0 ; <nl> state int i = 0 ; <nl> for ( ; i < messages . size ( ) ; i + + ) { <nl> try { <nl> maxQueueSize = std : : max ( maxQueueSize , getQueueSize ( messages [ i ] . get ( ) ) ) ; <nl> + maxPoppedVersionLag = std : : max ( maxPoppedVersionLag , getPoppedVersionLag ( messages [ i ] . get ( ) ) ) ; <nl> } catch ( Error & e ) { <nl> TraceEvent ( " QuietDatabaseFailure " ) . detail ( " Reason " , " Failed to extract MaxTLogQueue " ) . detail ( " Tlog " , tlogs [ i ] . id ( ) ) ; <nl> throw ; <nl> } <nl> } <nl> <nl> - return maxQueueSize ; <nl> + return std : : make_pair ( maxQueueSize , maxPoppedVersionLag ) ; <nl> } <nl> <nl> ACTOR Future < vector < StorageServerInterface > > getStorageServers ( Database cx , bool use_system_priority = false ) { <nl> ACTOR Future < int64_t > getDataDistributionQueueSize ( Database cx , WorkerInterface <nl> <nl> TraceEvent ( " DataDistributionQueueSize " ) . detail ( " Stage " , " GotString " ) ; <nl> <nl> - int64_t inQueue ; <nl> - sscanf ( movingDataMessage . getValue ( " InQueue " ) . c_str ( ) , " % " SCNd64 , & inQueue ) ; <nl> + int64_t inQueue = boost : : lexical_cast < int64_t > ( movingDataMessage . getValue ( " InQueue " ) ) ; <nl> <nl> if ( reportInFlight ) { <nl> - int64_t inFlight ; <nl> - sscanf ( movingDataMessage . getValue ( " InFlight " ) . c_str ( ) , " % " SCNd64 , & inFlight ) ; <nl> + int64_t inFlight = boost : : lexical_cast < int64_t > ( movingDataMessage . getValue ( " InFlight " ) ) ; <nl> inQueue + = inFlight ; <nl> } <nl> <nl> ACTOR Future < bool > getTeamCollectionValid ( Database cx , WorkerInterface dataDistr <nl> <nl> TraceEvent ( " GetTeamCollectionValid " ) . detail ( " Stage " , " GotString " ) ; <nl> <nl> - int64_t currentTeamNumber ; <nl> - int64_t desiredTeamNumber ; <nl> - int64_t maxTeamNumber ; <nl> - int64_t currentMachineTeamNumber ; <nl> - int64_t healthyMachineTeamCount ; <nl> - int64_t desiredMachineTeamNumber ; <nl> - int64_t maxMachineTeamNumber ; <nl> - sscanf ( teamCollectionInfoMessage . getValue ( " CurrentTeamNumber " ) . c_str ( ) , " % " SCNd64 , & currentTeamNumber ) ; <nl> - sscanf ( teamCollectionInfoMessage . getValue ( " DesiredTeamNumber " ) . c_str ( ) , " % " SCNd64 , & desiredTeamNumber ) ; <nl> - sscanf ( teamCollectionInfoMessage . getValue ( " MaxTeamNumber " ) . c_str ( ) , " % " SCNd64 , & maxTeamNumber ) ; <nl> - sscanf ( teamCollectionInfoMessage . getValue ( " CurrentMachineTeamNumber " ) . c_str ( ) , " % " SCNd64 , <nl> - & currentMachineTeamNumber ) ; <nl> - sscanf ( teamCollectionInfoMessage . getValue ( " CurrentHealthyMachineTeamNumber " ) . c_str ( ) , " % " SCNd64 , <nl> - & healthyMachineTeamCount ) ; <nl> - sscanf ( teamCollectionInfoMessage . getValue ( " DesiredMachineTeams " ) . c_str ( ) , " % " SCNd64 , <nl> - & desiredMachineTeamNumber ) ; <nl> - sscanf ( teamCollectionInfoMessage . getValue ( " MaxMachineTeams " ) . c_str ( ) , " % " SCNd64 , & maxMachineTeamNumber ) ; <nl> + int64_t currentTeamNumber = boost : : lexical_cast < int64_t > ( teamCollectionInfoMessage . getValue ( " CurrentTeamNumber " ) ) ; <nl> + int64_t desiredTeamNumber = boost : : lexical_cast < int64_t > ( teamCollectionInfoMessage . getValue ( " DesiredTeamNumber " ) ) ; <nl> + int64_t maxTeamNumber = boost : : lexical_cast < int64_t > ( teamCollectionInfoMessage . getValue ( " MaxTeamNumber " ) ) ; <nl> + int64_t currentMachineTeamNumber = boost : : lexical_cast < int64_t > ( teamCollectionInfoMessage . getValue ( " CurrentMachineTeamNumber " ) ) ; <nl> + int64_t healthyMachineTeamCount = boost : : lexical_cast < int64_t > ( teamCollectionInfoMessage . getValue ( " CurrentHealthyMachineTeamNumber " ) ) ; <nl> + int64_t desiredMachineTeamNumber = boost : : lexical_cast < int64_t > ( teamCollectionInfoMessage . getValue ( " DesiredMachineTeams " ) ) ; <nl> + int64_t maxMachineTeamNumber = boost : : lexical_cast < int64_t > ( teamCollectionInfoMessage . getValue ( " MaxMachineTeams " ) ) ; <nl> <nl> / / Team number is always valid when we disable teamRemover . This avoids false positive in simulation test <nl> if ( SERVER_KNOBS - > TR_FLAG_DISABLE_TEAM_REMOVER ) { <nl> ACTOR Future < Void > reconfigureAfter ( Database cx , double time , Reference < AsyncVar <nl> } <nl> <nl> ACTOR Future < Void > waitForQuietDatabase ( Database cx , Reference < AsyncVar < ServerDBInfo > > dbInfo , std : : string phase , int64_t dataInFlightGate = 2e6 , <nl> - int64_t maxTLogQueueGate = 5e6 , int64_t maxStorageServerQueueGate = 5e6 , int64_t maxDataDistributionQueueSize = 0 ) { <nl> + int64_t maxTLogQueueGate = 5e6 , int64_t maxStorageServerQueueGate = 5e6 , int64_t maxDataDistributionQueueSize = 0 , int64_t maxPoppedVersionLag = 30e6 ) { <nl> state Future < Void > reconfig = reconfigureAfter ( cx , 100 + ( g_random - > random01 ( ) * 100 ) , dbInfo , " QuietDatabase " ) ; <nl> <nl> TraceEvent ( ( " QuietDatabase " + phase + " Begin " ) . c_str ( ) ) ; <nl> ACTOR Future < Void > waitForQuietDatabase ( Database cx , Reference < AsyncVar < ServerD <nl> TraceEvent ( " QuietDatabaseGotDataDistributor " , distributorUID ) . detail ( " Locality " , distributorWorker . locality . toString ( ) ) ; <nl> <nl> state Future < int64_t > dataInFlight = getDataInFlight ( cx , distributorWorker ) ; <nl> - state Future < int64_t > tLogQueueSize = getMaxTLogQueueSize ( cx , dbInfo ) ; <nl> + state Future < std : : pair < int64_t , int64_t > > tLogQueueInfo = getTLogQueueInfo ( cx , dbInfo ) ; <nl> state Future < int64_t > dataDistributionQueueSize = getDataDistributionQueueSize ( cx , distributorWorker , dataInFlightGate = = 0 ) ; <nl> state Future < bool > teamCollectionValid = getTeamCollectionValid ( cx , distributorWorker ) ; <nl> state Future < int64_t > storageQueueSize = getMaxStorageServerQueueSize ( cx , dbInfo ) ; <nl> state Future < bool > dataDistributionActive = getDataDistributionActive ( cx , distributorWorker ) ; <nl> state Future < bool > storageServersRecruiting = getStorageServersRecruiting ( cx , distributorWorker , distributorUID ) ; <nl> <nl> - wait ( success ( dataInFlight ) & & success ( tLogQueueSize ) & & success ( dataDistributionQueueSize ) & & <nl> + wait ( success ( dataInFlight ) & & success ( tLogQueueInfo ) & & success ( dataDistributionQueueSize ) & & <nl> success ( teamCollectionValid ) & & success ( storageQueueSize ) & & success ( dataDistributionActive ) & & <nl> success ( storageServersRecruiting ) ) ; <nl> + <nl> TraceEvent ( ( " QuietDatabase " + phase ) . c_str ( ) ) <nl> - . detail ( " DataInFlight " , dataInFlight . get ( ) ) <nl> - . detail ( " MaxTLogQueueSize " , tLogQueueSize . get ( ) ) <nl> - . detail ( " DataDistributionQueueSize " , dataDistributionQueueSize . get ( ) ) <nl> - . detail ( " TeamCollectionValid " , teamCollectionValid . get ( ) ) <nl> - . detail ( " MaxStorageQueueSize " , storageQueueSize . get ( ) ) <nl> - . detail ( " DataDistributionActive " , dataDistributionActive . get ( ) ) <nl> - . detail ( " StorageServersRecruiting " , storageServersRecruiting . get ( ) ) ; <nl> - <nl> - if ( dataInFlight . get ( ) > dataInFlightGate | | tLogQueueSize . get ( ) > maxTLogQueueGate | | <nl> + . detail ( " DataInFlight " , dataInFlight . get ( ) ) <nl> + . detail ( " MaxTLogQueueSize " , tLogQueueInfo . get ( ) . first ) <nl> + . detail ( " MaxTLogPoppedVersionLag " , tLogQueueInfo . get ( ) . second ) <nl> + . detail ( " DataDistributionQueueSize " , dataDistributionQueueSize . get ( ) ) <nl> + . detail ( " TeamCollectionValid " , teamCollectionValid . get ( ) ) <nl> + . detail ( " MaxStorageQueueSize " , storageQueueSize . get ( ) ) <nl> + . detail ( " DataDistributionActive " , dataDistributionActive . get ( ) ) <nl> + . detail ( " StorageServersRecruiting " , storageServersRecruiting . get ( ) ) ; <nl> + <nl> + if ( dataInFlight . get ( ) > dataInFlightGate | | tLogQueueInfo . get ( ) . first > maxTLogQueueGate | | tLogQueueInfo . get ( ) . second > maxPoppedVersionLag | | <nl> dataDistributionQueueSize . get ( ) > maxDataDistributionQueueSize | | <nl> storageQueueSize . get ( ) > maxStorageServerQueueGate | | dataDistributionActive . get ( ) = = false | | <nl> storageServersRecruiting . get ( ) = = true | | teamCollectionValid . get ( ) = = false ) { <nl> ACTOR Future < Void > waitForQuietDatabase ( Database cx , Reference < AsyncVar < ServerD <nl> } <nl> <nl> Future < Void > quietDatabase ( Database const & cx , Reference < AsyncVar < ServerDBInfo > > const & dbInfo , std : : string phase , int64_t dataInFlightGate , <nl> - int64_t maxTLogQueueGate , int64_t maxStorageServerQueueGate , int64_t maxDataDistributionQueueSize ) { <nl> - return waitForQuietDatabase ( cx , dbInfo , phase , dataInFlightGate , maxTLogQueueGate , maxStorageServerQueueGate , maxDataDistributionQueueSize ) ; <nl> + int64_t maxTLogQueueGate , int64_t maxStorageServerQueueGate , int64_t maxDataDistributionQueueSize , int64_t maxPoppedVersionLag ) { <nl> + return waitForQuietDatabase ( cx , dbInfo , phase , dataInFlightGate , maxTLogQueueGate , maxStorageServerQueueGate , maxDataDistributionQueueSize , maxPoppedVersionLag ) ; <nl> } <nl> mmm a / fdbserver / QuietDatabase . h <nl> ppp b / fdbserver / QuietDatabase . h <nl> <nl> # include " flow / actorcompiler . h " <nl> <nl> Future < int64_t > getDataInFlight ( Database const & cx , Reference < AsyncVar < struct ServerDBInfo > > const & ) ; <nl> - Future < int64_t > getMaxTLogQueueSize ( Database const & cx , Reference < AsyncVar < struct ServerDBInfo > > const & ) ; <nl> + Future < std : : pair < int64_t , int64_t > > getTLogQueueInfo ( Database const & cx , Reference < AsyncVar < struct ServerDBInfo > > const & ) ; <nl> Future < int64_t > getMaxStorageServerQueueSize ( Database const & cx , Reference < AsyncVar < struct ServerDBInfo > > const & ) ; <nl> Future < int64_t > getDataDistributionQueueSize ( Database const & cx , Reference < AsyncVar < struct ServerDBInfo > > const & , bool const & reportInFlight ) ; <nl> Future < bool > getTeamCollectionValid ( Database const & cx , WorkerInterface const & ) ; <nl> mmm a / fdbserver / TLogServer . actor . cpp <nl> ppp b / fdbserver / TLogServer . actor . cpp <nl> struct LogData : NonCopyable , public ReferenceCounted < LogData > { <nl> NotifiedVersion version , queueCommittedVersion ; <nl> Version queueCommittingVersion ; <nl> Version knownCommittedVersion , durableKnownCommittedVersion , minKnownCommittedVersion ; <nl> + Version queuePoppedVersion ; <nl> <nl> Deque < std : : pair < Version , Standalone < VectorRef < uint8_t > > > > messageBlocks ; <nl> std : : vector < std : : vector < Reference < TagData > > > tag_data ; / / tag . locality | tag . id <nl> struct LogData : NonCopyable , public ReferenceCounted < LogData > { <nl> <nl> explicit LogData ( TLogData * tLogData , TLogInterface interf , Tag remoteTag , bool isPrimary , int logRouterTags , UID recruitmentID , uint64_t protocolVersion , std : : vector < Tag > tags ) : tLogData ( tLogData ) , knownCommittedVersion ( 0 ) , logId ( interf . id ( ) ) , <nl> cc ( " TLog " , interf . id ( ) . toString ( ) ) , bytesInput ( " BytesInput " , cc ) , bytesDurable ( " BytesDurable " , cc ) , remoteTag ( remoteTag ) , isPrimary ( isPrimary ) , logRouterTags ( logRouterTags ) , recruitmentID ( recruitmentID ) , protocolVersion ( protocolVersion ) , <nl> - logSystem ( new AsyncVar < Reference < ILogSystem > > ( ) ) , logRouterPoppedVersion ( 0 ) , durableKnownCommittedVersion ( 0 ) , minKnownCommittedVersion ( 0 ) , allTags ( tags . begin ( ) , tags . end ( ) ) , terminated ( tLogData - > terminated . getFuture ( ) ) , <nl> + logSystem ( new AsyncVar < Reference < ILogSystem > > ( ) ) , logRouterPoppedVersion ( 0 ) , durableKnownCommittedVersion ( 0 ) , minKnownCommittedVersion ( 0 ) , queuePoppedVersion ( 0 ) , allTags ( tags . begin ( ) , tags . end ( ) ) , terminated ( tLogData - > terminated . getFuture ( ) ) , <nl> / / These are initialized differently on init ( ) or recovery <nl> recoveryCount ( ) , stopped ( false ) , initialized ( false ) , queueCommittingVersion ( 0 ) , newPersistentDataVersion ( invalidVersion ) , unrecoveredBefore ( 1 ) , recoveredAt ( 1 ) , unpoppedRecoveredTags ( 0 ) , <nl> logRouterPopToVersion ( 0 ) , locality ( tagLocalityInvalid ) <nl> struct LogData : NonCopyable , public ReferenceCounted < LogData > { <nl> specialCounter ( cc , " PersistentDataVersion " , [ this ] ( ) { return this - > persistentDataVersion ; } ) ; <nl> specialCounter ( cc , " PersistentDataDurableVersion " , [ this ] ( ) { return this - > persistentDataDurableVersion ; } ) ; <nl> specialCounter ( cc , " KnownCommittedVersion " , [ this ] ( ) { return this - > knownCommittedVersion ; } ) ; <nl> + specialCounter ( cc , " QueuePoppedVersion " , [ this ] ( ) { return this - > queuePoppedVersion ; } ) ; <nl> specialCounter ( cc , " SharedBytesInput " , [ tLogData ] ( ) { return tLogData - > bytesInput ; } ) ; <nl> specialCounter ( cc , " SharedBytesDurable " , [ tLogData ] ( ) { return tLogData - > bytesDurable ; } ) ; <nl> specialCounter ( cc , " SharedOverheadBytesInput " , [ tLogData ] ( ) { return tLogData - > overheadBytesInput ; } ) ; <nl> void updatePersistentPopped ( TLogData * self , Reference < LogData > logData , Referen <nl> } <nl> <nl> ACTOR Future < Void > updatePoppedLocation ( TLogData * self , Reference < LogData > logData , Reference < LogData : : TagData > data ) { <nl> - / / txsTag is spilled by value , so by definition , its poppable location is always up to the persistentDataVersion . <nl> + / / txsTag is spilled by value , so we do not need to track its popped location . <nl> if ( data - > tag = = txsTag ) { <nl> - auto locationIter = logData - > versionLocation . lower_bound ( std : : max < Version > ( data - > popped , logData - > persistentDataVersion ) ) ; <nl> - if ( locationIter ! = logData - > versionLocation . end ( ) ) { <nl> - data - > poppedLocation = locationIter - > value . first ; <nl> - } else { <nl> - / / We have no data , so whatever our previous value was is better than anything new we know how <nl> - / / to assign . Ideally , we ' d use the most recent commit location , but that ' s surprisingly <nl> - / / difficult to track . <nl> - } <nl> return Void ( ) ; <nl> } <nl> <nl> if ( ! data - > requiresPoppedLocationUpdate ) return Void ( ) ; <nl> data - > requiresPoppedLocationUpdate = false ; <nl> <nl> - if ( data - > popped < logData - > persistentDataVersion ) { <nl> + if ( data - > popped < = logData - > persistentDataVersion ) { <nl> / / Recover the next needed location in the Disk Queue from the index . <nl> Standalone < VectorRef < KeyValueRef > > kvrefs = wait ( <nl> self - > persistentData - > readRange ( KeyRangeRef ( <nl> ACTOR Future < Void > popDiskQueue ( TLogData * self , Reference < LogData > logData ) { <nl> } <nl> wait ( waitForAll ( updates ) ) ; <nl> <nl> - auto lastItem = logData - > versionLocation . lastItem ( ) ; <nl> - IDiskQueue : : location minLocation = lastItem = = logData - > versionLocation . end ( ) ? 0 : lastItem - > value . second ; <nl> + IDiskQueue : : location minLocation = 0 ; <nl> + Version minVersion = 0 ; <nl> + auto locationIter = logData - > versionLocation . lower_bound ( logData - > persistentDataVersion ) ; <nl> + if ( locationIter ! = logData - > versionLocation . end ( ) ) { <nl> + minLocation = locationIter - > value . first ; <nl> + minVersion = locationIter - > key ; <nl> + } <nl> for ( int tagLocality = 0 ; tagLocality < logData - > tag_data . size ( ) ; tagLocality + + ) { <nl> for ( int tagId = 0 ; tagId < logData - > tag_data [ tagLocality ] . size ( ) ; tagId + + ) { <nl> Reference < LogData : : TagData > tagData = logData - > tag_data [ tagLocality ] [ tagId ] ; <nl> - if ( tagData ) { <nl> + if ( tagData & & tagData - > tag ! = txsTag & & ! tagData - > nothingPersistent ) { <nl> minLocation = std : : min ( minLocation , tagData - > poppedLocation ) ; <nl> + minVersion = std : : min ( minVersion , tagData - > popped ) ; <nl> } <nl> } <nl> } <nl> ACTOR Future < Void > popDiskQueue ( TLogData * self , Reference < LogData > logData ) { <nl> lastCommittedLocation = locationIter - > value . first ; <nl> } <nl> self - > persistentQueue - > pop ( std : : min ( minLocation , lastCommittedLocation ) ) ; <nl> + logData - > queuePoppedVersion = std : : max ( logData - > queuePoppedVersion , minVersion ) ; <nl> } <nl> <nl> return Void ( ) ; <nl> ACTOR Future < Void > updatePersistentData ( TLogData * self , Reference < LogData > logD <nl> for ( tagId = 0 ; tagId < logData - > tag_data [ tagLocality ] . size ( ) ; tagId + + ) { <nl> state Reference < LogData : : TagData > tagData = logData - > tag_data [ tagLocality ] [ tagId ] ; <nl> if ( tagData ) { <nl> + wait ( tagData - > eraseMessagesBefore ( tagData - > popped , self , logData , TaskUpdateStorage ) ) ; <nl> state Version currentVersion = 0 ; <nl> / / Clear recently popped versions from persistentData if necessary <nl> updatePersistentPopped ( self , logData , tagData ) ; <nl> mmm a / fdbserver / WaitFailure . actor . cpp <nl> ppp b / fdbserver / WaitFailure . actor . cpp <nl> ACTOR Future < Void > waitFailureClient ( RequestStream < ReplyPromise < Void > > waitFailu <nl> } <nl> } <nl> <nl> + ACTOR Future < Void > waitFailureClientStrict ( RequestStream < ReplyPromise < Void > > waitFailure , double failureReactionTime , int taskID ) { <nl> + loop { <nl> + wait ( waitFailureClient ( waitFailure , 0 , 0 , taskID ) ) ; <nl> + wait ( delay ( failureReactionTime , taskID ) | | IFailureMonitor : : failureMonitor ( ) . onStateEqual ( waitFailure . getEndpoint ( ) , FailureStatus ( false ) ) ) ; <nl> + if ( IFailureMonitor : : failureMonitor ( ) . getState ( waitFailure . getEndpoint ( ) ) . isFailed ( ) ) { <nl> + return Void ( ) ; <nl> + } <nl> + } <nl> + } <nl> + <nl> ACTOR Future < Void > waitFailureTracker ( RequestStream < ReplyPromise < Void > > waitFailure , Reference < AsyncVar < bool > > failed , double reactionTime , double reactionSlope , int taskID ) { <nl> loop { <nl> try { <nl> mmm a / fdbserver / WaitFailure . h <nl> ppp b / fdbserver / WaitFailure . h <nl> Future < Void > waitFailureServer ( const FutureStream < ReplyPromise < Void > > & waitFailu <nl> Future < Void > waitFailureClient ( const RequestStream < ReplyPromise < Void > > & waitFailure , <nl> double const & failureReactionTime = 0 , double const & failureReactionSlope = 0 , int const & taskID = TaskDefaultEndpoint ) ; <nl> <nl> + / / talks to a wait failure server , returns Void on failure , reaction time is always waited <nl> + Future < Void > waitFailureClientStrict ( const RequestStream < ReplyPromise < Void > > & waitFailure , double const & failureReactionTime = 0 , int const & taskID = TaskDefaultEndpoint ) ; <nl> + <nl> / / talks to a wait failure server , updates failed to be true or false based on failure status . <nl> Future < Void > waitFailureTracker ( const RequestStream < ReplyPromise < Void > > & waitFailure , Reference < AsyncVar < bool > > const & failed , <nl> double const & failureReactionTime = 0 , double const & failureReactionSlope = 0 , int const & taskID = TaskDefaultEndpoint ) ; <nl> mmm a / fdbserver / workloads / ConsistencyCheck . actor . cpp <nl> ppp b / fdbserver / workloads / ConsistencyCheck . actor . cpp <nl> struct ConsistencyCheckWorkload : TestWorkload <nl> } <nl> <nl> / / Check that nothing is in the TLog queues <nl> - int64_t maxTLogQueueSize = wait ( getMaxTLogQueueSize ( cx , self - > dbInfo ) ) ; <nl> - if ( maxTLogQueueSize > 1e5 ) / / FIXME : Should be zero ? <nl> + std : : pair < int64_t , int64_t > maxTLogQueueInfo = wait ( getTLogQueueInfo ( cx , self - > dbInfo ) ) ; <nl> + if ( maxTLogQueueInfo . first > 1e5 ) / / FIXME : Should be zero ? <nl> { <nl> - TraceEvent ( " ConsistencyCheck_NonZeroTLogQueue " ) . detail ( " MaxQueueSize " , maxTLogQueueSize ) ; <nl> + TraceEvent ( " ConsistencyCheck_NonZeroTLogQueue " ) . detail ( " MaxQueueSize " , maxTLogQueueInfo . first ) ; <nl> self - > testFailure ( " Non - zero tlog queue size " ) ; <nl> } <nl> <nl> + if ( maxTLogQueueInfo . second > 30e6 ) <nl> + { <nl> + TraceEvent ( " ConsistencyCheck_PoppedVersionLag " ) . detail ( " PoppedVersionLag " , maxTLogQueueInfo . second ) ; <nl> + self - > testFailure ( " large popped version lag " ) ; <nl> + } <nl> + <nl> / / Check that nothing is in the storage server queues <nl> try <nl> { <nl> mmm a / fdbserver / workloads / workloads . actor . h <nl> ppp b / fdbserver / workloads / workloads . actor . h <nl> double testKeyToDouble ( const KeyRef & p , const KeyRef & prefix ) ; <nl> ACTOR Future < Void > databaseWarmer ( Database cx ) ; <nl> <nl> Future < Void > quietDatabase ( Database const & cx , Reference < AsyncVar < struct ServerDBInfo > > const & , std : : string phase , int64_t dataInFlightGate = 2e6 , int64_t maxTLogQueueGate = 5e6 , <nl> - int64_t maxStorageServerQueueGate = 5e6 , int64_t maxDataDistributionQueueSize = 0 ) ; <nl> + int64_t maxStorageServerQueueGate = 5e6 , int64_t maxDataDistributionQueueSize = 0 , int64_t maxPoppedVersionLag = 30e6 ) ; <nl> <nl> <nl> # include " flow / unactorcompiler . h " <nl> mmm a / flow / Trace . cpp <nl> ppp b / flow / Trace . cpp <nl> std : : string TraceEventFields : : getValue ( std : : string key ) const { <nl> } <nl> else { <nl> TraceEvent ev ( SevWarn , " TraceEventFieldNotFound " ) ; <nl> + ev . suppressFor ( 1 . 0 ) ; <nl> if ( tryGetValue ( " Type " , value ) ) { <nl> ev . detail ( " Event " , value ) ; <nl> } <nl> mmm a / packaging / msi / FDBInstaller . wxs <nl> ppp b / packaging / msi / FDBInstaller . wxs <nl> <nl> <nl> < Wix xmlns = ' http : / / schemas . microsoft . com / wix / 2006 / wi ' > <nl> < Product Name = ' $ ( var . Title ) ' <nl> - Id = ' { B440CAB2 - F9C8 - 4185 - 9863 - E8A7E7587FED } ' <nl> + Id = ' { 311BF306 - 11DD - 487C - B2BC - D2A1D85DFCA3 } ' <nl> UpgradeCode = ' { A95EA002 - 686E - 4164 - 8356 - C715B7F8B1C8 } ' <nl> Version = ' $ ( var . Version ) ' <nl> Manufacturer = ' $ ( var . Manufacturer ) ' <nl> | Merge pull request from ajbeamon / merge - release - 6 . 1 - into - master | apple/foundationdb | 00ec629b5a762425f4d9a4934059be500becb5b7 | 2019-05-23T17:50:21Z |
mmm a / cores / esp8266 / Updater . cpp <nl> ppp b / cores / esp8266 / Updater . cpp <nl> <nl> extern " C " { <nl> # include " mem . h " <nl> } <nl> - # define DEBUG_UPDATER Serial <nl> + / / # define DEBUG_UPDATER Serial <nl> <nl> extern " C " uint32_t _SPIFFS_start ; <nl> <nl> | disable updater debug | esp8266/Arduino | bfbfd313159dcb4a8809cd7a64bfcbfc7112e02e | 2015-07-06T09:31:38Z |
mmm a / format . cc <nl> ppp b / format . cc <nl> class ArgConverter : public fmt : : internal : : ArgVisitor < ArgConverter < T > , void > { <nl> <nl> template < typename U > <nl> void visit_any_int ( U value ) { <nl> - if ( std : : numeric_limits < U > : : is_signed ) { <nl> + if ( std : : numeric_limits < T > : : is_signed ) { <nl> arg_ . type = fmt : : internal : : Arg : : INT ; <nl> arg_ . int_value = static_cast < T > ( value ) ; <nl> } else { <nl> void fmt : : internal : : PrintfFormatter < Char > : : format ( <nl> <nl> / / Parse length . <nl> switch ( * s ) { <nl> - case ' h ' : <nl> + case ' h ' : { <nl> + + s ; <nl> - ArgConverter < short > ( arg ) . visit ( arg ) ; <nl> + / / TODO : handle ' hh ' <nl> + char type = * s ; <nl> + if ( type = = ' d ' | | type = = ' i ' ) <nl> + ArgConverter < short > ( arg ) . visit ( arg ) ; <nl> + else <nl> + ArgConverter < unsigned short > ( arg ) . visit ( arg ) ; <nl> break ; <nl> + } <nl> case ' l ' : <nl> case ' j ' : <nl> case ' z ' : <nl> void fmt : : internal : : PrintfFormatter < Char > : : format ( <nl> if ( error_ ) <nl> throw FormatError ( error_ ) ; <nl> spec . type_ = static_cast < char > ( * s + + ) ; <nl> + if ( arg . type < = Arg : : LAST_INTEGER_TYPE & & spec . type_ = = ' u ' ) <nl> + spec . type_ = ' d ' ; <nl> <nl> start = s ; <nl> <nl> mmm a / test / printf - test . cc <nl> ppp b / test / printf - test . cc <nl> TEST ( PrintfTest , DynamicPrecision ) { <nl> } <nl> } <nl> <nl> - TEST ( PrintfTest , Length ) { <nl> - EXPECT_PRINTF ( " 42 " , " % hd " , 42 ) ; <nl> - char buffer [ BUFFER_SIZE ] ; <nl> - safe_sprintf ( buffer , " % hd " , SHRT_MAX + 1 ) ; <nl> - EXPECT_PRINTF ( buffer , " % hd " , SHRT_MAX + 1 ) ; <nl> - safe_sprintf ( buffer , " % hd " , fmt : : LongLong ( SHRT_MAX ) + 1 ) ; <nl> - EXPECT_PRINTF ( buffer , " % hd " , fmt : : LongLong ( SHRT_MAX ) + 1 ) ; <nl> - / / TODO <nl> + # define EXPECT_STD_PRINTF ( format , arg ) { \ <nl> + char buffer [ BUFFER_SIZE ] ; \ <nl> + safe_sprintf ( buffer , " % hd " , arg ) ; \ <nl> + EXPECT_PRINTF ( buffer , " % hd " , arg ) ; \ <nl> + } <nl> + <nl> + template < typename T > <nl> + void TestLength ( const char * length_spec ) { <nl> + EXPECT_STD_PRINTF ( format , 42 ) ; <nl> + T min = std : : numeric_limits < T > : : min ( ) , max = std : : numeric_limits < T > : : max ( ) ; <nl> + const char types [ ] = { ' d ' , ' i ' , ' u ' , ' o ' , ' x ' , ' X ' } ; <nl> + for ( int i = 0 ; i < sizeof ( types ) ; + + i ) { <nl> + std : : string format = fmt : : format ( " % { } { } " , length_spec , types [ i ] ) ; <nl> + EXPECT_STD_PRINTF ( format , min ) ; <nl> + EXPECT_STD_PRINTF ( format , max ) ; <nl> + EXPECT_STD_PRINTF ( format , fmt : : LongLong ( min ) - 1 ) ; <nl> + EXPECT_STD_PRINTF ( format , fmt : : LongLong ( max ) + 1 ) ; <nl> + EXPECT_STD_PRINTF ( format , std : : numeric_limits < int > : : min ( ) ) ; <nl> + EXPECT_STD_PRINTF ( format , std : : numeric_limits < int > : : max ( ) ) ; <nl> + EXPECT_STD_PRINTF ( format , std : : numeric_limits < unsigned > : : min ( ) ) ; <nl> + EXPECT_STD_PRINTF ( format , std : : numeric_limits < unsigned > : : max ( ) ) ; <nl> + EXPECT_STD_PRINTF ( format , std : : numeric_limits < fmt : : LongLong > : : min ( ) ) ; <nl> + EXPECT_STD_PRINTF ( format , std : : numeric_limits < fmt : : LongLong > : : max ( ) ) ; <nl> + EXPECT_STD_PRINTF ( format , std : : numeric_limits < fmt : : ULongLong > : : min ( ) ) ; <nl> + EXPECT_STD_PRINTF ( format , std : : numeric_limits < fmt : : ULongLong > : : max ( ) ) ; <nl> + } <nl> + } <nl> + <nl> + TEST ( PrintfTest , ShortLength ) { <nl> + TestLength < short > ( " h " ) ; <nl> + TestLength < unsigned short > ( " h " ) ; <nl> + / / TODO : more tests <nl> } <nl> <nl> / / TODO : test type specifier <nl> | Improve handling of ' h ' length specifier in printf . | fmtlib/fmt | 39b0930aeee13b75ea49c28cac35c3c2347b603e | 2014-07-30T15:08:08Z |
mmm a / DataReader / SparsePCReader / SparsePCReader . cpp <nl> ppp b / DataReader / SparsePCReader / SparsePCReader . cpp <nl> void SparsePCReader < ElemType > : : Init ( const ConfigParameters & readerConfig ) <nl> m_microBatchSize = readerConfig ( " microbatchSize " , " 1 " ) ; <nl> <nl> m_miniBatchSize = 0 ; <nl> + m_microBatchSize = readerConfig ( " microbatchSize " , " 1 " ) ; <nl> m_traceLevel = readerConfig ( " traceLevel " , " 0 " ) ; <nl> m_maxReadData = readerConfig ( " maxReadData " , " 0 " ) ; <nl> m_doGradientCheck = readerConfig ( " gradientCheck " , " false " ) ; <nl> bool SparsePCReader < ElemType > : : GetMinibatch ( std : : map < std : : wstring , Matrix < ElemTy <nl> return false ; <nl> } <nl> <nl> + m_pMBLayout - > Init ( m_miniBatchSize / m_microBatchSize , m_microBatchSize , false ) ; <nl> + <nl> Matrix < ElemType > * labels = nullptr ; <nl> auto labelEntry = matrices . find ( m_labelName ) ; <nl> bool useLabels = false ; <nl> | Adding layout handling to SparsePCReader . | microsoft/CNTK | ff39fb054c4a9ab41cac6137cec082dd07e23884 | 2015-11-05T21:57:52Z |
mmm a / CHANGELOG <nl> ppp b / CHANGELOG <nl> cocos2d - x - 3 . 3 ? ? <nl> [ FIX ] Button : when the dimension of button title is larger than the button , button will scale to fit the dimension of the button title <nl> [ FIX ] Camera : does not work correctly when the up is not ( 0 , 1 , 0 ) <nl> [ FIX ] Cocos console : compile failure on windows if using VS express version <nl> - [ FIX ] GrawNode : drawPoint ( ) may cause crash <nl> + [ FIX ] DrawNode : drawPoint ( ) may cause crash <nl> [ FIX ] GLProgramCache : doesn ' t release old program with the same key before adding a new one <nl> [ FIX ] GLProgramState : enabled GLProgramState restoring on render recreated on WP8 <nl> [ FIX ] Label : label shifting when outline feature enabled <nl> cocos2d - x - 3 . 3 - rc0 Oct . 21 2014 <nl> [ FIX ] C + + : remove armv7s in VALID_ARCHS for Xcode projects <nl> [ FIX ] Cocos Studio reader : UI animation playing crash if GUI JSON file is loaded again <nl> [ FIX ] Cocos Studio reader : improvement ImageViewReader don ' t necessary loadTexture when imageFilePath is empty <nl> - [ FIX ] EditBox : view rendereed in wrong position if click EditBox on iOS 8 <nl> + [ FIX ] EditBox : view rendered in wrong position if click EditBox on iOS 8 <nl> [ FIX ] FileUtils : can not remove files / directory on iOS devices <nl> [ FIX ] GLProgram : crashed on some Android devices that do not support more than 8 attributes <nl> [ FIX ] Label : getStringNumLines ( ) may returns wrong result if label is dirty <nl> cocos2d - x - 3 . 3alpha0 Aug . 28 2014 <nl> [ NEW ] Sprite3D : added getBoundingBox ( ) and getAABB ( ) <nl> [ NEW ] SpriteFrameCache : load from plist file content data <nl> [ NEW ] utils : added gettime ( ) <nl> - [ NEW ] UI : Added Added UIScale9Sprite <nl> + [ NEW ] UI : Added UIScale9Sprite <nl> [ NEW ] UI : ui : : Button : support customize how much zoom scale is when pressing a button <nl> [ NEW ] UI : ui : : PageView : added ` customScrollThreshold ` , could determine the swipe distance to trigger a PageView scroll event <nl> [ NEW ] UI : ui : : TextField : support utf8 <nl> | Merge pull request from winipcfg / patch - 1 | cocos2d/cocos2d-x | 0402ed37f65e28f8ca9e64aaabbbcaf6a63d60b0 | 2014-11-06T02:19:39Z |
mmm a / doc / python / ndarray . md <nl> ppp b / doc / python / ndarray . md <nl> Create NDArray <nl> Like ` numpy ` , you could create ` mxnet . ndarray ` like followings : <nl> ` ` ` python <nl> > > > import mxnet as mx <nl> - > > > a = mx . nd . zeros ( ( 100 , 50 ) ) # all - zero array of dimension 100x50 <nl> - > > > b = mx . nd . ones ( ( 256 , 32 , 128 , 1 ) ) # all - one array of dimension 256x32x128x1 <nl> - > > > c = mx . nd . array ( [ [ 1 , 2 , 3 ] , [ 4 , 5 , 6 ] ] ) # initialize array with contents <nl> + > > > # all - zero array of dimension 100x50 <nl> + > > > a = mx . nd . zeros ( ( 100 , 50 ) ) <nl> + > > > # all - one array of dimension 256x32x128x1 <nl> + > > > b = mx . nd . ones ( ( 256 , 32 , 128 , 1 ) ) <nl> + > > > # initialize array with contents <nl> + > > > c = mx . nd . array ( [ [ 1 , 2 , 3 ] , [ 4 , 5 , 6 ] ] ) <nl> ` ` ` <nl> <nl> NDArray operations <nl> We provide some basic ndarray operations like arithmetic and slice operations . M <nl> > > > a . shape <nl> ( 100L , 50L ) <nl> > > > b = mx . nd . ones ( ( 100 , 50 ) ) <nl> + > > > # c and d will be calculated in parallel here ! <nl> > > > c = a + b <nl> - > > > d = a - b # c and d will be calculated in parallel here ! <nl> - > > > b + = d # inplace operation , b ' s contents will be modified , but c and d won ' t be affected . <nl> + > > > d = a - b <nl> + > > > # inplace operation , b ' s contents will be modified , but c and d won ' t be affected . <nl> + > > > b + = d <nl> ` ` ` <nl> <nl> # # # Slice operations <nl> We provide some basic ndarray operations like arithmetic and slice operations . M <nl> > > > a [ 0 : 10 ] = 1 # first 10 rows will become 1 <nl> ` ` ` <nl> <nl> - Conversion from / to ` numpy . ndarray ` and I / O <nl> mmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmm <nl> + Conversion from / to ` numpy . ndarray ` <nl> + mmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmm - <nl> MXNet NDArray supports pretty nature way to convert from / to ` mxnet . ndarray ` to / from ` numpy . ndarray ` : <nl> ` ` ` python <nl> > > > import mxnet as mx <nl> MXNet NDArray supports pretty nature way to convert from / to ` mxnet . ndarray ` to / f <nl> array ( [ 1 . , 2 . , 3 . ] , dtype = float32 ) <nl> ` ` ` <nl> <nl> - We also provide two convenient functions to help save and load file from I / O : <nl> + Save Load NDArray <nl> + mmmmmmmmmmmmmmm - - <nl> + You can always use pickle to save and load NDArrays . <nl> + We also provide functions to help save and load list or dictionary of NDArrays from file systems . <nl> ` ` ` python <nl> > > > import mxnet as mx <nl> > > > a = mx . nd . zeros ( ( 100 , 200 ) ) <nl> - > > > mx . nd . save ( " / path / to / array / file " , a ) <nl> - > > > mx . nd . save ( " s3 : / / path / to / s3 / array " , a ) <nl> - > > > mx . nd . save ( " hdfs : / / path / to / hdfs / array " , a ) <nl> + > > > b = mx . nd . zeros ( ( 100 , 200 ) ) <nl> + > > > # save list of NDArrays <nl> + > > > mx . nd . save ( " / path / to / array / file " , [ a , b ] ) <nl> + > > > # save dictionary of NDArrays to AWS S3 <nl> + > > > mx . nd . save ( " s3 : / / path / to / s3 / array " , { ' A ' : a , ' B ' : b } ) <nl> + > > > # save list of NDArrays to hdfs . <nl> + > > > mx . nd . save ( " hdfs : / / path / to / hdfs / array " , [ a , b ] ) <nl> > > > from_file = mx . nd . load ( " / path / to / array / file " ) <nl> > > > from_s3 = mx . nd . load ( " s3 : / / path / to / s3 / array " ) <nl> > > > from_hdfs = mx . nd . load ( " hdfs : / / path / to / hdfs / array " ) <nl> The good thing about using the above ` save ` and ` load ` interface is that : <nl> - You could use the format across all ` mxnet ` language bindings . <nl> - Already support S3 and HDFS . <nl> <nl> - Multi - device support <nl> mmmmmmmmmmmmmmmmmm - - <nl> + Multi - device Support <nl> + mmmmmmmmmmmmmmmmmm - - <nl> The device information is stored in ` mxnet . Context ` structure . When creating ndarray in mxnet , user could either use the context argument ( default is CPU context ) to create arrays on specific device or use the ` with ` statement as follows : <nl> ` ` ` python <nl> > > > import mxnet as mx <nl> mmm a / doc / python / tutorial . md <nl> ppp b / doc / python / tutorial . md <nl> shape inconsistency . <nl> <nl> # # # Bind the Symbols and Run <nl> <nl> - Now we can bind the free variables of the symbol and perform forward and <nl> - backward . <nl> + Now we can bind the free variables of the symbol and perform forward and backward . <nl> + The bind function will create a ` ` ` Executor ` ` ` that can be used to carry out the real computations . <nl> <nl> ` ` ` python <nl> - > > > in_shape = ( 128 , 3 , 100 , 100 ) # minibatch_size , # channel , image_width , image_height <nl> - > > > executor = net . simple_bind ( mx . gpu ( ) , data = mx . nd . empty ( in_shape , mx . gpu ( ) ) <nl> - > > > # feed data and label . . <nl> - > > > executor . forward ( ) <nl> - > > > executor . backward ( ) <nl> - > > > print executor . outputs [ 0 ] . asnumpy ( ) <nl> + > > > # define computation graphs <nl> + > > > A = mx . symbol . Variable ( ' A ' ) <nl> + > > > B = mx . symbol . Variable ( ' B ' ) <nl> + > > > C = A * B <nl> + > > > a = mx . nd . ones ( 3 ) * 4 <nl> + > > > b = mx . nd . ones ( 3 ) * 2 <nl> + > > > # bind the symbol with real arguments <nl> + > > > c_exec = C . bind ( ctx = mx . cpu ( ) , args = { ' A ' : a , ' B ' : b } ) <nl> + > > > # do forward pass calclation . <nl> + > > > c_exec . forward ( ) <nl> + > > > c_exec . outputs [ 0 ] . asnumpy ( ) <nl> + [ 8 . 8 . 8 . ] <nl> ` ` ` <nl> + For neural nets , a more commonly used pattern is ` ` ` simple_bind ` ` ` , which will create <nl> + all the arguments arrays for you . Then you can call forward , and backward ( if gradient is needed ) <nl> + to get the gradient . <nl> + ` ` ` python <nl> + > > > # define computation graphs <nl> + > > > net = some symbol <nl> + > > > texec = net . simple_bind ( data = input_shape ) <nl> + > > > texec . forward ( ) <nl> + > > > texec . backward ( ) <nl> + ` ` ` <nl> + The [ model API ] ( . . / . . / python / mxnet / model . py ) is a thin wrapper around the symbolic executors to support neural net training . <nl> <nl> # # # How Efficient is Symbolic API <nl> <nl> mmm a / python / mxnet / __init__ . py <nl> ppp b / python / mxnet / __init__ . py <nl> <nl> # ! / usr / bin / env python <nl> # coding : utf - 8 <nl> - " " " MXNet : a concise , fast and flexible framework for deep learning <nl> - <nl> - MXNet is a project that evolves from cxxnet , minerva and purine2 . <nl> - The interface is designed in collaboration by authors of three projects . <nl> - <nl> - " " " <nl> + " " " MXNet : a concise , fast and flexible framework for deep learning . " " " <nl> from __future__ import absolute_import <nl> <nl> from . context import Context , current_context , cpu , gpu <nl> <nl> from . import ndarray <nl> from . import name <nl> from . import symbol <nl> + # use mx . kv as short for kvstore <nl> from . import kvstore as kv <nl> from . import io <nl> # use mx . nd as short for mx . ndarray <nl> mmm a / python / mxnet / callback . py <nl> ppp b / python / mxnet / callback . py <nl> <nl> - # pylint : disable = logging - not - lazy , blacklisted - name , invalid - name <nl> - " " " model helper for knowing training status " " " <nl> + # coding : utf - 8 <nl> + " " " Callback functions that can be used to track various status during iteration . " " " <nl> + from __future__ import absolute_import <nl> + <nl> import sys <nl> import math <nl> import logging <nl> def do_checkpoint ( prefix ) : <nl> callback : function <nl> The callback function that can be passed as iter_end_callback to fit . <nl> " " " <nl> - def _callback ( iter_no , s , arg , aux ) : <nl> + def _callback ( iter_no , sym , arg , aux ) : <nl> " " " The checkpoint function . " " " <nl> - save_checkpoint ( prefix , iter_no + 1 , s , arg , aux ) <nl> + save_checkpoint ( prefix , iter_no + 1 , sym , arg , aux ) <nl> return _callback <nl> <nl> + <nl> class Speedometer ( object ) : <nl> " " " Calculate training speed in frequent <nl> <nl> def __call__ ( self , count ) : <nl> if self . init : <nl> if count % self . frequent = = 0 : <nl> speed = self . frequent * self . batch_size / ( time . time ( ) - self . tic ) <nl> - logging . info ( " Batch [ % d ] \ tSpeed : % . 2f samples / sec " % ( count , speed ) ) <nl> + logging . info ( " Batch [ % d ] \ tSpeed : % . 2f samples / sec " , count , speed ) <nl> self . tic = time . time ( ) <nl> else : <nl> self . init = True <nl> self . tic = time . time ( ) <nl> <nl> + <nl> class ProgressBar ( object ) : <nl> " " " Show a progress bar <nl> <nl> def __call__ ( self , count ) : <nl> <nl> filled_len = int ( round ( self . bar_len * count / float ( self . total ) ) ) <nl> percents = math . ceil ( 100 . 0 * count / float ( self . total ) ) <nl> - bar = ' = ' * filled_len + ' - ' * ( self . bar_len - filled_len ) <nl> - sys . stdout . write ( ' [ % s ] % s % s \ r ' % ( bar , percents , ' % ' ) ) <nl> + prog_bar = ' = ' * filled_len + ' - ' * ( self . bar_len - filled_len ) <nl> + sys . stdout . write ( ' [ % s ] % s % s \ r ' % ( prog_bar , percents , ' % ' ) ) <nl> <nl> <nl> mmm a / python / mxnet / context . py <nl> ppp b / python / mxnet / context . py <nl> <nl> # coding : utf - 8 <nl> - " " " code for context management " " " <nl> + " " " Context management API of mxnet . " " " <nl> from __future__ import absolute_import <nl> <nl> class Context ( object ) : <nl> class Context ( object ) : <nl> <nl> Examples <nl> mmmmmm - - <nl> - Switch default context example : <nl> > > > # array on cpu <nl> > > > cpu_array = mx . md . ones ( ( 2 , 3 ) ) <nl> > > > # switch default context to GPU ( 2 ) <nl> mmm a / python / mxnet / executor . py <nl> ppp b / python / mxnet / executor . py <nl> <nl> # coding : utf - 8 <nl> - # pylint : disable = invalid - name , protected - access , too - many - locals , fixme <nl> - " " " code for executor . " " " <nl> + # pylint : disable = invalid - name , protected - access , too - many - locals <nl> + " " " Symbolic Executor component of MXNet . " " " <nl> from __future__ import absolute_import <nl> <nl> import ctypes <nl> <nl> <nl> class Executor ( object ) : <nl> " " " Executor is the actual executing object of MXNet . " " " <nl> - def __init__ ( self , handle ) : <nl> - " " " Init an executor from handle <nl> + def __init__ ( self , handle , symbol ) : <nl> + " " " Constructor , used Symbol . bind and Symbol . simple_bind instead . <nl> <nl> Parameters <nl> mmmmmmmmm - <nl> handle : ExecutorHandle <nl> ExecutorHandle generated by calling Bind <nl> + <nl> + See Also <nl> + mmmmmm - - <nl> + Symbol . bind : to create executor <nl> " " " <nl> if not isinstance ( handle , ExecutorHandle ) : <nl> raise TypeError ( " Handle type error " ) <nl> def __init__ ( self , handle ) : <nl> self . grad_arrays = [ ] <nl> self . aux_arrays = [ ] <nl> self . outputs = self . _get_outputs ( ) <nl> + self . _symbol = symbol <nl> + self . _arg_dict = None <nl> + self . _grad_dict = None <nl> + self . _aux_dict = None <nl> + <nl> + @ staticmethod <nl> + def _get_dict ( names , ndarrays ) : <nl> + " " " Get the dictionary given name and ndarray pairs . " " " <nl> + nset = set ( ) <nl> + for nm in names : <nl> + if nm in nset : <nl> + raise ValueError ( ' Duplicate names detected , % s ' % str ( names ) ) <nl> + nset . add ( nm ) <nl> + return dict ( zip ( names , ndarrays ) ) <nl> + <nl> + def _get_outputs ( self ) : <nl> + " " " list all the output ndarray <nl> <nl> - def forward ( self , is_train = True ) : <nl> - " " " Do forward . <nl> + Returns <nl> + mmmmmm - <nl> + A list of ndarray binded to the heads of executor . <nl> + " " " <nl> + out_size = mx_uint ( ) <nl> + handles = ctypes . POINTER ( NDArrayHandle ) ( ) <nl> + check_call ( _LIB . MXExecutorOutputs ( self . handle , <nl> + ctypes . byref ( out_size ) , ctypes . byref ( handles ) ) ) <nl> + return [ NDArray ( NDArrayHandle ( handles [ i ] ) ) for i in range ( out_size . value ) ] <nl> + <nl> + def forward ( self , is_train = False , * * kwargs ) : <nl> + " " " Calculate the outputs specified by the binded symbol . <nl> <nl> Parameters <nl> mmmmmmmmm - <nl> - is_train : bool <nl> - whether this forward is for evaluation purpose <nl> + is_train : bool , optional <nl> + whether this forward is for evaluation purpose . <nl> + <nl> + * * kwargs <nl> + Additional specification of input arguments . <nl> + <nl> + Examples <nl> + mmmmmm - - <nl> + > > > # doing forward by specifying data <nl> + > > > texec . forward ( is_train = True , data = mydata ) <nl> + > > > # doing forward by not specifying things , but copy to the executor before hand <nl> + > > > mydata . copyto ( texec . arg_dict [ ' data ' ] ) <nl> + > > > texec . forward ( is_train = True ) <nl> " " " <nl> + if len ( kwargs ) ! = 0 : <nl> + arg_dict = self . arg_dict <nl> + for name , array in kwargs . items ( ) : <nl> + if not isinstance ( array , NDArray ) : <nl> + raise ValueError ( ' only accept keyword argument of NDArrays ' ) <nl> + if name not in arg_dict : <nl> + raise TypeError ( ' Unknown argument % s ' % name ) <nl> + array . copyto ( arg_dict [ name ] ) <nl> + <nl> check_call ( _LIB . MXExecutorForward ( <nl> self . handle , <nl> ctypes . c_int ( int ( is_train ) ) ) ) <nl> <nl> - def backward ( self , head_grads = None ) : <nl> - " " " Do backward on heads ' gradient . <nl> + def backward ( self , out_grads = None ) : <nl> + " " " Do backward pass to get the gradient of arguments . <nl> <nl> Parameters <nl> mmmmmmmmm - <nl> - head_grads : NDArray or list of NDArray , optional <nl> - Gradient on the heads <nl> + out_grads : NDArray or list of NDArray , optional <nl> + Gradient on the outputs to be propagated back . <nl> + This parameter is only needed when bind is called <nl> + on outputs that are not a loss function . <nl> " " " <nl> - if head_grads is None : <nl> - head_grads = [ ] <nl> - elif isinstance ( head_grads , NDArray ) : <nl> - head_grads = [ head_grads ] <nl> + if out_grads is None : <nl> + out_grads = [ ] <nl> + elif isinstance ( out_grads , NDArray ) : <nl> + out_grads = [ out_grads ] <nl> <nl> - for obj in head_grads : <nl> + for obj in out_grads : <nl> if not isinstance ( obj , NDArray ) : <nl> raise TypeError ( " inputs must be NDArray " ) <nl> - ndarray = c_array ( NDArrayHandle , [ item . handle for item in head_grads ] ) <nl> + ndarray = c_array ( NDArrayHandle , [ item . handle for item in out_grads ] ) <nl> check_call ( _LIB . MXExecutorBackward ( <nl> self . handle , <nl> - mx_uint ( len ( head_grads ) ) , <nl> + mx_uint ( len ( out_grads ) ) , <nl> ndarray ) ) <nl> <nl> + @ property <nl> + def arg_dict ( self ) : <nl> + " " " Get dictionary representation of argument arrrays . <nl> + <nl> + Returns <nl> + mmmmmm - <nl> + arg_dict : dict of str to NDArray <nl> + The dictionary that maps name of arguments to NDArrays . <nl> + <nl> + Raises <nl> + mmmmmm <nl> + ValueError : if there are duplicated names in the arguments . <nl> + " " " <nl> + if self . _arg_dict is None : <nl> + self . _arg_dict = Executor . _get_dict ( <nl> + self . _symbol . list_arguments ( ) , self . arg_arrays ) <nl> + return self . _arg_dict <nl> + <nl> + @ property <nl> + def aux_dict ( self ) : <nl> + " " " Get dictionary representation of auxiliary states arrays . <nl> + <nl> + Returns <nl> + mmmmmm - <nl> + aux_dict : dict of str to NDArray <nl> + The dictionary that maps name of auxiliary states to NDArrays . <nl> + <nl> + Raises <nl> + mmmmmm <nl> + ValueError : if there are duplicated names in the auxiliary states . <nl> + " " " <nl> + if self . _aux_dict is None : <nl> + self . _aux_dict = Executor . _get_dict ( <nl> + self . _symbol . list_auxiliary_states ( ) , self . aux_arrays ) <nl> + return self . _aux_dict <nl> + <nl> + def copy_params_from ( self , arg_params , aux_params = None , allow_extra_params = False ) : <nl> + " " " Copy parameters from arg_params , aux_params into executor ' s internal array . <nl> + <nl> + Parameters <nl> + mmmmmmmmm - <nl> + arg_params : dict of str to NDArray <nl> + Parameters , dict of name to NDArray of arguments <nl> + <nl> + aux_params : dict of str to NDArray , optional <nl> + Parameters , dict of name to NDArray of auxiliary states . <nl> + <nl> + allow_extra_params : boolean , optional <nl> + Whether allow extra parameters that are not needed by symbol <nl> + If this is True , no error will be thrown when arg_params or aux_params <nl> + contain extra parameters that is not needed by the executor . <nl> + <nl> + Raises <nl> + mmmmmm <nl> + ValueError <nl> + If there is additional parameters in the dict but allow_extra_params = False <nl> + " " " <nl> + for name , array in arg_params . items ( ) : <nl> + if name in self . arg_dict : <nl> + array . copyto ( self . arg_dict [ name ] ) <nl> + else : <nl> + if not allow_extra_params : <nl> + raise ValueError ( ' Find name \ " % s \ " that is not in the arguments ' % name ) <nl> + if aux_params is None : <nl> + aux_params = { } <nl> + for name , array in aux_params . items ( ) : <nl> + if name in self . aux_dict : <nl> + array . copyto ( self . aux_dict [ name ] ) <nl> + else : <nl> + if not allow_extra_params : <nl> + raise ValueError ( ' Find name % s that is not in the auxiliary states ' % name ) <nl> + <nl> def debug_str ( self ) : <nl> " " " Get a debug string about internal execution plan . <nl> <nl> def debug_str ( self ) : <nl> check_call ( _LIB . MXExecutorPrint ( <nl> self . handle , ctypes . byref ( debug_str ) ) ) <nl> return py_str ( debug_str . value ) <nl> - <nl> - def _get_outputs ( self ) : <nl> - " " " list all heads ' output ndarray <nl> - <nl> - Returns <nl> - mmmmmm - <nl> - A list of ndarray binded to the heads of executor . <nl> - " " " <nl> - out_size = mx_uint ( ) <nl> - handles = ctypes . POINTER ( NDArrayHandle ) ( ) <nl> - check_call ( _LIB . MXExecutorOutputs ( self . handle , <nl> - ctypes . byref ( out_size ) , ctypes . byref ( handles ) ) ) <nl> - return [ NDArray ( NDArrayHandle ( handles [ i ] ) ) for i in range ( out_size . value ) ] <nl> mmm a / python / mxnet / kvstore . py <nl> ppp b / python / mxnet / kvstore . py <nl> <nl> # coding : utf - 8 <nl> - # pylint : disable = invalid - name , global - statement <nl> - " " " KVStore in mxnet " " " <nl> + " " " Key value store interface of MXNet for parameter synchronization . " " " <nl> from __future__ import absolute_import <nl> <nl> import ctypes <nl> def _ctype_key_value ( keys , vals ) : <nl> return ( c_array ( ctypes . c_int , [ keys ] ) , <nl> c_array ( NDArrayHandle , [ vals . handle ] ) ) <nl> else : <nl> - for v in vals : <nl> - assert ( isinstance ( v , NDArray ) ) <nl> + for value in vals : <nl> + assert ( isinstance ( value , NDArray ) ) <nl> return ( c_array ( ctypes . c_int , [ keys ] * len ( vals ) ) , <nl> - c_array ( NDArrayHandle , [ v . handle for v in vals ] ) ) <nl> + c_array ( NDArrayHandle , [ value . handle for value in vals ] ) ) <nl> else : <nl> assert ( len ( keys ) = = len ( vals ) ) <nl> for k in keys : <nl> def __del__ ( self ) : <nl> def init ( self , key , value ) : <nl> " " " Initialize a single or a sequence of key - value pairs into the store . <nl> <nl> - For each key , one must init it before push and pull <nl> + For each key , one must init it before push and pull . <nl> <nl> Parameters <nl> mmmmmmmmm - <nl> def push ( self , key , value , priority = 0 ) : <nl> mmmmmmmmm - <nl> key : int or list of int <nl> Keys <nl> + <nl> value : NDArray or list of NDArray or list of list of NDArray <nl> According values <nl> + <nl> priority : int , optional <nl> The priority of the push operation . <nl> The higher the priority , the faster this action is likely <nl> def push ( self , key , value , priority = 0 ) : <nl> ctypes . c_int ( priority ) ) ) <nl> <nl> def pull ( self , key , out = None , priority = 0 ) : <nl> - " " " Pull a single value or a sequence of values from the store <nl> + " " " Pull a single value or a sequence of values from the store . <nl> <nl> Parameters <nl> mmmmmmmmm - <nl> key : int or list of int <nl> Keys <nl> + <nl> out : NDArray or list of NDArray or list of list of NDArray <nl> According values <nl> + <nl> priority : int , optional <nl> The priority of the push operation . <nl> The higher the priority , the faster this action is likely <nl> mmm a / python / mxnet / metric . py <nl> ppp b / python / mxnet / metric . py <nl> <nl> - # pylint : disable = invalid - name <nl> + # coding : utf - 8 <nl> " " " Online evaluation metric module . " " " <nl> + from __future__ import absolute_import <nl> + <nl> from . base import string_types <nl> import numpy <nl> <nl> def __init__ ( self ) : <nl> def update ( self , label , pred ) : <nl> pred = pred . asnumpy ( ) <nl> label = label . asnumpy ( ) . astype ( ' int32 ' ) <nl> - py = numpy . argmax ( pred , axis = 1 ) <nl> - self . sum_metric + = numpy . sum ( py = = label ) <nl> + pred_label = numpy . argmax ( pred , axis = 1 ) <nl> + self . sum_metric + = numpy . sum ( pred_label = = label ) <nl> self . num_inst + = label . size <nl> <nl> <nl> def update ( self , label , pred ) : <nl> self . sum_metric + = self . _feval ( label , pred ) <nl> self . num_inst + = 1 <nl> <nl> - <nl> + # pylint : disable = invalid - name <nl> def np ( numpy_feval , name = None ) : <nl> " " " Create a customized metric from numpy function . <nl> <nl> def feval ( label , pred ) : <nl> return numpy_feval ( label . asnumpy ( ) , pred . asnumpy ( ) ) <nl> feval . __name__ = numpy_feval . __name__ <nl> return CustomMetric ( feval , name ) <nl> - <nl> + # pylint : enable = invalid - name <nl> <nl> def create ( metric ) : <nl> " " " Create an evaluation metric . <nl> mmm a / python / mxnet / model . py <nl> ppp b / python / mxnet / model . py <nl> <nl> # pylint : disable = fixme , invalid - name , too - many - arguments , too - many - locals <nl> - # pylint : disable = too - many - branches , too - many - statements , unused - argument <nl> + # pylint : disable = too - many - branches , too - many - statements <nl> " " " MXNet model module " " " <nl> from __future__ import absolute_import <nl> <nl> def _train_multi_device ( symbol , ctx , input_shape , <nl> aux_blocks = [ <nl> [ x . aux_arrays [ index ] for x in train_execs ] <nl> for index in range ( len ( train_execs [ 0 ] . aux_arrays ) ) ] <nl> - for name , block in zip ( arg_names , arg_blocks ) : <nl> - if name in arg_params : <nl> - for w in block : <nl> - arg_params [ name ] . copyto ( w ) <nl> - for name , block in zip ( aux_names , aux_blocks ) : <nl> - if name in aux_params : <nl> - for w in block : <nl> - aux_params [ name ] . copyto ( w ) <nl> + <nl> + for texec in train_execs : <nl> + texec . copy_params_from ( arg_params , aux_params ) <nl> + <nl> # ky value store <nl> kv = kvstore . create ( ) if num_device ! = 1 else None <nl> opt_state_blocks = [ ] <nl> def _train_multi_device ( symbol , ctx , input_shape , <nl> data [ islice ] . copyto ( target ) <nl> # forward backward pass <nl> for texec , islice in zip ( train_execs , slices ) : <nl> - texec . forward ( ) <nl> + texec . forward ( is_train = True ) <nl> texec . outputs [ 0 ] . copyto ( out_cpu_array [ islice ] ) <nl> for texec in train_execs : <nl> texec . backward ( ) <nl> mmm a / python / mxnet / ndarray . py <nl> ppp b / python / mxnet / ndarray . py <nl> <nl> # coding : utf - 8 <nl> - " " " NDArray interface of mxnet " " " <nl> + " " " NDArray API of mxnet . " " " <nl> from __future__ import absolute_import <nl> <nl> import ctypes <nl> def empty ( shape , ctx = None ) : <nl> out : Array <nl> The created NDArray . <nl> " " " <nl> + if isinstance ( shape , int ) : <nl> + shape = ( shape , ) <nl> if ctx is None : <nl> ctx = Context . default_ctx <nl> return NDArray ( handle = _new_alloc_handle ( shape , ctx , False ) ) <nl> def load ( fname ) : <nl> fname : str <nl> The name of the file . Can be S3 or HDFS address ( remember built with S3 support ) . <nl> Example of fname : <nl> - - s3 : / / my - bucket / path / my - s3 - ndarray <nl> - - hdfs : / / my - bucket / path / my - hdfs - ndarray <nl> - - / path - to / my - local - ndarray <nl> + <nl> + - ` s3 : / / my - bucket / path / my - s3 - ndarray ` <nl> + - ` hdfs : / / my - bucket / path / my - hdfs - ndarray ` <nl> + - ` / path - to / my - local - ndarray ` <nl> <nl> Returns <nl> mmmmmm - <nl> def save ( fname , data ) : <nl> fname : str <nl> The name of the file . Can be S3 or HDFS address ( remember built with S3 support ) . <nl> Example of fname : <nl> - - s3 : / / my - bucket / path / my - s3 - ndarray <nl> - - hdfs : / / my - bucket / path / my - hdfs - ndarray <nl> - - / path - to / my - local - ndarray <nl> + <nl> + - ` s3 : / / my - bucket / path / my - s3 - ndarray ` <nl> + - ` hdfs : / / my - bucket / path / my - hdfs - ndarray ` <nl> + - ` / path - to / my - local - ndarray ` <nl> <nl> data : list of NDArray or dict of str to NDArray <nl> The data to be saved . <nl> mmm a / python / mxnet / symbol . py <nl> ppp b / python / mxnet / symbol . py <nl> <nl> # coding : utf - 8 <nl> - # pylint : disable = invalid - name , protected - access , fixme , too - many - arguments <nl> - " " " Symbolic support of mxnet . <nl> - <nl> - Symbolic API of MXNet <nl> - <nl> - " " " <nl> + # pylint : disable = invalid - name , protected - access , too - many - arguments <nl> + " " " Symbolic configuration API of mxnet . " " " <nl> from __future__ import absolute_import <nl> <nl> import ctypes <nl> def bind ( self , ctx , args , args_grad = None , grad_req = ' write ' , aux_states = None ) : <nl> mx_uint ( len ( aux_states ) ) , <nl> aux_args_handle , <nl> ctypes . byref ( handle ) ) ) <nl> - executor = Executor ( handle ) <nl> - <nl> + executor = Executor ( handle , self ) <nl> executor . arg_arrays = args <nl> executor . grad_arrays = args_grad <nl> executor . aux_arrays = aux_states <nl> mmm a / python / mxnet / visualization . py <nl> ppp b / python / mxnet / visualization . py <nl> <nl> # coding : utf - 8 <nl> - # pylint : disable = invalid - name , protected - access , too - many - locals , fixme <nl> - # pylint : disable = unused - argument , too - many - branches , too - many - statements <nl> - # pylint : disable = unused - variable <nl> + # pylint : disable = invalid - name , too - many - locals , fixme <nl> + # pylint : disable = too - many - branches , too - many - statements <nl> " " " Visualization module " " " <nl> from __future__ import absolute_import <nl> <nl> | Merge pull request from tqchen / master | apache/incubator-mxnet | e4193cf025066d6cfa4db3ed6ab555475bffd9da | 2015-09-27T20:17:04Z |
mmm a / torch / _torch_docs . py <nl> ppp b / torch / _torch_docs . py <nl> def merge_dicts ( * dicts ) : <nl> <nl> . . math : : <nl> \ text { { heaviside } } ( input , values ) = \ begin { cases } <nl> - \ 0 , & \ text { if input < 0 } \ \ <nl> - \ values , & \ text { if input = = 0 } \ \ <nl> - \ 1 , & \ text { if input > 0 } <nl> + 0 , & \ text { if input < 0 } \ \ <nl> + values , & \ text { if input = = 0 } \ \ <nl> + 1 , & \ text { if input > 0 } <nl> \ end { cases } <nl> " " " + r " " " <nl> <nl> | Fix latex error in heaviside docs ( ) | pytorch/pytorch | 8daaa3bc7eed2f8267a437180fb6449885ecc773 | 2020-09-13T23:42:19Z |
mmm a / . gitignore <nl> ppp b / . gitignore <nl> <nl> * tmp * <nl> * . rabit <nl> * . mock <nl> - dmlc - core <nl> recommonmark <nl> recom <nl> _ * <nl> mmm a / CMakeLists . txt <nl> ppp b / CMakeLists . txt <nl> if ( RABIT_BUILD_TESTS ) <nl> endif ( ) <nl> <nl> foreach ( lib $ { rabit_libs } ) <nl> - # include " . / internal / utils . h " <nl> + # include " . / internal / utils . h " <nl> target_include_directories ( $ { lib } PUBLIC <nl> - " $ < BUILD_INTERFACE : $ { CMAKE_CURRENT_LIST_DIR } / include > " <nl> + " $ < BUILD_INTERFACE : $ { CMAKE_CURRENT_LIST_DIR } / include > " <nl> " $ < BUILD_INTERFACE : $ { CMAKE_CURRENT_LIST_DIR } / include / rabit > " <nl> - ) <nl> + ) <nl> endforeach ( ) <nl> <nl> if ( RABIT_BUILD_TESTS ) <nl> if ( RABIT_BUILD_TESTS ) <nl> if ( RABIT_BUILD_MPI ) <nl> add_executable ( speed_test_mpi test / speed_test . cc ) <nl> target_link_libraries ( speed_test_mpi rabit_mpi ) <nl> - install ( TARGETS speed_test_mpi DESTINATION bin ) <nl> + install ( TARGETS speed_test_mpi DESTINATION bin ) <nl> endif ( ) <nl> endif ( ) <nl> <nl> mmm a / Makefile <nl> ppp b / Makefile <nl> lib / librabit_empty . a : $ ( BPATH ) / engine_empty . o $ ( BPATH ) / c_api . o <nl> lib / librabit_mpi . a lib / librabit_mpi . so : $ ( MPIOBJ ) <nl> <nl> $ ( OBJ ) : <nl> - $ ( CXX ) - c $ ( CFLAGS ) - o $ @ $ ( firstword $ ( filter % . cpp % . c % . cc , $ ^ ) ) <nl> + $ ( CXX ) - c $ ( CFLAGS ) - o $ @ $ ( firstword $ ( filter % . cpp % . c % . cc , $ ^ ) ) - I include / <nl> <nl> $ ( MPIOBJ ) : <nl> $ ( MPICXX ) - c $ ( CFLAGS ) - o $ @ $ ( firstword $ ( filter % . cpp % . c % . cc , $ ^ ) ) <nl> mmm a / include / dmlc / io . h <nl> ppp b / include / dmlc / io . h <nl> <nl> # include < istream > <nl> # include < ostream > <nl> # include < streambuf > <nl> - # include " . / logging . h " <nl> + <nl> + # include " dmlc / base . h " <nl> <nl> / / include uint64_t only to make io standalone <nl> # ifdef _MSC_VER <nl> deleted file mode 100644 <nl> index 69d0d36dfd . . 0000000000 <nl> mmm a / include / dmlc / logging . h <nl> ppp / dev / null <nl> <nl> - / * ! <nl> - * Copyright ( c ) 2015 by Contributors <nl> - * \ file logging . h <nl> - * \ brief defines logging macros of dmlc <nl> - * allows use of GLOG , fall back to internal <nl> - * implementation when disabled <nl> - * / <nl> - # ifndef DMLC_LOGGING_H_ <nl> - # define DMLC_LOGGING_H_ <nl> - # include < cstdio > <nl> - # include < cstdlib > <nl> - # include < string > <nl> - # include < vector > <nl> - # include < stdexcept > <nl> - # include " . / base . h " <nl> - <nl> - # if DMLC_LOG_STACK_TRACE <nl> - # include < execinfo . h > <nl> - # endif <nl> - <nl> - namespace dmlc { <nl> - / * ! <nl> - * \ brief exception class that will be thrown by <nl> - * default logger if DMLC_LOG_FATAL_THROW = = 1 <nl> - * / <nl> - struct Error : public std : : runtime_error { <nl> - / * ! <nl> - * \ brief constructor <nl> - * \ param s the error message <nl> - * / <nl> - explicit Error ( const std : : string & s ) : std : : runtime_error ( s ) { } <nl> - } ; <nl> - } / / namespace dmlc <nl> - <nl> - # if DMLC_USE_GLOG <nl> - # include < glog / logging . h > <nl> - <nl> - namespace dmlc { <nl> - / * ! <nl> - * \ brief optionally redirect to google ' s init log <nl> - * \ param argv0 The arguments . <nl> - * / <nl> - inline void InitLogging ( const char * argv0 ) { <nl> - google : : InitGoogleLogging ( argv0 ) ; <nl> - } <nl> - } / / namespace dmlc <nl> - <nl> - # else <nl> - / / use a light version of glog <nl> - # include < assert . h > <nl> - # include < iostream > <nl> - # include < sstream > <nl> - # include < ctime > <nl> - <nl> - # if defined ( _MSC_VER ) <nl> - # pragma warning ( disable : 4722 ) <nl> - # endif <nl> - <nl> - namespace dmlc { <nl> - inline void InitLogging ( const char * ) { <nl> - / / DO NOTHING <nl> - } <nl> - <nl> - class LogCheckError { <nl> - public : <nl> - LogCheckError ( ) : str ( nullptr ) { } <nl> - explicit LogCheckError ( const std : : string & str_ ) : str ( new std : : string ( str_ ) ) { } <nl> - ~ LogCheckError ( ) { if ( str ! = nullptr ) delete str ; } <nl> - operator bool ( ) { return str ! = nullptr ; } <nl> - std : : string * str ; <nl> - } ; <nl> - <nl> - # define DEFINE_CHECK_FUNC ( name , op ) \ <nl> - template < typename X , typename Y > \ <nl> - inline LogCheckError LogCheck # # name ( const X & x , const Y & y ) { \ <nl> - if ( x op y ) return LogCheckError ( ) ; \ <nl> - std : : ostringstream os ; \ <nl> - os < < " ( " < < x < < " vs . " < < y < < " ) " ; / * CHECK_XX ( x , y ) requires x and y can be serialized to string . Use CHECK ( x OP y ) otherwise . NOLINT ( * ) * / \ <nl> - return LogCheckError ( os . str ( ) ) ; \ <nl> - } \ <nl> - inline LogCheckError LogCheck # # name ( int x , int y ) { \ <nl> - return LogCheck # # name < int , int > ( x , y ) ; \ <nl> - } <nl> - <nl> - # define CHECK_BINARY_OP ( name , op , x , y ) \ <nl> - if ( dmlc : : LogCheckError _check_err = dmlc : : LogCheck # # name ( x , y ) ) \ <nl> - dmlc : : LogMessageFatal ( __FILE__ , __LINE__ ) . stream ( ) \ <nl> - < < " Check failed : " < < # x " " # op " " # y < < * ( _check_err . str ) <nl> - <nl> - DEFINE_CHECK_FUNC ( _LT , < ) <nl> - DEFINE_CHECK_FUNC ( _GT , > ) <nl> - DEFINE_CHECK_FUNC ( _LE , < = ) <nl> - DEFINE_CHECK_FUNC ( _GE , > = ) <nl> - DEFINE_CHECK_FUNC ( _EQ , = = ) <nl> - DEFINE_CHECK_FUNC ( _NE , ! = ) <nl> - <nl> - / / Always - on checking <nl> - # define CHECK ( x ) \ <nl> - if ( ! ( x ) ) \ <nl> - dmlc : : LogMessageFatal ( __FILE__ , __LINE__ ) . stream ( ) \ <nl> - < < " Check failed : " # x < < ' ' <nl> - # define CHECK_LT ( x , y ) CHECK_BINARY_OP ( _LT , < , x , y ) <nl> - # define CHECK_GT ( x , y ) CHECK_BINARY_OP ( _GT , > , x , y ) <nl> - # define CHECK_LE ( x , y ) CHECK_BINARY_OP ( _LE , < = , x , y ) <nl> - # define CHECK_GE ( x , y ) CHECK_BINARY_OP ( _GE , > = , x , y ) <nl> - # define CHECK_EQ ( x , y ) CHECK_BINARY_OP ( _EQ , = = , x , y ) <nl> - # define CHECK_NE ( x , y ) CHECK_BINARY_OP ( _NE , ! = , x , y ) <nl> - # define CHECK_NOTNULL ( x ) \ <nl> - ( ( x ) = = NULL ? dmlc : : LogMessageFatal ( __FILE__ , __LINE__ ) . stream ( ) < < " Check notnull : " # x < < ' ' , ( x ) : ( x ) ) / / NOLINT ( * ) <nl> - / / Debug - only checking . <nl> - # ifdef NDEBUG <nl> - # define DCHECK ( x ) \ <nl> - while ( false ) CHECK ( x ) <nl> - # define DCHECK_LT ( x , y ) \ <nl> - while ( false ) CHECK ( ( x ) < ( y ) ) <nl> - # define DCHECK_GT ( x , y ) \ <nl> - while ( false ) CHECK ( ( x ) > ( y ) ) <nl> - # define DCHECK_LE ( x , y ) \ <nl> - while ( false ) CHECK ( ( x ) < = ( y ) ) <nl> - # define DCHECK_GE ( x , y ) \ <nl> - while ( false ) CHECK ( ( x ) > = ( y ) ) <nl> - # define DCHECK_EQ ( x , y ) \ <nl> - while ( false ) CHECK ( ( x ) = = ( y ) ) <nl> - # define DCHECK_NE ( x , y ) \ <nl> - while ( false ) CHECK ( ( x ) ! = ( y ) ) <nl> - # else <nl> - # define DCHECK ( x ) CHECK ( x ) <nl> - # define DCHECK_LT ( x , y ) CHECK ( ( x ) < ( y ) ) <nl> - # define DCHECK_GT ( x , y ) CHECK ( ( x ) > ( y ) ) <nl> - # define DCHECK_LE ( x , y ) CHECK ( ( x ) < = ( y ) ) <nl> - # define DCHECK_GE ( x , y ) CHECK ( ( x ) > = ( y ) ) <nl> - # define DCHECK_EQ ( x , y ) CHECK ( ( x ) = = ( y ) ) <nl> - # define DCHECK_NE ( x , y ) CHECK ( ( x ) ! = ( y ) ) <nl> - # endif / / NDEBUG <nl> - <nl> - # if DMLC_LOG_CUSTOMIZE <nl> - # define LOG_INFO dmlc : : CustomLogMessage ( __FILE__ , __LINE__ ) <nl> - # else <nl> - # define LOG_INFO dmlc : : LogMessage ( __FILE__ , __LINE__ ) <nl> - # endif <nl> - # define LOG_ERROR LOG_INFO <nl> - # define LOG_WARNING LOG_INFO <nl> - # define LOG_FATAL dmlc : : LogMessageFatal ( __FILE__ , __LINE__ ) <nl> - # define LOG_QFATAL LOG_FATAL <nl> - <nl> - / / Poor man version of VLOG <nl> - # define VLOG ( x ) LOG_INFO . stream ( ) <nl> - <nl> - # define LOG ( severity ) LOG_ # # severity . stream ( ) <nl> - # define LG LOG_INFO . stream ( ) <nl> - # define LOG_IF ( severity , condition ) \ <nl> - ! ( condition ) ? ( void ) 0 : dmlc : : LogMessageVoidify ( ) & LOG ( severity ) <nl> - <nl> - # ifdef NDEBUG <nl> - # define LOG_DFATAL LOG_ERROR <nl> - # define DFATAL ERROR <nl> - # define DLOG ( severity ) true ? ( void ) 0 : dmlc : : LogMessageVoidify ( ) & LOG ( severity ) <nl> - # define DLOG_IF ( severity , condition ) \ <nl> - ( true | | ! ( condition ) ) ? ( void ) 0 : dmlc : : LogMessageVoidify ( ) & LOG ( severity ) <nl> - # else <nl> - # define LOG_DFATAL LOG_FATAL <nl> - # define DFATAL FATAL <nl> - # define DLOG ( severity ) LOG ( severity ) <nl> - # define DLOG_IF ( severity , condition ) LOG_IF ( severity , condition ) <nl> - # endif <nl> - <nl> - / / Poor man version of LOG_EVERY_N <nl> - # define LOG_EVERY_N ( severity , n ) LOG ( severity ) <nl> - <nl> - class DateLogger { <nl> - public : <nl> - DateLogger ( ) { <nl> - # if defined ( _MSC_VER ) <nl> - _tzset ( ) ; <nl> - # endif <nl> - } <nl> - const char * HumanDate ( ) { <nl> - # if defined ( _MSC_VER ) <nl> - _strtime_s ( buffer_ , sizeof ( buffer_ ) ) ; <nl> - # else <nl> - time_t time_value = time ( NULL ) ; <nl> - struct tm * pnow ; <nl> - # if ! defined ( _WIN32 ) <nl> - struct tm now ; <nl> - pnow = localtime_r ( & time_value , & now ) ; <nl> - # else <nl> - pnow = localtime ( & time_value ) ; / / NOLINT ( * ) <nl> - # endif <nl> - snprintf ( buffer_ , sizeof ( buffer_ ) , " % 02d : % 02d : % 02d " , <nl> - pnow - > tm_hour , pnow - > tm_min , pnow - > tm_sec ) ; <nl> - # endif <nl> - return buffer_ ; <nl> - } <nl> - <nl> - private : <nl> - char buffer_ [ 9 ] ; <nl> - } ; <nl> - <nl> - class LogMessage { <nl> - public : <nl> - LogMessage ( const char * file , int line ) <nl> - : <nl> - # ifdef __ANDROID__ <nl> - log_stream_ ( std : : cout ) <nl> - # else <nl> - log_stream_ ( std : : cerr ) <nl> - # endif <nl> - { <nl> - log_stream_ < < " [ " < < pretty_date_ . HumanDate ( ) < < " ] " < < file < < " : " <nl> - < < line < < " : " ; <nl> - } <nl> - ~ LogMessage ( ) { log_stream_ < < ' \ n ' ; } <nl> - std : : ostream & stream ( ) { return log_stream_ ; } <nl> - <nl> - protected : <nl> - std : : ostream & log_stream_ ; <nl> - <nl> - private : <nl> - DateLogger pretty_date_ ; <nl> - LogMessage ( const LogMessage & ) ; <nl> - void operator = ( const LogMessage & ) ; <nl> - } ; <nl> - <nl> - / / customized logger that can allow user to define where to log the message . <nl> - class CustomLogMessage { <nl> - public : <nl> - CustomLogMessage ( const char * file , int line ) { <nl> - log_stream_ < < " [ " < < DateLogger ( ) . HumanDate ( ) < < " ] " < < file < < " : " <nl> - < < line < < " : " ; <nl> - } <nl> - ~ CustomLogMessage ( ) { <nl> - Log ( log_stream_ . str ( ) ) ; <nl> - } <nl> - std : : ostream & stream ( ) { return log_stream_ ; } <nl> - / * ! <nl> - * \ brief customized logging of the message . <nl> - * This function won ' t be implemented by libdmlc <nl> - * \ param msg The message to be logged . <nl> - * / <nl> - static void Log ( const std : : string & msg ) ; <nl> - <nl> - private : <nl> - std : : ostringstream log_stream_ ; <nl> - } ; <nl> - <nl> - # if DMLC_LOG_FATAL_THROW = = 0 <nl> - class LogMessageFatal : public LogMessage { <nl> - public : <nl> - LogMessageFatal ( const char * file , int line ) : LogMessage ( file , line ) { } <nl> - ~ LogMessageFatal ( ) { <nl> - # if DMLC_LOG_STACK_TRACE <nl> - const int MAX_STACK_SIZE = 10 ; <nl> - void * stack [ MAX_STACK_SIZE ] ; <nl> - <nl> - int nframes = backtrace ( stack , MAX_STACK_SIZE ) ; <nl> - log_stream_ < < " \ n \ n " < < " Stack trace returned " < < nframes < < " entries : \ n " ; <nl> - char * * msgs = backtrace_symbols ( stack , nframes ) ; <nl> - if ( msgs ! = nullptr ) { <nl> - for ( int i = 0 ; i < nframes ; + + i ) { <nl> - log_stream_ < < " [ bt ] ( " < < i < < " ) " < < msgs [ i ] < < " \ n " ; <nl> - } <nl> - } <nl> - # endif <nl> - <nl> - log_stream_ < < " \ n " ; <nl> - abort ( ) ; <nl> - } <nl> - <nl> - private : <nl> - LogMessageFatal ( const LogMessageFatal & ) ; <nl> - void operator = ( const LogMessageFatal & ) ; <nl> - } ; <nl> - # else <nl> - class LogMessageFatal { <nl> - public : <nl> - LogMessageFatal ( const char * file , int line ) { <nl> - log_stream_ < < " [ " < < pretty_date_ . HumanDate ( ) < < " ] " < < file < < " : " <nl> - < < line < < " : " ; <nl> - } <nl> - std : : ostringstream & stream ( ) { return log_stream_ ; } <nl> - ~ LogMessageFatal ( ) DMLC_THROW_EXCEPTION { <nl> - # if DMLC_LOG_STACK_TRACE <nl> - const int MAX_STACK_SIZE = 10 ; <nl> - void * stack [ MAX_STACK_SIZE ] ; <nl> - <nl> - int nframes = backtrace ( stack , MAX_STACK_SIZE ) ; <nl> - log_stream_ < < " \ n \ n " < < " Stack trace returned " < < nframes < < " entries : \ n " ; <nl> - char * * msgs = backtrace_symbols ( stack , nframes ) ; <nl> - if ( msgs ! = nullptr ) { <nl> - for ( int i = 0 ; i < nframes ; + + i ) { <nl> - log_stream_ < < " [ bt ] ( " < < i < < " ) " < < msgs [ i ] < < " \ n " ; <nl> - } <nl> - } <nl> - # endif <nl> - <nl> - / / throwing out of destructor is evil <nl> - / / hopefully we can do it here <nl> - / / also log the message before throw <nl> - # if DMLC_LOG_BEFORE_THROW <nl> - LOG ( ERROR ) < < log_stream_ . str ( ) ; <nl> - # endif <nl> - throw Error ( log_stream_ . str ( ) ) ; <nl> - } <nl> - <nl> - private : <nl> - std : : ostringstream log_stream_ ; <nl> - DateLogger pretty_date_ ; <nl> - LogMessageFatal ( const LogMessageFatal & ) ; <nl> - void operator = ( const LogMessageFatal & ) ; <nl> - } ; <nl> - # endif <nl> - <nl> - / / This class is used to explicitly ignore values in the conditional <nl> - / / logging macros . This avoids compiler warnings like " value computed <nl> - / / is not used " and " statement has no effect " . <nl> - class LogMessageVoidify { <nl> - public : <nl> - LogMessageVoidify ( ) { } <nl> - / / This has to be an operator with a precedence lower than < < but <nl> - / / higher than " ? : " . See its usage . <nl> - void operator & ( std : : ostream & ) { } <nl> - } ; <nl> - <nl> - } / / namespace dmlc <nl> - <nl> - # endif <nl> - # endif / / DMLC_LOGGING_H_ <nl> mmm a / include / dmlc / serializer . h <nl> ppp b / include / dmlc / serializer . h <nl> <nl> <nl> # include " . / base . h " <nl> # include " . / io . h " <nl> - # include " . / logging . h " <nl> # include " . / type_traits . h " <nl> <nl> # if DMLC_USE_CXX11 <nl> mmm a / include / rabit / serializable . h <nl> ppp b / include / rabit / serializable . h <nl> <nl> # include < vector > <nl> # include < string > <nl> # include " . / internal / utils . h " <nl> - # include " . . / dmlc / io . h " <nl> + # include " dmlc / io . h " <nl> <nl> namespace rabit { <nl> / * ! <nl> | Remove dmlc logging . ( ) | dmlc/xgboost | 0101a4719ce9c368584716250e732849d9c56700 | 2019-02-17T02:37:54Z |
mmm a / xbmc / addons / Repository . cpp <nl> ppp b / xbmc / addons / Repository . cpp <nl> bool CRepositoryUpdateJob : : DoWork ( ) <nl> / / unnecessary HEAD requests being sent to server . icons and fanart rarely <nl> / / change , and cannot change if there is no version bump . <nl> { <nl> - CTextureDatabase textureDB ; <nl> - textureDB . Open ( ) ; <nl> - textureDB . BeginMultipleExecute ( ) ; <nl> + CTextureDatabase textureDB ; <nl> + textureDB . Open ( ) ; <nl> + textureDB . BeginMultipleExecute ( ) ; <nl> <nl> for ( const auto & addon : addons ) <nl> - { <nl> + { <nl> if ( ! addon - > Props ( ) . fanart . empty ( ) ) <nl> textureDB . InvalidateCachedTexture ( addon - > Props ( ) . fanart ) ; <nl> if ( ! addon - > Props ( ) . icon . empty ( ) ) <nl> bool CRepositoryUpdateJob : : DoWork ( ) <nl> / / Unbroken <nl> CLog : : Log ( LOGDEBUG , " CRepositoryUpdateJob [ % s ] addon ' % s ' unbroken " , <nl> m_repo - > ID ( ) . c_str ( ) , addon - > ID ( ) . c_str ( ) ) ; <nl> + } <nl> } <nl> - } <nl> <nl> / / Update broken status <nl> database . BreakAddon ( addon - > ID ( ) , addon - > Props ( ) . broken ) ; <nl> CRepositoryUpdateJob : : FetchStatus CRepositoryUpdateJob : : FetchIfChanged ( const std <nl> if ( oldChecksum = = checksum & & ! oldChecksum . empty ( ) ) <nl> return STATUS_NOT_MODIFIED ; <nl> <nl> - std : : map < std : : string , AddonPtr > uniqueAddons ; <nl> + std : : map < std : : string , AddonPtr > uniqueAddons ; <nl> for ( auto it = m_repo - > m_dirs . cbegin ( ) ; it ! = m_repo - > m_dirs . cend ( ) ; + + it ) <nl> - { <nl> + { <nl> if ( ShouldCancel ( m_repo - > m_dirs . size ( ) + std : : distance ( m_repo - > m_dirs . cbegin ( ) , it ) , total ) ) <nl> return STATUS_ERROR ; <nl> <nl> - VECADDONS addons ; <nl> - if ( ! CRepository : : Parse ( * it , addons ) ) <nl> + VECADDONS addons ; <nl> + if ( ! CRepository : : Parse ( * it , addons ) ) <nl> { <nl> CLog : : Log ( LOGERROR , " CRepositoryUpdateJob [ % s ] failed to read or parse " <nl> " directory ' % s ' " , m_repo - > ID ( ) . c_str ( ) , it - > info . c_str ( ) ) ; <nl> return STATUS_ERROR ; <nl> - } <nl> - MergeAddons ( uniqueAddons , addons ) ; <nl> } <nl> + MergeAddons ( uniqueAddons , addons ) ; <nl> + } <nl> + <nl> <nl> for ( const auto & kv : uniqueAddons ) <nl> addons . push_back ( kv . second ) ; <nl> | Merge pull request from Paxxi / fix_indent | xbmc/xbmc | 0b044042325aeccb896cd780fbf33f844144e29d | 2015-09-12T19:46:34Z |
mmm a / CMakeLists . txt <nl> ppp b / CMakeLists . txt <nl> OCV_OPTION ( ENABLE_PRECOMPILED_HEADERS " Use precompiled headers " <nl> OCV_OPTION ( ENABLE_SOLUTION_FOLDERS " Solution folder in Visual Studio or in other IDEs " ( MSVC_IDE OR CMAKE_GENERATOR MATCHES Xcode ) ) <nl> OCV_OPTION ( ENABLE_PROFILING " Enable profiling in the GCC compiler ( Add flags : - g - pg ) " OFF IF CV_GCC ) <nl> OCV_OPTION ( ENABLE_COVERAGE " Enable coverage collection with GCov " OFF IF CV_GCC ) <nl> + OCV_OPTION ( OPENCV_ENABLE_MEMORY_SANITIZER " Better support for memory / address sanitizers " OFF ) <nl> OCV_OPTION ( ENABLE_OMIT_FRAME_POINTER " Enable - fomit - frame - pointer for GCC " ON IF CV_GCC ) <nl> OCV_OPTION ( ENABLE_POWERPC " Enable PowerPC for GCC " ON IF ( CV_GCC AND CMAKE_SYSTEM_PROCESSOR MATCHES powerpc . * ) ) <nl> OCV_OPTION ( ENABLE_FAST_MATH " Enable - ffast - math ( not recommended for GCC 4 . 6 . x ) " OFF IF ( CV_GCC AND ( X86 OR X86_64 ) ) ) <nl> mmm a / cmake / OpenCVCompilerOptions . cmake <nl> ppp b / cmake / OpenCVCompilerOptions . cmake <nl> macro ( ocv_add_modules_compiler_options ) <nl> string ( REPLACE " / W3 " " / W4 " $ { flags } " $ { $ { flags } } " ) <nl> endforeach ( ) <nl> endif ( ) <nl> + if ( OPENCV_ENABLE_MEMORY_SANITIZER ) <nl> + add_definitions ( - DOPENCV_ENABLE_MEMORY_SANITIZER = 1 ) <nl> + endif ( ) <nl> endmacro ( ) <nl> mmm a / modules / core / include / opencv2 / core / utility . hpp <nl> ppp b / modules / core / include / opencv2 / core / utility . hpp <nl> CV_EXPORTS void setUseCollection ( bool flag ) ; / / set implementation collection st <nl> } <nl> \ endcode <nl> * / <nl> + # ifdef OPENCV_ENABLE_MEMORY_SANITIZER <nl> + template < typename _Tp , size_t fixed_size = 0 > class AutoBuffer <nl> + # else <nl> template < typename _Tp , size_t fixed_size = 1024 / sizeof ( _Tp ) + 8 > class AutoBuffer <nl> + # endif <nl> { <nl> public : <nl> typedef _Tp value_type ; <nl> | build : + OPENCV_ENABLE_MEMORY_SANITIZER flag | opencv/opencv | c1981f28ad98e933d5a89ca1ae36ff7008175d08 | 2019-04-22T21:35:25Z |
mmm a / tensorflow / contrib / gan / python / estimator / python / gan_estimator_impl . py <nl> ppp b / tensorflow / contrib / gan / python / estimator / python / gan_estimator_impl . py <nl> class SummaryType ( enum . IntEnum ) : <nl> class GANEstimator ( estimator . Estimator ) : <nl> " " " An estimator for Generative Adversarial Networks ( GANs ) . <nl> <nl> - This Estimator is backed by TFGAN . <nl> + This Estimator is backed by TFGAN . The network functions follow the TFGAN API <nl> + except for one exception : if either ` generator_fn ` or ` discriminator_fn ` have <nl> + an argument called ` mode ` , then the tf . Estimator mode is passed in for that <nl> + argument . This helps with operations like batch normalization , which have <nl> + different train and evaluation behavior . <nl> <nl> Example : <nl> <nl> def _gan_model_fn ( <nl> def _make_gan_model ( generator_fn , discriminator_fn , real_data , <nl> generator_inputs , generator_scope , add_summaries , mode ) : <nl> " " " Make a ` GANModel ` , and optionally pass in ` mode ` . " " " <nl> - # If ` generator_fn ` has an argument ` mode ` , pass mode to it . <nl> + # If network functions have an argument ` mode ` , pass mode to it . <nl> if ' mode ' in inspect . getargspec ( generator_fn ) . args : <nl> generator_fn = functools . partial ( generator_fn , mode = mode ) <nl> + if ' mode ' in inspect . getargspec ( discriminator_fn ) . args : <nl> + discriminator_fn = functools . partial ( discriminator_fn , mode = mode ) <nl> gan_model = tfgan_train . gan_model ( <nl> generator_fn , <nl> discriminator_fn , <nl> mmm a / tensorflow / contrib / gan / python / estimator / python / gan_estimator_test . py <nl> ppp b / tensorflow / contrib / gan / python / estimator / python / gan_estimator_test . py <nl> def generator_fn ( noise_dict , mode ) : <nl> return layers . fully_connected ( noise , noise . shape [ 1 ] . value ) <nl> <nl> <nl> - def discriminator_fn ( data , _ ) : <nl> + def discriminator_fn ( data , unused_conditioning , mode ) : <nl> + del unused_conditioning , mode <nl> return layers . fully_connected ( data , 1 ) <nl> <nl> <nl> def _or_none ( x ) : <nl> else : <nl> testcase . assertEqual ( discriminator_scope_name , <nl> gan_model . discriminator_scope . name ) <nl> - testcase . assertEqual ( _or_none ( discriminator_fn ) , gan_model . discriminator_fn ) <nl> <nl> with ops . control_dependencies ( assertions ) : <nl> if mode = = model_fn_lib . ModeKeys . TRAIN : <nl> | Support ` mode ` option to discriminator function in GANEstimator . | tensorflow/tensorflow | 9560054b18ad3fc9faa296d344e062876858817a | 2018-01-30T16:11:03Z |
mmm a / hphp / runtime / base / mixed - array . cpp <nl> ppp b / hphp / runtime / base / mixed - array . cpp <nl> NEVER_INLINE MixedArray * MixedArray : : copyMixed ( ) const { <nl> <nl> / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / <nl> <nl> - Variant MixedArray : : CreateVarForUncountedArray ( const Variant & source ) { <nl> - auto type = source . getType ( ) ; / / this gets rid of the ref , if it was one <nl> - switch ( type ) { <nl> - case KindOfUninit : <nl> - case KindOfNull : <nl> - return init_null ( ) ; <nl> - <nl> - case KindOfBoolean : <nl> - return source . getBoolean ( ) ; <nl> - case KindOfInt64 : <nl> - return source . getInt64 ( ) ; <nl> - case KindOfDouble : <nl> - return source . getDouble ( ) ; <nl> - case KindOfPersistentString : <nl> - return Variant { source . getStringData ( ) , Variant : : PersistentStrInit { } } ; <nl> - case KindOfPersistentVec : <nl> - case KindOfPersistentDict : <nl> - case KindOfPersistentKeyset : <nl> - case KindOfPersistentArray : <nl> - return Variant { source . getArrayData ( ) } ; <nl> - <nl> - case KindOfString : { <nl> - auto src = source . getStringData ( ) ; <nl> - if ( ! src - > isRefCounted ( ) ) { <nl> - return Variant { src , Variant : : PersistentStrInit { } } ; <nl> - } <nl> - if ( auto s = lookupStaticString ( src ) ) { <nl> - return Variant { s , Variant : : PersistentStrInit { } } ; <nl> - } <nl> - return Variant { StringData : : MakeUncounted ( src - > slice ( ) ) , <nl> - Variant : : PersistentStrInit { } } ; <nl> - } <nl> - <nl> - case KindOfVec : { <nl> - auto const ad = source . getArrayData ( ) ; <nl> - assert ( ad - > isVecArray ( ) ) ; <nl> - if ( ad - > empty ( ) ) return Variant { staticEmptyVecArray ( ) } ; <nl> - return Variant { PackedArray : : MakeUncounted ( ad ) } ; <nl> - } <nl> - <nl> - case KindOfDict : { <nl> - auto const ad = source . getArrayData ( ) ; <nl> - assert ( ad - > isDict ( ) ) ; <nl> - if ( ad - > empty ( ) ) return Variant { staticEmptyDictArray ( ) } ; <nl> - return Variant { MixedArray : : MakeUncounted ( ad ) } ; <nl> - } <nl> - <nl> - case KindOfKeyset : { <nl> - auto const ad = source . getArrayData ( ) ; <nl> - assert ( ad - > isKeyset ( ) ) ; <nl> - if ( ad - > empty ( ) ) return Variant { staticEmptyKeysetArray ( ) } ; <nl> - return Variant { SetArray : : MakeUncounted ( ad ) } ; <nl> - } <nl> - <nl> - case KindOfArray : { <nl> - auto const ad = source . getArrayData ( ) ; <nl> - assert ( ad - > isPHPArray ( ) ) ; <nl> - if ( ad - > empty ( ) ) return Variant { staticEmptyArray ( ) } ; <nl> - if ( ad - > hasPackedLayout ( ) ) return Variant { PackedArray : : MakeUncounted ( ad ) } ; <nl> - return Variant { MixedArray : : MakeUncounted ( ad ) } ; <nl> - } <nl> - <nl> - case KindOfObject : <nl> - case KindOfResource : <nl> - case KindOfRef : <nl> - break ; <nl> - } <nl> - not_reached ( ) ; <nl> - } <nl> - <nl> ALWAYS_INLINE static bool UncountedMixedArrayOnHugePage ( ) { <nl> # ifdef USE_JEMALLOC_CUSTOM_HOOKS <nl> return high_huge1g_arena & & RuntimeOption : : EvalUncountedMixedArrayHuge ; <nl> mmm a / hphp / runtime / base / mixed - array . h <nl> ppp b / hphp / runtime / base / mixed - array . h <nl> struct MixedArray final : ArrayData , <nl> using ArrayData : : release ; <nl> <nl> public : <nl> - static Variant CreateVarForUncountedArray ( const Variant & source ) ; <nl> - <nl> static size_t Vsize ( const ArrayData * ) ; <nl> static member_rval : : ptr_u GetValueRef ( const ArrayData * , ssize_t pos ) ; <nl> static bool IsVectorData ( const ArrayData * ) ; <nl> | remove unused method | facebook/hhvm | 57986a4d2c89839787263599dcbd3ac95924ca72 | 2017-07-10T22:36:33Z |
mmm a / dbms / src / Dictionaries / ExternalResultDescription . cpp <nl> ppp b / dbms / src / Dictionaries / ExternalResultDescription . cpp <nl> <nl> # include < DataTypes / DataTypeDate . h > <nl> # include < DataTypes / DataTypeDateTime . h > <nl> # include < DataTypes / DataTypeUUID . h > <nl> + # include < DataTypes / DataTypeNullable . h > <nl> # include < Common / typeid_cast . h > <nl> <nl> <nl> void ExternalResultDescription : : init ( const Block & sample_block_ ) <nl> { <nl> sample_block = sample_block_ ; <nl> <nl> - const auto num_columns = sample_block . columns ( ) ; <nl> - types . reserve ( num_columns ) ; <nl> - names . reserve ( num_columns ) ; <nl> - sample_columns . reserve ( num_columns ) ; <nl> + types . reserve ( sample_block . columns ( ) ) ; <nl> <nl> - for ( const auto idx : ext : : range ( 0 , num_columns ) ) <nl> + for ( auto & elem : sample_block ) <nl> { <nl> - const auto & column = sample_block . safeGetByPosition ( idx ) ; <nl> - const auto type = column . type . get ( ) ; <nl> + / / / If default value for column was not provided , use default from data type . <nl> + if ( elem . column - > empty ( ) ) <nl> + elem . column = elem . type - > createColumnConstWithDefaultValue ( 1 ) - > convertToFullColumnIfConst ( ) ; <nl> + <nl> + DataTypePtr type_not_nullable = removeNullable ( elem . type ) ; <nl> + const IDataType * type = type_not_nullable . get ( ) ; <nl> <nl> if ( typeid_cast < const DataTypeUInt8 * > ( type ) ) <nl> types . push_back ( ValueType : : UInt8 ) ; <nl> void ExternalResultDescription : : init ( const Block & sample_block_ ) <nl> types . push_back ( ValueType : : UUID ) ; <nl> else <nl> throw Exception { " Unsupported type " + type - > getName ( ) , ErrorCodes : : UNKNOWN_TYPE } ; <nl> - <nl> - names . emplace_back ( column . name ) ; <nl> - sample_columns . emplace_back ( column . column ) ; <nl> - <nl> - / / / If default value for column was not provided , use default from data type . <nl> - if ( sample_columns . back ( ) - > empty ( ) ) <nl> - { <nl> - MutableColumnPtr mutable_column = ( * std : : move ( sample_columns . back ( ) ) ) . mutate ( ) ; <nl> - column . type - > insertDefaultInto ( * mutable_column ) ; <nl> - sample_columns . back ( ) = std : : move ( mutable_column ) ; <nl> - } <nl> } <nl> } <nl> <nl> mmm a / dbms / src / Dictionaries / ExternalResultDescription . h <nl> ppp b / dbms / src / Dictionaries / ExternalResultDescription . h <nl> struct ExternalResultDescription <nl> UUID <nl> } ; <nl> <nl> - Block sample_block ; <nl> + / / / For Nullable source types , these types correspond to their nested types . <nl> std : : vector < ValueType > types ; <nl> - std : : vector < std : : string > names ; <nl> - Columns sample_columns ; <nl> + <nl> + / / / May contain Nullable types . <nl> + Block sample_block ; <nl> <nl> void init ( const Block & sample_block_ ) ; <nl> } ; <nl> mmm a / dbms / src / Dictionaries / MongoDBBlockInputStream . cpp <nl> ppp b / dbms / src / Dictionaries / MongoDBBlockInputStream . cpp <nl> Block MongoDBBlockInputStream : : readImpl ( ) <nl> <nl> for ( const auto idx : ext : : range ( 0 , size ) ) <nl> { <nl> - const auto & name = description . names [ idx ] ; <nl> + const auto & name = description . sample_block . getByPosition ( idx ) . name ; <nl> const Poco : : MongoDB : : Element : : Ptr value = document - > get ( name ) ; <nl> <nl> if ( value . isNull ( ) | | value - > type ( ) = = Poco : : MongoDB : : ElementTraits < Poco : : MongoDB : : NullValue > : : TypeId ) <nl> - insertDefaultValue ( * columns [ idx ] , * description . sample_columns [ idx ] ) ; <nl> + insertDefaultValue ( * columns [ idx ] , * description . sample_block . getByPosition ( idx ) . column ) ; <nl> else <nl> insertValue ( * columns [ idx ] , description . types [ idx ] , * value , name ) ; <nl> } <nl> mmm a / dbms / src / Dictionaries / MySQLBlockInputStream . cpp <nl> ppp b / dbms / src / Dictionaries / MySQLBlockInputStream . cpp <nl> Block MySQLBlockInputStream : : readImpl ( ) <nl> if ( ! value . isNull ( ) ) <nl> insertValue ( * columns [ idx ] , description . types [ idx ] , value ) ; <nl> else <nl> - insertDefaultValue ( * columns [ idx ] , * description . sample_columns [ idx ] ) ; <nl> + insertDefaultValue ( * columns [ idx ] , * description . sample_block . getByPosition ( idx ) . column ) ; <nl> } <nl> <nl> + + num_rows ; <nl> mmm a / dbms / src / Dictionaries / ODBCBlockInputStream . cpp <nl> ppp b / dbms / src / Dictionaries / ODBCBlockInputStream . cpp <nl> Block ODBCBlockInputStream : : readImpl ( ) <nl> if ( ! value . isEmpty ( ) ) <nl> insertValue ( * columns [ idx ] , description . types [ idx ] , value ) ; <nl> else <nl> - insertDefaultValue ( * columns [ idx ] , * description . sample_columns [ idx ] ) ; <nl> + insertDefaultValue ( * columns [ idx ] , * description . sample_block . getByPosition ( idx ) . column ) ; <nl> } <nl> <nl> + + iterator ; <nl> | Allow Nullable types in MySQL , ODBC and MongoDB external sources | ClickHouse/ClickHouse | d5bfe378799ff330c5245b97323b69623a49b35f | 2018-10-12T02:09:47Z |
mmm a / src / mat . h <nl> ppp b / src / mat . h <nl> inline Mat Mat : : reshape ( int _w , int _h , int _c ) const <nl> if ( w * h * c ! = _w * _h * _c ) <nl> return Mat ( ) ; <nl> <nl> - if ( dims < 3 & & ( size_t ) _w * _h ! = alignSize ( _w * _h * sizeof ( float ) , 16 ) > > 2 ) <nl> + if ( dims < 3 ) <nl> { <nl> - Mat m ; <nl> - m . create ( _w , _h , _c ) ; <nl> - <nl> - / / align channel <nl> - for ( int i = 0 ; i < _c ; i + + ) <nl> + if ( ( size_t ) _w * _h ! = alignSize ( _w * _h * sizeof ( float ) , 16 ) > > 2 ) <nl> { <nl> - const float * ptr = data + i * _w * _h ; <nl> - float * mptr = m . data + i * m . cstep ; <nl> - memcpy ( mptr , ptr , _w * _h * sizeof ( float ) ) ; <nl> + Mat m ; <nl> + m . create ( _w , _h , _c ) ; <nl> + <nl> + / / align channel <nl> + for ( int i = 0 ; i < _c ; i + + ) <nl> + { <nl> + const float * ptr = data + i * _w * _h ; <nl> + float * mptr = m . data + i * m . cstep ; <nl> + memcpy ( mptr , ptr , _w * _h * sizeof ( float ) ) ; <nl> + } <nl> + <nl> + return m ; <nl> } <nl> - <nl> - return m ; <nl> } <nl> - <nl> - if ( c ! = _c ) <nl> + else if ( c ! = _c ) <nl> { <nl> / / flatten and then align <nl> Mat tmp = reshape ( _w * _h * _c ) ; <nl> | fix | Tencent/ncnn | 45b2e7cd571ee13e8ed9af17d3c36943600e16b3 | 2017-08-25T11:31:29Z |
mmm a / src / video_core / renderer_opengl / gl_rasterizer . cpp <nl> ppp b / src / video_core / renderer_opengl / gl_rasterizer . cpp <nl> <nl> # include < algorithm > <nl> # include < memory > <nl> # include < string > <nl> + # include < string_view > <nl> # include < tuple > <nl> # include < utility > <nl> # include < glad / glad . h > <nl> RasterizerOpenGL : : RasterizerOpenGL ( ) { <nl> GLint ext_num ; <nl> glGetIntegerv ( GL_NUM_EXTENSIONS , & ext_num ) ; <nl> for ( GLint i = 0 ; i < ext_num ; i + + ) { <nl> - std : : string extension { reinterpret_cast < const char * > ( glGetStringi ( GL_EXTENSIONS , i ) ) } ; <nl> + const std : : string_view extension { <nl> + reinterpret_cast < const char * > ( glGetStringi ( GL_EXTENSIONS , i ) ) } ; <nl> <nl> if ( extension = = " GL_ARB_buffer_storage " ) { <nl> has_ARB_buffer_storage = true ; <nl> | gl_rasterizer : Use std : : string_view instead of std : : string when checking for extensions | yuzu-emu/yuzu | 16139ed53b1b4be3ffc985b84ad966c8920082d4 | 2018-07-24T16:10:37Z |
mmm a / modules / imgproc / doc / filtering . rst <nl> ppp b / modules / imgproc / doc / filtering . rst <nl> http : / / www . dai . ed . ac . uk / CVonline / LOCAL \ _COPIES / MANDUCHI1 / Bilateral \ _Filtering . ht <nl> This filter does not work inplace . <nl> <nl> <nl> + adaptiveBilateralFilter <nl> + mmmmmmmmmmmmmmmmmmmmm - - <nl> + Applies the adaptive bilateral filter to an image . <nl> + <nl> + . . ocv : function : : void adaptiveBilateralFilter ( InputArray src , OutputArray dst , Size ksize , double sigmaSpace , Point anchor = Point ( - 1 , - 1 ) , int borderType = BORDER_DEFAULT ) <nl> + <nl> + . . ocv : pyfunction : : cv2 . adaptiveBilateralFilter ( src , ksize , sigmaSpace [ , dst [ , anchor [ , borderType ] ] ] ) - > dst <nl> + <nl> + : param src : Source 8 - bit , 1 - channel or 3 - channel image . <nl> + <nl> + : param dst : Destination image of the same size and type as ` ` src ` ` . <nl> + <nl> + : param ksize : filter kernel size . <nl> + <nl> + : param sigmaSpace : Filter sigma in the coordinate space . It has similar meaning with ` ` sigmaSpace ` ` in ` ` bilateralFilter ` ` . <nl> + <nl> + : param anchor : anchor point ; default value ` ` Point ( - 1 , - 1 ) ` ` means that the anchor is at the kernel center . Only default value is supported now . <nl> + <nl> + : param borderType : border mode used to extrapolate pixels outside of the image . <nl> + <nl> + The function applies adaptive bilateral filtering to the input image . This filter is similar to ` ` bilateralFilter ` ` , in that dissimilarity from and distance to the center pixel is punished . Instead of using ` ` sigmaColor ` ` , we employ the variance of pixel values in the neighbourhood . <nl> + <nl> <nl> <nl> blur <nl> mmm a / modules / imgproc / include / opencv2 / imgproc / imgproc . hpp <nl> ppp b / modules / imgproc / include / opencv2 / imgproc / imgproc . hpp <nl> CV_EXPORTS_W void GaussianBlur ( InputArray src , <nl> CV_EXPORTS_W void bilateralFilter ( InputArray src , OutputArray dst , int d , <nl> double sigmaColor , double sigmaSpace , <nl> int borderType = BORDER_DEFAULT ) ; <nl> + / / ! smooths the image using adaptive bilateral filter <nl> + CV_EXPORTS_W void adaptiveBilateralFilter ( InputArray src , OutputArray dst , Size ksize , <nl> + double sigmaSpace , Point anchor = Point ( - 1 , - 1 ) , <nl> + int borderType = BORDER_DEFAULT ) ; <nl> / / ! smooths the image using the box filter . Each pixel is processed in O ( 1 ) time <nl> CV_EXPORTS_W void boxFilter ( InputArray src , OutputArray dst , int ddepth , <nl> Size ksize , Point anchor = Point ( - 1 , - 1 ) , <nl> mmm a / modules / imgproc / src / smooth . cpp <nl> ppp b / modules / imgproc / src / smooth . cpp <nl> void cv : : bilateralFilter ( InputArray _src , OutputArray _dst , int d , <nl> " Bilateral filtering is only implemented for 8u and 32f images " ) ; <nl> } <nl> <nl> + <nl> + / * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * \ <nl> + Adaptive Bilateral Filtering <nl> + \ * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * / <nl> + <nl> + namespace cv <nl> + { <nl> + # define CALCVAR 1 <nl> + # define FIXED_WEIGHT 0 <nl> + <nl> + class adaptiveBilateralFilter_8u_Invoker : <nl> + public ParallelLoopBody <nl> + { <nl> + public : <nl> + adaptiveBilateralFilter_8u_Invoker ( Mat & _dest , const Mat & _temp , Size _ksize , double _sigma_space , Point _anchor ) : <nl> + temp ( & _temp ) , dest ( & _dest ) , ksize ( _ksize ) , sigma_space ( _sigma_space ) , anchor ( _anchor ) <nl> + { <nl> + if ( sigma_space < = 0 ) <nl> + sigma_space = 1 ; <nl> + CV_Assert ( ( ksize . width & 1 ) & & ( ksize . height & 1 ) ) ; <nl> + space_weight . resize ( ksize . width * ksize . height ) ; <nl> + double sigma2 = sigma_space * sigma_space ; <nl> + int idx = 0 ; <nl> + int w = ksize . width / 2 ; <nl> + int h = ksize . height / 2 ; <nl> + for ( int y = - h ; y < = h ; y + + ) <nl> + for ( int x = - w ; x < = w ; x + + ) <nl> + { <nl> + space_weight [ idx + + ] = ( float ) ( sigma2 / ( sigma2 + x * x + y * y ) ) ; <nl> + } <nl> + } <nl> + virtual void operator ( ) ( const Range & range ) const <nl> + { <nl> + int cn = dest - > channels ( ) ; <nl> + int anX = anchor . x ; <nl> + <nl> + const uchar * tptr ; <nl> + <nl> + for ( int i = range . start ; i < range . end ; i + + ) <nl> + { <nl> + int startY = i ; <nl> + if ( cn = = 1 ) <nl> + { <nl> + float var ; <nl> + int currVal ; <nl> + int sumVal = 0 ; <nl> + int sumValSqr = 0 ; <nl> + int currValCenter ; <nl> + int currWRTCenter ; <nl> + float weight ; <nl> + float totalWeight = 0 . ; <nl> + float tmpSum = 0 . ; <nl> + <nl> + for ( int j = 0 ; j < dest - > cols * cn ; j + = cn ) <nl> + { <nl> + sumVal = 0 ; <nl> + sumValSqr = 0 ; <nl> + totalWeight = 0 . ; <nl> + tmpSum = 0 . ; <nl> + <nl> + / / Top row : don ' t sum the very last element <nl> + int startLMJ = 0 ; <nl> + int endLMJ = ksize . width - 1 ; <nl> + int howManyAll = ( anX * 2 + 1 ) * ( ksize . width ) ; <nl> + # if CALCVAR <nl> + for ( int x = startLMJ ; x < endLMJ ; x + + ) <nl> + { <nl> + tptr = temp - > ptr ( startY + x ) + j ; <nl> + for ( int y = - anX ; y < = anX ; y + + ) <nl> + { <nl> + currVal = tptr [ cn * ( y + anX ) ] ; <nl> + sumVal + = currVal ; <nl> + sumValSqr + = ( currVal * currVal ) ; <nl> + } <nl> + } <nl> + var = ( ( sumValSqr * howManyAll ) - sumVal * sumVal ) / ( ( float ) ( howManyAll * howManyAll ) ) ; <nl> + # else <nl> + var = 900 . 0 ; <nl> + # endif <nl> + startLMJ = 0 ; <nl> + endLMJ = ksize . width ; <nl> + tptr = temp - > ptr ( startY + ( startLMJ + endLMJ ) / 2 ) ; <nl> + currValCenter = tptr [ j + cn * anX ] ; <nl> + for ( int x = startLMJ ; x < endLMJ ; x + + ) <nl> + { <nl> + tptr = temp - > ptr ( startY + x ) + j ; <nl> + for ( int y = - anX ; y < = anX ; y + + ) <nl> + { <nl> + # if FIXED_WEIGHT <nl> + weight = 1 . 0 ; <nl> + # else <nl> + currVal = tptr [ cn * ( y + anX ) ] ; <nl> + currWRTCenter = currVal - currValCenter ; <nl> + <nl> + weight = var / ( var + ( currWRTCenter * currWRTCenter ) ) * space_weight [ x * ksize . width + y + anX ] ; ; <nl> + # endif <nl> + tmpSum + = ( ( float ) tptr [ cn * ( y + anX ) ] * weight ) ; <nl> + totalWeight + = weight ; <nl> + } <nl> + } <nl> + tmpSum / = totalWeight ; <nl> + <nl> + dest - > at < uchar > ( startY , j ) = static_cast < uchar > ( tmpSum ) ; <nl> + } <nl> + } <nl> + else <nl> + { <nl> + assert ( cn = = 3 ) ; <nl> + float var_b , var_g , var_r ; <nl> + int currVal_b , currVal_g , currVal_r ; <nl> + int sumVal_b = 0 , sumVal_g = 0 , sumVal_r = 0 ; <nl> + int sumValSqr_b = 0 , sumValSqr_g = 0 , sumValSqr_r = 0 ; <nl> + int currValCenter_b = 0 , currValCenter_g = 0 , currValCenter_r = 0 ; <nl> + int currWRTCenter_b , currWRTCenter_g , currWRTCenter_r ; <nl> + float weight_b , weight_g , weight_r ; <nl> + float totalWeight_b = 0 . , totalWeight_g = 0 . , totalWeight_r = 0 . ; <nl> + float tmpSum_b = 0 . , tmpSum_g = 0 . , tmpSum_r = 0 . ; <nl> + <nl> + for ( int j = 0 ; j < dest - > cols * cn ; j + = cn ) <nl> + { <nl> + sumVal_b = 0 , sumVal_g = 0 , sumVal_r = 0 ; <nl> + sumValSqr_b = 0 , sumValSqr_g = 0 , sumValSqr_r = 0 ; <nl> + totalWeight_b = 0 . , totalWeight_g = 0 . , totalWeight_r = 0 . ; <nl> + tmpSum_b = 0 . , tmpSum_g = 0 . , tmpSum_r = 0 . ; <nl> + <nl> + / / Top row : don ' t sum the very last element <nl> + int startLMJ = 0 ; <nl> + int endLMJ = ksize . width - 1 ; <nl> + int howManyAll = ( anX * 2 + 1 ) * ( ksize . width ) ; <nl> + # if CALCVAR <nl> + for ( int x = startLMJ ; x < endLMJ ; x + + ) <nl> + { <nl> + tptr = temp - > ptr ( startY + x ) + j ; <nl> + for ( int y = - anX ; y < = anX ; y + + ) <nl> + { <nl> + currVal_b = tptr [ cn * ( y + anX ) ] , currVal_g = tptr [ cn * ( y + anX ) + 1 ] , currVal_r = tptr [ cn * ( y + anX ) + 2 ] ; <nl> + sumVal_b + = currVal_b ; <nl> + sumVal_g + = currVal_g ; <nl> + sumVal_r + = currVal_r ; <nl> + sumValSqr_b + = ( currVal_b * currVal_b ) ; <nl> + sumValSqr_g + = ( currVal_g * currVal_g ) ; <nl> + sumValSqr_r + = ( currVal_r * currVal_r ) ; <nl> + } <nl> + } <nl> + var_b = ( ( sumValSqr_b * howManyAll ) - sumVal_b * sumVal_b ) / ( ( float ) ( howManyAll * howManyAll ) ) ; <nl> + var_g = ( ( sumValSqr_g * howManyAll ) - sumVal_g * sumVal_g ) / ( ( float ) ( howManyAll * howManyAll ) ) ; <nl> + var_r = ( ( sumValSqr_r * howManyAll ) - sumVal_r * sumVal_r ) / ( ( float ) ( howManyAll * howManyAll ) ) ; <nl> + # else <nl> + var_b = 900 . 0 ; var_g = 900 . 0 ; var_r = 900 . 0 ; <nl> + # endif <nl> + startLMJ = 0 ; <nl> + endLMJ = ksize . width ; <nl> + tptr = temp - > ptr ( startY + ( startLMJ + endLMJ ) / 2 ) + j ; <nl> + currValCenter_b = tptr [ cn * anX ] , currValCenter_g = tptr [ cn * anX + 1 ] , currValCenter_r = tptr [ cn * anX + 2 ] ; <nl> + for ( int x = startLMJ ; x < endLMJ ; x + + ) <nl> + { <nl> + tptr = temp - > ptr ( startY + x ) + j ; <nl> + for ( int y = - anX ; y < = anX ; y + + ) <nl> + { <nl> + # if FIXED_WEIGHT <nl> + weight_b = 1 . 0 ; <nl> + weight_g = 1 . 0 ; <nl> + weight_r = 1 . 0 ; <nl> + # else <nl> + currVal_b = tptr [ cn * ( y + anX ) ] ; currVal_g = tptr [ cn * ( y + anX ) + 1 ] ; currVal_r = tptr [ cn * ( y + anX ) + 2 ] ; <nl> + currWRTCenter_b = currVal_b - currValCenter_b ; <nl> + currWRTCenter_g = currVal_g - currValCenter_g ; <nl> + currWRTCenter_r = currVal_r - currValCenter_r ; <nl> + <nl> + float cur_spw = space_weight [ x * ksize . width + y + anX ] ; <nl> + weight_b = var_b / ( var_b + ( currWRTCenter_b * currWRTCenter_b ) ) * cur_spw ; <nl> + weight_g = var_g / ( var_g + ( currWRTCenter_g * currWRTCenter_g ) ) * cur_spw ; <nl> + weight_r = var_r / ( var_r + ( currWRTCenter_r * currWRTCenter_r ) ) * cur_spw ; <nl> + # endif <nl> + tmpSum_b + = ( ( float ) tptr [ cn * ( y + anX ) ] * weight_b ) ; <nl> + tmpSum_g + = ( ( float ) tptr [ cn * ( y + anX ) + 1 ] * weight_g ) ; <nl> + tmpSum_r + = ( ( float ) tptr [ cn * ( y + anX ) + 2 ] * weight_r ) ; <nl> + totalWeight_b + = weight_b , totalWeight_g + = weight_g , totalWeight_r + = weight_r ; <nl> + } <nl> + } <nl> + tmpSum_b / = totalWeight_b ; <nl> + tmpSum_g / = totalWeight_g ; <nl> + tmpSum_r / = totalWeight_r ; <nl> + <nl> + dest - > at < uchar > ( startY , j ) = static_cast < uchar > ( tmpSum_b ) ; <nl> + dest - > at < uchar > ( startY , j + 1 ) = static_cast < uchar > ( tmpSum_g ) ; <nl> + dest - > at < uchar > ( startY , j + 2 ) = static_cast < uchar > ( tmpSum_r ) ; <nl> + } <nl> + } <nl> + } <nl> + } <nl> + private : <nl> + const Mat * temp ; <nl> + Mat * dest ; <nl> + Size ksize ; <nl> + double sigma_space ; <nl> + Point anchor ; <nl> + vector < float > space_weight ; <nl> + } ; <nl> + static void adaptiveBilateralFilter_8u ( const Mat & src , Mat & dst , Size ksize , double sigmaSpace , Point anchor , int borderType ) <nl> + { <nl> + Size size = src . size ( ) ; <nl> + <nl> + CV_Assert ( ( src . type ( ) = = CV_8UC1 | | src . type ( ) = = CV_8UC3 ) & & <nl> + src . type ( ) = = dst . type ( ) & & src . size ( ) = = dst . size ( ) & & <nl> + src . data ! = dst . data ) ; <nl> + Mat temp ; <nl> + copyMakeBorder ( src , temp , anchor . x , anchor . y , anchor . x , anchor . y , borderType ) ; <nl> + <nl> + adaptiveBilateralFilter_8u_Invoker body ( dst , temp , ksize , sigmaSpace , anchor ) ; <nl> + parallel_for_ ( Range ( 0 , size . height ) , body , dst . total ( ) / ( double ) ( 1 < < 16 ) ) ; <nl> + } <nl> + } <nl> + void cv : : adaptiveBilateralFilter ( InputArray _src , OutputArray _dst , Size ksize , <nl> + double sigmaSpace , Point anchor , int borderType ) <nl> + { <nl> + Mat src = _src . getMat ( ) ; <nl> + _dst . create ( src . size ( ) , src . type ( ) ) ; <nl> + Mat dst = _dst . getMat ( ) ; <nl> + <nl> + CV_Assert ( src . type ( ) = = CV_8UC1 | | src . type ( ) = = CV_8UC3 ) ; <nl> + <nl> + anchor = normalizeAnchor ( anchor , ksize ) ; <nl> + if ( src . depth ( ) = = CV_8U ) <nl> + adaptiveBilateralFilter_8u ( src , dst , ksize , sigmaSpace , anchor , borderType ) ; <nl> + else <nl> + CV_Error ( CV_StsUnsupportedFormat , <nl> + " Adaptive Bilateral filtering is only implemented for 8u images " ) ; <nl> + } <nl> + <nl> / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / <nl> <nl> CV_IMPL void <nl> mmm a / modules / ocl / doc / image_filtering . rst <nl> ppp b / modules / ocl / doc / image_filtering . rst <nl> ocl : : bilateralFilter <nl> mmmmmmmmmmmmmmmmmm - - <nl> Returns void <nl> <nl> - . . ocv : function : : void ocl : : bilateralFilter ( const oclMat & src , oclMat & dst , int d , double sigmaColor , double sigmaSpave , int borderType = BORDER_DEFAULT ) <nl> + . . ocv : function : : void ocl : : bilateralFilter ( const oclMat & src , oclMat & dst , int d , double sigmaColor , double sigmaSpace , int borderType = BORDER_DEFAULT ) <nl> <nl> : param src : The source image <nl> <nl> mmm a / modules / ocl / include / opencv2 / ocl / ocl . hpp <nl> ppp b / modules / ocl / include / opencv2 / ocl / ocl . hpp <nl> namespace cv <nl> <nl> / / ! bilateralFilter <nl> / / supports 8UC1 8UC4 <nl> - CV_EXPORTS void bilateralFilter ( const oclMat & src , oclMat & dst , int d , double sigmaColor , double sigmaSpave , int borderType = BORDER_DEFAULT ) ; <nl> + CV_EXPORTS void bilateralFilter ( const oclMat & src , oclMat & dst , int d , double sigmaColor , double sigmaSpace , int borderType = BORDER_DEFAULT ) ; <nl> + <nl> + / / ! Applies an adaptive bilateral filter to the input image <nl> + / / This is not truly a bilateral filter . Instead of using user provided fixed parameters , <nl> + / / the function calculates a constant at each window based on local standard deviation , <nl> + / / and use this constant to do filtering . <nl> + / / supports 8UC1 8UC3 <nl> + CV_EXPORTS void adaptiveBilateralFilter ( const oclMat & src , oclMat & dst , Size ksize , double sigmaSpace , Point anchor = Point ( - 1 , - 1 ) , int borderType = BORDER_DEFAULT ) ; <nl> + <nl> / / ! computes exponent of each matrix element ( b = e * * a ) <nl> / / supports only CV_32FC1 type <nl> CV_EXPORTS void exp ( const oclMat & a , oclMat & b ) ; <nl> mmm a / modules / ocl / perf / perf_filters . cpp <nl> ppp b / modules / ocl / perf / perf_filters . cpp <nl> PERF_TEST_P ( filter2DFixture , filter2D , <nl> else <nl> OCL_PERF_ELSE <nl> } <nl> + <nl> + / / / / / / / / / / / / / Bilateral / / / / / / / / / / / / / / / / / / / / / / / / <nl> + <nl> + typedef Size_MatType BilateralFixture ; <nl> + <nl> + PERF_TEST_P ( BilateralFixture , Bilateral , <nl> + : : testing : : Combine ( OCL_TYPICAL_MAT_SIZES , <nl> + OCL_PERF_ENUM ( CV_8UC1 , CV_8UC3 ) ) ) <nl> + { <nl> + const Size_MatType_t params = GetParam ( ) ; <nl> + const Size srcSize = get < 0 > ( params ) ; <nl> + const int type = get < 1 > ( params ) , d = 7 ; <nl> + double sigmacolor = 50 . 0 , sigmaspace = 50 . 0 ; <nl> + <nl> + Mat src ( srcSize , type ) , dst ( srcSize , type ) ; <nl> + declare . in ( src , WARMUP_RNG ) . out ( dst ) ; <nl> + <nl> + if ( srcSize = = OCL_SIZE_4000 & & type = = CV_8UC3 ) <nl> + declare . time ( 8 ) ; <nl> + <nl> + if ( RUN_OCL_IMPL ) <nl> + { <nl> + ocl : : oclMat oclSrc ( src ) , oclDst ( srcSize , type ) ; <nl> + <nl> + OCL_TEST_CYCLE ( ) cv : : ocl : : bilateralFilter ( oclSrc , oclDst , d , sigmacolor , sigmaspace ) ; <nl> + <nl> + oclDst . download ( dst ) ; <nl> + <nl> + SANITY_CHECK ( dst ) ; <nl> + } <nl> + else if ( RUN_PLAIN_IMPL ) <nl> + { <nl> + TEST_CYCLE ( ) cv : : bilateralFilter ( src , dst , d , sigmacolor , sigmaspace ) ; <nl> + <nl> + SANITY_CHECK ( dst ) ; <nl> + } <nl> + else <nl> + OCL_PERF_ELSE <nl> + } <nl> + <nl> + / / / / / / / / / / / / / adaptiveBilateral / / / / / / / / / / / / / / / / / / / / / / / / <nl> + <nl> + typedef Size_MatType adaptiveBilateralFixture ; <nl> + <nl> + PERF_TEST_P ( adaptiveBilateralFixture , adaptiveBilateral , <nl> + : : testing : : Combine ( OCL_TYPICAL_MAT_SIZES , <nl> + OCL_PERF_ENUM ( CV_8UC1 , CV_8UC3 ) ) ) <nl> + { <nl> + const Size_MatType_t params = GetParam ( ) ; <nl> + const Size srcSize = get < 0 > ( params ) ; <nl> + const int type = get < 1 > ( params ) ; <nl> + double sigmaspace = 10 . 0 ; <nl> + Size ksize ( 9 , 9 ) ; <nl> + <nl> + Mat src ( srcSize , type ) , dst ( srcSize , type ) ; <nl> + declare . in ( src , WARMUP_RNG ) . out ( dst ) ; <nl> + <nl> + if ( srcSize = = OCL_SIZE_4000 ) <nl> + declare . time ( 15 ) ; <nl> + <nl> + if ( RUN_OCL_IMPL ) <nl> + { <nl> + ocl : : oclMat oclSrc ( src ) , oclDst ( srcSize , type ) ; <nl> + <nl> + OCL_TEST_CYCLE ( ) cv : : ocl : : adaptiveBilateralFilter ( oclSrc , oclDst , ksize , sigmaspace ) ; <nl> + <nl> + oclDst . download ( dst ) ; <nl> + <nl> + SANITY_CHECK ( dst , 1 . ) ; <nl> + } <nl> + else if ( RUN_PLAIN_IMPL ) <nl> + { <nl> + TEST_CYCLE ( ) cv : : adaptiveBilateralFilter ( src , dst , ksize , sigmaspace ) ; <nl> + <nl> + SANITY_CHECK ( dst ) ; <nl> + } <nl> + else <nl> + OCL_PERF_ELSE <nl> + } <nl> mmm a / modules / ocl / src / filtering . cpp <nl> ppp b / modules / ocl / src / filtering . cpp <nl> extern const char * filter_sep_row ; <nl> extern const char * filter_sep_col ; <nl> extern const char * filtering_laplacian ; <nl> extern const char * filtering_morph ; <nl> + extern const char * filtering_adaptive_bilateral ; <nl> } <nl> } <nl> <nl> void cv : : ocl : : GaussianBlur ( const oclMat & src , oclMat & dst , Size ksize , double si <nl> Ptr < FilterEngine_GPU > f = createGaussianFilter_GPU ( src . type ( ) , ksize , sigma1 , sigma2 , bordertype ) ; <nl> f - > apply ( src , dst ) ; <nl> } <nl> + <nl> + / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / <nl> + / / Adaptive Bilateral Filter <nl> + <nl> + void cv : : ocl : : adaptiveBilateralFilter ( const oclMat & src , oclMat & dst , Size ksize , double sigmaSpace , Point anchor , int borderType ) <nl> + { <nl> + CV_Assert ( ( ksize . width & 1 ) & & ( ksize . height & 1 ) ) ; / / ksize must be odd <nl> + CV_Assert ( src . type ( ) = = CV_8UC1 | | src . type ( ) = = CV_8UC3 ) ; / / source must be 8bit RGB image <nl> + if ( sigmaSpace < = 0 ) <nl> + sigmaSpace = 1 ; <nl> + Mat lut ( Size ( ksize . width , ksize . height ) , CV_32FC1 ) ; <nl> + double sigma2 = sigmaSpace * sigmaSpace ; <nl> + int idx = 0 ; <nl> + int w = ksize . width / 2 ; <nl> + int h = ksize . height / 2 ; <nl> + for ( int y = - h ; y < = h ; y + + ) <nl> + for ( int x = - w ; x < = w ; x + + ) <nl> + { <nl> + lut . at < float > ( idx + + ) = sigma2 / ( sigma2 + x * x + y * y ) ; <nl> + } <nl> + oclMat dlut ( lut ) ; <nl> + int depth = src . depth ( ) ; <nl> + int cn = src . oclchannels ( ) ; <nl> + <nl> + normalizeAnchor ( anchor , ksize ) ; <nl> + const static String kernelName = " edgeEnhancingFilter " ; <nl> + <nl> + dst . create ( src . size ( ) , src . type ( ) ) ; <nl> + <nl> + char btype [ 30 ] ; <nl> + switch ( borderType ) <nl> + { <nl> + case BORDER_CONSTANT : <nl> + sprintf ( btype , " BORDER_CONSTANT " ) ; <nl> + break ; <nl> + case BORDER_REPLICATE : <nl> + sprintf ( btype , " BORDER_REPLICATE " ) ; <nl> + break ; <nl> + case BORDER_REFLECT : <nl> + sprintf ( btype , " BORDER_REFLECT " ) ; <nl> + break ; <nl> + case BORDER_WRAP : <nl> + sprintf ( btype , " BORDER_WRAP " ) ; <nl> + break ; <nl> + case BORDER_REFLECT101 : <nl> + sprintf ( btype , " BORDER_REFLECT_101 " ) ; <nl> + break ; <nl> + default : <nl> + CV_Error ( CV_StsBadArg , " This border type is not supported " ) ; <nl> + break ; <nl> + } <nl> + <nl> + / / the following constants may be adjusted for performance concerns <nl> + const static size_t blockSizeX = 64 , blockSizeY = 1 , EXTRA = ksize . height - 1 ; <nl> + <nl> + / / Normalize the result by default <nl> + const float alpha = ksize . height * ksize . width ; <nl> + <nl> + const size_t gSize = blockSizeX - ksize . width / 2 * 2 ; <nl> + const size_t globalSizeX = ( src . cols ) % gSize = = 0 ? <nl> + src . cols / gSize * blockSizeX : <nl> + ( src . cols / gSize + 1 ) * blockSizeX ; <nl> + const size_t rows_per_thread = 1 + EXTRA ; <nl> + const size_t globalSizeY = ( ( src . rows + rows_per_thread - 1 ) / rows_per_thread ) % blockSizeY = = 0 ? <nl> + ( ( src . rows + rows_per_thread - 1 ) / rows_per_thread ) : <nl> + ( ( ( src . rows + rows_per_thread - 1 ) / rows_per_thread ) / blockSizeY + 1 ) * blockSizeY ; <nl> + <nl> + size_t globalThreads [ 3 ] = { globalSizeX , globalSizeY , 1 } ; <nl> + size_t localThreads [ 3 ] = { blockSizeX , blockSizeY , 1 } ; <nl> + <nl> + char build_options [ 250 ] ; <nl> + <nl> + / / LDATATYPESIZE is sizeof local data store . This is to exemplify effect of LDS on kernel performance <nl> + sprintf ( build_options , <nl> + " - D VAR_PER_CHANNEL = 1 - D CALCVAR = 1 - D FIXED_WEIGHT = 0 - D EXTRA = % d " <nl> + " - D THREADS = % d - D anX = % d - D anY = % d - D ksX = % d - D ksY = % d - D % s " , <nl> + static_cast < int > ( EXTRA ) , static_cast < int > ( blockSizeX ) , anchor . x , anchor . y , ksize . width , ksize . height , btype ) ; <nl> + <nl> + std : : vector < pair < size_t , const void * > > args ; <nl> + args . push_back ( std : : make_pair ( sizeof ( cl_mem ) , & src . data ) ) ; <nl> + args . push_back ( std : : make_pair ( sizeof ( cl_mem ) , & dst . data ) ) ; <nl> + args . push_back ( std : : make_pair ( sizeof ( cl_float ) , ( void * ) & alpha ) ) ; <nl> + args . push_back ( std : : make_pair ( sizeof ( cl_int ) , ( void * ) & src . offset ) ) ; <nl> + args . push_back ( std : : make_pair ( sizeof ( cl_int ) , ( void * ) & src . wholerows ) ) ; <nl> + args . push_back ( std : : make_pair ( sizeof ( cl_int ) , ( void * ) & src . wholecols ) ) ; <nl> + args . push_back ( std : : make_pair ( sizeof ( cl_int ) , ( void * ) & src . step ) ) ; <nl> + args . push_back ( std : : make_pair ( sizeof ( cl_int ) , ( void * ) & dst . offset ) ) ; <nl> + args . push_back ( std : : make_pair ( sizeof ( cl_int ) , ( void * ) & dst . rows ) ) ; <nl> + args . push_back ( std : : make_pair ( sizeof ( cl_int ) , ( void * ) & dst . cols ) ) ; <nl> + args . push_back ( std : : make_pair ( sizeof ( cl_int ) , ( void * ) & dst . step ) ) ; <nl> + args . push_back ( std : : make_pair ( sizeof ( cl_mem ) , & dlut . data ) ) ; <nl> + int lut_step = dlut . step1 ( ) ; <nl> + args . push_back ( std : : make_pair ( sizeof ( cl_int ) , ( void * ) & lut_step ) ) ; <nl> + <nl> + openCLExecuteKernel ( Context : : getContext ( ) , & filtering_adaptive_bilateral , kernelName , <nl> + globalThreads , localThreads , args , cn , depth , build_options ) ; <nl> + } <nl> \ No newline at end of file <nl> new file mode 100644 <nl> index 00000000000 . . a8e0fd17ecc <nl> mmm / dev / null <nl> ppp b / modules / ocl / src / opencl / filtering_adaptive_bilateral . cl <nl> <nl> + / * M / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / <nl> + / / <nl> + / / IMPORTANT : READ BEFORE DOWNLOADING , COPYING , INSTALLING OR USING . <nl> + / / <nl> + / / By downloading , copying , installing or using the software you agree to this license . <nl> + / / If you do not agree to this license , do not download , install , <nl> + / / copy or use the software . <nl> + / / <nl> + / / <nl> + / / License Agreement <nl> + / / For Open Source Computer Vision Library <nl> + / / <nl> + / / Copyright ( C ) 2010 - 2013 , Multicoreware , Inc . , all rights reserved . <nl> + / / Copyright ( C ) 2010 - 2013 , Advanced Micro Devices , Inc . , all rights reserved . <nl> + / / Third party copyrights are property of their respective owners . <nl> + / / <nl> + / / @ Authors <nl> + / / Harris Gasparakis , harris . gasparakis @ amd . com <nl> + / / Xiaopeng Fu , fuxiaopeng2222 @ 163 . com <nl> + / / Yao Wang , bitwangyaoyao @ gmail . com <nl> + / / <nl> + / / Redistribution and use in source and binary forms , with or without modification , <nl> + / / are permitted provided that the following conditions are met : <nl> + / / <nl> + / / * Redistribution ' s of source code must retain the above copyright notice , <nl> + / / this list of conditions and the following disclaimer . <nl> + / / <nl> + / / * Redistribution ' s in binary form must reproduce the above copyright notice , <nl> + / / this list of conditions and the following disclaimer in the documentation <nl> + / / and / or other oclMaterials provided with the distribution . <nl> + / / <nl> + / / * The name of the copyright holders may not be used to endorse or promote products <nl> + / / derived from this software without specific prior written permission . <nl> + / / <nl> + / / This software is provided by the copyright holders and contributors as is and <nl> + / / any express or implied warranties , including , but not limited to , the implied <nl> + / / warranties of merchantability and fitness for a particular purpose are disclaimed . <nl> + / / In no event shall the Intel Corporation or contributors be liable for any direct , <nl> + / / indirect , incidental , special , exemplary , or consequential damages <nl> + / / ( including , but not limited to , procurement of substitute goods or services ; <nl> + / / loss of use , data , or profits ; or business interruption ) however caused <nl> + / / and on any theory of liability , whether in contract , strict liability , <nl> + / / or tort ( including negligence or otherwise ) arising in any way out of <nl> + / / the use of this software , even if advised of the possibility of such damage . <nl> + / / <nl> + / / M * / <nl> + <nl> + <nl> + # ifdef BORDER_REPLICATE <nl> + / / BORDER_REPLICATE : aaaaaa | abcdefgh | hhhhhhh <nl> + # define ADDR_L ( i , l_edge , r_edge ) ( ( i ) < ( l_edge ) ? ( l_edge ) : ( i ) ) <nl> + # define ADDR_R ( i , r_edge , addr ) ( ( i ) > = ( r_edge ) ? ( r_edge ) - 1 : ( addr ) ) <nl> + # define ADDR_H ( i , t_edge , b_edge ) ( ( i ) < ( t_edge ) ? ( t_edge ) : ( i ) ) <nl> + # define ADDR_B ( i , b_edge , addr ) ( ( i ) > = ( b_edge ) ? ( b_edge ) - 1 : ( addr ) ) <nl> + # endif <nl> + <nl> + # ifdef BORDER_REFLECT <nl> + / / BORDER_REFLECT : fedcba | abcdefgh | hgfedcb <nl> + # define ADDR_L ( i , l_edge , r_edge ) ( ( i ) < ( l_edge ) ? - ( i ) - 1 : ( i ) ) <nl> + # define ADDR_R ( i , r_edge , addr ) ( ( i ) > = ( r_edge ) ? - ( i ) - 1 + ( ( r_edge ) < < 1 ) : ( addr ) ) <nl> + # define ADDR_H ( i , t_edge , b_edge ) ( ( i ) < ( t_edge ) ? - ( i ) - 1 : ( i ) ) <nl> + # define ADDR_B ( i , b_edge , addr ) ( ( i ) > = ( b_edge ) ? - ( i ) - 1 + ( ( b_edge ) < < 1 ) : ( addr ) ) <nl> + # endif <nl> + <nl> + # ifdef BORDER_REFLECT_101 <nl> + / / BORDER_REFLECT_101 : gfedcb | abcdefgh | gfedcba <nl> + # define ADDR_L ( i , l_edge , r_edge ) ( ( i ) < ( l_edge ) ? - ( i ) : ( i ) ) <nl> + # define ADDR_R ( i , r_edge , addr ) ( ( i ) > = ( r_edge ) ? - ( i ) - 2 + ( ( r_edge ) < < 1 ) : ( addr ) ) <nl> + # define ADDR_H ( i , t_edge , b_edge ) ( ( i ) < ( t_edge ) ? - ( i ) : ( i ) ) <nl> + # define ADDR_B ( i , b_edge , addr ) ( ( i ) > = ( b_edge ) ? - ( i ) - 2 + ( ( b_edge ) < < 1 ) : ( addr ) ) <nl> + # endif <nl> + <nl> + / / blur function does not support BORDER_WRAP <nl> + # ifdef BORDER_WRAP <nl> + / / BORDER_WRAP : cdefgh | abcdefgh | abcdefg <nl> + # define ADDR_L ( i , l_edge , r_edge ) ( ( i ) < ( l_edge ) ? ( i ) + ( r_edge ) : ( i ) ) <nl> + # define ADDR_R ( i , r_edge , addr ) ( ( i ) > = ( r_edge ) ? ( i ) - ( r_edge ) : ( addr ) ) <nl> + # define ADDR_H ( i , t_edge , b_edge ) ( ( i ) < ( t_edge ) ? ( i ) + ( b_edge ) : ( i ) ) <nl> + # define ADDR_B ( i , b_edge , addr ) ( ( i ) > = ( b_edge ) ? ( i ) - ( b_edge ) : ( addr ) ) <nl> + # endif <nl> + <nl> + __kernel void <nl> + edgeEnhancingFilter_C4_D0 ( <nl> + __global const uchar4 * restrict src , <nl> + __global uchar4 * dst , <nl> + float alpha , <nl> + int src_offset , <nl> + int src_whole_rows , <nl> + int src_whole_cols , <nl> + int src_step , <nl> + int dst_offset , <nl> + int dst_rows , <nl> + int dst_cols , <nl> + int dst_step , <nl> + __global const float * lut , <nl> + int lut_step ) <nl> + { <nl> + int col = get_local_id ( 0 ) ; <nl> + const int gX = get_group_id ( 0 ) ; <nl> + const int gY = get_group_id ( 1 ) ; <nl> + <nl> + int src_x_off = ( src_offset % src_step ) > > 2 ; <nl> + int src_y_off = src_offset / src_step ; <nl> + int dst_x_off = ( dst_offset % dst_step ) > > 2 ; <nl> + int dst_y_off = dst_offset / dst_step ; <nl> + <nl> + int startX = gX * ( THREADS - ksX + 1 ) - anX + src_x_off ; <nl> + int startY = ( gY * ( 1 + EXTRA ) ) - anY + src_y_off ; <nl> + <nl> + int dst_startX = gX * ( THREADS - ksX + 1 ) + dst_x_off ; <nl> + int dst_startY = ( gY * ( 1 + EXTRA ) ) + dst_y_off ; <nl> + <nl> + int posX = dst_startX - dst_x_off + col ; <nl> + int posY = ( gY * ( 1 + EXTRA ) ) ; <nl> + <nl> + __local uchar4 data [ ksY + EXTRA ] [ THREADS ] ; <nl> + <nl> + float4 tmp_sum [ 1 + EXTRA ] ; <nl> + for ( int tmpint = 0 ; tmpint < 1 + EXTRA ; tmpint + + ) <nl> + { <nl> + tmp_sum [ tmpint ] = ( float4 ) ( 0 , 0 , 0 , 0 ) ; <nl> + } <nl> + <nl> + # ifdef BORDER_CONSTANT <nl> + bool con ; <nl> + uchar4 ss ; <nl> + for ( int j = 0 ; j < ksY + EXTRA ; j + + ) <nl> + { <nl> + con = ( startX + col > = 0 & & startX + col < src_whole_cols & & startY + j > = 0 & & startY + j < src_whole_rows ) ; <nl> + <nl> + int cur_col = clamp ( startX + col , 0 , src_whole_cols ) ; <nl> + if ( con ) <nl> + { <nl> + ss = src [ ( startY + j ) * ( src_step > > 2 ) + cur_col ] ; <nl> + } <nl> + <nl> + data [ j ] [ col ] = con ? ss : ( uchar4 ) 0 ; <nl> + } <nl> + # else <nl> + for ( int j = 0 ; j < ksY + EXTRA ; j + + ) <nl> + { <nl> + int selected_row ; <nl> + int selected_col ; <nl> + selected_row = ADDR_H ( startY + j , 0 , src_whole_rows ) ; <nl> + selected_row = ADDR_B ( startY + j , src_whole_rows , selected_row ) ; <nl> + <nl> + selected_col = ADDR_L ( startX + col , 0 , src_whole_cols ) ; <nl> + selected_col = ADDR_R ( startX + col , src_whole_cols , selected_col ) ; <nl> + <nl> + data [ j ] [ col ] = src [ selected_row * ( src_step > > 2 ) + selected_col ] ; <nl> + } <nl> + # endif <nl> + <nl> + barrier ( CLK_LOCAL_MEM_FENCE ) ; <nl> + <nl> + float4 var [ 1 + EXTRA ] ; <nl> + <nl> + # if VAR_PER_CHANNEL <nl> + float4 weight ; <nl> + float4 totalWeight = ( float4 ) ( 0 , 0 , 0 , 0 ) ; <nl> + # else <nl> + float weight ; <nl> + float totalWeight = 0 ; <nl> + # endif <nl> + <nl> + int4 currValCenter ; <nl> + int4 currWRTCenter ; <nl> + <nl> + int4 sumVal = 0 ; <nl> + int4 sumValSqr = 0 ; <nl> + <nl> + if ( col < ( THREADS - ( ksX - 1 ) ) ) <nl> + { <nl> + int4 currVal ; <nl> + <nl> + int howManyAll = ( 2 * anX + 1 ) * ( ksY ) ; <nl> + <nl> + / / find variance of all data <nl> + int startLMj ; <nl> + int endLMj ; <nl> + # if CALCVAR <nl> + / / Top row : don ' t sum the very last element <nl> + for ( int extraCnt = 0 ; extraCnt < = EXTRA ; extraCnt + + ) <nl> + { <nl> + startLMj = extraCnt ; <nl> + endLMj = ksY + extraCnt - 1 ; <nl> + sumVal = 0 ; <nl> + sumValSqr = 0 ; <nl> + for ( int j = startLMj ; j < endLMj ; j + + ) <nl> + { <nl> + for ( int i = - anX ; i < = anX ; i + + ) <nl> + { <nl> + currVal = convert_int4 ( data [ j ] [ col + anX + i ] ) ; <nl> + <nl> + sumVal + = currVal ; <nl> + sumValSqr + = mul24 ( currVal , currVal ) ; <nl> + } <nl> + } <nl> + var [ extraCnt ] = convert_float4 ( ( ( sumValSqr * howManyAll ) - mul24 ( sumVal , sumVal ) ) ) / ( ( float ) ( howManyAll * howManyAll ) ) ; <nl> + # else <nl> + var [ extraCnt ] = ( float4 ) ( 900 . 0 , 900 . 0 , 900 . 0 , 0 . 0 ) ; <nl> + # endif <nl> + } <nl> + <nl> + for ( int extraCnt = 0 ; extraCnt < = EXTRA ; extraCnt + + ) <nl> + { <nl> + <nl> + / / top row : include the very first element , even on first time <nl> + startLMj = extraCnt ; <nl> + / / go all the way , unless this is the last local mem chunk , <nl> + / / then stay within limits - 1 <nl> + endLMj = extraCnt + ksY ; <nl> + <nl> + / / Top row : don ' t sum the very last element <nl> + currValCenter = convert_int4 ( data [ ( startLMj + endLMj ) / 2 ] [ col + anX ] ) ; <nl> + <nl> + for ( int j = startLMj , lut_j = 0 ; j < endLMj ; j + + , lut_j + + ) <nl> + { <nl> + for ( int i = - anX ; i < = anX ; i + + ) <nl> + { <nl> + # if FIXED_WEIGHT <nl> + # if VAR_PER_CHANNEL <nl> + weight . x = 1 . 0f ; <nl> + weight . y = 1 . 0f ; <nl> + weight . z = 1 . 0f ; <nl> + weight . w = 1 . 0f ; <nl> + # else <nl> + weight = 1 . 0f ; <nl> + # endif <nl> + # else <nl> + currVal = convert_int4 ( data [ j ] [ col + anX + i ] ) ; <nl> + currWRTCenter = currVal - currValCenter ; <nl> + <nl> + # if VAR_PER_CHANNEL <nl> + weight = var [ extraCnt ] / ( var [ extraCnt ] + convert_float4 ( currWRTCenter * currWRTCenter ) ) * ( float4 ) ( lut [ lut_j * lut_step + anX + i ] ) ; <nl> + / / weight . x = var [ extraCnt ] . x / ( var [ extraCnt ] . x + ( float ) mul24 ( currWRTCenter . x , currWRTCenter . x ) ) ; <nl> + / / weight . y = var [ extraCnt ] . y / ( var [ extraCnt ] . y + ( float ) mul24 ( currWRTCenter . y , currWRTCenter . y ) ) ; <nl> + / / weight . z = var [ extraCnt ] . z / ( var [ extraCnt ] . z + ( float ) mul24 ( currWRTCenter . z , currWRTCenter . z ) ) ; <nl> + / / weight . w = 0 ; <nl> + # else <nl> + weight = 1 . 0f / ( 1 . 0f + ( mul24 ( currWRTCenter . x , currWRTCenter . x ) + mul24 ( currWRTCenter . y , currWRTCenter . y ) + mul24 ( currWRTCenter . z , currWRTCenter . z ) ) / ( var . x + var . y + var . z ) ) ; <nl> + # endif <nl> + # endif <nl> + tmp_sum [ extraCnt ] + = convert_float4 ( data [ j ] [ col + anX + i ] ) * weight ; <nl> + totalWeight + = weight ; <nl> + } <nl> + } <nl> + <nl> + tmp_sum [ extraCnt ] / = totalWeight ; <nl> + <nl> + if ( posX > = 0 & & posX < dst_cols & & ( posY + extraCnt ) > = 0 & & ( posY + extraCnt ) < dst_rows ) <nl> + { <nl> + dst [ ( dst_startY + extraCnt ) * ( dst_step > > 2 ) + dst_startX + col ] = convert_uchar4 ( tmp_sum [ extraCnt ] ) ; <nl> + } <nl> + <nl> + # if VAR_PER_CHANNEL <nl> + totalWeight = ( float4 ) ( 0 , 0 , 0 , 0 ) ; <nl> + # else <nl> + totalWeight = 0 ; <nl> + # endif <nl> + } <nl> + } <nl> + } <nl> + <nl> + <nl> + __kernel void <nl> + edgeEnhancingFilter_C1_D0 ( <nl> + __global const uchar * restrict src , <nl> + __global uchar * dst , <nl> + float alpha , <nl> + int src_offset , <nl> + int src_whole_rows , <nl> + int src_whole_cols , <nl> + int src_step , <nl> + int dst_offset , <nl> + int dst_rows , <nl> + int dst_cols , <nl> + int dst_step , <nl> + __global const float * lut , <nl> + int lut_step ) <nl> + { <nl> + int col = get_local_id ( 0 ) ; <nl> + const int gX = get_group_id ( 0 ) ; <nl> + const int gY = get_group_id ( 1 ) ; <nl> + <nl> + int src_x_off = ( src_offset % src_step ) ; <nl> + int src_y_off = src_offset / src_step ; <nl> + int dst_x_off = ( dst_offset % dst_step ) ; <nl> + int dst_y_off = dst_offset / dst_step ; <nl> + <nl> + int startX = gX * ( THREADS - ksX + 1 ) - anX + src_x_off ; <nl> + int startY = ( gY * ( 1 + EXTRA ) ) - anY + src_y_off ; <nl> + <nl> + int dst_startX = gX * ( THREADS - ksX + 1 ) + dst_x_off ; <nl> + int dst_startY = ( gY * ( 1 + EXTRA ) ) + dst_y_off ; <nl> + <nl> + int posX = dst_startX - dst_x_off + col ; <nl> + int posY = ( gY * ( 1 + EXTRA ) ) ; <nl> + <nl> + __local uchar data [ ksY + EXTRA ] [ THREADS ] ; <nl> + <nl> + float tmp_sum [ 1 + EXTRA ] ; <nl> + for ( int tmpint = 0 ; tmpint < 1 + EXTRA ; tmpint + + ) <nl> + { <nl> + tmp_sum [ tmpint ] = ( float ) ( 0 ) ; <nl> + } <nl> + <nl> + # ifdef BORDER_CONSTANT <nl> + bool con ; <nl> + uchar ss ; <nl> + for ( int j = 0 ; j < ksY + EXTRA ; j + + ) <nl> + { <nl> + con = ( startX + col > = 0 & & startX + col < src_whole_cols & & startY + j > = 0 & & startY + j < src_whole_rows ) ; <nl> + <nl> + int cur_col = clamp ( startX + col , 0 , src_whole_cols ) ; <nl> + if ( con ) <nl> + { <nl> + ss = src [ ( startY + j ) * ( src_step ) + cur_col ] ; <nl> + } <nl> + <nl> + data [ j ] [ col ] = con ? ss : 0 ; <nl> + } <nl> + # else <nl> + for ( int j = 0 ; j < ksY + EXTRA ; j + + ) <nl> + { <nl> + int selected_row ; <nl> + int selected_col ; <nl> + selected_row = ADDR_H ( startY + j , 0 , src_whole_rows ) ; <nl> + selected_row = ADDR_B ( startY + j , src_whole_rows , selected_row ) ; <nl> + <nl> + selected_col = ADDR_L ( startX + col , 0 , src_whole_cols ) ; <nl> + selected_col = ADDR_R ( startX + col , src_whole_cols , selected_col ) ; <nl> + <nl> + data [ j ] [ col ] = src [ selected_row * ( src_step ) + selected_col ] ; <nl> + } <nl> + # endif <nl> + <nl> + barrier ( CLK_LOCAL_MEM_FENCE ) ; <nl> + <nl> + float var [ 1 + EXTRA ] ; <nl> + <nl> + float weight ; <nl> + float totalWeight = 0 ; <nl> + <nl> + int currValCenter ; <nl> + int currWRTCenter ; <nl> + <nl> + int sumVal = 0 ; <nl> + int sumValSqr = 0 ; <nl> + <nl> + if ( col < ( THREADS - ( ksX - 1 ) ) ) <nl> + { <nl> + int currVal ; <nl> + <nl> + int howManyAll = ( 2 * anX + 1 ) * ( ksY ) ; <nl> + <nl> + / / find variance of all data <nl> + int startLMj ; <nl> + int endLMj ; <nl> + # if CALCVAR <nl> + / / Top row : don ' t sum the very last element <nl> + for ( int extraCnt = 0 ; extraCnt < = EXTRA ; extraCnt + + ) <nl> + { <nl> + startLMj = extraCnt ; <nl> + endLMj = ksY + extraCnt - 1 ; <nl> + sumVal = 0 ; <nl> + sumValSqr = 0 ; <nl> + for ( int j = startLMj ; j < endLMj ; j + + ) <nl> + { <nl> + for ( int i = - anX ; i < = anX ; i + + ) <nl> + { <nl> + currVal = ( uint ) ( data [ j ] [ col + anX + i ] ) ; <nl> + <nl> + sumVal + = currVal ; <nl> + sumValSqr + = mul24 ( currVal , currVal ) ; <nl> + } <nl> + } <nl> + var [ extraCnt ] = ( float ) ( ( ( sumValSqr * howManyAll ) - mul24 ( sumVal , sumVal ) ) ) / ( ( float ) ( howManyAll * howManyAll ) ) ; <nl> + # else <nl> + var [ extraCnt ] = ( float ) ( 900 . 0 ) ; <nl> + # endif <nl> + } <nl> + <nl> + for ( int extraCnt = 0 ; extraCnt < = EXTRA ; extraCnt + + ) <nl> + { <nl> + <nl> + / / top row : include the very first element , even on first time <nl> + startLMj = extraCnt ; <nl> + / / go all the way , unless this is the last local mem chunk , <nl> + / / then stay within limits - 1 <nl> + endLMj = extraCnt + ksY ; <nl> + <nl> + / / Top row : don ' t sum the very last element <nl> + currValCenter = ( int ) ( data [ ( startLMj + endLMj ) / 2 ] [ col + anX ] ) ; <nl> + <nl> + for ( int j = startLMj , lut_j = 0 ; j < endLMj ; j + + , lut_j + + ) <nl> + { <nl> + for ( int i = - anX ; i < = anX ; i + + ) <nl> + { <nl> + # if FIXED_WEIGHT <nl> + weight = 1 . 0f ; <nl> + # else <nl> + currVal = ( int ) ( data [ j ] [ col + anX + i ] ) ; <nl> + currWRTCenter = currVal - currValCenter ; <nl> + <nl> + weight = var [ extraCnt ] / ( var [ extraCnt ] + ( float ) mul24 ( currWRTCenter , currWRTCenter ) ) * lut [ lut_j * lut_step + anX + i ] ; <nl> + # endif <nl> + tmp_sum [ extraCnt ] + = ( float ) ( data [ j ] [ col + anX + i ] * weight ) ; <nl> + totalWeight + = weight ; <nl> + } <nl> + } <nl> + <nl> + tmp_sum [ extraCnt ] / = totalWeight ; <nl> + <nl> + <nl> + if ( posX > = 0 & & posX < dst_cols & & ( posY + extraCnt ) > = 0 & & ( posY + extraCnt ) < dst_rows ) <nl> + { <nl> + dst [ ( dst_startY + extraCnt ) * ( dst_step ) + dst_startX + col ] = ( uchar ) ( tmp_sum [ extraCnt ] ) ; <nl> + } <nl> + <nl> + totalWeight = 0 ; <nl> + } <nl> + } <nl> + } <nl> mmm a / modules / ocl / test / test_filters . cpp <nl> ppp b / modules / ocl / test / test_filters . cpp <nl> TEST_P ( Filter2D , Mat ) <nl> Near ( 1 ) ; <nl> } <nl> } <nl> + / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / <nl> + / / Bilateral <nl> + struct Bilateral : FilterTestBase <nl> + { <nl> + int type ; <nl> + cv : : Size ksize ; <nl> + int bordertype ; <nl> + double sigmacolor , sigmaspace ; <nl> + <nl> + virtual void SetUp ( ) <nl> + { <nl> + type = GET_PARAM ( 0 ) ; <nl> + ksize = GET_PARAM ( 1 ) ; <nl> + bordertype = GET_PARAM ( 3 ) ; <nl> + Init ( type ) ; <nl> + cv : : RNG & rng = TS : : ptr ( ) - > get_rng ( ) ; <nl> + sigmacolor = rng . uniform ( 20 , 100 ) ; <nl> + sigmaspace = rng . uniform ( 10 , 40 ) ; <nl> + } <nl> + } ; <nl> + <nl> + TEST_P ( Bilateral , Mat ) <nl> + { <nl> + for ( int j = 0 ; j < LOOP_TIMES ; j + + ) <nl> + { <nl> + random_roi ( ) ; <nl> + cv : : bilateralFilter ( mat1_roi , dst_roi , ksize . width , sigmacolor , sigmaspace , bordertype ) ; <nl> + cv : : ocl : : bilateralFilter ( gmat1 , gdst , ksize . width , sigmacolor , sigmaspace , bordertype ) ; <nl> + Near ( 1 ) ; <nl> + } <nl> + <nl> + } <nl> + <nl> + / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / <nl> + / / AdaptiveBilateral <nl> + struct AdaptiveBilateral : FilterTestBase <nl> + { <nl> + int type ; <nl> + cv : : Size ksize ; <nl> + int bordertype ; <nl> + Point anchor ; <nl> + virtual void SetUp ( ) <nl> + { <nl> + type = GET_PARAM ( 0 ) ; <nl> + ksize = GET_PARAM ( 1 ) ; <nl> + bordertype = GET_PARAM ( 3 ) ; <nl> + Init ( type ) ; <nl> + anchor = Point ( - 1 , - 1 ) ; <nl> + } <nl> + } ; <nl> + <nl> + TEST_P ( AdaptiveBilateral , Mat ) <nl> + { <nl> + for ( int j = 0 ; j < LOOP_TIMES ; j + + ) <nl> + { <nl> + random_roi ( ) ; <nl> + cv : : adaptiveBilateralFilter ( mat1_roi , dst_roi , ksize , 5 , anchor , bordertype ) ; <nl> + cv : : ocl : : adaptiveBilateralFilter ( gmat1 , gdst , ksize , 5 , anchor , bordertype ) ; <nl> + Near ( 1 ) ; <nl> + } <nl> + <nl> + } <nl> + <nl> INSTANTIATE_TEST_CASE_P ( Filter , Blur , Combine ( <nl> Values ( CV_8UC1 , CV_8UC3 , CV_8UC4 , CV_32FC1 , CV_32FC4 ) , <nl> Values ( cv : : Size ( 3 , 3 ) , cv : : Size ( 5 , 5 ) , cv : : Size ( 7 , 7 ) ) , <nl> INSTANTIATE_TEST_CASE_P ( Filter , Filter2D , testing : : Combine ( <nl> Values ( Size ( 0 , 0 ) ) , / / not use <nl> Values ( ( MatType ) cv : : BORDER_CONSTANT , ( MatType ) cv : : BORDER_REFLECT101 , ( MatType ) cv : : BORDER_REPLICATE , ( MatType ) cv : : BORDER_REFLECT ) ) ) ; <nl> <nl> + INSTANTIATE_TEST_CASE_P ( Filter , Bilateral , Combine ( <nl> + Values ( CV_8UC1 , CV_8UC3 ) , <nl> + Values ( Size ( 5 , 5 ) , Size ( 9 , 9 ) ) , <nl> + Values ( Size ( 0 , 0 ) ) , / / not use <nl> + Values ( ( MatType ) cv : : BORDER_CONSTANT , ( MatType ) cv : : BORDER_REPLICATE , <nl> + ( MatType ) cv : : BORDER_REFLECT , ( MatType ) cv : : BORDER_WRAP , ( MatType ) cv : : BORDER_REFLECT_101 ) ) ) ; <nl> + <nl> + INSTANTIATE_TEST_CASE_P ( Filter , AdaptiveBilateral , Combine ( <nl> + Values ( CV_8UC1 , CV_8UC3 ) , <nl> + Values ( Size ( 5 , 5 ) , Size ( 9 , 9 ) ) , <nl> + Values ( Size ( 0 , 0 ) ) , / / not use <nl> + Values ( ( MatType ) cv : : BORDER_CONSTANT , ( MatType ) cv : : BORDER_REPLICATE , <nl> + ( MatType ) cv : : BORDER_REFLECT , ( MatType ) cv : : BORDER_REFLECT_101 ) ) ) ; <nl> # endif / / HAVE_OPENCL <nl> mmm a / modules / ocl / test / test_imgproc . cpp <nl> ppp b / modules / ocl / test / test_imgproc . cpp <nl> TEST_P ( equalizeHist , Mat ) <nl> } <nl> <nl> <nl> - <nl> - <nl> - <nl> - / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / bilateralFilter / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / <nl> - <nl> - struct bilateralFilter : ImgprocTestBase { } ; <nl> - <nl> - TEST_P ( bilateralFilter , Mat ) <nl> - { <nl> - double sigmacolor = 50 . 0 ; <nl> - int radius = 9 ; <nl> - int d = 2 * radius + 1 ; <nl> - double sigmaspace = 20 . 0 ; <nl> - int bordertype [ ] = { cv : : BORDER_CONSTANT , cv : : BORDER_REPLICATE , cv : : BORDER_REFLECT , cv : : BORDER_WRAP , cv : : BORDER_REFLECT_101 } ; <nl> - / / const char * borderstr [ ] = { " BORDER_CONSTANT " , " BORDER_REPLICATE " , " BORDER_REFLECT " , " BORDER_WRAP " , " BORDER_REFLECT_101 " } ; <nl> - <nl> - if ( mat1 . depth ( ) ! = CV_8U | | mat1 . type ( ) ! = dst . type ( ) ) <nl> - { <nl> - cout < < " Unsupported type " < < endl ; <nl> - EXPECT_DOUBLE_EQ ( 0 . 0 , 0 . 0 ) ; <nl> - } <nl> - else <nl> - { <nl> - for ( size_t i = 0 ; i < sizeof ( bordertype ) / sizeof ( int ) ; i + + ) <nl> - for ( int j = 0 ; j < LOOP_TIMES ; j + + ) <nl> - { <nl> - random_roi ( ) ; <nl> - if ( ( ( bordertype [ i ] ! = cv : : BORDER_CONSTANT ) & & ( bordertype [ i ] ! = cv : : BORDER_REPLICATE ) & & ( mat1_roi . cols < = radius ) ) | | ( mat1_roi . cols < = radius ) | | ( mat1_roi . rows < = radius ) | | ( mat1_roi . rows < = radius ) ) <nl> - { <nl> - continue ; <nl> - } <nl> - / / if ( ( dstx > = radius ) & & ( dsty > = radius ) & & ( dstx + cldst_roi . cols + radius < = cldst_roi . wholecols ) & & ( dsty + cldst_roi . rows + radius < = cldst_roi . wholerows ) ) <nl> - / / { <nl> - / / dst_roi . adjustROI ( radius , radius , radius , radius ) ; <nl> - / / cldst_roi . adjustROI ( radius , radius , radius , radius ) ; <nl> - / / } <nl> - / / else <nl> - / / { <nl> - / / continue ; <nl> - / / } <nl> - <nl> - cv : : bilateralFilter ( mat1_roi , dst_roi , d , sigmacolor , sigmaspace , bordertype [ i ] | cv : : BORDER_ISOLATED ) ; <nl> - cv : : ocl : : bilateralFilter ( clmat1_roi , cldst_roi , d , sigmacolor , sigmaspace , bordertype [ i ] | cv : : BORDER_ISOLATED ) ; <nl> - Near ( 1 . ) ; <nl> - } <nl> - } <nl> - } <nl> - <nl> - <nl> - <nl> / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / copyMakeBorder / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / <nl> <nl> struct CopyMakeBorder : ImgprocTestBase { } ; <nl> INSTANTIATE_TEST_CASE_P ( ImgprocTestBase , equalizeHist , Combine ( <nl> NULL_TYPE , <nl> Values ( false ) ) ) ; / / Values ( false ) is the reserved parameter <nl> <nl> - / / INSTANTIATE_TEST_CASE_P ( ImgprocTestBase , bilateralFilter , Combine ( <nl> - / / ONE_TYPE ( CV_8UC1 ) , <nl> - / / NULL_TYPE , <nl> - / / ONE_TYPE ( CV_8UC1 ) , <nl> - / / NULL_TYPE , <nl> - / / NULL_TYPE , <nl> - / / Values ( false ) ) ) ; / / Values ( false ) is the reserved parameter <nl> - INSTANTIATE_TEST_CASE_P ( ImgprocTestBase , bilateralFilter , Combine ( <nl> - Values ( CV_8UC1 , CV_8UC3 ) , <nl> - NULL_TYPE , <nl> - Values ( CV_8UC1 , CV_8UC3 ) , <nl> - NULL_TYPE , <nl> - NULL_TYPE , <nl> - Values ( false ) ) ) ; / / Values ( false ) is the reserved parameter <nl> - <nl> <nl> INSTANTIATE_TEST_CASE_P ( ImgprocTestBase , CopyMakeBorder , Combine ( <nl> Values ( CV_8UC1 , CV_8UC3 , CV_8UC4 , CV_32SC1 , CV_32SC3 , CV_32SC4 , CV_32FC1 , CV_32FC3 , CV_32FC4 ) , <nl> new file mode 100644 <nl> index 00000000000 . . df226b195d9 <nl> mmm / dev / null <nl> ppp b / samples / ocl / adaptive_bilateral_filter . cpp <nl> <nl> + / / This sample shows the difference of adaptive bilateral filter and bilateral filter . <nl> + # include " opencv2 / core / core . hpp " <nl> + # include " opencv2 / imgproc / imgproc . hpp " <nl> + # include " opencv2 / highgui / highgui . hpp " <nl> + # include " opencv2 / ocl / ocl . hpp " <nl> + <nl> + using namespace cv ; <nl> + using namespace std ; <nl> + <nl> + <nl> + int main ( int argc , const char * * argv ) <nl> + { <nl> + const char * keys = <nl> + " { i | input | | specify input image } " <nl> + " { k | ksize | 5 | specify kernel size } " ; <nl> + CommandLineParser cmd ( argc , argv , keys ) ; <nl> + string src_path = cmd . get < string > ( " i " ) ; <nl> + int ks = cmd . get < int > ( " k " ) ; <nl> + const char * winName [ ] = { " input " , " adaptive bilateral CPU " , " adaptive bilateral OpenCL " , " bilateralFilter OpenCL " } ; <nl> + <nl> + Mat src = imread ( src_path ) ; <nl> + Mat abFilterCPU ; <nl> + if ( src . empty ( ) ) { <nl> + / / cout < < " error read image : " < < src_path < < endl ; <nl> + return - 1 ; <nl> + } <nl> + <nl> + std : : vector < ocl : : Info > infos ; <nl> + ocl : : getDevice ( infos ) ; <nl> + <nl> + ocl : : oclMat dsrc ( src ) , dABFilter , dBFilter ; <nl> + <nl> + Size ksize ( ks , ks ) ; <nl> + adaptiveBilateralFilter ( src , abFilterCPU , ksize , 10 ) ; <nl> + ocl : : adaptiveBilateralFilter ( dsrc , dABFilter , ksize , 10 ) ; <nl> + ocl : : bilateralFilter ( dsrc , dBFilter , ks , 30 , 9 ) ; <nl> + <nl> + Mat abFilter = dABFilter ; <nl> + Mat bFilter = dBFilter ; <nl> + imshow ( winName [ 0 ] , src ) ; <nl> + <nl> + imshow ( winName [ 1 ] , abFilterCPU ) ; <nl> + <nl> + imshow ( winName [ 2 ] , abFilter ) ; <nl> + <nl> + imshow ( winName [ 3 ] , bFilter ) ; <nl> + <nl> + waitKey ( ) ; <nl> + return 0 ; <nl> + <nl> + } <nl> \ No newline at end of file <nl> | add adaptive bilateral filter ( cpp and ocl version ) | opencv/opencv | 26b5eb3e3990b31be90ff3ca0afe18eaf68768da | 2013-08-29T02:48:15Z |
mmm a / lib / Basics / AssocUnique . h <nl> ppp b / lib / Basics / AssocUnique . h <nl> namespace triagens { <nl> / / Fill Total <nl> * total = 0 ; <nl> for ( auto & b : _buckets ) { <nl> - total + = b . _nrAlloc ; <nl> + * total + = b . _nrAlloc ; <nl> } <nl> TRI_ASSERT ( * total > 0 ) ; <nl> } <nl> | Should have dereferenced the pointer before adding sth | arangodb/arangodb | 771a6d51434dbe83aec60bd59b4beb82911bcdcf | 2015-08-28T07:28:24Z |
mmm a / third_party / mlir / include / mlir / CMakeLists . txt <nl> ppp b / third_party / mlir / include / mlir / CMakeLists . txt <nl> <nl> add_subdirectory ( Analysis ) <nl> add_subdirectory ( Dialect ) <nl> add_subdirectory ( EDSC ) <nl> + add_subdirectory ( Transforms ) <nl> new file mode 100644 <nl> index 0000000000000 . . 9ac003a4140cc <nl> mmm / dev / null <nl> ppp b / third_party / mlir / include / mlir / Transforms / CMakeLists . txt <nl> <nl> + set ( LLVM_TARGET_DEFINITIONS LoopLikeInterface . td ) <nl> + mlir_tablegen ( LoopLikeInterface . h . inc - gen - op - interface - decls ) <nl> + mlir_tablegen ( LoopLikeInterface . cpp . inc - gen - op - interface - defs ) <nl> + add_public_tablegen_target ( MLIRLoopLikeInterfaceIncGen ) <nl> + <nl> + <nl> mmm a / third_party / mlir / lib / Dialect / AffineOps / CMakeLists . txt <nl> ppp b / third_party / mlir / lib / Dialect / AffineOps / CMakeLists . txt <nl> add_llvm_library ( MLIRAffineOps <nl> ADDITIONAL_HEADER_DIRS <nl> $ { MLIR_MAIN_INCLUDE_DIR } / mlir / Dialect / AffineOps <nl> ) <nl> - add_dependencies ( MLIRAffineOps MLIRAffineOpsIncGen MLIRIR MLIRStandardOps ) <nl> + add_dependencies ( MLIRAffineOps <nl> + MLIRAffineOpsIncGen <nl> + MLIRIR <nl> + MLIRLoopLikeInterfaceIncGen <nl> + MLIRStandardOps ) <nl> target_link_libraries ( MLIRAffineOps MLIRIR MLIRStandardOps ) <nl> <nl> mmm a / third_party / mlir / lib / Dialect / LoopOps / CMakeLists . txt <nl> ppp b / third_party / mlir / lib / Dialect / LoopOps / CMakeLists . txt <nl> add_llvm_library ( MLIRLoopOps <nl> ADDITIONAL_HEADER_DIRS <nl> $ { MLIR_MAIN_INCLUDE_DIR } / mlir / LoopOps <nl> ) <nl> - add_dependencies ( MLIRLoopOps MLIRLoopOpsIncGen MLIRStandardOps LLVMSupport ) <nl> + add_dependencies ( MLIRLoopOps MLIRLoopLikeInterfaceIncGen MLIRLoopOpsIncGen MLIRStandardOps LLVMSupport ) <nl> target_link_libraries ( MLIRLoopOps LLVMSupport ) <nl> mmm a / third_party / mlir / lib / Transforms / CMakeLists . txt <nl> ppp b / third_party / mlir / lib / Transforms / CMakeLists . txt <nl> add_subdirectory ( Utils ) <nl> <nl> add_llvm_library ( MLIRTransforms <nl> AffineDataCopyGeneration . cpp <nl> + AffineLoopInvariantCodeMotion . cpp <nl> Canonicalizer . cpp <nl> CSE . cpp <nl> DialectConversion . cpp <nl> add_llvm_library ( MLIRTransforms <nl> $ { MLIR_MAIN_INCLUDE_DIR } / mlir / Transforms <nl> ) <nl> <nl> - add_dependencies ( MLIRTransforms MLIRStandardOpsIncGen ) <nl> + add_dependencies ( MLIRTransforms <nl> + MLIRLoopLikeInterfaceIncGen <nl> + MLIRStandardOpsIncGen ) <nl> target_link_libraries ( MLIRTransforms <nl> MLIRAffineOps <nl> MLIRAnalysis <nl> | Fix CMake configuration after introduction of LICM and LoopLikeInterface | tensorflow/tensorflow | f75990ffe45e52f2fa5c3e7709c5535021042d20 | 2019-10-16T15:41:06Z |
mmm a / tensorflow / compiler / xla / service / gpu / ir_emission_utils . cc <nl> ppp b / tensorflow / compiler / xla / service / gpu / ir_emission_utils . cc <nl> bool IsReductionFromOrToContiguousDimensions ( const HloInstruction & reduce ) { <nl> return reduction_dimensions . dimensions [ 1 ] > = kWarpSize ; <nl> } <nl> <nl> + bool IsInputFusibleSlices ( const HloInstruction & unnested_hlo , <nl> + bool verify_no_strides ) { <nl> + if ( ! unnested_hlo . IsInputFusion ( ) ) { <nl> + return false ; <nl> + } <nl> + <nl> + auto is_non_strided = [ ] ( const std : : vector < int64 > & strides ) - > bool { <nl> + return absl : : c_all_of ( strides , [ ] ( int stride ) { return stride = = 1 ; } ) ; <nl> + } ; <nl> + <nl> + const HloInstruction * root = unnested_hlo . fused_expression_root ( ) ; <nl> + if ( root - > opcode ( ) = = HloOpcode : : kSlice ) { <nl> + return ! verify_no_strides | | is_non_strided ( root - > slice_strides ( ) ) ; <nl> + } <nl> + <nl> + if ( root - > opcode ( ) ! = HloOpcode : : kTuple ) { <nl> + return false ; <nl> + } <nl> + <nl> + return absl : : c_all_of ( root - > operands ( ) , [ & ] ( const HloInstruction * instr ) { <nl> + return instr - > opcode ( ) = = HloOpcode : : kSlice & & <nl> + ( ! verify_no_strides | | is_non_strided ( instr - > slice_strides ( ) ) ) ; <nl> + } ) ; <nl> + } <nl> + <nl> ReductionDimensions GetReductionKindAndContiguousComponents ( <nl> const HloInstruction & reduce ) { <nl> const Shape & input_shape = reduce . operand ( 0 ) - > shape ( ) ; <nl> mmm a / tensorflow / compiler / xla / service / gpu / ir_emission_utils . h <nl> ppp b / tensorflow / compiler / xla / service / gpu / ir_emission_utils . h <nl> bool ImplementedAsLibraryCall ( const HloInstruction & hlo ) ; <nl> / / kept are contiguous in the input of the reduce instruction . <nl> bool IsReductionFromOrToContiguousDimensions ( const HloInstruction & reduce ) ; <nl> <nl> + / / Returns whether unnested_hlo is an input fusion whose root is either a slice <nl> + / / or a tuple of slices . If verify_no_strides is true , returns false unless all <nl> + / / ROOT slices have no strides . <nl> + bool IsInputFusibleSlices ( const HloInstruction & unnested_hlo , <nl> + bool verify_no_strides = false ) ; <nl> + <nl> struct ReductionDimensions { <nl> / / Indicates whether the reduction is a row reduction or a column reduction . <nl> bool is_row_reduction ; <nl> mmm a / tensorflow / compiler / xla / service / gpu / ir_emitter_unnested . cc <nl> ppp b / tensorflow / compiler / xla / service / gpu / ir_emitter_unnested . cc <nl> llvm : : Type * GetIndexTypeForKernel ( const HloInstruction * hlo , int64 launch_size , <nl> return b - > getInt32Ty ( ) ; <nl> } <nl> <nl> + / / Gets the input shape of the ROOT slices , which will be used as the kernel <nl> + / / launch dims . The slice input fusion requires the input shapes of the ROOT <nl> + / / slices to be the same although the ( slice ) output shapes can be different . <nl> + / / <nl> + / / Returns the input shape of the ROOT slices if all the input shapes of ROOT <nl> + / / slices are the same and the slices are non - strided . Otherwise , returns <nl> + / / FailedPrecondition . <nl> + StatusOr < Shape > GetConsistentInputShapeForRootSlices ( <nl> + const HloInstruction & fusion ) { <nl> + if ( ! IsInputFusibleSlices ( fusion , / * verify_no_strides = * / true ) ) { <nl> + return FailedPrecondition ( <nl> + " Unsupported root for slice input fusion . " <nl> + " Only non - strided slices are supported . " ) ; <nl> + } <nl> + <nl> + const HloInstruction & root = * fusion . fused_expression_root ( ) ; <nl> + if ( root . opcode ( ) = = HloOpcode : : kSlice ) { <nl> + return root . operands ( ) [ 0 ] - > shape ( ) ; <nl> + } <nl> + <nl> + CHECK_EQ ( root . opcode ( ) , HloOpcode : : kTuple ) ; <nl> + const Shape & first_slice_operand_shape = <nl> + root . operands ( ) [ 0 ] - > operands ( ) [ 0 ] - > shape ( ) ; <nl> + for ( size_t i = 1 ; i < root . operands ( ) . size ( ) ; + + i ) { <nl> + const HloInstruction * slice = root . operands ( ) [ i ] ; <nl> + const Shape & operand_shape = slice - > operands ( ) [ 0 ] - > shape ( ) ; <nl> + if ( ! ShapeUtil : : EqualIgnoringElementType ( first_slice_operand_shape , <nl> + operand_shape ) ) { <nl> + return FailedPrecondition ( <nl> + " Fused slices do not have the same input shape , fused computation = " <nl> + " % s . " , <nl> + root . parent ( ) - > name ( ) ) ; <nl> + } <nl> + } <nl> + <nl> + return first_slice_operand_shape ; <nl> + } <nl> + <nl> } / / namespace <nl> <nl> Status IrEmitterUnnested : : DefaultAction ( HloInstruction * hlo ) { <nl> Status IrEmitterUnnested : : HandleFusion ( HloInstruction * fusion ) { <nl> absl : : make_unique < SequentialThunk > ( std : : move ( thunks ) , fusion ) ) ; <nl> return Status : : OK ( ) ; <nl> } <nl> + / / In the case of root tuple , it can be either reduce or slice input <nl> + / / fusion . <nl> case HloOpcode : : kTuple : { <nl> + if ( IsInputFusibleSlices ( * fusion ) ) { <nl> + return EmitInputFusibleNonStridedSlices ( fusion ) ; <nl> + } <nl> + <nl> CHECK_GE ( root - > operand_count ( ) , 1 ) ; <nl> return EmitReductionFromOrToContiguousDimensions ( fusion , <nl> root - > operands ( ) ) ; <nl> Status IrEmitterUnnested : : HandleFusion ( HloInstruction * fusion ) { <nl> } <nl> return EmitReductionFromOrToContiguousDimensions ( fusion , { root } ) ; <nl> } <nl> + case HloOpcode : : kSlice : { <nl> + return EmitInputFusibleNonStridedSlices ( fusion ) ; <nl> + } <nl> default : <nl> LOG ( FATAL ) < < " Bad opcode for input fusion : " <nl> < < fusion - > fused_expression_root ( ) - > opcode ( ) ; <nl> Status IrEmitterUnnested : : EmitConstantGlobals ( ) { <nl> return Status : : OK ( ) ; <nl> } <nl> <nl> + / / Emits code for slices based on the below structure . An if statement with <nl> + / / a guarding condition is generated for each ROOT slice . <nl> + / / <nl> + / / Pseudo code : <nl> + / / <nl> + / / Compute values of slice input operands <nl> + / / <nl> + / / Compute guarding_cond0 <nl> + / / if ( guarding_cond0 ) { <nl> + / / Write to output of slice0 <nl> + / / } <nl> + / / <nl> + / / Compute guarding_cond1 <nl> + / / if ( guarding_cond1 ) { <nl> + / / Write to output of slice1 <nl> + / / } <nl> + / / <nl> + void IrEmitterUnnested : : EmitElementForInputFusibleSlices ( <nl> + HloInstruction * unnested_hlo , const llvm_ir : : IrArray : : Index & index ) { <nl> + VLOG ( 10 ) < < " Emitting slice input fusion for " < < unnested_hlo - > ToString ( ) ; <nl> + <nl> + HloInstruction * slice_or_tuple = unnested_hlo - > fused_expression_root ( ) ; <nl> + auto slice_instructions = [ & ] ( ) - > absl : : Span < HloInstruction * const > { <nl> + if ( slice_or_tuple - > opcode ( ) = = HloOpcode : : kSlice ) { <nl> + return absl : : Span < HloInstruction * const > ( & slice_or_tuple , 1 ) ; <nl> + } <nl> + CHECK_EQ ( slice_or_tuple - > opcode ( ) , HloOpcode : : kTuple ) ; <nl> + return slice_or_tuple - > operands ( ) ; <nl> + } ( ) ; <nl> + <nl> + / / Emit input operand values of slices . <nl> + std : : vector < llvm : : Value * > input_ir_values ; <nl> + GpuElementalIrEmitter elem_emitter ( hlo_module_config_ , module_ , & b_ , <nl> + GetNestedComputer ( ) ) ; <nl> + FusedIrEmitter fused_emitter ( GetGeneratorForOperandIrArrays ( unnested_hlo ) , <nl> + & elem_emitter ) ; <nl> + TF_CHECK_OK ( unnested_hlo - > fused_expression_root ( ) - > Accept ( & fused_emitter ) ) ; <nl> + for ( const HloInstruction * slice : slice_instructions ) { <nl> + auto input_generator = fused_emitter . GetGenerator ( slice - > operand ( 0 ) ) ; <nl> + input_ir_values . push_back ( input_generator ( index ) . ValueOrDie ( ) ) ; <nl> + } <nl> + <nl> + / / Emit for slice_instructions . <nl> + KernelSupportLibrary ksl ( & b_ , llvm_ir : : UnrollMode : : kDefaultUnroll ) ; <nl> + for ( int64 i = 0 ; i < slice_instructions . size ( ) ; + + i ) { <nl> + HloInstruction * slice = slice_instructions [ i ] ; <nl> + <nl> + / / guarding_cond : = index > = start & & index < limit , for each dim . <nl> + std : : vector < llvm : : Value * > index_within_ranges ; <nl> + for ( size_t dim = 0 ; dim < slice - > slice_starts ( ) . size ( ) ; + + dim ) { <nl> + CHECK_EQ ( slice - > slice_strides ( dim ) , 1 ) ; <nl> + auto larger_or_equal_than_start = b_ . CreateICmpSGE ( <nl> + index . multidim ( ) [ dim ] , <nl> + index . GetConstantWithIndexType ( slice - > slice_starts ( dim ) ) ) ; <nl> + llvm : : Value * smaller_than_limit = b_ . CreateICmpSLT ( <nl> + index . multidim ( ) [ dim ] , <nl> + index . GetConstantWithIndexType ( slice - > slice_limits ( dim ) ) ) ; <nl> + llvm : : Value * within_range = <nl> + b_ . CreateAnd ( larger_or_equal_than_start , smaller_than_limit ) ; <nl> + index_within_ranges . push_back ( within_range ) ; <nl> + } <nl> + llvm : : Value * guarding_cond = b_ . CreateAnd ( index_within_ranges ) ; <nl> + <nl> + auto emit_slice_elem_func = [ & ] { <nl> + const std : : vector < llvm : : Value * > & src_multidim = index . multidim ( ) ; <nl> + std : : vector < llvm : : Value * > dst_multidim ( src_multidim . size ( ) ) ; <nl> + for ( size_t dim = 0 ; dim < src_multidim . size ( ) ; + + dim ) { <nl> + dst_multidim [ dim ] = <nl> + Sub ( src_multidim [ dim ] , <nl> + index . GetConstantWithIndexType ( slice - > slice_starts ( dim ) ) ) ; <nl> + } <nl> + ShapeIndex shape_index = ( slice_or_tuple - > opcode ( ) = = HloOpcode : : kSlice ) <nl> + ? ShapeIndex ( ) <nl> + : ShapeIndex ( { i } ) ; <nl> + llvm_ir : : IrArray src_ir_array = <nl> + GetIrArray ( * unnested_hlo , * unnested_hlo , shape_index ) ; <nl> + IrArray : : Index slice_dst_index ( dst_multidim , slice - > shape ( ) , <nl> + index . GetType ( ) ) ; <nl> + llvm : : Value * dst_addr = src_ir_array . EmitArrayElementAddress ( <nl> + slice_dst_index , & b_ , " slice . dest " ) ; <nl> + b_ . CreateStore ( input_ir_values [ i ] , dst_addr ) ; <nl> + } ; <nl> + <nl> + ksl . If ( StrCat ( " slice " , i ) , guarding_cond , emit_slice_elem_func ) ; <nl> + } <nl> + } <nl> + <nl> + Status IrEmitterUnnested : : EmitInputFusibleNonStridedSlices ( <nl> + HloInstruction * unnested_hlo ) { <nl> + constexpr int unroll_factor = 1 ; <nl> + std : : unique_ptr < KernelThunk > kernel_thunk = BuildKernelThunk ( <nl> + unnested_hlo , / * implements_whole_instruction = * / true , unroll_factor ) ; <nl> + <nl> + TF_ASSIGN_OR_RETURN ( Shape element_shape , <nl> + GetConsistentInputShapeForRootSlices ( * unnested_hlo ) ) ; <nl> + LaunchDimensions launch_dimensions = CalculateLaunchDimensions ( <nl> + element_shape , ir_emitter_context_ - > device_description ( ) , unroll_factor ) ; <nl> + UpdateLaunchDimensions ( launch_dimensions , kernel_thunk . get ( ) , <nl> + ir_emitter_context_ - > llvm_module ( ) ) ; <nl> + <nl> + Status emit_status = <nl> + ParallelLoopEmitter ( <nl> + [ & ] ( const llvm_ir : : IrArray : : Index index ) - > Status { <nl> + EmitElementForInputFusibleSlices ( unnested_hlo , index ) ; <nl> + return Status : : OK ( ) ; <nl> + } , <nl> + element_shape , launch_dimensions , & b_ ) <nl> + . EmitLoop ( IrName ( unnested_hlo ) , <nl> + GetIndexTypeForKernel ( <nl> + unnested_hlo , launch_dimensions . launch_bound ( ) , & b_ ) ) ; <nl> + <nl> + thunk_sequence_ - > emplace_back ( std : : move ( kernel_thunk ) ) ; <nl> + <nl> + return emit_status ; <nl> + } <nl> + <nl> } / / namespace gpu <nl> } / / namespace xla <nl> mmm a / tensorflow / compiler / xla / service / gpu / ir_emitter_unnested . h <nl> ppp b / tensorflow / compiler / xla / service / gpu / ir_emitter_unnested . h <nl> class IrEmitterUnnested : public IrEmitter , <nl> ReductionCodegenInfo ComputeReductionCodegenInfo ( <nl> const HloInstruction * unnested_hlo , const HloInstruction * first_reduce ) ; <nl> <nl> + / / Generates code for input - fusible slices . <nl> + / / <nl> + / / Prerequisite : ROOT is either a slice or a tuple of slices . The input shapes <nl> + / / of all ROOT slices need to be the same while their output shapes can be <nl> + / / different . On the other hand , the input ranges of slices can be <nl> + / / overlapping . Further generalization / specialization when the needs are seen <nl> + / / in the future . <nl> + Status EmitInputFusibleNonStridedSlices ( HloInstruction * unnested_hlo ) ; <nl> + <nl> + void EmitElementForInputFusibleSlices ( <nl> + HloInstruction * unnested_hlo , <nl> + const llvm_ir : : IrArray : : Index & slice_input_index ) ; <nl> + <nl> / / Emits code for an in - place scatter , modifying ` thunk ` s launch dimensions in <nl> / / the process . ` scatter ` may be fused , scatter indices are taken from <nl> / / ` scatter_indices_gen ` , updates from ` updates_gen ` . The output buffer is <nl> mmm a / tensorflow / compiler / xla / service / gpu / tests / BUILD <nl> ppp b / tensorflow / compiler / xla / service / gpu / tests / BUILD <nl> tf_cc_test ( <nl> ] , <nl> ) <nl> <nl> + tf_cc_test ( <nl> + name = " gpu_input_fusible_slice_test " , <nl> + srcs = [ " gpu_input_fusible_slice_test . cc " ] , <nl> + tags = tf_cuda_tests_tags ( ) , <nl> + deps = [ <nl> + " : gpu_codegen_test " , <nl> + " / / tensorflow / compiler / xla / service : hlo " , <nl> + " / / tensorflow / compiler / xla / service : hlo_module_config " , <nl> + " / / tensorflow / compiler / xla / service : hlo_parser " , <nl> + " / / tensorflow / compiler / xla / tests : hlo_test_base " , <nl> + " / / tensorflow / core : test " , <nl> + " / / tensorflow / core : test_main " , <nl> + ] , <nl> + ) <nl> + <nl> xla_test ( <nl> name = " gpu_convolution_regression_test " , <nl> srcs = [ " gpu_convolution_regression_test . cc " ] , <nl> new file mode 100644 <nl> index 0000000000000 . . 7f345c1933118 <nl> mmm / dev / null <nl> ppp b / tensorflow / compiler / xla / service / gpu / tests / gpu_input_fusible_slice_test . cc <nl> <nl> + / * Copyright 2019 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 < utility > <nl> + <nl> + # include " tensorflow / compiler / xla / service / gpu / tests / gpu_codegen_test . h " <nl> + # include " tensorflow / compiler / xla / service / hlo_module_config . h " <nl> + # include " tensorflow / compiler / xla / service / hlo_parser . h " <nl> + # include " tensorflow / compiler / xla / tests / hlo_test_base . h " <nl> + # include " tensorflow / core / platform / test . h " <nl> + <nl> + namespace xla { <nl> + namespace gpu { <nl> + namespace { <nl> + <nl> + class GpuSliceInputFusionTest : public GpuCodegenTest { <nl> + protected : <nl> + GpuSliceInputFusionTest ( ) { } <nl> + <nl> + HloModuleConfig ConfigWithoutLayoutAssignment ( ) { <nl> + HloModuleConfig config ; <nl> + auto debug_options = HloTestBase : : GetDebugOptionsForTest ( ) ; <nl> + / / Disable the layout_assignment pass to use the preassigned layouts ; <nl> + / / otherwise , the pass throws away the layouts in the fusion computation . <nl> + debug_options . add_xla_disable_hlo_passes ( " layout - assignment " ) ; <nl> + config . set_debug_options ( debug_options ) ; <nl> + return config ; <nl> + } <nl> + } ; <nl> + <nl> + TEST_F ( GpuSliceInputFusionTest , InputFusionWithOnlyOneSlice ) { <nl> + const char * const kHloString = R " ( <nl> + HloModule input_fusion_with_only_one_slice <nl> + <nl> + fused_computation { <nl> + arg . 1 = f16 [ 1024 , 512 ] { 1 , 0 } parameter ( 0 ) <nl> + arg . 2 = f16 [ 1024 , 512 ] { 1 , 0 } parameter ( 1 ) <nl> + arg1 . conv = f32 [ 1024 , 512 ] { 1 , 0 } convert ( arg . 1 ) <nl> + arg2 . conv = f32 [ 1024 , 512 ] { 1 , 0 } convert ( arg . 2 ) <nl> + add . 1 = f32 [ 1024 , 512 ] { 1 , 0 } add ( arg1 . conv , arg2 . conv ) <nl> + ROOT slice . 1 = f32 [ 512 , 511 ] { 1 , 0 } slice ( add . 1 ) , slice = { [ 512 : 1024 ] , [ 1 : 512 ] } <nl> + } <nl> + <nl> + ENTRY kernel_entry { <nl> + arg . 1 = f16 [ 1024 , 512 ] { 1 , 0 } parameter ( 0 ) <nl> + arg . 2 = f16 [ 1024 , 512 ] { 1 , 0 } parameter ( 1 ) <nl> + ROOT fusion = f32 [ 512 , 511 ] { 1 , 0 } fusion ( arg . 1 , arg . 2 ) , kind = kInput , <nl> + calls = fused_computation <nl> + } ) " ; <nl> + <nl> + auto hlo_module = <nl> + ParseAndReturnVerifiedModule ( kHloString , ConfigWithoutLayoutAssignment ( ) ) <nl> + . ValueOrDie ( ) ; <nl> + CompileAndVerifyIr ( std : : move ( hlo_module ) , <nl> + R " ( <nl> + ; CHECK - LABEL : define void @ fusion <nl> + ; CHECK : slice0 <nl> + ; CHECK : } <nl> + ) " , <nl> + / * match_optimized_ir = * / false ) ; <nl> + / / Check that the kernel runs correctly . <nl> + EXPECT_TRUE ( RunAndCompareNoHloPasses ( kHloString , ErrorSpec { 0 , 0 } ) ) ; <nl> + } <nl> + <nl> + TEST_F ( GpuSliceInputFusionTest , InputFusionWithATupleOfSlices ) { <nl> + const char * const kHloString = R " ( <nl> + HloModule input_fusion_with_a_tuple_of_slices <nl> + <nl> + fused_computation { <nl> + arg . 1 = f16 [ 1024 , 512 ] { 1 , 0 } parameter ( 0 ) <nl> + arg . 2 = f16 [ 1024 , 512 ] { 1 , 0 } parameter ( 1 ) <nl> + mul . 1 = f16 [ 1024 , 512 ] { 1 , 0 } multiply ( arg . 1 , arg . 2 ) <nl> + add . 1 = f16 [ 1024 , 512 ] { 1 , 0 } add ( mul . 1 , arg . 2 ) <nl> + slice . 1 = f16 [ 512 , 511 ] { 1 , 0 } slice ( arg . 1 ) , slice = { [ 512 : 1024 ] , [ 1 : 512 ] } <nl> + slice . 2 = f16 [ 0 , 512 ] { 1 , 0 } slice ( add . 1 ) , slice = { [ 512 : 512 ] , [ 0 : 512 ] } <nl> + slice . 3 = f16 [ 1 , 1 ] { 1 , 0 } slice ( add . 1 ) , slice = { [ 512 : 513 ] , [ 511 : 512 ] } <nl> + ROOT tuple . 1 = ( f16 [ 512 , 511 ] { 1 , 0 } , f16 [ 0 , 512 ] { 1 , 0 } , f16 [ 1 , 1 ] { 1 , 0 } ) <nl> + tuple ( slice . 1 , slice . 2 , slice . 3 ) <nl> + } <nl> + <nl> + ENTRY kernel_entry { <nl> + arg . 1 = f16 [ 1024 , 512 ] { 1 , 0 } parameter ( 0 ) <nl> + arg . 2 = f16 [ 1024 , 512 ] { 1 , 0 } parameter ( 1 ) <nl> + ROOT fusion = ( f16 [ 512 , 511 ] { 1 , 0 } , f16 [ 0 , 512 ] { 1 , 0 } , f16 [ 1 , 1 ] { 1 , 0 } ) <nl> + fusion ( arg . 1 , arg . 2 ) , kind = kInput , calls = fused_computation <nl> + } ) " ; <nl> + <nl> + auto hlo_module = <nl> + ParseAndReturnVerifiedModule ( kHloString , ConfigWithoutLayoutAssignment ( ) ) <nl> + . ValueOrDie ( ) ; <nl> + CompileAndVerifyIr ( std : : move ( hlo_module ) , <nl> + R " ( <nl> + ; CHECK - LABEL : define void @ fusion <nl> + ; CHECK : slice2 <nl> + ; CHECK : } <nl> + ) " , <nl> + / * match_optimized_ir = * / false ) ; <nl> + / / Check that the kernel runs correctly . <nl> + EXPECT_TRUE ( RunAndCompareNoHloPasses ( kHloString , ErrorSpec { 0 , 0 } ) ) ; <nl> + } <nl> + <nl> + TEST_F ( GpuSliceInputFusionTest , ConcatThenSplit ) { <nl> + const char * const kHloString = R " ( <nl> + HloModule input_fusion_with_a_tuple_of_slices <nl> + <nl> + fused_computation { <nl> + arg . 1 = f16 [ 1024 ] { 0 } parameter ( 0 ) <nl> + arg . 2 = f16 [ 1024 ] { 0 } parameter ( 1 ) <nl> + arg . 3 = f16 [ 1023 ] { 0 } parameter ( 2 ) <nl> + arg . 4 = f16 [ 1023 ] { 0 } parameter ( 3 ) <nl> + mul . 1 = f16 [ 1024 ] { 0 } multiply ( arg . 1 , arg . 2 ) <nl> + add . 1 = f16 [ 1023 ] { 0 } add ( arg . 3 , arg . 4 ) <nl> + concat . 1 = f16 [ 2047 ] { 0 } concatenate ( mul . 1 , add . 1 ) , dimensions = { 0 } <nl> + slice . 1 = f16 [ 1024 ] { 0 } slice ( concat . 1 ) , slice = { [ 0 : 1024 ] } <nl> + slice . 2 = f16 [ 1023 ] { 0 } slice ( concat . 1 ) , slice = { [ 1024 : 2047 ] } <nl> + slice . 3 = f16 [ 0 ] { 0 } slice ( concat . 1 ) , slice = { [ 2047 : 2047 ] } <nl> + ROOT tuple . 1 = ( f16 [ 1024 ] { 0 } , f16 [ 1023 ] { 0 } , f16 [ 0 ] { 0 } ) <nl> + tuple ( slice . 1 , slice . 2 , slice . 3 ) <nl> + } <nl> + <nl> + ENTRY kernel_entry { <nl> + arg . 1 = f16 [ 1024 ] { 0 } parameter ( 0 ) <nl> + arg . 2 = f16 [ 1024 ] { 0 } parameter ( 1 ) <nl> + arg . 3 = f16 [ 1023 ] { 0 } parameter ( 2 ) <nl> + arg . 4 = f16 [ 1023 ] { 0 } parameter ( 3 ) <nl> + ROOT fusion = ( f16 [ 1024 ] { 0 } , f16 [ 1023 ] { 0 } , f16 [ 0 ] { 0 } ) <nl> + fusion ( arg . 1 , arg . 2 , arg . 3 , arg . 4 ) , kind = kInput , calls = fused_computation <nl> + } ) " ; <nl> + <nl> + auto hlo_module = <nl> + ParseAndReturnVerifiedModule ( kHloString , ConfigWithoutLayoutAssignment ( ) ) <nl> + . ValueOrDie ( ) ; <nl> + CompileAndVerifyIr ( std : : move ( hlo_module ) , <nl> + R " ( <nl> + ; CHECK - LABEL : define void @ fusion <nl> + ; CHECK : slice2 <nl> + ; CHECK : } <nl> + ) " , <nl> + / * match_optimized_ir = * / false ) ; <nl> + / / Check that the kernel runs correctly . <nl> + EXPECT_TRUE ( RunAndCompareNoHloPasses ( kHloString , ErrorSpec { 0 , 0 } ) ) ; <nl> + } <nl> + <nl> + } / / namespace <nl> + } / / namespace gpu <nl> + } / / namespace xla <nl> | Merge pull request from trentlo : input_fusible_slice_github | tensorflow/tensorflow | ca6ce24f81887c299ab5e9883083380c8e95701e | 2019-12-18T10:19:20Z |
mmm a / tensorflow / python / compat / compat . py <nl> ppp b / tensorflow / python / compat / compat . py <nl> <nl> # This value changes every day with an automatic CL . It can be modified in code <nl> # via ` forward_compatibility_horizon ( ) ` or with the environment variable <nl> # TF_FORWARD_COMPATIBILITY_DELTA_DAYS , which is added to the compatibility date . <nl> - _FORWARD_COMPATIBILITY_HORIZON = datetime . date ( 2020 , 1 , 28 ) <nl> + _FORWARD_COMPATIBILITY_HORIZON = datetime . date ( 2020 , 1 , 29 ) <nl> _FORWARD_COMPATIBILITY_DELTA_DAYS_VAR_NAME = " TF_FORWARD_COMPATIBILITY_DELTA_DAYS " <nl> _FORWARD_COMPATIBILITY_DATE_NUMBER = None <nl> <nl> | compat : Update forward compatibility horizon to 2020 - 01 - 29 | tensorflow/tensorflow | 0c0d06f13bdc61eb5cca1f80ce045bf578ea1275 | 2020-01-29T09:08:33Z |
mmm a / tools / jenkins - scripts / autotest . py <nl> ppp b / tools / jenkins - scripts / autotest . py <nl> <nl> import socket <nl> import time <nl> <nl> - HOST = ' localhost ' <nl> + HOST_MAC = ' localhost ' <nl> + HOST_ADNROID = ' 10 . 10 . 30 . 64 ' <nl> + HOST_IOS = ' 10 . 10 . 30 . 61 ' <nl> PORT = 5678 <nl> <nl> - def autotest ( ) : <nl> + suc_build_mac = 0 <nl> + suc_build_android = 0 <nl> + <nl> + TYPE_MAC = 0 <nl> + TYPE_ANDROID = 1 <nl> + TYPE_IOS = 2 <nl> + <nl> + sleep_time = 1 . 5 <nl> + def autotest ( type ) : <nl> soc = socket . socket ( socket . AF_INET , socket . SOCK_STREAM ) <nl> - soc . connect ( ( HOST , PORT ) ) <nl> + if type = = TYPE_MAC : <nl> + soc . connect ( ( HOST_MAC , PORT ) ) <nl> + if type = = TYPE_ANDROID : <nl> + soc . connect ( ( HOST_ADNROID , PORT ) ) <nl> + if type = = TYPE_IOS : <nl> + soc . connect ( ( HOST_IOS , PORT ) ) <nl> time . sleep ( 3 ) <nl> print ' autotest run : ' <nl> soc . send ( ' autotest run \ r \ n ' ) <nl> def autotest ( ) : <nl> soc . close ( ) <nl> <nl> # mmmmmmmmmmmmmmm - autotest build and runmmmmmmmmmmmmmmm - # <nl> - sleep_time = 1 . 5 <nl> - def cleanProj ( ) : <nl> - infoClean = os . system ( ' xcodebuild - project . / build / cocos2d_tests . xcodeproj - target Test \ cpp \ Mac clean ' ) <nl> - print ' infoClean : ' , infoClean <nl> - if infoClean ! = 0 : <nl> - print ' clean * * CLEAN FAILED * * ' <nl> - time . sleep ( sleep_time ) <nl> - def buildProj ( ) : <nl> - infoBuild = os . system ( ' xcodebuild - project . / build / cocos2d_tests . xcodeproj - target Test \ cpp \ Mac ' ) <nl> - print ' infoBuild : ' , infoBuild <nl> - if infoBuild ! = 0 : <nl> - print ' build * * BUILD FAILED * * ' <nl> - time . sleep ( sleep_time ) <nl> - return infoBuild <nl> - def openProj ( ) : <nl> - cmd = ' open . / build / build / Debug / Test \ cpp \ Mac . app ' <nl> - print ' cmd : ' , cmd <nl> - infoOpen = os . system ( cmd ) <nl> - print ' infoOpen : ' , infoOpen <nl> - if infoOpen ! = 0 : <nl> - print ' open * * OPEN FAILED * * ' <nl> - time . sleep ( sleep_time ) <nl> - def buildAndRun ( ) : <nl> - # cleanProj ( ) <nl> - if buildProj ( ) ! = 0 : <nl> - cleanProj ( ) <nl> - buildProj ( ) <nl> - openProj ( ) <nl> - time . sleep ( sleep_time ) <nl> + def MAC_BUILD ( ) : <nl> + def cleanProj ( ) : <nl> + infoClean = os . system ( ' xcodebuild - project . / build / cocos2d_tests . xcodeproj - target Test \ cpp \ Mac clean ' ) <nl> + print ' infoClean : ' , infoClean <nl> + if infoClean ! = 0 : <nl> + return False <nl> + time . sleep ( sleep_time ) <nl> + return True <nl> + def buildProj ( ) : <nl> + infoBuild = os . system ( ' xcodebuild - project . / build / cocos2d_tests . xcodeproj - target Test \ cpp \ Mac ' ) <nl> + print ' infoBuild : ' , infoBuild <nl> + if infoBuild ! = 0 : <nl> + return False <nl> + time . sleep ( sleep_time ) <nl> + return True <nl> + def openProj ( ) : <nl> + cmd = ' open . / build / build / Debug / Test \ cpp \ Mac . app ' <nl> + print ' cmd : ' , cmd <nl> + infoOpen = os . system ( cmd ) <nl> + print ' infoOpen : ' , infoOpen <nl> + if infoOpen ! = 0 : <nl> + return False <nl> + time . sleep ( sleep_time ) <nl> + return True <nl> + def buildAndRun ( ) : <nl> + if not cleanProj ( ) : <nl> + print ' * * CLEAN FAILED * * ' <nl> + if not buildProj ( ) : <nl> + cleanProj ( ) <nl> + buildProj ( ) <nl> + if not openProj ( ) : <nl> + return False <nl> + time . sleep ( sleep_time ) <nl> + return True <nl> + return buildAndRun ( ) <nl> # mmmmmmmmmmmmmmm - autotest build and run endmmmmmmmmmmmmmmm - # <nl> <nl> + # mmmmmmmmmmmmmmm - autotest - android build and runmmmmmmmmmmmmmmm - # <nl> + def ANDROID_BUILD ( ) : <nl> + def cleanProj ( ) : <nl> + infoClean = os . system ( ' rm - rf libs gen obj assets bin ' ) <nl> + print ' infoClean : ' , infoClean <nl> + infoClean = os . system ( ' adb uninstall org . cocos2dx . testcpp ' ) ; <nl> + print ' infoClean : ' , infoClean <nl> + if infoClean ! = 0 : <nl> + print ' clean * * CLEAN FAILED * * ' <nl> + time . sleep ( sleep_time ) <nl> + def updateProperty ( ) : <nl> + infoUpdate = os . system ( ' android update project - p . / cocos / 2d / platform / android / java / - t 12 ' ) <nl> + print ' cocos update : ' , infoUpdate <nl> + infoUpdate = os . system ( ' android update project - p . / tests / proj . android / - t 12 ' ) <nl> + print ' test update : ' , infoUpdate <nl> + def buildProj ( ) : <nl> + infoBuild = os . system ( ' . / build / android - build . py testcpp ' ) <nl> + print ' infoBuild testcpp : ' , infoBuild <nl> + infoBuild = os . system ( ' ant - buildfile . / tests / proj . android / debug install ' ) <nl> + print ' infoBuild : ' , infoBuild <nl> + if infoBuild ! = 0 : <nl> + print ' build * * BUILD FAILED * * ' <nl> + time . sleep ( sleep_time ) <nl> + return infoBuild <nl> + def openProj ( ) : <nl> + cmd = ' adb shell am start - n org . cocos2dx . testcpp / org . cocos2dx . testcpp . Cocos2dxActivity ' <nl> + print ' cmd : ' , cmd <nl> + infoOpen = os . system ( cmd ) <nl> + print ' infoOpen : ' , infoOpen <nl> + if infoOpen ! = 0 : <nl> + return False <nl> + time . sleep ( sleep_time ) <nl> + return True <nl> + def buildAndRun ( ) : <nl> + cleanProj ( ) <nl> + updateProperty ( ) <nl> + if buildProj ( ) ! = 0 : <nl> + cleanProj ( ) <nl> + buildProj ( ) <nl> + return openProj ( ) <nl> + return buildAndRun ( ) <nl> + # mmmmmmmmmmmmmmm - autotest - android build and run endmmmmmmmmmmmmmmm - # <nl> + <nl> def main ( ) : <nl> - try : <nl> - buildAndRun ( ) <nl> - except Exception , e : <nl> - print ' BUILD FAILED ! ' <nl> - else : <nl> - autotest ( ) <nl> + suc_build_mac = MAC_BUILD ( ) <nl> + suc_build_android = ANDROID_BUILD ( ) <nl> + if suc_build_mac : <nl> + autotest ( TYPE_MAC ) <nl> + if suc_build_android : <nl> + autotest ( TYPE_ANDROID ) <nl> <nl> <nl> # mmmmmmmmmmmm - - main mmmmmmmmmmmm - - <nl> | Merge pull request from shujunqiao / develop | cocos2d/cocos2d-x | 2928ef8c5709c7086761ce3765abbb1246105a25 | 2014-03-07T02:49:24Z |
mmm a / folly / test / ThreadLocalTest . cpp <nl> ppp b / folly / test / ThreadLocalTest . cpp <nl> <nl> <nl> # include < folly / ThreadLocal . h > <nl> <nl> + # ifndef _WIN32 <nl> # include < dlfcn . h > <nl> - # include < sys / types . h > <nl> # include < sys / wait . h > <nl> + # endif <nl> + <nl> + # include < sys / types . h > <nl> <nl> # include < array > <nl> # include < atomic > <nl> TEST ( ThreadLocal , Fork ) { <nl> } <nl> # endif <nl> <nl> + # ifndef _WIN32 <nl> struct HoldsOneTag2 { } ; <nl> <nl> TEST ( ThreadLocal , Fork2 ) { <nl> TEST ( ThreadLocal , Fork2 ) { <nl> EXPECT_TRUE ( false ) < < " fork failed " ; <nl> } <nl> } <nl> + # endif <nl> <nl> / / Elide this test when using any sanitizer . Otherwise , the dlopen ' ed code <nl> / / would end up running without e . g . , ASAN - initialized data structures and <nl> | Disable a test of ThreadLocal across forks for Windows | facebook/folly | e21b7273c9097c5c30ef89563c5c38ca09a1165e | 2016-07-21T23:23:35Z |
mmm a / tests / p2p_tests / init / run_test . pl <nl> ppp b / tests / p2p_tests / init / run_test . pl <nl> <nl> if ( ! GetOptions ( " nodes = i " = > \ $ nodes , <nl> " first - pause = i " = > \ $ first_pause , <nl> " launch - pause = i " = > \ $ launch_pause , <nl> - " duration = i " = > \ $ run_duratiion , <nl> + " duration = i " = > \ $ run_duration , <nl> " one - producer " = > \ $ only_one ) ) { <nl> print " usage : $ ARGV [ 0 ] [ - - nodes = < n > ] [ - - first - pause = < n > ] [ - - launch - pause = < n > ] [ - - duration = < n > ] [ - - one - producer ] \ n " ; <nl> print " where : \ n " ; <nl> <nl> sleep ( $ run_duration ) ; <nl> foreach my $ pp ( @ pid ) { <nl> print " killing $ pp \ n " ; <nl> - my $ res = kill 2 , $ pp ; <nl> - print " kill returned $ res " <nl> + kill 2 , $ pp ; <nl> } <nl> | fix a typo | EOSIO/eos | 0490293000c19b1d34c453488bd2a36588f7badb | 2017-07-15T01:33:57Z |
mmm a / scripts / requirements . txt <nl> ppp b / scripts / requirements . txt <nl> <nl> - numba = = 0 . 42 . 0 <nl> - llvmlite = = 0 . 27 . 0 <nl> coremltools = = 2 . 1 . 0 <nl> scipy = = 0 . 19 . 1 <nl> numpy = = 1 . 11 . 1 <nl> mmm a / src / unity / python / setup . py <nl> ppp b / src / unity / python / setup . py <nl> def run ( self ) : <nl> long_description = long_description , <nl> classifiers = classifiers , <nl> install_requires = [ <nl> - " numba = = 0 . 42 . 0 " , <nl> - " llvmlite = = 0 . 27 . 0 " , <nl> " decorator > = 4 . 0 . 9 " , <nl> " prettytable = = 0 . 7 . 2 " , <nl> " requests > = 2 . 9 . 1 " , <nl> | numba and llvmlite now have Python 3 . 5 wheels on PyPI ( ) | apple/turicreate | e59ab48474c2c1432d622f30b1dea729bb43dec0 | 2019-03-16T00:58:37Z |
mmm a / modules / prediction / common / prediction_gflags . cc <nl> ppp b / modules / prediction / common / prediction_gflags . cc <nl> DEFINE_bool ( enable_pedestrian_acc , false , " Enable calculating speed by acc " ) ; <nl> DEFINE_double ( coeff_mul_sigma , 2 . 0 , " coefficient multiply standard deviation " ) ; <nl> DEFINE_double ( pedestrian_min_speed , 0 . 1 , " min speed for still pedestrian " ) ; <nl> DEFINE_double ( pedestrian_max_speed , 10 . 0 , " speed upper bound for pedestrian " ) ; <nl> - DEFINE_double ( pedestrian_min_acc , - 4 . 0 , " minimum pedestrian acceleration " ) ; <nl> DEFINE_double ( pedestrian_max_acc , 2 . 0 , " maximum pedestrian acceleration " ) ; <nl> DEFINE_double ( prediction_pedestrian_total_time , 10 . 0 , <nl> " Total prediction time for pedestrians " ) ; <nl> mmm a / modules / prediction / common / prediction_gflags . h <nl> ppp b / modules / prediction / common / prediction_gflags . h <nl> DECLARE_bool ( enable_pedestrian_acc ) ; <nl> DECLARE_double ( coeff_mul_sigma ) ; <nl> DECLARE_double ( pedestrian_min_speed ) ; <nl> DECLARE_double ( pedestrian_max_speed ) ; <nl> - DECLARE_double ( pedestrian_min_acc ) ; <nl> DECLARE_double ( pedestrian_max_acc ) ; <nl> DECLARE_double ( prediction_pedestrian_total_time ) ; <nl> DECLARE_int32 ( num_trajectory_still_pedestrian ) ; <nl> | Prediction : cleaned up gflags | ApolloAuto/apollo | 086c027c26d2517e6d4bbfb844c2425056aa2944 | 2017-09-12T21:49:06Z |
mmm a / aten / src / ATen / core / op_registration / op_registration_test . cpp <nl> ppp b / aten / src / ATen / core / op_registration / op_registration_test . cpp <nl> TEST ( OperatorRegistrationTest , givenOpWithoutKernelsWithoutTensorInputs_whenRegi <nl> ASSERT_TRUE ( op . has_value ( ) ) ; / / assert schema is registered <nl> } <nl> <nl> + TEST ( OperatorRegistrationTest , givenOpWithMultipleKernels_whenKernelsHaveSameDispatchKey_thenFails ) { <nl> + auto registrar = c10 : : RegisterOperators ( ) <nl> + . op ( " _test : : dummy ( Tensor dummy ) - > ( ) " , kernel < DummyKernel > ( ) , dispatchKey ( TensorType1 ( ) ) ) ; <nl> + <nl> + auto op = Dispatcher : : singleton ( ) . findSchema ( " _test : : dummy " , " " ) ; <nl> + ASSERT_TRUE ( op . has_value ( ) ) ; / / assert schema is registered <nl> + <nl> + expectThrows < c10 : : Error > ( [ & ] { <nl> + c10 : : RegisterOperators ( ) . op ( " _test : : dummy ( Tensor dummy ) - > ( ) " , kernel < DummyKernel > ( ) , dispatchKey ( TensorType1 ( ) ) ) ; <nl> + } , " Tried to register multiple kernels with same dispatch key " ) ; <nl> + } <nl> + <nl> } <nl> | Add some tests ( ) | pytorch/pytorch | fa96de2b3f556a2aa7f6a13dad8155d599e74338 | 2019-04-18T09:04:53Z |
mmm a / doc / base / classes . xml <nl> ppp b / doc / base / classes . xml <nl> <nl> Standard themed Button . <nl> < / brief_description > <nl> < description > <nl> - Button is just the standard themed button : [ image src = " images / button_example . png " / ] It can contain text and an icon , and will display them according to the current [ Theme ] . <nl> + Button is the standard themed button . It can contain text and an icon , and will display them according to the current [ Theme ] . <nl> < / description > <nl> < methods > <nl> < method name = " set_text " > <nl> | Remove broken [ image ] usage in classref | godotengine/godot | 0dce4f7eb2ff28572d978edd8c2fc8031d468872 | 2016-02-19T17:39:16Z |
mmm a / src / app / models / connectionsmanager . cpp <nl> ppp b / src / app / models / connectionsmanager . cpp <nl> <nl> # include < QtXml > <nl> # include < QDebug > <nl> # include < QAbstractItemModel > <nl> + # include < easylogging + + . h > <nl> # include " modules / connections - tree / items / serveritem . h " <nl> # include " modules / redisclient / connectionconfig . h " <nl> # include " modules / value - editor / viewmodel . h " <nl> void ConnectionsManager : : addNewConnection ( const RedisClient : : ConnectionConfig & c <nl> / / add connection to internal container <nl> m_connections . push_back ( connection ) ; <nl> <nl> + / / set logger <nl> + QObject : : connect ( connection . data ( ) , & RedisClient : : Connection : : log , this , [ this ] ( const QString & info ) { <nl> + QString msg = QString ( " Connection : % 1 " ) . arg ( info ) ; <nl> + LOG ( INFO ) < < msg . toStdString ( ) ; <nl> + } ) ; <nl> + <nl> + QObject : : connect ( connection . data ( ) , & RedisClient : : Connection : : error , this , [ this ] ( const QString & error ) { <nl> + QString msg = QString ( " Connection : % 1 " ) . arg ( error ) ; <nl> + LOG ( ERROR ) < < msg . toStdString ( ) ; <nl> + } ) ; <nl> + <nl> / / add connection to view container <nl> using namespace ConnectionsTree ; <nl> <nl> mmm a / src / main . cpp <nl> ppp b / src / main . cpp <nl> <nl> # include < QSettings > <nl> # include < QFontDatabase > <nl> <nl> + # ifndef RDM_VERSION <nl> # include " version . h " <nl> + # endif <nl> # include " modules / crashhandler / crashhandler . h " <nl> # include " app / dialogs / mainwindow . h " <nl> <nl> mmm a / src / modules / console / logtab . h <nl> ppp b / src / modules / console / logtab . h <nl> class LogHandler : public el : : LogDispatchCallback { <nl> <nl> void handle ( const el : : LogDispatchData * data ) { <nl> if ( m_tab ) <nl> - m_tab . toStrongRef ( ) - > print ( QString ( " % 1 : % 2 ( % 3 ) " ) <nl> + m_tab . toStrongRef ( ) - > print ( QString ( " % 1 : % 2 " ) <nl> . arg ( QDateTime : : currentDateTime ( ) . toString ( " yyyy - MM - dd hh : mm : ss " ) ) <nl> - . arg ( QString : : fromStdString ( data - > logMessage ( ) - > message ( ) ) ) <nl> - . arg ( QString : : fromStdString ( data - > logMessage ( ) - > func ( ) ) ) <nl> + . arg ( QString : : fromStdString ( data - > logMessage ( ) - > message ( ) ) ) <nl> ) ; <nl> } <nl> private : <nl> mmm a / src / modules / redisclient / connection . cpp <nl> ppp b / src / modules / redisclient / connection . cpp <nl> void RedisClient : : Connection : : commandAddedToTransporter ( ) <nl> void RedisClient : : Connection : : auth ( ) <nl> { <nl> / / todo : check is socket succesufully connected before run this method <nl> - m_connected = true ; <nl> + m_connected = true ; <nl> <nl> if ( config . useAuth ( ) ) { <nl> Command authCmd ( QStringList ( ) < < " auth " < < config . auth ( ) ) ; <nl> void RedisClient : : Connection : : auth ( ) <nl> m_serverInfo = ServerInfo : : fromString ( infoResult . getValue ( ) . toString ( ) ) ; <nl> <nl> setConnectedState ( ) ; <nl> + emit log ( " AUTH OK " ) ; <nl> emit authOk ( ) ; <nl> } else { <nl> + emit error ( " AUTH ERROR " ) ; <nl> emit authError ( " Redis server require password or password invalid " ) ; <nl> m_connected = false ; <nl> } <nl> mmm a / src / rdm . pro <nl> ppp b / src / rdm . pro <nl> <nl> - # mmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmm - <nl> - # <nl> - # Redis Desktop Manager <nl> - # <nl> - # mmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmm - <nl> - <nl> - QT + = core gui network xml concurrent widgets quick quickwidgets <nl> - <nl> - TARGET = rdm <nl> - TEMPLATE = app <nl> - <nl> - # Skip version file <nl> - ! exists ( $ $ PWD / version . h ) { <nl> - write_file ( $ $ PWD / version . h ) <nl> - DEFINES + = RDM_VERSION = \ \ \ " 0 . 8 . 0 . 0 \ \ \ " <nl> - } <nl> - <nl> - SOURCES + = \ <nl> - $ $ PWD / main . cpp \ <nl> - $ $ PWD / app / dialogs / * . cpp \ <nl> - $ $ PWD / app / models / * . cpp \ <nl> - $ $ PWD / app / models / key - models / * . cpp \ <nl> - $ $ PWD / app / widgets / * . cpp \ <nl> - $ $ PWD / modules / connections - tree / * . cpp \ <nl> - $ $ PWD / modules / connections - tree / items / * . cpp \ <nl> - $ $ PWD / modules / console / * . cpp \ <nl> - $ $ PWD / modules / value - editor / * . cpp \ <nl> - $ $ PWD / modules / redisclient / * . cpp \ <nl> - $ $ PWD / modules / redisclient / ssh / * . cpp \ <nl> - $ $ PWD / modules / redisclient / transporters / * . cpp \ <nl> - $ $ PWD / modules / crashhandler / * . cpp \ <nl> - $ $ PWD / modules / updater / * . cpp \ <nl> - <nl> - HEADERS + = \ <nl> - $ $ PWD / version . h \ <nl> - $ $ PWD / app / dialogs / * . h \ <nl> - $ $ PWD / app / models / * . h \ <nl> - $ $ PWD / app / models / key - models / * . h \ <nl> - $ $ PWD / app / widgets / * . h \ <nl> - $ $ PWD / modules / connections - tree / * . h \ <nl> - $ $ PWD / modules / connections - tree / items / * . h \ <nl> - $ $ PWD / modules / console / * . h \ <nl> - $ $ PWD / modules / value - editor / * . h \ <nl> - $ $ PWD / modules / redisclient / * . h \ <nl> - $ $ PWD / modules / redisclient / ssh / * . h \ <nl> - $ $ PWD / modules / redisclient / transporters / * . h \ <nl> - $ $ PWD / modules / crashhandler / * . h \ <nl> - $ $ PWD / modules / updater / * . h \ <nl> - $ $ PWD / modules / * . h \ <nl> - <nl> - <nl> - <nl> - FORMS + = \ <nl> - $ $ PWD / app / forms / * . ui \ <nl> - <nl> - THIRDPARTYDIR = $ $ PWD / . . / 3rdparty / <nl> - <nl> - include ( $ $ THIRDPARTYDIR / 3rdparty . pri ) <nl> - <nl> - # win32 - msvc * { <nl> - win32 { <nl> - CONFIG + = c + + 11 <nl> - LIBS + = - lws2_32 - lkernel32 - luser32 - lshell32 - luuid - lole32 - ladvapi32 <nl> - RC_FILE + = $ $ PWD / resources / rdm . rc <nl> - <nl> - release : DESTDIR = . / . . / bin / windows / release <nl> - debug : DESTDIR = . / . . / bin / windows / debug <nl> - } <nl> - <nl> - unix : macx { # OSX <nl> - CONFIG + = c + + 11 # release <nl> - # CONFIG - = debug <nl> - <nl> - debug { <nl> - CONFIG - = app_bundle <nl> - } <nl> - <nl> - release : DESTDIR = . / . . / bin / linux / release <nl> - debug : DESTDIR = . / . . / bin / linux / debug <nl> - <nl> - # deployment <nl> - QMAKE_INFO_PLIST = $ $ PWD / resources / Info . plist <nl> - ICON = $ $ PWD / resources / rdm . icns <nl> - <nl> - release { <nl> - CRASHREPORTER_APP . files = $ $ DESTDIR / crashreporter <nl> - CRASHREPORTER_APP . path = Contents / MacOS <nl> - QMAKE_BUNDLE_DATA + = CRASHREPORTER_APP <nl> - } <nl> - } <nl> - <nl> - unix : ! macx { # ubuntu & debian <nl> - <nl> - CONFIG + = static release <nl> - CONFIG - = debug <nl> - <nl> - # Qt static linked on Ubuntu / Debian <nl> - QMAKE_LFLAGS + = - static - libgcc - static - libstdc + + <nl> - <nl> - release : DESTDIR = . / . . / bin / linux / release <nl> - debug : DESTDIR = . / . . / bin / linux / debug <nl> - <nl> - <nl> - # deployment <nl> - target . path = / usr / share / redis - desktop - manager / bin <nl> - target . files = $ $ DESTDIR / rdm $ $ DESTDIR / crashreporter $ $ PWD / resources / qt . conf $ $ PWD / resources / rdm . png $ $ PWD / resources / rdm . sh <nl> - INSTALLS + = target <nl> - <nl> - data . path = / usr / share / redis - desktop - manager / lib <nl> - data . files = $ $ PWD / lib / * <nl> - INSTALLS + = data <nl> - <nl> - deskicon . path = / usr / share / applications <nl> - deskicon . files = $ $ PWD / resources / rdm . desktop <nl> - INSTALLS + = deskicon <nl> - } <nl> - <nl> - UI_DIR = $ $ DESTDIR / ui <nl> - OBJECTS_DIR = $ $ DESTDIR / obj <nl> - MOC_DIR = $ $ DESTDIR / obj <nl> - RCC_DIR = $ $ DESTDIR / obj <nl> - <nl> - INCLUDEPATH + = $ $ PWD / \ <nl> - $ $ PWD / modules / \ <nl> - $ $ UI_DIR / \ <nl> - <nl> - RESOURCES + = \ <nl> - $ $ PWD / resources / rdm . qrc \ <nl> - $ $ PWD / resources / fonts . qrc \ <nl> - <nl> - OTHER_FILES + = \ <nl> - qt . conf \ <nl> - Info . plist \ <nl> - qml \ * . qml \ <nl> - <nl> - <nl> + # mmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmm - <nl> + # <nl> + # Redis Desktop Manager <nl> + # <nl> + # mmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmm - <nl> + <nl> + QT + = core gui network xml concurrent widgets quick quickwidgets <nl> + <nl> + TARGET = rdm <nl> + TEMPLATE = app <nl> + <nl> + # Skip version file <nl> + ! exists ( $ $ PWD / version . h ) { <nl> + DEFINES + = RDM_VERSION = \ \ \ " 0 . 8 . 0 . 0 \ \ \ " <nl> + } <nl> + <nl> + DEFINES + = ELPP_QT_LOGGING ELPP_STL_LOGGING <nl> + <nl> + SOURCES + = \ <nl> + $ $ PWD / main . cpp \ <nl> + $ $ PWD / app / dialogs / * . cpp \ <nl> + $ $ PWD / app / models / * . cpp \ <nl> + $ $ PWD / app / models / key - models / * . cpp \ <nl> + $ $ PWD / app / widgets / * . cpp \ <nl> + $ $ PWD / modules / connections - tree / * . cpp \ <nl> + $ $ PWD / modules / connections - tree / items / * . cpp \ <nl> + $ $ PWD / modules / console / * . cpp \ <nl> + $ $ PWD / modules / value - editor / * . cpp \ <nl> + $ $ PWD / modules / redisclient / * . cpp \ <nl> + $ $ PWD / modules / redisclient / ssh / * . cpp \ <nl> + $ $ PWD / modules / redisclient / transporters / * . cpp \ <nl> + $ $ PWD / modules / crashhandler / * . cpp \ <nl> + $ $ PWD / modules / updater / * . cpp \ <nl> + <nl> + HEADERS + = \ <nl> + $ $ PWD / version . h \ <nl> + $ $ PWD / app / dialogs / * . h \ <nl> + $ $ PWD / app / models / * . h \ <nl> + $ $ PWD / app / models / key - models / * . h \ <nl> + $ $ PWD / app / widgets / * . h \ <nl> + $ $ PWD / modules / connections - tree / * . h \ <nl> + $ $ PWD / modules / connections - tree / items / * . h \ <nl> + $ $ PWD / modules / console / * . h \ <nl> + $ $ PWD / modules / value - editor / * . h \ <nl> + $ $ PWD / modules / redisclient / * . h \ <nl> + $ $ PWD / modules / redisclient / ssh / * . h \ <nl> + $ $ PWD / modules / redisclient / transporters / * . h \ <nl> + $ $ PWD / modules / crashhandler / * . h \ <nl> + $ $ PWD / modules / updater / * . h \ <nl> + $ $ PWD / modules / * . h \ <nl> + <nl> + <nl> + <nl> + FORMS + = \ <nl> + $ $ PWD / app / forms / * . ui \ <nl> + <nl> + THIRDPARTYDIR = $ $ PWD / . . / 3rdparty / <nl> + <nl> + include ( $ $ THIRDPARTYDIR / 3rdparty . pri ) <nl> + <nl> + # win32 - msvc * { <nl> + win32 { <nl> + CONFIG + = c + + 11 <nl> + LIBS + = - lws2_32 - lkernel32 - luser32 - lshell32 - luuid - lole32 - ladvapi32 <nl> + RC_FILE + = $ $ PWD / resources / rdm . rc <nl> + <nl> + release : DESTDIR = . / . . / bin / windows / release <nl> + debug : DESTDIR = . / . . / bin / windows / debug <nl> + } <nl> + <nl> + unix : macx { # OSX <nl> + CONFIG + = c + + 11 # release <nl> + # CONFIG - = debug <nl> + <nl> + debug { <nl> + CONFIG - = app_bundle <nl> + } <nl> + <nl> + release : DESTDIR = . / . . / bin / linux / release <nl> + debug : DESTDIR = . / . . / bin / linux / debug <nl> + <nl> + # deployment <nl> + QMAKE_INFO_PLIST = $ $ PWD / resources / Info . plist <nl> + ICON = $ $ PWD / resources / rdm . icns <nl> + <nl> + release { <nl> + CRASHREPORTER_APP . files = $ $ DESTDIR / crashreporter <nl> + CRASHREPORTER_APP . path = Contents / MacOS <nl> + QMAKE_BUNDLE_DATA + = CRASHREPORTER_APP <nl> + } <nl> + } <nl> + <nl> + unix : ! macx { # ubuntu & debian <nl> + <nl> + CONFIG + = static release <nl> + CONFIG - = debug <nl> + <nl> + # Qt static linked on Ubuntu / Debian <nl> + QMAKE_LFLAGS + = - static - libgcc - static - libstdc + + <nl> + <nl> + release : DESTDIR = . / . . / bin / linux / release <nl> + debug : DESTDIR = . / . . / bin / linux / debug <nl> + <nl> + <nl> + # deployment <nl> + target . path = / usr / share / redis - desktop - manager / bin <nl> + target . files = $ $ DESTDIR / rdm $ $ DESTDIR / crashreporter $ $ PWD / resources / qt . conf $ $ PWD / resources / rdm . png $ $ PWD / resources / rdm . sh <nl> + INSTALLS + = target <nl> + <nl> + data . path = / usr / share / redis - desktop - manager / lib <nl> + data . files = $ $ PWD / lib / * <nl> + INSTALLS + = data <nl> + <nl> + deskicon . path = / usr / share / applications <nl> + deskicon . files = $ $ PWD / resources / rdm . desktop <nl> + INSTALLS + = deskicon <nl> + } <nl> + <nl> + UI_DIR = $ $ DESTDIR / ui <nl> + OBJECTS_DIR = $ $ DESTDIR / obj <nl> + MOC_DIR = $ $ DESTDIR / obj <nl> + RCC_DIR = $ $ DESTDIR / obj <nl> + <nl> + INCLUDEPATH + = $ $ PWD / \ <nl> + $ $ PWD / modules / \ <nl> + $ $ UI_DIR / \ <nl> + <nl> + RESOURCES + = \ <nl> + $ $ PWD / resources / rdm . qrc \ <nl> + $ $ PWD / resources / fonts . qrc \ <nl> + <nl> + OTHER_FILES + = \ <nl> + qt . conf \ <nl> + Info . plist \ <nl> + qml \ * . qml \ <nl> + <nl> + <nl> mmm a / tests / unit_tests / testcases / redisclient / test_connection . cpp <nl> ppp b / tests / unit_tests / testcases / redisclient / test_connection . cpp <nl> void TestConnection : : testRetriveCollection ( ) <nl> QCOMPARE ( result . canConvert ( QMetaType : : QVariantList ) , true ) ; <nl> callbackCalled = true ; <nl> } ) ; <nl> - wait ( 10000 ) ; <nl> + wait ( 2000 ) ; <nl> <nl> / / then - part 2 <nl> QCOMPARE ( callbackCalled , true ) ; <nl> | Cleanup | uglide/RedisDesktopManager | b7ba4008774e30116c4b42150aca376e58df9879 | 2015-02-14T12:21:44Z |
mmm a / editor / project_export . cpp <nl> ppp b / editor / project_export . cpp <nl> void ProjectExportDialog : : _bind_methods ( ) { <nl> ClassDB : : bind_method ( " _export_pck_zip_selected " , & ProjectExportDialog : : _export_pck_zip_selected ) ; <nl> ClassDB : : bind_method ( " _open_export_template_manager " , & ProjectExportDialog : : _open_export_template_manager ) ; <nl> ClassDB : : bind_method ( " _validate_export_path " , & ProjectExportDialog : : _validate_export_path ) ; <nl> + ClassDB : : bind_method ( " _export_path_changed " , & ProjectExportDialog : : _export_path_changed ) ; <nl> ClassDB : : bind_method ( " _export_project " , & ProjectExportDialog : : _export_project ) ; <nl> ClassDB : : bind_method ( " _export_project_to_path " , & ProjectExportDialog : : _export_project_to_path ) ; <nl> ClassDB : : bind_method ( " _export_all " , & ProjectExportDialog : : _export_all ) ; <nl> | Merge pull request from marcelofg55 / export_path_fix | godotengine/godot | a2e4eb7533480ee27ceac5998ed2db5d1ee6a2a1 | 2018-11-12T15:06:58Z |
mmm a / hphp / runtime / vm / jit / hhbc - translator . cpp <nl> ppp b / hphp / runtime / vm / jit / hhbc - translator . cpp <nl> void HhbcTranslator : : emitJmpImpl ( int32_t offset , <nl> if ( flags & JmpFlagNextIsMerge ) { <nl> exceptionBarrier ( ) ; <nl> } <nl> - auto target = <nl> - ( ! m_irb - > blockExists ( offset ) | | m_irb - > blockIsIncompatible ( offset ) ) <nl> - ? makeExit ( offset ) <nl> - : makeBlock ( offset ) ; <nl> + auto target = m_irb - > blockExists ( offset ) ? makeBlock ( offset ) <nl> + : makeExit ( offset ) ; <nl> assert ( target ! = nullptr ) ; <nl> gen ( Jmp , target ) ; <nl> return ; <nl> void HhbcTranslator : : emitJmpCondHelper ( int32_t taken , <nl> / / start with a DefSP to block SP - chain walking ) . <nl> exceptionBarrier ( ) ; <nl> } <nl> - auto const target = ( ! ( flags & JmpFlagBothPaths ) <nl> - | | m_irb - > blockIsIncompatible ( taken ) ) <nl> - ? makeExit ( taken ) <nl> - : makeBlock ( taken ) ; <nl> + auto const target = ( flags & JmpFlagBothPaths ) ? makeBlock ( taken ) <nl> + : makeExit ( taken ) ; <nl> assert ( target ! = nullptr ) ; <nl> auto const boolSrc = gen ( ConvCellToBool , src ) ; <nl> gen ( DecRef , src ) ; <nl> mmm a / hphp / runtime / vm / jit / ir - builder . cpp <nl> ppp b / hphp / runtime / vm / jit / ir - builder . cpp <nl> bool IRBuilder : : blockExists ( Offset offset ) { <nl> return m_offsetToBlockMap . count ( offset ) ; <nl> } <nl> <nl> - bool IRBuilder : : blockIsIncompatible ( Offset offset ) { <nl> - return m_offsetSeen . count ( offset ) & & ! RuntimeOption : : EvalJitLoops ; <nl> - } <nl> - <nl> - void IRBuilder : : recordOffset ( Offset offset ) { <nl> - m_offsetSeen . insert ( offset ) ; <nl> - } <nl> - <nl> void IRBuilder : : resetOffsetMapping ( ) { <nl> m_offsetToBlockMap . clear ( ) ; <nl> } <nl> mmm a / hphp / runtime / vm / jit / ir - builder . h <nl> ppp b / hphp / runtime / vm / jit / ir - builder . h <nl> struct IRBuilder { <nl> * / <nl> bool blockExists ( Offset offset ) ; <nl> <nl> - / * <nl> - * True if translating the block at offset is incompatible with the <nl> - * current state . This is possible if the target block has already <nl> - * been translated , or if the types of guarded locals do not match . <nl> - * <nl> - * TODO ( t3730468 ) : Should we check guarded stack types here as well ? <nl> - * / <nl> - bool blockIsIncompatible ( Offset offset ) ; <nl> - <nl> - / * <nl> - * Note that we ' ve seen this offset as the start of a block . <nl> - * / <nl> - void recordOffset ( Offset offset ) ; <nl> - <nl> / * <nl> * Clear the map from bytecode offsets to Blocks . <nl> * / <nl> struct IRBuilder { <nl> / / TODO ( t3730559 ) : Offset is used here since it ' s passed from <nl> / / emitJmp * , but SrcKey might be better in case of inlining . <nl> smart : : flat_map < Offset , Block * > m_offsetToBlockMap ; <nl> - <nl> - / / Track the offsets of every bytecode block that is started by <nl> - / / translateRegion . <nl> - / / <nl> - / / TODO ( t3730581 ) : Slightly redundant with m_offsetToBlockMap , but <nl> - / / not completely . It is used to prevent translating backward <nl> - / / branches to blocks on the main trace . We should be able to kill <nl> - / / this eventually . <nl> - smart : : flat_set < Offset > m_offsetSeen ; <nl> } ; <nl> <nl> / * <nl> mmm a / hphp / runtime / vm / jit / translator . cpp <nl> ppp b / hphp / runtime / vm / jit / translator . cpp <nl> Translator : : translateRegion ( const RegionDesc & region , <nl> findSuccOffsets ( region , blockId , blockIdToRegionBlock , succOffsets ) ; <nl> setSuccIRBlocks ( region , blockId , blockIdToIRBlock , blockIdToRegionBlock ) ; <nl> } <nl> - ht . irBuilder ( ) . recordOffset ( sk . offset ( ) ) ; <nl> <nl> for ( unsigned i = 0 ; i < block - > length ( ) ; + + i , sk . advance ( block - > unit ( ) ) ) { <nl> / / Update bcOff here so any guards or assertions from metadata are <nl> | Kill IRBuilder : : blockIsIncompatible ( try 2 ) | facebook/hhvm | fdc70a999e980dc7269fc84ebf04cb98b03adda8 | 2014-07-28T18:30:22Z |
mmm a / src / serializer / log / metablock_manager . cc <nl> ppp b / src / serializer / log / metablock_manager . cc <nl> bool disk_format_version_is_recognized ( uint32_t disk_format_version ) { <nl> = = static_cast < uint32_t > ( obsolete_cluster_version_t : : v1_13 ) ) { <nl> crash ( " Data directory is from version 1 . 13 of RethinkDB , " <nl> " which is no longer supported . " <nl> - " You can migrate your data using RethinkDB 2 . 0 . " ) ; <nl> + " You can migrate by launching RethinkDB 2 . 0 with this data directory " <nl> + " and rebuilding your secondary indexes . " ) ; <nl> } <nl> return disk_format_version = = static_cast < uint32_t > ( cluster_version_t : : v1_14 ) <nl> | | disk_format_version = = static_cast < uint32_t > ( cluster_version_t : : v1_15 ) <nl> | improved error message | rethinkdb/rethinkdb | 30b18792eaee224d717513f3cb7994f65f81937c | 2015-04-29T23:10:55Z |
mmm a / ports / sobjectizer / CONTROL <nl> ppp b / ports / sobjectizer / CONTROL <nl> <nl> Source : sobjectizer <nl> - Version : 5 . 5 . 22 <nl> + Version : 5 . 5 . 22 . 1 <nl> Description : SObjectizer is a C + + in - process message dispatching framework with implementation of Actor Model , Publish - Subscribe Model and CSP - like channels . <nl> mmm a / ports / sobjectizer / portfile . cmake <nl> ppp b / ports / sobjectizer / portfile . cmake <nl> <nl> include ( vcpkg_common_functions ) <nl> <nl> - set ( VERSION 5 . 5 . 22 ) <nl> + set ( VERSION 5 . 5 . 22 . 1 ) <nl> set ( SOURCE_PATH $ { CURRENT_BUILDTREES_DIR } / src / so - $ { VERSION } / dev ) <nl> <nl> vcpkg_download_distfile ( ARCHIVE <nl> URLS " https : / / sourceforge . net / projects / sobjectizer / files / sobjectizer / SObjectizer % 20Core % 20v . 5 . 5 / so - $ { VERSION } . zip " <nl> FILENAME " so - $ { VERSION } . zip " <nl> - SHA512 0f7c109a890fc4271a4f45ff009811d5d7479cec86ce8f6a312979bfd07a55e46069511d7868e1c7bf29e5ff6495d22d71fd3ba2b1253b2fb9299657d7b0384d <nl> + SHA512 400995d23fc7e53360e75ed6c001d678fabf7965bc90288679409068aeea026af99b194935d09dcd27410da8cb05ede08efd0b1fc5e3baa0402ea1d12ea331cd <nl> ) <nl> vcpkg_extract_source_archive ( $ { ARCHIVE } ) <nl> <nl> | sobjectizer updated to v . 5 . 5 . 22 . 1 | microsoft/vcpkg | 8437b25c8789b8c0ddd841e17a906caca86bddb1 | 2018-05-30T16:32:42Z |
mmm a / tensorflow / lite / kernels / subgraph_test_util . cc <nl> ppp b / tensorflow / lite / kernels / subgraph_test_util . cc <nl> void SubgraphBuilder : : BuildAccumulateLoopBodySubgraph ( Subgraph * subgraph ) { <nl> TfLiteAddParams * params = <nl> reinterpret_cast < TfLiteAddParams * > ( malloc ( sizeof ( TfLiteAddParams ) ) ) ; <nl> params - > activation = kTfLiteActNone ; <nl> + params - > pot_scale_int16 = false ; <nl> auto * add_reg = ops : : builtin : : Register_ADD ( ) ; <nl> add_reg - > builtin_code = kTfLiteBuiltinAdd ; <nl> subgraph - > AddNodeWithParameters ( { 0 , 4 } , { 2 } , { } , nullptr , 0 , params , add_reg , <nl> & node_index ) ; <nl> params = reinterpret_cast < TfLiteAddParams * > ( malloc ( sizeof ( TfLiteAddParams ) ) ) ; <nl> params - > activation = kTfLiteActNone ; <nl> + params - > pot_scale_int16 = false ; <nl> subgraph - > AddNodeWithParameters ( { 2 , 1 } , { 3 } , { } , nullptr , 0 , params , add_reg , <nl> & node_index ) ; <nl> } <nl> | Fix ' uninitialized field ' mSAN issue introduced in cl / 347894186 | tensorflow/tensorflow | 7f92a26eb07de557a5453b93a205b652a53a9887 | 2020-12-22T17:42:17Z |
mmm a / docs / tutorial / first - app . md <nl> ppp b / docs / tutorial / first - app . md <nl> for the application to be ready and open a window : <nl> <nl> ` ` ` javascript <nl> const { app , BrowserWindow } = require ( ' electron ' ) <nl> - const path = require ( ' path ' ) <nl> - const url = require ( ' url ' ) <nl> <nl> function createWindow ( ) { <nl> / / Create the browser window . <nl> win = new BrowserWindow ( { width : 800 , height : 600 } ) <nl> <nl> / / and load the index . html of the app . <nl> - win . loadURL ( url . format ( { <nl> - pathname : path . join ( __dirname , ' index . html ' ) , <nl> - protocol : ' file : ' , <nl> - slashes : true <nl> - } ) ) <nl> + win . loadFile ( ' index . html ' ) <nl> } <nl> <nl> app . on ( ' ready ' , createWindow ) <nl> windows on macOS if the user clicks on the app ' s icon in the dock . <nl> <nl> ` ` ` javascript <nl> const { app , BrowserWindow } = require ( ' electron ' ) <nl> - const path = require ( ' path ' ) <nl> - const url = require ( ' url ' ) <nl> <nl> / / Keep a global reference of the window object , if you don ' t , the window will <nl> / / be closed automatically when the JavaScript object is garbage collected . <nl> function createWindow ( ) { <nl> win = new BrowserWindow ( { width : 800 , height : 600 } ) <nl> <nl> / / and load the index . html of the app . <nl> - win . loadURL ( url . format ( { <nl> - pathname : path . join ( __dirname , ' index . html ' ) , <nl> - protocol : ' file : ' , <nl> - slashes : true <nl> - } ) ) <nl> + win . loadFile ( ' index . html ' ) <nl> <nl> / / Open the DevTools . <nl> win . webContents . openDevTools ( ) <nl> | docs : Simplify loading of html in example ( ) | electron/electron | 86fcdd0bae23a24cc4930d42f11c4d7ffe5d7918 | 2018-05-25T20:05:15Z |
mmm a / tensorflow / workspace . bzl <nl> ppp b / tensorflow / workspace . bzl <nl> def tf_workspace ( path_prefix = " " , tf_repo_name = " " ) : <nl> tf_http_archive ( <nl> name = " com_google_googletest " , <nl> urls = [ <nl> - " https : / / mirror . bazel . build / github . com / google / googletest / archive / 9816b96a6ddc0430671693df90192bbee57108b6 . zip " , <nl> - " https : / / github . com / google / googletest / archive / 9816b96a6ddc0430671693df90192bbee57108b6 . zip " , <nl> + " https : / / mirror . bazel . build / github . com / google / googletest / archive / 997d343dd680e541ef96ce71ee54a91daf2577a0 . zip " , <nl> + " https : / / github . com / google / googletest / archive / 997d343dd680e541ef96ce71ee54a91daf2577a0 . zip " , <nl> ] , <nl> - sha256 = " 9cbca84c4256bed17df2c8f4d00c912c19d247c11c9ba6647cd6dd5b5c996b8d " , <nl> - strip_prefix = " googletest - 9816b96a6ddc0430671693df90192bbee57108b6 " , <nl> + sha256 = " 353ab86e35cea1cd386115279cf4b16695bbf21b897bfbf2721cf4cb5f64ade8 " , <nl> + strip_prefix = " googletest - 997d343dd680e541ef96ce71ee54a91daf2577a0 " , <nl> ) <nl> <nl> tf_http_archive ( <nl> | Bump gtest version to latest head . | tensorflow/tensorflow | 76d5ee6d1fd6bc9c45b26c03194fae9053569990 | 2018-08-15T22:28:25Z |
mmm a / modules / gdscript / gdscript_tokenizer . cpp <nl> ppp b / modules / gdscript / gdscript_tokenizer . cpp <nl> void GDScriptTokenizer : : check_indent ( ) { <nl> CharType current_indent_char = _peek ( ) ; <nl> int indent_count = 0 ; <nl> <nl> - if ( current_indent_char ! = ' ' & & current_indent_char ! = ' \ t ' & & current_indent_char ! = ' \ r ' & & current_indent_char ! = ' \ n ' ) { <nl> + if ( current_indent_char ! = ' ' & & current_indent_char ! = ' \ t ' & & current_indent_char ! = ' \ r ' & & current_indent_char ! = ' \ n ' & & current_indent_char ! = ' # ' ) { <nl> / / First character of the line is not whitespace , so we clear all indentation levels . <nl> / / Unless we are in a continuation or in multiline mode ( inside expression ) . <nl> if ( line_continuation | | multiline_mode ) { <nl> GDScriptTokenizer : : Token GDScriptTokenizer : : scan ( ) { <nl> } <nl> <nl> default : <nl> - return make_error ( " Unknown character . " ) ; <nl> + return make_error ( vformat ( R " ( Unknown character " % s " . " ) " , String ( & c , 1 ) ) ) ; <nl> } <nl> } <nl> <nl> | Fix comments in beginning of file | godotengine/godot | 34c28eb2b8f3bb96edafba50d0689c49335146dc | 2020-07-20T14:38:39Z |
mmm a / stdlib / CMakeLists . txt <nl> ppp b / stdlib / CMakeLists . txt <nl> else ( ) <nl> endif ( ) <nl> <nl> add_subdirectory ( public ) <nl> - add_subdirectory ( internal ) <nl> add_subdirectory ( private ) <nl> <nl> deleted file mode 100644 <nl> index 4ab20eea969f . . 000000000000 <nl> mmm a / stdlib / internal / CMakeLists . txt <nl> ppp / dev / null <nl> <nl> - if ( SWIFT_BUILD_STDLIB ) <nl> - add_subdirectory ( SwiftExperimental ) <nl> - endif ( ) <nl> - <nl> deleted file mode 100644 <nl> index 39345ed88779 . . 000000000000 <nl> mmm a / stdlib / internal / README . txt <nl> ppp / dev / null <nl> <nl> - The modules in the ' stdlib / internal ' directory provide APIs that are <nl> - under active development and intended to be merged into the appropriate <nl> - libraries under ' stdlib / public ' in the near future , after API review is <nl> - complete and when all other tools that accompany these new APIs are ready . <nl> - <nl> - <nl> deleted file mode 100644 <nl> index 6b2cd6ec438e . . 000000000000 <nl> mmm a / stdlib / internal / SwiftExperimental / CMakeLists . txt <nl> ppp / dev / null <nl> <nl> - add_swift_library ( swiftSwiftExperimental $ { SWIFT_STDLIB_LIBRARY_BUILD_TYPES } IS_STDLIB <nl> - # This file should be listed the first . Module name is inferred from the <nl> - # filename . <nl> - SwiftExperimental . swift <nl> - <nl> - SWIFT_COMPILE_FLAGS $ { STDLIB_SIL_SERIALIZE_ALL } - parse - stdlib <nl> - INSTALL_IN_COMPONENT stdlib - experimental ) <nl> - <nl> mmm a / test / stdlib / DictionaryLiteral . swift <nl> ppp b / test / stdlib / DictionaryLiteral . swift <nl> <nl> <nl> / / REQUIRES : objc_interop <nl> <nl> - import SwiftExperimental <nl> import Foundation <nl> import StdlibUnittest <nl> <nl> deleted file mode 100644 <nl> index da1a4eb7bbe1 . . 000000000000 <nl> mmm a / test / stdlib / Experimental . swift <nl> ppp / dev / null <nl> <nl> - / / RUN : % target - run - simple - swift <nl> - / / REQUIRES : executable_test <nl> - <nl> - import SwiftExperimental <nl> - import StdlibUnittest <nl> - <nl> - <nl> - var ExperimentalTestSuite = TestSuite ( " Experimental " ) <nl> - <nl> - ExperimentalTestSuite . test ( " ComposeOperator / SmokeTest " ) { <nl> - func incr ( _ x : Int ) - > Int { return x + 1 } <nl> - func twice ( _ x : Int ) - > Int { return x * 2 } <nl> - <nl> - expectEqual ( 7 , ( incr β twice ) ( 3 ) ) <nl> - } <nl> - <nl> - / * <nl> - FIXME : this test crashes SILGen . <nl> - < rdar : / / problem / 19150374 > Unimplemented : abstraction difference in l - value <nl> - <nl> - ExperimentalTestSuite . test ( " ComposeOperator / Types " ) { <nl> - struct A { } <nl> - struct B { } <nl> - struct C { } <nl> - <nl> - func a ( _ : A ) - > B { return B ( ) } <nl> - func b ( _ : B ) - > C { return C ( ) } <nl> - <nl> - var result = b β a <nl> - typealias Expected = A - > C <nl> - expectType ( Expected . self , & result ) <nl> - } <nl> - * / <nl> - <nl> - ExperimentalTestSuite . test ( " ComposeOperator / CountCalls " ) { <nl> - struct A { } <nl> - struct B { } <nl> - struct C { } <nl> - <nl> - var aCalled = 0 <nl> - var bCalled = 0 <nl> - func a ( _ : A ) - > B { aCalled + = 1 ; return B ( ) } <nl> - func b ( _ : B ) - > C { bCalled + = 1 ; return C ( ) } <nl> - <nl> - var result = b β a <nl> - expectEqual ( 0 , aCalled ) <nl> - expectEqual ( 0 , bCalled ) <nl> - result ( A ( ) ) <nl> - expectEqual ( 1 , aCalled ) <nl> - expectEqual ( 1 , bCalled ) <nl> - } <nl> - <nl> - / / A modified variant of the test above . <nl> - struct A { } <nl> - struct B { } <nl> - struct C { } <nl> - <nl> - var aCalled = 0 <nl> - var bCalled = 0 <nl> - func a ( _ : A ) - > B { aCalled + = 1 ; return B ( ) } <nl> - func b ( _ : B ) - > C { bCalled + = 1 ; return C ( ) } <nl> - <nl> - ExperimentalTestSuite . test ( " ComposeOperator / CountCalls / Workaround " ) { <nl> - var result = b β a <nl> - expectEqual ( 0 , aCalled ) <nl> - expectEqual ( 0 , bCalled ) <nl> - result ( A ( ) ) <nl> - expectEqual ( 1 , aCalled ) <nl> - expectEqual ( 1 , bCalled ) <nl> - } <nl> - <nl> - runAllTests ( ) <nl> - <nl> similarity index 85 % <nl> rename from stdlib / internal / SwiftExperimental / SwiftExperimental . swift <nl> rename to validation - test / stdlib / ComplexOperators . swift <nl> mmm a / stdlib / internal / SwiftExperimental / SwiftExperimental . swift <nl> ppp b / validation - test / stdlib / ComplexOperators . swift <nl> <nl> - / / = = = mmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmm - = = = / / <nl> - / / <nl> - / / This source file is part of the Swift . org open source project <nl> - / / <nl> - / / Copyright ( c ) 2014 - 2017 Apple Inc . and the Swift project authors <nl> - / / Licensed under Apache License v2 . 0 with Runtime Library Exception <nl> - / / <nl> - / / See https : / / swift . org / LICENSE . txt for license information <nl> - / / See https : / / swift . org / CONTRIBUTORS . txt for the list of Swift project authors <nl> - / / <nl> - / / = = = mmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmm - = = = / / <nl> - / / Experimental APIs of the Swift Standard Library <nl> - / / <nl> - / / This library contains experimental APIs that can be subject to change or <nl> - / / removal . We don ' t guarantee API or ABI stability for this library . <nl> - / / <nl> - / / = = = mmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmm - = = = / / <nl> - import Swift <nl> + / / RUN : % target - typecheck - verify - swift <nl> <nl> / / / The function composition operator is the only user - defined operator that <nl> / / / operates on functions . That ' s why the exact precedence does not matter <nl> mmm a / validation - test / stdlib / Set . swift <nl> ppp b / validation - test / stdlib / Set . swift <nl> import Foundation <nl> import Glibc <nl> # endif <nl> <nl> - / / For experimental Set operators <nl> - import SwiftExperimental <nl> - <nl> extension Set { <nl> func _rawIdentifier ( ) - > Int { <nl> return unsafeBitCast ( self , to : Int . self ) <nl> SetTestSuite . test ( " isSubsetOf . Set . Set " ) { <nl> expectTrue ( s2 . isSubset ( of : s1 ) ) <nl> } <nl> <nl> - SetTestSuite . test ( " β . Set . Set " ) { <nl> - let s1 = Set ( [ 1010 , 2020 , 3030 , 4040 , 5050 , 6060 ] ) <nl> - let s2 = Set ( [ 1010 , 2020 , 3030 ] ) <nl> - expectTrue ( Set < Int > ( ) . isSubset ( of : s1 ) ) <nl> - expectFalse ( s1 β Set < Int > ( ) ) <nl> - expectTrue ( s1 β s1 ) <nl> - expectTrue ( s2 β s1 ) <nl> - } <nl> - <nl> - SetTestSuite . test ( " β . Set . Set " ) { <nl> - let s1 = Set ( [ 1010 , 2020 , 3030 , 4040 , 5050 , 6060 ] ) <nl> - let s2 = Set ( [ 1010 , 2020 , 3030 ] ) <nl> - expectFalse ( Set < Int > ( ) β s1 ) <nl> - expectTrue ( s1 β Set < Int > ( ) ) <nl> - expectFalse ( s1 β s1 ) <nl> - expectFalse ( s2 β s1 ) <nl> - } <nl> - <nl> SetTestSuite . test ( " isSubsetOf . Set . Sequence " ) { <nl> let s1 = Set ( [ 1010 , 2020 , 3030 , 4040 , 5050 , 6060 ] ) <nl> let s2 = AnySequence ( [ 1010 , 2020 , 3030 ] ) <nl> SetTestSuite . test ( " isSubsetOf . Set . Sequence " ) { <nl> expectTrue ( s1 . isSubset ( of : s1 ) ) <nl> } <nl> <nl> - SetTestSuite . test ( " β . Set . Sequence " ) { <nl> - let s1 = Set ( [ 1010 , 2020 , 3030 , 4040 , 5050 , 6060 ] ) <nl> - let s2 = AnySequence ( [ 1010 , 2020 , 3030 ] ) <nl> - expectTrue ( Set < Int > ( ) . isSubset ( of : s1 ) ) <nl> - expectFalse ( s1 β Set < Int > ( ) ) <nl> - expectTrue ( s1 β s1 ) <nl> - } <nl> - <nl> - SetTestSuite . test ( " β . Set . Sequence " ) { <nl> - let s1 = Set ( [ 1010 , 2020 , 3030 , 4040 , 5050 , 6060 ] ) <nl> - let s2 = AnySequence ( [ 1010 , 2020 , 3030 ] ) <nl> - expectFalse ( Set < Int > ( ) β s1 ) <nl> - expectTrue ( s1 β Set < Int > ( ) ) <nl> - expectFalse ( s1 β s1 ) <nl> - } <nl> - <nl> SetTestSuite . test ( " isStrictSubsetOf . Set . Set " ) { <nl> let s1 = Set ( [ 1010 , 2020 , 3030 , 4040 , 5050 , 6060 ] ) <nl> let s2 = Set ( [ 1010 , 2020 , 3030 ] ) <nl> SetTestSuite . test ( " isStrictSubsetOf . Set . Set " ) { <nl> expectFalse ( s1 . isStrictSubset ( of : s1 ) ) <nl> } <nl> <nl> - SetTestSuite . test ( " β . Set . Set " ) { <nl> - let s1 = Set ( [ 1010 , 2020 , 3030 , 4040 , 5050 , 6060 ] ) <nl> - let s2 = Set ( [ 1010 , 2020 , 3030 ] ) <nl> - expectTrue ( Set < Int > ( ) β s1 ) <nl> - expectFalse ( s1 β Set < Int > ( ) ) <nl> - expectFalse ( s1 β s1 ) <nl> - } <nl> - <nl> - SetTestSuite . test ( " β . Set . Set " ) { <nl> - let s1 = Set ( [ 1010 , 2020 , 3030 , 4040 , 5050 , 6060 ] ) <nl> - let s2 = Set ( [ 1010 , 2020 , 3030 ] ) <nl> - expectFalse ( Set < Int > ( ) β s1 ) <nl> - expectTrue ( s1 β Set < Int > ( ) ) <nl> - expectTrue ( s1 β s1 ) <nl> - } <nl> - <nl> SetTestSuite . test ( " isStrictSubsetOf . Set . Sequence " ) { <nl> let s1 = Set ( [ 1010 , 2020 , 3030 , 4040 , 5050 , 6060 ] ) <nl> let s2 = AnySequence ( [ 1010 , 2020 , 3030 ] ) <nl> SetTestSuite . test ( " isStrictSubsetOf . Set . Sequence " ) { <nl> expectFalse ( s1 . isStrictSubset ( of : s1 ) ) <nl> } <nl> <nl> - SetTestSuite . test ( " β . Set . Sequence " ) { <nl> - let s1 = Set ( [ 1010 , 2020 , 3030 , 4040 , 5050 , 6060 ] ) <nl> - let s2 = AnySequence ( [ 1010 , 2020 , 3030 ] ) <nl> - expectTrue ( Set < Int > ( ) β s1 ) <nl> - expectFalse ( s1 β Set < Int > ( ) ) <nl> - expectFalse ( s1 β s1 ) <nl> - } <nl> - <nl> - SetTestSuite . test ( " β . Set . Sequence " ) { <nl> - let s1 = Set ( [ 1010 , 2020 , 3030 , 4040 , 5050 , 6060 ] ) <nl> - let s2 = AnySequence ( [ 1010 , 2020 , 3030 ] ) <nl> - expectFalse ( Set < Int > ( ) β s1 ) <nl> - expectTrue ( s1 β Set < Int > ( ) ) <nl> - expectTrue ( s1 β s1 ) <nl> - } <nl> - <nl> SetTestSuite . test ( " isSupersetOf . Set . Set " ) { <nl> let s1 = Set ( [ 1010 , 2020 , 3030 , 4040 , 5050 , 6060 ] ) <nl> let s2 = Set ( [ 1010 , 2020 , 3030 ] ) <nl> SetTestSuite . test ( " isSupersetOf . Set . Set " ) { <nl> expectFalse ( Set < Int > ( ) . isSuperset ( of : s1 ) ) <nl> } <nl> <nl> - SetTestSuite . test ( " β . Set . Set " ) { <nl> - let s1 = Set ( [ 1010 , 2020 , 3030 , 4040 , 5050 , 6060 ] ) <nl> - let s2 = Set ( [ 1010 , 2020 , 3030 ] ) <nl> - expectTrue ( s1 β Set < Int > ( ) ) <nl> - expectFalse ( Set < Int > ( ) β s1 ) <nl> - expectTrue ( s1 β s1 ) <nl> - expectTrue ( s1 β s2 ) <nl> - expectFalse ( Set < Int > ( ) β s1 ) <nl> - } <nl> - <nl> - SetTestSuite . test ( " β . Set . Set " ) { <nl> - let s1 = Set ( [ 1010 , 2020 , 3030 , 4040 , 5050 , 6060 ] ) <nl> - let s2 = Set ( [ 1010 , 2020 , 3030 ] ) <nl> - expectFalse ( s1 β Set < Int > ( ) ) <nl> - expectTrue ( Set < Int > ( ) β s1 ) <nl> - expectFalse ( s1 β s1 ) <nl> - expectFalse ( s1 β s2 ) <nl> - expectTrue ( Set < Int > ( ) β s1 ) <nl> - } <nl> - <nl> SetTestSuite . test ( " isSupersetOf . Set . Sequence " ) { <nl> let s1 = Set ( [ 1010 , 2020 , 3030 , 4040 , 5050 , 6060 ] ) <nl> let s2 = AnySequence ( [ 1010 , 2020 , 3030 ] ) <nl> SetTestSuite . test ( " isSupersetOf . Set . Sequence " ) { <nl> expectFalse ( Set < Int > ( ) . isSuperset ( of : s1 ) ) <nl> } <nl> <nl> - SetTestSuite . test ( " β . Set . Sequence " ) { <nl> - let s1 = Set ( [ 1010 , 2020 , 3030 , 4040 , 5050 , 6060 ] ) <nl> - let s2 = AnySequence ( [ 1010 , 2020 , 3030 ] ) <nl> - expectTrue ( s1 β Set < Int > ( ) ) <nl> - expectFalse ( Set < Int > ( ) β s1 ) <nl> - expectTrue ( s1 β s1 ) <nl> - expectTrue ( s1 β s2 ) <nl> - expectFalse ( Set < Int > ( ) β s1 ) <nl> - } <nl> - <nl> - SetTestSuite . test ( " β . Set . Sequence " ) { <nl> - let s1 = Set ( [ 1010 , 2020 , 3030 , 4040 , 5050 , 6060 ] ) <nl> - let s2 = AnySequence ( [ 1010 , 2020 , 3030 ] ) <nl> - expectFalse ( s1 β Set < Int > ( ) ) <nl> - expectTrue ( Set < Int > ( ) β s1 ) <nl> - expectFalse ( s1 β s1 ) <nl> - expectFalse ( s1 β s2 ) <nl> - expectTrue ( Set < Int > ( ) β s1 ) <nl> - } <nl> - <nl> SetTestSuite . test ( " strictSuperset . Set . Set " ) { <nl> let s1 = Set ( [ 1010 , 2020 , 3030 , 4040 , 5050 , 6060 ] ) <nl> let s2 = Set ( [ 1010 , 2020 , 3030 ] ) <nl> SetTestSuite . test ( " strictSuperset . Set . Set " ) { <nl> expectTrue ( s1 . isStrictSuperset ( of : s2 ) ) <nl> } <nl> <nl> - SetTestSuite . test ( " β . Set . Set " ) { <nl> - let s1 = Set ( [ 1010 , 2020 , 3030 , 4040 , 5050 , 6060 ] ) <nl> - let s2 = Set ( [ 1010 , 2020 , 3030 ] ) <nl> - expectTrue ( s1 β Set < Int > ( ) ) <nl> - expectFalse ( Set < Int > ( ) β s1 ) <nl> - expectFalse ( s1 β s1 ) <nl> - expectTrue ( s1 β s2 ) <nl> - } <nl> - <nl> - SetTestSuite . test ( " β
. Set . Set " ) { <nl> - let s1 = Set ( [ 1010 , 2020 , 3030 , 4040 , 5050 , 6060 ] ) <nl> - let s2 = Set ( [ 1010 , 2020 , 3030 ] ) <nl> - expectFalse ( s1 β
Set < Int > ( ) ) <nl> - expectTrue ( Set < Int > ( ) β
s1 ) <nl> - expectTrue ( s1 β
s1 ) <nl> - expectFalse ( s1 β
s2 ) <nl> - } <nl> - <nl> SetTestSuite . test ( " strictSuperset . Set . Sequence " ) { <nl> let s1 = Set ( [ 1010 , 2020 , 3030 , 4040 , 5050 , 6060 ] ) <nl> let s2 = AnySequence ( [ 1010 , 2020 , 3030 ] ) <nl> SetTestSuite . test ( " strictSuperset . Set . Sequence " ) { <nl> expectTrue ( s1 . isStrictSuperset ( of : s2 ) ) <nl> } <nl> <nl> - SetTestSuite . test ( " β . Set . Sequence " ) { <nl> - let s1 = Set ( [ 1010 , 2020 , 3030 , 4040 , 5050 , 6060 ] ) <nl> - let s2 = AnySequence ( [ 1010 , 2020 , 3030 ] ) <nl> - expectTrue ( s1 β Set < Int > ( ) ) <nl> - expectFalse ( Set < Int > ( ) β s1 ) <nl> - expectFalse ( s1 β s1 ) <nl> - expectTrue ( s1 β s2 ) <nl> - } <nl> - <nl> - SetTestSuite . test ( " β
. Set . Sequence " ) { <nl> - let s1 = Set ( [ 1010 , 2020 , 3030 , 4040 , 5050 , 6060 ] ) <nl> - let s2 = AnySequence ( [ 1010 , 2020 , 3030 ] ) <nl> - expectFalse ( s1 β
Set < Int > ( ) ) <nl> - expectTrue ( Set < Int > ( ) β
s1 ) <nl> - expectTrue ( s1 β
s1 ) <nl> - expectFalse ( s1 β
s2 ) <nl> - } <nl> - <nl> SetTestSuite . test ( " Equatable . Native . Native " ) { <nl> let s1 = getCOWFastSet ( ) <nl> let s2 = getCOWFastSet ( [ 1010 , 2020 , 3030 , 4040 , 5050 , 6060 ] ) <nl> SetTestSuite . test ( " union " ) { <nl> expectEqual ( s1 , Set < Int > ( ) . union ( s1 ) ) <nl> } <nl> <nl> - SetTestSuite . test ( " βͺ " ) { <nl> - let s1 = Set ( [ 1010 , 2020 , 3030 ] ) <nl> - let s2 = Set ( [ 4040 , 5050 , 6060 ] ) <nl> - let s3 = Set ( [ 1010 , 2020 , 3030 , 4040 , 5050 , 6060 ] ) <nl> - <nl> - let identity1 = s1 . _rawIdentifier ( ) <nl> - <nl> - let s4 = s1 βͺ s2 <nl> - expectEqual ( s4 , s3 ) <nl> - <nl> - / / s1 should be unchanged <nl> - expectEqual ( identity1 , s1 . _rawIdentifier ( ) ) <nl> - expectEqual ( Set ( [ 1010 , 2020 , 3030 ] ) , s1 ) <nl> - <nl> - / / s4 should be a fresh set <nl> - expectNotEqual ( identity1 , s4 . _rawIdentifier ( ) ) <nl> - expectEqual ( s4 , s3 ) <nl> - <nl> - let s5 = s1 βͺ s1 <nl> - expectEqual ( s5 , s1 ) <nl> - expectEqual ( identity1 , s1 . _rawIdentifier ( ) ) <nl> - <nl> - expectEqual ( s1 , s1 βͺ Set < Int > ( ) ) <nl> - expectEqual ( s1 , Set < Int > ( ) βͺ s1 ) <nl> - } <nl> - <nl> SetTestSuite . test ( " formUnion " ) { <nl> / / These are anagrams - they should amount to the same sets . <nl> var s1 = Set ( " the morse code " . characters ) <nl> SetTestSuite . test ( " formUnion " ) { <nl> expectEqual ( identity1 , s1 . _rawIdentifier ( ) ) <nl> } <nl> <nl> - SetTestSuite . test ( " βͺ = " ) { <nl> - / / These are anagrams - they should amount to the same sets . <nl> - var s1 = Set ( " the morse code " . characters ) <nl> - let s2 = Set ( " here come dots " . characters ) <nl> - let s3 = Set ( " and then dashes " . characters ) <nl> - <nl> - let identity1 = s1 . _rawIdentifier ( ) <nl> - <nl> - s1 βͺ = " " . characters <nl> - expectEqual ( identity1 , s1 . _rawIdentifier ( ) ) <nl> - <nl> - expectEqual ( s1 , s2 ) <nl> - s1 βͺ = s2 <nl> - expectEqual ( s1 , s2 ) <nl> - expectEqual ( identity1 , s1 . _rawIdentifier ( ) ) <nl> - <nl> - s1 βͺ = s3 <nl> - expectNotEqual ( s1 , s2 ) <nl> - expectEqual ( identity1 , s1 . _rawIdentifier ( ) ) <nl> - } <nl> - <nl> SetTestSuite . test ( " subtract " ) <nl> . xfail ( . custom ( { _isStdlibDebugConfiguration ( ) } , <nl> reason : " rdar : / / 33358110 " ) ) <nl> SetTestSuite . test ( " subtract " ) <nl> expectEqual ( identity1 , s1 . _rawIdentifier ( ) ) <nl> } <nl> <nl> - SetTestSuite . test ( " β " ) { <nl> - let s1 = Set ( [ 1010 , 2020 , 3030 ] ) <nl> - let s2 = Set ( [ 4040 , 5050 , 6060 ] ) <nl> - let s3 = Set ( [ 1010 , 2020 , 3030 , 4040 , 5050 , 6060 ] ) <nl> - <nl> - let identity1 = s1 . _rawIdentifier ( ) <nl> - <nl> - / / Subtracting a disjoint set should not create a <nl> - / / unique reference <nl> - let s4 = s1 β s2 <nl> - expectEqual ( s1 , s4 ) <nl> - expectEqual ( identity1 , s1 . _rawIdentifier ( ) ) <nl> - expectEqual ( identity1 , s4 . _rawIdentifier ( ) ) <nl> - <nl> - / / Subtracting a superset will leave the set empty <nl> - let s5 = s1 β s3 <nl> - expectTrue ( s5 . isEmpty ) <nl> - expectEqual ( identity1 , s1 . _rawIdentifier ( ) ) <nl> - expectNotEqual ( identity1 , s5 . _rawIdentifier ( ) ) <nl> - <nl> - / / Subtracting the empty set does nothing <nl> - expectEqual ( s1 , s1 β Set < Int > ( ) ) <nl> - expectEqual ( Set < Int > ( ) , Set < Int > ( ) β s1 ) <nl> - expectEqual ( identity1 , s1 . _rawIdentifier ( ) ) <nl> - } <nl> - <nl> SetTestSuite . test ( " subtract " ) <nl> . xfail ( . custom ( { _isStdlibDebugConfiguration ( ) } , <nl> reason : " rdar : / / 33358110 " ) ) <nl> SetTestSuite . test ( " subtract " ) <nl> expectEqual ( identity1 , s1 . _rawIdentifier ( ) ) <nl> } <nl> <nl> - SetTestSuite . test ( " β = " ) <nl> - . xfail ( . custom ( { _isStdlibDebugConfiguration ( ) } , <nl> - reason : " rdar : / / 33358110 " ) ) <nl> - . code { <nl> - <nl> - var s1 = Set ( [ 1010 , 2020 , 3030 , 4040 , 5050 , 6060 ] ) <nl> - let s2 = Set ( [ 1010 , 2020 , 3030 ] ) <nl> - let s3 = Set ( [ 4040 , 5050 , 6060 ] ) <nl> - <nl> - let identity1 = s1 . _rawIdentifier ( ) <nl> - <nl> - s1 β = Set < Int > ( ) <nl> - expectEqual ( identity1 , s1 . _rawIdentifier ( ) ) <nl> - <nl> - s1 β = s3 <nl> - expectEqual ( identity1 , s1 . _rawIdentifier ( ) ) <nl> - <nl> - expectEqual ( s1 , s2 ) <nl> - expectEqual ( identity1 , s1 . _rawIdentifier ( ) ) <nl> - } <nl> - <nl> SetTestSuite . test ( " intersect " ) { <nl> let s1 = Set ( [ 1010 , 2020 , 3030 ] ) <nl> let s2 = Set ( [ 4040 , 5050 , 6060 ] ) <nl> SetTestSuite . test ( " intersect " ) { <nl> expectEqual ( Set < Int > ( ) , Set < Int > ( ) . intersection ( s1 ) ) <nl> } <nl> <nl> - SetTestSuite . test ( " β© " ) { <nl> - let s1 = Set ( [ 1010 , 2020 , 3030 ] ) <nl> - let s2 = Set ( [ 4040 , 5050 , 6060 ] ) <nl> - var s3 = Set ( [ 1010 , 2020 , 3030 , 4040 , 5050 , 6060 ] ) <nl> - var s4 = Set ( [ 1010 , 2020 , 3030 ] ) <nl> - <nl> - let identity1 = s1 . _rawIdentifier ( ) <nl> - expectEqual ( Set ( [ 1010 , 2020 , 3030 ] ) , <nl> - Set ( [ 1010 , 2020 , 3030 ] ) β© Set ( [ 1010 , 2020 , 3030 ] ) as Set < Int > ) <nl> - expectEqual ( identity1 , s1 . _rawIdentifier ( ) ) <nl> - <nl> - expectEqual ( s1 , s1 β© s3 ) <nl> - expectEqual ( identity1 , s1 . _rawIdentifier ( ) ) <nl> - <nl> - expectEqual ( Set < Int > ( ) , Set < Int > ( ) β© Set < Int > ( ) ) <nl> - expectEqual ( Set < Int > ( ) , s1 β© Set < Int > ( ) ) <nl> - expectEqual ( Set < Int > ( ) , Set < Int > ( ) β© s1 ) <nl> - } <nl> - <nl> SetTestSuite . test ( " formIntersection " ) { <nl> var s1 = Set ( [ 1010 , 2020 , 3030 ] ) <nl> let s2 = Set ( [ 4040 , 5050 , 6060 ] ) <nl> SetTestSuite . test ( " formIntersection " ) { <nl> expectEqual ( s5 , Set < Int > ( ) ) <nl> } <nl> <nl> - SetTestSuite . test ( " β© = " ) { <nl> - var s1 = Set ( [ 1010 , 2020 , 3030 ] ) <nl> - let s2 = Set ( [ 4040 , 5050 , 6060 ] ) <nl> - var s3 = Set ( [ 1010 , 2020 , 3030 , 4040 , 5050 , 6060 ] ) <nl> - var s4 = Set ( [ 1010 , 2020 , 3030 ] ) <nl> - <nl> - let identity1 = s1 . _rawIdentifier ( ) <nl> - s1 β© = s4 <nl> - expectEqual ( s1 , s4 ) <nl> - expectEqual ( identity1 , s1 . _rawIdentifier ( ) ) <nl> - <nl> - s4 β© = s2 <nl> - expectEqual ( Set < Int > ( ) , s4 ) <nl> - <nl> - let identity2 = s3 . _rawIdentifier ( ) <nl> - s3 β© = s2 <nl> - expectEqual ( s3 , s2 ) <nl> - expectTrue ( s1 . isDisjoint ( with : s3 ) ) <nl> - expectNotEqual ( identity1 , s3 . _rawIdentifier ( ) ) <nl> - <nl> - var s5 = Set < Int > ( ) <nl> - s5 β© = s5 <nl> - expectEqual ( s5 , Set < Int > ( ) ) <nl> - s5 β© = s1 <nl> - expectEqual ( s5 , Set < Int > ( ) ) <nl> - } <nl> - <nl> SetTestSuite . test ( " symmetricDifference " ) { <nl> <nl> / / Overlap with 4040 , 5050 , 6060 <nl> SetTestSuite . test ( " symmetricDifference " ) { <nl> expectTrue ( s1 . symmetricDifference ( s1 ) . isEmpty ) <nl> } <nl> <nl> - SetTestSuite . test ( " β¨ " ) { <nl> - <nl> - / / Overlap with 4040 , 5050 , 6060 <nl> - let s1 = Set ( [ 1010 , 2020 , 3030 , 4040 , 5050 , 6060 ] ) <nl> - let s2 = Set ( [ 4040 , 5050 , 6060 , 7070 , 8080 , 9090 ] ) <nl> - let result = Set ( [ 1010 , 2020 , 3030 , 7070 , 8080 , 9090 ] ) <nl> - let universe = Set ( [ 1010 , 2020 , 3030 , 4040 , 5050 , 6060 , <nl> - 7070 , 8080 , 9090 ] ) <nl> - <nl> - let identity1 = s1 . _rawIdentifier ( ) <nl> - <nl> - let s3 = s1 β¨ s2 <nl> - <nl> - expectEqual ( identity1 , s1 . _rawIdentifier ( ) ) <nl> - <nl> - expectEqual ( s3 , result ) <nl> - <nl> - expectEqual ( s1 β¨ s2 , <nl> - ( s1 βͺ s2 ) β© ( universe β ( s1 β© s2 ) ) ) <nl> - <nl> - expectEqual ( s1 β¨ s2 , <nl> - s1 β© ( universe β s2 ) βͺ ( universe β s1 ) β© s2 ) <nl> - <nl> - expectTrue ( ( s1 β¨ s1 ) . isEmpty ) <nl> - } <nl> - <nl> SetTestSuite . test ( " formSymmetricDifference " ) <nl> . xfail ( . custom ( { _isStdlibDebugConfiguration ( ) } , <nl> reason : " rdar : / / 33358110 " ) ) <nl> SetTestSuite . test ( " formSymmetricDifference " ) <nl> expectNotEqual ( identity1 , s1 . _rawIdentifier ( ) ) <nl> } <nl> <nl> - SetTestSuite . test ( " β¨ = " ) <nl> - . xfail ( . custom ( { _isStdlibDebugConfiguration ( ) } , <nl> - reason : " rdar : / / 33358110 " ) ) <nl> - . code { <nl> - <nl> - / / Overlap with 4040 , 5050 , 6060 <nl> - var s1 = Set ( [ 1010 , 2020 , 3030 , 4040 , 5050 , 6060 ] ) <nl> - let s2 = Set ( [ 1010 ] ) <nl> - let result = Set ( [ 2020 , 3030 , 4040 , 5050 , 6060 ] ) <nl> - <nl> - let identity1 = s1 . _rawIdentifier ( ) <nl> - s1 β¨ = s2 <nl> - <nl> - / / Removing just one element shouldn ' t cause an identity change <nl> - expectEqual ( identity1 , s1 . _rawIdentifier ( ) ) <nl> - <nl> - expectEqual ( s1 , result ) <nl> - <nl> - s1 β¨ = s1 <nl> - expectTrue ( s1 . isEmpty ) <nl> - <nl> - / / Removing all elements should cause an identity change <nl> - expectNotEqual ( identity1 , s1 . _rawIdentifier ( ) ) <nl> - } <nl> - <nl> SetTestSuite . test ( " removeFirst " ) { <nl> var s1 = Set ( [ 1010 , 2020 , 3030 ] ) <nl> let s2 = s1 <nl> SetTestSuite . test ( " contains " ) { <nl> expectFalse ( s1 . contains ( 999 ) ) <nl> } <nl> <nl> - SetTestSuite . test ( " β " ) { <nl> - let s1 = Set ( [ 1010 , 2020 , 3030 ] ) <nl> - expectTrue ( 1010 β s1 ) <nl> - expectFalse ( 999 β s1 ) <nl> - } <nl> - <nl> - SetTestSuite . test ( " β " ) { <nl> - let s1 = Set ( [ 1010 , 2020 , 3030 ] ) <nl> - expectFalse ( 1010 β s1 ) <nl> - expectTrue ( 999 β s1 ) <nl> - } <nl> - <nl> SetTestSuite . test ( " memberAtIndex " ) { <nl> let s1 = Set ( [ 1010 , 2020 , 3030 ] ) <nl> <nl> SetTestSuite . test ( " Hashable " ) { <nl> checkHashable ( [ ss1 , ss11 , ss2 ] , equalityOracle : { $ 0 = = $ 1 } ) <nl> } <nl> <nl> - SetTestSuite . test ( " Operator . Precedence " ) { <nl> - let s1 = Set ( [ 1010 , 2020 , 3030 ] ) <nl> - let s2 = Set ( [ 3030 , 4040 , 5050 ] ) <nl> - let s3 = Set ( [ 6060 , 7070 , 8080 ] ) <nl> - let s4 = Set ( [ 8080 , 9090 , 100100 ] ) <nl> - <nl> - / / intersection higher precedence than union <nl> - expectEqual ( s1 βͺ ( s2 β© s3 ) βͺ s4 , s1 βͺ s2 β© s3 βͺ s4 as Set < Int > ) <nl> - <nl> - / / intersection higher precedence than complement <nl> - expectEqual ( s1 β ( s2 β© s3 ) β s4 , s1 β s2 β© s3 β s4 as Set < Int > ) <nl> - <nl> - / / intersection higher precedence than exclusive - or <nl> - expectEqual ( s1 β¨ ( s2 β© s3 ) β¨ s4 , s1 β¨ s2 β© s3 β¨ s4 as Set < Int > ) <nl> - <nl> - / / union / complement / exclusive - or same precedence <nl> - expectEqual ( ( ( ( s1 βͺ s3 ) β s2 ) β¨ s4 ) , s1 βͺ s3 β s2 β¨ s4 as Set < Int > ) <nl> - <nl> - / / βͺ = should happen last . <nl> - var s5 = Set ( [ 1010 , 2020 , 3030 ] ) <nl> - s5 βͺ = Set ( [ 4040 , 5050 , 6060 ] ) βͺ [ 7070 ] <nl> - expectEqual ( Set ( [ 1010 , 2020 , 3030 , 4040 , 5050 , 6060 , 7070 ] ) , s5 ) <nl> - <nl> - / / β© = should happen last . <nl> - var s6 = Set ( [ 1010 , 2020 , 3030 ] ) <nl> - s6 β© = Set ( [ 1010 , 2020 , 3030 ] ) β© [ 3030 ] <nl> - expectEqual ( Set ( [ 3030 ] ) , s6 ) <nl> - <nl> - / / β¨ = should happen last . <nl> - var s7 = Set ( [ 1010 , 2020 , 3030 ] ) <nl> - s7 β¨ = Set ( [ 1010 , 2020 , 3030 ] ) β¨ [ 1010 , 3030 ] <nl> - expectEqual ( Set ( [ 1010 , 3030 ] ) , s7 ) <nl> - <nl> - / / β = should happen last . <nl> - var s8 = Set ( [ 1010 , 2020 , 3030 ] ) <nl> - s8 β = Set ( [ 2020 , 3030 ] ) β [ 3030 ] <nl> - expectEqual ( Set ( [ 1010 , 3030 ] ) , s8 ) <nl> - } <nl> - <nl> / / = = = mmm <nl> / / Check that iterators traverse a snapshot of the collection . <nl> / / = = = mmm <nl> | Remove SwiftExperimental | apple/swift | e4bfd600cc99225b64967e1eb94bd2302d923ac6 | 2017-08-11T21:21:06Z |
mmm a / xbmc / Application . cpp <nl> ppp b / xbmc / Application . cpp <nl> bool CApplication : : Create ( ) <nl> CProfilesManager : : Get ( ) . Load ( ) ; <nl> <nl> CLog : : Log ( LOGNOTICE , " mmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmm - - " ) ; <nl> + CLog : : Log ( LOGNOTICE , " Starting XBMC ( % s ) . Platform : % s " , g_infoManager . GetVersion ( ) . c_str ( ) , g_sysinfo . GetBuildTargetPlatformName ( ) . c_str ( ) ) ; <nl> + <nl> + / * Expand macro before stringify * / <nl> + # define STR_MACRO ( x ) # x <nl> + # define XSTR_MACRO ( x ) STR_MACRO ( x ) <nl> + <nl> + std : : string compilerStr ; <nl> + # if defined ( __clang__ ) <nl> + compilerStr = " Clang " XSTR_MACRO ( __clang_major__ ) " . " XSTR_MACRO ( __clang_minor__ ) " . " XSTR_MACRO ( __clang_patchlevel__ ) ; <nl> + # elif defined ( __INTEL_COMPILER ) <nl> + compilerStr = " Intel Compiler " XSTR_MACRO ( __INTEL_COMPILER ) ; <nl> + # elif defined ( __GNUC__ ) <nl> + # ifdef __llvm__ <nl> + / * Note : this will not detect GCC + DragonEgg * / <nl> + compilerStr = " llvm - gcc " ; <nl> + # else / / __llvm__ <nl> + compilerStr = " GCC " ; <nl> + # endif / / ! __llvm__ <nl> + compilerStr + = XSTR_MACRO ( __GNUC__ ) " . " XSTR_MACRO ( __GNUC_MINOR__ ) " . " XSTR_MACRO ( __GNUC_PATCHLEVEL__ ) ; <nl> + # elif defined ( _MSC_VER ) <nl> + compilerStr = " MSVC " XSTR_MACRO ( _MSC_FULL_VER ) ; <nl> + # else <nl> + compilerStr = " unknown compiler " ; <nl> + # endif <nl> + std : : string buildType ; <nl> + # if defined ( _DEBUG ) <nl> + buildType = " Debug " ; <nl> + # elif defined ( NDEBUG ) <nl> + buildType = " Release " ; <nl> + # else <nl> + buildType = " Unknown " ; <nl> + # endif <nl> + CLog : : Log ( LOGNOTICE , " Using % s XBMC build , compiled " __DATE__ " by % s for % s % s " , buildType . c_str ( ) , compilerStr . c_str ( ) , g_sysinfo . GetBuildTargetPlatformName ( ) . c_str ( ) , g_sysinfo . GetBuildTargetPlatformVersion ( ) . c_str ( ) ) ; <nl> + <nl> # if defined ( TARGET_DARWIN_OSX ) <nl> - CLog : : Log ( LOGNOTICE , " Starting XBMC ( % s ) , Built on " __DATE__ " ( GCC version % i . % i . % i ) . Platform : Darwin OSX ( % s ) " , <nl> - g_infoManager . GetVersion ( ) . c_str ( ) , __GNUC__ , __GNUC_MINOR__ , __GNUC_PATCHLEVEL__ , g_sysinfo . GetUnameVersion ( ) . c_str ( ) ) ; <nl> + CLog : : Log ( LOGNOTICE , " Running on Darwin OSX % s " , g_sysinfo . GetUnameVersion ( ) . c_str ( ) ) ; <nl> # elif defined ( TARGET_DARWIN_IOS ) <nl> - CLog : : Log ( LOGNOTICE , " Starting XBMC ( % s ) , Built on " __DATE__ " ( GCC version % i . % i . % i ) . Platform : Darwin iOS ( % s ) " , <nl> - g_infoManager . GetVersion ( ) . c_str ( ) , __GNUC__ , __GNUC_MINOR__ , __GNUC_PATCHLEVEL__ , g_sysinfo . GetUnameVersion ( ) . c_str ( ) ) ; <nl> + CLog : : Log ( LOGNOTICE , " Running on Darwin iOS % s % s " , g_sysinfo . IsAppleTV2 ( ) ? " ( AppleTV2 ) " : " " , g_sysinfo . GetUnameVersion ( ) . c_str ( ) ) ; <nl> # elif defined ( TARGET_FREEBSD ) <nl> - CLog : : Log ( LOGNOTICE , " Starting XBMC ( % s ) , Built on " __DATE__ " ( GCC version % i . % i . % i ) . Platform : FreeBSD ( % s ) " , <nl> - g_infoManager . GetVersion ( ) . c_str ( ) , __GNUC__ , __GNUC_MINOR__ , __GNUC_PATCHLEVEL__ , g_sysinfo . GetUnameVersion ( ) . c_str ( ) ) ; <nl> + CLog : : Log ( LOGNOTICE , " Running on FreeBSD % s " , g_sysinfo . GetUnameVersion ( ) . c_str ( ) ) ; <nl> # elif defined ( TARGET_POSIX ) <nl> - CLog : : Log ( LOGNOTICE , " Starting XBMC ( % s ) , Built on " __DATE__ " ( GCC version % i . % i . % i ) . Platform : Linux ( % s , % s ) " , <nl> - g_infoManager . GetVersion ( ) . c_str ( ) , __GNUC__ , __GNUC_MINOR__ , __GNUC_PATCHLEVEL__ , g_sysinfo . GetLinuxDistro ( ) . c_str ( ) , g_sysinfo . GetUnameVersion ( ) . c_str ( ) ) ; <nl> + CLog : : Log ( LOGNOTICE , " Running on Linux ( % s , % s ) " , g_sysinfo . GetLinuxDistro ( ) . c_str ( ) , g_sysinfo . GetUnameVersion ( ) . c_str ( ) ) ; <nl> # elif defined ( TARGET_WINDOWS ) <nl> - CLog : : Log ( LOGNOTICE , " Starting XBMC ( % s ) , Built on " __DATE__ " ( MSVC version % i ) . Platform : % s " , g_infoManager . GetVersion ( ) . c_str ( ) , _MSC_VER , g_sysinfo . GetKernelVersion ( ) . c_str ( ) ) ; <nl> - # endif <nl> - # if defined ( _DEBUG ) <nl> - CLog : : Log ( LOGINFO , " Using Debug XBMC build " ) ; <nl> - # elif defined ( NDEBUG ) <nl> - CLog : : Log ( LOGINFO , " Using Release XBMC build " ) ; <nl> + CLog : : Log ( LOGNOTICE , " Running on % s " , g_sysinfo . GetKernelVersion ( ) . c_str ( ) ) ; <nl> # endif <nl> + <nl> + CLog : : Log ( LOGNOTICE , " Host CPU : % s " , g_cpuInfo . getCPUModel ( ) . c_str ( ) ) ; <nl> # if defined ( TARGET_WINDOWS ) <nl> - CLog : : Log ( LOGNOTICE , " % s " , g_cpuInfo . getCPUModel ( ) . c_str ( ) ) ; <nl> CLog : : Log ( LOGNOTICE , " % s " , CWIN32Util : : GetResInfoString ( ) . c_str ( ) ) ; <nl> CLog : : Log ( LOGNOTICE , " Running with % s rights " , ( CWIN32Util : : IsCurrentUserLocalAdministrator ( ) = = TRUE ) ? " administrator " : " restricted " ) ; <nl> CLog : : Log ( LOGNOTICE , " Aero is % s " , ( g_sysinfo . IsAeroDisabled ( ) = = true ) ? " disabled " : " enabled " ) ; <nl> mmm a / xbmc / utils / CPUInfo . cpp <nl> ppp b / xbmc / utils / CPUInfo . cpp <nl> <nl> <nl> # include " log . h " <nl> # include " settings / AdvancedSettings . h " <nl> + # include " utils / StringUtils . h " <nl> <nl> using namespace std ; <nl> <nl> CCPUInfo : : CCPUInfo ( void ) <nl> } <nl> <nl> # endif <nl> + StringUtils : : RemoveDuplicatedSpacesAndTabs ( m_cpuModel ) ; <nl> + <nl> / * Set some default for empty string variables * / <nl> if ( m_cpuBogoMips . empty ( ) ) <nl> m_cpuBogoMips = " N / A " ; <nl> mmm a / xbmc / utils / StringUtils . cpp <nl> ppp b / xbmc / utils / StringUtils . cpp <nl> std : : string & StringUtils : : TrimRight ( std : : string & str ) <nl> return str ; <nl> } <nl> <nl> + std : : string & StringUtils : : RemoveDuplicatedSpacesAndTabs ( std : : string & str ) <nl> + { <nl> + std : : string : : iterator it = str . begin ( ) ; <nl> + bool onSpace = false ; <nl> + while ( it ! = str . end ( ) ) <nl> + { <nl> + if ( * it = = ' \ t ' ) <nl> + * it = ' ' ; <nl> + <nl> + if ( * it = = ' ' ) <nl> + { <nl> + if ( onSpace ) <nl> + { <nl> + it = str . erase ( it ) ; <nl> + continue ; <nl> + } <nl> + else <nl> + onSpace = true ; <nl> + } <nl> + else <nl> + onSpace = false ; <nl> + <nl> + + + it ; <nl> + } <nl> + return str ; <nl> + } <nl> + <nl> int StringUtils : : Replace ( string & str , char oldChar , char newChar ) <nl> { <nl> int replacedChars = 0 ; <nl> mmm a / xbmc / utils / StringUtils . h <nl> ppp b / xbmc / utils / StringUtils . h <nl> class StringUtils <nl> static std : : string & Trim ( std : : string & str ) ; <nl> static std : : string & TrimLeft ( std : : string & str ) ; <nl> static std : : string & TrimRight ( std : : string & str ) ; <nl> + static std : : string & RemoveDuplicatedSpacesAndTabs ( std : : string & str ) ; <nl> static int Replace ( std : : string & str , char oldChar , char newChar ) ; <nl> static int Replace ( std : : string & str , const std : : string & oldStr , const std : : string & newStr ) ; <nl> static bool StartsWith ( const std : : string & str , const std : : string & str2 , bool useCase = false ) ; <nl> mmm a / xbmc / utils / SystemInfo . cpp <nl> ppp b / xbmc / utils / SystemInfo . cpp <nl> <nl> # include " utils / StringUtils . h " <nl> # include " utils / XMLUtils . h " <nl> <nl> + / * Target identification * / <nl> + # if defined ( TARGET_DARWIN ) <nl> + # include < Availability . h > <nl> + # elif defined ( TARGET_ANDROID ) <nl> + # include < android / api - level . h > <nl> + # elif defined ( TARGET_FREEBSD ) <nl> + # include < sys / param . h > <nl> + # elif defined ( TARGET_LINUX ) <nl> + # include < linux / version . h > <nl> + # endif <nl> + <nl> CSysInfo g_sysinfo ; <nl> <nl> CSysInfoJob : : CSysInfoJob ( ) <nl> bool CSysInfo : : HasVideoToolBoxDecoder ( ) <nl> return result ; <nl> } <nl> <nl> + std : : string CSysInfo : : GetBuildTargetPlatformName ( void ) <nl> + { <nl> + # if defined ( TARGET_DARWIN_OSX ) <nl> + return " Darwin OSX " ; <nl> + # elif defined ( TARGET_DARWIN_IOS_ATV2 ) <nl> + return " Darwin iOS ATV2 " ; <nl> + # elif defined ( TARGET_DARWIN_IOS ) <nl> + return " Darwin iOS " ; <nl> + # elif defined ( TARGET_FREEBSD ) <nl> + return " FreeBSD " ; <nl> + # elif defined ( TARGET_ANDROID ) <nl> + return " Android " ; <nl> + # elif defined ( TARGET_LINUX ) <nl> + return " Linux " ; <nl> + # elif defined ( TARGET_WINDOWS ) <nl> + return " Win32 " ; <nl> + # else <nl> + return " unknown platform " ; <nl> + # endif <nl> + } <nl> + <nl> + std : : string CSysInfo : : GetBuildTargetPlatformVersion ( void ) <nl> + { <nl> + / * Expand macro before stringify * / <nl> + # define STR_MACRO ( x ) # x <nl> + # define XSTR_MACRO ( x ) STR_MACRO ( x ) <nl> + <nl> + # if defined ( TARGET_DARWIN_OSX ) <nl> + return " version " XSTR_MACRO ( __MAC_OS_X_VERSION_MIN_REQUIRED ) ; <nl> + # elif defined ( TARGET_DARWIN_IOS ) <nl> + return " version " XSTR_MACRO ( __IPHONE_OS_VERSION_MIN_REQUIRED ) ; <nl> + # elif defined ( TARGET_FREEBSD ) <nl> + return " version " XSTR_MACRO ( __FreeBSD_version ) ; <nl> + # elif defined ( TARGET_ANDROID ) <nl> + return " API level " XSTR_MACRO ( __ANDROID_API__ ) ; <nl> + # elif defined ( TARGET_LINUX ) <nl> + std : : string ver = StringUtils : : Format ( " % i . % i . % i " , LINUX_VERSION_CODE > > 16 , ( LINUX_VERSION_CODE > > 8 ) & 0xff , LINUX_VERSION_CODE & 0xff ) ; <nl> + return ver ; <nl> + # elif defined ( TARGET_WINDOWS ) <nl> + return " version " XSTR_MACRO ( NTDDI_VERSION ) ; <nl> + # else <nl> + return " ( unknown platform ) " ; <nl> + # endif <nl> + } <nl> + <nl> + <nl> CJob * CSysInfo : : GetJob ( ) const <nl> { <nl> return new CSysInfoJob ( ) ; <nl> mmm a / xbmc / utils / SystemInfo . h <nl> ppp b / xbmc / utils / SystemInfo . h <nl> class CSysInfo : public CInfoLoader , public ISubSettings <nl> int GetTotalUptime ( ) const { return m_iSystemTimeTotalUp ; } <nl> void SetTotalUptime ( int uptime ) { m_iSystemTimeTotalUp = uptime ; } <nl> <nl> + static std : : string GetBuildTargetPlatformName ( void ) ; <nl> + static std : : string GetBuildTargetPlatformVersion ( void ) ; <nl> + <nl> protected : <nl> virtual CJob * GetJob ( ) const ; <nl> virtual CStdString TranslateInfo ( int info ) const ; <nl> | Merge pull request from Karlson2k / startup_log_02 | xbmc/xbmc | 1d7d4e2473be0ab332cf8911d10bf26cf4ee2e7f | 2013-08-06T06:31:52Z |
mmm a / bazel / envoy_test . bzl <nl> ppp b / bazel / envoy_test . bzl <nl> def envoy_cc_test_library ( <nl> copts = [ ] , <nl> alwayslink = 1 , <nl> * * kargs ) : <nl> - deps = deps + [ <nl> - repository + " / / test / test_common : printers_includes " , <nl> - ] <nl> - <nl> _envoy_cc_test_infrastructure_library ( <nl> name , <nl> srcs , <nl> mmm a / test / config / BUILD <nl> ppp b / test / config / BUILD <nl> envoy_cc_test_library ( <nl> " / / test / integration : server_stats_interface " , <nl> " / / test / test_common : environment_lib " , <nl> " / / test / test_common : network_utility_lib " , <nl> + " / / test / test_common : printers_lib " , <nl> " / / test / test_common : resources_lib " , <nl> " / / test / test_common : utility_lib " , <nl> " @ envoy_api / / envoy / config / bootstrap / v3 : pkg_cc_proto " , <nl> mmm a / test / extensions / filters / network / common / redis / BUILD <nl> ppp b / test / extensions / filters / network / common / redis / BUILD <nl> envoy_cc_mock ( <nl> " / / source / common / common : assert_lib " , <nl> " / / source / extensions / filters / network / common / redis : client_lib " , <nl> " / / source / extensions / filters / network / common / redis : codec_lib " , <nl> + " / / test / test_common : printers_lib " , <nl> ] , <nl> ) <nl> <nl> mmm a / test / extensions / filters / network / redis_proxy / BUILD <nl> ppp b / test / extensions / filters / network / redis_proxy / BUILD <nl> envoy_cc_mock ( <nl> " / / source / extensions / filters / network / redis_proxy : command_splitter_interface " , <nl> " / / source / extensions / filters / network / redis_proxy : conn_pool_interface " , <nl> " / / source / extensions / filters / network / redis_proxy : router_interface " , <nl> + " / / test / test_common : printers_lib " , <nl> ] , <nl> ) <nl> <nl> mmm a / test / mocks / buffer / BUILD <nl> ppp b / test / mocks / buffer / BUILD <nl> envoy_cc_mock ( <nl> deps = [ <nl> " / / source / common / buffer : buffer_lib " , <nl> " / / source / common / buffer : watermark_buffer_lib " , <nl> + " / / test / test_common : printers_lib " , <nl> " / / test / test_common : utility_lib " , <nl> ] , <nl> ) <nl> mmm a / test / test_common / BUILD <nl> ppp b / test / test_common / BUILD <nl> licenses ( [ " notice " ] ) # Apache 2 <nl> <nl> envoy_package ( ) <nl> <nl> - envoy_basic_cc_library ( <nl> - name = " printers_includes " , <nl> - hdrs = [ " printers . h " ] , <nl> - deps = [ <nl> - " : printers_lib " , <nl> - " / / include / envoy / network : address_interface " , <nl> - ] , <nl> - ) <nl> - <nl> envoy_cc_test_library ( <nl> name = " environment_lib " , <nl> srcs = [ " environment . cc " ] , <nl> envoy_cc_test_library ( <nl> <nl> envoy_cc_library ( <nl> name = " printers_lib " , <nl> - srcs = [ <nl> - " printers . cc " , <nl> - " printers . h " , <nl> - ] , <nl> + srcs = [ " printers . cc " ] , <nl> + hdrs = [ " printers . h " ] , <nl> deps = [ <nl> " / / include / envoy / network : address_interface " , <nl> " / / source / common / buffer : buffer_lib " , <nl> envoy_cc_test_library ( <nl> ] , <nl> deps = [ <nl> " : file_system_for_test_lib " , <nl> + " : printers_lib " , <nl> " : resources_lib " , <nl> " : test_time_lib " , <nl> " : thread_factory_for_test_lib " , <nl> | [ test ] Replace printers_include with printers_lib . ( ) | envoyproxy/envoy | 5e6c4b909f85c54138ea117071f24581f18bddaa | 2020-12-17T21:29:06Z |
mmm a / src / gui / jmanager . cpp <nl> ppp b / src / gui / jmanager . cpp <nl> <nl> # include < vector > <nl> # include < allegro . h > <nl> <nl> - # include " base / memory . h " <nl> # include " gui / jinete . h " <nl> # include " gui / jintern . h " <nl> <nl> static bool move_focus ( JWidget manager , JMessage msg ) <nl> { <nl> int ( * cmp ) ( JWidget , int , int ) = NULL ; <nl> Widget * focus = NULL ; <nl> - Widget * it , * * list ; <nl> + Widget * it ; <nl> bool ret = false ; <nl> Frame * window ; <nl> int c , count ; <nl> static bool move_focus ( JWidget manager , JMessage msg ) <nl> <nl> / * one at least * / <nl> if ( count > 0 ) { <nl> - / * list of widgets * / <nl> - list = ( JWidget * ) base_malloc ( sizeof ( JWidget ) * count ) ; <nl> - if ( ! list ) <nl> - return ret ; <nl> + std : : vector < Widget * > list ( count ) ; <nl> <nl> c = 0 ; <nl> <nl> static bool move_focus ( JWidget manager , JMessage msg ) <nl> break ; <nl> } <nl> <nl> - base_free ( list ) ; <nl> - <nl> if ( ( focus ) & & ( focus ! = focus_widget ) ) <nl> jmanager_set_focus ( focus ) ; <nl> } <nl> | Convert " list " collection in " move_focus " function to std : : vector . | aseprite/aseprite | 73d7c608a1c6499be50b78a1116684b0a3d22b4c | 2011-01-23T23:35:27Z |
mmm a / src / video_core / shader / decode / other . cpp <nl> ppp b / src / video_core / shader / decode / other . cpp <nl> u32 ShaderIR : : DecodeOther ( NodeBlock & bb , u32 pc ) { <nl> break ; <nl> } <nl> case OpCode : : Id : : DEPBAR : { <nl> - LOG_WARNING ( HW_GPU , " DEPBAR instruction is stubbed " ) ; <nl> + LOG_DEBUG ( HW_GPU , " DEPBAR instruction is stubbed " ) ; <nl> break ; <nl> } <nl> default : <nl> | shader / other : Reduce DEPBAR log severity | yuzu-emu/yuzu | 24f4198cee093470365d0318c0642c2e86eef85f | 2019-11-20T00:26:40Z |
mmm a / atom / browser / web_dialog_helper . cc <nl> ppp b / atom / browser / web_dialog_helper . cc <nl> file_dialog : : Filters GetFileTypesFromAcceptType ( <nl> / / Skip the first character . <nl> extensions . push_back ( extension . substr ( 1 ) ) ; <nl> } else { <nl> - if ( ascii_type = = " image / * " | | ascii_type = = " audio / * " | | <nl> - ascii_type = = " video / * " ) { <nl> - / / For MIME Type <nl> - net : : GetExtensionsForMimeType ( ascii_type , & extensions ) ; <nl> - } <nl> + / / For MIME Type , ` audio / * , vidio / * , image / * <nl> + net : : GetExtensionsForMimeType ( ascii_type , & extensions ) ; <nl> } <nl> } <nl> <nl> + / / If no valid exntesion is added , return empty filters . <nl> + if ( extensions . empty ( ) ) <nl> + return filters ; <nl> + <nl> filters . push_back ( file_dialog : : Filter ( ) ) ; <nl> for ( const auto & extension : extensions ) { <nl> # if defined ( OS_WIN ) <nl> | Fix a missing the specified mime type check in < input > accept attribute . | electron/electron | 617bff8ec85b4717316d0fe8e258868e4f9f6e05 | 2015-07-28T02:32:13Z |
mmm a / tensorflow / lite / micro / BUILD <nl> ppp b / tensorflow / lite / micro / BUILD <nl> cc_library ( <nl> " / / tensorflow / lite / core / api " , <nl> " / / tensorflow / lite / kernels : op_macros " , <nl> " / / tensorflow / lite / kernels / internal : compatibility " , <nl> - " / / tensorflow / lite / micro / kernels : fully_connected " , <nl> " / / tensorflow / lite / micro / kernels : micro_ops " , <nl> " / / tensorflow / lite / schema : schema_fbs " , <nl> ] , <nl> mmm a / tensorflow / lite / micro / benchmarks / BUILD <nl> ppp b / tensorflow / lite / micro / benchmarks / BUILD <nl> cc_binary ( <nl> " / / tensorflow / lite / micro : micro_error_reporter " , <nl> " / / tensorflow / lite / micro : micro_framework " , <nl> " / / tensorflow / lite / micro : op_resolvers " , <nl> - " / / tensorflow / lite / micro / kernels : fully_connected " , <nl> ] , <nl> ) <nl> <nl> mmm a / tensorflow / lite / micro / benchmarks / keyword_benchmark . cc <nl> ppp b / tensorflow / lite / micro / benchmarks / keyword_benchmark . cc <nl> limitations under the License . <nl> # include " tensorflow / lite / c / common . h " <nl> # include " tensorflow / lite / micro / benchmarks / keyword_scrambled_model_data . h " <nl> # include " tensorflow / lite / micro / benchmarks / micro_benchmark . h " <nl> - # include " tensorflow / lite / micro / kernels / fully_connected . h " <nl> # include " tensorflow / lite / micro / micro_error_reporter . h " <nl> # include " tensorflow / lite / micro / micro_interpreter . h " <nl> # include " tensorflow / lite / micro / micro_mutable_op_resolver . h " <nl> void CreateBenchmarkRunner ( ) { <nl> / / lifetime must exceed that of the KeywordBenchmarkRunner object . <nl> KeywordOpResolver * op_resolver = new ( op_resolver_buffer ) KeywordOpResolver ( ) ; <nl> op_resolver - > AddDequantize ( ) ; <nl> - op_resolver - > AddFullyConnected ( tflite : : Register_FULLY_CONNECTED_INT8 ( ) ) ; <nl> + op_resolver - > AddFullyConnected ( ) ; <nl> op_resolver - > AddQuantize ( ) ; <nl> op_resolver - > AddSoftmax ( ) ; <nl> op_resolver - > AddSvdf ( ) ; <nl> mmm a / tensorflow / lite / micro / kernels / BUILD <nl> ppp b / tensorflow / lite / micro / kernels / BUILD <nl> config_setting ( <nl> define_values = { " tflm_build " : " xtensa_hifimini_staging " } , <nl> ) <nl> <nl> - package_group ( <nl> - name = " micro " , <nl> - packages = [ " / / tensorflow / lite / micro / . . . " ] , <nl> - ) <nl> - <nl> package_group ( <nl> name = " micro_top_level " , <nl> packages = [ " / / tensorflow / lite / micro " ] , <nl> ) <nl> <nl> - cc_library ( <nl> - name = " fixedpoint_utils " , <nl> - hdrs = select ( { <nl> - " / / conditions : default " : [ <nl> - ] , <nl> - " : xtensa_hifimini " : [ <nl> - " xtensa_hifimini / fixedpoint_utils . h " , <nl> - ] , <nl> - " : xtensa_hifimini_staging " : [ <nl> - " xtensa_hifimini / fixedpoint_utils . h " , <nl> - ] , <nl> - } ) , <nl> - copts = micro_copts ( ) , <nl> - deps = select ( { <nl> - " / / conditions : default " : [ ] , <nl> - " : xtensa_hifimini " : [ <nl> - # " / / third_party / xtensa / cstub64s : hifi_mini " , <nl> - " / / tensorflow / lite / kernels / internal : compatibility " , <nl> - ] , <nl> - } ) , <nl> - ) <nl> - <nl> - cc_library ( <nl> - name = " fully_connected " , <nl> - srcs = select ( { <nl> - " / / conditions : default " : [ <nl> - " fully_connected . cc " , <nl> - ] , <nl> - " : xtensa_hifimini " : [ <nl> - " xtensa_hifimini / fully_connected . cc " , <nl> - ] , <nl> - " : xtensa_hifimini_staging " : [ <nl> - " xtensa_hifimini_staging / fully_connected . cc " , <nl> - ] , <nl> - } ) , <nl> - hdrs = [ " fully_connected . h " ] , <nl> - copts = micro_copts ( ) , <nl> - visibility = [ <nl> - # Kernel variants need to be visible to the examples and benchmarks . <nl> - " : micro " , <nl> - ] , <nl> - deps = [ <nl> - " : activation_utils " , <nl> - " : fixedpoint_utils " , <nl> - " : kernel_util " , <nl> - " : micro_utils " , <nl> - " / / tensorflow / lite / c : common " , <nl> - " / / tensorflow / lite / kernels : kernel_util " , <nl> - " / / tensorflow / lite / kernels : op_macros " , <nl> - " / / tensorflow / lite / kernels : padding " , <nl> - " / / tensorflow / lite / kernels / internal : common " , <nl> - " / / tensorflow / lite / kernels / internal : compatibility " , <nl> - " / / tensorflow / lite / kernels / internal : quantization_util " , <nl> - " / / tensorflow / lite / kernels / internal : reference_base " , <nl> - " / / tensorflow / lite / kernels / internal : tensor " , <nl> - " / / tensorflow / lite / kernels / internal : types " , <nl> - " / / tensorflow / lite / micro : memory_helpers " , <nl> - " / / tensorflow / lite / micro : micro_utils " , <nl> - ] + select ( { <nl> - " / / conditions : default " : [ ] , <nl> - " : xtensa_hifimini " : [ <nl> - # " / / third_party / xtensa / cstub64s : hifi_mini " , <nl> - ] , <nl> - } ) , <nl> - ) <nl> - <nl> cc_library ( <nl> name = " micro_ops " , <nl> srcs = [ <nl> cc_library ( <nl> " / / conditions : default " : [ <nl> " conv . cc " , <nl> " depthwise_conv . cc " , <nl> + " fully_connected . cc " , <nl> " quantize . cc " , <nl> " softmax . cc " , <nl> " svdf . cc " , <nl> cc_library ( <nl> " : xtensa_hifimini " : [ <nl> " xtensa_hifimini / conv . cc " , <nl> " xtensa_hifimini / depthwise_conv . cc " , <nl> + " xtensa_hifimini / fixedpoint_utils . h " , <nl> + " xtensa_hifimini / fully_connected . cc " , <nl> " xtensa_hifimini / quantize . cc " , <nl> " xtensa_hifimini / softmax . cc " , <nl> " xtensa_hifimini / svdf . cc " , <nl> cc_library ( <nl> # behavior that we get with the Makefiles . <nl> " conv . cc " , <nl> " depthwise_conv . cc " , <nl> + " xtensa_hifimini / fixedpoint_utils . h " , <nl> + " xtensa_hifimini_staging / fully_connected . cc " , <nl> " xtensa_hifimini_staging / quantize . cc " , <nl> " xtensa_hifimini_staging / softmax . cc " , <nl> " xtensa_hifimini_staging / svdf . cc " , <nl> cc_library ( <nl> deps = [ <nl> " : activation_utils " , <nl> " : kernel_util " , <nl> - " : fixedpoint_utils " , <nl> " : micro_utils " , <nl> " / / tensorflow / lite / c : common " , <nl> " / / tensorflow / lite / kernels : kernel_util " , <nl> tflite_micro_cc_test ( <nl> " fully_connected_test . cc " , <nl> ] , <nl> deps = [ <nl> - " : fully_connected " , <nl> " : kernel_runner " , <nl> " / / tensorflow / lite / c : common " , <nl> " / / tensorflow / lite / micro : micro_framework " , <nl> " / / tensorflow / lite / micro : micro_utils " , <nl> " / / tensorflow / lite / micro : op_resolvers " , <nl> " / / tensorflow / lite / micro : test_helpers " , <nl> + " / / tensorflow / lite / micro / kernels : micro_ops " , <nl> " / / tensorflow / lite / micro / testing : micro_test " , <nl> ] , <nl> ) <nl> mmm a / tensorflow / lite / micro / kernels / cmsis - nn / fully_connected . cc <nl> ppp b / tensorflow / lite / micro / kernels / cmsis - nn / fully_connected . cc <nl> limitations under the License . <nl> # include " tensorflow / lite / kernels / internal / reference / integer_ops / fully_connected . h " <nl> # include " tensorflow / lite / kernels / internal / tensor_ctypes . h " <nl> # include " tensorflow / lite / kernels / kernel_util . h " <nl> - # include " tensorflow / lite / micro / kernels / fully_connected . h " <nl> # include " tensorflow / lite / micro / kernels / kernel_util . h " <nl> <nl> namespace tflite { <nl> + namespace ops { <nl> + namespace micro { <nl> + namespace fully_connected { <nl> namespace { <nl> <nl> struct OpData { <nl> constexpr int kWeightsTensor = 1 ; <nl> constexpr int kBiasTensor = 2 ; <nl> constexpr int kOutputTensor = 0 ; <nl> <nl> - / / TODO ( b / 169801227 ) : This global struct is needed for the linker to drop unused <nl> - / / code ( for example , by using Register_FULLY_CONNECTED_INT8 instead of <nl> - / / Register_FULLY_CONNECTED ) . <nl> - TfLiteRegistration fully_connected_registration ; <nl> - <nl> TfLiteStatus CalculateOpData ( TfLiteContext * context , <nl> TfLiteFusedActivation activation , <nl> TfLiteType data_type , const TfLiteTensor * input , <nl> TfLiteStatus CalculateOpData ( TfLiteContext * context , <nl> return status ; <nl> } <nl> <nl> + } / / namespace <nl> + <nl> void * Init ( TfLiteContext * context , const char * buffer , size_t length ) { <nl> TFLITE_DCHECK ( context - > AllocatePersistentBuffer ! = nullptr ) ; <nl> return context - > AllocatePersistentBuffer ( context , sizeof ( OpData ) ) ; <nl> TfLiteStatus Eval ( TfLiteContext * context , TfLiteNode * node ) { <nl> return kTfLiteOk ; <nl> } <nl> <nl> - / / Note that the current function names are not ideal at all ( this EvalInt8 <nl> - / / function internally calls EvalQuantizedInt8 , and there is similar name <nl> - / / aliasing in the Eval function too ) . We will be attempting to have a more <nl> - / / descriptive naming convention but holding off on that for now , since the <nl> - / / renaming might be coupled with reducing code duplication and some additional <nl> - / / refactoring . <nl> - TfLiteStatus EvalInt8 ( TfLiteContext * context , TfLiteNode * node ) { <nl> - const TfLiteEvalTensor * input = <nl> - tflite : : micro : : GetEvalInput ( context , node , kInputTensor ) ; <nl> - const TfLiteEvalTensor * filter = <nl> - tflite : : micro : : GetEvalInput ( context , node , kWeightsTensor ) ; <nl> - const TfLiteEvalTensor * bias = <nl> - tflite : : micro : : GetEvalInput ( context , node , kBiasTensor ) ; <nl> - TfLiteEvalTensor * output = <nl> - tflite : : micro : : GetEvalOutput ( context , node , kOutputTensor ) ; <nl> - <nl> - TFLITE_DCHECK ( node - > user_data ! = nullptr ) ; <nl> - const OpData & data = * ( static_cast < const OpData * > ( node - > user_data ) ) ; <nl> - <nl> - / / Checks in Prepare ensure input , output and filter types are all the same . <nl> - if ( input - > type ! = kTfLiteInt8 ) { <nl> - TF_LITE_KERNEL_LOG ( context , " Type % s ( % d ) not supported . " , <nl> - TfLiteTypeGetName ( input - > type ) , input - > type ) ; <nl> - return kTfLiteError ; <nl> - } <nl> - <nl> - return EvalQuantizedInt8 ( context , node , data , input , filter , bias , output ) ; <nl> - } <nl> - <nl> - } / / namespace <nl> + } / / namespace fully_connected <nl> <nl> TfLiteRegistration Register_FULLY_CONNECTED ( ) { <nl> - fully_connected_registration . init = Init ; <nl> - fully_connected_registration . free = nullptr ; <nl> - fully_connected_registration . prepare = Prepare ; <nl> - fully_connected_registration . invoke = Eval ; <nl> - fully_connected_registration . profiling_string = nullptr ; <nl> - fully_connected_registration . builtin_code = 0 ; <nl> - fully_connected_registration . custom_name = nullptr ; <nl> - fully_connected_registration . version = 0 ; <nl> - return fully_connected_registration ; <nl> - } <nl> - <nl> - TfLiteRegistration Register_FULLY_CONNECTED_INT8 ( ) { <nl> - fully_connected_registration . init = Init ; <nl> - fully_connected_registration . free = nullptr ; <nl> - fully_connected_registration . prepare = Prepare ; <nl> - fully_connected_registration . invoke = EvalInt8 ; <nl> - fully_connected_registration . profiling_string = nullptr ; <nl> - fully_connected_registration . builtin_code = 0 ; <nl> - fully_connected_registration . custom_name = nullptr ; <nl> - fully_connected_registration . version = 0 ; <nl> - return fully_connected_registration ; <nl> + return { / * init = * / fully_connected : : Init , <nl> + / * free = * / nullptr , <nl> + / * prepare = * / fully_connected : : Prepare , <nl> + / * invoke = * / fully_connected : : Eval , <nl> + / * profiling_string = * / nullptr , <nl> + / * builtin_code = * / 0 , <nl> + / * custom_name = * / nullptr , <nl> + / * version = * / 0 } ; <nl> } <nl> <nl> + } / / namespace micro <nl> + } / / namespace ops <nl> } / / namespace tflite <nl> mmm a / tensorflow / lite / micro / kernels / fully_connected . cc <nl> ppp b / tensorflow / lite / micro / kernels / fully_connected . cc <nl> <nl> - / * Copyright 2020 The TensorFlow Authors . All Rights Reserved . <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> See the License for the specific language governing permissions and <nl> limitations under the License . <nl> = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = * / <nl> <nl> - # include " tensorflow / lite / micro / kernels / fully_connected . h " <nl> + # include " tensorflow / lite / kernels / internal / reference / fully_connected . h " <nl> <nl> # include " tensorflow / lite / c / builtin_op_data . h " <nl> # include " tensorflow / lite / c / common . h " <nl> # include " tensorflow / lite / kernels / internal / common . h " <nl> # include " tensorflow / lite / kernels / internal / quantization_util . h " <nl> - # include " tensorflow / lite / kernels / internal / reference / fully_connected . h " <nl> # include " tensorflow / lite / kernels / internal / reference / integer_ops / fully_connected . h " <nl> # include " tensorflow / lite / kernels / internal / tensor_ctypes . h " <nl> # include " tensorflow / lite / kernels / kernel_util . h " <nl> # include " tensorflow / lite / micro / kernels / kernel_util . h " <nl> <nl> namespace tflite { <nl> + namespace ops { <nl> + namespace micro { <nl> + namespace fully_connected { <nl> namespace { <nl> <nl> struct OpData { <nl> TfLiteStatus CalculateOpData ( TfLiteContext * context , <nl> return status ; <nl> } <nl> <nl> + } / / namespace <nl> + <nl> void * Init ( TfLiteContext * context , const char * buffer , size_t length ) { <nl> TFLITE_DCHECK ( context - > AllocatePersistentBuffer ! = nullptr ) ; <nl> return context - > AllocatePersistentBuffer ( context , sizeof ( OpData ) ) ; <nl> TfLiteStatus Eval ( TfLiteContext * context , TfLiteNode * node ) { <nl> return kTfLiteOk ; <nl> } <nl> <nl> - } / / namespace <nl> + } / / namespace fully_connected <nl> <nl> TfLiteRegistration Register_FULLY_CONNECTED ( ) { <nl> - return { / * init = * / Init , <nl> + return { / * init = * / fully_connected : : Init , <nl> / * free = * / nullptr , <nl> - / * prepare = * / Prepare , <nl> - / * invoke = * / Eval , <nl> + / * prepare = * / fully_connected : : Prepare , <nl> + / * invoke = * / fully_connected : : Eval , <nl> / * profiling_string = * / nullptr , <nl> / * builtin_code = * / 0 , <nl> / * custom_name = * / nullptr , <nl> / * version = * / 0 } ; <nl> } <nl> <nl> + } / / namespace micro <nl> + } / / namespace ops <nl> } / / namespace tflite <nl> deleted file mode 100644 <nl> index 3e6467183fe71 . . 0000000000000 <nl> mmm a / tensorflow / lite / micro / kernels / fully_connected . h <nl> ppp / dev / null <nl> <nl> - / * Copyright 2020 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> - # ifndef TENSORFLOW_LITE_MICRO_KERNELS_FULLY_CONNECTED_H_ <nl> - # define TENSORFLOW_LITE_MICRO_KERNELS_FULLY_CONNECTED_H_ <nl> - <nl> - # include " tensorflow / lite / c / common . h " <nl> - <nl> - namespace tflite { <nl> - <nl> - / / This is the most generic TfLiteRegistration . The actual supported types may <nl> - / / still be target dependent . The only requirement is that every implementation <nl> - / / ( reference or optimized ) must define this function . <nl> - TfLiteRegistration Register_FULLY_CONNECTED ( ) ; <nl> - <nl> - # if defined ( CMSIS_NN ) | | defined ( ARDUINO ) <nl> - / / The Arduino is a special case where we use the CMSIS kernels , but because of <nl> - / / the current approach to building for Arduino , we do not support - DCMSIS_NN as <nl> - / / part of the build . As a result , we use defined ( ARDUINO ) as proxy for the <nl> - / / CMSIS kernels for this one special case . <nl> - <nl> - / / Returns a TfLiteRegistration struct for cmsis - nn kernel variant that only <nl> - / / supports int8 . <nl> - TfLiteRegistration Register_FULLY_CONNECTED_INT8 ( ) ; <nl> - <nl> - # else <nl> - / / Note that while this block gets used for both reference and optimized kernels <nl> - / / that do not have any specialized implementations , the only goal here is to <nl> - / / define fallback implementation that allow reference kernels to still be used <nl> - / / from applications that call a more specific kernel variant . <nl> - <nl> - inline TfLiteRegistration Register_FULLY_CONNECTED_INT8 ( ) { <nl> - return Register_FULLY_CONNECTED ( ) ; <nl> - } <nl> - <nl> - # endif <nl> - } / / namespace tflite <nl> - <nl> - # endif / / TENSORFLOW_LITE_MICRO_KERNELS_FULLY_CONNECTED_H_ <nl> mmm a / tensorflow / lite / micro / kernels / fully_connected_test . cc <nl> ppp b / tensorflow / lite / micro / kernels / fully_connected_test . cc <nl> limitations under the License . <nl> # include " tensorflow / lite / c / common . h " <nl> # include " tensorflow / lite / micro / all_ops_resolver . h " <nl> # include " tensorflow / lite / micro / kernels / kernel_runner . h " <nl> + # include " tensorflow / lite / micro / kernels / micro_ops . h " <nl> # include " tensorflow / lite / micro / micro_utils . h " <nl> # include " tensorflow / lite / micro / test_helpers . h " <nl> # include " tensorflow / lite / micro / testing / micro_test . h " <nl> TfLiteStatus ValidateFullyConnectedGoldens ( <nl> int outputs_array_data [ ] = { 1 , 3 } ; <nl> TfLiteIntArray * outputs_array = IntArrayFromInts ( outputs_array_data ) ; <nl> <nl> - const TfLiteRegistration registration = Register_FULLY_CONNECTED ( ) ; <nl> + const TfLiteRegistration registration = <nl> + ops : : micro : : Register_FULLY_CONNECTED ( ) ; <nl> micro : : KernelRunner runner ( <nl> registration , tensors , tensors_size , inputs_array , outputs_array , <nl> reinterpret_cast < void * > ( & builtin_data ) , micro_test : : reporter ) ; <nl> mmm a / tensorflow / lite / micro / kernels / micro_ops . h <nl> ppp b / tensorflow / lite / micro / kernels / micro_ops . h <nl> TfLiteRegistration Register_DEPTHWISE_CONV_2D ( ) ; <nl> TfLiteRegistration Register_DEQUANTIZE ( ) ; <nl> TfLiteRegistration Register_EQUAL ( ) ; <nl> TfLiteRegistration Register_FLOOR ( ) ; <nl> + TfLiteRegistration Register_FULLY_CONNECTED ( ) ; <nl> TfLiteRegistration Register_GREATER ( ) ; <nl> TfLiteRegistration Register_GREATER_EQUAL ( ) ; <nl> TfLiteRegistration Register_HARD_SWISH ( ) ; <nl> mmm a / tensorflow / lite / micro / micro_mutable_op_resolver . h <nl> ppp b / tensorflow / lite / micro / micro_mutable_op_resolver . h <nl> limitations under the License . <nl> # include " tensorflow / lite / kernels / internal / compatibility . h " <nl> # include " tensorflow / lite / kernels / op_macros . h " <nl> # include " tensorflow / lite / micro / compatibility . h " <nl> - # include " tensorflow / lite / micro / kernels / fully_connected . h " <nl> # include " tensorflow / lite / micro / kernels / micro_ops . h " <nl> # include " tensorflow / lite / micro / micro_op_resolver . h " <nl> # include " tensorflow / lite / schema / schema_generated . h " <nl> class MicroMutableOpResolver : public MicroOpResolver { <nl> tflite : : ops : : micro : : Register_FLOOR ( ) , ParseFloor ) ; <nl> } <nl> <nl> - TfLiteStatus AddFullyConnected ( <nl> - const TfLiteRegistration & registration = Register_FULLY_CONNECTED ( ) ) { <nl> - return AddBuiltin ( BuiltinOperator_FULLY_CONNECTED , registration , <nl> + TfLiteStatus AddFullyConnected ( ) { <nl> + return AddBuiltin ( BuiltinOperator_FULLY_CONNECTED , <nl> + tflite : : ops : : micro : : Register_FULLY_CONNECTED ( ) , <nl> ParseFullyConnected ) ; <nl> } <nl> <nl> class MicroMutableOpResolver : public MicroOpResolver { <nl> unsigned int num_buitin_ops_ = 0 ; <nl> <nl> ErrorReporter * error_reporter_ ; <nl> + <nl> } ; <nl> <nl> } ; / / namespace tflite <nl> | Internal change | tensorflow/tensorflow | c95c69473f32e89b8d4b75f822f459afb97d0860 | 2020-10-06T02:49:54Z |
mmm a / docs / ase - file - specs . md <nl> ppp b / docs / ase - file - specs . md <nl> Color profile for RGB or grayscale values . <nl> 1 - use special fixed gamma <nl> FIXED Fixed gamma ( 1 . 0 = linear ) <nl> Note : The gamma in sRGB is 2 . 2 in overall but it doesn ' t use <nl> - a this fixed gamma , because sRGB uses different gamma sections <nl> + this fixed gamma , because sRGB uses different gamma sections <nl> ( linear and non - linear ) . If sRGB is specified with a fixed <nl> gamma = 1 . 0 , it means that this is Linear sRGB . <nl> BYTE [ 8 ] Reserved ( set to zero ] <nl> Color profile for RGB or grayscale values . <nl> <nl> # # # Path Chunk ( 0x2017 ) <nl> <nl> - Never used . <nl> + Never used . <nl> <nl> # # # Frame Tags Chunk ( 0x2018 ) <nl> <nl> | Minor fixes in aseprite file format specs | aseprite/aseprite | c5b952173f53c09af67e20233725ef2ed7e999ab | 2019-03-29T19:13:16Z |
mmm a / api / envoy / config / metrics / v2 / stats . proto <nl> ppp b / api / envoy / config / metrics / v2 / stats . proto <nl> message StatsdSink { <nl> / / Envoy will connect to this cluster to flush statistics . <nl> string tcp_cluster_name = 2 ; <nl> } <nl> - / / [ # not - implemented - hide : ] Optional custom prefix for StatsdSink . If <nl> + / / Optional custom prefix for StatsdSink . If <nl> / / specified , this will override the default prefix . <nl> / / For example : <nl> / / <nl> mmm a / docs / root / intro / version_history . rst <nl> ppp b / docs / root / intro / version_history . rst <nl> Version history <nl> * sockets : added ` SO_KEEPALIVE ` socket option for upstream connections <nl> : ref : ` per cluster < envoy_api_field_Cluster . upstream_connection_options > ` . <nl> * stats : added support for histograms . <nl> + * stats : added : ref : ` option to configure the statsd prefix < envoy_api_field_config . metrics . v2 . StatsdSink . prefix > ` <nl> * tls : removed support for legacy SHA - 2 CBC cipher suites . <nl> * tracing : the sampling decision is now delegated to the tracers , allowing the tracer to decide when and if <nl> to use it . For example , if the : ref : ` x - b3 - sampled < config_http_conn_man_headers_x - b3 - sampled > ` header <nl> | docs : remove not - implemented - hide for statsd sink prefix ( ) | envoyproxy/envoy | 45d3e3f64074338fb8ac4e2e41226180b9c245b9 | 2018-05-11T20:02:16Z |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.