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 / library_gl . js <nl> ppp b / src / library_gl . js <nl> var LibraryGL = { <nl> GL . validateGLObjectID ( GL . programs , program , ' populateUniformTable ' , ' program ' ) ; <nl> # endif <nl> var p = GL . programs [ program ] ; <nl> - GL . programInfos [ program ] = { <nl> + var ptable = GL . programInfos [ program ] = { <nl> uniforms : { } , <nl> maxUniformLength : 0 , / / This is eagerly computed below , since we already enumerate all uniforms anyway . <nl> maxAttributeLength : - 1 , / / This is lazily computed and cached , computed when / if first asked , " - 1 " meaning not computed yet . <nl> maxUniformBlockNameLength : - 1 / / Lazily computed as well <nl> } ; <nl> <nl> - var ptable = GL . programInfos [ program ] ; <nl> var utable = ptable . uniforms ; <nl> / / A program ' s uniform table maps the string name of an uniform to an integer location of that uniform . <nl> / / The global GL . uniforms map maps integer locations to WebGLUniformLocations . <nl> var LibraryGL = { <nl> var log = ( GLctx . getProgramInfoLog ( GL . programs [ program ] ) | | ' ' ) . trim ( ) ; <nl> if ( log ) console . error ( ' glLinkProgram : ' + log ) ; <nl> # endif <nl> - GL . programInfos [ program ] = null ; / / uniforms no longer keep the same names after linking <nl> GL . populateUniformTable ( program ) ; <nl> } , <nl> <nl>
Micro - optimize WebGL glLinkProgram : Closure is for some reason unable to collapse redundant assignments . Saves - 16 bytes ( - 0 . 31 % ) in minimal WebGL demo .
emscripten-core/emscripten
810e7e7ce29024003bb15e7aebf01c0830551426
2019-02-07T17:56:28Z
new file mode 100644 <nl> index 00000000000 . . d145d9236c7 <nl> mmm / dev / null <nl> ppp b / hphp / hack / src / decl / decl_ancestors . ml <nl> <nl> + ( * * <nl> + * Copyright ( c ) 2018 , Facebook , Inc . <nl> + * All rights reserved . <nl> + * <nl> + * This source code is licensed under the MIT license found in the <nl> + * LICENSE file in the " hack " directory of this source tree . <nl> + * <nl> + * ) <nl> + <nl> + open Core_kernel <nl> + open Decl_defs <nl> + open Shallow_decl_defs <nl> + open Typing_defs <nl> + <nl> + module LSTable = Lazy_string_table <nl> + module Reason = Typing_reason <nl> + module SN = Naming_special_names <nl> + <nl> + let all_ancestors class_name = <nl> + Decl_linearize . ( get_linearization ~ kind : Ancestor_types ) class_name <nl> + ( * Drop the requested class ; we only want its ancestors . * ) <nl> + | > ( fun lin - > Sequence . drop_eagerly lin 1 ) <nl> + | > Sequence . map ~ f : begin fun mro - > <nl> + let { mro_name ; mro_type_args ; _ } = mro in <nl> + let pos = <nl> + match Shallow_classes_heap . get mro_name with <nl> + | None - > Pos . none <nl> + | Some c - > fst c . sc_name <nl> + in <nl> + let ty = Reason . Rhint pos , Tapply ( ( pos , mro_name ) , mro_type_args ) in <nl> + mro_name , ty <nl> + end <nl> + <nl> + let is_canonical _ = true <nl> + let merge ~ earlier ~ later : _ = earlier <nl> + <nl> + let ancestors_cache class_name = <nl> + LSTable . make ( all_ancestors class_name ) ~ is_canonical ~ merge <nl> mmm a / hphp / hack / src / decl / decl_linearize . ml <nl> ppp b / hphp / hack / src / decl / decl_linearize . ml <nl> open Typing_defs <nl> <nl> ( * Module calculating the Member Resolution Order of a class * ) <nl> <nl> - type env = { class_stack : SSet . t ; decl_env : Decl_env . env } <nl> + type linearization_kind = <nl> + | Member_resolution <nl> + | Ancestor_types <nl> + [ @ @ deriving show ] <nl> + <nl> + type env = { <nl> + class_stack : SSet . t ; <nl> + decl_env : Decl_env . env ; <nl> + linearization_kind : linearization_kind ; <nl> + } <nl> <nl> ( * * These state variants drive the Sequence generating the linearization . * ) <nl> type state = <nl> type state = <nl> ( with the appropriate source and type parameters substituted ) unless it <nl> was already emitted earlier in the current linearization sequence . * ) <nl> <nl> - module Cache = SharedMem . WithCache ( SharedMem . ProfiledImmediate ) ( StringKey ) ( struct <nl> + module CacheKey = struct <nl> + type t = string * linearization_kind [ @ @ deriving show ] <nl> + let compare = compare <nl> + let to_string = show <nl> + end <nl> + <nl> + module CacheKeySet = Reordered_argument_set ( Caml . Set . Make ( CacheKey ) ) <nl> + <nl> + module Cache = SharedMem . WithCache ( SharedMem . ProfiledImmediate ) ( CacheKey ) ( struct <nl> type t = mro_element list <nl> let prefix = Prefix . make ( ) <nl> let description = " Linearization " <nl> end ) <nl> <nl> let push_local_changes = Cache . LocalChanges . push_stack <nl> let pop_local_changes = Cache . LocalChanges . pop_stack <nl> - let remove_batch = Cache . remove_batch <nl> <nl> - module LocalCache = SharedMem . LocalCache ( StringKey ) ( struct <nl> + let remove_batch classes = <nl> + let keys = <nl> + SSet . fold classes ~ init : CacheKeySet . empty ~ f : begin fun class_name acc - > <nl> + let acc = CacheKeySet . add acc ( class_name , Member_resolution ) in <nl> + let acc = CacheKeySet . add acc ( class_name , Ancestor_types ) in <nl> + acc <nl> + end <nl> + in <nl> + Cache . remove_batch keys <nl> + <nl> + module LocalCache = SharedMem . LocalCache ( CacheKey ) ( struct <nl> type t = linearization <nl> let prefix = Prefix . make ( ) <nl> let description = " LazyLinearization " <nl> and linearize ( env : env ) ( c : shallow_class ) : linearization = <nl> mro_copy_private_members = c . sc_kind = Ast . Ctrait ; <nl> } in <nl> let get_ancestors kind = List . map ~ f : ( ancestor_from_ty kind ) in <nl> - let interfaces = get_ancestors Interface c . sc_implements in <nl> - let req_implements = get_ancestors ReqImpl c . sc_req_implements in <nl> - let xhp_attr_uses = get_ancestors XHPAttr c . sc_xhp_attr_uses in <nl> - let traits = get_ancestors Trait c . sc_uses in <nl> - let req_extends = get_ancestors ReqExtends c . sc_req_extends in <nl> - let parents = get_ancestors Parent ( from_parent c ) in <nl> + let interfaces c = get_ancestors Interface c . sc_implements in <nl> + let req_implements c = get_ancestors ReqImpl c . sc_req_implements in <nl> + let xhp_attr_uses c = get_ancestors XHPAttr c . sc_xhp_attr_uses in <nl> + let traits c = get_ancestors Trait c . sc_uses in <nl> + let req_extends c = get_ancestors ReqExtends c . sc_req_extends in <nl> + let parents c = get_ancestors Parent ( from_parent c ) in <nl> + let extends c = get_ancestors Parent c . sc_extends in <nl> + ( * HHVM implicitly adds the Stringish interface to every class , interface , and <nl> + trait with a __toString method . The primitive type ` string ` is considered <nl> + to also implement this interface . * ) <nl> + let stringish_interface c = <nl> + let module SN = Naming_special_names in <nl> + if mro_name = SN . Classes . cStringish then [ ] else <nl> + let is_to_string m = snd m . sm_name = SN . Members . __toString in <nl> + match List . find c . sc_methods is_to_string with <nl> + | None - > [ ] <nl> + | Some { sm_type = { ft_pos = pos ; _ } ; _ } - > <nl> + let ty = <nl> + Typing_reason . Rhint pos , Tapply ( ( pos , SN . Classes . cStringish ) , [ ] ) in <nl> + [ ancestor_from_ty Interface ty ] <nl> + in <nl> let ancestors = <nl> - List . concat [ <nl> - List . rev interfaces ; <nl> - List . rev req_implements ; <nl> - List . rev xhp_attr_uses ; <nl> - List . rev traits ; <nl> - List . rev req_extends ; <nl> - parents ; <nl> - ] <nl> + match env . linearization_kind with <nl> + | Member_resolution - > <nl> + List . concat [ <nl> + List . rev ( interfaces c ) ; <nl> + List . rev ( req_implements c ) ; <nl> + List . rev ( xhp_attr_uses c ) ; <nl> + List . rev ( traits c ) ; <nl> + List . rev ( req_extends c ) ; <nl> + parents c ; <nl> + ] <nl> + | Ancestor_types - > <nl> + ( * In order to match the historical handling of ancestor types ( used in <nl> + use cases like subtyping and override checking ) , we need to build the <nl> + linearization in the order [ extends ; implements ; uses ] . Require - extends <nl> + and require - implements relationships need to be included only to <nl> + support Stringish ( and can be removed here if we remove support for the <nl> + magic Stringish type , or require it to be explicitly implemented ) . * ) <nl> + List . concat [ <nl> + extends c ; <nl> + req_extends c ; <nl> + req_implements c ; <nl> + stringish_interface c ; <nl> + interfaces c ; <nl> + traits c ; <nl> + ] <nl> in <nl> Sequence . unfold_step <nl> ~ init : ( Child child , ancestors , [ ] , [ ] ) <nl> and next_state ( env : env ) ( class_name : string ) ( state , ancestors , acc , synths ) <nl> | exception Lazy . Undefined - > Skip ( Next_ancestor , ancestors , acc , synths ) <nl> | Some ( next , rest ) - > <nl> let should_skip , synths = <nl> - if next . mro_synthesized <nl> - then true , next : : synths <nl> - else List . mem acc next ~ equal : ( = ) , synths <nl> + match env . linearization_kind with <nl> + | Member_resolution - > <nl> + if next . mro_synthesized <nl> + then true , next : : synths <nl> + else List . mem acc next ~ equal : ( = ) , synths <nl> + | Ancestor_types - > <nl> + ( * For ancestor types , we don ' t care about require - extends or <nl> + require - implements relationships , except for the fact that we want <nl> + Stringish as an ancestor if we have some ancestor which requires <nl> + it . * ) <nl> + let should_skip = <nl> + next . mro_synthesized & & next . mro_name < > SN . Classes . cStringish <nl> + in <nl> + let equal a b = a . mro_name = b . mro_name in <nl> + should_skip | | List . mem acc next ~ equal , synths <nl> in <nl> if should_skip <nl> then Skip ( Ancestor rest , ancestors , acc , synths ) <nl> and next_state ( env : env ) ( class_name : string ) ( state , ancestors , acc , synths ) <nl> then Skip ( Synthesized_elts synths , ancestors , next : : acc , synths ) <nl> else Yield ( next , ( Synthesized_elts synths , ancestors , next : : acc , synths ) ) <nl> | Synthesized_elts [ ] , _ - > <nl> - Cache . add class_name ( List . rev acc ) ; <nl> + let key = class_name , env . linearization_kind in <nl> + Cache . add key ( List . rev acc ) ; <nl> Done <nl> <nl> and get_linearization ( env : env ) ( class_name : string ) : linearization = <nl> - let { class_stack ; _ } = env in <nl> + let { class_stack ; linearization_kind ; _ } = env in <nl> if SSet . mem class_stack class_name then Sequence . empty else <nl> let class_stack = SSet . add class_stack class_name in <nl> let env = { env with class_stack } in <nl> - match Cache . get class_name with <nl> + let key = class_name , linearization_kind in <nl> + match Cache . get key with <nl> | Some lin - > Sequence . of_list lin <nl> | None - > <nl> - match LocalCache . get class_name with <nl> + match LocalCache . get key with <nl> | Some lin - > lin <nl> | None - > <nl> match Shallow_classes_heap . get class_name with <nl> | None - > Sequence . empty <nl> | Some c - > <nl> let lin = linearize env c in <nl> - LocalCache . add class_name lin ; <nl> + LocalCache . add key lin ; <nl> lin <nl> <nl> - let get_linearization class_name = <nl> + let get_linearization ? ( kind = Member_resolution ) class_name = <nl> let decl_env = { Decl_env . <nl> mode = FileInfo . Mstrict ; <nl> droot = Some ( Typing_deps . Dep . Class class_name ) ; <nl> decl_tcopt = GlobalNamingOptions . get ( ) ; <nl> } in <nl> - get_linearization { class_stack = SSet . empty ; decl_env } class_name <nl> + let env = { <nl> + class_stack = SSet . empty ; <nl> + decl_env ; <nl> + linearization_kind = kind ; <nl> + } in <nl> + get_linearization env class_name <nl> mmm a / hphp / hack / src / decl / decl_linearize . mli <nl> ppp b / hphp / hack / src / decl / decl_linearize . mli <nl> <nl> <nl> open Decl_defs <nl> <nl> - val get_linearization : string - > linearization <nl> + type linearization_kind = <nl> + | Member_resolution <nl> + | Ancestor_types <nl> + [ @ @ deriving show ] <nl> + <nl> + val get_linearization : ? kind : linearization_kind - > string - > linearization <nl> <nl> val push_local_changes : unit - > unit <nl> val pop_local_changes : unit - > unit <nl> mmm a / hphp / hack / src / typing / typing_classes_heap . ml <nl> ppp b / hphp / hack / src / typing / typing_classes_heap . ml <nl> open Typing_defs <nl> open Shallow_decl_defs <nl> <nl> module Attrs = Attributes <nl> + module LSTable = Lazy_string_table <nl> module SN = Naming_special_names <nl> <nl> type lazy_class_type = { <nl> sc : shallow_class ; <nl> c : class_type ; <nl> + ancestors : decl ty LSTable . t ; <nl> } <nl> <nl> type class_type_variant = <nl> type class_type_variant = <nl> <nl> type t = class_type_variant <nl> <nl> - let make_lazy_class_type _class_name sc c = <nl> + let make_lazy_class_type class_name sc c = <nl> { <nl> sc ; <nl> c ; <nl> + ancestors = Decl_ancestors . ancestors_cache class_name ; <nl> } <nl> <nl> let shallow_decl_enabled ( ) = <nl> let decl_errors t = <nl> | Lazy lc - > lc . c . tc_decl_errors <nl> | Eager c - > c . tc_decl_errors <nl> <nl> + let sort_by_key seq = <nl> + seq <nl> + | > Sequence . to_list_rev <nl> + | > List . sort ~ compare : ( fun ( a , _ ) ( b , _ ) - > String . compare a b ) <nl> + | > Sequence . of_list <nl> + <nl> let get_ancestor t ancestor = <nl> match t with <nl> - | Lazy lc - > SMap . get ancestor lc . c . tc_ancestors <nl> + | Lazy lc - > LSTable . get lc . ancestors ancestor <nl> | Eager c - > SMap . get ancestor c . tc_ancestors <nl> <nl> let has_ancestor t ancestor = <nl> match t with <nl> - | Lazy lc - > SMap . mem ancestor lc . c . tc_ancestors <nl> + | Lazy lc - > LSTable . mem lc . ancestors ancestor <nl> | Eager c - > SMap . mem ancestor c . tc_ancestors <nl> <nl> let requires_ancestor t ancestor = <nl> let extends t ancestor = <nl> | Eager c - > SSet . mem ancestor c . tc_extends <nl> <nl> let all_ancestors t = <nl> - Sequence . of_list @ @ <nl> match t with <nl> - | Lazy lc - > SMap . bindings lc . c . tc_ancestors <nl> - | Eager c - > SMap . bindings c . tc_ancestors <nl> + | Lazy lc - > LSTable . to_seq lc . ancestors | > sort_by_key <nl> + | Eager c - > SMap . bindings c . tc_ancestors | > Sequence . of_list <nl> <nl> let all_ancestor_names t = <nl> - Sequence . of_list @ @ <nl> match t with <nl> - | Lazy lc - > SMap . ordered_keys lc . c . tc_ancestors <nl> - | Eager c - > SMap . ordered_keys c . tc_ancestors <nl> + | Lazy _ - > Sequence . map ( all_ancestors t ) fst <nl> + | Eager c - > SMap . ordered_keys c . tc_ancestors | > Sequence . of_list <nl> <nl> let all_ancestor_reqs t = <nl> match t with <nl> mmm a / hphp / hack / test / typecheck / xhp_attr_13 . php <nl> ppp b / hphp / hack / test / typecheck / xhp_attr_13 . php <nl> function takes_string ( string $ s ) { } <nl> class Foo extends Enum < int > { } <nl> <nl> class : xhp { } <nl> + <nl> + class Enum < T > { } <nl>
Look up class ancestors lazily using the linearization
facebook/hhvm
90a21f316034f4d367a1901c593c91f4ae0a148d
2019-04-17T19:32:37Z
mmm a / src / dbg / debugger . cpp <nl> ppp b / src / dbg / debugger . cpp <nl> static bool bFreezeStack = false ; <nl> static std : : vector < ExceptionRange > ignoredExceptionRange ; <nl> static HANDLE hEvent = 0 ; <nl> static duint tidToResume = 0 ; <nl> - static HANDLE hProcess = 0 ; <nl> static HANDLE hMemMapThread = 0 ; <nl> static bool bStopMemMapThread = false ; <nl> static HANDLE hTimeWastedCounterThread = 0 ; <nl> static void cbAttachDebugger ( ) <nl> cmddirectexec ( StringUtils : : sprintf ( " resumethread % p " , tidToResume ) . c_str ( ) ) ; <nl> tidToResume = 0 ; <nl> } <nl> - hProcess = fdProcessInfo - > hProcess ; <nl> varset ( " $ hp " , ( duint ) fdProcessInfo - > hProcess , true ) ; <nl> varset ( " $ pid " , fdProcessInfo - > dwProcessId , true ) ; <nl> } <nl> static void debugLoopFunction ( void * lpParameter , bool attach ) <nl> } <nl> else <nl> { <nl> - hProcess = fdProcessInfo - > hProcess ; <nl> DebugLoop ( ) ; <nl> } <nl> <nl> static void debugLoopFunction ( void * lpParameter , bool attach ) <nl> plugincbcall ( CB_STOPDEBUG , & stopInfo ) ; <nl> <nl> / / cleanup dbghelp <nl> - SafeSymCleanup ( hProcess ) ; <nl> + if ( fdProcessInfo - > hProcess ! = nullptr ) <nl> + SafeSymCleanup ( fdProcessInfo - > hProcess ) ; <nl> <nl> / / message the user / do final stuff <nl> RemoveAllBreakPoints ( UE_OPTION_REMOVEALL ) ; / / remove all breakpoints <nl>
Remove static global handle ' hProcess ' in debugger . cpp ; it is only used in one place as argument to SafeSymCleanup ( ) . Use fdProcessInfo - > hProcess instead
x64dbg/x64dbg
c8e8b692f0f60c1c57615cb48fc3c7d08a14ef83
2017-11-28T16:29:50Z
mmm a / bootstrap <nl> ppp b / bootstrap <nl> <nl> set - e <nl> <nl> autoreconf - vif <nl> + autoreconf - vif lib / libid3tag / libid3tag <nl> + audoreconf - vif xbmc / screensavers / rsxs - 0 . 9 <nl> + autoreconf - vif lib / libapetag <nl> autoreconf - vif lib / cpluff <nl> # order matters with libdvd and friends <nl> [ - d lib / libdvd / libdvdcss ] & & \ <nl>
[ grr ] time to add some more items to bootstrap , seeing auto - configures during make
xbmc/xbmc
f7619ffcd5742aa91f04bde3fbd10c1bc05fa442
2011-05-14T18:27:16Z
mmm a / tests / gl_in_pthread . cpp <nl> ppp b / tests / gl_in_pthread . cpp <nl> EMSCRIPTEN_WEBGL_CONTEXT_HANDLE ctx ; <nl> int threadRunning = 0 ; <nl> int numThreadsCreated = 0 ; <nl> <nl> + int result = 0 ; <nl> + <nl> void * ThreadMain ( void * arg ) <nl> { <nl> switch ( numThreadsCreated ) <nl> void CreateThread ( ) <nl> { <nl> printf ( " Test Skipped ! OffscreenCanvas is not supported ! \ n " ) ; <nl> # ifdef REPORT_RESULT <nl> - int result = 1 ; / / But report success , so that runs on non - supporting browsers don ' t raise noisy errors . <nl> + result = 1 ; / / But report success , so that runs on non - supporting browsers don ' t raise noisy errors . <nl> REPORT_RESULT ( ) ; <nl> # endif <nl> exit ( 0 ) ; <nl> void CreateThread ( ) <nl> + + numThreadsCreated ; <nl> } <nl> <nl> - int result = 0 ; <nl> - <nl> - void PollTestExit ( void * ) <nl> - { <nl> - emscripten_async_call ( PollTestExit , 0 , 1000 ) ; <nl> - } <nl> - <nl> void PollThreadExit ( void * ) <nl> { <nl> if ( ! emscripten_atomic_load_u32 ( & threadRunning ) ) <nl> void PollThreadExit ( void * ) <nl> if ( numThreadsCreated > = 3 ) <nl> { <nl> emscripten_atomic_store_u32 ( & result , 1 ) ; <nl> + # ifdef REPORT_RESULT <nl> + REPORT_RESULT ( ) ; <nl> + # endif <nl> return ; <nl> } <nl> else <nl> void * mymain ( void * ) <nl> EM_ASM ( Module [ ' noExitRuntime ' ] = true ; ) ; <nl> CreateThread ( ) ; <nl> emscripten_async_call ( PollThreadExit , 0 , 1000 ) ; <nl> - emscripten_async_call ( PollTestExit , 0 , 1000 ) ; <nl> return 0 ; <nl> } <nl> <nl> int main ( ) <nl> { <nl> printf ( " Test Skipped ! OffscreenCanvas is not supported ! \ n " ) ; <nl> # ifdef REPORT_RESULT <nl> - int result = 1 ; / / But report success , so that runs on non - supporting browsers don ' t raise noisy errors . <nl> + result = 1 ; / / But report success , so that runs on non - supporting browsers don ' t raise noisy errors . <nl> REPORT_RESULT ( ) ; <nl> # endif <nl> exit ( 0 ) ; <nl>
Fix browser . test_webgl_offscreen_canvas_in_pthread exit condition when OffscreenCanvas is supported .
emscripten-core/emscripten
97160738f96e2ea4162abd6cc4d015f342d023e8
2016-09-13T19:21:40Z
mmm a / Kodi . xcodeproj / project . pbxproj <nl> ppp b / Kodi . xcodeproj / project . pbxproj <nl> <nl> 68D9167B1DD0430E00058B06 / * GUIDialogNewJoystick . cpp in Sources * / = { isa = PBXBuildFile ; fileRef = 68D916781DD0430E00058B06 / * GUIDialogNewJoystick . cpp * / ; } ; <nl> 68D77CFF1CD1C5E4004C1735 / * GameSettings . cpp in Sources * / = { isa = PBXBuildFile ; fileRef = 68D77CFD1CD1C5E4004C1735 / * GameSettings . cpp * / ; } ; <nl> 68D77D001CD1C5E4004C1735 / * GameSettings . cpp in Sources * / = { isa = PBXBuildFile ; fileRef = 68D77CFD1CD1C5E4004C1735 / * GameSettings . cpp * / ; } ; <nl> + 68D77D0A1CD1C64C004C1735 / * JoystickEmulation . cpp in Sources * / = { isa = PBXBuildFile ; fileRef = 68D77D061CD1C64C004C1735 / * JoystickEmulation . cpp * / ; } ; <nl> + 68D77D0B1CD1C64C004C1735 / * JoystickEmulation . cpp in Sources * / = { isa = PBXBuildFile ; fileRef = 68D77D061CD1C64C004C1735 / * JoystickEmulation . cpp * / ; } ; <nl> + 68D77D0E1CD1C672004C1735 / * PeripheralBusApplication . cpp in Sources * / = { isa = PBXBuildFile ; fileRef = 68D77D0C1CD1C672004C1735 / * PeripheralBusApplication . cpp * / ; } ; <nl> + 68D77D0F1CD1C672004C1735 / * PeripheralBusApplication . cpp in Sources * / = { isa = PBXBuildFile ; fileRef = 68D77D0C1CD1C672004C1735 / * PeripheralBusApplication . cpp * / ; } ; <nl> + 68D77D121CD1C68A004C1735 / * PeripheralJoystickEmulation . cpp in Sources * / = { isa = PBXBuildFile ; fileRef = 68D77D101CD1C68A004C1735 / * PeripheralJoystickEmulation . cpp * / ; } ; <nl> + 68D77D131CD1C68A004C1735 / * PeripheralJoystickEmulation . cpp in Sources * / = { isa = PBXBuildFile ; fileRef = 68D77D101CD1C68A004C1735 / * PeripheralJoystickEmulation . cpp * / ; } ; <nl> 761170901C8B85F8006C6366 / * AddonGUIRenderingControl . cpp in Sources * / = { isa = PBXBuildFile ; fileRef = 7611708C1C8B85F8006C6366 / * AddonGUIRenderingControl . cpp * / ; } ; <nl> 761170911C8B85F8006C6366 / * AddonGUIWindow . cpp in Sources * / = { isa = PBXBuildFile ; fileRef = 7611708E1C8B85F8006C6366 / * AddonGUIWindow . cpp * / ; } ; <nl> 76AEFB361C8F79BD00EF2EC0 / * AddonInterfaces . cpp in Sources * / = { isa = PBXBuildFile ; fileRef = EDED2E991C878F61000F5E80 / * AddonInterfaces . cpp * / ; } ; <nl> <nl> 68D916791DD0430E00058B06 / * GUIDialogNewJoystick . h * / = { isa = PBXFileReference ; fileEncoding = 4 ; lastKnownFileType = sourcecode . c . h ; name = GUIDialogNewJoystick . h ; path = joysticks / dialogs / GUIDialogNewJoystick . h ; sourceTree = " < group > " ; } ; <nl> 68D77CFD1CD1C5E4004C1735 / * GameSettings . cpp * / = { isa = PBXFileReference ; fileEncoding = 4 ; lastKnownFileType = sourcecode . cpp . cpp ; name = GameSettings . cpp ; path = games / GameSettings . cpp ; sourceTree = " < group > " ; } ; <nl> 68D77CFE1CD1C5E4004C1735 / * GameSettings . h * / = { isa = PBXFileReference ; fileEncoding = 4 ; lastKnownFileType = sourcecode . c . h ; name = GameSettings . h ; path = games / GameSettings . h ; sourceTree = " < group > " ; } ; <nl> + 68D77D021CD1C638004C1735 / * IKeyboardHandler . h * / = { isa = PBXFileReference ; fileEncoding = 4 ; lastKnownFileType = sourcecode . c . h ; name = IKeyboardHandler . h ; path = keyboard / IKeyboardHandler . h ; sourceTree = " < group > " ; } ; <nl> + 68D77D061CD1C64C004C1735 / * JoystickEmulation . cpp * / = { isa = PBXFileReference ; fileEncoding = 4 ; lastKnownFileType = sourcecode . cpp . cpp ; name = JoystickEmulation . cpp ; path = keyboard / generic / JoystickEmulation . cpp ; sourceTree = " < group > " ; } ; <nl> + 68D77D071CD1C64C004C1735 / * JoystickEmulation . h * / = { isa = PBXFileReference ; fileEncoding = 4 ; lastKnownFileType = sourcecode . c . h ; name = JoystickEmulation . h ; path = keyboard / generic / JoystickEmulation . h ; sourceTree = " < group > " ; } ; <nl> + 68D77D0C1CD1C672004C1735 / * PeripheralBusApplication . cpp * / = { isa = PBXFileReference ; fileEncoding = 4 ; lastKnownFileType = sourcecode . cpp . cpp ; path = PeripheralBusApplication . cpp ; sourceTree = " < group > " ; } ; <nl> + 68D77D0D1CD1C672004C1735 / * PeripheralBusApplication . h * / = { isa = PBXFileReference ; fileEncoding = 4 ; lastKnownFileType = sourcecode . c . h ; path = PeripheralBusApplication . h ; sourceTree = " < group > " ; } ; <nl> + 68D77D101CD1C68A004C1735 / * PeripheralJoystickEmulation . cpp * / = { isa = PBXFileReference ; fileEncoding = 4 ; lastKnownFileType = sourcecode . cpp . cpp ; path = PeripheralJoystickEmulation . cpp ; sourceTree = " < group > " ; } ; <nl> + 68D77D111CD1C68A004C1735 / * PeripheralJoystickEmulation . h * / = { isa = PBXFileReference ; fileEncoding = 4 ; lastKnownFileType = sourcecode . c . h ; path = PeripheralJoystickEmulation . h ; sourceTree = " < group > " ; } ; <nl> 6E97BDBF0DA2B620003A2A89 / * EventClient . h * / = { isa = PBXFileReference ; fileEncoding = 4 ; lastKnownFileType = sourcecode . c . h ; path = EventClient . h ; sourceTree = " < group > " ; } ; <nl> 6E97BDC00DA2B620003A2A89 / * EventPacket . h * / = { isa = PBXFileReference ; fileEncoding = 4 ; lastKnownFileType = sourcecode . c . h ; path = EventPacket . h ; sourceTree = " < group > " ; } ; <nl> 6E97BDC10DA2B620003A2A89 / * EventServer . h * / = { isa = PBXFileReference ; fileEncoding = 4 ; lastKnownFileType = sourcecode . c . h ; path = EventServer . h ; sourceTree = " < group > " ; } ; <nl> <nl> isa = PBXGroup ; <nl> children = ( <nl> 68AE5BAB1C92419500C4D527 / * joysticks * / , <nl> + 68D77D011CD1C627004C1735 / * keyboard * / , <nl> E4991332174E5E5C00741B6D / * touch * / , <nl> 18B7C8CB12942546009E7A26 / * ButtonTranslator . cpp * / , <nl> 18B7C8CC12942546009E7A26 / * ButtonTranslator . h * / , <nl> <nl> children = ( <nl> 68AE5BE91C92422C00C4D527 / * PeripheralBusAddon . cpp * / , <nl> 68AE5BEA1C92422C00C4D527 / * PeripheralBusAddon . h * / , <nl> + 68D77D0C1CD1C672004C1735 / * PeripheralBusApplication . cpp * / , <nl> + 68D77D0D1CD1C672004C1735 / * PeripheralBusApplication . h * / , <nl> 1DAFDB7A16DFDCA7007F8C68 / * PeripheralBusCEC . cpp * / , <nl> 1DAFDB7B16DFDCA7007F8C68 / * PeripheralBusCEC . h * / , <nl> ) ; <nl> <nl> name = AudioDSPAddons ; <nl> sourceTree = " < group > " ; <nl> } ; <nl> + 68D77D011CD1C627004C1735 / * keyboard * / = { <nl> + isa = PBXGroup ; <nl> + children = ( <nl> + 68D77D031CD1C63B004C1735 / * generic * / , <nl> + 68D77D021CD1C638004C1735 / * IKeyboardHandler . h * / , <nl> + ) ; <nl> + name = keyboard ; <nl> + sourceTree = " < group > " ; <nl> + } ; <nl> + 68D77D031CD1C63B004C1735 / * generic * / = { <nl> + isa = PBXGroup ; <nl> + children = ( <nl> + 68D77D061CD1C64C004C1735 / * JoystickEmulation . cpp * / , <nl> + 68D77D071CD1C64C004C1735 / * JoystickEmulation . h * / , <nl> + ) ; <nl> + name = generic ; <nl> + sourceTree = " < group > " ; <nl> + } ; <nl> 76F4C37B1C8E927A00A1E64B / * InputStream * / = { <nl> isa = PBXGroup ; <nl> children = ( <nl> <nl> 1D638127161E211E003603ED / * PeripheralImon . h * / , <nl> 68AE5BED1C92424300C4D527 / * PeripheralJoystick . cpp * / , <nl> 68AE5BEE1C92424300C4D527 / * PeripheralJoystick . h * / , <nl> + 68D77D101CD1C68A004C1735 / * PeripheralJoystickEmulation . cpp * / , <nl> + 68D77D111CD1C68A004C1735 / * PeripheralJoystickEmulation . h * / , <nl> F5E10526140AA38000175026 / * PeripheralNIC . cpp * / , <nl> F5E10527140AA38000175026 / * PeripheralNIC . h * / , <nl> F5E10528140AA38000175026 / * PeripheralNyxboard . cpp * / , <nl> <nl> E38E1FC70D25F9FD00618676 / * CodecFactory . cpp in Sources * / , <nl> E38E1FE90D25F9FD00618676 / * LinuxRendererGL . cpp in Sources * / , <nl> E38E1FEC0D25F9FD00618676 / * RenderManager . cpp in Sources * / , <nl> + 68D77D0E1CD1C672004C1735 / * PeripheralBusApplication . cpp in Sources * / , <nl> E38E1FF00D25F9FD00618676 / * VideoFilterShader . cpp in Sources * / , <nl> E38E1FF10D25F9FD00618676 / * YUV2RGBShader . cpp in Sources * / , <nl> 2AFBB94C1CC608A200BAB340 / * GUIEPGGridContainerModel . cpp in Sources * / , <nl> <nl> E38E207D0D25F9FD00618676 / * GUIDialogButtonMenu . cpp in Sources * / , <nl> E38E207F0D25F9FD00618676 / * GUIDialogContextMenu . cpp in Sources * / , <nl> E38E20800D25F9FD00618676 / * GUIDialogFavourites . cpp in Sources * / , <nl> + 68D77D0A1CD1C64C004C1735 / * JoystickEmulation . cpp in Sources * / , <nl> E38E20810D25F9FD00618676 / * GUIDialogFileBrowser . cpp in Sources * / , <nl> E38E20830D25F9FD00618676 / * GUIDialogGamepad . cpp in Sources * / , <nl> E38E20890D25F9FD00618676 / * GUIDialogMediaSource . cpp in Sources * / , <nl> <nl> F5E10544140AA38100175026 / * GUIDialogPeripheralSettings . cpp in Sources * / , <nl> F5E10547140AA38100175026 / * Peripherals . cpp in Sources * / , <nl> F5E1138014357F3800175026 / * PeripheralCecAdapter . cpp in Sources * / , <nl> + 68D77D121CD1C68A004C1735 / * PeripheralJoystickEmulation . cpp in Sources * / , <nl> DF673AA51443819600A5A509 / * AddonManager . cpp in Sources * / , <nl> 7C8E022B1BA35D0B0072E8B2 / * GUIContainerBuiltins . cpp in Sources * / , <nl> 68B7E5E81D5FA9B300A5AEC0 / * GUIFeatureControls . cpp in Sources * / , <nl> <nl> E4991393174E5F0E00741B6D / * TagLibVFSStream . cpp in Sources * / , <nl> E4991394174E5F0E00741B6D / * TagLoaderTagLib . cpp in Sources * / , <nl> E4991395174E5F0E00741B6D / * GUIWindowMusicBase . cpp in Sources * / , <nl> + 68D77D0B1CD1C64C004C1735 / * JoystickEmulation . cpp in Sources * / , <nl> E4991396174E5F0E00741B6D / * GUIWindowMusicNav . cpp in Sources * / , <nl> E4991397174E5F0E00741B6D / * GUIWindowMusicPlaylist . cpp in Sources * / , <nl> E4991398174E5F0E00741B6D / * GUIWindowMusicPlaylistEditor . cpp in Sources * / , <nl> E499139A174E5F0E00741B6D / * GUIWindowVisualisation . cpp in Sources * / , <nl> + 68D77D0F1CD1C672004C1735 / * PeripheralBusApplication . cpp in Sources * / , <nl> E499139B174E5F0E00741B6D / * Album . cpp in Sources * / , <nl> E499139C174E5F0E00741B6D / * Artist . cpp in Sources * / , <nl> 68AE5C0E1C92437900C4D527 / * GUIFeatureList . cpp in Sources * / , <nl> <nl> DF396ED41C42A25F00214C1A / * DictionaryUtils . mm in Sources * / , <nl> E49913E2174E5F8D00741B6D / * PlayListM3U . cpp in Sources * / , <nl> E49913E3174E5F8D00741B6D / * PlayListPLS . cpp in Sources * / , <nl> + 68D77D131CD1C68A004C1735 / * PeripheralJoystickEmulation . cpp in Sources * / , <nl> E49913E4174E5F8D00741B6D / * PlayListURL . cpp in Sources * / , <nl> E49913E5174E5F8D00741B6D / * PlayListWPL . cpp in Sources * / , <nl> E49913E6174E5F8D00741B6D / * PlayListXML . cpp in Sources * / , <nl> mmm a / Makefile . in <nl> ppp b / Makefile . in <nl> ifeq ( $ ( findstring osx , @ ARCH @ ) , osx ) <nl> DIRECTORY_ARCHIVES + = xbmc / input / joysticks / input_joysticks . a <nl> DIRECTORY_ARCHIVES + = xbmc / input / joysticks / dialogs / input_joystick_dialogs . a <nl> DIRECTORY_ARCHIVES + = xbmc / input / joysticks / generic / input_joysticks_generic . a <nl> + DIRECTORY_ARCHIVES + = xbmc / input / keyboard / generic / input_keyboard_generic . a <nl> DIRECTORY_ARCHIVES + = xbmc / network / osx / network . a <nl> DIRECTORY_ARCHIVES + = xbmc / network / linux / network_linux . a <nl> DIRECTORY_ARCHIVES + = xbmc / powermanagement / osx / powermanagement . a <nl> ifeq ( @ USE_ANDROID @ , 1 ) <nl> DIRECTORY_ARCHIVES + = xbmc / input / joysticks / input_joysticks . a <nl> DIRECTORY_ARCHIVES + = xbmc / input / joysticks / dialogs / input_joystick_dialogs . a <nl> DIRECTORY_ARCHIVES + = xbmc / input / joysticks / generic / input_joysticks_generic . a <nl> + DIRECTORY_ARCHIVES + = xbmc / input / keyboard / generic / input_keyboard_generic . a <nl> DIRECTORY_ARCHIVES + = xbmc / input / linux / input_linux . a <nl> DIRECTORY_ARCHIVES + = xbmc / input / touch / input_touch . a <nl> DIRECTORY_ARCHIVES + = xbmc / input / touch / generic / input_touch_generic . a <nl> else <nl> DIRECTORY_ARCHIVES + = xbmc / input / joysticks / input_joysticks . a <nl> DIRECTORY_ARCHIVES + = xbmc / input / joysticks / dialogs / input_joystick_dialogs . a <nl> DIRECTORY_ARCHIVES + = xbmc / input / joysticks / generic / input_joysticks_generic . a <nl> + DIRECTORY_ARCHIVES + = xbmc / input / keyboard / generic / input_keyboard_generic . a <nl> DIRECTORY_ARCHIVES + = xbmc / input / linux / input_linux . a <nl> DIRECTORY_ARCHIVES + = xbmc / input / touch / input_touch . a <nl> DIRECTORY_ARCHIVES + = xbmc / input / touch / generic / input_touch_generic . a <nl> mmm a / addons / kodi . peripheral / addon . xml <nl> ppp b / addons / kodi . peripheral / addon . xml <nl> <nl> < ? xml version = " 1 . 0 " encoding = " UTF - 8 " ? > <nl> - < addon id = " kodi . peripheral " version = " 1 . 2 . 0 " provider - name = " Team - Kodi " > <nl> + < addon id = " kodi . peripheral " version = " 1 . 2 . 1 " provider - name = " Team - Kodi " > <nl> < backwards - compatibility abi = " 1 . 2 . 0 " / > <nl> < requires > <nl> < import addon = " xbmc . core " version = " 0 . 1 . 0 " / > <nl> mmm a / addons / resource . language . en_gb / resources / strings . po <nl> ppp b / addons / resource . language . en_gb / resources / strings . po <nl> msgctxt " # 35102 " <nl> msgid " Disable joystick when this device is present " <nl> msgstr " " <nl> <nl> - # empty strings from id 35103 to 35199 <nl> + # empty strings from id 35103 to 35149 <nl> + <nl> + # . Name of keyboard category in the settings category window <nl> + # : system / settings / settings . xml <nl> + msgctxt " # 35150 " <nl> + msgid " Keyboard " <nl> + msgstr " " <nl> + <nl> + # . Name of group for configuring keyboard players <nl> + # : system / settings / settings . xml <nl> + msgctxt " # 35151 " <nl> + msgid " Player configuration " <nl> + msgstr " " <nl> + <nl> + # . Name of setting for enabling the keyboard during gameplay <nl> + # : system / settings / settings . xml <nl> + msgctxt " # 35152 " <nl> + msgid " Enable keyboard " <nl> + msgstr " " <nl> + <nl> + # . Description of setting with label # 35152 " Enable keyboard " <nl> + # : system / settings / settings . xml <nl> + msgctxt " # 35153 " <nl> + msgid " This allows the keyboard to emulate up to 8 game controllers . If disabled , the keyboard can still be used to control emulators like DOSBox which require a full keyboard . " <nl> + msgstr " " <nl> + <nl> + # . Setting name for number of keyboard players <nl> + # : system / settings / settings . xml <nl> + msgctxt " # 35154 " <nl> + msgid " Number of keyboard players " <nl> + msgstr " " <nl> + <nl> + # . Description of settings with label # 35066 <nl> + # : system / settings / settings . xml <nl> + msgctxt " # 35155 " <nl> + msgid " Set the number of players using the keyboard . This is intended for devices that use keyboard drivers , but you can also see how many people fit around a keyboard ! " <nl> + msgstr " " <nl> + <nl> + # : system / settings / settings . xml <nl> + msgctxt " # 35156 " <nl> + msgid " % i " <nl> + msgstr " " <nl> + <nl> + # . Name of setting to configure a keyboard player ' s controller configuration <nl> + # : system / settings / settings . xml <nl> + msgctxt " # 35157 " <nl> + msgid " Configure keyboard player 1 " <nl> + msgstr " " <nl> + <nl> + # . Name of setting to configure a keyboard player ' s controller configuration <nl> + # : system / settings / settings . xml <nl> + msgctxt " # 35158 " <nl> + msgid " Configure keyboard player 2 " <nl> + msgstr " " <nl> + <nl> + # . Name of setting to configure a keyboard player ' s controller configuration <nl> + # : system / settings / settings . xml <nl> + msgctxt " # 35159 " <nl> + msgid " Configure keyboard player 3 " <nl> + msgstr " " <nl> + <nl> + # . Name of setting to configure a keyboard player ' s controller configuration <nl> + # : system / settings / settings . xml <nl> + msgctxt " # 35160 " <nl> + msgid " Configure keyboard player 4 " <nl> + msgstr " " <nl> + <nl> + # . Name of setting to configure a keyboard player ' s controller configuration <nl> + # : system / settings / settings . xml <nl> + msgctxt " # 35161 " <nl> + msgid " Configure keyboard player 5 " <nl> + msgstr " " <nl> + <nl> + # . Name of setting to configure a keyboard player ' s controller configuration <nl> + # : system / settings / settings . xml <nl> + msgctxt " # 35162 " <nl> + msgid " Configure keyboard player 6 " <nl> + msgstr " " <nl> + <nl> + # . Name of setting to configure a keyboard player ' s controller configuration <nl> + # : system / settings / settings . xml <nl> + msgctxt " # 35163 " <nl> + msgid " Configure keyboard player 7 " <nl> + msgstr " " <nl> + <nl> + # . Name of setting to configure a keyboard player ' s controller configuration <nl> + # : system / settings / settings . xml <nl> + msgctxt " # 35164 " <nl> + msgid " Configure keyboard player 8 " <nl> + msgstr " " <nl> + <nl> + # . Name of the keyboard - emulated controller in the list of peripherals <nl> + # : xbmc / peripherals / bus / virtual / PeripheralBusApplication . cpp <nl> + msgctxt " # 35165 " <nl> + msgid " Keyboard player " <nl> + msgstr " " <nl> + <nl> + # empty strings from id 35166 to 35199 <nl> <nl> # . This string is an early meme from the late 1990 ' s that made fun of the poor translation in the 16 - bit game Zero Wing from the late 1980 ' s . DO NOT TRANSLATE ! <nl> # : system / settings / settings . xml <nl> mmm a / doxygen_resources / pages / mainpage . dox <nl> ppp b / doxygen_resources / pages / mainpage . dox <nl> <nl> - Clients ( e . g . game clients implementing \ ref KEYBOARD : : IKeyboardHandler ) call <nl> \ ref CInputManager : : RegisterKeyboardHandler to register themselves as eligible <nl> for keyboard input events . <nl> + - Keyboards can emulate Joysticks as described in KEYBOARD : : CJoystickEmulation . <nl> * / <nl> <nl> / * ! <nl> mmm a / project / cmake / treedata / common / subdirs . txt <nl> ppp b / project / cmake / treedata / common / subdirs . txt <nl> xbmc / input input <nl> xbmc / input / joysticks input / joysticks <nl> xbmc / input / joysticks / dialogs input / joysticks / dialogs <nl> xbmc / input / joysticks / generic input / joysticks / generic <nl> + xbmc / input / keyboard input / keyboard <nl> + xbmc / input / keyboard / generic input / keyboard / generic <nl> xbmc / listproviders listproviders <nl> xbmc / media media <nl> xbmc / messaging messaging <nl> mmm a / system / settings / settings . xml <nl> ppp b / system / settings / settings . xml <nl> <nl> < / category > <nl> < / section > <nl> < section id = " games " label = " 15016 " help = " 35200 " > <nl> + < category id = " gameskeyboard " label = " 35150 " > <nl> + < group id = " 1 " label = " 128 " > <nl> + < setting id = " gameskeyboard . enablekeyboard " type = " boolean " label = " 35152 " help = " 35153 " > <nl> + < level > 0 < / level > <nl> + < control type = " toggle " / > <nl> + < default > false < / default > <nl> + < / setting > <nl> + < / group > <nl> + < group id = " 2 " label = " 35151 " > <nl> + < setting id = " gameskeyboard . keyboardplayers " type = " integer " label = " 35154 " help = " 35155 " > <nl> + < level > 0 < / level > <nl> + < default > 1 < / default > <nl> + < constraints > <nl> + < minimum > 1 < / minimum > <nl> + < step > 1 < / step > <nl> + < maximum > 8 < / maximum > <nl> + < / constraints > <nl> + < dependencies > <nl> + < dependency type = " enable " setting = " gameskeyboard . enablekeyboard " > true < / dependency > <nl> + < / dependencies > <nl> + < control type = " slider " format = " integer " > <nl> + < popup > true < / popup > <nl> + < formatlabel > 35156 < / formatlabel > < ! - - TODO : Add a < formattype > integer < / formattype > tag - - > <nl> + < / control > <nl> + < / setting > <nl> + < setting id = " gameskeyboard . keyboardplayerconfig1 " type = " action " label = " 35157 " help = " 35155 " > <nl> + < level > 0 < / level > <nl> + < control type = " button " format = " action " / > <nl> + < dependencies > <nl> + < dependency type = " visible " > <nl> + < condition on = " property " name = " gte " setting = " gameskeyboard . keyboardplayers " > 1 < / condition > <nl> + < / dependency > <nl> + < dependency type = " enable " setting = " gameskeyboard . enablekeyboard " > true < / dependency > <nl> + < / dependencies > <nl> + < / setting > <nl> + < setting id = " gameskeyboard . keyboardplayerconfig2 " type = " action " label = " 35158 " help = " 35155 " > <nl> + < level > 0 < / level > <nl> + < control type = " button " format = " action " / > <nl> + < dependencies > <nl> + < dependency type = " visible " > <nl> + < condition on = " property " name = " gte " setting = " gameskeyboard . keyboardplayers " > 2 < / condition > <nl> + < / dependency > <nl> + < dependency type = " enable " setting = " gameskeyboard . enablekeyboard " > true < / dependency > <nl> + < / dependencies > <nl> + < / setting > <nl> + < setting id = " gameskeyboard . keyboardplayerconfig3 " type = " action " label = " 35159 " help = " 35155 " > <nl> + < level > 0 < / level > <nl> + < control type = " button " format = " action " / > <nl> + < dependencies > <nl> + < dependency type = " visible " > <nl> + < condition on = " property " name = " gte " setting = " gameskeyboard . keyboardplayers " > 3 < / condition > <nl> + < / dependency > <nl> + < dependency type = " enable " setting = " gameskeyboard . enablekeyboard " > true < / dependency > <nl> + < / dependencies > <nl> + < / setting > <nl> + < setting id = " gameskeyboard . keyboardplayerconfig4 " type = " action " label = " 35160 " help = " 35155 " > <nl> + < level > 0 < / level > <nl> + < control type = " button " format = " action " / > <nl> + < dependencies > <nl> + < dependency type = " visible " > <nl> + < condition on = " property " name = " gte " setting = " gameskeyboard . keyboardplayers " > 4 < / condition > <nl> + < / dependency > <nl> + < dependency type = " enable " setting = " gameskeyboard . enablekeyboard " > true < / dependency > <nl> + < / dependencies > <nl> + < / setting > <nl> + < setting id = " gameskeyboard . keyboardplayerconfig5 " type = " action " label = " 35161 " help = " 35155 " > <nl> + < level > 0 < / level > <nl> + < control type = " button " format = " action " / > <nl> + < dependencies > <nl> + < dependency type = " visible " > <nl> + < condition on = " property " name = " gte " setting = " gameskeyboard . keyboardplayers " > 5 < / condition > <nl> + < / dependency > <nl> + < dependency type = " enable " setting = " gameskeyboard . enablekeyboard " > true < / dependency > <nl> + < / dependencies > <nl> + < / setting > <nl> + < setting id = " gameskeyboard . keyboardplayerconfig6 " type = " action " label = " 35162 " help = " 35155 " > <nl> + < level > 0 < / level > <nl> + < control type = " button " format = " action " / > <nl> + < dependencies > <nl> + < dependency type = " visible " > <nl> + < condition on = " property " name = " gte " setting = " gameskeyboard . keyboardplayers " > 6 < / condition > <nl> + < / dependency > <nl> + < dependency type = " enable " setting = " gameskeyboard . enablekeyboard " > true < / dependency > <nl> + < / dependencies > <nl> + < / setting > <nl> + < setting id = " gameskeyboard . keyboardplayerconfig7 " type = " action " label = " 35163 " help = " 35155 " > <nl> + < level > 0 < / level > <nl> + < control type = " button " format = " action " / > <nl> + < dependencies > <nl> + < dependency type = " visible " > <nl> + < condition on = " property " name = " gte " setting = " gameskeyboard . keyboardplayers " > 7 < / condition > <nl> + < / dependency > <nl> + < dependency type = " enable " setting = " gameskeyboard . enablekeyboard " > true < / dependency > <nl> + < / dependencies > <nl> + < / setting > <nl> + < setting id = " gameskeyboard . keyboardplayerconfig8 " type = " action " label = " 35164 " help = " 35155 " > <nl> + < level > 0 < / level > <nl> + < control type = " button " format = " action " / > <nl> + < dependencies > <nl> + < dependency type = " visible " > <nl> + < condition on = " property " name = " gte " setting = " gameskeyboard . keyboardplayers " > 8 < / condition > <nl> + < / dependency > <nl> + < dependency type = " enable " setting = " gameskeyboard . enablekeyboard " > true < / dependency > <nl> + < / dependencies > <nl> + < / setting > <nl> + < / group > <nl> + < / category > <nl> < / section > <nl> < section id = " system " label = " 13000 " help = " 36349 " > <nl> < category id = " display " label = " 14220 " help = " 36603 " > <nl> mmm a / xbmc / addons / kodi - addon - dev - kit / include / kodi / kodi_peripheral_types . h <nl> ppp b / xbmc / addons / kodi - addon - dev - kit / include / kodi / kodi_peripheral_types . h <nl> <nl> # endif <nl> <nl> / * current Peripheral API version * / <nl> - # define PERIPHERAL_API_VERSION " 1 . 2 . 0 " <nl> + # define PERIPHERAL_API_VERSION " 1 . 2 . 1 " <nl> <nl> / * min . Peripheral API version * / <nl> # define PERIPHERAL_MIN_API_VERSION " 1 . 2 . 0 " <nl> extern " C " <nl> { <nl> PERIPHERAL_TYPE_UNKNOWN , <nl> PERIPHERAL_TYPE_JOYSTICK , <nl> + PERIPHERAL_TYPE_KEYBOARD , <nl> } PERIPHERAL_TYPE ; <nl> <nl> typedef struct PERIPHERAL_INFO <nl> mmm a / xbmc / games / GameSettings . cpp <nl> ppp b / xbmc / games / GameSettings . cpp <nl> <nl> * / <nl> <nl> # include " GameSettings . h " <nl> + # include " guilib / GUIWindowManager . h " <nl> + # include " guilib / WindowIDs . h " <nl> + # include " peripherals / Peripherals . h " <nl> # include " settings / lib / Setting . h " <nl> + # include " settings / Settings . h " <nl> + # include " utils / StringUtils . h " <nl> + <nl> + # include < cstring > <nl> <nl> using namespace GAME ; <nl> <nl> + # define SETTING_GAMES_KEYBOARD_PLAYERCONFIG_PREFIX " gameskeyboard . keyboardplayerconfig " / / ! @ todo <nl> + <nl> CGameSettings & CGameSettings : : GetInstance ( ) <nl> { <nl> static CGameSettings gameSettingsInstance ; <nl> return gameSettingsInstance ; <nl> } <nl> <nl> + void CGameSettings : : OnSettingChanged ( const CSetting * setting ) <nl> + { <nl> + if ( setting = = NULL ) <nl> + return ; <nl> + <nl> + const std : : string & settingId = setting - > GetId ( ) ; <nl> + if ( settingId = = CSettings : : SETTING_GAMES_KEYBOARD_PLAYERS ) <nl> + { <nl> + PERIPHERALS : : g_peripherals . TriggerDeviceScan ( PERIPHERALS : : PERIPHERAL_BUS_APPLICATION ) ; <nl> + } <nl> + } <nl> + <nl> void CGameSettings : : OnSettingAction ( const CSetting * setting ) <nl> { <nl> if ( setting = = NULL ) <nl> return ; <nl> <nl> const std : : string & settingId = setting - > GetId ( ) ; <nl> - / / TODO <nl> + if ( StringUtils : : StartsWith ( settingId , SETTING_GAMES_KEYBOARD_PLAYERCONFIG_PREFIX ) ) <nl> + { <nl> + std : : string strControllerIndex = settingId . substr ( std : : strlen ( SETTING_GAMES_KEYBOARD_PLAYERCONFIG_PREFIX ) ) ; <nl> + g_windowManager . ActivateWindow ( WINDOW_DIALOG_GAME_CONTROLLERS , strControllerIndex ) ; <nl> + } <nl> } <nl> mmm a / xbmc / games / GameSettings . h <nl> ppp b / xbmc / games / GameSettings . h <nl> class CGameSettings : public ISettingCallback <nl> virtual ~ CGameSettings ( ) { } <nl> <nl> / / Inherited from ISettingCallback <nl> + virtual void OnSettingChanged ( const CSetting * setting ) override ; <nl> virtual void OnSettingAction ( const CSetting * setting ) override ; <nl> <nl> private : <nl> mmm a / xbmc / games / controllers / dialogs / GUIDialogButtonCapture . h <nl> ppp b / xbmc / games / controllers / dialogs / GUIDialogButtonCapture . h <nl> namespace GAME <nl> / / implementation of IButtonMapper <nl> virtual std : : string ControllerID ( void ) const override ; <nl> virtual bool NeedsCooldown ( void ) const override { return false ; } <nl> + virtual bool Emulation ( void ) const override { return false ; } <nl> + virtual unsigned int ControllerNumber ( void ) const override { return 0 ; } <nl> virtual bool MapPrimitive ( JOYSTICK : : IButtonMap * buttonMap , <nl> JOYSTICK : : IActionMap * actionMap , <nl> const JOYSTICK : : CDriverPrimitive & primitive ) override ; <nl> mmm a / xbmc / games / controllers / windows / GUIConfigurationWizard . cpp <nl> ppp b / xbmc / games / controllers / windows / GUIConfigurationWizard . cpp <nl> using namespace GAME ; <nl> / / Duration to wait for axes to neutralize after mapping is finished <nl> # define POST_MAPPING_WAIT_TIME_MS ( 5 * 1000 ) <nl> <nl> - CGUIConfigurationWizard : : CGUIConfigurationWizard ( ) : <nl> + CGUIConfigurationWizard : : CGUIConfigurationWizard ( bool bEmulation , unsigned int controllerNumber / * = 0 * / ) : <nl> CThread ( " GUIConfigurationWizard " ) , <nl> + m_bEmulation ( bEmulation ) , <nl> + m_controllerNumber ( controllerNumber ) , <nl> m_callback ( nullptr ) <nl> { <nl> InitializeState ( ) ; <nl> void CGUIConfigurationWizard : : InstallHooks ( void ) <nl> <nl> g_peripherals . RegisterJoystickButtonMapper ( this ) ; <nl> g_peripherals . RegisterObserver ( this ) ; <nl> - CInputManager : : GetInstance ( ) . RegisterKeyboardHandler ( this ) ; <nl> + <nl> + / / If we ' re not using emulation , allow keyboard input to abort prompt <nl> + if ( ! m_bEmulation ) <nl> + CInputManager : : GetInstance ( ) . RegisterKeyboardHandler ( this ) ; <nl> } <nl> <nl> void CGUIConfigurationWizard : : RemoveHooks ( void ) <nl> { <nl> using namespace PERIPHERALS ; <nl> <nl> - CInputManager : : GetInstance ( ) . UnregisterKeyboardHandler ( this ) ; <nl> + if ( ! m_bEmulation ) <nl> + CInputManager : : GetInstance ( ) . UnregisterKeyboardHandler ( this ) ; <nl> + <nl> g_peripherals . UnregisterObserver ( this ) ; <nl> g_peripherals . UnregisterJoystickButtonMapper ( this ) ; <nl> } <nl> mmm a / xbmc / games / controllers / windows / GUIConfigurationWizard . h <nl> ppp b / xbmc / games / controllers / windows / GUIConfigurationWizard . h <nl> namespace GAME <nl> protected CThread <nl> { <nl> public : <nl> - CGUIConfigurationWizard ( ) ; <nl> + CGUIConfigurationWizard ( bool bEmulation , unsigned int controllerNumber = 0 ) ; <nl> <nl> virtual ~ CGUIConfigurationWizard ( void ) { } <nl> <nl> namespace GAME <nl> / / implementation of IButtonMapper <nl> virtual std : : string ControllerID ( void ) const override { return m_strControllerId ; } <nl> virtual bool NeedsCooldown ( void ) const override { return true ; } <nl> + virtual bool Emulation ( void ) const override { return m_bEmulation ; } <nl> + virtual unsigned int ControllerNumber ( void ) const override { return m_controllerNumber ; } <nl> virtual bool MapPrimitive ( JOYSTICK : : IButtonMap * buttonMap , <nl> JOYSTICK : : IActionMap * actionMap , <nl> const JOYSTICK : : CDriverPrimitive & primitive ) override ; <nl> namespace GAME <nl> void OnMotion ( const JOYSTICK : : IButtonMap * buttonMap ) ; <nl> void OnMotionless ( const JOYSTICK : : IButtonMap * buttonMap ) ; <nl> <nl> + / / Construction parameters <nl> + const bool m_bEmulation ; <nl> + const unsigned int m_controllerNumber ; <nl> + <nl> / / Run ( ) parameters <nl> std : : string m_strControllerId ; <nl> std : : vector < IFeatureButton * > m_buttons ; <nl> mmm a / xbmc / games / controllers / windows / GUIControllerWindow . cpp <nl> ppp b / xbmc / games / controllers / windows / GUIControllerWindow . cpp <nl> bool CGUIControllerWindow : : OnMessage ( CGUIMessage & message ) <nl> { <nl> case GUI_MSG_WINDOW_INIT : <nl> { <nl> - / / ! @ todo Process parameter <nl> - / / std : : string strParam = message . GetStringParam ( ) ; <nl> + / / ! @ todo Process params here , don ' t just record them for later <nl> + m_param = message . GetStringParam ( ) ; <nl> break ; <nl> } <nl> case GUI_MSG_CLICKED : <nl> void CGUIControllerWindow : : OnInitWindow ( void ) <nl> <nl> if ( ! m_featureList ) <nl> { <nl> - m_featureList = new CGUIFeatureList ( this ) ; <nl> + m_featureList = new CGUIFeatureList ( this , m_param ) ; <nl> if ( ! m_featureList - > Initialize ( ) ) <nl> { <nl> delete m_featureList ; <nl> mmm a / xbmc / games / controllers / windows / GUIControllerWindow . h <nl> ppp b / xbmc / games / controllers / windows / GUIControllerWindow . h <nl> namespace GAME <nl> <nl> IControllerList * m_controllerList ; <nl> IFeatureList * m_featureList ; <nl> + std : : string m_param ; / / First auxiliary parameter in call to ActivateWindow ( ) <nl> } ; <nl> } <nl> mmm a / xbmc / games / controllers / windows / GUIFeatureList . cpp <nl> ppp b / xbmc / games / controllers / windows / GUIFeatureList . cpp <nl> <nl> <nl> using namespace GAME ; <nl> <nl> - CGUIFeatureList : : CGUIFeatureList ( CGUIWindow * window ) : <nl> + CGUIFeatureList : : CGUIFeatureList ( CGUIWindow * window , const std : : string & windowParam ) : <nl> m_window ( window ) , <nl> m_guiList ( nullptr ) , <nl> m_guiButtonTemplate ( nullptr ) , <nl> m_guiGroupTitle ( nullptr ) , <nl> m_guiFeatureSeparator ( nullptr ) , <nl> - m_wizard ( new CGUIConfigurationWizard ) <nl> + m_wizard ( nullptr ) <nl> { <nl> + if ( windowParam . empty ( ) ) <nl> + { <nl> + / / Run wizard for all physical controllers <nl> + m_wizard = new CGUIConfigurationWizard ( false ) ; <nl> + } <nl> + else <nl> + { <nl> + / / Run wizard for specified emulated controller <nl> + unsigned int number ; <nl> + std : : istringstream str ( windowParam ) ; <nl> + str > > number ; <nl> + m_wizard = new CGUIConfigurationWizard ( true , number ) ; <nl> + } <nl> } <nl> <nl> CGUIFeatureList : : ~ CGUIFeatureList ( void ) <nl> mmm a / xbmc / games / controllers / windows / GUIFeatureList . h <nl> ppp b / xbmc / games / controllers / windows / GUIFeatureList . h <nl> namespace GAME <nl> public IConfigurationWizardCallback <nl> { <nl> public : <nl> - CGUIFeatureList ( CGUIWindow * window ) ; <nl> + CGUIFeatureList ( CGUIWindow * window , const std : : string & windowParam ) ; <nl> virtual ~ CGUIFeatureList ( void ) ; <nl> <nl> / / implementation of IFeatureList <nl> mmm a / xbmc / input / joysticks / IButtonMapper . h <nl> ppp b / xbmc / input / joysticks / IButtonMapper . h <nl> namespace JOYSTICK <nl> * / <nl> virtual bool NeedsCooldown ( void ) const = 0 ; <nl> <nl> + / * ! <nl> + * \ brief Test if the mapping process is being performed for an emulated controller <nl> + * <nl> + * \ return true if an emulated controller is being mapped , false otherwise <nl> + * / <nl> + virtual bool Emulation ( void ) const = 0 ; <nl> + <nl> + / * ! <nl> + * \ brief Get the number of the emulated controller being mapped <nl> + * <nl> + * \ return The number , or 0 if an emulated controller is not being mapped <nl> + * <nl> + * \ remark Emulated controllers are 1 - indexed <nl> + * / <nl> + virtual unsigned int ControllerNumber ( void ) const = 0 ; <nl> + <nl> / * ! <nl> * \ brief Handle button / hat press or axis threshold <nl> * <nl> new file mode 100644 <nl> index 000000000000 . . 463c5d0f6103 <nl> mmm / dev / null <nl> ppp b / xbmc / input / keyboard / CMakeLists . txt <nl> @ @ - 0 , 0 + 1 @ @ <nl> + set ( HEADERS IKeyboardHandler . h ) <nl> new file mode 100644 <nl> index 000000000000 . . a5c9295aae68 <nl> mmm / dev / null <nl> ppp b / xbmc / input / keyboard / generic / CMakeLists . txt <nl> <nl> + set ( SOURCES JoystickEmulation . cpp ) <nl> + <nl> + set ( HEADERS JoystickEmulation . h ) <nl> + <nl> + core_add_library ( input_keyboard_generic ) <nl> new file mode 100644 <nl> index 000000000000 . . de4ce1850f94 <nl> mmm / dev / null <nl> ppp b / xbmc / input / keyboard / generic / JoystickEmulation . cpp <nl> <nl> + / * <nl> + * Copyright ( C ) 2015 - 2016 Team Kodi <nl> + * http : / / kodi . tv <nl> + * <nl> + * This Program is free software ; you can redistribute it and / or modify <nl> + * it under the terms of the GNU General Public License as published by <nl> + * the Free Software Foundation ; either version 2 , or ( at your option ) <nl> + * any later version . <nl> + * <nl> + * This Program is distributed in the hope that it will be useful , <nl> + * but WITHOUT ANY WARRANTY ; without even the implied warranty of <nl> + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE . See the <nl> + * GNU General Public License for more details . <nl> + * <nl> + * You should have received a copy of the GNU General Public License <nl> + * along with this Program ; see the file COPYING . If not , see <nl> + * < http : / / www . gnu . org / licenses / > . <nl> + * <nl> + * / <nl> + <nl> + # include " JoystickEmulation . h " <nl> + # include " input / joysticks / IDriverHandler . h " <nl> + # include " input / Key . h " <nl> + <nl> + # include < algorithm > <nl> + # include < assert . h > <nl> + <nl> + # define BUTTON_INDEX_MASK 0x01ff <nl> + <nl> + using namespace KEYBOARD ; <nl> + <nl> + CJoystickEmulation : : CJoystickEmulation ( JOYSTICK : : IDriverHandler * handler ) : <nl> + m_handler ( handler ) <nl> + { <nl> + assert ( m_handler ! = nullptr ) ; <nl> + } <nl> + <nl> + bool CJoystickEmulation : : OnKeyPress ( const CKey & key ) <nl> + { <nl> + bool bHandled = false ; <nl> + <nl> + unsigned int buttonIndex = GetButtonIndex ( key ) ; <nl> + if ( buttonIndex ! = 0 ) <nl> + bHandled = OnPress ( buttonIndex ) ; <nl> + <nl> + return bHandled ; <nl> + } <nl> + <nl> + void CJoystickEmulation : : OnKeyRelease ( const CKey & key ) <nl> + { <nl> + unsigned int buttonIndex = GetButtonIndex ( key ) ; <nl> + if ( buttonIndex ! = 0 ) <nl> + OnRelease ( buttonIndex ) ; <nl> + } <nl> + <nl> + bool CJoystickEmulation : : OnPress ( unsigned int buttonIndex ) <nl> + { <nl> + bool bHandled = false ; <nl> + <nl> + KeyEvent event ; <nl> + if ( GetEvent ( buttonIndex , event ) ) <nl> + { <nl> + bHandled = event . bHandled ; <nl> + } <nl> + else <nl> + { <nl> + bHandled = m_handler - > OnButtonMotion ( buttonIndex , true ) ; <nl> + m_pressedKeys . push_back ( { buttonIndex , bHandled } ) ; <nl> + } <nl> + <nl> + return bHandled ; <nl> + } <nl> + <nl> + void CJoystickEmulation : : OnRelease ( unsigned int buttonIndex ) <nl> + { <nl> + KeyEvent event ; <nl> + if ( GetEvent ( buttonIndex , event ) ) <nl> + { <nl> + m_handler - > OnButtonMotion ( buttonIndex , false ) ; <nl> + m_pressedKeys . erase ( std : : remove_if ( m_pressedKeys . begin ( ) , m_pressedKeys . end ( ) , <nl> + [ buttonIndex ] ( const KeyEvent & event ) <nl> + { <nl> + return buttonIndex = = event . buttonIndex ; <nl> + } ) , m_pressedKeys . end ( ) ) ; <nl> + } <nl> + } <nl> + <nl> + bool CJoystickEmulation : : GetEvent ( unsigned int buttonIndex , KeyEvent & event ) const <nl> + { <nl> + std : : vector < KeyEvent > : : const_iterator it = std : : find_if ( m_pressedKeys . begin ( ) , m_pressedKeys . end ( ) , <nl> + [ buttonIndex ] ( const KeyEvent & event ) <nl> + { <nl> + return buttonIndex = = event . buttonIndex ; <nl> + } ) ; <nl> + <nl> + if ( it ! = m_pressedKeys . end ( ) ) <nl> + { <nl> + event = * it ; <nl> + return true ; <nl> + } <nl> + <nl> + return false ; <nl> + } <nl> + <nl> + unsigned int CJoystickEmulation : : GetButtonIndex ( const CKey & key ) <nl> + { <nl> + return key . GetButtonCode ( ) & BUTTON_INDEX_MASK ; <nl> + } <nl> new file mode 100644 <nl> index 000000000000 . . 1bab9b743411 <nl> mmm / dev / null <nl> ppp b / xbmc / input / keyboard / generic / JoystickEmulation . h <nl> <nl> + / * <nl> + * Copyright ( C ) 2015 - 2016 Team Kodi <nl> + * http : / / kodi . tv <nl> + * <nl> + * This Program is free software ; you can redistribute it and / or modify <nl> + * it under the terms of the GNU General Public License as published by <nl> + * the Free Software Foundation ; either version 2 , or ( at your option ) <nl> + * any later version . <nl> + * <nl> + * This Program is distributed in the hope that it will be useful , <nl> + * but WITHOUT ANY WARRANTY ; without even the implied warranty of <nl> + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE . See the <nl> + * GNU General Public License for more details . <nl> + * <nl> + * You should have received a copy of the GNU General Public License <nl> + * along with this Program ; see the file COPYING . If not , see <nl> + * < http : / / www . gnu . org / licenses / > . <nl> + * <nl> + * / <nl> + # pragma once <nl> + <nl> + # include " input / keyboard / IKeyboardHandler . h " <nl> + <nl> + # include < vector > <nl> + <nl> + namespace JOYSTICK <nl> + { <nl> + class IDriverHandler ; <nl> + } <nl> + <nl> + namespace KEYBOARD <nl> + { <nl> + / * ! <nl> + * \ ingroup keyboard <nl> + * \ brief Generic implementation of a handler for joysticks that use keyboard <nl> + * drivers . It basically emulates a joystick with many buttons . <nl> + * / <nl> + class CJoystickEmulation : public IKeyboardHandler <nl> + { <nl> + public : <nl> + CJoystickEmulation ( JOYSTICK : : IDriverHandler * handler ) ; <nl> + <nl> + virtual ~ CJoystickEmulation ( void ) = default ; <nl> + <nl> + / / implementation of IKeyboardHandler <nl> + virtual bool OnKeyPress ( const CKey & key ) override ; <nl> + virtual void OnKeyRelease ( const CKey & key ) override ; <nl> + <nl> + private : <nl> + struct KeyEvent <nl> + { <nl> + unsigned int buttonIndex ; <nl> + bool bHandled ; <nl> + } ; <nl> + <nl> + bool OnPress ( unsigned int buttonIndex ) ; <nl> + void OnRelease ( unsigned int buttonIndex ) ; <nl> + bool GetEvent ( unsigned int buttonIndex , KeyEvent & event ) const ; <nl> + <nl> + static unsigned int GetButtonIndex ( const CKey & key ) ; <nl> + <nl> + JOYSTICK : : IDriverHandler * const m_handler ; <nl> + std : : vector < KeyEvent > m_pressedKeys ; <nl> + } ; <nl> + } <nl> new file mode 100644 <nl> index 000000000000 . . 3094f2698a72 <nl> mmm / dev / null <nl> ppp b / xbmc / input / keyboard / generic / Makefile <nl> <nl> + SRCS = JoystickEmulation . cpp \ <nl> + <nl> + LIB = input_keyboard_generic . a <nl> + <nl> + include . . / . . / . . / . . / Makefile . include <nl> + - include $ ( patsubst % . cpp , % . P , $ ( patsubst % . c , % . P , $ ( SRCS ) ) ) <nl> mmm a / xbmc / peripherals / PeripheralTypes . h <nl> ppp b / xbmc / peripherals / PeripheralTypes . h <nl> namespace PERIPHERALS <nl> PERIPHERAL_BUS_ANDROID , <nl> # endif <nl> PERIPHERAL_BUS_IMX , <nl> + PERIPHERAL_BUS_APPLICATION , <nl> } ; <nl> <nl> enum PeripheralFeature <nl> namespace PERIPHERALS <nl> PERIPHERAL_TUNER , <nl> PERIPHERAL_IMON , <nl> PERIPHERAL_JOYSTICK , <nl> + PERIPHERAL_JOYSTICK_EMULATION , <nl> } ; <nl> <nl> class CPeripheral ; <nl> namespace PERIPHERALS <nl> return " imon " ; <nl> case PERIPHERAL_JOYSTICK : <nl> return " joystick " ; <nl> + case PERIPHERAL_JOYSTICK_EMULATION : <nl> + return " joystickemulation " ; <nl> default : <nl> return " unknown " ; <nl> } <nl> namespace PERIPHERALS <nl> return PERIPHERAL_IMON ; <nl> else if ( strTypeLowerCase = = " joystick " ) <nl> return PERIPHERAL_JOYSTICK ; <nl> + else if ( strTypeLowerCase = = " joystickemulation " ) <nl> + return PERIPHERAL_JOYSTICK_EMULATION ; <nl> <nl> return PERIPHERAL_UNKNOWN ; <nl> } ; <nl> namespace PERIPHERALS <nl> case PERIPHERAL_BUS_ANDROID : <nl> return " android " ; <nl> # endif <nl> + case PERIPHERAL_BUS_APPLICATION : <nl> + return " application " ; <nl> default : <nl> return " unknown " ; <nl> } <nl> namespace PERIPHERALS <nl> else if ( strTypeLowerCase = = " android " ) <nl> return PERIPHERAL_BUS_ANDROID ; <nl> # endif <nl> + else if ( strTypeLowerCase = = " application " ) <nl> + return PERIPHERAL_BUS_APPLICATION ; <nl> <nl> return PERIPHERAL_BUS_UNKNOWN ; <nl> } ; <nl> mmm a / xbmc / peripherals / Peripherals . cpp <nl> ppp b / xbmc / peripherals / Peripherals . cpp <nl> <nl> # include " devices / PeripheralHID . h " <nl> # include " devices / PeripheralImon . h " <nl> # include " devices / PeripheralJoystick . h " <nl> + # include " devices / PeripheralJoystickEmulation . h " <nl> # include " devices / PeripheralNIC . h " <nl> # include " devices / PeripheralNyxboard . h " <nl> # include " devices / PeripheralTuner . h " <nl> <nl> # include " dialogs / GUIDialogPeripheralSettings . h " <nl> # include " dialogs / GUIDialogSelect . h " <nl> # include " FileItem . h " <nl> + # include " bus / virtual / PeripheralBusApplication . h " <nl> + # include " input / joysticks / IButtonMapper . h " <nl> # include " filesystem / Directory . h " <nl> # include " guilib / GUIWindowManager . h " <nl> # include " guilib / LocalizeStrings . h " <nl> void CPeripherals : : Initialise ( ) <nl> # if defined ( TARGET_ANDROID ) <nl> busses . push_back ( std : : make_shared < CPeripheralBusAndroid > ( this ) ) ; <nl> # endif <nl> + busses . push_back ( std : : make_shared < CPeripheralBusApplication > ( this ) ) ; <nl> <nl> / * initialise all known busses and run an initial scan for devices * / <nl> for ( auto & bus : busses ) <nl> void CPeripherals : : CreatePeripheral ( CPeripheralBus & bus , const PeripheralScanRes <nl> peripheral = PeripheralPtr ( new CPeripheralJoystick ( mappedResult , & bus ) ) ; <nl> break ; <nl> <nl> + case PERIPHERAL_JOYSTICK_EMULATION : <nl> + peripheral = PeripheralPtr ( new CPeripheralJoystickEmulation ( mappedResult , & bus ) ) ; <nl> + break ; <nl> + <nl> default : <nl> break ; <nl> } <nl> void CPeripherals : : OnDeviceAdded ( const CPeripheralBus & bus , const CPeripheral & p <nl> { <nl> OnDeviceChanged ( ) ; <nl> <nl> + bool bNotify = true ; <nl> + <nl> / / don ' t show a notification for devices detected during the initial scan <nl> - if ( bus . IsInitialised ( ) ) <nl> + if ( ! bus . IsInitialised ( ) ) <nl> + bNotify = false ; <nl> + <nl> + / / don ' t show a notification for emulated peripherals <nl> + if ( peripheral . Type ( ) = = PERIPHERAL_JOYSTICK_EMULATION ) / / ! @ todo Change to peripheral . IsEmulated ( ) <nl> + bNotify = false ; <nl> + <nl> + if ( bNotify ) <nl> CGUIDialogKaiToast : : QueueNotification ( CGUIDialogKaiToast : : Info , g_localizeStrings . Get ( 35005 ) , peripheral . DeviceName ( ) ) ; <nl> } <nl> <nl> void CPeripherals : : OnDeviceDeleted ( const CPeripheralBus & bus , const CPeripheral <nl> { <nl> OnDeviceChanged ( ) ; <nl> <nl> - CGUIDialogKaiToast : : QueueNotification ( CGUIDialogKaiToast : : Info , g_localizeStrings . Get ( 35006 ) , peripheral . DeviceName ( ) ) ; <nl> + bool bNotify = true ; <nl> + <nl> + / / don ' t show a notification for emulated peripherals <nl> + if ( peripheral . Type ( ) = = PERIPHERAL_JOYSTICK_EMULATION ) / / ! @ todo Change to peripheral . IsEmulated ( ) <nl> + bNotify = false ; <nl> + <nl> + if ( bNotify ) <nl> + CGUIDialogKaiToast : : QueueNotification ( CGUIDialogKaiToast : : Info , g_localizeStrings . Get ( 35006 ) , peripheral . DeviceName ( ) ) ; <nl> } <nl> <nl> void CPeripherals : : OnDeviceChanged ( ) <nl> void CPeripherals : : RegisterJoystickButtonMapper ( IButtonMapper * mapper ) <nl> GetPeripheralsWithFeature ( peripherals , FEATURE_JOYSTICK ) ; <nl> <nl> for ( auto & peripheral : peripherals ) <nl> + { <nl> + if ( mapper - > Emulation ( ) ) <nl> + { <nl> + if ( peripheral - > Type ( ) ! = PERIPHERAL_JOYSTICK_EMULATION ) <nl> + continue ; <nl> + <nl> + unsigned int controllerNumber = std : : static_pointer_cast < CPeripheralJoystickEmulation > ( peripheral ) - > ControllerNumber ( ) ; <nl> + <nl> + if ( mapper - > ControllerNumber ( ) ! = controllerNumber ) <nl> + continue ; <nl> + } <nl> + else <nl> + { <nl> + if ( peripheral - > Type ( ) ! = PERIPHERAL_JOYSTICK ) <nl> + continue ; <nl> + } <nl> + <nl> peripheral - > RegisterJoystickButtonMapper ( mapper ) ; <nl> + } <nl> } <nl> <nl> void CPeripherals : : UnregisterJoystickButtonMapper ( IButtonMapper * mapper ) <nl> mmm a / xbmc / peripherals / addons / PeripheralAddon . cpp <nl> ppp b / xbmc / peripherals / addons / PeripheralAddon . cpp <nl> <nl> # include " peripherals / Peripherals . h " <nl> # include " peripherals / bus / virtual / PeripheralBusAddon . h " <nl> # include " peripherals / devices / PeripheralJoystick . h " <nl> + # include " peripherals / devices / PeripheralJoystickEmulation . h " <nl> # include " settings / Settings . h " <nl> # include " threads / SingleLock . h " <nl> # include " utils / log . h " <nl> using namespace JOYSTICK ; <nl> using namespace PERIPHERALS ; <nl> using namespace XFILE ; <nl> <nl> + # define JOYSTICK_EMULATION_BUTTON_MAP_NAME " Keyboard " <nl> + # define JOYSTICK_EMULATION_PROVIDER " application " <nl> + <nl> # ifndef SAFE_DELETE <nl> # define SAFE_DELETE ( p ) do { delete ( p ) ; ( p ) = NULL ; } while ( 0 ) <nl> # endif <nl> void CPeripheralAddon : : RefreshButtonMaps ( const std : : string & strDeviceName / * = " <nl> <nl> void CPeripheralAddon : : GetPeripheralInfo ( const CPeripheral * device , ADDON : : Peripheral & peripheralInfo ) <nl> { <nl> + peripheralInfo . SetType ( CPeripheralAddonTranslator : : TranslateType ( device - > Type ( ) ) ) ; <nl> peripheralInfo . SetName ( device - > DeviceName ( ) ) ; <nl> peripheralInfo . SetVendorID ( device - > VendorId ( ) ) ; <nl> peripheralInfo . SetProductID ( device - > ProductId ( ) ) ; <nl> void CPeripheralAddon : : GetJoystickInfo ( const CPeripheral * device , ADDON : : Joystic <nl> joystickInfo . SetMotorCount ( joystick - > MotorCount ( ) ) ; <nl> joystickInfo . SetSupportsPowerOff ( joystick - > SupportsPowerOff ( ) ) ; <nl> } <nl> + else if ( device - > Type ( ) = = PERIPHERAL_JOYSTICK_EMULATION ) <nl> + { <nl> + const CPeripheralJoystickEmulation * joystick = static_cast < const CPeripheralJoystickEmulation * > ( device ) ; <nl> + joystickInfo . SetName ( JOYSTICK_EMULATION_BUTTON_MAP_NAME ) ; / / Override name with non - localized version <nl> + joystickInfo . SetProvider ( JOYSTICK_EMULATION_PROVIDER ) ; <nl> + joystickInfo . SetIndex ( joystick - > ControllerNumber ( ) ) ; <nl> + } <nl> } <nl> <nl> void CPeripheralAddon : : SetJoystickInfo ( CPeripheralJoystick & joystick , const ADDON : : Joystick & joystickInfo ) <nl> mmm a / xbmc / peripherals / addons / PeripheralAddonTranslator . cpp <nl> ppp b / xbmc / peripherals / addons / PeripheralAddonTranslator . cpp <nl> const char * CPeripheralAddonTranslator : : TranslateError ( const PERIPHERAL_ERROR er <nl> } <nl> } <nl> <nl> + PeripheralType CPeripheralAddonTranslator : : TranslateType ( PERIPHERAL_TYPE type ) <nl> + { <nl> + switch ( type ) <nl> + { <nl> + case PERIPHERAL_TYPE_JOYSTICK : <nl> + return PERIPHERAL_JOYSTICK ; <nl> + case PERIPHERAL_TYPE_KEYBOARD : <nl> + return PERIPHERAL_JOYSTICK_EMULATION ; <nl> + default : <nl> + break ; <nl> + } <nl> + return PERIPHERAL_UNKNOWN ; <nl> + } <nl> + <nl> + PERIPHERAL_TYPE CPeripheralAddonTranslator : : TranslateType ( PeripheralType type ) <nl> + { <nl> + switch ( type ) <nl> + { <nl> + case PERIPHERAL_JOYSTICK : <nl> + return PERIPHERAL_TYPE_JOYSTICK ; <nl> + case PERIPHERAL_JOYSTICK_EMULATION : <nl> + return PERIPHERAL_TYPE_KEYBOARD ; <nl> + default : <nl> + break ; <nl> + } <nl> + return PERIPHERAL_TYPE_UNKNOWN ; <nl> + } <nl> + <nl> CDriverPrimitive CPeripheralAddonTranslator : : TranslatePrimitive ( const ADDON : : DriverPrimitive & primitive ) <nl> { <nl> CDriverPrimitive retVal ; <nl> mmm a / xbmc / peripherals / addons / PeripheralAddonTranslator . h <nl> ppp b / xbmc / peripherals / addons / PeripheralAddonTranslator . h <nl> <nl> # include " addons / kodi - addon - dev - kit / include / kodi / kodi_peripheral_utils . hpp " <nl> # include " input / joysticks / DriverPrimitive . h " <nl> # include " input / joysticks / JoystickTypes . h " <nl> + # include " peripherals / PeripheralTypes . h " <nl> <nl> # include < vector > <nl> <nl> namespace PERIPHERALS <nl> public : <nl> static const char * TranslateError ( PERIPHERAL_ERROR error ) ; <nl> <nl> + static PeripheralType TranslateType ( PERIPHERAL_TYPE type ) ; <nl> + static PERIPHERAL_TYPE TranslateType ( PeripheralType type ) ; <nl> + <nl> static JOYSTICK : : CDriverPrimitive TranslatePrimitive ( const ADDON : : DriverPrimitive & primitive ) ; <nl> static ADDON : : DriverPrimitive TranslatePrimitive ( const JOYSTICK : : CDriverPrimitive & primitive ) ; <nl> <nl> mmm a / xbmc / peripherals / bus / Makefile . in <nl> ppp b / xbmc / peripherals / bus / Makefile . in <nl> <nl> SRCS = PeripheralBus . cpp <nl> SRCS + = virtual / PeripheralBusAddon . cpp <nl> + SRCS + = virtual / PeripheralBusApplication . cpp <nl> <nl> ifeq ( @ USE_ANDROID @ , 1 ) <nl> SRCS + = android / AndroidJoystickState . cpp <nl> mmm a / xbmc / peripherals / bus / virtual / CMakeLists . txt <nl> ppp b / xbmc / peripherals / bus / virtual / CMakeLists . txt <nl> <nl> - set ( SOURCES PeripheralBusAddon . cpp ) <nl> + set ( SOURCES PeripheralBusAddon . cpp <nl> + PeripheralBusApplication . cpp ) <nl> <nl> - set ( HEADERS PeripheralBusAddon . h ) <nl> + set ( HEADERS PeripheralBusAddon . h <nl> + PeripheralBusApplication . h ) <nl> <nl> if ( CEC_FOUND ) <nl> list ( APPEND SOURCES PeripheralBusCEC . cpp ) <nl> new file mode 100644 <nl> index 000000000000 . . 28c8194b8110 <nl> mmm / dev / null <nl> ppp b / xbmc / peripherals / bus / virtual / PeripheralBusApplication . cpp <nl> <nl> + / * <nl> + * Copyright ( C ) 2015 - 2016 Team Kodi <nl> + * http : / / kodi . tv <nl> + * <nl> + * This Program is free software ; you can redistribute it and / or modify <nl> + * it under the terms of the GNU General Public License as published by <nl> + * the Free Software Foundation ; either version 2 , or ( at your option ) <nl> + * any later version . <nl> + * <nl> + * This Program is distributed in the hope that it will be useful , <nl> + * but WITHOUT ANY WARRANTY ; without even the implied warranty of <nl> + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE . See the <nl> + * GNU General Public License for more details . <nl> + * <nl> + * You should have received a copy of the GNU General Public License <nl> + * along with this Program ; see the file COPYING . If not , see <nl> + * < http : / / www . gnu . org / licenses / > . <nl> + * <nl> + * / <nl> + <nl> + # include " PeripheralBusApplication . h " <nl> + # include " guilib / LocalizeStrings . h " <nl> + # include " settings / Settings . h " <nl> + # include " utils / StringUtils . h " <nl> + <nl> + using namespace PERIPHERALS ; <nl> + <nl> + CPeripheralBusApplication : : CPeripheralBusApplication ( CPeripherals * manager ) : <nl> + CPeripheralBus ( " PeripBusApplication " , manager , PERIPHERAL_BUS_APPLICATION ) <nl> + { <nl> + / / Initialize CPeripheralBus <nl> + m_bNeedsPolling = false ; <nl> + } <nl> + <nl> + void CPeripheralBusApplication : : Initialise ( void ) <nl> + { <nl> + CPeripheralBus : : Initialise ( ) ; <nl> + TriggerDeviceScan ( ) ; <nl> + } <nl> + <nl> + bool CPeripheralBusApplication : : PerformDeviceScan ( PeripheralScanResults & results ) <nl> + { <nl> + const unsigned int controllerCount = CSettings : : GetInstance ( ) . GetInt ( CSettings : : SETTING_GAMES_KEYBOARD_PLAYERS ) ; <nl> + <nl> + for ( unsigned int i = 1 ; i < = controllerCount ; i + + ) <nl> + { <nl> + PeripheralScanResult result ( Type ( ) ) ; <nl> + result . m_type = PERIPHERAL_JOYSTICK_EMULATION ; <nl> + result . m_strDeviceName = g_localizeStrings . Get ( 35165 ) ; / / " Keyboard player " <nl> + result . m_strLocation = MakeLocation ( i ) ; <nl> + result . m_iVendorId = 0 ; <nl> + result . m_iProductId = 0 ; <nl> + result . m_mappedType = PERIPHERAL_JOYSTICK_EMULATION ; <nl> + result . m_mappedBusType = Type ( ) ; <nl> + result . m_iSequence = 0 ; <nl> + <nl> + if ( ! results . ContainsResult ( result ) ) <nl> + results . m_results . push_back ( result ) ; <nl> + } <nl> + <nl> + return true ; <nl> + } <nl> + <nl> + void CPeripheralBusApplication : : GetDirectory ( const std : : string & strPath , CFileItemList & items ) const <nl> + { <nl> + / / Don ' t list emulated joysticks in the GUI <nl> + } <nl> + <nl> + std : : string CPeripheralBusApplication : : MakeLocation ( unsigned int controllerIndex ) const <nl> + { <nl> + return StringUtils : : Format ( " % u " , controllerIndex ) ; <nl> + } <nl> new file mode 100644 <nl> index 000000000000 . . 3b88c2aa5816 <nl> mmm / dev / null <nl> ppp b / xbmc / peripherals / bus / virtual / PeripheralBusApplication . h <nl> <nl> + / * <nl> + * Copyright ( C ) 2015 - 2016 Team Kodi <nl> + * http : / / kodi . tv <nl> + * <nl> + * This Program is free software ; you can redistribute it and / or modify <nl> + * it under the terms of the GNU General Public License as published by <nl> + * the Free Software Foundation ; either version 2 , or ( at your option ) <nl> + * any later version . <nl> + * <nl> + * This Program is distributed in the hope that it will be useful , <nl> + * but WITHOUT ANY WARRANTY ; without even the implied warranty of <nl> + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE . See the <nl> + * GNU General Public License for more details . <nl> + * <nl> + * You should have received a copy of the GNU General Public License <nl> + * along with this Program ; see the file COPYING . If not , see <nl> + * < http : / / www . gnu . org / licenses / > . <nl> + * <nl> + * / <nl> + # pragma once <nl> + <nl> + # include " peripherals / bus / PeripheralBus . h " <nl> + <nl> + namespace PERIPHERALS <nl> + { <nl> + / * ! <nl> + * @ class CPeripheralBusApplication <nl> + * <nl> + * This exposes peripherals that exist logically at the application level , <nl> + * such as emulated joysticks . <nl> + * / <nl> + class CPeripheralBusApplication : public CPeripheralBus <nl> + { <nl> + public : <nl> + CPeripheralBusApplication ( CPeripherals * manager ) ; <nl> + virtual ~ CPeripheralBusApplication ( void ) { } <nl> + <nl> + / / implementation of CPeripheralBus <nl> + virtual void Initialise ( void ) override ; <nl> + virtual void GetDirectory ( const std : : string & strPath , CFileItemList & items ) const override ; <nl> + <nl> + / * ! <nl> + * \ brief Get the location for the specified controller index <nl> + * / <nl> + std : : string MakeLocation ( unsigned int controllerIndex ) const ; <nl> + <nl> + protected : <nl> + / / implementation of CPeripheralBus <nl> + virtual bool PerformDeviceScan ( PeripheralScanResults & results ) override ; <nl> + } ; <nl> + } <nl> mmm a / xbmc / peripherals / devices / CMakeLists . txt <nl> ppp b / xbmc / peripherals / devices / CMakeLists . txt <nl> set ( SOURCES Peripheral . cpp <nl> PeripheralHID . cpp <nl> PeripheralImon . cpp <nl> PeripheralJoystick . cpp <nl> + PeripheralJoystickEmulation . cpp <nl> PeripheralNIC . cpp <nl> PeripheralNyxboard . cpp <nl> PeripheralTuner . cpp ) <nl> set ( HEADERS Peripheral . h <nl> PeripheralHID . h <nl> PeripheralImon . h <nl> PeripheralJoystick . h <nl> + PeripheralJoystickEmulation . h <nl> PeripheralNIC . h <nl> PeripheralNyxboard . h <nl> PeripheralTuner . h ) <nl> mmm a / xbmc / peripherals / devices / Makefile . in <nl> ppp b / xbmc / peripherals / devices / Makefile . in <nl> SRCS + = PeripheralDisk . cpp <nl> SRCS + = PeripheralHID . cpp <nl> SRCS + = PeripheralImon . cpp <nl> SRCS + = PeripheralJoystick . cpp <nl> + SRCS + = PeripheralJoystickEmulation . cpp <nl> SRCS + = PeripheralNIC . cpp <nl> SRCS + = PeripheralNyxboard . cpp <nl> SRCS + = PeripheralTuner . cpp <nl> new file mode 100644 <nl> index 000000000000 . . dceadeb47883 <nl> mmm / dev / null <nl> ppp b / xbmc / peripherals / devices / PeripheralJoystickEmulation . cpp <nl> <nl> + / * <nl> + * Copyright ( C ) 2015 - 2016 Team Kodi <nl> + * http : / / kodi . tv <nl> + * <nl> + * This Program is free software ; you can redistribute it and / or modify <nl> + * it under the terms of the GNU General Public License as published by <nl> + * the Free Software Foundation ; either version 2 , or ( at your option ) <nl> + * any later version . <nl> + * <nl> + * This Program is distributed in the hope that it will be useful , <nl> + * but WITHOUT ANY WARRANTY ; without even the implied warranty of <nl> + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE . See the <nl> + * GNU General Public License for more details . <nl> + * <nl> + * You should have received a copy of the GNU General Public License <nl> + * along with this Program ; see the file COPYING . If not , see <nl> + * < http : / / www . gnu . org / licenses / > . <nl> + * <nl> + * / <nl> + <nl> + # include " PeripheralJoystickEmulation . h " <nl> + # include " input / keyboard / generic / JoystickEmulation . h " <nl> + # include " input / InputManager . h " <nl> + # include " threads / SingleLock . h " <nl> + <nl> + # include < sstream > <nl> + <nl> + using namespace PERIPHERALS ; <nl> + <nl> + CPeripheralJoystickEmulation : : CPeripheralJoystickEmulation ( const PeripheralScanResult & scanResult , CPeripheralBus * bus ) : <nl> + CPeripheral ( scanResult , bus ) <nl> + { <nl> + m_features . push_back ( FEATURE_JOYSTICK ) ; <nl> + } <nl> + <nl> + CPeripheralJoystickEmulation : : ~ CPeripheralJoystickEmulation ( void ) <nl> + { <nl> + CInputManager : : GetInstance ( ) . UnregisterKeyboardHandler ( this ) ; <nl> + } <nl> + <nl> + bool CPeripheralJoystickEmulation : : InitialiseFeature ( const PeripheralFeature feature ) <nl> + { <nl> + bool bSuccess = false ; <nl> + <nl> + if ( CPeripheral : : InitialiseFeature ( feature ) ) <nl> + { <nl> + if ( feature = = FEATURE_JOYSTICK ) <nl> + { <nl> + CInputManager : : GetInstance ( ) . RegisterKeyboardHandler ( this ) ; <nl> + } <nl> + bSuccess = true ; <nl> + } <nl> + <nl> + return bSuccess ; <nl> + } <nl> + <nl> + void CPeripheralJoystickEmulation : : RegisterJoystickDriverHandler ( JOYSTICK : : IDriverHandler * handler , bool bPromiscuous ) <nl> + { <nl> + using namespace KEYBOARD ; <nl> + <nl> + CSingleLock lock ( m_mutex ) ; <nl> + <nl> + if ( m_keyboardHandlers . find ( handler ) = = m_keyboardHandlers . end ( ) ) <nl> + m_keyboardHandlers [ handler ] = KeyboardHandle { new CJoystickEmulation ( handler ) , bPromiscuous } ; <nl> + } <nl> + <nl> + void CPeripheralJoystickEmulation : : UnregisterJoystickDriverHandler ( JOYSTICK : : IDriverHandler * handler ) <nl> + { <nl> + CSingleLock lock ( m_mutex ) ; <nl> + <nl> + KeyboardHandlers : : iterator it = m_keyboardHandlers . find ( handler ) ; <nl> + if ( it ! = m_keyboardHandlers . end ( ) ) <nl> + { <nl> + delete it - > second . handler ; <nl> + m_keyboardHandlers . erase ( it ) ; <nl> + } <nl> + } <nl> + <nl> + bool CPeripheralJoystickEmulation : : OnKeyPress ( const CKey & key ) <nl> + { <nl> + CSingleLock lock ( m_mutex ) ; <nl> + <nl> + bool bHandled = false ; <nl> + <nl> + / / Process promiscuous handlers <nl> + for ( KeyboardHandlers : : iterator it = m_keyboardHandlers . begin ( ) ; it ! = m_keyboardHandlers . end ( ) ; + + it ) <nl> + { <nl> + if ( it - > second . bPromiscuous ) <nl> + it - > second . handler - > OnKeyPress ( key ) ; <nl> + } <nl> + <nl> + / / Process handlers until one is handled <nl> + for ( KeyboardHandlers : : iterator it = m_keyboardHandlers . begin ( ) ; it ! = m_keyboardHandlers . end ( ) ; + + it ) <nl> + { <nl> + if ( ! it - > second . bPromiscuous ) <nl> + { <nl> + bHandled = it - > second . handler - > OnKeyPress ( key ) ; <nl> + if ( bHandled ) <nl> + break ; <nl> + } <nl> + } <nl> + <nl> + return bHandled ; <nl> + } <nl> + <nl> + void CPeripheralJoystickEmulation : : OnKeyRelease ( const CKey & key ) <nl> + { <nl> + CSingleLock lock ( m_mutex ) ; <nl> + <nl> + for ( KeyboardHandlers : : iterator it = m_keyboardHandlers . begin ( ) ; it ! = m_keyboardHandlers . end ( ) ; + + it ) <nl> + it - > second . handler - > OnKeyRelease ( key ) ; <nl> + } <nl> + <nl> + unsigned int CPeripheralJoystickEmulation : : ControllerNumber ( void ) const <nl> + { <nl> + unsigned int number ; <nl> + std : : istringstream str ( m_strLocation ) ; <nl> + str > > number ; <nl> + return number ; <nl> + } <nl> new file mode 100644 <nl> index 000000000000 . . 1d22a63e8ed4 <nl> mmm / dev / null <nl> ppp b / xbmc / peripherals / devices / PeripheralJoystickEmulation . h <nl> <nl> + / * <nl> + * Copyright ( C ) 2015 - 2016 Team Kodi <nl> + * http : / / kodi . tv <nl> + * <nl> + * This Program is free software ; you can redistribute it and / or modify <nl> + * it under the terms of the GNU General Public License as published by <nl> + * the Free Software Foundation ; either version 2 , or ( at your option ) <nl> + * any later version . <nl> + * <nl> + * This Program is distributed in the hope that it will be useful , <nl> + * but WITHOUT ANY WARRANTY ; without even the implied warranty of <nl> + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE . See the <nl> + * GNU General Public License for more details . <nl> + * <nl> + * You should have received a copy of the GNU General Public License <nl> + * along with this Program ; see the file COPYING . If not , see <nl> + * < http : / / www . gnu . org / licenses / > . <nl> + * <nl> + * / <nl> + # pragma once <nl> + <nl> + # include " Peripheral . h " <nl> + # include " input / keyboard / IKeyboardHandler . h " <nl> + # include " threads / CriticalSection . h " <nl> + <nl> + namespace PERIPHERALS <nl> + { <nl> + class CPeripheralJoystickEmulation : public CPeripheral , <nl> + public KEYBOARD : : IKeyboardHandler <nl> + { <nl> + public : <nl> + CPeripheralJoystickEmulation ( const PeripheralScanResult & scanResult , CPeripheralBus * bus ) ; <nl> + <nl> + virtual ~ CPeripheralJoystickEmulation ( void ) ; <nl> + <nl> + / / implementation of CPeripheral <nl> + virtual bool InitialiseFeature ( const PeripheralFeature feature ) override ; <nl> + virtual void RegisterJoystickDriverHandler ( JOYSTICK : : IDriverHandler * handler , bool bPromiscuous ) override ; <nl> + virtual void UnregisterJoystickDriverHandler ( JOYSTICK : : IDriverHandler * handler ) override ; <nl> + <nl> + / / implementation of IKeyboardHandler <nl> + virtual bool OnKeyPress ( const CKey & key ) override ; <nl> + virtual void OnKeyRelease ( const CKey & key ) override ; <nl> + <nl> + / * ! <nl> + * \ brief Number of the emulated controller ( 1 - indexed ) <nl> + * / <nl> + unsigned int ControllerNumber ( void ) const ; <nl> + <nl> + private : <nl> + struct KeyboardHandle <nl> + { <nl> + KEYBOARD : : IKeyboardHandler * handler ; <nl> + bool bPromiscuous ; <nl> + } ; <nl> + <nl> + typedef std : : map < JOYSTICK : : IDriverHandler * , KeyboardHandle > KeyboardHandlers ; <nl> + <nl> + KeyboardHandlers m_keyboardHandlers ; <nl> + CCriticalSection m_mutex ; <nl> + } ; <nl> + } <nl> mmm a / xbmc / settings / Settings . cpp <nl> ppp b / xbmc / settings / Settings . cpp <nl> const std : : string CSettings : : SETTING_GENERAL_ADDONBROKENFILTER = " general . addonb <nl> const std : : string CSettings : : SETTING_SOURCE_VIDEOS = " source . videos " ; <nl> const std : : string CSettings : : SETTING_SOURCE_MUSIC = " source . music " ; <nl> const std : : string CSettings : : SETTING_SOURCE_PICTURES = " source . pictures " ; <nl> + const std : : string CSettings : : SETTING_GAMES_KEYBOARD_PLAYERS = " gameskeyboard . keyboardplayers " ; <nl> + const std : : string CSettings : : SETTING_GAMES_KEYBOARD_PLAYERCONFIG_1 = " gameskeyboard . keyboardplayerconfig1 " ; <nl> + const std : : string CSettings : : SETTING_GAMES_KEYBOARD_PLAYERCONFIG_2 = " gameskeyboard . keyboardplayerconfig2 " ; <nl> + const std : : string CSettings : : SETTING_GAMES_KEYBOARD_PLAYERCONFIG_3 = " gameskeyboard . keyboardplayerconfig3 " ; <nl> + const std : : string CSettings : : SETTING_GAMES_KEYBOARD_PLAYERCONFIG_4 = " gameskeyboard . keyboardplayerconfig4 " ; <nl> + const std : : string CSettings : : SETTING_GAMES_KEYBOARD_PLAYERCONFIG_5 = " gameskeyboard . keyboardplayerconfig5 " ; <nl> + const std : : string CSettings : : SETTING_GAMES_KEYBOARD_PLAYERCONFIG_6 = " gameskeyboard . keyboardplayerconfig6 " ; <nl> + const std : : string CSettings : : SETTING_GAMES_KEYBOARD_PLAYERCONFIG_7 = " gameskeyboard . keyboardplayerconfig7 " ; <nl> + const std : : string CSettings : : SETTING_GAMES_KEYBOARD_PLAYERCONFIG_8 = " gameskeyboard . keyboardplayerconfig8 " ; <nl> <nl> CSettings : : CSettings ( ) <nl> : m_initialized ( false ) <nl> void CSettings : : InitializeISettingCallbacks ( ) <nl> m_settingsManager - > RegisterCallback ( & CWakeOnAccess : : GetInstance ( ) , settingSet ) ; <nl> <nl> settingSet . clear ( ) ; <nl> + settingSet . insert ( CSettings : : SETTING_GAMES_KEYBOARD_PLAYERS ) ; <nl> + settingSet . insert ( CSettings : : SETTING_GAMES_KEYBOARD_PLAYERCONFIG_1 ) ; <nl> + settingSet . insert ( CSettings : : SETTING_GAMES_KEYBOARD_PLAYERCONFIG_2 ) ; <nl> + settingSet . insert ( CSettings : : SETTING_GAMES_KEYBOARD_PLAYERCONFIG_3 ) ; <nl> + settingSet . insert ( CSettings : : SETTING_GAMES_KEYBOARD_PLAYERCONFIG_4 ) ; <nl> + settingSet . insert ( CSettings : : SETTING_GAMES_KEYBOARD_PLAYERCONFIG_5 ) ; <nl> + settingSet . insert ( CSettings : : SETTING_GAMES_KEYBOARD_PLAYERCONFIG_6 ) ; <nl> + settingSet . insert ( CSettings : : SETTING_GAMES_KEYBOARD_PLAYERCONFIG_7 ) ; <nl> + settingSet . insert ( CSettings : : SETTING_GAMES_KEYBOARD_PLAYERCONFIG_8 ) ; <nl> m_settingsManager - > RegisterCallback ( & GAME : : CGameSettings : : GetInstance ( ) , settingSet ) ; <nl> } <nl> <nl> mmm a / xbmc / settings / Settings . h <nl> ppp b / xbmc / settings / Settings . h <nl> class CSettings : public CSettingCreator , public CSettingControlCreator <nl> static const std : : string SETTING_SOURCE_VIDEOS ; <nl> static const std : : string SETTING_SOURCE_MUSIC ; <nl> static const std : : string SETTING_SOURCE_PICTURES ; <nl> + static const std : : string SETTING_GAMES_KEYBOARD_PLAYERS ; <nl> + static const std : : string SETTING_GAMES_KEYBOARD_PLAYERCONFIG_1 ; <nl> + static const std : : string SETTING_GAMES_KEYBOARD_PLAYERCONFIG_2 ; <nl> + static const std : : string SETTING_GAMES_KEYBOARD_PLAYERCONFIG_3 ; <nl> + static const std : : string SETTING_GAMES_KEYBOARD_PLAYERCONFIG_4 ; <nl> + static const std : : string SETTING_GAMES_KEYBOARD_PLAYERCONFIG_5 ; <nl> + static const std : : string SETTING_GAMES_KEYBOARD_PLAYERCONFIG_6 ; <nl> + static const std : : string SETTING_GAMES_KEYBOARD_PLAYERCONFIG_7 ; <nl> + static const std : : string SETTING_GAMES_KEYBOARD_PLAYERCONFIG_8 ; <nl> <nl> / * ! <nl> \ brief Creates a new settings wrapper around a new settings manager . <nl>
[ retroplayer ] Keyboard players
xbmc/xbmc
8c3c1fa99052c5a87fe64059591afbc01c69f6cd
2016-12-02T01:34:48Z
mmm a / Code / Sandbox / EditorQt / CMakeLists . txt <nl> ppp b / Code / Sandbox / EditorQt / CMakeLists . txt <nl> add_sources ( " Editor_Uber_Material . cpp " <nl> " Material / MaterialBrowser . h " <nl> " Material / MaterialDialog . cpp " <nl> " Material / MaterialDialog . h " <nl> - " Material / StandaloneMaterialEditor . cpp " <nl> - " Material / StandaloneMaterialEditor . h " <nl> " Material / MaterialFXGraphMan . cpp " <nl> " Material / MaterialFXGraphMan . h " <nl> " Material / MaterialImageListCtrl . cpp " <nl> mmm a / Code / Sandbox / EditorQt / Material / MaterialManager . cpp <nl> ppp b / Code / Sandbox / EditorQt / Material / MaterialManager . cpp <nl> <nl> # include < Preferences / ViewportPreferences . h > <nl> # include < QAbstractNativeEventFilter > <nl> # include < QApplication > <nl> + # include " QT / QToolTabManager . h " <nl> + # include " AssetSystem / Browser / AssetBrowserDialog . h " <nl> + <nl> + namespace Private_MaterialManager <nl> + { <nl> + <nl> + / / Returns the path relative to the assets root directory or just the file name if the path does not belong to the root . <nl> + string ResolveToGamePath ( string maxFile ) <nl> + { <nl> + maxFile = PathUtil : : ToUnixPath ( maxFile ) ; <nl> + const string maxFileRelative = PathUtil : : ToGamePath ( maxFile ) ; <nl> + return maxFileRelative ! = maxFile ? maxFileRelative : PathUtil : : GetFile ( maxFileRelative ) ; <nl> + } <nl> + <nl> + } <nl> <nl> static const char * MATERIALS_LIBS_PATH = " Materials / " ; <nl> static unsigned int s_highlightUpdateCounter = 0 ; <nl> REGISTER_PYTHON_OVERLOAD_COMMAND ( PyGetMaterials , general , get_materials , pyGetMa <nl> " Get all , subgroup , or selected materials in the material editor . " , <nl> " general . get_materials ( str materialName = \ ' \ ' , selectedOnly = False , levelOnly = False ) " ) ; <nl> <nl> - / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / <nl> - / / CMaterialManager implementation . <nl> - / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / <nl> CMaterialManager : : CMaterialManager ( ) <nl> : m_pHighlighter ( new CMaterialHighlighter ) <nl> , m_highlightMask ( eHighlight_All & ~ ( eHighlight_Breakable | eHighlight_NoSurfaceType ) ) <nl> CMaterialManager : : CMaterialManager ( ) <nl> gViewportDebugPreferences . debugFlagsChanged . Connect ( this , & CMaterialManager : : OnDebugFlagsChanged ) ; <nl> } <nl> <nl> - / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / <nl> CMaterialManager : : ~ CMaterialManager ( ) <nl> { <nl> gViewportDebugPreferences . debugFlagsChanged . DisconnectObject ( this ) ; <nl> CMaterialManager : : ~ CMaterialManager ( ) <nl> } <nl> } <nl> <nl> - / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / <nl> void CMaterialManager : : ClearAll ( ) <nl> { <nl> SetCurrentMaterial ( NULL ) ; <nl> void CMaterialManager : : ClearAll ( ) <nl> m_pLevelLibrary - > SetLevelLibrary ( true ) ; <nl> } <nl> <nl> - / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / <nl> CMaterial * CMaterialManager : : CreateMaterial ( const string & sMaterialName , XmlNodeRef & node , int nMtlFlags , unsigned long nLoadingFlags ) <nl> { <nl> CMaterial * pMaterial = new CMaterial ( sMaterialName , nMtlFlags ) ; <nl> CMaterial * CMaterialManager : : CreateMaterial ( const string & sMaterialName , XmlNode <nl> return pMaterial ; <nl> } <nl> <nl> - / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / <nl> CMaterial * CMaterialManager : : CreateMaterial ( const char * sMaterialName , XmlNodeRef & node , int nMtlFlags , unsigned long nLoadingFlags ) <nl> { <nl> return CreateMaterial ( string ( sMaterialName ) , node , nMtlFlags , nLoadingFlags ) ; <nl> } <nl> <nl> - / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / <nl> void CMaterialManager : : Export ( XmlNodeRef & node ) <nl> { <nl> XmlNodeRef libs = node - > newChild ( " MaterialsLibrary " ) ; <nl> void CMaterialManager : : Export ( XmlNodeRef & node ) <nl> } <nl> } <nl> <nl> - / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / <nl> int CMaterialManager : : ExportLib ( CMaterialLibrary * pLib , XmlNodeRef & libNode ) <nl> { <nl> int num = 0 ; <nl> int CMaterialManager : : ExportLib ( CMaterialLibrary * pLib , XmlNodeRef & libNode ) <nl> return num ; <nl> } <nl> <nl> - / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / <nl> void CMaterialManager : : SetSelectedItem ( IDataBaseItem * pItem ) <nl> { <nl> m_pSelectedItem = ( CBaseLibraryItem * ) pItem ; <nl> SetCurrentMaterial ( ( CMaterial * ) pItem ) ; <nl> } <nl> <nl> - / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / <nl> void CMaterialManager : : SetCurrentMaterial ( CMaterial * pMtl ) <nl> { <nl> if ( m_pCurrentMaterial ) <nl> void CMaterialManager : : SetCurrentMaterial ( CMaterial * pMtl ) <nl> NotifyItemEvent ( m_pCurrentMaterial , EDB_ITEM_EVENT_SELECTED ) ; <nl> } <nl> <nl> - / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / <nl> void CMaterialManager : : SetCurrentFolder ( const string & folder ) <nl> { <nl> m_currentFolder = folder ; <nl> } <nl> <nl> - / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / <nl> void CMaterialManager : : SetMarkedMaterials ( const std : : vector < _smart_ptr < CMaterial > > & markedMaterials ) <nl> { <nl> m_markedMaterials = markedMaterials ; <nl> void CMaterialManager : : OnLoadShader ( CMaterial * pMaterial ) <nl> AddForHighlighting ( pMaterial ) ; <nl> } <nl> <nl> - / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / <nl> CMaterial * CMaterialManager : : GetCurrentMaterial ( ) const <nl> { <nl> return m_pCurrentMaterial ; <nl> } <nl> <nl> - / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / <nl> CBaseLibraryItem * CMaterialManager : : MakeNewItem ( ) <nl> { <nl> CMaterial * pMaterial = new CMaterial ( " " , 0 ) ; <nl> return pMaterial ; <nl> } <nl> - / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / <nl> + <nl> CBaseLibrary * CMaterialManager : : MakeNewLibrary ( ) <nl> { <nl> return new CMaterialLibrary ( this ) ; <nl> } <nl> - / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / <nl> + <nl> string CMaterialManager : : GetRootNodeName ( ) <nl> { <nl> return " MaterialsLibs " ; <nl> } <nl> - / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / <nl> + <nl> string CMaterialManager : : GetLibsPath ( ) <nl> { <nl> if ( m_libsPath . IsEmpty ( ) ) <nl> string CMaterialManager : : GetLibsPath ( ) <nl> return m_libsPath ; <nl> } <nl> <nl> - / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / <nl> void CMaterialManager : : ReportDuplicateItem ( CBaseLibraryItem * pItem , CBaseLibraryItem * pOldItem ) <nl> { <nl> string sLibName ; <nl> void CMaterialManager : : ReportDuplicateItem ( CBaseLibraryItem * pItem , CBaseLibrary <nl> ( const char * ) pItem - > GetName ( ) , ( const char * ) pOldItem - > GetName ( ) ) ; <nl> } <nl> <nl> - / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / <nl> void CMaterialManager : : Serialize ( XmlNodeRef & node , bool bLoading ) <nl> { <nl> / / CBaseLibraryManager : : Serialize ( node , bLoading ) ; <nl> struct SMaterialManagerFilter : QAbstractNativeEventFilter <nl> return false ; <nl> } <nl> <nl> - const CWnd * const pDlg = GetIEditorImpl ( ) - > OpenView ( " Material Editor Legacy " ) ; <nl> - if ( pDlg ) <nl> - { <nl> - GetIEditorImpl ( ) - > GetMaterialManager ( ) - > SyncMaterialEditor ( ) ; <nl> + GetIEditorImpl ( ) - > GetMaterialManager ( ) - > SyncMaterialEditor ( ) ; <nl> <nl> - if ( pResult ) <nl> - { <nl> - * pResult = 0 ; <nl> - } <nl> - <nl> - return true ; <nl> + if ( pResult ) <nl> + { <nl> + * pResult = 0 ; <nl> } <nl> <nl> - return false ; <nl> + return true ; <nl> } <nl> <nl> static SMaterialManagerFilter & GetInstance ( ) <nl> struct SMaterialManagerFilter : QAbstractNativeEventFilter <nl> <nl> } / / namespace <nl> <nl> - / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / <nl> void CMaterialManager : : OnEditorNotifyEvent ( EEditorNotifyEvent event ) <nl> { <nl> CBaseLibraryManager : : OnEditorNotifyEvent ( event ) ; <nl> void CMaterialManager : : OnEditorNotifyEvent ( EEditorNotifyEvent event ) <nl> } <nl> } <nl> <nl> - / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / <nl> CMaterial * CMaterialManager : : LoadMaterial ( const string & sMaterialName , bool bMakeIfNotFound ) <nl> { <nl> LOADING_TIME_PROFILE_SECTION ( GetISystem ( ) ) ; <nl> CMaterial * CMaterialManager : : LoadMaterial ( const string & sMaterialName , bool bMak <nl> return pMaterial ; <nl> } <nl> <nl> - / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / <nl> CMaterial * CMaterialManager : : LoadMaterial ( const char * sMaterialName , bool bMakeIfNotFound ) <nl> { <nl> return LoadMaterial ( string ( sMaterialName ) , bMakeIfNotFound ) ; <nl> } <nl> <nl> - / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / <nl> static bool MaterialRequiresSurfaceType ( CMaterial * pMaterial ) <nl> { <nl> / / Do not enforce Surface Type . . . <nl> static bool MaterialRequiresSurfaceType ( CMaterial * pMaterial ) <nl> return true ; <nl> } <nl> <nl> - / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / <nl> int CMaterialManager : : GetHighlightFlags ( CMaterial * pMaterial ) const <nl> { <nl> if ( pMaterial = = NULL ) <nl> int CMaterialManager : : GetHighlightFlags ( CMaterial * pMaterial ) const <nl> return result ; <nl> } <nl> <nl> - / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / <nl> void CMaterialManager : : AddForHighlighting ( CMaterial * pMaterial ) <nl> { <nl> if ( pMaterial = = NULL ) <nl> void CMaterialManager : : AddForHighlighting ( CMaterial * pMaterial ) <nl> } <nl> } <nl> <nl> - / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / <nl> void CMaterialManager : : RemoveFromHighlighting ( CMaterial * pMaterial , int mask ) <nl> { <nl> if ( pMaterial = = NULL ) <nl> void CMaterialManager : : RemoveFromHighlighting ( CMaterial * pMaterial , int mask ) <nl> } <nl> } <nl> <nl> - / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / <nl> void CMaterialManager : : UpdateHighlightedMaterials ( ) <nl> { <nl> IDataBaseItemEnumerator * pEnum = CBaseLibraryManager : : GetItemEnumerator ( ) ; <nl> void CMaterialManager : : UpdateHighlightedMaterials ( ) <nl> pEnum - > Release ( ) ; <nl> } <nl> <nl> - / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / <nl> IMaterial * CMaterialManager : : OnLoadMaterial ( const char * sMtlName , bool bForceCreation , unsigned long nLoadingFlags ) <nl> { <nl> _smart_ptr < CMaterial > pMaterial = LoadMaterial ( sMtlName , bForceCreation ) ; <nl> IMaterial * CMaterialManager : : OnLoadMaterial ( const char * sMtlName , bool bForceCre <nl> return NULL ; <nl> } <nl> <nl> - / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / <nl> void CMaterialManager : : OnRequestMaterial ( IMaterial * pMatInfo ) <nl> { <nl> const char * pcName = pMatInfo - > GetName ( ) ; <nl> void CMaterialManager : : OnRequestMaterial ( IMaterial * pMatInfo ) <nl> } <nl> } <nl> <nl> - / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / <nl> void CMaterialManager : : OnCreateMaterial ( IMaterial * pMatInfo ) <nl> { <nl> if ( ! ( pMatInfo - > GetFlags ( ) & MTL_FLAG_PURE_CHILD ) & & ! ( pMatInfo - > GetFlags ( ) & MTL_FLAG_UIMATERIAL ) ) <nl> void CMaterialManager : : OnCreateMaterial ( IMaterial * pMatInfo ) <nl> <nl> } <nl> <nl> - / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / <nl> void CMaterialManager : : OnDeleteMaterial ( IMaterial * pMaterial ) <nl> { <nl> CMaterial * pMtl = ( CMaterial * ) pMaterial - > GetUserData ( ) ; <nl> void CMaterialManager : : OnDeleteMaterial ( IMaterial * pMaterial ) <nl> } <nl> } <nl> <nl> - / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / <nl> CMaterial * CMaterialManager : : FromIMaterial ( IMaterial * pMaterial ) <nl> { <nl> if ( ! pMaterial ) <nl> CMaterial * CMaterialManager : : FromIMaterial ( IMaterial * pMaterial ) <nl> return pMtl ; <nl> } <nl> <nl> - / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / <nl> void CMaterialManager : : SaveAllLibs ( ) <nl> { <nl> } <nl> <nl> - / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / <nl> string CMaterialManager : : FilenameToMaterial ( const string & filename ) <nl> { <nl> string name = PathUtil : : RemoveExtension ( filename . GetString ( ) ) . c_str ( ) ; <nl> string CMaterialManager : : FilenameToMaterial ( const string & filename ) <nl> return name ; <nl> } <nl> <nl> - / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / <nl> string CMaterialManager : : MaterialToFilename ( const string & sMaterialName , bool bForWriting ) <nl> { <nl> string filename = PathUtil : : ReplaceExtension ( sMaterialName . GetString ( ) , MATERIAL_FILE_EXT ) . c_str ( ) ; <nl> return filename ; <nl> } <nl> <nl> - / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / <nl> bool CMaterialManager : : DeleteMaterial ( CMaterial * pMtl ) <nl> { <nl> assert ( pMtl ) ; <nl> bool CMaterialManager : : DeleteMaterial ( CMaterial * pMtl ) <nl> return bRes ; <nl> } <nl> <nl> - / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / <nl> bool CMaterialManager : : SelectSaveMaterial ( string & itemName , const char * defaultStartPath ) <nl> { <nl> string startPath ; <nl> bool CMaterialManager : : SelectSaveMaterial ( string & itemName , const char * defaultS <nl> return true ; <nl> } <nl> <nl> - / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / <nl> CMaterial * CMaterialManager : : SelectNewMaterial ( int nMtlFlags , const char * szStartPath ) <nl> { <nl> string path ; <nl> CMaterial * CMaterialManager : : SelectNewMaterial ( int nMtlFlags , const char * szStar <nl> return mtl ; <nl> } <nl> <nl> - / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / <nl> void CMaterialManager : : Command_Create ( ) <nl> { <nl> SelectNewMaterial ( 0 ) ; <nl> } <nl> <nl> - / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / <nl> void CMaterialManager : : Command_CreateMulti ( ) <nl> { <nl> SelectNewMaterial ( MTL_FLAG_MULTI_SUBMTL ) ; <nl> } <nl> <nl> - / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / <nl> void CMaterialManager : : Command_ConvertToMulti ( ) <nl> { <nl> CMaterial * pMaterial = GetCurrentMaterial ( ) ; <nl> void CMaterialManager : : Command_ConvertToMulti ( ) <nl> } <nl> } <nl> <nl> - / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / <nl> void CMaterialManager : : Command_Duplicate ( ) <nl> { <nl> CMaterial * pSrcMtl = GetCurrentMaterial ( ) ; <nl> void CMaterialManager : : Command_Duplicate ( ) <nl> } <nl> } <nl> <nl> - / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / <nl> CMaterial * CMaterialManager : : DuplicateMaterial ( const char * newName , CMaterial * pOriginal ) <nl> { <nl> if ( ! newName ) <nl> CMaterial * CMaterialManager : : DuplicateMaterial ( const char * newName , CMaterial * p <nl> return CreateMaterial ( newName , node , pOriginal - > GetFlags ( ) ) ; <nl> } <nl> <nl> - / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / <nl> void CMaterialManager : : Command_Merge ( ) <nl> { <nl> string itemName ; <nl> void CMaterialManager : : Command_Merge ( ) <nl> SetCurrentMaterial ( pNewMaterial ) ; <nl> } <nl> <nl> - / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / <nl> void CMaterialManager : : Command_Delete ( ) <nl> { <nl> CMaterial * pMtl = GetCurrentMaterial ( ) ; <nl> void CMaterialManager : : Command_CreateTerrainLayer ( ) <nl> GetIEditorImpl ( ) - > Notify ( eNotify_OnInvalidateControls ) ; <nl> } <nl> <nl> - / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / <nl> void CMaterialManager : : Command_AssignToSelection ( ) <nl> { <nl> CMaterial * pMtl = GetCurrentMaterial ( ) ; <nl> void CMaterialManager : : Command_AssignToSelection ( ) <nl> } <nl> } <nl> <nl> - / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / <nl> void CMaterialManager : : Command_ResetSelection ( ) <nl> { <nl> const CSelectionGroup * pSel = GetIEditorImpl ( ) - > GetSelection ( ) ; <nl> void CMaterialManager : : Command_ResetSelection ( ) <nl> } <nl> } <nl> <nl> - / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / <nl> void CMaterialManager : : Command_SelectAssignedObjects ( ) <nl> { <nl> CMaterial * pMtl = GetCurrentMaterial ( ) ; <nl> void CMaterialManager : : Command_SelectAssignedObjects ( ) <nl> } <nl> } <nl> <nl> - / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / <nl> void CMaterialManager : : Command_SelectFromObject ( ) <nl> { <nl> if ( GetIEditorImpl ( ) - > IsInPreviewMode ( ) ) <nl> void CMaterialManager : : Command_SelectFromObject ( ) <nl> } <nl> } <nl> <nl> - / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / <nl> void CMaterialManager : : PickPreviewMaterial ( HWND hWndCaller ) <nl> { <nl> XmlNodeRef data = XmlHelpers : : CreateXmlNode ( " ExportMaterial " ) ; <nl> CMaterial * pMtl = GetCurrentMaterial ( ) ; <nl> if ( ! pMtl ) <nl> + { <nl> return ; <nl> + } <nl> <nl> if ( pMtl - > IsPureChild ( ) & & pMtl - > GetParent ( ) ) <nl> + { <nl> pMtl = pMtl - > GetParent ( ) ; <nl> + } <nl> <nl> if ( pMtl - > GetFlags ( ) & MTL_FLAG_WIRE ) <nl> + { <nl> data - > setAttr ( " Flag_Wire " , 1 ) ; <nl> + } <nl> + <nl> if ( pMtl - > GetFlags ( ) & MTL_FLAG_2SIDED ) <nl> + { <nl> data - > setAttr ( " Flag_2Sided " , 1 ) ; <nl> + } <nl> <nl> data - > setAttr ( " Name " , pMtl - > GetName ( ) ) ; <nl> data - > setAttr ( " FileName " , pMtl - > GetFilename ( ) ) ; <nl> void CMaterialManager : : PickPreviewMaterial ( HWND hWndCaller ) <nl> m_MatSender - > SendMessage ( eMSM_GetSelectedMaterial , data ) ; <nl> } <nl> <nl> - / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / <nl> void CMaterialManager : : SyncMaterialEditor ( ) <nl> { <nl> if ( ! m_MatSender ) <nl> void CMaterialManager : : SyncMaterialEditor ( ) <nl> if ( ! node ) <nl> return ; <nl> <nl> - string sMtlName ; <nl> - string sMaxFile ; <nl> + const CAssetType * pAssetType = GetIEditor ( ) - > GetAssetManager ( ) - > FindAssetType ( " Material " ) ; <nl> + if ( ! pAssetType ) <nl> + { <nl> + return ; <nl> + } <nl> <nl> - XmlNodeRef root = m_MatSender - > m_node ; <nl> - root - > getAttr ( " Name " , sMtlName ) ; <nl> - root - > getAttr ( " MaxFile " , sMaxFile ) ; <nl> + string materialName ; <nl> + string maxFile ; / / 3ds Max file <nl> <nl> - int IsMulti = 0 ; <nl> - root - > getAttr ( " IsMulti " , IsMulti ) ; <nl> + XmlNodeRef root = m_MatSender - > m_node ; <nl> + root - > getAttr ( " Name " , materialName ) ; <nl> + root - > getAttr ( " MaxFile " , maxFile ) ; <nl> + <nl> + maxFile = Private_MaterialManager : : ResolveToGamePath ( maxFile ) ; <nl> + string initialBasePath ; <nl> + string maxFilename ; <nl> + PathUtil : : Split ( maxFile . c_str ( ) , initialBasePath , maxFilename ) ; <nl> + if ( initialBasePath . empty ( ) ) <nl> + { <nl> + initialBasePath = " materials " ; <nl> + } <nl> <nl> - int nMtlFlags = 0 ; <nl> - if ( IsMulti ) <nl> - nMtlFlags | = MTL_FLAG_MULTI_SUBMTL ; <nl> + const string initialAssetPath = pAssetType - > MakeMetadataFilename ( PathUtil : : Make ( initialBasePath , materialName ) . c_str ( ) ) ; <nl> <nl> - if ( root - > haveAttr ( " Flag_Wire " ) ) <nl> - nMtlFlags | = MTL_FLAG_WIRE ; <nl> - if ( root - > haveAttr ( " Flag_2Sided " ) ) <nl> - nMtlFlags | = MTL_FLAG_2SIDED ; <nl> + CAssetBrowserDialog dialog ( { pAssetType - > GetTypeName ( ) } , CAssetBrowserDialog : : Mode : : Create ) ; <nl> + dialog . SetOverwriteMode ( CAssetBrowserDialog : : OverwriteMode : : AllowOverwrite ) ; <nl> + dialog . SelectAsset ( initialAssetPath ) ; <nl> + if ( ! dialog . Execute ( ) ) <nl> + { <nl> + return ; <nl> + } <nl> + const string assetBasePath = dialog . GetSelectedAssetPath ( ) ; <nl> + if ( assetBasePath . empty ( ) ) <nl> + { <nl> + return ; <nl> + } <nl> <nl> - _smart_ptr < CMaterial > pMtl = SelectNewMaterial ( nMtlFlags , PathUtil : : GetPathWithoutFilename ( sMaxFile ) ) ; <nl> + const string assetPath = pAssetType - > MakeMetadataFilename ( assetBasePath . c_str ( ) ) ; <nl> + pAssetType - > Create ( assetPath ) ; <nl> <nl> + _smart_ptr < CMaterial > pMtl = LoadMaterial ( FilenameToMaterial ( PathUtil : : RemoveExtension ( assetPath ) ) ) ; <nl> if ( ! pMtl ) <nl> + { <nl> return ; <nl> + } <nl> + <nl> + InitMaterial ( pMtl . get ( ) ) ; <nl> + pMtl - > Save ( ) ; <nl> + <nl> + SetCurrentMaterial ( nullptr ) ; <nl> + SetCurrentMaterial ( pMtl ) ; <nl> <nl> - if ( ! IsMulti ) <nl> + GetIEditor ( ) - > ExecuteCommand ( " asset . show_in_browser ' % s ' " , assetPath . c_str ( ) ) ; <nl> + CAsset * const pAsset = GetIEditor ( ) - > GetAssetManager ( ) - > FindAssetForMetadata ( assetPath . c_str ( ) ) ; <nl> + if ( pAsset ) <nl> { <nl> - node - > delAttr ( " Shader " ) ; / / Remove shader attribute . <nl> - XmlNodeRef texturesNode = node - > findChild ( " Textures " ) ; <nl> - if ( texturesNode ) <nl> + pAsset - > Edit ( ) ; <nl> + } <nl> + } <nl> + <nl> + if ( m_MatSender - > m_h . msg = = eMSM_GetSelectedMaterial ) <nl> + { <nl> + CMaterial * const pMtl = GetCurrentMaterial ( ) ; <nl> + if ( ! pMtl ) <nl> + { <nl> + const CAssetType * const pMaterialType = GetIEditor ( ) - > GetAssetManager ( ) - > FindAssetType ( " Material " ) ; <nl> + <nl> + GetIEditor ( ) - > GetAssetManager ( ) - > ForeachAsset ( [ pMaterialType , this ] ( CAsset * pAsset ) <nl> { <nl> - for ( int i = 0 ; i < texturesNode - > getChildCount ( ) ; i + + ) <nl> + if ( ! GetCurrentMaterial ( ) & & pAsset - > GetType ( ) = = pMaterialType & & pAsset - > IsBeingEdited ( ) ) <nl> { <nl> - XmlNodeRef texNode = texturesNode - > getChild ( i ) ; <nl> - string file ; <nl> - if ( texNode - > getAttr ( " File " , file ) ) <nl> + const string name ( FilenameToMaterial ( pAsset - > GetFile ( 0 ) ) ) ; <nl> + CMaterial * const pMaterial = LoadMaterial ( name , false ) ; <nl> + SetCurrentMaterial ( pMaterial ) ; <nl> + } <nl> + } ) ; <nl> + } <nl> + <nl> + PickPreviewMaterial ( m_MatSender - > m_h . GetMaxHWND ( ) ) ; <nl> + <nl> + if ( ! pMtl ) <nl> + { <nl> + SetCurrentMaterial ( nullptr ) ; <nl> + } <nl> + } <nl> + } <nl> + <nl> + void CMaterialManager : : InitMaterial ( CMaterial * pMtl ) <nl> + { <nl> + using namespace Private_MaterialManager ; <nl> + <nl> + XmlNodeRef root = m_MatSender - > m_node ; <nl> + <nl> + XmlNodeRef node = root - > findChild ( " Material " ) ; <nl> + if ( ! node ) <nl> + return ; <nl> + <nl> + int nMtlFlags = 0 ; <nl> + <nl> + int IsMulti = 0 ; <nl> + root - > getAttr ( " IsMulti " , IsMulti ) ; <nl> + <nl> + if ( IsMulti ) <nl> + { <nl> + nMtlFlags | = MTL_FLAG_MULTI_SUBMTL ; <nl> + } <nl> + <nl> + if ( root - > haveAttr ( " Flag_Wire " ) ) <nl> + { <nl> + nMtlFlags | = MTL_FLAG_WIRE ; <nl> + } <nl> + <nl> + if ( root - > haveAttr ( " Flag_2Sided " ) ) <nl> + { <nl> + nMtlFlags | = MTL_FLAG_2SIDED ; <nl> + } <nl> + <nl> + pMtl - > SetFlags ( nMtlFlags ) ; <nl> + <nl> + if ( ! IsMulti ) <nl> + { <nl> + node - > delAttr ( " Shader " ) ; / / Remove shader attribute . <nl> + XmlNodeRef texturesNode = node - > findChild ( " Textures " ) ; <nl> + if ( texturesNode ) <nl> + { <nl> + for ( int i = 0 ; i < texturesNode - > getChildCount ( ) ; i + + ) <nl> + { <nl> + XmlNodeRef texNode = texturesNode - > getChild ( i ) ; <nl> + string file ; <nl> + if ( texNode - > getAttr ( " File " , file ) ) <nl> + { <nl> + / / make path relative to the project specific game folder <nl> + string newfile = ResolveToGamePath ( file . GetString ( ) ) . c_str ( ) ; <nl> + if ( newfile . GetLength ( ) > 0 ) <nl> { <nl> - / / make path relative to the project specific game folder <nl> - string newfile = PathUtil : : AbsolutePathToGamePath ( file . GetString ( ) ) . c_str ( ) ; <nl> - if ( newfile . GetLength ( ) > 0 ) <nl> - file = newfile ; <nl> - texNode - > setAttr ( " File " , file ) ; <nl> + file = newfile ; <nl> } <nl> + texNode - > setAttr ( " File " , file ) ; <nl> } <nl> } <nl> } <nl> - else <nl> + } <nl> + else <nl> + { <nl> + XmlNodeRef childsNode = node - > findChild ( " SubMaterials " ) ; <nl> + if ( childsNode ) <nl> { <nl> - XmlNodeRef childsNode = node - > findChild ( " SubMaterials " ) ; <nl> - if ( childsNode ) <nl> + int nSubMtls = childsNode - > getChildCount ( ) ; <nl> + for ( int i = 0 ; i < nSubMtls ; i + + ) <nl> { <nl> - int nSubMtls = childsNode - > getChildCount ( ) ; <nl> - for ( int i = 0 ; i < nSubMtls ; i + + ) <nl> + XmlNodeRef node = childsNode - > getChild ( i ) ; <nl> + node - > delAttr ( " Shader " ) ; / / Remove shader attribute . <nl> + XmlNodeRef texturesNode = node - > findChild ( " Textures " ) ; <nl> + if ( texturesNode ) <nl> { <nl> - XmlNodeRef node = childsNode - > getChild ( i ) ; <nl> - node - > delAttr ( " Shader " ) ; / / Remove shader attribute . <nl> - XmlNodeRef texturesNode = node - > findChild ( " Textures " ) ; <nl> - if ( texturesNode ) <nl> + for ( int i = 0 ; i < texturesNode - > getChildCount ( ) ; i + + ) <nl> { <nl> - for ( int i = 0 ; i < texturesNode - > getChildCount ( ) ; i + + ) <nl> + XmlNodeRef texNode = texturesNode - > getChild ( i ) ; <nl> + string file ; <nl> + if ( texNode - > getAttr ( " File " , file ) ) <nl> { <nl> - XmlNodeRef texNode = texturesNode - > getChild ( i ) ; <nl> - string file ; <nl> - if ( texNode - > getAttr ( " File " , file ) ) <nl> + / / make path relative to the project specific game folder <nl> + string newfile = ResolveToGamePath ( file . GetString ( ) ) . c_str ( ) ; <nl> + if ( newfile . GetLength ( ) > 0 ) <nl> { <nl> - / / make path relative to the project specific game folder <nl> - string newfile = PathUtil : : AbsolutePathToGamePath ( file . GetString ( ) ) . c_str ( ) ; <nl> - if ( newfile . GetLength ( ) > 0 ) <nl> - file = newfile ; <nl> - texNode - > setAttr ( " File " , file ) ; <nl> + file = newfile ; <nl> } <nl> + texNode - > setAttr ( " File " , file ) ; <nl> } <nl> } <nl> } <nl> } <nl> } <nl> - <nl> - CBaseLibraryItem : : SerializeContext ctx ( node , true ) ; <nl> - ctx . bUndo = true ; <nl> - pMtl - > Serialize ( ctx ) ; <nl> - <nl> - pMtl - > Update ( ) ; <nl> - <nl> - SetCurrentMaterial ( 0 ) ; <nl> - SetCurrentMaterial ( pMtl ) ; <nl> } <nl> <nl> - if ( m_MatSender - > m_h . msg = = eMSM_GetSelectedMaterial ) <nl> - { <nl> - PickPreviewMaterial ( m_MatSender - > m_h . GetMaxHWND ( ) ) ; <nl> - } <nl> + CBaseLibraryItem : : SerializeContext ctx ( node , true ) ; <nl> + ctx . bUndo = true ; <nl> + pMtl - > Serialize ( ctx ) ; <nl> + pMtl - > Update ( ) ; <nl> } <nl> <nl> - / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / <nl> void CMaterialManager : : InitMatSender ( ) <nl> { <nl> / / MatSend ( true ) ; <nl> void CMaterialManager : : OnDebugFlagsChanged ( ) <nl> SetHighlightMask ( mask ) ; <nl> } <nl> <nl> - / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / <nl> void CMaterialManager : : GotoMaterial ( CMaterial * pMaterial ) <nl> { <nl> if ( pMaterial ) <nl> GetIEditorImpl ( ) - > OpenDataBaseLibrary ( EDB_TYPE_MATERIAL , pMaterial ) ; <nl> } <nl> <nl> - / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / <nl> void CMaterialManager : : GotoMaterial ( IMaterial * pMtl ) <nl> { <nl> if ( pMtl ) <nl> void CMaterialManager : : GotoMaterial ( IMaterial * pMtl ) <nl> } <nl> } <nl> <nl> - / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / <nl> void CMaterialManager : : SetHighlightedMaterial ( CMaterial * pMtl ) <nl> { <nl> if ( m_pHighlightMaterial ) <nl> void CMaterialManager : : SetHighlightedMaterial ( CMaterial * pMtl ) <nl> AddForHighlighting ( m_pHighlightMaterial ) ; <nl> } <nl> <nl> - / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / <nl> void CMaterialManager : : HighlightedMaterialChanged ( CMaterial * pMtl ) <nl> { <nl> if ( ! pMtl ) <nl> void CMaterialManager : : HighlightedMaterialChanged ( CMaterial * pMtl ) <nl> AddForHighlighting ( pMtl ) ; <nl> } <nl> <nl> - / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / <nl> void CMaterialManager : : SetHighlightMask ( int highlightMask ) <nl> { <nl> if ( m_highlightMask ! = highlightMask ) <nl> void CMaterialManager : : SetHighlightMask ( int highlightMask ) <nl> } <nl> } <nl> <nl> - / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / <nl> void CMaterialManager : : GatherResources ( IMaterial * pMaterial , CUsedResources & resources ) <nl> { <nl> if ( ! pMaterial ) <nl> void CMaterialManager : : GatherResources ( IMaterial * pMaterial , CUsedResources & res <nl> } <nl> } <nl> <nl> - / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / <nl> void CMaterialManager : : GetHighlightColor ( ColorF * color , float * intensity , int flags ) <nl> { <nl> MAKE_SURE ( m_pHighlighter , return ) ; <nl> mmm a / Code / Sandbox / EditorQt / Material / MaterialManager . h <nl> ppp b / Code / Sandbox / EditorQt / Material / MaterialManager . h <nl> class SANDBOX_API CMaterialManager : public CBaseLibraryManager , public IMateria <nl> <nl> / / For material syncing with 3dsMax . <nl> void PickPreviewMaterial ( HWND hWndCaller ) ; <nl> + void InitMaterial ( CMaterial * pMtl ) ; <nl> void InitMatSender ( ) ; <nl> <nl> void OnDebugFlagsChanged ( ) ; <nl> deleted file mode 100644 <nl> index 4a5a2eb183 . . 0000000000 <nl> mmm a / Code / Sandbox / EditorQt / Material / StandaloneMaterialEditor . cpp <nl> ppp / dev / null <nl> <nl> - / / Copyright 2001 - 2018 Crytek GmbH / Crytek Group . All rights reserved . <nl> - # include < StdAfx . h > <nl> - # include " StandaloneMaterialEditor . h " <nl> - <nl> - # include " QMfcApp / qwinhost . h " <nl> - <nl> - # include " Material / MaterialDialog . h " <nl> - # include " Material / MaterialManager . h " <nl> - <nl> - # include " MaterialSender . h " <nl> - # include " IEditorImpl . h " <nl> - <nl> - # include " Controls / QuestionDialog . h " <nl> - # include " QtUtil . h " <nl> - <nl> - # include < QVBoxLayout > <nl> - # include < QTimer > <nl> - # include < QAbstractNativeEventFilter > <nl> - <nl> - # include < CrySystem / IProjectManager . h > <nl> - <nl> - namespace <nl> - { <nl> - <nl> - struct SMaterialEditorFilter : QAbstractNativeEventFilter <nl> - { <nl> - virtual bool nativeEventFilter ( const QByteArray & eventType , void * pMessage , long * pResult ) override <nl> - { <nl> - if ( eventType = = " windows_generic_MSG " ) <nl> - { <nl> - const MSG * const pTheMessage = static_cast < const MSG * > ( pMessage ) ; <nl> - if ( pTheMessage - > message = = WM_MATEDITSEND ) <nl> - { <nl> - GetIEditorImpl ( ) - > GetMaterialManager ( ) - > SyncMaterialEditor ( ) ; <nl> - <nl> - if ( pResult ) <nl> - { <nl> - * pResult = 0 ; <nl> - } <nl> - <nl> - return true ; <nl> - } <nl> - } <nl> - return false ; <nl> - } <nl> - <nl> - static SMaterialEditorFilter & GetInstance ( ) <nl> - { <nl> - static SMaterialEditorFilter theInstance ; <nl> - return theInstance ; <nl> - } <nl> - } ; <nl> - <nl> - } / / namespace <nl> - <nl> - StandaloneMaterialEditor : : StandaloneMaterialEditor ( ) <nl> - : CEditorDialog ( " SandaloneMaterialEditor " ) <nl> - , m_materialWnd ( nullptr ) <nl> - { <nl> - auto winHost = new QWinHost ( ) ; <nl> - <nl> - auto pClassDesc = GetIEditorImpl ( ) - > GetClassFactory ( ) - > FindClass ( MATERIAL_EDITOR_NAME ) ; <nl> - if ( pClassDesc ) <nl> - { <nl> - CRuntimeClass * pRuntimeClass = pClassDesc - > GetRuntimeClass ( ) ; <nl> - if ( pRuntimeClass ) <nl> - { <nl> - assert ( pRuntimeClass - > IsDerivedFrom ( RUNTIME_CLASS ( CWnd ) ) | | pRuntimeClass = = RUNTIME_CLASS ( CWnd ) ) ; <nl> - CRY_ASSERT ( AfxGetMainWnd ( ) ) ; <nl> - m_materialWnd = ( CWnd * ) pRuntimeClass - > CreateObject ( ) ; <nl> - assert ( m_materialWnd ) ; <nl> - winHost - > setWindow ( m_materialWnd - > GetSafeHwnd ( ) ) ; <nl> - } <nl> - } <nl> - <nl> - setAttribute ( Qt : : WA_DeleteOnClose ) ; <nl> - <nl> - if ( ! m_materialWnd ) <nl> - { <nl> - CQuestionDialog : : SCritical ( " Error " , " Error initializing the Standalone Material Editor " ) ; <nl> - close ( ) ; <nl> - } <nl> - else <nl> - { <nl> - auto pLayout = new QVBoxLayout ( this ) ; <nl> - pLayout - > setContentsMargins ( 5 , 5 , 5 , 5 ) ; <nl> - pLayout - > addWidget ( new QLabel ( tr ( " Material editing mode . Restart Sandbox for full functionality . " ) ) , 0 ) ; <nl> - pLayout - > addWidget ( winHost , 1 ) ; <nl> - <nl> - setMinimumSize ( QSize ( 600 , 400 ) ) ; <nl> - } <nl> - <nl> - qApp - > installNativeEventFilter ( & SMaterialEditorFilter : : GetInstance ( ) ) ; <nl> - <nl> - QTimer : : singleShot ( 16 , this , & StandaloneMaterialEditor : : OnIdleCallback ) ; <nl> - <nl> - string sWindowTitle ; <nl> - sWindowTitle . Format ( " CRYENGINE - Game % s " , gEnv - > pSystem - > GetIProjectManager ( ) - > GetCurrentProjectName ( ) ) ; <nl> - <nl> - QString windowTitle ( sWindowTitle ) ; <nl> - setWindowTitle ( windowTitle ) ; <nl> - } <nl> - <nl> - StandaloneMaterialEditor : : ~ StandaloneMaterialEditor ( ) <nl> - { <nl> - if ( m_materialWnd ) <nl> - m_materialWnd - > DestroyWindow ( ) ; <nl> - } <nl> - <nl> - void StandaloneMaterialEditor : : Execute ( ) <nl> - { <nl> - if ( m_materialWnd ) <nl> - { <nl> - show ( ) ; <nl> - window ( ) - > raise ( ) ; <nl> - } <nl> - <nl> - } <nl> - <nl> - void StandaloneMaterialEditor : : closeEvent ( QCloseEvent * event ) <nl> - { <nl> - / / when done , quit application <nl> - GetIEditorImpl ( ) - > GetCommandManager ( ) - > Execute ( " general . exit " ) ; <nl> - } <nl> - <nl> - void StandaloneMaterialEditor : : OnIdleCallback ( ) <nl> - { <nl> - GetIEditorImpl ( ) - > Notify ( eNotify_OnIdleUpdate ) ; <nl> - QTimer : : singleShot ( 16 , this , & StandaloneMaterialEditor : : OnIdleCallback ) ; <nl> - } <nl> - <nl> deleted file mode 100644 <nl> index 0fb7880ed3 . . 0000000000 <nl> mmm a / Code / Sandbox / EditorQt / Material / StandaloneMaterialEditor . h <nl> ppp / dev / null <nl> <nl> - / / Copyright 2001 - 2018 Crytek GmbH / Crytek Group . All rights reserved . <nl> - # pragma once <nl> - <nl> - # include " Controls / EditorDialog . h " <nl> - <nl> - class CWnd ; <nl> - <nl> - class StandaloneMaterialEditor : public CEditorDialog <nl> - { <nl> - public : <nl> - StandaloneMaterialEditor ( ) ; <nl> - ~ StandaloneMaterialEditor ( ) ; <nl> - <nl> - void Execute ( ) ; <nl> - <nl> - private : <nl> - <nl> - virtual void closeEvent ( QCloseEvent * event ) override ; <nl> - <nl> - void OnIdleCallback ( ) ; <nl> - <nl> - CWnd * m_materialWnd ; <nl> - } ; <nl> - <nl> mmm a / Code / Sandbox / EditorQt / QT / QtMain . cpp <nl> ppp b / Code / Sandbox / EditorQt / QT / QtMain . cpp <nl> <nl> # include " EditorStyleHelper . h " <nl> <nl> # include " Controls / QuestionTimeoutDialog . h " <nl> - # include " Material / StandaloneMaterialEditor . h " <nl> # include " SessionData . h " <nl> <nl> # include < CryCore / Platform / CryLibrary . h > <nl> int main ( int argc , char * argv [ ] ) <nl> <nl> splash . close ( ) ; <nl> <nl> - if ( GetIEditorImpl ( ) - > IsInMatEditMode ( ) ) / / special mode where we only show a material editor . Currently handled here for code clarity <nl> + if ( GetIEditorImpl ( ) - > IsInMatEditMode ( ) ) <nl> { <nl> - StandaloneMaterialEditor * standaloneMatEdit = new StandaloneMaterialEditor ( ) ; <nl> - standaloneMatEdit - > Execute ( ) ; <nl> - <nl> - mainFrame - > hide ( ) ; <nl> + / / TODO : special mode where we only show a material editor . <nl> } <nl> <nl> theApp . PostInit ( ) ; <nl> mmm a / Code / Sandbox / Plugins / EditorCommon / AssetSystem / AssetType . cpp <nl> ppp b / Code / Sandbox / Plugins / EditorCommon / AssetSystem / AssetType . cpp <nl> void CAssetType : : Init ( ) <nl> m_icon = GetIconInternal ( ) ; <nl> } <nl> <nl> + string CAssetType : : MakeMetadataFilename ( const char * szAssetName ) const <nl> + { <nl> + return string ( ) . Format ( " % s . % s . cryasset " , szAssetName , GetFileExtension ( ) ) ; <nl> + } <nl> + <nl> QVariant CAssetType : : GetVariantFromDetail ( const string & detailValue , const CItemModelAttribute * pAttrib ) <nl> { <nl> CRY_ASSERT ( pAttrib ) ; <nl> mmm a / Code / Sandbox / Plugins / EditorCommon / AssetSystem / AssetType . h <nl> ppp b / Code / Sandbox / Plugins / EditorCommon / AssetSystem / AssetType . h <nl> class EDITOR_COMMON_API CAssetType : public IClassDesc <nl> / / ! Returns the color code of the thumbnail . <nl> virtual QColor GetThumbnailColor ( ) const { return QColor ( Qt : : green ) ; } <nl> <nl> + / / ! Makes cryasset filename from asset name . <nl> + string MakeMetadataFilename ( const char * szAssetName ) const ; <nl> + <nl> protected : <nl> / / ! Helper function that parses a string and returns a variant of a type corresponding to \ p pAttrib - > GetType ( ) . <nl> / / ! If conversion fails , a default - constructed varient of that type is returned . ( see QVariant : : value ) . <nl> mmm a / Code / Sandbox / Plugins / EditorCommon / AssetSystem / Browser / AssetBrowser . cpp <nl> ppp b / Code / Sandbox / Plugins / EditorCommon / AssetSystem / Browser / AssetBrowser . cpp <nl> void CAssetBrowser : : SelectAsset ( const char * szPath ) const <nl> { <nl> SelectAsset ( * pAsset ) ; <nl> } <nl> + else if ( PathUtil : : GetExt ( szPath ) ) / / try to select folder by the file path <nl> + { <nl> + m_foldersView - > SelectFolder ( QtUtil : : ToQString ( PathUtil : : GetDirectory ( szPath ) ) ) ; <nl> + } <nl> + else <nl> + { <nl> + m_foldersView - > SelectFolder ( QtUtil : : ToQString ( szPath ) ) ; <nl> + } <nl> } <nl> <nl> void CAssetBrowser : : SelectAsset ( const CAsset & asset ) const <nl> mmm a / Code / Sandbox / Plugins / EditorCommon / AssetSystem / Browser / AssetBrowserDialog . cpp <nl> ppp b / Code / Sandbox / Plugins / EditorCommon / AssetSystem / Browser / AssetBrowserDialog . cpp <nl> <nl> # include " AssetModel . h " <nl> # include " AssetSystem / Asset . h " <nl> # include " AssetSystem / AssetManager . h " <nl> + # include " AssetSystem / Loader / AssetLoaderHelpers . h " <nl> <nl> # include " QtUtil . h " <nl> # include " QAdvancedTreeView . h " <nl> void CAssetBrowserDialog : : SelectAsset ( const CAsset & asset ) <nl> m_pBrowser - > SelectAsset ( asset ) ; <nl> } <nl> <nl> + void CAssetBrowserDialog : : SelectAsset ( const string & path ) <nl> + { <nl> + m_pBrowser - > SelectAsset ( path . c_str ( ) ) ; <nl> + <nl> + if ( m_mode ! = Mode : : Create ) <nl> + { <nl> + return ; <nl> + } <nl> + <nl> + const QStringList filenames = m_pPathEdit - > GetFileNames ( ) ; <nl> + if ( ! filenames . isEmpty ( ) ) <nl> + { <nl> + return ; <nl> + } <nl> + <nl> + / / We did not find any existing asset by the specified name , <nl> + / / set the name as the default asset name for the new asset . <nl> + const string assetName ( AssetLoader : : GetAssetName ( path ) ) ; <nl> + m_pPathEdit - > setText ( QtUtil : : ToQString ( assetName ) ) ; <nl> + } <nl> + <nl> void CAssetBrowserDialog : : OnAccept ( ) <nl> { <nl> if ( ! IsReadOnlyMode ( ) ) <nl> mmm a / Code / Sandbox / Plugins / EditorCommon / AssetSystem / Browser / AssetBrowserDialog . h <nl> ppp b / Code / Sandbox / Plugins / EditorCommon / AssetSystem / Browser / AssetBrowserDialog . h <nl> class EDITOR_COMMON_API CAssetBrowserDialog : public CEditorDialog <nl> std : : vector < CAsset * > GetSelectedAssets ( ) ; <nl> <nl> void SelectAsset ( const CAsset & asset ) ; <nl> + void SelectAsset ( const string & path ) ; <nl> + void SetOverwriteMode ( OverwriteMode mode ) ; <nl> + const string GetSelectedAssetPath ( ) const { return m_assetPath ; } <nl> <nl> static CAsset * OpenSingleAssetForTypes ( const std : : vector < string > & assetTypeNames ) ; <nl> static std : : vector < CAsset * > OpenMultipleAssetsForTypes ( const std : : vector < string > & assetTypeNames ) ; <nl> class EDITOR_COMMON_API CAssetBrowserDialog : public CEditorDialog <nl> private : <nl> void OnAccept ( ) ; <nl> void OnAcceptSave ( ) ; <nl> - <nl> - void SetOverwriteMode ( OverwriteMode mode ) ; <nl> - <nl> bool IsReadOnlyMode ( ) const ; <nl> <nl> private : <nl>
! F ( CE - 16524 ) ( Sandbox ) As a User , I want ' Sync Material ' in 3DsMax to work with the new Material Editor
CRYTEK/CRYENGINE
c44504591d00343b20622d44080d8d5bfcd7caa7
2018-06-12T08:05:56Z
mmm a / src / arm / codegen - arm . cc <nl> ppp b / src / arm / codegen - arm . cc <nl> int CompareStub : : MinorKey ( ) { <nl> / / Encode the three parameters in a unique 16 bit value . To avoid duplicate <nl> / / stubs the never NaN NaN condition is only taken into account if the <nl> / / condition is equals . <nl> - ASSERT ( ( static_cast < unsigned > ( cc_ ) > > 28 ) < ( 1 < < 14 ) ) ; <nl> + ASSERT ( ( static_cast < unsigned > ( cc_ ) > > 28 ) < ( 1 < < 13 ) ) ; <nl> return ConditionField : : encode ( static_cast < unsigned > ( cc_ ) > > 28 ) <nl> | StrictField : : encode ( strict_ ) <nl> - | NeverNanNanField : : encode ( cc_ = = eq ? never_nan_nan_ : false ) ; <nl> + | NeverNanNanField : : encode ( cc_ = = eq ? never_nan_nan_ : false ) <nl> + | IncludeNumberCompareField : : encode ( include_number_compare_ ) ; <nl> } <nl> <nl> <nl> mmm a / src / codegen . h <nl> ppp b / src / codegen . h <nl> class CompareStub : public CodeStub { <nl> public : <nl> CompareStub ( Condition cc , <nl> bool strict , <nl> - NaNInformation nan_info = kBothCouldBeNaN ) : <nl> - cc_ ( cc ) , strict_ ( strict ) , never_nan_nan_ ( nan_info = = kCantBothBeNaN ) { } <nl> + NaNInformation nan_info = kBothCouldBeNaN , <nl> + bool include_number_compare = true ) : <nl> + cc_ ( cc ) , <nl> + strict_ ( strict ) , <nl> + never_nan_nan_ ( nan_info = = kCantBothBeNaN ) , <nl> + include_number_compare_ ( include_number_compare ) { } <nl> <nl> void Generate ( MacroAssembler * masm ) ; <nl> <nl> class CompareStub : public CodeStub { <nl> / / generating the minor key for other comparisons to avoid creating more <nl> / / stubs . <nl> bool never_nan_nan_ ; <nl> + / / Do generate the number comparison code in the stub . Stubs without number <nl> + / / comparison code is used when the number comparison has been inlined , and <nl> + / / the stub will be called if one of the operands is not a number . <nl> + bool include_number_compare_ ; <nl> <nl> / / Encoding of the minor key CCCCCCCCCCCCCCNS . <nl> class StrictField : public BitField < bool , 0 , 1 > { } ; <nl> class NeverNanNanField : public BitField < bool , 1 , 1 > { } ; <nl> - class ConditionField : public BitField < int , 2 , 14 > { } ; <nl> + class IncludeNumberCompareField : public BitField < bool , 2 , 1 > { } ; <nl> + class ConditionField : public BitField < int , 3 , 13 > { } ; <nl> <nl> Major MajorKey ( ) { return Compare ; } <nl> <nl> mmm a / src / ia32 / codegen - ia32 . cc <nl> ppp b / src / ia32 / codegen - ia32 . cc <nl> class FloatingPointHelper : public AllStatic { <nl> / / operand in register number . Returns operand as floating point number <nl> / / on FPU stack . <nl> static void LoadFloatOperand ( MacroAssembler * masm , Register number ) ; <nl> + <nl> / / Code pattern for loading floating point values . Input values must <nl> / / be either smi or heap number objects ( fp values ) . Requirements : <nl> / / operand_1 on TOS + 1 or in edx , operand_2 on TOS + 2 or in eax . <nl> class FloatingPointHelper : public AllStatic { <nl> static void CheckFloatOperands ( MacroAssembler * masm , <nl> Label * non_float , <nl> Register scratch ) ; <nl> + <nl> / / Takes the operands in edx and eax and loads them as integers in eax <nl> / / and ecx . <nl> static void LoadAsIntegers ( MacroAssembler * masm , <nl> class FloatingPointHelper : public AllStatic { <nl> / / into xmm0 and xmm1 if they are . Operands are in edx and eax . <nl> / / Leaves operands unchanged . <nl> static void LoadSSE2Operands ( MacroAssembler * masm ) ; <nl> + <nl> / / Test if operands are numbers ( smi or HeapNumber objects ) , and load <nl> / / them into xmm0 and xmm1 if they are . Jump to label not_numbers if <nl> / / either operand is not a number . Operands are in edx and eax . <nl> static bool CouldBeNaN ( const Result & result ) { <nl> } <nl> <nl> <nl> + / / Convert from signed to unsigned comparison to match the way EFLAGS are set <nl> + / / by FPU and XMM compare instructions . <nl> + static Condition DoubleCondition ( Condition cc ) { <nl> + switch ( cc ) { <nl> + case less : return below ; <nl> + case equal : return equal ; <nl> + case less_equal : return below_equal ; <nl> + case greater : return above ; <nl> + case greater_equal : return above_equal ; <nl> + default : UNREACHABLE ( ) ; <nl> + } <nl> + UNREACHABLE ( ) ; <nl> + return equal ; <nl> + } <nl> + <nl> + <nl> void CodeGenerator : : Comparison ( AstNode * node , <nl> Condition cc , <nl> bool strict , <nl> void CodeGenerator : : Comparison ( AstNode * node , <nl> left_side = right_side ; <nl> right_side = temp ; <nl> cc = ReverseCondition ( cc ) ; <nl> - / / This may reintroduce greater or less_equal as the value of cc . <nl> + / / This may re - introduce greater or less_equal as the value of cc . <nl> / / CompareStub and the inline code both support all values of cc . <nl> } <nl> / / Implement comparison against a constant Smi , inlining the case <nl> void CodeGenerator : : Comparison ( AstNode * node , <nl> / / Jump to builtin for NaN . <nl> not_number . Branch ( parity_even , & left_side ) ; <nl> left_side . Unuse ( ) ; <nl> - Condition double_cc = cc ; <nl> - switch ( cc ) { <nl> - case less : double_cc = below ; break ; <nl> - case equal : double_cc = equal ; break ; <nl> - case less_equal : double_cc = below_equal ; break ; <nl> - case greater : double_cc = above ; break ; <nl> - case greater_equal : double_cc = above_equal ; break ; <nl> - default : UNREACHABLE ( ) ; <nl> - } <nl> - dest - > true_target ( ) - > Branch ( double_cc ) ; <nl> + dest - > true_target ( ) - > Branch ( DoubleCondition ( cc ) ) ; <nl> dest - > false_target ( ) - > Jump ( ) ; <nl> not_number . Bind ( & left_side ) ; <nl> } <nl> void CodeGenerator : : Comparison ( AstNode * node , <nl> dest - > Split ( cc ) ; <nl> } <nl> } else { <nl> - / / Neither side is a constant Smi or null . <nl> - / / If either side is a non - smi constant , skip the smi check . <nl> + / / Neither side is a constant Smi , constant 1 - char string or constant null . <nl> + / / If either side is a non - smi constant , or known to be a heap number skip <nl> + / / the smi check . <nl> bool known_non_smi = <nl> ( left_side . is_constant ( ) & & ! left_side . handle ( ) - > IsSmi ( ) ) | | <nl> - ( right_side . is_constant ( ) & & ! right_side . handle ( ) - > IsSmi ( ) ) ; <nl> + ( right_side . is_constant ( ) & & ! right_side . handle ( ) - > IsSmi ( ) ) | | <nl> + left_side . number_info ( ) . IsHeapNumber ( ) | | <nl> + right_side . number_info ( ) . IsHeapNumber ( ) ; <nl> NaNInformation nan_info = <nl> ( CouldBeNaN ( left_side ) & & CouldBeNaN ( right_side ) ) ? <nl> kBothCouldBeNaN : <nl> kCantBothBeNaN ; <nl> + <nl> + / / Inline number comparison handling any combination of smi ' s and heap <nl> + / / numbers if : <nl> + / / code is in a loop <nl> + / / the compare operation is different from equal <nl> + / / compare is not a for - loop comparison <nl> + / / The reason for excluding equal is that it will most likely be done <nl> + / / with smi ' s ( not heap numbers ) and the code to comparing smi ' s is inlined <nl> + / / separately . The same reason applies for for - loop comparison which will <nl> + / / also most likely be smi comparisons . <nl> + bool is_for_loop_compare = ( node - > AsCompareOperation ( ) ! = NULL ) <nl> + & & node - > AsCompareOperation ( ) - > is_for_loop_condition ( ) ; <nl> + bool inline_number_compare = loop_nesting ( ) > 0 <nl> + & & cc ! = equal <nl> + & & ! is_for_loop_compare ; <nl> + <nl> + / / Left and right needed in registers for the following code . <nl> left_side . ToRegister ( ) ; <nl> right_side . ToRegister ( ) ; <nl> <nl> if ( known_non_smi ) { <nl> - / / When non - smi , call out to the compare stub . <nl> - CompareStub stub ( cc , strict , nan_info ) ; <nl> + / / Inline the equality check if both operands can ' t be a NaN . If both <nl> + / / objects are the same they are equal . <nl> + if ( nan_info = = kCantBothBeNaN & & cc = = equal ) { <nl> + __ cmp ( left_side . reg ( ) , Operand ( right_side . reg ( ) ) ) ; <nl> + dest - > true_target ( ) - > Branch ( equal ) ; <nl> + } <nl> + <nl> + / / Inline number comparison . <nl> + if ( inline_number_compare ) { <nl> + GenerateInlineNumberComparison ( & left_side , & right_side , cc , dest ) ; <nl> + } <nl> + <nl> + / / End of in - line compare , call out to the compare stub . Don ' t include <nl> + / / number comparison in the stub if it was inlined . <nl> + CompareStub stub ( cc , strict , nan_info , ! inline_number_compare ) ; <nl> Result answer = frame_ - > CallStub ( & stub , & left_side , & right_side ) ; <nl> if ( cc = = equal ) { <nl> __ test ( answer . reg ( ) , Operand ( answer . reg ( ) ) ) ; <nl> void CodeGenerator : : Comparison ( AstNode * node , <nl> Register left_reg = left_side . reg ( ) ; <nl> Register right_reg = right_side . reg ( ) ; <nl> <nl> + / / In - line check for comparing two smis . <nl> Result temp = allocator_ - > Allocate ( ) ; <nl> ASSERT ( temp . is_valid ( ) ) ; <nl> __ mov ( temp . reg ( ) , left_side . reg ( ) ) ; <nl> void CodeGenerator : : Comparison ( AstNode * node , <nl> __ test ( temp . reg ( ) , Immediate ( kSmiTagMask ) ) ; <nl> temp . Unuse ( ) ; <nl> is_smi . Branch ( zero , taken ) ; <nl> - / / When non - smi , call out to the compare stub . <nl> - CompareStub stub ( cc , strict , nan_info ) ; <nl> + <nl> + / / Inline the equality check if both operands can ' t be a NaN . If both <nl> + / / objects are the same they are equal . <nl> + if ( nan_info = = kCantBothBeNaN & & cc = = equal ) { <nl> + __ cmp ( left_side . reg ( ) , Operand ( right_side . reg ( ) ) ) ; <nl> + dest - > true_target ( ) - > Branch ( equal ) ; <nl> + } <nl> + <nl> + / / Inline number comparison . <nl> + if ( inline_number_compare ) { <nl> + GenerateInlineNumberComparison ( & left_side , & right_side , cc , dest ) ; <nl> + } <nl> + <nl> + / / End of in - line compare , call out to the compare stub . Don ' t include <nl> + / / number comparison in the stub if it was inlined . <nl> + CompareStub stub ( cc , strict , nan_info , ! inline_number_compare ) ; <nl> Result answer = frame_ - > CallStub ( & stub , & left_side , & right_side ) ; <nl> if ( cc = = equal ) { <nl> __ test ( answer . reg ( ) , Operand ( answer . reg ( ) ) ) ; <nl> void CodeGenerator : : Comparison ( AstNode * node , <nl> } <nl> <nl> <nl> + / / Check that the comparison operand is a number . Jump to not_numbers jump <nl> + / / target passing the left and right result if the operand is not a number . <nl> + static void CheckComparisonOperand ( MacroAssembler * masm_ , <nl> + Result * operand , <nl> + Result * left_side , <nl> + Result * right_side , <nl> + JumpTarget * not_numbers ) { <nl> + / / Perform check if operand is not known to be a number . <nl> + if ( ! operand - > number_info ( ) . IsNumber ( ) ) { <nl> + Label done ; <nl> + __ test ( operand - > reg ( ) , Immediate ( kSmiTagMask ) ) ; <nl> + __ j ( zero , & done ) ; <nl> + __ cmp ( FieldOperand ( operand - > reg ( ) , HeapObject : : kMapOffset ) , <nl> + Immediate ( Factory : : heap_number_map ( ) ) ) ; <nl> + not_numbers - > Branch ( not_equal , left_side , right_side , not_taken ) ; <nl> + __ bind ( & done ) ; <nl> + } <nl> + } <nl> + <nl> + <nl> + / / Load a comparison operand to the FPU stack . This assumes that the operand has <nl> + / / already been checked and is a number . <nl> + static void LoadComparisonOperand ( MacroAssembler * masm_ , <nl> + Result * operand , <nl> + Result * left_side , <nl> + Result * right_side ) { <nl> + Label done ; <nl> + if ( operand - > number_info ( ) . IsHeapNumber ( ) ) { <nl> + / / Operand is known to be a heap number , just load it . <nl> + __ fld_d ( FieldOperand ( operand - > reg ( ) , HeapNumber : : kValueOffset ) ) ; <nl> + } else if ( operand - > number_info ( ) . IsSmi ( ) ) { <nl> + / / Operand is known to be a smi . Convert it to double and keep the original <nl> + / / smi . <nl> + __ SmiUntag ( operand - > reg ( ) ) ; <nl> + __ push ( operand - > reg ( ) ) ; <nl> + __ fild_s ( Operand ( esp , 0 ) ) ; <nl> + __ pop ( operand - > reg ( ) ) ; <nl> + __ SmiTag ( operand - > reg ( ) ) ; <nl> + } else { <nl> + / / Operand type not known , check for smi otherwise assume heap number . <nl> + Label smi ; <nl> + __ test ( operand - > reg ( ) , Immediate ( kSmiTagMask ) ) ; <nl> + __ j ( zero , & smi ) ; <nl> + __ fld_d ( FieldOperand ( operand - > reg ( ) , HeapNumber : : kValueOffset ) ) ; <nl> + __ jmp ( & done ) ; <nl> + __ bind ( & smi ) ; <nl> + __ SmiUntag ( operand - > reg ( ) ) ; <nl> + __ push ( operand - > reg ( ) ) ; <nl> + __ fild_s ( Operand ( esp , 0 ) ) ; <nl> + __ pop ( operand - > reg ( ) ) ; <nl> + __ SmiTag ( operand - > reg ( ) ) ; <nl> + __ jmp ( & done ) ; <nl> + } <nl> + __ bind ( & done ) ; <nl> + } <nl> + <nl> + <nl> + / / Load a comparison operand into into a XMM register . Jump to not_numbers jump <nl> + / / target passing the left and right result if the operand is not a number . <nl> + static void LoadComparisonOperandSSE2 ( MacroAssembler * masm_ , <nl> + Result * operand , <nl> + XMMRegister reg , <nl> + Result * left_side , <nl> + Result * right_side , <nl> + JumpTarget * not_numbers ) { <nl> + Label done ; <nl> + if ( operand - > number_info ( ) . IsHeapNumber ( ) ) { <nl> + / / Operand is known to be a heap number , just load it . <nl> + __ movdbl ( reg , FieldOperand ( operand - > reg ( ) , HeapNumber : : kValueOffset ) ) ; <nl> + } else if ( operand - > number_info ( ) . IsSmi ( ) ) { <nl> + / / Operand is known to be a smi . Convert it to double and keep the original <nl> + / / smi . <nl> + __ SmiUntag ( operand - > reg ( ) ) ; <nl> + __ cvtsi2sd ( reg , Operand ( operand - > reg ( ) ) ) ; <nl> + __ SmiTag ( left_side - > reg ( ) ) ; <nl> + } else { <nl> + / / Operand type not known , check for smi or heap number . <nl> + Label smi ; <nl> + __ test ( operand - > reg ( ) , Immediate ( kSmiTagMask ) ) ; <nl> + __ j ( zero , & smi ) ; <nl> + if ( ! operand - > number_info ( ) . IsNumber ( ) ) { <nl> + __ cmp ( FieldOperand ( operand - > reg ( ) , HeapObject : : kMapOffset ) , <nl> + Immediate ( Factory : : heap_number_map ( ) ) ) ; <nl> + not_numbers - > Branch ( not_equal , left_side , right_side , taken ) ; <nl> + } <nl> + __ movdbl ( reg , FieldOperand ( operand - > reg ( ) , HeapNumber : : kValueOffset ) ) ; <nl> + __ jmp ( & done ) ; <nl> + <nl> + __ bind ( & smi ) ; <nl> + / / Comvert smi to float and keep the original smi . <nl> + __ SmiUntag ( operand - > reg ( ) ) ; <nl> + __ cvtsi2sd ( reg , Operand ( operand - > reg ( ) ) ) ; <nl> + __ SmiTag ( operand - > reg ( ) ) ; <nl> + __ jmp ( & done ) ; <nl> + } <nl> + __ bind ( & done ) ; <nl> + } <nl> + <nl> + <nl> + void CodeGenerator : : GenerateInlineNumberComparison ( Result * left_side , <nl> + Result * right_side , <nl> + Condition cc , <nl> + ControlDestination * dest ) { <nl> + ASSERT ( left_side - > is_register ( ) ) ; <nl> + ASSERT ( right_side - > is_register ( ) ) ; <nl> + <nl> + JumpTarget not_numbers ; <nl> + if ( CpuFeatures : : IsSupported ( SSE2 ) ) { <nl> + CpuFeatures : : Scope use_sse2 ( SSE2 ) ; <nl> + <nl> + / / Load left and right operand into registers xmm0 and xmm1 and compare . <nl> + LoadComparisonOperandSSE2 ( masm_ , left_side , xmm0 , left_side , right_side , <nl> + & not_numbers ) ; <nl> + LoadComparisonOperandSSE2 ( masm_ , right_side , xmm1 , left_side , right_side , <nl> + & not_numbers ) ; <nl> + __ comisd ( xmm0 , xmm1 ) ; <nl> + } else { <nl> + Label check_right , compare ; <nl> + <nl> + / / Make sure that both comparison operands are numbers . <nl> + CheckComparisonOperand ( masm_ , left_side , left_side , right_side , <nl> + & not_numbers ) ; <nl> + CheckComparisonOperand ( masm_ , right_side , left_side , right_side , <nl> + & not_numbers ) ; <nl> + <nl> + / / Load right and left operand to FPU stack and compare . <nl> + LoadComparisonOperand ( masm_ , right_side , left_side , right_side ) ; <nl> + LoadComparisonOperand ( masm_ , left_side , left_side , right_side ) ; <nl> + __ FCmp ( ) ; <nl> + } <nl> + <nl> + / / Bail out if a NaN is involved . <nl> + not_numbers . Branch ( parity_even , left_side , right_side , not_taken ) ; <nl> + <nl> + / / Split to destination targets based on comparison . <nl> + left_side - > Unuse ( ) ; <nl> + right_side - > Unuse ( ) ; <nl> + dest - > true_target ( ) - > Branch ( DoubleCondition ( cc ) ) ; <nl> + dest - > false_target ( ) - > Jump ( ) ; <nl> + <nl> + not_numbers . Bind ( left_side , right_side ) ; <nl> + } <nl> + <nl> + <nl> / / Call the function just below TOS on the stack with the given <nl> / / arguments . The receiver is the TOS . <nl> void CodeGenerator : : CallWithArguments ( ZoneList < Expression * > * args , <nl> void CompareStub : : Generate ( MacroAssembler * masm ) { <nl> __ push ( edx ) ; <nl> __ push ( ecx ) ; <nl> <nl> - / / Inlined floating point compare . <nl> - / / Call builtin if operands are not floating point or smi . <nl> - Label check_for_symbols ; <nl> - Label unordered ; <nl> - if ( CpuFeatures : : IsSupported ( SSE2 ) ) { <nl> - CpuFeatures : : Scope use_sse2 ( SSE2 ) ; <nl> - CpuFeatures : : Scope use_cmov ( CMOV ) ; <nl> + / / Generate the number comparison code . <nl> + if ( include_number_compare_ ) { <nl> + Label non_number_comparison ; <nl> + Label unordered ; <nl> + if ( CpuFeatures : : IsSupported ( SSE2 ) ) { <nl> + CpuFeatures : : Scope use_sse2 ( SSE2 ) ; <nl> + CpuFeatures : : Scope use_cmov ( CMOV ) ; <nl> + <nl> + FloatingPointHelper : : LoadSSE2Operands ( masm , & non_number_comparison ) ; <nl> + __ comisd ( xmm0 , xmm1 ) ; <nl> + <nl> + / / Don ' t base result on EFLAGS when a NaN is involved . <nl> + __ j ( parity_even , & unordered , not_taken ) ; <nl> + / / Return a result of - 1 , 0 , or 1 , based on EFLAGS . <nl> + __ mov ( eax , 0 ) ; / / equal <nl> + __ mov ( ecx , Immediate ( Smi : : FromInt ( 1 ) ) ) ; <nl> + __ cmov ( above , eax , Operand ( ecx ) ) ; <nl> + __ mov ( ecx , Immediate ( Smi : : FromInt ( - 1 ) ) ) ; <nl> + __ cmov ( below , eax , Operand ( ecx ) ) ; <nl> + __ ret ( 2 * kPointerSize ) ; <nl> + } else { <nl> + FloatingPointHelper : : CheckFloatOperands ( <nl> + masm , & non_number_comparison , ebx ) ; <nl> + FloatingPointHelper : : LoadFloatOperands ( masm , ecx ) ; <nl> + __ FCmp ( ) ; <nl> <nl> - FloatingPointHelper : : LoadSSE2Operands ( masm , & check_for_symbols ) ; <nl> - __ comisd ( xmm0 , xmm1 ) ; <nl> + / / Don ' t base result on EFLAGS when a NaN is involved . <nl> + __ j ( parity_even , & unordered , not_taken ) ; <nl> <nl> - / / Jump to builtin for NaN . <nl> - __ j ( parity_even , & unordered , not_taken ) ; <nl> - __ mov ( eax , 0 ) ; / / equal <nl> - __ mov ( ecx , Immediate ( Smi : : FromInt ( 1 ) ) ) ; <nl> - __ cmov ( above , eax , Operand ( ecx ) ) ; <nl> - __ mov ( ecx , Immediate ( Smi : : FromInt ( - 1 ) ) ) ; <nl> - __ cmov ( below , eax , Operand ( ecx ) ) ; <nl> - __ ret ( 2 * kPointerSize ) ; <nl> - } else { <nl> - FloatingPointHelper : : CheckFloatOperands ( masm , & check_for_symbols , ebx ) ; <nl> - FloatingPointHelper : : LoadFloatOperands ( masm , ecx ) ; <nl> - __ FCmp ( ) ; <nl> + Label below_label , above_label ; <nl> + / / Return a result of - 1 , 0 , or 1 , based on EFLAGS . In all cases remove <nl> + / / two arguments from the stack as they have been pushed in preparation <nl> + / / of a possible runtime call . <nl> + __ j ( below , & below_label , not_taken ) ; <nl> + __ j ( above , & above_label , not_taken ) ; <nl> <nl> - / / Jump to builtin for NaN . <nl> - __ j ( parity_even , & unordered , not_taken ) ; <nl> + __ xor_ ( eax , Operand ( eax ) ) ; <nl> + __ ret ( 2 * kPointerSize ) ; <nl> <nl> - Label below_lbl , above_lbl ; <nl> - / / Return a result of - 1 , 0 , or 1 , to indicate result of comparison . <nl> - __ j ( below , & below_lbl , not_taken ) ; <nl> - __ j ( above , & above_lbl , not_taken ) ; <nl> + __ bind ( & below_label ) ; <nl> + __ mov ( eax , Immediate ( Smi : : FromInt ( - 1 ) ) ) ; <nl> + __ ret ( 2 * kPointerSize ) ; <nl> <nl> - __ xor_ ( eax , Operand ( eax ) ) ; / / equal <nl> - / / Both arguments were pushed in case a runtime call was needed . <nl> - __ ret ( 2 * kPointerSize ) ; <nl> - <nl> - __ bind ( & below_lbl ) ; <nl> - __ mov ( eax , Immediate ( Smi : : FromInt ( - 1 ) ) ) ; <nl> - __ ret ( 2 * kPointerSize ) ; <nl> + __ bind ( & above_label ) ; <nl> + __ mov ( eax , Immediate ( Smi : : FromInt ( 1 ) ) ) ; <nl> + __ ret ( 2 * kPointerSize ) ; <nl> + } <nl> <nl> - __ bind ( & above_lbl ) ; <nl> - __ mov ( eax , Immediate ( Smi : : FromInt ( 1 ) ) ) ; <nl> + / / If one of the numbers was NaN , then the result is always false . <nl> + / / The cc is never not - equal . <nl> + __ bind ( & unordered ) ; <nl> + ASSERT ( cc_ ! = not_equal ) ; <nl> + if ( cc_ = = less | | cc_ = = less_equal ) { <nl> + __ mov ( eax , Immediate ( Smi : : FromInt ( 1 ) ) ) ; <nl> + } else { <nl> + __ mov ( eax , Immediate ( Smi : : FromInt ( - 1 ) ) ) ; <nl> + } <nl> __ ret ( 2 * kPointerSize ) ; / / eax , edx were pushed <nl> + <nl> + / / The number comparison code did not provide a valid result . <nl> + __ bind ( & non_number_comparison ) ; <nl> } <nl> - / / If one of the numbers was NaN , then the result is always false . <nl> - / / The cc is never not - equal . <nl> - __ bind ( & unordered ) ; <nl> - ASSERT ( cc_ ! = not_equal ) ; <nl> - if ( cc_ = = less | | cc_ = = less_equal ) { <nl> - __ mov ( eax , Immediate ( Smi : : FromInt ( 1 ) ) ) ; <nl> - } else { <nl> - __ mov ( eax , Immediate ( Smi : : FromInt ( - 1 ) ) ) ; <nl> - } <nl> - __ ret ( 2 * kPointerSize ) ; / / eax , edx were pushed <nl> <nl> / / Fast negative check for symbol - to - symbol equality . <nl> - __ bind ( & check_for_symbols ) ; <nl> Label check_for_strings ; <nl> if ( cc_ = = equal ) { <nl> BranchIfNonSymbol ( masm , & check_for_strings , eax , ecx ) ; <nl> int CompareStub : : MinorKey ( ) { <nl> / / Encode the three parameters in a unique 16 bit value . To avoid duplicate <nl> / / stubs the never NaN NaN condition is only taken into account if the <nl> / / condition is equals . <nl> - ASSERT ( static_cast < unsigned > ( cc_ ) < ( 1 < < 14 ) ) ; <nl> + ASSERT ( static_cast < unsigned > ( cc_ ) < ( 1 < < 13 ) ) ; <nl> return ConditionField : : encode ( static_cast < unsigned > ( cc_ ) ) <nl> | StrictField : : encode ( strict_ ) <nl> - | NeverNanNanField : : encode ( cc_ = = equal ? never_nan_nan_ : false ) ; <nl> + | NeverNanNanField : : encode ( cc_ = = equal ? never_nan_nan_ : false ) <nl> + | IncludeNumberCompareField : : encode ( include_number_compare_ ) ; <nl> } <nl> <nl> <nl> void StringCompareStub : : GenerateCompareFlatAsciiStrings ( MacroAssembler * masm , <nl> Label result_not_equal ; <nl> Label result_greater ; <nl> Label compare_lengths ; <nl> + <nl> + __ IncrementCounter ( & Counters : : string_compare_native , 1 ) ; <nl> + <nl> / / Find minimum length . <nl> Label left_shorter ; <nl> __ mov ( scratch1 , FieldOperand ( left , String : : kLengthOffset ) ) ; <nl> void StringCompareStub : : Generate ( MacroAssembler * masm ) { <nl> __ JumpIfNotBothSequentialAsciiStrings ( edx , eax , ecx , ebx , & runtime ) ; <nl> <nl> / / Compare flat ascii strings . <nl> - __ IncrementCounter ( & Counters : : string_compare_native , 1 ) ; <nl> GenerateCompareFlatAsciiStrings ( masm , edx , eax , ecx , ebx , edi ) ; <nl> <nl> / / Call the runtime ; it returns - 1 ( less ) , 0 ( equal ) , or 1 ( greater ) <nl> mmm a / src / ia32 / codegen - ia32 . h <nl> ppp b / src / ia32 / codegen - ia32 . h <nl> class CodeGenerator : public AstVisitor { <nl> Condition cc , <nl> bool strict , <nl> ControlDestination * destination ) ; <nl> + void GenerateInlineNumberComparison ( Result * left_side , <nl> + Result * right_side , <nl> + Condition cc , <nl> + ControlDestination * dest ) ; <nl> <nl> / / To prevent long attacker - controlled byte sequences , integer constants <nl> / / from the JavaScript source are loaded in two parts if they are larger <nl> mmm a / src / jump - target . cc <nl> ppp b / src / jump - target . cc <nl> void JumpTarget : : Branch ( Condition cc , Result * arg , Hint hint ) { <nl> } <nl> <nl> <nl> + void JumpTarget : : Branch ( Condition cc , Result * arg0 , Result * arg1 , Hint hint ) { <nl> + ASSERT ( cgen ( ) - > has_valid_frame ( ) ) ; <nl> + <nl> + / / We want to check that non - frame registers at the call site stay in <nl> + / / the same registers on the fall - through branch . <nl> + DECLARE_ARGCHECK_VARS ( arg0 ) ; <nl> + DECLARE_ARGCHECK_VARS ( arg1 ) ; <nl> + <nl> + cgen ( ) - > frame ( ) - > Push ( arg0 ) ; <nl> + cgen ( ) - > frame ( ) - > Push ( arg1 ) ; <nl> + DoBranch ( cc , hint ) ; <nl> + * arg1 = cgen ( ) - > frame ( ) - > Pop ( ) ; <nl> + * arg0 = cgen ( ) - > frame ( ) - > Pop ( ) ; <nl> + <nl> + ASSERT_ARGCHECK ( arg0 ) ; <nl> + ASSERT_ARGCHECK ( arg1 ) ; <nl> + } <nl> + <nl> + <nl> void BreakTarget : : Branch ( Condition cc , Result * arg , Hint hint ) { <nl> ASSERT ( cgen ( ) - > has_valid_frame ( ) ) ; <nl> <nl> void JumpTarget : : Bind ( Result * arg ) { <nl> } <nl> <nl> <nl> + void JumpTarget : : Bind ( Result * arg0 , Result * arg1 ) { <nl> + if ( cgen ( ) - > has_valid_frame ( ) ) { <nl> + cgen ( ) - > frame ( ) - > Push ( arg0 ) ; <nl> + cgen ( ) - > frame ( ) - > Push ( arg1 ) ; <nl> + } <nl> + DoBind ( ) ; <nl> + * arg1 = cgen ( ) - > frame ( ) - > Pop ( ) ; <nl> + * arg0 = cgen ( ) - > frame ( ) - > Pop ( ) ; <nl> + } <nl> + <nl> + <nl> void JumpTarget : : AddReachingFrame ( VirtualFrame * frame ) { <nl> ASSERT ( reaching_frames_ . length ( ) = = merge_labels_ . length ( ) ) ; <nl> ASSERT ( entry_frame_ = = NULL ) ; <nl> mmm a / src / jump - target . h <nl> ppp b / src / jump - target . h <nl> class JumpTarget : public ZoneObject { / / Shadows are dynamically allocated . <nl> / / the target and the fall - through . <nl> virtual void Branch ( Condition cc , Hint hint = no_hint ) ; <nl> virtual void Branch ( Condition cc , Result * arg , Hint hint = no_hint ) ; <nl> + virtual void Branch ( Condition cc , <nl> + Result * arg0 , <nl> + Result * arg1 , <nl> + Hint hint = no_hint ) ; <nl> <nl> / / Bind a jump target . If there is no current frame at the binding <nl> / / site , there must be at least one frame reaching via a forward <nl> / / jump . <nl> virtual void Bind ( ) ; <nl> virtual void Bind ( Result * arg ) ; <nl> + virtual void Bind ( Result * arg0 , Result * arg1 ) ; <nl> <nl> / / Emit a call to a jump target . There must be a current frame at <nl> / / the call . The frame at the target is the same as the current <nl> mmm a / src / x64 / codegen - x64 . cc <nl> ppp b / src / x64 / codegen - x64 . cc <nl> int CompareStub : : MinorKey ( ) { <nl> / / Encode the three parameters in a unique 16 bit value . To avoid duplicate <nl> / / stubs the never NaN NaN condition is only taken into account if the <nl> / / condition is equals . <nl> - ASSERT ( static_cast < unsigned > ( cc_ ) < ( 1 < < 14 ) ) ; <nl> + ASSERT ( static_cast < unsigned > ( cc_ ) < ( 1 < < 13 ) ) ; <nl> return ConditionField : : encode ( static_cast < unsigned > ( cc_ ) ) <nl> | StrictField : : encode ( strict_ ) <nl> - | NeverNanNanField : : encode ( cc_ = = equal ? never_nan_nan_ : false ) ; <nl> + | NeverNanNanField : : encode ( cc_ = = equal ? never_nan_nan_ : false ) <nl> + | IncludeNumberCompareField : : encode ( include_number_compare_ ) ; <nl> } <nl> <nl> <nl>
Inline floating point compare
v8/v8
9240342ad6abf3553b3239ab5208c48edc240f71
2010-03-23T12:36:31Z
new file mode 100644 <nl> index 00000000000 . . d8eaf6f67b6 <nl> mmm / dev / null <nl> ppp b / tests / queries / 0_stateless / 01495_subqueries_in_with_statement_2 . reference <nl> <nl> + 0 <nl> + 1 <nl> + 2 <nl> + 3 <nl> + 4 <nl> + 0 <nl> + 1 <nl> + 2 <nl> + 3 <nl> + 4 <nl> + 5 <nl> + 6 <nl> + 7 <nl> + 8 <nl> + 9 <nl> + 0 <nl> + 1 <nl> + 2 <nl> + 3 <nl> + 4 <nl> + 1 <nl> + 1 <nl> + 3 <nl> + 3 <nl> + 1 <nl> + 3 <nl> new file mode 100644 <nl> index 00000000000 . . 7ec4eeaa778 <nl> mmm / dev / null <nl> ppp b / tests / queries / 0_stateless / 01495_subqueries_in_with_statement_2 . sql <nl> <nl> + <nl> + WITH <nl> + x AS ( SELECT number AS a FROM numbers ( 10 ) ) , <nl> + y AS ( SELECT number AS a FROM numbers ( 5 ) ) <nl> + SELECT * FROM x WHERE a in ( SELECT a FROM y ) <nl> + ORDER BY a ; <nl> + <nl> + WITH <nl> + x AS ( SELECT number AS a FROM numbers ( 10 ) ) , <nl> + y AS ( SELECT number AS a FROM numbers ( 5 ) ) <nl> + SELECT * FROM x left JOIN y USING a <nl> + ORDER BY a ; <nl> + <nl> + WITH <nl> + x AS ( SELECT number AS a FROM numbers ( 10 ) ) , <nl> + y AS ( SELECT number AS a FROM numbers ( 5 ) ) <nl> + SELECT * FROM x JOIN y USING a <nl> + ORDER BY x . a ; <nl> + <nl> + WITH <nl> + x AS ( SELECT number AS a FROM numbers ( 10 ) ) , <nl> + y AS ( SELECT number AS a FROM numbers ( 5 ) ) , <nl> + z AS ( SELECT toUInt64 ( 1 ) b ) <nl> + SELECT * FROM x JOIN y USING a WHERE a in ( SELECT * FROM z ) ; <nl> + <nl> + WITH <nl> + x AS ( SELECT number AS a FROM numbers ( 10 ) ) , <nl> + y AS ( SELECT number AS a FROM numbers ( 5 ) ) , <nl> + z AS ( SELECT * FROM x WHERE a % 2 ) , <nl> + w AS ( SELECT * FROM y WHERE a > 0 ) <nl> + SELECT * FROM x JOIN y USING a WHERE a in ( SELECT * FROM z ) <nl> + ORDER BY x . a ; <nl> + <nl> + WITH <nl> + x AS ( SELECT number AS a FROM numbers ( 10 ) ) , <nl> + y AS ( SELECT number AS a FROM numbers ( 5 ) ) , <nl> + z AS ( SELECT * FROM x WHERE a % 2 ) , <nl> + w AS ( SELECT * FROM y WHERE a > 0 ) <nl> + SELECT max ( a ) FROM x JOIN y USING a WHERE a in ( SELECT * FROM z ) <nl> + HAVING a > ( SELECT min ( a ) FROM w ) ; <nl> + <nl> + WITH <nl> + x AS ( SELECT number AS a FROM numbers ( 10 ) ) , <nl> + y AS ( SELECT number AS a FROM numbers ( 5 ) ) , <nl> + z AS ( SELECT * FROM x WHERE a % 2 ) , <nl> + w AS ( SELECT * FROM y WHERE a > 0 ) <nl> + SELECT a FROM x JOIN y USING a WHERE a in ( SELECT * FROM z ) <nl> + HAVING a < = ( SELECT max ( a ) FROM w ) <nl> + ORDER BY x . a ; <nl> new file mode 100644 <nl> index 00000000000 . . 7cc310d9662 <nl> mmm / dev / null <nl> ppp b / tests / queries / 0_stateless / 01495_subqueries_in_with_statement_3 . reference <nl> <nl> + 4999 <nl> + 333 <nl> + 3333 <nl> + 2000 <nl> + 97 1 33 <nl> + 99 - 3299 3399 <nl> + 99 0 100 <nl> + 99 - 3299 3399 <nl> new file mode 100644 <nl> index 00000000000 . . 36cba596d00 <nl> mmm / dev / null <nl> ppp b / tests / queries / 0_stateless / 01495_subqueries_in_with_statement_3 . sql <nl> <nl> + DROP TABLE IF EXISTS cte1 ; <nl> + DROP TABLE IF EXISTS cte2 ; <nl> + <nl> + CREATE TABLE cte1 ( a Int64 ) ENGINE = Memory ; <nl> + CREATE TABLE cte2 ( a Int64 ) ENGINE = Memory ; <nl> + <nl> + INSERT INTO cte1 SELECT * FROM numbers ( 10000 ) ; <nl> + INSERT INTO cte2 SELECT * FROM numbers ( 5000 ) ; <nl> + <nl> + WITH <nl> + x AS ( SELECT * FROM cte1 ) , <nl> + y AS ( SELECT * FROM cte2 ) , <nl> + z AS ( SELECT * FROM x WHERE a % 2 = 1 ) , <nl> + w AS ( SELECT * FROM y WHERE a > 333 ) <nl> + SELECT max ( a ) <nl> + FROM x JOIN y USING ( a ) <nl> + WHERE a in ( SELECT * FROM z ) AND a < = ( SELECT max ( a ) FROM w ) ; <nl> + <nl> + WITH <nl> + x AS ( SELECT * FROM cte1 ) , <nl> + y AS ( SELECT * FROM cte2 ) , <nl> + z AS ( SELECT * FROM x WHERE a % 3 = 1 ) , <nl> + w AS ( SELECT * FROM y WHERE a > 333 AND a < 1000 ) <nl> + SELECT count ( a ) <nl> + FROM x left JOIN y USING ( a ) <nl> + WHERE a in ( SELECT * FROM z ) AND a < = ( SELECT max ( a ) FROM w ) ; <nl> + <nl> + WITH <nl> + x AS ( SELECT * FROM cte1 ) , <nl> + y AS ( SELECT * FROM cte2 ) , <nl> + z AS ( SELECT * FROM x WHERE a % 3 = 1 ) , <nl> + w AS ( SELECT * FROM y WHERE a > 333 AND a < 1000 ) <nl> + SELECT count ( a ) <nl> + FROM x left JOIN y USING ( a ) <nl> + WHERE a in ( SELECT * FROM z ) ; <nl> + <nl> + WITH <nl> + x AS ( SELECT a - 4000 a FROM cte1 WHERE cte1 . a > 700 ) , <nl> + y AS ( SELECT * FROM cte2 ) , <nl> + z AS ( SELECT * FROM x WHERE a % 3 = 1 ) , <nl> + w AS ( SELECT * FROM y WHERE a > 333 AND a < 1000 ) <nl> + SELECT count ( * ) <nl> + FROM x left JOIN y USING ( a ) <nl> + WHERE a in ( SELECT * FROM z ) ; <nl> + <nl> + WITH <nl> + x AS ( SELECT a - 4000 a FROM cte1 WHERE cte1 . a > 700 ) , <nl> + y AS ( SELECT * FROM cte2 ) , <nl> + z AS ( SELECT * FROM x WHERE a % 3 = 1 ) , <nl> + w AS ( SELECT * FROM y WHERE a > 333 AND a < 1000 ) <nl> + SELECT max ( a ) , min ( a ) , count ( * ) <nl> + FROM x <nl> + WHERE a in ( SELECT * FROM z ) AND a < 100 ; <nl> + <nl> + WITH <nl> + x AS ( SELECT a - 4000 a FROM cte1 WHERE cte1 . a > 700 ) , <nl> + y AS ( SELECT * FROM cte2 ) , <nl> + z AS ( SELECT * FROM x WHERE a % 3 = 1 ) , <nl> + w AS ( SELECT * FROM y WHERE a > 333 AND a < 1000 ) <nl> + SELECT max ( a ) , min ( a ) , count ( * ) FROM x <nl> + WHERE a < 100 ; <nl> + <nl> + WITH <nl> + x AS ( SELECT a - 4000 a FROM cte1 AS t WHERE cte1 . a > 700 ) , <nl> + y AS ( SELECT * FROM cte2 ) , <nl> + z AS ( SELECT * FROM x WHERE a % 3 = 1 ) , <nl> + w AS ( SELECT * FROM y WHERE a > 333 AND a < 1000 ) <nl> + SELECT max ( a ) , min ( a ) , count ( * ) <nl> + FROM y <nl> + WHERE a < 100 ; <nl> + <nl> + WITH <nl> + x AS ( SELECT a - 4000 a FROM cte1 t WHERE t . a > 700 ) , <nl> + y AS ( SELECT x . a a FROM x left JOIN cte1 USING ( a ) ) , <nl> + z AS ( SELECT * FROM x WHERE a % 3 = 1 ) , <nl> + w AS ( SELECT * FROM y WHERE a > 333 AND a < 1000 ) <nl> + SELECT max ( a ) , min ( a ) , count ( * ) <nl> + FROM y <nl> + WHERE a < 100 ; <nl> + <nl> + DROP TABLE cte1 ; <nl> + DROP TABLE cte2 ; <nl>
Merge pull request from den - crane / tests / cte2
ClickHouse/ClickHouse
ae9c8d08a6013dcc9a2bdc43878585c301abbe35
2020-11-04T20:40:19Z
mmm a / system / lib / pthread / library_pthread . c <nl> ppp b / system / lib / pthread / library_pthread . c <nl> static void _do_call ( em_queued_call * q ) <nl> case EM_PROXIED_FILENO : q - > returnValue . i = fileno ( q - > args [ 0 ] . vp ) ; break ; <nl> case EM_PROXIED_FPUTC : q - > returnValue . i = fputc ( q - > args [ 0 ] . i , q - > args [ 1 ] . vp ) ; break ; <nl> case EM_PROXIED_PUTCHAR : q - > returnValue . i = putchar ( q - > args [ 0 ] . i ) ; break ; <nl> - case EM_PROXIED_PUTS : q - > returnValue . i = putc ( q - > args [ 0 ] . i , q - > args [ 1 ] . vp ) ; break ; <nl> + case EM_PROXIED_PUTS : q - > returnValue . i = puts ( q - > args [ 0 ] . cp ) ; break ; <nl> case EM_PROXIED_FREAD : q - > returnValue . i = fread ( q - > args [ 0 ] . vp , q - > args [ 1 ] . i , q - > args [ 2 ] . i , q - > args [ 3 ] . vp ) ; break ; <nl> case EM_PROXIED_FREOPEN : q - > returnValue . vp = freopen ( q - > args [ 0 ] . cp , q - > args [ 1 ] . cp , q - > args [ 2 ] . vp ) ; break ; <nl> case EM_PROXIED_FSEEK : q - > returnValue . i = fseek ( q - > args [ 0 ] . vp , q - > args [ 1 ] . i , q - > args [ 2 ] . i ) ; break ; <nl>
Fix signature typo in EM_PROXIED_PUTS .
emscripten-core/emscripten
1b8662beef11cb6bdedc1711917a106c666a7b4a
2015-06-01T12:11:20Z
mmm a / modules / dreamview / backend / hmi / hmi . cc <nl> ppp b / modules / dreamview / backend / hmi / hmi . cc <nl> void HMI : : ChangeVehicleTo ( const std : : string & vehicle_name ) { <nl> RunModeCommand ( " stop " ) ; <nl> status_ . set_current_vehicle ( vehicle_name ) ; <nl> / / Check available updates for current vehicle . <nl> - CheckOTAUpdates ( ) ; <nl> + / / CheckOTAUpdates ( ) ; <nl> BroadcastHMIStatus ( ) ; <nl> } <nl> <nl>
HMI : Disbale OTA temporarily .
ApolloAuto/apollo
f5548712ffd227832c87aa2220572adfa854f686
2017-12-20T19:51:02Z
mmm a / atom / browser / browser_process_impl . cc <nl> ppp b / atom / browser / browser_process_impl . cc <nl> prefs : : InProcessPrefServiceFactory * BrowserProcessImpl : : pref_service_factory ( ) <nl> return nullptr ; <nl> } <nl> <nl> - content : : NetworkConnectionTracker * <nl> - BrowserProcessImpl : : network_connection_tracker ( ) { <nl> - return nullptr ; <nl> - } <nl> - <nl> void BrowserProcessImpl : : SetApplicationLocale ( const std : : string & locale ) { <nl> locale_ = locale ; <nl> } <nl> mmm a / atom / browser / browser_process_impl . h <nl> ppp b / atom / browser / browser_process_impl . h <nl> class BrowserProcessImpl : public BrowserProcess { <nl> shell_integration : : DefaultWebClientState CachedDefaultWebClientState ( ) <nl> override ; <nl> prefs : : InProcessPrefServiceFactory * pref_service_factory ( ) const override ; <nl> - content : : NetworkConnectionTracker * network_connection_tracker ( ) override ; <nl> void CreateDevToolsProtocolHandler ( ) override { } <nl> void CreateDevToolsAutoOpener ( ) override { } <nl> void set_background_mode_manager_for_test ( <nl>
Move NetworkConnectionTracker getter to network_service_instance . h
electron/electron
ffeab383b541df6830796621e023b4256a436a1c
2018-12-03T14:37:40Z
mmm a / src / ccstruct / imagedata . cpp <nl> ppp b / src / ccstruct / imagedata . cpp <nl> bool ImageData : : SkipDeSerialize ( TFile * fp ) { <nl> / / In case of missing PNG support in Leptonica use PNM format , <nl> / / which requires more memory . <nl> void ImageData : : SetPix ( Pix * pix ) { <nl> + # ifdef TESSERACT_IMAGEDATA_AS_PIX <nl> + internal_pix_ = pix ; <nl> + # else <nl> SetPixInternal ( pix , & image_data_ ) ; <nl> + # endif <nl> } <nl> <nl> / / Returns the Pix image for * this . Must be pixDestroyed after use . <nl> Pix * ImageData : : GetPix ( ) const { <nl> + # ifdef TESSERACT_IMAGEDATA_AS_PIX <nl> + # ifdef GRAPHICS_DISABLED <nl> + / * The only caller of this is the scaling functions to prescale the <nl> + * source . Thus we can just return a new pointer to the same data . * / <nl> + return pixClone ( internal_pix_ ) ; <nl> + # else <nl> + / * pixCopy always does an actual copy , so the caller can modify the <nl> + * changed data . * / <nl> + return pixCopy ( NULL , internal_pix_ ) ; <nl> + # endif <nl> + # else <nl> return GetPixInternal ( image_data_ ) ; <nl> + # endif <nl> } <nl> <nl> / / Gets anything and everything with a non - nullptr pointer , prescaled to a <nl> void ImageData : : AddBoxes ( const GenericVector < TBOX > & boxes , <nl> } <nl> } <nl> <nl> + # ifndef TESSERACT_IMAGEDATA_AS_PIX <nl> / / Saves the given Pix as a PNG - encoded string and destroys it . <nl> / / In case of missing PNG support in Leptonica use PNM format , <nl> / / which requires more memory . <nl> Pix * ImageData : : GetPixInternal ( const GenericVector < char > & image_data ) { <nl> } <nl> return pix ; <nl> } <nl> + # endif <nl> <nl> / / Parses the text string as a box file and adds any discovered boxes that <nl> / / match the page number . Returns false on error . <nl> mmm a / src / ccstruct / imagedata . h <nl> ppp b / src / ccstruct / imagedata . h <nl> class ImageData { <nl> private : <nl> STRING imagefilename_ ; / / File to read image from . <nl> int32_t page_number_ ; / / Page number if multi - page tif or - 1 . <nl> + # ifdef TESSERACT_IMAGEDATA_AS_PIX <nl> + Pix * internal_pix_ ; <nl> + # endif <nl> GenericVector < char > image_data_ ; / / PNG / PNM file data . <nl> STRING language_ ; / / Language code for image . <nl> STRING transcription_ ; / / UTF - 8 ground truth of image . <nl>
Avoid tesseract writing Pix out / reading them back .
tesseract-ocr/tesseract
6bcb941bcff5e73b62ecc8d2aa5691d3e0e7afc0
2020-05-04T20:01:22Z
mmm a / CMakeLists . txt <nl> ppp b / CMakeLists . txt <nl> if ( BIICODE ) <nl> return ( ) <nl> endif ( ) <nl> <nl> + add_library ( cppformat $ { FMT_SOURCES } ) <nl> if ( BUILD_SHARED_LIBS ) <nl> - add_library ( cppformat SHARED $ { FMT_SOURCES } ) <nl> - if ( UNIX AND NOT APPLE ) <nl> - # Fix rpmlint warning : <nl> - # unused - direct - shlib - dependency / usr / lib / libformat . so . 1 . 1 . 0 / lib / libm . so . 6 . <nl> - target_link_libraries ( cppformat - Wl , - - as - needed ) <nl> - endif ( ) <nl> - else ( ) <nl> - add_library ( cppformat $ { FMT_SOURCES } ) <nl> - endif ( ) <nl> + if ( UNIX AND NOT APPLE ) <nl> + # Fix rpmlint warning : <nl> + # unused - direct - shlib - dependency / usr / lib / libformat . so . 1 . 1 . 0 / lib / libm . so . 6 . <nl> + target_link_libraries ( cppformat - Wl , - - as - needed ) <nl> + endif ( ) <nl> + set ( FMT_EXTRA_COMPILE_FLAGS - DFMT_EXPORT ) <nl> + endif ( ) <nl> <nl> if ( FMT_PEDANTIC AND <nl> ( CMAKE_COMPILER_IS_GNUCXX OR ( CMAKE_CXX_COMPILER_ID MATCHES " Clang " ) ) ) <nl> - set ( FMT_EXTRA_COMPILE_FLAGS " - Wall - Wextra - Wshadow - pedantic " ) <nl> + set ( FMT_EXTRA_COMPILE_FLAGS <nl> + " $ { FMT_EXTRA_COMPILE_FLAGS } - Wall - Wextra - Wshadow - pedantic " ) <nl> endif ( ) <nl> <nl> # If FMT_PEDANTIC is TRUE , then test compilation with both - std = c + + 11 <nl> if ( CPP11_FLAG AND FMT_PEDANTIC ) <nl> set ( FMT_TEST_DEFAULT_FLAGS TRUE ) <nl> endif ( ) <nl> <nl> - if ( BUILD_SHARED_LIBS ) <nl> - set ( FMT_EXTRA_COMPILE_FLAGS " $ { FMT_EXTRA_COMPILE_FLAGS } - DFMT_EXPORT " ) <nl> - endif ( ) <nl> - <nl> set_target_properties ( cppformat <nl> PROPERTIES COMPILE_FLAGS " $ { FMT_EXTRA_COMPILE_FLAGS } " ) <nl> <nl> mmm a / format . h <nl> ppp b / format . h <nl> typedef long long intmax_t ; <nl> # include < iterator > <nl> # endif <nl> <nl> - # if ! defined ( FMT_HEADER_ONLY ) & & ( defined ( _WIN32 ) | | defined ( __WIN32__ ) | | defined ( WIN32 ) ) <nl> + # if ! defined ( FMT_HEADER_ONLY ) & & defined ( _WIN32 ) <nl> # ifdef FMT_EXPORT <nl> # define FMT_API __declspec ( dllexport ) <nl> # elif defined ( FMT_SHARED ) <nl> # define FMT_API __declspec ( dllimport ) <nl> - # else <nl> - # define FMT_API <nl> # endif <nl> - # else <nl> + # endif <nl> + # ifndef FMT_API <nl> # define FMT_API <nl> # endif <nl> <nl> class UTF16ToUTF8 { <nl> } ; <nl> <nl> FMT_API void format_windows_error ( fmt : : Writer & out , int error_code , <nl> - fmt : : StringRef message ) FMT_NOEXCEPT ; <nl> + fmt : : StringRef message ) FMT_NOEXCEPT ; <nl> # endif <nl> <nl> FMT_API void format_system_error ( fmt : : Writer & out , int error_code , <nl> - fmt : : StringRef message ) FMT_NOEXCEPT ; <nl> + fmt : : StringRef message ) FMT_NOEXCEPT ; <nl> <nl> / / A formatting argument value . <nl> struct Value { <nl> class PrintfFormatter : private FormatterBase { <nl> <nl> public : <nl> explicit PrintfFormatter ( const ArgList & args ) : FormatterBase ( args ) { } <nl> - FMT_API void format ( BasicWriter < Char > & writer , BasicCStringRef < Char > format_str ) ; <nl> + FMT_API void format ( BasicWriter < Char > & writer , <nl> + BasicCStringRef < Char > format_str ) ; <nl> } ; <nl> } / / namespace internal <nl> <nl> void format ( BasicFormatter < Char > & f , const Char * & format_str , const T & value ) { <nl> <nl> / / Reports a system error without throwing an exception . <nl> / / Can be used to report errors from destructors . <nl> - FMT_API void report_system_error ( int error_code , StringRef message ) FMT_NOEXCEPT ; <nl> + FMT_API void report_system_error ( int error_code , <nl> + StringRef message ) FMT_NOEXCEPT ; <nl> <nl> # if FMT_USE_WINDOWS_H <nl> <nl> class WindowsError : public SystemError { <nl> <nl> / / Reports a Windows error without throwing an exception . <nl> / / Can be used to report errors from destructors . <nl> - FMT_API void report_windows_error ( int error_code , StringRef message ) FMT_NOEXCEPT ; <nl> + FMT_API void report_windows_error ( int error_code , <nl> + StringRef message ) FMT_NOEXCEPT ; <nl> <nl> # endif <nl> <nl> mmm a / test / CMakeLists . txt <nl> ppp b / test / CMakeLists . txt <nl> set ( FMT_GMOCK_DIR . . / gmock ) <nl> <nl> include_directories ( . . $ { FMT_GMOCK_DIR } ) <nl> <nl> - if ( BUILD_SHARED_LIBS ) <nl> - set ( FMT_IMPORT " - DFMT_SHARED " ) <nl> - endif ( ) <nl> + # Links target with cppformat and any libraries passed as extra arguments . <nl> + function ( target_link_cppformat target ) <nl> + target_link_libraries ( $ { target } cppformat $ { ARGN } ) <nl> + if ( BUILD_SHARED_LIBS ) <nl> + set_target_properties ( $ { target } PROPERTIES COMPILE_FLAGS - DFMT_SHARED ) <nl> + endif ( ) <nl> + endfunction ( ) <nl> <nl> # We compile Google Test ourselves instead of using pre - compiled libraries . <nl> # See the Google Test FAQ " Why is it not recommended to install a <nl> endif ( ) <nl> <nl> set ( TEST_MAIN_SRC test - main . cc gtest - extra . cc gtest - extra . h util . cc ) <nl> add_library ( test - main STATIC $ { TEST_MAIN_SRC } ) <nl> - set_target_properties ( test - main PROPERTIES COMPILE_FLAGS " $ { FMT_IMPORT } " ) <nl> - target_link_libraries ( test - main cppformat gmock ) <nl> + target_link_cppformat ( test - main gmock ) <nl> <nl> # Adds a test . <nl> # Usage : add_fmt_test ( name [ CUSTOM_LINK ] srcs . . . ) <nl> function ( add_fmt_test name ) <nl> add_executable ( $ { name } $ { name } . cc $ { add_fmt_test_UNPARSED_ARGUMENTS } ) <nl> target_link_libraries ( $ { name } test - main ) <nl> if ( NOT add_fmt_test_CUSTOM_LINK ) <nl> - set_target_properties ( $ { name } PROPERTIES COMPILE_FLAGS " $ { FMT_IMPORT } " ) <nl> - target_link_libraries ( $ { name } cppformat ) <nl> + target_link_cppformat ( $ { name } ) <nl> endif ( ) <nl> add_test ( NAME $ { name } COMMAND $ { name } ) <nl> endfunction ( ) <nl>
Simplify CMake config and do minor adjustments
fmtlib/fmt
1cba0aea27915c06192b47f2d4429c8ddaad3aa8
2015-12-10T15:24:23Z
mmm a / hphp / hack / src / client / ide_service / clientIdeDaemon . ml <nl> ppp b / hphp / hack / src / client / ide_service / clientIdeDaemon . ml <nl> let handle_message : <nl> ~ path <nl> ~ file_input : ( ServerCommandTypes . FileContent file_contents ) <nl> in <nl> - ( * Do a typecheck just to warm up the caches when you open a file . In the <nl> - future , we ' ll actually surface typechecking errors . * ) <nl> - let _tast : Tast . program = Provider_utils . compute_tast ~ ctx ~ entry in <nl> + ( * Do a typecheck just to warm up the caches when you open a file . In <nl> + the future , we ' ll actually surface typechecking errors . * ) <nl> + let ( _tast , _errors ) = <nl> + Provider_utils . compute_tast_and_errors ~ ctx ~ entry <nl> + in <nl> Lwt . return ( state , Handle_message_result . Response ( ) ) <nl> | ( Initialized { server_env ; _ } , Hover document_location ) - > <nl> let ( ctx , entry ) = <nl> let handle_message : <nl> in <nl> let matches = <nl> Provider_utils . with_context ~ ctx ~ f : ( fun ( ) - > <nl> - let tast = Provider_utils . compute_tast ~ ctx ~ entry in <nl> + let ( tast , _errors ) = <nl> + Provider_utils . compute_tast_and_errors ~ ctx ~ entry <nl> + in <nl> AutocompleteService . go ~ tcopt ~ autocomplete_context ~ sienv tast ) <nl> in <nl> let result = <nl> mmm a / hphp / hack / src / providers / provider_utils . ml <nl> ppp b / hphp / hack / src / providers / provider_utils . ml <nl> let update_context <nl> in <nl> ( ctx , entry ) <nl> <nl> - let compute_tast ~ ( ctx : Provider_context . t ) ~ ( entry : Provider_context . entry ) <nl> - : Tast . program = <nl> - Errors . ignore_ ( fun ( ) - > <nl> - let make_tast ( ) = <nl> - let nast = Naming . program entry . Provider_context . ast in <nl> - Typing . nast_to_tast ctx . Provider_context . tcopt nast <nl> - in <nl> - match Provider_context . get_global_context ( ) with <nl> - | None - > with_context ~ ctx ~ f : make_tast <nl> - | Some _ - > <nl> - ( * No need for [ with_context ] - - assume that ' s already the context we ' re <nl> - operating under . * ) <nl> - make_tast ( ) ) <nl> - <nl> let compute_tast_and_errors <nl> ~ ( ctx : Provider_context . t ) ~ ( entry : Provider_context . entry ) : <nl> - Errors . t * Tast . program = <nl> - let ( nast_errors , nast ) = <nl> - Errors . do_with_context entry . Provider_context . path Errors . Naming ( fun ( ) - > <nl> - Naming . program entry . Provider_context . ast ) <nl> - in <nl> - let ( tast_errors , tast ) = <nl> - Errors . do_with_context entry . Provider_context . path Errors . Typing ( fun ( ) - > <nl> - Typing . nast_to_tast ctx . Provider_context . tcopt nast ) <nl> + Tast . program * Errors . t = <nl> + let make_tast ( ) = <nl> + let ( errors , tast ) = <nl> + Errors . do_ ( fun ( ) - > <nl> + let nast = Naming . program entry . Provider_context . ast in <nl> + let tast = Typing . nast_to_tast ctx . Provider_context . tcopt nast in <nl> + tast ) <nl> + in <nl> + ( tast , errors ) <nl> in <nl> - let errors = Errors . merge nast_errors tast_errors in <nl> - ( errors , tast ) <nl> + ( * If global context is not set , set it and proceed * ) <nl> + match Provider_context . get_global_context ( ) with <nl> + | None - > with_context ~ ctx ~ f : make_tast <nl> + | Some _ - > make_tast ( ) <nl> mmm a / hphp / hack / src / providers / provider_utils . mli <nl> ppp b / hphp / hack / src / providers / provider_utils . mli <nl> <nl> * <nl> * ) <nl> <nl> - ( * * Compute the TAST by doing typechecking / type inference for the given entry in <nl> - the given context . Note : this function uses Provider_context . with_context <nl> - in case a ' with_context ' isn ' t already in force . * ) <nl> - val compute_tast : <nl> - ctx : Provider_context . t - > entry : Provider_context . entry - > Tast . program <nl> - <nl> - ( * * Compute TAST and error - list by doing typechecking / type inference for the <nl> - given entry in the given context . Note : this function does not use <nl> - Provider_context . with_context , so if one isn ' t already in force , then it <nl> - won ' t be for the duration of this function . * ) <nl> - val compute_tast_and_errors : <nl> - ctx : Provider_context . t - > <nl> - entry : Provider_context . entry - > <nl> - Errors . t * Tast . program <nl> - <nl> ( * * Compute the given AST for the given path , and return an updated [ t ] <nl> containing that entry . * ) <nl> val update_context : <nl> val update_context : <nl> file_input : ServerCommandTypes . file_input - > <nl> Provider_context . t * Provider_context . entry <nl> <nl> - ( * * Load the declarations of [ t ] and call [ f ] , then unload those declarations . <nl> - * ) <nl> + ( * * Load the declarations of [ t ] into any global - memory storage , then call <nl> + [ f ] , then unload those declarations . * ) <nl> val with_context : ctx : Provider_context . t - > f : ( unit - > ' a ) - > ' a <nl> + <nl> + ( * * Compute TAST and error - list by doing typechecking / type inference for the <nl> + given entry in the given context . Note that you must call this function <nl> + within a [ with_context ] , to ensure that all global state reflects the <nl> + contents of the context . * ) <nl> + val compute_tast_and_errors : <nl> + ctx : Provider_context . t - > <nl> + entry : Provider_context . entry - > <nl> + Tast . program * Errors . t <nl> mmm a / hphp / hack / src / server / serverBigCode . ml <nl> ppp b / hphp / hack / src / server / serverBigCode . ml <nl> let go : ServerEnv . env - > string - > string = <nl> ~ file_input : ( ServerCommandTypes . FileContent file_content ) <nl> in <nl> ( * Extract TAST and convert to string * ) <nl> - let tast = Provider_utils . compute_tast ~ ctx ~ entry in <nl> + let ( tast , _ ) = Provider_utils . compute_tast_and_errors ~ ctx ~ entry in <nl> let serialized_tast = serialize_tast tast env . ServerEnv . tcopt in <nl> ( * Visit the TAST and extract autocompleteion items for Acclass_get * ) <nl> let data = ( new visitor ) # get_entries tast in <nl> mmm a / hphp / hack / src / server / serverColorFile . ml <nl> ppp b / hphp / hack / src / server / serverColorFile . ml <nl> let go tcopt naming_table f_in = <nl> <nl> let go_ctx ~ ( ctx : Provider_context . t ) ~ ( entry : Provider_context . entry ) = <nl> try <nl> - let tast = Provider_utils . compute_tast ~ ctx ~ entry in <nl> + let ( tast , _errors ) = Provider_utils . compute_tast_and_errors ~ ctx ~ entry in <nl> Coverage_level . get_levels tast entry . Provider_context . path <nl> with _ - > <nl> ( * The " Fixme Provider " will throw an exception if the file cannot be found . <nl> mmm a / hphp / hack / src / server / serverHighlightRefs . ml <nl> ppp b / hphp / hack / src / server / serverHighlightRefs . ml <nl> let go_ctx <nl> ~ ( column : int ) <nl> ~ ( tcopt : TypecheckerOptions . t ) : ServerHighlightRefsTypes . result = <nl> let { Provider_context . path ; ast ; _ } = entry in <nl> - let symbol_to_highlight = <nl> - IdentifySymbolService . go <nl> - ( Provider_utils . compute_tast ~ ctx ~ entry ) <nl> - line <nl> - column <nl> - in <nl> + let ( tast , _errors ) = Provider_utils . compute_tast_and_errors ~ ctx ~ entry in <nl> + let symbol_to_highlight = IdentifySymbolService . go tast line column in <nl> let file_info = Provider_context . get_fileinfo entry in <nl> let results = <nl> List . fold symbol_to_highlight ~ init : [ ] ~ f : ( fun acc s - > <nl> mmm a / hphp / hack / src / server / serverHover . ml <nl> ppp b / hphp / hack / src / server / serverHover . ml <nl> let go_ctx <nl> ~ ( line : int ) <nl> ~ ( column : int ) : HoverService . result = <nl> let identities = ServerIdentifyFunction . go_ctx ~ ctx ~ entry ~ line ~ column in <nl> + let ( tast , _errors ) = Provider_utils . compute_tast_and_errors ~ ctx ~ entry in <nl> let env_and_ty = <nl> - ServerInferType . type_at_pos <nl> - ( Provider_utils . compute_tast ~ ctx ~ entry ) <nl> - line <nl> - column <nl> + ServerInferType . type_at_pos tast line column <nl> | > Option . map ~ f : ( fun ( env , ty ) - > ( env , Tast_expand . expand_ty env ty ) ) <nl> in <nl> ( * There are legitimate cases where we expect to have no identities returned , <nl> mmm a / hphp / hack / src / server / serverIdentifyFunction . ml <nl> ppp b / hphp / hack / src / server / serverIdentifyFunction . ml <nl> let go_ctx <nl> ~ ( entry : Provider_context . entry ) <nl> ~ ( line : int ) <nl> ~ ( column : int ) = <nl> - let symbols = <nl> - IdentifySymbolService . go <nl> - ( Provider_utils . compute_tast ~ ctx ~ entry ) <nl> - line <nl> - column <nl> - in <nl> + let ( tast , _errors ) = Provider_utils . compute_tast_and_errors ~ ctx ~ entry in <nl> + let symbols = IdentifySymbolService . go tast line column in <nl> let symbols = take_best_suggestions ( List . sort by_nesting symbols ) in <nl> List . map symbols ~ f : ( fun symbol - > <nl> let symbol_definition = <nl> mmm a / hphp / hack / src / server / serverTypeDefinition . ml <nl> ppp b / hphp / hack / src / server / serverTypeDefinition . ml <nl> let go_ctx <nl> ~ ( entry : Provider_context . entry ) <nl> ~ ( line : int ) <nl> ~ ( column : int ) : ServerCommandTypes . Go_to_type_definition . result = <nl> - let tast = Provider_utils . compute_tast ~ ctx ~ entry in <nl> + let ( tast , _errors ) = Provider_utils . compute_tast_and_errors ~ ctx ~ entry in <nl> go_common tast ~ line ~ column <nl> <nl> let go <nl> mmm a / hphp / hack / test / integration_ml / test_server_hover . ml <nl> ppp b / hphp / hack / test / integration_ml / test_server_hover . ml <nl> let test ( ) = <nl> ~ path <nl> ~ file_input <nl> in <nl> - let hover = ServerHover . go_ctx ~ ctx ~ entry ~ line ~ column in <nl> + let hover = <nl> + Provider_utils . with_context ~ ctx ~ f : ( fun ( ) - > <nl> + ServerHover . go_ctx ~ ctx ~ entry ~ line ~ column ) <nl> + in <nl> let expected = list_to_string expectedHover in <nl> let actual = list_to_string hover in <nl> if expected < > actual then <nl>
Clean up ` Provider_utils . compute_tast_and_errors `
facebook/hhvm
6ea775f60b6908aa5688ce3bbc065a0b03966a10
2019-11-05T23:47:31Z
mmm a / hphp / hack / src / parser / full_fidelity_ast . ml <nl> ppp b / hphp / hack / src / parser / full_fidelity_ast . ml <nl> module SyntaxKind = Full_fidelity_syntax_kind <nl> module TK = Full_fidelity_token_kind <nl> module SourceText = Trivia . SourceText <nl> <nl> + type expr_location = <nl> + | TopLevel <nl> + | MemberSelect <nl> + | InDoubleQuotedString <nl> + | InBacktickedString <nl> + | AsStatement <nl> + | RightOfAssignment <nl> + | RightOfAssignmentInUsingStatement <nl> + | RightOfReturn <nl> + | UsingStatement <nl> + <nl> let is_hack ( env : env ) = env . is_hh_file | | env . enable_hh_syntax <nl> let is_typechecker env = <nl> is_hack env & & ( not env . codegen ) <nl> let make_tmp_var_name env = <nl> env . tmp_var_counter < - env . tmp_var_counter + 1 ; <nl> name <nl> <nl> - let lift_await ( ( pos , _ ) as expr ) env ~ with_temp_local = <nl> - let awaits = env . lifted_awaits in <nl> - match awaits with <nl> - | None - > Await expr <nl> - | Some awaits - > <nl> - if ( with_temp_local ) <nl> + let lift_await ( ( pos , _ ) as expr ) env location = <nl> + match env . lifted_awaits , location with <nl> + | _ , UsingStatement <nl> + | _ , RightOfAssignmentInUsingStatement <nl> + | None , _ - > Await expr <nl> + | Some awaits , _ - > <nl> + if ( location < > AsStatement ) <nl> then <nl> let name = make_tmp_var_name env in <nl> awaits . awaits < - ( ( Some ( pos , name ) ) , expr ) : : awaits . awaits ; <nl> let mpYielding : ( ' a , ( ' a * bool ) ) metaparser = fun p node env - > <nl> let ( ) = env . saw_yield < - outer_saw_yield in <nl> result <nl> <nl> - type expr_location = <nl> - | TopLevel <nl> - | MemberSelect <nl> - | InDoubleQuotedString <nl> - | InBacktickedString <nl> - | AsStatement <nl> - | RightOfAssignment <nl> - | RightOfReturn <nl> - <nl> let in_string l = <nl> l = InDoubleQuotedString | | l = InBacktickedString <nl> <nl> and pString2 : expr_location - > node list - > env - > expr list = <nl> | x : : xs - > aux loc xs env ( ( pExpr ~ location : loc x env ) : : acc ) <nl> in <nl> fun loc l env - > aux loc l env [ ] <nl> - and pExprL node env = <nl> - ( pPos node env , Expr_list ( couldMap ~ f : pExpr node env ) ) <nl> + and pExprL ? location : ( location = TopLevel ) : expr parser = fun node env - > <nl> + ( pPos node env , Expr_list ( couldMap ~ f : ( pExpr ~ location ) node env ) ) <nl> <nl> ( * TODO : this function is a hotspot , deep recursion on huge files , attempt more optimization * ) <nl> and pMember node env = <nl> and pExpr ? location : ( location = TopLevel ) : expr parser = fun node env - > <nl> | Some TK . At - > snd expr <nl> | Some TK . Inout - > Callconv ( Pinout , expr ) <nl> | Some TK . Await - > <nl> - lift_await expr env ~ with_temp_local : ( location < > AsStatement ) <nl> + lift_await expr env location <nl> | Some TK . Suspend - > Suspend expr <nl> | Some TK . Clone - > Clone expr <nl> | Some TK . Print - > <nl> and pExpr ? location : ( location = TopLevel ) : expr parser = fun node env - > <nl> - > <nl> let bop_ast_node = <nl> let rlocation = <nl> - if location = AsStatement & & token_kind binary_operator = Some TK . Equal <nl> - then RightOfAssignment else TopLevel in <nl> + if token_kind binary_operator = Some TK . Equal <nl> + then <nl> + ( match location with <nl> + | AsStatement - > RightOfAssignment <nl> + | UsingStatement - > RightOfAssignmentInUsingStatement <nl> + | _ - > TopLevel ) <nl> + else <nl> + TopLevel in <nl> pBop binary_operator env <nl> ( pExpr binary_left_operand env ) <nl> ( pExpr binary_right_operand ~ location : rlocation env ) <nl> and pExpr ? location : ( location = TopLevel ) : expr parser = fun node env - > <nl> | MemberSelect , _ <nl> | TopLevel , _ <nl> | AsStatement , _ <nl> + | UsingStatement , _ <nl> | RightOfAssignment , _ <nl> + | RightOfAssignmentInUsingStatement , _ <nl> | RightOfReturn , _ - > Id ( pos_name node env ) <nl> ) <nl> <nl> | YieldExpression { yield_operand ; _ } - > <nl> env . saw_yield < - true ; <nl> - if location < > AsStatement & & location < > RightOfAssignment <nl> + if <nl> + location < > AsStatement & & <nl> + location < > RightOfAssignment & & <nl> + location < > RightOfAssignmentInUsingStatement <nl> then raise_parsing_error env ( ` Node node ) SyntaxError . invalid_yield ; <nl> if text yield_operand = " break " <nl> then Yield_break <nl> and pExpr ? location : ( location = TopLevel ) : expr parser = fun node env - > <nl> <nl> | YieldFromExpression { yield_from_operand ; _ } - > <nl> env . saw_yield < - true ; <nl> - if location < > AsStatement & & location < > RightOfAssignment & & location < > RightOfReturn <nl> + if <nl> + location < > AsStatement & & <nl> + location < > RightOfAssignment & & <nl> + location < > RightOfAssignmentInUsingStatement & & <nl> + location < > RightOfReturn <nl> then raise_parsing_error env ( ` Node node ) SyntaxError . invalid_yield_from ; <nl> Yield_from ( pExpr yield_from_operand env ) <nl> <nl> and pStmt : stmt parser = fun node env - > <nl> ; using_block_expressions <nl> ; using_block_body <nl> ; _ } - > <nl> - pos , Using { <nl> - us_is_block_scoped = true ; <nl> - us_has_await = not ( is_missing using_block_await_keyword ) ; <nl> - us_expr = pExprL using_block_expressions env ; <nl> - us_block = pBlock using_block_body env ; <nl> - } <nl> + lift_awaits_in_statement env pos ( fun ( ) - > <nl> + pos , Using { <nl> + us_is_block_scoped = true ; <nl> + us_has_await = not ( is_missing using_block_await_keyword ) ; <nl> + us_expr = pExprL ~ location : UsingStatement using_block_expressions env ; <nl> + us_block = pBlock using_block_body env ; <nl> + } ) <nl> | UsingStatementFunctionScoped <nl> { using_function_await_keyword <nl> ; using_function_expression <nl> and pStmt : stmt parser = fun node env - > <nl> * be rewritten by this point <nl> * If this gets run , it means that this using statement is the only one <nl> * in the block , hence it is not in a compound statement * ) <nl> - pos , Using { <nl> - us_is_block_scoped = false ; <nl> - us_has_await = not ( is_missing using_function_await_keyword ) ; <nl> - us_expr = pExpr using_function_expression env ; <nl> - us_block = [ Pos . none , Noop ] ; <nl> - } <nl> + lift_awaits_in_statement env pos ( fun ( ) - > <nl> + pos , Using { <nl> + us_is_block_scoped = false ; <nl> + us_has_await = not ( is_missing using_function_await_keyword ) ; <nl> + us_expr = pExpr ~ location : UsingStatement using_function_expression env ; <nl> + us_block = [ Pos . none , Noop ] ; <nl> + } ) <nl> | LetStatement <nl> { let_statement_name ; let_statement_type ; let_statement_initializer ; _ } - > <nl> lift_awaits_in_statement env pos ( fun ( ) - > <nl> and handle_loop_body pos stmts tail env = <nl> ; _ } <nl> ; _ } : : rest - > <nl> let body = conv [ ] rest in <nl> - let using = Using { <nl> - us_is_block_scoped = false ; <nl> - us_has_await = not ( is_missing await_kw ) ; <nl> - us_expr = pExprL expression env ; <nl> - us_block = body ; } in <nl> - List . concat @ @ List . rev ( [ pos , using ] : : acc ) <nl> + let using = lift_awaits_in_statement env pos ( fun ( ) - > <nl> + pos , Using { <nl> + us_is_block_scoped = false ; <nl> + us_has_await = not ( is_missing await_kw ) ; <nl> + us_expr = pExprL ~ location : UsingStatement expression env ; <nl> + us_block = body ; <nl> + } ) in <nl> + List . concat @ @ List . rev ( [ using ] : : acc ) <nl> | h : : rest - > <nl> let h = pStmtUnsafe h env in <nl> conv ( h : : acc ) rest <nl> similarity index 50 % <nl> rename from hphp / test / slow / using / await_as_expr_in_using . php <nl> rename to hphp / test / slow / await_as_an_expression / await_as_expr_in_using . php <nl> mmm a / hphp / test / slow / using / await_as_expr_in_using . php <nl> ppp b / hphp / test / slow / await_as_an_expression / await_as_expr_in_using . php <nl> class MyDisposable implements IDisposable { <nl> public function __construct ( int $ i ) { } <nl> public function __dispose ( ) { } <nl> } <nl> - async function async_int ( ) : Awaitable < int > { return 1 ; } <nl> + async function async_int ( int $ x ) : Awaitable < int > { return $ x ; } <nl> async function test ( ) { <nl> - using ( new MyDisposable ( await async_int ( ) ) ) { <nl> - echo " FAIL \ n " ; <nl> + using ( new MyDisposable ( await async_int ( 42 ) ) ) ; <nl> + using ( new MyDisposable ( await async_int ( 43 ) ) ) { <nl> + echo " PASS \ n " ; <nl> } <nl> + using ( new MyDisposable ( await async_int ( 44 ) ) ) ; <nl> } <nl> <nl> < < __EntryPoint > > <nl> new file mode 100644 <nl> index 00000000000 . . 7ef22e9a431 <nl> mmm / dev / null <nl> ppp b / hphp / test / slow / await_as_an_expression / await_as_expr_in_using . php . expectf <nl> @ @ - 0 , 0 + 1 @ @ <nl> + PASS <nl> deleted file mode 100644 <nl> index 6184a514b06 . . 00000000000 <nl> mmm a / hphp / test / slow / using / await_as_expr_in_using . php . expectf <nl> ppp / dev / null <nl> <nl> - <nl> - Fatal error : Await cannot be used as an expression in % s / await_as_expr_in_using . php on line 9 <nl>
Add missing lifting to using statements
facebook/hhvm
59b85444e143ae5b3f9e34ba693a5242d42ae2f7
2019-05-19T10:24:26Z
mmm a / hphp / runtime / ext / ext . h <nl> ppp b / hphp / runtime / ext / ext . h <nl> <nl> # include " hphp / runtime / ext / ext_math . h " <nl> # include " hphp / runtime / ext / ext_pdo . h " <nl> # include " hphp / runtime / ext / ext_posix . h " <nl> - # include " hphp / runtime / ext / ext_server . h " <nl> # include " hphp / runtime / ext / ext_simplexml . h " <nl> # include " hphp / runtime / ext / ext_soap . h " <nl> # include " hphp / runtime / ext / ext_socket . h " <nl> similarity index 66 % <nl> rename from hphp / runtime / ext / ext_server . cpp <nl> rename to hphp / runtime / ext / server / ext_server . cpp <nl> mmm a / hphp / runtime / ext / ext_server . cpp <nl> ppp b / hphp / runtime / ext / server / ext_server . cpp <nl> <nl> | license @ php . net so we can mail you a copy immediately . | <nl> + mmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmm - + <nl> * / <nl> - # include " hphp / runtime / ext / ext_server . h " <nl> + # include " hphp / runtime / ext / server / ext_server . h " <nl> <nl> # include " folly / Conv . h " <nl> <nl> <nl> <nl> namespace HPHP { <nl> <nl> - IMPLEMENT_DEFAULT_EXTENSION_VERSION ( server , NO_EXTENSION_VERSION_YET ) ; <nl> + static const StaticString s_PAGELET_NOT_READY ( " PAGELET_NOT_READY " ) ; <nl> + static const StaticString s_PAGELET_READY ( " PAGELET_READY " ) ; <nl> + static const StaticString s_PAGELET_DONE ( " PAGELET_DONE " ) ; <nl> + <nl> + static class ServerExtension : public Extension { <nl> + public : <nl> + ServerExtension ( ) : Extension ( " server " , NO_EXTENSION_VERSION_YET ) { } <nl> + virtual void moduleInit ( ) { <nl> + Native : : registerConstant < KindOfInt64 > ( s_PAGELET_NOT_READY . get ( ) , <nl> + k_PAGELET_NOT_READY ) ; <nl> + Native : : registerConstant < KindOfInt64 > ( s_PAGELET_READY . get ( ) , <nl> + k_PAGELET_READY ) ; <nl> + Native : : registerConstant < KindOfInt64 > ( s_PAGELET_DONE . get ( ) , k_PAGELET_DONE ) ; <nl> + <nl> + HHVM_FE ( dangling_server_proxy_old_request ) ; <nl> + HHVM_FE ( pagelet_server_is_enabled ) ; <nl> + HHVM_FE ( pagelet_server_task_start ) ; <nl> + HHVM_FE ( pagelet_server_task_status ) ; <nl> + HHVM_FE ( pagelet_server_task_result ) ; <nl> + HHVM_FE ( pagelet_server_flush ) ; <nl> + HHVM_FE ( xbox_send_message ) ; <nl> + HHVM_FE ( xbox_post_message ) ; <nl> + HHVM_FE ( xbox_task_start ) ; <nl> + HHVM_FE ( xbox_task_status ) ; <nl> + HHVM_FE ( xbox_task_result ) ; <nl> + HHVM_FE ( xbox_process_call_message ) ; <nl> + HHVM_FE ( xbox_get_thread_timeout ) ; <nl> + HHVM_FE ( xbox_set_thread_timeout ) ; <nl> + HHVM_FE ( xbox_schedule_thread_reset ) ; <nl> + HHVM_FE ( xbox_get_thread_time ) ; <nl> + <nl> + loadSystemlib ( ) ; <nl> + } <nl> + } s_server_extension ; <nl> <nl> / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / <nl> / / dangling server <nl> <nl> - bool f_dangling_server_proxy_old_request ( ) { <nl> + bool HHVM_FUNCTION ( dangling_server_proxy_old_request ) { <nl> static bool s_detected_dangling_server = true ; <nl> <nl> if ( ! s_detected_dangling_server | | <nl> const int64_t k_PAGELET_NOT_READY = PAGELET_NOT_READY ; <nl> const int64_t k_PAGELET_READY = PAGELET_READY ; <nl> const int64_t k_PAGELET_DONE = PAGELET_DONE ; <nl> <nl> - bool f_pagelet_server_is_enabled ( ) { <nl> + bool HHVM_FUNCTION ( pagelet_server_is_enabled ) { <nl> return PageletServer : : Enabled ( ) ; <nl> } <nl> <nl> const StaticString s_Host ( " Host " ) ; <nl> <nl> - Resource f_pagelet_server_task_start ( const String & url , <nl> - const Array & headers / * = null_array * / , <nl> - const String & post_data / * = null_string * / , <nl> - const Array & files / * = null_array * / ) { <nl> + Resource HHVM_FUNCTION ( pagelet_server_task_start , <nl> + const String & url , <nl> + const Array & headers / * = null_array * / , <nl> + const String & post_data / * = null_string * / , <nl> + const Array & files / * = null_array * / ) { <nl> String remote_host ; <nl> Transport * transport = g_context - > getTransport ( ) ; <nl> int timeout = ThreadInfo : : s_threadInfo - > m_reqInjectionData . getRemainingTime ( ) ; <nl> Resource f_pagelet_server_task_start ( const String & url , <nl> post_data , files , timeout ) ; <nl> } <nl> <nl> - int64_t f_pagelet_server_task_status ( const Resource & task ) { <nl> + int64_t HHVM_FUNCTION ( pagelet_server_task_status , <nl> + const Resource & task ) { <nl> return PageletServer : : TaskStatus ( task ) ; <nl> } <nl> <nl> - String f_pagelet_server_task_result ( const Resource & task , VRefParam headers , <nl> - VRefParam code , <nl> - int64_t timeout_ms / * = 0 * / ) { <nl> + String HHVM_FUNCTION ( pagelet_server_task_result , <nl> + const Resource & task , <nl> + VRefParam headers , <nl> + VRefParam code , <nl> + int64_t timeout_ms / * = 0 * / ) { <nl> Array rheaders ; <nl> int rcode ; <nl> String response = PageletServer : : TaskResult ( task , rheaders , rcode , <nl> String f_pagelet_server_task_result ( const Resource & task , VRefParam headers , <nl> return response ; <nl> } <nl> <nl> - void f_pagelet_server_flush ( ) { <nl> + void HHVM_FUNCTION ( pagelet_server_flush ) { <nl> ExecutionContext * context = g_context . getNoCheck ( ) ; <nl> Transport * transport = context - > getTransport ( ) ; <nl> if ( transport & & <nl> void f_pagelet_server_flush ( ) { <nl> / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / <nl> / / xbox <nl> <nl> - bool f_xbox_send_message ( const String & msg , <nl> - VRefParam retRef , <nl> - int64_t timeout_ms , <nl> - const String & host / * = " localhost " * / ) { <nl> + bool HHVM_FUNCTION ( xbox_send_message , <nl> + const String & msg , <nl> + VRefParam retRef , <nl> + int64_t timeout_ms , <nl> + const String & host / * = " localhost " * / ) { <nl> Array ret ; <nl> auto b = XboxServer : : SendMessage ( msg , ret , timeout_ms , host ) ; <nl> retRef = ret ; <nl> return b ; <nl> } <nl> <nl> - bool f_xbox_post_message ( const String & msg , const String & host / * = " localhost " * / ) { <nl> + bool HHVM_FUNCTION ( xbox_post_message , <nl> + const String & msg , <nl> + const String & host / * = " localhost " * / ) { <nl> return XboxServer : : PostMessage ( msg , host ) ; <nl> } <nl> <nl> - Resource f_xbox_task_start ( const String & message ) { <nl> + Resource HHVM_FUNCTION ( xbox_task_start , <nl> + const String & message ) { <nl> return XboxServer : : TaskStart ( message ) ; <nl> } <nl> <nl> - bool f_xbox_task_status ( const Resource & task ) { <nl> + bool HHVM_FUNCTION ( xbox_task_status , <nl> + const Resource & task ) { <nl> return XboxServer : : TaskStatus ( task ) ; <nl> } <nl> <nl> - int64_t f_xbox_task_result ( const Resource & task , int64_t timeout_ms , VRefParam ret ) { <nl> + int64_t HHVM_FUNCTION ( xbox_task_result , <nl> + const Resource & task , <nl> + int64_t timeout_ms , <nl> + VRefParam ret ) { <nl> return XboxServer : : TaskResult ( task , timeout_ms , ret ) ; <nl> } <nl> <nl> - Variant f_xbox_process_call_message ( const String & msg ) { <nl> + Variant HHVM_FUNCTION ( xbox_process_call_message , <nl> + const String & msg ) { <nl> Variant v = unserialize_from_string ( msg ) ; <nl> if ( ! v . isArray ( ) ) { <nl> raise_error ( " Error decoding xbox call message " ) ; <nl> Variant f_xbox_process_call_message ( const String & msg ) { <nl> return vm_call_user_func ( fn , args . toArray ( ) ) ; <nl> } <nl> <nl> - int64_t f_xbox_get_thread_timeout ( ) { <nl> + int64_t HHVM_FUNCTION ( xbox_get_thread_timeout ) { <nl> auto server_info = XboxServer : : GetServerInfo ( ) ; <nl> if ( server_info ) { <nl> return server_info - > getMaxDuration ( ) ; <nl> int64_t f_xbox_get_thread_timeout ( ) { <nl> throw Exception ( " Not an xbox worker ! " ) ; <nl> } <nl> <nl> - void f_xbox_set_thread_timeout ( int timeout ) { <nl> + void HHVM_FUNCTION ( xbox_set_thread_timeout , <nl> + int timeout ) { <nl> if ( timeout < 0 ) { <nl> raise_warning ( " Cannot set timeout / duration to a negative number . " ) ; <nl> return ; <nl> void f_xbox_set_thread_timeout ( int timeout ) { <nl> } <nl> } <nl> <nl> - void f_xbox_schedule_thread_reset ( ) { <nl> + void HHVM_FUNCTION ( xbox_schedule_thread_reset ) { <nl> RPCRequestHandler * handler = XboxServer : : GetRequestHandler ( ) ; <nl> if ( handler ) { <nl> handler - > setReset ( ) ; <nl> void f_xbox_schedule_thread_reset ( ) { <nl> } <nl> } <nl> <nl> - int64_t f_xbox_get_thread_time ( ) { <nl> + int64_t HHVM_FUNCTION ( xbox_get_thread_time ) { <nl> RPCRequestHandler * handler = XboxServer : : GetRequestHandler ( ) ; <nl> if ( handler ) { <nl> return time ( nullptr ) - handler - > getLastResetTime ( ) ; <nl> similarity index 50 % <nl> rename from hphp / runtime / ext / ext_server . h <nl> rename to hphp / runtime / ext / server / ext_server . h <nl> mmm a / hphp / runtime / ext / ext_server . h <nl> ppp b / hphp / runtime / ext / server / ext_server . h <nl> enum PageletStatusType { <nl> <nl> / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / <nl> <nl> - bool f_dangling_server_proxy_old_request ( ) ; <nl> - bool f_pagelet_server_is_enabled ( ) ; <nl> - Resource f_pagelet_server_task_start ( const String & url , const Array & headers = null_array , const String & post_data = null_string , const Array & files = null_array ) ; <nl> - int64_t f_pagelet_server_task_status ( const Resource & task ) ; <nl> - String f_pagelet_server_task_result ( const Resource & task , VRefParam headers , VRefParam code , int64_t timeout_ms ) ; <nl> - void f_pagelet_server_flush ( ) ; <nl> - bool f_xbox_send_message ( const String & msg , VRefParam ret , int64_t timeout_ms , const String & host = " localhost " ) ; <nl> - bool f_xbox_post_message ( const String & msg , const String & host = " localhost " ) ; <nl> - Resource f_xbox_task_start ( const String & message ) ; <nl> - bool f_xbox_task_status ( const Resource & task ) ; <nl> - int64_t f_xbox_task_result ( const Resource & task , int64_t timeout_ms , VRefParam ret ) ; <nl> - Variant f_xbox_process_call_message ( const String & msg ) ; <nl> - int64_t f_xbox_get_thread_timeout ( ) ; <nl> - void f_xbox_set_thread_timeout ( int timeout ) ; <nl> - void f_xbox_schedule_thread_reset ( ) ; <nl> - int64_t f_xbox_get_thread_time ( ) ; <nl> + bool HHVM_FUNCTION ( dangling_server_proxy_old_request ) ; <nl> + bool HHVM_FUNCTION ( pagelet_server_is_enabled ) ; <nl> + Resource HHVM_FUNCTION ( pagelet_server_task_start , <nl> + const String & url , <nl> + const Array & headers = null_array , <nl> + const String & post_data = null_string , <nl> + const Array & files = null_array ) ; <nl> + int64_t HHVM_FUNCTION ( pagelet_server_task_status , <nl> + const Resource & task ) ; <nl> + String HHVM_FUNCTION ( pagelet_server_task_result , <nl> + const Resource & task , <nl> + VRefParam headers , <nl> + VRefParam code , <nl> + int64_t timeout_ms ) ; <nl> + void HHVM_FUNCTION ( pagelet_server_flush ) ; <nl> + bool HHVM_FUNCTION ( xbox_send_message , <nl> + const String & msg , <nl> + VRefParam ret , <nl> + int64_t timeout_ms , <nl> + const String & host = " localhost " ) ; <nl> + bool HHVM_FUNCTION ( xbox_post_message , <nl> + const String & msg , <nl> + const String & host = " localhost " ) ; <nl> + Resource HHVM_FUNCTION ( xbox_task_start , <nl> + const String & message ) ; <nl> + bool HHVM_FUNCTION ( xbox_task_status , <nl> + const Resource & task ) ; <nl> + int64_t HHVM_FUNCTION ( xbox_task_result , <nl> + const Resource & task , <nl> + int64_t timeout_ms , <nl> + VRefParam ret ) ; <nl> + Variant HHVM_FUNCTION ( xbox_process_call_message , <nl> + const String & msg ) ; <nl> + int64_t HHVM_FUNCTION ( xbox_get_thread_timeout ) ; <nl> + void HHVM_FUNCTION ( xbox_set_thread_timeout , <nl> + int timeout ) ; <nl> + void HHVM_FUNCTION ( xbox_schedule_thread_reset ) ; <nl> + int64_t HHVM_FUNCTION ( xbox_get_thread_time ) ; <nl> <nl> / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / <nl> } <nl> new file mode 100644 <nl> index 00000000000 . . c1500e4bbb0 <nl> mmm / dev / null <nl> ppp b / hphp / runtime / ext / server / ext_server . php <nl> <nl> + < ? hh <nl> + <nl> + / * * <nl> + * When I ' m running a newer version of the server software and I ' m getting an <nl> + * HTTP request that ' s from old version of a web page , proxy it to a local <nl> + * instance that is still running or dangling just for handling old version of <nl> + * requests . Please read server documentation for more details . <nl> + * <nl> + * @ return bool - TRUE if successful , FALSE otherwise . <nl> + * <nl> + * / <nl> + < < __HipHopSpecific , __Native > > <nl> + function dangling_server_proxy_old_request ( ) : bool ; <nl> + <nl> + / * * <nl> + * Whether pagelet server is enabled or not . Please read server documentation <nl> + * for what a pagelet server is . <nl> + * <nl> + * @ return bool - TRUE if it ' s enabled , FALSE otherwise . <nl> + * <nl> + * / <nl> + < < __HipHopSpecific , __Native > > <nl> + function pagelet_server_is_enabled ( ) : bool ; <nl> + <nl> + / * * <nl> + * Processes a pagelet server request . <nl> + * <nl> + * @ param string $ url - The URL we ' re running this pagelet with . <nl> + * @ param array $ headers - HTTP headers to send to the pagelet . <nl> + * @ param string $ post_data - POST data to send . <nl> + * @ param array $ files - Array for the pagelet . <nl> + * <nl> + * @ return resource - An object that can be used with <nl> + * pagelet_server_task_status ( ) or pagelet_server_task_result ( ) . <nl> + * <nl> + * / <nl> + < < __HipHopSpecific , __Native > > <nl> + function pagelet_server_task_start ( string $ url , <nl> + array $ headers = [ ] , <nl> + string $ post_data = " " , <nl> + array $ files = [ ] ) : resource ; <nl> + <nl> + / * * <nl> + * Checks finish status of a pagelet task . <nl> + * <nl> + * @ param resource $ task - The pagelet task handle returned from <nl> + * pagelet_server_task_start ( ) . <nl> + * <nl> + * @ return int - PAGELET_NOT_READY if there is no data available , <nl> + * PAGELET_READY if ( partial ) data is available from pagelet_server_flush ( ) , <nl> + * and PAGELET_DONE if the pagelet request is done . <nl> + * <nl> + * / <nl> + < < __HipHopSpecific , __Native > > <nl> + function pagelet_server_task_status ( resource $ task ) : int ; <nl> + <nl> + / * * <nl> + * Block and wait until pagelet task finishes or times out . <nl> + * <nl> + * @ param resource $ task - The pagelet task handle returned from <nl> + * pagelet_server_task_start ( ) . <nl> + * @ param mixed $ headers - HTTP response headers . <nl> + * @ param mixed $ code - HTTP response code . Set to - 1 in the event of a <nl> + * timeout . <nl> + * @ param int $ timeout_ms - How many milliseconds to wait . A timeout of zero <nl> + * is interpreted as an infinite timeout . <nl> + * <nl> + * @ return string - HTTP response from the pagelet . <nl> + * <nl> + * / <nl> + < < __HipHopSpecific , __Native > > <nl> + function pagelet_server_task_result ( resource $ task , <nl> + mixed & $ headers , <nl> + mixed & $ code , <nl> + int $ timeout_ms = 0 ) : string ; <nl> + <nl> + / * * <nl> + * Flush all the currently buffered output , so that the main thread can read <nl> + * it with pagelet_server_task_result ( ) . This is only meaningful in a pagelet <nl> + * thread . <nl> + * <nl> + * / <nl> + < < __HipHopSpecific , __Native > > <nl> + function pagelet_server_flush ( ) : void ; <nl> + <nl> + / * * <nl> + * Sends an xbox message and waits for response . Please read server <nl> + * documentation for what an xbox is . <nl> + * <nl> + * @ param string $ msg - The message . <nl> + * @ param mixed $ ret - The response . <nl> + * @ param int $ timeout_ms - How many milli - seconds to wait . <nl> + * @ param string $ host - Which machine to send to . <nl> + * <nl> + * @ return bool - TRUE if successful , FALSE otherwise . <nl> + * <nl> + * / <nl> + < < __HipHopSpecific , __Native > > <nl> + function xbox_send_message ( string $ msg , <nl> + mixed & $ ret , <nl> + int $ timeout_ms , <nl> + string $ host = " localhost " ) : bool ; <nl> + <nl> + / * * <nl> + * Posts an xbox message without waiting . Please read server documentation for <nl> + * more details . <nl> + * <nl> + * @ param string $ msg - The response . <nl> + * @ param string $ host - Which machine to post to . <nl> + * <nl> + * @ return bool - TRUE if successful , FALSE otherwise . <nl> + * <nl> + * / <nl> + < < __HipHopSpecific , __Native > > <nl> + function xbox_post_message ( string $ msg , string $ host = " localhost " ) : bool ; <nl> + <nl> + / * * <nl> + * Starts a local xbox task . <nl> + * <nl> + * @ param string $ message - A message to send to xbox ' s message processing <nl> + * function . <nl> + * <nl> + * @ return resource - A task handle xbox_task_status ( ) and xbox_task_result ( ) <nl> + * can use . <nl> + * <nl> + * / <nl> + < < __HipHopSpecific , __Native > > <nl> + function xbox_task_start ( string $ message ) : resource ; <nl> + <nl> + / * * <nl> + * Checks an xbox task ' s status . <nl> + * <nl> + * @ param resource $ task - The xbox task object created by xbox_task_start ( ) . <nl> + * <nl> + * @ return bool - TRUE if finished , FALSE otherwise . <nl> + * <nl> + * / <nl> + < < __HipHopSpecific , __Native > > <nl> + function xbox_task_status ( resource $ task ) : bool ; <nl> + <nl> + / * * <nl> + * Block and wait for xbox task ' s result . <nl> + * <nl> + * @ param resource $ task - The xbox task object created by xbox_task_start ( ) . <nl> + * @ param int $ timeout_ms - How many milli - seconds to wait . <nl> + * @ param mixed $ ret - xbox message processing function ' s return value . <nl> + * <nl> + * @ return int - Response code following HTTP ' s responses . For example , 200 <nl> + * for success and 500 for server error . <nl> + * <nl> + * / <nl> + < < __HipHopSpecific , __Native > > <nl> + function xbox_task_result ( resource $ task , int $ timeout_ms , mixed & $ ret ) : int ; <nl> + <nl> + / * * <nl> + * This function is invoked by the xbox facility to start an xbox call task . <nl> + * This function is not intended to be called directly by user code . <nl> + * <nl> + * @ param string $ msg - The call message . <nl> + * <nl> + * @ return mixed - The return value of the xbox call task . <nl> + * <nl> + * / <nl> + < < __HipHopSpecific , __Native > > <nl> + function xbox_process_call_message ( string $ msg ) : mixed ; <nl> + <nl> + / * * <nl> + * Gets the timeout ( maximum duration ) , in seconds , of the current xbox <nl> + * thread . Throws for non - xbox threads . <nl> + * <nl> + * @ return int - The current timeout ( maximum duration ) . <nl> + * <nl> + * / <nl> + < < __HipHopSpecific , __Native > > <nl> + function xbox_get_thread_timeout ( ) : int ; <nl> + <nl> + / * * <nl> + * Sets the timeout ( maximum duration ) , in seconds , of the current xbox <nl> + * thread . The xbox thread would reset when this amount of time has passed <nl> + * since the previous reset . Throws for non - xbox threads . <nl> + * <nl> + * @ param int $ timeout - The new timeout ( maximum duration ) . <nl> + * <nl> + * / <nl> + < < __HipHopSpecific , __Native > > <nl> + function xbox_set_thread_timeout ( int $ timeout ) : void ; <nl> + <nl> + / * * <nl> + * Schedules a reset of the current xbox thread , when the next request comes <nl> + * in . Throws for non - xbox threads . <nl> + * <nl> + * / <nl> + < < __HipHopSpecific , __Native > > <nl> + function xbox_schedule_thread_reset ( ) : void ; <nl> + <nl> + / * * <nl> + * Returns the time that the current xbox thread has been running without a <nl> + * reset , in seconds , and throws for non - xbox threads . <nl> + * <nl> + * @ return int - The time that the current xbox thread has been running <nl> + * without a reset . <nl> + * <nl> + * / <nl> + < < __HipHopSpecific , __Native > > <nl> + function xbox_get_thread_time ( ) : int ; <nl> mmm a / hphp / runtime / server / pagelet - server . cpp <nl> ppp b / hphp / runtime / server / pagelet - server . cpp <nl> <nl> # include " hphp / runtime / base / string - buffer . h " <nl> # include " hphp / runtime / base / runtime - option . h " <nl> # include " hphp / runtime / base / complex - types . h " <nl> - # include " hphp / runtime / ext / ext_server . h " <nl> + # include " hphp / runtime / ext / server / ext_server . h " <nl> # include " hphp / util / job - queue . h " <nl> # include " hphp / util / lock . h " <nl> # include " hphp / util / logger . h " <nl> deleted file mode 100644 <nl> index f7162cbe564 . . 00000000000 <nl> mmm a / hphp / system / idl / server . idl . json <nl> ppp / dev / null <nl> <nl> - { <nl> - " preamble " : " " , <nl> - " consts " : [ <nl> - { <nl> - " name " : " PAGELET_NOT_READY " , <nl> - " type " : " Int64 " <nl> - } , <nl> - { <nl> - " name " : " PAGELET_READY " , <nl> - " type " : " Int64 " <nl> - } , <nl> - { <nl> - " name " : " PAGELET_DONE " , <nl> - " type " : " Int64 " <nl> - } <nl> - ] , <nl> - " funcs " : [ <nl> - { <nl> - " name " : " dangling_server_proxy_old_request " , <nl> - " desc " : " When I ' m running a newer version of the server software and I ' m getting an HTTP request that ' s from old version of a web page , proxy it to a local instance that is still running or dangling just for handling old version of requests . Please read server documentation for more details . " , <nl> - " flags " : [ <nl> - " HipHopSpecific " <nl> - ] , <nl> - " return " : { <nl> - " type " : " Boolean " , <nl> - " desc " : " TRUE if successful , FALSE otherwise . " <nl> - } , <nl> - " args " : [ <nl> - ] <nl> - } , <nl> - { <nl> - " name " : " pagelet_server_is_enabled " , <nl> - " desc " : " Whether pagelet server is enabled or not . Please read server documentation for what a pagelet server is . " , <nl> - " flags " : [ <nl> - " HipHopSpecific " <nl> - ] , <nl> - " return " : { <nl> - " type " : " Boolean " , <nl> - " desc " : " TRUE if it ' s enabled , FALSE otherwise . " <nl> - } , <nl> - " args " : [ <nl> - ] <nl> - } , <nl> - { <nl> - " name " : " pagelet_server_task_start " , <nl> - " desc " : " Processes a pagelet server request . " , <nl> - " flags " : [ <nl> - " HipHopSpecific " <nl> - ] , <nl> - " return " : { <nl> - " type " : " Resource " , <nl> - " desc " : " An object that can be used with pagelet_server_task_status ( ) or pagelet_server_task_result ( ) . " <nl> - } , <nl> - " args " : [ <nl> - { <nl> - " name " : " url " , <nl> - " type " : " String " , <nl> - " desc " : " The URL we ' re running this pagelet with . " <nl> - } , <nl> - { <nl> - " name " : " headers " , <nl> - " type " : " StringMap " , <nl> - " value " : " null_array " , <nl> - " desc " : " HTTP headers to send to the pagelet . " <nl> - } , <nl> - { <nl> - " name " : " post_data " , <nl> - " type " : " String " , <nl> - " value " : " null_string " , <nl> - " desc " : " POST data to send . " <nl> - } , <nl> - { <nl> - " name " : " files " , <nl> - " type " : " VariantVec " , <nl> - " value " : " null_array " , <nl> - " desc " : " Array for the pagelet . " <nl> - } <nl> - ] <nl> - } , <nl> - { <nl> - " name " : " pagelet_server_task_status " , <nl> - " desc " : " Checks finish status of a pagelet task . " , <nl> - " flags " : [ <nl> - " HipHopSpecific " <nl> - ] , <nl> - " return " : { <nl> - " type " : " Int64 " , <nl> - " desc " : " PAGELET_NOT_READY if there is no data available , PAGELET_READY if ( partial ) data is available from pagelet_server_flush ( ) , and PAGELET_DONE if the pagelet request is done . " <nl> - } , <nl> - " args " : [ <nl> - { <nl> - " name " : " task " , <nl> - " type " : " Resource " , <nl> - " desc " : " The pagelet task handle returned from pagelet_server_task_start ( ) . " <nl> - } <nl> - ] <nl> - } , <nl> - { <nl> - " name " : " pagelet_server_task_result " , <nl> - " desc " : " Block and wait until pagelet task finishes or times out . " , <nl> - " flags " : [ <nl> - " HipHopSpecific " <nl> - ] , <nl> - " return " : { <nl> - " type " : " String " , <nl> - " desc " : " HTTP response from the pagelet . " <nl> - } , <nl> - " args " : [ <nl> - { <nl> - " name " : " task " , <nl> - " type " : " Resource " , <nl> - " desc " : " The pagelet task handle returned from pagelet_server_task_start ( ) . " <nl> - } , <nl> - { <nl> - " name " : " headers " , <nl> - " type " : " Variant " , <nl> - " desc " : " HTTP response headers . " , <nl> - " ref " : true <nl> - } , <nl> - { <nl> - " name " : " code " , <nl> - " type " : " Variant " , <nl> - " desc " : " HTTP response code . Set to - 1 in the event of a timeout . " , <nl> - " ref " : true <nl> - } , <nl> - { <nl> - " name " : " timeout_ms " , <nl> - " type " : " Int64 " , <nl> - " value " : " 0 " , <nl> - " desc " : " How many milliseconds to wait . A timeout of zero is interpreted as an infinite timeout . " <nl> - } <nl> - ] <nl> - } , <nl> - { <nl> - " name " : " pagelet_server_flush " , <nl> - " desc " : " Flush all the currently buffered output , so that the main thread can read it with pagelet_server_task_result ( ) . This is only meaningful in a pagelet thread . " , <nl> - " flags " : [ <nl> - " HipHopSpecific " <nl> - ] , <nl> - " return " : { <nl> - " type " : null , <nl> - " desc " : " No value is returned . " <nl> - } , <nl> - " args " : [ <nl> - ] <nl> - } , <nl> - { <nl> - " name " : " xbox_send_message " , <nl> - " desc " : " Sends an xbox message and waits for response . Please read server documentation for what an xbox is . " , <nl> - " flags " : [ <nl> - " HipHopSpecific " <nl> - ] , <nl> - " return " : { <nl> - " type " : " Boolean " , <nl> - " desc " : " TRUE if successful , FALSE otherwise . " <nl> - } , <nl> - " args " : [ <nl> - { <nl> - " name " : " msg " , <nl> - " type " : " String " , <nl> - " desc " : " The message . " <nl> - } , <nl> - { <nl> - " name " : " ret " , <nl> - " type " : " Variant " , <nl> - " desc " : " The response . " , <nl> - " ref " : true <nl> - } , <nl> - { <nl> - " name " : " timeout_ms " , <nl> - " type " : " Int64 " , <nl> - " desc " : " How many milli - seconds to wait . " <nl> - } , <nl> - { <nl> - " name " : " host " , <nl> - " type " : " String " , <nl> - " value " : " \ " localhost \ " " , <nl> - " desc " : " Which machine to send to . " <nl> - } <nl> - ] <nl> - } , <nl> - { <nl> - " name " : " xbox_post_message " , <nl> - " desc " : " Posts an xbox message without waiting . Please read server documentation for more details . " , <nl> - " flags " : [ <nl> - " HipHopSpecific " <nl> - ] , <nl> - " return " : { <nl> - " type " : " Boolean " , <nl> - " desc " : " TRUE if successful , FALSE otherwise . " <nl> - } , <nl> - " args " : [ <nl> - { <nl> - " name " : " msg " , <nl> - " type " : " String " , <nl> - " desc " : " The response . " <nl> - } , <nl> - { <nl> - " name " : " host " , <nl> - " type " : " String " , <nl> - " value " : " \ " localhost \ " " , <nl> - " desc " : " Which machine to post to . " <nl> - } <nl> - ] <nl> - } , <nl> - { <nl> - " name " : " xbox_task_start " , <nl> - " desc " : " Starts a local xbox task . " , <nl> - " flags " : [ <nl> - " HipHopSpecific " <nl> - ] , <nl> - " return " : { <nl> - " type " : " Resource " , <nl> - " desc " : " A task handle xbox_task_status ( ) and xbox_task_result ( ) can use . " <nl> - } , <nl> - " args " : [ <nl> - { <nl> - " name " : " message " , <nl> - " type " : " String " , <nl> - " desc " : " A message to send to xbox ' s message processing function . " <nl> - } <nl> - ] <nl> - } , <nl> - { <nl> - " name " : " xbox_task_status " , <nl> - " desc " : " Checks an xbox task ' s status . " , <nl> - " flags " : [ <nl> - " HipHopSpecific " <nl> - ] , <nl> - " return " : { <nl> - " type " : " Boolean " , <nl> - " desc " : " TRUE if finished , FALSE otherwise . " <nl> - } , <nl> - " args " : [ <nl> - { <nl> - " name " : " task " , <nl> - " type " : " Resource " , <nl> - " desc " : " The xbox task object created by xbox_task_start ( ) . " <nl> - } <nl> - ] <nl> - } , <nl> - { <nl> - " name " : " xbox_task_result " , <nl> - " desc " : " Block and wait for xbox task ' s result . " , <nl> - " flags " : [ <nl> - " HipHopSpecific " <nl> - ] , <nl> - " return " : { <nl> - " type " : " Int64 " , <nl> - " desc " : " Response code following HTTP ' s responses . For example , 200 for success and 500 for server error . " <nl> - } , <nl> - " args " : [ <nl> - { <nl> - " name " : " task " , <nl> - " type " : " Resource " , <nl> - " desc " : " The xbox task object created by xbox_task_start ( ) . " <nl> - } , <nl> - { <nl> - " name " : " timeout_ms " , <nl> - " type " : " Int64 " , <nl> - " desc " : " How many milli - seconds to wait . " <nl> - } , <nl> - { <nl> - " name " : " ret " , <nl> - " type " : " Variant " , <nl> - " desc " : " xbox message processing function ' s return value . " , <nl> - " ref " : true <nl> - } <nl> - ] <nl> - } , <nl> - { <nl> - " name " : " xbox_process_call_message " , <nl> - " desc " : " This function is invoked by the xbox facility to start an xbox call task . This function is not intended to be called directly by user code . " , <nl> - " flags " : [ <nl> - " HipHopSpecific " <nl> - ] , <nl> - " return " : { <nl> - " type " : " Variant " , <nl> - " desc " : " The return value of the xbox call task . " <nl> - } , <nl> - " args " : [ <nl> - { <nl> - " name " : " msg " , <nl> - " type " : " String " , <nl> - " desc " : " The call message . " <nl> - } <nl> - ] <nl> - } , <nl> - { <nl> - " name " : " xbox_get_thread_timeout " , <nl> - " desc " : " Gets the timeout ( maximum duration ) , in seconds , of the current xbox thread . Throws for non - xbox threads . " , <nl> - " flags " : [ <nl> - " HipHopSpecific " <nl> - ] , <nl> - " return " : { <nl> - " type " : " Int64 " , <nl> - " desc " : " The current timeout ( maximum duration ) . " <nl> - } , <nl> - " args " : [ <nl> - ] <nl> - } , <nl> - { <nl> - " name " : " xbox_set_thread_timeout " , <nl> - " desc " : " Sets the timeout ( maximum duration ) , in seconds , of the current xbox thread . The xbox thread would reset when this amount of time has passed since the previous reset . Throws for non - xbox threads . " , <nl> - " flags " : [ <nl> - " HipHopSpecific " <nl> - ] , <nl> - " return " : { <nl> - " type " : null <nl> - } , <nl> - " args " : [ <nl> - { <nl> - " name " : " timeout " , <nl> - " type " : " Int32 " , <nl> - " desc " : " The new timeout ( maximum duration ) . " <nl> - } <nl> - ] <nl> - } , <nl> - { <nl> - " name " : " xbox_schedule_thread_reset " , <nl> - " desc " : " Schedules a reset of the current xbox thread , when the next request comes in . Throws for non - xbox threads . " , <nl> - " flags " : [ <nl> - " HipHopSpecific " <nl> - ] , <nl> - " return " : { <nl> - " type " : null <nl> - } , <nl> - " args " : [ <nl> - ] <nl> - } , <nl> - { <nl> - " name " : " xbox_get_thread_time " , <nl> - " desc " : " Returns the time that the current xbox thread has been running without a reset , in seconds , and throws for non - xbox threads . " , <nl> - " flags " : [ <nl> - " HipHopSpecific " <nl> - ] , <nl> - " return " : { <nl> - " type " : " Int64 " , <nl> - " desc " : " The time that the current xbox thread has been running without a reset . " <nl> - } , <nl> - " args " : [ <nl> - ] <nl> - } <nl> - ] , <nl> - " classes " : [ <nl> - ] <nl> - } <nl> mmm a / hphp / test / ext / test_ext_server . cpp <nl> ppp b / hphp / test / ext / test_ext_server . cpp <nl> <nl> <nl> # include " hphp / test / ext / test_ext_server . h " <nl> # include < vector > <nl> - # include " hphp / runtime / ext / ext_server . h " <nl> + # include " hphp / runtime / ext / server / ext_server . h " <nl> # include " hphp / runtime / server / pagelet - server . h " <nl> # include " hphp / runtime / server / xbox - server . h " <nl> # include " hphp / runtime / base / runtime - option . h " <nl> bool TestExtServer : : test_pagelet_server_task_result ( ) { <nl> String url = baseurl + String ( i ) ; <nl> String header = baseheader + String ( i ) ; <nl> String post = basepost + String ( i ) ; <nl> - Resource task = f_pagelet_server_task_start ( url , make_packed_array ( header ) , <nl> - post ) ; <nl> + Resource task = HHVM_FN ( pagelet_server_task_start ) ( url , <nl> + make_packed_array ( header ) , post ) ; <nl> tasks . push_back ( task ) ; <nl> } <nl> <nl> for ( int i = 0 ; i < TEST_SIZE ; + + i ) { <nl> - f_pagelet_server_task_status ( tasks [ i ] ) ; <nl> + HHVM_FN ( pagelet_server_task_status ) ( tasks [ i ] ) ; <nl> } <nl> <nl> / / Calls that time out ( try 1 ms ) should return a status code of - 1 <nl> for ( int i = 0 ; i < TEST_SIZE ; + + i ) { <nl> Variant code , headers ; <nl> - VS ( " " , f_pagelet_server_task_result ( tasks [ i ] , ref ( headers ) , ref ( code ) , 1 ) ) ; <nl> + VS ( " " , HHVM_FN ( pagelet_server_task_result ) ( tasks [ i ] , ref ( headers ) , <nl> + ref ( code ) , 1 ) ) ; <nl> VS ( code , - 1 ) ; <nl> } <nl> <nl> bool TestExtServer : : test_pagelet_server_task_result ( ) { <nl> <nl> / / A timeout of 0 indicates an infinite timeout that blocks . <nl> Variant code , headers ; <nl> - VS ( expected , f_pagelet_server_task_result ( tasks [ i ] , ref ( headers ) , <nl> - ref ( code ) , 0 ) ) ; <nl> + VS ( expected , HHVM_FN ( pagelet_server_task_result ) ( tasks [ i ] , ref ( headers ) , <nl> + ref ( code ) , 0 ) ) ; <nl> VS ( code , 200 ) ; <nl> VS ( headers . toArray ( ) [ 1 ] , " ResponseHeader : okay " ) ; <nl> <nl> - VS ( expected , f_pagelet_server_task_result ( tasks [ i ] , ref ( headers ) , <nl> - ref ( code ) , 1 ) ) ; <nl> + VS ( expected , HHVM_FN ( pagelet_server_task_result ) ( tasks [ i ] , ref ( headers ) , <nl> + ref ( code ) , 1 ) ) ; <nl> VS ( code , 200 ) ; <nl> } <nl> <nl> bool TestExtServer : : test_xbox_send_message ( ) { <nl> s_code ( " code " ) , <nl> s_response ( " response " ) ; <nl> Variant ret ; <nl> - VERIFY ( f_xbox_send_message ( " hello " , ref ( ret ) , 5000 ) ) ; <nl> + VERIFY ( HHVM_FN ( xbox_send_message ) ( " hello " , ref ( ret ) , 5000 ) ) ; <nl> VS ( ret . toArray ( ) [ s_code ] , 200 ) ; <nl> VS ( ret . toArray ( ) [ s_response ] , " olleh " ) ; <nl> return Count ( true ) ; <nl> } <nl> <nl> bool TestExtServer : : test_xbox_post_message ( ) { <nl> - VERIFY ( f_xbox_post_message ( " hello " ) ) ; <nl> + VERIFY ( HHVM_FN ( xbox_post_message ) ( " hello " ) ) ; <nl> return Count ( true ) ; <nl> } <nl> <nl> bool TestExtServer : : test_xbox_task_status ( ) { <nl> } <nl> <nl> bool TestExtServer : : test_xbox_task_result ( ) { <nl> - Resource task = f_xbox_task_start ( " hello " ) ; <nl> - f_xbox_task_status ( task ) ; <nl> + Resource task = HHVM_FN ( xbox_task_start ) ( " hello " ) ; <nl> + HHVM_FN ( xbox_task_status ) ( task ) ; <nl> Variant ret ; <nl> - VS ( f_xbox_task_result ( task , 0 , ref ( ret ) ) , 200 ) ; <nl> + VS ( HHVM_FN ( xbox_task_result ) ( task , 0 , ref ( ret ) ) , 200 ) ; <nl> VS ( ret , " olleh " ) ; <nl> return Count ( true ) ; <nl> } <nl>
Convert server to HNI
facebook/hhvm
09362b7cda3b83a47e0d0a70575dba8aad240baa
2014-10-23T17:00:22Z
mmm a / CMakeLists . txt <nl> ppp b / CMakeLists . txt <nl> add_library ( grpc_test_util <nl> src / core / lib / transport / transport . c <nl> src / core / lib / transport / transport_op_string . c <nl> src / core / lib / debug / trace . c <nl> + src / core / ext / filters / client_channel / channel_connectivity . c <nl> + src / core / ext / filters / client_channel / client_channel . c <nl> + src / core / ext / filters / client_channel / client_channel_factory . c <nl> + src / core / ext / filters / client_channel / client_channel_plugin . c <nl> + src / core / ext / filters / client_channel / connector . c <nl> + src / core / ext / filters / client_channel / http_connect_handshaker . c <nl> + src / core / ext / filters / client_channel / http_proxy . c <nl> + src / core / ext / filters / client_channel / lb_policy . c <nl> + src / core / ext / filters / client_channel / lb_policy_factory . c <nl> + src / core / ext / filters / client_channel / lb_policy_registry . c <nl> + src / core / ext / filters / client_channel / parse_address . c <nl> + src / core / ext / filters / client_channel / proxy_mapper . c <nl> + src / core / ext / filters / client_channel / proxy_mapper_registry . c <nl> + src / core / ext / filters / client_channel / resolver . c <nl> + src / core / ext / filters / client_channel / resolver_factory . c <nl> + src / core / ext / filters / client_channel / resolver_registry . c <nl> + src / core / ext / filters / client_channel / retry_throttle . c <nl> + src / core / ext / filters / client_channel / subchannel . c <nl> + src / core / ext / filters / client_channel / subchannel_index . c <nl> + src / core / ext / filters / client_channel / uri_parser . c <nl> + src / core / ext / filters / deadline / deadline_filter . c <nl> + src / core / ext / transport / chttp2 / transport / bin_decoder . c <nl> + src / core / ext / transport / chttp2 / transport / bin_encoder . c <nl> + src / core / ext / transport / chttp2 / transport / chttp2_plugin . c <nl> + src / core / ext / transport / chttp2 / transport / chttp2_transport . c <nl> + src / core / ext / transport / chttp2 / transport / frame_data . c <nl> + src / core / ext / transport / chttp2 / transport / frame_goaway . c <nl> + src / core / ext / transport / chttp2 / transport / frame_ping . c <nl> + src / core / ext / transport / chttp2 / transport / frame_rst_stream . c <nl> + src / core / ext / transport / chttp2 / transport / frame_settings . c <nl> + src / core / ext / transport / chttp2 / transport / frame_window_update . c <nl> + src / core / ext / transport / chttp2 / transport / hpack_encoder . c <nl> + src / core / ext / transport / chttp2 / transport / hpack_parser . c <nl> + src / core / ext / transport / chttp2 / transport / hpack_table . c <nl> + src / core / ext / transport / chttp2 / transport / http2_settings . c <nl> + src / core / ext / transport / chttp2 / transport / huffsyms . c <nl> + src / core / ext / transport / chttp2 / transport / incoming_metadata . c <nl> + src / core / ext / transport / chttp2 / transport / parsing . c <nl> + src / core / ext / transport / chttp2 / transport / stream_lists . c <nl> + src / core / ext / transport / chttp2 / transport / stream_map . c <nl> + src / core / ext / transport / chttp2 / transport / varint . c <nl> + src / core / ext / transport / chttp2 / transport / writing . c <nl> + src / core / ext / transport / chttp2 / alpn / alpn . c <nl> + src / core / ext / filters / http / client / http_client_filter . c <nl> + src / core / ext / filters / http / http_filters_plugin . c <nl> + src / core / ext / filters / http / message_compress / message_compress_filter . c <nl> + src / core / ext / filters / http / server / http_server_filter . c <nl> ) <nl> <nl> if ( WIN32 AND MSVC ) <nl> add_library ( grpc_test_util_unsecure <nl> test / core / util / port_server_client . c <nl> test / core / util / slice_splitter . c <nl> test / core / util / trickle_endpoint . c <nl> + src / core / lib / channel / channel_args . c <nl> + src / core / lib / channel / channel_stack . c <nl> + src / core / lib / channel / channel_stack_builder . c <nl> + src / core / lib / channel / connected_channel . c <nl> + src / core / lib / channel / handshaker . c <nl> + src / core / lib / channel / handshaker_factory . c <nl> + src / core / lib / channel / handshaker_registry . c <nl> + src / core / lib / compression / compression . c <nl> + src / core / lib / compression / message_compress . c <nl> + src / core / lib / compression / stream_compression . c <nl> + src / core / lib / http / format_request . c <nl> + src / core / lib / http / httpcli . c <nl> + src / core / lib / http / parser . c <nl> + src / core / lib / iomgr / closure . c <nl> + src / core / lib / iomgr / combiner . c <nl> + src / core / lib / iomgr / endpoint . c <nl> + src / core / lib / iomgr / endpoint_pair_posix . c <nl> + src / core / lib / iomgr / endpoint_pair_uv . c <nl> + src / core / lib / iomgr / endpoint_pair_windows . c <nl> + src / core / lib / iomgr / error . c <nl> + src / core / lib / iomgr / ev_epoll1_linux . c <nl> + src / core / lib / iomgr / ev_epoll_limited_pollers_linux . c <nl> + src / core / lib / iomgr / ev_epoll_thread_pool_linux . c <nl> + src / core / lib / iomgr / ev_epollex_linux . c <nl> + src / core / lib / iomgr / ev_epollsig_linux . c <nl> + src / core / lib / iomgr / ev_poll_posix . c <nl> + src / core / lib / iomgr / ev_posix . c <nl> + src / core / lib / iomgr / ev_windows . c <nl> + src / core / lib / iomgr / exec_ctx . c <nl> + src / core / lib / iomgr / executor . c <nl> + src / core / lib / iomgr / iocp_windows . c <nl> + src / core / lib / iomgr / iomgr . c <nl> + src / core / lib / iomgr / iomgr_posix . c <nl> + src / core / lib / iomgr / iomgr_uv . c <nl> + src / core / lib / iomgr / iomgr_windows . c <nl> + src / core / lib / iomgr / is_epollexclusive_available . c <nl> + src / core / lib / iomgr / load_file . c <nl> + src / core / lib / iomgr / lockfree_event . c <nl> + src / core / lib / iomgr / network_status_tracker . c <nl> + src / core / lib / iomgr / polling_entity . c <nl> + src / core / lib / iomgr / pollset_set_uv . c <nl> + src / core / lib / iomgr / pollset_set_windows . c <nl> + src / core / lib / iomgr / pollset_uv . c <nl> + src / core / lib / iomgr / pollset_windows . c <nl> + src / core / lib / iomgr / resolve_address_posix . c <nl> + src / core / lib / iomgr / resolve_address_uv . c <nl> + src / core / lib / iomgr / resolve_address_windows . c <nl> + src / core / lib / iomgr / resource_quota . c <nl> + src / core / lib / iomgr / sockaddr_utils . c <nl> + src / core / lib / iomgr / socket_factory_posix . c <nl> + src / core / lib / iomgr / socket_mutator . c <nl> + src / core / lib / iomgr / socket_utils_common_posix . c <nl> + src / core / lib / iomgr / socket_utils_linux . c <nl> + src / core / lib / iomgr / socket_utils_posix . c <nl> + src / core / lib / iomgr / socket_utils_uv . c <nl> + src / core / lib / iomgr / socket_utils_windows . c <nl> + src / core / lib / iomgr / socket_windows . c <nl> + src / core / lib / iomgr / tcp_client_posix . c <nl> + src / core / lib / iomgr / tcp_client_uv . c <nl> + src / core / lib / iomgr / tcp_client_windows . c <nl> + src / core / lib / iomgr / tcp_posix . c <nl> + src / core / lib / iomgr / tcp_server_posix . c <nl> + src / core / lib / iomgr / tcp_server_utils_posix_common . c <nl> + src / core / lib / iomgr / tcp_server_utils_posix_ifaddrs . c <nl> + src / core / lib / iomgr / tcp_server_utils_posix_noifaddrs . c <nl> + src / core / lib / iomgr / tcp_server_uv . c <nl> + src / core / lib / iomgr / tcp_server_windows . c <nl> + src / core / lib / iomgr / tcp_uv . c <nl> + src / core / lib / iomgr / tcp_windows . c <nl> + src / core / lib / iomgr / time_averaged_stats . c <nl> + src / core / lib / iomgr / timer_generic . c <nl> + src / core / lib / iomgr / timer_heap . c <nl> + src / core / lib / iomgr / timer_manager . c <nl> + src / core / lib / iomgr / timer_uv . c <nl> + src / core / lib / iomgr / udp_server . c <nl> + src / core / lib / iomgr / unix_sockets_posix . c <nl> + src / core / lib / iomgr / unix_sockets_posix_noop . c <nl> + src / core / lib / iomgr / wakeup_fd_cv . c <nl> + src / core / lib / iomgr / wakeup_fd_eventfd . c <nl> + src / core / lib / iomgr / wakeup_fd_nospecial . c <nl> + src / core / lib / iomgr / wakeup_fd_pipe . c <nl> + src / core / lib / iomgr / wakeup_fd_posix . c <nl> + src / core / lib / json / json . c <nl> + src / core / lib / json / json_reader . c <nl> + src / core / lib / json / json_string . c <nl> + src / core / lib / json / json_writer . c <nl> + src / core / lib / slice / b64 . c <nl> + src / core / lib / slice / percent_encoding . c <nl> + src / core / lib / slice / slice . c <nl> + src / core / lib / slice / slice_buffer . c <nl> + src / core / lib / slice / slice_hash_table . c <nl> + src / core / lib / slice / slice_intern . c <nl> + src / core / lib / slice / slice_string_helpers . c <nl> + src / core / lib / surface / alarm . c <nl> + src / core / lib / surface / api_trace . c <nl> + src / core / lib / surface / byte_buffer . c <nl> + src / core / lib / surface / byte_buffer_reader . c <nl> + src / core / lib / surface / call . c <nl> + src / core / lib / surface / call_details . c <nl> + src / core / lib / surface / call_log_batch . c <nl> + src / core / lib / surface / channel . c <nl> + src / core / lib / surface / channel_init . c <nl> + src / core / lib / surface / channel_ping . c <nl> + src / core / lib / surface / channel_stack_type . c <nl> + src / core / lib / surface / completion_queue . c <nl> + src / core / lib / surface / completion_queue_factory . c <nl> + src / core / lib / surface / event_string . c <nl> + src / core / lib / surface / lame_client . cc <nl> + src / core / lib / surface / metadata_array . c <nl> + src / core / lib / surface / server . c <nl> + src / core / lib / surface / validate_metadata . c <nl> + src / core / lib / surface / version . c <nl> + src / core / lib / transport / bdp_estimator . c <nl> + src / core / lib / transport / byte_stream . c <nl> + src / core / lib / transport / connectivity_state . c <nl> + src / core / lib / transport / error_utils . c <nl> + src / core / lib / transport / metadata . c <nl> + src / core / lib / transport / metadata_batch . c <nl> + src / core / lib / transport / pid_controller . c <nl> + src / core / lib / transport / service_config . c <nl> + src / core / lib / transport / static_metadata . c <nl> + src / core / lib / transport / status_conversion . c <nl> + src / core / lib / transport / timeout_encoding . c <nl> + src / core / lib / transport / transport . c <nl> + src / core / lib / transport / transport_op_string . c <nl> + src / core / lib / debug / trace . c <nl> + src / core / ext / filters / client_channel / channel_connectivity . c <nl> + src / core / ext / filters / client_channel / client_channel . c <nl> + src / core / ext / filters / client_channel / client_channel_factory . c <nl> + src / core / ext / filters / client_channel / client_channel_plugin . c <nl> + src / core / ext / filters / client_channel / connector . c <nl> + src / core / ext / filters / client_channel / http_connect_handshaker . c <nl> + src / core / ext / filters / client_channel / http_proxy . c <nl> + src / core / ext / filters / client_channel / lb_policy . c <nl> + src / core / ext / filters / client_channel / lb_policy_factory . c <nl> + src / core / ext / filters / client_channel / lb_policy_registry . c <nl> + src / core / ext / filters / client_channel / parse_address . c <nl> + src / core / ext / filters / client_channel / proxy_mapper . c <nl> + src / core / ext / filters / client_channel / proxy_mapper_registry . c <nl> + src / core / ext / filters / client_channel / resolver . c <nl> + src / core / ext / filters / client_channel / resolver_factory . c <nl> + src / core / ext / filters / client_channel / resolver_registry . c <nl> + src / core / ext / filters / client_channel / retry_throttle . c <nl> + src / core / ext / filters / client_channel / subchannel . c <nl> + src / core / ext / filters / client_channel / subchannel_index . c <nl> + src / core / ext / filters / client_channel / uri_parser . c <nl> + src / core / ext / filters / deadline / deadline_filter . c <nl> + src / core / ext / transport / chttp2 / transport / bin_decoder . c <nl> + src / core / ext / transport / chttp2 / transport / bin_encoder . c <nl> + src / core / ext / transport / chttp2 / transport / chttp2_plugin . c <nl> + src / core / ext / transport / chttp2 / transport / chttp2_transport . c <nl> + src / core / ext / transport / chttp2 / transport / frame_data . c <nl> + src / core / ext / transport / chttp2 / transport / frame_goaway . c <nl> + src / core / ext / transport / chttp2 / transport / frame_ping . c <nl> + src / core / ext / transport / chttp2 / transport / frame_rst_stream . c <nl> + src / core / ext / transport / chttp2 / transport / frame_settings . c <nl> + src / core / ext / transport / chttp2 / transport / frame_window_update . c <nl> + src / core / ext / transport / chttp2 / transport / hpack_encoder . c <nl> + src / core / ext / transport / chttp2 / transport / hpack_parser . c <nl> + src / core / ext / transport / chttp2 / transport / hpack_table . c <nl> + src / core / ext / transport / chttp2 / transport / http2_settings . c <nl> + src / core / ext / transport / chttp2 / transport / huffsyms . c <nl> + src / core / ext / transport / chttp2 / transport / incoming_metadata . c <nl> + src / core / ext / transport / chttp2 / transport / parsing . c <nl> + src / core / ext / transport / chttp2 / transport / stream_lists . c <nl> + src / core / ext / transport / chttp2 / transport / stream_map . c <nl> + src / core / ext / transport / chttp2 / transport / varint . c <nl> + src / core / ext / transport / chttp2 / transport / writing . c <nl> + src / core / ext / transport / chttp2 / alpn / alpn . c <nl> + src / core / ext / filters / http / client / http_client_filter . c <nl> + src / core / ext / filters / http / http_filters_plugin . c <nl> + src / core / ext / filters / http / message_compress / message_compress_filter . c <nl> + src / core / ext / filters / http / server / http_server_filter . c <nl> ) <nl> <nl> if ( WIN32 AND MSVC ) <nl> target_link_libraries ( grpc_test_util_unsecure <nl> gpr <nl> gpr_test_util <nl> grpc_unsecure <nl> - grpc <nl> ) <nl> <nl> + foreach ( _hdr <nl> + include / grpc / impl / codegen / byte_buffer_reader . h <nl> + include / grpc / impl / codegen / compression_types . h <nl> + include / grpc / impl / codegen / connectivity_state . h <nl> + include / grpc / impl / codegen / exec_ctx_fwd . h <nl> + include / grpc / impl / codegen / grpc_types . h <nl> + include / grpc / impl / codegen / propagation_bits . h <nl> + include / grpc / impl / codegen / slice . h <nl> + include / grpc / impl / codegen / status . h <nl> + include / grpc / impl / codegen / atm . h <nl> + include / grpc / impl / codegen / atm_gcc_atomic . h <nl> + include / grpc / impl / codegen / atm_gcc_sync . h <nl> + include / grpc / impl / codegen / atm_windows . h <nl> + include / grpc / impl / codegen / gpr_slice . h <nl> + include / grpc / impl / codegen / gpr_types . h <nl> + include / grpc / impl / codegen / port_platform . h <nl> + include / grpc / impl / codegen / sync . h <nl> + include / grpc / impl / codegen / sync_generic . h <nl> + include / grpc / impl / codegen / sync_posix . h <nl> + include / grpc / impl / codegen / sync_windows . h <nl> + ) <nl> + string ( REPLACE " include / " " " _path $ { _hdr } ) <nl> + get_filename_component ( _path $ { _path } PATH ) <nl> + install ( FILES $ { _hdr } <nl> + DESTINATION " $ { gRPC_INSTALL_INCLUDEDIR } / $ { _path } " <nl> + ) <nl> + endforeach ( ) <nl> <nl> endif ( gRPC_BUILD_TESTS ) <nl> <nl> foreach ( _hdr <nl> ) <nl> endforeach ( ) <nl> <nl> + endif ( gRPC_BUILD_TESTS ) <nl> + if ( gRPC_BUILD_TESTS ) <nl> + <nl> + add_library ( grpc + + _test_util_unsecure <nl> + $ { _gRPC_PROTO_GENS_DIR } / src / proto / grpc / health / v1 / health . pb . cc <nl> + $ { _gRPC_PROTO_GENS_DIR } / src / proto / grpc / health / v1 / health . grpc . pb . cc <nl> + $ { _gRPC_PROTO_GENS_DIR } / src / proto / grpc / health / v1 / health . pb . h <nl> + $ { _gRPC_PROTO_GENS_DIR } / src / proto / grpc / health / v1 / health . grpc . pb . h <nl> + $ { _gRPC_PROTO_GENS_DIR } / src / proto / grpc / testing / echo_messages . pb . cc <nl> + $ { _gRPC_PROTO_GENS_DIR } / src / proto / grpc / testing / echo_messages . grpc . pb . cc <nl> + $ { _gRPC_PROTO_GENS_DIR } / src / proto / grpc / testing / echo_messages . pb . h <nl> + $ { _gRPC_PROTO_GENS_DIR } / src / proto / grpc / testing / echo_messages . grpc . pb . h <nl> + $ { _gRPC_PROTO_GENS_DIR } / src / proto / grpc / testing / echo . pb . cc <nl> + $ { _gRPC_PROTO_GENS_DIR } / src / proto / grpc / testing / echo . grpc . pb . cc <nl> + $ { _gRPC_PROTO_GENS_DIR } / src / proto / grpc / testing / echo . pb . h <nl> + $ { _gRPC_PROTO_GENS_DIR } / src / proto / grpc / testing / echo . grpc . pb . h <nl> + $ { _gRPC_PROTO_GENS_DIR } / src / proto / grpc / testing / echo_mock . grpc . pb . h <nl> + $ { _gRPC_PROTO_GENS_DIR } / src / proto / grpc / testing / duplicate / echo_duplicate . pb . cc <nl> + $ { _gRPC_PROTO_GENS_DIR } / src / proto / grpc / testing / duplicate / echo_duplicate . grpc . pb . cc <nl> + $ { _gRPC_PROTO_GENS_DIR } / src / proto / grpc / testing / duplicate / echo_duplicate . pb . h <nl> + $ { _gRPC_PROTO_GENS_DIR } / src / proto / grpc / testing / duplicate / echo_duplicate . grpc . pb . h <nl> + test / cpp / end2end / test_service_impl . cc <nl> + test / cpp / util / byte_buffer_proto_helper . cc <nl> + test / cpp / util / string_ref_helper . cc <nl> + test / cpp / util / subprocess . cc <nl> + src / cpp / codegen / codegen_init . cc <nl> + ) <nl> + <nl> + if ( WIN32 AND MSVC ) <nl> + set_target_properties ( grpc + + _test_util_unsecure PROPERTIES COMPILE_PDB_NAME " grpc + + _test_util_unsecure " <nl> + COMPILE_PDB_OUTPUT_DIRECTORY " $ { CMAKE_BINARY_DIR } " <nl> + ) <nl> + if ( gRPC_INSTALL ) <nl> + install ( FILES $ { CMAKE_CURRENT_BINARY_DIR } / grpc + + _test_util_unsecure . pdb <nl> + DESTINATION $ { gRPC_INSTALL_LIBDIR } OPTIONAL <nl> + ) <nl> + endif ( ) <nl> + endif ( ) <nl> + <nl> + protobuf_generate_grpc_cpp ( <nl> + src / proto / grpc / health / v1 / health . proto <nl> + ) <nl> + protobuf_generate_grpc_cpp ( <nl> + src / proto / grpc / testing / echo_messages . proto <nl> + ) <nl> + protobuf_generate_grpc_cpp ( <nl> + src / proto / grpc / testing / echo . proto <nl> + ) <nl> + protobuf_generate_grpc_cpp ( <nl> + src / proto / grpc / testing / duplicate / echo_duplicate . proto <nl> + ) <nl> + <nl> + target_include_directories ( grpc + + _test_util_unsecure <nl> + PUBLIC $ < INSTALL_INTERFACE : include > $ < BUILD_INTERFACE : $ { CMAKE_CURRENT_SOURCE_DIR } / include > <nl> + PRIVATE $ { CMAKE_CURRENT_SOURCE_DIR } <nl> + PRIVATE $ { BORINGSSL_ROOT_DIR } / include <nl> + PRIVATE $ { PROTOBUF_ROOT_DIR } / src <nl> + PRIVATE $ { ZLIB_INCLUDE_DIR } <nl> + PRIVATE $ { BENCHMARK } / include <nl> + PRIVATE $ { CMAKE_CURRENT_BINARY_DIR } / third_party / zlib <nl> + PRIVATE $ { CARES_BUILD_INCLUDE_DIR } <nl> + PRIVATE $ { CARES_INCLUDE_DIR } <nl> + PRIVATE $ { CARES_PLATFORM_INCLUDE_DIR } <nl> + PRIVATE $ { CMAKE_CURRENT_BINARY_DIR } / third_party / cares / cares <nl> + PRIVATE $ { CMAKE_CURRENT_BINARY_DIR } / third_party / gflags / include <nl> + PRIVATE third_party / googletest / googletest / include <nl> + PRIVATE third_party / googletest / googletest <nl> + PRIVATE third_party / googletest / googlemock / include <nl> + PRIVATE third_party / googletest / googlemock <nl> + PRIVATE $ { _gRPC_PROTO_GENS_DIR } <nl> + ) <nl> + <nl> + target_link_libraries ( grpc + + _test_util_unsecure <nl> + $ { _gRPC_PROTOBUF_LIBRARIES } <nl> + $ { _gRPC_ALLTARGETS_LIBRARIES } <nl> + grpc + + _unsecure <nl> + grpc_test_util_unsecure <nl> + grpc_unsecure <nl> + ) <nl> + <nl> + foreach ( _hdr <nl> + include / grpc + + / impl / codegen / async_stream . h <nl> + include / grpc + + / impl / codegen / async_unary_call . h <nl> + include / grpc + + / impl / codegen / call . h <nl> + include / grpc + + / impl / codegen / call_hook . h <nl> + include / grpc + + / impl / codegen / channel_interface . h <nl> + include / grpc + + / impl / codegen / client_context . h <nl> + include / grpc + + / impl / codegen / client_unary_call . h <nl> + include / grpc + + / impl / codegen / completion_queue . h <nl> + include / grpc + + / impl / codegen / completion_queue_tag . h <nl> + include / grpc + + / impl / codegen / config . h <nl> + include / grpc + + / impl / codegen / core_codegen_interface . h <nl> + include / grpc + + / impl / codegen / create_auth_context . h <nl> + include / grpc + + / impl / codegen / grpc_library . h <nl> + include / grpc + + / impl / codegen / metadata_map . h <nl> + include / grpc + + / impl / codegen / method_handler_impl . h <nl> + include / grpc + + / impl / codegen / rpc_method . h <nl> + include / grpc + + / impl / codegen / rpc_service_method . h <nl> + include / grpc + + / impl / codegen / security / auth_context . h <nl> + include / grpc + + / impl / codegen / serialization_traits . h <nl> + include / grpc + + / impl / codegen / server_context . h <nl> + include / grpc + + / impl / codegen / server_interface . h <nl> + include / grpc + + / impl / codegen / service_type . h <nl> + include / grpc + + / impl / codegen / slice . h <nl> + include / grpc + + / impl / codegen / status . h <nl> + include / grpc + + / impl / codegen / status_code_enum . h <nl> + include / grpc + + / impl / codegen / string_ref . h <nl> + include / grpc + + / impl / codegen / stub_options . h <nl> + include / grpc + + / impl / codegen / sync_stream . h <nl> + include / grpc + + / impl / codegen / time . h <nl> + include / grpc / impl / codegen / byte_buffer_reader . h <nl> + include / grpc / impl / codegen / compression_types . h <nl> + include / grpc / impl / codegen / connectivity_state . h <nl> + include / grpc / impl / codegen / exec_ctx_fwd . h <nl> + include / grpc / impl / codegen / grpc_types . h <nl> + include / grpc / impl / codegen / propagation_bits . h <nl> + include / grpc / impl / codegen / slice . h <nl> + include / grpc / impl / codegen / status . h <nl> + include / grpc / impl / codegen / atm . h <nl> + include / grpc / impl / codegen / atm_gcc_atomic . h <nl> + include / grpc / impl / codegen / atm_gcc_sync . h <nl> + include / grpc / impl / codegen / atm_windows . h <nl> + include / grpc / impl / codegen / gpr_slice . h <nl> + include / grpc / impl / codegen / gpr_types . h <nl> + include / grpc / impl / codegen / port_platform . h <nl> + include / grpc / impl / codegen / sync . h <nl> + include / grpc / impl / codegen / sync_generic . h <nl> + include / grpc / impl / codegen / sync_posix . h <nl> + include / grpc / impl / codegen / sync_windows . h <nl> + include / grpc + + / impl / codegen / proto_utils . h <nl> + include / grpc + + / impl / codegen / config_protobuf . h <nl> + ) <nl> + string ( REPLACE " include / " " " _path $ { _hdr } ) <nl> + get_filename_component ( _path $ { _path } PATH ) <nl> + install ( FILES $ { _hdr } <nl> + DESTINATION " $ { gRPC_INSTALL_INCLUDEDIR } / $ { _path } " <nl> + ) <nl> + endforeach ( ) <nl> + <nl> endif ( gRPC_BUILD_TESTS ) <nl> <nl> add_library ( grpc + + _unsecure <nl> target_link_libraries ( grpc_benchmark <nl> $ { _gRPC_PROTOBUF_LIBRARIES } <nl> $ { _gRPC_ALLTARGETS_LIBRARIES } <nl> benchmark <nl> - grpc + + <nl> - grpc_test_util <nl> - grpc <nl> + grpc + + _unsecure <nl> + grpc_test_util_unsecure <nl> + grpc_unsecure <nl> $ { _gRPC_GFLAGS_LIBRARIES } <nl> ) <nl> <nl> target_include_directories ( alarm_cpp_test <nl> target_link_libraries ( alarm_cpp_test <nl> $ { _gRPC_PROTOBUF_LIBRARIES } <nl> $ { _gRPC_ALLTARGETS_LIBRARIES } <nl> - grpc + + _test_util <nl> - grpc_test_util <nl> - grpc + + <nl> - grpc <nl> + grpc + + _test_util_unsecure <nl> + grpc_test_util_unsecure <nl> + grpc + + _unsecure <nl> + grpc_unsecure <nl> gpr_test_util <nl> gpr <nl> $ { _gRPC_GFLAGS_LIBRARIES } <nl> target_link_libraries ( bm_arena <nl> $ { _gRPC_ALLTARGETS_LIBRARIES } <nl> grpc_benchmark <nl> benchmark <nl> - grpc + + _test_util <nl> - grpc_test_util <nl> - grpc + + <nl> - grpc <nl> + grpc + + _test_util_unsecure <nl> + grpc_test_util_unsecure <nl> + grpc + + _unsecure <nl> + grpc_unsecure <nl> gpr_test_util <nl> gpr <nl> $ { _gRPC_GFLAGS_LIBRARIES } <nl> target_link_libraries ( bm_call_create <nl> $ { _gRPC_ALLTARGETS_LIBRARIES } <nl> grpc_benchmark <nl> benchmark <nl> - grpc + + _test_util <nl> - grpc_test_util <nl> - grpc + + <nl> - grpc <nl> + grpc + + _test_util_unsecure <nl> + grpc_test_util_unsecure <nl> + grpc + + _unsecure <nl> + grpc_unsecure <nl> gpr_test_util <nl> gpr <nl> $ { _gRPC_GFLAGS_LIBRARIES } <nl> target_link_libraries ( bm_chttp2_hpack <nl> $ { _gRPC_ALLTARGETS_LIBRARIES } <nl> grpc_benchmark <nl> benchmark <nl> - grpc + + _test_util <nl> - grpc_test_util <nl> - grpc + + <nl> - grpc <nl> + grpc + + _test_util_unsecure <nl> + grpc_test_util_unsecure <nl> + grpc + + _unsecure <nl> + grpc_unsecure <nl> gpr_test_util <nl> gpr <nl> $ { _gRPC_GFLAGS_LIBRARIES } <nl> target_link_libraries ( bm_chttp2_transport <nl> $ { _gRPC_ALLTARGETS_LIBRARIES } <nl> grpc_benchmark <nl> benchmark <nl> - grpc + + _test_util <nl> - grpc_test_util <nl> - grpc + + <nl> - grpc <nl> + grpc + + _test_util_unsecure <nl> + grpc_test_util_unsecure <nl> + grpc + + _unsecure <nl> + grpc_unsecure <nl> gpr_test_util <nl> gpr <nl> $ { _gRPC_GFLAGS_LIBRARIES } <nl> target_link_libraries ( bm_closure <nl> $ { _gRPC_ALLTARGETS_LIBRARIES } <nl> grpc_benchmark <nl> benchmark <nl> - grpc + + _test_util <nl> - grpc_test_util <nl> - grpc + + <nl> - grpc <nl> + grpc + + _test_util_unsecure <nl> + grpc_test_util_unsecure <nl> + grpc + + _unsecure <nl> + grpc_unsecure <nl> gpr_test_util <nl> gpr <nl> $ { _gRPC_GFLAGS_LIBRARIES } <nl> target_link_libraries ( bm_cq <nl> $ { _gRPC_ALLTARGETS_LIBRARIES } <nl> grpc_benchmark <nl> benchmark <nl> - grpc + + _test_util <nl> - grpc_test_util <nl> - grpc + + <nl> - grpc <nl> + grpc + + _test_util_unsecure <nl> + grpc_test_util_unsecure <nl> + grpc + + _unsecure <nl> + grpc_unsecure <nl> gpr_test_util <nl> gpr <nl> $ { _gRPC_GFLAGS_LIBRARIES } <nl> target_link_libraries ( bm_cq_multiple_threads <nl> $ { _gRPC_ALLTARGETS_LIBRARIES } <nl> grpc_benchmark <nl> benchmark <nl> - grpc + + _test_util <nl> - grpc_test_util <nl> - grpc + + <nl> - grpc <nl> + grpc + + _test_util_unsecure <nl> + grpc_test_util_unsecure <nl> + grpc + + _unsecure <nl> + grpc_unsecure <nl> gpr_test_util <nl> gpr <nl> $ { _gRPC_GFLAGS_LIBRARIES } <nl> target_link_libraries ( bm_error <nl> $ { _gRPC_ALLTARGETS_LIBRARIES } <nl> grpc_benchmark <nl> benchmark <nl> - grpc + + _test_util <nl> - grpc_test_util <nl> - grpc + + <nl> - grpc <nl> + grpc + + _test_util_unsecure <nl> + grpc_test_util_unsecure <nl> + grpc + + _unsecure <nl> + grpc_unsecure <nl> gpr_test_util <nl> gpr <nl> $ { _gRPC_GFLAGS_LIBRARIES } <nl> target_link_libraries ( bm_fullstack_streaming_ping_pong <nl> $ { _gRPC_ALLTARGETS_LIBRARIES } <nl> grpc_benchmark <nl> benchmark <nl> - grpc + + _test_util <nl> - grpc_test_util <nl> - grpc + + <nl> - grpc <nl> + grpc + + _test_util_unsecure <nl> + grpc_test_util_unsecure <nl> + grpc + + _unsecure <nl> + grpc_unsecure <nl> gpr_test_util <nl> gpr <nl> $ { _gRPC_GFLAGS_LIBRARIES } <nl> target_link_libraries ( bm_fullstack_streaming_pump <nl> $ { _gRPC_ALLTARGETS_LIBRARIES } <nl> grpc_benchmark <nl> benchmark <nl> - grpc + + _test_util <nl> - grpc_test_util <nl> - grpc + + <nl> - grpc <nl> + grpc + + _test_util_unsecure <nl> + grpc_test_util_unsecure <nl> + grpc + + _unsecure <nl> + grpc_unsecure <nl> gpr_test_util <nl> gpr <nl> $ { _gRPC_GFLAGS_LIBRARIES } <nl> target_link_libraries ( bm_fullstack_trickle <nl> $ { _gRPC_ALLTARGETS_LIBRARIES } <nl> grpc_benchmark <nl> benchmark <nl> - grpc + + _test_util <nl> - grpc_test_util <nl> - grpc + + <nl> - grpc <nl> + grpc + + _test_util_unsecure <nl> + grpc_test_util_unsecure <nl> + grpc + + _unsecure <nl> + grpc_unsecure <nl> gpr_test_util <nl> gpr <nl> $ { _gRPC_GFLAGS_LIBRARIES } <nl> target_link_libraries ( bm_fullstack_unary_ping_pong <nl> $ { _gRPC_ALLTARGETS_LIBRARIES } <nl> grpc_benchmark <nl> benchmark <nl> - grpc + + _test_util <nl> - grpc_test_util <nl> - grpc + + <nl> - grpc <nl> + grpc + + _test_util_unsecure <nl> + grpc_test_util_unsecure <nl> + grpc + + _unsecure <nl> + grpc_unsecure <nl> gpr_test_util <nl> gpr <nl> $ { _gRPC_GFLAGS_LIBRARIES } <nl> target_link_libraries ( bm_metadata <nl> $ { _gRPC_ALLTARGETS_LIBRARIES } <nl> grpc_benchmark <nl> benchmark <nl> - grpc + + _test_util <nl> - grpc_test_util <nl> - grpc + + <nl> - grpc <nl> + grpc + + _test_util_unsecure <nl> + grpc_test_util_unsecure <nl> + grpc + + _unsecure <nl> + grpc_unsecure <nl> gpr_test_util <nl> gpr <nl> $ { _gRPC_GFLAGS_LIBRARIES } <nl> target_link_libraries ( bm_pollset <nl> $ { _gRPC_ALLTARGETS_LIBRARIES } <nl> grpc_benchmark <nl> benchmark <nl> - grpc + + _test_util <nl> - grpc_test_util <nl> - grpc + + <nl> - grpc <nl> + grpc + + _test_util_unsecure <nl> + grpc_test_util_unsecure <nl> + grpc + + _unsecure <nl> + grpc_unsecure <nl> gpr_test_util <nl> gpr <nl> $ { _gRPC_GFLAGS_LIBRARIES } <nl> target_include_directories ( server_builder_test <nl> target_link_libraries ( server_builder_test <nl> $ { _gRPC_PROTOBUF_LIBRARIES } <nl> $ { _gRPC_ALLTARGETS_LIBRARIES } <nl> - grpc + + _test_util <nl> - grpc_test_util <nl> + grpc + + _test_util_unsecure <nl> + grpc_test_util_unsecure <nl> gpr_test_util <nl> - grpc + + <nl> - grpc <nl> + grpc + + _unsecure <nl> + grpc_unsecure <nl> gpr <nl> $ { _gRPC_GFLAGS_LIBRARIES } <nl> ) <nl> target_include_directories ( server_request_call_test <nl> target_link_libraries ( server_request_call_test <nl> $ { _gRPC_PROTOBUF_LIBRARIES } <nl> $ { _gRPC_ALLTARGETS_LIBRARIES } <nl> - grpc + + _test_util <nl> - grpc_test_util <nl> + grpc + + _test_util_unsecure <nl> + grpc_test_util_unsecure <nl> gpr_test_util <nl> - grpc + + <nl> - grpc <nl> + grpc + + _unsecure <nl> + grpc_unsecure <nl> gpr <nl> $ { _gRPC_GFLAGS_LIBRARIES } <nl> ) <nl> target_include_directories ( thread_manager_test <nl> target_link_libraries ( thread_manager_test <nl> $ { _gRPC_PROTOBUF_LIBRARIES } <nl> $ { _gRPC_ALLTARGETS_LIBRARIES } <nl> - grpc + + <nl> - grpc <nl> + grpc + + _unsecure <nl> + grpc_unsecure <nl> gpr <nl> grpc + + _test_config <nl> $ { _gRPC_GFLAGS_LIBRARIES } <nl> target_include_directories ( thread_stress_test <nl> target_link_libraries ( thread_stress_test <nl> $ { _gRPC_PROTOBUF_LIBRARIES } <nl> $ { _gRPC_ALLTARGETS_LIBRARIES } <nl> - grpc + + _test_util <nl> - grpc_test_util <nl> - grpc + + <nl> - grpc <nl> + grpc + + _test_util_unsecure <nl> + grpc_test_util_unsecure <nl> + grpc + + _unsecure <nl> + grpc_unsecure <nl> gpr_test_util <nl> gpr <nl> $ { _gRPC_GFLAGS_LIBRARIES } <nl> mmm a / Makefile <nl> ppp b / Makefile <nl> pc_cxx : $ ( LIBDIR ) / $ ( CONFIG ) / pkgconfig / grpc + + . pc <nl> pc_cxx_unsecure : $ ( LIBDIR ) / $ ( CONFIG ) / pkgconfig / grpc + + _unsecure . pc <nl> <nl> ifeq ( $ ( EMBED_OPENSSL ) , true ) <nl> - privatelibs_cxx : $ ( LIBDIR ) / $ ( CONFIG ) / libgrpc + + _proto_reflection_desc_db . a $ ( LIBDIR ) / $ ( CONFIG ) / libgrpc + + _test_config . a $ ( LIBDIR ) / $ ( CONFIG ) / libgrpc + + _test_util . a $ ( LIBDIR ) / $ ( CONFIG ) / libgrpc_cli_libs . a $ ( LIBDIR ) / $ ( CONFIG ) / libhttp2_client_main . a $ ( LIBDIR ) / $ ( CONFIG ) / libinterop_client_helper . a $ ( LIBDIR ) / $ ( CONFIG ) / libinterop_client_main . a $ ( LIBDIR ) / $ ( CONFIG ) / libinterop_server_helper . a $ ( LIBDIR ) / $ ( CONFIG ) / libinterop_server_lib . a $ ( LIBDIR ) / $ ( CONFIG ) / libinterop_server_main . a $ ( LIBDIR ) / $ ( CONFIG ) / libqps . a $ ( LIBDIR ) / $ ( CONFIG ) / libboringssl_test_util . a $ ( LIBDIR ) / $ ( CONFIG ) / libboringssl_aes_test_lib . a $ ( LIBDIR ) / $ ( CONFIG ) / libboringssl_asn1_test_lib . a $ ( LIBDIR ) / $ ( CONFIG ) / libboringssl_base64_test_lib . a $ ( LIBDIR ) / $ ( CONFIG ) / libboringssl_bio_test_lib . a $ ( LIBDIR ) / $ ( CONFIG ) / libboringssl_bn_test_lib . a $ ( LIBDIR ) / $ ( CONFIG ) / libboringssl_bytestring_test_lib . a $ ( LIBDIR ) / $ ( CONFIG ) / libboringssl_aead_test_lib . a $ ( LIBDIR ) / $ ( CONFIG ) / libboringssl_cipher_test_lib . a $ ( LIBDIR ) / $ ( CONFIG ) / libboringssl_cmac_test_lib . a $ ( LIBDIR ) / $ ( CONFIG ) / libboringssl_constant_time_test_lib . a $ ( LIBDIR ) / $ ( CONFIG ) / libboringssl_ed25519_test_lib . a $ ( LIBDIR ) / $ ( CONFIG ) / libboringssl_spake25519_test_lib . a $ ( LIBDIR ) / $ ( CONFIG ) / libboringssl_x25519_test_lib . a $ ( LIBDIR ) / $ ( CONFIG ) / libboringssl_digest_test_lib . a $ ( LIBDIR ) / $ ( CONFIG ) / libboringssl_p256 - x86_64_test_lib . a $ ( LIBDIR ) / $ ( CONFIG ) / libboringssl_ecdh_test_lib . a $ ( LIBDIR ) / $ ( CONFIG ) / libboringssl_ecdsa_sign_test_lib . a $ ( LIBDIR ) / $ ( CONFIG ) / libboringssl_ecdsa_test_lib . a $ ( LIBDIR ) / $ ( CONFIG ) / libboringssl_ecdsa_verify_test_lib . a $ ( LIBDIR ) / $ ( CONFIG ) / libboringssl_evp_extra_test_lib . a $ ( LIBDIR ) / $ ( CONFIG ) / libboringssl_evp_test_lib . a $ ( LIBDIR ) / $ ( CONFIG ) / libboringssl_pbkdf_test_lib . a $ ( LIBDIR ) / $ ( CONFIG ) / libboringssl_hkdf_test_lib . a $ ( LIBDIR ) / $ ( CONFIG ) / libboringssl_hmac_test_lib . a $ ( LIBDIR ) / $ ( CONFIG ) / libboringssl_lhash_test_lib . a $ ( LIBDIR ) / $ ( CONFIG ) / libboringssl_gcm_test_lib . a $ ( LIBDIR ) / $ ( CONFIG ) / libboringssl_obj_test_lib . a $ ( LIBDIR ) / $ ( CONFIG ) / libboringssl_pkcs12_test_lib . a $ ( LIBDIR ) / $ ( CONFIG ) / libboringssl_pkcs8_test_lib . a $ ( LIBDIR ) / $ ( CONFIG ) / libboringssl_poly1305_test_lib . a $ ( LIBDIR ) / $ ( CONFIG ) / libboringssl_pool_test_lib . a $ ( LIBDIR ) / $ ( CONFIG ) / libboringssl_refcount_test_lib . a $ ( LIBDIR ) / $ ( CONFIG ) / libboringssl_x509_test_lib . a $ ( LIBDIR ) / $ ( CONFIG ) / libbenchmark . a <nl> + privatelibs_cxx : $ ( LIBDIR ) / $ ( CONFIG ) / libgrpc + + _proto_reflection_desc_db . a $ ( LIBDIR ) / $ ( CONFIG ) / libgrpc + + _test_config . a $ ( LIBDIR ) / $ ( CONFIG ) / libgrpc + + _test_util . a $ ( LIBDIR ) / $ ( CONFIG ) / libgrpc + + _test_util_unsecure . a $ ( LIBDIR ) / $ ( CONFIG ) / libgrpc_cli_libs . a $ ( LIBDIR ) / $ ( CONFIG ) / libhttp2_client_main . a $ ( LIBDIR ) / $ ( CONFIG ) / libinterop_client_helper . a $ ( LIBDIR ) / $ ( CONFIG ) / libinterop_client_main . a $ ( LIBDIR ) / $ ( CONFIG ) / libinterop_server_helper . a $ ( LIBDIR ) / $ ( CONFIG ) / libinterop_server_lib . a $ ( LIBDIR ) / $ ( CONFIG ) / libinterop_server_main . a $ ( LIBDIR ) / $ ( CONFIG ) / libqps . a $ ( LIBDIR ) / $ ( CONFIG ) / libboringssl_test_util . a $ ( LIBDIR ) / $ ( CONFIG ) / libboringssl_aes_test_lib . a $ ( LIBDIR ) / $ ( CONFIG ) / libboringssl_asn1_test_lib . a $ ( LIBDIR ) / $ ( CONFIG ) / libboringssl_base64_test_lib . a $ ( LIBDIR ) / $ ( CONFIG ) / libboringssl_bio_test_lib . a $ ( LIBDIR ) / $ ( CONFIG ) / libboringssl_bn_test_lib . a $ ( LIBDIR ) / $ ( CONFIG ) / libboringssl_bytestring_test_lib . a $ ( LIBDIR ) / $ ( CONFIG ) / libboringssl_aead_test_lib . a $ ( LIBDIR ) / $ ( CONFIG ) / libboringssl_cipher_test_lib . a $ ( LIBDIR ) / $ ( CONFIG ) / libboringssl_cmac_test_lib . a $ ( LIBDIR ) / $ ( CONFIG ) / libboringssl_constant_time_test_lib . a $ ( LIBDIR ) / $ ( CONFIG ) / libboringssl_ed25519_test_lib . a $ ( LIBDIR ) / $ ( CONFIG ) / libboringssl_spake25519_test_lib . a $ ( LIBDIR ) / $ ( CONFIG ) / libboringssl_x25519_test_lib . a $ ( LIBDIR ) / $ ( CONFIG ) / libboringssl_digest_test_lib . a $ ( LIBDIR ) / $ ( CONFIG ) / libboringssl_p256 - x86_64_test_lib . a $ ( LIBDIR ) / $ ( CONFIG ) / libboringssl_ecdh_test_lib . a $ ( LIBDIR ) / $ ( CONFIG ) / libboringssl_ecdsa_sign_test_lib . a $ ( LIBDIR ) / $ ( CONFIG ) / libboringssl_ecdsa_test_lib . a $ ( LIBDIR ) / $ ( CONFIG ) / libboringssl_ecdsa_verify_test_lib . a $ ( LIBDIR ) / $ ( CONFIG ) / libboringssl_evp_extra_test_lib . a $ ( LIBDIR ) / $ ( CONFIG ) / libboringssl_evp_test_lib . a $ ( LIBDIR ) / $ ( CONFIG ) / libboringssl_pbkdf_test_lib . a $ ( LIBDIR ) / $ ( CONFIG ) / libboringssl_hkdf_test_lib . a $ ( LIBDIR ) / $ ( CONFIG ) / libboringssl_hmac_test_lib . a $ ( LIBDIR ) / $ ( CONFIG ) / libboringssl_lhash_test_lib . a $ ( LIBDIR ) / $ ( CONFIG ) / libboringssl_gcm_test_lib . a $ ( LIBDIR ) / $ ( CONFIG ) / libboringssl_obj_test_lib . a $ ( LIBDIR ) / $ ( CONFIG ) / libboringssl_pkcs12_test_lib . a $ ( LIBDIR ) / $ ( CONFIG ) / libboringssl_pkcs8_test_lib . a $ ( LIBDIR ) / $ ( CONFIG ) / libboringssl_poly1305_test_lib . a $ ( LIBDIR ) / $ ( CONFIG ) / libboringssl_pool_test_lib . a $ ( LIBDIR ) / $ ( CONFIG ) / libboringssl_refcount_test_lib . a $ ( LIBDIR ) / $ ( CONFIG ) / libboringssl_x509_test_lib . a $ ( LIBDIR ) / $ ( CONFIG ) / libbenchmark . a <nl> else <nl> - privatelibs_cxx : $ ( LIBDIR ) / $ ( CONFIG ) / libgrpc + + _proto_reflection_desc_db . a $ ( LIBDIR ) / $ ( CONFIG ) / libgrpc + + _test_config . a $ ( LIBDIR ) / $ ( CONFIG ) / libgrpc + + _test_util . a $ ( LIBDIR ) / $ ( CONFIG ) / libgrpc_cli_libs . a $ ( LIBDIR ) / $ ( CONFIG ) / libhttp2_client_main . a $ ( LIBDIR ) / $ ( CONFIG ) / libinterop_client_helper . a $ ( LIBDIR ) / $ ( CONFIG ) / libinterop_client_main . a $ ( LIBDIR ) / $ ( CONFIG ) / libinterop_server_helper . a $ ( LIBDIR ) / $ ( CONFIG ) / libinterop_server_lib . a $ ( LIBDIR ) / $ ( CONFIG ) / libinterop_server_main . a $ ( LIBDIR ) / $ ( CONFIG ) / libqps . a $ ( LIBDIR ) / $ ( CONFIG ) / libbenchmark . a <nl> + privatelibs_cxx : $ ( LIBDIR ) / $ ( CONFIG ) / libgrpc + + _proto_reflection_desc_db . a $ ( LIBDIR ) / $ ( CONFIG ) / libgrpc + + _test_config . a $ ( LIBDIR ) / $ ( CONFIG ) / libgrpc + + _test_util . a $ ( LIBDIR ) / $ ( CONFIG ) / libgrpc + + _test_util_unsecure . a $ ( LIBDIR ) / $ ( CONFIG ) / libgrpc_cli_libs . a $ ( LIBDIR ) / $ ( CONFIG ) / libhttp2_client_main . a $ ( LIBDIR ) / $ ( CONFIG ) / libinterop_client_helper . a $ ( LIBDIR ) / $ ( CONFIG ) / libinterop_client_main . a $ ( LIBDIR ) / $ ( CONFIG ) / libinterop_server_helper . a $ ( LIBDIR ) / $ ( CONFIG ) / libinterop_server_lib . a $ ( LIBDIR ) / $ ( CONFIG ) / libinterop_server_main . a $ ( LIBDIR ) / $ ( CONFIG ) / libqps . a $ ( LIBDIR ) / $ ( CONFIG ) / libbenchmark . a <nl> endif <nl> <nl> <nl> LIBGRPC_TEST_UTIL_SRC = \ <nl> src / core / lib / transport / transport . c \ <nl> src / core / lib / transport / transport_op_string . c \ <nl> src / core / lib / debug / trace . c \ <nl> + src / core / ext / filters / client_channel / channel_connectivity . c \ <nl> + src / core / ext / filters / client_channel / client_channel . c \ <nl> + src / core / ext / filters / client_channel / client_channel_factory . c \ <nl> + src / core / ext / filters / client_channel / client_channel_plugin . c \ <nl> + src / core / ext / filters / client_channel / connector . c \ <nl> + src / core / ext / filters / client_channel / http_connect_handshaker . c \ <nl> + src / core / ext / filters / client_channel / http_proxy . c \ <nl> + src / core / ext / filters / client_channel / lb_policy . c \ <nl> + src / core / ext / filters / client_channel / lb_policy_factory . c \ <nl> + src / core / ext / filters / client_channel / lb_policy_registry . c \ <nl> + src / core / ext / filters / client_channel / parse_address . c \ <nl> + src / core / ext / filters / client_channel / proxy_mapper . c \ <nl> + src / core / ext / filters / client_channel / proxy_mapper_registry . c \ <nl> + src / core / ext / filters / client_channel / resolver . c \ <nl> + src / core / ext / filters / client_channel / resolver_factory . c \ <nl> + src / core / ext / filters / client_channel / resolver_registry . c \ <nl> + src / core / ext / filters / client_channel / retry_throttle . c \ <nl> + src / core / ext / filters / client_channel / subchannel . c \ <nl> + src / core / ext / filters / client_channel / subchannel_index . c \ <nl> + src / core / ext / filters / client_channel / uri_parser . c \ <nl> + src / core / ext / filters / deadline / deadline_filter . c \ <nl> + src / core / ext / transport / chttp2 / transport / bin_decoder . c \ <nl> + src / core / ext / transport / chttp2 / transport / bin_encoder . c \ <nl> + src / core / ext / transport / chttp2 / transport / chttp2_plugin . c \ <nl> + src / core / ext / transport / chttp2 / transport / chttp2_transport . c \ <nl> + src / core / ext / transport / chttp2 / transport / frame_data . c \ <nl> + src / core / ext / transport / chttp2 / transport / frame_goaway . c \ <nl> + src / core / ext / transport / chttp2 / transport / frame_ping . c \ <nl> + src / core / ext / transport / chttp2 / transport / frame_rst_stream . c \ <nl> + src / core / ext / transport / chttp2 / transport / frame_settings . c \ <nl> + src / core / ext / transport / chttp2 / transport / frame_window_update . c \ <nl> + src / core / ext / transport / chttp2 / transport / hpack_encoder . c \ <nl> + src / core / ext / transport / chttp2 / transport / hpack_parser . c \ <nl> + src / core / ext / transport / chttp2 / transport / hpack_table . c \ <nl> + src / core / ext / transport / chttp2 / transport / http2_settings . c \ <nl> + src / core / ext / transport / chttp2 / transport / huffsyms . c \ <nl> + src / core / ext / transport / chttp2 / transport / incoming_metadata . c \ <nl> + src / core / ext / transport / chttp2 / transport / parsing . c \ <nl> + src / core / ext / transport / chttp2 / transport / stream_lists . c \ <nl> + src / core / ext / transport / chttp2 / transport / stream_map . c \ <nl> + src / core / ext / transport / chttp2 / transport / varint . c \ <nl> + src / core / ext / transport / chttp2 / transport / writing . c \ <nl> + src / core / ext / transport / chttp2 / alpn / alpn . c \ <nl> + src / core / ext / filters / http / client / http_client_filter . c \ <nl> + src / core / ext / filters / http / http_filters_plugin . c \ <nl> + src / core / ext / filters / http / message_compress / message_compress_filter . c \ <nl> + src / core / ext / filters / http / server / http_server_filter . c \ <nl> <nl> PUBLIC_HEADERS_C + = \ <nl> include / grpc / impl / codegen / byte_buffer_reader . h \ <nl> LIBGRPC_TEST_UTIL_UNSECURE_SRC = \ <nl> test / core / util / port_server_client . c \ <nl> test / core / util / slice_splitter . c \ <nl> test / core / util / trickle_endpoint . c \ <nl> + src / core / lib / channel / channel_args . c \ <nl> + src / core / lib / channel / channel_stack . c \ <nl> + src / core / lib / channel / channel_stack_builder . c \ <nl> + src / core / lib / channel / connected_channel . c \ <nl> + src / core / lib / channel / handshaker . c \ <nl> + src / core / lib / channel / handshaker_factory . c \ <nl> + src / core / lib / channel / handshaker_registry . c \ <nl> + src / core / lib / compression / compression . c \ <nl> + src / core / lib / compression / message_compress . c \ <nl> + src / core / lib / compression / stream_compression . c \ <nl> + src / core / lib / http / format_request . c \ <nl> + src / core / lib / http / httpcli . c \ <nl> + src / core / lib / http / parser . c \ <nl> + src / core / lib / iomgr / closure . c \ <nl> + src / core / lib / iomgr / combiner . c \ <nl> + src / core / lib / iomgr / endpoint . c \ <nl> + src / core / lib / iomgr / endpoint_pair_posix . c \ <nl> + src / core / lib / iomgr / endpoint_pair_uv . c \ <nl> + src / core / lib / iomgr / endpoint_pair_windows . c \ <nl> + src / core / lib / iomgr / error . c \ <nl> + src / core / lib / iomgr / ev_epoll1_linux . c \ <nl> + src / core / lib / iomgr / ev_epoll_limited_pollers_linux . c \ <nl> + src / core / lib / iomgr / ev_epoll_thread_pool_linux . c \ <nl> + src / core / lib / iomgr / ev_epollex_linux . c \ <nl> + src / core / lib / iomgr / ev_epollsig_linux . c \ <nl> + src / core / lib / iomgr / ev_poll_posix . c \ <nl> + src / core / lib / iomgr / ev_posix . c \ <nl> + src / core / lib / iomgr / ev_windows . c \ <nl> + src / core / lib / iomgr / exec_ctx . c \ <nl> + src / core / lib / iomgr / executor . c \ <nl> + src / core / lib / iomgr / iocp_windows . c \ <nl> + src / core / lib / iomgr / iomgr . c \ <nl> + src / core / lib / iomgr / iomgr_posix . c \ <nl> + src / core / lib / iomgr / iomgr_uv . c \ <nl> + src / core / lib / iomgr / iomgr_windows . c \ <nl> + src / core / lib / iomgr / is_epollexclusive_available . c \ <nl> + src / core / lib / iomgr / load_file . c \ <nl> + src / core / lib / iomgr / lockfree_event . c \ <nl> + src / core / lib / iomgr / network_status_tracker . c \ <nl> + src / core / lib / iomgr / polling_entity . c \ <nl> + src / core / lib / iomgr / pollset_set_uv . c \ <nl> + src / core / lib / iomgr / pollset_set_windows . c \ <nl> + src / core / lib / iomgr / pollset_uv . c \ <nl> + src / core / lib / iomgr / pollset_windows . c \ <nl> + src / core / lib / iomgr / resolve_address_posix . c \ <nl> + src / core / lib / iomgr / resolve_address_uv . c \ <nl> + src / core / lib / iomgr / resolve_address_windows . c \ <nl> + src / core / lib / iomgr / resource_quota . c \ <nl> + src / core / lib / iomgr / sockaddr_utils . c \ <nl> + src / core / lib / iomgr / socket_factory_posix . c \ <nl> + src / core / lib / iomgr / socket_mutator . c \ <nl> + src / core / lib / iomgr / socket_utils_common_posix . c \ <nl> + src / core / lib / iomgr / socket_utils_linux . c \ <nl> + src / core / lib / iomgr / socket_utils_posix . c \ <nl> + src / core / lib / iomgr / socket_utils_uv . c \ <nl> + src / core / lib / iomgr / socket_utils_windows . c \ <nl> + src / core / lib / iomgr / socket_windows . c \ <nl> + src / core / lib / iomgr / tcp_client_posix . c \ <nl> + src / core / lib / iomgr / tcp_client_uv . c \ <nl> + src / core / lib / iomgr / tcp_client_windows . c \ <nl> + src / core / lib / iomgr / tcp_posix . c \ <nl> + src / core / lib / iomgr / tcp_server_posix . c \ <nl> + src / core / lib / iomgr / tcp_server_utils_posix_common . c \ <nl> + src / core / lib / iomgr / tcp_server_utils_posix_ifaddrs . c \ <nl> + src / core / lib / iomgr / tcp_server_utils_posix_noifaddrs . c \ <nl> + src / core / lib / iomgr / tcp_server_uv . c \ <nl> + src / core / lib / iomgr / tcp_server_windows . c \ <nl> + src / core / lib / iomgr / tcp_uv . c \ <nl> + src / core / lib / iomgr / tcp_windows . c \ <nl> + src / core / lib / iomgr / time_averaged_stats . c \ <nl> + src / core / lib / iomgr / timer_generic . c \ <nl> + src / core / lib / iomgr / timer_heap . c \ <nl> + src / core / lib / iomgr / timer_manager . c \ <nl> + src / core / lib / iomgr / timer_uv . c \ <nl> + src / core / lib / iomgr / udp_server . c \ <nl> + src / core / lib / iomgr / unix_sockets_posix . c \ <nl> + src / core / lib / iomgr / unix_sockets_posix_noop . c \ <nl> + src / core / lib / iomgr / wakeup_fd_cv . c \ <nl> + src / core / lib / iomgr / wakeup_fd_eventfd . c \ <nl> + src / core / lib / iomgr / wakeup_fd_nospecial . c \ <nl> + src / core / lib / iomgr / wakeup_fd_pipe . c \ <nl> + src / core / lib / iomgr / wakeup_fd_posix . c \ <nl> + src / core / lib / json / json . c \ <nl> + src / core / lib / json / json_reader . c \ <nl> + src / core / lib / json / json_string . c \ <nl> + src / core / lib / json / json_writer . c \ <nl> + src / core / lib / slice / b64 . c \ <nl> + src / core / lib / slice / percent_encoding . c \ <nl> + src / core / lib / slice / slice . c \ <nl> + src / core / lib / slice / slice_buffer . c \ <nl> + src / core / lib / slice / slice_hash_table . c \ <nl> + src / core / lib / slice / slice_intern . c \ <nl> + src / core / lib / slice / slice_string_helpers . c \ <nl> + src / core / lib / surface / alarm . c \ <nl> + src / core / lib / surface / api_trace . c \ <nl> + src / core / lib / surface / byte_buffer . c \ <nl> + src / core / lib / surface / byte_buffer_reader . c \ <nl> + src / core / lib / surface / call . c \ <nl> + src / core / lib / surface / call_details . c \ <nl> + src / core / lib / surface / call_log_batch . c \ <nl> + src / core / lib / surface / channel . c \ <nl> + src / core / lib / surface / channel_init . c \ <nl> + src / core / lib / surface / channel_ping . c \ <nl> + src / core / lib / surface / channel_stack_type . c \ <nl> + src / core / lib / surface / completion_queue . c \ <nl> + src / core / lib / surface / completion_queue_factory . c \ <nl> + src / core / lib / surface / event_string . c \ <nl> + src / core / lib / surface / lame_client . cc \ <nl> + src / core / lib / surface / metadata_array . c \ <nl> + src / core / lib / surface / server . c \ <nl> + src / core / lib / surface / validate_metadata . c \ <nl> + src / core / lib / surface / version . c \ <nl> + src / core / lib / transport / bdp_estimator . c \ <nl> + src / core / lib / transport / byte_stream . c \ <nl> + src / core / lib / transport / connectivity_state . c \ <nl> + src / core / lib / transport / error_utils . c \ <nl> + src / core / lib / transport / metadata . c \ <nl> + src / core / lib / transport / metadata_batch . c \ <nl> + src / core / lib / transport / pid_controller . c \ <nl> + src / core / lib / transport / service_config . c \ <nl> + src / core / lib / transport / static_metadata . c \ <nl> + src / core / lib / transport / status_conversion . c \ <nl> + src / core / lib / transport / timeout_encoding . c \ <nl> + src / core / lib / transport / transport . c \ <nl> + src / core / lib / transport / transport_op_string . c \ <nl> + src / core / lib / debug / trace . c \ <nl> + src / core / ext / filters / client_channel / channel_connectivity . c \ <nl> + src / core / ext / filters / client_channel / client_channel . c \ <nl> + src / core / ext / filters / client_channel / client_channel_factory . c \ <nl> + src / core / ext / filters / client_channel / client_channel_plugin . c \ <nl> + src / core / ext / filters / client_channel / connector . c \ <nl> + src / core / ext / filters / client_channel / http_connect_handshaker . c \ <nl> + src / core / ext / filters / client_channel / http_proxy . c \ <nl> + src / core / ext / filters / client_channel / lb_policy . c \ <nl> + src / core / ext / filters / client_channel / lb_policy_factory . c \ <nl> + src / core / ext / filters / client_channel / lb_policy_registry . c \ <nl> + src / core / ext / filters / client_channel / parse_address . c \ <nl> + src / core / ext / filters / client_channel / proxy_mapper . c \ <nl> + src / core / ext / filters / client_channel / proxy_mapper_registry . c \ <nl> + src / core / ext / filters / client_channel / resolver . c \ <nl> + src / core / ext / filters / client_channel / resolver_factory . c \ <nl> + src / core / ext / filters / client_channel / resolver_registry . c \ <nl> + src / core / ext / filters / client_channel / retry_throttle . c \ <nl> + src / core / ext / filters / client_channel / subchannel . c \ <nl> + src / core / ext / filters / client_channel / subchannel_index . c \ <nl> + src / core / ext / filters / client_channel / uri_parser . c \ <nl> + src / core / ext / filters / deadline / deadline_filter . c \ <nl> + src / core / ext / transport / chttp2 / transport / bin_decoder . c \ <nl> + src / core / ext / transport / chttp2 / transport / bin_encoder . c \ <nl> + src / core / ext / transport / chttp2 / transport / chttp2_plugin . c \ <nl> + src / core / ext / transport / chttp2 / transport / chttp2_transport . c \ <nl> + src / core / ext / transport / chttp2 / transport / frame_data . c \ <nl> + src / core / ext / transport / chttp2 / transport / frame_goaway . c \ <nl> + src / core / ext / transport / chttp2 / transport / frame_ping . c \ <nl> + src / core / ext / transport / chttp2 / transport / frame_rst_stream . c \ <nl> + src / core / ext / transport / chttp2 / transport / frame_settings . c \ <nl> + src / core / ext / transport / chttp2 / transport / frame_window_update . c \ <nl> + src / core / ext / transport / chttp2 / transport / hpack_encoder . c \ <nl> + src / core / ext / transport / chttp2 / transport / hpack_parser . c \ <nl> + src / core / ext / transport / chttp2 / transport / hpack_table . c \ <nl> + src / core / ext / transport / chttp2 / transport / http2_settings . c \ <nl> + src / core / ext / transport / chttp2 / transport / huffsyms . c \ <nl> + src / core / ext / transport / chttp2 / transport / incoming_metadata . c \ <nl> + src / core / ext / transport / chttp2 / transport / parsing . c \ <nl> + src / core / ext / transport / chttp2 / transport / stream_lists . c \ <nl> + src / core / ext / transport / chttp2 / transport / stream_map . c \ <nl> + src / core / ext / transport / chttp2 / transport / varint . c \ <nl> + src / core / ext / transport / chttp2 / transport / writing . c \ <nl> + src / core / ext / transport / chttp2 / alpn / alpn . c \ <nl> + src / core / ext / filters / http / client / http_client_filter . c \ <nl> + src / core / ext / filters / http / http_filters_plugin . c \ <nl> + src / core / ext / filters / http / message_compress / message_compress_filter . c \ <nl> + src / core / ext / filters / http / server / http_server_filter . c \ <nl> <nl> PUBLIC_HEADERS_C + = \ <nl> + include / grpc / impl / codegen / byte_buffer_reader . h \ <nl> + include / grpc / impl / codegen / compression_types . h \ <nl> + include / grpc / impl / codegen / connectivity_state . h \ <nl> + include / grpc / impl / codegen / exec_ctx_fwd . h \ <nl> + include / grpc / impl / codegen / grpc_types . h \ <nl> + include / grpc / impl / codegen / propagation_bits . h \ <nl> + include / grpc / impl / codegen / slice . h \ <nl> + include / grpc / impl / codegen / status . h \ <nl> + include / grpc / impl / codegen / atm . h \ <nl> + include / grpc / impl / codegen / atm_gcc_atomic . h \ <nl> + include / grpc / impl / codegen / atm_gcc_sync . h \ <nl> + include / grpc / impl / codegen / atm_windows . h \ <nl> + include / grpc / impl / codegen / gpr_slice . h \ <nl> + include / grpc / impl / codegen / gpr_types . h \ <nl> + include / grpc / impl / codegen / port_platform . h \ <nl> + include / grpc / impl / codegen / sync . h \ <nl> + include / grpc / impl / codegen / sync_generic . h \ <nl> + include / grpc / impl / codegen / sync_posix . h \ <nl> + include / grpc / impl / codegen / sync_windows . h \ <nl> <nl> LIBGRPC_TEST_UTIL_UNSECURE_OBJS = $ ( addprefix $ ( OBJDIR ) / $ ( CONFIG ) / , $ ( addsuffix . o , $ ( basename $ ( LIBGRPC_TEST_UTIL_UNSECURE_SRC ) ) ) ) <nl> <nl> $ ( OBJDIR ) / $ ( CONFIG ) / test / cpp / util / test_credentials_provider . o : $ ( GENDIR ) / src / pro <nl> $ ( OBJDIR ) / $ ( CONFIG ) / src / cpp / codegen / codegen_init . o : $ ( GENDIR ) / src / proto / grpc / health / v1 / health . pb . cc $ ( GENDIR ) / src / proto / grpc / health / v1 / health . grpc . pb . cc $ ( GENDIR ) / src / proto / grpc / testing / echo_messages . pb . cc $ ( GENDIR ) / src / proto / grpc / testing / echo_messages . grpc . pb . cc $ ( GENDIR ) / src / proto / grpc / testing / echo . pb . cc $ ( GENDIR ) / src / proto / grpc / testing / echo . grpc . pb . cc $ ( GENDIR ) / src / proto / grpc / testing / duplicate / echo_duplicate . pb . cc $ ( GENDIR ) / src / proto / grpc / testing / duplicate / echo_duplicate . grpc . pb . cc <nl> <nl> <nl> + LIBGRPC + + _TEST_UTIL_UNSECURE_SRC = \ <nl> + $ ( GENDIR ) / src / proto / grpc / health / v1 / health . pb . cc $ ( GENDIR ) / src / proto / grpc / health / v1 / health . grpc . pb . cc \ <nl> + $ ( GENDIR ) / src / proto / grpc / testing / echo_messages . pb . cc $ ( GENDIR ) / src / proto / grpc / testing / echo_messages . grpc . pb . cc \ <nl> + $ ( GENDIR ) / src / proto / grpc / testing / echo . pb . cc $ ( GENDIR ) / src / proto / grpc / testing / echo . grpc . pb . cc \ <nl> + $ ( GENDIR ) / src / proto / grpc / testing / duplicate / echo_duplicate . pb . cc $ ( GENDIR ) / src / proto / grpc / testing / duplicate / echo_duplicate . grpc . pb . cc \ <nl> + test / cpp / end2end / test_service_impl . cc \ <nl> + test / cpp / util / byte_buffer_proto_helper . cc \ <nl> + test / cpp / util / string_ref_helper . cc \ <nl> + test / cpp / util / subprocess . cc \ <nl> + src / cpp / codegen / codegen_init . cc \ <nl> + <nl> + PUBLIC_HEADERS_CXX + = \ <nl> + include / grpc + + / impl / codegen / async_stream . h \ <nl> + include / grpc + + / impl / codegen / async_unary_call . h \ <nl> + include / grpc + + / impl / codegen / call . h \ <nl> + include / grpc + + / impl / codegen / call_hook . h \ <nl> + include / grpc + + / impl / codegen / channel_interface . h \ <nl> + include / grpc + + / impl / codegen / client_context . h \ <nl> + include / grpc + + / impl / codegen / client_unary_call . h \ <nl> + include / grpc + + / impl / codegen / completion_queue . h \ <nl> + include / grpc + + / impl / codegen / completion_queue_tag . h \ <nl> + include / grpc + + / impl / codegen / config . h \ <nl> + include / grpc + + / impl / codegen / core_codegen_interface . h \ <nl> + include / grpc + + / impl / codegen / create_auth_context . h \ <nl> + include / grpc + + / impl / codegen / grpc_library . h \ <nl> + include / grpc + + / impl / codegen / metadata_map . h \ <nl> + include / grpc + + / impl / codegen / method_handler_impl . h \ <nl> + include / grpc + + / impl / codegen / rpc_method . h \ <nl> + include / grpc + + / impl / codegen / rpc_service_method . h \ <nl> + include / grpc + + / impl / codegen / security / auth_context . h \ <nl> + include / grpc + + / impl / codegen / serialization_traits . h \ <nl> + include / grpc + + / impl / codegen / server_context . h \ <nl> + include / grpc + + / impl / codegen / server_interface . h \ <nl> + include / grpc + + / impl / codegen / service_type . h \ <nl> + include / grpc + + / impl / codegen / slice . h \ <nl> + include / grpc + + / impl / codegen / status . h \ <nl> + include / grpc + + / impl / codegen / status_code_enum . h \ <nl> + include / grpc + + / impl / codegen / string_ref . h \ <nl> + include / grpc + + / impl / codegen / stub_options . h \ <nl> + include / grpc + + / impl / codegen / sync_stream . h \ <nl> + include / grpc + + / impl / codegen / time . h \ <nl> + include / grpc / impl / codegen / byte_buffer_reader . h \ <nl> + include / grpc / impl / codegen / compression_types . h \ <nl> + include / grpc / impl / codegen / connectivity_state . h \ <nl> + include / grpc / impl / codegen / exec_ctx_fwd . h \ <nl> + include / grpc / impl / codegen / grpc_types . h \ <nl> + include / grpc / impl / codegen / propagation_bits . h \ <nl> + include / grpc / impl / codegen / slice . h \ <nl> + include / grpc / impl / codegen / status . h \ <nl> + include / grpc / impl / codegen / atm . h \ <nl> + include / grpc / impl / codegen / atm_gcc_atomic . h \ <nl> + include / grpc / impl / codegen / atm_gcc_sync . h \ <nl> + include / grpc / impl / codegen / atm_windows . h \ <nl> + include / grpc / impl / codegen / gpr_slice . h \ <nl> + include / grpc / impl / codegen / gpr_types . h \ <nl> + include / grpc / impl / codegen / port_platform . h \ <nl> + include / grpc / impl / codegen / sync . h \ <nl> + include / grpc / impl / codegen / sync_generic . h \ <nl> + include / grpc / impl / codegen / sync_posix . h \ <nl> + include / grpc / impl / codegen / sync_windows . h \ <nl> + include / grpc + + / impl / codegen / proto_utils . h \ <nl> + include / grpc + + / impl / codegen / config_protobuf . h \ <nl> + <nl> + LIBGRPC + + _TEST_UTIL_UNSECURE_OBJS = $ ( addprefix $ ( OBJDIR ) / $ ( CONFIG ) / , $ ( addsuffix . o , $ ( basename $ ( LIBGRPC + + _TEST_UTIL_UNSECURE_SRC ) ) ) ) <nl> + <nl> + <nl> + ifeq ( $ ( NO_SECURE ) , true ) <nl> + <nl> + # You can ' t build secure libraries if you don ' t have OpenSSL . <nl> + <nl> + $ ( LIBDIR ) / $ ( CONFIG ) / libgrpc + + _test_util_unsecure . a : openssl_dep_error <nl> + <nl> + <nl> + else <nl> + <nl> + ifeq ( $ ( NO_PROTOBUF ) , true ) <nl> + <nl> + # You can ' t build a C + + library if you don ' t have protobuf - a bit overreached , but still okay . <nl> + <nl> + $ ( LIBDIR ) / $ ( CONFIG ) / libgrpc + + _test_util_unsecure . a : protobuf_dep_error <nl> + <nl> + <nl> + else <nl> + <nl> + $ ( LIBDIR ) / $ ( CONFIG ) / libgrpc + + _test_util_unsecure . a : $ ( ZLIB_DEP ) $ ( OPENSSL_DEP ) $ ( CARES_DEP ) $ ( PROTOBUF_DEP ) $ ( LIBGRPC + + _TEST_UTIL_UNSECURE_OBJS ) <nl> + $ ( E ) " [ AR ] Creating $ @ " <nl> + $ ( Q ) mkdir - p ` dirname $ @ ` <nl> + $ ( Q ) rm - f $ ( LIBDIR ) / $ ( CONFIG ) / libgrpc + + _test_util_unsecure . a <nl> + $ ( Q ) $ ( AR ) $ ( AROPTS ) $ ( LIBDIR ) / $ ( CONFIG ) / libgrpc + + _test_util_unsecure . a $ ( LIBGRPC + + _TEST_UTIL_UNSECURE_OBJS ) <nl> + ifeq ( $ ( SYSTEM ) , Darwin ) <nl> + $ ( Q ) ranlib - no_warning_for_no_symbols $ ( LIBDIR ) / $ ( CONFIG ) / libgrpc + + _test_util_unsecure . a <nl> + endif <nl> + <nl> + <nl> + <nl> + <nl> + endif <nl> + <nl> + endif <nl> + <nl> + ifneq ( $ ( NO_SECURE ) , true ) <nl> + ifneq ( $ ( NO_DEPS ) , true ) <nl> + - include $ ( LIBGRPC + + _TEST_UTIL_UNSECURE_OBJS : . o = . dep ) <nl> + endif <nl> + endif <nl> + $ ( OBJDIR ) / $ ( CONFIG ) / test / cpp / end2end / test_service_impl . o : $ ( GENDIR ) / src / proto / grpc / health / v1 / health . pb . cc $ ( GENDIR ) / src / proto / grpc / health / v1 / health . grpc . pb . cc $ ( GENDIR ) / src / proto / grpc / testing / echo_messages . pb . cc $ ( GENDIR ) / src / proto / grpc / testing / echo_messages . grpc . pb . cc $ ( GENDIR ) / src / proto / grpc / testing / echo . pb . cc $ ( GENDIR ) / src / proto / grpc / testing / echo . grpc . pb . cc $ ( GENDIR ) / src / proto / grpc / testing / duplicate / echo_duplicate . pb . cc $ ( GENDIR ) / src / proto / grpc / testing / duplicate / echo_duplicate . grpc . pb . cc <nl> + $ ( OBJDIR ) / $ ( CONFIG ) / test / cpp / util / byte_buffer_proto_helper . o : $ ( GENDIR ) / src / proto / grpc / health / v1 / health . pb . cc $ ( GENDIR ) / src / proto / grpc / health / v1 / health . grpc . pb . cc $ ( GENDIR ) / src / proto / grpc / testing / echo_messages . pb . cc $ ( GENDIR ) / src / proto / grpc / testing / echo_messages . grpc . pb . cc $ ( GENDIR ) / src / proto / grpc / testing / echo . pb . cc $ ( GENDIR ) / src / proto / grpc / testing / echo . grpc . pb . cc $ ( GENDIR ) / src / proto / grpc / testing / duplicate / echo_duplicate . pb . cc $ ( GENDIR ) / src / proto / grpc / testing / duplicate / echo_duplicate . grpc . pb . cc <nl> + $ ( OBJDIR ) / $ ( CONFIG ) / test / cpp / util / string_ref_helper . o : $ ( GENDIR ) / src / proto / grpc / health / v1 / health . pb . cc $ ( GENDIR ) / src / proto / grpc / health / v1 / health . grpc . pb . cc $ ( GENDIR ) / src / proto / grpc / testing / echo_messages . pb . cc $ ( GENDIR ) / src / proto / grpc / testing / echo_messages . grpc . pb . cc $ ( GENDIR ) / src / proto / grpc / testing / echo . pb . cc $ ( GENDIR ) / src / proto / grpc / testing / echo . grpc . pb . cc $ ( GENDIR ) / src / proto / grpc / testing / duplicate / echo_duplicate . pb . cc $ ( GENDIR ) / src / proto / grpc / testing / duplicate / echo_duplicate . grpc . pb . cc <nl> + $ ( OBJDIR ) / $ ( CONFIG ) / test / cpp / util / subprocess . o : $ ( GENDIR ) / src / proto / grpc / health / v1 / health . pb . cc $ ( GENDIR ) / src / proto / grpc / health / v1 / health . grpc . pb . cc $ ( GENDIR ) / src / proto / grpc / testing / echo_messages . pb . cc $ ( GENDIR ) / src / proto / grpc / testing / echo_messages . grpc . pb . cc $ ( GENDIR ) / src / proto / grpc / testing / echo . pb . cc $ ( GENDIR ) / src / proto / grpc / testing / echo . grpc . pb . cc $ ( GENDIR ) / src / proto / grpc / testing / duplicate / echo_duplicate . pb . cc $ ( GENDIR ) / src / proto / grpc / testing / duplicate / echo_duplicate . grpc . pb . cc <nl> + $ ( OBJDIR ) / $ ( CONFIG ) / src / cpp / codegen / codegen_init . o : $ ( GENDIR ) / src / proto / grpc / health / v1 / health . pb . cc $ ( GENDIR ) / src / proto / grpc / health / v1 / health . grpc . pb . cc $ ( GENDIR ) / src / proto / grpc / testing / echo_messages . pb . cc $ ( GENDIR ) / src / proto / grpc / testing / echo_messages . grpc . pb . cc $ ( GENDIR ) / src / proto / grpc / testing / echo . pb . cc $ ( GENDIR ) / src / proto / grpc / testing / echo . grpc . pb . cc $ ( GENDIR ) / src / proto / grpc / testing / duplicate / echo_duplicate . pb . cc $ ( GENDIR ) / src / proto / grpc / testing / duplicate / echo_duplicate . grpc . pb . cc <nl> + <nl> + <nl> LIBGRPC + + _UNSECURE_SRC = \ <nl> src / cpp / client / insecure_credentials . cc \ <nl> src / cpp / common / insecure_create_auth_context . cc \ <nl> $ ( BINDIR ) / $ ( CONFIG ) / alarm_cpp_test : protobuf_dep_error <nl> <nl> else <nl> <nl> - $ ( BINDIR ) / $ ( CONFIG ) / alarm_cpp_test : $ ( PROTOBUF_DEP ) $ ( ALARM_CPP_TEST_OBJS ) $ ( LIBDIR ) / $ ( CONFIG ) / libgrpc + + _test_util . a $ ( LIBDIR ) / $ ( CONFIG ) / libgrpc_test_util . a $ ( LIBDIR ) / $ ( CONFIG ) / libgrpc + + . a $ ( LIBDIR ) / $ ( CONFIG ) / libgrpc . a $ ( LIBDIR ) / $ ( CONFIG ) / libgpr_test_util . a $ ( LIBDIR ) / $ ( CONFIG ) / libgpr . a <nl> + $ ( BINDIR ) / $ ( CONFIG ) / alarm_cpp_test : $ ( PROTOBUF_DEP ) $ ( ALARM_CPP_TEST_OBJS ) $ ( LIBDIR ) / $ ( CONFIG ) / libgrpc + + _test_util_unsecure . a $ ( LIBDIR ) / $ ( CONFIG ) / libgrpc_test_util_unsecure . a $ ( LIBDIR ) / $ ( CONFIG ) / libgrpc + + _unsecure . a $ ( LIBDIR ) / $ ( CONFIG ) / libgrpc_unsecure . a $ ( LIBDIR ) / $ ( CONFIG ) / libgpr_test_util . a $ ( LIBDIR ) / $ ( CONFIG ) / libgpr . a <nl> $ ( E ) " [ LD ] Linking $ @ " <nl> $ ( Q ) mkdir - p ` dirname $ @ ` <nl> - $ ( Q ) $ ( LDXX ) $ ( LDFLAGS ) $ ( ALARM_CPP_TEST_OBJS ) $ ( LIBDIR ) / $ ( CONFIG ) / libgrpc + + _test_util . a $ ( LIBDIR ) / $ ( CONFIG ) / libgrpc_test_util . a $ ( LIBDIR ) / $ ( CONFIG ) / libgrpc + + . a $ ( LIBDIR ) / $ ( CONFIG ) / libgrpc . a $ ( LIBDIR ) / $ ( CONFIG ) / libgpr_test_util . a $ ( LIBDIR ) / $ ( CONFIG ) / libgpr . a $ ( LDLIBSXX ) $ ( LDLIBS_PROTOBUF ) $ ( LDLIBS ) $ ( LDLIBS_SECURE ) $ ( GTEST_LIB ) - o $ ( BINDIR ) / $ ( CONFIG ) / alarm_cpp_test <nl> + $ ( Q ) $ ( LDXX ) $ ( LDFLAGS ) $ ( ALARM_CPP_TEST_OBJS ) $ ( LIBDIR ) / $ ( CONFIG ) / libgrpc + + _test_util_unsecure . a $ ( LIBDIR ) / $ ( CONFIG ) / libgrpc_test_util_unsecure . a $ ( LIBDIR ) / $ ( CONFIG ) / libgrpc + + _unsecure . a $ ( LIBDIR ) / $ ( CONFIG ) / libgrpc_unsecure . a $ ( LIBDIR ) / $ ( CONFIG ) / libgpr_test_util . a $ ( LIBDIR ) / $ ( CONFIG ) / libgpr . a $ ( LDLIBSXX ) $ ( LDLIBS_PROTOBUF ) $ ( LDLIBS ) $ ( LDLIBS_SECURE ) $ ( GTEST_LIB ) - o $ ( BINDIR ) / $ ( CONFIG ) / alarm_cpp_test <nl> <nl> endif <nl> <nl> endif <nl> <nl> - $ ( OBJDIR ) / $ ( CONFIG ) / test / cpp / common / alarm_cpp_test . o : $ ( LIBDIR ) / $ ( CONFIG ) / libgrpc + + _test_util . a $ ( LIBDIR ) / $ ( CONFIG ) / libgrpc_test_util . a $ ( LIBDIR ) / $ ( CONFIG ) / libgrpc + + . a $ ( LIBDIR ) / $ ( CONFIG ) / libgrpc . a $ ( LIBDIR ) / $ ( CONFIG ) / libgpr_test_util . a $ ( LIBDIR ) / $ ( CONFIG ) / libgpr . a <nl> + $ ( OBJDIR ) / $ ( CONFIG ) / test / cpp / common / alarm_cpp_test . o : $ ( LIBDIR ) / $ ( CONFIG ) / libgrpc + + _test_util_unsecure . a $ ( LIBDIR ) / $ ( CONFIG ) / libgrpc_test_util_unsecure . a $ ( LIBDIR ) / $ ( CONFIG ) / libgrpc + + _unsecure . a $ ( LIBDIR ) / $ ( CONFIG ) / libgrpc_unsecure . a $ ( LIBDIR ) / $ ( CONFIG ) / libgpr_test_util . a $ ( LIBDIR ) / $ ( CONFIG ) / libgpr . a <nl> <nl> deps_alarm_cpp_test : $ ( ALARM_CPP_TEST_OBJS : . o = . dep ) <nl> <nl> $ ( BINDIR ) / $ ( CONFIG ) / bm_arena : protobuf_dep_error <nl> <nl> else <nl> <nl> - $ ( BINDIR ) / $ ( CONFIG ) / bm_arena : $ ( PROTOBUF_DEP ) $ ( BM_ARENA_OBJS ) $ ( LIBDIR ) / $ ( CONFIG ) / libgrpc_benchmark . a $ ( LIBDIR ) / $ ( CONFIG ) / libbenchmark . a $ ( LIBDIR ) / $ ( CONFIG ) / libgrpc + + _test_util . a $ ( LIBDIR ) / $ ( CONFIG ) / libgrpc_test_util . a $ ( LIBDIR ) / $ ( CONFIG ) / libgrpc + + . a $ ( LIBDIR ) / $ ( CONFIG ) / libgrpc . a $ ( LIBDIR ) / $ ( CONFIG ) / libgpr_test_util . a $ ( LIBDIR ) / $ ( CONFIG ) / libgpr . a <nl> + $ ( BINDIR ) / $ ( CONFIG ) / bm_arena : $ ( PROTOBUF_DEP ) $ ( BM_ARENA_OBJS ) $ ( LIBDIR ) / $ ( CONFIG ) / libgrpc_benchmark . a $ ( LIBDIR ) / $ ( CONFIG ) / libbenchmark . a $ ( LIBDIR ) / $ ( CONFIG ) / libgrpc + + _test_util_unsecure . a $ ( LIBDIR ) / $ ( CONFIG ) / libgrpc_test_util_unsecure . a $ ( LIBDIR ) / $ ( CONFIG ) / libgrpc + + _unsecure . a $ ( LIBDIR ) / $ ( CONFIG ) / libgrpc_unsecure . a $ ( LIBDIR ) / $ ( CONFIG ) / libgpr_test_util . a $ ( LIBDIR ) / $ ( CONFIG ) / libgpr . a <nl> $ ( E ) " [ LD ] Linking $ @ " <nl> $ ( Q ) mkdir - p ` dirname $ @ ` <nl> - $ ( Q ) $ ( LDXX ) $ ( LDFLAGS ) $ ( BM_ARENA_OBJS ) $ ( LIBDIR ) / $ ( CONFIG ) / libgrpc_benchmark . a $ ( LIBDIR ) / $ ( CONFIG ) / libbenchmark . a $ ( LIBDIR ) / $ ( CONFIG ) / libgrpc + + _test_util . a $ ( LIBDIR ) / $ ( CONFIG ) / libgrpc_test_util . a $ ( LIBDIR ) / $ ( CONFIG ) / libgrpc + + . a $ ( LIBDIR ) / $ ( CONFIG ) / libgrpc . a $ ( LIBDIR ) / $ ( CONFIG ) / libgpr_test_util . a $ ( LIBDIR ) / $ ( CONFIG ) / libgpr . a $ ( LDLIBSXX ) $ ( LDLIBS_PROTOBUF ) $ ( LDLIBS ) $ ( LDLIBS_SECURE ) $ ( GTEST_LIB ) - o $ ( BINDIR ) / $ ( CONFIG ) / bm_arena <nl> + $ ( Q ) $ ( LDXX ) $ ( LDFLAGS ) $ ( BM_ARENA_OBJS ) $ ( LIBDIR ) / $ ( CONFIG ) / libgrpc_benchmark . a $ ( LIBDIR ) / $ ( CONFIG ) / libbenchmark . a $ ( LIBDIR ) / $ ( CONFIG ) / libgrpc + + _test_util_unsecure . a $ ( LIBDIR ) / $ ( CONFIG ) / libgrpc_test_util_unsecure . a $ ( LIBDIR ) / $ ( CONFIG ) / libgrpc + + _unsecure . a $ ( LIBDIR ) / $ ( CONFIG ) / libgrpc_unsecure . a $ ( LIBDIR ) / $ ( CONFIG ) / libgpr_test_util . a $ ( LIBDIR ) / $ ( CONFIG ) / libgpr . a $ ( LDLIBSXX ) $ ( LDLIBS_PROTOBUF ) $ ( LDLIBS ) $ ( LDLIBS_SECURE ) $ ( GTEST_LIB ) - o $ ( BINDIR ) / $ ( CONFIG ) / bm_arena <nl> <nl> endif <nl> <nl> endif <nl> <nl> $ ( BM_ARENA_OBJS ) : CPPFLAGS + = - Ithird_party / benchmark / include - DHAVE_POSIX_REGEX <nl> - $ ( OBJDIR ) / $ ( CONFIG ) / test / cpp / microbenchmarks / bm_arena . o : $ ( LIBDIR ) / $ ( CONFIG ) / libgrpc_benchmark . a $ ( LIBDIR ) / $ ( CONFIG ) / libbenchmark . a $ ( LIBDIR ) / $ ( CONFIG ) / libgrpc + + _test_util . a $ ( LIBDIR ) / $ ( CONFIG ) / libgrpc_test_util . a $ ( LIBDIR ) / $ ( CONFIG ) / libgrpc + + . a $ ( LIBDIR ) / $ ( CONFIG ) / libgrpc . a $ ( LIBDIR ) / $ ( CONFIG ) / libgpr_test_util . a $ ( LIBDIR ) / $ ( CONFIG ) / libgpr . a <nl> + $ ( OBJDIR ) / $ ( CONFIG ) / test / cpp / microbenchmarks / bm_arena . o : $ ( LIBDIR ) / $ ( CONFIG ) / libgrpc_benchmark . a $ ( LIBDIR ) / $ ( CONFIG ) / libbenchmark . a $ ( LIBDIR ) / $ ( CONFIG ) / libgrpc + + _test_util_unsecure . a $ ( LIBDIR ) / $ ( CONFIG ) / libgrpc_test_util_unsecure . a $ ( LIBDIR ) / $ ( CONFIG ) / libgrpc + + _unsecure . a $ ( LIBDIR ) / $ ( CONFIG ) / libgrpc_unsecure . a $ ( LIBDIR ) / $ ( CONFIG ) / libgpr_test_util . a $ ( LIBDIR ) / $ ( CONFIG ) / libgpr . a <nl> <nl> deps_bm_arena : $ ( BM_ARENA_OBJS : . o = . dep ) <nl> <nl> $ ( BINDIR ) / $ ( CONFIG ) / bm_call_create : protobuf_dep_error <nl> <nl> else <nl> <nl> - $ ( BINDIR ) / $ ( CONFIG ) / bm_call_create : $ ( PROTOBUF_DEP ) $ ( BM_CALL_CREATE_OBJS ) $ ( LIBDIR ) / $ ( CONFIG ) / libgrpc_benchmark . a $ ( LIBDIR ) / $ ( CONFIG ) / libbenchmark . a $ ( LIBDIR ) / $ ( CONFIG ) / libgrpc + + _test_util . a $ ( LIBDIR ) / $ ( CONFIG ) / libgrpc_test_util . a $ ( LIBDIR ) / $ ( CONFIG ) / libgrpc + + . a $ ( LIBDIR ) / $ ( CONFIG ) / libgrpc . a $ ( LIBDIR ) / $ ( CONFIG ) / libgpr_test_util . a $ ( LIBDIR ) / $ ( CONFIG ) / libgpr . a <nl> + $ ( BINDIR ) / $ ( CONFIG ) / bm_call_create : $ ( PROTOBUF_DEP ) $ ( BM_CALL_CREATE_OBJS ) $ ( LIBDIR ) / $ ( CONFIG ) / libgrpc_benchmark . a $ ( LIBDIR ) / $ ( CONFIG ) / libbenchmark . a $ ( LIBDIR ) / $ ( CONFIG ) / libgrpc + + _test_util_unsecure . a $ ( LIBDIR ) / $ ( CONFIG ) / libgrpc_test_util_unsecure . a $ ( LIBDIR ) / $ ( CONFIG ) / libgrpc + + _unsecure . a $ ( LIBDIR ) / $ ( CONFIG ) / libgrpc_unsecure . a $ ( LIBDIR ) / $ ( CONFIG ) / libgpr_test_util . a $ ( LIBDIR ) / $ ( CONFIG ) / libgpr . a <nl> $ ( E ) " [ LD ] Linking $ @ " <nl> $ ( Q ) mkdir - p ` dirname $ @ ` <nl> - $ ( Q ) $ ( LDXX ) $ ( LDFLAGS ) $ ( BM_CALL_CREATE_OBJS ) $ ( LIBDIR ) / $ ( CONFIG ) / libgrpc_benchmark . a $ ( LIBDIR ) / $ ( CONFIG ) / libbenchmark . a $ ( LIBDIR ) / $ ( CONFIG ) / libgrpc + + _test_util . a $ ( LIBDIR ) / $ ( CONFIG ) / libgrpc_test_util . a $ ( LIBDIR ) / $ ( CONFIG ) / libgrpc + + . a $ ( LIBDIR ) / $ ( CONFIG ) / libgrpc . a $ ( LIBDIR ) / $ ( CONFIG ) / libgpr_test_util . a $ ( LIBDIR ) / $ ( CONFIG ) / libgpr . a $ ( LDLIBSXX ) $ ( LDLIBS_PROTOBUF ) $ ( LDLIBS ) $ ( LDLIBS_SECURE ) $ ( GTEST_LIB ) - o $ ( BINDIR ) / $ ( CONFIG ) / bm_call_create <nl> + $ ( Q ) $ ( LDXX ) $ ( LDFLAGS ) $ ( BM_CALL_CREATE_OBJS ) $ ( LIBDIR ) / $ ( CONFIG ) / libgrpc_benchmark . a $ ( LIBDIR ) / $ ( CONFIG ) / libbenchmark . a $ ( LIBDIR ) / $ ( CONFIG ) / libgrpc + + _test_util_unsecure . a $ ( LIBDIR ) / $ ( CONFIG ) / libgrpc_test_util_unsecure . a $ ( LIBDIR ) / $ ( CONFIG ) / libgrpc + + _unsecure . a $ ( LIBDIR ) / $ ( CONFIG ) / libgrpc_unsecure . a $ ( LIBDIR ) / $ ( CONFIG ) / libgpr_test_util . a $ ( LIBDIR ) / $ ( CONFIG ) / libgpr . a $ ( LDLIBSXX ) $ ( LDLIBS_PROTOBUF ) $ ( LDLIBS ) $ ( LDLIBS_SECURE ) $ ( GTEST_LIB ) - o $ ( BINDIR ) / $ ( CONFIG ) / bm_call_create <nl> <nl> endif <nl> <nl> endif <nl> <nl> $ ( BM_CALL_CREATE_OBJS ) : CPPFLAGS + = - Ithird_party / benchmark / include - DHAVE_POSIX_REGEX <nl> - $ ( OBJDIR ) / $ ( CONFIG ) / test / cpp / microbenchmarks / bm_call_create . o : $ ( LIBDIR ) / $ ( CONFIG ) / libgrpc_benchmark . a $ ( LIBDIR ) / $ ( CONFIG ) / libbenchmark . a $ ( LIBDIR ) / $ ( CONFIG ) / libgrpc + + _test_util . a $ ( LIBDIR ) / $ ( CONFIG ) / libgrpc_test_util . a $ ( LIBDIR ) / $ ( CONFIG ) / libgrpc + + . a $ ( LIBDIR ) / $ ( CONFIG ) / libgrpc . a $ ( LIBDIR ) / $ ( CONFIG ) / libgpr_test_util . a $ ( LIBDIR ) / $ ( CONFIG ) / libgpr . a <nl> + $ ( OBJDIR ) / $ ( CONFIG ) / test / cpp / microbenchmarks / bm_call_create . o : $ ( LIBDIR ) / $ ( CONFIG ) / libgrpc_benchmark . a $ ( LIBDIR ) / $ ( CONFIG ) / libbenchmark . a $ ( LIBDIR ) / $ ( CONFIG ) / libgrpc + + _test_util_unsecure . a $ ( LIBDIR ) / $ ( CONFIG ) / libgrpc_test_util_unsecure . a $ ( LIBDIR ) / $ ( CONFIG ) / libgrpc + + _unsecure . a $ ( LIBDIR ) / $ ( CONFIG ) / libgrpc_unsecure . a $ ( LIBDIR ) / $ ( CONFIG ) / libgpr_test_util . a $ ( LIBDIR ) / $ ( CONFIG ) / libgpr . a <nl> <nl> deps_bm_call_create : $ ( BM_CALL_CREATE_OBJS : . o = . dep ) <nl> <nl> $ ( BINDIR ) / $ ( CONFIG ) / bm_chttp2_hpack : protobuf_dep_error <nl> <nl> else <nl> <nl> - $ ( BINDIR ) / $ ( CONFIG ) / bm_chttp2_hpack : $ ( PROTOBUF_DEP ) $ ( BM_CHTTP2_HPACK_OBJS ) $ ( LIBDIR ) / $ ( CONFIG ) / libgrpc_benchmark . a $ ( LIBDIR ) / $ ( CONFIG ) / libbenchmark . a $ ( LIBDIR ) / $ ( CONFIG ) / libgrpc + + _test_util . a $ ( LIBDIR ) / $ ( CONFIG ) / libgrpc_test_util . a $ ( LIBDIR ) / $ ( CONFIG ) / libgrpc + + . a $ ( LIBDIR ) / $ ( CONFIG ) / libgrpc . a $ ( LIBDIR ) / $ ( CONFIG ) / libgpr_test_util . a $ ( LIBDIR ) / $ ( CONFIG ) / libgpr . a <nl> + $ ( BINDIR ) / $ ( CONFIG ) / bm_chttp2_hpack : $ ( PROTOBUF_DEP ) $ ( BM_CHTTP2_HPACK_OBJS ) $ ( LIBDIR ) / $ ( CONFIG ) / libgrpc_benchmark . a $ ( LIBDIR ) / $ ( CONFIG ) / libbenchmark . a $ ( LIBDIR ) / $ ( CONFIG ) / libgrpc + + _test_util_unsecure . a $ ( LIBDIR ) / $ ( CONFIG ) / libgrpc_test_util_unsecure . a $ ( LIBDIR ) / $ ( CONFIG ) / libgrpc + + _unsecure . a $ ( LIBDIR ) / $ ( CONFIG ) / libgrpc_unsecure . a $ ( LIBDIR ) / $ ( CONFIG ) / libgpr_test_util . a $ ( LIBDIR ) / $ ( CONFIG ) / libgpr . a <nl> $ ( E ) " [ LD ] Linking $ @ " <nl> $ ( Q ) mkdir - p ` dirname $ @ ` <nl> - $ ( Q ) $ ( LDXX ) $ ( LDFLAGS ) $ ( BM_CHTTP2_HPACK_OBJS ) $ ( LIBDIR ) / $ ( CONFIG ) / libgrpc_benchmark . a $ ( LIBDIR ) / $ ( CONFIG ) / libbenchmark . a $ ( LIBDIR ) / $ ( CONFIG ) / libgrpc + + _test_util . a $ ( LIBDIR ) / $ ( CONFIG ) / libgrpc_test_util . a $ ( LIBDIR ) / $ ( CONFIG ) / libgrpc + + . a $ ( LIBDIR ) / $ ( CONFIG ) / libgrpc . a $ ( LIBDIR ) / $ ( CONFIG ) / libgpr_test_util . a $ ( LIBDIR ) / $ ( CONFIG ) / libgpr . a $ ( LDLIBSXX ) $ ( LDLIBS_PROTOBUF ) $ ( LDLIBS ) $ ( LDLIBS_SECURE ) $ ( GTEST_LIB ) - o $ ( BINDIR ) / $ ( CONFIG ) / bm_chttp2_hpack <nl> + $ ( Q ) $ ( LDXX ) $ ( LDFLAGS ) $ ( BM_CHTTP2_HPACK_OBJS ) $ ( LIBDIR ) / $ ( CONFIG ) / libgrpc_benchmark . a $ ( LIBDIR ) / $ ( CONFIG ) / libbenchmark . a $ ( LIBDIR ) / $ ( CONFIG ) / libgrpc + + _test_util_unsecure . a $ ( LIBDIR ) / $ ( CONFIG ) / libgrpc_test_util_unsecure . a $ ( LIBDIR ) / $ ( CONFIG ) / libgrpc + + _unsecure . a $ ( LIBDIR ) / $ ( CONFIG ) / libgrpc_unsecure . a $ ( LIBDIR ) / $ ( CONFIG ) / libgpr_test_util . a $ ( LIBDIR ) / $ ( CONFIG ) / libgpr . a $ ( LDLIBSXX ) $ ( LDLIBS_PROTOBUF ) $ ( LDLIBS ) $ ( LDLIBS_SECURE ) $ ( GTEST_LIB ) - o $ ( BINDIR ) / $ ( CONFIG ) / bm_chttp2_hpack <nl> <nl> endif <nl> <nl> endif <nl> <nl> $ ( BM_CHTTP2_HPACK_OBJS ) : CPPFLAGS + = - Ithird_party / benchmark / include - DHAVE_POSIX_REGEX <nl> - $ ( OBJDIR ) / $ ( CONFIG ) / test / cpp / microbenchmarks / bm_chttp2_hpack . o : $ ( LIBDIR ) / $ ( CONFIG ) / libgrpc_benchmark . a $ ( LIBDIR ) / $ ( CONFIG ) / libbenchmark . a $ ( LIBDIR ) / $ ( CONFIG ) / libgrpc + + _test_util . a $ ( LIBDIR ) / $ ( CONFIG ) / libgrpc_test_util . a $ ( LIBDIR ) / $ ( CONFIG ) / libgrpc + + . a $ ( LIBDIR ) / $ ( CONFIG ) / libgrpc . a $ ( LIBDIR ) / $ ( CONFIG ) / libgpr_test_util . a $ ( LIBDIR ) / $ ( CONFIG ) / libgpr . a <nl> + $ ( OBJDIR ) / $ ( CONFIG ) / test / cpp / microbenchmarks / bm_chttp2_hpack . o : $ ( LIBDIR ) / $ ( CONFIG ) / libgrpc_benchmark . a $ ( LIBDIR ) / $ ( CONFIG ) / libbenchmark . a $ ( LIBDIR ) / $ ( CONFIG ) / libgrpc + + _test_util_unsecure . a $ ( LIBDIR ) / $ ( CONFIG ) / libgrpc_test_util_unsecure . a $ ( LIBDIR ) / $ ( CONFIG ) / libgrpc + + _unsecure . a $ ( LIBDIR ) / $ ( CONFIG ) / libgrpc_unsecure . a $ ( LIBDIR ) / $ ( CONFIG ) / libgpr_test_util . a $ ( LIBDIR ) / $ ( CONFIG ) / libgpr . a <nl> <nl> deps_bm_chttp2_hpack : $ ( BM_CHTTP2_HPACK_OBJS : . o = . dep ) <nl> <nl> $ ( BINDIR ) / $ ( CONFIG ) / bm_chttp2_transport : protobuf_dep_error <nl> <nl> else <nl> <nl> - $ ( BINDIR ) / $ ( CONFIG ) / bm_chttp2_transport : $ ( PROTOBUF_DEP ) $ ( BM_CHTTP2_TRANSPORT_OBJS ) $ ( LIBDIR ) / $ ( CONFIG ) / libgrpc_benchmark . a $ ( LIBDIR ) / $ ( CONFIG ) / libbenchmark . a $ ( LIBDIR ) / $ ( CONFIG ) / libgrpc + + _test_util . a $ ( LIBDIR ) / $ ( CONFIG ) / libgrpc_test_util . a $ ( LIBDIR ) / $ ( CONFIG ) / libgrpc + + . a $ ( LIBDIR ) / $ ( CONFIG ) / libgrpc . a $ ( LIBDIR ) / $ ( CONFIG ) / libgpr_test_util . a $ ( LIBDIR ) / $ ( CONFIG ) / libgpr . a <nl> + $ ( BINDIR ) / $ ( CONFIG ) / bm_chttp2_transport : $ ( PROTOBUF_DEP ) $ ( BM_CHTTP2_TRANSPORT_OBJS ) $ ( LIBDIR ) / $ ( CONFIG ) / libgrpc_benchmark . a $ ( LIBDIR ) / $ ( CONFIG ) / libbenchmark . a $ ( LIBDIR ) / $ ( CONFIG ) / libgrpc + + _test_util_unsecure . a $ ( LIBDIR ) / $ ( CONFIG ) / libgrpc_test_util_unsecure . a $ ( LIBDIR ) / $ ( CONFIG ) / libgrpc + + _unsecure . a $ ( LIBDIR ) / $ ( CONFIG ) / libgrpc_unsecure . a $ ( LIBDIR ) / $ ( CONFIG ) / libgpr_test_util . a $ ( LIBDIR ) / $ ( CONFIG ) / libgpr . a <nl> $ ( E ) " [ LD ] Linking $ @ " <nl> $ ( Q ) mkdir - p ` dirname $ @ ` <nl> - $ ( Q ) $ ( LDXX ) $ ( LDFLAGS ) $ ( BM_CHTTP2_TRANSPORT_OBJS ) $ ( LIBDIR ) / $ ( CONFIG ) / libgrpc_benchmark . a $ ( LIBDIR ) / $ ( CONFIG ) / libbenchmark . a $ ( LIBDIR ) / $ ( CONFIG ) / libgrpc + + _test_util . a $ ( LIBDIR ) / $ ( CONFIG ) / libgrpc_test_util . a $ ( LIBDIR ) / $ ( CONFIG ) / libgrpc + + . a $ ( LIBDIR ) / $ ( CONFIG ) / libgrpc . a $ ( LIBDIR ) / $ ( CONFIG ) / libgpr_test_util . a $ ( LIBDIR ) / $ ( CONFIG ) / libgpr . a $ ( LDLIBSXX ) $ ( LDLIBS_PROTOBUF ) $ ( LDLIBS ) $ ( LDLIBS_SECURE ) $ ( GTEST_LIB ) - o $ ( BINDIR ) / $ ( CONFIG ) / bm_chttp2_transport <nl> + $ ( Q ) $ ( LDXX ) $ ( LDFLAGS ) $ ( BM_CHTTP2_TRANSPORT_OBJS ) $ ( LIBDIR ) / $ ( CONFIG ) / libgrpc_benchmark . a $ ( LIBDIR ) / $ ( CONFIG ) / libbenchmark . a $ ( LIBDIR ) / $ ( CONFIG ) / libgrpc + + _test_util_unsecure . a $ ( LIBDIR ) / $ ( CONFIG ) / libgrpc_test_util_unsecure . a $ ( LIBDIR ) / $ ( CONFIG ) / libgrpc + + _unsecure . a $ ( LIBDIR ) / $ ( CONFIG ) / libgrpc_unsecure . a $ ( LIBDIR ) / $ ( CONFIG ) / libgpr_test_util . a $ ( LIBDIR ) / $ ( CONFIG ) / libgpr . a $ ( LDLIBSXX ) $ ( LDLIBS_PROTOBUF ) $ ( LDLIBS ) $ ( LDLIBS_SECURE ) $ ( GTEST_LIB ) - o $ ( BINDIR ) / $ ( CONFIG ) / bm_chttp2_transport <nl> <nl> endif <nl> <nl> endif <nl> <nl> $ ( BM_CHTTP2_TRANSPORT_OBJS ) : CPPFLAGS + = - Ithird_party / benchmark / include - DHAVE_POSIX_REGEX <nl> - $ ( OBJDIR ) / $ ( CONFIG ) / test / cpp / microbenchmarks / bm_chttp2_transport . o : $ ( LIBDIR ) / $ ( CONFIG ) / libgrpc_benchmark . a $ ( LIBDIR ) / $ ( CONFIG ) / libbenchmark . a $ ( LIBDIR ) / $ ( CONFIG ) / libgrpc + + _test_util . a $ ( LIBDIR ) / $ ( CONFIG ) / libgrpc_test_util . a $ ( LIBDIR ) / $ ( CONFIG ) / libgrpc + + . a $ ( LIBDIR ) / $ ( CONFIG ) / libgrpc . a $ ( LIBDIR ) / $ ( CONFIG ) / libgpr_test_util . a $ ( LIBDIR ) / $ ( CONFIG ) / libgpr . a <nl> + $ ( OBJDIR ) / $ ( CONFIG ) / test / cpp / microbenchmarks / bm_chttp2_transport . o : $ ( LIBDIR ) / $ ( CONFIG ) / libgrpc_benchmark . a $ ( LIBDIR ) / $ ( CONFIG ) / libbenchmark . a $ ( LIBDIR ) / $ ( CONFIG ) / libgrpc + + _test_util_unsecure . a $ ( LIBDIR ) / $ ( CONFIG ) / libgrpc_test_util_unsecure . a $ ( LIBDIR ) / $ ( CONFIG ) / libgrpc + + _unsecure . a $ ( LIBDIR ) / $ ( CONFIG ) / libgrpc_unsecure . a $ ( LIBDIR ) / $ ( CONFIG ) / libgpr_test_util . a $ ( LIBDIR ) / $ ( CONFIG ) / libgpr . a <nl> <nl> deps_bm_chttp2_transport : $ ( BM_CHTTP2_TRANSPORT_OBJS : . o = . dep ) <nl> <nl> $ ( BINDIR ) / $ ( CONFIG ) / bm_closure : protobuf_dep_error <nl> <nl> else <nl> <nl> - $ ( BINDIR ) / $ ( CONFIG ) / bm_closure : $ ( PROTOBUF_DEP ) $ ( BM_CLOSURE_OBJS ) $ ( LIBDIR ) / $ ( CONFIG ) / libgrpc_benchmark . a $ ( LIBDIR ) / $ ( CONFIG ) / libbenchmark . a $ ( LIBDIR ) / $ ( CONFIG ) / libgrpc + + _test_util . a $ ( LIBDIR ) / $ ( CONFIG ) / libgrpc_test_util . a $ ( LIBDIR ) / $ ( CONFIG ) / libgrpc + + . a $ ( LIBDIR ) / $ ( CONFIG ) / libgrpc . a $ ( LIBDIR ) / $ ( CONFIG ) / libgpr_test_util . a $ ( LIBDIR ) / $ ( CONFIG ) / libgpr . a <nl> + $ ( BINDIR ) / $ ( CONFIG ) / bm_closure : $ ( PROTOBUF_DEP ) $ ( BM_CLOSURE_OBJS ) $ ( LIBDIR ) / $ ( CONFIG ) / libgrpc_benchmark . a $ ( LIBDIR ) / $ ( CONFIG ) / libbenchmark . a $ ( LIBDIR ) / $ ( CONFIG ) / libgrpc + + _test_util_unsecure . a $ ( LIBDIR ) / $ ( CONFIG ) / libgrpc_test_util_unsecure . a $ ( LIBDIR ) / $ ( CONFIG ) / libgrpc + + _unsecure . a $ ( LIBDIR ) / $ ( CONFIG ) / libgrpc_unsecure . a $ ( LIBDIR ) / $ ( CONFIG ) / libgpr_test_util . a $ ( LIBDIR ) / $ ( CONFIG ) / libgpr . a <nl> $ ( E ) " [ LD ] Linking $ @ " <nl> $ ( Q ) mkdir - p ` dirname $ @ ` <nl> - $ ( Q ) $ ( LDXX ) $ ( LDFLAGS ) $ ( BM_CLOSURE_OBJS ) $ ( LIBDIR ) / $ ( CONFIG ) / libgrpc_benchmark . a $ ( LIBDIR ) / $ ( CONFIG ) / libbenchmark . a $ ( LIBDIR ) / $ ( CONFIG ) / libgrpc + + _test_util . a $ ( LIBDIR ) / $ ( CONFIG ) / libgrpc_test_util . a $ ( LIBDIR ) / $ ( CONFIG ) / libgrpc + + . a $ ( LIBDIR ) / $ ( CONFIG ) / libgrpc . a $ ( LIBDIR ) / $ ( CONFIG ) / libgpr_test_util . a $ ( LIBDIR ) / $ ( CONFIG ) / libgpr . a $ ( LDLIBSXX ) $ ( LDLIBS_PROTOBUF ) $ ( LDLIBS ) $ ( LDLIBS_SECURE ) $ ( GTEST_LIB ) - o $ ( BINDIR ) / $ ( CONFIG ) / bm_closure <nl> + $ ( Q ) $ ( LDXX ) $ ( LDFLAGS ) $ ( BM_CLOSURE_OBJS ) $ ( LIBDIR ) / $ ( CONFIG ) / libgrpc_benchmark . a $ ( LIBDIR ) / $ ( CONFIG ) / libbenchmark . a $ ( LIBDIR ) / $ ( CONFIG ) / libgrpc + + _test_util_unsecure . a $ ( LIBDIR ) / $ ( CONFIG ) / libgrpc_test_util_unsecure . a $ ( LIBDIR ) / $ ( CONFIG ) / libgrpc + + _unsecure . a $ ( LIBDIR ) / $ ( CONFIG ) / libgrpc_unsecure . a $ ( LIBDIR ) / $ ( CONFIG ) / libgpr_test_util . a $ ( LIBDIR ) / $ ( CONFIG ) / libgpr . a $ ( LDLIBSXX ) $ ( LDLIBS_PROTOBUF ) $ ( LDLIBS ) $ ( LDLIBS_SECURE ) $ ( GTEST_LIB ) - o $ ( BINDIR ) / $ ( CONFIG ) / bm_closure <nl> <nl> endif <nl> <nl> endif <nl> <nl> $ ( BM_CLOSURE_OBJS ) : CPPFLAGS + = - Ithird_party / benchmark / include - DHAVE_POSIX_REGEX <nl> - $ ( OBJDIR ) / $ ( CONFIG ) / test / cpp / microbenchmarks / bm_closure . o : $ ( LIBDIR ) / $ ( CONFIG ) / libgrpc_benchmark . a $ ( LIBDIR ) / $ ( CONFIG ) / libbenchmark . a $ ( LIBDIR ) / $ ( CONFIG ) / libgrpc + + _test_util . a $ ( LIBDIR ) / $ ( CONFIG ) / libgrpc_test_util . a $ ( LIBDIR ) / $ ( CONFIG ) / libgrpc + + . a $ ( LIBDIR ) / $ ( CONFIG ) / libgrpc . a $ ( LIBDIR ) / $ ( CONFIG ) / libgpr_test_util . a $ ( LIBDIR ) / $ ( CONFIG ) / libgpr . a <nl> + $ ( OBJDIR ) / $ ( CONFIG ) / test / cpp / microbenchmarks / bm_closure . o : $ ( LIBDIR ) / $ ( CONFIG ) / libgrpc_benchmark . a $ ( LIBDIR ) / $ ( CONFIG ) / libbenchmark . a $ ( LIBDIR ) / $ ( CONFIG ) / libgrpc + + _test_util_unsecure . a $ ( LIBDIR ) / $ ( CONFIG ) / libgrpc_test_util_unsecure . a $ ( LIBDIR ) / $ ( CONFIG ) / libgrpc + + _unsecure . a $ ( LIBDIR ) / $ ( CONFIG ) / libgrpc_unsecure . a $ ( LIBDIR ) / $ ( CONFIG ) / libgpr_test_util . a $ ( LIBDIR ) / $ ( CONFIG ) / libgpr . a <nl> <nl> deps_bm_closure : $ ( BM_CLOSURE_OBJS : . o = . dep ) <nl> <nl> $ ( BINDIR ) / $ ( CONFIG ) / bm_cq : protobuf_dep_error <nl> <nl> else <nl> <nl> - $ ( BINDIR ) / $ ( CONFIG ) / bm_cq : $ ( PROTOBUF_DEP ) $ ( BM_CQ_OBJS ) $ ( LIBDIR ) / $ ( CONFIG ) / libgrpc_benchmark . a $ ( LIBDIR ) / $ ( CONFIG ) / libbenchmark . a $ ( LIBDIR ) / $ ( CONFIG ) / libgrpc + + _test_util . a $ ( LIBDIR ) / $ ( CONFIG ) / libgrpc_test_util . a $ ( LIBDIR ) / $ ( CONFIG ) / libgrpc + + . a $ ( LIBDIR ) / $ ( CONFIG ) / libgrpc . a $ ( LIBDIR ) / $ ( CONFIG ) / libgpr_test_util . a $ ( LIBDIR ) / $ ( CONFIG ) / libgpr . a <nl> + $ ( BINDIR ) / $ ( CONFIG ) / bm_cq : $ ( PROTOBUF_DEP ) $ ( BM_CQ_OBJS ) $ ( LIBDIR ) / $ ( CONFIG ) / libgrpc_benchmark . a $ ( LIBDIR ) / $ ( CONFIG ) / libbenchmark . a $ ( LIBDIR ) / $ ( CONFIG ) / libgrpc + + _test_util_unsecure . a $ ( LIBDIR ) / $ ( CONFIG ) / libgrpc_test_util_unsecure . a $ ( LIBDIR ) / $ ( CONFIG ) / libgrpc + + _unsecure . a $ ( LIBDIR ) / $ ( CONFIG ) / libgrpc_unsecure . a $ ( LIBDIR ) / $ ( CONFIG ) / libgpr_test_util . a $ ( LIBDIR ) / $ ( CONFIG ) / libgpr . a <nl> $ ( E ) " [ LD ] Linking $ @ " <nl> $ ( Q ) mkdir - p ` dirname $ @ ` <nl> - $ ( Q ) $ ( LDXX ) $ ( LDFLAGS ) $ ( BM_CQ_OBJS ) $ ( LIBDIR ) / $ ( CONFIG ) / libgrpc_benchmark . a $ ( LIBDIR ) / $ ( CONFIG ) / libbenchmark . a $ ( LIBDIR ) / $ ( CONFIG ) / libgrpc + + _test_util . a $ ( LIBDIR ) / $ ( CONFIG ) / libgrpc_test_util . a $ ( LIBDIR ) / $ ( CONFIG ) / libgrpc + + . a $ ( LIBDIR ) / $ ( CONFIG ) / libgrpc . a $ ( LIBDIR ) / $ ( CONFIG ) / libgpr_test_util . a $ ( LIBDIR ) / $ ( CONFIG ) / libgpr . a $ ( LDLIBSXX ) $ ( LDLIBS_PROTOBUF ) $ ( LDLIBS ) $ ( LDLIBS_SECURE ) $ ( GTEST_LIB ) - o $ ( BINDIR ) / $ ( CONFIG ) / bm_cq <nl> + $ ( Q ) $ ( LDXX ) $ ( LDFLAGS ) $ ( BM_CQ_OBJS ) $ ( LIBDIR ) / $ ( CONFIG ) / libgrpc_benchmark . a $ ( LIBDIR ) / $ ( CONFIG ) / libbenchmark . a $ ( LIBDIR ) / $ ( CONFIG ) / libgrpc + + _test_util_unsecure . a $ ( LIBDIR ) / $ ( CONFIG ) / libgrpc_test_util_unsecure . a $ ( LIBDIR ) / $ ( CONFIG ) / libgrpc + + _unsecure . a $ ( LIBDIR ) / $ ( CONFIG ) / libgrpc_unsecure . a $ ( LIBDIR ) / $ ( CONFIG ) / libgpr_test_util . a $ ( LIBDIR ) / $ ( CONFIG ) / libgpr . a $ ( LDLIBSXX ) $ ( LDLIBS_PROTOBUF ) $ ( LDLIBS ) $ ( LDLIBS_SECURE ) $ ( GTEST_LIB ) - o $ ( BINDIR ) / $ ( CONFIG ) / bm_cq <nl> <nl> endif <nl> <nl> endif <nl> <nl> $ ( BM_CQ_OBJS ) : CPPFLAGS + = - Ithird_party / benchmark / include - DHAVE_POSIX_REGEX <nl> - $ ( OBJDIR ) / $ ( CONFIG ) / test / cpp / microbenchmarks / bm_cq . o : $ ( LIBDIR ) / $ ( CONFIG ) / libgrpc_benchmark . a $ ( LIBDIR ) / $ ( CONFIG ) / libbenchmark . a $ ( LIBDIR ) / $ ( CONFIG ) / libgrpc + + _test_util . a $ ( LIBDIR ) / $ ( CONFIG ) / libgrpc_test_util . a $ ( LIBDIR ) / $ ( CONFIG ) / libgrpc + + . a $ ( LIBDIR ) / $ ( CONFIG ) / libgrpc . a $ ( LIBDIR ) / $ ( CONFIG ) / libgpr_test_util . a $ ( LIBDIR ) / $ ( CONFIG ) / libgpr . a <nl> + $ ( OBJDIR ) / $ ( CONFIG ) / test / cpp / microbenchmarks / bm_cq . o : $ ( LIBDIR ) / $ ( CONFIG ) / libgrpc_benchmark . a $ ( LIBDIR ) / $ ( CONFIG ) / libbenchmark . a $ ( LIBDIR ) / $ ( CONFIG ) / libgrpc + + _test_util_unsecure . a $ ( LIBDIR ) / $ ( CONFIG ) / libgrpc_test_util_unsecure . a $ ( LIBDIR ) / $ ( CONFIG ) / libgrpc + + _unsecure . a $ ( LIBDIR ) / $ ( CONFIG ) / libgrpc_unsecure . a $ ( LIBDIR ) / $ ( CONFIG ) / libgpr_test_util . a $ ( LIBDIR ) / $ ( CONFIG ) / libgpr . a <nl> <nl> deps_bm_cq : $ ( BM_CQ_OBJS : . o = . dep ) <nl> <nl> $ ( BINDIR ) / $ ( CONFIG ) / bm_cq_multiple_threads : protobuf_dep_error <nl> <nl> else <nl> <nl> - $ ( BINDIR ) / $ ( CONFIG ) / bm_cq_multiple_threads : $ ( PROTOBUF_DEP ) $ ( BM_CQ_MULTIPLE_THREADS_OBJS ) $ ( LIBDIR ) / $ ( CONFIG ) / libgrpc_benchmark . a $ ( LIBDIR ) / $ ( CONFIG ) / libbenchmark . a $ ( LIBDIR ) / $ ( CONFIG ) / libgrpc + + _test_util . a $ ( LIBDIR ) / $ ( CONFIG ) / libgrpc_test_util . a $ ( LIBDIR ) / $ ( CONFIG ) / libgrpc + + . a $ ( LIBDIR ) / $ ( CONFIG ) / libgrpc . a $ ( LIBDIR ) / $ ( CONFIG ) / libgpr_test_util . a $ ( LIBDIR ) / $ ( CONFIG ) / libgpr . a <nl> + $ ( BINDIR ) / $ ( CONFIG ) / bm_cq_multiple_threads : $ ( PROTOBUF_DEP ) $ ( BM_CQ_MULTIPLE_THREADS_OBJS ) $ ( LIBDIR ) / $ ( CONFIG ) / libgrpc_benchmark . a $ ( LIBDIR ) / $ ( CONFIG ) / libbenchmark . a $ ( LIBDIR ) / $ ( CONFIG ) / libgrpc + + _test_util_unsecure . a $ ( LIBDIR ) / $ ( CONFIG ) / libgrpc_test_util_unsecure . a $ ( LIBDIR ) / $ ( CONFIG ) / libgrpc + + _unsecure . a $ ( LIBDIR ) / $ ( CONFIG ) / libgrpc_unsecure . a $ ( LIBDIR ) / $ ( CONFIG ) / libgpr_test_util . a $ ( LIBDIR ) / $ ( CONFIG ) / libgpr . a <nl> $ ( E ) " [ LD ] Linking $ @ " <nl> $ ( Q ) mkdir - p ` dirname $ @ ` <nl> - $ ( Q ) $ ( LDXX ) $ ( LDFLAGS ) $ ( BM_CQ_MULTIPLE_THREADS_OBJS ) $ ( LIBDIR ) / $ ( CONFIG ) / libgrpc_benchmark . a $ ( LIBDIR ) / $ ( CONFIG ) / libbenchmark . a $ ( LIBDIR ) / $ ( CONFIG ) / libgrpc + + _test_util . a $ ( LIBDIR ) / $ ( CONFIG ) / libgrpc_test_util . a $ ( LIBDIR ) / $ ( CONFIG ) / libgrpc + + . a $ ( LIBDIR ) / $ ( CONFIG ) / libgrpc . a $ ( LIBDIR ) / $ ( CONFIG ) / libgpr_test_util . a $ ( LIBDIR ) / $ ( CONFIG ) / libgpr . a $ ( LDLIBSXX ) $ ( LDLIBS_PROTOBUF ) $ ( LDLIBS ) $ ( LDLIBS_SECURE ) $ ( GTEST_LIB ) - o $ ( BINDIR ) / $ ( CONFIG ) / bm_cq_multiple_threads <nl> + $ ( Q ) $ ( LDXX ) $ ( LDFLAGS ) $ ( BM_CQ_MULTIPLE_THREADS_OBJS ) $ ( LIBDIR ) / $ ( CONFIG ) / libgrpc_benchmark . a $ ( LIBDIR ) / $ ( CONFIG ) / libbenchmark . a $ ( LIBDIR ) / $ ( CONFIG ) / libgrpc + + _test_util_unsecure . a $ ( LIBDIR ) / $ ( CONFIG ) / libgrpc_test_util_unsecure . a $ ( LIBDIR ) / $ ( CONFIG ) / libgrpc + + _unsecure . a $ ( LIBDIR ) / $ ( CONFIG ) / libgrpc_unsecure . a $ ( LIBDIR ) / $ ( CONFIG ) / libgpr_test_util . a $ ( LIBDIR ) / $ ( CONFIG ) / libgpr . a $ ( LDLIBSXX ) $ ( LDLIBS_PROTOBUF ) $ ( LDLIBS ) $ ( LDLIBS_SECURE ) $ ( GTEST_LIB ) - o $ ( BINDIR ) / $ ( CONFIG ) / bm_cq_multiple_threads <nl> <nl> endif <nl> <nl> endif <nl> <nl> $ ( BM_CQ_MULTIPLE_THREADS_OBJS ) : CPPFLAGS + = - Ithird_party / benchmark / include - DHAVE_POSIX_REGEX <nl> - $ ( OBJDIR ) / $ ( CONFIG ) / test / cpp / microbenchmarks / bm_cq_multiple_threads . o : $ ( LIBDIR ) / $ ( CONFIG ) / libgrpc_benchmark . a $ ( LIBDIR ) / $ ( CONFIG ) / libbenchmark . a $ ( LIBDIR ) / $ ( CONFIG ) / libgrpc + + _test_util . a $ ( LIBDIR ) / $ ( CONFIG ) / libgrpc_test_util . a $ ( LIBDIR ) / $ ( CONFIG ) / libgrpc + + . a $ ( LIBDIR ) / $ ( CONFIG ) / libgrpc . a $ ( LIBDIR ) / $ ( CONFIG ) / libgpr_test_util . a $ ( LIBDIR ) / $ ( CONFIG ) / libgpr . a <nl> + $ ( OBJDIR ) / $ ( CONFIG ) / test / cpp / microbenchmarks / bm_cq_multiple_threads . o : $ ( LIBDIR ) / $ ( CONFIG ) / libgrpc_benchmark . a $ ( LIBDIR ) / $ ( CONFIG ) / libbenchmark . a $ ( LIBDIR ) / $ ( CONFIG ) / libgrpc + + _test_util_unsecure . a $ ( LIBDIR ) / $ ( CONFIG ) / libgrpc_test_util_unsecure . a $ ( LIBDIR ) / $ ( CONFIG ) / libgrpc + + _unsecure . a $ ( LIBDIR ) / $ ( CONFIG ) / libgrpc_unsecure . a $ ( LIBDIR ) / $ ( CONFIG ) / libgpr_test_util . a $ ( LIBDIR ) / $ ( CONFIG ) / libgpr . a <nl> <nl> deps_bm_cq_multiple_threads : $ ( BM_CQ_MULTIPLE_THREADS_OBJS : . o = . dep ) <nl> <nl> $ ( BINDIR ) / $ ( CONFIG ) / bm_error : protobuf_dep_error <nl> <nl> else <nl> <nl> - $ ( BINDIR ) / $ ( CONFIG ) / bm_error : $ ( PROTOBUF_DEP ) $ ( BM_ERROR_OBJS ) $ ( LIBDIR ) / $ ( CONFIG ) / libgrpc_benchmark . a $ ( LIBDIR ) / $ ( CONFIG ) / libbenchmark . a $ ( LIBDIR ) / $ ( CONFIG ) / libgrpc + + _test_util . a $ ( LIBDIR ) / $ ( CONFIG ) / libgrpc_test_util . a $ ( LIBDIR ) / $ ( CONFIG ) / libgrpc + + . a $ ( LIBDIR ) / $ ( CONFIG ) / libgrpc . a $ ( LIBDIR ) / $ ( CONFIG ) / libgpr_test_util . a $ ( LIBDIR ) / $ ( CONFIG ) / libgpr . a <nl> + $ ( BINDIR ) / $ ( CONFIG ) / bm_error : $ ( PROTOBUF_DEP ) $ ( BM_ERROR_OBJS ) $ ( LIBDIR ) / $ ( CONFIG ) / libgrpc_benchmark . a $ ( LIBDIR ) / $ ( CONFIG ) / libbenchmark . a $ ( LIBDIR ) / $ ( CONFIG ) / libgrpc + + _test_util_unsecure . a $ ( LIBDIR ) / $ ( CONFIG ) / libgrpc_test_util_unsecure . a $ ( LIBDIR ) / $ ( CONFIG ) / libgrpc + + _unsecure . a $ ( LIBDIR ) / $ ( CONFIG ) / libgrpc_unsecure . a $ ( LIBDIR ) / $ ( CONFIG ) / libgpr_test_util . a $ ( LIBDIR ) / $ ( CONFIG ) / libgpr . a <nl> $ ( E ) " [ LD ] Linking $ @ " <nl> $ ( Q ) mkdir - p ` dirname $ @ ` <nl> - $ ( Q ) $ ( LDXX ) $ ( LDFLAGS ) $ ( BM_ERROR_OBJS ) $ ( LIBDIR ) / $ ( CONFIG ) / libgrpc_benchmark . a $ ( LIBDIR ) / $ ( CONFIG ) / libbenchmark . a $ ( LIBDIR ) / $ ( CONFIG ) / libgrpc + + _test_util . a $ ( LIBDIR ) / $ ( CONFIG ) / libgrpc_test_util . a $ ( LIBDIR ) / $ ( CONFIG ) / libgrpc + + . a $ ( LIBDIR ) / $ ( CONFIG ) / libgrpc . a $ ( LIBDIR ) / $ ( CONFIG ) / libgpr_test_util . a $ ( LIBDIR ) / $ ( CONFIG ) / libgpr . a $ ( LDLIBSXX ) $ ( LDLIBS_PROTOBUF ) $ ( LDLIBS ) $ ( LDLIBS_SECURE ) $ ( GTEST_LIB ) - o $ ( BINDIR ) / $ ( CONFIG ) / bm_error <nl> + $ ( Q ) $ ( LDXX ) $ ( LDFLAGS ) $ ( BM_ERROR_OBJS ) $ ( LIBDIR ) / $ ( CONFIG ) / libgrpc_benchmark . a $ ( LIBDIR ) / $ ( CONFIG ) / libbenchmark . a $ ( LIBDIR ) / $ ( CONFIG ) / libgrpc + + _test_util_unsecure . a $ ( LIBDIR ) / $ ( CONFIG ) / libgrpc_test_util_unsecure . a $ ( LIBDIR ) / $ ( CONFIG ) / libgrpc + + _unsecure . a $ ( LIBDIR ) / $ ( CONFIG ) / libgrpc_unsecure . a $ ( LIBDIR ) / $ ( CONFIG ) / libgpr_test_util . a $ ( LIBDIR ) / $ ( CONFIG ) / libgpr . a $ ( LDLIBSXX ) $ ( LDLIBS_PROTOBUF ) $ ( LDLIBS ) $ ( LDLIBS_SECURE ) $ ( GTEST_LIB ) - o $ ( BINDIR ) / $ ( CONFIG ) / bm_error <nl> <nl> endif <nl> <nl> endif <nl> <nl> $ ( BM_ERROR_OBJS ) : CPPFLAGS + = - Ithird_party / benchmark / include - DHAVE_POSIX_REGEX <nl> - $ ( OBJDIR ) / $ ( CONFIG ) / test / cpp / microbenchmarks / bm_error . o : $ ( LIBDIR ) / $ ( CONFIG ) / libgrpc_benchmark . a $ ( LIBDIR ) / $ ( CONFIG ) / libbenchmark . a $ ( LIBDIR ) / $ ( CONFIG ) / libgrpc + + _test_util . a $ ( LIBDIR ) / $ ( CONFIG ) / libgrpc_test_util . a $ ( LIBDIR ) / $ ( CONFIG ) / libgrpc + + . a $ ( LIBDIR ) / $ ( CONFIG ) / libgrpc . a $ ( LIBDIR ) / $ ( CONFIG ) / libgpr_test_util . a $ ( LIBDIR ) / $ ( CONFIG ) / libgpr . a <nl> + $ ( OBJDIR ) / $ ( CONFIG ) / test / cpp / microbenchmarks / bm_error . o : $ ( LIBDIR ) / $ ( CONFIG ) / libgrpc_benchmark . a $ ( LIBDIR ) / $ ( CONFIG ) / libbenchmark . a $ ( LIBDIR ) / $ ( CONFIG ) / libgrpc + + _test_util_unsecure . a $ ( LIBDIR ) / $ ( CONFIG ) / libgrpc_test_util_unsecure . a $ ( LIBDIR ) / $ ( CONFIG ) / libgrpc + + _unsecure . a $ ( LIBDIR ) / $ ( CONFIG ) / libgrpc_unsecure . a $ ( LIBDIR ) / $ ( CONFIG ) / libgpr_test_util . a $ ( LIBDIR ) / $ ( CONFIG ) / libgpr . a <nl> <nl> deps_bm_error : $ ( BM_ERROR_OBJS : . o = . dep ) <nl> <nl> $ ( BINDIR ) / $ ( CONFIG ) / bm_fullstack_streaming_ping_pong : protobuf_dep_error <nl> <nl> else <nl> <nl> - $ ( BINDIR ) / $ ( CONFIG ) / bm_fullstack_streaming_ping_pong : $ ( PROTOBUF_DEP ) $ ( BM_FULLSTACK_STREAMING_PING_PONG_OBJS ) $ ( LIBDIR ) / $ ( CONFIG ) / libgrpc_benchmark . a $ ( LIBDIR ) / $ ( CONFIG ) / libbenchmark . a $ ( LIBDIR ) / $ ( CONFIG ) / libgrpc + + _test_util . a $ ( LIBDIR ) / $ ( CONFIG ) / libgrpc_test_util . a $ ( LIBDIR ) / $ ( CONFIG ) / libgrpc + + . a $ ( LIBDIR ) / $ ( CONFIG ) / libgrpc . a $ ( LIBDIR ) / $ ( CONFIG ) / libgpr_test_util . a $ ( LIBDIR ) / $ ( CONFIG ) / libgpr . a <nl> + $ ( BINDIR ) / $ ( CONFIG ) / bm_fullstack_streaming_ping_pong : $ ( PROTOBUF_DEP ) $ ( BM_FULLSTACK_STREAMING_PING_PONG_OBJS ) $ ( LIBDIR ) / $ ( CONFIG ) / libgrpc_benchmark . a $ ( LIBDIR ) / $ ( CONFIG ) / libbenchmark . a $ ( LIBDIR ) / $ ( CONFIG ) / libgrpc + + _test_util_unsecure . a $ ( LIBDIR ) / $ ( CONFIG ) / libgrpc_test_util_unsecure . a $ ( LIBDIR ) / $ ( CONFIG ) / libgrpc + + _unsecure . a $ ( LIBDIR ) / $ ( CONFIG ) / libgrpc_unsecure . a $ ( LIBDIR ) / $ ( CONFIG ) / libgpr_test_util . a $ ( LIBDIR ) / $ ( CONFIG ) / libgpr . a <nl> $ ( E ) " [ LD ] Linking $ @ " <nl> $ ( Q ) mkdir - p ` dirname $ @ ` <nl> - $ ( Q ) $ ( LDXX ) $ ( LDFLAGS ) $ ( BM_FULLSTACK_STREAMING_PING_PONG_OBJS ) $ ( LIBDIR ) / $ ( CONFIG ) / libgrpc_benchmark . a $ ( LIBDIR ) / $ ( CONFIG ) / libbenchmark . a $ ( LIBDIR ) / $ ( CONFIG ) / libgrpc + + _test_util . a $ ( LIBDIR ) / $ ( CONFIG ) / libgrpc_test_util . a $ ( LIBDIR ) / $ ( CONFIG ) / libgrpc + + . a $ ( LIBDIR ) / $ ( CONFIG ) / libgrpc . a $ ( LIBDIR ) / $ ( CONFIG ) / libgpr_test_util . a $ ( LIBDIR ) / $ ( CONFIG ) / libgpr . a $ ( LDLIBSXX ) $ ( LDLIBS_PROTOBUF ) $ ( LDLIBS ) $ ( LDLIBS_SECURE ) $ ( GTEST_LIB ) - o $ ( BINDIR ) / $ ( CONFIG ) / bm_fullstack_streaming_ping_pong <nl> + $ ( Q ) $ ( LDXX ) $ ( LDFLAGS ) $ ( BM_FULLSTACK_STREAMING_PING_PONG_OBJS ) $ ( LIBDIR ) / $ ( CONFIG ) / libgrpc_benchmark . a $ ( LIBDIR ) / $ ( CONFIG ) / libbenchmark . a $ ( LIBDIR ) / $ ( CONFIG ) / libgrpc + + _test_util_unsecure . a $ ( LIBDIR ) / $ ( CONFIG ) / libgrpc_test_util_unsecure . a $ ( LIBDIR ) / $ ( CONFIG ) / libgrpc + + _unsecure . a $ ( LIBDIR ) / $ ( CONFIG ) / libgrpc_unsecure . a $ ( LIBDIR ) / $ ( CONFIG ) / libgpr_test_util . a $ ( LIBDIR ) / $ ( CONFIG ) / libgpr . a $ ( LDLIBSXX ) $ ( LDLIBS_PROTOBUF ) $ ( LDLIBS ) $ ( LDLIBS_SECURE ) $ ( GTEST_LIB ) - o $ ( BINDIR ) / $ ( CONFIG ) / bm_fullstack_streaming_ping_pong <nl> <nl> endif <nl> <nl> endif <nl> <nl> $ ( BM_FULLSTACK_STREAMING_PING_PONG_OBJS ) : CPPFLAGS + = - Ithird_party / benchmark / include - DHAVE_POSIX_REGEX <nl> - $ ( OBJDIR ) / $ ( CONFIG ) / test / cpp / microbenchmarks / bm_fullstack_streaming_ping_pong . o : $ ( LIBDIR ) / $ ( CONFIG ) / libgrpc_benchmark . a $ ( LIBDIR ) / $ ( CONFIG ) / libbenchmark . a $ ( LIBDIR ) / $ ( CONFIG ) / libgrpc + + _test_util . a $ ( LIBDIR ) / $ ( CONFIG ) / libgrpc_test_util . a $ ( LIBDIR ) / $ ( CONFIG ) / libgrpc + + . a $ ( LIBDIR ) / $ ( CONFIG ) / libgrpc . a $ ( LIBDIR ) / $ ( CONFIG ) / libgpr_test_util . a $ ( LIBDIR ) / $ ( CONFIG ) / libgpr . a <nl> + $ ( OBJDIR ) / $ ( CONFIG ) / test / cpp / microbenchmarks / bm_fullstack_streaming_ping_pong . o : $ ( LIBDIR ) / $ ( CONFIG ) / libgrpc_benchmark . a $ ( LIBDIR ) / $ ( CONFIG ) / libbenchmark . a $ ( LIBDIR ) / $ ( CONFIG ) / libgrpc + + _test_util_unsecure . a $ ( LIBDIR ) / $ ( CONFIG ) / libgrpc_test_util_unsecure . a $ ( LIBDIR ) / $ ( CONFIG ) / libgrpc + + _unsecure . a $ ( LIBDIR ) / $ ( CONFIG ) / libgrpc_unsecure . a $ ( LIBDIR ) / $ ( CONFIG ) / libgpr_test_util . a $ ( LIBDIR ) / $ ( CONFIG ) / libgpr . a <nl> <nl> deps_bm_fullstack_streaming_ping_pong : $ ( BM_FULLSTACK_STREAMING_PING_PONG_OBJS : . o = . dep ) <nl> <nl> $ ( BINDIR ) / $ ( CONFIG ) / bm_fullstack_streaming_pump : protobuf_dep_error <nl> <nl> else <nl> <nl> - $ ( BINDIR ) / $ ( CONFIG ) / bm_fullstack_streaming_pump : $ ( PROTOBUF_DEP ) $ ( BM_FULLSTACK_STREAMING_PUMP_OBJS ) $ ( LIBDIR ) / $ ( CONFIG ) / libgrpc_benchmark . a $ ( LIBDIR ) / $ ( CONFIG ) / libbenchmark . a $ ( LIBDIR ) / $ ( CONFIG ) / libgrpc + + _test_util . a $ ( LIBDIR ) / $ ( CONFIG ) / libgrpc_test_util . a $ ( LIBDIR ) / $ ( CONFIG ) / libgrpc + + . a $ ( LIBDIR ) / $ ( CONFIG ) / libgrpc . a $ ( LIBDIR ) / $ ( CONFIG ) / libgpr_test_util . a $ ( LIBDIR ) / $ ( CONFIG ) / libgpr . a <nl> + $ ( BINDIR ) / $ ( CONFIG ) / bm_fullstack_streaming_pump : $ ( PROTOBUF_DEP ) $ ( BM_FULLSTACK_STREAMING_PUMP_OBJS ) $ ( LIBDIR ) / $ ( CONFIG ) / libgrpc_benchmark . a $ ( LIBDIR ) / $ ( CONFIG ) / libbenchmark . a $ ( LIBDIR ) / $ ( CONFIG ) / libgrpc + + _test_util_unsecure . a $ ( LIBDIR ) / $ ( CONFIG ) / libgrpc_test_util_unsecure . a $ ( LIBDIR ) / $ ( CONFIG ) / libgrpc + + _unsecure . a $ ( LIBDIR ) / $ ( CONFIG ) / libgrpc_unsecure . a $ ( LIBDIR ) / $ ( CONFIG ) / libgpr_test_util . a $ ( LIBDIR ) / $ ( CONFIG ) / libgpr . a <nl> $ ( E ) " [ LD ] Linking $ @ " <nl> $ ( Q ) mkdir - p ` dirname $ @ ` <nl> - $ ( Q ) $ ( LDXX ) $ ( LDFLAGS ) $ ( BM_FULLSTACK_STREAMING_PUMP_OBJS ) $ ( LIBDIR ) / $ ( CONFIG ) / libgrpc_benchmark . a $ ( LIBDIR ) / $ ( CONFIG ) / libbenchmark . a $ ( LIBDIR ) / $ ( CONFIG ) / libgrpc + + _test_util . a $ ( LIBDIR ) / $ ( CONFIG ) / libgrpc_test_util . a $ ( LIBDIR ) / $ ( CONFIG ) / libgrpc + + . a $ ( LIBDIR ) / $ ( CONFIG ) / libgrpc . a $ ( LIBDIR ) / $ ( CONFIG ) / libgpr_test_util . a $ ( LIBDIR ) / $ ( CONFIG ) / libgpr . a $ ( LDLIBSXX ) $ ( LDLIBS_PROTOBUF ) $ ( LDLIBS ) $ ( LDLIBS_SECURE ) $ ( GTEST_LIB ) - o $ ( BINDIR ) / $ ( CONFIG ) / bm_fullstack_streaming_pump <nl> + $ ( Q ) $ ( LDXX ) $ ( LDFLAGS ) $ ( BM_FULLSTACK_STREAMING_PUMP_OBJS ) $ ( LIBDIR ) / $ ( CONFIG ) / libgrpc_benchmark . a $ ( LIBDIR ) / $ ( CONFIG ) / libbenchmark . a $ ( LIBDIR ) / $ ( CONFIG ) / libgrpc + + _test_util_unsecure . a $ ( LIBDIR ) / $ ( CONFIG ) / libgrpc_test_util_unsecure . a $ ( LIBDIR ) / $ ( CONFIG ) / libgrpc + + _unsecure . a $ ( LIBDIR ) / $ ( CONFIG ) / libgrpc_unsecure . a $ ( LIBDIR ) / $ ( CONFIG ) / libgpr_test_util . a $ ( LIBDIR ) / $ ( CONFIG ) / libgpr . a $ ( LDLIBSXX ) $ ( LDLIBS_PROTOBUF ) $ ( LDLIBS ) $ ( LDLIBS_SECURE ) $ ( GTEST_LIB ) - o $ ( BINDIR ) / $ ( CONFIG ) / bm_fullstack_streaming_pump <nl> <nl> endif <nl> <nl> endif <nl> <nl> $ ( BM_FULLSTACK_STREAMING_PUMP_OBJS ) : CPPFLAGS + = - Ithird_party / benchmark / include - DHAVE_POSIX_REGEX <nl> - $ ( OBJDIR ) / $ ( CONFIG ) / test / cpp / microbenchmarks / bm_fullstack_streaming_pump . o : $ ( LIBDIR ) / $ ( CONFIG ) / libgrpc_benchmark . a $ ( LIBDIR ) / $ ( CONFIG ) / libbenchmark . a $ ( LIBDIR ) / $ ( CONFIG ) / libgrpc + + _test_util . a $ ( LIBDIR ) / $ ( CONFIG ) / libgrpc_test_util . a $ ( LIBDIR ) / $ ( CONFIG ) / libgrpc + + . a $ ( LIBDIR ) / $ ( CONFIG ) / libgrpc . a $ ( LIBDIR ) / $ ( CONFIG ) / libgpr_test_util . a $ ( LIBDIR ) / $ ( CONFIG ) / libgpr . a <nl> + $ ( OBJDIR ) / $ ( CONFIG ) / test / cpp / microbenchmarks / bm_fullstack_streaming_pump . o : $ ( LIBDIR ) / $ ( CONFIG ) / libgrpc_benchmark . a $ ( LIBDIR ) / $ ( CONFIG ) / libbenchmark . a $ ( LIBDIR ) / $ ( CONFIG ) / libgrpc + + _test_util_unsecure . a $ ( LIBDIR ) / $ ( CONFIG ) / libgrpc_test_util_unsecure . a $ ( LIBDIR ) / $ ( CONFIG ) / libgrpc + + _unsecure . a $ ( LIBDIR ) / $ ( CONFIG ) / libgrpc_unsecure . a $ ( LIBDIR ) / $ ( CONFIG ) / libgpr_test_util . a $ ( LIBDIR ) / $ ( CONFIG ) / libgpr . a <nl> <nl> deps_bm_fullstack_streaming_pump : $ ( BM_FULLSTACK_STREAMING_PUMP_OBJS : . o = . dep ) <nl> <nl> $ ( BINDIR ) / $ ( CONFIG ) / bm_fullstack_trickle : protobuf_dep_error <nl> <nl> else <nl> <nl> - $ ( BINDIR ) / $ ( CONFIG ) / bm_fullstack_trickle : $ ( PROTOBUF_DEP ) $ ( BM_FULLSTACK_TRICKLE_OBJS ) $ ( LIBDIR ) / $ ( CONFIG ) / libgrpc_benchmark . a $ ( LIBDIR ) / $ ( CONFIG ) / libbenchmark . a $ ( LIBDIR ) / $ ( CONFIG ) / libgrpc + + _test_util . a $ ( LIBDIR ) / $ ( CONFIG ) / libgrpc_test_util . a $ ( LIBDIR ) / $ ( CONFIG ) / libgrpc + + . a $ ( LIBDIR ) / $ ( CONFIG ) / libgrpc . a $ ( LIBDIR ) / $ ( CONFIG ) / libgpr_test_util . a $ ( LIBDIR ) / $ ( CONFIG ) / libgpr . a <nl> + $ ( BINDIR ) / $ ( CONFIG ) / bm_fullstack_trickle : $ ( PROTOBUF_DEP ) $ ( BM_FULLSTACK_TRICKLE_OBJS ) $ ( LIBDIR ) / $ ( CONFIG ) / libgrpc_benchmark . a $ ( LIBDIR ) / $ ( CONFIG ) / libbenchmark . a $ ( LIBDIR ) / $ ( CONFIG ) / libgrpc + + _test_util_unsecure . a $ ( LIBDIR ) / $ ( CONFIG ) / libgrpc_test_util_unsecure . a $ ( LIBDIR ) / $ ( CONFIG ) / libgrpc + + _unsecure . a $ ( LIBDIR ) / $ ( CONFIG ) / libgrpc_unsecure . a $ ( LIBDIR ) / $ ( CONFIG ) / libgpr_test_util . a $ ( LIBDIR ) / $ ( CONFIG ) / libgpr . a <nl> $ ( E ) " [ LD ] Linking $ @ " <nl> $ ( Q ) mkdir - p ` dirname $ @ ` <nl> - $ ( Q ) $ ( LDXX ) $ ( LDFLAGS ) $ ( BM_FULLSTACK_TRICKLE_OBJS ) $ ( LIBDIR ) / $ ( CONFIG ) / libgrpc_benchmark . a $ ( LIBDIR ) / $ ( CONFIG ) / libbenchmark . a $ ( LIBDIR ) / $ ( CONFIG ) / libgrpc + + _test_util . a $ ( LIBDIR ) / $ ( CONFIG ) / libgrpc_test_util . a $ ( LIBDIR ) / $ ( CONFIG ) / libgrpc + + . a $ ( LIBDIR ) / $ ( CONFIG ) / libgrpc . a $ ( LIBDIR ) / $ ( CONFIG ) / libgpr_test_util . a $ ( LIBDIR ) / $ ( CONFIG ) / libgpr . a $ ( LDLIBSXX ) $ ( LDLIBS_PROTOBUF ) $ ( LDLIBS ) $ ( LDLIBS_SECURE ) $ ( GTEST_LIB ) - o $ ( BINDIR ) / $ ( CONFIG ) / bm_fullstack_trickle <nl> + $ ( Q ) $ ( LDXX ) $ ( LDFLAGS ) $ ( BM_FULLSTACK_TRICKLE_OBJS ) $ ( LIBDIR ) / $ ( CONFIG ) / libgrpc_benchmark . a $ ( LIBDIR ) / $ ( CONFIG ) / libbenchmark . a $ ( LIBDIR ) / $ ( CONFIG ) / libgrpc + + _test_util_unsecure . a $ ( LIBDIR ) / $ ( CONFIG ) / libgrpc_test_util_unsecure . a $ ( LIBDIR ) / $ ( CONFIG ) / libgrpc + + _unsecure . a $ ( LIBDIR ) / $ ( CONFIG ) / libgrpc_unsecure . a $ ( LIBDIR ) / $ ( CONFIG ) / libgpr_test_util . a $ ( LIBDIR ) / $ ( CONFIG ) / libgpr . a $ ( LDLIBSXX ) $ ( LDLIBS_PROTOBUF ) $ ( LDLIBS ) $ ( LDLIBS_SECURE ) $ ( GTEST_LIB ) - o $ ( BINDIR ) / $ ( CONFIG ) / bm_fullstack_trickle <nl> <nl> endif <nl> <nl> endif <nl> <nl> $ ( BM_FULLSTACK_TRICKLE_OBJS ) : CPPFLAGS + = - Ithird_party / benchmark / include - DHAVE_POSIX_REGEX <nl> - $ ( OBJDIR ) / $ ( CONFIG ) / test / cpp / microbenchmarks / bm_fullstack_trickle . o : $ ( LIBDIR ) / $ ( CONFIG ) / libgrpc_benchmark . a $ ( LIBDIR ) / $ ( CONFIG ) / libbenchmark . a $ ( LIBDIR ) / $ ( CONFIG ) / libgrpc + + _test_util . a $ ( LIBDIR ) / $ ( CONFIG ) / libgrpc_test_util . a $ ( LIBDIR ) / $ ( CONFIG ) / libgrpc + + . a $ ( LIBDIR ) / $ ( CONFIG ) / libgrpc . a $ ( LIBDIR ) / $ ( CONFIG ) / libgpr_test_util . a $ ( LIBDIR ) / $ ( CONFIG ) / libgpr . a <nl> + $ ( OBJDIR ) / $ ( CONFIG ) / test / cpp / microbenchmarks / bm_fullstack_trickle . o : $ ( LIBDIR ) / $ ( CONFIG ) / libgrpc_benchmark . a $ ( LIBDIR ) / $ ( CONFIG ) / libbenchmark . a $ ( LIBDIR ) / $ ( CONFIG ) / libgrpc + + _test_util_unsecure . a $ ( LIBDIR ) / $ ( CONFIG ) / libgrpc_test_util_unsecure . a $ ( LIBDIR ) / $ ( CONFIG ) / libgrpc + + _unsecure . a $ ( LIBDIR ) / $ ( CONFIG ) / libgrpc_unsecure . a $ ( LIBDIR ) / $ ( CONFIG ) / libgpr_test_util . a $ ( LIBDIR ) / $ ( CONFIG ) / libgpr . a <nl> <nl> deps_bm_fullstack_trickle : $ ( BM_FULLSTACK_TRICKLE_OBJS : . o = . dep ) <nl> <nl> $ ( BINDIR ) / $ ( CONFIG ) / bm_fullstack_unary_ping_pong : protobuf_dep_error <nl> <nl> else <nl> <nl> - $ ( BINDIR ) / $ ( CONFIG ) / bm_fullstack_unary_ping_pong : $ ( PROTOBUF_DEP ) $ ( BM_FULLSTACK_UNARY_PING_PONG_OBJS ) $ ( LIBDIR ) / $ ( CONFIG ) / libgrpc_benchmark . a $ ( LIBDIR ) / $ ( CONFIG ) / libbenchmark . a $ ( LIBDIR ) / $ ( CONFIG ) / libgrpc + + _test_util . a $ ( LIBDIR ) / $ ( CONFIG ) / libgrpc_test_util . a $ ( LIBDIR ) / $ ( CONFIG ) / libgrpc + + . a $ ( LIBDIR ) / $ ( CONFIG ) / libgrpc . a $ ( LIBDIR ) / $ ( CONFIG ) / libgpr_test_util . a $ ( LIBDIR ) / $ ( CONFIG ) / libgpr . a <nl> + $ ( BINDIR ) / $ ( CONFIG ) / bm_fullstack_unary_ping_pong : $ ( PROTOBUF_DEP ) $ ( BM_FULLSTACK_UNARY_PING_PONG_OBJS ) $ ( LIBDIR ) / $ ( CONFIG ) / libgrpc_benchmark . a $ ( LIBDIR ) / $ ( CONFIG ) / libbenchmark . a $ ( LIBDIR ) / $ ( CONFIG ) / libgrpc + + _test_util_unsecure . a $ ( LIBDIR ) / $ ( CONFIG ) / libgrpc_test_util_unsecure . a $ ( LIBDIR ) / $ ( CONFIG ) / libgrpc + + _unsecure . a $ ( LIBDIR ) / $ ( CONFIG ) / libgrpc_unsecure . a $ ( LIBDIR ) / $ ( CONFIG ) / libgpr_test_util . a $ ( LIBDIR ) / $ ( CONFIG ) / libgpr . a <nl> $ ( E ) " [ LD ] Linking $ @ " <nl> $ ( Q ) mkdir - p ` dirname $ @ ` <nl> - $ ( Q ) $ ( LDXX ) $ ( LDFLAGS ) $ ( BM_FULLSTACK_UNARY_PING_PONG_OBJS ) $ ( LIBDIR ) / $ ( CONFIG ) / libgrpc_benchmark . a $ ( LIBDIR ) / $ ( CONFIG ) / libbenchmark . a $ ( LIBDIR ) / $ ( CONFIG ) / libgrpc + + _test_util . a $ ( LIBDIR ) / $ ( CONFIG ) / libgrpc_test_util . a $ ( LIBDIR ) / $ ( CONFIG ) / libgrpc + + . a $ ( LIBDIR ) / $ ( CONFIG ) / libgrpc . a $ ( LIBDIR ) / $ ( CONFIG ) / libgpr_test_util . a $ ( LIBDIR ) / $ ( CONFIG ) / libgpr . a $ ( LDLIBSXX ) $ ( LDLIBS_PROTOBUF ) $ ( LDLIBS ) $ ( LDLIBS_SECURE ) $ ( GTEST_LIB ) - o $ ( BINDIR ) / $ ( CONFIG ) / bm_fullstack_unary_ping_pong <nl> + $ ( Q ) $ ( LDXX ) $ ( LDFLAGS ) $ ( BM_FULLSTACK_UNARY_PING_PONG_OBJS ) $ ( LIBDIR ) / $ ( CONFIG ) / libgrpc_benchmark . a $ ( LIBDIR ) / $ ( CONFIG ) / libbenchmark . a $ ( LIBDIR ) / $ ( CONFIG ) / libgrpc + + _test_util_unsecure . a $ ( LIBDIR ) / $ ( CONFIG ) / libgrpc_test_util_unsecure . a $ ( LIBDIR ) / $ ( CONFIG ) / libgrpc + + _unsecure . a $ ( LIBDIR ) / $ ( CONFIG ) / libgrpc_unsecure . a $ ( LIBDIR ) / $ ( CONFIG ) / libgpr_test_util . a $ ( LIBDIR ) / $ ( CONFIG ) / libgpr . a $ ( LDLIBSXX ) $ ( LDLIBS_PROTOBUF ) $ ( LDLIBS ) $ ( LDLIBS_SECURE ) $ ( GTEST_LIB ) - o $ ( BINDIR ) / $ ( CONFIG ) / bm_fullstack_unary_ping_pong <nl> <nl> endif <nl> <nl> endif <nl> <nl> $ ( BM_FULLSTACK_UNARY_PING_PONG_OBJS ) : CPPFLAGS + = - Ithird_party / benchmark / include - DHAVE_POSIX_REGEX <nl> - $ ( OBJDIR ) / $ ( CONFIG ) / test / cpp / microbenchmarks / bm_fullstack_unary_ping_pong . o : $ ( LIBDIR ) / $ ( CONFIG ) / libgrpc_benchmark . a $ ( LIBDIR ) / $ ( CONFIG ) / libbenchmark . a $ ( LIBDIR ) / $ ( CONFIG ) / libgrpc + + _test_util . a $ ( LIBDIR ) / $ ( CONFIG ) / libgrpc_test_util . a $ ( LIBDIR ) / $ ( CONFIG ) / libgrpc + + . a $ ( LIBDIR ) / $ ( CONFIG ) / libgrpc . a $ ( LIBDIR ) / $ ( CONFIG ) / libgpr_test_util . a $ ( LIBDIR ) / $ ( CONFIG ) / libgpr . a <nl> + $ ( OBJDIR ) / $ ( CONFIG ) / test / cpp / microbenchmarks / bm_fullstack_unary_ping_pong . o : $ ( LIBDIR ) / $ ( CONFIG ) / libgrpc_benchmark . a $ ( LIBDIR ) / $ ( CONFIG ) / libbenchmark . a $ ( LIBDIR ) / $ ( CONFIG ) / libgrpc + + _test_util_unsecure . a $ ( LIBDIR ) / $ ( CONFIG ) / libgrpc_test_util_unsecure . a $ ( LIBDIR ) / $ ( CONFIG ) / libgrpc + + _unsecure . a $ ( LIBDIR ) / $ ( CONFIG ) / libgrpc_unsecure . a $ ( LIBDIR ) / $ ( CONFIG ) / libgpr_test_util . a $ ( LIBDIR ) / $ ( CONFIG ) / libgpr . a <nl> <nl> deps_bm_fullstack_unary_ping_pong : $ ( BM_FULLSTACK_UNARY_PING_PONG_OBJS : . o = . dep ) <nl> <nl> $ ( BINDIR ) / $ ( CONFIG ) / bm_metadata : protobuf_dep_error <nl> <nl> else <nl> <nl> - $ ( BINDIR ) / $ ( CONFIG ) / bm_metadata : $ ( PROTOBUF_DEP ) $ ( BM_METADATA_OBJS ) $ ( LIBDIR ) / $ ( CONFIG ) / libgrpc_benchmark . a $ ( LIBDIR ) / $ ( CONFIG ) / libbenchmark . a $ ( LIBDIR ) / $ ( CONFIG ) / libgrpc + + _test_util . a $ ( LIBDIR ) / $ ( CONFIG ) / libgrpc_test_util . a $ ( LIBDIR ) / $ ( CONFIG ) / libgrpc + + . a $ ( LIBDIR ) / $ ( CONFIG ) / libgrpc . a $ ( LIBDIR ) / $ ( CONFIG ) / libgpr_test_util . a $ ( LIBDIR ) / $ ( CONFIG ) / libgpr . a <nl> + $ ( BINDIR ) / $ ( CONFIG ) / bm_metadata : $ ( PROTOBUF_DEP ) $ ( BM_METADATA_OBJS ) $ ( LIBDIR ) / $ ( CONFIG ) / libgrpc_benchmark . a $ ( LIBDIR ) / $ ( CONFIG ) / libbenchmark . a $ ( LIBDIR ) / $ ( CONFIG ) / libgrpc + + _test_util_unsecure . a $ ( LIBDIR ) / $ ( CONFIG ) / libgrpc_test_util_unsecure . a $ ( LIBDIR ) / $ ( CONFIG ) / libgrpc + + _unsecure . a $ ( LIBDIR ) / $ ( CONFIG ) / libgrpc_unsecure . a $ ( LIBDIR ) / $ ( CONFIG ) / libgpr_test_util . a $ ( LIBDIR ) / $ ( CONFIG ) / libgpr . a <nl> $ ( E ) " [ LD ] Linking $ @ " <nl> $ ( Q ) mkdir - p ` dirname $ @ ` <nl> - $ ( Q ) $ ( LDXX ) $ ( LDFLAGS ) $ ( BM_METADATA_OBJS ) $ ( LIBDIR ) / $ ( CONFIG ) / libgrpc_benchmark . a $ ( LIBDIR ) / $ ( CONFIG ) / libbenchmark . a $ ( LIBDIR ) / $ ( CONFIG ) / libgrpc + + _test_util . a $ ( LIBDIR ) / $ ( CONFIG ) / libgrpc_test_util . a $ ( LIBDIR ) / $ ( CONFIG ) / libgrpc + + . a $ ( LIBDIR ) / $ ( CONFIG ) / libgrpc . a $ ( LIBDIR ) / $ ( CONFIG ) / libgpr_test_util . a $ ( LIBDIR ) / $ ( CONFIG ) / libgpr . a $ ( LDLIBSXX ) $ ( LDLIBS_PROTOBUF ) $ ( LDLIBS ) $ ( LDLIBS_SECURE ) $ ( GTEST_LIB ) - o $ ( BINDIR ) / $ ( CONFIG ) / bm_metadata <nl> + $ ( Q ) $ ( LDXX ) $ ( LDFLAGS ) $ ( BM_METADATA_OBJS ) $ ( LIBDIR ) / $ ( CONFIG ) / libgrpc_benchmark . a $ ( LIBDIR ) / $ ( CONFIG ) / libbenchmark . a $ ( LIBDIR ) / $ ( CONFIG ) / libgrpc + + _test_util_unsecure . a $ ( LIBDIR ) / $ ( CONFIG ) / libgrpc_test_util_unsecure . a $ ( LIBDIR ) / $ ( CONFIG ) / libgrpc + + _unsecure . a $ ( LIBDIR ) / $ ( CONFIG ) / libgrpc_unsecure . a $ ( LIBDIR ) / $ ( CONFIG ) / libgpr_test_util . a $ ( LIBDIR ) / $ ( CONFIG ) / libgpr . a $ ( LDLIBSXX ) $ ( LDLIBS_PROTOBUF ) $ ( LDLIBS ) $ ( LDLIBS_SECURE ) $ ( GTEST_LIB ) - o $ ( BINDIR ) / $ ( CONFIG ) / bm_metadata <nl> <nl> endif <nl> <nl> endif <nl> <nl> $ ( BM_METADATA_OBJS ) : CPPFLAGS + = - Ithird_party / benchmark / include - DHAVE_POSIX_REGEX <nl> - $ ( OBJDIR ) / $ ( CONFIG ) / test / cpp / microbenchmarks / bm_metadata . o : $ ( LIBDIR ) / $ ( CONFIG ) / libgrpc_benchmark . a $ ( LIBDIR ) / $ ( CONFIG ) / libbenchmark . a $ ( LIBDIR ) / $ ( CONFIG ) / libgrpc + + _test_util . a $ ( LIBDIR ) / $ ( CONFIG ) / libgrpc_test_util . a $ ( LIBDIR ) / $ ( CONFIG ) / libgrpc + + . a $ ( LIBDIR ) / $ ( CONFIG ) / libgrpc . a $ ( LIBDIR ) / $ ( CONFIG ) / libgpr_test_util . a $ ( LIBDIR ) / $ ( CONFIG ) / libgpr . a <nl> + $ ( OBJDIR ) / $ ( CONFIG ) / test / cpp / microbenchmarks / bm_metadata . o : $ ( LIBDIR ) / $ ( CONFIG ) / libgrpc_benchmark . a $ ( LIBDIR ) / $ ( CONFIG ) / libbenchmark . a $ ( LIBDIR ) / $ ( CONFIG ) / libgrpc + + _test_util_unsecure . a $ ( LIBDIR ) / $ ( CONFIG ) / libgrpc_test_util_unsecure . a $ ( LIBDIR ) / $ ( CONFIG ) / libgrpc + + _unsecure . a $ ( LIBDIR ) / $ ( CONFIG ) / libgrpc_unsecure . a $ ( LIBDIR ) / $ ( CONFIG ) / libgpr_test_util . a $ ( LIBDIR ) / $ ( CONFIG ) / libgpr . a <nl> <nl> deps_bm_metadata : $ ( BM_METADATA_OBJS : . o = . dep ) <nl> <nl> $ ( BINDIR ) / $ ( CONFIG ) / bm_pollset : protobuf_dep_error <nl> <nl> else <nl> <nl> - $ ( BINDIR ) / $ ( CONFIG ) / bm_pollset : $ ( PROTOBUF_DEP ) $ ( BM_POLLSET_OBJS ) $ ( LIBDIR ) / $ ( CONFIG ) / libgrpc_benchmark . a $ ( LIBDIR ) / $ ( CONFIG ) / libbenchmark . a $ ( LIBDIR ) / $ ( CONFIG ) / libgrpc + + _test_util . a $ ( LIBDIR ) / $ ( CONFIG ) / libgrpc_test_util . a $ ( LIBDIR ) / $ ( CONFIG ) / libgrpc + + . a $ ( LIBDIR ) / $ ( CONFIG ) / libgrpc . a $ ( LIBDIR ) / $ ( CONFIG ) / libgpr_test_util . a $ ( LIBDIR ) / $ ( CONFIG ) / libgpr . a <nl> + $ ( BINDIR ) / $ ( CONFIG ) / bm_pollset : $ ( PROTOBUF_DEP ) $ ( BM_POLLSET_OBJS ) $ ( LIBDIR ) / $ ( CONFIG ) / libgrpc_benchmark . a $ ( LIBDIR ) / $ ( CONFIG ) / libbenchmark . a $ ( LIBDIR ) / $ ( CONFIG ) / libgrpc + + _test_util_unsecure . a $ ( LIBDIR ) / $ ( CONFIG ) / libgrpc_test_util_unsecure . a $ ( LIBDIR ) / $ ( CONFIG ) / libgrpc + + _unsecure . a $ ( LIBDIR ) / $ ( CONFIG ) / libgrpc_unsecure . a $ ( LIBDIR ) / $ ( CONFIG ) / libgpr_test_util . a $ ( LIBDIR ) / $ ( CONFIG ) / libgpr . a <nl> $ ( E ) " [ LD ] Linking $ @ " <nl> $ ( Q ) mkdir - p ` dirname $ @ ` <nl> - $ ( Q ) $ ( LDXX ) $ ( LDFLAGS ) $ ( BM_POLLSET_OBJS ) $ ( LIBDIR ) / $ ( CONFIG ) / libgrpc_benchmark . a $ ( LIBDIR ) / $ ( CONFIG ) / libbenchmark . a $ ( LIBDIR ) / $ ( CONFIG ) / libgrpc + + _test_util . a $ ( LIBDIR ) / $ ( CONFIG ) / libgrpc_test_util . a $ ( LIBDIR ) / $ ( CONFIG ) / libgrpc + + . a $ ( LIBDIR ) / $ ( CONFIG ) / libgrpc . a $ ( LIBDIR ) / $ ( CONFIG ) / libgpr_test_util . a $ ( LIBDIR ) / $ ( CONFIG ) / libgpr . a $ ( LDLIBSXX ) $ ( LDLIBS_PROTOBUF ) $ ( LDLIBS ) $ ( LDLIBS_SECURE ) $ ( GTEST_LIB ) - o $ ( BINDIR ) / $ ( CONFIG ) / bm_pollset <nl> + $ ( Q ) $ ( LDXX ) $ ( LDFLAGS ) $ ( BM_POLLSET_OBJS ) $ ( LIBDIR ) / $ ( CONFIG ) / libgrpc_benchmark . a $ ( LIBDIR ) / $ ( CONFIG ) / libbenchmark . a $ ( LIBDIR ) / $ ( CONFIG ) / libgrpc + + _test_util_unsecure . a $ ( LIBDIR ) / $ ( CONFIG ) / libgrpc_test_util_unsecure . a $ ( LIBDIR ) / $ ( CONFIG ) / libgrpc + + _unsecure . a $ ( LIBDIR ) / $ ( CONFIG ) / libgrpc_unsecure . a $ ( LIBDIR ) / $ ( CONFIG ) / libgpr_test_util . a $ ( LIBDIR ) / $ ( CONFIG ) / libgpr . a $ ( LDLIBSXX ) $ ( LDLIBS_PROTOBUF ) $ ( LDLIBS ) $ ( LDLIBS_SECURE ) $ ( GTEST_LIB ) - o $ ( BINDIR ) / $ ( CONFIG ) / bm_pollset <nl> <nl> endif <nl> <nl> endif <nl> <nl> $ ( BM_POLLSET_OBJS ) : CPPFLAGS + = - Ithird_party / benchmark / include - DHAVE_POSIX_REGEX <nl> - $ ( OBJDIR ) / $ ( CONFIG ) / test / cpp / microbenchmarks / bm_pollset . o : $ ( LIBDIR ) / $ ( CONFIG ) / libgrpc_benchmark . a $ ( LIBDIR ) / $ ( CONFIG ) / libbenchmark . a $ ( LIBDIR ) / $ ( CONFIG ) / libgrpc + + _test_util . a $ ( LIBDIR ) / $ ( CONFIG ) / libgrpc_test_util . a $ ( LIBDIR ) / $ ( CONFIG ) / libgrpc + + . a $ ( LIBDIR ) / $ ( CONFIG ) / libgrpc . a $ ( LIBDIR ) / $ ( CONFIG ) / libgpr_test_util . a $ ( LIBDIR ) / $ ( CONFIG ) / libgpr . a <nl> + $ ( OBJDIR ) / $ ( CONFIG ) / test / cpp / microbenchmarks / bm_pollset . o : $ ( LIBDIR ) / $ ( CONFIG ) / libgrpc_benchmark . a $ ( LIBDIR ) / $ ( CONFIG ) / libbenchmark . a $ ( LIBDIR ) / $ ( CONFIG ) / libgrpc + + _test_util_unsecure . a $ ( LIBDIR ) / $ ( CONFIG ) / libgrpc_test_util_unsecure . a $ ( LIBDIR ) / $ ( CONFIG ) / libgrpc + + _unsecure . a $ ( LIBDIR ) / $ ( CONFIG ) / libgrpc_unsecure . a $ ( LIBDIR ) / $ ( CONFIG ) / libgpr_test_util . a $ ( LIBDIR ) / $ ( CONFIG ) / libgpr . a <nl> <nl> deps_bm_pollset : $ ( BM_POLLSET_OBJS : . o = . dep ) <nl> <nl> $ ( BINDIR ) / $ ( CONFIG ) / server_builder_test : protobuf_dep_error <nl> <nl> else <nl> <nl> - $ ( BINDIR ) / $ ( CONFIG ) / server_builder_test : $ ( PROTOBUF_DEP ) $ ( SERVER_BUILDER_TEST_OBJS ) $ ( LIBDIR ) / $ ( CONFIG ) / libgrpc + + _test_util . a $ ( LIBDIR ) / $ ( CONFIG ) / libgrpc_test_util . a $ ( LIBDIR ) / $ ( CONFIG ) / libgpr_test_util . a $ ( LIBDIR ) / $ ( CONFIG ) / libgrpc + + . a $ ( LIBDIR ) / $ ( CONFIG ) / libgrpc . a $ ( LIBDIR ) / $ ( CONFIG ) / libgpr . a <nl> + $ ( BINDIR ) / $ ( CONFIG ) / server_builder_test : $ ( PROTOBUF_DEP ) $ ( SERVER_BUILDER_TEST_OBJS ) $ ( LIBDIR ) / $ ( CONFIG ) / libgrpc + + _test_util_unsecure . a $ ( LIBDIR ) / $ ( CONFIG ) / libgrpc_test_util_unsecure . a $ ( LIBDIR ) / $ ( CONFIG ) / libgpr_test_util . a $ ( LIBDIR ) / $ ( CONFIG ) / libgrpc + + _unsecure . a $ ( LIBDIR ) / $ ( CONFIG ) / libgrpc_unsecure . a $ ( LIBDIR ) / $ ( CONFIG ) / libgpr . a <nl> $ ( E ) " [ LD ] Linking $ @ " <nl> $ ( Q ) mkdir - p ` dirname $ @ ` <nl> - $ ( Q ) $ ( LDXX ) $ ( LDFLAGS ) $ ( SERVER_BUILDER_TEST_OBJS ) $ ( LIBDIR ) / $ ( CONFIG ) / libgrpc + + _test_util . a $ ( LIBDIR ) / $ ( CONFIG ) / libgrpc_test_util . a $ ( LIBDIR ) / $ ( CONFIG ) / libgpr_test_util . a $ ( LIBDIR ) / $ ( CONFIG ) / libgrpc + + . a $ ( LIBDIR ) / $ ( CONFIG ) / libgrpc . a $ ( LIBDIR ) / $ ( CONFIG ) / libgpr . a $ ( LDLIBSXX ) $ ( LDLIBS_PROTOBUF ) $ ( LDLIBS ) $ ( LDLIBS_SECURE ) $ ( GTEST_LIB ) - o $ ( BINDIR ) / $ ( CONFIG ) / server_builder_test <nl> + $ ( Q ) $ ( LDXX ) $ ( LDFLAGS ) $ ( SERVER_BUILDER_TEST_OBJS ) $ ( LIBDIR ) / $ ( CONFIG ) / libgrpc + + _test_util_unsecure . a $ ( LIBDIR ) / $ ( CONFIG ) / libgrpc_test_util_unsecure . a $ ( LIBDIR ) / $ ( CONFIG ) / libgpr_test_util . a $ ( LIBDIR ) / $ ( CONFIG ) / libgrpc + + _unsecure . a $ ( LIBDIR ) / $ ( CONFIG ) / libgrpc_unsecure . a $ ( LIBDIR ) / $ ( CONFIG ) / libgpr . a $ ( LDLIBSXX ) $ ( LDLIBS_PROTOBUF ) $ ( LDLIBS ) $ ( LDLIBS_SECURE ) $ ( GTEST_LIB ) - o $ ( BINDIR ) / $ ( CONFIG ) / server_builder_test <nl> <nl> endif <nl> <nl> endif <nl> <nl> - $ ( OBJDIR ) / $ ( CONFIG ) / src / proto / grpc / testing / echo_messages . o : $ ( LIBDIR ) / $ ( CONFIG ) / libgrpc + + _test_util . a $ ( LIBDIR ) / $ ( CONFIG ) / libgrpc_test_util . a $ ( LIBDIR ) / $ ( CONFIG ) / libgpr_test_util . a $ ( LIBDIR ) / $ ( CONFIG ) / libgrpc + + . a $ ( LIBDIR ) / $ ( CONFIG ) / libgrpc . a $ ( LIBDIR ) / $ ( CONFIG ) / libgpr . a <nl> + $ ( OBJDIR ) / $ ( CONFIG ) / src / proto / grpc / testing / echo_messages . o : $ ( LIBDIR ) / $ ( CONFIG ) / libgrpc + + _test_util_unsecure . a $ ( LIBDIR ) / $ ( CONFIG ) / libgrpc_test_util_unsecure . a $ ( LIBDIR ) / $ ( CONFIG ) / libgpr_test_util . a $ ( LIBDIR ) / $ ( CONFIG ) / libgrpc + + _unsecure . a $ ( LIBDIR ) / $ ( CONFIG ) / libgrpc_unsecure . a $ ( LIBDIR ) / $ ( CONFIG ) / libgpr . a <nl> <nl> - $ ( OBJDIR ) / $ ( CONFIG ) / src / proto / grpc / testing / echo . o : $ ( LIBDIR ) / $ ( CONFIG ) / libgrpc + + _test_util . a $ ( LIBDIR ) / $ ( CONFIG ) / libgrpc_test_util . a $ ( LIBDIR ) / $ ( CONFIG ) / libgpr_test_util . a $ ( LIBDIR ) / $ ( CONFIG ) / libgrpc + + . a $ ( LIBDIR ) / $ ( CONFIG ) / libgrpc . a $ ( LIBDIR ) / $ ( CONFIG ) / libgpr . a <nl> + $ ( OBJDIR ) / $ ( CONFIG ) / src / proto / grpc / testing / echo . o : $ ( LIBDIR ) / $ ( CONFIG ) / libgrpc + + _test_util_unsecure . a $ ( LIBDIR ) / $ ( CONFIG ) / libgrpc_test_util_unsecure . a $ ( LIBDIR ) / $ ( CONFIG ) / libgpr_test_util . a $ ( LIBDIR ) / $ ( CONFIG ) / libgrpc + + _unsecure . a $ ( LIBDIR ) / $ ( CONFIG ) / libgrpc_unsecure . a $ ( LIBDIR ) / $ ( CONFIG ) / libgpr . a <nl> <nl> - $ ( OBJDIR ) / $ ( CONFIG ) / test / cpp / server / server_builder_test . o : $ ( LIBDIR ) / $ ( CONFIG ) / libgrpc + + _test_util . a $ ( LIBDIR ) / $ ( CONFIG ) / libgrpc_test_util . a $ ( LIBDIR ) / $ ( CONFIG ) / libgpr_test_util . a $ ( LIBDIR ) / $ ( CONFIG ) / libgrpc + + . a $ ( LIBDIR ) / $ ( CONFIG ) / libgrpc . a $ ( LIBDIR ) / $ ( CONFIG ) / libgpr . a <nl> + $ ( OBJDIR ) / $ ( CONFIG ) / test / cpp / server / server_builder_test . o : $ ( LIBDIR ) / $ ( CONFIG ) / libgrpc + + _test_util_unsecure . a $ ( LIBDIR ) / $ ( CONFIG ) / libgrpc_test_util_unsecure . a $ ( LIBDIR ) / $ ( CONFIG ) / libgpr_test_util . a $ ( LIBDIR ) / $ ( CONFIG ) / libgrpc + + _unsecure . a $ ( LIBDIR ) / $ ( CONFIG ) / libgrpc_unsecure . a $ ( LIBDIR ) / $ ( CONFIG ) / libgpr . a <nl> <nl> deps_server_builder_test : $ ( SERVER_BUILDER_TEST_OBJS : . o = . dep ) <nl> <nl> $ ( BINDIR ) / $ ( CONFIG ) / server_request_call_test : protobuf_dep_error <nl> <nl> else <nl> <nl> - $ ( BINDIR ) / $ ( CONFIG ) / server_request_call_test : $ ( PROTOBUF_DEP ) $ ( SERVER_REQUEST_CALL_TEST_OBJS ) $ ( LIBDIR ) / $ ( CONFIG ) / libgrpc + + _test_util . a $ ( LIBDIR ) / $ ( CONFIG ) / libgrpc_test_util . a $ ( LIBDIR ) / $ ( CONFIG ) / libgpr_test_util . a $ ( LIBDIR ) / $ ( CONFIG ) / libgrpc + + . a $ ( LIBDIR ) / $ ( CONFIG ) / libgrpc . a $ ( LIBDIR ) / $ ( CONFIG ) / libgpr . a <nl> + $ ( BINDIR ) / $ ( CONFIG ) / server_request_call_test : $ ( PROTOBUF_DEP ) $ ( SERVER_REQUEST_CALL_TEST_OBJS ) $ ( LIBDIR ) / $ ( CONFIG ) / libgrpc + + _test_util_unsecure . a $ ( LIBDIR ) / $ ( CONFIG ) / libgrpc_test_util_unsecure . a $ ( LIBDIR ) / $ ( CONFIG ) / libgpr_test_util . a $ ( LIBDIR ) / $ ( CONFIG ) / libgrpc + + _unsecure . a $ ( LIBDIR ) / $ ( CONFIG ) / libgrpc_unsecure . a $ ( LIBDIR ) / $ ( CONFIG ) / libgpr . a <nl> $ ( E ) " [ LD ] Linking $ @ " <nl> $ ( Q ) mkdir - p ` dirname $ @ ` <nl> - $ ( Q ) $ ( LDXX ) $ ( LDFLAGS ) $ ( SERVER_REQUEST_CALL_TEST_OBJS ) $ ( LIBDIR ) / $ ( CONFIG ) / libgrpc + + _test_util . a $ ( LIBDIR ) / $ ( CONFIG ) / libgrpc_test_util . a $ ( LIBDIR ) / $ ( CONFIG ) / libgpr_test_util . a $ ( LIBDIR ) / $ ( CONFIG ) / libgrpc + + . a $ ( LIBDIR ) / $ ( CONFIG ) / libgrpc . a $ ( LIBDIR ) / $ ( CONFIG ) / libgpr . a $ ( LDLIBSXX ) $ ( LDLIBS_PROTOBUF ) $ ( LDLIBS ) $ ( LDLIBS_SECURE ) $ ( GTEST_LIB ) - o $ ( BINDIR ) / $ ( CONFIG ) / server_request_call_test <nl> + $ ( Q ) $ ( LDXX ) $ ( LDFLAGS ) $ ( SERVER_REQUEST_CALL_TEST_OBJS ) $ ( LIBDIR ) / $ ( CONFIG ) / libgrpc + + _test_util_unsecure . a $ ( LIBDIR ) / $ ( CONFIG ) / libgrpc_test_util_unsecure . a $ ( LIBDIR ) / $ ( CONFIG ) / libgpr_test_util . a $ ( LIBDIR ) / $ ( CONFIG ) / libgrpc + + _unsecure . a $ ( LIBDIR ) / $ ( CONFIG ) / libgrpc_unsecure . a $ ( LIBDIR ) / $ ( CONFIG ) / libgpr . a $ ( LDLIBSXX ) $ ( LDLIBS_PROTOBUF ) $ ( LDLIBS ) $ ( LDLIBS_SECURE ) $ ( GTEST_LIB ) - o $ ( BINDIR ) / $ ( CONFIG ) / server_request_call_test <nl> <nl> endif <nl> <nl> endif <nl> <nl> - $ ( OBJDIR ) / $ ( CONFIG ) / src / proto / grpc / testing / echo_messages . o : $ ( LIBDIR ) / $ ( CONFIG ) / libgrpc + + _test_util . a $ ( LIBDIR ) / $ ( CONFIG ) / libgrpc_test_util . a $ ( LIBDIR ) / $ ( CONFIG ) / libgpr_test_util . a $ ( LIBDIR ) / $ ( CONFIG ) / libgrpc + + . a $ ( LIBDIR ) / $ ( CONFIG ) / libgrpc . a $ ( LIBDIR ) / $ ( CONFIG ) / libgpr . a <nl> + $ ( OBJDIR ) / $ ( CONFIG ) / src / proto / grpc / testing / echo_messages . o : $ ( LIBDIR ) / $ ( CONFIG ) / libgrpc + + _test_util_unsecure . a $ ( LIBDIR ) / $ ( CONFIG ) / libgrpc_test_util_unsecure . a $ ( LIBDIR ) / $ ( CONFIG ) / libgpr_test_util . a $ ( LIBDIR ) / $ ( CONFIG ) / libgrpc + + _unsecure . a $ ( LIBDIR ) / $ ( CONFIG ) / libgrpc_unsecure . a $ ( LIBDIR ) / $ ( CONFIG ) / libgpr . a <nl> <nl> - $ ( OBJDIR ) / $ ( CONFIG ) / src / proto / grpc / testing / echo . o : $ ( LIBDIR ) / $ ( CONFIG ) / libgrpc + + _test_util . a $ ( LIBDIR ) / $ ( CONFIG ) / libgrpc_test_util . a $ ( LIBDIR ) / $ ( CONFIG ) / libgpr_test_util . a $ ( LIBDIR ) / $ ( CONFIG ) / libgrpc + + . a $ ( LIBDIR ) / $ ( CONFIG ) / libgrpc . a $ ( LIBDIR ) / $ ( CONFIG ) / libgpr . a <nl> + $ ( OBJDIR ) / $ ( CONFIG ) / src / proto / grpc / testing / echo . o : $ ( LIBDIR ) / $ ( CONFIG ) / libgrpc + + _test_util_unsecure . a $ ( LIBDIR ) / $ ( CONFIG ) / libgrpc_test_util_unsecure . a $ ( LIBDIR ) / $ ( CONFIG ) / libgpr_test_util . a $ ( LIBDIR ) / $ ( CONFIG ) / libgrpc + + _unsecure . a $ ( LIBDIR ) / $ ( CONFIG ) / libgrpc_unsecure . a $ ( LIBDIR ) / $ ( CONFIG ) / libgpr . a <nl> <nl> - $ ( OBJDIR ) / $ ( CONFIG ) / test / cpp / server / server_request_call_test . o : $ ( LIBDIR ) / $ ( CONFIG ) / libgrpc + + _test_util . a $ ( LIBDIR ) / $ ( CONFIG ) / libgrpc_test_util . a $ ( LIBDIR ) / $ ( CONFIG ) / libgpr_test_util . a $ ( LIBDIR ) / $ ( CONFIG ) / libgrpc + + . a $ ( LIBDIR ) / $ ( CONFIG ) / libgrpc . a $ ( LIBDIR ) / $ ( CONFIG ) / libgpr . a <nl> + $ ( OBJDIR ) / $ ( CONFIG ) / test / cpp / server / server_request_call_test . o : $ ( LIBDIR ) / $ ( CONFIG ) / libgrpc + + _test_util_unsecure . a $ ( LIBDIR ) / $ ( CONFIG ) / libgrpc_test_util_unsecure . a $ ( LIBDIR ) / $ ( CONFIG ) / libgpr_test_util . a $ ( LIBDIR ) / $ ( CONFIG ) / libgrpc + + _unsecure . a $ ( LIBDIR ) / $ ( CONFIG ) / libgrpc_unsecure . a $ ( LIBDIR ) / $ ( CONFIG ) / libgpr . a <nl> <nl> deps_server_request_call_test : $ ( SERVER_REQUEST_CALL_TEST_OBJS : . o = . dep ) <nl> <nl> $ ( BINDIR ) / $ ( CONFIG ) / thread_manager_test : protobuf_dep_error <nl> <nl> else <nl> <nl> - $ ( BINDIR ) / $ ( CONFIG ) / thread_manager_test : $ ( PROTOBUF_DEP ) $ ( THREAD_MANAGER_TEST_OBJS ) $ ( LIBDIR ) / $ ( CONFIG ) / libgrpc + + . a $ ( LIBDIR ) / $ ( CONFIG ) / libgrpc . a $ ( LIBDIR ) / $ ( CONFIG ) / libgpr . a $ ( LIBDIR ) / $ ( CONFIG ) / libgrpc + + _test_config . a <nl> + $ ( BINDIR ) / $ ( CONFIG ) / thread_manager_test : $ ( PROTOBUF_DEP ) $ ( THREAD_MANAGER_TEST_OBJS ) $ ( LIBDIR ) / $ ( CONFIG ) / libgrpc + + _unsecure . a $ ( LIBDIR ) / $ ( CONFIG ) / libgrpc_unsecure . a $ ( LIBDIR ) / $ ( CONFIG ) / libgpr . a $ ( LIBDIR ) / $ ( CONFIG ) / libgrpc + + _test_config . a <nl> $ ( E ) " [ LD ] Linking $ @ " <nl> $ ( Q ) mkdir - p ` dirname $ @ ` <nl> - $ ( Q ) $ ( LDXX ) $ ( LDFLAGS ) $ ( THREAD_MANAGER_TEST_OBJS ) $ ( LIBDIR ) / $ ( CONFIG ) / libgrpc + + . a $ ( LIBDIR ) / $ ( CONFIG ) / libgrpc . a $ ( LIBDIR ) / $ ( CONFIG ) / libgpr . a $ ( LIBDIR ) / $ ( CONFIG ) / libgrpc + + _test_config . a $ ( LDLIBSXX ) $ ( LDLIBS_PROTOBUF ) $ ( LDLIBS ) $ ( LDLIBS_SECURE ) $ ( GTEST_LIB ) - o $ ( BINDIR ) / $ ( CONFIG ) / thread_manager_test <nl> + $ ( Q ) $ ( LDXX ) $ ( LDFLAGS ) $ ( THREAD_MANAGER_TEST_OBJS ) $ ( LIBDIR ) / $ ( CONFIG ) / libgrpc + + _unsecure . a $ ( LIBDIR ) / $ ( CONFIG ) / libgrpc_unsecure . a $ ( LIBDIR ) / $ ( CONFIG ) / libgpr . a $ ( LIBDIR ) / $ ( CONFIG ) / libgrpc + + _test_config . a $ ( LDLIBSXX ) $ ( LDLIBS_PROTOBUF ) $ ( LDLIBS ) $ ( LDLIBS_SECURE ) $ ( GTEST_LIB ) - o $ ( BINDIR ) / $ ( CONFIG ) / thread_manager_test <nl> <nl> endif <nl> <nl> endif <nl> <nl> - $ ( OBJDIR ) / $ ( CONFIG ) / test / cpp / thread_manager / thread_manager_test . o : $ ( LIBDIR ) / $ ( CONFIG ) / libgrpc + + . a $ ( LIBDIR ) / $ ( CONFIG ) / libgrpc . a $ ( LIBDIR ) / $ ( CONFIG ) / libgpr . a $ ( LIBDIR ) / $ ( CONFIG ) / libgrpc + + _test_config . a <nl> + $ ( OBJDIR ) / $ ( CONFIG ) / test / cpp / thread_manager / thread_manager_test . o : $ ( LIBDIR ) / $ ( CONFIG ) / libgrpc + + _unsecure . a $ ( LIBDIR ) / $ ( CONFIG ) / libgrpc_unsecure . a $ ( LIBDIR ) / $ ( CONFIG ) / libgpr . a $ ( LIBDIR ) / $ ( CONFIG ) / libgrpc + + _test_config . a <nl> <nl> deps_thread_manager_test : $ ( THREAD_MANAGER_TEST_OBJS : . o = . dep ) <nl> <nl> $ ( BINDIR ) / $ ( CONFIG ) / thread_stress_test : protobuf_dep_error <nl> <nl> else <nl> <nl> - $ ( BINDIR ) / $ ( CONFIG ) / thread_stress_test : $ ( PROTOBUF_DEP ) $ ( THREAD_STRESS_TEST_OBJS ) $ ( LIBDIR ) / $ ( CONFIG ) / libgrpc + + _test_util . a $ ( LIBDIR ) / $ ( CONFIG ) / libgrpc_test_util . a $ ( LIBDIR ) / $ ( CONFIG ) / libgrpc + + . a $ ( LIBDIR ) / $ ( CONFIG ) / libgrpc . a $ ( LIBDIR ) / $ ( CONFIG ) / libgpr_test_util . a $ ( LIBDIR ) / $ ( CONFIG ) / libgpr . a <nl> + $ ( BINDIR ) / $ ( CONFIG ) / thread_stress_test : $ ( PROTOBUF_DEP ) $ ( THREAD_STRESS_TEST_OBJS ) $ ( LIBDIR ) / $ ( CONFIG ) / libgrpc + + _test_util_unsecure . a $ ( LIBDIR ) / $ ( CONFIG ) / libgrpc_test_util_unsecure . a $ ( LIBDIR ) / $ ( CONFIG ) / libgrpc + + _unsecure . a $ ( LIBDIR ) / $ ( CONFIG ) / libgrpc_unsecure . a $ ( LIBDIR ) / $ ( CONFIG ) / libgpr_test_util . a $ ( LIBDIR ) / $ ( CONFIG ) / libgpr . a <nl> $ ( E ) " [ LD ] Linking $ @ " <nl> $ ( Q ) mkdir - p ` dirname $ @ ` <nl> - $ ( Q ) $ ( LDXX ) $ ( LDFLAGS ) $ ( THREAD_STRESS_TEST_OBJS ) $ ( LIBDIR ) / $ ( CONFIG ) / libgrpc + + _test_util . a $ ( LIBDIR ) / $ ( CONFIG ) / libgrpc_test_util . a $ ( LIBDIR ) / $ ( CONFIG ) / libgrpc + + . a $ ( LIBDIR ) / $ ( CONFIG ) / libgrpc . a $ ( LIBDIR ) / $ ( CONFIG ) / libgpr_test_util . a $ ( LIBDIR ) / $ ( CONFIG ) / libgpr . a $ ( LDLIBSXX ) $ ( LDLIBS_PROTOBUF ) $ ( LDLIBS ) $ ( LDLIBS_SECURE ) $ ( GTEST_LIB ) - o $ ( BINDIR ) / $ ( CONFIG ) / thread_stress_test <nl> + $ ( Q ) $ ( LDXX ) $ ( LDFLAGS ) $ ( THREAD_STRESS_TEST_OBJS ) $ ( LIBDIR ) / $ ( CONFIG ) / libgrpc + + _test_util_unsecure . a $ ( LIBDIR ) / $ ( CONFIG ) / libgrpc_test_util_unsecure . a $ ( LIBDIR ) / $ ( CONFIG ) / libgrpc + + _unsecure . a $ ( LIBDIR ) / $ ( CONFIG ) / libgrpc_unsecure . a $ ( LIBDIR ) / $ ( CONFIG ) / libgpr_test_util . a $ ( LIBDIR ) / $ ( CONFIG ) / libgpr . a $ ( LDLIBSXX ) $ ( LDLIBS_PROTOBUF ) $ ( LDLIBS ) $ ( LDLIBS_SECURE ) $ ( GTEST_LIB ) - o $ ( BINDIR ) / $ ( CONFIG ) / thread_stress_test <nl> <nl> endif <nl> <nl> endif <nl> <nl> - $ ( OBJDIR ) / $ ( CONFIG ) / test / cpp / end2end / thread_stress_test . o : $ ( LIBDIR ) / $ ( CONFIG ) / libgrpc + + _test_util . a $ ( LIBDIR ) / $ ( CONFIG ) / libgrpc_test_util . a $ ( LIBDIR ) / $ ( CONFIG ) / libgrpc + + . a $ ( LIBDIR ) / $ ( CONFIG ) / libgrpc . a $ ( LIBDIR ) / $ ( CONFIG ) / libgpr_test_util . a $ ( LIBDIR ) / $ ( CONFIG ) / libgpr . a <nl> + $ ( OBJDIR ) / $ ( CONFIG ) / test / cpp / end2end / thread_stress_test . o : $ ( LIBDIR ) / $ ( CONFIG ) / libgrpc + + _test_util_unsecure . a $ ( LIBDIR ) / $ ( CONFIG ) / libgrpc_test_util_unsecure . a $ ( LIBDIR ) / $ ( CONFIG ) / libgrpc + + _unsecure . a $ ( LIBDIR ) / $ ( CONFIG ) / libgrpc_unsecure . a $ ( LIBDIR ) / $ ( CONFIG ) / libgpr_test_util . a $ ( LIBDIR ) / $ ( CONFIG ) / libgpr . a <nl> <nl> deps_thread_stress_test : $ ( THREAD_STRESS_TEST_OBJS : . o = . dep ) <nl> <nl> mmm a / build . yaml <nl> ppp b / build . yaml <nl> filegroups : <nl> - test / core / util / slice_splitter . c <nl> - test / core / util / trickle_endpoint . c <nl> deps : <nl> - - grpc <nl> - gpr_test_util <nl> + uses : <nl> + - grpc_base <nl> + - grpc_client_channel <nl> + - grpc_transport_chttp2 <nl> - name : grpc_trace <nl> src : <nl> - src / core / lib / debug / trace . c <nl> libs : <nl> - grpc <nl> filegroups : <nl> - grpc_test_util_base <nl> - - grpc_base <nl> vs_project_guid : ' { 17BCAFC0 - 5FDC - 4C94 - AEB9 - 95F3E220614B } ' <nl> - name : grpc_test_util_unsecure <nl> build : private <nl> libs : <nl> - grpc + + _codegen_base_src <nl> - grpc + + _codegen_proto <nl> - grpc + + _config_proto <nl> + - name : grpc + + _test_util_unsecure <nl> + build : private <nl> + language : c + + <nl> + headers : <nl> + - test / cpp / end2end / test_service_impl . h <nl> + - test / cpp / util / byte_buffer_proto_helper . h <nl> + - test / cpp / util / string_ref_helper . h <nl> + - test / cpp / util / subprocess . h <nl> + src : <nl> + - src / proto / grpc / health / v1 / health . proto <nl> + - src / proto / grpc / testing / echo_messages . proto <nl> + - src / proto / grpc / testing / echo . proto <nl> + - src / proto / grpc / testing / duplicate / echo_duplicate . proto <nl> + - test / cpp / end2end / test_service_impl . cc <nl> + - test / cpp / util / byte_buffer_proto_helper . cc <nl> + - test / cpp / util / string_ref_helper . cc <nl> + - test / cpp / util / subprocess . cc <nl> + deps : <nl> + - grpc + + _unsecure <nl> + - grpc_test_util_unsecure <nl> + - grpc_unsecure <nl> + filegroups : <nl> + - grpc + + _codegen_base <nl> + - grpc + + _codegen_base_src <nl> + - grpc + + _codegen_proto <nl> + - grpc + + _config_proto <nl> - name : grpc + + _unsecure <nl> build : all <nl> language : c + + <nl> libs : <nl> - test / cpp / microbenchmarks / helpers . cc <nl> deps : <nl> - benchmark <nl> - - grpc + + <nl> - - grpc_test_util <nl> - - grpc <nl> + - grpc + + _unsecure <nl> + - grpc_test_util_unsecure <nl> + - grpc_unsecure <nl> defaults : benchmark <nl> - name : grpc_cli_libs <nl> build : private <nl> targets : <nl> src : <nl> - test / cpp / common / alarm_cpp_test . cc <nl> deps : <nl> - - grpc + + _test_util <nl> - - grpc_test_util <nl> - - grpc + + <nl> - - grpc <nl> + - grpc + + _test_util_unsecure <nl> + - grpc_test_util_unsecure <nl> + - grpc + + _unsecure <nl> + - grpc_unsecure <nl> - gpr_test_util <nl> - gpr <nl> - name : async_end2end_test <nl> targets : <nl> deps : <nl> - grpc_benchmark <nl> - benchmark <nl> - - grpc + + _test_util <nl> - - grpc_test_util <nl> - - grpc + + <nl> - - grpc <nl> + - grpc + + _test_util_unsecure <nl> + - grpc_test_util_unsecure <nl> + - grpc + + _unsecure <nl> + - grpc_unsecure <nl> - gpr_test_util <nl> - gpr <nl> args : <nl> targets : <nl> deps : <nl> - grpc_benchmark <nl> - benchmark <nl> - - grpc + + _test_util <nl> - - grpc_test_util <nl> - - grpc + + <nl> - - grpc <nl> + - grpc + + _test_util_unsecure <nl> + - grpc_test_util_unsecure <nl> + - grpc + + _unsecure <nl> + - grpc_unsecure <nl> - gpr_test_util <nl> - gpr <nl> args : <nl> targets : <nl> deps : <nl> - grpc_benchmark <nl> - benchmark <nl> - - grpc + + _test_util <nl> - - grpc_test_util <nl> - - grpc + + <nl> - - grpc <nl> + - grpc + + _test_util_unsecure <nl> + - grpc_test_util_unsecure <nl> + - grpc + + _unsecure <nl> + - grpc_unsecure <nl> - gpr_test_util <nl> - gpr <nl> args : <nl> targets : <nl> deps : <nl> - grpc_benchmark <nl> - benchmark <nl> - - grpc + + _test_util <nl> - - grpc_test_util <nl> - - grpc + + <nl> - - grpc <nl> + - grpc + + _test_util_unsecure <nl> + - grpc_test_util_unsecure <nl> + - grpc + + _unsecure <nl> + - grpc_unsecure <nl> - gpr_test_util <nl> - gpr <nl> args : <nl> targets : <nl> deps : <nl> - grpc_benchmark <nl> - benchmark <nl> - - grpc + + _test_util <nl> - - grpc_test_util <nl> - - grpc + + <nl> - - grpc <nl> + - grpc + + _test_util_unsecure <nl> + - grpc_test_util_unsecure <nl> + - grpc + + _unsecure <nl> + - grpc_unsecure <nl> - gpr_test_util <nl> - gpr <nl> args : <nl> targets : <nl> deps : <nl> - grpc_benchmark <nl> - benchmark <nl> - - grpc + + _test_util <nl> - - grpc_test_util <nl> - - grpc + + <nl> - - grpc <nl> + - grpc + + _test_util_unsecure <nl> + - grpc_test_util_unsecure <nl> + - grpc + + _unsecure <nl> + - grpc_unsecure <nl> - gpr_test_util <nl> - gpr <nl> args : <nl> targets : <nl> deps : <nl> - grpc_benchmark <nl> - benchmark <nl> - - grpc + + _test_util <nl> - - grpc_test_util <nl> - - grpc + + <nl> - - grpc <nl> + - grpc + + _test_util_unsecure <nl> + - grpc_test_util_unsecure <nl> + - grpc + + _unsecure <nl> + - grpc_unsecure <nl> - gpr_test_util <nl> - gpr <nl> args : <nl> targets : <nl> deps : <nl> - grpc_benchmark <nl> - benchmark <nl> - - grpc + + _test_util <nl> - - grpc_test_util <nl> - - grpc + + <nl> - - grpc <nl> + - grpc + + _test_util_unsecure <nl> + - grpc_test_util_unsecure <nl> + - grpc + + _unsecure <nl> + - grpc_unsecure <nl> - gpr_test_util <nl> - gpr <nl> args : <nl> targets : <nl> deps : <nl> - grpc_benchmark <nl> - benchmark <nl> - - grpc + + _test_util <nl> - - grpc_test_util <nl> - - grpc + + <nl> - - grpc <nl> + - grpc + + _test_util_unsecure <nl> + - grpc_test_util_unsecure <nl> + - grpc + + _unsecure <nl> + - grpc_unsecure <nl> - gpr_test_util <nl> - gpr <nl> args : <nl> targets : <nl> deps : <nl> - grpc_benchmark <nl> - benchmark <nl> - - grpc + + _test_util <nl> - - grpc_test_util <nl> - - grpc + + <nl> - - grpc <nl> + - grpc + + _test_util_unsecure <nl> + - grpc_test_util_unsecure <nl> + - grpc + + _unsecure <nl> + - grpc_unsecure <nl> - gpr_test_util <nl> - gpr <nl> args : <nl> targets : <nl> deps : <nl> - grpc_benchmark <nl> - benchmark <nl> - - grpc + + _test_util <nl> - - grpc_test_util <nl> - - grpc + + <nl> - - grpc <nl> + - grpc + + _test_util_unsecure <nl> + - grpc_test_util_unsecure <nl> + - grpc + + _unsecure <nl> + - grpc_unsecure <nl> - gpr_test_util <nl> - gpr <nl> args : <nl> targets : <nl> deps : <nl> - grpc_benchmark <nl> - benchmark <nl> - - grpc + + _test_util <nl> - - grpc_test_util <nl> - - grpc + + <nl> - - grpc <nl> + - grpc + + _test_util_unsecure <nl> + - grpc_test_util_unsecure <nl> + - grpc + + _unsecure <nl> + - grpc_unsecure <nl> - gpr_test_util <nl> - gpr <nl> args : <nl> targets : <nl> deps : <nl> - grpc_benchmark <nl> - benchmark <nl> - - grpc + + _test_util <nl> - - grpc_test_util <nl> - - grpc + + <nl> - - grpc <nl> + - grpc + + _test_util_unsecure <nl> + - grpc_test_util_unsecure <nl> + - grpc + + _unsecure <nl> + - grpc_unsecure <nl> - gpr_test_util <nl> - gpr <nl> args : <nl> targets : <nl> deps : <nl> - grpc_benchmark <nl> - benchmark <nl> - - grpc + + _test_util <nl> - - grpc_test_util <nl> - - grpc + + <nl> - - grpc <nl> + - grpc + + _test_util_unsecure <nl> + - grpc_test_util_unsecure <nl> + - grpc + + _unsecure <nl> + - grpc_unsecure <nl> - gpr_test_util <nl> - gpr <nl> args : <nl> targets : <nl> - src / proto / grpc / testing / echo . proto <nl> - test / cpp / server / server_builder_test . cc <nl> deps : <nl> - - grpc + + _test_util <nl> - - grpc_test_util <nl> + - grpc + + _test_util_unsecure <nl> + - grpc_test_util_unsecure <nl> - gpr_test_util <nl> - - grpc + + <nl> - - grpc <nl> + - grpc + + _unsecure <nl> + - grpc_unsecure <nl> - gpr <nl> - name : server_context_test_spouse_test <nl> gtest : true <nl> targets : <nl> - src / proto / grpc / testing / echo . proto <nl> - test / cpp / server / server_request_call_test . cc <nl> deps : <nl> - - grpc + + _test_util <nl> - - grpc_test_util <nl> + - grpc + + _test_util_unsecure <nl> + - grpc_test_util_unsecure <nl> - gpr_test_util <nl> - - grpc + + <nl> - - grpc <nl> + - grpc + + _unsecure <nl> + - grpc_unsecure <nl> - gpr <nl> - name : shutdown_test <nl> gtest : true <nl> targets : <nl> src : <nl> - test / cpp / thread_manager / thread_manager_test . cc <nl> deps : <nl> - - grpc + + <nl> - - grpc <nl> + - grpc + + _unsecure <nl> + - grpc_unsecure <nl> - gpr <nl> - grpc + + _test_config <nl> - name : thread_stress_test <nl> targets : <nl> src : <nl> - test / cpp / end2end / thread_stress_test . cc <nl> deps : <nl> - - grpc + + _test_util <nl> - - grpc_test_util <nl> - - grpc + + <nl> - - grpc <nl> + - grpc + + _test_util_unsecure <nl> + - grpc_test_util_unsecure <nl> + - grpc + + _unsecure <nl> + - grpc_unsecure <nl> - gpr_test_util <nl> - gpr <nl> timeout_seconds : 1200 <nl> mmm a / tools / run_tests / generated / sources_and_headers . json <nl> ppp b / tools / run_tests / generated / sources_and_headers . json <nl> <nl> " deps " : [ <nl> " gpr " , <nl> " gpr_test_util " , <nl> - " grpc " , <nl> - " grpc + + " , <nl> - " grpc + + _test_util " , <nl> - " grpc_test_util " <nl> + " grpc + + _test_util_unsecure " , <nl> + " grpc + + _unsecure " , <nl> + " grpc_test_util_unsecure " , <nl> + " grpc_unsecure " <nl> ] , <nl> " headers " : [ ] , <nl> " is_filegroup " : false , <nl> <nl> " benchmark " , <nl> " gpr " , <nl> " gpr_test_util " , <nl> - " grpc " , <nl> - " grpc + + " , <nl> - " grpc + + _test_util " , <nl> + " grpc + + _test_util_unsecure " , <nl> + " grpc + + _unsecure " , <nl> " grpc_benchmark " , <nl> - " grpc_test_util " <nl> + " grpc_test_util_unsecure " , <nl> + " grpc_unsecure " <nl> ] , <nl> " headers " : [ ] , <nl> " is_filegroup " : false , <nl> <nl> " benchmark " , <nl> " gpr " , <nl> " gpr_test_util " , <nl> - " grpc " , <nl> - " grpc + + " , <nl> - " grpc + + _test_util " , <nl> + " grpc + + _test_util_unsecure " , <nl> + " grpc + + _unsecure " , <nl> " grpc_benchmark " , <nl> - " grpc_test_util " <nl> + " grpc_test_util_unsecure " , <nl> + " grpc_unsecure " <nl> ] , <nl> " headers " : [ ] , <nl> " is_filegroup " : false , <nl> <nl> " benchmark " , <nl> " gpr " , <nl> " gpr_test_util " , <nl> - " grpc " , <nl> - " grpc + + " , <nl> - " grpc + + _test_util " , <nl> + " grpc + + _test_util_unsecure " , <nl> + " grpc + + _unsecure " , <nl> " grpc_benchmark " , <nl> - " grpc_test_util " <nl> + " grpc_test_util_unsecure " , <nl> + " grpc_unsecure " <nl> ] , <nl> " headers " : [ ] , <nl> " is_filegroup " : false , <nl> <nl> " benchmark " , <nl> " gpr " , <nl> " gpr_test_util " , <nl> - " grpc " , <nl> - " grpc + + " , <nl> - " grpc + + _test_util " , <nl> + " grpc + + _test_util_unsecure " , <nl> + " grpc + + _unsecure " , <nl> " grpc_benchmark " , <nl> - " grpc_test_util " <nl> + " grpc_test_util_unsecure " , <nl> + " grpc_unsecure " <nl> ] , <nl> " headers " : [ ] , <nl> " is_filegroup " : false , <nl> <nl> " benchmark " , <nl> " gpr " , <nl> " gpr_test_util " , <nl> - " grpc " , <nl> - " grpc + + " , <nl> - " grpc + + _test_util " , <nl> + " grpc + + _test_util_unsecure " , <nl> + " grpc + + _unsecure " , <nl> " grpc_benchmark " , <nl> - " grpc_test_util " <nl> + " grpc_test_util_unsecure " , <nl> + " grpc_unsecure " <nl> ] , <nl> " headers " : [ ] , <nl> " is_filegroup " : false , <nl> <nl> " benchmark " , <nl> " gpr " , <nl> " gpr_test_util " , <nl> - " grpc " , <nl> - " grpc + + " , <nl> - " grpc + + _test_util " , <nl> + " grpc + + _test_util_unsecure " , <nl> + " grpc + + _unsecure " , <nl> " grpc_benchmark " , <nl> - " grpc_test_util " <nl> + " grpc_test_util_unsecure " , <nl> + " grpc_unsecure " <nl> ] , <nl> " headers " : [ ] , <nl> " is_filegroup " : false , <nl> <nl> " benchmark " , <nl> " gpr " , <nl> " gpr_test_util " , <nl> - " grpc " , <nl> - " grpc + + " , <nl> - " grpc + + _test_util " , <nl> + " grpc + + _test_util_unsecure " , <nl> + " grpc + + _unsecure " , <nl> " grpc_benchmark " , <nl> - " grpc_test_util " <nl> + " grpc_test_util_unsecure " , <nl> + " grpc_unsecure " <nl> ] , <nl> " headers " : [ ] , <nl> " is_filegroup " : false , <nl> <nl> " benchmark " , <nl> " gpr " , <nl> " gpr_test_util " , <nl> - " grpc " , <nl> - " grpc + + " , <nl> - " grpc + + _test_util " , <nl> + " grpc + + _test_util_unsecure " , <nl> + " grpc + + _unsecure " , <nl> " grpc_benchmark " , <nl> - " grpc_test_util " <nl> + " grpc_test_util_unsecure " , <nl> + " grpc_unsecure " <nl> ] , <nl> " headers " : [ ] , <nl> " is_filegroup " : false , <nl> <nl> " benchmark " , <nl> " gpr " , <nl> " gpr_test_util " , <nl> - " grpc " , <nl> - " grpc + + " , <nl> - " grpc + + _test_util " , <nl> + " grpc + + _test_util_unsecure " , <nl> + " grpc + + _unsecure " , <nl> " grpc_benchmark " , <nl> - " grpc_test_util " <nl> + " grpc_test_util_unsecure " , <nl> + " grpc_unsecure " <nl> ] , <nl> " headers " : [ ] , <nl> " is_filegroup " : false , <nl> <nl> " benchmark " , <nl> " gpr " , <nl> " gpr_test_util " , <nl> - " grpc " , <nl> - " grpc + + " , <nl> - " grpc + + _test_util " , <nl> + " grpc + + _test_util_unsecure " , <nl> + " grpc + + _unsecure " , <nl> " grpc_benchmark " , <nl> - " grpc_test_util " <nl> + " grpc_test_util_unsecure " , <nl> + " grpc_unsecure " <nl> ] , <nl> " headers " : [ ] , <nl> " is_filegroup " : false , <nl> <nl> " benchmark " , <nl> " gpr " , <nl> " gpr_test_util " , <nl> - " grpc " , <nl> - " grpc + + " , <nl> - " grpc + + _test_util " , <nl> + " grpc + + _test_util_unsecure " , <nl> + " grpc + + _unsecure " , <nl> " grpc_benchmark " , <nl> - " grpc_test_util " <nl> + " grpc_test_util_unsecure " , <nl> + " grpc_unsecure " <nl> ] , <nl> " headers " : [ ] , <nl> " is_filegroup " : false , <nl> <nl> " benchmark " , <nl> " gpr " , <nl> " gpr_test_util " , <nl> - " grpc " , <nl> - " grpc + + " , <nl> - " grpc + + _test_util " , <nl> + " grpc + + _test_util_unsecure " , <nl> + " grpc + + _unsecure " , <nl> " grpc_benchmark " , <nl> - " grpc_test_util " <nl> + " grpc_test_util_unsecure " , <nl> + " grpc_unsecure " <nl> ] , <nl> " headers " : [ ] , <nl> " is_filegroup " : false , <nl> <nl> " benchmark " , <nl> " gpr " , <nl> " gpr_test_util " , <nl> - " grpc " , <nl> - " grpc + + " , <nl> - " grpc + + _test_util " , <nl> + " grpc + + _test_util_unsecure " , <nl> + " grpc + + _unsecure " , <nl> " grpc_benchmark " , <nl> - " grpc_test_util " <nl> + " grpc_test_util_unsecure " , <nl> + " grpc_unsecure " <nl> ] , <nl> " headers " : [ ] , <nl> " is_filegroup " : false , <nl> <nl> " benchmark " , <nl> " gpr " , <nl> " gpr_test_util " , <nl> - " grpc " , <nl> - " grpc + + " , <nl> - " grpc + + _test_util " , <nl> + " grpc + + _test_util_unsecure " , <nl> + " grpc + + _unsecure " , <nl> " grpc_benchmark " , <nl> - " grpc_test_util " <nl> + " grpc_test_util_unsecure " , <nl> + " grpc_unsecure " <nl> ] , <nl> " headers " : [ ] , <nl> " is_filegroup " : false , <nl> <nl> " deps " : [ <nl> " gpr " , <nl> " gpr_test_util " , <nl> - " grpc " , <nl> - " grpc + + " , <nl> - " grpc + + _test_util " , <nl> - " grpc_test_util " <nl> + " grpc + + _test_util_unsecure " , <nl> + " grpc + + _unsecure " , <nl> + " grpc_test_util_unsecure " , <nl> + " grpc_unsecure " <nl> ] , <nl> " headers " : [ <nl> " src / proto / grpc / testing / echo . grpc . pb . h " , <nl> <nl> " deps " : [ <nl> " gpr " , <nl> " gpr_test_util " , <nl> - " grpc " , <nl> - " grpc + + " , <nl> - " grpc + + _test_util " , <nl> - " grpc_test_util " <nl> + " grpc + + _test_util_unsecure " , <nl> + " grpc + + _unsecure " , <nl> + " grpc_test_util_unsecure " , <nl> + " grpc_unsecure " <nl> ] , <nl> " headers " : [ <nl> " src / proto / grpc / testing / echo . grpc . pb . h " , <nl> <nl> { <nl> " deps " : [ <nl> " gpr " , <nl> - " grpc " , <nl> - " grpc + + " , <nl> - " grpc + + _test_config " <nl> + " grpc + + _test_config " , <nl> + " grpc + + _unsecure " , <nl> + " grpc_unsecure " <nl> ] , <nl> " headers " : [ ] , <nl> " is_filegroup " : false , <nl> <nl> " deps " : [ <nl> " gpr " , <nl> " gpr_test_util " , <nl> - " grpc " , <nl> - " grpc + + " , <nl> - " grpc + + _test_util " , <nl> - " grpc_test_util " <nl> + " grpc + + _test_util_unsecure " , <nl> + " grpc + + _unsecure " , <nl> + " grpc_test_util_unsecure " , <nl> + " grpc_unsecure " <nl> ] , <nl> " headers " : [ ] , <nl> " is_filegroup " : false , <nl> <nl> " gpr " , <nl> " gpr_test_util " , <nl> " grpc " , <nl> - " grpc_base " , <nl> " grpc_test_util_base " <nl> ] , <nl> " headers " : [ <nl> <nl> " deps " : [ <nl> " gpr " , <nl> " gpr_test_util " , <nl> - " grpc " , <nl> " grpc_test_util_base " , <nl> " grpc_unsecure " <nl> ] , <nl> <nl> " third_party " : false , <nl> " type " : " lib " <nl> } , <nl> + { <nl> + " deps " : [ <nl> + " grpc + + _codegen_base " , <nl> + " grpc + + _codegen_base_src " , <nl> + " grpc + + _codegen_proto " , <nl> + " grpc + + _config_proto " , <nl> + " grpc + + _unsecure " , <nl> + " grpc_test_util_unsecure " , <nl> + " grpc_unsecure " <nl> + ] , <nl> + " headers " : [ <nl> + " src / proto / grpc / health / v1 / health . grpc . pb . h " , <nl> + " src / proto / grpc / health / v1 / health . pb . h " , <nl> + " src / proto / grpc / health / v1 / health_mock . grpc . pb . h " , <nl> + " src / proto / grpc / testing / duplicate / echo_duplicate . grpc . pb . h " , <nl> + " src / proto / grpc / testing / duplicate / echo_duplicate . pb . h " , <nl> + " src / proto / grpc / testing / duplicate / echo_duplicate_mock . grpc . pb . h " , <nl> + " src / proto / grpc / testing / echo . grpc . pb . h " , <nl> + " src / proto / grpc / testing / echo . pb . h " , <nl> + " src / proto / grpc / testing / echo_messages . grpc . pb . h " , <nl> + " src / proto / grpc / testing / echo_messages . pb . h " , <nl> + " src / proto / grpc / testing / echo_messages_mock . grpc . pb . h " , <nl> + " src / proto / grpc / testing / echo_mock . grpc . pb . h " , <nl> + " test / cpp / end2end / test_service_impl . h " , <nl> + " test / cpp / util / byte_buffer_proto_helper . h " , <nl> + " test / cpp / util / string_ref_helper . h " , <nl> + " test / cpp / util / subprocess . h " <nl> + ] , <nl> + " is_filegroup " : false , <nl> + " language " : " c + + " , <nl> + " name " : " grpc + + _test_util_unsecure " , <nl> + " src " : [ <nl> + " test / cpp / end2end / test_service_impl . cc " , <nl> + " test / cpp / end2end / test_service_impl . h " , <nl> + " test / cpp / util / byte_buffer_proto_helper . cc " , <nl> + " test / cpp / util / byte_buffer_proto_helper . h " , <nl> + " test / cpp / util / string_ref_helper . cc " , <nl> + " test / cpp / util / string_ref_helper . h " , <nl> + " test / cpp / util / subprocess . cc " , <nl> + " test / cpp / util / subprocess . h " <nl> + ] , <nl> + " third_party " : false , <nl> + " type " : " lib " <nl> + } , <nl> { <nl> " deps " : [ <nl> " gpr " , <nl> <nl> { <nl> " deps " : [ <nl> " benchmark " , <nl> - " grpc " , <nl> - " grpc + + " , <nl> - " grpc_test_util " <nl> + " grpc + + _unsecure " , <nl> + " grpc_test_util_unsecure " , <nl> + " grpc_unsecure " <nl> ] , <nl> " headers " : [ <nl> " test / cpp / microbenchmarks / fullstack_context_mutators . h " , <nl> <nl> } , <nl> { <nl> " deps " : [ <nl> + " gpr " , <nl> " gpr_test_util " , <nl> - " grpc " <nl> + " grpc_base " , <nl> + " grpc_client_channel " , <nl> + " grpc_transport_chttp2 " <nl> ] , <nl> " headers " : [ <nl> " src / core / ext / filters / client_channel / resolver / fake / fake_resolver . h " , <nl> mmm a / vsprojects / buildtests_c . sln <nl> ppp b / vsprojects / buildtests_c . sln <nl> Project ( " { 8BC9CEB8 - 8B4A - 11D0 - 8D11 - 00A0C91BC942 } " ) = " grpc_test_util_unsecure " , " <nl> { B23D3D1A - 9438 - 4EDA - BEB6 - 9A0A03D17792 } = { B23D3D1A - 9438 - 4EDA - BEB6 - 9A0A03D17792 } <nl> { EAB0A629 - 17A9 - 44DB - B5FF - E91A721FE037 } = { EAB0A629 - 17A9 - 44DB - B5FF - E91A721FE037 } <nl> { 46CEDFFF - 9692 - 456A - AA24 - 38B5D6BCF4C5 } = { 46CEDFFF - 9692 - 456A - AA24 - 38B5D6BCF4C5 } <nl> - { 29D16885 - 7228 - 4C31 - 81ED - 5F9187C7F2A9 } = { 29D16885 - 7228 - 4C31 - 81ED - 5F9187C7F2A9 } <nl> EndProjectSection <nl> EndProject <nl> Project ( " { 8BC9CEB8 - 8B4A - 11D0 - 8D11 - 00A0C91BC942 } " ) = " grpc_unsecure " , " vcxproj \ . \ grpc_unsecure \ grpc_unsecure . vcxproj " , " { 46CEDFFF - 9692 - 456A - AA24 - 38B5D6BCF4C5 } " <nl> mmm a / vsprojects / grpc . sln <nl> ppp b / vsprojects / grpc . sln <nl> Project ( " { 8BC9CEB8 - 8B4A - 11D0 - 8D11 - 00A0C91BC942 } " ) = " grpc_test_util_unsecure " , " <nl> { B23D3D1A - 9438 - 4EDA - BEB6 - 9A0A03D17792 } = { B23D3D1A - 9438 - 4EDA - BEB6 - 9A0A03D17792 } <nl> { EAB0A629 - 17A9 - 44DB - B5FF - E91A721FE037 } = { EAB0A629 - 17A9 - 44DB - B5FF - E91A721FE037 } <nl> { 46CEDFFF - 9692 - 456A - AA24 - 38B5D6BCF4C5 } = { 46CEDFFF - 9692 - 456A - AA24 - 38B5D6BCF4C5 } <nl> - { 29D16885 - 7228 - 4C31 - 81ED - 5F9187C7F2A9 } = { 29D16885 - 7228 - 4C31 - 81ED - 5F9187C7F2A9 } <nl> EndProjectSection <nl> EndProject <nl> Project ( " { 8BC9CEB8 - 8B4A - 11D0 - 8D11 - 00A0C91BC942 } " ) = " grpc_unsecure " , " vcxproj \ . \ grpc_unsecure \ grpc_unsecure . vcxproj " , " { 46CEDFFF - 9692 - 456A - AA24 - 38B5D6BCF4C5 } " <nl> new file mode 100644 <nl> index 00000000000 . . 5a84ab4f824 <nl> mmm / dev / null <nl> ppp b / vsprojects / vcxproj / grpc + + _test_util_unsecure / grpc + + _test_util_unsecure . vcxproj <nl> <nl> + < ? xml version = " 1 . 0 " encoding = " utf - 8 " ? > <nl> + < Project DefaultTargets = " Build " ToolsVersion = " 12 . 0 " xmlns = " http : / / schemas . microsoft . com / developer / msbuild / 2003 " > <nl> + < ItemGroup Label = " ProjectConfigurations " > <nl> + < ProjectConfiguration Include = " Debug | Win32 " > <nl> + < Configuration > Debug < / Configuration > <nl> + < Platform > Win32 < / Platform > <nl> + < / ProjectConfiguration > <nl> + < ProjectConfiguration Include = " Debug | x64 " > <nl> + < Configuration > Debug < / Configuration > <nl> + < Platform > x64 < / Platform > <nl> + < / ProjectConfiguration > <nl> + < ProjectConfiguration Include = " Release | Win32 " > <nl> + < Configuration > Release < / Configuration > <nl> + < Platform > Win32 < / Platform > <nl> + < / ProjectConfiguration > <nl> + < ProjectConfiguration Include = " Release | x64 " > <nl> + < Configuration > Release < / Configuration > <nl> + < Platform > x64 < / Platform > <nl> + < / ProjectConfiguration > <nl> + < / ItemGroup > <nl> + < PropertyGroup Label = " Globals " > <nl> + < ProjectGuid > { 1D4003D7 - 5BF1 - 9FE6 - BAF7 - 23B174D942AC } < / ProjectGuid > <nl> + < IgnoreWarnIntDirInTempDetected > true < / IgnoreWarnIntDirInTempDetected > <nl> + < IntDir > $ ( SolutionDir ) IntDir \ $ ( MSBuildProjectName ) \ < / IntDir > <nl> + < / PropertyGroup > <nl> + < Import Project = " $ ( VCTargetsPath ) \ Microsoft . Cpp . Default . props " / > <nl> + < PropertyGroup Condition = " ' $ ( VisualStudioVersion ) ' = = ' 10 . 0 ' " Label = " Configuration " > <nl> + < PlatformToolset > v100 < / PlatformToolset > <nl> + < / PropertyGroup > <nl> + < PropertyGroup Condition = " ' $ ( VisualStudioVersion ) ' = = ' 11 . 0 ' " Label = " Configuration " > <nl> + < PlatformToolset > v110 < / PlatformToolset > <nl> + < / PropertyGroup > <nl> + < PropertyGroup Condition = " ' $ ( VisualStudioVersion ) ' = = ' 12 . 0 ' " Label = " Configuration " > <nl> + < PlatformToolset > v120 < / PlatformToolset > <nl> + < / PropertyGroup > <nl> + < PropertyGroup Condition = " ' $ ( VisualStudioVersion ) ' = = ' 14 . 0 ' " Label = " Configuration " > <nl> + < PlatformToolset > v140 < / PlatformToolset > <nl> + < / PropertyGroup > <nl> + < PropertyGroup Condition = " ' $ ( Configuration ) ' = = ' Debug ' " Label = " Configuration " > <nl> + < ConfigurationType > StaticLibrary < / ConfigurationType > <nl> + < UseDebugLibraries > true < / UseDebugLibraries > <nl> + < CharacterSet > Unicode < / CharacterSet > <nl> + < / PropertyGroup > <nl> + < PropertyGroup Condition = " ' $ ( Configuration ) ' = = ' Release ' " Label = " Configuration " > <nl> + < ConfigurationType > StaticLibrary < / ConfigurationType > <nl> + < UseDebugLibraries > false < / UseDebugLibraries > <nl> + < WholeProgramOptimization > true < / WholeProgramOptimization > <nl> + < CharacterSet > Unicode < / CharacterSet > <nl> + < / PropertyGroup > <nl> + < Import Project = " $ ( VCTargetsPath ) \ Microsoft . Cpp . props " / > <nl> + < ImportGroup Label = " ExtensionSettings " > <nl> + < / ImportGroup > <nl> + < ImportGroup Label = " PropertySheets " > <nl> + < Import Project = " $ ( UserRootDir ) \ Microsoft . Cpp . $ ( Platform ) . user . props " Condition = " exists ( ' $ ( UserRootDir ) \ Microsoft . Cpp . $ ( Platform ) . user . props ' ) " Label = " LocalAppDataPlatform " / > <nl> + < Import Project = " $ ( SolutionDir ) \ . . \ vsprojects \ global . props " / > <nl> + < Import Project = " $ ( SolutionDir ) \ . . \ vsprojects \ winsock . props " / > <nl> + < / ImportGroup > <nl> + < PropertyGroup Label = " UserMacros " / > <nl> + < PropertyGroup Condition = " ' $ ( Configuration ) ' = = ' Debug ' " > <nl> + < TargetName > grpc + + _test_util_unsecure < / TargetName > <nl> + < / PropertyGroup > <nl> + < PropertyGroup Condition = " ' $ ( Configuration ) ' = = ' Release ' " > <nl> + < TargetName > grpc + + _test_util_unsecure < / TargetName > <nl> + < / PropertyGroup > <nl> + < ItemDefinitionGroup Condition = " ' $ ( Configuration ) | $ ( Platform ) ' = = ' Debug | Win32 ' " > <nl> + < ClCompile > <nl> + < PrecompiledHeader > NotUsing < / PrecompiledHeader > <nl> + < WarningLevel > Level3 < / WarningLevel > <nl> + < Optimization > Disabled < / Optimization > <nl> + < PreprocessorDefinitions > WIN32 ; _DEBUG ; _LIB ; % ( PreprocessorDefinitions ) < / PreprocessorDefinitions > <nl> + < SDLCheck > true < / SDLCheck > <nl> + < RuntimeLibrary > MultiThreadedDebug < / RuntimeLibrary > <nl> + < TreatWarningAsError > true < / TreatWarningAsError > <nl> + < DebugInformationFormat Condition = " $ ( Jenkins ) " > None < / DebugInformationFormat > <nl> + < MinimalRebuild Condition = " $ ( Jenkins ) " > false < / MinimalRebuild > <nl> + < / ClCompile > <nl> + < Link > <nl> + < SubSystem > Windows < / SubSystem > <nl> + < GenerateDebugInformation Condition = " ! $ ( Jenkins ) " > true < / GenerateDebugInformation > <nl> + < GenerateDebugInformation Condition = " $ ( Jenkins ) " > false < / GenerateDebugInformation > <nl> + < / Link > <nl> + < / ItemDefinitionGroup > <nl> + <nl> + < ItemDefinitionGroup Condition = " ' $ ( Configuration ) | $ ( Platform ) ' = = ' Debug | x64 ' " > <nl> + < ClCompile > <nl> + < PrecompiledHeader > NotUsing < / PrecompiledHeader > <nl> + < WarningLevel > Level3 < / WarningLevel > <nl> + < Optimization > Disabled < / Optimization > <nl> + < PreprocessorDefinitions > WIN32 ; _DEBUG ; _LIB ; % ( PreprocessorDefinitions ) < / PreprocessorDefinitions > <nl> + < SDLCheck > true < / SDLCheck > <nl> + < RuntimeLibrary > MultiThreadedDebug < / RuntimeLibrary > <nl> + < TreatWarningAsError > true < / TreatWarningAsError > <nl> + < DebugInformationFormat Condition = " $ ( Jenkins ) " > None < / DebugInformationFormat > <nl> + < MinimalRebuild Condition = " $ ( Jenkins ) " > false < / MinimalRebuild > <nl> + < / ClCompile > <nl> + < Link > <nl> + < SubSystem > Windows < / SubSystem > <nl> + < GenerateDebugInformation Condition = " ! $ ( Jenkins ) " > true < / GenerateDebugInformation > <nl> + < GenerateDebugInformation Condition = " $ ( Jenkins ) " > false < / GenerateDebugInformation > <nl> + < / Link > <nl> + < / ItemDefinitionGroup > <nl> + <nl> + < ItemDefinitionGroup Condition = " ' $ ( Configuration ) | $ ( Platform ) ' = = ' Release | Win32 ' " > <nl> + < ClCompile > <nl> + < PrecompiledHeader > NotUsing < / PrecompiledHeader > <nl> + < WarningLevel > Level3 < / WarningLevel > <nl> + < Optimization > MaxSpeed < / Optimization > <nl> + < PreprocessorDefinitions > WIN32 ; NDEBUG ; _LIB ; % ( PreprocessorDefinitions ) < / PreprocessorDefinitions > <nl> + < FunctionLevelLinking > true < / FunctionLevelLinking > <nl> + < IntrinsicFunctions > true < / IntrinsicFunctions > <nl> + < SDLCheck > true < / SDLCheck > <nl> + < RuntimeLibrary > MultiThreaded < / RuntimeLibrary > <nl> + < TreatWarningAsError > true < / TreatWarningAsError > <nl> + < DebugInformationFormat Condition = " $ ( Jenkins ) " > None < / DebugInformationFormat > <nl> + < MinimalRebuild Condition = " $ ( Jenkins ) " > false < / MinimalRebuild > <nl> + < / ClCompile > <nl> + < Link > <nl> + < SubSystem > Windows < / SubSystem > <nl> + < GenerateDebugInformation Condition = " ! $ ( Jenkins ) " > true < / GenerateDebugInformation > <nl> + < GenerateDebugInformation Condition = " $ ( Jenkins ) " > false < / GenerateDebugInformation > <nl> + < EnableCOMDATFolding > true < / EnableCOMDATFolding > <nl> + < OptimizeReferences > true < / OptimizeReferences > <nl> + < / Link > <nl> + < / ItemDefinitionGroup > <nl> + <nl> + < ItemDefinitionGroup Condition = " ' $ ( Configuration ) | $ ( Platform ) ' = = ' Release | x64 ' " > <nl> + < ClCompile > <nl> + < PrecompiledHeader > NotUsing < / PrecompiledHeader > <nl> + < WarningLevel > Level3 < / WarningLevel > <nl> + < Optimization > MaxSpeed < / Optimization > <nl> + < PreprocessorDefinitions > WIN32 ; NDEBUG ; _LIB ; % ( PreprocessorDefinitions ) < / PreprocessorDefinitions > <nl> + < FunctionLevelLinking > true < / FunctionLevelLinking > <nl> + < IntrinsicFunctions > true < / IntrinsicFunctions > <nl> + < SDLCheck > true < / SDLCheck > <nl> + < RuntimeLibrary > MultiThreaded < / RuntimeLibrary > <nl> + < TreatWarningAsError > true < / TreatWarningAsError > <nl> + < DebugInformationFormat Condition = " $ ( Jenkins ) " > None < / DebugInformationFormat > <nl> + < MinimalRebuild Condition = " $ ( Jenkins ) " > false < / MinimalRebuild > <nl> + < / ClCompile > <nl> + < Link > <nl> + < SubSystem > Windows < / SubSystem > <nl> + < GenerateDebugInformation Condition = " ! $ ( Jenkins ) " > true < / GenerateDebugInformation > <nl> + < GenerateDebugInformation Condition = " $ ( Jenkins ) " > false < / GenerateDebugInformation > <nl> + < EnableCOMDATFolding > true < / EnableCOMDATFolding > <nl> + < OptimizeReferences > true < / OptimizeReferences > <nl> + < / Link > <nl> + < / ItemDefinitionGroup > <nl> + <nl> + < ItemGroup > <nl> + < ClInclude Include = " $ ( SolutionDir ) \ . . \ include \ grpc + + \ impl \ codegen \ async_stream . h " / > <nl> + < ClInclude Include = " $ ( SolutionDir ) \ . . \ include \ grpc + + \ impl \ codegen \ async_unary_call . h " / > <nl> + < ClInclude Include = " $ ( SolutionDir ) \ . . \ include \ grpc + + \ impl \ codegen \ call . h " / > <nl> + < ClInclude Include = " $ ( SolutionDir ) \ . . \ include \ grpc + + \ impl \ codegen \ call_hook . h " / > <nl> + < ClInclude Include = " $ ( SolutionDir ) \ . . \ include \ grpc + + \ impl \ codegen \ channel_interface . h " / > <nl> + < ClInclude Include = " $ ( SolutionDir ) \ . . \ include \ grpc + + \ impl \ codegen \ client_context . h " / > <nl> + < ClInclude Include = " $ ( SolutionDir ) \ . . \ include \ grpc + + \ impl \ codegen \ client_unary_call . h " / > <nl> + < ClInclude Include = " $ ( SolutionDir ) \ . . \ include \ grpc + + \ impl \ codegen \ completion_queue . h " / > <nl> + < ClInclude Include = " $ ( SolutionDir ) \ . . \ include \ grpc + + \ impl \ codegen \ completion_queue_tag . h " / > <nl> + < ClInclude Include = " $ ( SolutionDir ) \ . . \ include \ grpc + + \ impl \ codegen \ config . h " / > <nl> + < ClInclude Include = " $ ( SolutionDir ) \ . . \ include \ grpc + + \ impl \ codegen \ core_codegen_interface . h " / > <nl> + < ClInclude Include = " $ ( SolutionDir ) \ . . \ include \ grpc + + \ impl \ codegen \ create_auth_context . h " / > <nl> + < ClInclude Include = " $ ( SolutionDir ) \ . . \ include \ grpc + + \ impl \ codegen \ grpc_library . h " / > <nl> + < ClInclude Include = " $ ( SolutionDir ) \ . . \ include \ grpc + + \ impl \ codegen \ metadata_map . h " / > <nl> + < ClInclude Include = " $ ( SolutionDir ) \ . . \ include \ grpc + + \ impl \ codegen \ method_handler_impl . h " / > <nl> + < ClInclude Include = " $ ( SolutionDir ) \ . . \ include \ grpc + + \ impl \ codegen \ rpc_method . h " / > <nl> + < ClInclude Include = " $ ( SolutionDir ) \ . . \ include \ grpc + + \ impl \ codegen \ rpc_service_method . h " / > <nl> + < ClInclude Include = " $ ( SolutionDir ) \ . . \ include \ grpc + + \ impl \ codegen \ security \ auth_context . h " / > <nl> + < ClInclude Include = " $ ( SolutionDir ) \ . . \ include \ grpc + + \ impl \ codegen \ serialization_traits . h " / > <nl> + < ClInclude Include = " $ ( SolutionDir ) \ . . \ include \ grpc + + \ impl \ codegen \ server_context . h " / > <nl> + < ClInclude Include = " $ ( SolutionDir ) \ . . \ include \ grpc + + \ impl \ codegen \ server_interface . h " / > <nl> + < ClInclude Include = " $ ( SolutionDir ) \ . . \ include \ grpc + + \ impl \ codegen \ service_type . h " / > <nl> + < ClInclude Include = " $ ( SolutionDir ) \ . . \ include \ grpc + + \ impl \ codegen \ slice . h " / > <nl> + < ClInclude Include = " $ ( SolutionDir ) \ . . \ include \ grpc + + \ impl \ codegen \ status . h " / > <nl> + < ClInclude Include = " $ ( SolutionDir ) \ . . \ include \ grpc + + \ impl \ codegen \ status_code_enum . h " / > <nl> + < ClInclude Include = " $ ( SolutionDir ) \ . . \ include \ grpc + + \ impl \ codegen \ string_ref . h " / > <nl> + < ClInclude Include = " $ ( SolutionDir ) \ . . \ include \ grpc + + \ impl \ codegen \ stub_options . h " / > <nl> + < ClInclude Include = " $ ( SolutionDir ) \ . . \ include \ grpc + + \ impl \ codegen \ sync_stream . h " / > <nl> + < ClInclude Include = " $ ( SolutionDir ) \ . . \ include \ grpc + + \ impl \ codegen \ time . h " / > <nl> + < ClInclude Include = " $ ( SolutionDir ) \ . . \ include \ grpc \ impl \ codegen \ byte_buffer_reader . h " / > <nl> + < ClInclude Include = " $ ( SolutionDir ) \ . . \ include \ grpc \ impl \ codegen \ compression_types . h " / > <nl> + < ClInclude Include = " $ ( SolutionDir ) \ . . \ include \ grpc \ impl \ codegen \ connectivity_state . h " / > <nl> + < ClInclude Include = " $ ( SolutionDir ) \ . . \ include \ grpc \ impl \ codegen \ exec_ctx_fwd . h " / > <nl> + < ClInclude Include = " $ ( SolutionDir ) \ . . \ include \ grpc \ impl \ codegen \ grpc_types . h " / > <nl> + < ClInclude Include = " $ ( SolutionDir ) \ . . \ include \ grpc \ impl \ codegen \ propagation_bits . h " / > <nl> + < ClInclude Include = " $ ( SolutionDir ) \ . . \ include \ grpc \ impl \ codegen \ slice . h " / > <nl> + < ClInclude Include = " $ ( SolutionDir ) \ . . \ include \ grpc \ impl \ codegen \ status . h " / > <nl> + < ClInclude Include = " $ ( SolutionDir ) \ . . \ include \ grpc \ impl \ codegen \ atm . h " / > <nl> + < ClInclude Include = " $ ( SolutionDir ) \ . . \ include \ grpc \ impl \ codegen \ atm_gcc_atomic . h " / > <nl> + < ClInclude Include = " $ ( SolutionDir ) \ . . \ include \ grpc \ impl \ codegen \ atm_gcc_sync . h " / > <nl> + < ClInclude Include = " $ ( SolutionDir ) \ . . \ include \ grpc \ impl \ codegen \ atm_windows . h " / > <nl> + < ClInclude Include = " $ ( SolutionDir ) \ . . \ include \ grpc \ impl \ codegen \ gpr_slice . h " / > <nl> + < ClInclude Include = " $ ( SolutionDir ) \ . . \ include \ grpc \ impl \ codegen \ gpr_types . h " / > <nl> + < ClInclude Include = " $ ( SolutionDir ) \ . . \ include \ grpc \ impl \ codegen \ port_platform . h " / > <nl> + < ClInclude Include = " $ ( SolutionDir ) \ . . \ include \ grpc \ impl \ codegen \ sync . h " / > <nl> + < ClInclude Include = " $ ( SolutionDir ) \ . . \ include \ grpc \ impl \ codegen \ sync_generic . h " / > <nl> + < ClInclude Include = " $ ( SolutionDir ) \ . . \ include \ grpc \ impl \ codegen \ sync_posix . h " / > <nl> + < ClInclude Include = " $ ( SolutionDir ) \ . . \ include \ grpc \ impl \ codegen \ sync_windows . h " / > <nl> + < ClInclude Include = " $ ( SolutionDir ) \ . . \ include \ grpc + + \ impl \ codegen \ proto_utils . h " / > <nl> + < ClInclude Include = " $ ( SolutionDir ) \ . . \ include \ grpc + + \ impl \ codegen \ config_protobuf . h " / > <nl> + < / ItemGroup > <nl> + < ItemGroup > <nl> + < ClInclude Include = " $ ( SolutionDir ) \ . . \ test \ cpp \ end2end \ test_service_impl . h " / > <nl> + < ClInclude Include = " $ ( SolutionDir ) \ . . \ test \ cpp \ util \ byte_buffer_proto_helper . h " / > <nl> + < ClInclude Include = " $ ( SolutionDir ) \ . . \ test \ cpp \ util \ string_ref_helper . h " / > <nl> + < ClInclude Include = " $ ( SolutionDir ) \ . . \ test \ cpp \ util \ subprocess . h " / > <nl> + < / ItemGroup > <nl> + < ItemGroup > <nl> + < ClCompile Include = " $ ( SolutionDir ) \ . . \ src \ proto \ grpc \ health \ v1 \ health . pb . cc " > <nl> + < / ClCompile > <nl> + < ClInclude Include = " $ ( SolutionDir ) \ . . \ src \ proto \ grpc \ health \ v1 \ health . pb . h " > <nl> + < / ClInclude > <nl> + < ClCompile Include = " $ ( SolutionDir ) \ . . \ src \ proto \ grpc \ health \ v1 \ health . grpc . pb . cc " > <nl> + < / ClCompile > <nl> + < ClInclude Include = " $ ( SolutionDir ) \ . . \ src \ proto \ grpc \ health \ v1 \ health . grpc . pb . h " > <nl> + < / ClInclude > <nl> + < ClCompile Include = " $ ( SolutionDir ) \ . . \ src \ proto \ grpc \ testing \ echo_messages . pb . cc " > <nl> + < / ClCompile > <nl> + < ClInclude Include = " $ ( SolutionDir ) \ . . \ src \ proto \ grpc \ testing \ echo_messages . pb . h " > <nl> + < / ClInclude > <nl> + < ClCompile Include = " $ ( SolutionDir ) \ . . \ src \ proto \ grpc \ testing \ echo_messages . grpc . pb . cc " > <nl> + < / ClCompile > <nl> + < ClInclude Include = " $ ( SolutionDir ) \ . . \ src \ proto \ grpc \ testing \ echo_messages . grpc . pb . h " > <nl> + < / ClInclude > <nl> + < ClCompile Include = " $ ( SolutionDir ) \ . . \ src \ proto \ grpc \ testing \ echo . pb . cc " > <nl> + < / ClCompile > <nl> + < ClInclude Include = " $ ( SolutionDir ) \ . . \ src \ proto \ grpc \ testing \ echo . pb . h " > <nl> + < / ClInclude > <nl> + < ClCompile Include = " $ ( SolutionDir ) \ . . \ src \ proto \ grpc \ testing \ echo . grpc . pb . cc " > <nl> + < / ClCompile > <nl> + < ClInclude Include = " $ ( SolutionDir ) \ . . \ src \ proto \ grpc \ testing \ echo . grpc . pb . h " > <nl> + < / ClInclude > <nl> + < ClCompile Include = " $ ( SolutionDir ) \ . . \ src \ proto \ grpc \ testing \ duplicate \ echo_duplicate . pb . cc " > <nl> + < / ClCompile > <nl> + < ClInclude Include = " $ ( SolutionDir ) \ . . \ src \ proto \ grpc \ testing \ duplicate \ echo_duplicate . pb . h " > <nl> + < / ClInclude > <nl> + < ClCompile Include = " $ ( SolutionDir ) \ . . \ src \ proto \ grpc \ testing \ duplicate \ echo_duplicate . grpc . pb . cc " > <nl> + < / ClCompile > <nl> + < ClInclude Include = " $ ( SolutionDir ) \ . . \ src \ proto \ grpc \ testing \ duplicate \ echo_duplicate . grpc . pb . h " > <nl> + < / ClInclude > <nl> + < ClCompile Include = " $ ( SolutionDir ) \ . . \ test \ cpp \ end2end \ test_service_impl . cc " > <nl> + < / ClCompile > <nl> + < ClCompile Include = " $ ( SolutionDir ) \ . . \ test \ cpp \ util \ byte_buffer_proto_helper . cc " > <nl> + < / ClCompile > <nl> + < ClCompile Include = " $ ( SolutionDir ) \ . . \ test \ cpp \ util \ string_ref_helper . cc " > <nl> + < / ClCompile > <nl> + < ClCompile Include = " $ ( SolutionDir ) \ . . \ test \ cpp \ util \ subprocess . cc " > <nl> + < / ClCompile > <nl> + < ClCompile Include = " $ ( SolutionDir ) \ . . \ src \ cpp \ codegen \ codegen_init . cc " > <nl> + < / ClCompile > <nl> + < / ItemGroup > <nl> + < ItemGroup > <nl> + < ProjectReference Include = " $ ( SolutionDir ) \ . . \ vsprojects \ vcxproj \ . \ grpc + + _unsecure \ grpc + + _unsecure . vcxproj " > <nl> + < Project > { 6EE56155 - DF7C - 4F6E - BFC4 - F6F776BEB211 } < / Project > <nl> + < / ProjectReference > <nl> + < ProjectReference Include = " $ ( SolutionDir ) \ . . \ vsprojects \ vcxproj \ . \ grpc_test_util_unsecure \ grpc_test_util_unsecure . vcxproj " > <nl> + < Project > { 0A7E7F92 - FDEA - 40F1 - A9EC - 3BA484F98BBF } < / Project > <nl> + < / ProjectReference > <nl> + < ProjectReference Include = " $ ( SolutionDir ) \ . . \ vsprojects \ vcxproj \ . \ grpc_unsecure \ grpc_unsecure . vcxproj " > <nl> + < Project > { 46CEDFFF - 9692 - 456A - AA24 - 38B5D6BCF4C5 } < / Project > <nl> + < / ProjectReference > <nl> + < / ItemGroup > <nl> + < Import Project = " $ ( VCTargetsPath ) \ Microsoft . Cpp . targets " / > <nl> + < ImportGroup Label = " ExtensionTargets " > <nl> + < / ImportGroup > <nl> + < Target Name = " EnsureNuGetPackageBuildImports " BeforeTargets = " PrepareForBuild " > <nl> + < PropertyGroup > <nl> + < ErrorText > This project references NuGet package ( s ) that are missing on this computer . Enable NuGet Package Restore to download them . For more information , see http : / / go . microsoft . com / fwlink / ? LinkID = 322105 . The missing file is { 0 } . < / ErrorText > <nl> + < / PropertyGroup > <nl> + < / Target > <nl> + < / Project > <nl> + <nl> new file mode 100644 <nl> index 00000000000 . . b39f96f466e <nl> mmm / dev / null <nl> ppp b / vsprojects / vcxproj / grpc + + _test_util_unsecure / grpc + + _test_util_unsecure . vcxproj . filters <nl> <nl> + < ? xml version = " 1 . 0 " encoding = " utf - 8 " ? > <nl> + < Project ToolsVersion = " 4 . 0 " xmlns = " http : / / schemas . microsoft . com / developer / msbuild / 2003 " > <nl> + < ItemGroup > <nl> + < ClCompile Include = " $ ( SolutionDir ) \ . . \ src \ proto \ grpc \ health \ v1 \ health . proto " > <nl> + < Filter > src \ proto \ grpc \ health \ v1 < / Filter > <nl> + < / ClCompile > <nl> + < ClCompile Include = " $ ( SolutionDir ) \ . . \ src \ proto \ grpc \ testing \ echo_messages . proto " > <nl> + < Filter > src \ proto \ grpc \ testing < / Filter > <nl> + < / ClCompile > <nl> + < ClCompile Include = " $ ( SolutionDir ) \ . . \ src \ proto \ grpc \ testing \ echo . proto " > <nl> + < Filter > src \ proto \ grpc \ testing < / Filter > <nl> + < / ClCompile > <nl> + < ClCompile Include = " $ ( SolutionDir ) \ . . \ src \ proto \ grpc \ testing \ duplicate \ echo_duplicate . proto " > <nl> + < Filter > src \ proto \ grpc \ testing \ duplicate < / Filter > <nl> + < / ClCompile > <nl> + < ClCompile Include = " $ ( SolutionDir ) \ . . \ test \ cpp \ end2end \ test_service_impl . cc " > <nl> + < Filter > test \ cpp \ end2end < / Filter > <nl> + < / ClCompile > <nl> + < ClCompile Include = " $ ( SolutionDir ) \ . . \ test \ cpp \ util \ byte_buffer_proto_helper . cc " > <nl> + < Filter > test \ cpp \ util < / Filter > <nl> + < / ClCompile > <nl> + < ClCompile Include = " $ ( SolutionDir ) \ . . \ test \ cpp \ util \ string_ref_helper . cc " > <nl> + < Filter > test \ cpp \ util < / Filter > <nl> + < / ClCompile > <nl> + < ClCompile Include = " $ ( SolutionDir ) \ . . \ test \ cpp \ util \ subprocess . cc " > <nl> + < Filter > test \ cpp \ util < / Filter > <nl> + < / ClCompile > <nl> + < ClCompile Include = " $ ( SolutionDir ) \ . . \ src \ cpp \ codegen \ codegen_init . cc " > <nl> + < Filter > src \ cpp \ codegen < / Filter > <nl> + < / ClCompile > <nl> + < / ItemGroup > <nl> + < ItemGroup > <nl> + < ClInclude Include = " $ ( SolutionDir ) \ . . \ include \ grpc + + \ impl \ codegen \ async_stream . h " > <nl> + < Filter > include \ grpc + + \ impl \ codegen < / Filter > <nl> + < / ClInclude > <nl> + < ClInclude Include = " $ ( SolutionDir ) \ . . \ include \ grpc + + \ impl \ codegen \ async_unary_call . h " > <nl> + < Filter > include \ grpc + + \ impl \ codegen < / Filter > <nl> + < / ClInclude > <nl> + < ClInclude Include = " $ ( SolutionDir ) \ . . \ include \ grpc + + \ impl \ codegen \ call . h " > <nl> + < Filter > include \ grpc + + \ impl \ codegen < / Filter > <nl> + < / ClInclude > <nl> + < ClInclude Include = " $ ( SolutionDir ) \ . . \ include \ grpc + + \ impl \ codegen \ call_hook . h " > <nl> + < Filter > include \ grpc + + \ impl \ codegen < / Filter > <nl> + < / ClInclude > <nl> + < ClInclude Include = " $ ( SolutionDir ) \ . . \ include \ grpc + + \ impl \ codegen \ channel_interface . h " > <nl> + < Filter > include \ grpc + + \ impl \ codegen < / Filter > <nl> + < / ClInclude > <nl> + < ClInclude Include = " $ ( SolutionDir ) \ . . \ include \ grpc + + \ impl \ codegen \ client_context . h " > <nl> + < Filter > include \ grpc + + \ impl \ codegen < / Filter > <nl> + < / ClInclude > <nl> + < ClInclude Include = " $ ( SolutionDir ) \ . . \ include \ grpc + + \ impl \ codegen \ client_unary_call . h " > <nl> + < Filter > include \ grpc + + \ impl \ codegen < / Filter > <nl> + < / ClInclude > <nl> + < ClInclude Include = " $ ( SolutionDir ) \ . . \ include \ grpc + + \ impl \ codegen \ completion_queue . h " > <nl> + < Filter > include \ grpc + + \ impl \ codegen < / Filter > <nl> + < / ClInclude > <nl> + < ClInclude Include = " $ ( SolutionDir ) \ . . \ include \ grpc + + \ impl \ codegen \ completion_queue_tag . h " > <nl> + < Filter > include \ grpc + + \ impl \ codegen < / Filter > <nl> + < / ClInclude > <nl> + < ClInclude Include = " $ ( SolutionDir ) \ . . \ include \ grpc + + \ impl \ codegen \ config . h " > <nl> + < Filter > include \ grpc + + \ impl \ codegen < / Filter > <nl> + < / ClInclude > <nl> + < ClInclude Include = " $ ( SolutionDir ) \ . . \ include \ grpc + + \ impl \ codegen \ core_codegen_interface . h " > <nl> + < Filter > include \ grpc + + \ impl \ codegen < / Filter > <nl> + < / ClInclude > <nl> + < ClInclude Include = " $ ( SolutionDir ) \ . . \ include \ grpc + + \ impl \ codegen \ create_auth_context . h " > <nl> + < Filter > include \ grpc + + \ impl \ codegen < / Filter > <nl> + < / ClInclude > <nl> + < ClInclude Include = " $ ( SolutionDir ) \ . . \ include \ grpc + + \ impl \ codegen \ grpc_library . h " > <nl> + < Filter > include \ grpc + + \ impl \ codegen < / Filter > <nl> + < / ClInclude > <nl> + < ClInclude Include = " $ ( SolutionDir ) \ . . \ include \ grpc + + \ impl \ codegen \ metadata_map . h " > <nl> + < Filter > include \ grpc + + \ impl \ codegen < / Filter > <nl> + < / ClInclude > <nl> + < ClInclude Include = " $ ( SolutionDir ) \ . . \ include \ grpc + + \ impl \ codegen \ method_handler_impl . h " > <nl> + < Filter > include \ grpc + + \ impl \ codegen < / Filter > <nl> + < / ClInclude > <nl> + < ClInclude Include = " $ ( SolutionDir ) \ . . \ include \ grpc + + \ impl \ codegen \ rpc_method . h " > <nl> + < Filter > include \ grpc + + \ impl \ codegen < / Filter > <nl> + < / ClInclude > <nl> + < ClInclude Include = " $ ( SolutionDir ) \ . . \ include \ grpc + + \ impl \ codegen \ rpc_service_method . h " > <nl> + < Filter > include \ grpc + + \ impl \ codegen < / Filter > <nl> + < / ClInclude > <nl> + < ClInclude Include = " $ ( SolutionDir ) \ . . \ include \ grpc + + \ impl \ codegen \ security \ auth_context . h " > <nl> + < Filter > include \ grpc + + \ impl \ codegen \ security < / Filter > <nl> + < / ClInclude > <nl> + < ClInclude Include = " $ ( SolutionDir ) \ . . \ include \ grpc + + \ impl \ codegen \ serialization_traits . h " > <nl> + < Filter > include \ grpc + + \ impl \ codegen < / Filter > <nl> + < / ClInclude > <nl> + < ClInclude Include = " $ ( SolutionDir ) \ . . \ include \ grpc + + \ impl \ codegen \ server_context . h " > <nl> + < Filter > include \ grpc + + \ impl \ codegen < / Filter > <nl> + < / ClInclude > <nl> + < ClInclude Include = " $ ( SolutionDir ) \ . . \ include \ grpc + + \ impl \ codegen \ server_interface . h " > <nl> + < Filter > include \ grpc + + \ impl \ codegen < / Filter > <nl> + < / ClInclude > <nl> + < ClInclude Include = " $ ( SolutionDir ) \ . . \ include \ grpc + + \ impl \ codegen \ service_type . h " > <nl> + < Filter > include \ grpc + + \ impl \ codegen < / Filter > <nl> + < / ClInclude > <nl> + < ClInclude Include = " $ ( SolutionDir ) \ . . \ include \ grpc + + \ impl \ codegen \ slice . h " > <nl> + < Filter > include \ grpc + + \ impl \ codegen < / Filter > <nl> + < / ClInclude > <nl> + < ClInclude Include = " $ ( SolutionDir ) \ . . \ include \ grpc + + \ impl \ codegen \ status . h " > <nl> + < Filter > include \ grpc + + \ impl \ codegen < / Filter > <nl> + < / ClInclude > <nl> + < ClInclude Include = " $ ( SolutionDir ) \ . . \ include \ grpc + + \ impl \ codegen \ status_code_enum . h " > <nl> + < Filter > include \ grpc + + \ impl \ codegen < / Filter > <nl> + < / ClInclude > <nl> + < ClInclude Include = " $ ( SolutionDir ) \ . . \ include \ grpc + + \ impl \ codegen \ string_ref . h " > <nl> + < Filter > include \ grpc + + \ impl \ codegen < / Filter > <nl> + < / ClInclude > <nl> + < ClInclude Include = " $ ( SolutionDir ) \ . . \ include \ grpc + + \ impl \ codegen \ stub_options . h " > <nl> + < Filter > include \ grpc + + \ impl \ codegen < / Filter > <nl> + < / ClInclude > <nl> + < ClInclude Include = " $ ( SolutionDir ) \ . . \ include \ grpc + + \ impl \ codegen \ sync_stream . h " > <nl> + < Filter > include \ grpc + + \ impl \ codegen < / Filter > <nl> + < / ClInclude > <nl> + < ClInclude Include = " $ ( SolutionDir ) \ . . \ include \ grpc + + \ impl \ codegen \ time . h " > <nl> + < Filter > include \ grpc + + \ impl \ codegen < / Filter > <nl> + < / ClInclude > <nl> + < ClInclude Include = " $ ( SolutionDir ) \ . . \ include \ grpc \ impl \ codegen \ byte_buffer_reader . h " > <nl> + < Filter > include \ grpc \ impl \ codegen < / Filter > <nl> + < / ClInclude > <nl> + < ClInclude Include = " $ ( SolutionDir ) \ . . \ include \ grpc \ impl \ codegen \ compression_types . h " > <nl> + < Filter > include \ grpc \ impl \ codegen < / Filter > <nl> + < / ClInclude > <nl> + < ClInclude Include = " $ ( SolutionDir ) \ . . \ include \ grpc \ impl \ codegen \ connectivity_state . h " > <nl> + < Filter > include \ grpc \ impl \ codegen < / Filter > <nl> + < / ClInclude > <nl> + < ClInclude Include = " $ ( SolutionDir ) \ . . \ include \ grpc \ impl \ codegen \ exec_ctx_fwd . h " > <nl> + < Filter > include \ grpc \ impl \ codegen < / Filter > <nl> + < / ClInclude > <nl> + < ClInclude Include = " $ ( SolutionDir ) \ . . \ include \ grpc \ impl \ codegen \ grpc_types . h " > <nl> + < Filter > include \ grpc \ impl \ codegen < / Filter > <nl> + < / ClInclude > <nl> + < ClInclude Include = " $ ( SolutionDir ) \ . . \ include \ grpc \ impl \ codegen \ propagation_bits . h " > <nl> + < Filter > include \ grpc \ impl \ codegen < / Filter > <nl> + < / ClInclude > <nl> + < ClInclude Include = " $ ( SolutionDir ) \ . . \ include \ grpc \ impl \ codegen \ slice . h " > <nl> + < Filter > include \ grpc \ impl \ codegen < / Filter > <nl> + < / ClInclude > <nl> + < ClInclude Include = " $ ( SolutionDir ) \ . . \ include \ grpc \ impl \ codegen \ status . h " > <nl> + < Filter > include \ grpc \ impl \ codegen < / Filter > <nl> + < / ClInclude > <nl> + < ClInclude Include = " $ ( SolutionDir ) \ . . \ include \ grpc \ impl \ codegen \ atm . h " > <nl> + < Filter > include \ grpc \ impl \ codegen < / Filter > <nl> + < / ClInclude > <nl> + < ClInclude Include = " $ ( SolutionDir ) \ . . \ include \ grpc \ impl \ codegen \ atm_gcc_atomic . h " > <nl> + < Filter > include \ grpc \ impl \ codegen < / Filter > <nl> + < / ClInclude > <nl> + < ClInclude Include = " $ ( SolutionDir ) \ . . \ include \ grpc \ impl \ codegen \ atm_gcc_sync . h " > <nl> + < Filter > include \ grpc \ impl \ codegen < / Filter > <nl> + < / ClInclude > <nl> + < ClInclude Include = " $ ( SolutionDir ) \ . . \ include \ grpc \ impl \ codegen \ atm_windows . h " > <nl> + < Filter > include \ grpc \ impl \ codegen < / Filter > <nl> + < / ClInclude > <nl> + < ClInclude Include = " $ ( SolutionDir ) \ . . \ include \ grpc \ impl \ codegen \ gpr_slice . h " > <nl> + < Filter > include \ grpc \ impl \ codegen < / Filter > <nl> + < / ClInclude > <nl> + < ClInclude Include = " $ ( SolutionDir ) \ . . \ include \ grpc \ impl \ codegen \ gpr_types . h " > <nl> + < Filter > include \ grpc \ impl \ codegen < / Filter > <nl> + < / ClInclude > <nl> + < ClInclude Include = " $ ( SolutionDir ) \ . . \ include \ grpc \ impl \ codegen \ port_platform . h " > <nl> + < Filter > include \ grpc \ impl \ codegen < / Filter > <nl> + < / ClInclude > <nl> + < ClInclude Include = " $ ( SolutionDir ) \ . . \ include \ grpc \ impl \ codegen \ sync . h " > <nl> + < Filter > include \ grpc \ impl \ codegen < / Filter > <nl> + < / ClInclude > <nl> + < ClInclude Include = " $ ( SolutionDir ) \ . . \ include \ grpc \ impl \ codegen \ sync_generic . h " > <nl> + < Filter > include \ grpc \ impl \ codegen < / Filter > <nl> + < / ClInclude > <nl> + < ClInclude Include = " $ ( SolutionDir ) \ . . \ include \ grpc \ impl \ codegen \ sync_posix . h " > <nl> + < Filter > include \ grpc \ impl \ codegen < / Filter > <nl> + < / ClInclude > <nl> + < ClInclude Include = " $ ( SolutionDir ) \ . . \ include \ grpc \ impl \ codegen \ sync_windows . h " > <nl> + < Filter > include \ grpc \ impl \ codegen < / Filter > <nl> + < / ClInclude > <nl> + < ClInclude Include = " $ ( SolutionDir ) \ . . \ include \ grpc + + \ impl \ codegen \ proto_utils . h " > <nl> + < Filter > include \ grpc + + \ impl \ codegen < / Filter > <nl> + < / ClInclude > <nl> + < ClInclude Include = " $ ( SolutionDir ) \ . . \ include \ grpc + + \ impl \ codegen \ config_protobuf . h " > <nl> + < Filter > include \ grpc + + \ impl \ codegen < / Filter > <nl> + < / ClInclude > <nl> + < / ItemGroup > <nl> + < ItemGroup > <nl> + < ClInclude Include = " $ ( SolutionDir ) \ . . \ test \ cpp \ end2end \ test_service_impl . h " > <nl> + < Filter > test \ cpp \ end2end < / Filter > <nl> + < / ClInclude > <nl> + < ClInclude Include = " $ ( SolutionDir ) \ . . \ test \ cpp \ util \ byte_buffer_proto_helper . h " > <nl> + < Filter > test \ cpp \ util < / Filter > <nl> + < / ClInclude > <nl> + < ClInclude Include = " $ ( SolutionDir ) \ . . \ test \ cpp \ util \ string_ref_helper . h " > <nl> + < Filter > test \ cpp \ util < / Filter > <nl> + < / ClInclude > <nl> + < ClInclude Include = " $ ( SolutionDir ) \ . . \ test \ cpp \ util \ subprocess . h " > <nl> + < Filter > test \ cpp \ util < / Filter > <nl> + < / ClInclude > <nl> + < / ItemGroup > <nl> + <nl> + < ItemGroup > <nl> + < Filter Include = " include " > <nl> + < UniqueIdentifier > { 781a1608 - 4ec4 - 84b1 - fd7e - e57adad0005d } < / UniqueIdentifier > <nl> + < / Filter > <nl> + < Filter Include = " include \ grpc " > <nl> + < UniqueIdentifier > { da1ebc2d - b558 - bdc0 - 9541 - c9f819d11c04 } < / UniqueIdentifier > <nl> + < / Filter > <nl> + < Filter Include = " include \ grpc + + " > <nl> + < UniqueIdentifier > { a39a48c0 - c9a5 - 3604 - e938 - 802c36d53216 } < / UniqueIdentifier > <nl> + < / Filter > <nl> + < Filter Include = " include \ grpc + + \ impl " > <nl> + < UniqueIdentifier > { 1fdb8853 - a861 - f8e3 - fa1c - 0543fa78879f } < / UniqueIdentifier > <nl> + < / Filter > <nl> + < Filter Include = " include \ grpc + + \ impl \ codegen " > <nl> + < UniqueIdentifier > { 2546f4ae - 8381 - e6a9 - ddac - 41d12c404b5f } < / UniqueIdentifier > <nl> + < / Filter > <nl> + < Filter Include = " include \ grpc + + \ impl \ codegen \ security " > <nl> + < UniqueIdentifier > { f3b5631d - 4a82 - 0785 - 9358 - cf5062293391 } < / UniqueIdentifier > <nl> + < / Filter > <nl> + < Filter Include = " include \ grpc \ impl " > <nl> + < UniqueIdentifier > { 19f6c9d1 - 1185 - a5de - 881e - 5224d1058d5e } < / UniqueIdentifier > <nl> + < / Filter > <nl> + < Filter Include = " include \ grpc \ impl \ codegen " > <nl> + < UniqueIdentifier > { 967583b5 - ee23 - 687f - 2474 - 520655e0be4a } < / UniqueIdentifier > <nl> + < / Filter > <nl> + < Filter Include = " src " > <nl> + < UniqueIdentifier > { 391a84b9 - 78a5 - 9954 - e923 - f8d055b3481b } < / UniqueIdentifier > <nl> + < / Filter > <nl> + < Filter Include = " src \ cpp " > <nl> + < UniqueIdentifier > { 4062f6b9 - f1ff - 68e8 - 72bc - 30277514b0ee } < / UniqueIdentifier > <nl> + < / Filter > <nl> + < Filter Include = " src \ cpp \ codegen " > <nl> + < UniqueIdentifier > { 8a7e7d59 - 50b8 - 04bf - e9c7 - 67ebf0021873 } < / UniqueIdentifier > <nl> + < / Filter > <nl> + < Filter Include = " src \ proto " > <nl> + < UniqueIdentifier > { 1b71252d - 1742 - e9be - 64f9 - 562af348bafd } < / UniqueIdentifier > <nl> + < / Filter > <nl> + < Filter Include = " src \ proto \ grpc " > <nl> + < UniqueIdentifier > { ce9a06e6 - fe2f - f9fa - 03ae - 0e39e730c312 } < / UniqueIdentifier > <nl> + < / Filter > <nl> + < Filter Include = " src \ proto \ grpc \ health " > <nl> + < UniqueIdentifier > { 471fdb3b - 4dc0 - 4a35 - 3667 - 22e9f857db8e } < / UniqueIdentifier > <nl> + < / Filter > <nl> + < Filter Include = " src \ proto \ grpc \ health \ v1 " > <nl> + < UniqueIdentifier > { 7e63feec - 8f56 - cd35 - b7d6 - 73db98dbdde2 } < / UniqueIdentifier > <nl> + < / Filter > <nl> + < Filter Include = " src \ proto \ grpc \ testing " > <nl> + < UniqueIdentifier > { 4ffb2a33 - 1a46 - 184c - 555e - be927e3747fd } < / UniqueIdentifier > <nl> + < / Filter > <nl> + < Filter Include = " src \ proto \ grpc \ testing \ duplicate " > <nl> + < UniqueIdentifier > { 2bc8042f - 43c5 - 737c - 4d52 - 553402259478 } < / UniqueIdentifier > <nl> + < / Filter > <nl> + < Filter Include = " test " > <nl> + < UniqueIdentifier > { 9d840e55 - 92ac - 10af - 2ac1 - 9c0af3b05a5c } < / UniqueIdentifier > <nl> + < / Filter > <nl> + < Filter Include = " test \ cpp " > <nl> + < UniqueIdentifier > { 2668f96a - 1d73 - d007 - 92ff - 9b50e2fba1b0 } < / UniqueIdentifier > <nl> + < / Filter > <nl> + < Filter Include = " test \ cpp \ end2end " > <nl> + < UniqueIdentifier > { 63c12fd2 - 9e66 - f7b8 - 1eec - 951e7d48e343 } < / UniqueIdentifier > <nl> + < / Filter > <nl> + < Filter Include = " test \ cpp \ util " > <nl> + < UniqueIdentifier > { e08c5a81 - 5645 - f71c - 59ab - 98d2f3e41417 } < / UniqueIdentifier > <nl> + < / Filter > <nl> + < / ItemGroup > <nl> + < / Project > <nl> + <nl> mmm a / vsprojects / vcxproj / grpc_test_util / grpc_test_util . vcxproj <nl> ppp b / vsprojects / vcxproj / grpc_test_util / grpc_test_util . vcxproj <nl> <nl> < ClInclude Include = " $ ( SolutionDir ) \ . . \ test \ core \ util \ port_server_client . h " / > <nl> < ClInclude Include = " $ ( SolutionDir ) \ . . \ test \ core \ util \ slice_splitter . h " / > <nl> < ClInclude Include = " $ ( SolutionDir ) \ . . \ test \ core \ util \ trickle_endpoint . h " / > <nl> + < ClInclude Include = " $ ( SolutionDir ) \ . . \ src \ core \ ext \ filters \ client_channel \ client_channel . h " / > <nl> + < ClInclude Include = " $ ( SolutionDir ) \ . . \ src \ core \ ext \ filters \ client_channel \ client_channel_factory . h " / > <nl> + < ClInclude Include = " $ ( SolutionDir ) \ . . \ src \ core \ ext \ filters \ client_channel \ connector . h " / > <nl> + < ClInclude Include = " $ ( SolutionDir ) \ . . \ src \ core \ ext \ filters \ client_channel \ http_connect_handshaker . h " / > <nl> + < ClInclude Include = " $ ( SolutionDir ) \ . . \ src \ core \ ext \ filters \ client_channel \ http_proxy . h " / > <nl> + < ClInclude Include = " $ ( SolutionDir ) \ . . \ src \ core \ ext \ filters \ client_channel \ lb_policy . h " / > <nl> + < ClInclude Include = " $ ( SolutionDir ) \ . . \ src \ core \ ext \ filters \ client_channel \ lb_policy_factory . h " / > <nl> + < ClInclude Include = " $ ( SolutionDir ) \ . . \ src \ core \ ext \ filters \ client_channel \ lb_policy_registry . h " / > <nl> + < ClInclude Include = " $ ( SolutionDir ) \ . . \ src \ core \ ext \ filters \ client_channel \ parse_address . h " / > <nl> + < ClInclude Include = " $ ( SolutionDir ) \ . . \ src \ core \ ext \ filters \ client_channel \ proxy_mapper . h " / > <nl> + < ClInclude Include = " $ ( SolutionDir ) \ . . \ src \ core \ ext \ filters \ client_channel \ proxy_mapper_registry . h " / > <nl> + < ClInclude Include = " $ ( SolutionDir ) \ . . \ src \ core \ ext \ filters \ client_channel \ resolver . h " / > <nl> + < ClInclude Include = " $ ( SolutionDir ) \ . . \ src \ core \ ext \ filters \ client_channel \ resolver_factory . h " / > <nl> + < ClInclude Include = " $ ( SolutionDir ) \ . . \ src \ core \ ext \ filters \ client_channel \ resolver_registry . h " / > <nl> + < ClInclude Include = " $ ( SolutionDir ) \ . . \ src \ core \ ext \ filters \ client_channel \ retry_throttle . h " / > <nl> + < ClInclude Include = " $ ( SolutionDir ) \ . . \ src \ core \ ext \ filters \ client_channel \ subchannel . h " / > <nl> + < ClInclude Include = " $ ( SolutionDir ) \ . . \ src \ core \ ext \ filters \ client_channel \ subchannel_index . h " / > <nl> + < ClInclude Include = " $ ( SolutionDir ) \ . . \ src \ core \ ext \ filters \ client_channel \ uri_parser . h " / > <nl> + < ClInclude Include = " $ ( SolutionDir ) \ . . \ src \ core \ ext \ filters \ deadline \ deadline_filter . h " / > <nl> + < ClInclude Include = " $ ( SolutionDir ) \ . . \ src \ core \ ext \ transport \ chttp2 \ transport \ bin_decoder . h " / > <nl> + < ClInclude Include = " $ ( SolutionDir ) \ . . \ src \ core \ ext \ transport \ chttp2 \ transport \ bin_encoder . h " / > <nl> + < ClInclude Include = " $ ( SolutionDir ) \ . . \ src \ core \ ext \ transport \ chttp2 \ transport \ chttp2_transport . h " / > <nl> + < ClInclude Include = " $ ( SolutionDir ) \ . . \ src \ core \ ext \ transport \ chttp2 \ transport \ frame . h " / > <nl> + < ClInclude Include = " $ ( SolutionDir ) \ . . \ src \ core \ ext \ transport \ chttp2 \ transport \ frame_data . h " / > <nl> + < ClInclude Include = " $ ( SolutionDir ) \ . . \ src \ core \ ext \ transport \ chttp2 \ transport \ frame_goaway . h " / > <nl> + < ClInclude Include = " $ ( SolutionDir ) \ . . \ src \ core \ ext \ transport \ chttp2 \ transport \ frame_ping . h " / > <nl> + < ClInclude Include = " $ ( SolutionDir ) \ . . \ src \ core \ ext \ transport \ chttp2 \ transport \ frame_rst_stream . h " / > <nl> + < ClInclude Include = " $ ( SolutionDir ) \ . . \ src \ core \ ext \ transport \ chttp2 \ transport \ frame_settings . h " / > <nl> + < ClInclude Include = " $ ( SolutionDir ) \ . . \ src \ core \ ext \ transport \ chttp2 \ transport \ frame_window_update . h " / > <nl> + < ClInclude Include = " $ ( SolutionDir ) \ . . \ src \ core \ ext \ transport \ chttp2 \ transport \ hpack_encoder . h " / > <nl> + < ClInclude Include = " $ ( SolutionDir ) \ . . \ src \ core \ ext \ transport \ chttp2 \ transport \ hpack_parser . h " / > <nl> + < ClInclude Include = " $ ( SolutionDir ) \ . . \ src \ core \ ext \ transport \ chttp2 \ transport \ hpack_table . h " / > <nl> + < ClInclude Include = " $ ( SolutionDir ) \ . . \ src \ core \ ext \ transport \ chttp2 \ transport \ http2_settings . h " / > <nl> + < ClInclude Include = " $ ( SolutionDir ) \ . . \ src \ core \ ext \ transport \ chttp2 \ transport \ huffsyms . h " / > <nl> + < ClInclude Include = " $ ( SolutionDir ) \ . . \ src \ core \ ext \ transport \ chttp2 \ transport \ incoming_metadata . h " / > <nl> + < ClInclude Include = " $ ( SolutionDir ) \ . . \ src \ core \ ext \ transport \ chttp2 \ transport \ internal . h " / > <nl> + < ClInclude Include = " $ ( SolutionDir ) \ . . \ src \ core \ ext \ transport \ chttp2 \ transport \ stream_map . h " / > <nl> + < ClInclude Include = " $ ( SolutionDir ) \ . . \ src \ core \ ext \ transport \ chttp2 \ transport \ varint . h " / > <nl> + < ClInclude Include = " $ ( SolutionDir ) \ . . \ src \ core \ ext \ transport \ chttp2 \ alpn \ alpn . h " / > <nl> + < ClInclude Include = " $ ( SolutionDir ) \ . . \ src \ core \ ext \ filters \ http \ client \ http_client_filter . h " / > <nl> + < ClInclude Include = " $ ( SolutionDir ) \ . . \ src \ core \ ext \ filters \ http \ message_compress \ message_compress_filter . h " / > <nl> + < ClInclude Include = " $ ( SolutionDir ) \ . . \ src \ core \ ext \ filters \ http \ server \ http_server_filter . h " / > <nl> < / ItemGroup > <nl> < ItemGroup > <nl> < ClCompile Include = " $ ( SolutionDir ) \ . . \ test \ core \ end2end \ data \ client_certs . c " > <nl> <nl> < / ClCompile > <nl> < ClCompile Include = " $ ( SolutionDir ) \ . . \ src \ core \ lib \ debug \ trace . c " > <nl> < / ClCompile > <nl> + < ClCompile Include = " $ ( SolutionDir ) \ . . \ src \ core \ ext \ filters \ client_channel \ channel_connectivity . c " > <nl> + < / ClCompile > <nl> + < ClCompile Include = " $ ( SolutionDir ) \ . . \ src \ core \ ext \ filters \ client_channel \ client_channel . c " > <nl> + < / ClCompile > <nl> + < ClCompile Include = " $ ( SolutionDir ) \ . . \ src \ core \ ext \ filters \ client_channel \ client_channel_factory . c " > <nl> + < / ClCompile > <nl> + < ClCompile Include = " $ ( SolutionDir ) \ . . \ src \ core \ ext \ filters \ client_channel \ client_channel_plugin . c " > <nl> + < / ClCompile > <nl> + < ClCompile Include = " $ ( SolutionDir ) \ . . \ src \ core \ ext \ filters \ client_channel \ connector . c " > <nl> + < / ClCompile > <nl> + < ClCompile Include = " $ ( SolutionDir ) \ . . \ src \ core \ ext \ filters \ client_channel \ http_connect_handshaker . c " > <nl> + < / ClCompile > <nl> + < ClCompile Include = " $ ( SolutionDir ) \ . . \ src \ core \ ext \ filters \ client_channel \ http_proxy . c " > <nl> + < / ClCompile > <nl> + < ClCompile Include = " $ ( SolutionDir ) \ . . \ src \ core \ ext \ filters \ client_channel \ lb_policy . c " > <nl> + < / ClCompile > <nl> + < ClCompile Include = " $ ( SolutionDir ) \ . . \ src \ core \ ext \ filters \ client_channel \ lb_policy_factory . c " > <nl> + < / ClCompile > <nl> + < ClCompile Include = " $ ( SolutionDir ) \ . . \ src \ core \ ext \ filters \ client_channel \ lb_policy_registry . c " > <nl> + < / ClCompile > <nl> + < ClCompile Include = " $ ( SolutionDir ) \ . . \ src \ core \ ext \ filters \ client_channel \ parse_address . c " > <nl> + < / ClCompile > <nl> + < ClCompile Include = " $ ( SolutionDir ) \ . . \ src \ core \ ext \ filters \ client_channel \ proxy_mapper . c " > <nl> + < / ClCompile > <nl> + < ClCompile Include = " $ ( SolutionDir ) \ . . \ src \ core \ ext \ filters \ client_channel \ proxy_mapper_registry . c " > <nl> + < / ClCompile > <nl> + < ClCompile Include = " $ ( SolutionDir ) \ . . \ src \ core \ ext \ filters \ client_channel \ resolver . c " > <nl> + < / ClCompile > <nl> + < ClCompile Include = " $ ( SolutionDir ) \ . . \ src \ core \ ext \ filters \ client_channel \ resolver_factory . c " > <nl> + < / ClCompile > <nl> + < ClCompile Include = " $ ( SolutionDir ) \ . . \ src \ core \ ext \ filters \ client_channel \ resolver_registry . c " > <nl> + < / ClCompile > <nl> + < ClCompile Include = " $ ( SolutionDir ) \ . . \ src \ core \ ext \ filters \ client_channel \ retry_throttle . c " > <nl> + < / ClCompile > <nl> + < ClCompile Include = " $ ( SolutionDir ) \ . . \ src \ core \ ext \ filters \ client_channel \ subchannel . c " > <nl> + < / ClCompile > <nl> + < ClCompile Include = " $ ( SolutionDir ) \ . . \ src \ core \ ext \ filters \ client_channel \ subchannel_index . c " > <nl> + < / ClCompile > <nl> + < ClCompile Include = " $ ( SolutionDir ) \ . . \ src \ core \ ext \ filters \ client_channel \ uri_parser . c " > <nl> + < / ClCompile > <nl> + < ClCompile Include = " $ ( SolutionDir ) \ . . \ src \ core \ ext \ filters \ deadline \ deadline_filter . c " > <nl> + < / ClCompile > <nl> + < ClCompile Include = " $ ( SolutionDir ) \ . . \ src \ core \ ext \ transport \ chttp2 \ transport \ bin_decoder . c " > <nl> + < / ClCompile > <nl> + < ClCompile Include = " $ ( SolutionDir ) \ . . \ src \ core \ ext \ transport \ chttp2 \ transport \ bin_encoder . c " > <nl> + < / ClCompile > <nl> + < ClCompile Include = " $ ( SolutionDir ) \ . . \ src \ core \ ext \ transport \ chttp2 \ transport \ chttp2_plugin . c " > <nl> + < / ClCompile > <nl> + < ClCompile Include = " $ ( SolutionDir ) \ . . \ src \ core \ ext \ transport \ chttp2 \ transport \ chttp2_transport . c " > <nl> + < / ClCompile > <nl> + < ClCompile Include = " $ ( SolutionDir ) \ . . \ src \ core \ ext \ transport \ chttp2 \ transport \ frame_data . c " > <nl> + < / ClCompile > <nl> + < ClCompile Include = " $ ( SolutionDir ) \ . . \ src \ core \ ext \ transport \ chttp2 \ transport \ frame_goaway . c " > <nl> + < / ClCompile > <nl> + < ClCompile Include = " $ ( SolutionDir ) \ . . \ src \ core \ ext \ transport \ chttp2 \ transport \ frame_ping . c " > <nl> + < / ClCompile > <nl> + < ClCompile Include = " $ ( SolutionDir ) \ . . \ src \ core \ ext \ transport \ chttp2 \ transport \ frame_rst_stream . c " > <nl> + < / ClCompile > <nl> + < ClCompile Include = " $ ( SolutionDir ) \ . . \ src \ core \ ext \ transport \ chttp2 \ transport \ frame_settings . c " > <nl> + < / ClCompile > <nl> + < ClCompile Include = " $ ( SolutionDir ) \ . . \ src \ core \ ext \ transport \ chttp2 \ transport \ frame_window_update . c " > <nl> + < / ClCompile > <nl> + < ClCompile Include = " $ ( SolutionDir ) \ . . \ src \ core \ ext \ transport \ chttp2 \ transport \ hpack_encoder . c " > <nl> + < / ClCompile > <nl> + < ClCompile Include = " $ ( SolutionDir ) \ . . \ src \ core \ ext \ transport \ chttp2 \ transport \ hpack_parser . c " > <nl> + < / ClCompile > <nl> + < ClCompile Include = " $ ( SolutionDir ) \ . . \ src \ core \ ext \ transport \ chttp2 \ transport \ hpack_table . c " > <nl> + < / ClCompile > <nl> + < ClCompile Include = " $ ( SolutionDir ) \ . . \ src \ core \ ext \ transport \ chttp2 \ transport \ http2_settings . c " > <nl> + < / ClCompile > <nl> + < ClCompile Include = " $ ( SolutionDir ) \ . . \ src \ core \ ext \ transport \ chttp2 \ transport \ huffsyms . c " > <nl> + < / ClCompile > <nl> + < ClCompile Include = " $ ( SolutionDir ) \ . . \ src \ core \ ext \ transport \ chttp2 \ transport \ incoming_metadata . c " > <nl> + < / ClCompile > <nl> + < ClCompile Include = " $ ( SolutionDir ) \ . . \ src \ core \ ext \ transport \ chttp2 \ transport \ parsing . c " > <nl> + < / ClCompile > <nl> + < ClCompile Include = " $ ( SolutionDir ) \ . . \ src \ core \ ext \ transport \ chttp2 \ transport \ stream_lists . c " > <nl> + < / ClCompile > <nl> + < ClCompile Include = " $ ( SolutionDir ) \ . . \ src \ core \ ext \ transport \ chttp2 \ transport \ stream_map . c " > <nl> + < / ClCompile > <nl> + < ClCompile Include = " $ ( SolutionDir ) \ . . \ src \ core \ ext \ transport \ chttp2 \ transport \ varint . c " > <nl> + < / ClCompile > <nl> + < ClCompile Include = " $ ( SolutionDir ) \ . . \ src \ core \ ext \ transport \ chttp2 \ transport \ writing . c " > <nl> + < / ClCompile > <nl> + < ClCompile Include = " $ ( SolutionDir ) \ . . \ src \ core \ ext \ transport \ chttp2 \ alpn \ alpn . c " > <nl> + < / ClCompile > <nl> + < ClCompile Include = " $ ( SolutionDir ) \ . . \ src \ core \ ext \ filters \ http \ client \ http_client_filter . c " > <nl> + < / ClCompile > <nl> + < ClCompile Include = " $ ( SolutionDir ) \ . . \ src \ core \ ext \ filters \ http \ http_filters_plugin . c " > <nl> + < / ClCompile > <nl> + < ClCompile Include = " $ ( SolutionDir ) \ . . \ src \ core \ ext \ filters \ http \ message_compress \ message_compress_filter . c " > <nl> + < / ClCompile > <nl> + < ClCompile Include = " $ ( SolutionDir ) \ . . \ src \ core \ ext \ filters \ http \ server \ http_server_filter . c " > <nl> + < / ClCompile > <nl> < / ItemGroup > <nl> < ItemGroup > <nl> < ProjectReference Include = " $ ( SolutionDir ) \ . . \ vsprojects \ vcxproj \ . \ gpr_test_util \ gpr_test_util . vcxproj " > <nl> mmm a / vsprojects / vcxproj / grpc_test_util / grpc_test_util . vcxproj . filters <nl> ppp b / vsprojects / vcxproj / grpc_test_util / grpc_test_util . vcxproj . filters <nl> <nl> < ClCompile Include = " $ ( SolutionDir ) \ . . \ src \ core \ lib \ debug \ trace . c " > <nl> < Filter > src \ core \ lib \ debug < / Filter > <nl> < / ClCompile > <nl> + < ClCompile Include = " $ ( SolutionDir ) \ . . \ src \ core \ ext \ filters \ client_channel \ channel_connectivity . c " > <nl> + < Filter > src \ core \ ext \ filters \ client_channel < / Filter > <nl> + < / ClCompile > <nl> + < ClCompile Include = " $ ( SolutionDir ) \ . . \ src \ core \ ext \ filters \ client_channel \ client_channel . c " > <nl> + < Filter > src \ core \ ext \ filters \ client_channel < / Filter > <nl> + < / ClCompile > <nl> + < ClCompile Include = " $ ( SolutionDir ) \ . . \ src \ core \ ext \ filters \ client_channel \ client_channel_factory . c " > <nl> + < Filter > src \ core \ ext \ filters \ client_channel < / Filter > <nl> + < / ClCompile > <nl> + < ClCompile Include = " $ ( SolutionDir ) \ . . \ src \ core \ ext \ filters \ client_channel \ client_channel_plugin . c " > <nl> + < Filter > src \ core \ ext \ filters \ client_channel < / Filter > <nl> + < / ClCompile > <nl> + < ClCompile Include = " $ ( SolutionDir ) \ . . \ src \ core \ ext \ filters \ client_channel \ connector . c " > <nl> + < Filter > src \ core \ ext \ filters \ client_channel < / Filter > <nl> + < / ClCompile > <nl> + < ClCompile Include = " $ ( SolutionDir ) \ . . \ src \ core \ ext \ filters \ client_channel \ http_connect_handshaker . c " > <nl> + < Filter > src \ core \ ext \ filters \ client_channel < / Filter > <nl> + < / ClCompile > <nl> + < ClCompile Include = " $ ( SolutionDir ) \ . . \ src \ core \ ext \ filters \ client_channel \ http_proxy . c " > <nl> + < Filter > src \ core \ ext \ filters \ client_channel < / Filter > <nl> + < / ClCompile > <nl> + < ClCompile Include = " $ ( SolutionDir ) \ . . \ src \ core \ ext \ filters \ client_channel \ lb_policy . c " > <nl> + < Filter > src \ core \ ext \ filters \ client_channel < / Filter > <nl> + < / ClCompile > <nl> + < ClCompile Include = " $ ( SolutionDir ) \ . . \ src \ core \ ext \ filters \ client_channel \ lb_policy_factory . c " > <nl> + < Filter > src \ core \ ext \ filters \ client_channel < / Filter > <nl> + < / ClCompile > <nl> + < ClCompile Include = " $ ( SolutionDir ) \ . . \ src \ core \ ext \ filters \ client_channel \ lb_policy_registry . c " > <nl> + < Filter > src \ core \ ext \ filters \ client_channel < / Filter > <nl> + < / ClCompile > <nl> + < ClCompile Include = " $ ( SolutionDir ) \ . . \ src \ core \ ext \ filters \ client_channel \ parse_address . c " > <nl> + < Filter > src \ core \ ext \ filters \ client_channel < / Filter > <nl> + < / ClCompile > <nl> + < ClCompile Include = " $ ( SolutionDir ) \ . . \ src \ core \ ext \ filters \ client_channel \ proxy_mapper . c " > <nl> + < Filter > src \ core \ ext \ filters \ client_channel < / Filter > <nl> + < / ClCompile > <nl> + < ClCompile Include = " $ ( SolutionDir ) \ . . \ src \ core \ ext \ filters \ client_channel \ proxy_mapper_registry . c " > <nl> + < Filter > src \ core \ ext \ filters \ client_channel < / Filter > <nl> + < / ClCompile > <nl> + < ClCompile Include = " $ ( SolutionDir ) \ . . \ src \ core \ ext \ filters \ client_channel \ resolver . c " > <nl> + < Filter > src \ core \ ext \ filters \ client_channel < / Filter > <nl> + < / ClCompile > <nl> + < ClCompile Include = " $ ( SolutionDir ) \ . . \ src \ core \ ext \ filters \ client_channel \ resolver_factory . c " > <nl> + < Filter > src \ core \ ext \ filters \ client_channel < / Filter > <nl> + < / ClCompile > <nl> + < ClCompile Include = " $ ( SolutionDir ) \ . . \ src \ core \ ext \ filters \ client_channel \ resolver_registry . c " > <nl> + < Filter > src \ core \ ext \ filters \ client_channel < / Filter > <nl> + < / ClCompile > <nl> + < ClCompile Include = " $ ( SolutionDir ) \ . . \ src \ core \ ext \ filters \ client_channel \ retry_throttle . c " > <nl> + < Filter > src \ core \ ext \ filters \ client_channel < / Filter > <nl> + < / ClCompile > <nl> + < ClCompile Include = " $ ( SolutionDir ) \ . . \ src \ core \ ext \ filters \ client_channel \ subchannel . c " > <nl> + < Filter > src \ core \ ext \ filters \ client_channel < / Filter > <nl> + < / ClCompile > <nl> + < ClCompile Include = " $ ( SolutionDir ) \ . . \ src \ core \ ext \ filters \ client_channel \ subchannel_index . c " > <nl> + < Filter > src \ core \ ext \ filters \ client_channel < / Filter > <nl> + < / ClCompile > <nl> + < ClCompile Include = " $ ( SolutionDir ) \ . . \ src \ core \ ext \ filters \ client_channel \ uri_parser . c " > <nl> + < Filter > src \ core \ ext \ filters \ client_channel < / Filter > <nl> + < / ClCompile > <nl> + < ClCompile Include = " $ ( SolutionDir ) \ . . \ src \ core \ ext \ filters \ deadline \ deadline_filter . c " > <nl> + < Filter > src \ core \ ext \ filters \ deadline < / Filter > <nl> + < / ClCompile > <nl> + < ClCompile Include = " $ ( SolutionDir ) \ . . \ src \ core \ ext \ transport \ chttp2 \ transport \ bin_decoder . c " > <nl> + < Filter > src \ core \ ext \ transport \ chttp2 \ transport < / Filter > <nl> + < / ClCompile > <nl> + < ClCompile Include = " $ ( SolutionDir ) \ . . \ src \ core \ ext \ transport \ chttp2 \ transport \ bin_encoder . c " > <nl> + < Filter > src \ core \ ext \ transport \ chttp2 \ transport < / Filter > <nl> + < / ClCompile > <nl> + < ClCompile Include = " $ ( SolutionDir ) \ . . \ src \ core \ ext \ transport \ chttp2 \ transport \ chttp2_plugin . c " > <nl> + < Filter > src \ core \ ext \ transport \ chttp2 \ transport < / Filter > <nl> + < / ClCompile > <nl> + < ClCompile Include = " $ ( SolutionDir ) \ . . \ src \ core \ ext \ transport \ chttp2 \ transport \ chttp2_transport . c " > <nl> + < Filter > src \ core \ ext \ transport \ chttp2 \ transport < / Filter > <nl> + < / ClCompile > <nl> + < ClCompile Include = " $ ( SolutionDir ) \ . . \ src \ core \ ext \ transport \ chttp2 \ transport \ frame_data . c " > <nl> + < Filter > src \ core \ ext \ transport \ chttp2 \ transport < / Filter > <nl> + < / ClCompile > <nl> + < ClCompile Include = " $ ( SolutionDir ) \ . . \ src \ core \ ext \ transport \ chttp2 \ transport \ frame_goaway . c " > <nl> + < Filter > src \ core \ ext \ transport \ chttp2 \ transport < / Filter > <nl> + < / ClCompile > <nl> + < ClCompile Include = " $ ( SolutionDir ) \ . . \ src \ core \ ext \ transport \ chttp2 \ transport \ frame_ping . c " > <nl> + < Filter > src \ core \ ext \ transport \ chttp2 \ transport < / Filter > <nl> + < / ClCompile > <nl> + < ClCompile Include = " $ ( SolutionDir ) \ . . \ src \ core \ ext \ transport \ chttp2 \ transport \ frame_rst_stream . c " > <nl> + < Filter > src \ core \ ext \ transport \ chttp2 \ transport < / Filter > <nl> + < / ClCompile > <nl> + < ClCompile Include = " $ ( SolutionDir ) \ . . \ src \ core \ ext \ transport \ chttp2 \ transport \ frame_settings . c " > <nl> + < Filter > src \ core \ ext \ transport \ chttp2 \ transport < / Filter > <nl> + < / ClCompile > <nl> + < ClCompile Include = " $ ( SolutionDir ) \ . . \ src \ core \ ext \ transport \ chttp2 \ transport \ frame_window_update . c " > <nl> + < Filter > src \ core \ ext \ transport \ chttp2 \ transport < / Filter > <nl> + < / ClCompile > <nl> + < ClCompile Include = " $ ( SolutionDir ) \ . . \ src \ core \ ext \ transport \ chttp2 \ transport \ hpack_encoder . c " > <nl> + < Filter > src \ core \ ext \ transport \ chttp2 \ transport < / Filter > <nl> + < / ClCompile > <nl> + < ClCompile Include = " $ ( SolutionDir ) \ . . \ src \ core \ ext \ transport \ chttp2 \ transport \ hpack_parser . c " > <nl> + < Filter > src \ core \ ext \ transport \ chttp2 \ transport < / Filter > <nl> + < / ClCompile > <nl> + < ClCompile Include = " $ ( SolutionDir ) \ . . \ src \ core \ ext \ transport \ chttp2 \ transport \ hpack_table . c " > <nl> + < Filter > src \ core \ ext \ transport \ chttp2 \ transport < / Filter > <nl> + < / ClCompile > <nl> + < ClCompile Include = " $ ( SolutionDir ) \ . . \ src \ core \ ext \ transport \ chttp2 \ transport \ http2_settings . c " > <nl> + < Filter > src \ core \ ext \ transport \ chttp2 \ transport < / Filter > <nl> + < / ClCompile > <nl> + < ClCompile Include = " $ ( SolutionDir ) \ . . \ src \ core \ ext \ transport \ chttp2 \ transport \ huffsyms . c " > <nl> + < Filter > src \ core \ ext \ transport \ chttp2 \ transport < / Filter > <nl> + < / ClCompile > <nl> + < ClCompile Include = " $ ( SolutionDir ) \ . . \ src \ core \ ext \ transport \ chttp2 \ transport \ incoming_metadata . c " > <nl> + < Filter > src \ core \ ext \ transport \ chttp2 \ transport < / Filter > <nl> + < / ClCompile > <nl> + < ClCompile Include = " $ ( SolutionDir ) \ . . \ src \ core \ ext \ transport \ chttp2 \ transport \ parsing . c " > <nl> + < Filter > src \ core \ ext \ transport \ chttp2 \ transport < / Filter > <nl> + < / ClCompile > <nl> + < ClCompile Include = " $ ( SolutionDir ) \ . . \ src \ core \ ext \ transport \ chttp2 \ transport \ stream_lists . c " > <nl> + < Filter > src \ core \ ext \ transport \ chttp2 \ transport < / Filter > <nl> + < / ClCompile > <nl> + < ClCompile Include = " $ ( SolutionDir ) \ . . \ src \ core \ ext \ transport \ chttp2 \ transport \ stream_map . c " > <nl> + < Filter > src \ core \ ext \ transport \ chttp2 \ transport < / Filter > <nl> + < / ClCompile > <nl> + < ClCompile Include = " $ ( SolutionDir ) \ . . \ src \ core \ ext \ transport \ chttp2 \ transport \ varint . c " > <nl> + < Filter > src \ core \ ext \ transport \ chttp2 \ transport < / Filter > <nl> + < / ClCompile > <nl> + < ClCompile Include = " $ ( SolutionDir ) \ . . \ src \ core \ ext \ transport \ chttp2 \ transport \ writing . c " > <nl> + < Filter > src \ core \ ext \ transport \ chttp2 \ transport < / Filter > <nl> + < / ClCompile > <nl> + < ClCompile Include = " $ ( SolutionDir ) \ . . \ src \ core \ ext \ transport \ chttp2 \ alpn \ alpn . c " > <nl> + < Filter > src \ core \ ext \ transport \ chttp2 \ alpn < / Filter > <nl> + < / ClCompile > <nl> + < ClCompile Include = " $ ( SolutionDir ) \ . . \ src \ core \ ext \ filters \ http \ client \ http_client_filter . c " > <nl> + < Filter > src \ core \ ext \ filters \ http \ client < / Filter > <nl> + < / ClCompile > <nl> + < ClCompile Include = " $ ( SolutionDir ) \ . . \ src \ core \ ext \ filters \ http \ http_filters_plugin . c " > <nl> + < Filter > src \ core \ ext \ filters \ http < / Filter > <nl> + < / ClCompile > <nl> + < ClCompile Include = " $ ( SolutionDir ) \ . . \ src \ core \ ext \ filters \ http \ message_compress \ message_compress_filter . c " > <nl> + < Filter > src \ core \ ext \ filters \ http \ message_compress < / Filter > <nl> + < / ClCompile > <nl> + < ClCompile Include = " $ ( SolutionDir ) \ . . \ src \ core \ ext \ filters \ http \ server \ http_server_filter . c " > <nl> + < Filter > src \ core \ ext \ filters \ http \ server < / Filter > <nl> + < / ClCompile > <nl> < / ItemGroup > <nl> < ItemGroup > <nl> < ClInclude Include = " $ ( SolutionDir ) \ . . \ include \ grpc \ impl \ codegen \ byte_buffer_reader . h " > <nl> <nl> < ClInclude Include = " $ ( SolutionDir ) \ . . \ test \ core \ util \ trickle_endpoint . h " > <nl> < Filter > test \ core \ util < / Filter > <nl> < / ClInclude > <nl> + < ClInclude Include = " $ ( SolutionDir ) \ . . \ src \ core \ ext \ filters \ client_channel \ client_channel . h " > <nl> + < Filter > src \ core \ ext \ filters \ client_channel < / Filter > <nl> + < / ClInclude > <nl> + < ClInclude Include = " $ ( SolutionDir ) \ . . \ src \ core \ ext \ filters \ client_channel \ client_channel_factory . h " > <nl> + < Filter > src \ core \ ext \ filters \ client_channel < / Filter > <nl> + < / ClInclude > <nl> + < ClInclude Include = " $ ( SolutionDir ) \ . . \ src \ core \ ext \ filters \ client_channel \ connector . h " > <nl> + < Filter > src \ core \ ext \ filters \ client_channel < / Filter > <nl> + < / ClInclude > <nl> + < ClInclude Include = " $ ( SolutionDir ) \ . . \ src \ core \ ext \ filters \ client_channel \ http_connect_handshaker . h " > <nl> + < Filter > src \ core \ ext \ filters \ client_channel < / Filter > <nl> + < / ClInclude > <nl> + < ClInclude Include = " $ ( SolutionDir ) \ . . \ src \ core \ ext \ filters \ client_channel \ http_proxy . h " > <nl> + < Filter > src \ core \ ext \ filters \ client_channel < / Filter > <nl> + < / ClInclude > <nl> + < ClInclude Include = " $ ( SolutionDir ) \ . . \ src \ core \ ext \ filters \ client_channel \ lb_policy . h " > <nl> + < Filter > src \ core \ ext \ filters \ client_channel < / Filter > <nl> + < / ClInclude > <nl> + < ClInclude Include = " $ ( SolutionDir ) \ . . \ src \ core \ ext \ filters \ client_channel \ lb_policy_factory . h " > <nl> + < Filter > src \ core \ ext \ filters \ client_channel < / Filter > <nl> + < / ClInclude > <nl> + < ClInclude Include = " $ ( SolutionDir ) \ . . \ src \ core \ ext \ filters \ client_channel \ lb_policy_registry . h " > <nl> + < Filter > src \ core \ ext \ filters \ client_channel < / Filter > <nl> + < / ClInclude > <nl> + < ClInclude Include = " $ ( SolutionDir ) \ . . \ src \ core \ ext \ filters \ client_channel \ parse_address . h " > <nl> + < Filter > src \ core \ ext \ filters \ client_channel < / Filter > <nl> + < / ClInclude > <nl> + < ClInclude Include = " $ ( SolutionDir ) \ . . \ src \ core \ ext \ filters \ client_channel \ proxy_mapper . h " > <nl> + < Filter > src \ core \ ext \ filters \ client_channel < / Filter > <nl> + < / ClInclude > <nl> + < ClInclude Include = " $ ( SolutionDir ) \ . . \ src \ core \ ext \ filters \ client_channel \ proxy_mapper_registry . h " > <nl> + < Filter > src \ core \ ext \ filters \ client_channel < / Filter > <nl> + < / ClInclude > <nl> + < ClInclude Include = " $ ( SolutionDir ) \ . . \ src \ core \ ext \ filters \ client_channel \ resolver . h " > <nl> + < Filter > src \ core \ ext \ filters \ client_channel < / Filter > <nl> + < / ClInclude > <nl> + < ClInclude Include = " $ ( SolutionDir ) \ . . \ src \ core \ ext \ filters \ client_channel \ resolver_factory . h " > <nl> + < Filter > src \ core \ ext \ filters \ client_channel < / Filter > <nl> + < / ClInclude > <nl> + < ClInclude Include = " $ ( SolutionDir ) \ . . \ src \ core \ ext \ filters \ client_channel \ resolver_registry . h " > <nl> + < Filter > src \ core \ ext \ filters \ client_channel < / Filter > <nl> + < / ClInclude > <nl> + < ClInclude Include = " $ ( SolutionDir ) \ . . \ src \ core \ ext \ filters \ client_channel \ retry_throttle . h " > <nl> + < Filter > src \ core \ ext \ filters \ client_channel < / Filter > <nl> + < / ClInclude > <nl> + < ClInclude Include = " $ ( SolutionDir ) \ . . \ src \ core \ ext \ filters \ client_channel \ subchannel . h " > <nl> + < Filter > src \ core \ ext \ filters \ client_channel < / Filter > <nl> + < / ClInclude > <nl> + < ClInclude Include = " $ ( SolutionDir ) \ . . \ src \ core \ ext \ filters \ client_channel \ subchannel_index . h " > <nl> + < Filter > src \ core \ ext \ filters \ client_channel < / Filter > <nl> + < / ClInclude > <nl> + < ClInclude Include = " $ ( SolutionDir ) \ . . \ src \ core \ ext \ filters \ client_channel \ uri_parser . h " > <nl> + < Filter > src \ core \ ext \ filters \ client_channel < / Filter > <nl> + < / ClInclude > <nl> + < ClInclude Include = " $ ( SolutionDir ) \ . . \ src \ core \ ext \ filters \ deadline \ deadline_filter . h " > <nl> + < Filter > src \ core \ ext \ filters \ deadline < / Filter > <nl> + < / ClInclude > <nl> + < ClInclude Include = " $ ( SolutionDir ) \ . . \ src \ core \ ext \ transport \ chttp2 \ transport \ bin_decoder . h " > <nl> + < Filter > src \ core \ ext \ transport \ chttp2 \ transport < / Filter > <nl> + < / ClInclude > <nl> + < ClInclude Include = " $ ( SolutionDir ) \ . . \ src \ core \ ext \ transport \ chttp2 \ transport \ bin_encoder . h " > <nl> + < Filter > src \ core \ ext \ transport \ chttp2 \ transport < / Filter > <nl> + < / ClInclude > <nl> + < ClInclude Include = " $ ( SolutionDir ) \ . . \ src \ core \ ext \ transport \ chttp2 \ transport \ chttp2_transport . h " > <nl> + < Filter > src \ core \ ext \ transport \ chttp2 \ transport < / Filter > <nl> + < / ClInclude > <nl> + < ClInclude Include = " $ ( SolutionDir ) \ . . \ src \ core \ ext \ transport \ chttp2 \ transport \ frame . h " > <nl> + < Filter > src \ core \ ext \ transport \ chttp2 \ transport < / Filter > <nl> + < / ClInclude > <nl> + < ClInclude Include = " $ ( SolutionDir ) \ . . \ src \ core \ ext \ transport \ chttp2 \ transport \ frame_data . h " > <nl> + < Filter > src \ core \ ext \ transport \ chttp2 \ transport < / Filter > <nl> + < / ClInclude > <nl> + < ClInclude Include = " $ ( SolutionDir ) \ . . \ src \ core \ ext \ transport \ chttp2 \ transport \ frame_goaway . h " > <nl> + < Filter > src \ core \ ext \ transport \ chttp2 \ transport < / Filter > <nl> + < / ClInclude > <nl> + < ClInclude Include = " $ ( SolutionDir ) \ . . \ src \ core \ ext \ transport \ chttp2 \ transport \ frame_ping . h " > <nl> + < Filter > src \ core \ ext \ transport \ chttp2 \ transport < / Filter > <nl> + < / ClInclude > <nl> + < ClInclude Include = " $ ( SolutionDir ) \ . . \ src \ core \ ext \ transport \ chttp2 \ transport \ frame_rst_stream . h " > <nl> + < Filter > src \ core \ ext \ transport \ chttp2 \ transport < / Filter > <nl> + < / ClInclude > <nl> + < ClInclude Include = " $ ( SolutionDir ) \ . . \ src \ core \ ext \ transport \ chttp2 \ transport \ frame_settings . h " > <nl> + < Filter > src \ core \ ext \ transport \ chttp2 \ transport < / Filter > <nl> + < / ClInclude > <nl> + < ClInclude Include = " $ ( SolutionDir ) \ . . \ src \ core \ ext \ transport \ chttp2 \ transport \ frame_window_update . h " > <nl> + < Filter > src \ core \ ext \ transport \ chttp2 \ transport < / Filter > <nl> + < / ClInclude > <nl> + < ClInclude Include = " $ ( SolutionDir ) \ . . \ src \ core \ ext \ transport \ chttp2 \ transport \ hpack_encoder . h " > <nl> + < Filter > src \ core \ ext \ transport \ chttp2 \ transport < / Filter > <nl> + < / ClInclude > <nl> + < ClInclude Include = " $ ( SolutionDir ) \ . . \ src \ core \ ext \ transport \ chttp2 \ transport \ hpack_parser . h " > <nl> + < Filter > src \ core \ ext \ transport \ chttp2 \ transport < / Filter > <nl> + < / ClInclude > <nl> + < ClInclude Include = " $ ( SolutionDir ) \ . . \ src \ core \ ext \ transport \ chttp2 \ transport \ hpack_table . h " > <nl> + < Filter > src \ core \ ext \ transport \ chttp2 \ transport < / Filter > <nl> + < / ClInclude > <nl> + < ClInclude Include = " $ ( SolutionDir ) \ . . \ src \ core \ ext \ transport \ chttp2 \ transport \ http2_settings . h " > <nl> + < Filter > src \ core \ ext \ transport \ chttp2 \ transport < / Filter > <nl> + < / ClInclude > <nl> + < ClInclude Include = " $ ( SolutionDir ) \ . . \ src \ core \ ext \ transport \ chttp2 \ transport \ huffsyms . h " > <nl> + < Filter > src \ core \ ext \ transport \ chttp2 \ transport < / Filter > <nl> + < / ClInclude > <nl> + < ClInclude Include = " $ ( SolutionDir ) \ . . \ src \ core \ ext \ transport \ chttp2 \ transport \ incoming_metadata . h " > <nl> + < Filter > src \ core \ ext \ transport \ chttp2 \ transport < / Filter > <nl> + < / ClInclude > <nl> + < ClInclude Include = " $ ( SolutionDir ) \ . . \ src \ core \ ext \ transport \ chttp2 \ transport \ internal . h " > <nl> + < Filter > src \ core \ ext \ transport \ chttp2 \ transport < / Filter > <nl> + < / ClInclude > <nl> + < ClInclude Include = " $ ( SolutionDir ) \ . . \ src \ core \ ext \ transport \ chttp2 \ transport \ stream_map . h " > <nl> + < Filter > src \ core \ ext \ transport \ chttp2 \ transport < / Filter > <nl> + < / ClInclude > <nl> + < ClInclude Include = " $ ( SolutionDir ) \ . . \ src \ core \ ext \ transport \ chttp2 \ transport \ varint . h " > <nl> + < Filter > src \ core \ ext \ transport \ chttp2 \ transport < / Filter > <nl> + < / ClInclude > <nl> + < ClInclude Include = " $ ( SolutionDir ) \ . . \ src \ core \ ext \ transport \ chttp2 \ alpn \ alpn . h " > <nl> + < Filter > src \ core \ ext \ transport \ chttp2 \ alpn < / Filter > <nl> + < / ClInclude > <nl> + < ClInclude Include = " $ ( SolutionDir ) \ . . \ src \ core \ ext \ filters \ http \ client \ http_client_filter . h " > <nl> + < Filter > src \ core \ ext \ filters \ http \ client < / Filter > <nl> + < / ClInclude > <nl> + < ClInclude Include = " $ ( SolutionDir ) \ . . \ src \ core \ ext \ filters \ http \ message_compress \ message_compress_filter . h " > <nl> + < Filter > src \ core \ ext \ filters \ http \ message_compress < / Filter > <nl> + < / ClInclude > <nl> + < ClInclude Include = " $ ( SolutionDir ) \ . . \ src \ core \ ext \ filters \ http \ server \ http_server_filter . h " > <nl> + < Filter > src \ core \ ext \ filters \ http \ server < / Filter > <nl> + < / ClInclude > <nl> < / ItemGroup > <nl> <nl> < ItemGroup > <nl> <nl> < Filter Include = " src \ core \ ext \ filters \ client_channel \ resolver \ fake " > <nl> < UniqueIdentifier > { 9e94ffec - fe00 - d132 - db50 - c4a3c218f102 } < / UniqueIdentifier > <nl> < / Filter > <nl> + < Filter Include = " src \ core \ ext \ filters \ deadline " > <nl> + < UniqueIdentifier > { 2c9ab189 - bb7e - 355d - 9f37 - 385472e86b9f } < / UniqueIdentifier > <nl> + < / Filter > <nl> + < Filter Include = " src \ core \ ext \ filters \ http " > <nl> + < UniqueIdentifier > { 4503bfa6 - 92be - 99d8 - 8c6b - feeb42bbdd1c } < / UniqueIdentifier > <nl> + < / Filter > <nl> + < Filter Include = " src \ core \ ext \ filters \ http \ client " > <nl> + < UniqueIdentifier > { 6d9ffdbe - 4d2f - b0c4 - 8abe - a548ffde6ad6 } < / UniqueIdentifier > <nl> + < / Filter > <nl> + < Filter Include = " src \ core \ ext \ filters \ http \ message_compress " > <nl> + < UniqueIdentifier > { a6c2fe73 - 3b25 - 084c - 68d7 - 9673ec7b872a } < / UniqueIdentifier > <nl> + < / Filter > <nl> + < Filter Include = " src \ core \ ext \ filters \ http \ server " > <nl> + < UniqueIdentifier > { ec11748c - 79ef - f224 - 2072 - e3006d8638f4 } < / UniqueIdentifier > <nl> + < / Filter > <nl> + < Filter Include = " src \ core \ ext \ transport " > <nl> + < UniqueIdentifier > { b5f17b17 - 8012 - 87c9 - dfb2 - 428dd29d0b94 } < / UniqueIdentifier > <nl> + < / Filter > <nl> + < Filter Include = " src \ core \ ext \ transport \ chttp2 " > <nl> + < UniqueIdentifier > { 608f56aa - d257 - f25b - 14aa - 1776a771defd } < / UniqueIdentifier > <nl> + < / Filter > <nl> + < Filter Include = " src \ core \ ext \ transport \ chttp2 \ alpn " > <nl> + < UniqueIdentifier > { 49d381db - 172f - 9765 - 4135 - d7a10c4485bf } < / UniqueIdentifier > <nl> + < / Filter > <nl> + < Filter Include = " src \ core \ ext \ transport \ chttp2 \ transport " > <nl> + < UniqueIdentifier > { 4395ba2e - 6b6d - ea05 - 8a1e - 915b8f0f85f6 } < / UniqueIdentifier > <nl> + < / Filter > <nl> < Filter Include = " src \ core \ lib " > <nl> < UniqueIdentifier > { f4e8c61e - 1ca6 - 0fdd - 7b5e - b7f9a30c9a21 } < / UniqueIdentifier > <nl> < / Filter > <nl> mmm a / vsprojects / vcxproj / grpc_test_util_unsecure / grpc_test_util_unsecure . vcxproj <nl> ppp b / vsprojects / vcxproj / grpc_test_util_unsecure / grpc_test_util_unsecure . vcxproj <nl> <nl> < / Link > <nl> < / ItemDefinitionGroup > <nl> <nl> + < ItemGroup > <nl> + < ClInclude Include = " $ ( SolutionDir ) \ . . \ include \ grpc \ impl \ codegen \ byte_buffer_reader . h " / > <nl> + < ClInclude Include = " $ ( SolutionDir ) \ . . \ include \ grpc \ impl \ codegen \ compression_types . h " / > <nl> + < ClInclude Include = " $ ( SolutionDir ) \ . . \ include \ grpc \ impl \ codegen \ connectivity_state . h " / > <nl> + < ClInclude Include = " $ ( SolutionDir ) \ . . \ include \ grpc \ impl \ codegen \ exec_ctx_fwd . h " / > <nl> + < ClInclude Include = " $ ( SolutionDir ) \ . . \ include \ grpc \ impl \ codegen \ grpc_types . h " / > <nl> + < ClInclude Include = " $ ( SolutionDir ) \ . . \ include \ grpc \ impl \ codegen \ propagation_bits . h " / > <nl> + < ClInclude Include = " $ ( SolutionDir ) \ . . \ include \ grpc \ impl \ codegen \ slice . h " / > <nl> + < ClInclude Include = " $ ( SolutionDir ) \ . . \ include \ grpc \ impl \ codegen \ status . h " / > <nl> + < ClInclude Include = " $ ( SolutionDir ) \ . . \ include \ grpc \ impl \ codegen \ atm . h " / > <nl> + < ClInclude Include = " $ ( SolutionDir ) \ . . \ include \ grpc \ impl \ codegen \ atm_gcc_atomic . h " / > <nl> + < ClInclude Include = " $ ( SolutionDir ) \ . . \ include \ grpc \ impl \ codegen \ atm_gcc_sync . h " / > <nl> + < ClInclude Include = " $ ( SolutionDir ) \ . . \ include \ grpc \ impl \ codegen \ atm_windows . h " / > <nl> + < ClInclude Include = " $ ( SolutionDir ) \ . . \ include \ grpc \ impl \ codegen \ gpr_slice . h " / > <nl> + < ClInclude Include = " $ ( SolutionDir ) \ . . \ include \ grpc \ impl \ codegen \ gpr_types . h " / > <nl> + < ClInclude Include = " $ ( SolutionDir ) \ . . \ include \ grpc \ impl \ codegen \ port_platform . h " / > <nl> + < ClInclude Include = " $ ( SolutionDir ) \ . . \ include \ grpc \ impl \ codegen \ sync . h " / > <nl> + < ClInclude Include = " $ ( SolutionDir ) \ . . \ include \ grpc \ impl \ codegen \ sync_generic . h " / > <nl> + < ClInclude Include = " $ ( SolutionDir ) \ . . \ include \ grpc \ impl \ codegen \ sync_posix . h " / > <nl> + < ClInclude Include = " $ ( SolutionDir ) \ . . \ include \ grpc \ impl \ codegen \ sync_windows . h " / > <nl> + < / ItemGroup > <nl> < ItemGroup > <nl> < ClInclude Include = " $ ( SolutionDir ) \ . . \ src \ core \ ext \ filters \ client_channel \ resolver \ fake \ fake_resolver . h " / > <nl> < ClInclude Include = " $ ( SolutionDir ) \ . . \ test \ core \ end2end \ cq_verifier . h " / > <nl> <nl> < ClInclude Include = " $ ( SolutionDir ) \ . . \ test \ core \ util \ port_server_client . h " / > <nl> < ClInclude Include = " $ ( SolutionDir ) \ . . \ test \ core \ util \ slice_splitter . h " / > <nl> < ClInclude Include = " $ ( SolutionDir ) \ . . \ test \ core \ util \ trickle_endpoint . h " / > <nl> + < ClInclude Include = " $ ( SolutionDir ) \ . . \ src \ core \ ext \ filters \ client_channel \ client_channel . h " / > <nl> + < ClInclude Include = " $ ( SolutionDir ) \ . . \ src \ core \ ext \ filters \ client_channel \ client_channel_factory . h " / > <nl> + < ClInclude Include = " $ ( SolutionDir ) \ . . \ src \ core \ ext \ filters \ client_channel \ connector . h " / > <nl> + < ClInclude Include = " $ ( SolutionDir ) \ . . \ src \ core \ ext \ filters \ client_channel \ http_connect_handshaker . h " / > <nl> + < ClInclude Include = " $ ( SolutionDir ) \ . . \ src \ core \ ext \ filters \ client_channel \ http_proxy . h " / > <nl> + < ClInclude Include = " $ ( SolutionDir ) \ . . \ src \ core \ ext \ filters \ client_channel \ lb_policy . h " / > <nl> + < ClInclude Include = " $ ( SolutionDir ) \ . . \ src \ core \ ext \ filters \ client_channel \ lb_policy_factory . h " / > <nl> + < ClInclude Include = " $ ( SolutionDir ) \ . . \ src \ core \ ext \ filters \ client_channel \ lb_policy_registry . h " / > <nl> + < ClInclude Include = " $ ( SolutionDir ) \ . . \ src \ core \ ext \ filters \ client_channel \ parse_address . h " / > <nl> + < ClInclude Include = " $ ( SolutionDir ) \ . . \ src \ core \ ext \ filters \ client_channel \ proxy_mapper . h " / > <nl> + < ClInclude Include = " $ ( SolutionDir ) \ . . \ src \ core \ ext \ filters \ client_channel \ proxy_mapper_registry . h " / > <nl> + < ClInclude Include = " $ ( SolutionDir ) \ . . \ src \ core \ ext \ filters \ client_channel \ resolver . h " / > <nl> + < ClInclude Include = " $ ( SolutionDir ) \ . . \ src \ core \ ext \ filters \ client_channel \ resolver_factory . h " / > <nl> + < ClInclude Include = " $ ( SolutionDir ) \ . . \ src \ core \ ext \ filters \ client_channel \ resolver_registry . h " / > <nl> + < ClInclude Include = " $ ( SolutionDir ) \ . . \ src \ core \ ext \ filters \ client_channel \ retry_throttle . h " / > <nl> + < ClInclude Include = " $ ( SolutionDir ) \ . . \ src \ core \ ext \ filters \ client_channel \ subchannel . h " / > <nl> + < ClInclude Include = " $ ( SolutionDir ) \ . . \ src \ core \ ext \ filters \ client_channel \ subchannel_index . h " / > <nl> + < ClInclude Include = " $ ( SolutionDir ) \ . . \ src \ core \ ext \ filters \ client_channel \ uri_parser . h " / > <nl> + < ClInclude Include = " $ ( SolutionDir ) \ . . \ src \ core \ ext \ filters \ deadline \ deadline_filter . h " / > <nl> + < ClInclude Include = " $ ( SolutionDir ) \ . . \ src \ core \ ext \ transport \ chttp2 \ transport \ bin_decoder . h " / > <nl> + < ClInclude Include = " $ ( SolutionDir ) \ . . \ src \ core \ ext \ transport \ chttp2 \ transport \ bin_encoder . h " / > <nl> + < ClInclude Include = " $ ( SolutionDir ) \ . . \ src \ core \ ext \ transport \ chttp2 \ transport \ chttp2_transport . h " / > <nl> + < ClInclude Include = " $ ( SolutionDir ) \ . . \ src \ core \ ext \ transport \ chttp2 \ transport \ frame . h " / > <nl> + < ClInclude Include = " $ ( SolutionDir ) \ . . \ src \ core \ ext \ transport \ chttp2 \ transport \ frame_data . h " / > <nl> + < ClInclude Include = " $ ( SolutionDir ) \ . . \ src \ core \ ext \ transport \ chttp2 \ transport \ frame_goaway . h " / > <nl> + < ClInclude Include = " $ ( SolutionDir ) \ . . \ src \ core \ ext \ transport \ chttp2 \ transport \ frame_ping . h " / > <nl> + < ClInclude Include = " $ ( SolutionDir ) \ . . \ src \ core \ ext \ transport \ chttp2 \ transport \ frame_rst_stream . h " / > <nl> + < ClInclude Include = " $ ( SolutionDir ) \ . . \ src \ core \ ext \ transport \ chttp2 \ transport \ frame_settings . h " / > <nl> + < ClInclude Include = " $ ( SolutionDir ) \ . . \ src \ core \ ext \ transport \ chttp2 \ transport \ frame_window_update . h " / > <nl> + < ClInclude Include = " $ ( SolutionDir ) \ . . \ src \ core \ ext \ transport \ chttp2 \ transport \ hpack_encoder . h " / > <nl> + < ClInclude Include = " $ ( SolutionDir ) \ . . \ src \ core \ ext \ transport \ chttp2 \ transport \ hpack_parser . h " / > <nl> + < ClInclude Include = " $ ( SolutionDir ) \ . . \ src \ core \ ext \ transport \ chttp2 \ transport \ hpack_table . h " / > <nl> + < ClInclude Include = " $ ( SolutionDir ) \ . . \ src \ core \ ext \ transport \ chttp2 \ transport \ http2_settings . h " / > <nl> + < ClInclude Include = " $ ( SolutionDir ) \ . . \ src \ core \ ext \ transport \ chttp2 \ transport \ huffsyms . h " / > <nl> + < ClInclude Include = " $ ( SolutionDir ) \ . . \ src \ core \ ext \ transport \ chttp2 \ transport \ incoming_metadata . h " / > <nl> + < ClInclude Include = " $ ( SolutionDir ) \ . . \ src \ core \ ext \ transport \ chttp2 \ transport \ internal . h " / > <nl> + < ClInclude Include = " $ ( SolutionDir ) \ . . \ src \ core \ ext \ transport \ chttp2 \ transport \ stream_map . h " / > <nl> + < ClInclude Include = " $ ( SolutionDir ) \ . . \ src \ core \ ext \ transport \ chttp2 \ transport \ varint . h " / > <nl> + < ClInclude Include = " $ ( SolutionDir ) \ . . \ src \ core \ ext \ transport \ chttp2 \ alpn \ alpn . h " / > <nl> + < ClInclude Include = " $ ( SolutionDir ) \ . . \ src \ core \ ext \ filters \ http \ client \ http_client_filter . h " / > <nl> + < ClInclude Include = " $ ( SolutionDir ) \ . . \ src \ core \ ext \ filters \ http \ message_compress \ message_compress_filter . h " / > <nl> + < ClInclude Include = " $ ( SolutionDir ) \ . . \ src \ core \ ext \ filters \ http \ server \ http_server_filter . h " / > <nl> < / ItemGroup > <nl> < ItemGroup > <nl> < ClCompile Include = " $ ( SolutionDir ) \ . . \ src \ core \ ext \ filters \ client_channel \ resolver \ fake \ fake_resolver . c " > <nl> <nl> < / ClCompile > <nl> < ClCompile Include = " $ ( SolutionDir ) \ . . \ test \ core \ util \ trickle_endpoint . c " > <nl> < / ClCompile > <nl> + < ClCompile Include = " $ ( SolutionDir ) \ . . \ src \ core \ lib \ channel \ channel_args . c " > <nl> + < / ClCompile > <nl> + < ClCompile Include = " $ ( SolutionDir ) \ . . \ src \ core \ lib \ channel \ channel_stack . c " > <nl> + < / ClCompile > <nl> + < ClCompile Include = " $ ( SolutionDir ) \ . . \ src \ core \ lib \ channel \ channel_stack_builder . c " > <nl> + < / ClCompile > <nl> + < ClCompile Include = " $ ( SolutionDir ) \ . . \ src \ core \ lib \ channel \ connected_channel . c " > <nl> + < / ClCompile > <nl> + < ClCompile Include = " $ ( SolutionDir ) \ . . \ src \ core \ lib \ channel \ handshaker . c " > <nl> + < / ClCompile > <nl> + < ClCompile Include = " $ ( SolutionDir ) \ . . \ src \ core \ lib \ channel \ handshaker_factory . c " > <nl> + < / ClCompile > <nl> + < ClCompile Include = " $ ( SolutionDir ) \ . . \ src \ core \ lib \ channel \ handshaker_registry . c " > <nl> + < / ClCompile > <nl> + < ClCompile Include = " $ ( SolutionDir ) \ . . \ src \ core \ lib \ compression \ compression . c " > <nl> + < / ClCompile > <nl> + < ClCompile Include = " $ ( SolutionDir ) \ . . \ src \ core \ lib \ compression \ message_compress . c " > <nl> + < / ClCompile > <nl> + < ClCompile Include = " $ ( SolutionDir ) \ . . \ src \ core \ lib \ compression \ stream_compression . c " > <nl> + < / ClCompile > <nl> + < ClCompile Include = " $ ( SolutionDir ) \ . . \ src \ core \ lib \ http \ format_request . c " > <nl> + < / ClCompile > <nl> + < ClCompile Include = " $ ( SolutionDir ) \ . . \ src \ core \ lib \ http \ httpcli . c " > <nl> + < / ClCompile > <nl> + < ClCompile Include = " $ ( SolutionDir ) \ . . \ src \ core \ lib \ http \ parser . c " > <nl> + < / ClCompile > <nl> + < ClCompile Include = " $ ( SolutionDir ) \ . . \ src \ core \ lib \ iomgr \ closure . c " > <nl> + < / ClCompile > <nl> + < ClCompile Include = " $ ( SolutionDir ) \ . . \ src \ core \ lib \ iomgr \ combiner . c " > <nl> + < / ClCompile > <nl> + < ClCompile Include = " $ ( SolutionDir ) \ . . \ src \ core \ lib \ iomgr \ endpoint . c " > <nl> + < / ClCompile > <nl> + < ClCompile Include = " $ ( SolutionDir ) \ . . \ src \ core \ lib \ iomgr \ endpoint_pair_posix . c " > <nl> + < / ClCompile > <nl> + < ClCompile Include = " $ ( SolutionDir ) \ . . \ src \ core \ lib \ iomgr \ endpoint_pair_uv . c " > <nl> + < / ClCompile > <nl> + < ClCompile Include = " $ ( SolutionDir ) \ . . \ src \ core \ lib \ iomgr \ endpoint_pair_windows . c " > <nl> + < / ClCompile > <nl> + < ClCompile Include = " $ ( SolutionDir ) \ . . \ src \ core \ lib \ iomgr \ error . c " > <nl> + < / ClCompile > <nl> + < ClCompile Include = " $ ( SolutionDir ) \ . . \ src \ core \ lib \ iomgr \ ev_epoll1_linux . c " > <nl> + < / ClCompile > <nl> + < ClCompile Include = " $ ( SolutionDir ) \ . . \ src \ core \ lib \ iomgr \ ev_epoll_limited_pollers_linux . c " > <nl> + < / ClCompile > <nl> + < ClCompile Include = " $ ( SolutionDir ) \ . . \ src \ core \ lib \ iomgr \ ev_epoll_thread_pool_linux . c " > <nl> + < / ClCompile > <nl> + < ClCompile Include = " $ ( SolutionDir ) \ . . \ src \ core \ lib \ iomgr \ ev_epollex_linux . c " > <nl> + < / ClCompile > <nl> + < ClCompile Include = " $ ( SolutionDir ) \ . . \ src \ core \ lib \ iomgr \ ev_epollsig_linux . c " > <nl> + < / ClCompile > <nl> + < ClCompile Include = " $ ( SolutionDir ) \ . . \ src \ core \ lib \ iomgr \ ev_poll_posix . c " > <nl> + < / ClCompile > <nl> + < ClCompile Include = " $ ( SolutionDir ) \ . . \ src \ core \ lib \ iomgr \ ev_posix . c " > <nl> + < / ClCompile > <nl> + < ClCompile Include = " $ ( SolutionDir ) \ . . \ src \ core \ lib \ iomgr \ ev_windows . c " > <nl> + < / ClCompile > <nl> + < ClCompile Include = " $ ( SolutionDir ) \ . . \ src \ core \ lib \ iomgr \ exec_ctx . c " > <nl> + < / ClCompile > <nl> + < ClCompile Include = " $ ( SolutionDir ) \ . . \ src \ core \ lib \ iomgr \ executor . c " > <nl> + < / ClCompile > <nl> + < ClCompile Include = " $ ( SolutionDir ) \ . . \ src \ core \ lib \ iomgr \ iocp_windows . c " > <nl> + < / ClCompile > <nl> + < ClCompile Include = " $ ( SolutionDir ) \ . . \ src \ core \ lib \ iomgr \ iomgr . c " > <nl> + < / ClCompile > <nl> + < ClCompile Include = " $ ( SolutionDir ) \ . . \ src \ core \ lib \ iomgr \ iomgr_posix . c " > <nl> + < / ClCompile > <nl> + < ClCompile Include = " $ ( SolutionDir ) \ . . \ src \ core \ lib \ iomgr \ iomgr_uv . c " > <nl> + < / ClCompile > <nl> + < ClCompile Include = " $ ( SolutionDir ) \ . . \ src \ core \ lib \ iomgr \ iomgr_windows . c " > <nl> + < / ClCompile > <nl> + < ClCompile Include = " $ ( SolutionDir ) \ . . \ src \ core \ lib \ iomgr \ is_epollexclusive_available . c " > <nl> + < / ClCompile > <nl> + < ClCompile Include = " $ ( SolutionDir ) \ . . \ src \ core \ lib \ iomgr \ load_file . c " > <nl> + < / ClCompile > <nl> + < ClCompile Include = " $ ( SolutionDir ) \ . . \ src \ core \ lib \ iomgr \ lockfree_event . c " > <nl> + < / ClCompile > <nl> + < ClCompile Include = " $ ( SolutionDir ) \ . . \ src \ core \ lib \ iomgr \ network_status_tracker . c " > <nl> + < / ClCompile > <nl> + < ClCompile Include = " $ ( SolutionDir ) \ . . \ src \ core \ lib \ iomgr \ polling_entity . c " > <nl> + < / ClCompile > <nl> + < ClCompile Include = " $ ( SolutionDir ) \ . . \ src \ core \ lib \ iomgr \ pollset_set_uv . c " > <nl> + < / ClCompile > <nl> + < ClCompile Include = " $ ( SolutionDir ) \ . . \ src \ core \ lib \ iomgr \ pollset_set_windows . c " > <nl> + < / ClCompile > <nl> + < ClCompile Include = " $ ( SolutionDir ) \ . . \ src \ core \ lib \ iomgr \ pollset_uv . c " > <nl> + < / ClCompile > <nl> + < ClCompile Include = " $ ( SolutionDir ) \ . . \ src \ core \ lib \ iomgr \ pollset_windows . c " > <nl> + < / ClCompile > <nl> + < ClCompile Include = " $ ( SolutionDir ) \ . . \ src \ core \ lib \ iomgr \ resolve_address_posix . c " > <nl> + < / ClCompile > <nl> + < ClCompile Include = " $ ( SolutionDir ) \ . . \ src \ core \ lib \ iomgr \ resolve_address_uv . c " > <nl> + < / ClCompile > <nl> + < ClCompile Include = " $ ( SolutionDir ) \ . . \ src \ core \ lib \ iomgr \ resolve_address_windows . c " > <nl> + < / ClCompile > <nl> + < ClCompile Include = " $ ( SolutionDir ) \ . . \ src \ core \ lib \ iomgr \ resource_quota . c " > <nl> + < / ClCompile > <nl> + < ClCompile Include = " $ ( SolutionDir ) \ . . \ src \ core \ lib \ iomgr \ sockaddr_utils . c " > <nl> + < / ClCompile > <nl> + < ClCompile Include = " $ ( SolutionDir ) \ . . \ src \ core \ lib \ iomgr \ socket_factory_posix . c " > <nl> + < / ClCompile > <nl> + < ClCompile Include = " $ ( SolutionDir ) \ . . \ src \ core \ lib \ iomgr \ socket_mutator . c " > <nl> + < / ClCompile > <nl> + < ClCompile Include = " $ ( SolutionDir ) \ . . \ src \ core \ lib \ iomgr \ socket_utils_common_posix . c " > <nl> + < / ClCompile > <nl> + < ClCompile Include = " $ ( SolutionDir ) \ . . \ src \ core \ lib \ iomgr \ socket_utils_linux . c " > <nl> + < / ClCompile > <nl> + < ClCompile Include = " $ ( SolutionDir ) \ . . \ src \ core \ lib \ iomgr \ socket_utils_posix . c " > <nl> + < / ClCompile > <nl> + < ClCompile Include = " $ ( SolutionDir ) \ . . \ src \ core \ lib \ iomgr \ socket_utils_uv . c " > <nl> + < / ClCompile > <nl> + < ClCompile Include = " $ ( SolutionDir ) \ . . \ src \ core \ lib \ iomgr \ socket_utils_windows . c " > <nl> + < / ClCompile > <nl> + < ClCompile Include = " $ ( SolutionDir ) \ . . \ src \ core \ lib \ iomgr \ socket_windows . c " > <nl> + < / ClCompile > <nl> + < ClCompile Include = " $ ( SolutionDir ) \ . . \ src \ core \ lib \ iomgr \ tcp_client_posix . c " > <nl> + < / ClCompile > <nl> + < ClCompile Include = " $ ( SolutionDir ) \ . . \ src \ core \ lib \ iomgr \ tcp_client_uv . c " > <nl> + < / ClCompile > <nl> + < ClCompile Include = " $ ( SolutionDir ) \ . . \ src \ core \ lib \ iomgr \ tcp_client_windows . c " > <nl> + < / ClCompile > <nl> + < ClCompile Include = " $ ( SolutionDir ) \ . . \ src \ core \ lib \ iomgr \ tcp_posix . c " > <nl> + < / ClCompile > <nl> + < ClCompile Include = " $ ( SolutionDir ) \ . . \ src \ core \ lib \ iomgr \ tcp_server_posix . c " > <nl> + < / ClCompile > <nl> + < ClCompile Include = " $ ( SolutionDir ) \ . . \ src \ core \ lib \ iomgr \ tcp_server_utils_posix_common . c " > <nl> + < / ClCompile > <nl> + < ClCompile Include = " $ ( SolutionDir ) \ . . \ src \ core \ lib \ iomgr \ tcp_server_utils_posix_ifaddrs . c " > <nl> + < / ClCompile > <nl> + < ClCompile Include = " $ ( SolutionDir ) \ . . \ src \ core \ lib \ iomgr \ tcp_server_utils_posix_noifaddrs . c " > <nl> + < / ClCompile > <nl> + < ClCompile Include = " $ ( SolutionDir ) \ . . \ src \ core \ lib \ iomgr \ tcp_server_uv . c " > <nl> + < / ClCompile > <nl> + < ClCompile Include = " $ ( SolutionDir ) \ . . \ src \ core \ lib \ iomgr \ tcp_server_windows . c " > <nl> + < / ClCompile > <nl> + < ClCompile Include = " $ ( SolutionDir ) \ . . \ src \ core \ lib \ iomgr \ tcp_uv . c " > <nl> + < / ClCompile > <nl> + < ClCompile Include = " $ ( SolutionDir ) \ . . \ src \ core \ lib \ iomgr \ tcp_windows . c " > <nl> + < / ClCompile > <nl> + < ClCompile Include = " $ ( SolutionDir ) \ . . \ src \ core \ lib \ iomgr \ time_averaged_stats . c " > <nl> + < / ClCompile > <nl> + < ClCompile Include = " $ ( SolutionDir ) \ . . \ src \ core \ lib \ iomgr \ timer_generic . c " > <nl> + < / ClCompile > <nl> + < ClCompile Include = " $ ( SolutionDir ) \ . . \ src \ core \ lib \ iomgr \ timer_heap . c " > <nl> + < / ClCompile > <nl> + < ClCompile Include = " $ ( SolutionDir ) \ . . \ src \ core \ lib \ iomgr \ timer_manager . c " > <nl> + < / ClCompile > <nl> + < ClCompile Include = " $ ( SolutionDir ) \ . . \ src \ core \ lib \ iomgr \ timer_uv . c " > <nl> + < / ClCompile > <nl> + < ClCompile Include = " $ ( SolutionDir ) \ . . \ src \ core \ lib \ iomgr \ udp_server . c " > <nl> + < / ClCompile > <nl> + < ClCompile Include = " $ ( SolutionDir ) \ . . \ src \ core \ lib \ iomgr \ unix_sockets_posix . c " > <nl> + < / ClCompile > <nl> + < ClCompile Include = " $ ( SolutionDir ) \ . . \ src \ core \ lib \ iomgr \ unix_sockets_posix_noop . c " > <nl> + < / ClCompile > <nl> + < ClCompile Include = " $ ( SolutionDir ) \ . . \ src \ core \ lib \ iomgr \ wakeup_fd_cv . c " > <nl> + < / ClCompile > <nl> + < ClCompile Include = " $ ( SolutionDir ) \ . . \ src \ core \ lib \ iomgr \ wakeup_fd_eventfd . c " > <nl> + < / ClCompile > <nl> + < ClCompile Include = " $ ( SolutionDir ) \ . . \ src \ core \ lib \ iomgr \ wakeup_fd_nospecial . c " > <nl> + < / ClCompile > <nl> + < ClCompile Include = " $ ( SolutionDir ) \ . . \ src \ core \ lib \ iomgr \ wakeup_fd_pipe . c " > <nl> + < / ClCompile > <nl> + < ClCompile Include = " $ ( SolutionDir ) \ . . \ src \ core \ lib \ iomgr \ wakeup_fd_posix . c " > <nl> + < / ClCompile > <nl> + < ClCompile Include = " $ ( SolutionDir ) \ . . \ src \ core \ lib \ json \ json . c " > <nl> + < / ClCompile > <nl> + < ClCompile Include = " $ ( SolutionDir ) \ . . \ src \ core \ lib \ json \ json_reader . c " > <nl> + < / ClCompile > <nl> + < ClCompile Include = " $ ( SolutionDir ) \ . . \ src \ core \ lib \ json \ json_string . c " > <nl> + < / ClCompile > <nl> + < ClCompile Include = " $ ( SolutionDir ) \ . . \ src \ core \ lib \ json \ json_writer . c " > <nl> + < / ClCompile > <nl> + < ClCompile Include = " $ ( SolutionDir ) \ . . \ src \ core \ lib \ slice \ b64 . c " > <nl> + < / ClCompile > <nl> + < ClCompile Include = " $ ( SolutionDir ) \ . . \ src \ core \ lib \ slice \ percent_encoding . c " > <nl> + < / ClCompile > <nl> + < ClCompile Include = " $ ( SolutionDir ) \ . . \ src \ core \ lib \ slice \ slice . c " > <nl> + < / ClCompile > <nl> + < ClCompile Include = " $ ( SolutionDir ) \ . . \ src \ core \ lib \ slice \ slice_buffer . c " > <nl> + < / ClCompile > <nl> + < ClCompile Include = " $ ( SolutionDir ) \ . . \ src \ core \ lib \ slice \ slice_hash_table . c " > <nl> + < / ClCompile > <nl> + < ClCompile Include = " $ ( SolutionDir ) \ . . \ src \ core \ lib \ slice \ slice_intern . c " > <nl> + < / ClCompile > <nl> + < ClCompile Include = " $ ( SolutionDir ) \ . . \ src \ core \ lib \ slice \ slice_string_helpers . c " > <nl> + < / ClCompile > <nl> + < ClCompile Include = " $ ( SolutionDir ) \ . . \ src \ core \ lib \ surface \ alarm . c " > <nl> + < / ClCompile > <nl> + < ClCompile Include = " $ ( SolutionDir ) \ . . \ src \ core \ lib \ surface \ api_trace . c " > <nl> + < / ClCompile > <nl> + < ClCompile Include = " $ ( SolutionDir ) \ . . \ src \ core \ lib \ surface \ byte_buffer . c " > <nl> + < / ClCompile > <nl> + < ClCompile Include = " $ ( SolutionDir ) \ . . \ src \ core \ lib \ surface \ byte_buffer_reader . c " > <nl> + < / ClCompile > <nl> + < ClCompile Include = " $ ( SolutionDir ) \ . . \ src \ core \ lib \ surface \ call . c " > <nl> + < / ClCompile > <nl> + < ClCompile Include = " $ ( SolutionDir ) \ . . \ src \ core \ lib \ surface \ call_details . c " > <nl> + < / ClCompile > <nl> + < ClCompile Include = " $ ( SolutionDir ) \ . . \ src \ core \ lib \ surface \ call_log_batch . c " > <nl> + < / ClCompile > <nl> + < ClCompile Include = " $ ( SolutionDir ) \ . . \ src \ core \ lib \ surface \ channel . c " > <nl> + < / ClCompile > <nl> + < ClCompile Include = " $ ( SolutionDir ) \ . . \ src \ core \ lib \ surface \ channel_init . c " > <nl> + < / ClCompile > <nl> + < ClCompile Include = " $ ( SolutionDir ) \ . . \ src \ core \ lib \ surface \ channel_ping . c " > <nl> + < / ClCompile > <nl> + < ClCompile Include = " $ ( SolutionDir ) \ . . \ src \ core \ lib \ surface \ channel_stack_type . c " > <nl> + < / ClCompile > <nl> + < ClCompile Include = " $ ( SolutionDir ) \ . . \ src \ core \ lib \ surface \ completion_queue . c " > <nl> + < / ClCompile > <nl> + < ClCompile Include = " $ ( SolutionDir ) \ . . \ src \ core \ lib \ surface \ completion_queue_factory . c " > <nl> + < / ClCompile > <nl> + < ClCompile Include = " $ ( SolutionDir ) \ . . \ src \ core \ lib \ surface \ event_string . c " > <nl> + < / ClCompile > <nl> + < ClCompile Include = " $ ( SolutionDir ) \ . . \ src \ core \ lib \ surface \ lame_client . cc " > <nl> + < / ClCompile > <nl> + < ClCompile Include = " $ ( SolutionDir ) \ . . \ src \ core \ lib \ surface \ metadata_array . c " > <nl> + < / ClCompile > <nl> + < ClCompile Include = " $ ( SolutionDir ) \ . . \ src \ core \ lib \ surface \ server . c " > <nl> + < / ClCompile > <nl> + < ClCompile Include = " $ ( SolutionDir ) \ . . \ src \ core \ lib \ surface \ validate_metadata . c " > <nl> + < / ClCompile > <nl> + < ClCompile Include = " $ ( SolutionDir ) \ . . \ src \ core \ lib \ surface \ version . c " > <nl> + < / ClCompile > <nl> + < ClCompile Include = " $ ( SolutionDir ) \ . . \ src \ core \ lib \ transport \ bdp_estimator . c " > <nl> + < / ClCompile > <nl> + < ClCompile Include = " $ ( SolutionDir ) \ . . \ src \ core \ lib \ transport \ byte_stream . c " > <nl> + < / ClCompile > <nl> + < ClCompile Include = " $ ( SolutionDir ) \ . . \ src \ core \ lib \ transport \ connectivity_state . c " > <nl> + < / ClCompile > <nl> + < ClCompile Include = " $ ( SolutionDir ) \ . . \ src \ core \ lib \ transport \ error_utils . c " > <nl> + < / ClCompile > <nl> + < ClCompile Include = " $ ( SolutionDir ) \ . . \ src \ core \ lib \ transport \ metadata . c " > <nl> + < / ClCompile > <nl> + < ClCompile Include = " $ ( SolutionDir ) \ . . \ src \ core \ lib \ transport \ metadata_batch . c " > <nl> + < / ClCompile > <nl> + < ClCompile Include = " $ ( SolutionDir ) \ . . \ src \ core \ lib \ transport \ pid_controller . c " > <nl> + < / ClCompile > <nl> + < ClCompile Include = " $ ( SolutionDir ) \ . . \ src \ core \ lib \ transport \ service_config . c " > <nl> + < / ClCompile > <nl> + < ClCompile Include = " $ ( SolutionDir ) \ . . \ src \ core \ lib \ transport \ static_metadata . c " > <nl> + < / ClCompile > <nl> + < ClCompile Include = " $ ( SolutionDir ) \ . . \ src \ core \ lib \ transport \ status_conversion . c " > <nl> + < / ClCompile > <nl> + < ClCompile Include = " $ ( SolutionDir ) \ . . \ src \ core \ lib \ transport \ timeout_encoding . c " > <nl> + < / ClCompile > <nl> + < ClCompile Include = " $ ( SolutionDir ) \ . . \ src \ core \ lib \ transport \ transport . c " > <nl> + < / ClCompile > <nl> + < ClCompile Include = " $ ( SolutionDir ) \ . . \ src \ core \ lib \ transport \ transport_op_string . c " > <nl> + < / ClCompile > <nl> + < ClCompile Include = " $ ( SolutionDir ) \ . . \ src \ core \ lib \ debug \ trace . c " > <nl> + < / ClCompile > <nl> + < ClCompile Include = " $ ( SolutionDir ) \ . . \ src \ core \ ext \ filters \ client_channel \ channel_connectivity . c " > <nl> + < / ClCompile > <nl> + < ClCompile Include = " $ ( SolutionDir ) \ . . \ src \ core \ ext \ filters \ client_channel \ client_channel . c " > <nl> + < / ClCompile > <nl> + < ClCompile Include = " $ ( SolutionDir ) \ . . \ src \ core \ ext \ filters \ client_channel \ client_channel_factory . c " > <nl> + < / ClCompile > <nl> + < ClCompile Include = " $ ( SolutionDir ) \ . . \ src \ core \ ext \ filters \ client_channel \ client_channel_plugin . c " > <nl> + < / ClCompile > <nl> + < ClCompile Include = " $ ( SolutionDir ) \ . . \ src \ core \ ext \ filters \ client_channel \ connector . c " > <nl> + < / ClCompile > <nl> + < ClCompile Include = " $ ( SolutionDir ) \ . . \ src \ core \ ext \ filters \ client_channel \ http_connect_handshaker . c " > <nl> + < / ClCompile > <nl> + < ClCompile Include = " $ ( SolutionDir ) \ . . \ src \ core \ ext \ filters \ client_channel \ http_proxy . c " > <nl> + < / ClCompile > <nl> + < ClCompile Include = " $ ( SolutionDir ) \ . . \ src \ core \ ext \ filters \ client_channel \ lb_policy . c " > <nl> + < / ClCompile > <nl> + < ClCompile Include = " $ ( SolutionDir ) \ . . \ src \ core \ ext \ filters \ client_channel \ lb_policy_factory . c " > <nl> + < / ClCompile > <nl> + < ClCompile Include = " $ ( SolutionDir ) \ . . \ src \ core \ ext \ filters \ client_channel \ lb_policy_registry . c " > <nl> + < / ClCompile > <nl> + < ClCompile Include = " $ ( SolutionDir ) \ . . \ src \ core \ ext \ filters \ client_channel \ parse_address . c " > <nl> + < / ClCompile > <nl> + < ClCompile Include = " $ ( SolutionDir ) \ . . \ src \ core \ ext \ filters \ client_channel \ proxy_mapper . c " > <nl> + < / ClCompile > <nl> + < ClCompile Include = " $ ( SolutionDir ) \ . . \ src \ core \ ext \ filters \ client_channel \ proxy_mapper_registry . c " > <nl> + < / ClCompile > <nl> + < ClCompile Include = " $ ( SolutionDir ) \ . . \ src \ core \ ext \ filters \ client_channel \ resolver . c " > <nl> + < / ClCompile > <nl> + < ClCompile Include = " $ ( SolutionDir ) \ . . \ src \ core \ ext \ filters \ client_channel \ resolver_factory . c " > <nl> + < / ClCompile > <nl> + < ClCompile Include = " $ ( SolutionDir ) \ . . \ src \ core \ ext \ filters \ client_channel \ resolver_registry . c " > <nl> + < / ClCompile > <nl> + < ClCompile Include = " $ ( SolutionDir ) \ . . \ src \ core \ ext \ filters \ client_channel \ retry_throttle . c " > <nl> + < / ClCompile > <nl> + < ClCompile Include = " $ ( SolutionDir ) \ . . \ src \ core \ ext \ filters \ client_channel \ subchannel . c " > <nl> + < / ClCompile > <nl> + < ClCompile Include = " $ ( SolutionDir ) \ . . \ src \ core \ ext \ filters \ client_channel \ subchannel_index . c " > <nl> + < / ClCompile > <nl> + < ClCompile Include = " $ ( SolutionDir ) \ . . \ src \ core \ ext \ filters \ client_channel \ uri_parser . c " > <nl> + < / ClCompile > <nl> + < ClCompile Include = " $ ( SolutionDir ) \ . . \ src \ core \ ext \ filters \ deadline \ deadline_filter . c " > <nl> + < / ClCompile > <nl> + < ClCompile Include = " $ ( SolutionDir ) \ . . \ src \ core \ ext \ transport \ chttp2 \ transport \ bin_decoder . c " > <nl> + < / ClCompile > <nl> + < ClCompile Include = " $ ( SolutionDir ) \ . . \ src \ core \ ext \ transport \ chttp2 \ transport \ bin_encoder . c " > <nl> + < / ClCompile > <nl> + < ClCompile Include = " $ ( SolutionDir ) \ . . \ src \ core \ ext \ transport \ chttp2 \ transport \ chttp2_plugin . c " > <nl> + < / ClCompile > <nl> + < ClCompile Include = " $ ( SolutionDir ) \ . . \ src \ core \ ext \ transport \ chttp2 \ transport \ chttp2_transport . c " > <nl> + < / ClCompile > <nl> + < ClCompile Include = " $ ( SolutionDir ) \ . . \ src \ core \ ext \ transport \ chttp2 \ transport \ frame_data . c " > <nl> + < / ClCompile > <nl> + < ClCompile Include = " $ ( SolutionDir ) \ . . \ src \ core \ ext \ transport \ chttp2 \ transport \ frame_goaway . c " > <nl> + < / ClCompile > <nl> + < ClCompile Include = " $ ( SolutionDir ) \ . . \ src \ core \ ext \ transport \ chttp2 \ transport \ frame_ping . c " > <nl> + < / ClCompile > <nl> + < ClCompile Include = " $ ( SolutionDir ) \ . . \ src \ core \ ext \ transport \ chttp2 \ transport \ frame_rst_stream . c " > <nl> + < / ClCompile > <nl> + < ClCompile Include = " $ ( SolutionDir ) \ . . \ src \ core \ ext \ transport \ chttp2 \ transport \ frame_settings . c " > <nl> + < / ClCompile > <nl> + < ClCompile Include = " $ ( SolutionDir ) \ . . \ src \ core \ ext \ transport \ chttp2 \ transport \ frame_window_update . c " > <nl> + < / ClCompile > <nl> + < ClCompile Include = " $ ( SolutionDir ) \ . . \ src \ core \ ext \ transport \ chttp2 \ transport \ hpack_encoder . c " > <nl> + < / ClCompile > <nl> + < ClCompile Include = " $ ( SolutionDir ) \ . . \ src \ core \ ext \ transport \ chttp2 \ transport \ hpack_parser . c " > <nl> + < / ClCompile > <nl> + < ClCompile Include = " $ ( SolutionDir ) \ . . \ src \ core \ ext \ transport \ chttp2 \ transport \ hpack_table . c " > <nl> + < / ClCompile > <nl> + < ClCompile Include = " $ ( SolutionDir ) \ . . \ src \ core \ ext \ transport \ chttp2 \ transport \ http2_settings . c " > <nl> + < / ClCompile > <nl> + < ClCompile Include = " $ ( SolutionDir ) \ . . \ src \ core \ ext \ transport \ chttp2 \ transport \ huffsyms . c " > <nl> + < / ClCompile > <nl> + < ClCompile Include = " $ ( SolutionDir ) \ . . \ src \ core \ ext \ transport \ chttp2 \ transport \ incoming_metadata . c " > <nl> + < / ClCompile > <nl> + < ClCompile Include = " $ ( SolutionDir ) \ . . \ src \ core \ ext \ transport \ chttp2 \ transport \ parsing . c " > <nl> + < / ClCompile > <nl> + < ClCompile Include = " $ ( SolutionDir ) \ . . \ src \ core \ ext \ transport \ chttp2 \ transport \ stream_lists . c " > <nl> + < / ClCompile > <nl> + < ClCompile Include = " $ ( SolutionDir ) \ . . \ src \ core \ ext \ transport \ chttp2 \ transport \ stream_map . c " > <nl> + < / ClCompile > <nl> + < ClCompile Include = " $ ( SolutionDir ) \ . . \ src \ core \ ext \ transport \ chttp2 \ transport \ varint . c " > <nl> + < / ClCompile > <nl> + < ClCompile Include = " $ ( SolutionDir ) \ . . \ src \ core \ ext \ transport \ chttp2 \ transport \ writing . c " > <nl> + < / ClCompile > <nl> + < ClCompile Include = " $ ( SolutionDir ) \ . . \ src \ core \ ext \ transport \ chttp2 \ alpn \ alpn . c " > <nl> + < / ClCompile > <nl> + < ClCompile Include = " $ ( SolutionDir ) \ . . \ src \ core \ ext \ filters \ http \ client \ http_client_filter . c " > <nl> + < / ClCompile > <nl> + < ClCompile Include = " $ ( SolutionDir ) \ . . \ src \ core \ ext \ filters \ http \ http_filters_plugin . c " > <nl> + < / ClCompile > <nl> + < ClCompile Include = " $ ( SolutionDir ) \ . . \ src \ core \ ext \ filters \ http \ message_compress \ message_compress_filter . c " > <nl> + < / ClCompile > <nl> + < ClCompile Include = " $ ( SolutionDir ) \ . . \ src \ core \ ext \ filters \ http \ server \ http_server_filter . c " > <nl> + < / ClCompile > <nl> < / ItemGroup > <nl> < ItemGroup > <nl> < ProjectReference Include = " $ ( SolutionDir ) \ . . \ vsprojects \ vcxproj \ . \ gpr \ gpr . vcxproj " > <nl> <nl> < ProjectReference Include = " $ ( SolutionDir ) \ . . \ vsprojects \ vcxproj \ . \ grpc_unsecure \ grpc_unsecure . vcxproj " > <nl> < Project > { 46CEDFFF - 9692 - 456A - AA24 - 38B5D6BCF4C5 } < / Project > <nl> < / ProjectReference > <nl> - < ProjectReference Include = " $ ( SolutionDir ) \ . . \ vsprojects \ vcxproj \ . \ grpc \ grpc . vcxproj " > <nl> - < Project > { 29D16885 - 7228 - 4C31 - 81ED - 5F9187C7F2A9 } < / Project > <nl> - < / ProjectReference > <nl> < / ItemGroup > <nl> < Import Project = " $ ( VCTargetsPath ) \ Microsoft . Cpp . targets " / > <nl> < ImportGroup Label = " ExtensionTargets " > <nl> mmm a / vsprojects / vcxproj / grpc_test_util_unsecure / grpc_test_util_unsecure . vcxproj . filters <nl> ppp b / vsprojects / vcxproj / grpc_test_util_unsecure / grpc_test_util_unsecure . vcxproj . filters <nl> <nl> < ClCompile Include = " $ ( SolutionDir ) \ . . \ test \ core \ util \ trickle_endpoint . c " > <nl> < Filter > test \ core \ util < / Filter > <nl> < / ClCompile > <nl> + < ClCompile Include = " $ ( SolutionDir ) \ . . \ src \ core \ lib \ channel \ channel_args . c " > <nl> + < Filter > src \ core \ lib \ channel < / Filter > <nl> + < / ClCompile > <nl> + < ClCompile Include = " $ ( SolutionDir ) \ . . \ src \ core \ lib \ channel \ channel_stack . c " > <nl> + < Filter > src \ core \ lib \ channel < / Filter > <nl> + < / ClCompile > <nl> + < ClCompile Include = " $ ( SolutionDir ) \ . . \ src \ core \ lib \ channel \ channel_stack_builder . c " > <nl> + < Filter > src \ core \ lib \ channel < / Filter > <nl> + < / ClCompile > <nl> + < ClCompile Include = " $ ( SolutionDir ) \ . . \ src \ core \ lib \ channel \ connected_channel . c " > <nl> + < Filter > src \ core \ lib \ channel < / Filter > <nl> + < / ClCompile > <nl> + < ClCompile Include = " $ ( SolutionDir ) \ . . \ src \ core \ lib \ channel \ handshaker . c " > <nl> + < Filter > src \ core \ lib \ channel < / Filter > <nl> + < / ClCompile > <nl> + < ClCompile Include = " $ ( SolutionDir ) \ . . \ src \ core \ lib \ channel \ handshaker_factory . c " > <nl> + < Filter > src \ core \ lib \ channel < / Filter > <nl> + < / ClCompile > <nl> + < ClCompile Include = " $ ( SolutionDir ) \ . . \ src \ core \ lib \ channel \ handshaker_registry . c " > <nl> + < Filter > src \ core \ lib \ channel < / Filter > <nl> + < / ClCompile > <nl> + < ClCompile Include = " $ ( SolutionDir ) \ . . \ src \ core \ lib \ compression \ compression . c " > <nl> + < Filter > src \ core \ lib \ compression < / Filter > <nl> + < / ClCompile > <nl> + < ClCompile Include = " $ ( SolutionDir ) \ . . \ src \ core \ lib \ compression \ message_compress . c " > <nl> + < Filter > src \ core \ lib \ compression < / Filter > <nl> + < / ClCompile > <nl> + < ClCompile Include = " $ ( SolutionDir ) \ . . \ src \ core \ lib \ compression \ stream_compression . c " > <nl> + < Filter > src \ core \ lib \ compression < / Filter > <nl> + < / ClCompile > <nl> + < ClCompile Include = " $ ( SolutionDir ) \ . . \ src \ core \ lib \ http \ format_request . c " > <nl> + < Filter > src \ core \ lib \ http < / Filter > <nl> + < / ClCompile > <nl> + < ClCompile Include = " $ ( SolutionDir ) \ . . \ src \ core \ lib \ http \ httpcli . c " > <nl> + < Filter > src \ core \ lib \ http < / Filter > <nl> + < / ClCompile > <nl> + < ClCompile Include = " $ ( SolutionDir ) \ . . \ src \ core \ lib \ http \ parser . c " > <nl> + < Filter > src \ core \ lib \ http < / Filter > <nl> + < / ClCompile > <nl> + < ClCompile Include = " $ ( SolutionDir ) \ . . \ src \ core \ lib \ iomgr \ closure . c " > <nl> + < Filter > src \ core \ lib \ iomgr < / Filter > <nl> + < / ClCompile > <nl> + < ClCompile Include = " $ ( SolutionDir ) \ . . \ src \ core \ lib \ iomgr \ combiner . c " > <nl> + < Filter > src \ core \ lib \ iomgr < / Filter > <nl> + < / ClCompile > <nl> + < ClCompile Include = " $ ( SolutionDir ) \ . . \ src \ core \ lib \ iomgr \ endpoint . c " > <nl> + < Filter > src \ core \ lib \ iomgr < / Filter > <nl> + < / ClCompile > <nl> + < ClCompile Include = " $ ( SolutionDir ) \ . . \ src \ core \ lib \ iomgr \ endpoint_pair_posix . c " > <nl> + < Filter > src \ core \ lib \ iomgr < / Filter > <nl> + < / ClCompile > <nl> + < ClCompile Include = " $ ( SolutionDir ) \ . . \ src \ core \ lib \ iomgr \ endpoint_pair_uv . c " > <nl> + < Filter > src \ core \ lib \ iomgr < / Filter > <nl> + < / ClCompile > <nl> + < ClCompile Include = " $ ( SolutionDir ) \ . . \ src \ core \ lib \ iomgr \ endpoint_pair_windows . c " > <nl> + < Filter > src \ core \ lib \ iomgr < / Filter > <nl> + < / ClCompile > <nl> + < ClCompile Include = " $ ( SolutionDir ) \ . . \ src \ core \ lib \ iomgr \ error . c " > <nl> + < Filter > src \ core \ lib \ iomgr < / Filter > <nl> + < / ClCompile > <nl> + < ClCompile Include = " $ ( SolutionDir ) \ . . \ src \ core \ lib \ iomgr \ ev_epoll1_linux . c " > <nl> + < Filter > src \ core \ lib \ iomgr < / Filter > <nl> + < / ClCompile > <nl> + < ClCompile Include = " $ ( SolutionDir ) \ . . \ src \ core \ lib \ iomgr \ ev_epoll_limited_pollers_linux . c " > <nl> + < Filter > src \ core \ lib \ iomgr < / Filter > <nl> + < / ClCompile > <nl> + < ClCompile Include = " $ ( SolutionDir ) \ . . \ src \ core \ lib \ iomgr \ ev_epoll_thread_pool_linux . c " > <nl> + < Filter > src \ core \ lib \ iomgr < / Filter > <nl> + < / ClCompile > <nl> + < ClCompile Include = " $ ( SolutionDir ) \ . . \ src \ core \ lib \ iomgr \ ev_epollex_linux . c " > <nl> + < Filter > src \ core \ lib \ iomgr < / Filter > <nl> + < / ClCompile > <nl> + < ClCompile Include = " $ ( SolutionDir ) \ . . \ src \ core \ lib \ iomgr \ ev_epollsig_linux . c " > <nl> + < Filter > src \ core \ lib \ iomgr < / Filter > <nl> + < / ClCompile > <nl> + < ClCompile Include = " $ ( SolutionDir ) \ . . \ src \ core \ lib \ iomgr \ ev_poll_posix . c " > <nl> + < Filter > src \ core \ lib \ iomgr < / Filter > <nl> + < / ClCompile > <nl> + < ClCompile Include = " $ ( SolutionDir ) \ . . \ src \ core \ lib \ iomgr \ ev_posix . c " > <nl> + < Filter > src \ core \ lib \ iomgr < / Filter > <nl> + < / ClCompile > <nl> + < ClCompile Include = " $ ( SolutionDir ) \ . . \ src \ core \ lib \ iomgr \ ev_windows . c " > <nl> + < Filter > src \ core \ lib \ iomgr < / Filter > <nl> + < / ClCompile > <nl> + < ClCompile Include = " $ ( SolutionDir ) \ . . \ src \ core \ lib \ iomgr \ exec_ctx . c " > <nl> + < Filter > src \ core \ lib \ iomgr < / Filter > <nl> + < / ClCompile > <nl> + < ClCompile Include = " $ ( SolutionDir ) \ . . \ src \ core \ lib \ iomgr \ executor . c " > <nl> + < Filter > src \ core \ lib \ iomgr < / Filter > <nl> + < / ClCompile > <nl> + < ClCompile Include = " $ ( SolutionDir ) \ . . \ src \ core \ lib \ iomgr \ iocp_windows . c " > <nl> + < Filter > src \ core \ lib \ iomgr < / Filter > <nl> + < / ClCompile > <nl> + < ClCompile Include = " $ ( SolutionDir ) \ . . \ src \ core \ lib \ iomgr \ iomgr . c " > <nl> + < Filter > src \ core \ lib \ iomgr < / Filter > <nl> + < / ClCompile > <nl> + < ClCompile Include = " $ ( SolutionDir ) \ . . \ src \ core \ lib \ iomgr \ iomgr_posix . c " > <nl> + < Filter > src \ core \ lib \ iomgr < / Filter > <nl> + < / ClCompile > <nl> + < ClCompile Include = " $ ( SolutionDir ) \ . . \ src \ core \ lib \ iomgr \ iomgr_uv . c " > <nl> + < Filter > src \ core \ lib \ iomgr < / Filter > <nl> + < / ClCompile > <nl> + < ClCompile Include = " $ ( SolutionDir ) \ . . \ src \ core \ lib \ iomgr \ iomgr_windows . c " > <nl> + < Filter > src \ core \ lib \ iomgr < / Filter > <nl> + < / ClCompile > <nl> + < ClCompile Include = " $ ( SolutionDir ) \ . . \ src \ core \ lib \ iomgr \ is_epollexclusive_available . c " > <nl> + < Filter > src \ core \ lib \ iomgr < / Filter > <nl> + < / ClCompile > <nl> + < ClCompile Include = " $ ( SolutionDir ) \ . . \ src \ core \ lib \ iomgr \ load_file . c " > <nl> + < Filter > src \ core \ lib \ iomgr < / Filter > <nl> + < / ClCompile > <nl> + < ClCompile Include = " $ ( SolutionDir ) \ . . \ src \ core \ lib \ iomgr \ lockfree_event . c " > <nl> + < Filter > src \ core \ lib \ iomgr < / Filter > <nl> + < / ClCompile > <nl> + < ClCompile Include = " $ ( SolutionDir ) \ . . \ src \ core \ lib \ iomgr \ network_status_tracker . c " > <nl> + < Filter > src \ core \ lib \ iomgr < / Filter > <nl> + < / ClCompile > <nl> + < ClCompile Include = " $ ( SolutionDir ) \ . . \ src \ core \ lib \ iomgr \ polling_entity . c " > <nl> + < Filter > src \ core \ lib \ iomgr < / Filter > <nl> + < / ClCompile > <nl> + < ClCompile Include = " $ ( SolutionDir ) \ . . \ src \ core \ lib \ iomgr \ pollset_set_uv . c " > <nl> + < Filter > src \ core \ lib \ iomgr < / Filter > <nl> + < / ClCompile > <nl> + < ClCompile Include = " $ ( SolutionDir ) \ . . \ src \ core \ lib \ iomgr \ pollset_set_windows . c " > <nl> + < Filter > src \ core \ lib \ iomgr < / Filter > <nl> + < / ClCompile > <nl> + < ClCompile Include = " $ ( SolutionDir ) \ . . \ src \ core \ lib \ iomgr \ pollset_uv . c " > <nl> + < Filter > src \ core \ lib \ iomgr < / Filter > <nl> + < / ClCompile > <nl> + < ClCompile Include = " $ ( SolutionDir ) \ . . \ src \ core \ lib \ iomgr \ pollset_windows . c " > <nl> + < Filter > src \ core \ lib \ iomgr < / Filter > <nl> + < / ClCompile > <nl> + < ClCompile Include = " $ ( SolutionDir ) \ . . \ src \ core \ lib \ iomgr \ resolve_address_posix . c " > <nl> + < Filter > src \ core \ lib \ iomgr < / Filter > <nl> + < / ClCompile > <nl> + < ClCompile Include = " $ ( SolutionDir ) \ . . \ src \ core \ lib \ iomgr \ resolve_address_uv . c " > <nl> + < Filter > src \ core \ lib \ iomgr < / Filter > <nl> + < / ClCompile > <nl> + < ClCompile Include = " $ ( SolutionDir ) \ . . \ src \ core \ lib \ iomgr \ resolve_address_windows . c " > <nl> + < Filter > src \ core \ lib \ iomgr < / Filter > <nl> + < / ClCompile > <nl> + < ClCompile Include = " $ ( SolutionDir ) \ . . \ src \ core \ lib \ iomgr \ resource_quota . c " > <nl> + < Filter > src \ core \ lib \ iomgr < / Filter > <nl> + < / ClCompile > <nl> + < ClCompile Include = " $ ( SolutionDir ) \ . . \ src \ core \ lib \ iomgr \ sockaddr_utils . c " > <nl> + < Filter > src \ core \ lib \ iomgr < / Filter > <nl> + < / ClCompile > <nl> + < ClCompile Include = " $ ( SolutionDir ) \ . . \ src \ core \ lib \ iomgr \ socket_factory_posix . c " > <nl> + < Filter > src \ core \ lib \ iomgr < / Filter > <nl> + < / ClCompile > <nl> + < ClCompile Include = " $ ( SolutionDir ) \ . . \ src \ core \ lib \ iomgr \ socket_mutator . c " > <nl> + < Filter > src \ core \ lib \ iomgr < / Filter > <nl> + < / ClCompile > <nl> + < ClCompile Include = " $ ( SolutionDir ) \ . . \ src \ core \ lib \ iomgr \ socket_utils_common_posix . c " > <nl> + < Filter > src \ core \ lib \ iomgr < / Filter > <nl> + < / ClCompile > <nl> + < ClCompile Include = " $ ( SolutionDir ) \ . . \ src \ core \ lib \ iomgr \ socket_utils_linux . c " > <nl> + < Filter > src \ core \ lib \ iomgr < / Filter > <nl> + < / ClCompile > <nl> + < ClCompile Include = " $ ( SolutionDir ) \ . . \ src \ core \ lib \ iomgr \ socket_utils_posix . c " > <nl> + < Filter > src \ core \ lib \ iomgr < / Filter > <nl> + < / ClCompile > <nl> + < ClCompile Include = " $ ( SolutionDir ) \ . . \ src \ core \ lib \ iomgr \ socket_utils_uv . c " > <nl> + < Filter > src \ core \ lib \ iomgr < / Filter > <nl> + < / ClCompile > <nl> + < ClCompile Include = " $ ( SolutionDir ) \ . . \ src \ core \ lib \ iomgr \ socket_utils_windows . c " > <nl> + < Filter > src \ core \ lib \ iomgr < / Filter > <nl> + < / ClCompile > <nl> + < ClCompile Include = " $ ( SolutionDir ) \ . . \ src \ core \ lib \ iomgr \ socket_windows . c " > <nl> + < Filter > src \ core \ lib \ iomgr < / Filter > <nl> + < / ClCompile > <nl> + < ClCompile Include = " $ ( SolutionDir ) \ . . \ src \ core \ lib \ iomgr \ tcp_client_posix . c " > <nl> + < Filter > src \ core \ lib \ iomgr < / Filter > <nl> + < / ClCompile > <nl> + < ClCompile Include = " $ ( SolutionDir ) \ . . \ src \ core \ lib \ iomgr \ tcp_client_uv . c " > <nl> + < Filter > src \ core \ lib \ iomgr < / Filter > <nl> + < / ClCompile > <nl> + < ClCompile Include = " $ ( SolutionDir ) \ . . \ src \ core \ lib \ iomgr \ tcp_client_windows . c " > <nl> + < Filter > src \ core \ lib \ iomgr < / Filter > <nl> + < / ClCompile > <nl> + < ClCompile Include = " $ ( SolutionDir ) \ . . \ src \ core \ lib \ iomgr \ tcp_posix . c " > <nl> + < Filter > src \ core \ lib \ iomgr < / Filter > <nl> + < / ClCompile > <nl> + < ClCompile Include = " $ ( SolutionDir ) \ . . \ src \ core \ lib \ iomgr \ tcp_server_posix . c " > <nl> + < Filter > src \ core \ lib \ iomgr < / Filter > <nl> + < / ClCompile > <nl> + < ClCompile Include = " $ ( SolutionDir ) \ . . \ src \ core \ lib \ iomgr \ tcp_server_utils_posix_common . c " > <nl> + < Filter > src \ core \ lib \ iomgr < / Filter > <nl> + < / ClCompile > <nl> + < ClCompile Include = " $ ( SolutionDir ) \ . . \ src \ core \ lib \ iomgr \ tcp_server_utils_posix_ifaddrs . c " > <nl> + < Filter > src \ core \ lib \ iomgr < / Filter > <nl> + < / ClCompile > <nl> + < ClCompile Include = " $ ( SolutionDir ) \ . . \ src \ core \ lib \ iomgr \ tcp_server_utils_posix_noifaddrs . c " > <nl> + < Filter > src \ core \ lib \ iomgr < / Filter > <nl> + < / ClCompile > <nl> + < ClCompile Include = " $ ( SolutionDir ) \ . . \ src \ core \ lib \ iomgr \ tcp_server_uv . c " > <nl> + < Filter > src \ core \ lib \ iomgr < / Filter > <nl> + < / ClCompile > <nl> + < ClCompile Include = " $ ( SolutionDir ) \ . . \ src \ core \ lib \ iomgr \ tcp_server_windows . c " > <nl> + < Filter > src \ core \ lib \ iomgr < / Filter > <nl> + < / ClCompile > <nl> + < ClCompile Include = " $ ( SolutionDir ) \ . . \ src \ core \ lib \ iomgr \ tcp_uv . c " > <nl> + < Filter > src \ core \ lib \ iomgr < / Filter > <nl> + < / ClCompile > <nl> + < ClCompile Include = " $ ( SolutionDir ) \ . . \ src \ core \ lib \ iomgr \ tcp_windows . c " > <nl> + < Filter > src \ core \ lib \ iomgr < / Filter > <nl> + < / ClCompile > <nl> + < ClCompile Include = " $ ( SolutionDir ) \ . . \ src \ core \ lib \ iomgr \ time_averaged_stats . c " > <nl> + < Filter > src \ core \ lib \ iomgr < / Filter > <nl> + < / ClCompile > <nl> + < ClCompile Include = " $ ( SolutionDir ) \ . . \ src \ core \ lib \ iomgr \ timer_generic . c " > <nl> + < Filter > src \ core \ lib \ iomgr < / Filter > <nl> + < / ClCompile > <nl> + < ClCompile Include = " $ ( SolutionDir ) \ . . \ src \ core \ lib \ iomgr \ timer_heap . c " > <nl> + < Filter > src \ core \ lib \ iomgr < / Filter > <nl> + < / ClCompile > <nl> + < ClCompile Include = " $ ( SolutionDir ) \ . . \ src \ core \ lib \ iomgr \ timer_manager . c " > <nl> + < Filter > src \ core \ lib \ iomgr < / Filter > <nl> + < / ClCompile > <nl> + < ClCompile Include = " $ ( SolutionDir ) \ . . \ src \ core \ lib \ iomgr \ timer_uv . c " > <nl> + < Filter > src \ core \ lib \ iomgr < / Filter > <nl> + < / ClCompile > <nl> + < ClCompile Include = " $ ( SolutionDir ) \ . . \ src \ core \ lib \ iomgr \ udp_server . c " > <nl> + < Filter > src \ core \ lib \ iomgr < / Filter > <nl> + < / ClCompile > <nl> + < ClCompile Include = " $ ( SolutionDir ) \ . . \ src \ core \ lib \ iomgr \ unix_sockets_posix . c " > <nl> + < Filter > src \ core \ lib \ iomgr < / Filter > <nl> + < / ClCompile > <nl> + < ClCompile Include = " $ ( SolutionDir ) \ . . \ src \ core \ lib \ iomgr \ unix_sockets_posix_noop . c " > <nl> + < Filter > src \ core \ lib \ iomgr < / Filter > <nl> + < / ClCompile > <nl> + < ClCompile Include = " $ ( SolutionDir ) \ . . \ src \ core \ lib \ iomgr \ wakeup_fd_cv . c " > <nl> + < Filter > src \ core \ lib \ iomgr < / Filter > <nl> + < / ClCompile > <nl> + < ClCompile Include = " $ ( SolutionDir ) \ . . \ src \ core \ lib \ iomgr \ wakeup_fd_eventfd . c " > <nl> + < Filter > src \ core \ lib \ iomgr < / Filter > <nl> + < / ClCompile > <nl> + < ClCompile Include = " $ ( SolutionDir ) \ . . \ src \ core \ lib \ iomgr \ wakeup_fd_nospecial . c " > <nl> + < Filter > src \ core \ lib \ iomgr < / Filter > <nl> + < / ClCompile > <nl> + < ClCompile Include = " $ ( SolutionDir ) \ . . \ src \ core \ lib \ iomgr \ wakeup_fd_pipe . c " > <nl> + < Filter > src \ core \ lib \ iomgr < / Filter > <nl> + < / ClCompile > <nl> + < ClCompile Include = " $ ( SolutionDir ) \ . . \ src \ core \ lib \ iomgr \ wakeup_fd_posix . c " > <nl> + < Filter > src \ core \ lib \ iomgr < / Filter > <nl> + < / ClCompile > <nl> + < ClCompile Include = " $ ( SolutionDir ) \ . . \ src \ core \ lib \ json \ json . c " > <nl> + < Filter > src \ core \ lib \ json < / Filter > <nl> + < / ClCompile > <nl> + < ClCompile Include = " $ ( SolutionDir ) \ . . \ src \ core \ lib \ json \ json_reader . c " > <nl> + < Filter > src \ core \ lib \ json < / Filter > <nl> + < / ClCompile > <nl> + < ClCompile Include = " $ ( SolutionDir ) \ . . \ src \ core \ lib \ json \ json_string . c " > <nl> + < Filter > src \ core \ lib \ json < / Filter > <nl> + < / ClCompile > <nl> + < ClCompile Include = " $ ( SolutionDir ) \ . . \ src \ core \ lib \ json \ json_writer . c " > <nl> + < Filter > src \ core \ lib \ json < / Filter > <nl> + < / ClCompile > <nl> + < ClCompile Include = " $ ( SolutionDir ) \ . . \ src \ core \ lib \ slice \ b64 . c " > <nl> + < Filter > src \ core \ lib \ slice < / Filter > <nl> + < / ClCompile > <nl> + < ClCompile Include = " $ ( SolutionDir ) \ . . \ src \ core \ lib \ slice \ percent_encoding . c " > <nl> + < Filter > src \ core \ lib \ slice < / Filter > <nl> + < / ClCompile > <nl> + < ClCompile Include = " $ ( SolutionDir ) \ . . \ src \ core \ lib \ slice \ slice . c " > <nl> + < Filter > src \ core \ lib \ slice < / Filter > <nl> + < / ClCompile > <nl> + < ClCompile Include = " $ ( SolutionDir ) \ . . \ src \ core \ lib \ slice \ slice_buffer . c " > <nl> + < Filter > src \ core \ lib \ slice < / Filter > <nl> + < / ClCompile > <nl> + < ClCompile Include = " $ ( SolutionDir ) \ . . \ src \ core \ lib \ slice \ slice_hash_table . c " > <nl> + < Filter > src \ core \ lib \ slice < / Filter > <nl> + < / ClCompile > <nl> + < ClCompile Include = " $ ( SolutionDir ) \ . . \ src \ core \ lib \ slice \ slice_intern . c " > <nl> + < Filter > src \ core \ lib \ slice < / Filter > <nl> + < / ClCompile > <nl> + < ClCompile Include = " $ ( SolutionDir ) \ . . \ src \ core \ lib \ slice \ slice_string_helpers . c " > <nl> + < Filter > src \ core \ lib \ slice < / Filter > <nl> + < / ClCompile > <nl> + < ClCompile Include = " $ ( SolutionDir ) \ . . \ src \ core \ lib \ surface \ alarm . c " > <nl> + < Filter > src \ core \ lib \ surface < / Filter > <nl> + < / ClCompile > <nl> + < ClCompile Include = " $ ( SolutionDir ) \ . . \ src \ core \ lib \ surface \ api_trace . c " > <nl> + < Filter > src \ core \ lib \ surface < / Filter > <nl> + < / ClCompile > <nl> + < ClCompile Include = " $ ( SolutionDir ) \ . . \ src \ core \ lib \ surface \ byte_buffer . c " > <nl> + < Filter > src \ core \ lib \ surface < / Filter > <nl> + < / ClCompile > <nl> + < ClCompile Include = " $ ( SolutionDir ) \ . . \ src \ core \ lib \ surface \ byte_buffer_reader . c " > <nl> + < Filter > src \ core \ lib \ surface < / Filter > <nl> + < / ClCompile > <nl> + < ClCompile Include = " $ ( SolutionDir ) \ . . \ src \ core \ lib \ surface \ call . c " > <nl> + < Filter > src \ core \ lib \ surface < / Filter > <nl> + < / ClCompile > <nl> + < ClCompile Include = " $ ( SolutionDir ) \ . . \ src \ core \ lib \ surface \ call_details . c " > <nl> + < Filter > src \ core \ lib \ surface < / Filter > <nl> + < / ClCompile > <nl> + < ClCompile Include = " $ ( SolutionDir ) \ . . \ src \ core \ lib \ surface \ call_log_batch . c " > <nl> + < Filter > src \ core \ lib \ surface < / Filter > <nl> + < / ClCompile > <nl> + < ClCompile Include = " $ ( SolutionDir ) \ . . \ src \ core \ lib \ surface \ channel . c " > <nl> + < Filter > src \ core \ lib \ surface < / Filter > <nl> + < / ClCompile > <nl> + < ClCompile Include = " $ ( SolutionDir ) \ . . \ src \ core \ lib \ surface \ channel_init . c " > <nl> + < Filter > src \ core \ lib \ surface < / Filter > <nl> + < / ClCompile > <nl> + < ClCompile Include = " $ ( SolutionDir ) \ . . \ src \ core \ lib \ surface \ channel_ping . c " > <nl> + < Filter > src \ core \ lib \ surface < / Filter > <nl> + < / ClCompile > <nl> + < ClCompile Include = " $ ( SolutionDir ) \ . . \ src \ core \ lib \ surface \ channel_stack_type . c " > <nl> + < Filter > src \ core \ lib \ surface < / Filter > <nl> + < / ClCompile > <nl> + < ClCompile Include = " $ ( SolutionDir ) \ . . \ src \ core \ lib \ surface \ completion_queue . c " > <nl> + < Filter > src \ core \ lib \ surface < / Filter > <nl> + < / ClCompile > <nl> + < ClCompile Include = " $ ( SolutionDir ) \ . . \ src \ core \ lib \ surface \ completion_queue_factory . c " > <nl> + < Filter > src \ core \ lib \ surface < / Filter > <nl> + < / ClCompile > <nl> + < ClCompile Include = " $ ( SolutionDir ) \ . . \ src \ core \ lib \ surface \ event_string . c " > <nl> + < Filter > src \ core \ lib \ surface < / Filter > <nl> + < / ClCompile > <nl> + < ClCompile Include = " $ ( SolutionDir ) \ . . \ src \ core \ lib \ surface \ lame_client . cc " > <nl> + < Filter > src \ core \ lib \ surface < / Filter > <nl> + < / ClCompile > <nl> + < ClCompile Include = " $ ( SolutionDir ) \ . . \ src \ core \ lib \ surface \ metadata_array . c " > <nl> + < Filter > src \ core \ lib \ surface < / Filter > <nl> + < / ClCompile > <nl> + < ClCompile Include = " $ ( SolutionDir ) \ . . \ src \ core \ lib \ surface \ server . c " > <nl> + < Filter > src \ core \ lib \ surface < / Filter > <nl> + < / ClCompile > <nl> + < ClCompile Include = " $ ( SolutionDir ) \ . . \ src \ core \ lib \ surface \ validate_metadata . c " > <nl> + < Filter > src \ core \ lib \ surface < / Filter > <nl> + < / ClCompile > <nl> + < ClCompile Include = " $ ( SolutionDir ) \ . . \ src \ core \ lib \ surface \ version . c " > <nl> + < Filter > src \ core \ lib \ surface < / Filter > <nl> + < / ClCompile > <nl> + < ClCompile Include = " $ ( SolutionDir ) \ . . \ src \ core \ lib \ transport \ bdp_estimator . c " > <nl> + < Filter > src \ core \ lib \ transport < / Filter > <nl> + < / ClCompile > <nl> + < ClCompile Include = " $ ( SolutionDir ) \ . . \ src \ core \ lib \ transport \ byte_stream . c " > <nl> + < Filter > src \ core \ lib \ transport < / Filter > <nl> + < / ClCompile > <nl> + < ClCompile Include = " $ ( SolutionDir ) \ . . \ src \ core \ lib \ transport \ connectivity_state . c " > <nl> + < Filter > src \ core \ lib \ transport < / Filter > <nl> + < / ClCompile > <nl> + < ClCompile Include = " $ ( SolutionDir ) \ . . \ src \ core \ lib \ transport \ error_utils . c " > <nl> + < Filter > src \ core \ lib \ transport < / Filter > <nl> + < / ClCompile > <nl> + < ClCompile Include = " $ ( SolutionDir ) \ . . \ src \ core \ lib \ transport \ metadata . c " > <nl> + < Filter > src \ core \ lib \ transport < / Filter > <nl> + < / ClCompile > <nl> + < ClCompile Include = " $ ( SolutionDir ) \ . . \ src \ core \ lib \ transport \ metadata_batch . c " > <nl> + < Filter > src \ core \ lib \ transport < / Filter > <nl> + < / ClCompile > <nl> + < ClCompile Include = " $ ( SolutionDir ) \ . . \ src \ core \ lib \ transport \ pid_controller . c " > <nl> + < Filter > src \ core \ lib \ transport < / Filter > <nl> + < / ClCompile > <nl> + < ClCompile Include = " $ ( SolutionDir ) \ . . \ src \ core \ lib \ transport \ service_config . c " > <nl> + < Filter > src \ core \ lib \ transport < / Filter > <nl> + < / ClCompile > <nl> + < ClCompile Include = " $ ( SolutionDir ) \ . . \ src \ core \ lib \ transport \ static_metadata . c " > <nl> + < Filter > src \ core \ lib \ transport < / Filter > <nl> + < / ClCompile > <nl> + < ClCompile Include = " $ ( SolutionDir ) \ . . \ src \ core \ lib \ transport \ status_conversion . c " > <nl> + < Filter > src \ core \ lib \ transport < / Filter > <nl> + < / ClCompile > <nl> + < ClCompile Include = " $ ( SolutionDir ) \ . . \ src \ core \ lib \ transport \ timeout_encoding . c " > <nl> + < Filter > src \ core \ lib \ transport < / Filter > <nl> + < / ClCompile > <nl> + < ClCompile Include = " $ ( SolutionDir ) \ . . \ src \ core \ lib \ transport \ transport . c " > <nl> + < Filter > src \ core \ lib \ transport < / Filter > <nl> + < / ClCompile > <nl> + < ClCompile Include = " $ ( SolutionDir ) \ . . \ src \ core \ lib \ transport \ transport_op_string . c " > <nl> + < Filter > src \ core \ lib \ transport < / Filter > <nl> + < / ClCompile > <nl> + < ClCompile Include = " $ ( SolutionDir ) \ . . \ src \ core \ lib \ debug \ trace . c " > <nl> + < Filter > src \ core \ lib \ debug < / Filter > <nl> + < / ClCompile > <nl> + < ClCompile Include = " $ ( SolutionDir ) \ . . \ src \ core \ ext \ filters \ client_channel \ channel_connectivity . c " > <nl> + < Filter > src \ core \ ext \ filters \ client_channel < / Filter > <nl> + < / ClCompile > <nl> + < ClCompile Include = " $ ( SolutionDir ) \ . . \ src \ core \ ext \ filters \ client_channel \ client_channel . c " > <nl> + < Filter > src \ core \ ext \ filters \ client_channel < / Filter > <nl> + < / ClCompile > <nl> + < ClCompile Include = " $ ( SolutionDir ) \ . . \ src \ core \ ext \ filters \ client_channel \ client_channel_factory . c " > <nl> + < Filter > src \ core \ ext \ filters \ client_channel < / Filter > <nl> + < / ClCompile > <nl> + < ClCompile Include = " $ ( SolutionDir ) \ . . \ src \ core \ ext \ filters \ client_channel \ client_channel_plugin . c " > <nl> + < Filter > src \ core \ ext \ filters \ client_channel < / Filter > <nl> + < / ClCompile > <nl> + < ClCompile Include = " $ ( SolutionDir ) \ . . \ src \ core \ ext \ filters \ client_channel \ connector . c " > <nl> + < Filter > src \ core \ ext \ filters \ client_channel < / Filter > <nl> + < / ClCompile > <nl> + < ClCompile Include = " $ ( SolutionDir ) \ . . \ src \ core \ ext \ filters \ client_channel \ http_connect_handshaker . c " > <nl> + < Filter > src \ core \ ext \ filters \ client_channel < / Filter > <nl> + < / ClCompile > <nl> + < ClCompile Include = " $ ( SolutionDir ) \ . . \ src \ core \ ext \ filters \ client_channel \ http_proxy . c " > <nl> + < Filter > src \ core \ ext \ filters \ client_channel < / Filter > <nl> + < / ClCompile > <nl> + < ClCompile Include = " $ ( SolutionDir ) \ . . \ src \ core \ ext \ filters \ client_channel \ lb_policy . c " > <nl> + < Filter > src \ core \ ext \ filters \ client_channel < / Filter > <nl> + < / ClCompile > <nl> + < ClCompile Include = " $ ( SolutionDir ) \ . . \ src \ core \ ext \ filters \ client_channel \ lb_policy_factory . c " > <nl> + < Filter > src \ core \ ext \ filters \ client_channel < / Filter > <nl> + < / ClCompile > <nl> + < ClCompile Include = " $ ( SolutionDir ) \ . . \ src \ core \ ext \ filters \ client_channel \ lb_policy_registry . c " > <nl> + < Filter > src \ core \ ext \ filters \ client_channel < / Filter > <nl> + < / ClCompile > <nl> + < ClCompile Include = " $ ( SolutionDir ) \ . . \ src \ core \ ext \ filters \ client_channel \ parse_address . c " > <nl> + < Filter > src \ core \ ext \ filters \ client_channel < / Filter > <nl> + < / ClCompile > <nl> + < ClCompile Include = " $ ( SolutionDir ) \ . . \ src \ core \ ext \ filters \ client_channel \ proxy_mapper . c " > <nl> + < Filter > src \ core \ ext \ filters \ client_channel < / Filter > <nl> + < / ClCompile > <nl> + < ClCompile Include = " $ ( SolutionDir ) \ . . \ src \ core \ ext \ filters \ client_channel \ proxy_mapper_registry . c " > <nl> + < Filter > src \ core \ ext \ filters \ client_channel < / Filter > <nl> + < / ClCompile > <nl> + < ClCompile Include = " $ ( SolutionDir ) \ . . \ src \ core \ ext \ filters \ client_channel \ resolver . c " > <nl> + < Filter > src \ core \ ext \ filters \ client_channel < / Filter > <nl> + < / ClCompile > <nl> + < ClCompile Include = " $ ( SolutionDir ) \ . . \ src \ core \ ext \ filters \ client_channel \ resolver_factory . c " > <nl> + < Filter > src \ core \ ext \ filters \ client_channel < / Filter > <nl> + < / ClCompile > <nl> + < ClCompile Include = " $ ( SolutionDir ) \ . . \ src \ core \ ext \ filters \ client_channel \ resolver_registry . c " > <nl> + < Filter > src \ core \ ext \ filters \ client_channel < / Filter > <nl> + < / ClCompile > <nl> + < ClCompile Include = " $ ( SolutionDir ) \ . . \ src \ core \ ext \ filters \ client_channel \ retry_throttle . c " > <nl> + < Filter > src \ core \ ext \ filters \ client_channel < / Filter > <nl> + < / ClCompile > <nl> + < ClCompile Include = " $ ( SolutionDir ) \ . . \ src \ core \ ext \ filters \ client_channel \ subchannel . c " > <nl> + < Filter > src \ core \ ext \ filters \ client_channel < / Filter > <nl> + < / ClCompile > <nl> + < ClCompile Include = " $ ( SolutionDir ) \ . . \ src \ core \ ext \ filters \ client_channel \ subchannel_index . c " > <nl> + < Filter > src \ core \ ext \ filters \ client_channel < / Filter > <nl> + < / ClCompile > <nl> + < ClCompile Include = " $ ( SolutionDir ) \ . . \ src \ core \ ext \ filters \ client_channel \ uri_parser . c " > <nl> + < Filter > src \ core \ ext \ filters \ client_channel < / Filter > <nl> + < / ClCompile > <nl> + < ClCompile Include = " $ ( SolutionDir ) \ . . \ src \ core \ ext \ filters \ deadline \ deadline_filter . c " > <nl> + < Filter > src \ core \ ext \ filters \ deadline < / Filter > <nl> + < / ClCompile > <nl> + < ClCompile Include = " $ ( SolutionDir ) \ . . \ src \ core \ ext \ transport \ chttp2 \ transport \ bin_decoder . c " > <nl> + < Filter > src \ core \ ext \ transport \ chttp2 \ transport < / Filter > <nl> + < / ClCompile > <nl> + < ClCompile Include = " $ ( SolutionDir ) \ . . \ src \ core \ ext \ transport \ chttp2 \ transport \ bin_encoder . c " > <nl> + < Filter > src \ core \ ext \ transport \ chttp2 \ transport < / Filter > <nl> + < / ClCompile > <nl> + < ClCompile Include = " $ ( SolutionDir ) \ . . \ src \ core \ ext \ transport \ chttp2 \ transport \ chttp2_plugin . c " > <nl> + < Filter > src \ core \ ext \ transport \ chttp2 \ transport < / Filter > <nl> + < / ClCompile > <nl> + < ClCompile Include = " $ ( SolutionDir ) \ . . \ src \ core \ ext \ transport \ chttp2 \ transport \ chttp2_transport . c " > <nl> + < Filter > src \ core \ ext \ transport \ chttp2 \ transport < / Filter > <nl> + < / ClCompile > <nl> + < ClCompile Include = " $ ( SolutionDir ) \ . . \ src \ core \ ext \ transport \ chttp2 \ transport \ frame_data . c " > <nl> + < Filter > src \ core \ ext \ transport \ chttp2 \ transport < / Filter > <nl> + < / ClCompile > <nl> + < ClCompile Include = " $ ( SolutionDir ) \ . . \ src \ core \ ext \ transport \ chttp2 \ transport \ frame_goaway . c " > <nl> + < Filter > src \ core \ ext \ transport \ chttp2 \ transport < / Filter > <nl> + < / ClCompile > <nl> + < ClCompile Include = " $ ( SolutionDir ) \ . . \ src \ core \ ext \ transport \ chttp2 \ transport \ frame_ping . c " > <nl> + < Filter > src \ core \ ext \ transport \ chttp2 \ transport < / Filter > <nl> + < / ClCompile > <nl> + < ClCompile Include = " $ ( SolutionDir ) \ . . \ src \ core \ ext \ transport \ chttp2 \ transport \ frame_rst_stream . c " > <nl> + < Filter > src \ core \ ext \ transport \ chttp2 \ transport < / Filter > <nl> + < / ClCompile > <nl> + < ClCompile Include = " $ ( SolutionDir ) \ . . \ src \ core \ ext \ transport \ chttp2 \ transport \ frame_settings . c " > <nl> + < Filter > src \ core \ ext \ transport \ chttp2 \ transport < / Filter > <nl> + < / ClCompile > <nl> + < ClCompile Include = " $ ( SolutionDir ) \ . . \ src \ core \ ext \ transport \ chttp2 \ transport \ frame_window_update . c " > <nl> + < Filter > src \ core \ ext \ transport \ chttp2 \ transport < / Filter > <nl> + < / ClCompile > <nl> + < ClCompile Include = " $ ( SolutionDir ) \ . . \ src \ core \ ext \ transport \ chttp2 \ transport \ hpack_encoder . c " > <nl> + < Filter > src \ core \ ext \ transport \ chttp2 \ transport < / Filter > <nl> + < / ClCompile > <nl> + < ClCompile Include = " $ ( SolutionDir ) \ . . \ src \ core \ ext \ transport \ chttp2 \ transport \ hpack_parser . c " > <nl> + < Filter > src \ core \ ext \ transport \ chttp2 \ transport < / Filter > <nl> + < / ClCompile > <nl> + < ClCompile Include = " $ ( SolutionDir ) \ . . \ src \ core \ ext \ transport \ chttp2 \ transport \ hpack_table . c " > <nl> + < Filter > src \ core \ ext \ transport \ chttp2 \ transport < / Filter > <nl> + < / ClCompile > <nl> + < ClCompile Include = " $ ( SolutionDir ) \ . . \ src \ core \ ext \ transport \ chttp2 \ transport \ http2_settings . c " > <nl> + < Filter > src \ core \ ext \ transport \ chttp2 \ transport < / Filter > <nl> + < / ClCompile > <nl> + < ClCompile Include = " $ ( SolutionDir ) \ . . \ src \ core \ ext \ transport \ chttp2 \ transport \ huffsyms . c " > <nl> + < Filter > src \ core \ ext \ transport \ chttp2 \ transport < / Filter > <nl> + < / ClCompile > <nl> + < ClCompile Include = " $ ( SolutionDir ) \ . . \ src \ core \ ext \ transport \ chttp2 \ transport \ incoming_metadata . c " > <nl> + < Filter > src \ core \ ext \ transport \ chttp2 \ transport < / Filter > <nl> + < / ClCompile > <nl> + < ClCompile Include = " $ ( SolutionDir ) \ . . \ src \ core \ ext \ transport \ chttp2 \ transport \ parsing . c " > <nl> + < Filter > src \ core \ ext \ transport \ chttp2 \ transport < / Filter > <nl> + < / ClCompile > <nl> + < ClCompile Include = " $ ( SolutionDir ) \ . . \ src \ core \ ext \ transport \ chttp2 \ transport \ stream_lists . c " > <nl> + < Filter > src \ core \ ext \ transport \ chttp2 \ transport < / Filter > <nl> + < / ClCompile > <nl> + < ClCompile Include = " $ ( SolutionDir ) \ . . \ src \ core \ ext \ transport \ chttp2 \ transport \ stream_map . c " > <nl> + < Filter > src \ core \ ext \ transport \ chttp2 \ transport < / Filter > <nl> + < / ClCompile > <nl> + < ClCompile Include = " $ ( SolutionDir ) \ . . \ src \ core \ ext \ transport \ chttp2 \ transport \ varint . c " > <nl> + < Filter > src \ core \ ext \ transport \ chttp2 \ transport < / Filter > <nl> + < / ClCompile > <nl> + < ClCompile Include = " $ ( SolutionDir ) \ . . \ src \ core \ ext \ transport \ chttp2 \ transport \ writing . c " > <nl> + < Filter > src \ core \ ext \ transport \ chttp2 \ transport < / Filter > <nl> + < / ClCompile > <nl> + < ClCompile Include = " $ ( SolutionDir ) \ . . \ src \ core \ ext \ transport \ chttp2 \ alpn \ alpn . c " > <nl> + < Filter > src \ core \ ext \ transport \ chttp2 \ alpn < / Filter > <nl> + < / ClCompile > <nl> + < ClCompile Include = " $ ( SolutionDir ) \ . . \ src \ core \ ext \ filters \ http \ client \ http_client_filter . c " > <nl> + < Filter > src \ core \ ext \ filters \ http \ client < / Filter > <nl> + < / ClCompile > <nl> + < ClCompile Include = " $ ( SolutionDir ) \ . . \ src \ core \ ext \ filters \ http \ http_filters_plugin . c " > <nl> + < Filter > src \ core \ ext \ filters \ http < / Filter > <nl> + < / ClCompile > <nl> + < ClCompile Include = " $ ( SolutionDir ) \ . . \ src \ core \ ext \ filters \ http \ message_compress \ message_compress_filter . c " > <nl> + < Filter > src \ core \ ext \ filters \ http \ message_compress < / Filter > <nl> + < / ClCompile > <nl> + < ClCompile Include = " $ ( SolutionDir ) \ . . \ src \ core \ ext \ filters \ http \ server \ http_server_filter . c " > <nl> + < Filter > src \ core \ ext \ filters \ http \ server < / Filter > <nl> + < / ClCompile > <nl> + < / ItemGroup > <nl> + < ItemGroup > <nl> + < ClInclude Include = " $ ( SolutionDir ) \ . . \ include \ grpc \ impl \ codegen \ byte_buffer_reader . h " > <nl> + < Filter > include \ grpc \ impl \ codegen < / Filter > <nl> + < / ClInclude > <nl> + < ClInclude Include = " $ ( SolutionDir ) \ . . \ include \ grpc \ impl \ codegen \ compression_types . h " > <nl> + < Filter > include \ grpc \ impl \ codegen < / Filter > <nl> + < / ClInclude > <nl> + < ClInclude Include = " $ ( SolutionDir ) \ . . \ include \ grpc \ impl \ codegen \ connectivity_state . h " > <nl> + < Filter > include \ grpc \ impl \ codegen < / Filter > <nl> + < / ClInclude > <nl> + < ClInclude Include = " $ ( SolutionDir ) \ . . \ include \ grpc \ impl \ codegen \ exec_ctx_fwd . h " > <nl> + < Filter > include \ grpc \ impl \ codegen < / Filter > <nl> + < / ClInclude > <nl> + < ClInclude Include = " $ ( SolutionDir ) \ . . \ include \ grpc \ impl \ codegen \ grpc_types . h " > <nl> + < Filter > include \ grpc \ impl \ codegen < / Filter > <nl> + < / ClInclude > <nl> + < ClInclude Include = " $ ( SolutionDir ) \ . . \ include \ grpc \ impl \ codegen \ propagation_bits . h " > <nl> + < Filter > include \ grpc \ impl \ codegen < / Filter > <nl> + < / ClInclude > <nl> + < ClInclude Include = " $ ( SolutionDir ) \ . . \ include \ grpc \ impl \ codegen \ slice . h " > <nl> + < Filter > include \ grpc \ impl \ codegen < / Filter > <nl> + < / ClInclude > <nl> + < ClInclude Include = " $ ( SolutionDir ) \ . . \ include \ grpc \ impl \ codegen \ status . h " > <nl> + < Filter > include \ grpc \ impl \ codegen < / Filter > <nl> + < / ClInclude > <nl> + < ClInclude Include = " $ ( SolutionDir ) \ . . \ include \ grpc \ impl \ codegen \ atm . h " > <nl> + < Filter > include \ grpc \ impl \ codegen < / Filter > <nl> + < / ClInclude > <nl> + < ClInclude Include = " $ ( SolutionDir ) \ . . \ include \ grpc \ impl \ codegen \ atm_gcc_atomic . h " > <nl> + < Filter > include \ grpc \ impl \ codegen < / Filter > <nl> + < / ClInclude > <nl> + < ClInclude Include = " $ ( SolutionDir ) \ . . \ include \ grpc \ impl \ codegen \ atm_gcc_sync . h " > <nl> + < Filter > include \ grpc \ impl \ codegen < / Filter > <nl> + < / ClInclude > <nl> + < ClInclude Include = " $ ( SolutionDir ) \ . . \ include \ grpc \ impl \ codegen \ atm_windows . h " > <nl> + < Filter > include \ grpc \ impl \ codegen < / Filter > <nl> + < / ClInclude > <nl> + < ClInclude Include = " $ ( SolutionDir ) \ . . \ include \ grpc \ impl \ codegen \ gpr_slice . h " > <nl> + < Filter > include \ grpc \ impl \ codegen < / Filter > <nl> + < / ClInclude > <nl> + < ClInclude Include = " $ ( SolutionDir ) \ . . \ include \ grpc \ impl \ codegen \ gpr_types . h " > <nl> + < Filter > include \ grpc \ impl \ codegen < / Filter > <nl> + < / ClInclude > <nl> + < ClInclude Include = " $ ( SolutionDir ) \ . . \ include \ grpc \ impl \ codegen \ port_platform . h " > <nl> + < Filter > include \ grpc \ impl \ codegen < / Filter > <nl> + < / ClInclude > <nl> + < ClInclude Include = " $ ( SolutionDir ) \ . . \ include \ grpc \ impl \ codegen \ sync . h " > <nl> + < Filter > include \ grpc \ impl \ codegen < / Filter > <nl> + < / ClInclude > <nl> + < ClInclude Include = " $ ( SolutionDir ) \ . . \ include \ grpc \ impl \ codegen \ sync_generic . h " > <nl> + < Filter > include \ grpc \ impl \ codegen < / Filter > <nl> + < / ClInclude > <nl> + < ClInclude Include = " $ ( SolutionDir ) \ . . \ include \ grpc \ impl \ codegen \ sync_posix . h " > <nl> + < Filter > include \ grpc \ impl \ codegen < / Filter > <nl> + < / ClInclude > <nl> + < ClInclude Include = " $ ( SolutionDir ) \ . . \ include \ grpc \ impl \ codegen \ sync_windows . h " > <nl> + < Filter > include \ grpc \ impl \ codegen < / Filter > <nl> + < / ClInclude > <nl> < / ItemGroup > <nl> < ItemGroup > <nl> < ClInclude Include = " $ ( SolutionDir ) \ . . \ src \ core \ ext \ filters \ client_channel \ resolver \ fake \ fake_resolver . h " > <nl> <nl> < ClInclude Include = " $ ( SolutionDir ) \ . . \ test \ core \ util \ trickle_endpoint . h " > <nl> < Filter > test \ core \ util < / Filter > <nl> < / ClInclude > <nl> + < ClInclude Include = " $ ( SolutionDir ) \ . . \ src \ core \ ext \ filters \ client_channel \ client_channel . h " > <nl> + < Filter > src \ core \ ext \ filters \ client_channel < / Filter > <nl> + < / ClInclude > <nl> + < ClInclude Include = " $ ( SolutionDir ) \ . . \ src \ core \ ext \ filters \ client_channel \ client_channel_factory . h " > <nl> + < Filter > src \ core \ ext \ filters \ client_channel < / Filter > <nl> + < / ClInclude > <nl> + < ClInclude Include = " $ ( SolutionDir ) \ . . \ src \ core \ ext \ filters \ client_channel \ connector . h " > <nl> + < Filter > src \ core \ ext \ filters \ client_channel < / Filter > <nl> + < / ClInclude > <nl> + < ClInclude Include = " $ ( SolutionDir ) \ . . \ src \ core \ ext \ filters \ client_channel \ http_connect_handshaker . h " > <nl> + < Filter > src \ core \ ext \ filters \ client_channel < / Filter > <nl> + < / ClInclude > <nl> + < ClInclude Include = " $ ( SolutionDir ) \ . . \ src \ core \ ext \ filters \ client_channel \ http_proxy . h " > <nl> + < Filter > src \ core \ ext \ filters \ client_channel < / Filter > <nl> + < / ClInclude > <nl> + < ClInclude Include = " $ ( SolutionDir ) \ . . \ src \ core \ ext \ filters \ client_channel \ lb_policy . h " > <nl> + < Filter > src \ core \ ext \ filters \ client_channel < / Filter > <nl> + < / ClInclude > <nl> + < ClInclude Include = " $ ( SolutionDir ) \ . . \ src \ core \ ext \ filters \ client_channel \ lb_policy_factory . h " > <nl> + < Filter > src \ core \ ext \ filters \ client_channel < / Filter > <nl> + < / ClInclude > <nl> + < ClInclude Include = " $ ( SolutionDir ) \ . . \ src \ core \ ext \ filters \ client_channel \ lb_policy_registry . h " > <nl> + < Filter > src \ core \ ext \ filters \ client_channel < / Filter > <nl> + < / ClInclude > <nl> + < ClInclude Include = " $ ( SolutionDir ) \ . . \ src \ core \ ext \ filters \ client_channel \ parse_address . h " > <nl> + < Filter > src \ core \ ext \ filters \ client_channel < / Filter > <nl> + < / ClInclude > <nl> + < ClInclude Include = " $ ( SolutionDir ) \ . . \ src \ core \ ext \ filters \ client_channel \ proxy_mapper . h " > <nl> + < Filter > src \ core \ ext \ filters \ client_channel < / Filter > <nl> + < / ClInclude > <nl> + < ClInclude Include = " $ ( SolutionDir ) \ . . \ src \ core \ ext \ filters \ client_channel \ proxy_mapper_registry . h " > <nl> + < Filter > src \ core \ ext \ filters \ client_channel < / Filter > <nl> + < / ClInclude > <nl> + < ClInclude Include = " $ ( SolutionDir ) \ . . \ src \ core \ ext \ filters \ client_channel \ resolver . h " > <nl> + < Filter > src \ core \ ext \ filters \ client_channel < / Filter > <nl> + < / ClInclude > <nl> + < ClInclude Include = " $ ( SolutionDir ) \ . . \ src \ core \ ext \ filters \ client_channel \ resolver_factory . h " > <nl> + < Filter > src \ core \ ext \ filters \ client_channel < / Filter > <nl> + < / ClInclude > <nl> + < ClInclude Include = " $ ( SolutionDir ) \ . . \ src \ core \ ext \ filters \ client_channel \ resolver_registry . h " > <nl> + < Filter > src \ core \ ext \ filters \ client_channel < / Filter > <nl> + < / ClInclude > <nl> + < ClInclude Include = " $ ( SolutionDir ) \ . . \ src \ core \ ext \ filters \ client_channel \ retry_throttle . h " > <nl> + < Filter > src \ core \ ext \ filters \ client_channel < / Filter > <nl> + < / ClInclude > <nl> + < ClInclude Include = " $ ( SolutionDir ) \ . . \ src \ core \ ext \ filters \ client_channel \ subchannel . h " > <nl> + < Filter > src \ core \ ext \ filters \ client_channel < / Filter > <nl> + < / ClInclude > <nl> + < ClInclude Include = " $ ( SolutionDir ) \ . . \ src \ core \ ext \ filters \ client_channel \ subchannel_index . h " > <nl> + < Filter > src \ core \ ext \ filters \ client_channel < / Filter > <nl> + < / ClInclude > <nl> + < ClInclude Include = " $ ( SolutionDir ) \ . . \ src \ core \ ext \ filters \ client_channel \ uri_parser . h " > <nl> + < Filter > src \ core \ ext \ filters \ client_channel < / Filter > <nl> + < / ClInclude > <nl> + < ClInclude Include = " $ ( SolutionDir ) \ . . \ src \ core \ ext \ filters \ deadline \ deadline_filter . h " > <nl> + < Filter > src \ core \ ext \ filters \ deadline < / Filter > <nl> + < / ClInclude > <nl> + < ClInclude Include = " $ ( SolutionDir ) \ . . \ src \ core \ ext \ transport \ chttp2 \ transport \ bin_decoder . h " > <nl> + < Filter > src \ core \ ext \ transport \ chttp2 \ transport < / Filter > <nl> + < / ClInclude > <nl> + < ClInclude Include = " $ ( SolutionDir ) \ . . \ src \ core \ ext \ transport \ chttp2 \ transport \ bin_encoder . h " > <nl> + < Filter > src \ core \ ext \ transport \ chttp2 \ transport < / Filter > <nl> + < / ClInclude > <nl> + < ClInclude Include = " $ ( SolutionDir ) \ . . \ src \ core \ ext \ transport \ chttp2 \ transport \ chttp2_transport . h " > <nl> + < Filter > src \ core \ ext \ transport \ chttp2 \ transport < / Filter > <nl> + < / ClInclude > <nl> + < ClInclude Include = " $ ( SolutionDir ) \ . . \ src \ core \ ext \ transport \ chttp2 \ transport \ frame . h " > <nl> + < Filter > src \ core \ ext \ transport \ chttp2 \ transport < / Filter > <nl> + < / ClInclude > <nl> + < ClInclude Include = " $ ( SolutionDir ) \ . . \ src \ core \ ext \ transport \ chttp2 \ transport \ frame_data . h " > <nl> + < Filter > src \ core \ ext \ transport \ chttp2 \ transport < / Filter > <nl> + < / ClInclude > <nl> + < ClInclude Include = " $ ( SolutionDir ) \ . . \ src \ core \ ext \ transport \ chttp2 \ transport \ frame_goaway . h " > <nl> + < Filter > src \ core \ ext \ transport \ chttp2 \ transport < / Filter > <nl> + < / ClInclude > <nl> + < ClInclude Include = " $ ( SolutionDir ) \ . . \ src \ core \ ext \ transport \ chttp2 \ transport \ frame_ping . h " > <nl> + < Filter > src \ core \ ext \ transport \ chttp2 \ transport < / Filter > <nl> + < / ClInclude > <nl> + < ClInclude Include = " $ ( SolutionDir ) \ . . \ src \ core \ ext \ transport \ chttp2 \ transport \ frame_rst_stream . h " > <nl> + < Filter > src \ core \ ext \ transport \ chttp2 \ transport < / Filter > <nl> + < / ClInclude > <nl> + < ClInclude Include = " $ ( SolutionDir ) \ . . \ src \ core \ ext \ transport \ chttp2 \ transport \ frame_settings . h " > <nl> + < Filter > src \ core \ ext \ transport \ chttp2 \ transport < / Filter > <nl> + < / ClInclude > <nl> + < ClInclude Include = " $ ( SolutionDir ) \ . . \ src \ core \ ext \ transport \ chttp2 \ transport \ frame_window_update . h " > <nl> + < Filter > src \ core \ ext \ transport \ chttp2 \ transport < / Filter > <nl> + < / ClInclude > <nl> + < ClInclude Include = " $ ( SolutionDir ) \ . . \ src \ core \ ext \ transport \ chttp2 \ transport \ hpack_encoder . h " > <nl> + < Filter > src \ core \ ext \ transport \ chttp2 \ transport < / Filter > <nl> + < / ClInclude > <nl> + < ClInclude Include = " $ ( SolutionDir ) \ . . \ src \ core \ ext \ transport \ chttp2 \ transport \ hpack_parser . h " > <nl> + < Filter > src \ core \ ext \ transport \ chttp2 \ transport < / Filter > <nl> + < / ClInclude > <nl> + < ClInclude Include = " $ ( SolutionDir ) \ . . \ src \ core \ ext \ transport \ chttp2 \ transport \ hpack_table . h " > <nl> + < Filter > src \ core \ ext \ transport \ chttp2 \ transport < / Filter > <nl> + < / ClInclude > <nl> + < ClInclude Include = " $ ( SolutionDir ) \ . . \ src \ core \ ext \ transport \ chttp2 \ transport \ http2_settings . h " > <nl> + < Filter > src \ core \ ext \ transport \ chttp2 \ transport < / Filter > <nl> + < / ClInclude > <nl> + < ClInclude Include = " $ ( SolutionDir ) \ . . \ src \ core \ ext \ transport \ chttp2 \ transport \ huffsyms . h " > <nl> + < Filter > src \ core \ ext \ transport \ chttp2 \ transport < / Filter > <nl> + < / ClInclude > <nl> + < ClInclude Include = " $ ( SolutionDir ) \ . . \ src \ core \ ext \ transport \ chttp2 \ transport \ incoming_metadata . h " > <nl> + < Filter > src \ core \ ext \ transport \ chttp2 \ transport < / Filter > <nl> + < / ClInclude > <nl> + < ClInclude Include = " $ ( SolutionDir ) \ . . \ src \ core \ ext \ transport \ chttp2 \ transport \ internal . h " > <nl> + < Filter > src \ core \ ext \ transport \ chttp2 \ transport < / Filter > <nl> + < / ClInclude > <nl> + < ClInclude Include = " $ ( SolutionDir ) \ . . \ src \ core \ ext \ transport \ chttp2 \ transport \ stream_map . h " > <nl> + < Filter > src \ core \ ext \ transport \ chttp2 \ transport < / Filter > <nl> + < / ClInclude > <nl> + < ClInclude Include = " $ ( SolutionDir ) \ . . \ src \ core \ ext \ transport \ chttp2 \ transport \ varint . h " > <nl> + < Filter > src \ core \ ext \ transport \ chttp2 \ transport < / Filter > <nl> + < / ClInclude > <nl> + < ClInclude Include = " $ ( SolutionDir ) \ . . \ src \ core \ ext \ transport \ chttp2 \ alpn \ alpn . h " > <nl> + < Filter > src \ core \ ext \ transport \ chttp2 \ alpn < / Filter > <nl> + < / ClInclude > <nl> + < ClInclude Include = " $ ( SolutionDir ) \ . . \ src \ core \ ext \ filters \ http \ client \ http_client_filter . h " > <nl> + < Filter > src \ core \ ext \ filters \ http \ client < / Filter > <nl> + < / ClInclude > <nl> + < ClInclude Include = " $ ( SolutionDir ) \ . . \ src \ core \ ext \ filters \ http \ message_compress \ message_compress_filter . h " > <nl> + < Filter > src \ core \ ext \ filters \ http \ message_compress < / Filter > <nl> + < / ClInclude > <nl> + < ClInclude Include = " $ ( SolutionDir ) \ . . \ src \ core \ ext \ filters \ http \ server \ http_server_filter . h " > <nl> + < Filter > src \ core \ ext \ filters \ http \ server < / Filter > <nl> + < / ClInclude > <nl> < / ItemGroup > <nl> <nl> < ItemGroup > <nl> + < Filter Include = " include " > <nl> + < UniqueIdentifier > { 9793fab6 - 15ae - 1f61 - 712d - c3d673654d72 } < / UniqueIdentifier > <nl> + < / Filter > <nl> + < Filter Include = " include \ grpc " > <nl> + < UniqueIdentifier > { c2447106 - a6bf - 6b88 - 9ad0 - a42b7ac1573c } < / UniqueIdentifier > <nl> + < / Filter > <nl> + < Filter Include = " include \ grpc \ impl " > <nl> + < UniqueIdentifier > { dba70812 - 267b - 656c - 9f8c - 636338d3f5c0 } < / UniqueIdentifier > <nl> + < / Filter > <nl> + < Filter Include = " include \ grpc \ impl \ codegen " > <nl> + < UniqueIdentifier > { b9e2ddac - f042 - 3042 - ba4b - 79ba4445e68c } < / UniqueIdentifier > <nl> + < / Filter > <nl> < Filter Include = " src " > <nl> < UniqueIdentifier > { 65483377 - 42fd - 137e - 3847 - 00dfd4675db3 } < / UniqueIdentifier > <nl> < / Filter > <nl> <nl> < Filter Include = " src \ core \ ext \ filters \ client_channel \ resolver \ fake " > <nl> < UniqueIdentifier > { 2d280bd0 - f4ee - d1f2 - 4d70 - 174147ac0dbc } < / UniqueIdentifier > <nl> < / Filter > <nl> + < Filter Include = " src \ core \ ext \ filters \ deadline " > <nl> + < UniqueIdentifier > { 6820a68f - 2aa3 - 8b45 - ddea - 294656d531f6 } < / UniqueIdentifier > <nl> + < / Filter > <nl> + < Filter Include = " src \ core \ ext \ filters \ http " > <nl> + < UniqueIdentifier > { b7df4d88 - fa6b - 6bd3 - 579e - b5f086ba6299 } < / UniqueIdentifier > <nl> + < / Filter > <nl> + < Filter Include = " src \ core \ ext \ filters \ http \ client " > <nl> + < UniqueIdentifier > { 37d93a32 - 6a75 - 3b9e - 35a4 - c47f0a2d274a } < / UniqueIdentifier > <nl> + < / Filter > <nl> + < Filter Include = " src \ core \ ext \ filters \ http \ message_compress " > <nl> + < UniqueIdentifier > { a4bd6a23 - c8e1 - 4e35 - f9eb - 6434a86f38f0 } < / UniqueIdentifier > <nl> + < / Filter > <nl> + < Filter Include = " src \ core \ ext \ filters \ http \ server " > <nl> + < UniqueIdentifier > { 2dd536f5 - 341a - 771f - 4853 - a95522e59224 } < / UniqueIdentifier > <nl> + < / Filter > <nl> + < Filter Include = " src \ core \ ext \ transport " > <nl> + < UniqueIdentifier > { fb32254e - a807 - 768a - 3686 - 4e87f3bf1e8e } < / UniqueIdentifier > <nl> + < / Filter > <nl> + < Filter Include = " src \ core \ ext \ transport \ chttp2 " > <nl> + < UniqueIdentifier > { 87c61e56 - 5090 - 5e1a - 22af - 02e3c8bf4a2a } < / UniqueIdentifier > <nl> + < / Filter > <nl> + < Filter Include = " src \ core \ ext \ transport \ chttp2 \ alpn " > <nl> + < UniqueIdentifier > { e50ce1d1 - 6b17 - dad2 - 9ef3 - 46f68d4bee1b } < / UniqueIdentifier > <nl> + < / Filter > <nl> + < Filter Include = " src \ core \ ext \ transport \ chttp2 \ transport " > <nl> + < UniqueIdentifier > { 67007111 - 23fe - 296f - 1808 - 91f2b96a31aa } < / UniqueIdentifier > <nl> + < / Filter > <nl> + < Filter Include = " src \ core \ lib " > <nl> + < UniqueIdentifier > { e3d002a7 - 9318 - 1ac5 - 4259 - e177f58ccc9a } < / UniqueIdentifier > <nl> + < / Filter > <nl> + < Filter Include = " src \ core \ lib \ channel " > <nl> + < UniqueIdentifier > { ac14fd16 - a4af - 6b22 - 4226 - 2d7dabf25409 } < / UniqueIdentifier > <nl> + < / Filter > <nl> + < Filter Include = " src \ core \ lib \ compression " > <nl> + < UniqueIdentifier > { 24268e45 - f6c3 - 6024 - b49a - d01bb9c12d96 } < / UniqueIdentifier > <nl> + < / Filter > <nl> + < Filter Include = " src \ core \ lib \ debug " > <nl> + < UniqueIdentifier > { 0be401bd - 3e26 - dead - fdf4 - 2ce27a1ac3a3 } < / UniqueIdentifier > <nl> + < / Filter > <nl> + < Filter Include = " src \ core \ lib \ http " > <nl> + < UniqueIdentifier > { ac2f12e3 - ac77 - f0a7 - d15d - 92899e61ed25 } < / UniqueIdentifier > <nl> + < / Filter > <nl> + < Filter Include = " src \ core \ lib \ iomgr " > <nl> + < UniqueIdentifier > { 9015222c - df04 - 298f - 3f2c - d19babffc180 } < / UniqueIdentifier > <nl> + < / Filter > <nl> + < Filter Include = " src \ core \ lib \ json " > <nl> + < UniqueIdentifier > { c3ff117a - aae9 - dedd - 2f5a - 888f0383cbb8 } < / UniqueIdentifier > <nl> + < / Filter > <nl> + < Filter Include = " src \ core \ lib \ slice " > <nl> + < UniqueIdentifier > { 588ffbfc - 2f94 - a99f - 85b0 - 4c47ec9f8d13 } < / UniqueIdentifier > <nl> + < / Filter > <nl> + < Filter Include = " src \ core \ lib \ surface " > <nl> + < UniqueIdentifier > { 732318c6 - bb34 - 9a99 - 611b - 9928db3d4e2a } < / UniqueIdentifier > <nl> + < / Filter > <nl> + < Filter Include = " src \ core \ lib \ transport " > <nl> + < UniqueIdentifier > { 2c0ca4a1 - 38df - 329d - eeba - 5c5b61dc81a5 } < / UniqueIdentifier > <nl> + < / Filter > <nl> < Filter Include = " test " > <nl> < UniqueIdentifier > { 037c7645 - 1698 - cf2d - 4163 - 525240323101 } < / UniqueIdentifier > <nl> < / Filter > <nl> mmm a / vsprojects / vcxproj / test / alarm_cpp_test / alarm_cpp_test . vcxproj <nl> ppp b / vsprojects / vcxproj / test / alarm_cpp_test / alarm_cpp_test . vcxproj <nl> <nl> < / ClCompile > <nl> < / ItemGroup > <nl> < ItemGroup > <nl> - < ProjectReference Include = " $ ( SolutionDir ) \ . . \ vsprojects \ vcxproj \ . \ grpc + + _test_util \ grpc + + _test_util . vcxproj " > <nl> - < Project > { 0BE77741 - 552A - 929B - A497 - 4EF7ECE17A64 } < / Project > <nl> + < ProjectReference Include = " $ ( SolutionDir ) \ . . \ vsprojects \ vcxproj \ . \ grpc + + _test_util_unsecure \ grpc + + _test_util_unsecure . vcxproj " > <nl> + < Project > { 1D4003D7 - 5BF1 - 9FE6 - BAF7 - 23B174D942AC } < / Project > <nl> < / ProjectReference > <nl> - < ProjectReference Include = " $ ( SolutionDir ) \ . . \ vsprojects \ vcxproj \ . \ grpc_test_util \ grpc_test_util . vcxproj " > <nl> - < Project > { 17BCAFC0 - 5FDC - 4C94 - AEB9 - 95F3E220614B } < / Project > <nl> + < ProjectReference Include = " $ ( SolutionDir ) \ . . \ vsprojects \ vcxproj \ . \ grpc_test_util_unsecure \ grpc_test_util_unsecure . vcxproj " > <nl> + < Project > { 0A7E7F92 - FDEA - 40F1 - A9EC - 3BA484F98BBF } < / Project > <nl> < / ProjectReference > <nl> - < ProjectReference Include = " $ ( SolutionDir ) \ . . \ vsprojects \ vcxproj \ . \ grpc + + \ grpc + + . vcxproj " > <nl> - < Project > { C187A093 - A0FE - 489D - A40A - 6E33DE0F9FEB } < / Project > <nl> + < ProjectReference Include = " $ ( SolutionDir ) \ . . \ vsprojects \ vcxproj \ . \ grpc + + _unsecure \ grpc + + _unsecure . vcxproj " > <nl> + < Project > { 6EE56155 - DF7C - 4F6E - BFC4 - F6F776BEB211 } < / Project > <nl> < / ProjectReference > <nl> - < ProjectReference Include = " $ ( SolutionDir ) \ . . \ vsprojects \ vcxproj \ . \ grpc \ grpc . vcxproj " > <nl> - < Project > { 29D16885 - 7228 - 4C31 - 81ED - 5F9187C7F2A9 } < / Project > <nl> + < ProjectReference Include = " $ ( SolutionDir ) \ . . \ vsprojects \ vcxproj \ . \ grpc_unsecure \ grpc_unsecure . vcxproj " > <nl> + < Project > { 46CEDFFF - 9692 - 456A - AA24 - 38B5D6BCF4C5 } < / Project > <nl> < / ProjectReference > <nl> < ProjectReference Include = " $ ( SolutionDir ) \ . . \ vsprojects \ vcxproj \ . \ gpr_test_util \ gpr_test_util . vcxproj " > <nl> < Project > { EAB0A629 - 17A9 - 44DB - B5FF - E91A721FE037 } < / Project > <nl> mmm a / vsprojects / vcxproj / test / grpc_benchmark / grpc_benchmark . vcxproj <nl> ppp b / vsprojects / vcxproj / test / grpc_benchmark / grpc_benchmark . vcxproj <nl> <nl> < ProjectReference Include = " $ ( SolutionDir ) \ . . \ vsprojects \ vcxproj \ . \ benchmark \ benchmark . vcxproj " > <nl> < Project > { 07978586 - E47C - 8709 - A63E - 895FBF3C3C7D } < / Project > <nl> < / ProjectReference > <nl> - < ProjectReference Include = " $ ( SolutionDir ) \ . . \ vsprojects \ vcxproj \ . \ grpc + + \ grpc + + . vcxproj " > <nl> - < Project > { C187A093 - A0FE - 489D - A40A - 6E33DE0F9FEB } < / Project > <nl> + < ProjectReference Include = " $ ( SolutionDir ) \ . . \ vsprojects \ vcxproj \ . \ grpc + + _unsecure \ grpc + + _unsecure . vcxproj " > <nl> + < Project > { 6EE56155 - DF7C - 4F6E - BFC4 - F6F776BEB211 } < / Project > <nl> < / ProjectReference > <nl> - < ProjectReference Include = " $ ( SolutionDir ) \ . . \ vsprojects \ vcxproj \ . \ grpc_test_util \ grpc_test_util . vcxproj " > <nl> - < Project > { 17BCAFC0 - 5FDC - 4C94 - AEB9 - 95F3E220614B } < / Project > <nl> + < ProjectReference Include = " $ ( SolutionDir ) \ . . \ vsprojects \ vcxproj \ . \ grpc_test_util_unsecure \ grpc_test_util_unsecure . vcxproj " > <nl> + < Project > { 0A7E7F92 - FDEA - 40F1 - A9EC - 3BA484F98BBF } < / Project > <nl> < / ProjectReference > <nl> - < ProjectReference Include = " $ ( SolutionDir ) \ . . \ vsprojects \ vcxproj \ . \ grpc \ grpc . vcxproj " > <nl> - < Project > { 29D16885 - 7228 - 4C31 - 81ED - 5F9187C7F2A9 } < / Project > <nl> + < ProjectReference Include = " $ ( SolutionDir ) \ . . \ vsprojects \ vcxproj \ . \ grpc_unsecure \ grpc_unsecure . vcxproj " > <nl> + < Project > { 46CEDFFF - 9692 - 456A - AA24 - 38B5D6BCF4C5 } < / Project > <nl> < / ProjectReference > <nl> < / ItemGroup > <nl> < ItemGroup > <nl> mmm a / vsprojects / vcxproj / test / server_builder_test / server_builder_test . vcxproj <nl> ppp b / vsprojects / vcxproj / test / server_builder_test / server_builder_test . vcxproj <nl> <nl> < / ClCompile > <nl> < / ItemGroup > <nl> < ItemGroup > <nl> - < ProjectReference Include = " $ ( SolutionDir ) \ . . \ vsprojects \ vcxproj \ . \ grpc + + _test_util \ grpc + + _test_util . vcxproj " > <nl> - < Project > { 0BE77741 - 552A - 929B - A497 - 4EF7ECE17A64 } < / Project > <nl> + < ProjectReference Include = " $ ( SolutionDir ) \ . . \ vsprojects \ vcxproj \ . \ grpc + + _test_util_unsecure \ grpc + + _test_util_unsecure . vcxproj " > <nl> + < Project > { 1D4003D7 - 5BF1 - 9FE6 - BAF7 - 23B174D942AC } < / Project > <nl> < / ProjectReference > <nl> - < ProjectReference Include = " $ ( SolutionDir ) \ . . \ vsprojects \ vcxproj \ . \ grpc_test_util \ grpc_test_util . vcxproj " > <nl> - < Project > { 17BCAFC0 - 5FDC - 4C94 - AEB9 - 95F3E220614B } < / Project > <nl> + < ProjectReference Include = " $ ( SolutionDir ) \ . . \ vsprojects \ vcxproj \ . \ grpc_test_util_unsecure \ grpc_test_util_unsecure . vcxproj " > <nl> + < Project > { 0A7E7F92 - FDEA - 40F1 - A9EC - 3BA484F98BBF } < / Project > <nl> < / ProjectReference > <nl> < ProjectReference Include = " $ ( SolutionDir ) \ . . \ vsprojects \ vcxproj \ . \ gpr_test_util \ gpr_test_util . vcxproj " > <nl> < Project > { EAB0A629 - 17A9 - 44DB - B5FF - E91A721FE037 } < / Project > <nl> < / ProjectReference > <nl> - < ProjectReference Include = " $ ( SolutionDir ) \ . . \ vsprojects \ vcxproj \ . \ grpc + + \ grpc + + . vcxproj " > <nl> - < Project > { C187A093 - A0FE - 489D - A40A - 6E33DE0F9FEB } < / Project > <nl> + < ProjectReference Include = " $ ( SolutionDir ) \ . . \ vsprojects \ vcxproj \ . \ grpc + + _unsecure \ grpc + + _unsecure . vcxproj " > <nl> + < Project > { 6EE56155 - DF7C - 4F6E - BFC4 - F6F776BEB211 } < / Project > <nl> < / ProjectReference > <nl> - < ProjectReference Include = " $ ( SolutionDir ) \ . . \ vsprojects \ vcxproj \ . \ grpc \ grpc . vcxproj " > <nl> - < Project > { 29D16885 - 7228 - 4C31 - 81ED - 5F9187C7F2A9 } < / Project > <nl> + < ProjectReference Include = " $ ( SolutionDir ) \ . . \ vsprojects \ vcxproj \ . \ grpc_unsecure \ grpc_unsecure . vcxproj " > <nl> + < Project > { 46CEDFFF - 9692 - 456A - AA24 - 38B5D6BCF4C5 } < / Project > <nl> < / ProjectReference > <nl> < ProjectReference Include = " $ ( SolutionDir ) \ . . \ vsprojects \ vcxproj \ . \ gpr \ gpr . vcxproj " > <nl> < Project > { B23D3D1A - 9438 - 4EDA - BEB6 - 9A0A03D17792 } < / Project > <nl> mmm a / vsprojects / vcxproj / test / server_request_call_test / server_request_call_test . vcxproj <nl> ppp b / vsprojects / vcxproj / test / server_request_call_test / server_request_call_test . vcxproj <nl> <nl> < / ClCompile > <nl> < / ItemGroup > <nl> < ItemGroup > <nl> - < ProjectReference Include = " $ ( SolutionDir ) \ . . \ vsprojects \ vcxproj \ . \ grpc + + _test_util \ grpc + + _test_util . vcxproj " > <nl> - < Project > { 0BE77741 - 552A - 929B - A497 - 4EF7ECE17A64 } < / Project > <nl> + < ProjectReference Include = " $ ( SolutionDir ) \ . . \ vsprojects \ vcxproj \ . \ grpc + + _test_util_unsecure \ grpc + + _test_util_unsecure . vcxproj " > <nl> + < Project > { 1D4003D7 - 5BF1 - 9FE6 - BAF7 - 23B174D942AC } < / Project > <nl> < / ProjectReference > <nl> - < ProjectReference Include = " $ ( SolutionDir ) \ . . \ vsprojects \ vcxproj \ . \ grpc_test_util \ grpc_test_util . vcxproj " > <nl> - < Project > { 17BCAFC0 - 5FDC - 4C94 - AEB9 - 95F3E220614B } < / Project > <nl> + < ProjectReference Include = " $ ( SolutionDir ) \ . . \ vsprojects \ vcxproj \ . \ grpc_test_util_unsecure \ grpc_test_util_unsecure . vcxproj " > <nl> + < Project > { 0A7E7F92 - FDEA - 40F1 - A9EC - 3BA484F98BBF } < / Project > <nl> < / ProjectReference > <nl> < ProjectReference Include = " $ ( SolutionDir ) \ . . \ vsprojects \ vcxproj \ . \ gpr_test_util \ gpr_test_util . vcxproj " > <nl> < Project > { EAB0A629 - 17A9 - 44DB - B5FF - E91A721FE037 } < / Project > <nl> < / ProjectReference > <nl> - < ProjectReference Include = " $ ( SolutionDir ) \ . . \ vsprojects \ vcxproj \ . \ grpc + + \ grpc + + . vcxproj " > <nl> - < Project > { C187A093 - A0FE - 489D - A40A - 6E33DE0F9FEB } < / Project > <nl> + < ProjectReference Include = " $ ( SolutionDir ) \ . . \ vsprojects \ vcxproj \ . \ grpc + + _unsecure \ grpc + + _unsecure . vcxproj " > <nl> + < Project > { 6EE56155 - DF7C - 4F6E - BFC4 - F6F776BEB211 } < / Project > <nl> < / ProjectReference > <nl> - < ProjectReference Include = " $ ( SolutionDir ) \ . . \ vsprojects \ vcxproj \ . \ grpc \ grpc . vcxproj " > <nl> - < Project > { 29D16885 - 7228 - 4C31 - 81ED - 5F9187C7F2A9 } < / Project > <nl> + < ProjectReference Include = " $ ( SolutionDir ) \ . . \ vsprojects \ vcxproj \ . \ grpc_unsecure \ grpc_unsecure . vcxproj " > <nl> + < Project > { 46CEDFFF - 9692 - 456A - AA24 - 38B5D6BCF4C5 } < / Project > <nl> < / ProjectReference > <nl> < ProjectReference Include = " $ ( SolutionDir ) \ . . \ vsprojects \ vcxproj \ . \ gpr \ gpr . vcxproj " > <nl> < Project > { B23D3D1A - 9438 - 4EDA - BEB6 - 9A0A03D17792 } < / Project > <nl> mmm a / vsprojects / vcxproj / test / thread_manager_test / thread_manager_test . vcxproj <nl> ppp b / vsprojects / vcxproj / test / thread_manager_test / thread_manager_test . vcxproj <nl> <nl> < / ClCompile > <nl> < / ItemGroup > <nl> < ItemGroup > <nl> - < ProjectReference Include = " $ ( SolutionDir ) \ . . \ vsprojects \ vcxproj \ . \ grpc + + \ grpc + + . vcxproj " > <nl> - < Project > { C187A093 - A0FE - 489D - A40A - 6E33DE0F9FEB } < / Project > <nl> + < ProjectReference Include = " $ ( SolutionDir ) \ . . \ vsprojects \ vcxproj \ . \ grpc + + _unsecure \ grpc + + _unsecure . vcxproj " > <nl> + < Project > { 6EE56155 - DF7C - 4F6E - BFC4 - F6F776BEB211 } < / Project > <nl> < / ProjectReference > <nl> - < ProjectReference Include = " $ ( SolutionDir ) \ . . \ vsprojects \ vcxproj \ . \ grpc \ grpc . vcxproj " > <nl> - < Project > { 29D16885 - 7228 - 4C31 - 81ED - 5F9187C7F2A9 } < / Project > <nl> + < ProjectReference Include = " $ ( SolutionDir ) \ . . \ vsprojects \ vcxproj \ . \ grpc_unsecure \ grpc_unsecure . vcxproj " > <nl> + < Project > { 46CEDFFF - 9692 - 456A - AA24 - 38B5D6BCF4C5 } < / Project > <nl> < / ProjectReference > <nl> < ProjectReference Include = " $ ( SolutionDir ) \ . . \ vsprojects \ vcxproj \ . \ gpr \ gpr . vcxproj " > <nl> < Project > { B23D3D1A - 9438 - 4EDA - BEB6 - 9A0A03D17792 } < / Project > <nl> mmm a / vsprojects / vcxproj / test / thread_stress_test / thread_stress_test . vcxproj <nl> ppp b / vsprojects / vcxproj / test / thread_stress_test / thread_stress_test . vcxproj <nl> <nl> < / ClCompile > <nl> < / ItemGroup > <nl> < ItemGroup > <nl> - < ProjectReference Include = " $ ( SolutionDir ) \ . . \ vsprojects \ vcxproj \ . \ grpc + + _test_util \ grpc + + _test_util . vcxproj " > <nl> - < Project > { 0BE77741 - 552A - 929B - A497 - 4EF7ECE17A64 } < / Project > <nl> + < ProjectReference Include = " $ ( SolutionDir ) \ . . \ vsprojects \ vcxproj \ . \ grpc + + _test_util_unsecure \ grpc + + _test_util_unsecure . vcxproj " > <nl> + < Project > { 1D4003D7 - 5BF1 - 9FE6 - BAF7 - 23B174D942AC } < / Project > <nl> < / ProjectReference > <nl> - < ProjectReference Include = " $ ( SolutionDir ) \ . . \ vsprojects \ vcxproj \ . \ grpc_test_util \ grpc_test_util . vcxproj " > <nl> - < Project > { 17BCAFC0 - 5FDC - 4C94 - AEB9 - 95F3E220614B } < / Project > <nl> + < ProjectReference Include = " $ ( SolutionDir ) \ . . \ vsprojects \ vcxproj \ . \ grpc_test_util_unsecure \ grpc_test_util_unsecure . vcxproj " > <nl> + < Project > { 0A7E7F92 - FDEA - 40F1 - A9EC - 3BA484F98BBF } < / Project > <nl> < / ProjectReference > <nl> - < ProjectReference Include = " $ ( SolutionDir ) \ . . \ vsprojects \ vcxproj \ . \ grpc + + \ grpc + + . vcxproj " > <nl> - < Project > { C187A093 - A0FE - 489D - A40A - 6E33DE0F9FEB } < / Project > <nl> + < ProjectReference Include = " $ ( SolutionDir ) \ . . \ vsprojects \ vcxproj \ . \ grpc + + _unsecure \ grpc + + _unsecure . vcxproj " > <nl> + < Project > { 6EE56155 - DF7C - 4F6E - BFC4 - F6F776BEB211 } < / Project > <nl> < / ProjectReference > <nl> - < ProjectReference Include = " $ ( SolutionDir ) \ . . \ vsprojects \ vcxproj \ . \ grpc \ grpc . vcxproj " > <nl> - < Project > { 29D16885 - 7228 - 4C31 - 81ED - 5F9187C7F2A9 } < / Project > <nl> + < ProjectReference Include = " $ ( SolutionDir ) \ . . \ vsprojects \ vcxproj \ . \ grpc_unsecure \ grpc_unsecure . vcxproj " > <nl> + < Project > { 46CEDFFF - 9692 - 456A - AA24 - 38B5D6BCF4C5 } < / Project > <nl> < / ProjectReference > <nl> < ProjectReference Include = " $ ( SolutionDir ) \ . . \ vsprojects \ vcxproj \ . \ gpr_test_util \ gpr_test_util . vcxproj " > <nl> < Project > { EAB0A629 - 17A9 - 44DB - B5FF - E91A721FE037 } < / Project > <nl>
Test against grpc + + _unsecure when possible . Provide unsecure version of test_util
grpc/grpc
168034b2f0a1943a0b14237a6d56a3ed0b582d8a
2017-08-01T00:10:44Z
mmm a / include / grpcpp / impl / codegen / client_callback . h <nl> ppp b / include / grpcpp / impl / codegen / client_callback . h <nl> class ClientCallbackReaderWriterImpl <nl> } <nl> <nl> void StartCall ( ) override { <nl> - / / This call initiates two batches , each with a callback <nl> + / / This call initiates two batches , plus any backlog , each with a callback <nl> / / 1 . Send initial metadata ( unless corked ) + recv initial metadata <nl> - / / 2 . Recv trailing metadata , on_completion callback <nl> - callbacks_outstanding_ = 2 ; <nl> + / / 2 . Any read backlog <nl> + / / 3 . Recv trailing metadata , on_completion callback <nl> + / / 4 . Any write backlog <nl> + started_ = true ; <nl> <nl> start_tag_ . Set ( call_ . call ( ) , <nl> [ this ] ( bool ok ) { <nl> class ClientCallbackReaderWriterImpl <nl> MaybeFinish ( ) ; <nl> } , <nl> & start_ops_ ) ; <nl> - start_corked_ = context_ - > initial_metadata_corked_ ; <nl> if ( ! start_corked_ ) { <nl> start_ops_ . SendInitialMetadata ( & context_ - > send_initial_metadata_ , <nl> context_ - > initial_metadata_flags ( ) ) ; <nl> class ClientCallbackReaderWriterImpl <nl> start_ops_ . set_core_cq_tag ( & start_tag_ ) ; <nl> call_ . PerformOps ( & start_ops_ ) ; <nl> <nl> - finish_tag_ . Set ( call_ . call ( ) , [ this ] ( bool ok ) { MaybeFinish ( ) ; } , <nl> - & finish_ops_ ) ; <nl> - finish_ops_ . ClientRecvStatus ( context_ , & finish_status_ ) ; <nl> - finish_ops_ . set_core_cq_tag ( & finish_tag_ ) ; <nl> - call_ . PerformOps ( & finish_ops_ ) ; <nl> - <nl> / / Also set up the read and write tags so that they don ' t have to be set up <nl> / / each time <nl> write_tag_ . Set ( call_ . call ( ) , <nl> class ClientCallbackReaderWriterImpl <nl> } , <nl> & read_ops_ ) ; <nl> read_ops_ . set_core_cq_tag ( & read_tag_ ) ; <nl> + if ( read_ops_at_start_ ) { <nl> + call_ . PerformOps ( & read_ops_ ) ; <nl> + } <nl> + <nl> + finish_tag_ . Set ( call_ . call ( ) , [ this ] ( bool ok ) { MaybeFinish ( ) ; } , <nl> + & finish_ops_ ) ; <nl> + finish_ops_ . ClientRecvStatus ( context_ , & finish_status_ ) ; <nl> + finish_ops_ . set_core_cq_tag ( & finish_tag_ ) ; <nl> + call_ . PerformOps ( & finish_ops_ ) ; <nl> + <nl> + if ( write_ops_at_start_ ) { <nl> + call_ . PerformOps ( & write_ops_ ) ; <nl> + } <nl> + <nl> + if ( writes_done_ops_at_start_ ) { <nl> + call_ . PerformOps ( & writes_done_ops_ ) ; <nl> + } <nl> } <nl> <nl> void Read ( Response * msg ) override { <nl> read_ops_ . RecvMessage ( msg ) ; <nl> callbacks_outstanding_ + + ; <nl> - call_ . PerformOps ( & read_ops_ ) ; <nl> + if ( started_ ) { <nl> + call_ . PerformOps ( & read_ops_ ) ; <nl> + } else { <nl> + read_ops_at_start_ = true ; <nl> + } <nl> } <nl> <nl> void Write ( const Request * msg , WriteOptions options ) override { <nl> class ClientCallbackReaderWriterImpl <nl> write_ops_ . ClientSendClose ( ) ; <nl> } <nl> callbacks_outstanding_ + + ; <nl> - call_ . PerformOps ( & write_ops_ ) ; <nl> + if ( started_ ) { <nl> + call_ . PerformOps ( & write_ops_ ) ; <nl> + } else { <nl> + write_ops_at_start_ = true ; <nl> + } <nl> } <nl> void WritesDone ( ) override { <nl> if ( start_corked_ ) { <nl> class ClientCallbackReaderWriterImpl <nl> & writes_done_ops_ ) ; <nl> writes_done_ops_ . set_core_cq_tag ( & writes_done_tag_ ) ; <nl> callbacks_outstanding_ + + ; <nl> - call_ . PerformOps ( & writes_done_ops_ ) ; <nl> + if ( started_ ) { <nl> + call_ . PerformOps ( & writes_done_ops_ ) ; <nl> + } else { <nl> + writes_done_ops_at_start_ = true ; <nl> + } <nl> } <nl> <nl> private : <nl> class ClientCallbackReaderWriterImpl <nl> ClientCallbackReaderWriterImpl ( <nl> Call call , ClientContext * context , <nl> : : grpc : : experimental : : ClientBidiReactor * reactor ) <nl> - : context_ ( context ) , call_ ( call ) , reactor_ ( reactor ) { } <nl> + : context_ ( context ) , <nl> + call_ ( call ) , <nl> + reactor_ ( reactor ) , <nl> + start_corked_ ( context_ - > initial_metadata_corked_ ) { } <nl> <nl> ClientContext * context_ ; <nl> Call call_ ; <nl> class ClientCallbackReaderWriterImpl <nl> CallOpSet < CallOpSendInitialMetadata , CallOpSendMessage , CallOpClientSendClose > <nl> write_ops_ ; <nl> CallbackWithSuccessTag write_tag_ ; <nl> + bool write_ops_at_start_ { false } ; <nl> <nl> CallOpSet < CallOpSendInitialMetadata , CallOpClientSendClose > writes_done_ops_ ; <nl> CallbackWithSuccessTag writes_done_tag_ ; <nl> + bool writes_done_ops_at_start_ { false } ; <nl> <nl> - CallOpSet < CallOpRecvInitialMetadata , CallOpRecvMessage < Response > > read_ops_ ; <nl> + CallOpSet < CallOpRecvMessage < Response > > read_ops_ ; <nl> CallbackWithSuccessTag read_tag_ ; <nl> + bool read_ops_at_start_ { false } ; <nl> <nl> - std : : atomic_int callbacks_outstanding_ ; <nl> + / / Minimum of 2 outstanding callbacks to pre - register for start and finish <nl> + std : : atomic_int callbacks_outstanding_ { 2 } ; <nl> + bool started_ { false } ; <nl> } ; <nl> <nl> template < class Request , class Response > <nl> class ClientCallbackReaderImpl <nl> } <nl> <nl> void StartCall ( ) override { <nl> - / / This call initiates two batches , each with a callback <nl> + / / This call initiates two batches , plus any backlog , each with a callback <nl> / / 1 . Send initial metadata ( unless corked ) + recv initial metadata <nl> - / / 2 . Recv trailing metadata , on_completion callback <nl> - callbacks_outstanding_ = 2 ; <nl> + / / 2 . Any backlog <nl> + / / 3 . Recv trailing metadata , on_completion callback <nl> + started_ = true ; <nl> <nl> start_tag_ . Set ( call_ . call ( ) , <nl> [ this ] ( bool ok ) { <nl> class ClientCallbackReaderImpl <nl> start_ops_ . set_core_cq_tag ( & start_tag_ ) ; <nl> call_ . PerformOps ( & start_ops_ ) ; <nl> <nl> - finish_tag_ . Set ( call_ . call ( ) , [ this ] ( bool ok ) { MaybeFinish ( ) ; } , <nl> - & finish_ops_ ) ; <nl> - finish_ops_ . ClientRecvStatus ( context_ , & finish_status_ ) ; <nl> - finish_ops_ . set_core_cq_tag ( & finish_tag_ ) ; <nl> - call_ . PerformOps ( & finish_ops_ ) ; <nl> - <nl> / / Also set up the read tag so it doesn ' t have to be set up each time <nl> read_tag_ . Set ( call_ . call ( ) , <nl> [ this ] ( bool ok ) { <nl> class ClientCallbackReaderImpl <nl> } , <nl> & read_ops_ ) ; <nl> read_ops_ . set_core_cq_tag ( & read_tag_ ) ; <nl> + if ( read_ops_at_start_ ) { <nl> + call_ . PerformOps ( & read_ops_ ) ; <nl> + } <nl> + <nl> + finish_tag_ . Set ( call_ . call ( ) , [ this ] ( bool ok ) { MaybeFinish ( ) ; } , <nl> + & finish_ops_ ) ; <nl> + finish_ops_ . ClientRecvStatus ( context_ , & finish_status_ ) ; <nl> + finish_ops_ . set_core_cq_tag ( & finish_tag_ ) ; <nl> + call_ . PerformOps ( & finish_ops_ ) ; <nl> } <nl> <nl> void Read ( Response * msg ) override { <nl> read_ops_ . RecvMessage ( msg ) ; <nl> callbacks_outstanding_ + + ; <nl> - call_ . PerformOps ( & read_ops_ ) ; <nl> + if ( started_ ) { <nl> + call_ . PerformOps ( & read_ops_ ) ; <nl> + } else { <nl> + read_ops_at_start_ = true ; <nl> + } <nl> } <nl> <nl> private : <nl> class ClientCallbackReaderImpl <nl> CallbackWithSuccessTag finish_tag_ ; <nl> Status finish_status_ ; <nl> <nl> - CallOpSet < CallOpRecvInitialMetadata , CallOpRecvMessage < Response > > read_ops_ ; <nl> + CallOpSet < CallOpRecvMessage < Response > > read_ops_ ; <nl> CallbackWithSuccessTag read_tag_ ; <nl> + bool read_ops_at_start_ { false } ; <nl> <nl> - std : : atomic_int callbacks_outstanding_ ; <nl> + / / Minimum of 2 outstanding callbacks to pre - register for start and finish <nl> + std : : atomic_int callbacks_outstanding_ { 2 } ; <nl> + bool started_ { false } ; <nl> } ; <nl> <nl> template < class Response > <nl> class ClientCallbackWriterImpl <nl> } <nl> <nl> void StartCall ( ) override { <nl> - / / This call initiates two batches , each with a callback <nl> + / / This call initiates two batches , plus any backlog , each with a callback <nl> / / 1 . Send initial metadata ( unless corked ) + recv initial metadata <nl> - / / 2 . Recv message + recv trailing metadata , on_completion callback <nl> - callbacks_outstanding_ = 2 ; <nl> + / / 2 . Recv trailing metadata , on_completion callback <nl> + / / 3 . Any backlog <nl> + started_ = true ; <nl> <nl> start_tag_ . Set ( call_ . call ( ) , <nl> [ this ] ( bool ok ) { <nl> class ClientCallbackWriterImpl <nl> MaybeFinish ( ) ; <nl> } , <nl> & start_ops_ ) ; <nl> - start_corked_ = context_ - > initial_metadata_corked_ ; <nl> if ( ! start_corked_ ) { <nl> start_ops_ . SendInitialMetadata ( & context_ - > send_initial_metadata_ , <nl> context_ - > initial_metadata_flags ( ) ) ; <nl> class ClientCallbackWriterImpl <nl> start_ops_ . set_core_cq_tag ( & start_tag_ ) ; <nl> call_ . PerformOps ( & start_ops_ ) ; <nl> <nl> - finish_tag_ . Set ( call_ . call ( ) , [ this ] ( bool ok ) { MaybeFinish ( ) ; } , <nl> - & finish_ops_ ) ; <nl> - finish_ops_ . ClientRecvStatus ( context_ , & finish_status_ ) ; <nl> - finish_ops_ . set_core_cq_tag ( & finish_tag_ ) ; <nl> - call_ . PerformOps ( & finish_ops_ ) ; <nl> - <nl> / / Also set up the read and write tags so that they don ' t have to be set up <nl> / / each time <nl> write_tag_ . Set ( call_ . call ( ) , <nl> class ClientCallbackWriterImpl <nl> } , <nl> & write_ops_ ) ; <nl> write_ops_ . set_core_cq_tag ( & write_tag_ ) ; <nl> + <nl> + finish_tag_ . Set ( call_ . call ( ) , [ this ] ( bool ok ) { MaybeFinish ( ) ; } , <nl> + & finish_ops_ ) ; <nl> + finish_ops_ . ClientRecvStatus ( context_ , & finish_status_ ) ; <nl> + finish_ops_ . set_core_cq_tag ( & finish_tag_ ) ; <nl> + call_ . PerformOps ( & finish_ops_ ) ; <nl> + <nl> + if ( write_ops_at_start_ ) { <nl> + call_ . PerformOps ( & write_ops_ ) ; <nl> + } <nl> + <nl> + if ( writes_done_ops_at_start_ ) { <nl> + call_ . PerformOps ( & writes_done_ops_ ) ; <nl> + } <nl> } <nl> <nl> void Write ( const Request * msg , WriteOptions options ) override { <nl> class ClientCallbackWriterImpl <nl> write_ops_ . ClientSendClose ( ) ; <nl> } <nl> callbacks_outstanding_ + + ; <nl> - call_ . PerformOps ( & write_ops_ ) ; <nl> + if ( started_ ) { <nl> + call_ . PerformOps ( & write_ops_ ) ; <nl> + } else { <nl> + write_ops_at_start_ = true ; <nl> + } <nl> } <nl> void WritesDone ( ) override { <nl> if ( start_corked_ ) { <nl> class ClientCallbackWriterImpl <nl> & writes_done_ops_ ) ; <nl> writes_done_ops_ . set_core_cq_tag ( & writes_done_tag_ ) ; <nl> callbacks_outstanding_ + + ; <nl> - call_ . PerformOps ( & writes_done_ops_ ) ; <nl> + if ( started_ ) { <nl> + call_ . PerformOps ( & writes_done_ops_ ) ; <nl> + } else { <nl> + writes_done_ops_at_start_ = true ; <nl> + } <nl> } <nl> <nl> private : <nl> class ClientCallbackWriterImpl <nl> ClientCallbackWriterImpl ( Call call , ClientContext * context , <nl> Response * response , <nl> : : grpc : : experimental : : ClientWriteReactor * reactor ) <nl> - : context_ ( context ) , call_ ( call ) , reactor_ ( reactor ) { <nl> + : context_ ( context ) , <nl> + call_ ( call ) , <nl> + reactor_ ( reactor ) , <nl> + start_corked_ ( context_ - > initial_metadata_corked_ ) { <nl> finish_ops_ . RecvMessage ( response ) ; <nl> finish_ops_ . AllowNoMessage ( ) ; <nl> } <nl> class ClientCallbackWriterImpl <nl> CallOpSet < CallOpSendInitialMetadata , CallOpSendMessage , CallOpClientSendClose > <nl> write_ops_ ; <nl> CallbackWithSuccessTag write_tag_ ; <nl> + bool write_ops_at_start_ { false } ; <nl> <nl> CallOpSet < CallOpSendInitialMetadata , CallOpClientSendClose > writes_done_ops_ ; <nl> CallbackWithSuccessTag writes_done_tag_ ; <nl> + bool writes_done_ops_at_start_ { false } ; <nl> <nl> - std : : atomic_int callbacks_outstanding_ ; <nl> + / / Minimum of 2 outstanding callbacks to pre - register for start and finish <nl> + std : : atomic_int callbacks_outstanding_ { 2 } ; <nl> + bool started_ { false } ; <nl> } ; <nl> <nl> template < class Request > <nl> mmm a / test / cpp / end2end / client_callback_end2end_test . cc <nl> ppp b / test / cpp / end2end / client_callback_end2end_test . cc <nl> class ClientCallbackEnd2endTest <nl> stream_ = <nl> test - > generic_stub_ - > experimental ( ) . PrepareBidiStreamingCall ( <nl> & cli_ctx_ , method_name , this ) ; <nl> - stream_ - > StartCall ( ) ; <nl> request_ . set_message ( test_str ) ; <nl> send_buf_ = SerializeToByteBuffer ( & request_ ) ; <nl> - stream_ - > Read ( & recv_buf_ ) ; <nl> stream_ - > Write ( send_buf_ . get ( ) ) ; <nl> + stream_ - > Read ( & recv_buf_ ) ; <nl> + stream_ - > StartCall ( ) ; <nl> } <nl> void OnWriteDone ( bool ok ) override { stream_ - > WritesDone ( ) ; } <nl> void OnReadDone ( bool ok ) override { <nl> mmm a / test / cpp / end2end / test_service_impl . cc <nl> ppp b / test / cpp / end2end / test_service_impl . cc <nl> void CallbackTestServiceImpl : : EchoNonDelayed ( <nl> return ; <nl> } <nl> <nl> + gpr_log ( GPR_DEBUG , " Request message was % s " , request - > message ( ) . c_str ( ) ) ; <nl> response - > set_message ( request - > message ( ) ) ; <nl> MaybeEchoDeadline ( context , request , response ) ; <nl> if ( host_ ) { <nl>
Make StartCall ( ) a releasing operation so that you can pile up ops
grpc/grpc
dac2066a1c0df628fefe4144ae0f97337af6324e
2018-11-30T12:13:40Z
mmm a / lib / Sema / CSSimplify . cpp <nl> ppp b / lib / Sema / CSSimplify . cpp <nl> ConstraintSystem : : simplifyMemberConstraint ( const Constraint & constraint ) { <nl> continue ; <nl> } <nl> <nl> + / / Verify that @ inout methods on value types are only applied to settable <nl> + / / values . <nl> + if ( ! isMetatype & & ! baseObjTy - > hasReferenceSemantics ( ) & & <nl> + isa < FuncDecl > ( result ) & & result - > getAttrs ( ) . isInOut ( ) & & <nl> + result - > isInstanceMember ( ) & & <nl> + / / Reject non - values and non - settable lvalues . <nl> + ( ! baseTy - > is < LValueType > ( ) | | <nl> + ! baseTy - > castTo < LValueType > ( ) - > isSettable ( ) ) ) <nl> + continue ; <nl> + <nl> / / If we ' re looking into an existential type , check whether this <nl> / / result was found via dynamic lookup . <nl> if ( isDynamicLookup ) { <nl>
Reject calls to inout methods on rvalues and ' let ' values .
apple/swift
b11903a6fc3187044ac0e5dbaa80439d9329cea4
2013-12-17T21:15:44Z
mmm a / src / mongo / db / op_observer_impl . cpp <nl> ppp b / src / mongo / db / op_observer_impl . cpp <nl> <nl> # include " mongo / db / namespace_string . h " <nl> # include " mongo / db / operation_context . h " <nl> # include " mongo / db / repl / oplog . h " <nl> + # include " mongo / db / repl / replication_coordinator_global . h " <nl> # include " mongo / db / s / collection_sharding_state . h " <nl> # include " mongo / db / server_options . h " <nl> # include " mongo / db / views / durable_view_catalog . h " <nl> # include " mongo / scripting / engine . h " <nl> <nl> namespace mongo { <nl> + namespace { <nl> + / / Return whether we ' re a master using master - slave replication . <nl> + bool isMasterSlave ( ) { <nl> + return repl : : getGlobalReplicationCoordinator ( ) - > getReplicationMode ( ) = = <nl> + repl : : ReplicationCoordinator : : modeMasterSlave ; <nl> + } <nl> + } / / namespace <nl> <nl> void OpObserverImpl : : onCreateIndex ( OperationContext * opCtx , <nl> const NamespaceString & nss , <nl> void OpObserverImpl : : onCreateIndex ( OperationContext * opCtx , <nl> BSONObj indexDoc , <nl> bool fromMigrate ) { <nl> NamespaceString systemIndexes { nss . getSystemIndexesCollection ( ) } ; <nl> - if ( uuid ) { <nl> + if ( uuid & & ! isMasterSlave ( ) ) { <nl> BSONObjBuilder builder ; <nl> builder . append ( " createIndexes " , nss . coll ( ) ) ; <nl> <nl> void OpObserverImpl : : onRenameCollection ( OperationContext * opCtx , <nl> builder . append ( " renameCollection " , fromCollection . ns ( ) ) ; <nl> builder . append ( " to " , toCollection . ns ( ) ) ; <nl> builder . append ( " stayTemp " , stayTemp ) ; <nl> - if ( dropTargetUUID & & enableCollectionUUIDs ) { <nl> + if ( dropTargetUUID & & enableCollectionUUIDs & & ! isMasterSlave ( ) ) { <nl> dropTargetUUID - > appendToBuilder ( & builder , " dropTarget " ) ; <nl> } else { <nl> builder . append ( " dropTarget " , dropTarget ) ; <nl> } <nl> - if ( dropSourceUUID & & enableCollectionUUIDs ) { <nl> + if ( dropSourceUUID & & enableCollectionUUIDs & & ! isMasterSlave ( ) ) { <nl> dropSourceUUID - > appendToBuilder ( & builder , " dropSource " ) ; <nl> } <nl> BSONObj cmdObj = builder . done ( ) ; <nl> mmm a / src / mongo / db / repl / oplog . cpp <nl> ppp b / src / mongo / db / repl / oplog . cpp <nl> OplogDocWriter _logOpWriter ( OperationContext * opCtx , <nl> b . append ( " v " , OplogEntry : : kOplogVersion ) ; <nl> b . append ( " op " , opstr ) ; <nl> b . append ( " ns " , nss . ns ( ) ) ; <nl> - if ( uuid ) <nl> + if ( uuid & & <nl> + repl : : getGlobalReplicationCoordinator ( ) - > getReplicationMode ( ) ! = <nl> + repl : : ReplicationCoordinator : : modeMasterSlave ) <nl> uuid - > appendToBuilder ( & b , " ui " ) ; <nl> if ( fromMigrate ) <nl> b . appendBool ( " fromMigrate " , true ) ; <nl>
SERVER - 30036 Make m / s replication work with collection UUIDs
mongodb/mongo
74149b3f7016cefde188e70c23cff3507930a7dc
2017-07-18T02:53:20Z
mmm a / contracts / eosiolib / datastream . hpp <nl> ppp b / contracts / eosiolib / datastream . hpp <nl> inline datastream < Stream > & operator > > ( datastream < Stream > & ds , checksum256 & d ) { <nl> template < typename DataStream > <nl> DataStream & operator < < ( DataStream & ds , const std : : string & v ) { <nl> ds < < unsigned_int ( v . size ( ) ) ; <nl> - for ( const auto & i : v ) <nl> - ds < < i ; <nl> + if ( v . size ( ) ) <nl> + ds . write ( v . data ( ) , v . size ( ) ) ; <nl> return ds ; <nl> } <nl> <nl> template < typename DataStream > <nl> DataStream & operator > > ( DataStream & ds , std : : string & v ) { <nl> - unsigned_int s ; <nl> - ds > > s ; <nl> - v . resize ( s . value ) ; <nl> - for ( auto & i : v ) <nl> - ds > > i ; <nl> + std : : vector < char > tmp ; <nl> + ds > > tmp ; <nl> + if ( tmp . size ( ) ) <nl> + v = std : : string ( tmp . data ( ) , tmp . data ( ) + tmp . size ( ) ) ; <nl> + else <nl> + v = std : : string ( ) ; <nl> return ds ; <nl> } <nl> <nl>
Optimization for string . GH
EOSIO/eos
c3e6cdc3040ac11a43d0bd88ad45e7ec201fe72d
2018-04-17T15:04:00Z
mmm a / src / video_core / CMakeLists . txt <nl> ppp b / src / video_core / CMakeLists . txt <nl> add_library ( video_core STATIC <nl> engines / maxwell_3d . h <nl> engines / maxwell_compute . cpp <nl> engines / maxwell_compute . h <nl> + engines / maxwell_dma . cpp <nl> + engines / maxwell_dma . h <nl> engines / shader_bytecode . h <nl> gpu . cpp <nl> gpu . h <nl> mmm a / src / video_core / command_processor . cpp <nl> ppp b / src / video_core / command_processor . cpp <nl> <nl> # include " video_core / engines / fermi_2d . h " <nl> # include " video_core / engines / maxwell_3d . h " <nl> # include " video_core / engines / maxwell_compute . h " <nl> + # include " video_core / engines / maxwell_dma . h " <nl> # include " video_core / gpu . h " <nl> # include " video_core / renderer_base . h " <nl> # include " video_core / video_core . h " <nl> void GPU : : WriteReg ( u32 method , u32 subchannel , u32 value , u32 remaining_params ) <nl> case EngineID : : MAXWELL_COMPUTE_B : <nl> maxwell_compute - > WriteReg ( method , value ) ; <nl> break ; <nl> + case EngineID : : MAXWELL_DMA_COPY_A : <nl> + maxwell_dma - > WriteReg ( method , value ) ; <nl> + break ; <nl> default : <nl> - UNIMPLEMENTED ( ) ; <nl> + UNIMPLEMENTED_MSG ( " Unimplemented engine " ) ; <nl> } <nl> } <nl> <nl> mmm a / src / video_core / engines / fermi_2d . cpp <nl> ppp b / src / video_core / engines / fermi_2d . cpp <nl> void Fermi2D : : HandleSurfaceCopy ( ) { <nl> <nl> if ( regs . src . linear = = regs . dst . linear ) { <nl> / / If the input layout and the output layout are the same , just perform a raw copy . <nl> + ASSERT ( regs . src . BlockHeight ( ) = = regs . dst . BlockHeight ( ) ) ; <nl> Memory : : CopyBlock ( dest_cpu , source_cpu , <nl> src_bytes_per_pixel * regs . dst . width * regs . dst . height ) ; <nl> return ; <nl> new file mode 100644 <nl> index 00000000000 . . 442138988b5 <nl> mmm / dev / null <nl> ppp b / src / video_core / engines / maxwell_dma . cpp <nl> <nl> + / / Copyright 2018 yuzu Emulator Project <nl> + / / Licensed under GPLv2 or any later version <nl> + / / Refer to the license . txt file included . <nl> + <nl> + # include " core / memory . h " <nl> + # include " video_core / engines / maxwell_dma . h " <nl> + # include " video_core / textures / decoders . h " <nl> + <nl> + namespace Tegra { <nl> + namespace Engines { <nl> + <nl> + MaxwellDMA : : MaxwellDMA ( MemoryManager & memory_manager ) : memory_manager ( memory_manager ) { } <nl> + <nl> + void MaxwellDMA : : WriteReg ( u32 method , u32 value ) { <nl> + ASSERT_MSG ( method < Regs : : NUM_REGS , <nl> + " Invalid MaxwellDMA register , increase the size of the Regs structure " ) ; <nl> + <nl> + regs . reg_array [ method ] = value ; <nl> + <nl> + # define MAXWELLDMA_REG_INDEX ( field_name ) \ <nl> + ( offsetof ( Tegra : : Engines : : MaxwellDMA : : Regs , field_name ) / sizeof ( u32 ) ) <nl> + <nl> + switch ( method ) { <nl> + case MAXWELLDMA_REG_INDEX ( exec ) : { <nl> + HandleCopy ( ) ; <nl> + break ; <nl> + } <nl> + } <nl> + <nl> + # undef MAXWELLDMA_REG_INDEX <nl> + } <nl> + <nl> + void MaxwellDMA : : HandleCopy ( ) { <nl> + NGLOG_WARNING ( HW_GPU , " Requested a DMA copy " ) ; <nl> + <nl> + const GPUVAddr source = regs . src_address . Address ( ) ; <nl> + const GPUVAddr dest = regs . dst_address . Address ( ) ; <nl> + <nl> + const VAddr source_cpu = * memory_manager . GpuToCpuAddress ( source ) ; <nl> + const VAddr dest_cpu = * memory_manager . GpuToCpuAddress ( dest ) ; <nl> + <nl> + / / TODO ( Subv ) : Perform more research and implement all features of this engine . <nl> + ASSERT ( regs . exec . enable_swizzle = = 0 ) ; <nl> + ASSERT ( regs . exec . enable_2d = = 1 ) ; <nl> + ASSERT ( regs . exec . query_mode = = Regs : : QueryMode : : None ) ; <nl> + ASSERT ( regs . exec . query_intr = = Regs : : QueryIntr : : None ) ; <nl> + ASSERT ( regs . exec . copy_mode = = Regs : : CopyMode : : Unk2 ) ; <nl> + ASSERT ( regs . src_params . pos_x = = 0 ) ; <nl> + ASSERT ( regs . src_params . pos_y = = 0 ) ; <nl> + ASSERT ( regs . dst_params . pos_x = = 0 ) ; <nl> + ASSERT ( regs . dst_params . pos_y = = 0 ) ; <nl> + ASSERT ( regs . exec . is_dst_linear ! = regs . exec . is_src_linear ) ; <nl> + <nl> + u8 * src_buffer = Memory : : GetPointer ( source_cpu ) ; <nl> + u8 * dst_buffer = Memory : : GetPointer ( dest_cpu ) ; <nl> + <nl> + if ( regs . exec . is_dst_linear & & ! regs . exec . is_src_linear ) { <nl> + / / If the input is tiled and the output is linear , deswizzle the input and copy it over . <nl> + Texture : : CopySwizzledData ( regs . src_params . size_x , regs . src_params . size_y , 1 , 1 , src_buffer , <nl> + dst_buffer , true , regs . src_params . BlockHeight ( ) ) ; <nl> + } else { <nl> + / / If the input is linear and the output is tiled , swizzle the input and copy it over . <nl> + Texture : : CopySwizzledData ( regs . dst_params . size_x , regs . dst_params . size_y , 1 , 1 , dst_buffer , <nl> + src_buffer , false , regs . dst_params . BlockHeight ( ) ) ; <nl> + } <nl> + } <nl> + <nl> + } / / namespace Engines <nl> + } / / namespace Tegra <nl> new file mode 100644 <nl> index 00000000000 . . 905749bde5a <nl> mmm / dev / null <nl> ppp b / src / video_core / engines / maxwell_dma . h <nl> <nl> + / / Copyright 2018 yuzu Emulator Project <nl> + / / Licensed under GPLv2 or any later version <nl> + / / Refer to the license . txt file included . <nl> + <nl> + # pragma once <nl> + <nl> + # include < array > <nl> + # include " common / assert . h " <nl> + # include " common / bit_field . h " <nl> + # include " common / common_funcs . h " <nl> + # include " common / common_types . h " <nl> + # include " video_core / gpu . h " <nl> + # include " video_core / memory_manager . h " <nl> + <nl> + namespace Tegra { <nl> + namespace Engines { <nl> + <nl> + class MaxwellDMA final { <nl> + public : <nl> + explicit MaxwellDMA ( MemoryManager & memory_manager ) ; <nl> + ~ MaxwellDMA ( ) = default ; <nl> + <nl> + / / / Write the value to the register identified by method . <nl> + void WriteReg ( u32 method , u32 value ) ; <nl> + <nl> + struct Regs { <nl> + static constexpr size_t NUM_REGS = 0x1D6 ; <nl> + <nl> + struct Parameters { <nl> + union { <nl> + BitField < 0 , 4 , u32 > block_depth ; <nl> + BitField < 4 , 4 , u32 > block_height ; <nl> + BitField < 8 , 4 , u32 > block_width ; <nl> + } ; <nl> + u32 size_x ; <nl> + u32 size_y ; <nl> + u32 size_z ; <nl> + u32 pos_z ; <nl> + union { <nl> + BitField < 0 , 16 , u32 > pos_x ; <nl> + BitField < 16 , 16 , u32 > pos_y ; <nl> + } ; <nl> + <nl> + u32 BlockHeight ( ) const { <nl> + return 1 < < block_height ; <nl> + } <nl> + } ; <nl> + <nl> + static_assert ( sizeof ( Parameters ) = = 24 , " Parameters has wrong size " ) ; <nl> + <nl> + enum class CopyMode : u32 { <nl> + None = 0 , <nl> + Unk1 = 1 , <nl> + Unk2 = 2 , <nl> + } ; <nl> + <nl> + enum class QueryMode : u32 { <nl> + None = 0 , <nl> + Short = 1 , <nl> + Long = 2 , <nl> + } ; <nl> + <nl> + enum class QueryIntr : u32 { <nl> + None = 0 , <nl> + Block = 1 , <nl> + NonBlock = 2 , <nl> + } ; <nl> + <nl> + union { <nl> + struct { <nl> + INSERT_PADDING_WORDS ( 0xC0 ) ; <nl> + <nl> + struct { <nl> + union { <nl> + BitField < 0 , 2 , CopyMode > copy_mode ; <nl> + BitField < 2 , 1 , u32 > flush ; <nl> + <nl> + BitField < 3 , 2 , QueryMode > query_mode ; <nl> + BitField < 5 , 2 , QueryIntr > query_intr ; <nl> + <nl> + BitField < 7 , 1 , u32 > is_src_linear ; <nl> + BitField < 8 , 1 , u32 > is_dst_linear ; <nl> + <nl> + BitField < 9 , 1 , u32 > enable_2d ; <nl> + BitField < 10 , 1 , u32 > enable_swizzle ; <nl> + } ; <nl> + } exec ; <nl> + <nl> + INSERT_PADDING_WORDS ( 0x3F ) ; <nl> + <nl> + struct { <nl> + u32 address_high ; <nl> + u32 address_low ; <nl> + <nl> + GPUVAddr Address ( ) const { <nl> + return static_cast < GPUVAddr > ( ( static_cast < GPUVAddr > ( address_high ) < < 32 ) | <nl> + address_low ) ; <nl> + } <nl> + } src_address ; <nl> + <nl> + struct { <nl> + u32 address_high ; <nl> + u32 address_low ; <nl> + <nl> + GPUVAddr Address ( ) const { <nl> + return static_cast < GPUVAddr > ( ( static_cast < GPUVAddr > ( address_high ) < < 32 ) | <nl> + address_low ) ; <nl> + } <nl> + } dst_address ; <nl> + <nl> + u32 src_pitch ; <nl> + u32 dst_pitch ; <nl> + u32 x_count ; <nl> + u32 y_count ; <nl> + <nl> + INSERT_PADDING_WORDS ( 0xBB ) ; <nl> + <nl> + Parameters dst_params ; <nl> + <nl> + INSERT_PADDING_WORDS ( 1 ) ; <nl> + <nl> + Parameters src_params ; <nl> + <nl> + INSERT_PADDING_WORDS ( 0x13 ) ; <nl> + } ; <nl> + std : : array < u32 , NUM_REGS > reg_array ; <nl> + } ; <nl> + } regs { } ; <nl> + <nl> + MemoryManager & memory_manager ; <nl> + <nl> + private : <nl> + / / / Performs the copy from the source buffer to the destination buffer as configured in the <nl> + / / / registers . <nl> + void HandleCopy ( ) ; <nl> + } ; <nl> + <nl> + # define ASSERT_REG_POSITION ( field_name , position ) \ <nl> + static_assert ( offsetof ( MaxwellDMA : : Regs , field_name ) = = position * 4 , \ <nl> + " Field " # field_name " has invalid position " ) <nl> + <nl> + ASSERT_REG_POSITION ( exec , 0xC0 ) ; <nl> + ASSERT_REG_POSITION ( src_address , 0x100 ) ; <nl> + ASSERT_REG_POSITION ( dst_address , 0x102 ) ; <nl> + ASSERT_REG_POSITION ( src_pitch , 0x104 ) ; <nl> + ASSERT_REG_POSITION ( dst_pitch , 0x105 ) ; <nl> + ASSERT_REG_POSITION ( x_count , 0x106 ) ; <nl> + ASSERT_REG_POSITION ( y_count , 0x107 ) ; <nl> + ASSERT_REG_POSITION ( dst_params , 0x1C3 ) ; <nl> + ASSERT_REG_POSITION ( src_params , 0x1CA ) ; <nl> + <nl> + # undef ASSERT_REG_POSITION <nl> + <nl> + } / / namespace Engines <nl> + } / / namespace Tegra <nl> mmm a / src / video_core / gpu . cpp <nl> ppp b / src / video_core / gpu . cpp <nl> <nl> # include " video_core / engines / fermi_2d . h " <nl> # include " video_core / engines / maxwell_3d . h " <nl> # include " video_core / engines / maxwell_compute . h " <nl> + # include " video_core / engines / maxwell_dma . h " <nl> # include " video_core / gpu . h " <nl> <nl> namespace Tegra { <nl> GPU : : GPU ( ) { <nl> maxwell_3d = std : : make_unique < Engines : : Maxwell3D > ( * memory_manager ) ; <nl> fermi_2d = std : : make_unique < Engines : : Fermi2D > ( * memory_manager ) ; <nl> maxwell_compute = std : : make_unique < Engines : : MaxwellCompute > ( ) ; <nl> + maxwell_dma = std : : make_unique < Engines : : MaxwellDMA > ( * memory_manager ) ; <nl> } <nl> <nl> GPU : : ~ GPU ( ) = default ; <nl> mmm a / src / video_core / gpu . h <nl> ppp b / src / video_core / gpu . h <nl> namespace Engines { <nl> class Fermi2D ; <nl> class Maxwell3D ; <nl> class MaxwellCompute ; <nl> + class MaxwellDMA ; <nl> } / / namespace Engines <nl> <nl> enum class EngineID { <nl> class GPU final { <nl> std : : unique_ptr < Engines : : Fermi2D > fermi_2d ; <nl> / / / Compute engine <nl> std : : unique_ptr < Engines : : MaxwellCompute > maxwell_compute ; <nl> + / / / DMA engine <nl> + std : : unique_ptr < Engines : : MaxwellDMA > maxwell_dma ; <nl> } ; <nl> <nl> } / / namespace Tegra <nl>
Merge pull request from Subv / dma_engine
yuzu-emu/yuzu
019d7208c808bee08495b7da12cbc57056d77783
2018-06-12T18:25:17Z
mmm a / Marlin / ultralcd . cpp <nl> ppp b / Marlin / ultralcd . cpp <nl> void kill_screen ( const char * lcd_msg ) { <nl> MENU_ITEM ( gcode , MSG_AUTO_HOME_Z , PSTR ( " G28 Z " ) ) ; <nl> # endif <nl> <nl> - / / <nl> - / / Set Home Offsets <nl> - / / <nl> - MENU_ITEM ( function , MSG_SET_HOME_OFFSETS , lcd_set_home_offsets ) ; <nl> - / / MENU_ITEM ( gcode , MSG_SET_ORIGIN , PSTR ( " G92 X0 Y0 Z0 " ) ) ; <nl> - <nl> / / <nl> / / Level Bed <nl> / / <nl> void kill_screen ( const char * lcd_msg ) { <nl> MENU_ITEM ( submenu , MSG_LEVEL_BED , lcd_level_bed ) ; <nl> # endif <nl> <nl> + / / <nl> + / / Set Home Offsets <nl> + / / <nl> + MENU_ITEM ( function , MSG_SET_HOME_OFFSETS , lcd_set_home_offsets ) ; <nl> + / / MENU_ITEM ( gcode , MSG_SET_ORIGIN , PSTR ( " G92 X0 Y0 Z0 " ) ) ; <nl> + <nl> / / <nl> / / Disable Steppers <nl> / / <nl>
Place " Level Bed " closer to " Auto Home "
MarlinFirmware/Marlin
0d2fc135163d99b0f0596587a5461d7a9066f30e
2016-12-20T08:51:03Z
mmm a / src / unity / python / turicreate / data_structures / image . py <nl> ppp b / src / unity / python / turicreate / data_structures / image . py <nl> def save ( self , filename ) : <nl> " " " <nl> Saves the image to a file system for later use . <nl> <nl> + File format is inferred from the file extension of the ` filename ` . <nl> + Supported file extensions include : bmp , gif , jpg , png , tiff . <nl> + <nl> Parameters <nl> mmmmmmmmm - <nl> filename : string <nl> mmm a / src / unity / python / turicreate / toolkits / drawing_classifier / drawing_classifier . py <nl> ppp b / src / unity / python / turicreate / toolkits / drawing_classifier / drawing_classifier . py <nl> def evaluate ( self , dataset , metric = ' auto ' , batch_size = None , verbose = True ) : <nl> prediction / true label combinations . <nl> - ' roc_curve ' : An SFrame containing information needed for an <nl> ROC curve <nl> - <nl> + <nl> + batch_size : int , optional <nl> + If you are getting memory errors , try decreasing this value . If you <nl> + have a powerful computer , increasing this value may improve <nl> + performance . <nl> + <nl> verbose : bool , optional <nl> If True , prints prediction progress . <nl> <nl> def predict_topk ( self , dataset , output_type = " probability " , k = 3 , <nl> Examples <nl> mmmmmm - - <nl> > > > pred = m . predict_topk ( validation_data , k = 3 ) <nl> - > > > pred <nl> + > > > print ( pred ) <nl> + mmm - + mmmmmm - + mmmmmmmmmmmmmmmmmm - + <nl> | id | class | probability | <nl> + mmm - + mmmmmm - + mmmmmmmmmmmmmmmmmm - + <nl> mmm a / userguide / drawing_classifier / README . md <nl> ppp b / userguide / drawing_classifier / README . md <nl> data = tc . SFrame ( SFRAME_PATH ) <nl> train_data , test_data = data . random_split ( 0 . 7 ) <nl> <nl> # Create a model <nl> - model = tc . drawing_classifier . create ( train_data ) <nl> + model = tc . drawing_classifier . create ( train_data , ' label ' ) <nl> <nl> # Save predictions to an SArray <nl> predictions = model . predict ( test_data ) <nl> mmm a / userguide / drawing_classifier / advanced - usage . md <nl> ppp b / userguide / drawing_classifier / advanced - usage . md <nl> and also helping the model converge faster . <nl> <nl> We have published a pre - trained model that automatically gets downloaded when you pass in <nl> ` auto ` to the ` warm_start ` parameter . This model is trained on millions of drawings from <nl> - the “ Quick , Draw ! ” dataset <nl> \ No newline at end of file <nl> + the “ Quick , Draw ! ” dataset . <nl> mmm a / userguide / drawing_classifier / data - preparation . md <nl> ppp b / userguide / drawing_classifier / data - preparation . md <nl> def build_bitmap_sframe ( ) : <nl> _image_data_size = np_pixel_data . size ) <nl> bitmaps_list . append ( bitmap ) <nl> labels_list . append ( class_name ) <nl> + <nl> sf = tc . SFrame ( { " drawing " : bitmaps_list , " label " : labels_list } ) <nl> sf . save ( os . path . join ( sframes_dir , " bitmap_square_triangle . sframe " ) ) <nl> <nl> mmm a / userguide / drawing_classifier / export - coreml . md <nl> ppp b / userguide / drawing_classifier / export - coreml . md <nl> <nl> Drawing Classifier models created in Turi Create can easily be deployed to <nl> Core ML . <nl> <nl> - You can export to Core ML in Turi Create 5 . 4 as follows : <nl> + You can export to Core ML in Turi Create 5 . 4 or higher as follows : <nl> ` ` ` python <nl> model . export_coreml ( " MySquareTriangleClassifier . mlmodel " ) <nl> ` ` ` <nl> mmm a / userguide / drawing_classifier / how - it - works . md <nl> ppp b / userguide / drawing_classifier / how - it - works . md <nl> data we have to deal with during the rasterization step . In most <nl> drawing / rendering ecosystems , points are usually sampled at a frequency high <nl> enough that some key points can capture the drawing that all the points <nl> rendered . To simplify drawings and get rid of redundant points , we employ the <nl> - Ramer - Douglas - Peucker algorithm , which decimates a stroke composed of <nl> + [ Ramer - Douglas - Peucker algorithm ] ( https : / / en . wikipedia . org / wiki / Ramer – Douglas – Peucker_algorithm ) , which decimates a stroke composed of <nl> line segments to a similar curve with fewer points . <nl> <nl> 3 . * * Rasterization * * : Rasterization from the simplified normalized strokes to <nl> the final bitmap that the Neural Network can consume , can be further broken <nl> down into three steps : <nl> + <nl> 1 . First , we render the simplified drawing that we <nl> - got as an output from Step 2 as an intermediate bitmap of size 256x256 <nl> - ( since all our normalized points lie in [ 0 , 255 ] ) . <nl> + got as an output from Step 2 as an intermediate bitmap of size 256x256 <nl> + ( since all our normalized points lie in [ 0 , 255 ] ) . <nl> + <nl> 2 . Next , we blur the intermediate bitmap . <nl> + <nl> 3 . Finally , we resize the blurred intermediate bitmap down to a final bitmap <nl> size of 28x28 , which the Neural Network can consume . <nl> <nl>
Minor documentation updates ( )
apple/turicreate
f3e6964474626b51867ef7b9d3936c20a6936b41
2019-05-28T14:51:30Z
mmm a / laf <nl> ppp b / laf <nl> @ @ - 1 + 1 @ @ <nl> - Subproject commit af0f8e7b53b9e3e689b5fa4e5ce1466c42c9e2aa <nl> + Subproject commit 241b7c9ff09158d8432b3a9dbb0e68c6eed61b60 <nl>
Fix memory leak drawing Unicode text
aseprite/aseprite
26c675e0d380b7213f370864ea94dbda72498c0c
2020-06-04T19:13:46Z
mmm a / dbms / include / DB / Columns / ColumnArray . h <nl> ppp b / dbms / include / DB / Columns / ColumnArray . h <nl> class ColumnArray final : public IColumn <nl> if ( ! typeid_cast < ColumnOffsets_t * > ( & * offsets_column ) ) <nl> throw Exception ( " offsets_column must be a ColumnUInt64 " , ErrorCodes : : ILLEGAL_COLUMN ) ; <nl> } <nl> + <nl> + if ( nested_column - > isConst ( ) ) <nl> + throw Exception { " ColumnArray cannot have constant nested column " , ErrorCodes : : LOGICAL_ERROR } ; <nl> } <nl> <nl> std : : string getName ( ) const override { return " ColumnArray ( " + getData ( ) . getName ( ) + " ) " ; } <nl> mmm a / dbms / src / Columns / ColumnNullable . cpp <nl> ppp b / dbms / src / Columns / ColumnNullable . cpp <nl> ColumnNullable : : ColumnNullable ( ColumnPtr nested_column_ , ColumnPtr null_map_ ) <nl> { <nl> if ( nested_column - > isNullable ( ) ) <nl> throw Exception { " A nullable column cannot contain another nullable column " , ErrorCodes : : LOGICAL_ERROR } ; <nl> + <nl> + if ( nested_column - > isConst ( ) ) <nl> + throw Exception { " ColumnNullable cannot have constant nested column " , ErrorCodes : : LOGICAL_ERROR } ; <nl> + <nl> + if ( null_map - > isConst ( ) ) <nl> + throw Exception { " ColumnNullable cannot have constant null map " , ErrorCodes : : LOGICAL_ERROR } ; <nl> } <nl> <nl> <nl>
More safe [ # CLICKHOUSE - 4 ] .
ClickHouse/ClickHouse
0a8d89e4ba209733f2bbec46b27009121a3b5a80
2017-03-06T21:36:33Z
mmm a / test / Sema / exhaustive_switch . swift <nl> ppp b / test / Sema / exhaustive_switch . swift <nl> func sr10301_as ( _ foo : SR10301 < String , ( Int , Error ) > ) { <nl> return <nl> } <nl> } <nl> + <nl> + / / SR - 11212 tests : Some of the tests here rely on compiler bugs related to <nl> + / / implicit ( un ) tupling in patterns . When you add a warning for the erroneous <nl> + / / cases , feel free to add expected notes as appropriate . <nl> + enum SR11212Tests { <nl> + <nl> + enum Untupled { <nl> + case upair ( Int , Int ) <nl> + } <nl> + <nl> + func sr11212_content_untupled_pattern_tupled ( u : Untupled ) - > ( Int , Int ) { <nl> + switch u { <nl> + case . upair ( ( let x , let y ) ) : return ( x , y ) <nl> + } <nl> + } <nl> + <nl> + func sr11212_content_untupled_pattern_tupled_nested ( u : Untupled ) - > ( Int , Int ) { <nl> + switch u { <nl> + case . upair ( let ( x , y ) ) : return ( x , y ) <nl> + } <nl> + } <nl> + <nl> + func sr11212_content_untupled_pattern_untupled ( u : Untupled ) - > ( Int , Int ) { <nl> + switch u { <nl> + case . upair ( let x , let y ) : return ( x , y ) <nl> + } <nl> + } <nl> + <nl> + func sr11212_content_untupled_pattern_ambiguous ( u : Untupled ) - > ( Int , Int ) { <nl> + switch u { <nl> + case . upair ( let u_ ) : return u_ <nl> + } <nl> + } <nl> + <nl> + enum Tupled { <nl> + case tpair ( ( Int , Int ) ) <nl> + } <nl> + <nl> + func sr11212_content_tupled_pattern_tupled ( t : Tupled ) - > ( Int , Int ) { <nl> + switch t { <nl> + case . tpair ( ( let x , let y ) ) : return ( x , y ) <nl> + } <nl> + } <nl> + <nl> + func sr11212_content_tupled_pattern_tupled_nested ( t : Tupled ) - > ( Int , Int ) { <nl> + switch t { <nl> + case . tpair ( let ( x , y ) ) : return ( x , y ) <nl> + } <nl> + } <nl> + <nl> + func sr11212_content_tupled_pattern_untupled ( t : Tupled ) - > ( Int , Int ) { <nl> + switch t { <nl> + case . tpair ( let x , let y ) : return ( x , y ) <nl> + } <nl> + } <nl> + <nl> + func sr11212_content_tupled_pattern_ambiguous ( t : Tupled ) - > ( Int , Int ) { <nl> + switch t { <nl> + case . tpair ( let t_ ) : return t_ <nl> + } <nl> + } <nl> + <nl> + enum Box < T > { <nl> + case box ( T ) <nl> + } <nl> + <nl> + func sr11212_content_generic_pattern_tupled ( b : Box < ( Int , Int ) > ) - > ( Int , Int ) { <nl> + switch b { <nl> + case . box ( ( let x , let y ) ) : return ( x , y ) <nl> + } <nl> + } <nl> + <nl> + func sr11212_content_generic_pattern_tupled_nested ( b : Box < ( Int , Int ) > ) - > ( Int , Int ) { <nl> + switch b { <nl> + case . box ( let ( x , y ) ) : return ( x , y ) <nl> + } <nl> + } <nl> + <nl> + func sr11212_content_generic_pattern_untupled ( b : Box < ( Int , Int ) > ) - > ( Int , Int ) { <nl> + switch b { <nl> + case . box ( let x , let y ) : return ( x , y ) <nl> + } <nl> + } <nl> + <nl> + func sr11212_content_generic_pattern_ambiguous ( b : Box < ( Int , Int ) > ) - > ( Int , Int ) { <nl> + switch b { <nl> + case . box ( let b_ ) : return b_ <nl> + } <nl> + } <nl> + <nl> + } / / end SR11212Tests <nl>
Merge remote - tracking branch ' origin / master ' into master - next
apple/swift
c9d3a53e92e15effe0f32af582798c67960d6b77
2019-07-30T18:09:59Z
mmm a / misc / dist / linux / godot . 6 <nl> ppp b / misc / dist / linux / godot . 6 <nl> <nl> - . TH GODOT " 6 " " March 2019 " " godot 3 . 2 " " Games " <nl> + . TH GODOT " 6 " " January 2020 " " godot 3 . 2 " " Games " <nl> . SH NAME <nl> godot \ - multi \ - platform 2D and 3D game engine with a feature \ - rich editor <nl> . SH SYNOPSIS <nl> Force low \ - DPI mode ( macOS and Windows only ) . <nl> . TP <nl> \ fB \ - \ - no \ - window \ fR <nl> Disable window creation ( Windows only ) . Useful together with \ fB \ - \ - script \ fR . <nl> + . TP <nl> + \ fB \ - \ - enable \ - vsync \ - via \ - compositor \ fR <nl> + When vsync is enabled , vsync via the OS ' window compositor ( Windows only ) . <nl> + . TP <nl> + \ fB \ - \ - disable \ - vsync \ - via \ - compositor \ fR <nl> + Disable vsync via the OS ' window compositor ( Windows only ) . <nl> . SS " Debug options : " <nl> . TP <nl> \ fB \ - d \ fR , \ fB \ - \ - debug \ fR <nl> Run a script . <nl> \ fB \ - \ - check \ - only \ fR <nl> Only parse for errors and quit ( use with - - script ) . <nl> . TP <nl> - \ fB \ - \ - export \ fR < target > <nl> - Export the project using the given export target . Export only main pack if path ends with . pck or . zip . <nl> + \ fB \ - \ - export \ fR < preset > < path > <nl> + Export the project using the given preset and matching release template . The preset name should match one defined in export_presets . cfg . <nl> + . br <nl> + < path > should be absolute or relative to the project directory , and include the filename for the binary ( e . g . ' builds / game . exe ' ) . The target directory should exist . <nl> + . TP <nl> + \ fB \ - \ - export \ - debug \ fR < preset > < path > <nl> + Same as \ - \ - export , but using the debug template . <nl> . TP <nl> - \ fB \ - \ - export \ - debug \ fR < target > <nl> - Like \ - \ - export , but use debug template . <nl> + \ fB \ - \ - export \ - pack \ fR < preset > < path > <nl> + Same as \ - \ - export , but only export the game pack for the given preset . The < path > extension determines whether it will be in PCK or ZIP format . <nl> . TP <nl> \ fB \ - \ - doctool \ fR < path > <nl> Dump the engine API reference to the given < path > in XML format , merging if existing files are found . <nl> Dump the engine API reference to the given < path > in XML format , merging if exis <nl> Disallow dumping the base types ( used with \ fB \ - \ - doctool \ fR ) . <nl> . TP <nl> \ fB \ - \ - build \ - solutions \ fR <nl> - Build the scripting solutions ( e . g . for C # projects ) . <nl> + Build the scripting solutions ( e . g . for C # projects ) . Implies \ - \ - editor and requires a valid project to edit . <nl> . TP <nl> \ fB \ - \ - gdnative \ - generate \ - json \ - api \ fR <nl> Generate JSON dump of the Godot API for GDNative bindings . <nl> Godot Engine is a free and open source project and welcomes any kind of <nl> contributions . In particular , you can report issues or make suggestions on <nl> Godot ' s issue tracker at \ fIhttps : / / github . com / godotengine / godot / issues \ fR . <nl> . SH AUTHOR <nl> - Man page written by Rémi Verschelde < akien @ godotengine . org > on behalf of the <nl> + Man page written by Rémi Verschelde < remi @ godotengine . org > on behalf of the <nl> Godot Engine development team . <nl> mmm a / misc / dist / linux / org . godotengine . Godot . appdata . xml <nl> ppp b / misc / dist / linux / org . godotengine . Godot . appdata . xml <nl> <nl> < ? xml version = " 1 . 0 " encoding = " UTF - 8 " ? > <nl> - < ! - - Copyright 2017 - 2020 Rémi Verschelde < akien @ godotengine . org > - - > <nl> + < ! - - Copyright 2017 - 2020 Rémi Verschelde < remi @ godotengine . org > - - > <nl> < component type = " desktop " > <nl> < id > org . godotengine . Godot < / id > <nl> < metadata_license > CC0 - 1 . 0 < / metadata_license > <nl>
Linux : Sync man page with current - - help output
godotengine/godot
9ed14815d8f2fd0dc3b91a65e85cec43a8b5f0ef
2020-01-26T18:02:09Z
mmm a / package . json <nl> ppp b / package . json <nl> <nl> " @ types / webpack - env " : " ^ 1 . 15 . 1 " , <nl> " @ typescript - eslint / eslint - plugin " : " ^ 2 . 24 . 0 " , <nl> " @ typescript - eslint / parser " : " ^ 2 . 24 . 0 " , <nl> - " asar " : " ^ 1 . 0 . 0 " , <nl> + " asar " : " ^ 3 . 0 . 1 " , <nl> " check - for - leaks " : " ^ 1 . 2 . 1 " , <nl> " colors " : " ^ 1 . 1 . 2 " , <nl> " dotenv - safe " : " ^ 4 . 0 . 4 " , <nl> mmm a / yarn . lock <nl> ppp b / yarn . lock <nl> <nl> resolved " https : / / registry . yarnpkg . com / @ types / eslint - visitor - keys / - / eslint - visitor - keys - 1 . 0 . 0 . tgz # 1ee30d79544ca84d68d4b3cdb0af4f205663dd2d " <nl> integrity sha512 - OCutwjDZ4aFS6PB1UZ988C4YgwlBHJd6wCeQqaLdmadZ / 7e + w79 + hbMUFC1QXDNCmdyoRfAFdm0RypzwR + Qpag = = <nl> <nl> + " @ types / events @ * " : <nl> + version " 3 . 0 . 0 " <nl> + resolved " https : / / registry . yarnpkg . com / @ types / events / - / events - 3 . 0 . 0 . tgz # 2862f3f58a9a7f7c3e78d79f130dd4d71c25c2a7 " <nl> + integrity sha512 - EaObqwIvayI5a8dCzhFrjKzVwKLxjoG9T6Ppd5CEo07LRKfQ8Yokw54r5 + Wq7FaBQ + yXRvQAYPrHwya1 / UFt9g = = <nl> + <nl> " @ types / express - serve - static - core @ * " : <nl> version " 4 . 17 . 2 " <nl> resolved " https : / / registry . yarnpkg . com / @ types / express - serve - static - core / - / express - serve - static - core - 4 . 17 . 2 . tgz # f6f41fa35d42e79dbf6610eccbb2637e6008a0cf " <nl> <nl> dependencies : <nl> " @ types / node " " * " <nl> <nl> + " @ types / glob @ ^ 7 . 1 . 1 " : <nl> + version " 7 . 1 . 1 " <nl> + resolved " https : / / registry . yarnpkg . com / @ types / glob / - / glob - 7 . 1 . 1 . tgz # aa59a1c6e3fbc421e07ccd31a944c30eba521575 " <nl> + integrity sha512 - 1Bh06cbWJUHMC97acuD6UMG29nMt0Aqz1vF3guLfG + kHHJhy3AyohZFFxYk2f7Q1SQIrNwvncxAE0N / 9s70F2w = = <nl> + dependencies : <nl> + " @ types / events " " * " <nl> + " @ types / minimatch " " * " <nl> + " @ types / node " " * " <nl> + <nl> " @ types / json - schema @ ^ 7 . 0 . 3 " : <nl> version " 7 . 0 . 3 " <nl> resolved " https : / / registry . yarnpkg . com / @ types / json - schema / - / json - schema - 7 . 0 . 3 . tgz # bdfd69d61e464dcc81b25159c270d75a73c1a636 " <nl> <nl> resolved " https : / / registry . yarnpkg . com / @ types / mime / - / mime - 2 . 0 . 1 . tgz # dc488842312a7f075149312905b5e3c0b054c79d " <nl> integrity sha512 - FwI9gX75FgVBJ7ywgnq / P7tw + / o1GUbtP0KzbtusLigAOgIgNISRK0ZPl4qertvXSIE8YbsVJueQ90cDt9YYyw = = <nl> <nl> + " @ types / minimatch @ * " : <nl> + version " 3 . 0 . 3 " <nl> + resolved " https : / / registry . yarnpkg . com / @ types / minimatch / - / minimatch - 3 . 0 . 3 . tgz # 3dca0e3f33b200fc7d1139c0cd96c1268cadfd9d " <nl> + integrity sha512 - tHq6qdbT9U1IRSGf14CL0pUlULksvY9OZ + 5eEgl1N7t + OA3tGvNpxJCzuKQlsNgCVwbAs670L1vcVQi8j9HjnA = = <nl> + <nl> " @ types / mocha @ ^ 7 . 0 . 2 " : <nl> version " 7 . 0 . 2 " <nl> resolved " https : / / registry . yarnpkg . com / @ types / mocha / - / mocha - 7 . 0 . 2 . tgz # b17f16cf933597e10d6d78eae3251e692ce8b0ce " <nl> arrify @ ^ 1 . 0 . 0 , arrify @ ^ 1 . 0 . 1 : <nl> resolved " https : / / registry . yarnpkg . com / arrify / - / arrify - 1 . 0 . 1 . tgz # 898508da2226f380df904728456849c1501a4b0d " <nl> integrity sha1 - iYUI2iIm84DfkEcoRWhJwVAaSw0 = <nl> <nl> - asar @ ^ 1 . 0 . 0 : <nl> - version " 1 . 0 . 0 " <nl> - resolved " https : / / registry . yarnpkg . com / asar / - / asar - 1 . 0 . 0 . tgz # 5624ffa1369aa929871dfc036de02c20871bdc2e " <nl> - integrity sha512 - MBiDU5cDr9UWuY2F0zq2fZlnyRq1aOPmJGMas22Qa14K1odpRXL3xkMHPN3uw2hAK5mD89Q + / KidOUtpi4V0Cg = = <nl> + asar @ ^ 3 . 0 . 1 : <nl> + version " 3 . 0 . 1 " <nl> + resolved " https : / / registry . yarnpkg . com / asar / - / asar - 3 . 0 . 1 . tgz # fbf352cba5b833efbdebbf7118440e5b492c01c5 " <nl> + integrity sha512 - 43sVUKSX0VLNfavair0OLzPoVX5rRdqAxcUUhtwKLGkKQPs2ePreOG7zpp3gZOLvZGhZxixD9JZBxWKgqH8r1g = = <nl> dependencies : <nl> chromium - pickle - js " ^ 0 . 2 . 0 " <nl> - commander " ^ 2 . 19 . 0 " <nl> - cuint " ^ 0 . 2 . 2 " <nl> - glob " ^ 7 . 1 . 3 " <nl> + commander " ^ 4 . 1 . 1 " <nl> + glob " ^ 7 . 1 . 6 " <nl> minimatch " ^ 3 . 0 . 4 " <nl> - mkdirp " ^ 0 . 5 . 1 " <nl> - pify " ^ 4 . 0 . 1 " <nl> - tmp - promise " ^ 1 . 0 . 5 " <nl> + optionalDependencies : <nl> + " @ types / glob " " ^ 7 . 1 . 1 " <nl> <nl> asn1 . js @ ^ 4 . 0 . 0 : <nl> version " 4 . 10 . 1 " <nl> bl @ ^ 1 . 0 . 0 : <nl> readable - stream " ^ 2 . 3 . 5 " <nl> safe - buffer " ^ 5 . 1 . 1 " <nl> <nl> - bluebird @ ^ 3 . 5 . 0 , bluebird @ ^ 3 . 5 . 5 : <nl> + bluebird @ ^ 3 . 5 . 5 : <nl> version " 3 . 5 . 5 " <nl> resolved " https : / / registry . yarnpkg . com / bluebird / - / bluebird - 3 . 5 . 5 . tgz # a8d0afd73251effbbd5fe384a77d73003c17a71f " <nl> integrity sha512 - 5am6HnnfN + urzt4yfg7IgTbotDjIT / u8AJpEt0sIU9FtXfVeezXAPKswrG + xKUCOYAINpSdgZVDU6QFh + cuH3w = = <nl> combined - stream @ ^ 1 . 0 . 6 , combined - stream @ ~ 1 . 0 . 6 : <nl> dependencies : <nl> delayed - stream " ~ 1 . 0 . 0 " <nl> <nl> - commander @ ^ 2 . 14 . 1 , commander @ ^ 2 . 18 . 0 , commander @ ^ 2 . 19 . 0 , commander @ ^ 2 . 20 . 0 , commander @ ^ 2 . 9 . 0 : <nl> + commander @ ^ 2 . 14 . 1 , commander @ ^ 2 . 18 . 0 , commander @ ^ 2 . 20 . 0 , commander @ ^ 2 . 9 . 0 : <nl> version " 2 . 20 . 0 " <nl> resolved " https : / / registry . yarnpkg . com / commander / - / commander - 2 . 20 . 0 . tgz # d58bb2b5c1ee8f87b0d340027e9e94e222c5a422 " <nl> integrity sha512 - 7j2y + 40w61zy6YC2iRNpUe / NwhNyoXrYpHMrSunaMG64nRnaf96zO / KMQR4OyN / UnE5KLyEBnKHd4aG3rskjpQ = = <nl> <nl> + commander @ ^ 4 . 1 . 1 : <nl> + version " 4 . 1 . 1 " <nl> + resolved " https : / / registry . yarnpkg . com / commander / - / commander - 4 . 1 . 1 . tgz # 9fd602bd936294e9e9ef46a3f4d6964044b18068 " <nl> + integrity sha512 - NOKm8xhkzAjzFx8B2v5OAHT + u5pRQc2UCa2Vq9jYL / 31o2wi9mxBA7LIFs3sV5VSC49z6pEhfbMULvShKj26WA = = <nl> + <nl> commondir @ ^ 1 . 0 . 1 : <nl> version " 1 . 0 . 1 " <nl> resolved " https : / / registry . yarnpkg . com / commondir / - / commondir - 1 . 0 . 1 . tgz # ddd800da0c66127393cca5950ea968a3aaf1253b " <nl> crypto - browserify @ ^ 3 . 11 . 0 : <nl> randombytes " ^ 2 . 0 . 0 " <nl> randomfill " ^ 1 . 0 . 3 " <nl> <nl> - cuint @ ^ 0 . 2 . 2 : <nl> - version " 0 . 2 . 2 " <nl> - resolved " https : / / registry . yarnpkg . com / cuint / - / cuint - 0 . 2 . 2 . tgz # 408086d409550c2631155619e9fa7bcadc3b991b " <nl> - integrity sha1 - QICG1AlVDCYxFVYZ6fp7ytw7mRs = <nl> - <nl> currently - unhandled @ ^ 0 . 4 . 1 : <nl> version " 0 . 4 . 1 " <nl> resolved " https : / / registry . yarnpkg . com / currently - unhandled / - / currently - unhandled - 0 . 4 . 1 . tgz # 988df33feab191ef799a61369dd76c17adf957ea " <nl> timers - browserify @ ^ 2 . 0 . 4 : <nl> dependencies : <nl> setimmediate " ^ 1 . 0 . 4 " <nl> <nl> - tmp - promise @ ^ 1 . 0 . 5 : <nl> - version " 1 . 1 . 0 " <nl> - resolved " https : / / registry . yarnpkg . com / tmp - promise / - / tmp - promise - 1 . 1 . 0 . tgz # bb924d239029157b9bc1d506a6aa341f8b13e64c " <nl> - integrity sha512 - 8 + Ah9aB1IRXCnIOxXZ0uFozV1nMU5xiu7hhFVUSxZ3bYu + psD4TzagCzVbexUCgNNGJnsmNDQlS4nG3mTyoNkw = = <nl> - dependencies : <nl> - bluebird " ^ 3 . 5 . 0 " <nl> - tmp " 0 . 1 . 0 " <nl> - <nl> - tmp @ 0 . 1 . 0 : <nl> - version " 0 . 1 . 0 " <nl> - resolved " https : / / registry . yarnpkg . com / tmp / - / tmp - 0 . 1 . 0 . tgz # ee434a4e22543082e294ba6201dcc6eafefa2877 " <nl> - integrity sha512 - J7Z2K08jbGcdA1kkQpJSqLF6T0tdQqpR2pnSUXsIchbPdTI9v3e85cLW0d6WDhwuAleOV71j2xWs8qMPfK7nKw = = <nl> - dependencies : <nl> - rimraf " ^ 2 . 6 . 3 " <nl> - <nl> tmp @ ^ 0 . 0 . 33 : <nl> version " 0 . 0 . 33 " <nl> resolved " https : / / registry . yarnpkg . com / tmp / - / tmp - 0 . 0 . 33 . tgz # 6d34335889768d21b2bcda0aa277ced3b1bfadf9 " <nl>
build : upgrade asar to a version that requires Node 10 ( )
electron/electron
8ff7a1160a4060c20b36add34807fd4094886b83
2020-03-27T00:52:53Z
mmm a / include / mxnet / base . h <nl> ppp b / include / mxnet / base . h <nl> typedef mshadow : : TBlob TBlob ; <nl> namespace dmlc { <nl> / / Add a few patches to support TShape in dmlc / parameter . <nl> DMLC_DECLARE_TYPE_NAME ( mxnet : : TShape , " Shape ( tuple ) " ) ; <nl> + DMLC_DECLARE_TYPE_NAME ( uint32_t , " unsigned int " ) ; <nl> + <nl> <nl> namespace parameter { <nl> template < > <nl> mmm a / src / operator / convolution - inl . h <nl> ppp b / src / operator / convolution - inl . h <nl> class ConvolutionOp : public Operator { <nl> / / TODO ( bing ) : make mshadow support dual stride <nl> } <nl> const index_t gstride = temp_col_ . size ( 0 ) / param_ . nb_group ; <nl> - for ( int gid = 0 ; gid < param_ . nb_group ; + + gid ) { <nl> + for ( uint32_t gid = 0 ; gid < param_ . nb_group ; + + gid ) { <nl> mshadow : : Tensor < xpu , 2 > tmpc = temp_col_ . Slice ( gstride * gid , <nl> gstride * ( gid + 1 ) ) ; <nl> temp_dst_ [ gid ] = dot ( wmat [ gid ] , tmpc ) ; <nl> class ConvolutionOp : public Operator { <nl> const index_t nbatch = data . size ( 0 ) ; <nl> for ( index_t i = 0 ; i < nbatch ; i + = param_ . nstep ) { <nl> const index_t step = std : : min ( param_ . nstep , nbatch - i ) ; <nl> - temp_col_ . Resize ( mshadow : : Shape2 ( shape_colunit_ [ 0 ] , <nl> + temp_col_ . Resize ( Shape2 ( shape_colunit_ [ 0 ] , <nl> shape_colunit_ [ 1 ] * step ) ) ; <nl> - temp_dst_ . Resize ( mshadow : : Shape3 ( shape_dstunit_ [ 0 ] , <nl> + temp_dst_ . Resize ( Shape3 ( shape_dstunit_ [ 0 ] , <nl> shape_dstunit_ [ 1 ] , shape_dstunit_ [ 2 ] * step ) ) ; <nl> temp_dst_ = reshape ( swapaxis < 1 , 0 > ( grad . Slice ( i , i + step ) ) , temp_dst_ . shape_ ) ; <nl> if ( param_ . pad [ 0 ] = = 0 & & param_ . pad [ 1 ] = = 0 ) { <nl> class ConvolutionOp : public Operator { <nl> param_ . stride [ 0 ] ) ; <nl> } <nl> const index_t gstride = temp_col_ . size ( 0 ) / param_ . nb_group ; <nl> - for ( int gid = 0 ; gid < param_ . nb_group ; + + gid ) { <nl> - mshadow : : Tensor < xpu , 2 > tmpc = temp_col_ . Slice ( gstride * gid , gstride * ( gid + 1 ) ) ; <nl> - gwmat [ gid ] + = dot ( temp_dst_ [ gid ] , tmpc . T ( ) ) ; <nl> + for ( uint32_t gid = 0 ; gid < param_ . nb_group ; + + gid ) { <nl> + Tensor < xpu , 2 > tmpc = temp_col_ . Slice ( gstride * gid , gstride * ( gid + 1 ) ) ; <nl> + if ( i = = 0 ) { <nl> + Tensor < xpu , 2 > tmp_gwmat = gwmat [ gid ] ; <nl> + Assign ( tmp_gwmat , req [ kWeight ] , dot ( temp_dst_ [ gid ] , tmpc . T ( ) ) ) ; <nl> + } else { <nl> + gwmat [ gid ] + = dot ( temp_dst_ [ gid ] , tmpc . T ( ) ) ; <nl> + } <nl> } <nl> if ( req [ kData ] = = kWriteTo ) { <nl> - for ( int gid = 0 ; gid < param_ . nb_group ; + + gid ) { <nl> - mshadow : : Tensor < xpu , 2 > tmpc = temp_col_ . Slice ( gstride * gid , gstride * ( gid + 1 ) ) ; <nl> + for ( uint32_t gid = 0 ; gid < param_ . nb_group ; + + gid ) { <nl> + Tensor < xpu , 2 > tmpc = temp_col_ . Slice ( gstride * gid , gstride * ( gid + 1 ) ) ; <nl> tmpc = dot ( wmat [ gid ] . T ( ) , temp_dst_ [ gid ] ) ; <nl> } <nl> if ( param_ . pad [ 0 ] = = 0 & & param_ . pad [ 1 ] = = 0 ) { <nl> class ConvolutionOp : public Operator { <nl> param_ . kernel [ 1 ] , <nl> param_ . stride [ 0 ] ) ; <nl> } else { <nl> - mshadow : : Shape < 4 > pshape = data . Slice ( i , i + step ) . shape_ ; <nl> + Shape < 4 > pshape = data . Slice ( i , i + step ) . shape_ ; <nl> pshape [ 2 ] + = 2 * param_ . pad [ 0 ] ; <nl> pshape [ 3 ] + = 2 * param_ . pad [ 1 ] ; <nl> gdata . Slice ( i , i + step ) = crop ( pack_col2patch ( temp_col_ , <nl> class ConvolutionOp : public Operator { <nl> } <nl> if ( ! param_ . no_bias ) { <nl> Tensor < xpu , 1 > gbias = in_grad [ kBias ] . get < xpu , 1 , real_t > ( s ) ; <nl> - / / Assign ( gbias , req [ kBias ] , sumall_except_dim < 1 > ( grad ) ; <nl> - gbias + = sumall_except_dim < 1 > ( grad ) ; <nl> + Assign ( gbias , req [ kBias ] , sumall_except_dim < 1 > ( grad ) ) ; <nl> } <nl> } <nl> <nl> mmm a / src / operator / pooling - inl . h <nl> ppp b / src / operator / pooling - inl . h <nl> class PoolingOp : public Operator { <nl> const std : : vector < TBlob > & out_data ) { <nl> using namespace mshadow ; <nl> using namespace mshadow : : expr ; <nl> - CHECK_EQ ( req [ kOut ] , kWriteTo ) ; <nl> CHECK_EQ ( in_data . size ( ) , 1 ) ; <nl> CHECK_EQ ( out_data . size ( ) , 1 ) ; <nl> Stream < xpu > * s = ctx . get_stream < xpu > ( ) ; <nl> class PoolingOp : public Operator { <nl> mshadow : : Shape < 2 > out_shape = Shape2 ( out . shape_ [ 2 ] , out . shape_ [ 3 ] ) ; <nl> / / TODO ( bing ) : dual stride in mshadow <nl> if ( param_ . pool_type = = kMaxPooling | | param_ . pool_type = = kSumPooling ) { <nl> - out = pool < Reducer > ( pad ( data , param_ . pad [ 0 ] , param_ . pad [ 1 ] ) , <nl> + Assign ( out , <nl> + req [ kOut ] , <nl> + pool < Reducer > ( pad ( data , param_ . pad [ 0 ] , param_ . pad [ 1 ] ) , <nl> out_shape , <nl> param_ . kernel [ 0 ] , <nl> param_ . kernel [ 1 ] , <nl> - param_ . kernel [ 0 ] ) ; <nl> + param_ . kernel [ 0 ] ) ) ; <nl> } else if ( param_ . pool_type = = kAvgPooling ) { <nl> - out = ( 1 . 0f / ( param_ . kernel [ 0 ] * param_ . kernel [ 1 ] ) ) * \ <nl> - pool < Reducer > ( pad ( data , param_ . pad [ 0 ] , param_ . pad [ 1 ] ) , <nl> + Assign ( out , <nl> + req [ kOut ] , <nl> + ( 1 . 0f / ( param_ . kernel [ 0 ] * param_ . kernel [ 1 ] ) ) * \ <nl> + pool < Reducer > ( pad ( data , param_ . pad [ 0 ] , param_ . pad [ 1 ] ) , <nl> out_shape , <nl> param_ . kernel [ 0 ] , <nl> param_ . kernel [ 1 ] , <nl> - param_ . kernel [ 0 ] ) ; <nl> + param_ . kernel [ 0 ] ) ) ; <nl> } <nl> } <nl> <nl> mmm a / src / operator / reshape . cc <nl> ppp b / src / operator / reshape . cc <nl> MXNET_REGISTER_OP_PROPERTY ( Reshape , ReshapeProp ) <nl> <nl> MXNET_REGISTER_OP_PROPERTY ( Flatten , FlattenProp ) <nl> . add_argument ( " data " , " Symbol " , " Input data to flatten . " ) <nl> + . add_arguments ( ReshapeParam : : __FIELDS__ ( ) ) <nl> . describe ( " Flatten input " ) ; <nl> } / / namespace op <nl> } / / namespace mxnet <nl> mmm a / src / operator / softmax - inl . h <nl> ppp b / src / operator / softmax - inl . h <nl> class SoftmaxOp : public Operator { <nl> Stream < xpu > * s = ctx . get_stream < xpu > ( ) ; <nl> Tensor < xpu , 2 > data = in_data [ kData ] . FlatTo2D < xpu , real_t > ( s ) ; <nl> Tensor < xpu , 2 > out = out_data [ kOut ] . FlatTo2D < xpu , real_t > ( s ) ; <nl> - Softmax ( data , out ) ; <nl> + Softmax ( out , data ) ; <nl> } <nl> <nl> virtual void Backward ( const OpContext & ctx , <nl> similarity index 55 % <nl> rename from python / test_mnist . py <nl> rename to tests / python / test_conv . py <nl> mmm a / python / test_mnist . py <nl> ppp b / tests / python / test_conv . py <nl> <nl> # pylint : skip - file <nl> import mxnet as mx <nl> import numpy as np <nl> - import os , cPickle , gzip <nl> + import os , pickle , gzip <nl> + import sys <nl> + <nl> <nl> def CalAcc ( out , label ) : <nl> pred = np . argmax ( out , axis = 1 ) <nl> return np . sum ( pred = = label ) * 1 . 0 / out . shape [ 0 ] <nl> <nl> + def IgnorePython3 ( ) : <nl> + if sys . version_info [ 0 ] > = 3 : <nl> + # TODO ( tianjun ) : use IO instead of pickle <nl> + # Python3 pickle is not able to load data correctly <nl> + sys . exit ( 0 ) <nl> + <nl> <nl> # load data <nl> class MNISTIter ( object ) : <nl> def __init__ ( self , which_set , batch_size = 100 , flatten = True ) : <nl> if not os . path . exists ( ' mnist . pkl . gz ' ) : <nl> os . system ( " wget http : / / deeplearning . net / data / mnist / mnist . pkl . gz " ) <nl> f = gzip . open ( ' mnist . pkl . gz ' , ' rb ' ) <nl> - train_set , valid_set , test_set = cPickle . load ( f ) <nl> + IgnorePython3 ( ) <nl> + train_set , valid_set , test_set = pickle . load ( f ) <nl> f . close ( ) <nl> if which_set = = ' train ' : <nl> self . data = train_set [ 0 ] <nl> def Get ( self ) : <nl> # symbol net <nl> batch_size = 100 <nl> data = mx . symbol . Variable ( ' data ' ) <nl> - fc1 = mx . symbol . Convolution ( data = data , name = ' conv1 ' , nb_filter = 32 , kernel = ( 7 , 7 ) , stride = ( 2 , 2 ) , nstep = 10 , no_bias = 1 ) <nl> - act1 = mx . symbol . Activation ( data = fc1 , name = ' relu1 ' , act_type = " relu " ) <nl> - mp = mx . symbol . Pooling ( data = act1 , name = ' mp ' , kernel = ( 2 , 2 ) , stride = ( 2 , 2 ) , pool_type = ' avg ' ) <nl> - fl = mx . symbol . Flatten ( data = mp , name = " flatten " ) <nl> + conv1 = mx . symbol . Convolution ( data = data , name = ' conv1 ' , nb_filter = 32 , kernel = ( 3 , 3 ) , stride = ( 1 , 1 ) , nstep = 10 ) <nl> + act1 = mx . symbol . Activation ( data = conv1 , name = ' relu1 ' , act_type = " relu " ) <nl> + mp1 = mx . symbol . Pooling ( data = act1 , name = ' mp1 ' , kernel = ( 2 , 2 ) , stride = ( 2 , 2 ) , pool_type = ' max ' ) <nl> + <nl> + conv2 = mx . symbol . Convolution ( data = mp1 , name = ' conv2 ' , nb_filter = 32 , kernel = ( 3 , 3 ) , stride = ( 1 , 1 ) , nstep = 10 ) <nl> + act2 = mx . symbol . Activation ( data = conv2 , name = ' relu2 ' , act_type = " relu " ) <nl> + mp2 = mx . symbol . Pooling ( data = act2 , name = ' mp2 ' , kernel = ( 2 , 2 ) , stride = ( 2 , 2 ) , pool_type = ' max ' ) <nl> + <nl> + <nl> + fl = mx . symbol . Flatten ( data = mp2 , name = " flatten " ) <nl> fc2 = mx . symbol . FullyConnected ( data = fl , name = ' fc2 ' , num_hidden = 10 ) <nl> softmax = mx . symbol . Softmax ( data = fc2 , name = ' sm ' ) <nl> args_list = softmax . list_arguments ( ) <nl> def Get ( self ) : <nl> arg_shapes , out_shapes = softmax . infer_shape ( data = data_shape ) <nl> arg_narrays = [ mx . narray . create ( shape ) for shape in arg_shapes ] <nl> grad_narrays = [ mx . narray . create ( shape ) for shape in arg_shapes ] <nl> - mom_narrays = [ mx . narray . create ( shape ) for shape in arg_shapes ] <nl> inputs = dict ( zip ( args_list , arg_narrays ) ) <nl> - print zip ( args_list , arg_shapes ) <nl> np . random . seed ( 0 ) <nl> # set random weight <nl> for name , narray in inputs . items ( ) : <nl> if " weight " in name : <nl> - narray . numpy [ : , : ] = np . random . uniform ( - 0 . 001 , 0 . 001 , narray . numpy . shape ) <nl> + narray . numpy [ : , : ] = np . random . uniform ( - 0 . 07 , 0 . 07 , narray . numpy . shape ) <nl> if " bias " in name : <nl> narray . numpy [ : ] = 0 . 0 <nl> <nl> def Get ( self ) : <nl> out_narray = executor . heads ( ) [ 0 ] <nl> grad_narray = mx . narray . create ( out_narray . shape ) <nl> <nl> - epoch = 10 <nl> + epoch = 1 <nl> momentum = 0 . 9 <nl> - lr = 0 . 001 <nl> + lr = 0 . 1 <nl> wd = 0 . 0004 <nl> <nl> - def Update ( mom , grad , weight ) : <nl> - weight . numpy [ : ] - = lr * grad . numpy [ : ] <nl> + def Update ( grad , weight ) : <nl> + weight . numpy [ : ] - = lr * grad . numpy [ : ] / batch_size <nl> <nl> - block = zip ( mom_narrays , grad_narrays , arg_narrays ) <nl> + block = zip ( grad_narrays , arg_narrays ) <nl> <nl> <nl> train = MNISTIter ( " train " , batch_size , False ) <nl> valid = MNISTIter ( " valid " , batch_size , False ) <nl> <nl> - for i in xrange ( epoch ) : <nl> - # train <nl> - print " Epoch % d " % i <nl> - train_acc = 0 . 0 <nl> - val_acc = 0 . 0 <nl> - while train . Next ( ) : <nl> - data , label = train . Get ( ) <nl> - inputs [ " data " ] . numpy [ : ] = data <nl> - inputs [ " sm_label " ] . numpy [ : ] = label <nl> - executor . forward ( ) <nl> - train_acc + = CalAcc ( out_narray . numpy , label ) <nl> - grad_narray . numpy [ : ] = out_narray . numpy <nl> - executor . backward ( [ grad_narray ] ) <nl> - <nl> - for mom , grad , weight in block : <nl> - Update ( mom , grad , weight ) <nl> - <nl> - # evaluate <nl> - while valid . Next ( ) : <nl> - data , label = valid . Get ( ) <nl> - inputs [ " data " ] . numpy [ : ] = data <nl> - executor . forward ( ) <nl> - val_acc + = CalAcc ( out_narray . numpy , label ) <nl> - print " Train Acc : " , train_acc / train . nbatch <nl> - print " Valid Acc : " , val_acc / valid . nbatch <nl> - train . BeforeFirst ( ) <nl> - valid . BeforeFirst ( ) <nl> - <nl> - <nl> + def test_mnist ( ) : <nl> + acc_train = 0 . 0 <nl> + acc_val = 0 . 0 <nl> + for i in xrange ( epoch ) : <nl> + # train <nl> + print ( " Epoch % d " % i ) <nl> + train_acc = 0 . 0 <nl> + val_acc = 0 . 0 <nl> + while train . Next ( ) : <nl> + data , label = train . Get ( ) <nl> + inputs [ " data " ] . numpy [ : ] = data <nl> + inputs [ " sm_label " ] . numpy [ : ] = label <nl> + executor . forward ( ) <nl> + train_acc + = CalAcc ( out_narray . numpy , label ) <nl> + grad_narray . numpy [ : ] = out_narray . numpy <nl> + executor . backward ( [ grad_narray ] ) <nl> + <nl> + for grad , weight in block : <nl> + Update ( grad , weight ) <nl> + <nl> + # evaluate <nl> + while valid . Next ( ) : <nl> + data , label = valid . Get ( ) <nl> + inputs [ " data " ] . numpy [ : ] = data <nl> + executor . forward ( ) <nl> + val_acc + = CalAcc ( out_narray . numpy , label ) <nl> + print ( " Train Acc : " , train_acc / train . nbatch ) <nl> + print ( " Valid Acc : " , val_acc / valid . nbatch ) <nl> + acc_train = train_acc / train . nbatch <nl> + acc_val = val_acc / valid . nbatch <nl> + train . BeforeFirst ( ) <nl> + valid . BeforeFirst ( ) <nl> + assert ( acc_train > 0 . 84 ) <nl> + assert ( acc_val > 0 . 96 ) <nl> <nl> new file mode 100644 <nl> index 00000000000 . . 4770c19b913 <nl> mmm / dev / null <nl> ppp b / tests / python / test_mlp . py <nl> <nl> + # pylint : skip - file <nl> + import mxnet as mx <nl> + import numpy as np <nl> + import os , gzip <nl> + import pickle as pickle <nl> + import sys <nl> + def CalAcc ( out , label ) : <nl> + pred = np . argmax ( out , axis = 1 ) <nl> + return np . sum ( pred = = label ) * 1 . 0 / out . shape [ 0 ] <nl> + <nl> + def IgnorePython3 ( ) : <nl> + if sys . version_info [ 0 ] > = 3 : <nl> + # TODO ( tianjun ) : use IO instead of pickle <nl> + # Python3 pickle is not able to load data correctly <nl> + sys . exit ( 0 ) <nl> + <nl> + <nl> + # load data <nl> + class MNISTIter ( object ) : <nl> + def __init__ ( self , which_set , batch_size = 100 , flatten = True ) : <nl> + if not os . path . exists ( ' mnist . pkl . gz ' ) : <nl> + os . system ( " wget http : / / deeplearning . net / data / mnist / mnist . pkl . gz " ) <nl> + f = gzip . open ( ' mnist . pkl . gz ' , ' rb ' ) <nl> + IgnorePython3 ( ) <nl> + train_set , valid_set , test_set = pickle . load ( f ) <nl> + f . close ( ) <nl> + if which_set = = ' train ' : <nl> + self . data = train_set [ 0 ] <nl> + self . label = np . asarray ( train_set [ 1 ] ) <nl> + elif which_set = = ' valid ' : <nl> + self . data = valid_set [ 0 ] <nl> + self . label = np . asarray ( valid_set [ 1 ] ) <nl> + else : <nl> + self . data = test_set [ 0 ] <nl> + self . data = np . asarray ( test_set [ 1 ] ) <nl> + self . flatten = flatten <nl> + self . batch_size = batch_size <nl> + self . nbatch = self . data . shape [ 0 ] / batch_size <nl> + assert ( self . data . shape [ 0 ] % batch_size = = 0 ) # I am lazy <nl> + self . now_idx = - 1 <nl> + def BeforeFirst ( self ) : <nl> + self . now_idx = - 1 <nl> + def Next ( self ) : <nl> + self . now_idx + = 1 <nl> + if self . now_idx = = self . nbatch : <nl> + return False <nl> + return True <nl> + def Get ( self ) : <nl> + if self . now_idx < 0 : <nl> + raise Exception ( " Iterator is at head " ) <nl> + elif self . now_idx > = self . nbatch : <nl> + raise Exception ( " Iterator is at end " ) <nl> + start = self . now_idx * self . batch_size <nl> + end = ( self . now_idx + 1 ) * self . batch_size <nl> + if self . flatten : <nl> + return ( self . data [ start : end , : ] , self . label [ start : end ] ) <nl> + else : <nl> + return ( self . data [ start : end , : ] . reshape ( batch_size , 1 , 28 , 28 ) , <nl> + self . label [ start : end ] ) <nl> + <nl> + <nl> + # symbol net <nl> + batch_size = 100 <nl> + data = mx . symbol . Variable ( ' data ' ) <nl> + fc1 = mx . symbol . FullyConnected ( data = data , name = ' fc1 ' , num_hidden = 128 ) <nl> + act1 = mx . symbol . Activation ( data = fc1 , name = ' relu1 ' , act_type = " relu " ) <nl> + fc2 = mx . symbol . FullyConnected ( data = act1 , name = ' fc2 ' , num_hidden = 64 ) <nl> + act2 = mx . symbol . Activation ( data = fc2 , name = ' relu2 ' , act_type = " relu " ) <nl> + fc3 = mx . symbol . FullyConnected ( data = act2 , name = ' fc3 ' , num_hidden = 10 ) <nl> + softmax = mx . symbol . Softmax ( data = fc3 , name = ' sm ' ) <nl> + args_list = softmax . list_arguments ( ) <nl> + # infer shape <nl> + data_shape = ( batch_size , 784 ) <nl> + arg_shapes , out_shapes = softmax . infer_shape ( data = data_shape ) <nl> + arg_narrays = [ mx . narray . create ( shape ) for shape in arg_shapes ] <nl> + grad_narrays = [ mx . narray . create ( shape ) for shape in arg_shapes ] <nl> + inputs = dict ( zip ( args_list , arg_narrays ) ) <nl> + np . random . seed ( 0 ) <nl> + # set random weight <nl> + for name , narray in inputs . items ( ) : <nl> + if " weight " in name : <nl> + narray . numpy [ : , : ] = np . random . uniform ( - 0 . 07 , 0 . 07 , narray . numpy . shape ) <nl> + if " bias " in name : <nl> + narray . numpy [ : ] = 0 . 0 <nl> + <nl> + req = [ ' write_to ' for i in range ( len ( arg_narrays ) ) ] <nl> + # bind executer <nl> + # TODO ( bing ) : think of a better bind interface <nl> + executor = softmax . bind ( mx . Context ( ' cpu ' ) , arg_narrays , grad_narrays , req ) <nl> + # update <nl> + <nl> + out_narray = executor . heads ( ) [ 0 ] <nl> + grad_narray = mx . narray . create ( out_narray . shape ) <nl> + <nl> + epoch = 9 <nl> + lr = 0 . 1 <nl> + wd = 0 . 0004 <nl> + def Update ( grad , weight ) : <nl> + weight . numpy [ : ] - = lr * grad . numpy [ : ] / batch_size <nl> + <nl> + block = zip ( grad_narrays , arg_narrays ) <nl> + <nl> + <nl> + <nl> + train = MNISTIter ( " train " , batch_size , True ) <nl> + valid = MNISTIter ( " valid " , batch_size , True ) <nl> + <nl> + def test_mlp ( ) : <nl> + acc_train = 0 . <nl> + acc_val = 0 . <nl> + for i in range ( epoch ) : <nl> + # train <nl> + print ( " Epoch % d " % i ) <nl> + train_acc = 0 . 0 <nl> + val_acc = 0 . 0 <nl> + while train . Next ( ) : <nl> + data , label = train . Get ( ) <nl> + inputs [ " data " ] . numpy [ : ] = data <nl> + inputs [ " sm_label " ] . numpy [ : ] = label <nl> + executor . forward ( ) <nl> + train_acc + = CalAcc ( out_narray . numpy , label ) <nl> + grad_narray . numpy [ : ] = out_narray . numpy <nl> + executor . backward ( [ grad_narray ] ) <nl> + <nl> + for grad , weight in block : <nl> + Update ( grad , weight ) <nl> + <nl> + # evaluate <nl> + while valid . Next ( ) : <nl> + data , label = valid . Get ( ) <nl> + inputs [ " data " ] . numpy [ : ] = data <nl> + executor . forward ( ) <nl> + val_acc + = CalAcc ( out_narray . numpy , label ) <nl> + acc_train = train_acc / train . nbatch <nl> + acc_val = val_acc / valid . nbatch <nl> + print ( " Train Acc : " , train_acc / train . nbatch ) <nl> + print ( " Valid Acc : " , val_acc / valid . nbatch ) <nl> + train . BeforeFirst ( ) <nl> + valid . BeforeFirst ( ) <nl> + assert ( acc_train > 0 . 98 ) <nl> + assert ( acc_val > 0 . 97 ) <nl> + <nl>
[ simple - engine ] Merge branch ' master ' into simple - engine
apache/incubator-mxnet
602a436a97025aa1af7dab7346c9c314893ef9d0
2015-08-28T05:18:30Z
mmm a / src / mongo / db / namespace_details . cpp <nl> ppp b / src / mongo / db / namespace_details . cpp <nl> namespace mongo { <nl> / / adjust for padding factor <nl> int allocationSize = static_cast < int > ( minRecordSize * _paddingFactor ) ; <nl> <nl> + if ( _isCapped ) <nl> + / / pad record size for capped collections , but do not quantize <nl> + return allocationSize ; <nl> + <nl> / / quantize to the nearest 1 / 16th bucketSize <nl> return quantizeAllocationSpace ( allocationSize ) ; <nl> } <nl>
SERVER - 7159 : don ' t quantize capped allocations
mongodb/mongo
f8f684a8a3e727ed5baad22433333963e2817346
2012-11-17T00:32:35Z
mmm a / test / distrib / csharp / DistribTest / DistribTest . csproj <nl> ppp b / test / distrib / csharp / DistribTest / DistribTest . csproj <nl> <nl> < None Include = " packages . config " / > <nl> < / ItemGroup > <nl> < Import Project = " $ ( MSBuildToolsPath ) \ Microsoft . CSharp . targets " / > <nl> - < Import Project = " . . \ packages \ grpc . native . csharp . __GRPC_NUGET_VERSION__ \ build \ portable - net45 + netcore45 + wpa81 + wp8 \ grpc . native . csharp . targets " Condition = " Exists ( ' . . \ packages \ grpc . native . csharp . __GRPC_NUGET_VERSION__ \ build \ portable - net45 + netcore45 + wpa81 + wp8 \ grpc . native . csharp . targets ' ) " / > <nl> + < Import Project = " . . \ packages \ Grpc . Core . __GRPC_NUGET_VERSION__ \ build \ net45 \ Grpc . Core . targets " Condition = " Exists ( ' . . \ packages \ Grpc . Core . __GRPC_NUGET_VERSION__ \ build \ net45 \ Grpc . Core . targets ' ) " / > <nl> < Target Name = " EnsureNuGetPackageBuildImports " BeforeTargets = " PrepareForBuild " > <nl> < PropertyGroup > <nl> < ErrorText > This project references NuGet package ( s ) that are missing on this computer . Enable NuGet Package Restore to download them . For more information , see http : / / go . microsoft . com / fwlink / ? LinkID = 322105 . The missing file is { 0 } . < / ErrorText > <nl> < / PropertyGroup > <nl> - < Error Condition = " ! Exists ( ' . . \ packages \ grpc . native . csharp . __GRPC_NUGET_VERSION__ \ build \ portable - net45 + netcore45 + wpa81 + wp8 \ grpc . native . csharp . targets ' ) " Text = " $ ( [ System . String ] : : Format ( ' $ ( ErrorText ) ' , ' . . \ packages \ grpc . native . csharp . __GRPC_NUGET_VERSION__ \ build \ portable - net45 + netcore45 + wpa81 + wp8 \ grpc . native . csharp . targets ' ) ) " / > <nl> + < Error Condition = " ! Exists ( ' . . \ packages \ Grpc . Core . __GRPC_NUGET_VERSION__ \ build \ net45 \ Grpc . Core . targets ' ) " Text = " $ ( [ System . String ] : : Format ( ' $ ( ErrorText ) ' , ' . . \ packages \ Grpc . Core . __GRPC_NUGET_VERSION__ \ build \ net45 \ Grpc . Core . targets ' ) ) " / > <nl> < Error Condition = " ! Exists ( ' . . \ packages \ Microsoft . Bcl . Build . 1 . 0 . 21 \ build \ Microsoft . Bcl . Build . targets ' ) " Text = " $ ( [ System . String ] : : Format ( ' $ ( ErrorText ) ' , ' . . \ packages \ Microsoft . Bcl . Build . 1 . 0 . 21 \ build \ Microsoft . Bcl . Build . targets ' ) ) " / > <nl> < / Target > <nl> < Import Project = " . . \ packages \ Microsoft . Bcl . Build . 1 . 0 . 21 \ build \ Microsoft . Bcl . Build . targets " Condition = " Exists ( ' . . \ packages \ Microsoft . Bcl . Build . 1 . 0 . 21 \ build \ Microsoft . Bcl . Build . targets ' ) " / > <nl> <nl> < Target Name = " AfterBuild " > <nl> < / Target > <nl> - - > <nl> - < / Project > <nl> \ No newline at end of file <nl> + < / Project > <nl> mmm a / test / distrib / csharp / DistribTest / packages . config <nl> ppp b / test / distrib / csharp / DistribTest / packages . config <nl> <nl> < package id = " Grpc " version = " __GRPC_NUGET_VERSION__ " targetFramework = " net45 " / > <nl> < package id = " Grpc . Auth " version = " __GRPC_NUGET_VERSION__ " targetFramework = " net45 " / > <nl> < package id = " Grpc . Core " version = " __GRPC_NUGET_VERSION__ " targetFramework = " net45 " / > <nl> - < package id = " grpc . native . csharp " version = " __GRPC_NUGET_VERSION__ " targetFramework = " net45 " / > <nl> < package id = " Ix - Async " version = " 1 . 2 . 3 " targetFramework = " net45 " / > <nl> < package id = " Microsoft . Bcl " version = " 1 . 1 . 10 " targetFramework = " net45 " / > <nl> < package id = " Microsoft . Bcl . Async " version = " 1 . 0 . 168 " targetFramework = " net45 " / > <nl> < package id = " Microsoft . Bcl . Build " version = " 1 . 0 . 21 " targetFramework = " net45 " / > <nl> < package id = " Microsoft . Net . Http " version = " 2 . 2 . 29 " targetFramework = " net45 " / > <nl> < package id = " Newtonsoft . Json " version = " 7 . 0 . 1 " targetFramework = " net45 " / > <nl> - < / packages > <nl> \ No newline at end of file <nl> + < / packages > <nl>
Merge pull request from jtattermusch / csharp_fixing_distribtests
grpc/grpc
e8ca2acb38f39b250665cf4920bdcaa6d0d1dc94
2016-05-05T23:12:12Z
new file mode 100644 <nl> index 000000000 . . 728e13a3e <nl> mmm / dev / null <nl> ppp b / src / apps / PreferencesWindow / PreferencesWindow / Assets . xcassets / ic_warning_18pt . imageset / Contents . json <nl> <nl> + { <nl> + " images " : [ <nl> + { <nl> + " idiom " : " universal " , <nl> + " filename " : " ic_warning_18pt . png " , <nl> + " scale " : " 1x " <nl> + } , <nl> + { <nl> + " idiom " : " universal " , <nl> + " filename " : " ic_warning_18pt_2x . png " , <nl> + " scale " : " 2x " <nl> + } , <nl> + { <nl> + " idiom " : " universal " , <nl> + " filename " : " ic_warning_18pt_3x . png " , <nl> + " scale " : " 3x " <nl> + } <nl> + ] , <nl> + " info " : { <nl> + " version " : 1 , <nl> + " author " : " xcode " <nl> + } <nl> + } <nl> \ No newline at end of file <nl> new file mode 100644 <nl> index 000000000 . . 482dc3c31 <nl> Binary files / dev / null and b / src / apps / PreferencesWindow / PreferencesWindow / Assets . xcassets / ic_warning_18pt . imageset / ic_warning_18pt . png differ <nl> new file mode 100644 <nl> index 000000000 . . 4c3d9a497 <nl> Binary files / dev / null and b / src / apps / PreferencesWindow / PreferencesWindow / Assets . xcassets / ic_warning_18pt . imageset / ic_warning_18pt_2x . png differ <nl> new file mode 100644 <nl> index 000000000 . . b69063084 <nl> Binary files / dev / null and b / src / apps / PreferencesWindow / PreferencesWindow / Assets . xcassets / ic_warning_18pt . imageset / ic_warning_18pt_3x . png differ <nl>
add ic_warning_18pt . imageset
pqrs-org/Karabiner-Elements
8c51dff946eb48ef2da85a9732742ea59ddc091b
2018-03-18T06:47:33Z
mmm a / src / platform - linux . cc <nl> ppp b / src / platform - linux . cc <nl> static void ProfilerSignalHandler ( int signal , siginfo_t * info , void * context ) { <nl> sample - > fp = reinterpret_cast < Address > ( mcontext . gregs [ REG_RBP ] ) ; <nl> # elif V8_HOST_ARCH_ARM <nl> / / An undefined macro evaluates to 0 , so this applies to Android ' s Bionic also . <nl> - # if ( __GLIBC__ < 2 | | ( __GLIBC__ = = 2 & & __GLIBC_MINOR__ < = 3 ) ) <nl> + # if ( __GLIBC__ < 2 | | ( __GLIBC__ = = 2 & & __GLIBC_MINOR__ < = 3 ) & & \ <nl> + ! defined ( __UCLIBC__ ) ) <nl> sample - > pc = reinterpret_cast < Address > ( mcontext . gregs [ R15 ] ) ; <nl> sample - > sp = reinterpret_cast < Address > ( mcontext . gregs [ R13 ] ) ; <nl> sample - > fp = reinterpret_cast < Address > ( mcontext . gregs [ R11 ] ) ; <nl> static void ProfilerSignalHandler ( int signal , siginfo_t * info , void * context ) { <nl> sample - > pc = reinterpret_cast < Address > ( mcontext . arm_pc ) ; <nl> sample - > sp = reinterpret_cast < Address > ( mcontext . arm_sp ) ; <nl> sample - > fp = reinterpret_cast < Address > ( mcontext . arm_fp ) ; <nl> - # endif / / ( __GLIBC__ < 2 | | ( __GLIBC__ = = 2 & & __GLIBC_MINOR__ < = 3 ) ) <nl> + # endif / / ( __GLIBC__ < 2 | | ( __GLIBC__ = = 2 & & __GLIBC_MINOR__ < = 3 ) & & <nl> + / / ! defined ( __UCLIBC__ ) ) <nl> # elif V8_HOST_ARCH_MIPS <nl> sample - > pc = reinterpret_cast < Address > ( mcontext . pc ) ; <nl> sample - > sp = reinterpret_cast < Address > ( mcontext . gregs [ 29 ] ) ; <nl>
Fix compilation for ARM / uClibc
v8/v8
8547d08ab6e4f1add8b815bfaa29a24bcd6a9f8a
2012-07-16T12:34:34Z
mmm a / modules / objdetect / include / opencv2 / objdetect / objdetect . hpp <nl> ppp b / modules / objdetect / include / opencv2 / objdetect / objdetect . hpp <nl> class CV_EXPORTS SCascade : public Algorithm <nl> / / Param image is a frame on which detector will be applied . <nl> / / Param rois is a vector of regions of interest . Only the objects that fall into one of the regions will be returned . <nl> / / Param objects is an output array of Detections <nl> - virtual void detect ( const Mat & image , const std : : vector < cv : : Rect > & rois , std : : vector < Detection > & objects ) const ; <nl> + virtual void detect ( InputArray image , InputArray rois , std : : vector < Detection > & objects ) const ; <nl> <nl> private : <nl> + void detectNoRoi ( const Mat & image , std : : vector < Detection > & objects ) const ; <nl> + <nl> struct Filds ; <nl> Filds * filds ; <nl> <nl> mmm a / modules / objdetect / perf / perf_cascadeclassifier . cpp <nl> ppp b / modules / objdetect / perf / perf_cascadeclassifier . cpp <nl> PERF_TEST_P ( detect , SCascade , <nl> ASSERT_TRUE ( fs . isOpened ( ) ) ; <nl> ASSERT_TRUE ( cascade . load ( fs . getFirstTopLevelNode ( ) ) ) ; <nl> <nl> - std : : vector < cv : : Rect > rois ; <nl> std : : vector < detection_t > objectBoxes ; <nl> - cascade . detect ( colored , rois , objectBoxes ) ; <nl> + cascade . detect ( colored , cv : : noArray ( ) , objectBoxes ) ; <nl> <nl> TEST_CYCLE ( ) <nl> { <nl> - cascade . detect ( colored , rois , objectBoxes ) ; <nl> + cascade . detect ( colored , cv : : noArray ( ) , objectBoxes ) ; <nl> } <nl> <nl> vector < Rect > rects ; <nl> mmm a / modules / objdetect / src / softcascade . cpp <nl> ppp b / modules / objdetect / src / softcascade . cpp <nl> bool cv : : SCascade : : load ( const FileNode & fn ) <nl> return filds - > fill ( fn , minScale , maxScale ) ; <nl> } <nl> <nl> - void cv : : SCascade : : detect ( const Mat & image , const std : : vector < cv : : Rect > & / * rois * / , std : : vector < Detection > & objects ) const <nl> + void cv : : SCascade : : detectNoRoi ( const cv : : Mat & image , std : : vector < Detection > & objects ) const <nl> { <nl> - / / only color images are supperted <nl> - CV_Assert ( image . type ( ) = = CV_8UC3 ) ; <nl> - <nl> Filds & fld = * filds ; <nl> - fld . calcLevels ( image . size ( ) , scales ) ; <nl> - <nl> - objects . clear ( ) ; <nl> - <nl> / / create integrals <nl> ChannelStorage storage ( image , fld . shrinkage ) ; <nl> <nl> void cv : : SCascade : : detect ( const Mat & image , const std : : vector < cv : : Rect > & / * rois * <nl> } <nl> } <nl> } <nl> + } <nl> + <nl> + void cv : : SCascade : : detect ( cv : : InputArray _image , cv : : InputArray _rois , std : : vector < Detection > & objects ) const <nl> + { <nl> + / / only color images are supperted <nl> + cv : : Mat image = _image . getMat ( ) ; <nl> + CV_Assert ( image . type ( ) = = CV_8UC3 ) ; <nl> + <nl> + Filds & fld = * filds ; <nl> + fld . calcLevels ( image . size ( ) , scales ) ; <nl> + <nl> + objects . clear ( ) ; <nl> + <nl> + if ( _rois . kind ( ) = = cv : : _InputArray : : NONE ) <nl> + return detectNoRoi ( image , objects ) ; <nl> + <nl> + cv : : Mat roi = _rois . getMat ( ) ; <nl> + cv : : Mat mask ( image . rows / fld . shrinkage , image . cols / fld . shrinkage , CV_8UC1 ) ; <nl> + <nl> + mask . setTo ( cv : : Scalar : : all ( 0 ) ) ; <nl> + cv : : Rect * r = roi . ptr < cv : : Rect > ( 0 ) ; <nl> + for ( int i = 0 ; i < ( int ) roi . cols ; + + i ) <nl> + cv : : Mat ( mask , cv : : Rect ( r [ i ] . x / fld . shrinkage , r [ i ] . y / fld . shrinkage , r [ i ] . width / fld . shrinkage , r [ i ] . height / fld . shrinkage ) ) . setTo ( cv : : Scalar : : all ( 1 ) ) ; <nl> + <nl> + / / create integrals <nl> + ChannelStorage storage ( image , fld . shrinkage ) ; <nl> + <nl> + typedef std : : vector < Level > : : const_iterator lIt ; <nl> + for ( lIt it = fld . levels . begin ( ) ; it ! = fld . levels . end ( ) ; + + it ) <nl> + { <nl> + const Level & level = * it ; <nl> + <nl> + for ( int dy = 0 ; dy < level . workRect . height ; + + dy ) <nl> + { <nl> + uchar * m = mask . ptr < uchar > ( dy ) ; <nl> + for ( int dx = 0 ; dx < level . workRect . width ; + + dx ) <nl> + { <nl> + if ( m [ dx ] ) <nl> + { <nl> + storage . offset = dy * storage . step + dx ; <nl> + fld . detectAt ( dx , dy , level , storage , objects ) ; <nl> + } <nl> + } <nl> + } <nl> + } <nl> } <nl> \ No newline at end of file <nl> mmm a / modules / objdetect / test / test_softcascade . cpp <nl> ppp b / modules / objdetect / test / test_softcascade . cpp <nl> TEST ( SCascade , detect ) <nl> cv : : Mat colored = cv : : imread ( cvtest : : TS : : ptr ( ) - > get_data_path ( ) + " cascadeandhog / bahnhof / image_00000000_0 . png " ) ; <nl> ASSERT_FALSE ( colored . empty ( ) ) ; <nl> <nl> + std : : vector < Detection > objects ; <nl> + <nl> + cascade . detect ( colored , cv : : noArray ( ) , objects ) ; <nl> + <nl> + / / cv : : Mat out = colored . clone ( ) ; <nl> + / / int level = 0 , total = 0 ; <nl> + / / int levelWidth = objects [ 0 ] . bb . width ; <nl> + <nl> + / / for ( int i = 0 ; i < ( int ) objects . size ( ) ; + + i ) <nl> + / / { <nl> + / / if ( objects [ i ] . bb . width ! = levelWidth ) <nl> + / / { <nl> + / / std : : cout < < " Level : " < < level < < " total " < < total < < std : : endl ; <nl> + / / cv : : imshow ( " out " , out ) ; <nl> + / / cv : : waitKey ( 0 ) ; <nl> + / / out = colored . clone ( ) ; <nl> + / / levelWidth = objects [ i ] . bb . width ; <nl> + / / total = 0 ; <nl> + / / level + + ; <nl> + / / } <nl> + / / cv : : rectangle ( out , objects [ i ] . bb , cv : : Scalar ( 255 , 0 , 0 , 255 ) , 1 ) ; <nl> + / / std : : cout < < " detection : " < < objects [ i ] . bb . x <nl> + / / < < " " < < objects [ i ] . bb . y <nl> + / / < < " " < < objects [ i ] . bb . width <nl> + / / < < " " < < objects [ i ] . bb . height < < std : : endl ; <nl> + / / total + + ; <nl> + / / } <nl> + / / std : : cout < < " detected : " < < ( int ) objects . size ( ) < < std : : endl ; <nl> + ASSERT_EQ ( ( int ) objects . size ( ) , 3498 ) ; <nl> + } <nl> + <nl> + TEST ( SCascade , detectRoi ) <nl> + { <nl> + typedef cv : : SCascade : : Detection Detection ; <nl> + std : : string xml = cvtest : : TS : : ptr ( ) - > get_data_path ( ) + " cascadeandhog / sc_cvpr_2012_to_opencv . xml " ; <nl> + cv : : SCascade cascade ; <nl> + cv : : FileStorage fs ( xml , cv : : FileStorage : : READ ) ; <nl> + ASSERT_TRUE ( cascade . load ( fs . getFirstTopLevelNode ( ) ) ) ; <nl> + <nl> + cv : : Mat colored = cv : : imread ( cvtest : : TS : : ptr ( ) - > get_data_path ( ) + " cascadeandhog / bahnhof / image_00000000_0 . png " ) ; <nl> + ASSERT_FALSE ( colored . empty ( ) ) ; <nl> + <nl> std : : vector < Detection > objects ; <nl> std : : vector < cv : : Rect > rois ; <nl> rois . push_back ( cv : : Rect ( 0 , 0 , 640 , 480 ) ) ; <nl> <nl> cascade . detect ( colored , rois , objects ) ; <nl> <nl> + / / cv : : Mat out = colored . clone ( ) ; <nl> + / / int level = 0 , total = 0 ; <nl> + / / int levelWidth = objects [ 0 ] . bb . width ; <nl> <nl> - cv : : Mat out = colored . clone ( ) ; <nl> - int level = 0 , total = 0 ; <nl> - int levelWidth = objects [ 0 ] . bb . width ; <nl> - <nl> - for ( int i = 0 ; i < ( int ) objects . size ( ) ; + + i ) <nl> - { <nl> - if ( objects [ i ] . bb . width ! = levelWidth ) <nl> - { <nl> - std : : cout < < " Level : " < < level < < " total " < < total < < std : : endl ; <nl> - cv : : imshow ( " out " , out ) ; <nl> - cv : : waitKey ( 0 ) ; <nl> - out = colored . clone ( ) ; <nl> - levelWidth = objects [ i ] . bb . width ; <nl> - total = 0 ; <nl> - level + + ; <nl> - } <nl> - cv : : rectangle ( out , objects [ i ] . bb , cv : : Scalar ( 255 , 0 , 0 , 255 ) , 1 ) ; <nl> - std : : cout < < " detection : " < < objects [ i ] . bb . x <nl> - < < " " < < objects [ i ] . bb . y <nl> - < < " " < < objects [ i ] . bb . width <nl> - < < " " < < objects [ i ] . bb . height < < std : : endl ; <nl> - total + + ; <nl> - } <nl> - std : : cout < < " detected : " < < ( int ) objects . size ( ) < < std : : endl ; <nl> + / / for ( int i = 0 ; i < ( int ) objects . size ( ) ; + + i ) <nl> + / / { <nl> + / / if ( objects [ i ] . bb . width ! = levelWidth ) <nl> + / / { <nl> + / / std : : cout < < " Level : " < < level < < " total " < < total < < std : : endl ; <nl> + / / cv : : imshow ( " out " , out ) ; <nl> + / / cv : : waitKey ( 0 ) ; <nl> + / / out = colored . clone ( ) ; <nl> + / / levelWidth = objects [ i ] . bb . width ; <nl> + / / total = 0 ; <nl> + / / level + + ; <nl> + / / } <nl> + / / cv : : rectangle ( out , objects [ i ] . bb , cv : : Scalar ( 255 , 0 , 0 , 255 ) , 1 ) ; <nl> + / / std : : cout < < " detection : " < < objects [ i ] . bb . x <nl> + / / < < " " < < objects [ i ] . bb . y <nl> + / / < < " " < < objects [ i ] . bb . width <nl> + / / < < " " < < objects [ i ] . bb . height < < std : : endl ; <nl> + / / total + + ; <nl> + / / } <nl> + / / std : : cout < < " detected : " < < ( int ) objects . size ( ) < < std : : endl ; <nl> ASSERT_EQ ( ( int ) objects . size ( ) , 3498 ) ; <nl> + } <nl> + <nl> + TEST ( SCascade , detectNoRoi ) <nl> + { <nl> + typedef cv : : SCascade : : Detection Detection ; <nl> + std : : string xml = cvtest : : TS : : ptr ( ) - > get_data_path ( ) + " cascadeandhog / sc_cvpr_2012_to_opencv . xml " ; <nl> + cv : : SCascade cascade ; <nl> + cv : : FileStorage fs ( xml , cv : : FileStorage : : READ ) ; <nl> + ASSERT_TRUE ( cascade . load ( fs . getFirstTopLevelNode ( ) ) ) ; <nl> + <nl> + cv : : Mat colored = cv : : imread ( cvtest : : TS : : ptr ( ) - > get_data_path ( ) + " cascadeandhog / bahnhof / image_00000000_0 . png " ) ; <nl> + ASSERT_FALSE ( colored . empty ( ) ) ; <nl> + <nl> + std : : vector < Detection > objects ; <nl> + std : : vector < cv : : Rect > rois ; <nl> + <nl> + cascade . detect ( colored , rois , objects ) ; <nl> + <nl> + ASSERT_EQ ( ( int ) objects . size ( ) , 0 ) ; <nl> } <nl> \ No newline at end of file <nl>
add ROI support
opencv/opencv
157ab66ab908b44d9f72438a651461a796ce52ca
2012-11-07T22:34:49Z
mmm a / tensorflow / python / ops / image_ops_impl . py <nl> ppp b / tensorflow / python / ops / image_ops_impl . py <nl> def convert_image_dtype ( image , dtype , saturate = False , name = None ) : <nl> AttributeError : Raises an attribute error when dtype is neither float nor integer <nl> " " " <nl> image = ops . convert_to_tensor ( image , name = ' image ' ) <nl> - dtype = tf . dtypes . as_dtype ( dtype ) <nl> + dtype = dtypes . as_dtype ( dtype ) <nl> if not dtype . is_floating and not dtype . is_integer : <nl> raise AttributeError ( " dtype must be either floating point or integer " ) <nl> if dtype = = image . dtype : <nl>
fixed a bug in convert_image_dtype
tensorflow/tensorflow
14f0c841dc5e670e392621d3e2092b45600070ba
2019-06-07T10:33:56Z
mmm a / configure <nl> ppp b / configure <nl> <nl> # ! / usr / bin / env bash <nl> <nl> - DO_NOT_SUBMIT_WARNING = " Unofficial setting . DO NOT SUBMIT ! ! ! " <nl> - <nl> # Find out the absolute path to where . / configure resides <nl> pushd ` dirname $ 0 ` # > / dev / null <nl> SOURCE_BASE_DIR = ` pwd - P ` <nl> else <nl> perl - pi - e " s , WITH_GCP_SUPPORT = ( False | True ) , WITH_GCP_SUPPORT = False , s " tensorflow / core / platform / default / build_config . bzl <nl> fi <nl> <nl> + while [ " $ TF_NEED_HDFS " = = " " ] ; do <nl> + read - p " Do you wish to build TensorFlow with " \ <nl> + " Hadoop File System support ? [ y / N ] " INPUT <nl> + case $ INPUT in <nl> + [ Yy ] * ) echo " Hadoop File System support will be enabled for " \ <nl> + " TensorFlow " ; TF_NEED_HDFS = 1 ; ; <nl> + [ Nn ] * ) echo " No Hadoop File System support will be enabled for " \ <nl> + " TensorFlow " ; TF_NEED_HDFS = 0 ; ; <nl> + " " ) echo " No Hadoop File System support will be enabled for " \ <nl> + " TensorFlow " ; TF_NEED_HDFS = 0 ; ; <nl> + * ) echo " Invalid selection : " $ INPUT ; ; <nl> + esac <nl> + done <nl> + <nl> + if [ " $ TF_NEED_HDFS " = = " 1 " ] ; then <nl> + # Update Bazel build configuration . <nl> + perl - pi - e " s , WITH_HDFS_SUPPORT = ( False | True ) , WITH_HDFS_SUPPORT = True , s " tensorflow / core / platform / default / build_config . bzl <nl> + else <nl> + # Update Bazel build configuration . <nl> + perl - pi - e " s , WITH_HDFS_SUPPORT = ( False | True ) , WITH_HDFS_SUPPORT = False , s " tensorflow / core / platform / default / build_config . bzl <nl> + fi <nl> + <nl> # # Find swig path <nl> if [ - z " $ SWIG_PATH " ] ; then <nl> SWIG_PATH = ` type - p swig 2 > / dev / null ` <nl> deleted file mode 100644 <nl> index 6b5a8e7617598 . . 0000000000000 <nl> mmm a / navbar . md <nl> ppp / dev / null <nl> <nl> - # TensorFlow <nl> - <nl> - * [ Home ] [ home ] <nl> - * [ Getting Started ] ( / tensorflow / g3doc / get_started / index . md ) <nl> - * [ Mechanics ] ( / tensorflow / g3doc / how_tos / index . md ) <nl> - * [ Tutorials ] ( / tensorflow / g3doc / tutorials / index . md ) <nl> - * [ Python API ] ( / tensorflow / g3doc / api_docs / python / index . md ) <nl> - * [ C + + API ] ( / tensorflow / g3doc / api_docs / cc / index . md ) <nl> - * [ Other Resources ] ( / tensorflow / g3doc / resources / index . md ) <nl> - <nl> - [ home ] : / tensorflow / g3doc / index . md <nl> mmm a / tensorflow / BUILD <nl> ppp b / tensorflow / BUILD <nl> filegroup ( <nl> " / / tensorflow / core / ops / compat : all_files " , <nl> " / / tensorflow / core / platform / cloud : all_files " , <nl> " / / tensorflow / core / platform / default / build_config : all_files " , <nl> + " / / tensorflow / core / platform / hadoop : all_files " , <nl> " / / tensorflow / core / util / ctc : all_files " , <nl> " / / tensorflow / examples / android : all_files " , <nl> " / / tensorflow / examples / how_tos / reading_data : all_files " , <nl> filegroup ( <nl> " / / tensorflow / tensorboard / lib : all_files " , <nl> " / / tensorflow / tensorboard / lib / python : all_files " , <nl> " / / tensorflow / tensorboard / scripts : all_files " , <nl> + " / / tensorflow / third_party / hadoop : all_files " , <nl> " / / tensorflow / tools / dist_test / server : all_files " , <nl> " / / tensorflow / tools / docker : all_files " , <nl> " / / tensorflow / tools / docker / notebooks : all_files " , <nl> mmm a / tensorflow / c / c_api . cc <nl> ppp b / tensorflow / c / c_api . cc <nl> limitations under the License . <nl> # include < memory > <nl> # include < vector > <nl> <nl> + # include " tensorflow / core / common_runtime / shape_refiner . h " <nl> # include " tensorflow / core / framework / log_memory . h " <nl> # include " tensorflow / core / framework / node_def_util . h " <nl> # include " tensorflow / core / framework / op_kernel . h " <nl> limitations under the License . <nl> # include " tensorflow / core / framework / tensor_shape . h " <nl> # include " tensorflow / core / graph / graph . h " <nl> # include " tensorflow / core / graph / node_builder . h " <nl> - # include " tensorflow / core / graph / shape_refiner . h " <nl> # include " tensorflow / core / lib / core / coding . h " <nl> # include " tensorflow / core / lib / core / errors . h " <nl> # include " tensorflow / core / lib / core / status . h " <nl> mmm a / tensorflow / cc / framework / scope . h <nl> ppp b / tensorflow / cc / framework / scope . h <nl> limitations under the License . <nl> # include < vector > <nl> <nl> # include " tensorflow / cc / framework / ops . h " <nl> - # include " tensorflow / core / graph / shape_refiner . h " <nl> + # include " tensorflow / core / common_runtime / shape_refiner . h " <nl> # include " tensorflow / core / lib / core / status . h " <nl> # include " tensorflow / core / lib / gtl / array_slice . h " <nl> <nl> mmm a / tensorflow / contrib / bayesflow / python / kernel_tests / stochastic_gradient_estimators_test . py <nl> ppp b / tensorflow / contrib / bayesflow / python / kernel_tests / stochastic_gradient_estimators_test . py <nl> def baseline_fn ( stoch_tensor , loss ) : <nl> <nl> def testScoreFunctionWithMeanBaseline ( self ) : <nl> ema_decay = 0 . 8 <nl> + num_steps = 6 <nl> x = st . BernoulliTensor ( <nl> p = self . _p , <nl> loss_fn = sge . get_score_function_with_baseline ( <nl> sge . get_mean_baseline ( ema_decay ) ) ) <nl> sf = x . loss ( self . _final_loss ) <nl> <nl> - expected = tf . log ( self . _p ) * ( self . _final_loss - <nl> - ( 1 . - ema_decay ) * self . _final_loss ) <nl> + # Expected EMA value <nl> + ema = 0 . <nl> + for _ in range ( num_steps ) : <nl> + ema - = ( 1 . - ema_decay ) * ( ema - self . _final_loss ) <nl> + <nl> + # Baseline is EMA with bias correction <nl> + bias_correction = 1 . - ema_decay * * num_steps <nl> + baseline = ema / bias_correction <nl> + expected = tf . log ( self . _p ) * ( self . _final_loss - baseline ) <nl> <nl> with self . test_session ( ) as sess : <nl> sess . run ( tf . initialize_all_variables ( ) ) <nl> - sess . run ( sf ) # run to update EMA <nl> + for _ in range ( num_steps - 1 ) : <nl> + sess . run ( sf ) # run to update EMA <nl> self . assertAllClose ( * sess . run ( [ expected , sf ] ) ) <nl> <nl> def testScoreFunctionWithAdvantageFn ( self ) : <nl> def advantage_fn ( stoch_tensor , loss ) : <nl> self . _testScoreFunction ( <nl> sge . get_score_function_with_advantage ( advantage_fn ) , expected ) <nl> <nl> + def testScoreFunctionWithMeanBaselineHasUniqueVarScope ( self ) : <nl> + ema_decay = 0 . 8 <nl> + x = st . BernoulliTensor ( <nl> + p = self . _p , <nl> + loss_fn = sge . get_score_function_with_baseline ( <nl> + sge . get_mean_baseline ( ema_decay ) ) ) <nl> + y = st . BernoulliTensor ( <nl> + p = self . _p , <nl> + loss_fn = sge . get_score_function_with_baseline ( <nl> + sge . get_mean_baseline ( ema_decay ) ) ) <nl> + sf_x = x . loss ( self . _final_loss ) <nl> + sf_y = y . loss ( self . _final_loss ) <nl> + with self . test_session ( ) as sess : <nl> + # Smoke test <nl> + sess . run ( tf . initialize_all_variables ( ) ) <nl> + sess . run ( [ sf_x , sf_y ] ) <nl> + <nl> <nl> if __name__ = = " __main__ " : <nl> tf . test . main ( ) <nl> mmm a / tensorflow / contrib / bayesflow / python / ops / stochastic_gradient_estimators . py <nl> ppp b / tensorflow / contrib / bayesflow / python / ops / stochastic_gradient_estimators . py <nl> <nl> from tensorflow . python . framework import ops <nl> from tensorflow . python . ops import array_ops <nl> from tensorflow . python . ops import math_ops <nl> + from tensorflow . python . ops import variable_scope as vs <nl> from tensorflow . python . training import training <nl> from tensorflow . python . util . all_util import make_all <nl> <nl> def score_function_with_baseline ( dist_tensor , value , loss ) : <nl> return score_function_with_baseline <nl> <nl> <nl> - def get_mean_baseline ( ema_decay = 0 . 99 , name = " MeanBaseline " ) : <nl> + def get_mean_baseline ( ema_decay = 0 . 99 , name = None ) : <nl> " " " ExponentialMovingAverage baseline . <nl> <nl> + EMA initializes to 0 , which introduces a bias . This baseline implements the <nl> + bias correction term from Adam ( section 3 of <nl> + https : / / arxiv . org / pdf / 1412 . 6980v8 . pdf ) , dividing by ` 1 - ema_decay ^ t ` , where <nl> + ` t ` is the step count . <nl> + <nl> Args : <nl> ema_decay : decay rate for the ExponentialMovingAverage . <nl> - name : name to prepend ops with . <nl> + name : name for variable scope of the ExponentialMovingAverage . <nl> <nl> Returns : <nl> Callable baseline function that takes the ` DistributionTensor ` ( unused ) and <nl> def get_mean_baseline ( ema_decay = 0 . 99 , name = " MeanBaseline " ) : <nl> " " " <nl> <nl> def mean_baseline ( _ , loss ) : <nl> - with ops . name_scope ( name ) : <nl> - ema = training . ExponentialMovingAverage ( decay = ema_decay ) <nl> + with vs . variable_scope ( name , default_name = " MeanBaseline " ) : <nl> reduced_loss = math_ops . reduce_mean ( loss ) <nl> + <nl> + ema = training . ExponentialMovingAverage ( decay = ema_decay ) <nl> update_op = ema . apply ( [ reduced_loss ] ) <nl> + <nl> + # The bias correction term requires keeping track of how many times the <nl> + # EMA has been updated . Creating a variable here to do so . The global step <nl> + # is not used because it may or may not track exactly the number of times <nl> + # the EMA is updated . <nl> + ema_var = ema . average ( reduced_loss ) <nl> + assert ema_var is not None <nl> + with ops . colocate_with ( ema_var ) : <nl> + num_updates = vs . get_variable ( <nl> + " local_ema_step " , initializer = 0 , trainable = False ) <nl> + num_updates = num_updates . assign_add ( 1 ) <nl> + bias_correction = 1 . - math_ops . pow ( ema_decay , math_ops . cast ( <nl> + num_updates , reduced_loss . dtype ) ) <nl> + <nl> with ops . control_dependencies ( [ update_op ] ) : <nl> - # TODO ( rsepassi ) : Possibly implement the initialization bias correction <nl> - # term from Adam ( section 3 of https : / / arxiv . org / pdf / 1412 . 6980v8 . pdf ) . <nl> - baseline = ema . average ( reduced_loss ) <nl> + baseline = ema . average ( reduced_loss ) / bias_correction <nl> + <nl> return baseline <nl> <nl> return mean_baseline <nl> mmm a / tensorflow / contrib / distributions / python / ops / transformed_distribution . py <nl> ppp b / tensorflow / contrib / distributions / python / ops / transformed_distribution . py <nl> class TransformedDistribution ( distribution . Distribution ) : <nl> <nl> ` ` ` <nl> logit_normal = TransformedDistribution ( <nl> - base_dist = Normal ( mu , sigma ) , <nl> + base_dist_cls = tf . contrib . distributions . Normal , <nl> + mu = mu , <nl> + sigma = sigma , <nl> transform = lambda x : tf . sigmoid ( x ) , <nl> inverse = lambda y : tf . log ( y ) - tf . log ( 1 . - y ) , <nl> log_det_jacobian = ( lambda x : <nl> mmm a / tensorflow / contrib / graph_editor / select . py <nl> ppp b / tensorflow / contrib / graph_editor / select . py <nl> def get_ops_ios ( ops , control_inputs = False , control_outputs = None , <nl> return res <nl> <nl> <nl> - def compute_boundary_ts ( ops , ambiguous_are_outputs = True ) : <nl> + def compute_boundary_ts ( ops , ambiguous_ts_are_outputs = True ) : <nl> " " " Compute the tensors at the boundary of a set of ops . <nl> <nl> This function looks at all the tensors connected to the given ops ( in / out ) <nl> def compute_boundary_ts ( ops , ambiguous_are_outputs = True ) : <nl> <nl> Args : <nl> ops : an object convertible to a list of tf . Operation . <nl> - ambiguous_are_outputs : a tensor can have consumers both inside and outside <nl> - ops . Such tensors are treated as outside tensor if inside_output_as_output <nl> - is True , otherwise they are treated as inside tensor . <nl> + ambiguous_ts_are_outputs : a tensor can have consumers both inside and <nl> + outside ops . Such tensors are treated as outside tensor if <nl> + ambiguous_ts_are_outputs is True , otherwise they are treated as <nl> + inside tensor . <nl> Returns : <nl> A tuple ` ( outside_input_ts , outside_output_ts , inside_ts ) ` where : <nl> ` outside_input_ts ` is a Python list of input tensors ; <nl> def compute_boundary_ts ( ops , ambiguous_are_outputs = True ) : <nl> input_ts = _get_input_ts ( ops ) <nl> output_ts = _get_output_ts ( ops ) <nl> output_ts_set = frozenset ( output_ts ) <nl> + ops_set = frozenset ( ops ) <nl> <nl> # fill in inside <nl> inside_ts = [ ] <nl> def compute_boundary_ts ( ops , ambiguous_are_outputs = True ) : <nl> # is also output ? <nl> if t not in output_ts_set : <nl> continue <nl> - # is ambiguous ? <nl> - if ambiguous_are_outputs : <nl> - not_in_ops = [ op for op in t . consumers ( ) if op not in ops ] <nl> - if not_in_ops : <nl> + # is ambiguous_ts_are_outputs is True , don ' t add to inside if ambiguous <nl> + if ambiguous_ts_are_outputs : <nl> + consumers = frozenset ( t . consumers ( ) ) <nl> + if consumers - ops_set : <nl> continue <nl> inside_ts . append ( t ) <nl> <nl> - outside_input_ts = [ t for t in input_ts if t not in inside_ts ] <nl> - outside_output_ts = [ t for t in output_ts if t not in inside_ts ] <nl> + inside_ts_set = frozenset ( inside_ts ) <nl> + outside_input_ts = [ t for t in input_ts if t not in inside_ts_set ] <nl> + outside_output_ts = [ t for t in output_ts if t not in inside_ts_set ] <nl> return outside_input_ts , outside_output_ts , inside_ts <nl> <nl> <nl> mmm a / tensorflow / contrib / graph_editor / transform . py <nl> ppp b / tensorflow / contrib / graph_editor / transform . py <nl> <nl> from tensorflow . contrib . graph_editor import subgraph <nl> from tensorflow . contrib . graph_editor import util <nl> from tensorflow . python . framework import ops as tf_ops <nl> - from tensorflow . python . platform import tf_logging as logging <nl> <nl> __all__ = [ <nl> " replace_t_with_placeholder_handler " , <nl> class _Info ( object ) : <nl> def __init__ ( self , transformer , sgv , dst_graph , dst_scope , src_scope ) : <nl> self . transformer = transformer <nl> self . sgv = sgv <nl> + self . sgv_inputs_set = frozenset ( sgv . inputs ) <nl> self . ops = frozenset ( sgv . ops ) <nl> self . control_outputs = util . ControlOutputs ( sgv . graph ) <nl> self . graph = sgv . graph <nl> def __call__ ( self , <nl> if dst_scope and not reuse_dst_scope : <nl> dst_scope = util . scope_finalize ( dst_graph . unique_name ( dst_scope [ : - 1 ] ) ) <nl> <nl> - if sgv . graph is dst_graph and not dst_scope : <nl> - logging . warning ( " The source and the destination are the same ! " <nl> - " Beware : in - place transormation are currently " <nl> - " experimental . " ) <nl> + # Create temporary info used during this transform call <nl> self . _info = Transformer . _Info ( self , sgv , dst_graph , dst_scope , src_scope ) <nl> <nl> # Transform the graph starting from the output tensors . <nl> def _transform_t ( self , t ) : <nl> # If op is not in the subgraph : <nl> if op not in self . _info . ops : <nl> # t_ is an input of the subgraph <nl> - if t in self . _info . sgv . inputs : <nl> + if t in self . _info . sgv_inputs_set : <nl> t_ = self . transform_external_input_handler ( self . _info , t ) <nl> # t_ is a hidden input of the subgraph <nl> else : <nl> mmm a / tensorflow / contrib / layers / python / layers / optimizers . py <nl> ppp b / tensorflow / contrib / layers / python / layers / optimizers . py <nl> <nl> from tensorflow . python . ops import random_ops <nl> from tensorflow . python . ops import variable_scope as vs <nl> from tensorflow . python . ops import variables as vars_ <nl> - from tensorflow . python . platform import tf_logging as logging <nl> from tensorflow . python . training import optimizer as optimizer_ <nl> from tensorflow . python . training import training as train <nl> <nl> def optimize_loss ( loss , <nl> gradient_noise_scale = None , <nl> gradient_multipliers = None , <nl> clip_gradients = None , <nl> - moving_average_decay = None , <nl> learning_rate_decay_fn = None , <nl> update_ops = None , <nl> variables = None , <nl> def optimize_loss ( loss , <nl> summaries = None ) : <nl> " " " Given loss and parameters for optimizer , returns a training op . <nl> <nl> + Various ways of passing optimizers , include : <nl> + - string , name of the optimizer like ' SGD ' , ' Adam ' , see OPTIMIZER_CLS_NAMES <nl> + for full list . E . g . ` optimize_loss ( . . . , optimizer = ' Adam ' ) ` . <nl> + - function , takes learning rate ` Tensor ` as argument and must return <nl> + ` Optimizer ` instance . E . g . ` optimize_loss ( . . . , <nl> + optimizer = lambda lr : tf . train . MomentumOptimizer ( lr , momentum = 0 . 5 ) ) ` . <nl> + Alternatively , if ` learning_rate ` is ` None ` , the function takes no <nl> + arguments . E . g . ` optimize_loss ( . . . , learning_rate = None , <nl> + optimizer = lambda : tf . train . MomentumOptimizer ( 0 . 5 , momentum = 0 . 5 ) ) ` . <nl> + - class , subclass of ` Optimizer ` that takes only one required argument - <nl> + learning rate , such as AdamOptimizer , AdagradOptimizer . <nl> + E . g . ` optimize_loss ( . . . , optimizer = tf . train . AdagradOptimizer ) ` . <nl> + - object , instance of subclass of ` Optimizer ` . <nl> + E . g . , ` optimizer_loss ( . . . , optimizer = tf . train . AdagradOptimizer ( 0 . 5 ) ) ` . <nl> + <nl> Args : <nl> loss : Tensor , 0 dimensional . <nl> global_step : Tensor , step counter for each update . <nl> def optimize_loss ( loss , <nl> ' Adam ' , ' Adagrad ' . Full list in OPTIMIZER_CLS_NAMES constant . <nl> class should be sub - class of tf . Optimizer that implements <nl> ` compute_gradients ` and ` apply_gradients ` functions . <nl> - optimizer instance should be instantion of tf . Optimizer sub - class <nl> - and have ` compute_gradients ` and ` apply_gradients ` functions . <nl> + optimizer instance should be instantion of ` tf . Optimizer ` <nl> + sub - class and have ` compute_gradients ` and ` apply_gradients ` <nl> + functions . <nl> gradient_noise_scale : float or None , adds 0 - mean normal noise scaled by this <nl> value . <nl> gradient_multipliers : dict of variables or variable names to floats . <nl> If present , gradients for specified <nl> variables will be multiplied by given constant . <nl> clip_gradients : float or ` None ` , clips gradients by this value . <nl> - moving_average_decay : Deprecated . float or None , takes into account previous <nl> - loss to make learning smoother due to outliers . <nl> learning_rate_decay_fn : function , takes ` learning_rate ` and ` global_step ` <nl> ` Tensor ` s , returns ` Tensor ` . <nl> Can be used to implement any learning rate decay <nl> class should be sub - class of tf . Optimizer that implements <nl> if update_ops : <nl> loss = control_flow_ops . with_dependencies ( list ( update_ops ) , loss ) <nl> <nl> - # Moving average of the loss with decay . <nl> - # TODO ( b / 30439864 ) : moving_average_decay should be removed . <nl> - if moving_average_decay is not None : <nl> - logging . warn ( " ' moving_average_decay ' is deprecated . Please use " <nl> - " tensorboard ' s builtin averaging instead . " ) <nl> - # Generate moving averages of the loss . <nl> - loss_averages = train . ExponentialMovingAverage ( moving_average_decay , <nl> - name = " avg " ) <nl> - loss_averages_op = loss_averages . apply ( [ loss ] ) <nl> - logging_ops . scalar_summary ( " loss / mean " , loss_averages . average ( loss ) ) <nl> - loss = control_flow_ops . with_dependencies ( [ loss_averages_op ] , loss ) <nl> - <nl> # Learning rate variable , with possible decay . <nl> - if ( isinstance ( learning_rate , ops . Tensor ) <nl> - and learning_rate . get_shape ( ) . ndims = = 0 ) : <nl> - lr = learning_rate <nl> - elif isinstance ( learning_rate , float ) : <nl> - lr = vs . get_variable ( <nl> - " learning_rate " , [ ] , trainable = False , <nl> - initializer = init_ops . constant_initializer ( learning_rate ) ) <nl> - else : <nl> - raise ValueError ( " Learning rate should be 0d Tensor or float . " <nl> - " Got % s of type % s " % ( <nl> - str ( learning_rate ) , str ( type ( learning_rate ) ) ) ) <nl> + lr = None <nl> + if learning_rate is not None : <nl> + if ( isinstance ( learning_rate , ops . Tensor ) <nl> + and learning_rate . get_shape ( ) . ndims = = 0 ) : <nl> + lr = learning_rate <nl> + elif isinstance ( learning_rate , float ) : <nl> + lr = vs . get_variable ( <nl> + " learning_rate " , [ ] , trainable = False , <nl> + initializer = init_ops . constant_initializer ( learning_rate ) ) <nl> + else : <nl> + raise ValueError ( " Learning rate should be 0d Tensor or float . " <nl> + " Got % s of type % s " % ( <nl> + str ( learning_rate ) , str ( type ( learning_rate ) ) ) ) <nl> if summaries is None : <nl> summaries = [ " loss " , " learning_rate " ] <nl> - if learning_rate_decay_fn is not None : <nl> + if learning_rate is not None and learning_rate_decay_fn is not None : <nl> lr = learning_rate_decay_fn ( lr , global_step ) <nl> if " learning_rate " in summaries : <nl> logging_ops . scalar_summary ( " learning_rate " , lr ) <nl> <nl> # Create optimizer , given specified parameters . <nl> if isinstance ( optimizer , six . string_types ) : <nl> + if lr is None : <nl> + raise ValueError ( " Learning rate is None , but should be specified if " <nl> + " optimizer is string ( % s ) . " % optimizer ) <nl> if optimizer not in OPTIMIZER_CLS_NAMES : <nl> raise ValueError ( <nl> " Optimizer name should be one of [ % s ] , you provided % s . " <nl> % ( " , " . join ( OPTIMIZER_CLS_NAMES ) , optimizer ) ) <nl> opt = OPTIMIZER_CLS_NAMES [ optimizer ] ( learning_rate = lr ) <nl> - elif isinstance ( optimizer , type ) and issubclass ( optimizer , <nl> - optimizer_ . Optimizer ) : <nl> + elif ( isinstance ( optimizer , type ) <nl> + and issubclass ( optimizer , optimizer_ . Optimizer ) ) : <nl> + if lr is None : <nl> + raise ValueError ( " Learning rate is None , but should be specified if " <nl> + " optimizer is class ( % s ) . " % optimizer ) <nl> opt = optimizer ( learning_rate = lr ) <nl> elif isinstance ( optimizer , optimizer_ . Optimizer ) : <nl> opt = optimizer <nl> + elif callable ( optimizer ) : <nl> + if learning_rate is not None : <nl> + opt = optimizer ( lr ) <nl> + else : <nl> + opt = optimizer ( ) <nl> + if not isinstance ( opt , optimizer_ . Optimizer ) : <nl> + raise ValueError ( " Unrecognized optimizer : function should return " <nl> + " subclass of Optimizer . Got % s . " % str ( opt ) ) <nl> else : <nl> raise ValueError ( " Unrecognized optimizer : should be string , " <nl> - " subclass of Optimizer or instance of " <nl> - " subclass of Optimizer . Got % s . " % str ( optimizer ) ) <nl> + " subclass of Optimizer , instance of " <nl> + " subclass of Optimizer or function with one argument . " <nl> + " Got % s . " % str ( optimizer ) ) <nl> <nl> # All trainable variables , if specific variables are not specified . <nl> if variables is None : <nl> mmm a / tensorflow / contrib / layers / python / layers / optimizers_test . py <nl> ppp b / tensorflow / contrib / layers / python / layers / optimizers_test . py <nl> def _setup_model ( ) : <nl> class OptimizersTest ( tf . test . TestCase ) : <nl> <nl> def testSGDOptimizer ( self ) : <nl> - optimizers = [ " SGD " , tf . train . GradientDescentOptimizer , <nl> - tf . train . GradientDescentOptimizer ( learning_rate = 0 . 1 ) ] <nl> + optimizers = [ <nl> + " SGD " , tf . train . GradientDescentOptimizer , <nl> + tf . train . GradientDescentOptimizer ( learning_rate = 0 . 1 ) , <nl> + lambda lr : tf . train . GradientDescentOptimizer ( learning_rate = lr ) ] <nl> for optimizer in optimizers : <nl> with tf . Graph ( ) . as_default ( ) as g : <nl> with self . test_session ( graph = g ) as session : <nl> def testSGDOptimizer ( self ) : <nl> self . assertEqual ( var_value , 9 . 5 ) <nl> self . assertEqual ( global_step_value , 1 ) <nl> <nl> + def testNoLrCallable ( self ) : <nl> + def optimizer_fn ( ) : <nl> + return tf . train . GradientDescentOptimizer ( learning_rate = 0 . 1 ) <nl> + with tf . Graph ( ) . as_default ( ) as g : <nl> + with self . test_session ( graph = g ) as session : <nl> + x , var , loss , global_step = _setup_model ( ) <nl> + train = tf . contrib . layers . optimize_loss ( loss , <nl> + global_step , <nl> + learning_rate = None , <nl> + optimizer = optimizer_fn ) <nl> + tf . initialize_all_variables ( ) . run ( ) <nl> + session . run ( train , feed_dict = { x : 5 } ) <nl> + var_value , global_step_value = session . run ( [ var , global_step ] ) <nl> + self . assertEqual ( var_value , 9 . 5 ) <nl> + self . assertEqual ( global_step_value , 1 ) <nl> + <nl> def testWrongOptimizer ( self ) : <nl> - optimizers = [ " blah " , tf . Variable , object ( ) ] <nl> + optimizers = [ " blah " , tf . Variable , object ( ) , lambda x : None ] <nl> for optimizer in optimizers : <nl> with tf . Graph ( ) . as_default ( ) as g : <nl> with self . test_session ( graph = g ) : <nl> mmm a / tensorflow / contrib / learn / BUILD <nl> ppp b / tensorflow / contrib / learn / BUILD <nl> py_test ( <nl> ] , <nl> ) <nl> <nl> - py_test ( <nl> - name = " early_stopping_test " , <nl> - size = " medium " , <nl> - srcs = [ " python / learn / tests / early_stopping_test . py " ] , <nl> - srcs_version = " PY2AND3 " , <nl> - tags = [ <nl> - " manual " , <nl> - " noasan " , # http : / / b / 28555477 <nl> - ] , <nl> - deps = [ <nl> - " : learn " , <nl> - " / / tensorflow : tensorflow_py " , <nl> - " / / tensorflow / python : framework_test_lib " , <nl> - ] , <nl> - ) <nl> - <nl> py_test ( <nl> name = " estimators_test " , <nl> size = " small " , <nl> py_test ( <nl> name = " dnn_test " , <nl> size = " medium " , <nl> srcs = [ " python / learn / estimators / dnn_test . py " ] , <nl> + shard_count = 4 , <nl> srcs_version = " PY2AND3 " , <nl> deps = [ <nl> " : learn " , <nl> py_test ( <nl> size = " medium " , <nl> srcs = [ " python / learn / tests / nonlinear_test . py " ] , <nl> srcs_version = " PY2AND3 " , <nl> - tags = [ <nl> - " manual " , # http : / / b / 29220227 <nl> - " noasan " , <nl> - ] , <nl> deps = [ <nl> " : learn " , <nl> " / / tensorflow : tensorflow_py " , <nl> py_test ( <nl> ] , <nl> ) <nl> <nl> - py_test ( <nl> - name = " saver_test " , <nl> - size = " small " , <nl> - srcs = [ " python / learn / tests / saver_test . py " ] , <nl> - srcs_version = " PY2AND3 " , <nl> - tags = [ " manual " ] , # http : / / b / 29604599 <nl> - deps = [ <nl> - " : learn " , <nl> - " / / tensorflow : tensorflow_py " , <nl> - " / / tensorflow / python : framework_test_lib " , <nl> - ] , <nl> - ) <nl> - <nl> py_test ( <nl> name = " ops_test " , <nl> size = " small " , <nl> mmm a / tensorflow / contrib / learn / python / learn / basic_session_run_hooks . py <nl> ppp b / tensorflow / contrib / learn / python / learn / basic_session_run_hooks . py <nl> <nl> from tensorflow . core . util . event_pb2 import SessionLog <nl> from tensorflow . python . framework import ops <nl> from tensorflow . python . platform import tf_logging as logging <nl> + from tensorflow . python . training import training_util <nl> <nl> <nl> class LoggingTensorHook ( session_run_hook . SessionRunHook ) : <nl> def __init__ ( self , <nl> " " " <nl> logging . info ( " Create CheckpointSaverHook " ) <nl> self . _saver = saver <nl> + self . _checkpoint_dir = checkpoint_dir <nl> self . _summary_writer = SummaryWriterCache . get ( checkpoint_dir ) <nl> self . _save_path = os . path . join ( checkpoint_dir , checkpoint_basename ) <nl> self . _scaffold = scaffold <nl> def begin ( self ) : <nl> " Global step should be created to use CheckpointSaverHook . " ) <nl> <nl> def before_run ( self , run_context ) : # pylint : disable = unused - argument <nl> + if self . _last_saved_time is None : <nl> + # Write graph in the first call <nl> + training_util . write_graph ( <nl> + ops . get_default_graph ( ) . as_graph_def ( add_shapes = True ) , <nl> + self . _checkpoint_dir , <nl> + " graph . pbtxt " ) <nl> + self . _summary_writer . add_graph ( ops . get_default_graph ( ) ) <nl> + <nl> return SessionRunArgs ( self . _global_step_tensor ) <nl> <nl> def after_run ( self , run_context , run_values ) : <nl> mmm a / tensorflow / contrib / learn / python / learn / estimators / dnn_linear_combined_test . py <nl> ppp b / tensorflow / contrib / learn / python / learn / estimators / dnn_linear_combined_test . py <nl> <nl> import tensorflow as tf <nl> <nl> from tensorflow . contrib . learn . python . learn . estimators import _sklearn <nl> + from tensorflow . contrib . learn . python . learn . estimators import estimator_test_utils <nl> <nl> <nl> def _get_quantile_based_buckets ( feature_values , num_buckets ) : <nl> def _iris_input_logistic_fn ( ) : <nl> <nl> class DNNLinearCombinedClassifierTest ( tf . test . TestCase ) : <nl> <nl> + def testEstimatorContract ( self ) : <nl> + estimator_test_utils . assert_estimator_contract ( <nl> + self , tf . contrib . learn . DNNLinearCombinedClassifier ) <nl> + <nl> def testLogisticRegression_MatrixData ( self ) : <nl> " " " Tests binary classification using matrix data as input . " " " <nl> iris = _prepare_iris_data_for_logistic_regression ( ) <nl> def _input_fn_train ( ) : <nl> <nl> class DNNLinearCombinedRegressorTest ( tf . test . TestCase ) : <nl> <nl> + def testEstimatorContract ( self ) : <nl> + estimator_test_utils . assert_estimator_contract ( <nl> + self , tf . contrib . learn . DNNLinearCombinedRegressor ) <nl> + <nl> def _input_fn_train ( self ) : <nl> # Create 4 rows of ( y = x ) <nl> target = tf . constant ( [ [ 100 . ] , [ 3 . ] , [ 2 . ] , [ 2 . ] ] ) <nl> mmm a / tensorflow / contrib / learn / python / learn / estimators / dnn_test . py <nl> ppp b / tensorflow / contrib / learn / python / learn / estimators / dnn_test . py <nl> <nl> import tensorflow as tf <nl> <nl> from tensorflow . contrib . learn . python . learn . estimators import _sklearn <nl> + from tensorflow . contrib . learn . python . learn . estimators import estimator_test_utils <nl> <nl> # pylint : disable = g - import - not - at - top <nl> try : <nl> def _iris_input_multiclass_fn ( ) : <nl> <nl> class DNNClassifierTest ( tf . test . TestCase ) : <nl> <nl> + def testEstimatorContract ( self ) : <nl> + estimator_test_utils . assert_estimator_contract ( <nl> + self , tf . contrib . learn . DNNClassifier ) <nl> + <nl> def testLogisticRegression_MatrixData ( self ) : <nl> " " " Tests binary classification using matrix data as input . " " " <nl> cont_features = [ <nl> def testSklearnCompatibility ( self ) : <nl> <nl> class DNNRegressorTest ( tf . test . TestCase ) : <nl> <nl> + def testEstimatorContract ( self ) : <nl> + estimator_test_utils . assert_estimator_contract ( <nl> + self , tf . contrib . learn . DNNRegressor ) <nl> + <nl> def testRegression_MatrixData ( self ) : <nl> " " " Tests regression using matrix data as input . " " " <nl> cont_features = [ <nl> mmm a / tensorflow / contrib / learn / python / learn / estimators / estimator . py <nl> ppp b / tensorflow / contrib / learn / python / learn / estimators / estimator . py <nl> def get_variable_value ( self , name ) : <nl> Returns : <nl> Numpy array - value of the tensor . <nl> " " " <nl> - if name . endswith ( ' : 0 ' ) : <nl> - name = name [ : - 2 ] <nl> return checkpoints . load_variable ( self . model_dir , name ) <nl> <nl> def get_variable_names ( self ) : <nl> new file mode 100644 <nl> index 0000000000000 . . 3ba74e1c912d5 <nl> mmm / dev / null <nl> ppp b / tensorflow / contrib / learn / python / learn / estimators / estimator_test_utils . py <nl> <nl> + # Copyright 2016 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> + " " " Utils for Estimator . " " " <nl> + <nl> + from __future__ import absolute_import <nl> + from __future__ import division <nl> + from __future__ import print_function <nl> + <nl> + import inspect <nl> + <nl> + <nl> + def assert_estimator_contract ( tester , estimator_class ) : <nl> + " " " Asserts whether given estimator satisfies the expected contract . <nl> + <nl> + This doesn ' t check every details of contract . This test is used for that a <nl> + function is not forgotten to implement in a precanned Estimator . <nl> + <nl> + Args : <nl> + tester : A tf . test . TestCase . <nl> + estimator_class : ' type ' object of pre - canned estimator . <nl> + " " " <nl> + attributes = inspect . getmembers ( estimator_class ) <nl> + attribute_names = [ a [ 0 ] for a in attributes ] <nl> + <nl> + tester . assertTrue ( ' config ' in attribute_names ) <nl> + tester . assertTrue ( ' evaluate ' in attribute_names ) <nl> + tester . assertTrue ( ' export ' in attribute_names ) <nl> + tester . assertTrue ( ' fit ' in attribute_names ) <nl> + tester . assertTrue ( ' get_variable_names ' in attribute_names ) <nl> + tester . assertTrue ( ' get_variable_value ' in attribute_names ) <nl> + tester . assertTrue ( ' model_dir ' in attribute_names ) <nl> + tester . assertTrue ( ' predict ' in attribute_names ) <nl> mmm a / tensorflow / contrib / learn / python / learn / estimators / linear . py <nl> ppp b / tensorflow / contrib / learn / python / learn / estimators / linear . py <nl> class LinearClassifier ( evaluable . Evaluable , trainable . Trainable ) : <nl> feature_columns = [ occupation , education_x_occupation ] , <nl> optimizer = tf . contrib . linear_optimizer . SDCAOptimizer ( <nl> example_id_column = ' example_id ' , <nl> + num_loss_partitions = . . . , <nl> symmetric_l2_regularization = 2 . 0 <nl> ) ) <nl> <nl> def predict_proba ( self , x = None , input_fn = None , batch_size = None , outputs = None , <nl> def get_variable_names ( self ) : <nl> return [ name for name , _ in checkpoints . list_variables ( self . _model_dir ) ] <nl> <nl> + def get_variable_value ( self , name ) : <nl> + return checkpoints . load_variable ( self . model_dir , name ) <nl> + <nl> def export ( self , <nl> export_dir , <nl> input_fn = None , <nl> mmm a / tensorflow / contrib / learn / python / learn / estimators / linear_test . py <nl> ppp b / tensorflow / contrib / learn / python / learn / estimators / linear_test . py <nl> <nl> import tensorflow as tf <nl> <nl> from tensorflow . contrib . learn . python . learn . estimators import _sklearn <nl> + from tensorflow . contrib . learn . python . learn . estimators import estimator_test_utils <nl> from tensorflow . contrib . learn . python . learn . metric_spec import MetricSpec <nl> <nl> <nl> def _iris_input_fn ( ) : <nl> <nl> class LinearClassifierTest ( tf . test . TestCase ) : <nl> <nl> + def testEstimatorContract ( self ) : <nl> + estimator_test_utils . assert_estimator_contract ( <nl> + self , tf . contrib . learn . LinearClassifier ) <nl> + <nl> def testTrain ( self ) : <nl> " " " Tests that loss goes down with training . " " " <nl> <nl> def input_fn ( ) : <nl> <nl> class LinearRegressorTest ( tf . test . TestCase ) : <nl> <nl> + def testEstimatorContract ( self ) : <nl> + estimator_test_utils . assert_estimator_contract ( <nl> + self , tf . contrib . learn . LinearRegressor ) <nl> + <nl> def testRegression ( self ) : <nl> " " " Tests that loss goes down with training . " " " <nl> <nl> def input_fn ( ) : <nl> self . assertLess ( loss2 , loss1 ) <nl> self . assertLess ( loss2 , 0 . 5 ) <nl> <nl> + def testRegression_MatrixData ( self ) : <nl> + " " " Tests regression using matrix data as input . " " " <nl> + cont_features = [ <nl> + tf . contrib . layers . real_valued_column ( ' feature ' , dimension = 4 ) ] <nl> + <nl> + regressor = tf . contrib . learn . LinearRegressor ( <nl> + feature_columns = cont_features , <nl> + config = tf . contrib . learn . RunConfig ( tf_random_seed = 1 ) ) <nl> + <nl> + regressor . fit ( input_fn = _iris_input_fn , steps = 100 ) <nl> + scores = regressor . evaluate ( input_fn = _iris_input_fn , steps = 1 ) <nl> + self . assertLess ( scores [ ' loss ' ] , 0 . 2 ) <nl> + <nl> + def testRegression_TensorData ( self ) : <nl> + " " " Tests regression using tensor data as input . " " " <nl> + def _input_fn ( num_epochs = None ) : <nl> + features = { <nl> + ' age ' : tf . train . limit_epochs ( tf . constant ( [ [ 0 . 8 ] , [ 0 . 15 ] , [ 0 . ] ] ) , <nl> + num_epochs = num_epochs ) , <nl> + ' language ' : tf . SparseTensor ( values = [ ' en ' , ' fr ' , ' zh ' ] , <nl> + indices = [ [ 0 , 0 ] , [ 0 , 1 ] , [ 2 , 0 ] ] , <nl> + shape = [ 3 , 2 ] ) <nl> + } <nl> + return features , tf . constant ( [ 1 . 0 , 0 . , 0 . 2 ] , dtype = tf . float32 ) <nl> + <nl> + feature_columns = [ <nl> + tf . contrib . layers . sparse_column_with_hash_bucket ( ' language ' , <nl> + hash_bucket_size = 20 ) , <nl> + tf . contrib . layers . real_valued_column ( ' age ' ) <nl> + ] <nl> + <nl> + regressor = tf . contrib . learn . LinearRegressor ( <nl> + feature_columns = feature_columns , <nl> + config = tf . contrib . learn . RunConfig ( tf_random_seed = 1 ) ) <nl> + <nl> + regressor . fit ( input_fn = _input_fn , steps = 100 ) <nl> + <nl> + scores = regressor . evaluate ( input_fn = _input_fn , steps = 1 ) <nl> + self . assertLess ( scores [ ' loss ' ] , 0 . 2 ) <nl> + <nl> + def testLoss ( self ) : <nl> + " " " Tests loss calculation . " " " <nl> + <nl> + def _input_fn_train ( ) : <nl> + # Create 4 rows , one of them ( y = x ) , three of them ( y = Not ( x ) ) <nl> + # The algorithm should learn ( y = 0 . 25 ) . <nl> + target = tf . constant ( [ [ 1 . ] , [ 0 . ] , [ 0 . ] , [ 0 . ] ] ) <nl> + features = { <nl> + ' x ' : tf . ones ( shape = [ 4 , 1 ] , dtype = tf . float32 ) , <nl> + } <nl> + return features , target <nl> + <nl> + regressor = tf . contrib . learn . LinearRegressor ( <nl> + feature_columns = [ tf . contrib . layers . real_valued_column ( ' x ' ) ] , <nl> + config = tf . contrib . learn . RunConfig ( tf_random_seed = 1 ) ) <nl> + <nl> + regressor . fit ( input_fn = _input_fn_train , steps = 100 ) <nl> + scores = regressor . evaluate ( input_fn = _input_fn_train , steps = 1 ) <nl> + # Average square loss = ( 0 . 75 ^ 2 + 3 * 0 . 25 ^ 2 ) / 4 = 0 . 1875 <nl> + self . assertAlmostEqual ( scores [ ' loss ' ] , 0 . 1875 , delta = 0 . 1 ) <nl> + <nl> + def testLossWithWeights ( self ) : <nl> + " " " Tests loss calculation with weights . " " " <nl> + <nl> + def _input_fn_train ( ) : <nl> + # 4 rows with equal weight , one of them ( y = x ) , three of them ( y = Not ( x ) ) <nl> + # The algorithm should learn ( y = 0 . 25 ) . <nl> + target = tf . constant ( [ [ 1 . ] , [ 0 . ] , [ 0 . ] , [ 0 . ] ] ) <nl> + features = { <nl> + ' x ' : tf . ones ( shape = [ 4 , 1 ] , dtype = tf . float32 ) , <nl> + ' w ' : tf . constant ( [ [ 1 . ] , [ 1 . ] , [ 1 . ] , [ 1 . ] ] ) <nl> + } <nl> + return features , target <nl> + <nl> + def _input_fn_eval ( ) : <nl> + # 4 rows , with different weights . <nl> + target = tf . constant ( [ [ 1 . ] , [ 0 . ] , [ 0 . ] , [ 0 . ] ] ) <nl> + features = { <nl> + ' x ' : tf . ones ( shape = [ 4 , 1 ] , dtype = tf . float32 ) , <nl> + ' w ' : tf . constant ( [ [ 7 . ] , [ 1 . ] , [ 1 . ] , [ 1 . ] ] ) <nl> + } <nl> + return features , target <nl> + <nl> + regressor = tf . contrib . learn . LinearRegressor ( <nl> + weight_column_name = ' w ' , <nl> + feature_columns = [ tf . contrib . layers . real_valued_column ( ' x ' ) ] , <nl> + config = tf . contrib . learn . RunConfig ( tf_random_seed = 1 ) ) <nl> + <nl> + regressor . fit ( input_fn = _input_fn_train , steps = 100 ) <nl> + scores = regressor . evaluate ( input_fn = _input_fn_eval , steps = 1 ) <nl> + # Weighted average square loss = ( 7 * 0 . 75 ^ 2 + 3 * 0 . 25 ^ 2 ) / 10 = 0 . 4125 <nl> + self . assertAlmostEqual ( scores [ ' loss ' ] , 0 . 4125 , delta = 0 . 1 ) <nl> + <nl> + def testTrainWithWeights ( self ) : <nl> + " " " Tests training with given weight column . " " " <nl> + <nl> + def _input_fn_train ( ) : <nl> + # Create 4 rows , one of them ( y = x ) , three of them ( y = Not ( x ) ) <nl> + # First row has more weight than others . Model should fit ( y = x ) better <nl> + # than ( y = Not ( x ) ) due to the relative higher weight of the first row . <nl> + target = tf . constant ( [ [ 1 . ] , [ 0 . ] , [ 0 . ] , [ 0 . ] ] ) <nl> + features = { <nl> + ' x ' : tf . ones ( shape = [ 4 , 1 ] , dtype = tf . float32 ) , <nl> + ' w ' : tf . constant ( [ [ 100 . ] , [ 3 . ] , [ 2 . ] , [ 2 . ] ] ) <nl> + } <nl> + return features , target <nl> + <nl> + def _input_fn_eval ( ) : <nl> + # Create 4 rows ( y = x ) <nl> + target = tf . constant ( [ [ 1 . ] , [ 1 . ] , [ 1 . ] , [ 1 . ] ] ) <nl> + features = { <nl> + ' x ' : tf . ones ( shape = [ 4 , 1 ] , dtype = tf . float32 ) , <nl> + ' w ' : tf . constant ( [ [ 1 . ] , [ 1 . ] , [ 1 . ] , [ 1 . ] ] ) <nl> + } <nl> + return features , target <nl> + <nl> + regressor = tf . contrib . learn . LinearRegressor ( <nl> + weight_column_name = ' w ' , <nl> + feature_columns = [ tf . contrib . layers . real_valued_column ( ' x ' ) ] , <nl> + config = tf . contrib . learn . RunConfig ( tf_random_seed = 1 ) ) <nl> + <nl> + regressor . fit ( input_fn = _input_fn_train , steps = 100 ) <nl> + scores = regressor . evaluate ( input_fn = _input_fn_eval , steps = 1 ) <nl> + # The model should learn ( y = x ) because of the weights , so the loss should <nl> + # be close to zero . <nl> + self . assertLess ( scores [ ' loss ' ] , 0 . 1 ) <nl> + <nl> + def testPredict_AsIterableFalse ( self ) : <nl> + " " " Tests predict method with as_iterable = False . " " " <nl> + target = [ 1 . 0 , 0 . , 0 . 2 ] <nl> + def _input_fn ( num_epochs = None ) : <nl> + features = { <nl> + ' age ' : tf . train . limit_epochs ( tf . constant ( [ [ 0 . 8 ] , [ 0 . 15 ] , [ 0 . ] ] ) , <nl> + num_epochs = num_epochs ) , <nl> + ' language ' : tf . SparseTensor ( values = [ ' en ' , ' fr ' , ' zh ' ] , <nl> + indices = [ [ 0 , 0 ] , [ 0 , 1 ] , [ 2 , 0 ] ] , <nl> + shape = [ 3 , 2 ] ) <nl> + } <nl> + return features , tf . constant ( target , dtype = tf . float32 ) <nl> + <nl> + feature_columns = [ <nl> + tf . contrib . layers . sparse_column_with_hash_bucket ( ' language ' , <nl> + hash_bucket_size = 20 ) , <nl> + tf . contrib . layers . real_valued_column ( ' age ' ) <nl> + ] <nl> + <nl> + regressor = tf . contrib . learn . LinearRegressor ( <nl> + feature_columns = feature_columns , <nl> + config = tf . contrib . learn . RunConfig ( tf_random_seed = 1 ) ) <nl> + <nl> + regressor . fit ( input_fn = _input_fn , steps = 100 ) <nl> + <nl> + scores = regressor . evaluate ( input_fn = _input_fn , steps = 1 ) <nl> + self . assertLess ( scores [ ' loss ' ] , 0 . 1 ) <nl> + predictions = regressor . predict ( input_fn = _input_fn , as_iterable = False ) <nl> + self . assertAllClose ( predictions , target , atol = 0 . 1 ) <nl> + <nl> + def testPredict_AsIterable ( self ) : <nl> + " " " Tests predict method with as_iterable = True . " " " <nl> + target = [ 1 . 0 , 0 . , 0 . 2 ] <nl> + def _input_fn ( num_epochs = None ) : <nl> + features = { <nl> + ' age ' : tf . train . limit_epochs ( tf . constant ( [ [ 0 . 8 ] , [ 0 . 15 ] , [ 0 . ] ] ) , <nl> + num_epochs = num_epochs ) , <nl> + ' language ' : tf . SparseTensor ( values = [ ' en ' , ' fr ' , ' zh ' ] , <nl> + indices = [ [ 0 , 0 ] , [ 0 , 1 ] , [ 2 , 0 ] ] , <nl> + shape = [ 3 , 2 ] ) <nl> + } <nl> + return features , tf . constant ( target , dtype = tf . float32 ) <nl> + <nl> + feature_columns = [ <nl> + tf . contrib . layers . sparse_column_with_hash_bucket ( ' language ' , <nl> + hash_bucket_size = 20 ) , <nl> + tf . contrib . layers . real_valued_column ( ' age ' ) <nl> + ] <nl> + <nl> + regressor = tf . contrib . learn . LinearRegressor ( <nl> + feature_columns = feature_columns , <nl> + config = tf . contrib . learn . RunConfig ( tf_random_seed = 1 ) ) <nl> + <nl> + regressor . fit ( input_fn = _input_fn , steps = 100 ) <nl> + <nl> + scores = regressor . evaluate ( input_fn = _input_fn , steps = 1 ) <nl> + self . assertLess ( scores [ ' loss ' ] , 0 . 1 ) <nl> + predict_input_fn = functools . partial ( _input_fn , num_epochs = 1 ) <nl> + predictions = list ( <nl> + regressor . predict ( input_fn = predict_input_fn , as_iterable = True ) ) <nl> + self . assertAllClose ( predictions , target , atol = 0 . 1 ) <nl> + <nl> + def testCustomMetrics ( self ) : <nl> + " " " Tests custom evaluation metrics . " " " <nl> + def _input_fn_train ( ) : <nl> + # Create 4 rows , one of them ( y = x ) , three of them ( y = Not ( x ) ) <nl> + target = tf . constant ( [ [ 1 . ] , [ 0 . ] , [ 0 . ] , [ 0 . ] ] ) <nl> + features = { ' x ' : tf . ones ( shape = [ 4 , 1 ] , dtype = tf . float32 ) , } <nl> + return features , target <nl> + <nl> + def _my_metric_op ( predictions , targets ) : <nl> + return tf . reduce_sum ( tf . mul ( predictions , targets ) ) <nl> + <nl> + regressor = tf . contrib . learn . LinearRegressor ( <nl> + feature_columns = [ tf . contrib . layers . real_valued_column ( ' x ' ) ] , <nl> + config = tf . contrib . learn . RunConfig ( tf_random_seed = 1 ) ) <nl> + <nl> + regressor . fit ( input_fn = _input_fn_train , steps = 100 ) <nl> + scores = regressor . evaluate ( <nl> + input_fn = _input_fn_train , <nl> + steps = 1 , <nl> + metrics = { <nl> + ' my_error ' : tf . contrib . metrics . streaming_mean_squared_error , <nl> + ' my_metric ' : _my_metric_op <nl> + } ) <nl> + self . assertIn ( ' loss ' , set ( scores . keys ( ) ) ) <nl> + self . assertIn ( ' my_error ' , set ( scores . keys ( ) ) ) <nl> + self . assertIn ( ' my_metric ' , set ( scores . keys ( ) ) ) <nl> + predictions = regressor . predict ( input_fn = _input_fn_train ) <nl> + self . assertAlmostEqual ( <nl> + _sklearn . mean_squared_error ( np . array ( [ 1 , 0 , 0 , 0 ] ) , predictions ) , <nl> + scores [ ' my_error ' ] ) <nl> + <nl> + # Tests that when the key is a tuple , an error is raised . <nl> + with self . assertRaises ( TypeError ) : <nl> + regressor . evaluate ( <nl> + input_fn = _input_fn_train , <nl> + steps = 1 , <nl> + metrics = { ( ' my_error ' , ' predictions ' <nl> + ) : tf . contrib . metrics . streaming_mean_squared_error } ) <nl> + <nl> + def testTrainSaveLoad ( self ) : <nl> + " " " Tests that insures you can save and reload a trained model . " " " <nl> + def _input_fn ( num_epochs = None ) : <nl> + features = { <nl> + ' age ' : tf . train . limit_epochs ( tf . constant ( [ [ 0 . 8 ] , [ 0 . 15 ] , [ 0 . ] ] ) , <nl> + num_epochs = num_epochs ) , <nl> + ' language ' : tf . SparseTensor ( values = [ ' en ' , ' fr ' , ' zh ' ] , <nl> + indices = [ [ 0 , 0 ] , [ 0 , 1 ] , [ 2 , 0 ] ] , <nl> + shape = [ 3 , 2 ] ) <nl> + } <nl> + return features , tf . constant ( [ 1 . 0 , 0 . , 0 . 2 ] , dtype = tf . float32 ) <nl> + <nl> + feature_columns = [ <nl> + tf . contrib . layers . sparse_column_with_hash_bucket ( ' language ' , <nl> + hash_bucket_size = 20 ) , <nl> + tf . contrib . layers . real_valued_column ( ' age ' ) <nl> + ] <nl> + <nl> + model_dir = tempfile . mkdtemp ( ) <nl> + regressor = tf . contrib . learn . LinearRegressor ( <nl> + model_dir = model_dir , <nl> + feature_columns = feature_columns , <nl> + config = tf . contrib . learn . RunConfig ( tf_random_seed = 1 ) ) <nl> + <nl> + regressor . fit ( input_fn = _input_fn , steps = 100 ) <nl> + predict_input_fn = functools . partial ( _input_fn , num_epochs = 1 ) <nl> + predictions = list ( regressor . predict ( input_fn = predict_input_fn ) ) <nl> + del regressor <nl> + <nl> + regressor2 = tf . contrib . learn . LinearRegressor ( <nl> + model_dir = model_dir , <nl> + feature_columns = feature_columns ) <nl> + predictions2 = list ( regressor2 . predict ( input_fn = predict_input_fn ) ) <nl> + self . assertAllClose ( predictions , predictions2 ) <nl> + <nl> + def testTrainWithPartitionedVariables ( self ) : <nl> + " " " Tests training with partitioned variables . " " " <nl> + def _input_fn ( num_epochs = None ) : <nl> + features = { <nl> + ' age ' : tf . train . limit_epochs ( tf . constant ( [ [ 0 . 8 ] , [ 0 . 15 ] , [ 0 . ] ] ) , <nl> + num_epochs = num_epochs ) , <nl> + ' language ' : tf . SparseTensor ( values = [ ' en ' , ' fr ' , ' zh ' ] , <nl> + indices = [ [ 0 , 0 ] , [ 0 , 1 ] , [ 2 , 0 ] ] , <nl> + shape = [ 3 , 2 ] ) <nl> + } <nl> + return features , tf . constant ( [ 1 . 0 , 0 . , 0 . 2 ] , dtype = tf . float32 ) <nl> + <nl> + feature_columns = [ <nl> + # The given hash_bucket_size results in variables larger than the <nl> + # default min_slice_size attribute , so the variables are partitioned . <nl> + tf . contrib . layers . sparse_column_with_hash_bucket ( ' language ' , <nl> + hash_bucket_size = 2e7 ) , <nl> + tf . contrib . layers . real_valued_column ( ' age ' ) <nl> + ] <nl> + <nl> + regressor = tf . contrib . learn . LinearRegressor ( <nl> + feature_columns = feature_columns , <nl> + # Because we did not start a distributed cluster , we need to pass an <nl> + # empty ClusterSpec , otherwise the device_setter will look for <nl> + # distributed jobs , such as " / job : ps " which are not present . <nl> + config = tf . contrib . learn . RunConfig ( <nl> + num_ps_replicas = 2 , cluster_spec = tf . train . ClusterSpec ( { } ) , <nl> + tf_random_seed = 1 ) ) <nl> + <nl> + regressor . fit ( input_fn = _input_fn , steps = 100 ) <nl> + <nl> + scores = regressor . evaluate ( input_fn = _input_fn , steps = 1 ) <nl> + self . assertLess ( scores [ ' loss ' ] , 0 . 1 ) <nl> + <nl> + def testDisableCenteredBias ( self ) : <nl> + " " " Tests that we can disable centered bias . " " " <nl> + def _input_fn ( num_epochs = None ) : <nl> + features = { <nl> + ' age ' : tf . train . limit_epochs ( tf . constant ( [ [ 0 . 8 ] , [ 0 . 15 ] , [ 0 . ] ] ) , <nl> + num_epochs = num_epochs ) , <nl> + ' language ' : tf . SparseTensor ( values = [ ' en ' , ' fr ' , ' zh ' ] , <nl> + indices = [ [ 0 , 0 ] , [ 0 , 1 ] , [ 2 , 0 ] ] , <nl> + shape = [ 3 , 2 ] ) <nl> + } <nl> + return features , tf . constant ( [ 1 . 0 , 0 . , 0 . 2 ] , dtype = tf . float32 ) <nl> + <nl> + feature_columns = [ <nl> + tf . contrib . layers . sparse_column_with_hash_bucket ( ' language ' , <nl> + hash_bucket_size = 20 ) , <nl> + tf . contrib . layers . real_valued_column ( ' age ' ) <nl> + ] <nl> + <nl> + regressor = tf . contrib . learn . LinearRegressor ( <nl> + feature_columns = feature_columns , <nl> + enable_centered_bias = False , <nl> + config = tf . contrib . learn . RunConfig ( tf_random_seed = 1 ) ) <nl> + <nl> + regressor . fit ( input_fn = _input_fn , steps = 100 ) <nl> + <nl> + scores = regressor . evaluate ( input_fn = _input_fn , steps = 1 ) <nl> + self . assertLess ( scores [ ' loss ' ] , 0 . 1 ) <nl> + <nl> def testRecoverWeights ( self ) : <nl> rng = np . random . RandomState ( 67 ) <nl> n = 1000 <nl> def testRecoverWeights ( self ) : <nl> y + = rng . randn ( len ( x ) ) * 0 . 05 + rng . normal ( bias , 0 . 01 ) <nl> feature_columns = tf . contrib . learn . infer_real_valued_columns_from_input ( x ) <nl> regressor = tf . contrib . learn . LinearRegressor ( <nl> - feature_columns = feature_columns ) <nl> - regressor . fit ( x , y , batch_size = 32 , steps = 20000 ) <nl> + feature_columns = feature_columns , <nl> + optimizer = tf . train . FtrlOptimizer ( learning_rate = 0 . 8 ) ) <nl> + regressor . fit ( x , y , batch_size = 64 , steps = 2000 ) <nl> # Have to flatten weights since they come in ( x , 1 ) shape . <nl> self . assertAllClose ( weights , regressor . weights_ . flatten ( ) , rtol = 1 ) <nl> # TODO ( ispir ) : Disable centered_bias . <nl> mmm a / tensorflow / contrib / learn / python / learn / estimators / logistic_regressor . py <nl> ppp b / tensorflow / contrib / learn / python / learn / estimators / logistic_regressor . py <nl> def __init__ ( self , model_fn , thresholds = None , model_dir = None , config = None ) : <nl> thresholds : List of floating point thresholds to use for accuracy , <nl> precision , and recall metrics . If ` None ` , defaults to ` [ 0 . 5 ] ` . <nl> model_dir : Directory to save model parameters , graphs , etc . This can also <nl> - be used to load checkpoints from the directory into a estimator to continue <nl> - training a previously saved model . <nl> + be used to load checkpoints from the directory into a estimator to <nl> + continue training a previously saved model . <nl> config : A RunConfig configuration object . <nl> " " " <nl> if thresholds is None : <nl> mmm a / tensorflow / contrib / learn / python / learn / estimators / svm . py <nl> ppp b / tensorflow / contrib / learn / python / learn / estimators / svm . py <nl> class SVM ( trainable . Trainable , evaluable . Evaluable ) : <nl> " " " Support Vector Machine ( SVM ) model for binary classification . <nl> <nl> Currently , only linear SVMs are supported . For the underlying optimization <nl> - problem , the SDCAOptimizer is used . <nl> + problem , the ` SDCAOptimizer ` is used . For performance and convergence tuning , <nl> + the num_loss_partitions parameter passed to ` SDCAOptimizer ` ( see ` __init__ ( ) ` <nl> + method ) , should be set to ( # concurrent train ops per worker ) x ( # workers ) . If <nl> + num_loss_partitions is larger or equal to this value , convergence is <nl> + guaranteed but becomes slower as num_loss_partitions increases . If it is set <nl> + to a smaller value , the optimizer is more agressive in reducing the global <nl> + loss but convergence is not guaranteed . The recommended value in tf . learn <nl> + ( where there is one process per worker ) is the number of workers running the <nl> + train steps . It defaults to 1 ( single machine ) . <nl> <nl> Example Usage : <nl> - ` ` ` <nl> + ` ` ` python <nl> real_feature_column = real_valued_column ( . . . ) <nl> sparse_feature_column = sparse_column_with_hash_bucket ( . . . ) <nl> <nl> def input_fn_eval : # returns x , y <nl> whose ` value ` is a ` SparseTensor ` . <nl> - if ` column ` is a ` RealValuedColumn , a feature with ` key = column . name ` <nl> whose ` value ` is a ` Tensor ` . <nl> - <nl> - Parameters : <nl> - example_id_column : A string defining the feature column name representing <nl> - example ids . Used to initialize the underlying optimizer . <nl> - feature_columns : An iterable containing all the feature columns used by the <nl> - model . All items in the set should be instances of classes derived from <nl> - ` FeatureColumn ` . <nl> - weight_column_name : A string defining feature column name representing <nl> - weights . It is used to down weight or boost examples during training . It <nl> - will be multiplied by the loss of the example . <nl> - model_dir : Directory to save model parameters , graph and etc . This can also <nl> - be used to load checkpoints from the directory into a estimator to <nl> - continue training a previously saved model . <nl> - l1_regularization : L1 - regularization parameter . Refers to global L1 <nl> - regularization ( across all examples ) . <nl> - l2_regularization : L2 - regularization parameter . Refers to global L2 <nl> - regularization ( across all examples ) . <nl> - kernels : A list of kernels for the SVM . Currently , no kernels are supported . <nl> - Reserved for future use for non - linear SVMs <nl> - config : RunConfig object to configure the runtime settings . <nl> " " " <nl> <nl> def __init__ ( self , <nl> def __init__ ( self , <nl> model_dir = None , <nl> l1_regularization = 0 . 0 , <nl> l2_regularization = 0 . 0 , <nl> + num_loss_partitions = 1 , <nl> kernels = None , <nl> config = None ) : <nl> + " " " Constructs a ` SVM ~ estimator object . <nl> + <nl> + Args : <nl> + example_id_column : A string defining the feature column name representing <nl> + example ids . Used to initialize the underlying optimizer . <nl> + feature_columns : An iterable containing all the feature columns used by <nl> + the model . All items in the set should be instances of classes derived <nl> + from ` FeatureColumn ` . <nl> + weight_column_name : A string defining feature column name representing <nl> + weights . It is used to down weight or boost examples during training . It <nl> + will be multiplied by the loss of the example . <nl> + model_dir : Directory to save model parameters , graph and etc . This can <nl> + also be used to load checkpoints from the directory into a estimator to <nl> + continue training a previously saved model . <nl> + l1_regularization : L1 - regularization parameter . Refers to global L1 <nl> + regularization ( across all examples ) . <nl> + l2_regularization : L2 - regularization parameter . Refers to global L2 <nl> + regularization ( across all examples ) . <nl> + num_loss_partitions : number of partitions of the ( global ) loss function <nl> + optimized by the underlying optimizer ( SDCAOptimizer ) . <nl> + kernels : A list of kernels for the SVM . Currently , no kernels are <nl> + supported . Reserved for future use for non - linear SVMs . <nl> + config : RunConfig object to configure the runtime settings . <nl> + <nl> + Raises : <nl> + ValueError : if kernels passed is not None . <nl> + " " " <nl> if kernels is not None : <nl> raise ValueError ( " Kernel SVMs are not currently supported . " ) <nl> self . _optimizer = sdca_optimizer . SDCAOptimizer ( <nl> example_id_column = example_id_column , <nl> + num_loss_partitions = num_loss_partitions , <nl> symmetric_l1_regularization = l1_regularization , <nl> symmetric_l2_regularization = l2_regularization ) <nl> <nl> mmm a / tensorflow / contrib / learn / python / learn / experiment . py <nl> ppp b / tensorflow / contrib / learn / python / learn / experiment . py <nl> def train ( self , delay_secs = None ) : <nl> # we ( optionally ) sleep for the case where no device_filters are set . <nl> # Otherwise , the servers will wait to connect to each other before starting <nl> # to train . We might as well start as soon as we can . <nl> - if self . _estimator . config . cluster_spec : <nl> + if self . _estimator . config . cluster_spec and self . _estimator . config . master : <nl> self . _start_server ( ) <nl> <nl> if delay_secs is None : <nl> mmm a / tensorflow / contrib / learn / python / learn / graph_actions . py <nl> ppp b / tensorflow / contrib / learn / python / learn / graph_actions . py <nl> def _monitored_train ( graph , <nl> saver = tf_saver . Saver ( <nl> sharded = True , max_to_keep = keep_checkpoint_max , defer_build = True ) ) <nl> <nl> - if supervisor_is_chief : <nl> - # See question about adding the summary writer to the scaffold . <nl> + if not supervisor_is_chief : <nl> + session_creator = monitored_session . WorkerSessionCreator ( <nl> + scaffold = scaffold , <nl> + master = supervisor_master ) <nl> + else : <nl> + session_creator = monitored_session . ChiefSessionCreator ( <nl> + scaffold = scaffold , <nl> + checkpoint_dir = output_dir , <nl> + master = supervisor_master ) <nl> summary_writer = summary_writer_cache . SummaryWriterCache . get ( output_dir ) <nl> all_hooks . append ( <nl> basic_session_run_hooks . StepCounterHook ( <nl> def _monitored_train ( graph , <nl> all_hooks . extend ( hooks ) <nl> <nl> with monitored_session . MonitoredSession ( <nl> - supervisor_master , <nl> - is_chief = supervisor_is_chief , <nl> - checkpoint_dir = output_dir , <nl> - hooks = all_hooks , <nl> - scaffold = scaffold ) as super_sess : <nl> + session_creator = session_creator , <nl> + hooks = all_hooks ) as super_sess : <nl> loss = None <nl> while not super_sess . should_stop ( ) : <nl> _ , loss = super_sess . run ( [ train_op , loss_op ] , feed_fn ( ) if feed_fn else <nl> mmm a / tensorflow / contrib / learn / python / learn / learn_io / graph_io . py <nl> ppp b / tensorflow / contrib / learn / python / learn / learn_io / graph_io . py <nl> def read_keyed_batch_features ( file_pattern , <nl> queue_capacity = 10000 , <nl> reader_num_threads = 1 , <nl> feature_queue_capacity = 100 , <nl> - num_queue_runners = 2 , <nl> + num_enqueue_threads = 2 , <nl> parser_num_threads = None , <nl> parse_fn = None , <nl> name = None ) : <nl> def read_keyed_batch_features ( file_pattern , <nl> queue_capacity : Capacity for input queue . <nl> reader_num_threads : The number of threads to read examples . <nl> feature_queue_capacity : Capacity of the parsed features queue . <nl> - num_queue_runners : Number of queue runners to start for the feature queue , <nl> - Adding multiple queue runners for the parsed example queue helps maintain <nl> + num_enqueue_threads : Number of threads to enqueue the parsed example queue . <nl> + Using multiple threads to enqueue the parsed example queue helps maintain <nl> a full queue when the subsequent computations overall are cheaper than <nl> parsing . <nl> parser_num_threads : ( Deprecated ) The number of threads to parse examples . <nl> def read_keyed_batch_features ( file_pattern , <nl> feature_map , <nl> keys = keys , <nl> feature_queue_capacity = feature_queue_capacity , <nl> - num_queue_runners = num_queue_runners , <nl> + num_enqueue_threads = num_enqueue_threads , <nl> name = scope ) <nl> <nl> <nl> def queue_parsed_features ( parsed_features , <nl> keys = None , <nl> feature_queue_capacity = 100 , <nl> - num_queue_runners = 2 , <nl> + num_enqueue_threads = 2 , <nl> name = None ) : <nl> " " " Speeds up parsing by using queues to do it asynchronously . <nl> <nl> def queue_parsed_features ( parsed_features , <nl> parsed_features : A dict of string key to ` Tensor ` or ` SparseTensor ` objects . <nl> keys : ` Tensor ` of string keys . <nl> feature_queue_capacity : Capacity of the parsed features queue . <nl> - num_queue_runners : Number of queue runners to start for the feature queue , <nl> - Adding multiple queue runners for the parsed example queue helps maintain <nl> + num_enqueue_threads : Number of threads to enqueue the parsed example queue . <nl> + Using multiple thrads to enqueue the parsed example queue helps maintain <nl> a full queue when the subsequent computations overall are cheaper than <nl> parsing . <nl> name : Name of resulting op . <nl> def queue_parsed_features ( parsed_features , <nl> math_ops . cast ( input_queue . size ( ) , dtypes . float32 ) <nl> * ( 1 . / feature_queue_capacity ) ) <nl> <nl> - # Add multiple queue runners so that the queue is always full . Adding more <nl> - # than two queue - runners may hog the cpu on the worker to fill up the queue . <nl> - for _ in range ( num_queue_runners ) : <nl> - queue_runner . add_queue_runner ( <nl> - queue_runner . QueueRunner ( <nl> - input_queue , [ input_queue . enqueue ( tensors_to_enqueue ) ] , <nl> - queue_closed_exception_types = ( errors . OutOfRangeError , <nl> - errors . CancelledError ) ) ) <nl> + # Use multiple threads to enqueue so the queue is always full . Adding more <nl> + # than two threads may hog the cpu on the worker to fill up the queue . <nl> + enqueue_ops = [ input_queue . enqueue ( tensors_to_enqueue ) <nl> + for _ in range ( num_enqueue_threads ) ] <nl> + queue_runner . add_queue_runner ( queue_runner . QueueRunner ( <nl> + input_queue , enqueue_ops , <nl> + queue_closed_exception_types = ( errors . OutOfRangeError , <nl> + errors . CancelledError ) ) ) <nl> <nl> dequeued_tensors = input_queue . dequeue ( ) <nl> <nl> mmm a / tensorflow / contrib / learn / python / learn / monitored_session . py <nl> ppp b / tensorflow / contrib / learn / python / learn / monitored_session . py <nl> <nl> from __future__ import division <nl> from __future__ import print_function <nl> <nl> + import abc <nl> + <nl> from tensorflow . contrib . learn . python . learn import session_run_hook <nl> - from tensorflow . contrib . learn . python . learn import summary_writer_cache <nl> from tensorflow . python . framework import errors <nl> from tensorflow . python . framework import ops <nl> from tensorflow . python . ops import control_flow_ops <nl> <nl> from tensorflow . python . training import queue_runner <nl> from tensorflow . python . training import saver as training_saver <nl> from tensorflow . python . training import session_manager as sm <nl> - from tensorflow . python . training import training_util <nl> <nl> <nl> # TODO ( touts ) : Share that with the Supervisor . <nl> def finalize ( self ) : <nl> self . _saver . build ( ) <nl> <nl> ops . get_default_graph ( ) . finalize ( ) <nl> + return self <nl> <nl> @ property <nl> def init_fn ( self ) : <nl> def _default_local_init_op ( ) : <nl> data_flow_ops . initialize_all_tables ( ) ) <nl> <nl> <nl> + class SessionCreator ( object ) : <nl> + " " " A factory for tf . Session . " " " <nl> + <nl> + @ abc . abstractmethod <nl> + def create_session ( self ) : <nl> + raise NotImplementedError ( <nl> + ' create_session is not implemented for { } . ' . format ( self ) ) <nl> + <nl> + <nl> + class ChiefSessionCreator ( SessionCreator ) : <nl> + " " " Creates a tf . Session for a chief . " " " <nl> + <nl> + def __init__ ( self , scaffold = None , master = ' ' , config = None , <nl> + checkpoint_dir = None ) : <nl> + " " " Initializes a chief session creator . <nl> + <nl> + Args : <nl> + scaffold : A ` Scaffold ` used for gathering or building supportive ops . If <nl> + not specified a default one is created . It ' s used to finalize the graph . <nl> + master : ` String ` representation of the TensorFlow master to use . <nl> + config : ` ConfigProto ` proto used to configure the session . <nl> + checkpoint_dir : A string . Optional path to a directory where to restore <nl> + variables . <nl> + " " " <nl> + self . _checkpoint_dir = checkpoint_dir <nl> + self . _scaffold = scaffold or Scaffold ( ) <nl> + self . _session_manager = None <nl> + self . _master = master <nl> + self . _config = config <nl> + <nl> + def _get_session_manager ( self ) : <nl> + if self . _session_manager : <nl> + return self . _session_manager <nl> + <nl> + self . _session_manager = sm . SessionManager ( <nl> + local_init_op = self . _scaffold . local_init_op , <nl> + ready_op = self . _scaffold . ready_op , <nl> + graph = ops . get_default_graph ( ) ) <nl> + return self . _session_manager <nl> + <nl> + def create_session ( self ) : <nl> + self . _scaffold . finalize ( ) <nl> + return self . _get_session_manager ( ) . prepare_session ( <nl> + self . _master , <nl> + saver = self . _scaffold . saver , <nl> + checkpoint_dir = self . _checkpoint_dir , <nl> + config = self . _config , <nl> + init_op = self . _scaffold . init_op , <nl> + init_feed_dict = self . _scaffold . init_feed_dict , <nl> + init_fn = self . _scaffold . init_fn ) <nl> + <nl> + <nl> + class WorkerSessionCreator ( SessionCreator ) : <nl> + " " " Creates a tf . Session for a worker . " " " <nl> + <nl> + def __init__ ( self , scaffold = None , master = ' ' , config = None ) : <nl> + " " " Initializes a worker session creator . <nl> + <nl> + Args : <nl> + scaffold : A ` Scaffold ` used for gathering or building supportive ops . If <nl> + not specified a default one is created . It ' s used to finalize the graph . <nl> + master : ` String ` representation of the TensorFlow master to use . <nl> + config : ` ConfigProto ` proto used to configure the session . <nl> + " " " <nl> + self . _scaffold = scaffold or Scaffold ( ) <nl> + self . _session_manager = None <nl> + self . _master = master <nl> + self . _config = config <nl> + <nl> + def _get_session_manager ( self ) : <nl> + if self . _session_manager : <nl> + return self . _session_manager <nl> + <nl> + self . _session_manager = sm . SessionManager ( <nl> + local_init_op = self . _scaffold . local_init_op , <nl> + ready_op = self . _scaffold . ready_op , <nl> + graph = ops . get_default_graph ( ) ) <nl> + return self . _session_manager <nl> + <nl> + def create_session ( self ) : <nl> + self . _scaffold . finalize ( ) <nl> + return self . _get_session_manager ( ) . wait_for_session ( <nl> + self . _master , config = self . _config ) <nl> + <nl> + <nl> class MonitoredSession ( object ) : <nl> " " " Session - like object that handles initialization , recovery and hooks . <nl> <nl> class MonitoredSession ( object ) : <nl> processed if the monitored_session is used as a context . <nl> " " " <nl> <nl> - def __init__ ( self , <nl> - master = ' ' , <nl> - is_chief = True , <nl> - checkpoint_dir = None , <nl> - hooks = None , <nl> - scaffold = None , <nl> - config = None ) : <nl> + def __init__ ( self , session_creator = None , hooks = None ) : <nl> " " " Creates a MonitoredSession . <nl> <nl> Args : <nl> - master : ` String ` representation of the TensorFlow master to use . <nl> - is_chief : If True , it will take care of initialization and recovery the <nl> - underlying TensorFlow session . If False , it will wait on a chief to <nl> - initialize or recover the TensorFlow session . <nl> - checkpoint_dir : A string . Optional path to a directory where to restore <nl> - variables . <nl> + session_creator : A factory object to create session . <nl> hooks : An iterable of ` SessionRunHook ' objects . <nl> - scaffold : A ` Scaffold ` used for gathering or building supportive ops . If <nl> - not specified a default one is created . It ' s used to finalize the graph . <nl> - config : ` ConfigProto ` proto used to configure the session . <nl> " " " <nl> - self . _graph = ops . get_default_graph ( ) <nl> - self . _master = master <nl> - self . _checkpoint_dir = checkpoint_dir <nl> - self . _is_chief = is_chief <nl> - self . _config = config <nl> self . _hooks = hooks or [ ] <nl> - self . _scaffold = scaffold or Scaffold ( ) <nl> - self . _coord = None <nl> for h in self . _hooks : <nl> h . begin ( ) <nl> # Create the session . <nl> - self . _scaffold . finalize ( ) <nl> - self . _session_manager = sm . SessionManager ( <nl> - local_init_op = self . _scaffold . local_init_op , <nl> - ready_op = self . _scaffold . ready_op , <nl> - graph = ops . get_default_graph ( ) ) <nl> - self . _sess = _RecoverableSession ( self . _create_session ) <nl> - self . write_graph ( ) <nl> - <nl> - def _create_session ( self ) : <nl> - " " " Factory for the _RecoverableSession . <nl> - <nl> - Returns : <nl> - A session , initialized or recovered as needed . <nl> - " " " <nl> - if self . _is_chief : <nl> - tf_sess = self . _session_manager . prepare_session ( <nl> - self . _master , <nl> - saver = self . _scaffold . saver , <nl> - checkpoint_dir = self . _checkpoint_dir , <nl> - config = self . _config , <nl> - init_op = self . _scaffold . init_op , <nl> - init_feed_dict = self . _scaffold . init_feed_dict , <nl> - init_fn = self . _scaffold . init_fn ) <nl> - else : <nl> - tf_sess = self . _session_manager . wait_for_session ( <nl> - self . _master , config = self . _config ) <nl> - # Keep the tf_sess for quick runs of global step when needed . <nl> - self . _tf_sess = tf_sess <nl> - # We don ' t want coordinator to suppress any exception . <nl> - self . _coord = coordinator . Coordinator ( clean_stop_exception_types = [ ] ) <nl> - queue_runner . start_queue_runners ( sess = tf_sess , coord = self . _coord ) <nl> - return _CoordinatedSession ( _HookedSession ( tf_sess , self . _hooks ) , <nl> - self . _coord ) <nl> + self . _coordinated_creator = self . _CoordinatedSessionCreator ( <nl> + session_creator = session_creator or ChiefSessionCreator ( ) , <nl> + hooks = self . _hooks ) <nl> + self . _sess = _RecoverableSession ( self . _coordinated_creator ) <nl> <nl> @ property <nl> - def scaffold ( self ) : <nl> - return self . _scaffold <nl> + def graph ( self ) : <nl> + " " " The graph that was launched in this session . " " " <nl> + if self . _coordinated_creator . tf_sess is None : <nl> + return None <nl> + return self . _coordinated_creator . tf_sess . graph <nl> <nl> def run ( self , fetches , feed_dict = None , options = None , run_metadata = None ) : <nl> " " " Run ops in the monitored session . <nl> def should_stop ( self ) : <nl> def close ( self ) : <nl> self . _close_internal ( ) <nl> <nl> + def __enter__ ( self ) : <nl> + return self <nl> + <nl> + def __exit__ ( self , exception_type , exception_value , traceback ) : <nl> + if exception_type in [ errors . OutOfRangeError , StopIteration ] : <nl> + exception_type = None <nl> + self . _close_internal ( exception_type ) <nl> + # __exit__ should return True to suppress an exception . <nl> + return exception_type is None <nl> + <nl> + class _CoordinatedSessionCreator ( object ) : <nl> + " " " Factory for the _RecoverableSession . " " " <nl> + <nl> + def __init__ ( self , session_creator , hooks ) : <nl> + self . _session_creator = session_creator <nl> + self . _hooks = hooks <nl> + self . coord = None <nl> + self . tf_sess = None <nl> + <nl> + def create_session ( self ) : <nl> + " " " Creates a coordinated session . " " " <nl> + # Keep the tf_sess for unit testing . <nl> + self . tf_sess = self . _session_creator . create_session ( ) <nl> + # We don ' t want coordinator to suppress any exception . <nl> + self . coord = coordinator . Coordinator ( clean_stop_exception_types = [ ] ) <nl> + queue_runner . start_queue_runners ( sess = self . tf_sess , coord = self . coord ) <nl> + return _CoordinatedSession ( <nl> + _HookedSession ( self . tf_sess , self . _hooks ) , self . coord ) <nl> + <nl> def _close_internal ( self , exception_type = None ) : <nl> try : <nl> if not exception_type : <nl> for h in self . _hooks : <nl> - h . end ( self . _tf_sess ) <nl> + h . end ( self . _coordinated_creator . tf_sess ) <nl> finally : <nl> try : <nl> self . _sess . close ( ) <nl> finally : <nl> self . _sess = None <nl> - self . _tf_sess = None <nl> - self . _coord = None <nl> + self . _coordinated_creator . tf_sess = None <nl> + self . _coordinated_creator . coord = None <nl> <nl> def _is_closed ( self ) : <nl> " " " Return True if the supervised session is closed . For tests only . <nl> def _is_closed ( self ) : <nl> Returns : <nl> A boolean . <nl> " " " <nl> - return self . _tf_sess is None <nl> - <nl> - def __enter__ ( self ) : <nl> - return self <nl> - <nl> - def __exit__ ( self , exception_type , exception_value , traceback ) : <nl> - if exception_type in [ errors . OutOfRangeError , StopIteration ] : <nl> - exception_type = None <nl> - self . _close_internal ( exception_type ) <nl> - # __exit__ should return True to suppress an exception . <nl> - return exception_type is None <nl> - <nl> - def write_graph ( self ) : <nl> - " " " Saves current graph . " " " <nl> - if self . _checkpoint_dir is not None and self . _is_chief : <nl> - summary_writer = summary_writer_cache . SummaryWriterCache . get ( <nl> - self . _checkpoint_dir ) <nl> - training_util . write_graph ( <nl> - self . _graph . as_graph_def ( add_shapes = True ) , <nl> - self . _checkpoint_dir , <nl> - ' graph . pbtxt ' ) <nl> - summary_writer . add_graph ( self . _graph ) <nl> + return self . _coordinated_creator . tf_sess is None <nl> <nl> <nl> class _WrappedSession ( object ) : <nl> def run ( self , * args , * * kwargs ) : <nl> class _RecoverableSession ( _WrappedSession ) : <nl> " " " A wrapped session that recreates a session on ` tf . errors . AbortedError ` . <nl> <nl> - The constructor is passed a session _factory_ , not a session . The factory is <nl> - a no - argument function that must return a ` Session ` . <nl> + The constructor is passed a SessionCreator object , not a session . <nl> <nl> Calls to ` run ( ) ` are delegated to the wrapped session . If a call raises the <nl> exception ` tf . errors . AbortedError ` , the wrapped session is closed , and a new <nl> one is created by calling the factory again . <nl> " " " <nl> <nl> - def __init__ ( self , sess_factory ) : <nl> + def __init__ ( self , sess_creator ) : <nl> " " " Create a new ` _RecoverableSession ` . <nl> <nl> - The value returned by calling ` sess_factory ( ) ` will be the <nl> + The value returned by calling ` sess_creator . create_session ( ) ` will be the <nl> session wrapped by this recoverable session . <nl> <nl> Args : <nl> - sess_factory : A callable with no arguments that returns a <nl> - ` tf . Session ` when called . <nl> + sess_creator : A ' SessionCreator ' to be wrapped by recoverable . <nl> " " " <nl> - self . _factory = sess_factory <nl> - _WrappedSession . __init__ ( self , sess_factory ( ) ) <nl> + self . _sess_creator = sess_creator <nl> + _WrappedSession . __init__ ( self , self . _sess_creator . create_session ( ) ) <nl> <nl> def run ( self , fetches , feed_dict = None , options = None , run_metadata = None ) : <nl> while True : <nl> try : <nl> if not self . _sess : <nl> - self . _sess = self . _factory ( ) <nl> + self . _sess = self . _sess_creator . create_session ( ) <nl> return self . _sess . run ( fetches , <nl> feed_dict = feed_dict , <nl> options = options , <nl> mmm a / tensorflow / contrib / learn / python / learn / monitors . py <nl> ppp b / tensorflow / contrib / learn / python / learn / monitors . py <nl> def step_begin ( self , step ) : <nl> step = = self . _max_steps ) : # Note : max_steps can be None here . <nl> self . _every_n_step_begin_called = True <nl> return self . every_n_step_begin ( step ) <nl> - else : <nl> - self . _every_n_step_begin_called = False <nl> + self . _every_n_step_begin_called = False <nl> return [ ] <nl> <nl> def step_end ( self , step , output ) : <nl> def every_n_step_end ( self , step , outputs ) : <nl> self . _latest_path_step = step <nl> <nl> # Run evaluation and log it . <nl> - outputs = self . _estimator . evaluate ( <nl> + validation_outputs = self . _estimator . evaluate ( <nl> x = self . x , y = self . y , input_fn = self . input_fn , batch_size = self . batch_size , <nl> steps = self . eval_steps , metrics = self . metrics , name = self . name ) <nl> stats = [ ] <nl> - for name in outputs : <nl> - stats . append ( " % s = % s " % ( name , str ( outputs [ name ] ) ) ) <nl> + for name in validation_outputs : <nl> + stats . append ( " % s = % s " % ( name , str ( validation_outputs [ name ] ) ) ) <nl> logging . info ( " Validation ( step % d ) : % s " , step , " , " . join ( stats ) ) <nl> <nl> # Early stopping logic . <nl> if self . early_stopping_rounds is not None : <nl> - current_value = outputs [ self . early_stopping_metric ] <nl> + if self . early_stopping_metric not in validation_outputs : <nl> + raise ValueError ( " Metric % s missing from outputs % s . " % ( <nl> + self . early_stopping_metric , set ( validation_outputs . keys ( ) ) ) ) <nl> + current_value = validation_outputs [ self . early_stopping_metric ] <nl> if ( self . _best_value is None or ( self . early_stopping_metric_minimize and <nl> ( current_value < self . _best_value ) ) or <nl> ( not self . early_stopping_metric_minimize and <nl> def __init__ ( self , <nl> ValueError : If both ` save_steps ` and ` save_secs ` are not ` None ` . <nl> ValueError : If both ` save_steps ` and ` save_secs ` are ` None ` . <nl> " " " <nl> - logging . info ( " Create CheckpointSaver " ) <nl> + logging . info ( " Create CheckpointSaver . " ) <nl> super ( CheckpointSaver , self ) . __init__ ( ) <nl> self . _saver = saver <nl> self . _summary_writer = SummaryWriterCache . get ( checkpoint_dir ) <nl> deleted file mode 100644 <nl> index ba9ab5277f491 . . 0000000000000 <nl> mmm a / tensorflow / contrib / learn / python / learn / tests / early_stopping_test . py <nl> ppp / dev / null <nl> <nl> - # Copyright 2016 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> - " " " Early stopping tests . " " " <nl> - <nl> - from __future__ import absolute_import <nl> - from __future__ import division <nl> - from __future__ import print_function <nl> - <nl> - import random <nl> - import tensorflow as tf <nl> - <nl> - from tensorflow . contrib . learn . python import learn <nl> - from tensorflow . contrib . learn . python . learn import datasets <nl> - from tensorflow . contrib . learn . python . learn . estimators . _sklearn import accuracy_score <nl> - from tensorflow . contrib . learn . python . learn . estimators . _sklearn import train_test_split <nl> - <nl> - <nl> - def _get_summary_events ( folder ) : <nl> - if not tf . gfile . Exists ( folder ) : <nl> - raise ValueError ( ' Folder % s doesn \ ' t exist . ' % folder ) <nl> - return tf . contrib . testing . latest_summaries ( folder ) <nl> - <nl> - <nl> - class EarlyStoppingTest ( tf . test . TestCase ) : <nl> - " " " Early stopping tests . " " " <nl> - <nl> - def testIrisES ( self ) : <nl> - random . seed ( 42 ) <nl> - <nl> - iris = datasets . load_iris ( ) <nl> - x_train , x_test , y_train , y_test = train_test_split ( <nl> - iris . data , iris . target , test_size = 0 . 2 , random_state = 42 ) <nl> - <nl> - x_train , x_val , y_train , y_val = train_test_split ( <nl> - x_train , y_train , test_size = 0 . 2 , random_state = 42 ) <nl> - val_monitor = learn . monitors . ValidationMonitor ( <nl> - x_val , y_val , every_n_steps = 50 , early_stopping_rounds = 100 , <nl> - early_stopping_metric = ' loss ' , early_stopping_metric_minimize = False ) <nl> - <nl> - feature_columns = learn . infer_real_valued_columns_from_input ( iris . data ) <nl> - <nl> - # classifier without early stopping - overfitting <nl> - classifier1 = learn . DNNClassifier ( <nl> - feature_columns = feature_columns , hidden_units = [ 10 , 20 , 10 ] , n_classes = 3 ) <nl> - classifier1 . fit ( x_train , y_train , steps = 1000 ) <nl> - _ = accuracy_score ( y_test , classifier1 . predict ( x_test ) ) <nl> - <nl> - # Full 1000 steps , 19 summaries and no evaluation summary : <nl> - # 1 summary of net at step 1 <nl> - # 9 x ( 1 summary of net and 1 summary of global step ) for steps 101 , 201 , . . . <nl> - self . assertEqual ( 19 , len ( _get_summary_events ( classifier1 . model_dir ) ) ) <nl> - with self . assertRaises ( ValueError ) : <nl> - _get_summary_events ( classifier1 . model_dir + ' / eval ' ) <nl> - <nl> - # classifier with early stopping - improved accuracy on testing set <nl> - classifier2 = learn . DNNClassifier ( <nl> - hidden_units = [ 10 , 20 , 10 ] , feature_columns = feature_columns , n_classes = 3 , <nl> - config = tf . contrib . learn . RunConfig ( save_checkpoints_secs = 1 ) ) <nl> - <nl> - classifier2 . fit ( x_train , y_train , monitors = [ val_monitor ] , steps = 2000 ) <nl> - _ = accuracy_score ( y_val , classifier2 . predict ( x_val ) ) <nl> - _ = accuracy_score ( y_test , classifier2 . predict ( x_test ) ) <nl> - <nl> - # Note , this test is unstable , so not checking for equality . <nl> - # See stability_test for examples of stability issues . <nl> - if val_monitor . early_stopped : <nl> - self . assertLess ( val_monitor . best_step , 2000 ) <nl> - # Note , due to validation monitor stopping after the best score occur , <nl> - # the accuracy at current checkpoint is less . <nl> - # TODO ( ipolosukhin ) : Time machine for restoring old checkpoints ? <nl> - # flaky , still not always best_value better then score2 value . <nl> - # self . assertGreater ( val_monitor . best_value , score2_val ) <nl> - <nl> - # Early stopped , unstable so checking only < then max . <nl> - self . assertLess ( len ( _get_summary_events ( classifier2 . model_dir ) ) , 21 ) <nl> - # Eval typically has ~ 6 events , but it varies based on the run . <nl> - self . assertLess ( len ( _get_summary_events ( <nl> - classifier2 . model_dir + ' / eval ' ) ) , 8 ) <nl> - <nl> - # TODO ( ipolosukhin ) : Restore this ? <nl> - # self . assertGreater ( score2 , score1 , " No improvement using early stopping . " ) <nl> - <nl> - <nl> - if __name__ = = ' __main__ ' : <nl> - tf . test . main ( ) <nl> mmm a / tensorflow / contrib / learn / python / learn / tests / experiment_test . py <nl> ppp b / tensorflow / contrib / learn / python / learn / tests / experiment_test . py <nl> def test_train_server_does_not_start_without_cluster_spec ( self , mock_server ) : <nl> # The server should not have started because there was no ClusterSpec . <nl> self . assertFalse ( mock_server . called ) <nl> <nl> + @ tf . test . mock . patch ( ' tensorflow . python . training . server_lib . Server ' ) # pylint : disable = line - too - long <nl> + def test_train_server_does_not_start_with_empty_master ( self , mock_server ) : <nl> + config = tf . contrib . learn . RunConfig ( <nl> + cluster_spec = tf . train . ClusterSpec ( <nl> + { ' ps ' : [ ' host1 : 2222 ' , ' host2 : 2222 ' ] , <nl> + ' worker ' : [ ' host3 : 2222 ' , ' host4 : 2222 ' , ' host5 : 2222 ' ] } <nl> + ) , <nl> + master = ' ' , ) <nl> + ex = tf . contrib . learn . Experiment ( TestEstimator ( config ) , <nl> + train_input_fn = ' train_input ' , <nl> + eval_input_fn = ' eval_input ' ) <nl> + ex . train ( ) <nl> + <nl> + # The server should not have started because master was the empty string . <nl> + self . assertFalse ( mock_server . called ) <nl> + <nl> def test_train_raises_if_job_name_is_missing ( self ) : <nl> no_job_name = tf . contrib . learn . RunConfig ( <nl> cluster_spec = tf . train . ClusterSpec ( <nl> { ' ps ' : [ ' host1 : 2222 ' , ' host2 : 2222 ' ] , <nl> - ' worker ' : [ ' host3 : 2222 ' , ' host4 : 2222 ' , ' host5 : 2222 ' ] } <nl> + ' worker ' : [ ' host3 : 2222 ' , ' host4 : 2222 ' , ' host5 : 2222 ' ] } , <nl> ) , <nl> task = 1 , <nl> + master = ' host3 : 2222 ' , # Normally selected by job_name <nl> ) <nl> with self . assertRaises ( ValueError ) : <nl> ex = tf . contrib . learn . Experiment ( TestEstimator ( no_job_name ) , <nl> mmm a / tensorflow / contrib / learn / python / learn / tests / monitored_session_test . py <nl> ppp b / tensorflow / contrib / learn / python / learn / tests / monitored_session_test . py <nl> def run ( self , * args , * * kwargs ) : <nl> class RecoverableSessionTest ( tf . test . TestCase ) : <nl> " " " _RecoverableSession tests . " " " <nl> <nl> + class _SessionReturner ( object ) : <nl> + <nl> + def __init__ ( self , sess ) : <nl> + self . _sess = sess <nl> + <nl> + def create_session ( self ) : <nl> + return self . _sess <nl> + <nl> def test_properties ( self ) : <nl> with self . test_session ( ) as sess : <nl> tf . constant ( 0 . 0 ) <nl> - recoverable_sess = monitored_session . _RecoverableSession ( lambda : sess ) <nl> + recoverable_sess = monitored_session . _RecoverableSession ( <nl> + self . _SessionReturner ( sess ) ) <nl> self . assertEquals ( sess . graph , recoverable_sess . graph ) <nl> self . assertEquals ( sess . sess_str , recoverable_sess . sess_str ) <nl> <nl> def test_run ( self ) : <nl> with self . test_session ( ) as sess : <nl> c = tf . constant ( 0 ) <nl> v = tf . identity ( c ) <nl> - recoverable_sess = monitored_session . _RecoverableSession ( lambda : sess ) <nl> + recoverable_sess = monitored_session . _RecoverableSession ( <nl> + self . _SessionReturner ( sess ) ) <nl> self . assertEqual ( 51 , recoverable_sess . run ( v , feed_dict = { c : 51 } ) ) <nl> <nl> def test_recovery ( self ) : <nl> with self . test_session ( ) as sess : <nl> + <nl> + class StackSessionCreator ( object ) : <nl> + <nl> + def __init__ ( self , sess ) : <nl> + self . sessions_to_use = [ <nl> + AbortAtNSession ( sess , x + 1 ) for x in range ( 3 ) <nl> + ] <nl> + <nl> + def create_session ( self ) : <nl> + return self . sessions_to_use . pop ( 0 ) <nl> + <nl> c = tf . constant ( 0 ) <nl> v = tf . identity ( c ) <nl> + session_creator = StackSessionCreator ( sess ) <nl> # List of 3 sessions to use for recovery . The first one aborts <nl> # after 1 run ( ) call , the second after 2 run calls , the third <nl> # after 3 run calls . <nl> - sessions_to_use = [ AbortAtNSession ( sess , x + 1 ) for x in range ( 3 ) ] <nl> - self . assertEqual ( 3 , len ( sessions_to_use ) ) <nl> + self . assertEqual ( 3 , len ( session_creator . sessions_to_use ) ) <nl> # Make the recoverable session uses these 3 sessions in sequence by <nl> # passing a factory that pops from the session_to_use list . <nl> - recoverable_sess = monitored_session . _RecoverableSession ( <nl> - lambda : sessions_to_use . pop ( 0 ) ) <nl> - self . assertEqual ( 2 , len ( sessions_to_use ) ) # One session popped . <nl> + recoverable_sess = monitored_session . _RecoverableSession ( session_creator ) <nl> + self . assertEqual ( <nl> + 2 , len ( session_creator . sessions_to_use ) ) # One session popped . <nl> # Using first session . <nl> self . assertEqual ( 51 , recoverable_sess . run ( v , feed_dict = { c : 51 } ) ) <nl> - self . assertEqual ( 2 , len ( sessions_to_use ) ) # Still 2 sessions available <nl> + self . assertEqual ( <nl> + 2 , len ( session_creator . sessions_to_use ) ) # Still 2 sessions available <nl> # This will fail and recover by picking up the second session . <nl> self . assertEqual ( 42 , recoverable_sess . run ( v , feed_dict = { c : 42 } ) ) <nl> - self . assertEqual ( 1 , len ( sessions_to_use ) ) # Still 1 session available <nl> + self . assertEqual ( <nl> + 1 , len ( session_creator . sessions_to_use ) ) # Still 1 session available <nl> self . assertEqual ( 33 , recoverable_sess . run ( v , feed_dict = { c : 33 } ) ) <nl> - self . assertEqual ( 1 , len ( sessions_to_use ) ) # Still 1 session available <nl> + self . assertEqual ( <nl> + 1 , len ( session_creator . sessions_to_use ) ) # Still 1 session available <nl> # This will fail and recover by picking up the last session . <nl> self . assertEqual ( 24 , recoverable_sess . run ( v , feed_dict = { c : 24 } ) ) <nl> - self . assertEqual ( 0 , len ( sessions_to_use ) ) # All sessions used . <nl> + self . assertEqual ( <nl> + 0 , len ( session_creator . sessions_to_use ) ) # All sessions used . <nl> self . assertEqual ( 11 , recoverable_sess . run ( v , feed_dict = { c : 11 } ) ) <nl> self . assertEqual ( 0 , recoverable_sess . run ( v , feed_dict = { c : 0 } ) ) <nl> # This will fail and throw a real error as the pop ( ) will fail . <nl> def _test_dir ( self , test_name ) : <nl> def test_defaults ( self ) : <nl> with tf . Graph ( ) . as_default ( ) : <nl> a_var = tf . Variable ( 0 ) <nl> - with monitored_session . MonitoredSession ( ' ' ) as session : <nl> + with monitored_session . MonitoredSession ( ) as session : <nl> self . assertEqual ( 0 , session . run ( a_var ) ) <nl> <nl> def test_last_step ( self ) : <nl> def test_last_step ( self ) : <nl> with tf . Graph ( ) . as_default ( ) : <nl> gstep = tf . contrib . framework . get_or_create_global_step ( ) <nl> do_step = tf . assign_add ( gstep , 1 ) <nl> - scaffold = monitored_session . Scaffold ( ) <nl> # Run till step 3 and save . <nl> hooks = [ basic_session_run_hooks . StopAtStepHook ( last_step = 3 ) ] <nl> - with monitored_session . MonitoredSession ( <nl> - ' ' , scaffold = scaffold , hooks = hooks ) as session : <nl> + scaffold = monitored_session . Scaffold ( ) . finalize ( ) <nl> + with monitored_session . MonitoredSession ( hooks = hooks ) as session : <nl> self . assertEqual ( 0 , session . run ( gstep ) ) <nl> self . assertFalse ( session . should_stop ( ) ) <nl> self . assertEqual ( 1 , session . run ( do_step ) ) <nl> def test_last_step ( self ) : <nl> self . assertFalse ( session . should_stop ( ) ) <nl> self . assertEqual ( 3 , session . run ( do_step ) ) <nl> self . assertTrue ( session . should_stop ( ) ) <nl> - save_path = scaffold . saver . save ( session . _tf_sess , <nl> + save_path = scaffold . saver . save ( session . _coordinated_creator . tf_sess , <nl> os . path . join ( logdir , ' step - 3 ' ) ) <nl> # Run till step 5 and save . <nl> def load_ckpt ( scaffold , sess ) : <nl> scaffold . saver . restore ( sess , save_path ) <nl> <nl> - scaffold = monitored_session . Scaffold ( init_fn = load_ckpt ) <nl> + session_creator = monitored_session . ChiefSessionCreator ( <nl> + monitored_session . Scaffold ( init_fn = load_ckpt ) ) <nl> hooks = [ basic_session_run_hooks . StopAtStepHook ( last_step = 5 ) ] <nl> with monitored_session . MonitoredSession ( <nl> - ' ' , scaffold = scaffold , hooks = hooks ) as session : <nl> + hooks = hooks , session_creator = session_creator ) as session : <nl> self . assertEqual ( 3 , session . run ( gstep ) ) <nl> self . assertFalse ( session . should_stop ( ) ) <nl> self . assertEqual ( 4 , session . run ( do_step ) ) <nl> def test_num_steps ( self ) : <nl> with tf . Graph ( ) . as_default ( ) : <nl> gstep = tf . contrib . framework . get_or_create_global_step ( ) <nl> do_step = tf . assign_add ( gstep , 1 ) <nl> - scaffold = monitored_session . Scaffold ( ) <nl> # Do 3 steps and save . <nl> hooks = [ basic_session_run_hooks . StopAtStepHook ( num_steps = 3 ) ] <nl> - with monitored_session . MonitoredSession ( <nl> - ' ' , scaffold = scaffold , hooks = hooks ) as session : <nl> + scaffold = monitored_session . Scaffold ( ) . finalize ( ) <nl> + with monitored_session . MonitoredSession ( hooks = hooks ) as session : <nl> session . run ( do_step ) <nl> self . assertFalse ( session . should_stop ( ) ) <nl> session . run ( do_step ) <nl> self . assertFalse ( session . should_stop ( ) ) <nl> session . run ( do_step ) <nl> self . assertTrue ( session . should_stop ( ) ) <nl> - save_path = scaffold . saver . save ( session . _tf_sess , <nl> + save_path = scaffold . saver . save ( session . _coordinated_creator . tf_sess , <nl> os . path . join ( logdir , ' step - 3 ' ) ) <nl> # Restore and do 4 steps . <nl> def load_ckpt ( scaffold , sess ) : <nl> scaffold . saver . restore ( sess , save_path ) <nl> <nl> - scaffold = monitored_session . Scaffold ( init_fn = load_ckpt ) <nl> + session_creator = monitored_session . ChiefSessionCreator ( <nl> + scaffold = monitored_session . Scaffold ( init_fn = load_ckpt ) ) <nl> hooks = [ basic_session_run_hooks . StopAtStepHook ( num_steps = 4 ) ] <nl> with monitored_session . MonitoredSession ( <nl> - ' ' , scaffold = scaffold , hooks = hooks ) as session : <nl> + hooks = hooks , session_creator = session_creator ) as session : <nl> self . assertEqual ( 4 , session . run ( do_step ) ) <nl> self . assertFalse ( session . should_stop ( ) ) <nl> session . run ( do_step ) <nl> def test_recovery ( self ) : <nl> hooks = [ basic_session_run_hooks . CheckpointSaverHook ( <nl> logdir , save_steps = 1 , scaffold = scaffold ) ] <nl> with monitored_session . MonitoredSession ( <nl> - ' ' , scaffold = scaffold , checkpoint_dir = logdir , hooks = hooks ) as session : <nl> + session_creator = monitored_session . ChiefSessionCreator ( <nl> + scaffold , checkpoint_dir = logdir ) , <nl> + hooks = hooks ) as session : <nl> self . assertEqual ( 0 , session . run ( gstep ) ) <nl> self . assertEqual ( 1 , session . run ( do_step ) ) <nl> self . assertEqual ( 2 , session . run ( do_step ) ) <nl> # A restart will find the checkpoint and recover automatically . <nl> with monitored_session . MonitoredSession ( <nl> - ' ' , scaffold = scaffold , checkpoint_dir = logdir ) as session : <nl> + session_creator = monitored_session . ChiefSessionCreator ( <nl> + scaffold , checkpoint_dir = logdir ) ) as session : <nl> self . assertEqual ( 2 , session . run ( gstep ) ) <nl> <nl> def test_retry_on_aborted_error ( self ) : <nl> def test_retry_on_aborted_error ( self ) : <nl> with tf . Graph ( ) . as_default ( ) : <nl> gstep = tf . contrib . framework . get_or_create_global_step ( ) <nl> do_step = tf . assign_add ( gstep , 1 ) <nl> - scaffold = monitored_session . Scaffold ( ) <nl> hook = RaiseOnceAtCountN ( 4 , tf . errors . AbortedError ( None , None , ' Abort ' ) ) <nl> - with monitored_session . MonitoredSession ( <nl> - ' ' , scaffold = scaffold , hooks = [ hook ] ) as session : <nl> + with monitored_session . MonitoredSession ( hooks = [ hook ] ) as session : <nl> self . assertEqual ( 0 , session . run ( gstep ) ) <nl> self . assertEqual ( 1 , session . run ( do_step ) ) <nl> self . assertEqual ( 2 , session . run ( do_step ) ) <nl> def test_recover_and_retry_on_aborted_error ( self ) : <nl> logdir , save_steps = 1 , scaffold = scaffold ) <nl> hooks = [ abort_hook , ckpt_hook ] <nl> with monitored_session . MonitoredSession ( <nl> - ' ' , scaffold = scaffold , checkpoint_dir = logdir , hooks = hooks ) as session : <nl> + session_creator = monitored_session . ChiefSessionCreator ( <nl> + scaffold , checkpoint_dir = logdir ) , <nl> + hooks = hooks ) as session : <nl> self . assertEqual ( 0 , session . run ( gstep ) ) <nl> self . assertEqual ( 1 , session . run ( do_step ) ) <nl> self . assertEqual ( 2 , session . run ( do_step ) ) <nl> def test_exit_cleanly_on_out_of_range_exception ( self ) : <nl> with tf . Graph ( ) . as_default ( ) : <nl> gstep = tf . contrib . framework . get_or_create_global_step ( ) <nl> do_step = tf . assign_add ( gstep , 1 ) <nl> - scaffold = monitored_session . Scaffold ( ) <nl> hook = RaiseOnceAtCountN ( 2 , tf . errors . OutOfRangeError ( None , None , ' EOI ' ) ) <nl> - session = monitored_session . MonitoredSession ( <nl> - ' ' , scaffold = scaffold , hooks = [ hook ] ) <nl> + session = monitored_session . MonitoredSession ( hooks = [ hook ] ) <nl> # session should cleanly exit from the context . <nl> with session : <nl> self . assertEqual ( 0 , session . run ( gstep ) ) <nl> def test_exit_cleanly_on_stop_iteration_exception ( self ) : <nl> with tf . Graph ( ) . as_default ( ) : <nl> gstep = tf . contrib . framework . get_or_create_global_step ( ) <nl> do_step = tf . assign_add ( gstep , 1 ) <nl> - scaffold = monitored_session . Scaffold ( ) <nl> hook = RaiseOnceAtCountN ( 2 , StopIteration ) <nl> - session = monitored_session . MonitoredSession ( <nl> - ' ' , scaffold = scaffold , hooks = [ hook ] ) <nl> + session = monitored_session . MonitoredSession ( hooks = [ hook ] ) <nl> # session should cleanly exit from the context . <nl> with session : <nl> self . assertEqual ( 0 , session . run ( gstep ) ) <nl> def test_regular_exception_pass_through_run ( self ) : <nl> with tf . Graph ( ) . as_default ( ) : <nl> gstep = tf . contrib . framework . get_or_create_global_step ( ) <nl> do_step = tf . assign_add ( gstep , 1 ) <nl> - scaffold = monitored_session . Scaffold ( ) <nl> hook = RaiseOnceAtCountN ( 4 , RuntimeError ( ' regular exception ' ) ) <nl> - session = monitored_session . MonitoredSession ( <nl> - ' ' , scaffold = scaffold , hooks = [ hook ] ) <nl> + session = monitored_session . MonitoredSession ( hooks = [ hook ] ) <nl> with self . assertRaisesRegexp ( RuntimeError , ' regular exception ' ) : <nl> with session : <nl> self . assertEqual ( 0 , session . run ( gstep ) ) <nl> def test_regular_exception_reported_to_coord_pass_through_run ( self ) : <nl> # set the session in stop mode . <nl> with tf . Graph ( ) . as_default ( ) : <nl> gstep = tf . contrib . framework . get_or_create_global_step ( ) <nl> - scaffold = monitored_session . Scaffold ( ) <nl> - session = monitored_session . MonitoredSession ( ' ' , scaffold = scaffold ) <nl> + session = monitored_session . MonitoredSession ( ) <nl> run_performed_without_error = False <nl> with self . assertRaisesRegexp ( RuntimeError , ' a thread wants to stop ' ) : <nl> with session : <nl> def test_regular_exception_reported_to_coord_pass_through_run ( self ) : <nl> try : <nl> raise RuntimeError ( ' a thread wants to stop ' ) <nl> except RuntimeError as e : <nl> - session . _coord . request_stop ( e ) <nl> + session . _coordinated_creator . coord . request_stop ( e ) <nl> # Call run ( ) which should perform normally . <nl> self . assertEqual ( 0 , session . run ( gstep ) ) <nl> run_performed_without_error = True <nl> def test_regular_exception_reported_to_coord_pass_through_return ( self ) : <nl> # set the session in stop mode . <nl> with tf . Graph ( ) . as_default ( ) : <nl> gstep = tf . contrib . framework . get_or_create_global_step ( ) <nl> - scaffold = monitored_session . Scaffold ( ) <nl> - session = monitored_session . MonitoredSession ( ' ' , scaffold = scaffold ) <nl> + session = monitored_session . MonitoredSession ( ) <nl> with self . assertRaisesRegexp ( RuntimeError , ' a thread wants to stop ' ) : <nl> with session : <nl> self . assertEqual ( 0 , session . run ( gstep ) ) <nl> def test_regular_exception_reported_to_coord_pass_through_return ( self ) : <nl> try : <nl> raise RuntimeError ( ' a thread wants to stop ' ) <nl> except RuntimeError as e : <nl> - session . _coord . request_stop ( e ) <nl> + session . _coordinated_creator . coord . request_stop ( e ) <nl> self . assertTrue ( session . should_stop ( ) ) <nl> <nl> # This set of tests , verifies the session behavior when exceptions are raised <nl> def test_stop_cleanly_when_no_exception_in_with_body ( self ) : <nl> with tf . Graph ( ) . as_default ( ) : <nl> gstep = tf . contrib . framework . get_or_create_global_step ( ) <nl> do_step = tf . assign_add ( gstep , 1 ) <nl> - scaffold = monitored_session . Scaffold ( ) <nl> - session = monitored_session . MonitoredSession ( ' ' , scaffold = scaffold ) <nl> + session = monitored_session . MonitoredSession ( ) <nl> with session : <nl> self . assertEqual ( 1 , session . run ( do_step ) ) <nl> self . assertEqual ( 2 , session . run ( do_step ) ) <nl> def test_raises_regular_exceptions_in_with_body ( self ) : <nl> with tf . Graph ( ) . as_default ( ) : <nl> gstep = tf . contrib . framework . get_or_create_global_step ( ) <nl> do_step = tf . assign_add ( gstep , 1 ) <nl> - scaffold = monitored_session . Scaffold ( ) <nl> - session = monitored_session . MonitoredSession ( ' ' , scaffold = scaffold ) <nl> + session = monitored_session . MonitoredSession ( ) <nl> # We should see that exception . <nl> with self . assertRaisesRegexp ( RuntimeError , ' regular exception ' ) : <nl> with session : <nl> def test_raises_regular_exceptions_in_with_body ( self ) : <nl> self . assertTrue ( session . should_stop ( ) ) <nl> self . assertTrue ( session . _is_closed ( ) ) <nl> <nl> + def test_graph ( self ) : <nl> + g = tf . Graph ( ) <nl> + with g . as_default ( ) : <nl> + session = monitored_session . MonitoredSession ( ) <nl> + self . assertEqual ( g , session . graph ) <nl> + <nl> <nl> if __name__ = = ' __main__ ' : <nl> tf . test . main ( ) <nl> mmm a / tensorflow / contrib / learn / python / learn / tests / monitors_test . py <nl> ppp b / tensorflow / contrib / learn / python / learn / tests / monitors_test . py <nl> <nl> from tensorflow . contrib . learn . python import learn <nl> from tensorflow . contrib . learn . python . learn import monitored_session <nl> from tensorflow . python . platform import tf_logging as logging <nl> + from tensorflow . python . training import saver <nl> <nl> <nl> class _MyEveryN ( learn . monitors . EveryN ) : <nl> def setUp ( self ) : <nl> # monitored . <nl> self . _actual_log = logging . info <nl> <nl> - def mockLog ( * args , * * kwargs ) : <nl> + def mockLog ( * args , * * kwargs ) : # pylint : disable = invalid - name <nl> self . logged_message = args <nl> self . _actual_log ( * args , * * kwargs ) <nl> <nl> def test_base_monitor ( self ) : <nl> with tf . Graph ( ) . as_default ( ) as g , self . test_session ( g ) : <nl> self . _run_monitor ( learn . monitors . BaseMonitor ( ) ) <nl> <nl> - def test_every_n ( self ) : <nl> + def test_every_0 ( self ) : <nl> + monitor = _MyEveryN ( every_n_steps = 0 , first_n_steps = - 1 ) <nl> + with tf . Graph ( ) . as_default ( ) as g , self . test_session ( g ) : <nl> + self . _run_monitor ( monitor , num_epochs = 3 , num_steps_per_epoch = 10 ) <nl> + expected_steps = list ( range ( 30 ) ) <nl> + self . assertAllEqual ( expected_steps , monitor . steps_begun ) <nl> + self . assertAllEqual ( expected_steps , monitor . steps_ended ) <nl> + self . assertAllEqual ( expected_steps , monitor . post_steps ) <nl> + <nl> + def test_every_1 ( self ) : <nl> + monitor = _MyEveryN ( every_n_steps = 1 , first_n_steps = - 1 ) <nl> + with tf . Graph ( ) . as_default ( ) as g , self . test_session ( g ) : <nl> + self . _run_monitor ( monitor , num_epochs = 3 , num_steps_per_epoch = 10 ) <nl> + expected_steps = list ( range ( 1 , 30 ) ) <nl> + self . assertEqual ( expected_steps , monitor . steps_begun ) <nl> + self . assertEqual ( expected_steps , monitor . steps_ended ) <nl> + self . assertEqual ( expected_steps , monitor . post_steps ) <nl> + <nl> + def test_every_2 ( self ) : <nl> + monitor = _MyEveryN ( every_n_steps = 2 , first_n_steps = - 1 ) <nl> + with tf . Graph ( ) . as_default ( ) as g , self . test_session ( g ) : <nl> + self . _run_monitor ( monitor , num_epochs = 3 , num_steps_per_epoch = 10 ) <nl> + expected_steps = list ( range ( 2 , 29 , 2 ) ) + [ 29 ] <nl> + self . assertEqual ( expected_steps , monitor . steps_begun ) <nl> + self . assertEqual ( expected_steps , monitor . steps_ended ) <nl> + self . assertEqual ( expected_steps , monitor . post_steps ) <nl> + <nl> + def test_every_8 ( self ) : <nl> monitor = _MyEveryN ( every_n_steps = 8 , first_n_steps = 2 ) <nl> with tf . Graph ( ) . as_default ( ) as g , self . test_session ( g ) : <nl> self . _run_monitor ( monitor , num_epochs = 3 , num_steps_per_epoch = 10 ) <nl> def test_every_n ( self ) : <nl> self . assertEqual ( expected_steps , monitor . steps_ended ) <nl> self . assertEqual ( expected_steps , monitor . post_steps ) <nl> <nl> - def test_every_n_no_max_steps ( self ) : <nl> + def test_every_8_no_max_steps ( self ) : <nl> monitor = _MyEveryN ( every_n_steps = 8 , first_n_steps = 2 ) <nl> with tf . Graph ( ) . as_default ( ) as g , self . test_session ( g ) : <nl> self . _run_monitor ( monitor , num_epochs = 3 , num_steps_per_epoch = 10 , <nl> def test_every_n_no_max_steps ( self ) : <nl> self . assertEqual ( begin_end_steps , monitor . steps_ended ) <nl> self . assertEqual ( post_steps , monitor . post_steps ) <nl> <nl> - def test_every_n_recovered_after_step_begin ( self ) : <nl> + def test_every_8_recovered_after_step_begin ( self ) : <nl> monitor = _MyEveryN ( every_n_steps = 8 ) <nl> with tf . Graph ( ) . as_default ( ) as g , self . test_session ( g ) : <nl> for step in [ 8 , 16 ] : <nl> def test_every_n_recovered_after_step_begin ( self ) : <nl> self . assertEqual ( [ 8 , 16 ] , monitor . steps_ended ) <nl> self . assertEqual ( [ 8 , 16 ] , monitor . post_steps ) <nl> <nl> - def test_every_n_recovered_after_step_end ( self ) : <nl> + def test_every_8_recovered_after_step_end ( self ) : <nl> monitor = _MyEveryN ( every_n_steps = 8 ) <nl> with tf . Graph ( ) . as_default ( ) as g , self . test_session ( g ) : <nl> for step in [ 8 , 16 ] : <nl> def test_every_n_recovered_after_step_end ( self ) : <nl> self . assertEqual ( [ 8 , 16 ] , monitor . steps_ended ) <nl> self . assertEqual ( [ 8 , 16 ] , monitor . post_steps ) <nl> <nl> - def test_every_n_call_post_step_at_the_end ( self ) : <nl> + def test_every_8_call_post_step_at_the_end ( self ) : <nl> monitor = _MyEveryN ( every_n_steps = 8 ) <nl> with tf . Graph ( ) . as_default ( ) as g , self . test_session ( g ) : <nl> monitor . begin ( ) <nl> def test_every_n_call_post_step_at_the_end ( self ) : <nl> self . assertEqual ( [ 8 , 16 ] , monitor . steps_ended ) <nl> self . assertEqual ( [ 8 , 16 , 19 ] , monitor . post_steps ) <nl> <nl> - def test_every_n_call_post_step_should_not_be_called_twice ( self ) : <nl> + def test_every_8_call_post_step_should_not_be_called_twice ( self ) : <nl> monitor = _MyEveryN ( every_n_steps = 8 ) <nl> with tf . Graph ( ) . as_default ( ) as g , self . test_session ( g ) : <nl> monitor . begin ( ) <nl> def test_summary_saver ( self ) : <nl> 29 : { ' my_summary ' : 6 . 0 } , <nl> } ) <nl> <nl> - # TODO ( b / 29293803 ) : Add better tests with a mocked estimator . <nl> - def test_validation_monitor ( self ) : <nl> - monitor = learn . monitors . ValidationMonitor ( x = tf . constant ( 2 . 0 ) ) <nl> + def _assert_validation_monitor ( <nl> + self , monitor , expected_early_stopped = False , expected_best_step = None , <nl> + expected_best_value = None ) : <nl> + self . assertEqual ( expected_early_stopped , monitor . early_stopped ) <nl> + self . assertEqual ( expected_best_step , monitor . best_step ) <nl> + self . assertEqual ( expected_best_value , monitor . best_value ) <nl> + <nl> + def test_validation_monitor_no_estimator ( self ) : <nl> + monitor = learn . monitors . ValidationMonitor ( <nl> + x = tf . constant ( 2 . 0 ) , every_n_steps = 0 ) <nl> + self . _assert_validation_monitor ( monitor ) <nl> with tf . Graph ( ) . as_default ( ) as g , self . test_session ( g ) : <nl> with self . assertRaisesRegexp ( ValueError , ' set_estimator ' ) : <nl> self . _run_monitor ( monitor ) <nl> <nl> + @ tf . test . mock . patch ( ' tensorflow . contrib . learn . python . learn . estimators . Estimator ' , autospec = True ) # pylint : disable = line - too - long <nl> + @ tf . test . mock . patch . object ( saver , ' latest_checkpoint ' ) <nl> + def test_validation_monitor_no_ckpt ( <nl> + self , mock_latest_checkpoint , mock_estimator_class ) : <nl> + estimator = mock_estimator_class ( ) <nl> + model_dir = ' model / dir ' <nl> + estimator . model_dir = model_dir <nl> + mock_latest_checkpoint . return_value = None <nl> + <nl> + # Do nothing with no checkpoint . <nl> + monitor = learn . monitors . ValidationMonitor ( <nl> + x = tf . constant ( 2 . 0 ) , every_n_steps = 0 ) <nl> + self . _assert_validation_monitor ( monitor ) <nl> + monitor . set_estimator ( estimator ) <nl> + with tf . Graph ( ) . as_default ( ) as g , self . test_session ( g ) : <nl> + self . _run_monitor ( monitor ) <nl> + self . _assert_validation_monitor ( monitor ) <nl> + mock_latest_checkpoint . assert_called_with ( model_dir ) <nl> + <nl> + @ tf . test . mock . patch ( ' tensorflow . contrib . learn . python . learn . estimators . Estimator ' , autospec = True ) # pylint : disable = line - too - long <nl> + @ tf . test . mock . patch . object ( saver , ' latest_checkpoint ' ) <nl> + def test_validation_monitor_no_early_stopping_rounds ( <nl> + self , mock_latest_checkpoint , mock_estimator_class ) : <nl> + estimator = mock_estimator_class ( ) <nl> + model_dir = ' model / dir ' <nl> + estimator . model_dir = model_dir <nl> + estimator . evaluate . return_value = { } <nl> + mock_latest_checkpoint . return_value = ' % s / ckpt ' % model_dir <nl> + <nl> + # Do nothing with early_stopping_rounds = None . <nl> + monitor = learn . monitors . ValidationMonitor ( <nl> + x = tf . constant ( 2 . 0 ) , every_n_steps = 0 ) <nl> + self . _assert_validation_monitor ( monitor ) <nl> + monitor . set_estimator ( estimator ) <nl> + with tf . Graph ( ) . as_default ( ) as g , self . test_session ( g ) : <nl> + self . _run_monitor ( monitor ) <nl> + self . _assert_validation_monitor ( monitor ) <nl> + <nl> + @ tf . test . mock . patch ( ' tensorflow . contrib . learn . python . learn . estimators . Estimator ' , autospec = True ) # pylint : disable = line - too - long <nl> + @ tf . test . mock . patch . object ( saver , ' latest_checkpoint ' ) <nl> + def test_validation_monitor_invalid_metric ( <nl> + self , mock_latest_checkpoint , mock_estimator_class ) : <nl> + estimator = mock_estimator_class ( ) <nl> + model_dir = ' model / dir ' <nl> + estimator . model_dir = model_dir <nl> + estimator . evaluate . return_value = { } <nl> + mock_latest_checkpoint . return_value = ' % s / ckpt ' % model_dir <nl> + <nl> + # Fail for missing metric . <nl> + monitor = learn . monitors . ValidationMonitor ( <nl> + x = tf . constant ( 2 . 0 ) , every_n_steps = 0 , early_stopping_rounds = 1 ) <nl> + self . _assert_validation_monitor ( monitor ) <nl> + monitor . set_estimator ( estimator ) <nl> + with tf . Graph ( ) . as_default ( ) as g , self . test_session ( g ) : <nl> + with self . assertRaisesRegexp ( ValueError , ' missing from outputs ' ) : <nl> + self . _run_monitor ( monitor , num_epochs = 1 , num_steps_per_epoch = 1 ) <nl> + <nl> + @ tf . test . mock . patch ( ' tensorflow . contrib . learn . python . learn . estimators . Estimator ' , autospec = True ) # pylint : disable = line - too - long <nl> + @ tf . test . mock . patch . object ( saver , ' latest_checkpoint ' ) <nl> + def test_validation_monitor ( <nl> + self , mock_latest_checkpoint , mock_estimator_class ) : <nl> + estimator = mock_estimator_class ( ) <nl> + model_dir = ' model / dir ' <nl> + estimator . model_dir = model_dir <nl> + validation_outputs = { ' loss ' : None } <nl> + estimator . evaluate . return_value = validation_outputs <nl> + <nl> + monitor = learn . monitors . ValidationMonitor ( <nl> + x = tf . constant ( 2 . 0 ) , every_n_steps = 0 , early_stopping_rounds = 2 ) <nl> + self . _assert_validation_monitor ( monitor ) <nl> + monitor . set_estimator ( estimator ) <nl> + with tf . Graph ( ) . as_default ( ) as g , self . test_session ( g ) : <nl> + monitor . begin ( max_steps = 100 ) <nl> + monitor . epoch_begin ( epoch = 0 ) <nl> + self . assertEqual ( 0 , estimator . evaluate . call_count ) <nl> + <nl> + # Step 0 , initial loss . <nl> + step = 0 <nl> + mock_latest_checkpoint . return_value = ' % s / ckpt . % s ' % ( model_dir , step ) <nl> + validation_outputs [ ' loss ' ] = 42 . 0 <nl> + self . assertEqual ( 0 , len ( monitor . step_begin ( step = step ) ) ) <nl> + self . assertFalse ( monitor . step_end ( step = step , output = { } ) ) <nl> + self . assertEqual ( 1 , estimator . evaluate . call_count ) <nl> + self . _assert_validation_monitor ( <nl> + monitor , expected_best_step = 0 , expected_best_value = 42 . 0 ) <nl> + monitor . post_step ( step = step , session = None ) <nl> + <nl> + # Step 1 , same checkpoint , no eval . <nl> + step = 1 <nl> + self . assertEqual ( 0 , len ( monitor . step_begin ( step = step ) ) ) <nl> + self . assertFalse ( monitor . step_end ( step = step , output = { } ) ) <nl> + self . assertEqual ( 1 , estimator . evaluate . call_count ) <nl> + self . _assert_validation_monitor ( <nl> + monitor , expected_best_step = 0 , expected_best_value = 42 . 0 ) <nl> + monitor . post_step ( step = step , session = None ) <nl> + <nl> + # Step 2 , lower loss . <nl> + step = 2 <nl> + mock_latest_checkpoint . return_value = ' % s / ckpt . % s ' % ( model_dir , step ) <nl> + validation_outputs [ ' loss ' ] = 40 . 0 <nl> + self . assertEqual ( 0 , len ( monitor . step_begin ( step = step ) ) ) <nl> + self . assertFalse ( monitor . step_end ( step = step , output = { } ) ) <nl> + self . assertEqual ( 2 , estimator . evaluate . call_count ) <nl> + self . _assert_validation_monitor ( <nl> + monitor , expected_best_step = 2 , expected_best_value = 40 . 0 ) <nl> + monitor . post_step ( step = step , session = None ) <nl> + <nl> + # Step 3 , higher loss . <nl> + step = 3 <nl> + mock_latest_checkpoint . return_value = ' % s / ckpt . % s ' % ( model_dir , step ) <nl> + validation_outputs [ ' loss ' ] = 44 . 0 <nl> + self . assertEqual ( 0 , len ( monitor . step_begin ( step = step ) ) ) <nl> + self . assertFalse ( monitor . step_end ( step = step , output = { } ) ) <nl> + self . assertEqual ( 3 , estimator . evaluate . call_count ) <nl> + self . _assert_validation_monitor ( <nl> + monitor , expected_best_step = 2 , expected_best_value = 40 . 0 ) <nl> + monitor . post_step ( step = step , session = None ) <nl> + <nl> + # Step 4 , higher loss for 2 steps , early stopping . <nl> + step = 4 <nl> + mock_latest_checkpoint . return_value = ' % s / ckpt . % s ' % ( model_dir , step ) <nl> + validation_outputs [ ' loss ' ] = 43 . 0 <nl> + self . assertEqual ( 0 , len ( monitor . step_begin ( step = step ) ) ) <nl> + self . assertTrue ( monitor . step_end ( step = step , output = { } ) ) <nl> + self . assertEqual ( 4 , estimator . evaluate . call_count ) <nl> + self . _assert_validation_monitor ( <nl> + monitor , expected_early_stopped = True , expected_best_step = 2 , <nl> + expected_best_value = 40 . 0 ) <nl> + monitor . post_step ( step = step , session = None ) <nl> + <nl> + monitor . epoch_end ( epoch = 0 ) <nl> + monitor . end ( ) <nl> + <nl> def test_graph_dump ( self ) : <nl> monitor0 = learn . monitors . GraphDump ( ) <nl> monitor1 = learn . monitors . GraphDump ( ) <nl> mmm a / tensorflow / contrib / learn / python / learn / tests / nonlinear_test . py <nl> ppp b / tensorflow / contrib / learn / python / learn / tests / nonlinear_test . py <nl> <nl> <nl> import random <nl> <nl> - import numpy as np <nl> import tensorflow as tf <nl> - from tensorflow . contrib . learn . python . learn . estimators . _sklearn import accuracy_score <nl> - from tensorflow . contrib . learn . python . learn . estimators . _sklearn import mean_squared_error <nl> <nl> <nl> class NonLinearTest ( tf . test . TestCase ) : <nl> def testIrisDNN ( self ) : <nl> feature_columns = feature_columns , hidden_units = [ 10 , 20 , 10 ] , n_classes = 3 , <nl> config = tf . contrib . learn . RunConfig ( tf_random_seed = 1 ) ) <nl> classifier . fit ( iris . data , iris . target , max_steps = 200 ) <nl> - score = accuracy_score ( iris . target , classifier . predict ( iris . data ) ) <nl> - self . assertGreater ( score , 0 . 9 , " Failed with score = { 0 } " . format ( score ) ) <nl> weights = classifier . weights_ <nl> self . assertEqual ( weights [ 0 ] . shape , ( 4 , 10 ) ) <nl> self . assertEqual ( weights [ 1 ] . shape , ( 10 , 20 ) ) <nl> def testBostonDNN ( self ) : <nl> config = tf . contrib . learn . RunConfig ( tf_random_seed = 1 ) ) <nl> regressor . fit ( <nl> boston . data , boston . target , steps = 300 , batch_size = boston . data . shape [ 0 ] ) <nl> - score = mean_squared_error ( boston . target , regressor . predict ( boston . data ) ) <nl> - self . assertLess ( score , 110 , " Failed with score = { 0 } " . format ( score ) ) <nl> weights = regressor . weights_ <nl> self . assertEqual ( weights [ 0 ] . shape , ( 13 , 10 ) ) <nl> self . assertEqual ( weights [ 1 ] . shape , ( 10 , 20 ) ) <nl> def testDNNDropout0 ( self ) : <nl> feature_columns = feature_columns , hidden_units = [ 10 , 20 , 10 ] , n_classes = 3 , <nl> dropout = 0 . 0 , config = tf . contrib . learn . RunConfig ( tf_random_seed = 1 ) ) <nl> classifier . fit ( iris . data , iris . target , max_steps = 200 ) <nl> - score = accuracy_score ( iris . target , classifier . predict ( iris . data ) ) <nl> - self . assertGreater ( score , 0 . 9 , " Failed with score = { 0 } " . format ( score ) ) <nl> <nl> def testDNNDropout0_1 ( self ) : <nl> # Dropping only a little . <nl> def testDNNDropout0_1 ( self ) : <nl> feature_columns = feature_columns , hidden_units = [ 10 , 20 , 10 ] , n_classes = 3 , <nl> dropout = 0 . 1 , config = tf . contrib . learn . RunConfig ( tf_random_seed = 1 ) ) <nl> classifier . fit ( iris . data , iris . target , max_steps = 200 ) <nl> - score = accuracy_score ( iris . target , classifier . predict ( iris . data ) ) <nl> - # If the quality is lower - dropout is not working . <nl> - self . assertGreater ( score , 0 . 9 , " Failed with score = { 0 } " . format ( score ) ) <nl> <nl> def testDNNDropout0_9 ( self ) : <nl> # Dropping out most of it . <nl> def testDNNDropout0_9 ( self ) : <nl> feature_columns = feature_columns , hidden_units = [ 10 , 20 , 10 ] , n_classes = 3 , <nl> dropout = 0 . 9 , config = tf . contrib . learn . RunConfig ( tf_random_seed = 1 ) ) <nl> classifier . fit ( iris . data , iris . target , max_steps = 200 ) <nl> - score = accuracy_score ( iris . target , classifier . predict ( iris . data ) ) <nl> - self . assertGreater ( score , 0 . 3 , " Failed with score = { 0 } " . format ( score ) ) <nl> - # If the quality is higher - dropout is not working . <nl> - self . assertLess ( score , 0 . 6 , " Failed with score = { 0 } " . format ( score ) ) <nl> <nl> <nl> if __name__ = = " __main__ " : <nl> deleted file mode 100644 <nl> index 838a3ff33b2b1 . . 0000000000000 <nl> mmm a / tensorflow / contrib / learn / python / learn / tests / saver_test . py <nl> ppp / dev / null <nl> <nl> - # Copyright 2016 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> - " " " Save and restore tests . " " " <nl> - <nl> - from __future__ import absolute_import <nl> - from __future__ import division <nl> - from __future__ import print_function <nl> - <nl> - import random <nl> - <nl> - import tensorflow as tf <nl> - from tensorflow . contrib . learn . python import learn <nl> - from tensorflow . contrib . learn . python . learn import datasets <nl> - <nl> - <nl> - class SaverTest ( tf . test . TestCase ) : <nl> - " " " Save and restore tests . " " " <nl> - <nl> - def testIris ( self ) : <nl> - path = tf . test . get_temp_dir ( ) + ' / tmp . saver ' <nl> - random . seed ( 42 ) <nl> - iris = datasets . load_iris ( ) <nl> - cont_features = [ <nl> - tf . contrib . layers . real_valued_column ( ' ' , dimension = 4 ) ] <nl> - classifier = learn . LinearClassifier ( <nl> - feature_columns = cont_features , n_classes = 3 , model_dir = path ) <nl> - classifier . fit ( iris . data , iris . target , steps = 200 ) <nl> - # TODO ( ipolosukhin ) : Remove or restore . <nl> - # new_classifier = learn . TensorFlowEstimator . restore ( path ) <nl> - # self . assertEqual ( type ( new_classifier ) , type ( classifier ) ) <nl> - # score = accuracy_score ( iris . target , new_classifier . predict ( iris . data ) ) <nl> - # self . assertGreater ( score , 0 . 5 , ' Failed with score = { 0 } ' . format ( score ) ) <nl> - <nl> - def testCustomModel ( self ) : <nl> - path = tf . test . get_temp_dir ( ) + ' / tmp . saver2 ' <nl> - random . seed ( 42 ) <nl> - iris = datasets . load_iris ( ) <nl> - <nl> - def _custom_model ( x , y ) : <nl> - return learn . models . logistic_regression ( x , y ) <nl> - <nl> - classifier = learn . TensorFlowEstimator ( model_fn = _custom_model , n_classes = 3 ) <nl> - classifier . fit ( iris . data , iris . target ) <nl> - classifier . save ( path ) <nl> - # TODO ( ipolosukhin ) : Remove or restore . <nl> - # new_classifier = learn . TensorFlowEstimator . restore ( path ) <nl> - # self . assertEqual ( type ( new_classifier ) , type ( classifier ) ) <nl> - # score = accuracy_score ( iris . target , new_classifier . predict ( iris . data ) ) <nl> - # self . assertGreater ( score , 0 . 5 , ' Failed with score = { 0 } ' . format ( score ) ) <nl> - <nl> - def testDNN ( self ) : <nl> - random . seed ( 42 ) <nl> - iris = datasets . load_iris ( ) <nl> - cont_features = [ <nl> - tf . contrib . layers . real_valued_column ( ' ' , dimension = 4 ) ] <nl> - classifier = learn . DNNClassifier ( feature_columns = cont_features , <nl> - hidden_units = [ 10 , 20 , 10 ] , <nl> - n_classes = 3 ) <nl> - classifier . fit ( iris . data , iris . target , max_steps = 100 ) <nl> - # TODO ( ipolosukhin ) : Remove or restore . <nl> - # path = tf . test . get_temp_dir ( ) + ' / tmp_saver3 ' <nl> - # classifier . save ( path ) <nl> - # new_classifier = learn . TensorFlowEstimator . restore ( path ) <nl> - # self . assertEqual ( type ( new_classifier ) , type ( classifier ) ) <nl> - # score = accuracy_score ( iris . target , new_classifier . predict ( iris . data ) ) <nl> - # self . assertGreater ( score , 0 . 5 , ' Failed with score = { 0 } ' . format ( score ) ) <nl> - <nl> - def testNoFolder ( self ) : <nl> - with self . assertRaises ( ValueError ) : <nl> - learn . TensorFlowEstimator . restore ( ' no_model_path ' ) <nl> - <nl> - def testNoCheckpoints ( self ) : <nl> - random . seed ( 42 ) <nl> - iris = datasets . load_iris ( ) <nl> - cont_features = [ <nl> - tf . contrib . layers . real_valued_column ( ' ' , dimension = 4 ) ] <nl> - classifier = learn . DNNClassifier ( feature_columns = cont_features , <nl> - hidden_units = [ 10 , 20 , 10 ] , <nl> - n_classes = 3 ) <nl> - classifier . fit ( iris . data , iris . target , max_steps = 100 ) <nl> - # TODO ( ipolosukhin ) : Remove or restore . <nl> - # path = tf . test . get_temp_dir ( ) + ' / tmp / tmp . saver4 ' <nl> - # classifier . save ( path ) <nl> - # os . remove ( os . path . join ( path , ' checkpoint ' ) ) <nl> - # with self . assertRaises ( NotImplementedError ) : <nl> - # learn . TensorFlowEstimator . restore ( path ) <nl> - <nl> - if __name__ = = ' __main__ ' : <nl> - tf . test . main ( ) <nl> mmm a / tensorflow / contrib / linear_optimizer / kernels / hinge - loss . h <nl> ppp b / tensorflow / contrib / linear_optimizer / kernels / hinge - loss . h <nl> class HingeLossUpdater : public DualLossUpdater { <nl> / / <nl> / / TODO ( sibyl - vie3Poto ) : Write up a doc with concrete derivation and point to it from <nl> / / here . <nl> - double ComputeUpdatedDual ( const int num_partitions , const double label , <nl> + double ComputeUpdatedDual ( const int num_loss_partitions , const double label , <nl> const double example_weight , <nl> const double current_dual , const double wx , <nl> const double weighted_example_norm ) const final { <nl> class HingeLossUpdater : public DualLossUpdater { <nl> const double candidate_optimal_dual = <nl> current_dual + <nl> ( label - wx ) / <nl> - ( num_partitions * example_weight * weighted_example_norm ) ; <nl> + ( num_loss_partitions * example_weight * weighted_example_norm ) ; <nl> if ( label * candidate_optimal_dual < 0 ) { <nl> return 0 . 0 ; <nl> } <nl> class HingeLossUpdater : public DualLossUpdater { <nl> return std : : max ( 0 . 0 , 1 - y_wx ) * example_weight ; <nl> } <nl> <nl> + double PrimalLossDerivative ( const double wx , const double label , <nl> + const double example_weight ) const final { <nl> + if ( label * wx < 1 ) { <nl> + return - label * example_weight ; <nl> + } <nl> + return 0 ; <nl> + } <nl> + <nl> + / / The smoothness constant is 0 since the derivative of the loss is not <nl> + / / Lipschitz <nl> + double SmoothnessConstant ( ) const final { return 0 ; } <nl> + <nl> / / Converts binary example labels from 0 . 0 or 1 . 0 to - 1 . 0 or 1 . 0 respectively <nl> / / as expected by hinge loss . <nl> Status ConvertLabel ( float * const example_label ) const final { <nl> mmm a / tensorflow / contrib / linear_optimizer / kernels / logistic - loss . h <nl> ppp b / tensorflow / contrib / linear_optimizer / kernels / logistic - loss . h <nl> class LogisticLossUpdater : public DualLossUpdater { <nl> / / Adding vs . Averaging in Distributed Primal - Dual Optimization . <nl> / / Chenxin Ma , Virginia Smith , Martin Jaggi , Michael I . Jordan , Peter <nl> / / Richtarik , Martin Takac http : / / arxiv . org / abs / 1502 . 03508 <nl> - double ComputeUpdatedDual ( const int num_partitions , const double label , <nl> + double ComputeUpdatedDual ( const int num_loss_partitions , const double label , <nl> const double example_weight , <nl> const double current_dual , const double wx , <nl> const double weighted_example_norm ) const final { <nl> class LogisticLossUpdater : public DualLossUpdater { <nl> static const int newton_total_steps = 10 ; <nl> double x = 0 ; <nl> for ( int i = 0 ; i < newton_total_steps ; + + i ) { <nl> - x = NewtonStep ( x , num_partitions , label , wx , example_weight , <nl> + x = NewtonStep ( x , num_loss_partitions , label , wx , example_weight , <nl> weighted_example_norm , current_dual ) ; <nl> } <nl> return 0 . 5 * ( 1 + tanh ( x ) ) / label ; <nl> class LogisticLossUpdater : public DualLossUpdater { <nl> return ( log ( 1 + exp ( y_wx ) ) - y_wx ) * example_weight ; <nl> } <nl> <nl> + / / Derivative of logistic loss <nl> + double PrimalLossDerivative ( const double wx , const double label , <nl> + const double example_weight ) const final { <nl> + double inverse_exp_term = 0 ; <nl> + if ( label * wx > 0 ) { <nl> + inverse_exp_term = exp ( - label * wx ) / ( 1 + exp ( - label * wx ) ) ; <nl> + } else { <nl> + inverse_exp_term = 1 / ( 1 + exp ( label * wx ) ) ; <nl> + } <nl> + return inverse_exp_term * label * example_weight ; <nl> + } <nl> + <nl> + / / The smoothness constant is 4 since the derivative of logistic loss , which <nl> + / / is exp ( - x ) / ( 1 + exp ( - x ) ) can be shown to 0 . 25 - Lipschitz ( its derivative <nl> + / / is bounded by 0 . 25 ) <nl> + double SmoothnessConstant ( ) const final { return 4 ; } <nl> + <nl> / / Converts binary example labels from 0 . 0 or 1 . 0 to - 1 . 0 or 1 . 0 respectively <nl> / / as expected by logistic regression . <nl> Status ConvertLabel ( float * const example_label ) const final { <nl> class LogisticLossUpdater : public DualLossUpdater { <nl> <nl> private : <nl> / / We use Newton algorithm on a modified function ( see readme . md ) . <nl> - double NewtonStep ( const double x , const int num_partitions , <nl> + double NewtonStep ( const double x , const int num_loss_partitions , <nl> const double label , const double wx , <nl> const double example_weight , <nl> const double weighted_example_norm , <nl> const double current_dual ) const { <nl> const double tanhx = tanh ( x ) ; <nl> const double numerator = - 2 * label * x - wx - <nl> - num_partitions * weighted_example_norm * <nl> + num_loss_partitions * weighted_example_norm * <nl> example_weight * <nl> ( 0 . 5 * ( 1 + tanhx ) / label - current_dual ) ; <nl> const double denominator = - 2 * label - <nl> - num_partitions * weighted_example_norm * <nl> + num_loss_partitions * weighted_example_norm * <nl> example_weight * ( 1 - tanhx * tanhx ) * 0 . 5 / <nl> label ; <nl> return x - numerator / denominator ; <nl> mmm a / tensorflow / contrib / linear_optimizer / kernels / loss . h <nl> ppp b / tensorflow / contrib / linear_optimizer / kernels / loss . h <nl> class DualLossUpdater { <nl> / / can be employed here , like newton step and / or line search or approximate <nl> / / step that decreases the dual sub - optimality . <nl> virtual double ComputeUpdatedDual ( <nl> - const int num_partitions , const double label , const double example_weight , <nl> - const double current_dual , const double wx , <nl> + const int num_loss_partitions , const double label , <nl> + const double example_weight , const double current_dual , const double wx , <nl> const double weighted_example_norm ) const = 0 ; <nl> <nl> / / Compute dual loss based on the current dual ( alpha ) , example label ( y ) <nl> class DualLossUpdater { <nl> virtual double ComputePrimalLoss ( const double wx , const double example_label , <nl> const double example_weight ) const = 0 ; <nl> <nl> + / / Primal loss derivative used to compute the dual residue in AdaSDCA <nl> + virtual double PrimalLossDerivative ( const double wx , <nl> + const double example_label , <nl> + const double example_weight ) const = 0 ; <nl> + <nl> + / / This is gamma such that the loss derivative is 1 / gamma Lipschitz <nl> + virtual double SmoothnessConstant ( ) const = 0 ; <nl> + <nl> / / Converts binary example labels from 0 . 0 or 1 . 0 to appropriate range for <nl> / / each loss function . <nl> virtual Status ConvertLabel ( float * const example_label ) const = 0 ; <nl> mmm a / tensorflow / contrib / linear_optimizer / kernels / loss_test . cc <nl> ppp b / tensorflow / contrib / linear_optimizer / kernels / loss_test . cc <nl> TEST ( HingeLoss , ComputeUpdatedDual ) { <nl> 0 . 3 / * wx * / , 100 . 0 / * weighted_example_norm * / ) , <nl> 1e - 3 ) ; <nl> / / When label = - 1 . 0 , example_weight = 1 . 0 , current_dual = 0 . 4 , wx = 0 . 6 , <nl> - / / weighted_example_norm = 10 . 0 and num_partitions = 10 , it turns out that the <nl> - / / optimal value to update the dual to is 0 . 384 which is within the permitted <nl> - / / range and thus should be the value returned . <nl> + / / weighted_example_norm = 10 . 0 and num_loss_partitions = 10 , it turns out that <nl> + / / the optimal value to update the dual to is 0 . 384 which is within the <nl> + / / permitted range and thus should be the value returned . <nl> EXPECT_NEAR ( - 0 . 416 , loss_updater . ComputeUpdatedDual ( <nl> 10 / * num partitions * / , - 1 . 0 / * label * / , <nl> 1 . 0 / * example weight * / , - 0 . 4 / * current_dual * / , <nl> mmm a / tensorflow / contrib / linear_optimizer / kernels / sdca_ops . cc <nl> ppp b / tensorflow / contrib / linear_optimizer / kernels / sdca_ops . cc <nl> limitations under the License . <nl> # include " tensorflow / core / lib / core / stringpiece . h " <nl> # include " tensorflow / core / lib / gtl / inlined_vector . h " <nl> # include " tensorflow / core / lib / hash / hash . h " <nl> + # include " tensorflow / core / lib / random / distribution_sampler . h " <nl> # include " tensorflow / core / lib / strings / stringprintf . h " <nl> # include " tensorflow / core / platform / fingerprint . h " <nl> # include " tensorflow / core / platform / mutex . h " <nl> # include " tensorflow / core / platform / types . h " <nl> + # include " tensorflow / core / util / guarded_philox_random . h " <nl> # include " tensorflow / core / util / sparse / group_iterator . h " <nl> # include " tensorflow / core / util / sparse / sparse_tensor . h " <nl> # include " tensorflow / core / util / work_sharder . h " <nl> class Example { <nl> / / Compute dot product between weights , and example feature values . This <nl> / / method also computes the normalized example norm used in SDCA update . <nl> const ExampleStatistics ComputeWxAndWeightedExampleNorm ( <nl> - const int num_partitions , const ModelWeights & model_weights , <nl> + const int num_loss_partitions , const ModelWeights & model_weights , <nl> const Regularizations & regularization ) const ; <nl> <nl> float example_label ( ) const { return example_label_ ; } <nl> class ModelWeights { <nl> / / Computes the example statistics for given example , and model . Defined here <nl> / / as we need definition of ModelWeights and Regularizations . <nl> const ExampleStatistics Example : : ComputeWxAndWeightedExampleNorm ( <nl> - const int num_partitions , const ModelWeights & model_weights , <nl> + const int num_loss_partitions , const ModelWeights & model_weights , <nl> const Regularizations & regularization ) const { <nl> ExampleStatistics result ; <nl> <nl> const ExampleStatistics Example : : ComputeWxAndWeightedExampleNorm ( <nl> : ( * sparse_features . values ) ( k ) ; <nl> const double feature_weight = <nl> sparse_weights . nominals ( feature_index ) + <nl> - sparse_weights . deltas ( feature_index ) * num_partitions ; <nl> + sparse_weights . deltas ( feature_index ) * num_loss_partitions ; <nl> result . prev_wx + = <nl> feature_value * <nl> regularization . Shrink ( sparse_weights . nominals ( feature_index ) ) ; <nl> const ExampleStatistics Example : : ComputeWxAndWeightedExampleNorm ( <nl> <nl> const Eigen : : Tensor < float , 1 , Eigen : : RowMajor > feature_weights = <nl> dense_weights . nominals + <nl> - dense_weights . deltas * dense_weights . deltas . constant ( num_partitions ) ; <nl> + dense_weights . deltas * <nl> + dense_weights . deltas . constant ( num_loss_partitions ) ; <nl> const Eigen : : Tensor < float , 0 , Eigen : : RowMajor > prev_prediction = <nl> ( dense_vector . row ( ) * <nl> regularization . EigenShrink ( dense_weights . nominals ) ) <nl> class Examples { <nl> return examples_ . at ( example_index ) ; <nl> } <nl> <nl> + int sampled_index ( const int id , const bool adaptative ) const { <nl> + if ( adaptative ) return sampled_index_ [ id ] ; <nl> + return id ; <nl> + } <nl> + <nl> + void SampleAdaptativeProbabilities ( <nl> + const int num_partitions , const Regularizations & regularization , <nl> + const ModelWeights & model_weights , <nl> + const TTypes < float > : : Matrix example_state_data , <nl> + const std : : unique_ptr < DualLossUpdater > & loss_updater ) { <nl> + / / Compute the probabilities <nl> + for ( int example_id = 0 ; example_id < num_examples ( ) ; + + example_id ) { <nl> + const Example & example = examples_ [ example_id ] ; <nl> + const double example_weight = example . example_weight ( ) ; <nl> + float label = example . example_label ( ) ; <nl> + const Status conversion_status = loss_updater - > ConvertLabel ( & label ) ; <nl> + const ExampleStatistics example_statistics = <nl> + example . ComputeWxAndWeightedExampleNorm ( num_partitions , model_weights , <nl> + regularization ) ; <nl> + const double kappa = example_state_data ( example_id , 0 ) + <nl> + loss_updater - > PrimalLossDerivative ( <nl> + example_statistics . wx , label , example_weight ) ; <nl> + probabilities_ [ example_id ] = <nl> + example_weight * sqrt ( examples_ [ example_id ] . squared_norm_ + <nl> + regularization . symmetric_l2 ( ) * <nl> + loss_updater - > SmoothnessConstant ( ) ) * <nl> + std : : abs ( kappa ) ; <nl> + } <nl> + <nl> + / / Sample the index <nl> + random : : DistributionSampler sampler ( probabilities_ ) ; <nl> + GuardedPhiloxRandom generator ; <nl> + generator . Init ( 0 , 0 ) ; <nl> + auto local_gen = generator . ReserveSamples32 ( num_examples ( ) ) ; <nl> + random : : SimplePhilox random ( & local_gen ) ; <nl> + std : : random_device rd ; <nl> + std : : mt19937 gen ( rd ( ) ) ; <nl> + std : : uniform_real_distribution < > dis ( 0 , 1 ) ; <nl> + <nl> + / / We use a decay of 10 : the probability of an example is divided by 10 <nl> + / / once that example is picked . A good approximation of that is to only <nl> + / / keep a picked example with probability ( 1 / 10 ) ^ k where k is the <nl> + / / number of times we already picked that example . We add a num_retries <nl> + / / to avoid taking too long to sample . We then fill the sampled_index with <nl> + / / unseen examples sorted by probabilities . <nl> + int id = 0 ; <nl> + int num_retries = 0 ; <nl> + while ( id < num_examples ( ) & & num_retries < num_examples ( ) ) { <nl> + int picked_id = sampler . Sample ( & random ) ; <nl> + if ( dis ( gen ) > std : : pow ( 0 . 1 , sampled_count_ [ picked_id ] ) ) { <nl> + num_retries + + ; <nl> + continue ; <nl> + } <nl> + sampled_count_ [ picked_id ] + + ; <nl> + sampled_index_ [ id + + ] = picked_id ; <nl> + } <nl> + <nl> + std : : vector < std : : pair < int , float > > examples_not_seen ; <nl> + examples_not_seen . reserve ( num_examples ( ) ) ; <nl> + for ( int i = 0 ; i < num_examples ( ) ; + + i ) { <nl> + if ( sampled_count_ [ i ] = = 0 ) <nl> + examples_not_seen . emplace_back ( sampled_index_ [ i ] , probabilities_ [ i ] ) ; <nl> + } <nl> + std : : sort ( <nl> + examples_not_seen . begin ( ) , examples_not_seen . end ( ) , <nl> + [ ] ( const std : : pair < int , float > & lhs , const std : : pair < int , float > & rhs ) { <nl> + return lhs . second > rhs . second ; <nl> + } ) ; <nl> + for ( int i = id ; i < num_examples ( ) ; + + i ) { <nl> + sampled_count_ [ i ] = examples_not_seen [ i - id ] . first ; <nl> + } <nl> + } <nl> + <nl> int num_examples ( ) const { return examples_ . size ( ) ; } <nl> <nl> int num_features ( ) const { return num_features_ ; } <nl> class Examples { <nl> / / All examples in the batch . <nl> std : : vector < Example > examples_ ; <nl> <nl> + / / Adaptative sampling variables <nl> + std : : vector < float > probabilities_ ; <nl> + std : : vector < int > sampled_index_ ; <nl> + std : : vector < int > sampled_count_ ; <nl> + <nl> int num_features_ = 0 ; <nl> <nl> TF_DISALLOW_COPY_AND_ASSIGN ( Examples ) ; <nl> Status Examples : : Initialize ( OpKernelContext * const context , <nl> <nl> examples_ . clear ( ) ; <nl> examples_ . resize ( num_examples ) ; <nl> + probabilities_ . resize ( num_examples ) ; <nl> + sampled_index_ . resize ( num_examples ) ; <nl> + sampled_count_ . resize ( num_examples ) ; <nl> for ( int example_id = 0 ; example_id < num_examples ; + + example_id ) { <nl> Example * const example = & examples_ [ example_id ] ; <nl> example - > sparse_features_ . resize ( num_sparse_features ) ; <nl> class DistributedSdcaLargeBatchSolver : public OpKernel { <nl> OP_REQUIRES ( context , false , errors : : InvalidArgument ( <nl> " Unsupported loss type : " , loss_type ) ) ; <nl> } <nl> + OP_REQUIRES_OK ( context , context - > GetAttr ( " adaptative " , & adaptative_ ) ) ; <nl> OP_REQUIRES_OK ( context , context - > GetAttr ( " num_sparse_features " , <nl> & num_sparse_features_ ) ) ; <nl> OP_REQUIRES_OK ( context , <nl> class DistributedSdcaLargeBatchSolver : public OpKernel { <nl> static_cast < int64 > ( num_sparse_features_ ) + <nl> static_cast < int64 > ( num_dense_features_ ) , <nl> std : : numeric_limits < int > : : max ( ) ) ) ) ; <nl> - OP_REQUIRES_OK ( context , <nl> - context - > GetAttr ( " num_partitions " , & num_partitions_ ) ) ; <nl> + OP_REQUIRES_OK ( context , context - > GetAttr ( " num_loss_partitions " , <nl> + & num_loss_partitions_ ) ) ; <nl> OP_REQUIRES_OK ( context , context - > GetAttr ( " num_inner_iterations " , <nl> & num_inner_iterations_ ) ) ; <nl> OP_REQUIRES_OK ( context , regularizations_ . Initialize ( context ) ) ; <nl> class DistributedSdcaLargeBatchSolver : public OpKernel { <nl> <nl> / / TODO ( sibyl - Aix6ihai ) : Refactor / shorten this function . <nl> void Compute ( OpKernelContext * const context ) override { <nl> - Examples examples ; <nl> ModelWeights model_weights ; <nl> OP_REQUIRES_OK ( context , model_weights . Initialize ( context ) ) ; <nl> <nl> + Examples examples ; <nl> OP_REQUIRES_OK ( context , <nl> examples . Initialize ( <nl> context , model_weights , num_sparse_features_ , <nl> class DistributedSdcaLargeBatchSolver : public OpKernel { <nl> auto example_state_data = mutable_example_state_data_t . matrix < float > ( ) ; <nl> context - > set_output ( " out_example_state_data " , mutable_example_state_data_t ) ; <nl> <nl> + if ( adaptative_ ) { <nl> + examples . SampleAdaptativeProbabilities ( num_loss_partitions_ , <nl> + regularizations_ , model_weights , <nl> + example_state_data , loss_updater_ ) ; <nl> + } <nl> + <nl> mutex mu ; <nl> Status train_step_status GUARDED_BY ( mu ) ; <nl> + std : : atomic < std : : int64_t > atomic_index ( - 1 ) ; <nl> auto train_step = [ & , this ] ( const int64 begin , const int64 end ) { <nl> / / The static_cast here is safe since begin and end can be at most <nl> / / num_examples which is an int . <nl> - for ( int example_index = static_cast < int > ( begin ) ; example_index < end ; <nl> - + + example_index ) { <nl> + for ( int id = static_cast < int > ( begin ) ; id < end ; + + id ) { <nl> + const int64 example_index = <nl> + examples . sampled_index ( + + atomic_index , adaptative_ ) ; <nl> const Example & example = examples . example ( example_index ) ; <nl> const float dual = example_state_data ( example_index , 0 ) ; <nl> const float example_weight = example . example_weight ( ) ; <nl> class DistributedSdcaLargeBatchSolver : public OpKernel { <nl> / / primal loss . <nl> const ExampleStatistics example_statistics = <nl> example . ComputeWxAndWeightedExampleNorm ( <nl> - num_partitions_ , model_weights , regularizations_ ) ; <nl> + num_loss_partitions_ , model_weights , regularizations_ ) ; <nl> <nl> const double new_dual = loss_updater_ - > ComputeUpdatedDual ( <nl> - num_partitions_ , example_label , example_weight , dual , <nl> + num_loss_partitions_ , example_label , example_weight , dual , <nl> example_statistics . wx , example_statistics . normalized_squared_norm ) ; <nl> <nl> / / Compute new weights . <nl> class DistributedSdcaLargeBatchSolver : public OpKernel { <nl> const int64 kCostPerUnit = examples . num_features ( ) ; <nl> const DeviceBase : : CpuWorkerThreads & worker_threads = <nl> * context - > device ( ) - > tensorflow_cpu_worker_threads ( ) ; <nl> + <nl> Shard ( worker_threads . num_threads , worker_threads . workers , <nl> examples . num_examples ( ) , kCostPerUnit , train_step ) ; <nl> OP_REQUIRES_OK ( context , train_step_status ) ; <nl> class DistributedSdcaLargeBatchSolver : public OpKernel { <nl> int num_sparse_features_with_values_ = 0 ; <nl> int num_dense_features_ = 0 ; <nl> int num_inner_iterations_ = 0 ; <nl> - int num_partitions_ = 0 ; <nl> + int num_loss_partitions_ = 0 ; <nl> + bool adaptative_ ; <nl> Regularizations regularizations_ ; <nl> } ; <nl> REGISTER_KERNEL_BUILDER ( <nl> mmm a / tensorflow / contrib / linear_optimizer / kernels / sdca_ops_test . cc <nl> ppp b / tensorflow / contrib / linear_optimizer / kernels / sdca_ops_test . cc <nl> void GetGraphs ( const int32 num_examples , const int32 num_sparse_feature_groups , <nl> . Attr ( " num_dense_features " , num_dense_feature_groups ) <nl> . Attr ( " l1 " , 0 . 0 ) <nl> . Attr ( " l2 " , 1 . 0 ) <nl> - . Attr ( " num_partitions " , 1 ) <nl> + . Attr ( " num_loss_partitions " , 1 ) <nl> . Attr ( " num_inner_iterations " , 2 ) <nl> . Input ( sparse_example_indices ) <nl> . Input ( sparse_feature_indices ) <nl> mmm a / tensorflow / contrib / linear_optimizer / kernels / smooth - hinge - loss . h <nl> ppp b / tensorflow / contrib / linear_optimizer / kernels / smooth - hinge - loss . h <nl> class SmoothHingeLossUpdater : public DualLossUpdater { <nl> * example_label ) ; <nl> } <nl> <nl> + double PrimalLossDerivative ( const double wx , const double label , <nl> + const double example_weight ) const final { <nl> + if ( label * wx > = 1 ) { <nl> + return 0 ; <nl> + } <nl> + if ( label * wx < = 1 - gamma ) { <nl> + return - label ; <nl> + } <nl> + return ( wx - label ) / gamma ; <nl> + } <nl> + <nl> + double SmoothnessConstant ( ) const final { return gamma ; } <nl> + <nl> private : <nl> / / Smoothness constant of smooth hinge loss <nl> / / TODO ( sibyl - Aix6ihai ) : expose this parameter <nl> mmm a / tensorflow / contrib / linear_optimizer / kernels / squared - loss . h <nl> ppp b / tensorflow / contrib / linear_optimizer / kernels / squared - loss . h <nl> class SquaredLossUpdater : public DualLossUpdater { <nl> / / be 1 + | | x_i | | ^ 2 / ( \ lambda n ) ( without the 2 multiplier ) . <nl> / / <nl> / / The CoCoA + modification is detailed in readme . md . <nl> - double ComputeUpdatedDual ( const int num_partitions , const double label , <nl> + double ComputeUpdatedDual ( const int num_loss_partitions , const double label , <nl> const double example_weight , <nl> const double current_dual , const double wx , <nl> const double weighted_example_norm ) const final { <nl> const double delta_numerator = label - current_dual - wx ; <nl> const double delta_denominator = <nl> - 1 + num_partitions * weighted_example_norm * example_weight ; <nl> + 1 + num_loss_partitions * weighted_example_norm * example_weight ; <nl> return current_dual + delta_numerator / delta_denominator ; <nl> } <nl> <nl> class SquaredLossUpdater : public DualLossUpdater { <nl> return error * error * example_weight * 0 . 5 ; <nl> } <nl> <nl> + inline double PrimalLossDerivative ( const double wx , const double label , <nl> + const double example_weight ) const final { <nl> + return ( wx - label ) * example_weight ; <nl> + } <nl> + <nl> + inline double SmoothnessConstant ( ) const final { return 1 . 0 ; } <nl> + <nl> / / Labels don ' t require conversion for linear regression . <nl> Status ConvertLabel ( float * const example_label ) const final { <nl> return Status : : OK ( ) ; <nl> mmm a / tensorflow / contrib / linear_optimizer / ops / sdca_ops . cc <nl> ppp b / tensorflow / contrib / linear_optimizer / ops / sdca_ops . cc <nl> REGISTER_OP ( " DistributedSdcaLargeBatchSolver " ) <nl> . Attr ( <nl> " loss_type : { ' logistic_loss ' , ' squared_loss ' , ' hinge_loss ' , " <nl> " ' smooth_hinge_loss ' } " ) <nl> + . Attr ( " adaptative : bool = false " ) <nl> . Attr ( " num_sparse_features : int > = 0 " ) <nl> . Attr ( " num_sparse_features_with_values : int > = 0 " ) <nl> . Attr ( " num_dense_features : int > = 0 " ) <nl> . Attr ( " l1 : float " ) <nl> . Attr ( " l2 : float " ) <nl> - . Attr ( " num_partitions : int > = 1 " ) <nl> + . Attr ( " num_loss_partitions : int > = 1 " ) <nl> . Attr ( " num_inner_iterations : int > = 1 " ) <nl> . Input ( " sparse_example_indices : num_sparse_features * int64 " ) <nl> . Input ( " sparse_feature_indices : num_sparse_features * int64 " ) <nl> num_sparse_features_with_values : Number of sparse feature groups with values <nl> num_dense_features : Number of dense feature groups to train on . <nl> l1 : Symmetric l1 regularization strength . <nl> l2 : Symmetric l2 regularization strength . <nl> - num_partitions : Number of partitions of the loss function . <nl> + num_loss_partitions : Number of partitions of the global loss function . <nl> num_inner_iterations : Number of iterations per mini - batch . <nl> sparse_example_indices : a list of vectors which contain example indices . <nl> sparse_feature_indices : a list of vectors which contain feature indices . <nl> mmm a / tensorflow / contrib / linear_optimizer / python / kernel_tests / sdca_ops_test . py <nl> ppp b / tensorflow / contrib / linear_optimizer / python / kernel_tests / sdca_ops_test . py <nl> <nl> <nl> _MAX_ITERATIONS = 100 <nl> _SHARD_NUMBERS = [ None , 1 , 3 , 10 ] <nl> - _NUM_PARTITIONS = [ 2 , 4 ] <nl> + _NUM_LOSS_PARTITIONS = [ 2 , 4 ] <nl> <nl> def make_example_proto ( feature_dict , target , value = 1 . 0 ) : <nl> e = tf . train . Example ( ) <nl> def testDistributedSimple ( self ) : <nl> ] <nl> example_weights = [ 1 . 0 , 1 . 0 ] <nl> for num_shards in _SHARD_NUMBERS : <nl> - for num_partitions in _NUM_PARTITIONS : <nl> + for num_loss_partitions in _NUM_LOSS_PARTITIONS : <nl> with self . _single_threaded_test_session ( ) : <nl> examples = make_example_dict ( example_protos , example_weights ) <nl> variables = make_variable_dict ( 1 , 1 ) <nl> def testDistributedSimple ( self ) : <nl> symmetric_l1_regularization = 0 , <nl> loss_type = ' logistic_loss ' , <nl> num_table_shards = num_shards , <nl> - num_partitions = num_partitions ) <nl> + num_loss_partitions = num_loss_partitions ) <nl> <nl> lr = SdcaModel ( examples , variables , options ) <nl> tf . initialize_all_variables ( ) . run ( ) <nl> def Minimize ( ) : <nl> train_op . run ( ) <nl> <nl> threads = [ ] <nl> - for _ in range ( num_partitions ) : <nl> + for _ in range ( num_loss_partitions ) : <nl> threads . append ( Thread ( target = Minimize ) ) <nl> threads [ - 1 ] . start ( ) <nl> <nl> mmm a / tensorflow / contrib / linear_optimizer / python / ops / sdca_ops . py <nl> ppp b / tensorflow / contrib / linear_optimizer / python / ops / sdca_ops . py <nl> class SdcaModel ( object ) : <nl> symmetric_l1_regularization : 0 . 0 <nl> symmetric_l2_regularization : 1 . 0 <nl> loss_type : " logistic_loss " <nl> - num_partitions : 1 ( Optional , with default value of 1 . Number of <nl> + num_loss_partitions : 1 ( Optional , with default value of 1 . Number of <nl> partitions of the global loss function , 1 means single machine solver , <nl> - and > = 1 when we have more than one optimizer working concurrently . ) <nl> + and > 1 when we have more than one optimizer working concurrently . ) <nl> num_table_shards : 1 ( Optional , with default value of 1 . Number of shards <nl> of the internal state table , typically set to match the number of <nl> parameter servers for large data sets . <nl> def _symmetric_l2_regularization ( self ) : <nl> # Algorithmic requirement ( for now ) is to have minimal l2 of 1 . 0 . <nl> return max ( self . _options [ ' symmetric_l2_regularization ' ] , 1 . 0 ) <nl> <nl> - def _num_partitions ( self ) : <nl> + def _num_loss_partitions ( self ) : <nl> # Number of partitions of the global objective . <nl> - # TODO ( andreasst ) : set num_partitions automatically based on the number <nl> + # TODO ( andreasst ) : set num_loss_partitions automatically based on the number <nl> # of workers <nl> - return self . _options . get ( ' num_partitions ' , 1 ) <nl> + return self . _options . get ( ' num_loss_partitions ' , 1 ) <nl> <nl> def _num_table_shards ( self ) : <nl> # Number of hash table shards . <nl> def minimize ( self , global_step = None , name = None ) : <nl> loss_type = self . _options [ ' loss_type ' ] , <nl> l1 = self . _options [ ' symmetric_l1_regularization ' ] , <nl> l2 = self . _symmetric_l2_regularization ( ) , <nl> - num_partitions = self . _num_partitions ( ) , <nl> + num_loss_partitions = self . _num_loss_partitions ( ) , <nl> # TODO ( sibyl - Aix6ihai ) : Provide empirical evidence for this . It is better <nl> # to run more than one iteration on single mini - batch as we want to <nl> # spend more time in compute . SDCA works better with larger <nl> mmm a / tensorflow / contrib / linear_optimizer / python / sdca_optimizer . py <nl> ppp b / tensorflow / contrib / linear_optimizer / python / sdca_optimizer . py <nl> class SDCAOptimizer ( object ) : <nl> real_feature_column = real_valued_column ( . . . ) <nl> sparse_feature_column = sparse_column_with_hash_bucket ( . . . ) <nl> sdca_optimizer = linear . SDCAOptimizer ( example_id_column = ' example_id ' , <nl> - num_partitions = 1 , <nl> + num_loss_partitions = 1 , <nl> num_table_shards = 1 , <nl> symmetric_l2_regularization = 2 . 0 ) <nl> classifier = tf . contrib . learn . LinearClassifier ( <nl> class SDCAOptimizer ( object ) : <nl> Here the expectation is that the input_fn_ * functions passed to train and <nl> evaluate return a pair ( dict , label_tensor ) where dict has ` example_id_column ` <nl> as ` key ` whose value is a ` Tensor ` of shape [ batch_size ] and dtype string . <nl> - num_partitions defines the number of partitions of the loss function , which <nl> - is equivalent to the number of concurrent workers running the train steps . <nl> - num_table_shards defines the number of shards for the internal state table , <nl> - typically set to match the number of parameter servers for large data sets . <nl> + num_loss_partitions defines the number of partitions of the global loss <nl> + function and should be set to ( # concurrent train ops / per worker ) x ( # workers ) . <nl> + Convergence of ( global ) loss is guranteed if num_loss_partitions is larger or <nl> + equal to the above product . Larger values for num_loss_partitions lead to <nl> + slower convergence . The recommended value for num_loss_partitions in tf . learn <nl> + ( where currently there is one process per worker ) is the number of workers <nl> + running the train steps . It defaults to 1 ( single machine ) . num_table_shards <nl> + defines the number of shards for the internal state table , typically set to <nl> + match the number of parameter servers for large data sets . <nl> " " " <nl> <nl> def __init__ ( self , <nl> example_id_column , <nl> - num_partitions = 1 , <nl> + num_loss_partitions = 1 , <nl> num_table_shards = None , <nl> symmetric_l1_regularization = 0 . 0 , <nl> symmetric_l2_regularization = 1 . 0 ) : <nl> self . _example_id_column = example_id_column <nl> - self . _num_partitions = num_partitions <nl> + self . _num_loss_partitions = num_loss_partitions <nl> self . _num_table_shards = num_table_shards <nl> self . _symmetric_l1_regularization = symmetric_l1_regularization <nl> self . _symmetric_l2_regularization = symmetric_l2_regularization <nl> def _training_examples_and_variables ( ) : <nl> options = dict ( <nl> symmetric_l1_regularization = self . _symmetric_l1_regularization , <nl> symmetric_l2_regularization = self . _symmetric_l2_regularization , <nl> - num_partitions = self . _num_partitions , <nl> + num_loss_partitions = self . _num_loss_partitions , <nl> num_table_shards = self . _num_table_shards , <nl> loss_type = loss_type ) ) <nl> return sdca_model . minimize ( global_step = global_step ) <nl> mmm a / tensorflow / contrib / makefile / README . md <nl> ppp b / tensorflow / contrib / makefile / README . md <nl> You should download the example graph from [ https : / / storage . googleapis . com / downl <nl> <nl> _Note : This has only been tested on Ubuntu . _ <nl> <nl> - Don ' t forget to download dependencies if you haven ' t already : <nl> - <nl> - ` ` ` bash <nl> - tensorflow / contrib / makefile / download_dependencies . sh <nl> - ` ` ` <nl> - <nl> - You will need install a version of <nl> - [ protobuf 3 ] ( https : / / github . com / google / protobuf ) on your system . We strongly <nl> - recommend that you compile and install the version downloaded in the script <nl> - above . <nl> - <nl> - On Ubuntu , you can do this : <nl> + As a first step , you need to make sure the required packages are installed : <nl> ` ` ` bash <nl> - sudo apt - get install autoconf automake libtool curl make g + + unzip <nl> - pushd . <nl> - cd tensorflow / contrib / makefile / downloads / protobuf <nl> - . / autogen . sh <nl> - . / configure <nl> - make <nl> - make check <nl> - sudo make install <nl> - sudo ldconfig # refresh shared library cache <nl> - popd <nl> + sudo apt - get install autoconf automake libtool curl make g + + unzip zlib1g - dev \ <nl> + git python <nl> ` ` ` <nl> <nl> - If you have issues ( or can ' t use apt - get ) , see <nl> - [ these instructions ] ( https : / / github . com / google / protobuf / blob / master / src / README . md ) <nl> - for specific installation of C + + support tools . <nl> - <nl> - After you have installed protobufs , you can run this from the repository root : <nl> - <nl> + You should then be able to run the ` build_all_linux . sh ` script to compile : <nl> ` ` ` bash <nl> - make - f tensorflow / contrib / makefile / Makefile <nl> + tensorflow / contrib / makefile / build_all_linux . sh <nl> ` ` ` <nl> <nl> This should compile a static library in <nl> mmm a / tensorflow / contrib / makefile / proto_text_cc_files . txt <nl> ppp b / tensorflow / contrib / makefile / proto_text_cc_files . txt <nl> tensorflow / core / platform / tensor_coding . cc <nl> tensorflow / core / platform / protobuf_util . cc <nl> tensorflow / core / platform / posix / posix_file_system . cc <nl> tensorflow / core / platform / posix / port . cc <nl> + tensorflow / core / platform / posix / error . cc <nl> tensorflow / core / platform / posix / env . cc <nl> tensorflow / core / platform / load_library . cc <nl> tensorflow / core / platform / file_system . cc <nl> mmm a / tensorflow / contrib / quantization / kernels / hexagon / quantized_matmul_op_for_hexagon_test . cc <nl> ppp b / tensorflow / contrib / quantization / kernels / hexagon / quantized_matmul_op_for_hexagon_test . cc <nl> class QuantizedMatMulOpForHexagonTest : public OpsTestBase { <nl> < < hexagon_gemm_wrapper_GetWrapperVersion ( ) <nl> < < " , hexagon binary version = " <nl> < < hexagon_gemm_wrapper_GetHexagonBinaryVersion ( ) < < " ) " ; <nl> + LOG ( INFO ) < < " Cpu frequency = " <nl> + < < profile_utils : : CpuUtils : : GetCpuFrequency ( ) ; <nl> # else <nl> LOG ( WARNING ) < < " Hexagon libs are not linked . " ; <nl> # endif <nl> TEST_F ( QuantizedMatMulOpForHexagonTest , EvaluateSharedLibOverhead ) { <nl> const int wrapper_version = hexagon_gemm_wrapper_GetWrapperVersion ( ) ; <nl> const uint64 overhead_shared_lib_end = <nl> profile_utils : : CpuUtils : : GetCurrentClockCycle ( ) ; <nl> + const uint64 overhead_shared_lib_diff = <nl> + ( overhead_shared_lib_end - overhead_shared_lib_start ) ; <nl> const uint64 overhead_hexagon_rpc_start = <nl> profile_utils : : CpuUtils : : GetCurrentClockCycle ( ) ; <nl> const int hexagon_binary_version = <nl> hexagon_gemm_wrapper_GetHexagonBinaryVersion ( ) ; <nl> const uint64 overhead_hexagon_rpc_end = <nl> profile_utils : : CpuUtils : : GetCurrentClockCycle ( ) ; <nl> + const uint64 overhead_hexagon_rpc_diff = <nl> + ( overhead_hexagon_rpc_end - overhead_hexagon_rpc_start ) ; <nl> LOG ( INFO ) < < " Shared lib ( ver = " < < wrapper_version < < " ) overhead is " <nl> - < < ( overhead_shared_lib_end - overhead_shared_lib_start ) <nl> - < < " cycles " ; <nl> + < < overhead_shared_lib_diff < < " cycles , time = " <nl> + < < std : : chrono : : duration_cast < std : : chrono : : microseconds > ( <nl> + profile_utils : : CpuUtils : : ConvertClockCycleToTime ( <nl> + overhead_shared_lib_diff ) ) <nl> + . count ( ) <nl> + < < " usec " ; <nl> LOG ( INFO ) < < " hexagon rpc ( ver = " < < hexagon_binary_version <nl> - < < " ) overhead is " <nl> - < < ( overhead_hexagon_rpc_end - overhead_hexagon_rpc_start ) <nl> - < < " cycles " ; <nl> + < < " ) overhead is " < < overhead_hexagon_rpc_diff <nl> + < < " cycles , time = " <nl> + < < std : : chrono : : duration_cast < std : : chrono : : microseconds > ( <nl> + profile_utils : : CpuUtils : : ConvertClockCycleToTime ( <nl> + overhead_hexagon_rpc_diff ) ) <nl> + . count ( ) <nl> + < < " usec " ; <nl> } <nl> # endif <nl> <nl> mmm a / tensorflow / contrib / rnn / python / kernel_tests / rnn_cell_test . py <nl> ppp b / tensorflow / contrib / rnn / python / kernel_tests / rnn_cell_test . py <nl> def testAttentionCellWrapperCorrectResult ( self ) : <nl> self . assertAllClose ( sess . run ( output ) , expected_output ) <nl> self . assertAllClose ( sess . run ( state ) , expected_state ) <nl> <nl> + <nl> + class LayerNormBasicLSTMCellTest ( tf . test . TestCase ) : <nl> + <nl> + # NOTE : all the values in the current test case have been calculated . <nl> + <nl> + def testBasicLSTMCell ( self ) : <nl> + with self . test_session ( ) as sess : <nl> + with tf . variable_scope ( " root " , initializer = tf . constant_initializer ( 0 . 5 ) ) : <nl> + x = tf . zeros ( [ 1 , 2 ] ) <nl> + c0 = tf . zeros ( [ 1 , 2 ] ) <nl> + h0 = tf . zeros ( [ 1 , 2 ] ) <nl> + state0 = tf . nn . rnn_cell . LSTMStateTuple ( c0 , h0 ) <nl> + c1 = tf . zeros ( [ 1 , 2 ] ) <nl> + h1 = tf . zeros ( [ 1 , 2 ] ) <nl> + state1 = tf . nn . rnn_cell . LSTMStateTuple ( c1 , h1 ) <nl> + state = ( state0 , state1 ) <nl> + cell = tf . contrib . rnn . LayerNormBasicLSTMCell ( 2 ) <nl> + cell = tf . nn . rnn_cell . MultiRNNCell ( [ cell ] * 2 ) <nl> + g , out_m = cell ( x , state ) <nl> + sess . run ( [ tf . initialize_all_variables ( ) ] ) <nl> + res = sess . run ( [ g , out_m ] , <nl> + { <nl> + x . name : np . array ( [ [ 1 . , 1 . ] ] ) , <nl> + c0 . name : 0 . 1 * np . asarray ( [ [ 0 , 1 ] ] ) , <nl> + h0 . name : 0 . 1 * np . asarray ( [ [ 2 , 3 ] ] ) , <nl> + c1 . name : 0 . 1 * np . asarray ( [ [ 4 , 5 ] ] ) , <nl> + h1 . name : 0 . 1 * np . asarray ( [ [ 6 , 7 ] ] ) , <nl> + } ) <nl> + <nl> + expected_h = np . array ( [ [ - 0 . 38079708 , 0 . 38079708 ] ] ) <nl> + expected_state0_c = np . array ( [ [ - 1 . 0 , 1 . 0 ] ] ) <nl> + expected_state0_h = np . array ( [ [ - 0 . 38079708 , 0 . 38079708 ] ] ) <nl> + expected_state1_c = np . array ( [ [ - 1 . 0 , 1 . 0 ] ] ) <nl> + expected_state1_h = np . array ( [ [ - 0 . 38079708 , 0 . 38079708 ] ] ) <nl> + <nl> + actual_h = res [ 0 ] <nl> + actual_state0_c = res [ 1 ] [ 0 ] . c <nl> + actual_state0_h = res [ 1 ] [ 0 ] . h <nl> + actual_state1_c = res [ 1 ] [ 1 ] . c <nl> + actual_state1_h = res [ 1 ] [ 1 ] . h <nl> + <nl> + self . assertAllClose ( actual_h , expected_h , 1e - 5 ) <nl> + self . assertAllClose ( expected_state0_c , actual_state0_c , 1e - 5 ) <nl> + self . assertAllClose ( expected_state0_h , actual_state0_h , 1e - 5 ) <nl> + self . assertAllClose ( expected_state1_c , actual_state1_c , 1e - 5 ) <nl> + self . assertAllClose ( expected_state1_h , actual_state1_h , 1e - 5 ) <nl> + <nl> + with tf . variable_scope ( " other " , initializer = tf . constant_initializer ( 0 . 5 ) ) : <nl> + x = tf . zeros ( [ 1 , 3 ] ) # Test BasicLSTMCell with input_size ! = num_units . <nl> + c = tf . zeros ( [ 1 , 2 ] ) <nl> + h = tf . zeros ( [ 1 , 2 ] ) <nl> + state = tf . nn . rnn_cell . LSTMStateTuple ( c , h ) <nl> + cell = tf . contrib . rnn . LayerNormBasicLSTMCell ( 2 ) <nl> + g , out_m = cell ( x , state ) <nl> + sess . run ( [ tf . initialize_all_variables ( ) ] ) <nl> + res = sess . run ( [ g , out_m ] , <nl> + { <nl> + x . name : np . array ( [ [ 1 . , 1 . , 1 . ] ] ) , <nl> + c . name : 0 . 1 * np . asarray ( [ [ 0 , 1 ] ] ) , <nl> + h . name : 0 . 1 * np . asarray ( [ [ 2 , 3 ] ] ) , <nl> + } ) <nl> + <nl> + expected_h = np . array ( [ [ - 0 . 38079708 , 0 . 38079708 ] ] ) <nl> + expected_c = np . array ( [ [ - 1 . 0 , 1 . 0 ] ] ) <nl> + self . assertEqual ( len ( res ) , 2 ) <nl> + self . assertAllClose ( res [ 0 ] , expected_h , 1e - 5 ) <nl> + self . assertAllClose ( res [ 1 ] . c , expected_c , 1e - 5 ) <nl> + self . assertAllClose ( res [ 1 ] . h , expected_h , 1e - 5 ) <nl> + <nl> + def testBasicLSTMCellWithStateTuple ( self ) : <nl> + with self . test_session ( ) as sess : <nl> + with tf . variable_scope ( " root " , initializer = tf . constant_initializer ( 0 . 5 ) ) : <nl> + x = tf . zeros ( [ 1 , 2 ] ) <nl> + c0 = tf . zeros ( [ 1 , 2 ] ) <nl> + h0 = tf . zeros ( [ 1 , 2 ] ) <nl> + state0 = tf . nn . rnn_cell . LSTMStateTuple ( c0 , h0 ) <nl> + c1 = tf . zeros ( [ 1 , 2 ] ) <nl> + h1 = tf . zeros ( [ 1 , 2 ] ) <nl> + state1 = tf . nn . rnn_cell . LSTMStateTuple ( c1 , h1 ) <nl> + cell = tf . contrib . rnn . LayerNormBasicLSTMCell ( 2 ) <nl> + cell = tf . nn . rnn_cell . MultiRNNCell ( [ cell ] * 2 ) <nl> + h , ( s0 , s1 ) = cell ( x , ( state0 , state1 ) ) <nl> + sess . run ( [ tf . initialize_all_variables ( ) ] ) <nl> + res = sess . run ( [ h , s0 , s1 ] , <nl> + { <nl> + x . name : np . array ( [ [ 1 . , 1 . ] ] ) , <nl> + c0 . name : 0 . 1 * np . asarray ( [ [ 0 , 1 ] ] ) , <nl> + h0 . name : 0 . 1 * np . asarray ( [ [ 2 , 3 ] ] ) , <nl> + c1 . name : 0 . 1 * np . asarray ( [ [ 4 , 5 ] ] ) , <nl> + h1 . name : 0 . 1 * np . asarray ( [ [ 6 , 7 ] ] ) , <nl> + } ) <nl> + <nl> + expected_h = np . array ( [ [ - 0 . 38079708 , 0 . 38079708 ] ] ) <nl> + expected_h0 = np . array ( [ [ - 0 . 38079708 , 0 . 38079708 ] ] ) <nl> + expected_c0 = np . array ( [ [ - 1 . 0 , 1 . 0 ] ] ) <nl> + expected_h1 = np . array ( [ [ - 0 . 38079708 , 0 . 38079708 ] ] ) <nl> + expected_c1 = np . array ( [ [ - 1 . 0 , 1 . 0 ] ] ) <nl> + <nl> + self . assertEqual ( len ( res ) , 3 ) <nl> + self . assertAllClose ( res [ 0 ] , expected_h , 1e - 5 ) <nl> + self . assertAllClose ( res [ 1 ] . c , expected_c0 , 1e - 5 ) <nl> + self . assertAllClose ( res [ 1 ] . h , expected_h0 , 1e - 5 ) <nl> + self . assertAllClose ( res [ 2 ] . c , expected_c1 , 1e - 5 ) <nl> + self . assertAllClose ( res [ 2 ] . h , expected_h1 , 1e - 5 ) <nl> + <nl> + def testBasicLSTMCellWithDropout ( self ) : <nl> + <nl> + def _is_close ( x , y , digits = 4 ) : <nl> + delta = x - y <nl> + return delta < 10 * * ( - digits ) <nl> + <nl> + def _is_close_in ( x , items , digits = 4 ) : <nl> + for i in items : <nl> + if _is_close ( x , i , digits ) : <nl> + return True <nl> + return False <nl> + <nl> + keep_prob = 0 . 5 <nl> + c_high = 2 . 9998924946 <nl> + c_low = 0 . 999983298578 <nl> + h_low = 0 . 761552567265 <nl> + h_high = 0 . 995008519604 <nl> + num_units = 5 <nl> + allowed_low = [ 2 , 3 ] <nl> + <nl> + with self . test_session ( ) as sess : <nl> + with tf . variable_scope ( " other " , initializer = tf . constant_initializer ( 1 ) ) : <nl> + x = tf . zeros ( [ 1 , 5 ] ) <nl> + c = tf . zeros ( [ 1 , 5 ] ) <nl> + h = tf . zeros ( [ 1 , 5 ] ) <nl> + state = tf . nn . rnn_cell . LSTMStateTuple ( c , h ) <nl> + cell = tf . contrib . rnn . LayerNormBasicLSTMCell ( <nl> + num_units , layer_norm = False , dropout_keep_prob = keep_prob ) <nl> + <nl> + g , s = cell ( x , state ) <nl> + sess . run ( [ tf . initialize_all_variables ( ) ] ) <nl> + res = sess . run ( [ g , s ] , <nl> + { <nl> + x . name : np . ones ( [ 1 , 5 ] ) , <nl> + c . name : np . ones ( [ 1 , 5 ] ) , <nl> + h . name : np . ones ( [ 1 , 5 ] ) , <nl> + } ) <nl> + <nl> + # Since the returned tensors are of size [ 1 , n ] <nl> + # get the first component right now . <nl> + actual_h = res [ 0 ] [ 0 ] <nl> + actual_state_c = res [ 1 ] . c [ 0 ] <nl> + actual_state_h = res [ 1 ] . h [ 0 ] <nl> + <nl> + # For each item in ` c ` ( the cell inner state ) check that <nl> + # it is equal to one of the allowed values ` c_high ` ( not <nl> + # dropped out ) or ` c_low ` ( dropped out ) and verify that the <nl> + # corresponding item in ` h ` ( the cell activation ) is coherent . <nl> + # Count the dropped activations and check that their number is <nl> + # coherent with the dropout probability . <nl> + dropped_count = 0 <nl> + self . assertTrue ( ( actual_h = = actual_state_h ) . all ( ) ) <nl> + for citem , hitem in zip ( actual_state_c , actual_state_h ) : <nl> + self . assertTrue ( _is_close_in ( citem , [ c_low , c_high ] ) ) <nl> + if _is_close ( citem , c_low ) : <nl> + self . assertTrue ( _is_close ( hitem , h_low ) ) <nl> + dropped_count + = 1 <nl> + elif _is_close ( citem , c_high ) : <nl> + self . assertTrue ( _is_close ( hitem , h_high ) ) <nl> + self . assertIn ( dropped_count , allowed_low ) <nl> + <nl> + <nl> if __name__ = = " __main__ " : <nl> tf . test . main ( ) <nl> mmm a / tensorflow / contrib / rnn / python / ops / rnn_cell . py <nl> ppp b / tensorflow / contrib / rnn / python / ops / rnn_cell . py <nl> <nl> import collections <nl> import math <nl> <nl> + from tensorflow . contrib . layers . python . layers import layers <nl> from tensorflow . python . framework import ops <nl> from tensorflow . python . ops import array_ops <nl> from tensorflow . python . ops import clip_ops <nl> + from tensorflow . python . ops import init_ops <nl> from tensorflow . python . ops import math_ops <nl> from tensorflow . python . ops import nn_ops <nl> from tensorflow . python . ops import rnn_cell <nl> def _attention ( self , query , attn_states ) : <nl> new_attns = array_ops . reshape ( d , [ - 1 , self . _attn_size ] ) <nl> new_attn_states = array_ops . slice ( attn_states , [ 0 , 1 , 0 ] , [ - 1 , - 1 , - 1 ] ) <nl> return new_attns , new_attn_states <nl> + <nl> + <nl> + class LayerNormBasicLSTMCell ( rnn_cell . RNNCell ) : <nl> + " " " LSTM unit with layer normalization and recurrent dropout . <nl> + <nl> + This class adds layer normalization and recurrent dropout to a <nl> + basic LSTM unit . Layer normalization implementation is based on : <nl> + <nl> + https : / / arxiv . org / abs / 1607 . 06450 . <nl> + <nl> + " Layer Normalization " <nl> + Jimmy Lei Ba , Jamie Ryan Kiros , Geoffrey E . Hinton <nl> + <nl> + and is applied before the internal nonlinearities . <nl> + Recurrent dropout is base on : <nl> + <nl> + https : / / arxiv . org / abs / 1603 . 05118 <nl> + <nl> + " Recurrent Dropout without Memory Loss " <nl> + Stanislau Semeniuta , Aliaksei Severyn , Erhardt Barth . <nl> + " " " <nl> + <nl> + def __init__ ( self , num_units , forget_bias = 1 . 0 , <nl> + input_size = None , activation = math_ops . tanh , <nl> + layer_norm = True , norm_gain = 1 . 0 , norm_shift = 0 . 0 , <nl> + dropout_keep_prob = 1 . 0 , dropout_prob_seed = None ) : <nl> + " " " Initializes the basic LSTM cell . <nl> + <nl> + Args : <nl> + num_units : int , The number of units in the LSTM cell . <nl> + forget_bias : float , The bias added to forget gates ( see above ) . <nl> + input_size : Deprecated and unused . <nl> + activation : Activation function of the inner states . <nl> + layer_norm : If ` True ` , layer normalization will be applied . <nl> + norm_gain : float , The layer normalization gain initial value . If <nl> + ` layer_norm ` has been set to ` False ` , this argument will be ignored . <nl> + norm_shift : float , The layer normalization shift initial value . If <nl> + ` layer_norm ` has been set to ` False ` , this argument will be ignored . <nl> + dropout_keep_prob : unit Tensor or float between 0 and 1 representing the <nl> + recurrent dropout probability value . If float and 1 . 0 , no dropout will <nl> + be applied . <nl> + dropout_prob_seed : ( optional ) integer , the randomness seed . <nl> + " " " <nl> + <nl> + if input_size is not None : <nl> + logging . warn ( " % s : The input_size parameter is deprecated . " , self ) <nl> + <nl> + self . _num_units = num_units <nl> + self . _activation = activation <nl> + self . _forget_bias = forget_bias <nl> + self . _keep_prob = dropout_keep_prob <nl> + self . _seed = dropout_prob_seed <nl> + self . _layer_norm = layer_norm <nl> + self . _g = norm_gain <nl> + self . _b = norm_shift <nl> + <nl> + @ property <nl> + def state_size ( self ) : <nl> + return rnn_cell . LSTMStateTuple ( self . _num_units , self . _num_units ) <nl> + <nl> + @ property <nl> + def output_size ( self ) : <nl> + return self . _num_units <nl> + <nl> + def _norm ( self , inp , scope ) : <nl> + with vs . variable_scope ( scope ) as scope : <nl> + shape = inp . get_shape ( ) [ - 1 : ] <nl> + gamma_init = init_ops . constant_initializer ( self . _g ) <nl> + beta_init = init_ops . constant_initializer ( self . _b ) <nl> + gamma = vs . get_variable ( " gamma " , shape = shape , initializer = gamma_init ) # pylint : disable = unused - variable <nl> + beta = vs . get_variable ( " beta " , shape = shape , initializer = beta_init ) # pylint : disable = unused - variable <nl> + normalized = layers . layer_norm ( inp , reuse = True , scope = scope ) <nl> + return normalized <nl> + <nl> + def _linear ( self , args , scope = " linear " ) : <nl> + out_size = 4 * self . _num_units <nl> + proj_size = args . get_shape ( ) [ - 1 ] <nl> + with vs . variable_scope ( scope ) as scope : <nl> + weights = vs . get_variable ( " weights " , [ proj_size , out_size ] ) <nl> + out = math_ops . matmul ( args , weights ) <nl> + if not self . _layer_norm : <nl> + bias = vs . get_variable ( " b " , [ out_size ] ) <nl> + out + = bias <nl> + return out <nl> + <nl> + def __call__ ( self , inputs , state , scope = None ) : <nl> + " " " LSTM cell with layer normalization and recurrent dropout . " " " <nl> + <nl> + with vs . variable_scope ( scope or type ( self ) . __name__ ) as scope : # LayerNormBasicLSTMCell # pylint : disable = unused - variables <nl> + c , h = state <nl> + args = array_ops . concat ( 1 , [ inputs , h ] ) <nl> + concat = self . _linear ( args ) <nl> + <nl> + i , j , f , o = array_ops . split ( 1 , 4 , concat ) <nl> + if self . _layer_norm : <nl> + i = self . _norm ( i , " input " ) <nl> + j = self . _norm ( j , " transform " ) <nl> + f = self . _norm ( f , " forget " ) <nl> + o = self . _norm ( o , " output " ) <nl> + <nl> + g = self . _activation ( j ) <nl> + if ( not isinstance ( self . _keep_prob , float ) ) or self . _keep_prob < 1 : <nl> + g = nn_ops . dropout ( g , self . _keep_prob , seed = self . _seed ) <nl> + <nl> + new_c = ( c * math_ops . sigmoid ( f + self . _forget_bias ) <nl> + + math_ops . sigmoid ( i ) * g ) <nl> + if self . _layer_norm : <nl> + new_c = self . _norm ( new_c , " state " ) <nl> + new_h = self . _activation ( new_c ) * math_ops . sigmoid ( o ) <nl> + <nl> + new_state = rnn_cell . LSTMStateTuple ( new_c , new_h ) <nl> + return new_h , new_state <nl> mmm a / tensorflow / core / BUILD <nl> ppp b / tensorflow / core / BUILD <nl> cc_library ( <nl> " lib / hash / crc32c . h " , # TODO ( josh11b ) : make internal <nl> " lib / histogram / histogram . h " , <nl> " lib / io / inputbuffer . h " , # TODO ( josh11b ) : make internal <nl> + " lib / io / match . h " , # TODO ( vrv , jeff ) : remove once Env - > Match change is in <nl> " lib / io / path . h " , <nl> " lib / io / proto_encode_helper . h " , <nl> " lib / io / record_reader . h " , <nl> tf_cuda_library ( <nl> name = " core_cpu " , <nl> hdrs = [ <nl> " common_runtime / device . h " , <nl> + " common_runtime / shape_refiner . h " , <nl> " graph / algorithm . h " , <nl> " graph / default_device . h " , <nl> " graph / gradients . h " , <nl> tf_cuda_library ( <nl> " graph / graph_constructor . h " , <nl> " graph / graph_def_builder . h " , <nl> " graph / node_builder . h " , <nl> - " graph / shape_refiner . h " , <nl> " graph / validate . h " , <nl> " public / session . h " , <nl> " public / session_options . h " , <nl> filegroup ( <nl> " platform / default / test_benchmark . * " , <nl> " platform / cuda . h " , <nl> " platform / google / * * / * " , <nl> + " platform / hadoop / * * / * " , <nl> " platform / jpeg . * " , <nl> " platform / png . * " , <nl> " platform / gif . * " , <nl> cc_library ( <nl> " : test " , <nl> " / / tensorflow / core / platform / default / build_config : test_main " , <nl> ] , <nl> + alwayslink = 1 , <nl> ) <nl> <nl> # Low level library tests <nl> tf_cc_tests ( <nl> " graph / node_builder_test . cc " , <nl> " graph / optimizer_cse_test . cc " , <nl> " graph / quantize_training_test . cc " , <nl> - " graph / shape_refiner_test . cc " , <nl> " graph / subgraph_test . cc " , <nl> " graph / tensor_id_test . cc " , <nl> " graph / validate_test . cc " , <nl> tf_cc_test ( <nl> ] , <nl> ) <nl> <nl> + tf_cc_test ( <nl> + name = " common_runtime_shape_refiner_test " , <nl> + size = " small " , <nl> + srcs = [ <nl> + " common_runtime / shape_refiner_test . cc " , <nl> + ] , <nl> + linkstatic = tf_kernel_tests_linkstatic ( ) , <nl> + deps = [ <nl> + " : core " , <nl> + " : core_cpu " , <nl> + " : core_cpu_internal " , <nl> + " : framework " , <nl> + " : framework_internal " , <nl> + " : lib " , <nl> + " : lib_internal " , <nl> + " : ops " , <nl> + " : protos_all_cc " , <nl> + " : test " , <nl> + " : test_main " , <nl> + " : testlib " , <nl> + " / / tensorflow / cc : cc_ops " , <nl> + " / / tensorflow / cc : scope " , <nl> + " / / tensorflow / core / kernels : array " , <nl> + " / / tensorflow / core / kernels : math " , <nl> + " / / third_party / eigen3 " , <nl> + ] , <nl> + ) <nl> + <nl> tf_cc_test ( <nl> name = " common_runtime_direct_session_test " , <nl> size = " small " , <nl> mmm a / tensorflow / core / common_runtime / constant_folding . cc <nl> ppp b / tensorflow / core / common_runtime / constant_folding . cc <nl> void FindConstantFoldableNodes ( const Graph * graph , <nl> } <nl> } <nl> <nl> - typedef std : : pair < Node * , int > NodeAndOutput ; <nl> - <nl> / / Given the constant foldable nodes in ' nodes ' , returns a new graph ' g ' . ' g ' <nl> / / will contain copies of the nodes in ' nodes ' . In addition , if there is an edge <nl> / / going from a node ' n ' in ' nodes ' to another node in ' orig_graph ' but not in <nl> new file mode 100644 <nl> index 0000000000000 . . e0795d1457338 <nl> mmm / dev / null <nl> ppp b / tensorflow / core / common_runtime / shape_refiner . cc <nl> <nl> + / * Copyright 2016 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> + # include " tensorflow / core / common_runtime / shape_refiner . h " <nl> + <nl> + # include < deque > <nl> + # include < memory > <nl> + # include < unordered_set > <nl> + # include < vector > <nl> + <nl> + # include " tensorflow / core / common_runtime / graph_runner . h " <nl> + # include " tensorflow / core / framework / tensor . h " <nl> + # include " tensorflow / core / lib / core / errors . h " <nl> + # include " tensorflow / core / lib / gtl / stl_util . h " <nl> + # include " tensorflow / core / public / session . h " <nl> + <nl> + namespace tensorflow { <nl> + <nl> + ShapeRefiner : : ShapeRefiner ( ) { } <nl> + <nl> + ShapeRefiner : : ~ ShapeRefiner ( ) { gtl : : STLDeleteValues ( & node_to_context_ ) ; } <nl> + <nl> + Status ShapeRefiner : : AddNode ( const Node * node ) { <nl> + / / For each ' input ' of this node , fetch the corresponding shape <nl> + / / from ' input ' s InferenceContext , and store into a vector <nl> + / / indexed by ' node ' s input . <nl> + std : : vector < Node * > input_nodes ( node - > num_inputs ( ) ) ; <nl> + std : : vector < shape_inference : : ShapeHandle > input_shapes ( node - > num_inputs ( ) ) ; <nl> + for ( const Edge * e : node - > in_edges ( ) ) { <nl> + if ( e - > IsControlEdge ( ) ) continue ; <nl> + <nl> + Node * input = e - > src ( ) ; <nl> + auto it = node_to_context_ . find ( input ) ; <nl> + if ( it = = node_to_context_ . end ( ) ) { <nl> + return errors : : FailedPrecondition ( <nl> + " Input " , e - > dst_input ( ) , " ( ' " , input - > name ( ) , " ' ) for ' " , <nl> + node - > name ( ) , " ' was not previously added to ShapeRefiner . " ) ; <nl> + } <nl> + <nl> + shape_inference : : InferenceContext * c = it - > second ; <nl> + DCHECK_GE ( e - > dst_input ( ) , 0 ) ; <nl> + input_nodes [ e - > dst_input ( ) ] = input ; <nl> + input_shapes [ e - > dst_input ( ) ] = c - > output ( e - > src_output ( ) ) ; <nl> + } <nl> + <nl> + / / Get the shape function for this node <nl> + const OpRegistrationData * op_reg_data ; <nl> + / / TODO ( vrv ) : Take in the OpRegistryInterface * instead of taking <nl> + / / the global one . <nl> + TF_RETURN_IF_ERROR ( <nl> + OpRegistry : : Global ( ) - > LookUp ( node - > type_string ( ) , & op_reg_data ) ) ; <nl> + if ( op_reg_data - > shape_inference_fn = = nullptr ) { <nl> + return errors : : InvalidArgument ( <nl> + " No shape inference function exists for op ' " , node - > type_string ( ) , <nl> + " ' , did you forget to define it ? " ) ; <nl> + } <nl> + <nl> + / / This needs to be filled in with real data in a second pass . <nl> + std : : vector < const Tensor * > input_tensors ( node - > num_inputs ( ) ) ; <nl> + std : : vector < Tensor > real_tensors ( node - > num_inputs ( ) ) ; <nl> + std : : vector < bool > attempted_materialization ( node - > num_inputs ( ) ) ; <nl> + <nl> + / / Create the inference context for this node with the existing input shapes . <nl> + std : : unique_ptr < shape_inference : : InferenceContext > c ( <nl> + new shape_inference : : InferenceContext ( & node - > def ( ) , node - > op_def ( ) , <nl> + { } / * input_shapes_string * / , <nl> + input_shapes , input_tensors ) ) ; <nl> + if ( ! c - > construction_status ( ) . ok ( ) ) { <nl> + return c - > construction_status ( ) ; <nl> + } <nl> + <nl> + / / Run the shape inference function , and return if there was an error . <nl> + TF_RETURN_IF_ERROR ( op_reg_data - > shape_inference_fn ( c . get ( ) ) ) ; <nl> + <nl> + / / We must run the shape function repeatedly , in case users write <nl> + / / shape functions where they only conditionally call input_tensor ( ) <nl> + / / based on the values of another input tensor . <nl> + bool rerun_shape_fn ; <nl> + do { <nl> + / / If the result of running shape inference would have benefitted <nl> + / / from knowing the values of input tensors , try to materialize <nl> + / / the results of those tensors , and then run the shape inference <nl> + / / function again using those known tensors . <nl> + rerun_shape_fn = false ; <nl> + <nl> + / / NOTE : It is possible to batch the extraction and <nl> + / / materialization of inputs , instead of materializing one input <nl> + / / at a time like we do below . If input - at - a - time computation <nl> + / / becomes a bottleneck , we could separate ExtractConstantSubgraph <nl> + / / into two functions : one that returns true if an input is <nl> + / / derivable from constants , and another function that extracts <nl> + / / the subgraph for multiple target nodes and executes the whole <nl> + / / subgraph once . <nl> + <nl> + for ( int i = 0 ; i < c - > num_inputs ( ) ; + + i ) { <nl> + / / Check if we have not already filled in the requested input , <nl> + / / and if not , try to materialize the tensors . <nl> + if ( c - > requested_input_tensor ( i ) & & ! attempted_materialization [ i ] ) { <nl> + attempted_materialization [ i ] = true ; <nl> + <nl> + const Edge * input_edge ; <nl> + TF_RETURN_IF_ERROR ( node - > input_edge ( i , & input_edge ) ) ; <nl> + <nl> + bool is_constant_graph ; <nl> + / / TODO ( vrv ) : Like above , get the OpRegistry from somewhere . <nl> + / / We probably also want the FunctionDefLibrary . <nl> + Graph subgraph ( OpRegistry : : Global ( ) ) ; <nl> + <nl> + / / We identify the possibly constant subgraph to evaluate by <nl> + / / recursively iterating backwards through the inputs to ' node ' <nl> + / / until we either 1 ) find an already existing input to our subgraph <nl> + / / ( filled in ` const_inputs ` ) , 2 ) Discover our graph is not constant , <nl> + / / or 3 ) Hit a root node . <nl> + std : : vector < std : : pair < string , Tensor > > const_inputs ; <nl> + TF_RETURN_IF_ERROR ( ExtractConstantSubgraph ( <nl> + input_nodes [ i ] , & subgraph , & is_constant_graph , & const_inputs ) ) ; <nl> + if ( is_constant_graph ) { <nl> + const string output_tensor_name = strings : : StrCat ( <nl> + input_nodes [ i ] - > name ( ) , " : " , input_edge - > src_output ( ) ) ; <nl> + std : : vector < Tensor > outputs ; <nl> + Status s = GraphRunner : : Run ( & subgraph , nullptr / * function_library * / , <nl> + Env : : Default ( ) , const_inputs , <nl> + { output_tensor_name } , & outputs ) ; <nl> + <nl> + / / If all kernels in the constant graph are not registered <nl> + / / in the process , GraphRunner : : Run may fail , in which case <nl> + / / we cannot propagate constants , so this is best - effort . <nl> + if ( s . ok ( ) ) { <nl> + real_tensors [ i ] = outputs [ 0 ] ; <nl> + input_tensors [ i ] = & real_tensors [ i ] ; <nl> + <nl> + / / We have more concrete information about a shape , <nl> + / / so re - run shape inference . <nl> + rerun_shape_fn = true ; <nl> + <nl> + / / We memoize ( small ) constants evaluated so far , so <nl> + / / ExtractConstantSubgraph can avoid extracting the full <nl> + / / subgraph . As we build up large graphs , this avoids <nl> + / / repeated computation of the early parts of a constant <nl> + / / graph . <nl> + if ( outputs [ 0 ] . TotalBytes ( ) < = kMaxTensorSize ) { <nl> + const_tensor_map_ [ output_tensor_name ] = outputs [ 0 ] ; <nl> + } <nl> + } <nl> + } <nl> + } <nl> + } <nl> + <nl> + if ( rerun_shape_fn ) { <nl> + / / We have more information about the shapes on this pass , <nl> + / / so re - run shape inference . <nl> + c - > set_input_tensors ( input_tensors ) ; <nl> + TF_RETURN_IF_ERROR ( op_reg_data - > shape_inference_fn ( c . get ( ) ) ) ; <nl> + } <nl> + } while ( rerun_shape_fn ) ; <nl> + <nl> + / / Store the resulting InferenceContext object in the map . <nl> + node_to_context_ [ node ] = c . release ( ) ; <nl> + <nl> + return Status : : OK ( ) ; <nl> + } <nl> + <nl> + Status ShapeRefiner : : SetShape ( const Node * node , int output_port , <nl> + shape_inference : : ShapeHandle shape ) { <nl> + auto c = GetContext ( node ) ; <nl> + if ( c = = nullptr ) { <nl> + return errors : : Internal ( " Could not find context for " , node - > name ( ) ) ; <nl> + } <nl> + <nl> + if ( output_port < 0 | | output_port > = node - > num_outputs ( ) ) { <nl> + return errors : : InvalidArgument ( <nl> + " output_port ' " , output_port , " ' is out of range , " , " node ' " , <nl> + node - > name ( ) , " ' has " , node - > num_outputs ( ) , " outputs " ) ; <nl> + } <nl> + <nl> + / / Check compatibility , and merge the shapes . <nl> + shape_inference : : ShapeHandle existing_shape = c - > output ( output_port ) ; <nl> + TF_RETURN_IF_ERROR ( c - > Merge ( existing_shape , shape , & shape ) ) ; <nl> + c - > set_output ( output_port , shape ) ; <nl> + <nl> + / / TODO ( vrv ) : Do we need to propagate the new shape through all <nl> + / / consumers that change their outputs ? At the moment , python <nl> + / / does not do this , but this seems like a nice feature . <nl> + <nl> + / / TODO ( vrv ) : We might need to keep track of the fact that the <nl> + / / existing shape is invalidated , in case we need to propagate <nl> + / / this information to remote workers . <nl> + return Status : : OK ( ) ; <nl> + } <nl> + <nl> + Status ShapeRefiner : : ExtractConstantSubgraph ( <nl> + Node * target_node , Graph * out_graph , bool * is_constant_graph , <nl> + std : : vector < std : : pair < string , Tensor > > * const_inputs ) { <nl> + std : : unordered_set < string > const_inputs_added ; <nl> + <nl> + if ( target_node - > op_def ( ) . is_stateful ( ) ) { <nl> + return Status : : OK ( ) ; <nl> + } <nl> + <nl> + std : : map < Node * , Node * > old_to_new ; <nl> + Node * target_node_copy = out_graph - > CopyNode ( target_node ) ; <nl> + old_to_new [ target_node ] = target_node_copy ; <nl> + <nl> + / / Add the target node ' s inputs to seed the recursion . <nl> + std : : deque < const Edge * > edges_to_visit ; <nl> + for ( const Edge * e : target_node - > in_edges ( ) ) { <nl> + / / TODO ( vrv ) : What do we do about control edges ? Based on our <nl> + / / definition of a constant graph , we should be free to ignore <nl> + / / control edges since the order in which a constant graph is <nl> + / / executed should be the same regardless of when nodes run : we <nl> + / / should only need to recurse down data edges . <nl> + if ( e - > IsControlEdge ( ) ) continue ; <nl> + edges_to_visit . push_back ( e ) ; <nl> + } <nl> + <nl> + * is_constant_graph = true ; <nl> + <nl> + / / Iterate over the set of edges to visit ( backwards ) . <nl> + while ( ! edges_to_visit . empty ( ) ) { <nl> + const Edge * current_edge = edges_to_visit . front ( ) ; <nl> + edges_to_visit . pop_front ( ) ; <nl> + Node * current_node = current_edge - > src ( ) ; <nl> + <nl> + / / If the node is stateful , assume the graph is not constant . <nl> + if ( current_node - > op_def ( ) . is_stateful ( ) ) { <nl> + * is_constant_graph = false ; <nl> + return Status : : OK ( ) ; <nl> + } <nl> + <nl> + / / If there is nothing more to recurse down , see if <nl> + / / the generator node is a constant . <nl> + if ( current_node - > num_inputs ( ) = = 0 ) { <nl> + if ( ! current_node - > IsConstant ( ) ) { <nl> + / / Generator node is not a constant , so subgraph is not <nl> + / / constant . <nl> + * is_constant_graph = false ; <nl> + return Status : : OK ( ) ; <nl> + } <nl> + } <nl> + <nl> + / / Either the node is a constant , or the node is a potential <nl> + / / intermediate node on the path from a constant . <nl> + / / <nl> + / / Add a copy of its node and a new edge to the new subgraph . <nl> + <nl> + / / Get or create the version of ' current_node ' in the new graph . <nl> + bool first_visit_to_node = false ; <nl> + Node * current_node_copy ; <nl> + { <nl> + auto it = old_to_new . find ( current_node ) ; <nl> + if ( it = = old_to_new . end ( ) ) { <nl> + / / First time processing this node . <nl> + first_visit_to_node = true ; <nl> + current_node_copy = out_graph - > CopyNode ( current_node ) ; <nl> + / / Track the mapping from the original node to the new one . <nl> + old_to_new [ current_node ] = current_node_copy ; <nl> + } else { <nl> + current_node_copy = it - > second ; <nl> + } <nl> + } <nl> + <nl> + / / Add the edge to the destination node . <nl> + { <nl> + auto it = old_to_new . find ( current_edge - > dst ( ) ) ; <nl> + if ( it = = old_to_new . end ( ) ) { <nl> + return errors : : Internal ( <nl> + " Could not find mapping from old to new copy of destination node : " , <nl> + current_edge - > dst ( ) - > name ( ) ) ; <nl> + } <nl> + Node * dst_copy = it - > second ; <nl> + <nl> + out_graph - > AddEdge ( current_node_copy , current_edge - > src_output ( ) , <nl> + dst_copy , current_edge - > dst_input ( ) ) ; <nl> + } <nl> + <nl> + / / If we have a copy of the input tensor materialized already , <nl> + / / then add to the list of inputs to feed and do not recurse further . <nl> + const string & output_tensor_name = <nl> + strings : : StrCat ( current_node - > name ( ) , " : " , current_edge - > src_output ( ) ) ; <nl> + auto it = const_tensor_map_ . find ( output_tensor_name ) ; <nl> + if ( it ! = const_tensor_map_ . end ( ) & & <nl> + const_inputs_added . count ( output_tensor_name ) = = 0 ) { <nl> + const_inputs - > emplace_back ( <nl> + std : : make_pair ( output_tensor_name , it - > second ) ) ; <nl> + const_inputs_added . insert ( output_tensor_name ) ; <nl> + continue ; <nl> + } <nl> + <nl> + / / If this is the first time visiting this node , recurse on this <nl> + / / node ' s inputs . <nl> + if ( first_visit_to_node ) { <nl> + for ( const Edge * e : current_node - > in_edges ( ) ) { <nl> + if ( e - > IsControlEdge ( ) ) continue ; <nl> + edges_to_visit . push_back ( e ) ; <nl> + } <nl> + } <nl> + } <nl> + <nl> + return Status : : OK ( ) ; <nl> + } <nl> + <nl> + } / / namespace tensorflow <nl> similarity index 69 % <nl> rename from tensorflow / core / graph / shape_refiner . h <nl> rename to tensorflow / core / common_runtime / shape_refiner . h <nl> mmm a / tensorflow / core / graph / shape_refiner . h <nl> ppp b / tensorflow / core / common_runtime / shape_refiner . h <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 THIRD_PARTY_TENSORFLOW_CORE_GRAPH_SHAPE_REFINER_H_ <nl> - # define THIRD_PARTY_TENSORFLOW_CORE_GRAPH_SHAPE_REFINER_H_ <nl> + # ifndef THIRD_PARTY_TENSORFLOW_CORE_COMMON_RUNTIME_SHAPE_REFINER_H_ <nl> + # define THIRD_PARTY_TENSORFLOW_CORE_COMMON_RUNTIME_SHAPE_REFINER_H_ <nl> <nl> # include < vector > <nl> <nl> class ShapeRefiner { <nl> } <nl> <nl> private : <nl> - / / Extracts the ' constant_value ' of ' input_node ' if possible . Uses <nl> - / / ' tensor_storage ' for storage and sets ' * input_tensor ' to <nl> - / / ' tensor_storage ' if a constant value could be extracted . <nl> - Status ConstantValue ( const Node * node , Tensor * tensor_storage , <nl> - const Tensor * * input_tensor ) const ; <nl> + / / Extracts the subgraph ending at ' node ' that is statically <nl> + / / computable and inserts into ' out_graph ' . If statically computable , <nl> + / / ' is_constant_graph ' will be true . <nl> + Status ExtractConstantSubgraph ( <nl> + Node * node , Graph * out_graph , bool * is_constant_graph , <nl> + std : : vector < std : : pair < string , Tensor > > * const_inputs ) TF_MUST_USE_RESULT ; <nl> <nl> - / / Helper functions to extract the Tensor associated with ' node ' . <nl> - Status Constant ( const Node * node , Tensor * tensor_storage , <nl> - const Tensor * * input_tensor ) const ; <nl> - Status Shape ( const Node * node , Tensor * tensor_storage , <nl> - const Tensor * * input_tensor ) const ; <nl> - Status Size ( const Node * node , Tensor * tensor_storage , <nl> - const Tensor * * input_tensor ) const ; <nl> - Status Rank ( const Node * node , Tensor * tensor_storage , <nl> - const Tensor * * input_tensor ) const ; <nl> - Status Range ( const Node * node , Tensor * tensor_storage , <nl> - const Tensor * * input_tensor ) const ; <nl> / / Stores a map from a node to its InferenceContext . <nl> / / <nl> / / Owns values . <nl> std : : unordered_map < const Node * , shape_inference : : InferenceContext * > <nl> node_to_context_ ; <nl> <nl> + / / Holds a cache from ' tensor name ' to the tensor that is <nl> + / / evaluatable as a constant expression . This reduces repeated <nl> + / / execution of the entire constant subgraph as a graph is being <nl> + / / built up . This could be changed to some kind of size - based LRU <nl> + / / cache to avoid consuming too much memory , if that eventually <nl> + / / becomes a concern . <nl> + / / <nl> + / / Only tensors less than 1KiB are currently stored in the cache . <nl> + static constexpr int64 kMaxTensorSize = 1024 ; <nl> + std : : unordered_map < string , Tensor > const_tensor_map_ ; <nl> TF_DISALLOW_COPY_AND_ASSIGN ( ShapeRefiner ) ; <nl> } ; <nl> <nl> } / / namespace tensorflow <nl> <nl> - # endif / / THIRD_PARTY_TENSORFLOW_CORE_GRAPH_SHAPE_REFINER_H_ <nl> + # endif / / THIRD_PARTY_TENSORFLOW_CORE_COMMON_RUNTIME_SHAPE_REFINER_H_ <nl> similarity index 80 % <nl> rename from tensorflow / core / graph / shape_refiner_test . cc <nl> rename to tensorflow / core / common_runtime / shape_refiner_test . cc <nl> mmm a / tensorflow / core / graph / shape_refiner_test . cc <nl> ppp b / tensorflow / core / common_runtime / shape_refiner_test . cc <nl> See the License for the specific language governing permissions and <nl> limitations under the License . <nl> = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = * / <nl> <nl> - # include " tensorflow / core / graph / shape_refiner . h " <nl> + # include " tensorflow / core / common_runtime / shape_refiner . h " <nl> <nl> # include " tensorflow / cc / framework / scope . h " <nl> # include " tensorflow / cc / ops / standard_ops . h " <nl> TEST ( ShapeRefinerTest , InputTensorDependencies ) { <nl> Node * node ; <nl> <nl> Tensor a ( DT_FLOAT , TensorShape ( { } ) ) ; <nl> - a . scalar < float > ( ) ( ) = 0 . 0 ; <nl> + a . scalar < float > ( ) ( ) = 1 . 0 ; <nl> <nl> Tensor b ( DT_FLOAT , TensorShape ( { } ) ) ; <nl> - b . scalar < float > ( ) ( ) = 0 . 0 ; <nl> + b . scalar < float > ( ) ( ) = 2 . 0 ; <nl> <nl> Node * input_a = test : : graph : : Constant ( & graph , a ) ; <nl> Node * input_b = test : : graph : : Constant ( & graph , b ) ; <nl> TEST ( ShapeRefinerTest , PropagateRange ) { <nl> EXPECT_EQ ( " [ 1 , 4 , 7 , 10 ] " , ctx - > DebugString ( ctx - > output ( 0 ) ) ) ; <nl> } <nl> <nl> + TEST ( ShapeRefinerTest , ConstantValueTwoInputsToSameNode ) { <nl> + Scope root = Scope : : NewRootScope ( ) ; <nl> + / / This node is used as two inputs to ' range ' . <nl> + auto begin_and_delta = ops : : Const ( root , 1 ) ; <nl> + auto limit = ops : : Const ( root , 4 ) ; <nl> + auto range = ops : : Range ( root , begin_and_delta , limit , begin_and_delta ) ; <nl> + <nl> + Node * shape_data ; <nl> + TF_ASSERT_OK ( NodeBuilder ( " Test " , " ShapeData " ) <nl> + . Input ( range . node ( ) ) <nl> + . Finalize ( root . graph ( ) , & shape_data ) ) ; <nl> + <nl> + ShapeRefiner m ; <nl> + TF_ASSERT_OK ( m . AddNode ( begin_and_delta . node ( ) ) ) ; <nl> + TF_ASSERT_OK ( m . AddNode ( limit . node ( ) ) ) ; <nl> + TF_ASSERT_OK ( m . AddNode ( range . node ( ) ) ) ; <nl> + TF_ASSERT_OK ( m . AddNode ( shape_data ) ) ; <nl> + <nl> + shape_inference : : InferenceContext * ctx = m . GetContext ( shape_data ) ; <nl> + EXPECT_EQ ( " [ 1 , 2 , 3 ] " , ctx - > DebugString ( ctx - > output ( 0 ) ) ) ; <nl> + } <nl> + <nl> + / / Creates a graph where ' begin ' is attempted to be visited during <nl> + / / constant value evaluation after having been processed once . <nl> + TEST ( ShapeRefinerTest , ConstantValueVisitNodeTwice ) { <nl> + Scope root = Scope : : NewRootScope ( ) ; <nl> + auto begin = ops : : Const ( root , 1 ) ; <nl> + auto limit = ops : : Const ( root , 8 ) ; <nl> + auto delta = ops : : Const ( root , 3 ) ; <nl> + <nl> + auto d1 = ops : : Add ( root , begin , limit ) ; / / 9 <nl> + auto d2 = ops : : Add ( root , begin , delta ) ; / / 4 <nl> + / / Visiting flimit ' s children will visit ' begin ' before ' d1 ' . <nl> + / / It will then visit d1 , whose child is ' begin ' . That edge still <nl> + / / must be visited . <nl> + auto flimit = ops : : Sub ( root , begin , d1 ) ; / / 1 - 9 = - 8 <nl> + auto fdelta = ops : : Sub ( root , begin , d2 ) ; / / 1 - 4 = - 3 <nl> + auto nl = ops : : Abs ( root , flimit ) ; / / 8 <nl> + auto nd = ops : : Abs ( root , fdelta ) ; / / 3 <nl> + <nl> + auto range = ops : : Range ( root , begin , nl , nd ) ; <nl> + <nl> + Node * shape_data ; <nl> + TF_ASSERT_OK ( NodeBuilder ( " Test " , " ShapeData " ) <nl> + . Input ( range . node ( ) ) <nl> + . Finalize ( root . graph ( ) , & shape_data ) ) ; <nl> + <nl> + ShapeRefiner m ; <nl> + TF_ASSERT_OK ( m . AddNode ( begin . node ( ) ) ) ; <nl> + TF_ASSERT_OK ( m . AddNode ( limit . node ( ) ) ) ; <nl> + TF_ASSERT_OK ( m . AddNode ( delta . node ( ) ) ) ; <nl> + TF_ASSERT_OK ( m . AddNode ( d1 . node ( ) ) ) ; <nl> + TF_ASSERT_OK ( m . AddNode ( d2 . node ( ) ) ) ; <nl> + TF_ASSERT_OK ( m . AddNode ( flimit . node ( ) ) ) ; <nl> + TF_ASSERT_OK ( m . AddNode ( fdelta . node ( ) ) ) ; <nl> + TF_ASSERT_OK ( m . AddNode ( nl . node ( ) ) ) ; <nl> + TF_ASSERT_OK ( m . AddNode ( nd . node ( ) ) ) ; <nl> + TF_ASSERT_OK ( m . AddNode ( range . node ( ) ) ) ; <nl> + TF_ASSERT_OK ( m . AddNode ( shape_data ) ) ; <nl> + <nl> + shape_inference : : InferenceContext * ctx = m . GetContext ( shape_data ) ; <nl> + EXPECT_EQ ( " [ 1 , 4 , 7 ] " , ctx - > DebugString ( ctx - > output ( 0 ) ) ) ; <nl> + } <nl> + <nl> } / / namespace <nl> } / / namespace tensorflow <nl> mmm a / tensorflow / core / distributed_runtime / tensor_coding . cc <nl> ppp b / tensorflow / core / distributed_runtime / tensor_coding . cc <nl> Status TensorResponse : : ParseFrom ( Source * source ) { <nl> input . SetTotalBytesLimit ( INT_MAX , INT_MAX ) ; / / Unlimited <nl> <nl> / / Pre - parse into local storage , then delegate to device . <nl> - RecvTensorResponse proto ; <nl> - if ( ! proto . ParseFromCodedStream ( & input ) | | ! input . ConsumedEntireMessage ( ) ) { <nl> + if ( ! meta_ . ParseFromCodedStream ( & input ) | | ! input . ConsumedEntireMessage ( ) ) { <nl> return errors : : InvalidArgument ( " Cannot parse tensor from response " ) ; <nl> } <nl> - return device_ - > MakeTensorFromProto ( proto . tensor ( ) , alloc_attrs_ , & tensor_ ) ; <nl> + Status s = <nl> + device_ - > MakeTensorFromProto ( meta_ . tensor ( ) , alloc_attrs_ , & tensor_ ) ; <nl> + / / Reduce memory usage for big tensors . <nl> + { <nl> + TensorProto empty ; <nl> + meta_ . mutable_tensor ( ) - > Swap ( & empty ) ; <nl> + } <nl> + meta_ . clear_tensor ( ) ; <nl> + return s ; <nl> } <nl> if ( already_used_ ) { <nl> ClearTensor ( ) ; <nl> mmm a / tensorflow / core / framework / versions . h <nl> ppp b / tensorflow / core / framework / versions . h <nl> namespace tensorflow { <nl> / / <nl> / / # include " tensorflow / core / public / version . h " <nl> / / <nl> - / / TF_RETURN_ERROR ( CheckVersions ( versions , TF_GRAPH_DEF_VERSION , <nl> - / / TF_GRAPH_DEF_VERSION_MIN_PRODUCER , <nl> - / / " GraphDef " , " graph " ) ) ; <nl> + / / TF_RETURN_IF_ERROR ( CheckVersions ( versions , TF_GRAPH_DEF_VERSION , <nl> + / / TF_GRAPH_DEF_VERSION_MIN_PRODUCER , <nl> + / / " GraphDef " , " graph " ) ) ; <nl> Status CheckVersions ( const VersionDef & versions , int consumer , int min_producer , <nl> const char * upper_name , const char * lower_name ) ; <nl> <nl> mmm a / tensorflow / core / graph / graph_constructor . cc <nl> ppp b / tensorflow / core / graph / graph_constructor . cc <nl> limitations under the License . <nl> # include " tensorflow / core / framework / versions . h " <nl> # include " tensorflow / core / graph / algorithm . h " <nl> # include " tensorflow / core / graph / graph . h " <nl> - # include " tensorflow / core / graph / optimizer_cse . h " <nl> # include " tensorflow / core / graph / tensor_id . h " <nl> # include " tensorflow / core / lib / core / errors . h " <nl> # include " tensorflow / core / lib / gtl / inlined_vector . h " <nl> namespace { <nl> inline bool IsMerge ( const NodeDef & node_def ) { <nl> return node_def . op ( ) = = " Merge " | | node_def . op ( ) = = " RefMerge " ; <nl> } <nl> - } / / namespace <nl> <nl> - namespace { <nl> + bool IsValidNodeName ( StringPiece s , bool allow_internal_ops ) { <nl> + using : : tensorflow : : strings : : Scanner ; <nl> + return Scanner ( s ) <nl> + . One ( allow_internal_ops ? Scanner : : LETTER_DIGIT_DOT_UNDERSCORE <nl> + : Scanner : : LETTER_DIGIT_DOT ) <nl> + . Any ( Scanner : : LETTER_DIGIT_DASH_DOT_SLASH_UNDERSCORE ) <nl> + . Eos ( ) <nl> + . GetResult ( ) ; <nl> + } <nl> <nl> class GraphConstructor { <nl> public : <nl> - GraphConstructor ( const GraphConstructorOptions & opts , const GraphDef * gdef , <nl> - Graph * g , Status * status ) <nl> - : opts_ ( opts ) , gdef_ ( gdef ) , g_ ( g ) , status_ ( status ) { <nl> - * status = <nl> - CheckVersions ( gdef - > versions ( ) , TF_GRAPH_DEF_VERSION , <nl> - TF_GRAPH_DEF_VERSION_MIN_PRODUCER , " GraphDef " , " graph " ) ; <nl> - if ( ! status - > ok ( ) ) return ; <nl> + static Status Construct ( const GraphConstructorOptions & opts , <nl> + const GraphDef * gdef , Graph * g ) { <nl> + TF_RETURN_IF_ERROR ( CheckVersions ( gdef - > versions ( ) , TF_GRAPH_DEF_VERSION , <nl> + TF_GRAPH_DEF_VERSION_MIN_PRODUCER , <nl> + " GraphDef " , " graph " ) ) ; <nl> + GraphConstructor c ( opts , gdef , g ) ; <nl> g - > set_versions ( gdef - > versions ( ) ) ; <nl> - BuildNodeIndex ( ) ; <nl> - InitFromEdges ( ) ; <nl> - Convert ( ) ; <nl> + TF_RETURN_IF_ERROR ( c . BuildNodeIndex ( ) ) ; <nl> + TF_RETURN_IF_ERROR ( c . InitFromEdges ( ) ) ; <nl> + TF_RETURN_IF_ERROR ( c . Convert ( ) ) ; <nl> + TF_RETURN_IF_ERROR ( c . AddBackEdges ( ) ) ; <nl> + FixupSourceAndSinkEdges ( g ) ; <nl> + return Status : : OK ( ) ; <nl> } <nl> <nl> private : <nl> - void SetError ( const string & error ) ; <nl> - void SetNodeError ( const NodeDef & node_def , const StringPiece & message ) { <nl> - SetError ( strings : : StrCat ( " Node ' " , node_def . name ( ) , " ' : " , message ) ) ; <nl> - } <nl> - void BuildNodeIndex ( ) ; <nl> - void InitFromEdges ( ) ; <nl> - Node * MakeNode ( const NodeDef & node_def ) ; <nl> - void Convert ( ) ; <nl> - / / Calls SetError ( ) and returns false if the type of the output of <nl> - / / the source of the edge can ' t be consumed by destination of the edge . <nl> - / / REQUIRES : edge must be a data edge , not a control edge . <nl> - bool TypeValidateEdge ( const Edge * edge ) ; <nl> + GraphConstructor ( const GraphConstructorOptions & opts , const GraphDef * gdef , <nl> + Graph * g ) <nl> + : opts_ ( opts ) , gdef_ ( gdef ) , g_ ( g ) { } <nl> + <nl> + Status BuildNodeIndex ( ) ; <nl> + Status InitFromEdges ( ) ; <nl> + Status Convert ( ) ; <nl> + Status AddBackEdges ( ) ; <nl> + <nl> + Status MakeNode ( const NodeDef & node_def , Node * * node ) ; <nl> + Status MakeEdge ( Node * src , int output_index , Node * dst , int input_index ) ; <nl> <nl> / / From constructor <nl> const GraphConstructorOptions opts_ ; <nl> const GraphDef * gdef_ ; <nl> Graph * g_ ; <nl> - Status * status_ ; <nl> <nl> / / Mapping from node name to the index within gdef_ <nl> struct NodeInfo { <nl> class GraphConstructor { <nl> Node * dst_node ; <nl> int dst_index ; <nl> } ; <nl> + std : : vector < EdgeInfo > back_edges_ ; <nl> } ; <nl> <nl> - void GraphConstructor : : SetError ( const string & error ) { <nl> - status_ - > Update ( errors : : InvalidArgument ( error ) ) ; <nl> - } <nl> - <nl> - bool IsValidNodeName ( StringPiece s , bool allow_internal_ops ) { <nl> - using : : tensorflow : : strings : : Scanner ; <nl> - return Scanner ( s ) <nl> - . One ( allow_internal_ops ? Scanner : : LETTER_DIGIT_DOT_UNDERSCORE <nl> - : Scanner : : LETTER_DIGIT_DOT ) <nl> - . Any ( Scanner : : LETTER_DIGIT_DASH_DOT_SLASH_UNDERSCORE ) <nl> - . Eos ( ) <nl> - . GetResult ( ) ; <nl> - } <nl> - <nl> - void GraphConstructor : : BuildNodeIndex ( ) { <nl> + Status GraphConstructor : : BuildNodeIndex ( ) { <nl> / / Validate the node names and add them to name_index_ . <nl> for ( int n = 0 ; n < gdef_ - > node_size ( ) ; + + n ) { <nl> const NodeDef & node_def ( gdef_ - > node ( n ) ) ; <nl> if ( ! IsValidNodeName ( node_def . name ( ) , opts_ . allow_internal_ops ) ) { <nl> - SetNodeError ( node_def , " Node name contains invalid characters " ) ; <nl> - return ; <nl> + return errors : : InvalidArgument ( <nl> + " Node ' " , node_def . name ( ) , <nl> + " ' : Node name contains invalid characters " ) ; <nl> } <nl> if ( ! name_index_ <nl> . insert ( std : : make_pair ( StringPiece ( node_def . name ( ) ) , NodeInfo ( n ) ) ) <nl> . second ) { <nl> - SetNodeError ( node_def , " Node name is not unique " ) ; <nl> - return ; <nl> + return errors : : InvalidArgument ( " Node ' " , node_def . name ( ) , <nl> + " ' is not unique " ) ; <nl> } <nl> / / Validate the operation ' s type . <nl> if ( node_def . op ( ) . empty ( ) ) { <nl> - SetNodeError ( node_def , " Does not specify a type " ) ; <nl> - return ; <nl> + return errors : : InvalidArgument ( " Node ' " , node_def . name ( ) , <nl> + " ' does not specify an operation " ) ; <nl> } <nl> if ( opts_ . expect_device_spec & & node_def . device ( ) . empty ( ) ) { <nl> - SetNodeError ( node_def , strings : : StrCat ( " Missing device specification . " ) ) ; <nl> - return ; <nl> + return errors : : InvalidArgument ( " Node ' " , node_def . name ( ) , <nl> + " ' is missing a device specification " ) ; <nl> } <nl> } <nl> + return Status : : OK ( ) ; <nl> } <nl> <nl> - void GraphConstructor : : InitFromEdges ( ) { <nl> + Status GraphConstructor : : InitFromEdges ( ) { <nl> const int num_nodes = gdef_ - > node_size ( ) ; <nl> - ready_ . reserve ( num_nodes ) ; <nl> pending_count_ . reserve ( num_nodes ) ; <nl> outputs_ . resize ( num_nodes ) ; <nl> <nl> void GraphConstructor : : InitFromEdges ( ) { <nl> int32 num_control_edges = 0 ; <nl> for ( int i = 0 ; i < node_def . input_size ( ) ; + + i ) { <nl> StringPiece input_name ( node_def . input ( i ) ) ; <nl> - if ( StringPiece ( input_name ) . starts_with ( " ^ " ) ) { <nl> + if ( input_name . starts_with ( " ^ " ) ) { <nl> num_control_edges + + ; <nl> } <nl> } <nl> void GraphConstructor : : InitFromEdges ( ) { <nl> } <nl> for ( int i = 0 ; i < node_def . input_size ( ) ; + + i ) { <nl> StringPiece input_name = node_def . input ( i ) ; <nl> - if ( input_name . starts_with ( " ^ " ) ) { <nl> - / / Control dependence <nl> - input_name . remove_prefix ( 1 ) ; <nl> - } <nl> + input_name . Consume ( " ^ " ) ; / / In case this is a control dependence . <nl> TensorId id ( ParseTensorName ( input_name ) ) ; <nl> auto iter = name_index_ . find ( id . first ) ; <nl> if ( iter = = name_index_ . end ( ) ) { <nl> - SetNodeError ( node_def , <nl> - strings : : StrCat ( " Unknown input node " , node_def . input ( i ) ) ) ; <nl> - return ; <nl> + return errors : : InvalidArgument ( " Node ' " , node_def . name ( ) , <nl> + " ' : Unknown input node ' " , <nl> + node_def . input ( i ) , " ' " ) ; <nl> } <nl> outputs_ [ iter - > second . gdef_index ] . push_back ( n ) ; <nl> } <nl> } <nl> + return Status : : OK ( ) ; <nl> } <nl> <nl> - Node * GraphConstructor : : MakeNode ( const NodeDef & node_def ) { <nl> + Status GraphConstructor : : MakeNode ( const NodeDef & node_def , Node * * node ) { <nl> / / Add the node to the graph . <nl> - Node * node = g_ - > AddNode ( node_def , status_ ) ; <nl> - if ( node = = nullptr ) return nullptr ; <nl> + Status status ; <nl> + * node = g_ - > AddNode ( node_def , & status ) ; <nl> + if ( ! status . ok ( ) ) return status ; <nl> if ( opts_ . expect_device_spec ) { <nl> - node - > set_assigned_device_name ( node_def . device ( ) ) ; <nl> + ( * node ) - > set_assigned_device_name ( node_def . device ( ) ) ; <nl> } <nl> - name_index_ [ node_def . name ( ) ] . node = node ; <nl> - return node ; <nl> + name_index_ [ node_def . name ( ) ] . node = * node ; <nl> + return Status : : OK ( ) ; <nl> } <nl> <nl> / / Return the number of nodes in " g " <nl> - static int CountNodes ( Graph * g ) { <nl> + int CountNodes ( Graph * g ) { <nl> int nodes = 0 ; <nl> for ( Node * node : g - > nodes ( ) ) { <nl> VLOG ( 3 ) < < node ; / / Dummy use to avoid compiler warning <nl> static int CountNodes ( Graph * g ) { <nl> return nodes ; <nl> } <nl> <nl> - void GraphConstructor : : Convert ( ) { <nl> + Status GraphConstructor : : Convert ( ) { <nl> std : : vector < InputInfo > inputs ; <nl> - std : : vector < EdgeInfo > back_edges ; <nl> int processed = 0 ; <nl> / / Process the NodeDefs in topological order . <nl> while ( ! ready_ . empty ( ) ) { <nl> void GraphConstructor : : Convert ( ) { <nl> bool has_data_back_edge = false ; <nl> for ( int i = 0 ; i < node_def . input_size ( ) ; + + i ) { <nl> StringPiece input_name ( node_def . input ( i ) ) ; <nl> - if ( StringPiece ( input_name ) . starts_with ( " ^ " ) ) { <nl> - / / A control dependence <nl> + if ( input_name . Consume ( " ^ " ) ) { <nl> in_control_dependence = true ; <nl> - input_name . remove_prefix ( 1 ) ; <nl> - } else { <nl> - if ( in_control_dependence ) { <nl> - SetNodeError ( node_def , strings : : StrCat ( <nl> - " Control dependencies must come after " , <nl> - " regular dependencies : input " , input_name , <nl> - " of source node " , node_def . name ( ) ) ) ; <nl> - return ; <nl> - } <nl> + } else if ( in_control_dependence ) { <nl> + return errors : : InvalidArgument ( <nl> + " Node ' " , node_def . name ( ) , <nl> + " ' : Control dependencies must come after regular dependencies " ) ; <nl> } <nl> TensorId id ( ParseTensorName ( input_name ) ) ; <nl> auto iter = name_index_ . find ( id . first ) ; <nl> void GraphConstructor : : Convert ( ) { <nl> inputs . push_back ( InputInfo ( id . first , src_node , id . second ) ) ; <nl> } else { <nl> if ( id . second > = src_node - > num_outputs ( ) ) { <nl> - SetNodeError ( <nl> - node_def , <nl> - strings : : StrCat ( " Connecting to invalid output " , id . second , <nl> - " of source node " , id . first , " which has " , <nl> - src_node - > num_outputs ( ) , " outputs " ) ) ; <nl> - return ; <nl> + return errors : : InvalidArgument ( <nl> + " Node ' " , node_def . name ( ) , " ' : Connecting to invalid output " , <nl> + id . second , " of source node " , id . first , " which has " , <nl> + src_node - > num_outputs ( ) , " outputs " ) ; <nl> } <nl> inputs . push_back ( InputInfo ( id . first , src_node , id . second ) ) ; <nl> } <nl> } <nl> } <nl> if ( has_data_back_edge & & ! IsMerge ( node_def ) ) { <nl> - SetError ( strings : : StrCat ( <nl> - node_def . name ( ) , <nl> - " had a back edge . But only Merge can have back edges . " ) ) ; <nl> - return ; <nl> + return errors : : InvalidArgument ( <nl> + " Node ' " , node_def . name ( ) , <nl> + " ' had a back edge , but only Merge nodes can have back edges . " ) ; <nl> } <nl> <nl> - Node * node = MakeNode ( node_def ) ; <nl> - if ( node = = nullptr ) return ; <nl> + Node * node ; <nl> + TF_RETURN_IF_ERROR ( MakeNode ( node_def , & node ) ) ; <nl> <nl> / / Add edges from inputs to * node to the graph . <nl> for ( size_t i = 0 ; i < inputs . size ( ) ; + + i ) { <nl> if ( inputs [ i ] . node = = nullptr ) { <nl> / / Record this back edge , which will be added after all nodes <nl> / / are created . <nl> - back_edges . push_back ( <nl> + back_edges_ . push_back ( <nl> EdgeInfo ( inputs [ i ] . name , inputs [ i ] . index , node , i ) ) ; <nl> } else if ( inputs [ i ] . index = = - 1 ) { <nl> g_ - > AddControlEdge ( inputs [ i ] . node , node ) ; <nl> } else { <nl> - const Edge * edge = <nl> - g_ - > AddEdge ( inputs [ i ] . node , inputs [ i ] . index , node , i ) ; <nl> - if ( ! TypeValidateEdge ( edge ) ) return ; <nl> + TF_RETURN_IF_ERROR ( MakeEdge ( inputs [ i ] . node , inputs [ i ] . index , node , i ) ) ; <nl> } <nl> } <nl> <nl> void GraphConstructor : : Convert ( ) { <nl> } <nl> } <nl> <nl> + if ( processed < gdef_ - > node_size ( ) ) { <nl> + return errors : : InvalidArgument ( gdef_ - > node_size ( ) - processed , <nl> + " nodes in a cycle " ) ; <nl> + } <nl> + return Status : : OK ( ) ; <nl> + } <nl> + <nl> + Status GraphConstructor : : AddBackEdges ( ) { <nl> / / Add the back edges after all nodes are created . <nl> - for ( auto e : back_edges ) { <nl> + for ( auto e : back_edges_ ) { <nl> Node * src_node = name_index_ [ e . src_name ] . node ; <nl> if ( e . src_index = = - 1 ) { <nl> g_ - > AddControlEdge ( src_node , e . dst_node ) ; <nl> } else { <nl> - const Edge * edge = <nl> - g_ - > AddEdge ( src_node , e . src_index , e . dst_node , e . dst_index ) ; <nl> - if ( ! TypeValidateEdge ( edge ) ) return ; <nl> + TF_RETURN_IF_ERROR ( <nl> + MakeEdge ( src_node , e . src_index , e . dst_node , e . dst_index ) ) ; <nl> } <nl> <nl> VLOG ( 2 ) < < " Add back edge : " < < src_node - > name ( ) < < " - > " <nl> < < e . dst_node - > name ( ) ; <nl> } <nl> - <nl> - if ( processed < gdef_ - > node_size ( ) ) { <nl> - SetError ( <nl> - strings : : StrCat ( gdef_ - > node_size ( ) - processed , " nodes in a cycle " ) ) ; <nl> - return ; <nl> - } <nl> - <nl> - if ( status_ - > ok ( ) ) { <nl> - FixupSourceAndSinkEdges ( g_ ) ; <nl> - <nl> - if ( opts_ . optimizer_do_cse ) { <nl> - if ( ! back_edges . empty ( ) ) { <nl> - VLOG ( 1 ) < < " Not doing CSE . We need to figure out how to handle " <nl> - < < " loops in the CSE phase . " ; <nl> - } else { <nl> - VLOG ( 1 ) < < " Starting CSE : graph of " < < CountNodes ( g_ ) < < " nodes " ; <nl> - OptimizeCSE ( g_ , opts_ . cse_consider_function ) ; <nl> - VLOG ( 1 ) < < " Finished CSE : graph of " < < CountNodes ( g_ ) < < " nodes " ; <nl> - } <nl> - } <nl> - } <nl> + return Status : : OK ( ) ; <nl> } <nl> <nl> - bool GraphConstructor : : TypeValidateEdge ( const Edge * edge ) { <nl> - DataType src_out = edge - > src ( ) - > output_type ( edge - > src_output ( ) ) ; <nl> - DataType dst_in = edge - > dst ( ) - > input_type ( edge - > dst_input ( ) ) ; <nl> + Status GraphConstructor : : MakeEdge ( Node * src , int output_index , Node * dst , <nl> + int input_index ) { <nl> + DataType src_out = src - > output_type ( output_index ) ; <nl> + DataType dst_in = dst - > input_type ( input_index ) ; <nl> if ( ! TypesCompatible ( dst_in , src_out ) ) { <nl> - SetError ( strings : : StrCat ( <nl> - " Input " , edge - > dst_input ( ) , " of node " , edge - > dst ( ) - > name ( ) , <nl> - " was passed " , DataTypeString ( src_out ) , " from " , edge - > src ( ) - > name ( ) , <nl> - " : " , edge - > src_output ( ) , " incompatible with expected " , <nl> - DataTypeString ( dst_in ) , " . " ) ) ; <nl> - return false ; <nl> + return errors : : InvalidArgument ( <nl> + " Input " , input_index , " of node " , dst - > name ( ) , " was passed " , <nl> + DataTypeString ( src_out ) , " from " , src - > name ( ) , " : " , output_index , <nl> + " incompatible with expected " , DataTypeString ( dst_in ) , " . " ) ; <nl> } <nl> - return true ; <nl> - } <nl> - <nl> - static void SetDoCSE ( const OptimizerOptions & optimizer_opt , bool force , <nl> - GraphConstructorOptions * graph_opt ) { <nl> - graph_opt - > optimizer_do_cse = <nl> - force | | optimizer_opt . do_common_subexpression_elimination ( ) ; <nl> - } <nl> - <nl> - static void SetDoConstantFolding ( const OptimizerOptions & optimizer_opt , <nl> - bool force , <nl> - GraphConstructorOptions * graph_opt ) { <nl> - graph_opt - > optimizer_do_constant_folding = <nl> - force | | optimizer_opt . do_constant_folding ( ) ; <nl> + g_ - > AddEdge ( src , output_index , dst , input_index ) ; <nl> + return Status : : OK ( ) ; <nl> } <nl> <nl> } / / namespace <nl> static void SetDoConstantFolding ( const OptimizerOptions & optimizer_opt , <nl> <nl> GraphConstructorOptions : : GraphConstructorOptions ( ) { } <nl> <nl> - GraphConstructorOptions : : GraphConstructorOptions ( const OptimizerOptions & opts ) { <nl> - / / Set the individually specified options first . <nl> - SetDoCSE ( opts , false , this ) ; <nl> - SetDoConstantFolding ( opts , false , this ) ; <nl> - <nl> - / / Set options that the level signifies <nl> - if ( opts . opt_level ( ) = = OptimizerOptions : : L0 ) { <nl> - / / No optimizations performed . <nl> - } else if ( opts . opt_level ( ) = = OptimizerOptions : : L1 ) { <nl> - SetDoCSE ( opts , true , this ) ; <nl> - SetDoConstantFolding ( opts , true , this ) ; <nl> - } <nl> - } <nl> - <nl> / / mmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmm - <nl> / / ConvertGraphDefToGraph <nl> / / mmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmm - <nl> <nl> Status ConvertGraphDefToGraph ( const GraphConstructorOptions & opts , <nl> const GraphDef & gdef , Graph * g ) { <nl> - Status status ; <nl> - GraphConstructor constructor ( opts , & gdef , g , & status ) ; <nl> - return status ; <nl> + return GraphConstructor : : Construct ( opts , & gdef , g ) ; <nl> } <nl> <nl> / / mmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmm - <nl> mmm a / tensorflow / core / graph / graph_constructor . h <nl> ppp b / tensorflow / core / graph / graph_constructor . h <nl> limitations under the License . <nl> # include " tensorflow / core / framework / graph . pb . h " <nl> # include " tensorflow / core / graph / graph . h " <nl> # include " tensorflow / core / lib / core / status . h " <nl> - # include " tensorflow / core / protobuf / config . pb . h " <nl> <nl> namespace tensorflow { <nl> <nl> / / Options specific to constant folding optimizations . <nl> + / / <nl> + / / TODO ( ashankar , vrv ) : This should move to where constant folding is done . <nl> struct ConstantFoldingOptions { <nl> / / If " consider " is not a nullptr , then only constant fold a node " n " if <nl> / / consider ( n ) returns true . <nl> struct ConstantFoldingOptions { <nl> / / error , in which case * g is left in an incomplete state . <nl> struct GraphConstructorOptions { <nl> GraphConstructorOptions ( ) ; <nl> - explicit GraphConstructorOptions ( const OptimizerOptions & opts ) ; <nl> <nl> / / If true , allows internal ops in the GraphDef . <nl> bool allow_internal_ops = false ; <nl> struct GraphConstructorOptions { <nl> / / <nl> / / TODO ( zhifengc ) : if possible , consider removing this option . <nl> bool expect_device_spec = false ; <nl> - <nl> - / / If true , perform common subexpression elimination on the graph . <nl> - / / TODO ( jeff ) : Turn this default to true ? <nl> - bool optimizer_do_cse = false ; <nl> - <nl> - / / If " optimizer_do_cse " is true and " cse_consider_function " is <nl> - / / not nullptr , then only consider nodes for CSE for which <nl> - / / " cse_consider_function ( node ) " returns true . <nl> - std : : function < bool ( const Node * ) > cse_consider_function = nullptr ; <nl> - <nl> - / / If true , perform constant folding on the graph . <nl> - bool optimizer_do_constant_folding = false ; <nl> - <nl> - ConstantFoldingOptions constant_folding_opts ; <nl> } ; <nl> extern Status ConvertGraphDefToGraph ( const GraphConstructorOptions & opts , <nl> const GraphDef & gdef , Graph * g ) ; <nl> mmm a / tensorflow / core / graph / graph_constructor_test . cc <nl> ppp b / tensorflow / core / graph / graph_constructor_test . cc <nl> namespace { <nl> <nl> class GraphConstructorTest : public : : testing : : Test { <nl> protected : <nl> - GraphConstructorTest ( ) : g_ ( new Graph ( OpRegistry : : Global ( ) ) ) { <nl> - } <nl> + GraphConstructorTest ( ) : g_ ( new Graph ( OpRegistry : : Global ( ) ) ) { } <nl> ~ GraphConstructorTest ( ) override { } <nl> <nl> void Convert ( const string & gdef_ascii ) { <nl> class GraphConstructorTest : public : : testing : : Test { <nl> bool HasEdge ( const string & src , int src_out , const string & dst , int dst_in ) { <nl> for ( const Edge * e : g_ - > edges ( ) ) { <nl> if ( e - > src ( ) - > name ( ) = = src & & e - > src_output ( ) = = src_out & & <nl> - e - > dst ( ) - > name ( ) = = dst & & e - > dst_input ( ) = = src_out ) <nl> + e - > dst ( ) - > name ( ) = = dst & & e - > dst_input ( ) = = dst_in ) <nl> return true ; <nl> } <nl> return false ; <nl> TEST_F ( GraphConstructorTest , SimpleModel ) { <nl> EXPECT_TRUE ( HasNode ( " input " ) ) ; <nl> EXPECT_TRUE ( HasNode ( " t1 " ) ) ; <nl> EXPECT_TRUE ( HasEdge ( " W1 " , 0 , " t1 " , 0 ) ) ; <nl> - EXPECT_TRUE ( HasEdge ( " input " , 1 , " t1 " , 0 ) ) ; <nl> + EXPECT_TRUE ( HasEdge ( " input " , 1 , " t1 " , 1 ) ) ; <nl> } <nl> <nl> TEST_F ( GraphConstructorTest , SimpleModelWithControlEdges ) { <nl> TEST_F ( GraphConstructorTest , SimpleModelWithControlEdges ) { <nl> EXPECT_TRUE ( HasNode ( " t1 " ) ) ; <nl> EXPECT_TRUE ( HasNode ( " t2 " ) ) ; <nl> EXPECT_TRUE ( HasEdge ( " W1 " , 0 , " t1 " , 0 ) ) ; <nl> - EXPECT_TRUE ( HasEdge ( " input " , 1 , " t1 " , 0 ) ) ; <nl> + EXPECT_TRUE ( HasEdge ( " input " , 1 , " t1 " , 1 ) ) ; <nl> EXPECT_TRUE ( HasEdge ( " W1 " , 0 , " t2 " , 0 ) ) ; <nl> - EXPECT_TRUE ( HasEdge ( " input " , 1 , " t2 " , 0 ) ) ; <nl> + EXPECT_TRUE ( HasEdge ( " input " , 1 , " t2 " , 1 ) ) ; <nl> EXPECT_TRUE ( HasControlEdge ( " W1 " , " input " ) ) ; <nl> EXPECT_TRUE ( HasControlEdge ( " t1 " , " t2 " ) ) ; <nl> } <nl> deleted file mode 100644 <nl> index 7cbec631ac7d5 . . 0000000000000 <nl> mmm a / tensorflow / core / graph / shape_refiner . cc <nl> ppp / dev / null <nl> <nl> - / * Copyright 2016 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> - # include " tensorflow / core / graph / shape_refiner . h " <nl> - <nl> - # include < memory > <nl> - # include < vector > <nl> - <nl> - # include " tensorflow / core / framework / tensor . h " <nl> - # include " tensorflow / core / lib / core / errors . h " <nl> - # include " tensorflow / core / lib / gtl / stl_util . h " <nl> - <nl> - namespace tensorflow { <nl> - <nl> - ShapeRefiner : : ShapeRefiner ( ) { } <nl> - ShapeRefiner : : ~ ShapeRefiner ( ) { gtl : : STLDeleteValues ( & node_to_context_ ) ; } <nl> - <nl> - Status ShapeRefiner : : AddNode ( const Node * node ) { <nl> - / / For each ' input ' of this node , fetch the corresponding shape <nl> - / / from ' input ' s InferenceContext , and store into a vector <nl> - / / indexed by ' node ' s input . <nl> - std : : vector < const Node * > input_nodes ( node - > num_inputs ( ) ) ; <nl> - std : : vector < shape_inference : : ShapeHandle > input_shapes ( node - > num_inputs ( ) ) ; <nl> - for ( const Edge * e : node - > in_edges ( ) ) { <nl> - if ( e - > IsControlEdge ( ) ) continue ; <nl> - <nl> - const Node * input = e - > src ( ) ; <nl> - auto it = node_to_context_ . find ( input ) ; <nl> - if ( it = = node_to_context_ . end ( ) ) { <nl> - return errors : : FailedPrecondition ( <nl> - " Input " , e - > dst_input ( ) , " ( ' " , input - > name ( ) , " ' ) for ' " , <nl> - node - > name ( ) , " ' was not previously added to ShapeRefiner . " ) ; <nl> - } <nl> - <nl> - shape_inference : : InferenceContext * c = it - > second ; <nl> - DCHECK_GE ( e - > dst_input ( ) , 0 ) ; <nl> - input_nodes [ e - > dst_input ( ) ] = input ; <nl> - input_shapes [ e - > dst_input ( ) ] = c - > output ( e - > src_output ( ) ) ; <nl> - } <nl> - <nl> - / / Get the shape function for this node <nl> - const OpRegistrationData * op_reg_data ; <nl> - / / TODO ( vrv ) : Take in the OpRegistryInterface * instead of taking <nl> - / / the global one . <nl> - TF_RETURN_IF_ERROR ( <nl> - OpRegistry : : Global ( ) - > LookUp ( node - > type_string ( ) , & op_reg_data ) ) ; <nl> - if ( op_reg_data - > shape_inference_fn = = nullptr ) { <nl> - return errors : : InvalidArgument ( <nl> - " No shape inference function exists for op ' " , node - > type_string ( ) , <nl> - " ' , did you forget to define it ? " ) ; <nl> - } <nl> - <nl> - / / This needs to be filled in with real data in a second pass . <nl> - std : : vector < const Tensor * > input_tensors ( node - > num_inputs ( ) ) ; <nl> - std : : vector < Tensor > real_tensors ( node - > num_inputs ( ) ) ; <nl> - std : : vector < bool > attempted_materialization ( node - > num_inputs ( ) ) ; <nl> - <nl> - / / Create the inference context for this node with the existing input shapes . <nl> - std : : unique_ptr < shape_inference : : InferenceContext > c ( <nl> - new shape_inference : : InferenceContext ( & node - > def ( ) , node - > op_def ( ) , <nl> - { } / * input_shapes_string * / , <nl> - input_shapes , input_tensors ) ) ; <nl> - if ( ! c - > construction_status ( ) . ok ( ) ) { <nl> - return c - > construction_status ( ) ; <nl> - } <nl> - <nl> - / / Run the shape inference function , and return if there was an error . <nl> - TF_RETURN_IF_ERROR ( op_reg_data - > shape_inference_fn ( c . get ( ) ) ) ; <nl> - <nl> - / / We must run the shape function repeatedly , in case users write <nl> - / / shape functions where they only conditionally call input_tensor ( ) <nl> - / / based on the values of another input tensor . <nl> - bool rerun_shape_fn ; <nl> - do { <nl> - / / If the result of running shape inference would have benefitted <nl> - / / from knowing the values of input tensors , try to materialize <nl> - / / the results of those tensors , and then run the shape inference <nl> - / / function again using those known tensors . <nl> - rerun_shape_fn = false ; <nl> - for ( int i = 0 ; i < c - > num_inputs ( ) ; + + i ) { <nl> - / / Check if we have not already filled in the requested input , <nl> - / / and if not , try to materialize the tensors . <nl> - if ( c - > requested_input_tensor ( i ) & & ! attempted_materialization [ i ] ) { <nl> - rerun_shape_fn = true ; <nl> - attempted_materialization [ i ] = true ; <nl> - TF_RETURN_IF_ERROR ( <nl> - ConstantValue ( input_nodes [ i ] , & real_tensors [ i ] , & input_tensors [ i ] ) ) ; <nl> - } <nl> - } <nl> - <nl> - if ( rerun_shape_fn ) { <nl> - / / We have more information about the shapes on this pass , <nl> - / / so re - run shape inference . <nl> - c - > set_input_tensors ( input_tensors ) ; <nl> - TF_RETURN_IF_ERROR ( op_reg_data - > shape_inference_fn ( c . get ( ) ) ) ; <nl> - } <nl> - } while ( rerun_shape_fn ) ; <nl> - <nl> - / / Store the resulting InferenceContext object in the map . <nl> - node_to_context_ [ node ] = c . release ( ) ; <nl> - <nl> - return Status : : OK ( ) ; <nl> - } <nl> - <nl> - Status ShapeRefiner : : SetShape ( const Node * node , int output_port , <nl> - shape_inference : : ShapeHandle shape ) { <nl> - auto c = GetContext ( node ) ; <nl> - if ( c = = nullptr ) { <nl> - return errors : : Internal ( " Could not find context for " , node - > name ( ) ) ; <nl> - } <nl> - <nl> - if ( output_port < 0 | | output_port > = node - > num_outputs ( ) ) { <nl> - return errors : : InvalidArgument ( <nl> - " output_port ' " , output_port , " ' is out of range , " , " node ' " , <nl> - node - > name ( ) , " ' has " , node - > num_outputs ( ) , " outputs " ) ; <nl> - } <nl> - <nl> - / / Check compatibility , and merge the shapes . <nl> - shape_inference : : ShapeHandle existing_shape = c - > output ( output_port ) ; <nl> - TF_RETURN_IF_ERROR ( c - > Merge ( existing_shape , shape , & shape ) ) ; <nl> - c - > set_output ( output_port , shape ) ; <nl> - <nl> - / / TODO ( vrv ) : Do we need to propagate the new shape through all <nl> - / / consumers that change their outputs ? At the moment , python <nl> - / / does not do this , but this seems like a nice feature . <nl> - <nl> - / / TODO ( vrv ) : We might need to keep track of the fact that the <nl> - / / existing shape is invalidated , in case we need to propagate <nl> - / / this information to remote workers . <nl> - return Status : : OK ( ) ; <nl> - } <nl> - <nl> - Status ShapeRefiner : : ConstantValue ( const Node * node , Tensor * tensor_storage , <nl> - const Tensor * * input_tensor ) const { <nl> - * input_tensor = nullptr ; <nl> - / / For now , we do a simple static analysis of the graph to <nl> - / / materialize those tensors , but in the future , we should try to do <nl> - / / a partial evaluation of the graph . <nl> - <nl> - / / TODO ( vrv ) : Handle other types of nodes , like we do in python : <nl> - / / Cast , Concat , Pack . These require re - implementing the core <nl> - / / kernels themselves , and we may want to switch this to partial <nl> - / / evaluation instead of implementing these again . <nl> - if ( node - > IsConstant ( ) ) { <nl> - return Constant ( node , tensor_storage , input_tensor ) ; <nl> - } <nl> - if ( node - > type_string ( ) = = " Shape " ) { <nl> - return Shape ( node , tensor_storage , input_tensor ) ; <nl> - } <nl> - if ( node - > type_string ( ) = = " Size " ) { <nl> - return Size ( node , tensor_storage , input_tensor ) ; <nl> - } <nl> - if ( node - > type_string ( ) = = " Rank " ) { <nl> - return Rank ( node , tensor_storage , input_tensor ) ; <nl> - } <nl> - if ( node - > type_string ( ) = = " Range " ) { <nl> - return Range ( node , tensor_storage , input_tensor ) ; <nl> - } <nl> - <nl> - return Status : : OK ( ) ; <nl> - } <nl> - <nl> - Status ShapeRefiner : : Constant ( const Node * node , Tensor * tensor_storage , <nl> - const Tensor * * input_tensor ) const { <nl> - TF_RETURN_IF_ERROR ( GetNodeAttr ( node - > def ( ) , " value " , tensor_storage ) ) ; <nl> - * input_tensor = tensor_storage ; <nl> - return Status : : OK ( ) ; <nl> - } <nl> - <nl> - Status ShapeRefiner : : Shape ( const Node * node , Tensor * tensor_storage , <nl> - const Tensor * * input_tensor ) const { <nl> - / / Get the input to the node . <nl> - const Node * shape_node ; <nl> - TF_RETURN_IF_ERROR ( node - > input_node ( 0 , & shape_node ) ) ; <nl> - auto ic = GetContext ( shape_node ) ; <nl> - if ( ! ic ) { <nl> - return errors : : Internal ( " Could not find InferenceContext for " , <nl> - shape_node - > name ( ) ) ; <nl> - } <nl> - shape_inference : : ShapeHandle input_shape = ic - > output ( 0 ) ; <nl> - if ( ic - > FullyDefined ( input_shape ) ) { <nl> - * tensor_storage = Tensor ( DT_INT32 , { ic - > Rank ( input_shape ) } ) ; <nl> - for ( int i = 0 ; i < ic - > Rank ( input_shape ) ; + + i ) { <nl> - int64 dim = ic - > Value ( ic - > Dim ( input_shape , i ) ) ; <nl> - if ( dim > std : : numeric_limits < int32 > : : max ( ) ) { <nl> - / / The output of Shape is 32 - bits , so we cannot fill in anything <nl> - / / here . See b / 28119922 . <nl> - return Status : : OK ( ) ; <nl> - } <nl> - <nl> - tensor_storage - > vec < int32 > ( ) ( i ) = dim ; <nl> - } <nl> - * input_tensor = tensor_storage ; <nl> - } <nl> - <nl> - return Status : : OK ( ) ; <nl> - } <nl> - <nl> - Status ShapeRefiner : : Size ( const Node * node , Tensor * tensor_storage , <nl> - const Tensor * * input_tensor ) const { <nl> - / / Get the input to the node . <nl> - const Node * size_node ; <nl> - TF_RETURN_IF_ERROR ( node - > input_node ( 0 , & size_node ) ) ; <nl> - auto ic = GetContext ( size_node ) ; <nl> - if ( ! ic ) { <nl> - return errors : : Internal ( " Could not find InferenceContext for " , <nl> - size_node - > name ( ) ) ; <nl> - } <nl> - auto num_elements = ic - > NumElements ( ic - > output ( 0 ) ) ; <nl> - if ( ic - > ValueKnown ( num_elements ) ) { <nl> - * tensor_storage = Tensor ( DT_INT32 , { } ) ; <nl> - int64 ne = ic - > Value ( num_elements ) ; <nl> - if ( ne > std : : numeric_limits < int32 > : : max ( ) ) { <nl> - / / The output of Size is 32 - bits , so we cannot fill in anything <nl> - / / here . See b / 28119922 . <nl> - return Status : : OK ( ) ; <nl> - } <nl> - tensor_storage - > scalar < int32 > ( ) ( ) = ic - > Value ( num_elements ) ; <nl> - * input_tensor = tensor_storage ; <nl> - } <nl> - <nl> - return Status : : OK ( ) ; <nl> - } <nl> - <nl> - Status ShapeRefiner : : Rank ( const Node * node , Tensor * tensor_storage , <nl> - const Tensor * * input_tensor ) const { <nl> - / / Get the input to the node . <nl> - const Node * rank_node ; <nl> - TF_RETURN_IF_ERROR ( node - > input_node ( 0 , & rank_node ) ) ; <nl> - auto ic = GetContext ( rank_node ) ; <nl> - if ( ! ic ) { <nl> - return errors : : Internal ( " Could not find InferenceContext for " , <nl> - rank_node - > name ( ) ) ; <nl> - } <nl> - <nl> - if ( ic - > RankKnown ( ic - > output ( 0 ) ) ) { <nl> - int32 rank = ic - > Rank ( ic - > output ( 0 ) ) ; <nl> - * tensor_storage = Tensor ( DT_INT32 , { } ) ; <nl> - tensor_storage - > scalar < int32 > ( ) ( ) = rank ; <nl> - * input_tensor = tensor_storage ; <nl> - } <nl> - <nl> - return Status : : OK ( ) ; <nl> - } <nl> - <nl> - Status ShapeRefiner : : Range ( const Node * node , Tensor * tensor_storage , <nl> - const Tensor * * input_tensor ) const { <nl> - const Node * start_node ; <nl> - TF_RETURN_IF_ERROR ( node - > input_node ( 0 , & start_node ) ) ; <nl> - const Node * limit_node ; <nl> - TF_RETURN_IF_ERROR ( node - > input_node ( 1 , & limit_node ) ) ; <nl> - const Node * delta_node ; <nl> - TF_RETURN_IF_ERROR ( node - > input_node ( 2 , & delta_node ) ) ; <nl> - <nl> - const Tensor * start_node_tensor ; <nl> - TF_RETURN_IF_ERROR ( <nl> - ConstantValue ( start_node , tensor_storage , & start_node_tensor ) ) ; <nl> - if ( start_node_tensor = = nullptr ) return Status : : OK ( ) ; <nl> - const int32 start = start_node_tensor - > scalar < int32 > ( ) ( ) ; <nl> - <nl> - const Tensor * limit_node_tensor ; <nl> - TF_RETURN_IF_ERROR ( <nl> - ConstantValue ( limit_node , tensor_storage , & limit_node_tensor ) ) ; <nl> - if ( limit_node_tensor = = nullptr ) return Status : : OK ( ) ; <nl> - const int32 limit = limit_node_tensor - > scalar < int32 > ( ) ( ) ; <nl> - <nl> - const Tensor * delta_node_tensor ; <nl> - TF_RETURN_IF_ERROR ( <nl> - ConstantValue ( delta_node , tensor_storage , & delta_node_tensor ) ) ; <nl> - if ( delta_node_tensor = = nullptr ) return Status : : OK ( ) ; <nl> - const int32 delta = delta_node_tensor - > scalar < int32 > ( ) ( ) ; <nl> - <nl> - if ( start > limit ) { <nl> - return errors : : InvalidArgument ( " Range requires start < = limit : " , start , <nl> - " / " , limit ) ; <nl> - } <nl> - <nl> - if ( delta < = 0 ) { <nl> - return errors : : InvalidArgument ( " Range requires delta > 0 : " , delta ) ; <nl> - } <nl> - <nl> - int32 size = ( limit - start + delta - 1 ) / delta ; <nl> - * tensor_storage = Tensor ( DT_INT32 , { size } ) ; <nl> - <nl> - auto flat = tensor_storage - > flat < int32 > ( ) ; <nl> - int32 val = start ; <nl> - for ( int32 i = 0 ; i < size ; + + i ) { <nl> - flat ( i ) = val ; <nl> - val + = delta ; <nl> - } <nl> - <nl> - * input_tensor = tensor_storage ; <nl> - return Status : : OK ( ) ; <nl> - } <nl> - <nl> - } / / namespace tensorflow <nl> mmm a / tensorflow / core / kernels / random_shuffle_queue_op . cc <nl> ppp b / tensorflow / core / kernels / random_shuffle_queue_op . cc <nl> RandomShuffleQueue : : RandomShuffleQueue ( <nl> } <nl> <nl> Status RandomShuffleQueue : : Initialize ( ) { <nl> - Status s = TypedQueue : : Initialize ( ) ; <nl> - if ( ! s . ok ( ) ) return s ; <nl> + TF_RETURN_IF_ERROR ( TypedQueue : : Initialize ( ) ) ; <nl> <nl> mutex_lock lock ( mu_ ) ; <nl> for ( int i = 0 ; i < num_components ( ) ; + + i ) { <nl> - queues_ . back ( ) . reserve ( min_after_dequeue_ ) ; <nl> + queues_ [ i ] . reserve ( min_after_dequeue_ ) ; <nl> } <nl> return Status : : OK ( ) ; <nl> } <nl> mmm a / tensorflow / core / lib / strings / numbers . cc <nl> ppp b / tensorflow / core / lib / strings / numbers . cc <nl> <nl> / * Copyright 2015 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> limitations under the License . <nl> # include < cmath > <nl> # include < unordered_map > <nl> <nl> + # include " tensorflow / core / lib / strings / stringprintf . h " <nl> # include " tensorflow / core / platform / logging . h " <nl> # include " tensorflow / core / platform / macros . h " <nl> # include " tensorflow / core / platform / types . h " <nl> bool HexStringToUint64 ( const StringPiece & s , uint64 * result ) { <nl> return true ; <nl> } <nl> <nl> + string HumanReadableNum ( int64 value ) { <nl> + string s ; <nl> + if ( value < 0 ) { <nl> + s + = " - " ; <nl> + value = - value ; <nl> + } <nl> + if ( value < 1000 ) { <nl> + Appendf ( & s , " % lld " , value ) ; <nl> + } else if ( value > = static_cast < int64 > ( 1e15 ) ) { <nl> + / / Number bigger than 1E15 ; use that notation . <nl> + Appendf ( & s , " % 0 . 3G " , static_cast < double > ( value ) ) ; <nl> + } else { <nl> + static const char units [ ] = " kMBT " ; <nl> + const char * unit = units ; <nl> + while ( value > = static_cast < int64 > ( 1000000 ) ) { <nl> + value / = static_cast < int64 > ( 1000 ) ; <nl> + + + unit ; <nl> + CHECK ( unit < units + TF_ARRAYSIZE ( units ) ) ; <nl> + } <nl> + Appendf ( & s , " % . 2f % c " , value / 1000 . 0 , * unit ) ; <nl> + } <nl> + return s ; <nl> + } <nl> + <nl> string HumanReadableNumBytes ( int64 num_bytes ) { <nl> if ( num_bytes = = kint64min ) { <nl> / / Special case for number with not representable negation . <nl> string HumanReadableNumBytes ( int64 num_bytes ) { <nl> return string ( buf ) ; <nl> } <nl> <nl> + string HumanReadableElapsedTime ( double seconds ) { <nl> + string human_readable ; <nl> + <nl> + if ( seconds < 0 ) { <nl> + human_readable = " - " ; <nl> + seconds = - seconds ; <nl> + } <nl> + <nl> + / / Start with us and keep going up to years . <nl> + / / The comparisons must account for rounding to prevent the format breaking <nl> + / / the tested condition and returning , e . g . , " 1e + 03 us " instead of " 1 ms " . <nl> + const double microseconds = seconds * 1 . 0e6 ; <nl> + if ( microseconds < 999 . 5 ) { <nl> + strings : : Appendf ( & human_readable , " % 0 . 3g us " , microseconds ) ; <nl> + return human_readable ; <nl> + } <nl> + double milliseconds = seconds * 1e3 ; <nl> + if ( milliseconds > = . 995 & & milliseconds < 1 ) { <nl> + / / Round half to even in Appendf would convert this to 0 . 999 ms . <nl> + milliseconds = 1 . 0 ; <nl> + } <nl> + if ( milliseconds < 999 . 5 ) { <nl> + strings : : Appendf ( & human_readable , " % 0 . 3g ms " , milliseconds ) ; <nl> + return human_readable ; <nl> + } <nl> + if ( seconds < 60 . 0 ) { <nl> + strings : : Appendf ( & human_readable , " % 0 . 3g s " , seconds ) ; <nl> + return human_readable ; <nl> + } <nl> + seconds / = 60 . 0 ; <nl> + if ( seconds < 60 . 0 ) { <nl> + strings : : Appendf ( & human_readable , " % 0 . 3g min " , seconds ) ; <nl> + return human_readable ; <nl> + } <nl> + seconds / = 60 . 0 ; <nl> + if ( seconds < 24 . 0 ) { <nl> + strings : : Appendf ( & human_readable , " % 0 . 3g h " , seconds ) ; <nl> + return human_readable ; <nl> + } <nl> + seconds / = 24 . 0 ; <nl> + if ( seconds < 30 . 0 ) { <nl> + strings : : Appendf ( & human_readable , " % 0 . 3g days " , seconds ) ; <nl> + return human_readable ; <nl> + } <nl> + if ( seconds < 365 . 2425 ) { <nl> + strings : : Appendf ( & human_readable , " % 0 . 3g months " , seconds / 30 . 436875 ) ; <nl> + return human_readable ; <nl> + } <nl> + seconds / = 365 . 2425 ; <nl> + strings : : Appendf ( & human_readable , " % 0 . 3g years " , seconds ) ; <nl> + return human_readable ; <nl> + } <nl> + <nl> } / / namespace strings <nl> } / / namespace tensorflow <nl> mmm a / tensorflow / core / lib / strings / numbers . h <nl> ppp b / tensorflow / core / lib / strings / numbers . h <nl> bool safe_strtof ( const char * str , float * value ) ; <nl> / / Values may be rounded on over - and underflow . <nl> bool safe_strtod ( const char * str , double * value ) ; <nl> <nl> + / / Converts from an int64 to a human readable string representing the <nl> + / / same number , using decimal powers . e . g . 1200000 - > " 1 . 20M " . <nl> + string HumanReadableNum ( int64 value ) ; <nl> + <nl> / / Converts from an int64 representing a number of bytes to a <nl> / / human readable string representing the same number . <nl> / / e . g . 12345678 - > " 11 . 77MiB " . <nl> string HumanReadableNumBytes ( int64 num_bytes ) ; <nl> <nl> + / / Converts a time interval as double to a human readable <nl> + / / string . For example : <nl> + / / 0 . 001 - > " 1 ms " <nl> + / / 10 . 0 - > " 10 s " <nl> + / / 933120 . 0 - > " 10 . 8 days " <nl> + / / 39420000 . 0 - > " 1 . 25 years " <nl> + / / - 10 - > " - 10 s " <nl> + string HumanReadableElapsedTime ( double seconds ) ; <nl> + <nl> } / / namespace strings <nl> } / / namespace tensorflow <nl> <nl> mmm a / tensorflow / core / lib / strings / numbers_test . cc <nl> ppp b / tensorflow / core / lib / strings / numbers_test . cc <nl> TEST ( Uint64ToHexString , Ints ) { <nl> EXPECT_FALSE ( HexStringToUint64 ( " 0000000000000000xyz " , & dummy ) ) ; <nl> } <nl> <nl> + TEST ( HumanReadableNum , Basic ) { <nl> + EXPECT_EQ ( HumanReadableNum ( 823 ) , " 823 " ) ; <nl> + EXPECT_EQ ( HumanReadableNum ( 1024 ) , " 1 . 02k " ) ; <nl> + EXPECT_EQ ( HumanReadableNum ( 4000 ) , " 4 . 00k " ) ; <nl> + EXPECT_EQ ( HumanReadableNum ( 999499 ) , " 999 . 50k " ) ; <nl> + EXPECT_EQ ( HumanReadableNum ( 1000000 ) , " 1 . 00M " ) ; <nl> + EXPECT_EQ ( HumanReadableNum ( 1048575 ) , " 1 . 05M " ) ; <nl> + EXPECT_EQ ( HumanReadableNum ( 1048576 ) , " 1 . 05M " ) ; <nl> + EXPECT_EQ ( HumanReadableNum ( 23956812342 ) , " 23 . 96B " ) ; <nl> + EXPECT_EQ ( HumanReadableNum ( 123456789012345678 ) , " 1 . 23E + 17 " ) ; <nl> + } <nl> + <nl> TEST ( HumanReadableNumBytes , Bytes ) { <nl> EXPECT_EQ ( " 0B " , HumanReadableNumBytes ( 0 ) ) ; <nl> EXPECT_EQ ( " 4B " , HumanReadableNumBytes ( 4 ) ) ; <nl> TEST ( HumanReadableNumBytes , Bytes ) { <nl> EXPECT_EQ ( " - 8E " , HumanReadableNumBytes ( kint64min ) ) ; <nl> } <nl> <nl> + TEST ( HumanReadableElapsedTime , Basic ) { <nl> + EXPECT_EQ ( HumanReadableElapsedTime ( - 10 ) , " - 10 s " ) ; <nl> + EXPECT_EQ ( HumanReadableElapsedTime ( - 0 . 001 ) , " - 1 ms " ) ; <nl> + EXPECT_EQ ( HumanReadableElapsedTime ( - 60 . 0 ) , " - 1 min " ) ; <nl> + EXPECT_EQ ( HumanReadableElapsedTime ( 0 . 00000001 ) , " 0 . 01 us " ) ; <nl> + EXPECT_EQ ( HumanReadableElapsedTime ( 0 . 0000012 ) , " 1 . 2 us " ) ; <nl> + EXPECT_EQ ( HumanReadableElapsedTime ( 0 . 0012 ) , " 1 . 2 ms " ) ; <nl> + EXPECT_EQ ( HumanReadableElapsedTime ( 0 . 12 ) , " 120 ms " ) ; <nl> + EXPECT_EQ ( HumanReadableElapsedTime ( 1 . 12 ) , " 1 . 12 s " ) ; <nl> + EXPECT_EQ ( HumanReadableElapsedTime ( 90 . 0 ) , " 1 . 5 min " ) ; <nl> + EXPECT_EQ ( HumanReadableElapsedTime ( 600 . 0 ) , " 10 min " ) ; <nl> + EXPECT_EQ ( HumanReadableElapsedTime ( 9000 . 0 ) , " 2 . 5 h " ) ; <nl> + EXPECT_EQ ( HumanReadableElapsedTime ( 87480 . 0 ) , " 1 . 01 days " ) ; <nl> + EXPECT_EQ ( HumanReadableElapsedTime ( 7776000 . 0 ) , " 2 . 96 months " ) ; <nl> + EXPECT_EQ ( HumanReadableElapsedTime ( 78840000 . 0 ) , " 2 . 5 years " ) ; <nl> + EXPECT_EQ ( HumanReadableElapsedTime ( 382386614 . 40 ) , " 12 . 1 years " ) ; <nl> + EXPECT_EQ ( HumanReadableElapsedTime ( DBL_MAX ) , " 5 . 7e + 300 years " ) ; <nl> + } <nl> + <nl> TEST ( safe_strto32 , Int32s ) { <nl> int32 result ; <nl> <nl> mmm a / tensorflow / core / lib / strings / str_util . cc <nl> ppp b / tensorflow / core / lib / strings / str_util . cc <nl> bool ConsumePrefix ( StringPiece * s , StringPiece expected ) { <nl> return false ; <nl> } <nl> <nl> + bool ConsumeSuffix ( StringPiece * s , StringPiece expected ) { <nl> + if ( s - > ends_with ( expected ) ) { <nl> + s - > remove_suffix ( expected . size ( ) ) ; <nl> + return true ; <nl> + } <nl> + return false ; <nl> + } <nl> + <nl> bool ConsumeLeadingDigits ( StringPiece * s , uint64 * val ) { <nl> const char * p = s - > data ( ) ; <nl> const char * limit = p + s - > size ( ) ; <nl> bool SplitAndParseAsInts ( StringPiece text , char delim , <nl> return true ; <nl> } <nl> <nl> - string HumanReadableElapsedTime ( double seconds ) { <nl> - string human_readable ; <nl> - <nl> - if ( seconds < 0 ) { <nl> - human_readable = " - " ; <nl> - seconds = - seconds ; <nl> - } <nl> - <nl> - / / Start with us and keep going up to years . <nl> - / / The comparisons must account for rounding to prevent the format breaking <nl> - / / the tested condition and returning , e . g . , " 1e + 03 us " instead of " 1 ms " . <nl> - const double microseconds = seconds * 1 . 0e6 ; <nl> - if ( microseconds < 999 . 5 ) { <nl> - strings : : Appendf ( & human_readable , " % 0 . 3g us " , microseconds ) ; <nl> - return human_readable ; <nl> - } <nl> - double milliseconds = seconds * 1e3 ; <nl> - if ( milliseconds > = . 995 & & milliseconds < 1 ) { <nl> - / / Round half to even in Appendf would convert this to 0 . 999 ms . <nl> - milliseconds = 1 . 0 ; <nl> - } <nl> - if ( milliseconds < 999 . 5 ) { <nl> - strings : : Appendf ( & human_readable , " % 0 . 3g ms " , milliseconds ) ; <nl> - return human_readable ; <nl> - } <nl> - if ( seconds < 60 . 0 ) { <nl> - strings : : Appendf ( & human_readable , " % 0 . 3g s " , seconds ) ; <nl> - return human_readable ; <nl> - } <nl> - seconds / = 60 . 0 ; <nl> - if ( seconds < 60 . 0 ) { <nl> - strings : : Appendf ( & human_readable , " % 0 . 3g min " , seconds ) ; <nl> - return human_readable ; <nl> - } <nl> - seconds / = 60 . 0 ; <nl> - if ( seconds < 24 . 0 ) { <nl> - strings : : Appendf ( & human_readable , " % 0 . 3g h " , seconds ) ; <nl> - return human_readable ; <nl> - } <nl> - seconds / = 24 . 0 ; <nl> - if ( seconds < 30 . 0 ) { <nl> - strings : : Appendf ( & human_readable , " % 0 . 3g days " , seconds ) ; <nl> - return human_readable ; <nl> - } <nl> - if ( seconds < 365 . 2425 ) { <nl> - strings : : Appendf ( & human_readable , " % 0 . 3g months " , seconds / 30 . 436875 ) ; <nl> - return human_readable ; <nl> - } <nl> - seconds / = 365 . 2425 ; <nl> - strings : : Appendf ( & human_readable , " % 0 . 3g years " , seconds ) ; <nl> - return human_readable ; <nl> - } <nl> - <nl> } / / namespace str_util <nl> } / / namespace tensorflow <nl> mmm a / tensorflow / core / lib / strings / str_util . h <nl> ppp b / tensorflow / core / lib / strings / str_util . h <nl> bool ConsumeNonWhitespace ( StringPiece * s , StringPiece * val ) ; <nl> / / Otherwise , return false . <nl> bool ConsumePrefix ( StringPiece * s , StringPiece expected ) ; <nl> <nl> + / / If " * s " ends with " expected " , remove it and return true . <nl> + / / Otherwise , return false . <nl> + bool ConsumeSuffix ( StringPiece * s , StringPiece expected ) ; <nl> + <nl> / / Return lower - cased version of s . <nl> string Lowercase ( StringPiece s ) ; <nl> <nl> string Uppercase ( StringPiece s ) ; <nl> / / set of characters that can be used as word boundaries . <nl> void TitlecaseString ( string * s , StringPiece delimiters ) ; <nl> <nl> - / / Converts a time interval as double to a human readable <nl> - / / string . For example : <nl> - / / 0 . 001 - > " 1 ms " <nl> - / / 10 . 0 - > " 10 s " <nl> - / / 933120 . 0 - > " 10 . 8 days " <nl> - / / 39420000 . 0 - > " 1 . 25 years " <nl> - / / - 10 - > " - 10 s " <nl> - string HumanReadableElapsedTime ( double seconds ) ; <nl> - <nl> / / Join functionality <nl> template < typename T > <nl> string Join ( const T & s , const char * sep ) ; <nl> mmm a / tensorflow / core / lib / strings / str_util_test . cc <nl> ppp b / tensorflow / core / lib / strings / str_util_test . cc <nl> TEST ( TitlecaseString , Basic ) { <nl> ASSERT_EQ ( s , " Dense " ) ; <nl> } <nl> <nl> - TEST ( HumanReadableElapsedTime , Basic ) { <nl> - EXPECT_EQ ( str_util : : HumanReadableElapsedTime ( - 10 ) , " - 10 s " ) ; <nl> - EXPECT_EQ ( str_util : : HumanReadableElapsedTime ( - 0 . 001 ) , " - 1 ms " ) ; <nl> - EXPECT_EQ ( str_util : : HumanReadableElapsedTime ( - 60 . 0 ) , " - 1 min " ) ; <nl> - EXPECT_EQ ( str_util : : HumanReadableElapsedTime ( 0 . 00000001 ) , " 0 . 01 us " ) ; <nl> - EXPECT_EQ ( str_util : : HumanReadableElapsedTime ( 0 . 0000012 ) , " 1 . 2 us " ) ; <nl> - EXPECT_EQ ( str_util : : HumanReadableElapsedTime ( 0 . 0012 ) , " 1 . 2 ms " ) ; <nl> - EXPECT_EQ ( str_util : : HumanReadableElapsedTime ( 0 . 12 ) , " 120 ms " ) ; <nl> - EXPECT_EQ ( str_util : : HumanReadableElapsedTime ( 1 . 12 ) , " 1 . 12 s " ) ; <nl> - EXPECT_EQ ( str_util : : HumanReadableElapsedTime ( 90 . 0 ) , " 1 . 5 min " ) ; <nl> - EXPECT_EQ ( str_util : : HumanReadableElapsedTime ( 600 . 0 ) , " 10 min " ) ; <nl> - EXPECT_EQ ( str_util : : HumanReadableElapsedTime ( 9000 . 0 ) , " 2 . 5 h " ) ; <nl> - EXPECT_EQ ( str_util : : HumanReadableElapsedTime ( 87480 . 0 ) , " 1 . 01 days " ) ; <nl> - EXPECT_EQ ( str_util : : HumanReadableElapsedTime ( 7776000 . 0 ) , " 2 . 96 months " ) ; <nl> - EXPECT_EQ ( str_util : : HumanReadableElapsedTime ( 78840000 . 0 ) , " 2 . 5 years " ) ; <nl> - EXPECT_EQ ( str_util : : HumanReadableElapsedTime ( 382386614 . 40 ) , " 12 . 1 years " ) ; <nl> - EXPECT_EQ ( str_util : : HumanReadableElapsedTime ( DBL_MAX ) , " 5 . 7e + 300 years " ) ; <nl> - } <nl> - <nl> } / / namespace tensorflow <nl> mmm a / tensorflow / core / platform / default / build_config . bzl <nl> ppp b / tensorflow / core / platform / default / build_config . bzl <nl> <nl> load ( " @ protobuf / / : protobuf . bzl " , " cc_proto_library " ) <nl> load ( " @ protobuf / / : protobuf . bzl " , " py_proto_library " ) <nl> <nl> - # configure may change the following line to True <nl> + # configure may change the following lines to True <nl> WITH_GCP_SUPPORT = False <nl> + WITH_HDFS_SUPPORT = False <nl> <nl> # Appends a suffix to a list of deps . <nl> def tf_deps ( deps , suffix ) : <nl> def tf_kernel_tests_linkstatic ( ) : <nl> return 0 <nl> <nl> def tf_additional_lib_deps ( ) : <nl> - return ( [ " / / tensorflow / core / platform / cloud : gcs_file_system " ] <nl> - if WITH_GCP_SUPPORT else [ ] ) <nl> + deps = [ ] <nl> + if WITH_GCP_SUPPORT : <nl> + deps . append ( " / / tensorflow / core / platform / cloud : gcs_file_system " ) <nl> + if WITH_HDFS_SUPPORT : <nl> + deps . append ( " / / tensorflow / core / platform / hadoop : hadoop_file_system " ) <nl> + return deps <nl> new file mode 100644 <nl> index 0000000000000 . . 457b4fe14cbc5 <nl> mmm / dev / null <nl> ppp b / tensorflow / core / platform / hadoop / BUILD <nl> <nl> + # Description : <nl> + # Hadoop file system implementation . <nl> + <nl> + package ( <nl> + default_visibility = [ " / / visibility : public " ] , <nl> + ) <nl> + <nl> + licenses ( [ " notice " ] ) # Apache 2 . 0 <nl> + <nl> + load ( <nl> + " / / tensorflow : tensorflow . bzl " , <nl> + " tf_cc_test " , <nl> + ) <nl> + <nl> + filegroup ( <nl> + name = " all_files " , <nl> + srcs = glob ( <nl> + [ " * * / * " ] , <nl> + exclude = [ <nl> + " * * / METADATA " , <nl> + " * * / OWNERS " , <nl> + ] , <nl> + ) , <nl> + visibility = [ " / / tensorflow : __subpackages__ " ] , <nl> + ) <nl> + <nl> + cc_library ( <nl> + name = " hadoop_file_system " , <nl> + srcs = [ " hadoop_file_system . cc " ] , <nl> + hdrs = [ " hadoop_file_system . h " ] , <nl> + deps = [ <nl> + " / / tensorflow / core : lib " , <nl> + " / / tensorflow / core : lib_internal " , <nl> + " / / tensorflow / third_party / hadoop : hdfs " , <nl> + ] , <nl> + alwayslink = 1 , <nl> + ) <nl> + <nl> + # This test is set to manual because it requires downloading the Hadoop <nl> + # distribution to run . To run this test : <nl> + # 1 . Ensure $ JAVA_HOME is set . <nl> + # 2 . Download the binary Hadoop distribution from : <nl> + # http : / / hadoop . apache . org / releases . html <nl> + # 3 . Extract the Hadoop distribution and run : <nl> + # source libexec / hadoop - config . sh <nl> + # 4 . bazel test \ <nl> + # - - test_env = LD_LIBRARY_PATH = $ JAVA_HOME / jre / lib / amd64 / server \ <nl> + # - - test_env = HADOOP_HDFS_HOME = $ HADOOP_HDFS_HOME \ <nl> + # - - test_env = CLASSPATH = $ ( $ HADOOP_HDFS_HOME / bin / hadoop classpath - - glob ) \ <nl> + # - - test_strategy = local \ <nl> + # : hadoop_file_system_test <nl> + tf_cc_test ( <nl> + name = " hadoop_file_system_test " , <nl> + size = " small " , <nl> + srcs = [ <nl> + " hadoop_file_system_test . cc " , <nl> + ] , <nl> + tags = [ <nl> + " manual " , <nl> + " notap " , <nl> + ] , <nl> + deps = [ <nl> + " : hadoop_file_system " , <nl> + " / / tensorflow / core : lib " , <nl> + " / / tensorflow / core : lib_internal " , <nl> + " / / tensorflow / core : test " , <nl> + " / / tensorflow / core : test_main " , <nl> + ] , <nl> + ) <nl> new file mode 100644 <nl> index 0000000000000 . . 662818cc9a7bb <nl> mmm / dev / null <nl> ppp b / tensorflow / core / platform / hadoop / hadoop_file_system . cc <nl> <nl> + / * Copyright 2016 The TensorFlow Authors . All Rights Reserved . <nl> + <nl> + Licensed under the Apache License , Version 2 . 0 ( the " License " ) ; <nl> + you may not use this file except in compliance with the License . <nl> + You may obtain a copy of the License at <nl> + <nl> + http : / / www . apache . org / licenses / LICENSE - 2 . 0 <nl> + <nl> + Unless required by applicable law or agreed to in writing , software <nl> + distributed under the License is distributed on an " AS IS " BASIS , <nl> + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND , either express or implied . <nl> + See the License for the specific language governing permissions and <nl> + limitations under the License . <nl> + = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = * / <nl> + <nl> + # include " tensorflow / core / platform / hadoop / hadoop_file_system . h " <nl> + <nl> + # include < errno . h > <nl> + <nl> + # include " tensorflow / core / lib / core / status . h " <nl> + # include " tensorflow / core / lib / io / path . h " <nl> + # include " tensorflow / core / lib / strings / strcat . h " <nl> + # include " tensorflow / core / platform / env . h " <nl> + # include " tensorflow / core / platform / logging . h " <nl> + # include " tensorflow / core / platform / posix / error . h " <nl> + # include " tensorflow / third_party / hadoop / hdfs . h " <nl> + <nl> + namespace tensorflow { <nl> + <nl> + template < typename R , typename . . . Args > <nl> + Status BindFunc ( void * handle , const char * name , <nl> + std : : function < R ( Args . . . ) > * func ) { <nl> + void * symbol_ptr = nullptr ; <nl> + TF_RETURN_IF_ERROR ( <nl> + Env : : Default ( ) - > GetSymbolFromLibrary ( handle , name , & symbol_ptr ) ) ; <nl> + * func = reinterpret_cast < R ( * ) ( Args . . . ) > ( symbol_ptr ) ; <nl> + return Status : : OK ( ) ; <nl> + } <nl> + <nl> + class LibHDFS { <nl> + public : <nl> + static LibHDFS * Load ( ) { <nl> + static LibHDFS * lib = [ ] ( ) - > LibHDFS * { <nl> + LibHDFS * lib = new LibHDFS ; <nl> + lib - > LoadAndBind ( ) ; <nl> + return lib ; <nl> + } ( ) ; <nl> + <nl> + return lib ; <nl> + } <nl> + <nl> + / / The status , if any , from failure to load . <nl> + Status status ( ) { return status_ ; } <nl> + <nl> + std : : function < hdfsFS ( hdfsBuilder * ) > hdfsBuilderConnect ; <nl> + std : : function < hdfsBuilder * ( ) > hdfsNewBuilder ; <nl> + std : : function < void ( hdfsBuilder * , const char * ) > hdfsBuilderSetNameNode ; <nl> + std : : function < int ( hdfsFS , hdfsFile ) > hdfsCloseFile ; <nl> + std : : function < tSize ( hdfsFS , hdfsFile , tOffset , void * , tSize ) > hdfsPread ; <nl> + std : : function < tSize ( hdfsFS , hdfsFile , const void * , tSize ) > hdfsWrite ; <nl> + std : : function < int ( hdfsFS , hdfsFile ) > hdfsFlush ; <nl> + std : : function < int ( hdfsFS , hdfsFile ) > hdfsHSync ; <nl> + std : : function < hdfsFile ( hdfsFS , const char * , int , int , short , tSize ) > <nl> + hdfsOpenFile ; <nl> + std : : function < int ( hdfsFS , const char * ) > hdfsExists ; <nl> + std : : function < hdfsFileInfo * ( hdfsFS , const char * , int * ) > hdfsListDirectory ; <nl> + std : : function < void ( hdfsFileInfo * , int ) > hdfsFreeFileInfo ; <nl> + std : : function < int ( hdfsFS , const char * , int recursive ) > hdfsDelete ; <nl> + std : : function < int ( hdfsFS , const char * ) > hdfsCreateDirectory ; <nl> + std : : function < hdfsFileInfo * ( hdfsFS , const char * ) > hdfsGetPathInfo ; <nl> + std : : function < int ( hdfsFS , const char * , const char * ) > hdfsRename ; <nl> + <nl> + private : <nl> + void LoadAndBind ( ) { <nl> + auto TryLoadAndBind = [ this ] ( const char * name , void * * handle ) - > Status { <nl> + TF_RETURN_IF_ERROR ( Env : : Default ( ) - > LoadLibrary ( name , handle ) ) ; <nl> + # define BIND_HDFS_FUNC ( function ) \ <nl> + TF_RETURN_IF_ERROR ( BindFunc ( * handle , # function , & function ) ) ; <nl> + <nl> + BIND_HDFS_FUNC ( hdfsBuilderConnect ) ; <nl> + BIND_HDFS_FUNC ( hdfsNewBuilder ) ; <nl> + BIND_HDFS_FUNC ( hdfsBuilderSetNameNode ) ; <nl> + BIND_HDFS_FUNC ( hdfsCloseFile ) ; <nl> + BIND_HDFS_FUNC ( hdfsPread ) ; <nl> + BIND_HDFS_FUNC ( hdfsWrite ) ; <nl> + BIND_HDFS_FUNC ( hdfsFlush ) ; <nl> + BIND_HDFS_FUNC ( hdfsHSync ) ; <nl> + BIND_HDFS_FUNC ( hdfsOpenFile ) ; <nl> + BIND_HDFS_FUNC ( hdfsExists ) ; <nl> + BIND_HDFS_FUNC ( hdfsListDirectory ) ; <nl> + BIND_HDFS_FUNC ( hdfsFreeFileInfo ) ; <nl> + BIND_HDFS_FUNC ( hdfsDelete ) ; <nl> + BIND_HDFS_FUNC ( hdfsCreateDirectory ) ; <nl> + BIND_HDFS_FUNC ( hdfsGetPathInfo ) ; <nl> + BIND_HDFS_FUNC ( hdfsRename ) ; <nl> + # undef BIND_HDFS_FUNC <nl> + return Status : : OK ( ) ; <nl> + } ; <nl> + <nl> + / / libhdfs . so won ' t be in the standard locations . Use the path as specified <nl> + / / in the libhdfs documentation . <nl> + char * hdfs_home = getenv ( " HADOOP_HDFS_HOME " ) ; <nl> + if ( hdfs_home = = nullptr ) { <nl> + status_ = errors : : FailedPrecondition ( <nl> + " Environment variable HADOOP_HDFS_HOME not set " ) ; <nl> + return ; <nl> + } <nl> + string path = io : : JoinPath ( hdfs_home , " lib " , " native " , " libhdfs . so " ) ; <nl> + status_ = TryLoadAndBind ( path . c_str ( ) , & handle_ ) ; <nl> + return ; <nl> + } <nl> + <nl> + Status status_ ; <nl> + void * handle_ = nullptr ; <nl> + } ; <nl> + <nl> + HadoopFileSystem : : HadoopFileSystem ( ) : hdfs_ ( LibHDFS : : Load ( ) ) { } <nl> + <nl> + HadoopFileSystem : : ~ HadoopFileSystem ( ) { } <nl> + <nl> + / / We rely on HDFS connection caching here . The HDFS client calls <nl> + / / org . apache . hadoop . fs . FileSystem . get ( ) , which caches the connection <nl> + / / internally . <nl> + Status HadoopFileSystem : : Connect ( StringPiece fname , hdfsFS * fs ) { <nl> + TF_RETURN_IF_ERROR ( hdfs_ - > status ( ) ) ; <nl> + <nl> + if ( ! fname . Consume ( " hdfs : / / " ) ) { <nl> + return errors : : InvalidArgument ( " HDFS path must start with hdfs : / / " ) ; <nl> + } <nl> + auto first_slash = fname . find ( ' / ' ) ; <nl> + string namenode ; <nl> + if ( first_slash = = string : : npos ) { <nl> + namenode = fname . ToString ( ) ; <nl> + } else { <nl> + namenode = fname . substr ( 0 , first_slash ) . ToString ( ) ; <nl> + } <nl> + <nl> + hdfsBuilder * builder = hdfs_ - > hdfsNewBuilder ( ) ; <nl> + if ( namenode = = " localfilesystem " ) { <nl> + hdfs_ - > hdfsBuilderSetNameNode ( builder , nullptr ) ; <nl> + } else { <nl> + hdfs_ - > hdfsBuilderSetNameNode ( builder , namenode . c_str ( ) ) ; <nl> + } <nl> + * fs = hdfs_ - > hdfsBuilderConnect ( builder ) ; <nl> + if ( * fs = = nullptr ) { <nl> + return errors : : NotFound ( strerror ( errno ) ) ; <nl> + } <nl> + return Status : : OK ( ) ; <nl> + } <nl> + <nl> + string HadoopFileSystem : : TranslateName ( const string & name ) const { <nl> + StringPiece sp = name ; <nl> + sp . Consume ( " hdfs : / / " ) ; <nl> + auto first_slash = sp . find ( ' / ' ) ; <nl> + if ( first_slash = = string : : npos ) { <nl> + return string ( ) ; <nl> + } <nl> + sp . remove_prefix ( first_slash ) ; <nl> + return sp . ToString ( ) ; <nl> + } <nl> + <nl> + class HDFSRandomAccessFile : public RandomAccessFile { <nl> + public : <nl> + HDFSRandomAccessFile ( const string & fname , LibHDFS * hdfs , hdfsFS fs , <nl> + hdfsFile file ) <nl> + : filename_ ( fname ) , hdfs_ ( hdfs ) , fs_ ( fs ) , file_ ( file ) { } <nl> + <nl> + ~ HDFSRandomAccessFile ( ) override { hdfs_ - > hdfsCloseFile ( fs_ , file_ ) ; } <nl> + <nl> + Status Read ( uint64 offset , size_t n , StringPiece * result , <nl> + char * scratch ) const override { <nl> + Status s ; <nl> + char * dst = scratch ; <nl> + while ( n > 0 & & s . ok ( ) ) { <nl> + tSize r = hdfs_ - > hdfsPread ( fs_ , file_ , static_cast < tOffset > ( offset ) , dst , <nl> + static_cast < tSize > ( n ) ) ; <nl> + if ( r > 0 ) { <nl> + dst + = r ; <nl> + n - = r ; <nl> + offset + = r ; <nl> + } else if ( r = = 0 ) { <nl> + s = Status ( error : : OUT_OF_RANGE , " Read less bytes than requested " ) ; <nl> + } else if ( errno = = EINTR | | errno = = EAGAIN ) { <nl> + / / hdfsPread may return EINTR too . Just retry . <nl> + } else { <nl> + s = IOError ( filename_ , errno ) ; <nl> + } <nl> + } <nl> + * result = StringPiece ( scratch , dst - scratch ) ; <nl> + return s ; <nl> + } <nl> + <nl> + private : <nl> + string filename_ ; <nl> + LibHDFS * hdfs_ ; <nl> + hdfsFS fs_ ; <nl> + hdfsFile file_ ; <nl> + } ; <nl> + <nl> + Status HadoopFileSystem : : NewRandomAccessFile ( <nl> + const string & fname , std : : unique_ptr < RandomAccessFile > * result ) { <nl> + hdfsFS fs = nullptr ; <nl> + TF_RETURN_IF_ERROR ( Connect ( fname , & fs ) ) ; <nl> + <nl> + hdfsFile file = <nl> + hdfs_ - > hdfsOpenFile ( fs , TranslateName ( fname ) . c_str ( ) , O_RDONLY , 0 , 0 , 0 ) ; <nl> + if ( file = = nullptr ) { <nl> + return IOError ( fname , errno ) ; <nl> + } <nl> + result - > reset ( new HDFSRandomAccessFile ( fname , hdfs_ , fs , file ) ) ; <nl> + return Status : : OK ( ) ; <nl> + } <nl> + <nl> + class HDFSWritableFile : public WritableFile { <nl> + public : <nl> + HDFSWritableFile ( const string & fname , LibHDFS * hdfs , hdfsFS fs , hdfsFile file ) <nl> + : filename_ ( fname ) , hdfs_ ( hdfs ) , fs_ ( fs ) , file_ ( file ) { } <nl> + <nl> + ~ HDFSWritableFile ( ) override { <nl> + if ( file_ ! = nullptr ) { <nl> + Close ( ) ; <nl> + } <nl> + } <nl> + <nl> + Status Append ( const StringPiece & data ) override { <nl> + if ( hdfs_ - > hdfsWrite ( fs_ , file_ , data . data ( ) , <nl> + static_cast < tSize > ( data . size ( ) ) ) = = - 1 ) { <nl> + return IOError ( filename_ , errno ) ; <nl> + } <nl> + return Status : : OK ( ) ; <nl> + } <nl> + <nl> + Status Close ( ) override { <nl> + Status result ; <nl> + if ( hdfs_ - > hdfsCloseFile ( fs_ , file_ ) ! = 0 ) { <nl> + result = IOError ( filename_ , errno ) ; <nl> + } <nl> + hdfs_ = nullptr ; <nl> + fs_ = nullptr ; <nl> + file_ = nullptr ; <nl> + return result ; <nl> + } <nl> + <nl> + Status Flush ( ) override { <nl> + if ( hdfs_ - > hdfsFlush ( fs_ , file_ ) ! = 0 ) { <nl> + return IOError ( filename_ , errno ) ; <nl> + } <nl> + return Status : : OK ( ) ; <nl> + } <nl> + <nl> + Status Sync ( ) override { <nl> + if ( hdfs_ - > hdfsHSync ( fs_ , file_ ) ! = 0 ) { <nl> + return IOError ( filename_ , errno ) ; <nl> + } <nl> + return Status : : OK ( ) ; <nl> + } <nl> + <nl> + private : <nl> + string filename_ ; <nl> + LibHDFS * hdfs_ ; <nl> + hdfsFS fs_ ; <nl> + hdfsFile file_ ; <nl> + } ; <nl> + <nl> + Status HadoopFileSystem : : NewWritableFile ( <nl> + const string & fname , std : : unique_ptr < WritableFile > * result ) { <nl> + hdfsFS fs = nullptr ; <nl> + TF_RETURN_IF_ERROR ( Connect ( fname , & fs ) ) ; <nl> + <nl> + hdfsFile file = <nl> + hdfs_ - > hdfsOpenFile ( fs , TranslateName ( fname ) . c_str ( ) , O_WRONLY , 0 , 0 , 0 ) ; <nl> + if ( file = = nullptr ) { <nl> + return IOError ( fname , errno ) ; <nl> + } <nl> + result - > reset ( new HDFSWritableFile ( fname , hdfs_ , fs , file ) ) ; <nl> + return Status : : OK ( ) ; <nl> + } <nl> + <nl> + Status HadoopFileSystem : : NewAppendableFile ( <nl> + const string & fname , std : : unique_ptr < WritableFile > * result ) { <nl> + hdfsFS fs = nullptr ; <nl> + TF_RETURN_IF_ERROR ( Connect ( fname , & fs ) ) ; <nl> + <nl> + hdfsFile file = hdfs_ - > hdfsOpenFile ( fs , TranslateName ( fname ) . c_str ( ) , <nl> + O_WRONLY | O_APPEND , 0 , 0 , 0 ) ; <nl> + if ( file = = nullptr ) { <nl> + return IOError ( fname , errno ) ; <nl> + } <nl> + result - > reset ( new HDFSWritableFile ( fname , hdfs_ , fs , file ) ) ; <nl> + return Status : : OK ( ) ; <nl> + } <nl> + <nl> + Status HadoopFileSystem : : NewReadOnlyMemoryRegionFromFile ( <nl> + const string & fname , std : : unique_ptr < ReadOnlyMemoryRegion > * result ) { <nl> + / / hadoopReadZero ( ) technically supports this call with the following <nl> + / / caveats : <nl> + / / - It only works up to 2 GB . We ' d have to Stat ( ) the file to ensure that <nl> + / / it fits . <nl> + / / - If not on the local filesystem , the entire file will be read , making <nl> + / / it inefficient for callers that assume typical mmap ( ) behavior . <nl> + return errors : : Unimplemented ( " HDFS does not support ReadOnlyMemoryRegion " ) ; <nl> + } <nl> + <nl> + bool HadoopFileSystem : : FileExists ( const string & fname ) { <nl> + hdfsFS fs = nullptr ; <nl> + Status status = Connect ( fname , & fs ) ; <nl> + if ( ! status . ok ( ) ) { <nl> + LOG ( ERROR ) < < " Connect failed : " < < status . error_message ( ) ; <nl> + return false ; <nl> + } <nl> + <nl> + return hdfs_ - > hdfsExists ( fs , TranslateName ( fname ) . c_str ( ) ) = = 0 ; <nl> + } <nl> + <nl> + Status HadoopFileSystem : : GetChildren ( const string & dir , <nl> + std : : vector < string > * result ) { <nl> + result - > clear ( ) ; <nl> + hdfsFS fs = nullptr ; <nl> + TF_RETURN_IF_ERROR ( Connect ( dir , & fs ) ) ; <nl> + <nl> + / / hdfsListDirectory returns nullptr if the directory is empty . Do a separate <nl> + / / check to verify the directory exists first . <nl> + FileStatistics stat ; <nl> + TF_RETURN_IF_ERROR ( Stat ( dir , & stat ) ) ; <nl> + <nl> + int entries = 0 ; <nl> + hdfsFileInfo * info = <nl> + hdfs_ - > hdfsListDirectory ( fs , TranslateName ( dir ) . c_str ( ) , & entries ) ; <nl> + if ( info = = nullptr ) { <nl> + if ( stat . is_directory ) { <nl> + / / Assume it ' s an empty directory . <nl> + return Status : : OK ( ) ; <nl> + } <nl> + return IOError ( dir , errno ) ; <nl> + } <nl> + for ( int i = 0 ; i < entries ; i + + ) { <nl> + result - > push_back ( io : : Basename ( info [ i ] . mName ) . ToString ( ) ) ; <nl> + } <nl> + hdfs_ - > hdfsFreeFileInfo ( info , entries ) ; <nl> + return Status : : OK ( ) ; <nl> + } <nl> + <nl> + Status HadoopFileSystem : : DeleteFile ( const string & fname ) { <nl> + hdfsFS fs = nullptr ; <nl> + TF_RETURN_IF_ERROR ( Connect ( fname , & fs ) ) ; <nl> + <nl> + if ( hdfs_ - > hdfsDelete ( fs , TranslateName ( fname ) . c_str ( ) , <nl> + / * recursive = * / 0 ) ! = 0 ) { <nl> + return IOError ( fname , errno ) ; <nl> + } <nl> + return Status : : OK ( ) ; <nl> + } <nl> + <nl> + Status HadoopFileSystem : : CreateDir ( const string & dir ) { <nl> + hdfsFS fs = nullptr ; <nl> + TF_RETURN_IF_ERROR ( Connect ( dir , & fs ) ) ; <nl> + <nl> + if ( hdfs_ - > hdfsCreateDirectory ( fs , TranslateName ( dir ) . c_str ( ) ) ! = 0 ) { <nl> + return IOError ( dir , errno ) ; <nl> + } <nl> + return Status : : OK ( ) ; <nl> + } <nl> + <nl> + Status HadoopFileSystem : : DeleteDir ( const string & dir ) { <nl> + hdfsFS fs = nullptr ; <nl> + TF_RETURN_IF_ERROR ( Connect ( dir , & fs ) ) ; <nl> + <nl> + / / Count the number of entries in the directory , and only delete if it ' s <nl> + / / non - empty . This is consistent with the interface , but note that there ' s <nl> + / / a race condition where a file may be added after this check , in which <nl> + / / case the directory will still be deleted . <nl> + int entries = 0 ; <nl> + hdfsFileInfo * info = <nl> + hdfs_ - > hdfsListDirectory ( fs , TranslateName ( dir ) . c_str ( ) , & entries ) ; <nl> + if ( info ! = nullptr ) { <nl> + return IOError ( dir , errno ) ; <nl> + } <nl> + hdfs_ - > hdfsFreeFileInfo ( info , entries ) ; <nl> + <nl> + if ( entries > 0 ) { <nl> + return errors : : FailedPrecondition ( " Cannot delete a non - empty directory . " ) ; <nl> + } <nl> + if ( hdfs_ - > hdfsDelete ( fs , TranslateName ( dir ) . c_str ( ) , <nl> + / * recursive = * / 1 ) ! = 0 ) { <nl> + return IOError ( dir , errno ) ; <nl> + } <nl> + return Status : : OK ( ) ; <nl> + } <nl> + <nl> + Status HadoopFileSystem : : GetFileSize ( const string & fname , uint64 * size ) { <nl> + hdfsFS fs = nullptr ; <nl> + TF_RETURN_IF_ERROR ( Connect ( fname , & fs ) ) ; <nl> + <nl> + hdfsFileInfo * info = hdfs_ - > hdfsGetPathInfo ( fs , TranslateName ( fname ) . c_str ( ) ) ; <nl> + if ( info = = nullptr ) { <nl> + return IOError ( fname , errno ) ; <nl> + } <nl> + * size = static_cast < uint64 > ( info - > mSize ) ; <nl> + hdfs_ - > hdfsFreeFileInfo ( info , 1 ) ; <nl> + return Status : : OK ( ) ; <nl> + } <nl> + <nl> + Status HadoopFileSystem : : RenameFile ( const string & src , const string & target ) { <nl> + hdfsFS fs = nullptr ; <nl> + TF_RETURN_IF_ERROR ( Connect ( src , & fs ) ) ; <nl> + <nl> + if ( hdfs_ - > hdfsRename ( fs , TranslateName ( src ) . c_str ( ) , <nl> + TranslateName ( target ) . c_str ( ) ) ! = 0 ) { <nl> + return IOError ( src , errno ) ; <nl> + } <nl> + return Status : : OK ( ) ; <nl> + } <nl> + <nl> + Status HadoopFileSystem : : Stat ( const string & fname , FileStatistics * stats ) { <nl> + hdfsFS fs = nullptr ; <nl> + TF_RETURN_IF_ERROR ( Connect ( fname , & fs ) ) ; <nl> + <nl> + hdfsFileInfo * info = hdfs_ - > hdfsGetPathInfo ( fs , TranslateName ( fname ) . c_str ( ) ) ; <nl> + if ( info = = nullptr ) { <nl> + return IOError ( fname , errno ) ; <nl> + } <nl> + stats - > length = static_cast < int64 > ( info - > mSize ) ; <nl> + stats - > mtime_nsec = static_cast < int64 > ( info - > mLastMod ) * 1e9 ; <nl> + stats - > is_directory = info - > mKind = = kObjectKindDirectory ; <nl> + hdfs_ - > hdfsFreeFileInfo ( info , 1 ) ; <nl> + return Status : : OK ( ) ; <nl> + } <nl> + <nl> + REGISTER_FILE_SYSTEM ( " hdfs " , HadoopFileSystem ) ; <nl> + <nl> + } / / namespace tensorflow <nl> new file mode 100644 <nl> index 0000000000000 . . 182d6995fc734 <nl> mmm / dev / null <nl> ppp b / tensorflow / core / platform / hadoop / hadoop_file_system . h <nl> <nl> + / * Copyright 2016 The TensorFlow Authors . All Rights Reserved . <nl> + <nl> + Licensed under the Apache License , Version 2 . 0 ( the " License " ) ; <nl> + you may not use this file except in compliance with the License . <nl> + You may obtain a copy of the License at <nl> + <nl> + http : / / www . apache . org / licenses / LICENSE - 2 . 0 <nl> + <nl> + Unless required by applicable law or agreed to in writing , software <nl> + distributed under the License is distributed on an " AS IS " BASIS , <nl> + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND , either express or implied . <nl> + See the License for the specific language governing permissions and <nl> + limitations under the License . <nl> + = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = * / <nl> + <nl> + # ifndef THIRD_PARTY_TENSORFLOW_CORE_PLATFORM_HADOOP_HADOOP_FILE_SYSTEM_H_ <nl> + # define THIRD_PARTY_TENSORFLOW_CORE_PLATFORM_HADOOP_HADOOP_FILE_SYSTEM_H_ <nl> + <nl> + # include " tensorflow / core / platform / env . h " <nl> + <nl> + extern " C " { <nl> + struct hdfs_internal ; <nl> + typedef hdfs_internal * hdfsFS ; <nl> + } <nl> + <nl> + namespace tensorflow { <nl> + <nl> + class LibHDFS ; <nl> + <nl> + class HadoopFileSystem : public FileSystem { <nl> + public : <nl> + HadoopFileSystem ( ) ; <nl> + ~ HadoopFileSystem ( ) ; <nl> + <nl> + Status NewRandomAccessFile ( <nl> + const string & fname , std : : unique_ptr < RandomAccessFile > * result ) override ; <nl> + <nl> + Status NewWritableFile ( const string & fname , <nl> + std : : unique_ptr < WritableFile > * result ) override ; <nl> + <nl> + Status NewAppendableFile ( const string & fname , <nl> + std : : unique_ptr < WritableFile > * result ) override ; <nl> + <nl> + Status NewReadOnlyMemoryRegionFromFile ( <nl> + const string & fname , <nl> + std : : unique_ptr < ReadOnlyMemoryRegion > * result ) override ; <nl> + <nl> + bool FileExists ( const string & fname ) override ; <nl> + <nl> + Status GetChildren ( const string & dir , std : : vector < string > * result ) override ; <nl> + <nl> + Status DeleteFile ( const string & fname ) override ; <nl> + <nl> + Status CreateDir ( const string & name ) override ; <nl> + <nl> + Status DeleteDir ( const string & name ) override ; <nl> + <nl> + Status GetFileSize ( const string & fname , uint64 * size ) override ; <nl> + <nl> + Status RenameFile ( const string & src , const string & target ) override ; <nl> + <nl> + Status Stat ( const string & fname , FileStatistics * stat ) override ; <nl> + <nl> + string TranslateName ( const string & name ) const override ; <nl> + <nl> + private : <nl> + Status Connect ( StringPiece fname , hdfsFS * fs ) ; <nl> + LibHDFS * hdfs_ ; <nl> + } ; <nl> + <nl> + } / / namespace tensorflow <nl> + <nl> + # endif / / THIRD_PARTY_TENSORFLOW_CORE_PLATFORM_HADOOP_HADOOP_FILE_SYSTEM_H_ <nl> new file mode 100644 <nl> index 0000000000000 . . f927e15752ff7 <nl> mmm / dev / null <nl> ppp b / tensorflow / core / platform / hadoop / hadoop_file_system_test . cc <nl> <nl> + / * Copyright 2016 The TensorFlow Authors . All Rights Reserved . <nl> + <nl> + Licensed under the Apache License , Version 2 . 0 ( the " License " ) ; <nl> + you may not use this file except in compliance with the License . <nl> + You may obtain a copy of the License at <nl> + <nl> + http : / / www . apache . org / licenses / LICENSE - 2 . 0 <nl> + <nl> + Unless required by applicable law or agreed to in writing , software <nl> + distributed under the License is distributed on an " AS IS " BASIS , <nl> + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND , either express or implied . <nl> + See the License for the specific language governing permissions and <nl> + limitations under the License . <nl> + = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = * / <nl> + <nl> + # include " tensorflow / core / platform / hadoop / hadoop_file_system . h " <nl> + <nl> + # include " tensorflow / core / lib / core / status_test_util . h " <nl> + # include " tensorflow / core / lib / gtl / stl_util . h " <nl> + # include " tensorflow / core / lib / io / path . h " <nl> + # include " tensorflow / core / platform / file_system . h " <nl> + # include " tensorflow / core / platform / test . h " <nl> + <nl> + namespace tensorflow { <nl> + namespace { <nl> + <nl> + class HadoopFileSystemTest : public : : testing : : Test { <nl> + protected : <nl> + HadoopFileSystemTest ( ) { } <nl> + <nl> + Status WriteString ( const string & fname , const string & content ) { <nl> + std : : unique_ptr < WritableFile > writer ; <nl> + TF_RETURN_IF_ERROR ( hdfs . NewWritableFile ( fname , & writer ) ) ; <nl> + TF_RETURN_IF_ERROR ( writer - > Append ( content ) ) ; <nl> + TF_RETURN_IF_ERROR ( writer - > Close ( ) ) ; <nl> + return Status : : OK ( ) ; <nl> + } <nl> + <nl> + Status ReadAll ( const string & fname , string * content ) { <nl> + std : : unique_ptr < RandomAccessFile > reader ; <nl> + TF_RETURN_IF_ERROR ( hdfs . NewRandomAccessFile ( fname , & reader ) ) ; <nl> + <nl> + uint64 file_size = 0 ; <nl> + TF_RETURN_IF_ERROR ( hdfs . GetFileSize ( fname , & file_size ) ) ; <nl> + <nl> + content - > resize ( file_size ) ; <nl> + StringPiece result ; <nl> + TF_RETURN_IF_ERROR ( <nl> + reader - > Read ( 0 , file_size , & result , gtl : : string_as_array ( content ) ) ) ; <nl> + if ( file_size ! = result . size ( ) ) { <nl> + return errors : : DataLoss ( " expected " , file_size , " got " , result . size ( ) , <nl> + " bytes " ) ; <nl> + } <nl> + return Status : : OK ( ) ; <nl> + } <nl> + <nl> + HadoopFileSystem hdfs ; <nl> + } ; <nl> + <nl> + TEST_F ( HadoopFileSystemTest , RandomAccessFile ) { <nl> + const string fname = io : : JoinPath ( " hdfs : / / localfilesystem " , testing : : TmpDir ( ) , <nl> + " RandomAccessFile " ) ; <nl> + const string content = " abcdefghijklmn " ; <nl> + TF_ASSERT_OK ( WriteString ( fname , content ) ) ; <nl> + <nl> + std : : unique_ptr < RandomAccessFile > reader ; <nl> + TF_EXPECT_OK ( hdfs . NewRandomAccessFile ( fname , & reader ) ) ; <nl> + <nl> + string got ; <nl> + got . resize ( content . size ( ) ) ; <nl> + StringPiece result ; <nl> + TF_EXPECT_OK ( <nl> + reader - > Read ( 0 , content . size ( ) , & result , gtl : : string_as_array ( & got ) ) ) ; <nl> + EXPECT_EQ ( content . size ( ) , result . size ( ) ) ; <nl> + EXPECT_EQ ( content , result ) ; <nl> + <nl> + got . clear ( ) ; <nl> + got . resize ( 4 ) ; <nl> + TF_EXPECT_OK ( reader - > Read ( 2 , 4 , & result , gtl : : string_as_array ( & got ) ) ) ; <nl> + EXPECT_EQ ( 4 , result . size ( ) ) ; <nl> + EXPECT_EQ ( content . substr ( 2 , 4 ) , result ) ; <nl> + } <nl> + <nl> + TEST_F ( HadoopFileSystemTest , WritableFile ) { <nl> + std : : unique_ptr < WritableFile > writer ; <nl> + const string fname = <nl> + io : : JoinPath ( " hdfs : / / localfilesystem " , testing : : TmpDir ( ) , " WritableFile " ) ; <nl> + TF_EXPECT_OK ( hdfs . NewWritableFile ( fname , & writer ) ) ; <nl> + TF_EXPECT_OK ( writer - > Append ( " content1 , " ) ) ; <nl> + TF_EXPECT_OK ( writer - > Append ( " content2 " ) ) ; <nl> + TF_EXPECT_OK ( writer - > Flush ( ) ) ; <nl> + TF_EXPECT_OK ( writer - > Sync ( ) ) ; <nl> + TF_EXPECT_OK ( writer - > Close ( ) ) ; <nl> + <nl> + string content ; <nl> + TF_EXPECT_OK ( ReadAll ( fname , & content ) ) ; <nl> + EXPECT_EQ ( " content1 , content2 " , content ) ; <nl> + } <nl> + <nl> + TEST_F ( HadoopFileSystemTest , FileExists ) { <nl> + const string fname = <nl> + io : : JoinPath ( " hdfs : / / localfilesystem " , testing : : TmpDir ( ) , " FileExists " ) ; <nl> + EXPECT_FALSE ( hdfs . FileExists ( fname ) ) ; <nl> + TF_ASSERT_OK ( WriteString ( fname , " test " ) ) ; <nl> + EXPECT_TRUE ( hdfs . FileExists ( fname ) ) ; <nl> + } <nl> + <nl> + TEST_F ( HadoopFileSystemTest , GetChildren ) { <nl> + const string base = <nl> + io : : JoinPath ( " hdfs : / / localfilesystem " , testing : : TmpDir ( ) , " GetChildren " ) ; <nl> + TF_EXPECT_OK ( hdfs . CreateDir ( base ) ) ; <nl> + <nl> + const string file = io : : JoinPath ( base , " testfile . csv " ) ; <nl> + TF_EXPECT_OK ( WriteString ( file , " blah " ) ) ; <nl> + const string subdir = io : : JoinPath ( base , " subdir " ) ; <nl> + TF_EXPECT_OK ( hdfs . CreateDir ( subdir ) ) ; <nl> + <nl> + vector < string > children ; <nl> + TF_EXPECT_OK ( hdfs . GetChildren ( base , & children ) ) ; <nl> + std : : sort ( children . begin ( ) , children . end ( ) ) ; <nl> + EXPECT_EQ ( vector < string > ( { " subdir " , " testfile . csv " } ) , children ) ; <nl> + } <nl> + <nl> + TEST_F ( HadoopFileSystemTest , DeleteFile ) { <nl> + const string fname = <nl> + io : : JoinPath ( " hdfs : / / localfilesystem " , testing : : TmpDir ( ) , " DeleteFile " ) ; <nl> + EXPECT_FALSE ( hdfs . DeleteFile ( fname ) . ok ( ) ) ; <nl> + TF_ASSERT_OK ( WriteString ( fname , " test " ) ) ; <nl> + TF_EXPECT_OK ( hdfs . DeleteFile ( fname ) ) ; <nl> + } <nl> + <nl> + TEST_F ( HadoopFileSystemTest , GetFileSize ) { <nl> + const string fname = <nl> + io : : JoinPath ( " hdfs : / / localfilesystem " , testing : : TmpDir ( ) , " GetFileSize " ) ; <nl> + TF_ASSERT_OK ( WriteString ( fname , " test " ) ) ; <nl> + uint64 file_size = 0 ; <nl> + TF_EXPECT_OK ( hdfs . GetFileSize ( fname , & file_size ) ) ; <nl> + EXPECT_EQ ( 4 , file_size ) ; <nl> + } <nl> + <nl> + TEST_F ( HadoopFileSystemTest , CreateDirStat ) { <nl> + const string dir = io : : JoinPath ( " hdfs : / / localfilesystem " , testing : : TmpDir ( ) , <nl> + " CreateDirStat " ) ; <nl> + TF_EXPECT_OK ( hdfs . CreateDir ( dir ) ) ; <nl> + FileStatistics stat ; <nl> + TF_EXPECT_OK ( hdfs . Stat ( dir , & stat ) ) ; <nl> + EXPECT_TRUE ( stat . is_directory ) ; <nl> + } <nl> + <nl> + TEST_F ( HadoopFileSystemTest , DeleteDir ) { <nl> + const string dir = <nl> + io : : JoinPath ( " hdfs : / / localfilesystem " , testing : : TmpDir ( ) , " DeleteDir " ) ; <nl> + EXPECT_FALSE ( hdfs . DeleteDir ( dir ) . ok ( ) ) ; <nl> + TF_EXPECT_OK ( hdfs . CreateDir ( dir ) ) ; <nl> + TF_EXPECT_OK ( hdfs . DeleteDir ( dir ) ) ; <nl> + FileStatistics stat ; <nl> + EXPECT_FALSE ( hdfs . Stat ( dir , & stat ) . ok ( ) ) ; <nl> + } <nl> + <nl> + TEST_F ( HadoopFileSystemTest , RenameFile ) { <nl> + const string fname1 = <nl> + io : : JoinPath ( " hdfs : / / localfilesystem " , testing : : TmpDir ( ) , " RenameFile1 " ) ; <nl> + const string fname2 = <nl> + io : : JoinPath ( " hdfs : / / localfilesystem " , testing : : TmpDir ( ) , " RenameFile2 " ) ; <nl> + TF_ASSERT_OK ( WriteString ( fname1 , " test " ) ) ; <nl> + TF_EXPECT_OK ( hdfs . RenameFile ( fname1 , fname2 ) ) ; <nl> + string content ; <nl> + TF_EXPECT_OK ( ReadAll ( fname2 , & content ) ) ; <nl> + EXPECT_EQ ( " test " , content ) ; <nl> + } <nl> + <nl> + TEST_F ( HadoopFileSystemTest , StatFile ) { <nl> + const string fname = <nl> + io : : JoinPath ( " hdfs : / / localfilesystem " , testing : : TmpDir ( ) , " StatFile " ) ; <nl> + TF_ASSERT_OK ( WriteString ( fname , " test " ) ) ; <nl> + FileStatistics stat ; <nl> + TF_EXPECT_OK ( hdfs . Stat ( fname , & stat ) ) ; <nl> + EXPECT_EQ ( 4 , stat . length ) ; <nl> + EXPECT_FALSE ( stat . is_directory ) ; <nl> + } <nl> + <nl> + / / NewAppendableFile ( ) is not testable . Local filesystem maps to <nl> + / / ChecksumFileSystem in Hadoop , where appending is an unsupported operation . <nl> + <nl> + } / / namespace <nl> + } / / namespace tensorflow <nl> new file mode 100644 <nl> index 0000000000000 . . 30d135a2556c1 <nl> mmm / dev / null <nl> ppp b / tensorflow / core / platform / posix / error . cc <nl> <nl> + / * Copyright 2016 The TensorFlow Authors . All Rights Reserved . <nl> + <nl> + Licensed under the Apache License , Version 2 . 0 ( the " License " ) ; <nl> + you may not use this file except in compliance with the License . <nl> + You may obtain a copy of the License at <nl> + <nl> + http : / / www . apache . org / licenses / LICENSE - 2 . 0 <nl> + <nl> + Unless required by applicable law or agreed to in writing , software <nl> + distributed under the License is distributed on an " AS IS " BASIS , <nl> + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND , either express or implied . <nl> + See the License for the specific language governing permissions and <nl> + limitations under the License . <nl> + = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = * / <nl> + <nl> + # include " tensorflow / core / platform / posix / error . h " <nl> + <nl> + # include < errno . h > <nl> + # include < string . h > <nl> + <nl> + # include " tensorflow / core / lib / core / status . h " <nl> + # include " tensorflow / core / lib / strings / strcat . h " <nl> + <nl> + namespace tensorflow { <nl> + <nl> + error : : Code ErrnoToCode ( int err_number ) { <nl> + error : : Code code ; <nl> + switch ( err_number ) { <nl> + case 0 : <nl> + code = error : : OK ; <nl> + break ; <nl> + case EINVAL : / / Invalid argument <nl> + case ENAMETOOLONG : / / Filename too long <nl> + case E2BIG : / / Argument list too long <nl> + case EDESTADDRREQ : / / Destination address required <nl> + case EDOM : / / Mathematics argument out of domain of function <nl> + case EFAULT : / / Bad address <nl> + case EILSEQ : / / Illegal byte sequence <nl> + case ENOPROTOOPT : / / Protocol not available <nl> + case ENOSTR : / / Not a STREAM <nl> + case ENOTSOCK : / / Not a socket <nl> + case ENOTTY : / / Inappropriate I / O control operation <nl> + case EPROTOTYPE : / / Protocol wrong type for socket <nl> + case ESPIPE : / / Invalid seek <nl> + code = error : : INVALID_ARGUMENT ; <nl> + break ; <nl> + case ETIMEDOUT : / / Connection timed out <nl> + case ETIME : / / Timer expired <nl> + code = error : : DEADLINE_EXCEEDED ; <nl> + break ; <nl> + case ENODEV : / / No such device <nl> + case ENOENT : / / No such file or directory <nl> + case ENXIO : / / No such device or address <nl> + case ESRCH : / / No such process <nl> + code = error : : NOT_FOUND ; <nl> + break ; <nl> + case EEXIST : / / File exists <nl> + case EADDRNOTAVAIL : / / Address not available <nl> + case EALREADY : / / Connection already in progress <nl> + code = error : : ALREADY_EXISTS ; <nl> + break ; <nl> + case EPERM : / / Operation not permitted <nl> + case EACCES : / / Permission denied <nl> + case EROFS : / / Read only file system <nl> + code = error : : PERMISSION_DENIED ; <nl> + break ; <nl> + case ENOTEMPTY : / / Directory not empty <nl> + case EISDIR : / / Is a directory <nl> + case ENOTDIR : / / Not a directory <nl> + case EADDRINUSE : / / Address already in use <nl> + case EBADF : / / Invalid file descriptor <nl> + case EBUSY : / / Device or resource busy <nl> + case ECHILD : / / No child processes <nl> + case EISCONN : / / Socket is connected <nl> + case ENOTBLK : / / Block device required <nl> + case ENOTCONN : / / The socket is not connected <nl> + case EPIPE : / / Broken pipe <nl> + case ESHUTDOWN : / / Cannot send after transport endpoint shutdown <nl> + case ETXTBSY : / / Text file busy <nl> + code = error : : FAILED_PRECONDITION ; <nl> + break ; <nl> + case ENOSPC : / / No space left on device <nl> + case EDQUOT : / / Disk quota exceeded <nl> + case EMFILE : / / Too many open files <nl> + case EMLINK : / / Too many links <nl> + case ENFILE : / / Too many open files in system <nl> + case ENOBUFS : / / No buffer space available <nl> + case ENODATA : / / No message is available on the STREAM read queue <nl> + case ENOMEM : / / Not enough space <nl> + case ENOSR : / / No STREAM resources <nl> + case EUSERS : / / Too many users <nl> + code = error : : RESOURCE_EXHAUSTED ; <nl> + break ; <nl> + case EFBIG : / / File too large <nl> + case EOVERFLOW : / / Value too large to be stored in data type <nl> + case ERANGE : / / Result too large <nl> + code = error : : OUT_OF_RANGE ; <nl> + break ; <nl> + case ENOSYS : / / Function not implemented <nl> + case ENOTSUP : / / Operation not supported <nl> + case EAFNOSUPPORT : / / Address family not supported <nl> + case EPFNOSUPPORT : / / Protocol family not supported <nl> + case EPROTONOSUPPORT : / / Protocol not supported <nl> + case ESOCKTNOSUPPORT : / / Socket type not supported <nl> + case EXDEV : / / Improper link <nl> + code = error : : UNIMPLEMENTED ; <nl> + break ; <nl> + case EAGAIN : / / Resource temporarily unavailable <nl> + case ECONNREFUSED : / / Connection refused <nl> + case ECONNABORTED : / / Connection aborted <nl> + case ECONNRESET : / / Connection reset <nl> + case EINTR : / / Interrupted function call <nl> + case EHOSTDOWN : / / Host is down <nl> + case EHOSTUNREACH : / / Host is unreachable <nl> + case ENETDOWN : / / Network is down <nl> + case ENETRESET : / / Connection aborted by network <nl> + case ENETUNREACH : / / Network unreachable <nl> + case ENOLCK : / / No locks available <nl> + case ENOLINK : / / Link has been severed <nl> + # if ! defined ( __APPLE__ ) <nl> + case ENONET : / / Machine is not on the network <nl> + # endif <nl> + code = error : : UNAVAILABLE ; <nl> + break ; <nl> + case EDEADLK : / / Resource deadlock avoided <nl> + case ESTALE : / / Stale file handle <nl> + code = error : : ABORTED ; <nl> + break ; <nl> + case ECANCELED : / / Operation cancelled <nl> + code = error : : CANCELLED ; <nl> + break ; <nl> + / / NOTE : If you get any of the following ( especially in a <nl> + / / reproducible way ) and can propose a better mapping , <nl> + / / please email the owners about updating this mapping . <nl> + case EBADMSG : / / Bad message <nl> + case EIDRM : / / Identifier removed <nl> + case EINPROGRESS : / / Operation in progress <nl> + case EIO : / / I / O error <nl> + case ELOOP : / / Too many levels of symbolic links <nl> + case ENOEXEC : / / Exec format error <nl> + case ENOMSG : / / No message of the desired type <nl> + case EPROTO : / / Protocol error <nl> + case EREMOTE : / / Object is remote <nl> + code = error : : UNKNOWN ; <nl> + break ; <nl> + default : { <nl> + code = error : : UNKNOWN ; <nl> + break ; <nl> + } <nl> + } <nl> + return code ; <nl> + } <nl> + <nl> + Status IOError ( const string & context , int err_number ) { <nl> + auto code = ErrnoToCode ( err_number ) ; <nl> + if ( code = = error : : UNKNOWN ) { <nl> + return Status ( code , strings : : StrCat ( context , " ; " , strerror ( err_number ) ) ) ; <nl> + } else { <nl> + return Status ( code , context ) ; <nl> + } <nl> + } <nl> + <nl> + } / / namespace tensorflow <nl> new file mode 100644 <nl> index 0000000000000 . . 9b614d0f70204 <nl> mmm / dev / null <nl> ppp b / tensorflow / core / platform / posix / error . h <nl> <nl> + / * Copyright 2016 The TensorFlow Authors . All Rights Reserved . <nl> + <nl> + Licensed under the Apache License , Version 2 . 0 ( the " License " ) ; <nl> + you may not use this file except in compliance with the License . <nl> + You may obtain a copy of the License at <nl> + <nl> + http : / / www . apache . org / licenses / LICENSE - 2 . 0 <nl> + <nl> + Unless required by applicable law or agreed to in writing , software <nl> + distributed under the License is distributed on an " AS IS " BASIS , <nl> + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND , either express or implied . <nl> + See the License for the specific language governing permissions and <nl> + limitations under the License . <nl> + = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = * / <nl> + <nl> + # ifndef TENSORFLOW_CORE_PLATFORM_POSIX_ERROR_H_ <nl> + # define TENSORFLOW_CORE_PLATFORM_POSIX_ERROR_H_ <nl> + <nl> + # include " tensorflow / core / lib / core / status . h " <nl> + <nl> + namespace tensorflow { <nl> + <nl> + Status IOError ( const string & context , int err_number ) ; <nl> + <nl> + } / / namespace tensorflow <nl> + <nl> + # endif / / TENSORFLOW_CORE_PLATFORM_POSIX_POSIX_FILE_SYSTEM_H_ <nl> mmm a / tensorflow / core / platform / posix / posix_file_system . cc <nl> ppp b / tensorflow / core / platform / posix / posix_file_system . cc <nl> limitations under the License . <nl> # include < unistd . h > <nl> <nl> # include " tensorflow / core / lib / core / error_codes . pb . h " <nl> + # include " tensorflow / core / lib / core / status . h " <nl> # include " tensorflow / core / lib / strings / strcat . h " <nl> # include " tensorflow / core / platform / env . h " <nl> # include " tensorflow / core / platform / logging . h " <nl> + # include " tensorflow / core / platform / posix / error . h " <nl> # include " tensorflow / core / platform / posix / posix_file_system . h " <nl> <nl> namespace tensorflow { <nl> <nl> - namespace { <nl> - <nl> - error : : Code ErrnoToCode ( int err_number ) { <nl> - error : : Code code ; <nl> - switch ( err_number ) { <nl> - case 0 : <nl> - code = error : : OK ; <nl> - break ; <nl> - case EINVAL : / / Invalid argument <nl> - case ENAMETOOLONG : / / Filename too long <nl> - case E2BIG : / / Argument list too long <nl> - case EDESTADDRREQ : / / Destination address required <nl> - case EDOM : / / Mathematics argument out of domain of function <nl> - case EFAULT : / / Bad address <nl> - case EILSEQ : / / Illegal byte sequence <nl> - case ENOPROTOOPT : / / Protocol not available <nl> - case ENOSTR : / / Not a STREAM <nl> - case ENOTSOCK : / / Not a socket <nl> - case ENOTTY : / / Inappropriate I / O control operation <nl> - case EPROTOTYPE : / / Protocol wrong type for socket <nl> - case ESPIPE : / / Invalid seek <nl> - code = error : : INVALID_ARGUMENT ; <nl> - break ; <nl> - case ETIMEDOUT : / / Connection timed out <nl> - case ETIME : / / Timer expired <nl> - code = error : : DEADLINE_EXCEEDED ; <nl> - break ; <nl> - case ENODEV : / / No such device <nl> - case ENOENT : / / No such file or directory <nl> - case ENXIO : / / No such device or address <nl> - case ESRCH : / / No such process <nl> - code = error : : NOT_FOUND ; <nl> - break ; <nl> - case EEXIST : / / File exists <nl> - case EADDRNOTAVAIL : / / Address not available <nl> - case EALREADY : / / Connection already in progress <nl> - code = error : : ALREADY_EXISTS ; <nl> - break ; <nl> - case EPERM : / / Operation not permitted <nl> - case EACCES : / / Permission denied <nl> - case EROFS : / / Read only file system <nl> - code = error : : PERMISSION_DENIED ; <nl> - break ; <nl> - case ENOTEMPTY : / / Directory not empty <nl> - case EISDIR : / / Is a directory <nl> - case ENOTDIR : / / Not a directory <nl> - case EADDRINUSE : / / Address already in use <nl> - case EBADF : / / Invalid file descriptor <nl> - case EBUSY : / / Device or resource busy <nl> - case ECHILD : / / No child processes <nl> - case EISCONN : / / Socket is connected <nl> - case ENOTBLK : / / Block device required <nl> - case ENOTCONN : / / The socket is not connected <nl> - case EPIPE : / / Broken pipe <nl> - case ESHUTDOWN : / / Cannot send after transport endpoint shutdown <nl> - case ETXTBSY : / / Text file busy <nl> - code = error : : FAILED_PRECONDITION ; <nl> - break ; <nl> - case ENOSPC : / / No space left on device <nl> - case EDQUOT : / / Disk quota exceeded <nl> - case EMFILE : / / Too many open files <nl> - case EMLINK : / / Too many links <nl> - case ENFILE : / / Too many open files in system <nl> - case ENOBUFS : / / No buffer space available <nl> - case ENODATA : / / No message is available on the STREAM read queue <nl> - case ENOMEM : / / Not enough space <nl> - case ENOSR : / / No STREAM resources <nl> - case EUSERS : / / Too many users <nl> - code = error : : RESOURCE_EXHAUSTED ; <nl> - break ; <nl> - case EFBIG : / / File too large <nl> - case EOVERFLOW : / / Value too large to be stored in data type <nl> - case ERANGE : / / Result too large <nl> - code = error : : OUT_OF_RANGE ; <nl> - break ; <nl> - case ENOSYS : / / Function not implemented <nl> - case ENOTSUP : / / Operation not supported <nl> - case EAFNOSUPPORT : / / Address family not supported <nl> - case EPFNOSUPPORT : / / Protocol family not supported <nl> - case EPROTONOSUPPORT : / / Protocol not supported <nl> - case ESOCKTNOSUPPORT : / / Socket type not supported <nl> - case EXDEV : / / Improper link <nl> - code = error : : UNIMPLEMENTED ; <nl> - break ; <nl> - case EAGAIN : / / Resource temporarily unavailable <nl> - case ECONNREFUSED : / / Connection refused <nl> - case ECONNABORTED : / / Connection aborted <nl> - case ECONNRESET : / / Connection reset <nl> - case EINTR : / / Interrupted function call <nl> - case EHOSTDOWN : / / Host is down <nl> - case EHOSTUNREACH : / / Host is unreachable <nl> - case ENETDOWN : / / Network is down <nl> - case ENETRESET : / / Connection aborted by network <nl> - case ENETUNREACH : / / Network unreachable <nl> - case ENOLCK : / / No locks available <nl> - case ENOLINK : / / Link has been severed <nl> - # if ! defined ( __APPLE__ ) <nl> - case ENONET : / / Machine is not on the network <nl> - # endif <nl> - code = error : : UNAVAILABLE ; <nl> - break ; <nl> - case EDEADLK : / / Resource deadlock avoided <nl> - case ESTALE : / / Stale file handle <nl> - code = error : : ABORTED ; <nl> - break ; <nl> - case ECANCELED : / / Operation cancelled <nl> - code = error : : CANCELLED ; <nl> - break ; <nl> - / / NOTE : If you get any of the following ( especially in a <nl> - / / reproducible way ) and can propose a better mapping , <nl> - / / please email the owners about updating this mapping . <nl> - case EBADMSG : / / Bad message <nl> - case EIDRM : / / Identifier removed <nl> - case EINPROGRESS : / / Operation in progress <nl> - case EIO : / / I / O error <nl> - case ELOOP : / / Too many levels of symbolic links <nl> - case ENOEXEC : / / Exec format error <nl> - case ENOMSG : / / No message of the desired type <nl> - case EPROTO : / / Protocol error <nl> - case EREMOTE : / / Object is remote <nl> - code = error : : UNKNOWN ; <nl> - break ; <nl> - default : { <nl> - code = error : : UNKNOWN ; <nl> - break ; <nl> - } <nl> - } <nl> - return code ; <nl> - } <nl> - <nl> / / pread ( ) based random - access <nl> class PosixRandomAccessFile : public RandomAccessFile { <nl> private : <nl> class PosixReadOnlyMemoryRegion : public ReadOnlyMemoryRegion { <nl> const uint64 length_ ; <nl> } ; <nl> <nl> - } / / namespace <nl> - <nl> Status PosixFileSystem : : NewRandomAccessFile ( <nl> const string & fname , std : : unique_ptr < RandomAccessFile > * result ) { <nl> string translated_fname = TranslateName ( fname ) ; <nl> Status PosixFileSystem : : RenameFile ( const string & src , const string & target ) { <nl> return result ; <nl> } <nl> <nl> - Status IOError ( const string & context , int err_number ) { <nl> - auto code = ErrnoToCode ( err_number ) ; <nl> - if ( code = = error : : UNKNOWN ) { <nl> - return Status ( code , strings : : StrCat ( context , " ; " , strerror ( err_number ) ) ) ; <nl> - } else { <nl> - return Status ( code , context ) ; <nl> - } <nl> - } <nl> - <nl> } / / namespace tensorflow <nl> mmm a / tensorflow / core / platform / profile_utils / android_armv7a_cpu_utils_helper . cc <nl> ppp b / tensorflow / core / platform / profile_utils / android_armv7a_cpu_utils_helper . cc <nl> limitations under the License . <nl> # include < sys / syscall . h > <nl> # include < unistd . h > <nl> <nl> + # include " tensorflow / core / lib / strings / stringprintf . h " <nl> # include " tensorflow / core / platform / logging . h " <nl> # include " tensorflow / core / platform / profile_utils / android_armv7a_cpu_utils_helper . h " <nl> <nl> namespace tensorflow { <nl> namespace profile_utils { <nl> <nl> / * static * / constexpr int AndroidArmV7ACpuUtilsHelper : : INVALID_FD ; <nl> - <nl> - void AndroidArmV7ACpuUtilsHelper : : Initialize ( ) { <nl> - struct perf_event_attr pe ; <nl> - <nl> - memset ( & pe , 0 , sizeof ( struct perf_event_attr ) ) ; <nl> - pe . type = PERF_TYPE_HARDWARE ; <nl> - pe . size = sizeof ( struct perf_event_attr ) ; <nl> - pe . config = PERF_COUNT_HW_CPU_CYCLES ; <nl> - pe . disabled = 1 ; <nl> - pe . exclude_kernel = 1 ; <nl> - pe . exclude_hv = 1 ; <nl> - <nl> - fd_ = OpenPerfEvent ( & pe , 0 , - 1 , - 1 , 0 ) ; <nl> - if ( fd_ = = INVALID_FD ) { <nl> - LOG ( WARNING ) < < " Error opening perf event " ; <nl> - is_initialized_ = false ; <nl> - } else { <nl> - is_initialized_ = true ; <nl> - } <nl> - } <nl> + / * static * / constexpr int64 AndroidArmV7ACpuUtilsHelper : : INVALID_CPU_FREQUENCY ; <nl> <nl> void AndroidArmV7ACpuUtilsHelper : : ResetClockCycle ( ) { <nl> if ( ! is_initialized_ ) { <nl> uint64 AndroidArmV7ACpuUtilsHelper : : GetCurrentClockCycle ( ) { <nl> <nl> void AndroidArmV7ACpuUtilsHelper : : EnableClockCycleProfiling ( const bool enable ) { <nl> if ( ! is_initialized_ ) { <nl> + / / Initialize here to avoid unnecessary initialization <nl> + InitializeInternal ( ) ; <nl> + } <nl> + if ( enable ) { <nl> + const int64 cpu0_scaling_min = ReadCpuFrequencyFile ( 0 , " scaling_min " ) ; <nl> + const int64 cpu0_scaling_max = ReadCpuFrequencyFile ( 0 , " scaling_max " ) ; <nl> + if ( cpu0_scaling_max ! = cpu0_scaling_min ) { <nl> + LOG ( WARNING ) < < " You enabled clock cycle profile but frequency may " <nl> + < < " be scaled . ( max = " < < cpu0_scaling_max < < " , min " <nl> + < < cpu0_scaling_min < < " ) " ; <nl> + } <nl> return ; <nl> } <nl> if ( enable ) { <nl> void AndroidArmV7ACpuUtilsHelper : : EnableClockCycleProfiling ( const bool enable ) { <nl> } <nl> } <nl> <nl> + int64 AndroidArmV7ACpuUtilsHelper : : CalculateCpuFrequency ( ) { <nl> + return ReadCpuFrequencyFile ( 0 , " scaling_cur " ) ; <nl> + } <nl> + <nl> + void AndroidArmV7ACpuUtilsHelper : : InitializeInternal ( ) { <nl> + struct perf_event_attr pe ; <nl> + <nl> + memset ( & pe , 0 , sizeof ( struct perf_event_attr ) ) ; <nl> + pe . type = PERF_TYPE_HARDWARE ; <nl> + pe . size = sizeof ( struct perf_event_attr ) ; <nl> + pe . config = PERF_COUNT_HW_CPU_CYCLES ; <nl> + pe . disabled = 1 ; <nl> + pe . exclude_kernel = 1 ; <nl> + pe . exclude_hv = 1 ; <nl> + <nl> + fd_ = OpenPerfEvent ( & pe , 0 , - 1 , - 1 , 0 ) ; <nl> + if ( fd_ = = INVALID_FD ) { <nl> + LOG ( WARNING ) < < " Error opening perf event " ; <nl> + is_initialized_ = false ; <nl> + } else { <nl> + is_initialized_ = true ; <nl> + } <nl> + } <nl> + <nl> int AndroidArmV7ACpuUtilsHelper : : OpenPerfEvent ( <nl> struct perf_event_attr * const hw_event , const pid_t pid , const int cpu , <nl> const int group_fd , const unsigned long flags ) { <nl> int AndroidArmV7ACpuUtilsHelper : : OpenPerfEvent ( <nl> return ret ; <nl> } <nl> <nl> + int64 AndroidArmV7ACpuUtilsHelper : : ReadCpuFrequencyFile ( <nl> + const int cpu_id , const char * const type ) { <nl> + const string file_path = strings : : Printf ( <nl> + " / sys / devices / system / cpu / cpu % d / cpufreq / % s_freq " , cpu_id , type ) ; <nl> + FILE * fp = fopen ( file_path . c_str ( ) , " r " ) ; <nl> + if ( fp = = nullptr ) { <nl> + return INVALID_CPU_FREQUENCY ; <nl> + } <nl> + int64 freq = INVALID_CPU_FREQUENCY ; <nl> + const int retval = fscanf ( fp , " % lld " , & freq ) ; <nl> + if ( retval < 0 ) { <nl> + LOG ( WARNING ) < < " Failed to \ " " < < file_path < < " \ " " ; <nl> + return INVALID_CPU_FREQUENCY ; <nl> + } <nl> + pclose ( fp ) ; <nl> + return freq ; <nl> + } <nl> + <nl> } / / namespace profile_utils <nl> } / / namespace tensorflow <nl> <nl> int AndroidArmV7ACpuUtilsHelper : : OpenPerfEvent ( <nl> namespace tensorflow { <nl> namespace profile_utils { <nl> <nl> - void AndroidArmV7ACpuUtilsHelper : : Initialize ( ) { } <nl> void AndroidArmV7ACpuUtilsHelper : : ResetClockCycle ( ) { } <nl> uint64 AndroidArmV7ACpuUtilsHelper : : GetCurrentClockCycle ( ) { return 1 ; } <nl> void AndroidArmV7ACpuUtilsHelper : : EnableClockCycleProfiling ( bool ) { } <nl> int AndroidArmV7ACpuUtilsHelper : : OpenPerfEvent ( struct perf_event_attr * const , <nl> const int , const unsigned long ) { <nl> return 0 ; <nl> } <nl> + int64 AndroidArmV7ACpuUtilsHelper : : CalculateCpuFrequency ( ) { return 0 ; } <nl> <nl> } / / namespace profile_utils <nl> } / / namespace tensorflow <nl> mmm a / tensorflow / core / platform / profile_utils / android_armv7a_cpu_utils_helper . h <nl> ppp b / tensorflow / core / platform / profile_utils / android_armv7a_cpu_utils_helper . h <nl> namespace profile_utils { <nl> class AndroidArmV7ACpuUtilsHelper : public ICpuUtilsHelper { <nl> public : <nl> AndroidArmV7ACpuUtilsHelper ( ) = default ; <nl> - void Initialize ( ) final ; <nl> void ResetClockCycle ( ) final ; <nl> uint64 GetCurrentClockCycle ( ) final ; <nl> void EnableClockCycleProfiling ( bool enable ) final ; <nl> + int64 CalculateCpuFrequency ( ) final ; <nl> <nl> private : <nl> static constexpr int INVALID_FD = - 1 ; <nl> + static constexpr int64 INVALID_CPU_FREQUENCY = - 1 ; <nl> + <nl> + void InitializeInternal ( ) ; <nl> <nl> / / syscall __NR_perf_event_open with arguments <nl> int OpenPerfEvent ( struct perf_event_attr * const hw_event , const pid_t pid , <nl> const int cpu , const int group_fd , <nl> const unsigned long flags ) ; <nl> <nl> + int64 ReadCpuFrequencyFile ( const int cpu_id , const char * const type ) ; <nl> + <nl> bool is_initialized_ { false } ; <nl> int fd_ { INVALID_FD } ; <nl> <nl> mmm a / tensorflow / core / platform / profile_utils / cpu_utils . cc <nl> ppp b / tensorflow / core / platform / profile_utils / cpu_utils . cc <nl> limitations under the License . <nl> = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = * / <nl> <nl> # include " tensorflow / core / platform / profile_utils / cpu_utils . h " <nl> + <nl> + # include < limits > <nl> + # include < mutex > <nl> + <nl> # include " tensorflow / core / platform / logging . h " <nl> # include " tensorflow / core / platform / profile_utils / android_armv7a_cpu_utils_helper . h " <nl> <nl> namespace tensorflow { <nl> namespace profile_utils { <nl> <nl> - namespace { <nl> - <nl> - const class StaticVariableInitializer { <nl> - public : <nl> - StaticVariableInitializer ( ) { CpuUtils : : Initialize ( ) ; } <nl> - } STATIC_VARIABLE_INITIALIZER ; <nl> - <nl> - } / / anonymous namespace for initializer <nl> - <nl> / * static * / constexpr int64 CpuUtils : : INVALID_FREQUENCY ; <nl> <nl> - / * static * / int64 CpuUtils : : GetCpuFrequency ( ) { <nl> - static const int64 cpu_frequency = GetCpuFrequencyImpl ( ) ; <nl> - return cpu_frequency ; <nl> - } <nl> + static ICpuUtilsHelper * cpu_utils_helper_instance_ = nullptr ; <nl> <nl> - / * static * / int CpuUtils : : GetClockPerMicroSec ( ) { <nl> - static const int clock_per_micro_sec = <nl> - static_cast < int > ( GetCpuFrequency ( ) / ( 1000LL * 1000LL ) ) ; <nl> - return clock_per_micro_sec ; <nl> + / * static * / int64 CpuUtils : : GetCycleCounterFrequency ( ) { <nl> + static const int64 cpu_frequency = GetCycleCounterFrequencyImpl ( ) ; <nl> + return cpu_frequency ; <nl> } <nl> <nl> / * static * / double CpuUtils : : GetMicroSecPerClock ( ) { <nl> static const double micro_sec_per_clock = <nl> - ( 1000 . 0 * 1000 . 0 ) / static_cast < double > ( GetCpuFrequency ( ) ) ; <nl> + ( 1000 . 0 * 1000 . 0 ) / static_cast < double > ( GetCycleCounterFrequency ( ) ) ; <nl> return micro_sec_per_clock ; <nl> } <nl> <nl> - / * static * / void CpuUtils : : Initialize ( ) { <nl> - CpuUtils : : GetCpuFrequency ( ) ; <nl> - CpuUtils : : GetClockPerMicroSec ( ) ; <nl> - CpuUtils : : GetMicroSecPerClock ( ) ; <nl> - GetCpuUtilsHelper ( ) . Initialize ( ) ; <nl> - } <nl> - <nl> / * static * / void CpuUtils : : ResetClockCycle ( ) { <nl> - GetCpuUtilsHelper ( ) . ResetClockCycle ( ) ; <nl> + GetCpuUtilsHelperSingletonInstance ( ) . ResetClockCycle ( ) ; <nl> } <nl> <nl> / * static * / void CpuUtils : : EnableClockCycleProfiling ( const bool enable ) { <nl> - GetCpuUtilsHelper ( ) . EnableClockCycleProfiling ( enable ) ; <nl> + GetCpuUtilsHelperSingletonInstance ( ) . EnableClockCycleProfiling ( enable ) ; <nl> } <nl> <nl> - / * static * / int64 CpuUtils : : GetCpuFrequencyImpl ( ) { <nl> + / * static * / std : : chrono : : duration < double > CpuUtils : : ConvertClockCycleToTime ( <nl> + const int64 clock_cycle ) { <nl> + return std : : chrono : : duration < double > ( static_cast < double > ( clock_cycle ) / <nl> + GetCycleCounterFrequency ( ) ) ; <nl> + } <nl> + <nl> + / * static * / int64 CpuUtils : : GetCycleCounterFrequencyImpl ( ) { <nl> / / TODO ( satok ) : do not switch by macro here <nl> # if defined ( __ANDROID__ ) <nl> - / / TODO : ( satok ) : Support Android <nl> + # if defined ( __ARM_ARCH_7A__ ) & & ( __ANDROID_API__ > = 21 ) <nl> + / / This profiling tool only supports Ver 21 or upper on Android <nl> + return GetCpuUtilsHelperSingletonInstance ( ) . CalculateCpuFrequency ( ) ; <nl> + # else / / defined ( __ARM_ARCH_7A__ ) & & ( __ANDROID_API__ > = 21 ) <nl> return INVALID_FREQUENCY ; <nl> + # endif <nl> # elif defined ( __linux__ ) <nl> double bogomips ; <nl> FILE * fp = popen ( " grep ' ^ bogomips ' / proc / cpuinfo | head - 1 " , " r " ) ; <nl> + if ( fp = = nullptr ) { <nl> + return INVALID_FREQUENCY ; <nl> + } <nl> const int retval_of_bogomips = fscanf ( fp , " bogomips : % lf " , & bogomips ) ; <nl> + if ( retval_of_bogomips < = 0 ) { <nl> + return INVALID_FREQUENCY ; <nl> + } <nl> pclose ( fp ) ; <nl> const double freq_ghz = bogomips / 1000 . 0 / 2 . 0 ; <nl> if ( retval_of_bogomips ! = 1 | | freq_ghz < 0 . 01 ) { <nl> const class StaticVariableInitializer { <nl> int64 freq_hz ; <nl> FILE * fp = <nl> popen ( " sysctl hw | grep hw . cpufrequency_max : | cut - d ' ' - f 2 " , " r " ) ; <nl> - fscanf ( fp , " % lld " , & freq_hz ) ; <nl> + if ( fp = = nullptr ) { <nl> + return INVALID_FREQUENCY ; <nl> + } <nl> + if ( fscanf ( fp , " % lld " , & freq_hz ) ! = 1 ) { <nl> + return INVALID_FREQUENCY ; <nl> + } <nl> pclose ( fp ) ; <nl> if ( freq_hz < 1e6 ) { <nl> LOG ( WARNING ) < < " Failed to get CPU frequency : " < < freq_hz < < " Hz " ; <nl> const class StaticVariableInitializer { <nl> # endif <nl> } <nl> <nl> - / * static * / ICpuUtilsHelper & CpuUtils : : GetCpuUtilsHelper ( ) { <nl> + / * static * / ICpuUtilsHelper & CpuUtils : : GetCpuUtilsHelperSingletonInstance ( ) { <nl> + static std : : once_flag flag ; <nl> + std : : call_once ( flag , [ ] ( ) { <nl> + if ( cpu_utils_helper_instance_ ! = nullptr ) { <nl> + LOG ( FATAL ) < < " cpu_utils_helper_instance_ is already instantiated . " ; <nl> + } <nl> # if defined ( __ANDROID__ ) & & defined ( __ARM_ARCH_7A__ ) & & ( __ANDROID_API__ > = 21 ) <nl> - static AndroidArmV7ACpuUtilsHelper cpu_utils_helper ; <nl> + cpu_utils_helper_instance_ = new AndroidArmV7ACpuUtilsHelper ( ) ; <nl> # else <nl> - / / TODO ( satok ) : Change CpuUtilsHelper by cpu architecture <nl> - static DefaultCpuUtilsHelper cpu_utils_helper ; <nl> + cpu_utils_helper_instance_ = new DefaultCpuUtilsHelper ( ) ; <nl> # endif <nl> - return cpu_utils_helper ; <nl> + } ) ; <nl> + return * cpu_utils_helper_instance_ ; <nl> } <nl> <nl> } / / namespace profile_utils <nl> mmm a / tensorflow / core / platform / profile_utils / cpu_utils . h <nl> ppp b / tensorflow / core / platform / profile_utils / cpu_utils . h <nl> limitations under the License . <nl> # ifndef TENSORFLOW_PLATFORM_PROFILEUTILS_CPU_UTILS_H__ <nl> # define TENSORFLOW_PLATFORM_PROFILEUTILS_CPU_UTILS_H__ <nl> <nl> + # include < chrono > <nl> + # include < memory > <nl> + <nl> # include " tensorflow / core / platform / macros . h " <nl> # include " tensorflow / core / platform / profile_utils / i_cpu_utils_helper . h " <nl> # include " tensorflow / core / platform / types . h " <nl> namespace tensorflow { <nl> <nl> namespace profile_utils { <nl> <nl> + / / CpuUtils is a profiling tool with static functions <nl> + / / designed to be called from multiple classes . <nl> + / / A dedicated class which inherits ICpuUtilsHelper is <nl> + / / stored as a function - local static variable which inherits <nl> + / / GetCpuUtilsHelperSingletonInstance that caches CPU information , <nl> + / / because loading CPU information may take a long time . <nl> + / / Users must call EnableClockCycleProfiling before using CpuUtils . <nl> class CpuUtils { <nl> public : <nl> / / Constant for invalid frequency . <nl> class CpuUtils { <nl> static inline uint64 GetCurrentClockCycle ( ) { <nl> # if defined ( __ANDROID__ ) <nl> # if defined ( __ARM_ARCH_7A__ ) & & ( __ANDROID_API__ > = 21 ) <nl> - return GetCpuUtilsHelper ( ) . GetCurrentClockCycle ( ) ; <nl> + return GetCpuUtilsHelperSingletonInstance ( ) . GetCurrentClockCycle ( ) ; <nl> # else / / defined ( __ARM_ARCH_7A__ ) & & ( __ANDROID_API__ > = 21 ) <nl> return DUMMY_CYCLE_CLOCK ; <nl> # endif / / defined ( __ARM_ARCH_7A__ ) & & ( __ANDROID_API__ > = 21 ) <nl> class CpuUtils { <nl> # endif <nl> } <nl> <nl> - / / Return cpu frequency . As this method caches the cpu frequency internally , <nl> - / / there is no overhead except function call to call this method . <nl> - static int64 GetCpuFrequency ( ) ; <nl> - <nl> - / / Return cached cpu count per each micro second . <nl> + / / Return cycle counter frequency . <nl> / / As this method caches the cpu frequency internally , <nl> - / / there is no overhead except function call to call this method . <nl> - static int GetClockPerMicroSec ( ) ; <nl> + / / the first call will incur overhead , but not subsequent calls . <nl> + static int64 GetCycleCounterFrequency ( ) ; <nl> <nl> / / Return micro secound per each clock <nl> / / As this method caches the cpu frequency internally , <nl> - / / there is no overhead except function call to call this method . <nl> + / / the first call will incur overhead , but not subsequent calls . <nl> static double GetMicroSecPerClock ( ) ; <nl> <nl> - / / Initialize CpuUtils <nl> - / / This method is called from the static initializer declared in cpu_utils . cc <nl> - / / This initializes state and cached static variables declared in functions . <nl> - static void Initialize ( ) ; <nl> - <nl> / / Reset clock cycle <nl> / / Resetting clock cycle is recommended to prevent <nl> / / clock cycle counters from overflowing on some platforms . <nl> class CpuUtils { <nl> / / You can enable / disable profile if it ' s supported by the platform <nl> static void EnableClockCycleProfiling ( bool enable ) ; <nl> <nl> + / / Return chrono : : duration per each clock <nl> + static std : : chrono : : duration < double > ConvertClockCycleToTime ( <nl> + const int64 clock_cycle ) ; <nl> + <nl> private : <nl> class DefaultCpuUtilsHelper : public ICpuUtilsHelper { <nl> public : <nl> DefaultCpuUtilsHelper ( ) = default ; <nl> - void Initialize ( ) final { } <nl> void ResetClockCycle ( ) final { } <nl> uint64 GetCurrentClockCycle ( ) final { return DUMMY_CYCLE_CLOCK ; } <nl> void EnableClockCycleProfiling ( bool / * enable * / ) final { } <nl> + int64 CalculateCpuFrequency ( ) final { return INVALID_FREQUENCY ; } <nl> <nl> private : <nl> TF_DISALLOW_COPY_AND_ASSIGN ( DefaultCpuUtilsHelper ) ; <nl> class CpuUtils { <nl> / / CAVEAT : as this method calls system call and parse the mssage , <nl> / / this call may be slow . This is why this class caches the value by <nl> / / StaticVariableInitializer . <nl> - static int64 GetCpuFrequencyImpl ( ) ; <nl> - <nl> - static ICpuUtilsHelper & GetCpuUtilsHelper ( ) ; <nl> + static int64 GetCycleCounterFrequencyImpl ( ) ; <nl> + <nl> + / / Return a singleton of ICpuUtilsHelper <nl> + / / ICpuUtilsHelper is declared as a function - local static variable <nl> + / / for the following two reasons : <nl> + / / 1 . Avoid passing instances to all classes which want <nl> + / / to use profiling tools in CpuUtils <nl> + / / 2 . Minimize the overhead of acquiring ICpuUtilsHelper <nl> + static ICpuUtilsHelper & GetCpuUtilsHelperSingletonInstance ( ) ; <nl> <nl> TF_DISALLOW_COPY_AND_ASSIGN ( CpuUtils ) ; <nl> } ; <nl> mmm a / tensorflow / core / platform / profile_utils / cpu_utils_test . cc <nl> ppp b / tensorflow / core / platform / profile_utils / cpu_utils_test . cc <nl> namespace profile_utils { <nl> <nl> static constexpr bool DBG = false ; <nl> <nl> - TEST ( CpuUtils , CheckGetCurrentClockCycle ) { <nl> + class CpuUtilsTest : public : : testing : : Test { <nl> + protected : <nl> + void SetUp ( ) { CpuUtils : : EnableClockCycleProfiling ( true ) ; } <nl> + } ; <nl> + <nl> + TEST_F ( CpuUtilsTest , SetUpTestCase ) { } <nl> + <nl> + TEST_F ( CpuUtilsTest , TearDownTestCase ) { } <nl> + <nl> + TEST_F ( CpuUtilsTest , CheckGetCurrentClockCycle ) { <nl> static constexpr int LOOP_COUNT = 10 ; <nl> const uint64 start_clock_count = CpuUtils : : GetCurrentClockCycle ( ) ; <nl> CHECK_GT ( start_clock_count , 0 ) ; <nl> TEST ( CpuUtils , CheckGetCurrentClockCycle ) { <nl> } <nl> } <nl> <nl> - TEST ( CpuUtils , CheckCpuFrequency ) { <nl> - const int64 cpu_frequency = CpuUtils : : GetCpuFrequency ( ) ; <nl> + TEST_F ( CpuUtilsTest , CheckCycleCounterFrequency ) { <nl> + const int64 cpu_frequency = CpuUtils : : GetCycleCounterFrequency ( ) ; <nl> CHECK_GT ( cpu_frequency , 0 ) ; <nl> CHECK_NE ( cpu_frequency , CpuUtils : : INVALID_FREQUENCY ) ; <nl> if ( DBG ) { <nl> TEST ( CpuUtils , CheckCpuFrequency ) { <nl> } <nl> } <nl> <nl> - TEST ( CpuUtils , CheckClockPerMicroSec ) { <nl> - const int clock_per_micro_sec = CpuUtils : : GetClockPerMicroSec ( ) ; <nl> - CHECK_GT ( clock_per_micro_sec , 0 ) ; <nl> - if ( DBG ) { <nl> - LOG ( INFO ) < < " Clock per micro sec = " < < clock_per_micro_sec ; <nl> - } <nl> - } <nl> - <nl> - TEST ( CpuUtils , CheckMicroSecPerClock ) { <nl> + TEST_F ( CpuUtilsTest , CheckMicroSecPerClock ) { <nl> const double micro_sec_per_clock = CpuUtils : : GetMicroSecPerClock ( ) ; <nl> CHECK_GT ( micro_sec_per_clock , 0 . 0 ) ; <nl> if ( DBG ) { <nl> mmm a / tensorflow / core / platform / profile_utils / i_cpu_utils_helper . h <nl> ppp b / tensorflow / core / platform / profile_utils / i_cpu_utils_helper . h <nl> namespace profile_utils { <nl> <nl> / / ICpuUtilsHelper is an interface class for cpu_utils which proxies <nl> / / the difference of profiling functions of different platforms . <nl> + / / Overridden functions must be thread safe . <nl> class ICpuUtilsHelper { <nl> public : <nl> ICpuUtilsHelper ( ) = default ; <nl> virtual ~ ICpuUtilsHelper ( ) = default ; <nl> - / / Initialize CpuUtilsHelper . <nl> - / / This method is called only once when CpuUtils is loaded . <nl> - virtual void Initialize ( ) = 0 ; <nl> / / Reset clock cycle . <nl> / / Resetting clock cycle is recommended to prevent <nl> / / clock cycle counters from overflowing on some platforms . <nl> class ICpuUtilsHelper { <nl> / / Enable clock cycle profile <nl> / / You can enable / disable profile if it ' s supported by the platform <nl> virtual void EnableClockCycleProfiling ( bool enable ) = 0 ; <nl> + / / Return cpu frequency . <nl> + / / CAVEAT : as this method may read file and / or call system calls , <nl> + / / this call is supposed to be slow . <nl> + virtual int64 CalculateCpuFrequency ( ) = 0 ; <nl> <nl> private : <nl> TF_DISALLOW_COPY_AND_ASSIGN ( ICpuUtilsHelper ) ; <nl> mmm a / tensorflow / g3doc / api_docs / python / contrib . distributions . md <nl> ppp b / tensorflow / g3doc / api_docs / python / contrib . distributions . md <nl> distribution : <nl> <nl> ` ` ` <nl> logit_normal = TransformedDistribution ( <nl> - base_dist = Normal ( mu , sigma ) , <nl> + base_dist_cls = tf . contrib . distributions . Normal , <nl> + mu = mu , <nl> + sigma = sigma , <nl> transform = lambda x : tf . sigmoid ( x ) , <nl> inverse = lambda y : tf . log ( y ) - tf . log ( 1 . - y ) , <nl> log_det_jacobian = ( lambda x : <nl> mmm a / tensorflow / g3doc / api_docs / python / contrib . graph_editor . md <nl> ppp b / tensorflow / g3doc / api_docs / python / contrib . graph_editor . md <nl> Return all the tf . Operation which are connected to an op in ops . <nl> <nl> - - - <nl> <nl> - # # # ` tf . contrib . graph_editor . compute_boundary_ts ( ops , ambiguous_are_outputs = True ) ` { # compute_boundary_ts } <nl> + # # # ` tf . contrib . graph_editor . compute_boundary_ts ( ops , ambiguous_ts_are_outputs = True ) ` { # compute_boundary_ts } <nl> <nl> Compute the tensors at the boundary of a set of ops . <nl> <nl> and classify them into three categories : <nl> <nl> <nl> * < b > ` ops ` < / b > : an object convertible to a list of tf . Operation . <nl> - * < b > ` ambiguous_are_outputs ` < / b > : a tensor can have consumers both inside and outside <nl> - ops . Such tensors are treated as outside tensor if inside_output_as_output <nl> - is True , otherwise they are treated as inside tensor . <nl> + * < b > ` ambiguous_ts_are_outputs ` < / b > : a tensor can have consumers both inside and <nl> + outside ops . Such tensors are treated as outside tensor if <nl> + ambiguous_ts_are_outputs is True , otherwise they are treated as <nl> + inside tensor . <nl> <nl> # # # # # Returns : <nl> <nl> mmm a / tensorflow / g3doc / api_docs / python / contrib . layers . md <nl> ppp b / tensorflow / g3doc / api_docs / python / contrib . layers . md <nl> Optimize weights given a loss . <nl> <nl> - - - <nl> <nl> - # # # ` tf . contrib . layers . optimize_loss ( loss , global_step , learning_rate , optimizer , gradient_noise_scale = None , gradient_multipliers = None , clip_gradients = None , moving_average_decay = None , learning_rate_decay_fn = None , update_ops = None , variables = None , name = None , summaries = None ) ` { # optimize_loss } <nl> + # # # ` tf . contrib . layers . optimize_loss ( loss , global_step , learning_rate , optimizer , gradient_noise_scale = None , gradient_multipliers = None , clip_gradients = None , learning_rate_decay_fn = None , update_ops = None , variables = None , name = None , summaries = None ) ` { # optimize_loss } <nl> <nl> Given loss and parameters for optimizer , returns a training op . <nl> <nl> + Various ways of passing optimizers , include : <nl> + - string , name of the optimizer like ' SGD ' , ' Adam ' , see OPTIMIZER_CLS_NAMES <nl> + for full list . E . g . ` optimize_loss ( . . . , optimizer = ' Adam ' ) ` . <nl> + - function , takes learning rate ` Tensor ` as argument and must return <nl> + ` Optimizer ` instance . E . g . ` optimize_loss ( . . . , <nl> + optimizer = lambda lr : tf . train . MomentumOptimizer ( lr , momentum = 0 . 5 ) ) ` . <nl> + Alternatively , if ` learning_rate ` is ` None ` , the function takes no <nl> + arguments . E . g . ` optimize_loss ( . . . , learning_rate = None , <nl> + optimizer = lambda : tf . train . MomentumOptimizer ( 0 . 5 , momentum = 0 . 5 ) ) ` . <nl> + - class , subclass of ` Optimizer ` that takes only one required argument - <nl> + learning rate , such as AdamOptimizer , AdagradOptimizer . <nl> + E . g . ` optimize_loss ( . . . , optimizer = tf . train . AdagradOptimizer ) ` . <nl> + - object , instance of subclass of ` Optimizer ` . <nl> + E . g . , ` optimizer_loss ( . . . , optimizer = tf . train . AdagradOptimizer ( 0 . 5 ) ) ` . <nl> + <nl> # # # # # Args : <nl> <nl> <nl> Given loss and parameters for optimizer , returns a training op . <nl> ' Adam ' , ' Adagrad ' . Full list in OPTIMIZER_CLS_NAMES constant . <nl> class should be sub - class of tf . Optimizer that implements <nl> ` compute_gradients ` and ` apply_gradients ` functions . <nl> - optimizer instance should be instantion of tf . Optimizer sub - class <nl> - and have ` compute_gradients ` and ` apply_gradients ` functions . <nl> + optimizer instance should be instantion of ` tf . Optimizer ` <nl> + sub - class and have ` compute_gradients ` and ` apply_gradients ` <nl> + functions . <nl> * < b > ` gradient_noise_scale ` < / b > : float or None , adds 0 - mean normal noise scaled by this <nl> value . <nl> * < b > ` gradient_multipliers ` < / b > : dict of variables or variable names to floats . <nl> If present , gradients for specified <nl> variables will be multiplied by given constant . <nl> * < b > ` clip_gradients ` < / b > : float or ` None ` , clips gradients by this value . <nl> - * < b > ` moving_average_decay ` < / b > : Deprecated . float or None , takes into account previous <nl> - loss to make learning smoother due to outliers . <nl> * < b > ` learning_rate_decay_fn ` < / b > : function , takes ` learning_rate ` and ` global_step ` <nl> ` Tensor ` s , returns ` Tensor ` . <nl> Can be used to implement any learning rate decay <nl> mmm a / tensorflow / g3doc / api_docs / python / contrib . learn . md <nl> ppp b / tensorflow / g3doc / api_docs / python / contrib . learn . md <nl> estimator = LinearClassifier ( <nl> feature_columns = [ occupation , education_x_occupation ] , <nl> optimizer = tf . contrib . linear_optimizer . SDCAOptimizer ( <nl> example_id_column = ' example_id ' , <nl> + num_loss_partitions = . . . , <nl> symmetric_l2_regularization = 2 . 0 <nl> ) ) <nl> <nl> See trainable . Trainable . <nl> <nl> <nl> <nl> + - - - <nl> + <nl> + # # # # ` tf . contrib . learn . LinearClassifier . get_variable_value ( name ) ` { # LinearClassifier . get_variable_value } <nl> + <nl> + <nl> + <nl> + <nl> - - - <nl> <nl> # # # # ` tf . contrib . learn . LinearClassifier . model_dir ` { # LinearClassifier . model_dir } <nl> mmm a / tensorflow / g3doc / api_docs / python / contrib . rnn . md <nl> ppp b / tensorflow / g3doc / api_docs / python / contrib . rnn . md <nl> the shapes ` [ batch_size x s ] ` for each s in ` state_size ` . <nl> <nl> <nl> <nl> + <nl> + # # Other Functions and Classes <nl> + - - - <nl> + <nl> + # # # ` class tf . contrib . rnn . LayerNormBasicLSTMCell ` { # LayerNormBasicLSTMCell } <nl> + <nl> + LSTM unit with layer normalization and recurrent dropout . <nl> + <nl> + This class adds layer normalization and recurrent dropout to a <nl> + basic LSTM unit . Layer normalization implementation is based on : <nl> + <nl> + https : / / arxiv . org / abs / 1607 . 06450 . <nl> + <nl> + " Layer Normalization " <nl> + Jimmy Lei Ba , Jamie Ryan Kiros , Geoffrey E . Hinton <nl> + <nl> + and is applied before the internal nonlinearities . <nl> + Recurrent dropout is base on : <nl> + <nl> + https : / / arxiv . org / abs / 1603 . 05118 <nl> + <nl> + " Recurrent Dropout without Memory Loss " <nl> + Stanislau Semeniuta , Aliaksei Severyn , Erhardt Barth . <nl> + - - - <nl> + <nl> + # # # # ` tf . contrib . rnn . LayerNormBasicLSTMCell . __call__ ( inputs , state , scope = None ) ` { # LayerNormBasicLSTMCell . __call__ } <nl> + <nl> + LSTM cell with layer normalization and recurrent dropout . <nl> + <nl> + <nl> + - - - <nl> + <nl> + # # # # ` tf . contrib . rnn . LayerNormBasicLSTMCell . __init__ ( num_units , forget_bias = 1 . 0 , input_size = None , activation = tanh , layer_norm = True , norm_gain = 1 . 0 , norm_shift = 0 . 0 , dropout_keep_prob = 1 . 0 , dropout_prob_seed = None ) ` { # LayerNormBasicLSTMCell . __init__ } <nl> + <nl> + Initializes the basic LSTM cell . <nl> + <nl> + # # # # # Args : <nl> + <nl> + <nl> + * < b > ` num_units ` < / b > : int , The number of units in the LSTM cell . <nl> + * < b > ` forget_bias ` < / b > : float , The bias added to forget gates ( see above ) . <nl> + * < b > ` input_size ` < / b > : Deprecated and unused . <nl> + * < b > ` activation ` < / b > : Activation function of the inner states . <nl> + * < b > ` layer_norm ` < / b > : If ` True ` , layer normalization will be applied . <nl> + * < b > ` norm_gain ` < / b > : float , The layer normalization gain initial value . If <nl> + ` layer_norm ` has been set to ` False ` , this argument will be ignored . <nl> + * < b > ` norm_shift ` < / b > : float , The layer normalization shift initial value . If <nl> + ` layer_norm ` has been set to ` False ` , this argument will be ignored . <nl> + * < b > ` dropout_keep_prob ` < / b > : unit Tensor or float between 0 and 1 representing the <nl> + recurrent dropout probability value . If float and 1 . 0 , no dropout will <nl> + be applied . <nl> + * < b > ` dropout_prob_seed ` < / b > : ( optional ) integer , the randomness seed . <nl> + <nl> + <nl> + - - - <nl> + <nl> + # # # # ` tf . contrib . rnn . LayerNormBasicLSTMCell . output_size ` { # LayerNormBasicLSTMCell . output_size } <nl> + <nl> + <nl> + <nl> + <nl> + - - - <nl> + <nl> + # # # # ` tf . contrib . rnn . LayerNormBasicLSTMCell . state_size ` { # LayerNormBasicLSTMCell . state_size } <nl> + <nl> + <nl> + <nl> + <nl> + - - - <nl> + <nl> + # # # # ` tf . contrib . rnn . LayerNormBasicLSTMCell . zero_state ( batch_size , dtype ) ` { # LayerNormBasicLSTMCell . zero_state } <nl> + <nl> + Return zero - filled state tensor ( s ) . <nl> + <nl> + # # # # # Args : <nl> + <nl> + <nl> + * < b > ` batch_size ` < / b > : int , float , or unit Tensor representing the batch size . <nl> + * < b > ` dtype ` < / b > : the data type to use for the state . <nl> + <nl> + # # # # # Returns : <nl> + <nl> + If ` state_size ` is an int or TensorShape , then the return value is a <nl> + ` N - D ` tensor of shape ` [ batch_size x state_size ] ` filled with zeros . <nl> + <nl> + If ` state_size ` is a nested list or tuple , then the return value is <nl> + a nested list or tuple ( of the same structure ) of ` 2 - D ` tensors with <nl> + the shapes ` [ batch_size x s ] ` for each s in ` state_size ` . <nl> + <nl> + <nl> + <nl> mmm a / tensorflow / g3doc / api_docs / python / framework . md <nl> ppp b / tensorflow / g3doc / api_docs / python / framework . md <nl> Return a string representation of this ` DeviceSpec ` . <nl> <nl> <nl> <nl> - - - - <nl> - <nl> - # # # ` class tf . bytes ` { # bytes } <nl> - <nl> - str ( object = ' ' ) - > string <nl> - <nl> - Return a nice string representation of the object . <nl> - If the argument is a string , the return value is the same object . <nl> - <nl> mmm a / tensorflow / g3doc / api_docs / python / functions_and_classes / shard1 / tf . contrib . distributions . TransformedDistribution . md <nl> ppp b / tensorflow / g3doc / api_docs / python / functions_and_classes / shard1 / tf . contrib . distributions . TransformedDistribution . md <nl> distribution : <nl> <nl> ` ` ` <nl> logit_normal = TransformedDistribution ( <nl> - base_dist = Normal ( mu , sigma ) , <nl> + base_dist_cls = tf . contrib . distributions . Normal , <nl> + mu = mu , <nl> + sigma = sigma , <nl> transform = lambda x : tf . sigmoid ( x ) , <nl> inverse = lambda y : tf . log ( y ) - tf . log ( 1 . - y ) , <nl> log_det_jacobian = ( lambda x : <nl> mmm a / tensorflow / g3doc / api_docs / python / functions_and_classes / shard1 / tf . contrib . graph_editor . compute_boundary_ts . md <nl> ppp b / tensorflow / g3doc / api_docs / python / functions_and_classes / shard1 / tf . contrib . graph_editor . compute_boundary_ts . md <nl> <nl> - # # # ` tf . contrib . graph_editor . compute_boundary_ts ( ops , ambiguous_are_outputs = True ) ` { # compute_boundary_ts } <nl> + # # # ` tf . contrib . graph_editor . compute_boundary_ts ( ops , ambiguous_ts_are_outputs = True ) ` { # compute_boundary_ts } <nl> <nl> Compute the tensors at the boundary of a set of ops . <nl> <nl> and classify them into three categories : <nl> <nl> <nl> * < b > ` ops ` < / b > : an object convertible to a list of tf . Operation . <nl> - * < b > ` ambiguous_are_outputs ` < / b > : a tensor can have consumers both inside and outside <nl> - ops . Such tensors are treated as outside tensor if inside_output_as_output <nl> - is True , otherwise they are treated as inside tensor . <nl> + * < b > ` ambiguous_ts_are_outputs ` < / b > : a tensor can have consumers both inside and <nl> + outside ops . Such tensors are treated as outside tensor if <nl> + ambiguous_ts_are_outputs is True , otherwise they are treated as <nl> + inside tensor . <nl> <nl> # # # # # Returns : <nl> <nl> mmm a / tensorflow / g3doc / api_docs / python / functions_and_classes / shard1 / tf . contrib . learn . LinearClassifier . md <nl> ppp b / tensorflow / g3doc / api_docs / python / functions_and_classes / shard1 / tf . contrib . learn . LinearClassifier . md <nl> estimator = LinearClassifier ( <nl> feature_columns = [ occupation , education_x_occupation ] , <nl> optimizer = tf . contrib . linear_optimizer . SDCAOptimizer ( <nl> example_id_column = ' example_id ' , <nl> + num_loss_partitions = . . . , <nl> symmetric_l2_regularization = 2 . 0 <nl> ) ) <nl> <nl> See trainable . Trainable . <nl> <nl> <nl> <nl> + - - - <nl> + <nl> + # # # # ` tf . contrib . learn . LinearClassifier . get_variable_value ( name ) ` { # LinearClassifier . get_variable_value } <nl> + <nl> + <nl> + <nl> + <nl> - - - <nl> <nl> # # # # ` tf . contrib . learn . LinearClassifier . model_dir ` { # LinearClassifier . model_dir } <nl> mmm a / tensorflow / g3doc / api_docs / python / functions_and_classes / shard2 / tf . contrib . layers . optimize_loss . md <nl> ppp b / tensorflow / g3doc / api_docs / python / functions_and_classes / shard2 / tf . contrib . layers . optimize_loss . md <nl> <nl> - # # # ` tf . contrib . layers . optimize_loss ( loss , global_step , learning_rate , optimizer , gradient_noise_scale = None , gradient_multipliers = None , clip_gradients = None , moving_average_decay = None , learning_rate_decay_fn = None , update_ops = None , variables = None , name = None , summaries = None ) ` { # optimize_loss } <nl> + # # # ` tf . contrib . layers . optimize_loss ( loss , global_step , learning_rate , optimizer , gradient_noise_scale = None , gradient_multipliers = None , clip_gradients = None , learning_rate_decay_fn = None , update_ops = None , variables = None , name = None , summaries = None ) ` { # optimize_loss } <nl> <nl> Given loss and parameters for optimizer , returns a training op . <nl> <nl> + Various ways of passing optimizers , include : <nl> + - string , name of the optimizer like ' SGD ' , ' Adam ' , see OPTIMIZER_CLS_NAMES <nl> + for full list . E . g . ` optimize_loss ( . . . , optimizer = ' Adam ' ) ` . <nl> + - function , takes learning rate ` Tensor ` as argument and must return <nl> + ` Optimizer ` instance . E . g . ` optimize_loss ( . . . , <nl> + optimizer = lambda lr : tf . train . MomentumOptimizer ( lr , momentum = 0 . 5 ) ) ` . <nl> + Alternatively , if ` learning_rate ` is ` None ` , the function takes no <nl> + arguments . E . g . ` optimize_loss ( . . . , learning_rate = None , <nl> + optimizer = lambda : tf . train . MomentumOptimizer ( 0 . 5 , momentum = 0 . 5 ) ) ` . <nl> + - class , subclass of ` Optimizer ` that takes only one required argument - <nl> + learning rate , such as AdamOptimizer , AdagradOptimizer . <nl> + E . g . ` optimize_loss ( . . . , optimizer = tf . train . AdagradOptimizer ) ` . <nl> + - object , instance of subclass of ` Optimizer ` . <nl> + E . g . , ` optimizer_loss ( . . . , optimizer = tf . train . AdagradOptimizer ( 0 . 5 ) ) ` . <nl> + <nl> # # # # # Args : <nl> <nl> <nl> Given loss and parameters for optimizer , returns a training op . <nl> ' Adam ' , ' Adagrad ' . Full list in OPTIMIZER_CLS_NAMES constant . <nl> class should be sub - class of tf . Optimizer that implements <nl> ` compute_gradients ` and ` apply_gradients ` functions . <nl> - optimizer instance should be instantion of tf . Optimizer sub - class <nl> - and have ` compute_gradients ` and ` apply_gradients ` functions . <nl> + optimizer instance should be instantion of ` tf . Optimizer ` <nl> + sub - class and have ` compute_gradients ` and ` apply_gradients ` <nl> + functions . <nl> * < b > ` gradient_noise_scale ` < / b > : float or None , adds 0 - mean normal noise scaled by this <nl> value . <nl> * < b > ` gradient_multipliers ` < / b > : dict of variables or variable names to floats . <nl> If present , gradients for specified <nl> variables will be multiplied by given constant . <nl> * < b > ` clip_gradients ` < / b > : float or ` None ` , clips gradients by this value . <nl> - * < b > ` moving_average_decay ` < / b > : Deprecated . float or None , takes into account previous <nl> - loss to make learning smoother due to outliers . <nl> * < b > ` learning_rate_decay_fn ` < / b > : function , takes ` learning_rate ` and ` global_step ` <nl> ` Tensor ` s , returns ` Tensor ` . <nl> Can be used to implement any learning rate decay <nl> mmm a / tensorflow / g3doc / api_docs / python / functions_and_classes / shard3 / tf . nn . log_softmax . md <nl> ppp b / tensorflow / g3doc / api_docs / python / functions_and_classes / shard3 / tf . nn . log_softmax . md <nl> Computes log softmax activations . <nl> <nl> For each batch ` i ` and class ` j ` we have <nl> <nl> - logsoftmax = logits - reduce_sum ( exp ( logits ) , dim ) <nl> + logsoftmax = logits - log ( reduce_sum ( exp ( logits ) , dim ) ) <nl> <nl> # # # # # Args : <nl> <nl> mmm a / tensorflow / g3doc / api_docs / python / functions_and_classes / shard4 / tf . nn . nce_loss . md <nl> ppp b / tensorflow / g3doc / api_docs / python / functions_and_classes / shard4 / tf . nn . nce_loss . md <nl> unnormalized statistical models ] <nl> Also see our [ Candidate Sampling Algorithms Reference ] <nl> ( . . / . . / extras / candidate_sampling . pdf ) <nl> <nl> + Note : By default this uses a log - uniform ( Zipfian ) distribution for sampling , <nl> + so your labels must be sorted in order of decreasing frequency to achieve <nl> + good results . For more details , see <nl> + [ log_uniform_candidate_sampler ] ( # log_uniform_candidate_sampler ) . <nl> + <nl> Note : In the case where ` num_true ` > 1 , we assign to each target class <nl> the target probability 1 / ` num_true ` so that the target probabilities <nl> sum to 1 per - example . <nl> deleted file mode 100644 <nl> index 5353507e3937c . . 0000000000000 <nl> mmm a / tensorflow / g3doc / api_docs / python / functions_and_classes / shard5 / tf . bytes . md <nl> ppp / dev / null <nl> <nl> - str ( object = ' ' ) - > string <nl> - <nl> - Return a nice string representation of the object . <nl> - If the argument is a string , the return value is the same object . <nl> new file mode 100644 <nl> index 0000000000000 . . 814388a1a2e29 <nl> mmm / dev / null <nl> ppp b / tensorflow / g3doc / api_docs / python / functions_and_classes / shard6 / tf . contrib . rnn . LayerNormBasicLSTMCell . md <nl> <nl> + LSTM unit with layer normalization and recurrent dropout . <nl> + <nl> + This class adds layer normalization and recurrent dropout to a <nl> + basic LSTM unit . Layer normalization implementation is based on : <nl> + <nl> + https : / / arxiv . org / abs / 1607 . 06450 . <nl> + <nl> + " Layer Normalization " <nl> + Jimmy Lei Ba , Jamie Ryan Kiros , Geoffrey E . Hinton <nl> + <nl> + and is applied before the internal nonlinearities . <nl> + Recurrent dropout is base on : <nl> + <nl> + https : / / arxiv . org / abs / 1603 . 05118 <nl> + <nl> + " Recurrent Dropout without Memory Loss " <nl> + Stanislau Semeniuta , Aliaksei Severyn , Erhardt Barth . <nl> + - - - <nl> + <nl> + # # # # ` tf . contrib . rnn . LayerNormBasicLSTMCell . __call__ ( inputs , state , scope = None ) ` { # LayerNormBasicLSTMCell . __call__ } <nl> + <nl> + LSTM cell with layer normalization and recurrent dropout . <nl> + <nl> + <nl> + - - - <nl> + <nl> + # # # # ` tf . contrib . rnn . LayerNormBasicLSTMCell . __init__ ( num_units , forget_bias = 1 . 0 , input_size = None , activation = tanh , layer_norm = True , norm_gain = 1 . 0 , norm_shift = 0 . 0 , dropout_keep_prob = 1 . 0 , dropout_prob_seed = None ) ` { # LayerNormBasicLSTMCell . __init__ } <nl> + <nl> + Initializes the basic LSTM cell . <nl> + <nl> + # # # # # Args : <nl> + <nl> + <nl> + * < b > ` num_units ` < / b > : int , The number of units in the LSTM cell . <nl> + * < b > ` forget_bias ` < / b > : float , The bias added to forget gates ( see above ) . <nl> + * < b > ` input_size ` < / b > : Deprecated and unused . <nl> + * < b > ` activation ` < / b > : Activation function of the inner states . <nl> + * < b > ` layer_norm ` < / b > : If ` True ` , layer normalization will be applied . <nl> + * < b > ` norm_gain ` < / b > : float , The layer normalization gain initial value . If <nl> + ` layer_norm ` has been set to ` False ` , this argument will be ignored . <nl> + * < b > ` norm_shift ` < / b > : float , The layer normalization shift initial value . If <nl> + ` layer_norm ` has been set to ` False ` , this argument will be ignored . <nl> + * < b > ` dropout_keep_prob ` < / b > : unit Tensor or float between 0 and 1 representing the <nl> + recurrent dropout probability value . If float and 1 . 0 , no dropout will <nl> + be applied . <nl> + * < b > ` dropout_prob_seed ` < / b > : ( optional ) integer , the randomness seed . <nl> + <nl> + <nl> + - - - <nl> + <nl> + # # # # ` tf . contrib . rnn . LayerNormBasicLSTMCell . output_size ` { # LayerNormBasicLSTMCell . output_size } <nl> + <nl> + <nl> + <nl> + <nl> + - - - <nl> + <nl> + # # # # ` tf . contrib . rnn . LayerNormBasicLSTMCell . state_size ` { # LayerNormBasicLSTMCell . state_size } <nl> + <nl> + <nl> + <nl> + <nl> + - - - <nl> + <nl> + # # # # ` tf . contrib . rnn . LayerNormBasicLSTMCell . zero_state ( batch_size , dtype ) ` { # LayerNormBasicLSTMCell . zero_state } <nl> + <nl> + Return zero - filled state tensor ( s ) . <nl> + <nl> + # # # # # Args : <nl> + <nl> + <nl> + * < b > ` batch_size ` < / b > : int , float , or unit Tensor representing the batch size . <nl> + * < b > ` dtype ` < / b > : the data type to use for the state . <nl> + <nl> + # # # # # Returns : <nl> + <nl> + If ` state_size ` is an int or TensorShape , then the return value is a <nl> + ` N - D ` tensor of shape ` [ batch_size x state_size ] ` filled with zeros . <nl> + <nl> + If ` state_size ` is a nested list or tuple , then the return value is <nl> + a nested list or tuple ( of the same structure ) of ` 2 - D ` tensors with <nl> + the shapes ` [ batch_size x s ] ` for each s in ` state_size ` . <nl> + <nl> + <nl> mmm a / tensorflow / g3doc / api_docs / python / functions_and_classes / shard6 / tf . nn . softmax . md <nl> ppp b / tensorflow / g3doc / api_docs / python / functions_and_classes / shard6 / tf . nn . softmax . md <nl> <nl> # # # ` tf . nn . softmax ( logits , dim = - 1 , name = None ) ` { # softmax } <nl> <nl> - Computes log softmax activations . <nl> + Computes softmax activations . <nl> <nl> For each batch ` i ` and class ` j ` we have <nl> <nl> mmm a / tensorflow / g3doc / api_docs / python / index . md <nl> ppp b / tensorflow / g3doc / api_docs / python / index . md <nl> <nl> * * * [ Building Graphs ] ( . . / . . / api_docs / python / framework . md ) * * : <nl> * [ ` add_to_collection ` ] ( . . / . . / api_docs / python / framework . md # add_to_collection ) <nl> * [ ` as_dtype ` ] ( . . / . . / api_docs / python / framework . md # as_dtype ) <nl> - * [ ` bytes ` ] ( . . / . . / api_docs / python / framework . md # bytes ) <nl> * [ ` container ` ] ( . . / . . / api_docs / python / framework . md # container ) <nl> * [ ` control_dependencies ` ] ( . . / . . / api_docs / python / framework . md # control_dependencies ) <nl> * [ ` convert_to_tensor ` ] ( . . / . . / api_docs / python / framework . md # convert_to_tensor ) <nl> <nl> * [ ` CoupledInputForgetGateLSTMCell ` ] ( . . / . . / api_docs / python / contrib . rnn . md # CoupledInputForgetGateLSTMCell ) <nl> * [ ` GridLSTMCell ` ] ( . . / . . / api_docs / python / contrib . rnn . md # GridLSTMCell ) <nl> * [ ` GRUBlockCell ` ] ( . . / . . / api_docs / python / contrib . rnn . md # GRUBlockCell ) <nl> + * [ ` LayerNormBasicLSTMCell ` ] ( . . / . . / api_docs / python / contrib . rnn . md # LayerNormBasicLSTMCell ) <nl> * [ ` LSTMBlockCell ` ] ( . . / . . / api_docs / python / contrib . rnn . md # LSTMBlockCell ) <nl> * [ ` TimeFreqLSTMCell ` ] ( . . / . . / api_docs / python / contrib . rnn . md # TimeFreqLSTMCell ) <nl> <nl> mmm a / tensorflow / g3doc / api_docs / python / nn . md <nl> ppp b / tensorflow / g3doc / api_docs / python / nn . md <nl> equivalent formulation <nl> <nl> # # # ` tf . nn . softmax ( logits , dim = - 1 , name = None ) ` { # softmax } <nl> <nl> - Computes log softmax activations . <nl> + Computes softmax activations . <nl> <nl> For each batch ` i ` and class ` j ` we have <nl> <nl> Computes log softmax activations . <nl> <nl> For each batch ` i ` and class ` j ` we have <nl> <nl> - logsoftmax = logits - reduce_sum ( exp ( logits ) , dim ) <nl> + logsoftmax = logits - log ( reduce_sum ( exp ( logits ) , dim ) ) <nl> <nl> # # # # # Args : <nl> <nl> unnormalized statistical models ] <nl> Also see our [ Candidate Sampling Algorithms Reference ] <nl> ( . . / . . / extras / candidate_sampling . pdf ) <nl> <nl> + Note : By default this uses a log - uniform ( Zipfian ) distribution for sampling , <nl> + so your labels must be sorted in order of decreasing frequency to achieve <nl> + good results . For more details , see <nl> + [ log_uniform_candidate_sampler ] ( # log_uniform_candidate_sampler ) . <nl> + <nl> Note : In the case where ` num_true ` > 1 , we assign to each target class <nl> the target probability 1 / ` num_true ` so that the target probabilities <nl> sum to 1 per - example . <nl> mmm a / tensorflow / python / BUILD <nl> ppp b / tensorflow / python / BUILD <nl> tf_py_wrap_cc ( <nl> " lib / io / py_record_reader . i " , <nl> " lib / io / py_record_writer . i " , <nl> " platform / base . i " , <nl> - " platform / numpy . i " , <nl> " training / server_lib . i " , <nl> " util / port . i " , <nl> " util / py_checkpoint_reader . i " , <nl> mmm a / tensorflow / python / client / device_lib . py <nl> ppp b / tensorflow / python / client / device_lib . py <nl> <nl> from __future__ import division <nl> from __future__ import print_function <nl> <nl> - import six # pylint : disable = unused - import <nl> - <nl> from tensorflow . core . framework import device_attributes_pb2 <nl> from tensorflow . python import pywrap_tensorflow <nl> <nl> mmm a / tensorflow / python / client / tf_session . i <nl> ppp b / tensorflow / python / client / tf_session . i <nl> limitations under the License . <nl> % } <nl> <nl> / / Required to use PyArray_ * functions . <nl> - % include " tensorflow / python / platform / numpy . i " <nl> % init % { <nl> tensorflow : : ImportNumpy ( ) ; <nl> % } <nl> tensorflow : : ImportNumpy ( ) ; <nl> / / BEGIN TYPEMAPS FOR tensorflow : : TF_Run_wrapper ( ) <nl> / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / <nl> <nl> - / / The wrapper takes a vector of pairs of feed names and feed <nl> - / / values . In Python this is represented as dictionary mapping strings <nl> - / / to numpy arrays . <nl> - % typemap ( in ) const tensorflow : : FeedVector & inputs ( <nl> - tensorflow : : FeedVector temp , <nl> - tensorflow : : Safe_PyObjectPtr temp_string_list ( tensorflow : : make_safe ( nullptr ) ) , <nl> - tensorflow : : Safe_PyObjectPtr temp_array_list ( tensorflow : : make_safe ( nullptr ) ) ) { <nl> - if ( ! PyDict_Check ( $ input ) ) { <nl> - SWIG_fail ; <nl> - } <nl> - <nl> - temp_string_list = tensorflow : : make_safe ( PyList_New ( 0 ) ) ; <nl> - if ( ! temp_string_list ) { <nl> - SWIG_fail ; <nl> - } <nl> - temp_array_list = tensorflow : : make_safe ( PyList_New ( 0 ) ) ; <nl> - if ( ! temp_array_list ) { <nl> - SWIG_fail ; <nl> - } <nl> - <nl> - PyObject * key ; <nl> - PyObject * value ; <nl> - Py_ssize_t pos = 0 ; <nl> - while ( PyDict_Next ( $ input , & pos , & key , & value ) ) { <nl> - char * key_string = PyBytes_AsString ( key ) ; <nl> - if ( ! key_string ) { <nl> - SWIG_fail ; <nl> - } <nl> - <nl> - / / The ndarray must be stored as contiguous bytes in C ( row - major ) order . <nl> - PyObject * array_object = PyArray_FromAny ( <nl> - value , nullptr , 0 , 0 , NPY_ARRAY_CARRAY , nullptr ) ; <nl> - if ( ! array_object ) { <nl> - SWIG_fail ; <nl> - } <nl> - PyArrayObject * array = reinterpret_cast < PyArrayObject * > ( array_object ) ; <nl> - <nl> - / / Keep a reference to the key and the array , in case the incoming dict is <nl> - / / modified , and / or to avoid leaking references on failure . <nl> - if ( PyList_Append ( temp_string_list . get ( ) , key ) = = - 1 ) { <nl> - SWIG_fail ; <nl> - } <nl> - if ( PyList_Append ( temp_array_list . get ( ) , array_object ) = = - 1 ) { <nl> - SWIG_fail ; <nl> - } <nl> - <nl> - temp . push_back ( std : : make_pair ( key_string , array ) ) ; <nl> - } <nl> - $ 1 = & temp ; <nl> - } <nl> - <nl> / / The wrapper also takes a list of fetch and target names . In Python this is <nl> / / represented as a list of strings . <nl> % typemap ( in ) const tensorflow : : NameVector & ( <nl> mmm a / tensorflow / python / client / tf_session_helper . cc <nl> ppp b / tensorflow / python / client / tf_session_helper . cc <nl> Safe_PyObjectPtr make_safe ( PyObject * o ) { <nl> } <nl> <nl> void TF_Run_wrapper_helper ( TF_Session * session , const char * handle , <nl> - const TF_Buffer * run_options , <nl> - const FeedVector & inputs , <nl> + const TF_Buffer * run_options , PyObject * feed_dict , <nl> const NameVector & output_names , <nl> const NameVector & target_nodes , <nl> TF_Status * out_status , PyObjectVector * out_values , <nl> TF_Buffer * run_outputs ) { <nl> + static const char * kFeedDictErrorMsg = <nl> + " feed_dict must be a dictionary mapping strings to NumPy arrays . " ; <nl> + <nl> / / 1 . Convert the feed inputs to the appropriate form for TF_Run . <nl> + if ( ! PyDict_Check ( feed_dict ) ) { <nl> + Set_TF_Status_from_Status ( out_status , <nl> + errors : : InvalidArgument ( kFeedDictErrorMsg ) ) ; <nl> + return ; <nl> + } <nl> + <nl> NameVector input_names ; <nl> - Safe_PyObjectVector <nl> - py_inputs_safe ; / / Used to decref the input arrays on failure . <nl> Safe_TF_TensorVector inputs_safe ; / / Used to delete tensors on failure . <nl> TF_TensorVector inputs_unsafe ; / / Used to contain the arg to TF_Run . <nl> <nl> - for ( const auto & name_and_array : inputs ) { <nl> - py_inputs_safe . emplace_back ( <nl> - make_safe ( reinterpret_cast < PyObject * > ( name_and_array . second ) ) ) ; <nl> - } <nl> - <nl> - Status result ; <nl> - for ( size_t i = 0 ; i < inputs . size ( ) ; + + i ) { <nl> - input_names . push_back ( inputs [ i ] . first ) ; <nl> - PyArrayObject * array = inputs [ i ] . second ; <nl> + PyObject * key ; <nl> + PyObject * value ; <nl> + Py_ssize_t pos = 0 ; <nl> + int index = 0 ; <nl> + Status s ; <nl> + while ( PyDict_Next ( feed_dict , & pos , & key , & value ) ) { <nl> + char * key_string = PyBytes_AsString ( key ) ; <nl> + if ( ! key_string ) { <nl> + Set_TF_Status_from_Status ( out_status , <nl> + errors : : InvalidArgument ( kFeedDictErrorMsg ) ) ; <nl> + return ; <nl> + } <nl> + input_names . push_back ( key_string ) ; <nl> + <nl> + / / The array object will be dereferenced at the end of this iteration <nl> + / / ( or if we return early due to an error ) . <nl> + Safe_PyObjectPtr array_safe ( make_safe ( <nl> + PyArray_FromAny ( value , nullptr , 0 , 0 , NPY_ARRAY_CARRAY , nullptr ) ) ) ; <nl> + if ( ! array_safe ) { <nl> + Set_TF_Status_from_Status ( out_status , <nl> + errors : : InvalidArgument ( kFeedDictErrorMsg ) ) ; <nl> + return ; <nl> + } <nl> + PyArrayObject * array = reinterpret_cast < PyArrayObject * > ( array_safe . get ( ) ) ; <nl> <nl> / / Convert numpy dtype to TensorFlow dtype . <nl> TF_DataType dtype = TF_FLOAT ; <nl> - result = PyArray_TYPE_to_TF_DataType ( array , & dtype ) ; <nl> - if ( ! result . ok ( ) ) { <nl> - Set_TF_Status_from_Status ( out_status , result ) ; <nl> + s = PyArray_TYPE_to_TF_DataType ( array , & dtype ) ; <nl> + if ( ! s . ok ( ) ) { <nl> + Set_TF_Status_from_Status ( out_status , s ) ; <nl> return ; <nl> } <nl> <nl> void TF_Run_wrapper_helper ( TF_Session * session , const char * handle , <nl> TF_AllocateTensor ( dtype , dims . data ( ) , dims . size ( ) , size ) ; <nl> std : : memcpy ( TF_TensorData ( tensor ) , PyArray_DATA ( array ) , size ) ; <nl> inputs_safe . emplace_back ( make_safe ( tensor ) ) ; <nl> - / / The destruction of the numpy array will now be handled by the <nl> - / / inputs_safe destructor . <nl> - py_inputs_safe [ i ] . reset ( ) ; <nl> } else { <nl> size_t size = 0 ; <nl> void * encoded = nullptr ; <nl> void TF_Run_wrapper_helper ( TF_Session * session , const char * handle , <nl> delete [ ] reinterpret_cast < char * > ( data ) ; <nl> } , <nl> array ) ) ) ; <nl> - / / The destruction of the numpy array will now be handled by the <nl> - / / inputs_safe destructor . <nl> - py_inputs_safe [ i ] . reset ( ) ; <nl> } <nl> inputs_unsafe . push_back ( inputs_safe . back ( ) . get ( ) ) ; <nl> + + + index ; <nl> } <nl> <nl> / / 2 . Allocate a container for the output data . <nl> void TF_Run_wrapper_helper ( TF_Session * session , const char * handle , <nl> Safe_PyObjectVector py_outputs_safe ; <nl> for ( size_t i = 0 ; i < output_names . size ( ) ; + + i ) { <nl> PyObject * py_array ; <nl> - result = TF_Tensor_to_PyObject ( outputs [ i ] , & py_array ) ; <nl> - if ( ! result . ok ( ) ) { <nl> - Set_TF_Status_from_Status ( out_status , result ) ; <nl> + s = TF_Tensor_to_PyObject ( outputs [ i ] , & py_array ) ; <nl> + if ( ! s . ok ( ) ) { <nl> + Set_TF_Status_from_Status ( out_status , s ) ; <nl> return ; <nl> } <nl> py_outputs_safe . emplace_back ( make_safe ( py_array ) ) ; <nl> void TF_Run_wrapper_helper ( TF_Session * session , const char * handle , <nl> / / If * out_status is OK , the caller becomes the owner of the PyObjects <nl> / / in * out_values . <nl> void TF_Run_wrapper ( TF_Session * session , const TF_Buffer * run_options , <nl> - const FeedVector & inputs , const NameVector & output_names , <nl> + PyObject * feed_dict , const NameVector & output_names , <nl> const NameVector & target_nodes , TF_Status * out_status , <nl> PyObjectVector * out_values , TF_Buffer * run_outputs ) { <nl> - TF_Run_wrapper_helper ( session , nullptr , run_options , inputs , output_names , <nl> + TF_Run_wrapper_helper ( session , nullptr , run_options , feed_dict , output_names , <nl> target_nodes , out_status , out_values , run_outputs ) ; <nl> } <nl> <nl> void TF_PRunSetup_wrapper ( TF_Session * session , const NameVector & input_names , <nl> / / If * out_status is OK , the caller becomes the owner of the PyObjects <nl> / / in * out_values . <nl> void TF_PRun_wrapper ( TF_Session * session , const char * handle , <nl> - const FeedVector & inputs , const NameVector & output_names , <nl> + PyObject * feed_dict , const NameVector & output_names , <nl> TF_Status * out_status , PyObjectVector * out_values ) { <nl> - TF_Run_wrapper_helper ( session , handle , nullptr , inputs , output_names , <nl> + TF_Run_wrapper_helper ( session , handle , nullptr , feed_dict , output_names , <nl> NameVector ( ) , out_status , out_values , nullptr ) ; <nl> } <nl> <nl> mmm a / tensorflow / python / client / tf_session_helper . h <nl> ppp b / tensorflow / python / client / tf_session_helper . h <nl> namespace tensorflow { <nl> / / Container types for the various arguments and temporary values used <nl> / / in the wrapper . <nl> <nl> - / / A FeedVector is a vector of tensor name and numpy array pairs . The <nl> - / / name is a borrowed C string . <nl> - typedef tensorflow : : gtl : : InlinedVector < std : : pair < const char * , PyArrayObject * > , <nl> - 8 > <nl> - FeedVector ; <nl> - <nl> / / A NameVector is a vector of tensor or operation names , as borrowed <nl> / / C strings . <nl> typedef tensorflow : : gtl : : InlinedVector < const char * , 8 > NameVector ; <nl> Safe_PyObjectPtr make_safe ( PyObject * o ) ; <nl> / / stolen by the implementation ( i . e . the implementation will <nl> / / eventually call Py_DECREF on each array input ) . <nl> / / <nl> + / / The PyObject * feed_dict must be a dictionary mapping strings to <nl> + / / NumPy arrays . This function does not modify its reference count . <nl> + / / <nl> / / On success , the tensors corresponding to output_names [ 0 , noutputs - 1 ] <nl> / / are placed in out_values [ ] , and these outputs [ ] become the property <nl> / / of the caller ( the caller must eventually call Py_DECREF on them ) . <nl> Safe_PyObjectPtr make_safe ( PyObject * o ) ; <nl> / / On failure , out_status contains a tensorflow : : Status with an error <nl> / / message . <nl> void TF_Run_wrapper ( TF_Session * session , const TF_Buffer * run_options , <nl> - const FeedVector & inputs , const NameVector & output_names , <nl> + PyObject * feed_dict , const NameVector & output_names , <nl> const NameVector & target_nodes , TF_Status * out_status , <nl> PyObjectVector * out_values , TF_Buffer * run_outputs ) ; <nl> <nl> void TF_PRunSetup_wrapper ( TF_Session * session , const NameVector & input_names , <nl> / / Continue to run the graph with additional feeds and fetches . The <nl> / / execution state is uniquely identified by the handle . <nl> / / <nl> + / / The PyObject * feed_dict must be a dictionary mapping strings to <nl> + / / NumPy arrays . This function does not modify its reference count . <nl> + / / <nl> / / On success , the tensors corresponding to output_names [ 0 , noutputs - 1 ] <nl> / / are placed in out_values [ ] , and these outputs [ ] become the property <nl> / / of the caller ( the caller must eventually call Py_DECREF on them ) . <nl> void TF_PRunSetup_wrapper ( TF_Session * session , const NameVector & input_names , <nl> / / <nl> / / NOTE : This is EXPERIMENTAL and subject to change . <nl> void TF_PRun_wrapper ( TF_Session * session , const char * handle , <nl> - const FeedVector & inputs , const NameVector & output_names , <nl> + PyObject * feed_dict , const NameVector & output_names , <nl> TF_Status * out_status , PyObjectVector * out_values ) ; <nl> <nl> / / Wrapper for TF_Reset that converts the string vectors to character arrays . <nl> mmm a / tensorflow / python / client / timeline . py <nl> ppp b / tensorflow / python / client / timeline . py <nl> <nl> import copy <nl> import json <nl> <nl> - import six # pylint : disable = unused - import <nl> - <nl> # The timeline target is usually imported as part of BUILD target <nl> # " platform_test " , which includes also includes the " platform " <nl> # dependency . This is why the logging import here is okay . <nl> mmm a / tensorflow / python / framework / errors . py <nl> ppp b / tensorflow / python / framework / errors . py <nl> def node_def ( self ) : <nl> <nl> def __str__ ( self ) : <nl> if self . _op is not None : <nl> - output = [ " % s \ nCaused by op % r , defined at : \ n " <nl> - % ( self . message , self . _op . name , ) ] <nl> + output = [ " % s \ n \ nCaused by op % r , defined at : \ n " % ( self . message , <nl> + self . _op . name , ) ] <nl> curr_traceback_list = traceback . format_list ( self . _op . traceback ) <nl> output . extend ( curr_traceback_list ) <nl> original_op = self . _op . _original_op <nl> def __str__ ( self ) : <nl> output . extend ( line ) <nl> <nl> original_op = original_op . _original_op <nl> + output . append ( " \ n % s ( see above for traceback ) : % s \ n " % <nl> + ( type ( self ) . __name__ , self . message ) ) <nl> return ' ' . join ( output ) <nl> else : <nl> return self . message <nl> mmm a / tensorflow / python / framework / load_library . py <nl> ppp b / tensorflow / python / framework / load_library . py <nl> <nl> import sys <nl> import threading <nl> <nl> - from six . moves . builtins import bytes # pylint : disable = redefined - builtin <nl> - <nl> from tensorflow . core . framework import op_def_pb2 <nl> from tensorflow . core . lib . core import error_codes_pb2 <nl> from tensorflow . python import pywrap_tensorflow as py_tf <nl> mmm a / tensorflow / python / kernel_tests / BUILD <nl> ppp b / tensorflow / python / kernel_tests / BUILD <nl> package ( <nl> <nl> licenses ( [ " notice " ] ) # Apache 2 . 0 <nl> <nl> - load ( " / / tensorflow : tensorflow . bzl " , " py_tests " ) <nl> load ( " / / tensorflow : tensorflow . bzl " , " tf_py_test " ) <nl> - load ( " / / tensorflow : tensorflow . bzl " , " cuda_py_tests " ) <nl> load ( " / / tensorflow : tensorflow . bzl " , " cuda_py_test " ) <nl> <nl> - py_tests ( <nl> - name = " cpu_only_kernel_tests " , <nl> - size = " small " , <nl> - srcs = [ <nl> - " as_string_op_test . py " , <nl> - " attention_ops_test . py " , <nl> - " barrier_ops_test . py " , <nl> - " base64_ops_test . py " , <nl> - " bcast_ops_test . py " , <nl> - " benchmark_test . py " , <nl> - " candidate_sampler_ops_test . py " , <nl> - " cholesky_op_test . py " , <nl> - " clip_ops_test . py " , <nl> - " ctc_decoder_ops_test . py " , <nl> - " ctc_loss_op_test . py " , <nl> - " decode_csv_op_test . py " , <nl> - " decode_png_op_test . py " , <nl> - " decode_raw_op_test . py " , <nl> - " determinant_op_test . py " , <nl> - " edit_distance_op_test . py " , <nl> - " fifo_queue_test . py " , <nl> - " fractional_avg_pool_op_test . py " , <nl> - " fractional_max_pool_op_test . py " , <nl> - " identity_op_py_test . py " , <nl> - " in_topk_op_test . py " , <nl> - " io_ops_test . py " , <nl> - " listdiff_op_test . py " , <nl> - " logging_ops_test . py " , <nl> - " matrix_inverse_op_test . py " , <nl> - " matrix_solve_ls_op_test . py " , <nl> - " matrix_solve_op_test . py " , <nl> - " matrix_triangular_solve_op_test . py " , <nl> - " parameterized_truncated_normal_op_test . py " , <nl> - " parsing_ops_test . py " , <nl> - " partitioned_variables_test . py " , <nl> - " priority_queue_test . py " , <nl> - " random_shuffle_queue_test . py " , <nl> - " save_restore_ops_test . py " , <nl> - " segment_reduction_ops_test . py " , <nl> - " sparse_add_op_test . py " , <nl> - " sparse_concat_op_test . py " , <nl> - " sparse_reorder_op_test . py " , <nl> - " sparse_reshape_op_test . py " , <nl> - " sparse_split_op_test . py " , <nl> - " sparse_to_dense_op_py_test . py " , <nl> - " sparsemask_op_test . py " , <nl> - " string_join_op_test . py " , <nl> - " string_split_op_test . py " , <nl> - " summary_ops_test . py " , <nl> - " summary_tensor_op_test . py " , <nl> - " template_test . py " , <nl> - " topk_op_test . py " , <nl> - " unique_op_test . py " , <nl> - " variable_scope_test . py " , <nl> - " variables_test . py " , <nl> - " where_op_test . py " , <nl> - ] , <nl> - additional_deps = [ <nl> - " / / tensorflow : tensorflow_py " , <nl> - ] , <nl> - ) <nl> - <nl> - cuda_py_tests ( <nl> + # CPU only tests should use tf_py_test , GPU tests use cuda_py_test <nl> + # Please avoid the py_tests and cuda_py_tests ( plural ) while we <nl> + # fix the shared / overbroad dependencies . <nl> + <nl> + tf_py_test ( <nl> + name = " as_string_op_test " , <nl> + size = " small " , <nl> + srcs = [ " as_string_op_test . py " ] , <nl> + additional_deps = [ " / / tensorflow : tensorflow_py " ] , <nl> + ) <nl> + <nl> + tf_py_test ( <nl> + name = " attention_ops_test " , <nl> + size = " small " , <nl> + srcs = [ " attention_ops_test . py " ] , <nl> + additional_deps = [ " / / tensorflow : tensorflow_py " ] , <nl> + ) <nl> + <nl> + tf_py_test ( <nl> + name = " barrier_ops_test " , <nl> + size = " small " , <nl> + srcs = [ " barrier_ops_test . py " ] , <nl> + additional_deps = [ " / / tensorflow : tensorflow_py " ] , <nl> + ) <nl> + <nl> + tf_py_test ( <nl> + name = " base64_ops_test " , <nl> + size = " small " , <nl> + srcs = [ " base64_ops_test . py " ] , <nl> + additional_deps = [ " / / tensorflow : tensorflow_py " ] , <nl> + ) <nl> + <nl> + tf_py_test ( <nl> + name = " bcast_ops_test " , <nl> + size = " small " , <nl> + srcs = [ " bcast_ops_test . py " ] , <nl> + additional_deps = [ " / / tensorflow : tensorflow_py " ] , <nl> + ) <nl> + <nl> + tf_py_test ( <nl> + name = " benchmark_test " , <nl> + size = " small " , <nl> + srcs = [ " benchmark_test . py " ] , <nl> + additional_deps = [ " / / tensorflow : tensorflow_py " ] , <nl> + ) <nl> + <nl> + tf_py_test ( <nl> + name = " candidate_sampler_ops_test " , <nl> + size = " small " , <nl> + srcs = [ " candidate_sampler_ops_test . py " ] , <nl> + additional_deps = [ " / / tensorflow : tensorflow_py " ] , <nl> + ) <nl> + <nl> + tf_py_test ( <nl> + name = " cholesky_op_test " , <nl> + size = " small " , <nl> + srcs = [ " cholesky_op_test . py " ] , <nl> + additional_deps = [ " / / tensorflow : tensorflow_py " ] , <nl> + ) <nl> + <nl> + tf_py_test ( <nl> + name = " clip_ops_test " , <nl> + size = " small " , <nl> + srcs = [ " clip_ops_test . py " ] , <nl> + additional_deps = [ " / / tensorflow : tensorflow_py " ] , <nl> + ) <nl> + <nl> + tf_py_test ( <nl> + name = " ctc_decoder_ops_test " , <nl> + size = " small " , <nl> + srcs = [ " ctc_decoder_ops_test . py " ] , <nl> + additional_deps = [ " / / tensorflow : tensorflow_py " ] , <nl> + ) <nl> + <nl> + tf_py_test ( <nl> + name = " ctc_loss_op_test " , <nl> + size = " small " , <nl> + srcs = [ " ctc_loss_op_test . py " ] , <nl> + additional_deps = [ " / / tensorflow : tensorflow_py " ] , <nl> + ) <nl> + <nl> + tf_py_test ( <nl> + name = " decode_csv_op_test " , <nl> + size = " small " , <nl> + srcs = [ " decode_csv_op_test . py " ] , <nl> + additional_deps = [ " / / tensorflow : tensorflow_py " ] , <nl> + ) <nl> + <nl> + tf_py_test ( <nl> + name = " decode_png_op_test " , <nl> + size = " small " , <nl> + srcs = [ " decode_png_op_test . py " ] , <nl> + additional_deps = [ " / / tensorflow : tensorflow_py " ] , <nl> + ) <nl> + <nl> + tf_py_test ( <nl> + name = " decode_raw_op_test " , <nl> + size = " small " , <nl> + srcs = [ " decode_raw_op_test . py " ] , <nl> + additional_deps = [ " / / tensorflow : tensorflow_py " ] , <nl> + ) <nl> + <nl> + tf_py_test ( <nl> + name = " determinant_op_test " , <nl> + size = " small " , <nl> + srcs = [ " determinant_op_test . py " ] , <nl> + additional_deps = [ " / / tensorflow : tensorflow_py " ] , <nl> + ) <nl> + <nl> + tf_py_test ( <nl> + name = " edit_distance_op_test " , <nl> + size = " small " , <nl> + srcs = [ " edit_distance_op_test . py " ] , <nl> + additional_deps = [ " / / tensorflow : tensorflow_py " ] , <nl> + ) <nl> + <nl> + tf_py_test ( <nl> + name = " fifo_queue_test " , <nl> + size = " small " , <nl> + srcs = [ " fifo_queue_test . py " ] , <nl> + additional_deps = [ " / / tensorflow : tensorflow_py " ] , <nl> + ) <nl> + <nl> + tf_py_test ( <nl> + name = " fractional_avg_pool_op_test " , <nl> + size = " small " , <nl> + srcs = [ " fractional_avg_pool_op_test . py " ] , <nl> + additional_deps = [ " / / tensorflow : tensorflow_py " ] , <nl> + ) <nl> + <nl> + tf_py_test ( <nl> + name = " fractional_max_pool_op_test " , <nl> + size = " small " , <nl> + srcs = [ " fractional_max_pool_op_test . py " ] , <nl> + additional_deps = [ " / / tensorflow : tensorflow_py " ] , <nl> + ) <nl> + <nl> + tf_py_test ( <nl> + name = " identity_op_py_test " , <nl> + size = " small " , <nl> + srcs = [ " identity_op_py_test . py " ] , <nl> + additional_deps = [ " / / tensorflow : tensorflow_py " ] , <nl> + ) <nl> + <nl> + tf_py_test ( <nl> + name = " in_topk_op_test " , <nl> + size = " small " , <nl> + srcs = [ " in_topk_op_test . py " ] , <nl> + additional_deps = [ " / / tensorflow : tensorflow_py " ] , <nl> + ) <nl> + <nl> + tf_py_test ( <nl> + name = " io_ops_test " , <nl> + size = " small " , <nl> + srcs = [ " io_ops_test . py " ] , <nl> + additional_deps = [ " / / tensorflow : tensorflow_py " ] , <nl> + ) <nl> + <nl> + tf_py_test ( <nl> + name = " listdiff_op_test " , <nl> + size = " small " , <nl> + srcs = [ " listdiff_op_test . py " ] , <nl> + additional_deps = [ " / / tensorflow : tensorflow_py " ] , <nl> + ) <nl> + <nl> + tf_py_test ( <nl> + name = " logging_ops_test " , <nl> + size = " small " , <nl> + srcs = [ " logging_ops_test . py " ] , <nl> + additional_deps = [ " / / tensorflow : tensorflow_py " ] , <nl> + ) <nl> + <nl> + tf_py_test ( <nl> + name = " matrix_inverse_op_test " , <nl> + size = " small " , <nl> + srcs = [ " matrix_inverse_op_test . py " ] , <nl> + additional_deps = [ " / / tensorflow : tensorflow_py " ] , <nl> + ) <nl> + <nl> + tf_py_test ( <nl> + name = " matrix_solve_ls_op_test " , <nl> + size = " small " , <nl> + srcs = [ " matrix_solve_ls_op_test . py " ] , <nl> + additional_deps = [ " / / tensorflow : tensorflow_py " ] , <nl> + ) <nl> + <nl> + tf_py_test ( <nl> + name = " matrix_solve_op_test " , <nl> + size = " small " , <nl> + srcs = [ " matrix_solve_op_test . py " ] , <nl> + additional_deps = [ " / / tensorflow : tensorflow_py " ] , <nl> + ) <nl> + <nl> + tf_py_test ( <nl> + name = " matrix_triangular_solve_op_test " , <nl> + size = " small " , <nl> + srcs = [ " matrix_triangular_solve_op_test . py " ] , <nl> + additional_deps = [ " / / tensorflow : tensorflow_py " ] , <nl> + ) <nl> + <nl> + tf_py_test ( <nl> + name = " parameterized_truncated_normal_op_test " , <nl> + size = " small " , <nl> + srcs = [ " parameterized_truncated_normal_op_test . py " ] , <nl> + additional_deps = [ " / / tensorflow : tensorflow_py " ] , <nl> + ) <nl> + <nl> + tf_py_test ( <nl> + name = " parsing_ops_test " , <nl> + size = " small " , <nl> + srcs = [ " parsing_ops_test . py " ] , <nl> + additional_deps = [ " / / tensorflow : tensorflow_py " ] , <nl> + ) <nl> + <nl> + tf_py_test ( <nl> + name = " partitioned_variables_test " , <nl> + size = " small " , <nl> + srcs = [ " partitioned_variables_test . py " ] , <nl> + additional_deps = [ " / / tensorflow : tensorflow_py " ] , <nl> + ) <nl> + <nl> + tf_py_test ( <nl> + name = " priority_queue_test " , <nl> + size = " small " , <nl> + srcs = [ " priority_queue_test . py " ] , <nl> + additional_deps = [ " / / tensorflow : tensorflow_py " ] , <nl> + ) <nl> + <nl> + tf_py_test ( <nl> + name = " random_shuffle_queue_test " , <nl> + size = " small " , <nl> + srcs = [ " random_shuffle_queue_test . py " ] , <nl> + additional_deps = [ " / / tensorflow : tensorflow_py " ] , <nl> + ) <nl> + <nl> + tf_py_test ( <nl> + name = " save_restore_ops_test " , <nl> + size = " small " , <nl> + srcs = [ " save_restore_ops_test . py " ] , <nl> + additional_deps = [ " / / tensorflow : tensorflow_py " ] , <nl> + ) <nl> + <nl> + tf_py_test ( <nl> + name = " segment_reduction_ops_test " , <nl> + size = " small " , <nl> + srcs = [ " segment_reduction_ops_test . py " ] , <nl> + additional_deps = [ " / / tensorflow : tensorflow_py " ] , <nl> + ) <nl> + <nl> + tf_py_test ( <nl> + name = " sparse_add_op_test " , <nl> + size = " small " , <nl> + srcs = [ " sparse_add_op_test . py " ] , <nl> + additional_deps = [ " / / tensorflow : tensorflow_py " ] , <nl> + ) <nl> + <nl> + tf_py_test ( <nl> + name = " sparse_concat_op_test " , <nl> + size = " small " , <nl> + srcs = [ " sparse_concat_op_test . py " ] , <nl> + additional_deps = [ " / / tensorflow : tensorflow_py " ] , <nl> + ) <nl> + <nl> + tf_py_test ( <nl> + name = " sparse_reorder_op_test " , <nl> + size = " small " , <nl> + srcs = [ " sparse_reorder_op_test . py " ] , <nl> + additional_deps = [ " / / tensorflow : tensorflow_py " ] , <nl> + ) <nl> + <nl> + tf_py_test ( <nl> + name = " sparse_reshape_op_test " , <nl> + size = " small " , <nl> + srcs = [ " sparse_reshape_op_test . py " ] , <nl> + additional_deps = [ " / / tensorflow : tensorflow_py " ] , <nl> + ) <nl> + <nl> + tf_py_test ( <nl> + name = " sparse_split_op_test " , <nl> + size = " small " , <nl> + srcs = [ " sparse_split_op_test . py " ] , <nl> + additional_deps = [ " / / tensorflow : tensorflow_py " ] , <nl> + ) <nl> + <nl> + tf_py_test ( <nl> + name = " sparse_to_dense_op_py_test " , <nl> + size = " small " , <nl> + srcs = [ " sparse_to_dense_op_py_test . py " ] , <nl> + additional_deps = [ " / / tensorflow : tensorflow_py " ] , <nl> + ) <nl> + <nl> + tf_py_test ( <nl> + name = " sparsemask_op_test " , <nl> + size = " small " , <nl> + srcs = [ " sparsemask_op_test . py " ] , <nl> + additional_deps = [ " / / tensorflow : tensorflow_py " ] , <nl> + ) <nl> + <nl> + tf_py_test ( <nl> + name = " string_join_op_test " , <nl> + size = " small " , <nl> + srcs = [ " string_join_op_test . py " ] , <nl> + additional_deps = [ " / / tensorflow : tensorflow_py " ] , <nl> + ) <nl> + <nl> + tf_py_test ( <nl> + name = " string_split_op_test " , <nl> + size = " small " , <nl> + srcs = [ " string_split_op_test . py " ] , <nl> + additional_deps = [ " / / tensorflow : tensorflow_py " ] , <nl> + ) <nl> + <nl> + tf_py_test ( <nl> + name = " summary_ops_test " , <nl> + size = " small " , <nl> + srcs = [ " summary_ops_test . py " ] , <nl> + additional_deps = [ " / / tensorflow : tensorflow_py " ] , <nl> + ) <nl> + <nl> + tf_py_test ( <nl> + name = " summary_tensor_op_test " , <nl> + size = " small " , <nl> + srcs = [ " summary_tensor_op_test . py " ] , <nl> + additional_deps = [ " / / tensorflow : tensorflow_py " ] , <nl> + ) <nl> + <nl> + tf_py_test ( <nl> + name = " template_test " , <nl> + size = " small " , <nl> + srcs = [ " template_test . py " ] , <nl> + additional_deps = [ " / / tensorflow : tensorflow_py " ] , <nl> + ) <nl> + <nl> + tf_py_test ( <nl> + name = " topk_op_test " , <nl> + size = " small " , <nl> + srcs = [ " topk_op_test . py " ] , <nl> + additional_deps = [ " / / tensorflow : tensorflow_py " ] , <nl> + ) <nl> + <nl> + tf_py_test ( <nl> + name = " unique_op_test " , <nl> + size = " small " , <nl> + srcs = [ " unique_op_test . py " ] , <nl> + additional_deps = [ " / / tensorflow : tensorflow_py " ] , <nl> + ) <nl> + <nl> + tf_py_test ( <nl> + name = " variable_scope_test " , <nl> + size = " small " , <nl> + srcs = [ " variable_scope_test . py " ] , <nl> + additional_deps = [ " / / tensorflow : tensorflow_py " ] , <nl> + ) <nl> + <nl> + tf_py_test ( <nl> + name = " variables_test " , <nl> + size = " small " , <nl> + srcs = [ " variables_test . py " ] , <nl> + additional_deps = [ " / / tensorflow : tensorflow_py " ] , <nl> + ) <nl> + <nl> + tf_py_test ( <nl> + name = " where_op_test " , <nl> + size = " small " , <nl> + srcs = [ " where_op_test . py " ] , <nl> + additional_deps = [ " / / tensorflow : tensorflow_py " ] , <nl> + ) <nl> + <nl> + cuda_py_test ( <nl> name = " cast_op_test " , <nl> size = " small " , <nl> srcs = [ " cast_op_test . py " ] , <nl> tf_py_test ( <nl> shard_count = 2 , <nl> ) <nl> <nl> - py_tests ( <nl> + tf_py_test ( <nl> name = " reader_ops_test " , <nl> size = " small " , <nl> srcs = [ " reader_ops_test . py " ] , <nl> py_tests ( <nl> ] , <nl> ) <nl> <nl> - cuda_py_tests ( <nl> - name = " kernel_tests " , <nl> - size = " small " , <nl> - srcs = [ <nl> - " argmax_op_test . py " , <nl> - " batch_matmul_op_test . py " , <nl> - " batchtospace_op_test . py " , <nl> - " betainc_op_test . py " , <nl> - " bias_op_test . py " , <nl> - " bitcast_op_test . py " , <nl> - " check_ops_test . py " , <nl> - " constant_op_test . py " , <nl> - " control_flow_ops_py_test . py " , <nl> - " conv1d_test . py " , <nl> - " conv2d_transpose_test . py " , <nl> - " conv3d_backprop_filter_v2_grad_test . py " , <nl> - " cross_grad_test . py " , <nl> - " denormal_test . py " , <nl> - " dense_update_ops_test . py " , <nl> - " depthtospace_op_test . py " , <nl> - " division_past_test . py " , <nl> - " dynamic_partition_op_test . py " , <nl> - " dynamic_stitch_op_test . py " , <nl> - " extract_image_patches_op_test . py " , <nl> - " functional_ops_test . py " , <nl> - " gather_nd_op_test . py " , <nl> - " gather_op_test . py " , <nl> - " gradient_correctness_test . py " , <nl> - " init_ops_test . py " , <nl> - " linalg_ops_test . py " , <nl> - " lrn_op_test . py " , <nl> - " matmul_op_test . py " , <nl> - " morphological_ops_test . py " , <nl> - " multinomial_op_test . py " , <nl> - " numerics_test . py " , <nl> - " one_hot_op_test . py " , <nl> - " pack_op_test . py " , <nl> - " pad_op_test . py " , <nl> - " padding_fifo_queue_test . py " , <nl> - " py_func_test . py " , <nl> - " random_crop_test . py " , <nl> - " random_ops_test . py " , <nl> - " reduce_join_op_test . py " , <nl> - " relu_op_test . py " , <nl> - " reshape_op_test . py " , <nl> - " reverse_sequence_op_test . py " , <nl> - " rnn_cell_test . py " , <nl> - " scalar_strict_test . py " , <nl> - " session_ops_test . py " , <nl> - " shape_ops_test . py " , <nl> - " softmax_op_test . py " , <nl> - " softplus_op_test . py " , <nl> - " softsign_op_test . py " , <nl> - " spacetobatch_op_test . py " , <nl> - " spacetodepth_op_test . py " , <nl> - " sparse_serialization_ops_test . py " , <nl> - " sparse_tensor_dense_matmul_grad_test . py " , <nl> - " sparse_xent_op_test . py " , <nl> - " split_op_test . py " , <nl> - " stack_ops_test . py " , <nl> - " string_to_hash_bucket_op_test . py " , <nl> - " string_to_number_op_test . py " , <nl> - " summary_audio_op_test . py " , <nl> - " summary_image_op_test . py " , <nl> - " tensor_array_ops_test . py " , <nl> - " trace_op_test . py " , <nl> - " transpose_op_test . py " , <nl> - " unpack_op_test . py " , <nl> - " variable_ops_test . py " , <nl> - " xent_op_test . py " , <nl> - " zero_division_test . py " , <nl> - ] , <nl> - additional_deps = [ <nl> - " / / tensorflow : tensorflow_py " , <nl> - ] , <nl> - ) <nl> - <nl> - cuda_py_tests ( <nl> - name = " medium_kernel_tests " , <nl> - size = " medium " , <nl> - srcs = [ <nl> - " array_ops_test . py " , <nl> - " atrous_conv2d_test . py " , <nl> - " conv2d_backprop_filter_grad_test . py " , <nl> - " conv3d_transpose_test . py " , <nl> - " conv_ops_test . py " , <nl> - " depthwise_conv_op_test . py " , # http : / / b / 30603882 <nl> - " division_future_test . py " , <nl> - " fft_ops_test . py " , <nl> - " pooling_ops_3d_test . py " , # http : / / b / 30600785 <nl> - " pooling_ops_test . py " , <nl> - " random_gamma_test . py " , <nl> - " reduction_ops_test . py " , <nl> - " rnn_test . py " , <nl> - " scan_ops_test . py " , <nl> - " seq2seq_test . py " , <nl> - " slice_op_test . py " , <nl> - " sparse_matmul_op_test . py " , <nl> - " sparse_ops_test . py " , <nl> - " sparse_tensor_dense_matmul_op_test . py " , <nl> + cuda_py_test ( <nl> + name = " argmax_op_test " , <nl> + size = " small " , <nl> + srcs = [ " argmax_op_test . py " ] , <nl> + additional_deps = [ <nl> + " / / tensorflow : tensorflow_py " , <nl> ] , <nl> + ) <nl> + <nl> + cuda_py_test ( <nl> + name = " array_ops_test " , <nl> + size = " medium " , <nl> + srcs = [ " array_ops_test . py " ] , <nl> additional_deps = [ <nl> " / / tensorflow : tensorflow_py " , <nl> ] , <nl> ) <nl> <nl> - cuda_py_tests ( <nl> - name = " large_kernel_tests " , <nl> - size = " large " , <nl> - srcs = [ <nl> - " scatter_ops_test . py " , <nl> + cuda_py_test ( <nl> + name = " batch_matmul_op_test " , <nl> + size = " small " , <nl> + srcs = [ " batch_matmul_op_test . py " ] , <nl> + additional_deps = [ <nl> + " / / tensorflow : tensorflow_py " , <nl> ] , <nl> + ) <nl> + <nl> + cuda_py_test ( <nl> + name = " batchtospace_op_test " , <nl> + size = " small " , <nl> + srcs = [ " batchtospace_op_test . py " ] , <nl> additional_deps = [ <nl> " / / tensorflow : tensorflow_py " , <nl> ] , <nl> ) <nl> <nl> - # TODO ( gpapan ) : Revisit the gradient of extract_image_patches_op to resolve <nl> - # http : / / b / 31080670 . <nl> cuda_py_test ( <nl> - name = " extract_image_patches_grad_test " , <nl> - size = " medium " , <nl> - srcs = [ " extract_image_patches_grad_test . py " ] , <nl> + name = " betainc_op_test " , <nl> + size = " small " , <nl> + srcs = [ " betainc_op_test . py " ] , <nl> additional_deps = [ <nl> " / / tensorflow : tensorflow_py " , <nl> ] , <nl> - tags = [ " notap " ] , # http : / / b / 31080670 <nl> ) <nl> <nl> cuda_py_test ( <nl> - name = " concat_op_test " , <nl> - size = " medium " , <nl> - srcs = [ " concat_op_test . py " ] , <nl> + name = " bias_op_test " , <nl> + size = " small " , <nl> + srcs = [ " bias_op_test . py " ] , <nl> additional_deps = [ <nl> " / / tensorflow : tensorflow_py " , <nl> ] , <nl> - tags = [ " notsan " ] , # http : / / b / 30445083 <nl> ) <nl> <nl> - cuda_py_tests ( <nl> - name = " kernel_tests_with_sharding " , <nl> - size = " medium " , <nl> - srcs = [ <nl> - " conv_ops_3d_test . py " , <nl> - " embedding_ops_test . py " , <nl> - " linalg_grad_test . py " , <nl> - " matrix_band_part_op_test . py " , <nl> - " self_adjoint_eig_op_test . py " , <nl> - " svd_op_test . py " , <nl> + cuda_py_test ( <nl> + name = " bitcast_op_test " , <nl> + size = " small " , <nl> + srcs = [ " bitcast_op_test . py " ] , <nl> + additional_deps = [ <nl> + " / / tensorflow : tensorflow_py " , <nl> ] , <nl> + ) <nl> + <nl> + cuda_py_test ( <nl> + name = " check_ops_test " , <nl> + size = " small " , <nl> + srcs = [ " check_ops_test . py " ] , <nl> additional_deps = [ <nl> " / / tensorflow : tensorflow_py " , <nl> ] , <nl> - shard_count = 20 , <nl> ) <nl> <nl> cuda_py_test ( <nl> - name = " cwise_ops_test " , <nl> - size = " medium " , <nl> - srcs = [ " cwise_ops_test . py " ] , <nl> + name = " constant_op_test " , <nl> + size = " small " , <nl> + srcs = [ " constant_op_test . py " ] , <nl> additional_deps = [ <nl> " / / tensorflow : tensorflow_py " , <nl> ] , <nl> - shard_count = 50 , <nl> - tags = [ " notap " ] , # http : / / b / 30226163 <nl> + ) <nl> + <nl> + cuda_py_test ( <nl> + name = " control_flow_ops_py_test " , <nl> + size = " small " , <nl> + srcs = [ " control_flow_ops_py_test . py " ] , <nl> + additional_deps = [ <nl> + " / / tensorflow : tensorflow_py " , <nl> + ] , <nl> + ) <nl> + <nl> + cuda_py_test ( <nl> + name = " conv1d_test " , <nl> + size = " small " , <nl> + srcs = [ " conv1d_test . py " ] , <nl> + additional_deps = [ <nl> + " / / tensorflow : tensorflow_py " , <nl> + ] , <nl> + ) <nl> + <nl> + cuda_py_test ( <nl> + name = " conv2d_transpose_test " , <nl> + size = " small " , <nl> + srcs = [ " conv2d_transpose_test . py " ] , <nl> + additional_deps = [ <nl> + " / / tensorflow : tensorflow_py " , <nl> + ] , <nl> + ) <nl> + <nl> + cuda_py_test ( <nl> + name = " conv3d_backprop_filter_v2_grad_test " , <nl> + size = " small " , <nl> + srcs = [ " conv3d_backprop_filter_v2_grad_test . py " ] , <nl> + additional_deps = [ <nl> + " / / tensorflow : tensorflow_py " , <nl> + ] , <nl> + ) <nl> + <nl> + cuda_py_test ( <nl> + name = " cross_grad_test " , <nl> + size = " small " , <nl> + srcs = [ " cross_grad_test . py " ] , <nl> + additional_deps = [ <nl> + " / / tensorflow : tensorflow_py " , <nl> + ] , <nl> + ) <nl> + <nl> + cuda_py_test ( <nl> + name = " denormal_test " , <nl> + size = " small " , <nl> + srcs = [ " denormal_test . py " ] , <nl> + additional_deps = [ <nl> + " / / tensorflow : tensorflow_py " , <nl> + ] , <nl> + ) <nl> + <nl> + cuda_py_test ( <nl> + name = " dense_update_ops_test " , <nl> + size = " small " , <nl> + srcs = [ " dense_update_ops_test . py " ] , <nl> + additional_deps = [ <nl> + " / / tensorflow : tensorflow_py " , <nl> + ] , <nl> + ) <nl> + <nl> + cuda_py_test ( <nl> + name = " depthtospace_op_test " , <nl> + size = " small " , <nl> + srcs = [ " depthtospace_op_test . py " ] , <nl> + additional_deps = [ <nl> + " / / tensorflow : tensorflow_py " , <nl> + ] , <nl> + ) <nl> + <nl> + cuda_py_test ( <nl> + name = " division_past_test " , <nl> + size = " small " , <nl> + srcs = [ " division_past_test . py " ] , <nl> + additional_deps = [ <nl> + " / / tensorflow : tensorflow_py " , <nl> + ] , <nl> + ) <nl> + <nl> + cuda_py_test ( <nl> + name = " dynamic_partition_op_test " , <nl> + size = " small " , <nl> + srcs = [ " dynamic_partition_op_test . py " ] , <nl> + additional_deps = [ <nl> + " / / tensorflow : tensorflow_py " , <nl> + ] , <nl> + ) <nl> + <nl> + cuda_py_test ( <nl> + name = " dynamic_stitch_op_test " , <nl> + size = " small " , <nl> + srcs = [ " dynamic_stitch_op_test . py " ] , <nl> + additional_deps = [ <nl> + " / / tensorflow : tensorflow_py " , <nl> + ] , <nl> + ) <nl> + <nl> + cuda_py_test ( <nl> + name = " extract_image_patches_op_test " , <nl> + size = " small " , <nl> + srcs = [ " extract_image_patches_op_test . py " ] , <nl> + additional_deps = [ <nl> + " / / tensorflow : tensorflow_py " , <nl> + ] , <nl> + ) <nl> + <nl> + cuda_py_test ( <nl> + name = " functional_ops_test " , <nl> + size = " small " , <nl> + srcs = [ " functional_ops_test . py " ] , <nl> + additional_deps = [ <nl> + " / / tensorflow : tensorflow_py " , <nl> + ] , <nl> + ) <nl> + <nl> + cuda_py_test ( <nl> + name = " gather_nd_op_test " , <nl> + size = " small " , <nl> + srcs = [ " gather_nd_op_test . py " ] , <nl> + additional_deps = [ <nl> + " / / tensorflow : tensorflow_py " , <nl> + ] , <nl> + ) <nl> + <nl> + cuda_py_test ( <nl> + name = " gather_op_test " , <nl> + size = " small " , <nl> + srcs = [ " gather_op_test . py " ] , <nl> + additional_deps = [ <nl> + " / / tensorflow : tensorflow_py " , <nl> + ] , <nl> + ) <nl> + <nl> + cuda_py_test ( <nl> + name = " gradient_correctness_test " , <nl> + size = " small " , <nl> + srcs = [ " gradient_correctness_test . py " ] , <nl> + additional_deps = [ <nl> + " / / tensorflow : tensorflow_py " , <nl> + ] , <nl> + ) <nl> + <nl> + cuda_py_test ( <nl> + name = " init_ops_test " , <nl> + size = " small " , <nl> + srcs = [ " init_ops_test . py " ] , <nl> + additional_deps = [ <nl> + " / / tensorflow : tensorflow_py " , <nl> + ] , <nl> + ) <nl> + <nl> + cuda_py_test ( <nl> + name = " linalg_ops_test " , <nl> + size = " small " , <nl> + srcs = [ " linalg_ops_test . py " ] , <nl> + additional_deps = [ <nl> + " / / tensorflow : tensorflow_py " , <nl> + ] , <nl> + ) <nl> + <nl> + cuda_py_test ( <nl> + name = " lrn_op_test " , <nl> + size = " small " , <nl> + srcs = [ " lrn_op_test . py " ] , <nl> + additional_deps = [ <nl> + " / / tensorflow : tensorflow_py " , <nl> + ] , <nl> + ) <nl> + <nl> + cuda_py_test ( <nl> + name = " matmul_op_test " , <nl> + size = " small " , <nl> + srcs = [ " matmul_op_test . py " ] , <nl> + additional_deps = [ <nl> + " / / tensorflow : tensorflow_py " , <nl> + ] , <nl> + ) <nl> + <nl> + cuda_py_test ( <nl> + name = " morphological_ops_test " , <nl> + size = " small " , <nl> + srcs = [ " morphological_ops_test . py " ] , <nl> + additional_deps = [ <nl> + " / / tensorflow : tensorflow_py " , <nl> + ] , <nl> + ) <nl> + <nl> + cuda_py_test ( <nl> + name = " multinomial_op_test " , <nl> + size = " small " , <nl> + srcs = [ " multinomial_op_test . py " ] , <nl> + additional_deps = [ <nl> + " / / tensorflow : tensorflow_py " , <nl> + ] , <nl> + ) <nl> + <nl> + cuda_py_test ( <nl> + name = " numerics_test " , <nl> + size = " small " , <nl> + srcs = [ " numerics_test . py " ] , <nl> + additional_deps = [ <nl> + " / / tensorflow : tensorflow_py " , <nl> + ] , <nl> + ) <nl> + <nl> + cuda_py_test ( <nl> + name = " one_hot_op_test " , <nl> + size = " small " , <nl> + srcs = [ " one_hot_op_test . py " ] , <nl> + additional_deps = [ <nl> + " / / tensorflow : tensorflow_py " , <nl> + ] , <nl> + ) <nl> + <nl> + cuda_py_test ( <nl> + name = " pack_op_test " , <nl> + size = " small " , <nl> + srcs = [ " pack_op_test . py " ] , <nl> + additional_deps = [ <nl> + " / / tensorflow : tensorflow_py " , <nl> + ] , <nl> + ) <nl> + <nl> + cuda_py_test ( <nl> + name = " pad_op_test " , <nl> + size = " small " , <nl> + srcs = [ " pad_op_test . py " ] , <nl> + additional_deps = [ <nl> + " / / tensorflow : tensorflow_py " , <nl> + ] , <nl> + ) <nl> + <nl> + cuda_py_test ( <nl> + name = " padding_fifo_queue_test " , <nl> + size = " small " , <nl> + srcs = [ " padding_fifo_queue_test . py " ] , <nl> + additional_deps = [ <nl> + " / / tensorflow : tensorflow_py " , <nl> + ] , <nl> + ) <nl> + <nl> + cuda_py_test ( <nl> + name = " py_func_test " , <nl> + size = " small " , <nl> + srcs = [ " py_func_test . py " ] , <nl> + additional_deps = [ <nl> + " / / tensorflow : tensorflow_py " , <nl> + ] , <nl> + ) <nl> + <nl> + cuda_py_test ( <nl> + name = " random_crop_test " , <nl> + size = " small " , <nl> + srcs = [ " random_crop_test . py " ] , <nl> + additional_deps = [ <nl> + " / / tensorflow : tensorflow_py " , <nl> + ] , <nl> + ) <nl> + <nl> + cuda_py_test ( <nl> + name = " random_ops_test " , <nl> + size = " small " , <nl> + srcs = [ " random_ops_test . py " ] , <nl> + additional_deps = [ <nl> + " / / tensorflow : tensorflow_py " , <nl> + ] , <nl> + ) <nl> + <nl> + cuda_py_test ( <nl> + name = " reduce_join_op_test " , <nl> + size = " small " , <nl> + srcs = [ " reduce_join_op_test . py " ] , <nl> + additional_deps = [ <nl> + " / / tensorflow : tensorflow_py " , <nl> + ] , <nl> + ) <nl> + <nl> + cuda_py_test ( <nl> + name = " reduction_ops_test " , <nl> + size = " medium " , <nl> + srcs = [ " reduction_ops_test . py " ] , <nl> + additional_deps = [ <nl> + " / / tensorflow : tensorflow_py " , <nl> + ] , <nl> + ) <nl> + <nl> + cuda_py_test ( <nl> + name = " relu_op_test " , <nl> + size = " small " , <nl> + srcs = [ " relu_op_test . py " ] , <nl> + additional_deps = [ <nl> + " / / tensorflow : tensorflow_py " , <nl> + ] , <nl> + ) <nl> + <nl> + cuda_py_test ( <nl> + name = " reshape_op_test " , <nl> + size = " small " , <nl> + srcs = [ " reshape_op_test . py " ] , <nl> + additional_deps = [ <nl> + " / / tensorflow : tensorflow_py " , <nl> + ] , <nl> + ) <nl> + <nl> + cuda_py_test ( <nl> + name = " reverse_sequence_op_test " , <nl> + size = " small " , <nl> + srcs = [ " reverse_sequence_op_test . py " ] , <nl> + additional_deps = [ <nl> + " / / tensorflow : tensorflow_py " , <nl> + ] , <nl> + ) <nl> + <nl> + cuda_py_test ( <nl> + name = " rnn_cell_test " , <nl> + size = " small " , <nl> + srcs = [ " rnn_cell_test . py " ] , <nl> + additional_deps = [ <nl> + " / / tensorflow : tensorflow_py " , <nl> + ] , <nl> + ) <nl> + <nl> + cuda_py_test ( <nl> + name = " scalar_strict_test " , <nl> + size = " small " , <nl> + srcs = [ " scalar_strict_test . py " ] , <nl> + additional_deps = [ <nl> + " / / tensorflow : tensorflow_py " , <nl> + ] , <nl> + ) <nl> + <nl> + cuda_py_test ( <nl> + name = " scan_ops_test " , <nl> + size = " medium " , <nl> + srcs = [ " scan_ops_test . py " ] , <nl> + additional_deps = [ <nl> + " / / tensorflow : tensorflow_py " , <nl> + ] , <nl> + ) <nl> + <nl> + cuda_py_test ( <nl> + name = " session_ops_test " , <nl> + size = " small " , <nl> + srcs = [ " session_ops_test . py " ] , <nl> + additional_deps = [ <nl> + " / / tensorflow : tensorflow_py " , <nl> + ] , <nl> + ) <nl> + <nl> + cuda_py_test ( <nl> + name = " shape_ops_test " , <nl> + size = " small " , <nl> + srcs = [ " shape_ops_test . py " ] , <nl> + additional_deps = [ <nl> + " / / tensorflow : tensorflow_py " , <nl> + ] , <nl> + ) <nl> + <nl> + cuda_py_test ( <nl> + name = " softmax_op_test " , <nl> + size = " small " , <nl> + srcs = [ " softmax_op_test . py " ] , <nl> + additional_deps = [ <nl> + " / / tensorflow : tensorflow_py " , <nl> + ] , <nl> + ) <nl> + <nl> + cuda_py_test ( <nl> + name = " softplus_op_test " , <nl> + size = " small " , <nl> + srcs = [ " softplus_op_test . py " ] , <nl> + additional_deps = [ <nl> + " / / tensorflow : tensorflow_py " , <nl> + ] , <nl> + ) <nl> + <nl> + cuda_py_test ( <nl> + name = " softsign_op_test " , <nl> + size = " small " , <nl> + srcs = [ " softsign_op_test . py " ] , <nl> + additional_deps = [ <nl> + " / / tensorflow : tensorflow_py " , <nl> + ] , <nl> + ) <nl> + <nl> + cuda_py_test ( <nl> + name = " spacetobatch_op_test " , <nl> + size = " small " , <nl> + srcs = [ " spacetobatch_op_test . py " ] , <nl> + additional_deps = [ <nl> + " / / tensorflow : tensorflow_py " , <nl> + ] , <nl> + ) <nl> + <nl> + cuda_py_test ( <nl> + name = " spacetodepth_op_test " , <nl> + size = " small " , <nl> + srcs = [ " spacetodepth_op_test . py " ] , <nl> + additional_deps = [ <nl> + " / / tensorflow : tensorflow_py " , <nl> + ] , <nl> + ) <nl> + <nl> + cuda_py_test ( <nl> + name = " sparse_serialization_ops_test " , <nl> + size = " small " , <nl> + srcs = [ " sparse_serialization_ops_test . py " ] , <nl> + additional_deps = [ <nl> + " / / tensorflow : tensorflow_py " , <nl> + ] , <nl> + ) <nl> + <nl> + cuda_py_test ( <nl> + name = " sparse_tensor_dense_matmul_grad_test " , <nl> + size = " small " , <nl> + srcs = [ " sparse_tensor_dense_matmul_grad_test . py " ] , <nl> + additional_deps = [ <nl> + " / / tensorflow : tensorflow_py " , <nl> + ] , <nl> + ) <nl> + <nl> + cuda_py_test ( <nl> + name = " sparse_xent_op_test " , <nl> + size = " small " , <nl> + srcs = [ " sparse_xent_op_test . py " ] , <nl> + additional_deps = [ <nl> + " / / tensorflow : tensorflow_py " , <nl> + ] , <nl> + ) <nl> + <nl> + cuda_py_test ( <nl> + name = " split_op_test " , <nl> + size = " small " , <nl> + srcs = [ " split_op_test . py " ] , <nl> + additional_deps = [ <nl> + " / / tensorflow : tensorflow_py " , <nl> + ] , <nl> + ) <nl> + <nl> + cuda_py_test ( <nl> + name = " stack_ops_test " , <nl> + size = " small " , <nl> + srcs = [ " stack_ops_test . py " ] , <nl> + additional_deps = [ <nl> + " / / tensorflow : tensorflow_py " , <nl> + ] , <nl> + ) <nl> + <nl> + cuda_py_test ( <nl> + name = " string_to_hash_bucket_op_test " , <nl> + size = " small " , <nl> + srcs = [ " string_to_hash_bucket_op_test . py " ] , <nl> + additional_deps = [ <nl> + " / / tensorflow : tensorflow_py " , <nl> + ] , <nl> + ) <nl> + <nl> + cuda_py_test ( <nl> + name = " string_to_number_op_test " , <nl> + size = " small " , <nl> + srcs = [ " string_to_number_op_test . py " ] , <nl> + additional_deps = [ <nl> + " / / tensorflow : tensorflow_py " , <nl> + ] , <nl> + ) <nl> + <nl> + cuda_py_test ( <nl> + name = " summary_audio_op_test " , <nl> + size = " small " , <nl> + srcs = [ " summary_audio_op_test . py " ] , <nl> + additional_deps = [ <nl> + " / / tensorflow : tensorflow_py " , <nl> + ] , <nl> + ) <nl> + <nl> + cuda_py_test ( <nl> + name = " summary_image_op_test " , <nl> + size = " small " , <nl> + srcs = [ " summary_image_op_test . py " ] , <nl> + additional_deps = [ <nl> + " / / tensorflow : tensorflow_py " , <nl> + ] , <nl> + ) <nl> + <nl> + cuda_py_test ( <nl> + name = " tensor_array_ops_test " , <nl> + size = " small " , <nl> + srcs = [ " tensor_array_ops_test . py " ] , <nl> + additional_deps = [ <nl> + " / / tensorflow : tensorflow_py " , <nl> + ] , <nl> + ) <nl> + <nl> + cuda_py_test ( <nl> + name = " trace_op_test " , <nl> + size = " small " , <nl> + srcs = [ " trace_op_test . py " ] , <nl> + additional_deps = [ <nl> + " / / tensorflow : tensorflow_py " , <nl> + ] , <nl> + ) <nl> + <nl> + cuda_py_test ( <nl> + name = " transpose_op_test " , <nl> + size = " small " , <nl> + srcs = [ " transpose_op_test . py " ] , <nl> + additional_deps = [ <nl> + " / / tensorflow : tensorflow_py " , <nl> + ] , <nl> + ) <nl> + <nl> + cuda_py_test ( <nl> + name = " unpack_op_test " , <nl> + size = " small " , <nl> + srcs = [ " unpack_op_test . py " ] , <nl> + additional_deps = [ <nl> + " / / tensorflow : tensorflow_py " , <nl> + ] , <nl> + ) <nl> + <nl> + cuda_py_test ( <nl> + name = " variable_ops_test " , <nl> + size = " small " , <nl> + srcs = [ " variable_ops_test . py " ] , <nl> + additional_deps = [ <nl> + " / / tensorflow : tensorflow_py " , <nl> + ] , <nl> + ) <nl> + <nl> + cuda_py_test ( <nl> + name = " xent_op_test " , <nl> + size = " small " , <nl> + srcs = [ " xent_op_test . py " ] , <nl> + additional_deps = [ <nl> + " / / tensorflow : tensorflow_py " , <nl> + ] , <nl> + ) <nl> + <nl> + cuda_py_test ( <nl> + name = " zero_division_test " , <nl> + size = " small " , <nl> + srcs = [ " zero_division_test . py " ] , <nl> + additional_deps = [ <nl> + " / / tensorflow : tensorflow_py " , <nl> + ] , <nl> + ) <nl> + <nl> + cuda_py_test ( <nl> + name = " atrous_conv2d_test " , <nl> + size = " medium " , <nl> + srcs = [ " atrous_conv2d_test . py " ] , <nl> + additional_deps = [ <nl> + " / / tensorflow : tensorflow_py " , <nl> + ] , <nl> + ) <nl> + <nl> + cuda_py_test ( <nl> + name = " conv2d_backprop_filter_grad_test " , <nl> + size = " medium " , <nl> + srcs = [ " conv2d_backprop_filter_grad_test . py " ] , <nl> + additional_deps = [ <nl> + " / / tensorflow : tensorflow_py " , <nl> + ] , <nl> + ) <nl> + <nl> + cuda_py_test ( <nl> + name = " conv3d_transpose_test " , <nl> + size = " medium " , <nl> + srcs = [ " conv3d_transpose_test . py " ] , <nl> + additional_deps = [ <nl> + " / / tensorflow : tensorflow_py " , <nl> + ] , <nl> + ) <nl> + <nl> + cuda_py_test ( <nl> + name = " conv_ops_test " , <nl> + size = " medium " , <nl> + srcs = [ " conv_ops_test . py " ] , <nl> + additional_deps = [ <nl> + " / / tensorflow : tensorflow_py " , <nl> + ] , <nl> + ) <nl> + <nl> + cuda_py_test ( <nl> + name = " depthwise_conv_op_test " , <nl> + size = " medium " , # http : / / b / 30603882 <nl> + srcs = [ " depthwise_conv_op_test . py " ] , <nl> + additional_deps = [ <nl> + " / / tensorflow : tensorflow_py " , <nl> + ] , <nl> + ) <nl> + <nl> + cuda_py_test ( <nl> + name = " division_future_test " , <nl> + size = " medium " , <nl> + srcs = [ " division_future_test . py " ] , <nl> + additional_deps = [ <nl> + " / / tensorflow : tensorflow_py " , <nl> + ] , <nl> + ) <nl> + <nl> + cuda_py_test ( <nl> + name = " fft_ops_test " , <nl> + size = " medium " , <nl> + srcs = [ " fft_ops_test . py " ] , <nl> + additional_deps = [ <nl> + " / / tensorflow : tensorflow_py " , <nl> + ] , <nl> + ) <nl> + <nl> + cuda_py_test ( <nl> + name = " pooling_ops_3d_test " , <nl> + size = " medium " , # http : / / b / 30600785 <nl> + srcs = [ " pooling_ops_3d_test . py " ] , <nl> + additional_deps = [ <nl> + " / / tensorflow : tensorflow_py " , <nl> + ] , <nl> + ) <nl> + <nl> + cuda_py_test ( <nl> + name = " pooling_ops_test " , <nl> + size = " medium " , <nl> + srcs = [ " pooling_ops_test . py " ] , <nl> + additional_deps = [ <nl> + " / / tensorflow : tensorflow_py " , <nl> + ] , <nl> + ) <nl> + <nl> + cuda_py_test ( <nl> + name = " random_gamma_test " , <nl> + size = " medium " , <nl> + srcs = [ " random_gamma_test . py " ] , <nl> + additional_deps = [ <nl> + " / / tensorflow : tensorflow_py " , <nl> + ] , <nl> + ) <nl> + <nl> + cuda_py_test ( <nl> + name = " rnn_test " , <nl> + size = " medium " , <nl> + srcs = [ " rnn_test . py " ] , <nl> + additional_deps = [ <nl> + " / / tensorflow : tensorflow_py " , <nl> + ] , <nl> + ) <nl> + <nl> + cuda_py_test ( <nl> + name = " scatter_ops_test " , <nl> + size = " large " , # NOTE : This is not run . <nl> + srcs = [ " scatter_ops_test . py " ] , <nl> + additional_deps = [ <nl> + " / / tensorflow : tensorflow_py " , <nl> + ] , <nl> + ) <nl> + <nl> + cuda_py_test ( <nl> + name = " seq2seq_test " , <nl> + size = " medium " , <nl> + srcs = [ " seq2seq_test . py " ] , <nl> + additional_deps = [ <nl> + " / / tensorflow : tensorflow_py " , <nl> + ] , <nl> + ) <nl> + <nl> + cuda_py_test ( <nl> + name = " slice_op_test " , <nl> + size = " medium " , <nl> + srcs = [ " slice_op_test . py " ] , <nl> + additional_deps = [ <nl> + " / / tensorflow : tensorflow_py " , <nl> + ] , <nl> + ) <nl> + <nl> + cuda_py_test ( <nl> + name = " sparse_matmul_op_test " , <nl> + size = " medium " , <nl> + srcs = [ " sparse_matmul_op_test . py " ] , <nl> + additional_deps = [ <nl> + " / / tensorflow : tensorflow_py " , <nl> + ] , <nl> + ) <nl> + <nl> + cuda_py_test ( <nl> + name = " sparse_ops_test " , <nl> + size = " medium " , <nl> + srcs = [ " sparse_ops_test . py " ] , <nl> + additional_deps = [ <nl> + " / / tensorflow : tensorflow_py " , <nl> + ] , <nl> + ) <nl> + <nl> + cuda_py_test ( <nl> + name = " sparse_tensor_dense_matmul_op_test " , <nl> + size = " medium " , <nl> + srcs = [ " sparse_tensor_dense_matmul_op_test . py " ] , <nl> + additional_deps = [ <nl> + " / / tensorflow : tensorflow_py " , <nl> + ] , <nl> + ) <nl> + <nl> + # TODO ( gpapan ) : Revisit the gradient of extract_image_patches_op to resolve <nl> + # http : / / b / 31080670 . <nl> + cuda_py_test ( <nl> + name = " extract_image_patches_grad_test " , <nl> + size = " medium " , <nl> + srcs = [ " extract_image_patches_grad_test . py " ] , <nl> + additional_deps = [ <nl> + " / / tensorflow : tensorflow_py " , <nl> + ] , <nl> + tags = [ " notap " ] , # http : / / b / 31080670 <nl> + ) <nl> + <nl> + cuda_py_test ( <nl> + name = " concat_op_test " , <nl> + size = " medium " , <nl> + srcs = [ " concat_op_test . py " ] , <nl> + additional_deps = [ <nl> + " / / tensorflow : tensorflow_py " , <nl> + ] , <nl> + tags = [ " notsan " ] , # http : / / b / 30445083 <nl> + ) <nl> + <nl> + cuda_py_test ( <nl> + name = " conv_ops_3d_test " , <nl> + size = " medium " , <nl> + srcs = [ " conv_ops_3d_test . py " ] , <nl> + additional_deps = [ " / / tensorflow : tensorflow_py " ] , <nl> + shard_count = 20 , <nl> + ) <nl> + <nl> + cuda_py_test ( <nl> + name = " cwise_ops_test " , <nl> + size = " medium " , <nl> + srcs = [ " cwise_ops_test . py " ] , <nl> + additional_deps = [ " / / tensorflow : tensorflow_py " ] , <nl> + shard_count = 50 , <nl> + tags = [ " notap " ] , # b / 30226163 <nl> + ) <nl> + <nl> + cuda_py_test ( <nl> + name = " embedding_ops_test " , <nl> + size = " medium " , <nl> + srcs = [ " embedding_ops_test . py " ] , <nl> + additional_deps = [ " / / tensorflow : tensorflow_py " ] , <nl> + shard_count = 20 , <nl> + ) <nl> + <nl> + cuda_py_test ( <nl> + name = " linalg_grad_test " , <nl> + size = " medium " , <nl> + srcs = [ " linalg_grad_test . py " ] , <nl> + additional_deps = [ " / / tensorflow : tensorflow_py " ] , <nl> + shard_count = 20 , <nl> + ) <nl> + <nl> + cuda_py_test ( <nl> + name = " matrix_band_part_op_test " , <nl> + size = " medium " , <nl> + srcs = [ " matrix_band_part_op_test . py " ] , <nl> + additional_deps = [ " / / tensorflow : tensorflow_py " ] , <nl> + shard_count = 20 , <nl> + ) <nl> + <nl> + cuda_py_test ( <nl> + name = " self_adjoint_eig_op_test " , <nl> + size = " medium " , <nl> + srcs = [ " self_adjoint_eig_op_test . py " ] , <nl> + additional_deps = [ " / / tensorflow : tensorflow_py " ] , <nl> + shard_count = 20 , <nl> + ) <nl> + <nl> + cuda_py_test ( <nl> + name = " svd_op_test " , <nl> + size = " medium " , <nl> + srcs = [ " svd_op_test . py " ] , <nl> + additional_deps = [ " / / tensorflow : tensorflow_py " ] , <nl> + shard_count = 20 , <nl> ) <nl> <nl> filegroup ( <nl> mmm a / tensorflow / python / kernel_tests / random_shuffle_queue_test . py <nl> ppp b / tensorflow / python / kernel_tests / random_shuffle_queue_test . py <nl> def testSharedQueueSameSession ( self ) : <nl> 1 , 0 , tf . float32 , ( ( ) , ) , shared_name = " shared_queue " ) <nl> q1 . enqueue ( ( 10 . 0 , ) ) . run ( ) <nl> <nl> + # TensorFlow TestCase adds a default graph seed ( = 87654321 ) . We check if <nl> + # the seed computed from the default graph seed is reproduced . <nl> + seed = 887634792 <nl> q2 = tf . RandomShuffleQueue ( <nl> - 1 , 0 , tf . float32 , ( ( ) , ) , shared_name = " shared_queue " ) <nl> + 1 , 0 , tf . float32 , ( ( ) , ) , shared_name = " shared_queue " , seed = seed ) <nl> <nl> q1_size_t = q1 . size ( ) <nl> q2_size_t = q2 . size ( ) <nl> def testSharedQueueSameSession ( self ) : <nl> self . assertEqual ( q1_size_t . eval ( ) , 0 ) <nl> self . assertEqual ( q2_size_t . eval ( ) , 0 ) <nl> <nl> + def testSharedQueueSameSessionGraphSeedNone ( self ) : <nl> + with self . test_session ( ) : <nl> + q1 = tf . RandomShuffleQueue ( <nl> + 1 , 0 , tf . float32 , ( ( ) , ) , shared_name = " shared_queue " , seed = 98765432 ) <nl> + q1 . enqueue ( ( 10 . 0 , ) ) . run ( ) <nl> + <nl> + # If both graph and op seeds are not provided , the default value must be <nl> + # used , and in case a shared queue is already created , the second queue op <nl> + # must accept any previous seed value . <nl> + tf . set_random_seed ( None ) <nl> + q2 = tf . RandomShuffleQueue ( <nl> + 1 , 0 , tf . float32 , ( ( ) , ) , shared_name = " shared_queue " ) <nl> + <nl> + q1_size_t = q1 . size ( ) <nl> + q2_size_t = q2 . size ( ) <nl> + <nl> + self . assertEqual ( q1_size_t . eval ( ) , 1 ) <nl> + self . assertEqual ( q2_size_t . eval ( ) , 1 ) <nl> + <nl> def testIncompatibleSharedQueueErrors ( self ) : <nl> with self . test_session ( ) : <nl> q_a_1 = tf . RandomShuffleQueue ( <nl> mmm a / tensorflow / python / kernel_tests / string_to_hash_bucket_op_test . py <nl> ppp b / tensorflow / python / kernel_tests / string_to_hash_bucket_op_test . py <nl> <nl> from __future__ import division <nl> from __future__ import print_function <nl> <nl> - import numpy as np <nl> import tensorflow as tf <nl> <nl> <nl> mmm a / tensorflow / python / ops / data_flow_ops . py <nl> ppp b / tensorflow / python / ops / data_flow_ops . py <nl> <nl> from __future__ import print_function <nl> <nl> import collections <nl> + import hashlib <nl> import re <nl> <nl> import six <nl> def __init__ ( self , capacity , min_after_dequeue , dtypes , shapes = None , <nl> dtypes = _as_type_list ( dtypes ) <nl> shapes = _as_shape_list ( shapes , dtypes ) <nl> names = _as_name_list ( names , dtypes ) <nl> - # If shared_name is provided and an op seed was not provided , we must ensure <nl> - # that we use the same seed for all queues with the same shared_name . <nl> - if shared_name is not None and seed is None : <nl> - seed = hash ( shared_name ) <nl> seed1 , seed2 = random_seed . get_seed ( seed ) <nl> + if seed1 is None and seed2 is None : <nl> + seed1 , seed2 = 0 , 0 <nl> + elif seed is None and shared_name is not None : <nl> + # This means that graph seed is provided but op seed is not provided . <nl> + # If shared_name is also provided , make seed2 depend only on the graph <nl> + # seed and shared_name . ( seed2 from get_seed ( ) is generally dependent on <nl> + # the id of the last op created . ) <nl> + string = ( str ( seed1 ) + shared_name ) . encode ( " utf - 8 " ) <nl> + seed2 = int ( hashlib . md5 ( string ) . hexdigest ( ) [ : 8 ] , 16 ) & 0x7FFFFFFF <nl> queue_ref = gen_data_flow_ops . _random_shuffle_queue ( <nl> component_types = dtypes , shapes = shapes , capacity = capacity , <nl> min_after_dequeue = min_after_dequeue , seed = seed1 , seed2 = seed2 , <nl> mmm a / tensorflow / python / ops / nn . py <nl> ppp b / tensorflow / python / ops / nn . py <nl> def nce_loss ( weights , <nl> Also see our [ Candidate Sampling Algorithms Reference ] <nl> ( . . / . . / extras / candidate_sampling . pdf ) <nl> <nl> + Note : By default this uses a log - uniform ( Zipfian ) distribution for sampling , <nl> + so your labels must be sorted in order of decreasing frequency to achieve <nl> + good results . For more details , see <nl> + [ log_uniform_candidate_sampler ] ( # log_uniform_candidate_sampler ) . <nl> + <nl> Note : In the case where ` num_true ` > 1 , we assign to each target class <nl> the target probability 1 / ` num_true ` so that the target probabilities <nl> sum to 1 per - example . <nl> mmm a / tensorflow / python / ops / nn_ops . py <nl> ppp b / tensorflow / python / ops / nn_ops . py <nl> def _swap_axis ( logits , dim_index , last_index ) : <nl> <nl> <nl> def softmax ( logits , dim = - 1 , name = None ) : <nl> - " " " Computes log softmax activations . <nl> + " " " Computes softmax activations . <nl> <nl> For each batch ` i ` and class ` j ` we have <nl> <nl> def log_softmax ( logits , dim = - 1 , name = None ) : <nl> <nl> For each batch ` i ` and class ` j ` we have <nl> <nl> - logsoftmax = logits - reduce_sum ( exp ( logits ) , dim ) <nl> + logsoftmax = logits - log ( reduce_sum ( exp ( logits ) , dim ) ) <nl> <nl> Args : <nl> logits : A non - empty ` Tensor ` . Must be one of the following types : ` half ` , <nl> mmm a / tensorflow / python / ops / partitioned_variables . py <nl> ppp b / tensorflow / python / ops / partitioned_variables . py <nl> <nl> <nl> import math <nl> <nl> - import six # pylint : disable = unused - import <nl> - <nl> from tensorflow . python . framework import dtypes <nl> from tensorflow . python . framework import tensor_shape <nl> from tensorflow . python . ops import variable_scope <nl> mmm a / tensorflow / python / ops / string_ops . py <nl> ppp b / tensorflow / python / ops / string_ops . py <nl> <nl> from __future__ import division <nl> from __future__ import print_function <nl> <nl> - import numpy as np <nl> import six <nl> <nl> from tensorflow . python . framework import common_shapes <nl> deleted file mode 100644 <nl> index 955b42fb99928 . . 0000000000000 <nl> mmm a / tensorflow / python / platform / numpy . i <nl> ppp / dev / null <nl> <nl> - / * - * - C - * - ( not really , but good for syntax highlighting ) * / <nl> - <nl> - / * <nl> - * Copyright ( c ) 2005 - 2015 , NumPy Developers . <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> - * <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> - * <nl> - * * Neither the name of the NumPy Developers nor the names of any <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> - <nl> - # ifdef SWIGPYTHON <nl> - <nl> - % { <nl> - # ifndef SWIG_FILE_WITH_INIT <nl> - # define NO_IMPORT_ARRAY <nl> - # endif <nl> - # include " stdio . h " <nl> - # define NPY_NO_DEPRECATED_API NPY_1_7_API_VERSION <nl> - # include < numpy / arrayobject . h > <nl> - % } <nl> - <nl> - / * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * / <nl> - <nl> - % fragment ( " NumPy_Backward_Compatibility " , " header " ) <nl> - { <nl> - % # if NPY_API_VERSION < 0x00000007 <nl> - % # define NPY_ARRAY_DEFAULT NPY_DEFAULT <nl> - % # define NPY_ARRAY_FARRAY NPY_FARRAY <nl> - % # define NPY_FORTRANORDER NPY_FORTRAN <nl> - % # endif <nl> - } <nl> - <nl> - / * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * / <nl> - <nl> - / * The following code originally appeared in <nl> - * enthought / kiva / agg / src / numeric . i written by Eric Jones . It was <nl> - * translated from C + + to C by John Hunter . Bill Spotz has modified <nl> - * it to fix some minor bugs , upgrade from Numeric to numpy ( all <nl> - * versions ) , add some comments and functionality , and convert from <nl> - * direct code insertion to SWIG fragments . <nl> - * / <nl> - <nl> - % fragment ( " NumPy_Macros " , " header " ) <nl> - { <nl> - / * Macros to extract array attributes . <nl> - * / <nl> - % # if NPY_API_VERSION < 0x00000007 <nl> - % # define is_array ( a ) ( ( a ) & & PyArray_Check ( ( PyArrayObject * ) a ) ) <nl> - % # define array_type ( a ) ( int ) ( PyArray_TYPE ( ( PyArrayObject * ) a ) ) <nl> - % # define array_numdims ( a ) ( ( ( PyArrayObject * ) a ) - > nd ) <nl> - % # define array_dimensions ( a ) ( ( ( PyArrayObject * ) a ) - > dimensions ) <nl> - % # define array_size ( a , i ) ( ( ( PyArrayObject * ) a ) - > dimensions [ i ] ) <nl> - % # define array_strides ( a ) ( ( ( PyArrayObject * ) a ) - > strides ) <nl> - % # define array_stride ( a , i ) ( ( ( PyArrayObject * ) a ) - > strides [ i ] ) <nl> - % # define array_data ( a ) ( ( ( PyArrayObject * ) a ) - > data ) <nl> - % # define array_descr ( a ) ( ( ( PyArrayObject * ) a ) - > descr ) <nl> - % # define array_flags ( a ) ( ( ( PyArrayObject * ) a ) - > flags ) <nl> - % # define array_enableflags ( a , f ) ( ( ( PyArrayObject * ) a ) - > flags ) = f <nl> - % # else <nl> - % # define is_array ( a ) ( ( a ) & & PyArray_Check ( a ) ) <nl> - % # define array_type ( a ) PyArray_TYPE ( ( PyArrayObject * ) a ) <nl> - % # define array_numdims ( a ) PyArray_NDIM ( ( PyArrayObject * ) a ) <nl> - % # define array_dimensions ( a ) PyArray_DIMS ( ( PyArrayObject * ) a ) <nl> - % # define array_strides ( a ) PyArray_STRIDES ( ( PyArrayObject * ) a ) <nl> - % # define array_stride ( a , i ) PyArray_STRIDE ( ( PyArrayObject * ) a , i ) <nl> - % # define array_size ( a , i ) PyArray_DIM ( ( PyArrayObject * ) a , i ) <nl> - % # define array_data ( a ) PyArray_DATA ( ( PyArrayObject * ) a ) <nl> - % # define array_descr ( a ) PyArray_DESCR ( ( PyArrayObject * ) a ) <nl> - % # define array_flags ( a ) PyArray_FLAGS ( ( PyArrayObject * ) a ) <nl> - % # define array_enableflags ( a , f ) PyArray_ENABLEFLAGS ( ( PyArrayObject * ) a , f ) <nl> - % # endif <nl> - % # define array_is_contiguous ( a ) ( PyArray_ISCONTIGUOUS ( ( PyArrayObject * ) a ) ) <nl> - % # define array_is_native ( a ) ( PyArray_ISNOTSWAPPED ( ( PyArrayObject * ) a ) ) <nl> - % # define array_is_fortran ( a ) ( PyArray_ISFORTRAN ( ( PyArrayObject * ) a ) ) <nl> - } <nl> - <nl> - / * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * / <nl> - <nl> - % fragment ( " NumPy_Utilities " , <nl> - " header " ) <nl> - { <nl> - / * Given a PyObject , return a string describing its type . <nl> - * / <nl> - const char * pytype_string ( PyObject * py_obj ) <nl> - { <nl> - if ( py_obj = = NULL ) return " C NULL value " ; <nl> - if ( py_obj = = Py_None ) return " Python None " ; <nl> - if ( PyCallable_Check ( py_obj ) ) return " callable " ; <nl> - if ( PyString_Check ( py_obj ) ) return " string " ; <nl> - if ( PyInt_Check ( py_obj ) ) return " int " ; <nl> - if ( PyFloat_Check ( py_obj ) ) return " float " ; <nl> - if ( PyDict_Check ( py_obj ) ) return " dict " ; <nl> - if ( PyList_Check ( py_obj ) ) return " list " ; <nl> - if ( PyTuple_Check ( py_obj ) ) return " tuple " ; <nl> - % # if PY_MAJOR_VERSION < 3 <nl> - if ( PyFile_Check ( py_obj ) ) return " file " ; <nl> - if ( PyModule_Check ( py_obj ) ) return " module " ; <nl> - if ( PyInstance_Check ( py_obj ) ) return " instance " ; <nl> - % # endif <nl> - <nl> - return " unkown type " ; <nl> - } <nl> - <nl> - / * Given a NumPy typecode , return a string describing the type . <nl> - * / <nl> - const char * typecode_string ( int typecode ) <nl> - { <nl> - static const char * type_names [ 25 ] = { " bool " , <nl> - " byte " , <nl> - " unsigned byte " , <nl> - " short " , <nl> - " unsigned short " , <nl> - " int " , <nl> - " unsigned int " , <nl> - " long " , <nl> - " unsigned long " , <nl> - " long long " , <nl> - " unsigned long long " , <nl> - " float " , <nl> - " double " , <nl> - " long double " , <nl> - " complex float " , <nl> - " complex double " , <nl> - " complex long double " , <nl> - " object " , <nl> - " string " , <nl> - " unicode " , <nl> - " void " , <nl> - " ntypes " , <nl> - " notype " , <nl> - " char " , <nl> - " unknown " } ; <nl> - return typecode < 24 ? type_names [ typecode ] : type_names [ 24 ] ; <nl> - } <nl> - <nl> - / * Make sure input has correct numpy type . This now just calls <nl> - PyArray_EquivTypenums ( ) . <nl> - * / <nl> - int type_match ( int actual_type , <nl> - int desired_type ) <nl> - { <nl> - return PyArray_EquivTypenums ( actual_type , desired_type ) ; <nl> - } <nl> - <nl> - % # ifdef SWIGPY_USE_CAPSULE <nl> - void free_cap ( PyObject * cap ) <nl> - { <nl> - void * array = ( void * ) PyCapsule_GetPointer ( cap , SWIGPY_CAPSULE_NAME ) ; <nl> - if ( array ! = NULL ) free ( array ) ; <nl> - } <nl> - % # endif <nl> - <nl> - <nl> - } <nl> - <nl> - / * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * / <nl> - <nl> - % fragment ( " NumPy_Object_to_Array " , <nl> - " header " , <nl> - fragment = " NumPy_Backward_Compatibility " , <nl> - fragment = " NumPy_Macros " , <nl> - fragment = " NumPy_Utilities " ) <nl> - { <nl> - / * Given a PyObject pointer , cast it to a PyArrayObject pointer if <nl> - * legal . If not , set the python error string appropriately and <nl> - * return NULL . <nl> - * / <nl> - PyArrayObject * obj_to_array_no_conversion ( PyObject * input , <nl> - int typecode ) <nl> - { <nl> - PyArrayObject * ary = NULL ; <nl> - if ( is_array ( input ) & & ( typecode = = NPY_NOTYPE | | <nl> - PyArray_EquivTypenums ( array_type ( input ) , typecode ) ) ) <nl> - { <nl> - ary = ( PyArrayObject * ) input ; <nl> - } <nl> - else if is_array ( input ) <nl> - { <nl> - const char * desired_type = typecode_string ( typecode ) ; <nl> - const char * actual_type = typecode_string ( array_type ( input ) ) ; <nl> - PyErr_Format ( PyExc_TypeError , <nl> - " Array of type ' % s ' required . Array of type ' % s ' given " , <nl> - desired_type , actual_type ) ; <nl> - ary = NULL ; <nl> - } <nl> - else <nl> - { <nl> - const char * desired_type = typecode_string ( typecode ) ; <nl> - const char * actual_type = pytype_string ( input ) ; <nl> - PyErr_Format ( PyExc_TypeError , <nl> - " Array of type ' % s ' required . A ' % s ' was given " , <nl> - desired_type , <nl> - actual_type ) ; <nl> - ary = NULL ; <nl> - } <nl> - return ary ; <nl> - } <nl> - <nl> - / * Convert the given PyObject to a NumPy array with the given <nl> - * typecode . On success , return a valid PyArrayObject * with the <nl> - * correct type . On failure , the python error string will be set and <nl> - * the routine returns NULL . <nl> - * / <nl> - PyArrayObject * obj_to_array_allow_conversion ( PyObject * input , <nl> - int typecode , <nl> - int * is_new_object ) <nl> - { <nl> - PyArrayObject * ary = NULL ; <nl> - PyObject * py_obj ; <nl> - if ( is_array ( input ) & & ( typecode = = NPY_NOTYPE | | <nl> - PyArray_EquivTypenums ( array_type ( input ) , typecode ) ) ) <nl> - { <nl> - ary = ( PyArrayObject * ) input ; <nl> - * is_new_object = 0 ; <nl> - } <nl> - else <nl> - { <nl> - py_obj = PyArray_FROMANY ( input , typecode , 0 , 0 , NPY_ARRAY_DEFAULT ) ; <nl> - / * If NULL , PyArray_FromObject will have set python error value . * / <nl> - ary = ( PyArrayObject * ) py_obj ; <nl> - * is_new_object = 1 ; <nl> - } <nl> - return ary ; <nl> - } <nl> - <nl> - / * Given a PyArrayObject , check to see if it is contiguous . If so , <nl> - * return the input pointer and flag it as not a new object . If it is <nl> - * not contiguous , create a new PyArrayObject using the original data , <nl> - * flag it as a new object and return the pointer . <nl> - * / <nl> - PyArrayObject * make_contiguous ( PyArrayObject * ary , <nl> - int * is_new_object , <nl> - int min_dims , <nl> - int max_dims ) <nl> - { <nl> - PyArrayObject * result ; <nl> - if ( array_is_contiguous ( ary ) ) <nl> - { <nl> - result = ary ; <nl> - * is_new_object = 0 ; <nl> - } <nl> - else <nl> - { <nl> - result = ( PyArrayObject * ) PyArray_ContiguousFromObject ( ( PyObject * ) ary , <nl> - array_type ( ary ) , <nl> - min_dims , <nl> - max_dims ) ; <nl> - * is_new_object = 1 ; <nl> - } <nl> - return result ; <nl> - } <nl> - <nl> - / * Given a PyArrayObject , check to see if it is Fortran - contiguous . <nl> - * If so , return the input pointer , but do not flag it as not a new <nl> - * object . If it is not Fortran - contiguous , create a new <nl> - * PyArrayObject using the original data , flag it as a new object <nl> - * and return the pointer . <nl> - * / <nl> - PyArrayObject * make_fortran ( PyArrayObject * ary , <nl> - int * is_new_object ) <nl> - { <nl> - PyArrayObject * result ; <nl> - if ( array_is_fortran ( ary ) ) <nl> - { <nl> - result = ary ; <nl> - * is_new_object = 0 ; <nl> - } <nl> - else <nl> - { <nl> - Py_INCREF ( array_descr ( ary ) ) ; <nl> - result = ( PyArrayObject * ) PyArray_FromArray ( ary , <nl> - array_descr ( ary ) , <nl> - NPY_FORTRANORDER ) ; <nl> - * is_new_object = 1 ; <nl> - } <nl> - return result ; <nl> - } <nl> - <nl> - / * Convert a given PyObject to a contiguous PyArrayObject of the <nl> - * specified type . If the input object is not a contiguous <nl> - * PyArrayObject , a new one will be created and the new object flag <nl> - * will be set . <nl> - * / <nl> - PyArrayObject * obj_to_array_contiguous_allow_conversion ( PyObject * input , <nl> - int typecode , <nl> - int * is_new_object ) <nl> - { <nl> - int is_new1 = 0 ; <nl> - int is_new2 = 0 ; <nl> - PyArrayObject * ary2 ; <nl> - PyArrayObject * ary1 = obj_to_array_allow_conversion ( input , <nl> - typecode , <nl> - & is_new1 ) ; <nl> - if ( ary1 ) <nl> - { <nl> - ary2 = make_contiguous ( ary1 , & is_new2 , 0 , 0 ) ; <nl> - if ( is_new1 & & is_new2 ) <nl> - { <nl> - Py_DECREF ( ary1 ) ; <nl> - } <nl> - ary1 = ary2 ; <nl> - } <nl> - * is_new_object = is_new1 | | is_new2 ; <nl> - return ary1 ; <nl> - } <nl> - <nl> - / * Convert a given PyObject to a Fortran - ordered PyArrayObject of the <nl> - * specified type . If the input object is not a Fortran - ordered <nl> - * PyArrayObject , a new one will be created and the new object flag <nl> - * will be set . <nl> - * / <nl> - PyArrayObject * obj_to_array_fortran_allow_conversion ( PyObject * input , <nl> - int typecode , <nl> - int * is_new_object ) <nl> - { <nl> - int is_new1 = 0 ; <nl> - int is_new2 = 0 ; <nl> - PyArrayObject * ary2 ; <nl> - PyArrayObject * ary1 = obj_to_array_allow_conversion ( input , <nl> - typecode , <nl> - & is_new1 ) ; <nl> - if ( ary1 ) <nl> - { <nl> - ary2 = make_fortran ( ary1 , & is_new2 ) ; <nl> - if ( is_new1 & & is_new2 ) <nl> - { <nl> - Py_DECREF ( ary1 ) ; <nl> - } <nl> - ary1 = ary2 ; <nl> - } <nl> - * is_new_object = is_new1 | | is_new2 ; <nl> - return ary1 ; <nl> - } <nl> - } / * end fragment * / <nl> - <nl> - / * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * / <nl> - <nl> - % fragment ( " NumPy_Array_Requirements " , <nl> - " header " , <nl> - fragment = " NumPy_Backward_Compatibility " , <nl> - fragment = " NumPy_Macros " ) <nl> - { <nl> - / * Test whether a python object is contiguous . If array is <nl> - * contiguous , return 1 . Otherwise , set the python error string and <nl> - * return 0 . <nl> - * / <nl> - int require_contiguous ( PyArrayObject * ary ) <nl> - { <nl> - int contiguous = 1 ; <nl> - if ( ! array_is_contiguous ( ary ) ) <nl> - { <nl> - PyErr_SetString ( PyExc_TypeError , <nl> - " Array must be contiguous . A non - contiguous array was given " ) ; <nl> - contiguous = 0 ; <nl> - } <nl> - return contiguous ; <nl> - } <nl> - <nl> - / * Require that a numpy array is not byte - swapped . If the array is <nl> - * not byte - swapped , return 1 . Otherwise , set the python error string <nl> - * and return 0 . <nl> - * / <nl> - int require_native ( PyArrayObject * ary ) <nl> - { <nl> - int native = 1 ; <nl> - if ( ! array_is_native ( ary ) ) <nl> - { <nl> - PyErr_SetString ( PyExc_TypeError , <nl> - " Array must have native byteorder . " <nl> - " A byte - swapped array was given " ) ; <nl> - native = 0 ; <nl> - } <nl> - return native ; <nl> - } <nl> - <nl> - / * Require the given PyArrayObject to have a specified number of <nl> - * dimensions . If the array has the specified number of dimensions , <nl> - * return 1 . Otherwise , set the python error string and return 0 . <nl> - * / <nl> - int require_dimensions ( PyArrayObject * ary , <nl> - int exact_dimensions ) <nl> - { <nl> - int success = 1 ; <nl> - if ( array_numdims ( ary ) ! = exact_dimensions ) <nl> - { <nl> - PyErr_Format ( PyExc_TypeError , <nl> - " Array must have % d dimensions . Given array has % d dimensions " , <nl> - exact_dimensions , <nl> - array_numdims ( ary ) ) ; <nl> - success = 0 ; <nl> - } <nl> - return success ; <nl> - } <nl> - <nl> - / * Require the given PyArrayObject to have one of a list of specified <nl> - * number of dimensions . If the array has one of the specified number <nl> - * of dimensions , return 1 . Otherwise , set the python error string <nl> - * and return 0 . <nl> - * / <nl> - int require_dimensions_n ( PyArrayObject * ary , <nl> - int * exact_dimensions , <nl> - int n ) <nl> - { <nl> - int success = 0 ; <nl> - int i ; <nl> - char dims_str [ 255 ] = " " ; <nl> - char s [ 255 ] ; <nl> - for ( i = 0 ; i < n & & ! success ; i + + ) <nl> - { <nl> - if ( array_numdims ( ary ) = = exact_dimensions [ i ] ) <nl> - { <nl> - success = 1 ; <nl> - } <nl> - } <nl> - if ( ! success ) <nl> - { <nl> - for ( i = 0 ; i < n - 1 ; i + + ) <nl> - { <nl> - sprintf ( s , " % d , " , exact_dimensions [ i ] ) ; <nl> - strcat ( dims_str , s ) ; <nl> - } <nl> - sprintf ( s , " or % d " , exact_dimensions [ n - 1 ] ) ; <nl> - strcat ( dims_str , s ) ; <nl> - PyErr_Format ( PyExc_TypeError , <nl> - " Array must have % s dimensions . Given array has % d dimensions " , <nl> - dims_str , <nl> - array_numdims ( ary ) ) ; <nl> - } <nl> - return success ; <nl> - } <nl> - <nl> - / * Require the given PyArrayObject to have a specified shape . If the <nl> - * array has the specified shape , return 1 . Otherwise , set the python <nl> - * error string and return 0 . <nl> - * / <nl> - int require_size ( PyArrayObject * ary , <nl> - npy_intp * size , <nl> - int n ) <nl> - { <nl> - int i ; <nl> - int success = 1 ; <nl> - int len ; <nl> - char desired_dims [ 255 ] = " [ " ; <nl> - char s [ 255 ] ; <nl> - char actual_dims [ 255 ] = " [ " ; <nl> - for ( i = 0 ; i < n ; i + + ) <nl> - { <nl> - if ( size [ i ] ! = - 1 & & size [ i ] ! = array_size ( ary , i ) ) <nl> - { <nl> - success = 0 ; <nl> - } <nl> - } <nl> - if ( ! success ) <nl> - { <nl> - for ( i = 0 ; i < n ; i + + ) <nl> - { <nl> - if ( size [ i ] = = - 1 ) <nl> - { <nl> - sprintf ( s , " * , " ) ; <nl> - } <nl> - else <nl> - { <nl> - sprintf ( s , " % ld , " , ( long int ) size [ i ] ) ; <nl> - } <nl> - strcat ( desired_dims , s ) ; <nl> - } <nl> - len = strlen ( desired_dims ) ; <nl> - desired_dims [ len - 1 ] = ' ] ' ; <nl> - for ( i = 0 ; i < n ; i + + ) <nl> - { <nl> - sprintf ( s , " % ld , " , ( long int ) array_size ( ary , i ) ) ; <nl> - strcat ( actual_dims , s ) ; <nl> - } <nl> - len = strlen ( actual_dims ) ; <nl> - actual_dims [ len - 1 ] = ' ] ' ; <nl> - PyErr_Format ( PyExc_TypeError , <nl> - " Array must have shape of % s . Given array has shape of % s " , <nl> - desired_dims , <nl> - actual_dims ) ; <nl> - } <nl> - return success ; <nl> - } <nl> - <nl> - / * Require the given PyArrayObject to be Fortran ordered . If the <nl> - * the PyArrayObject is already Fortran ordered , do nothing . Else , <nl> - * set the Fortran ordering flag and recompute the strides . <nl> - * / <nl> - int require_fortran ( PyArrayObject * ary ) <nl> - { <nl> - int success = 1 ; <nl> - int nd = array_numdims ( ary ) ; <nl> - int i ; <nl> - npy_intp * strides = array_strides ( ary ) ; <nl> - if ( array_is_fortran ( ary ) ) return success ; <nl> - / * Set the Fortran ordered flag * / <nl> - array_enableflags ( ary , NPY_ARRAY_FARRAY ) ; <nl> - / * Recompute the strides * / <nl> - strides [ 0 ] = strides [ nd - 1 ] ; <nl> - for ( i = 1 ; i < nd ; + + i ) <nl> - strides [ i ] = strides [ i - 1 ] * array_size ( ary , i - 1 ) ; <nl> - return success ; <nl> - } <nl> - } <nl> - <nl> - / * Combine all NumPy fragments into one for convenience * / <nl> - % fragment ( " NumPy_Fragments " , <nl> - " header " , <nl> - fragment = " NumPy_Backward_Compatibility " , <nl> - fragment = " NumPy_Macros " , <nl> - fragment = " NumPy_Utilities " , <nl> - fragment = " NumPy_Object_to_Array " , <nl> - fragment = " NumPy_Array_Requirements " ) <nl> - { <nl> - } <nl> - <nl> - / * End John Hunter translation ( with modifications by Bill Spotz ) <nl> - * / <nl> - <nl> - / * % numpy_typemaps ( ) macro <nl> - * <nl> - * This macro defines a family of 74 typemaps that allow C arguments <nl> - * of the form <nl> - * <nl> - * 1 . ( DATA_TYPE IN_ARRAY1 [ ANY ] ) <nl> - * 2 . ( DATA_TYPE * IN_ARRAY1 , DIM_TYPE DIM1 ) <nl> - * 3 . ( DIM_TYPE DIM1 , DATA_TYPE * IN_ARRAY1 ) <nl> - * <nl> - * 4 . ( DATA_TYPE IN_ARRAY2 [ ANY ] [ ANY ] ) <nl> - * 5 . ( DATA_TYPE * IN_ARRAY2 , DIM_TYPE DIM1 , DIM_TYPE DIM2 ) <nl> - * 6 . ( DIM_TYPE DIM1 , DIM_TYPE DIM2 , DATA_TYPE * IN_ARRAY2 ) <nl> - * 7 . ( DATA_TYPE * IN_FARRAY2 , DIM_TYPE DIM1 , DIM_TYPE DIM2 ) <nl> - * 8 . ( DIM_TYPE DIM1 , DIM_TYPE DIM2 , DATA_TYPE * IN_FARRAY2 ) <nl> - * <nl> - * 9 . ( DATA_TYPE IN_ARRAY3 [ ANY ] [ ANY ] [ ANY ] ) <nl> - * 10 . ( DATA_TYPE * IN_ARRAY3 , DIM_TYPE DIM1 , DIM_TYPE DIM2 , DIM_TYPE DIM3 ) <nl> - * 11 . ( DATA_TYPE * * IN_ARRAY3 , DIM_TYPE DIM1 , DIM_TYPE DIM2 , DIM_TYPE DIM3 ) <nl> - * 12 . ( DIM_TYPE DIM1 , DIM_TYPE DIM2 , DIM_TYPE DIM3 , DATA_TYPE * IN_ARRAY3 ) <nl> - * 13 . ( DATA_TYPE * IN_FARRAY3 , DIM_TYPE DIM1 , DIM_TYPE DIM2 , DIM_TYPE DIM3 ) <nl> - * 14 . ( DIM_TYPE DIM1 , DIM_TYPE DIM2 , DIM_TYPE DIM3 , DATA_TYPE * IN_FARRAY3 ) <nl> - * <nl> - * 15 . ( DATA_TYPE IN_ARRAY4 [ ANY ] [ ANY ] [ ANY ] [ ANY ] ) <nl> - * 16 . ( DATA_TYPE * IN_ARRAY4 , DIM_TYPE DIM1 , DIM_TYPE DIM2 , DIM_TYPE DIM3 , DIM_TYPE DIM4 ) <nl> - * 17 . ( DATA_TYPE * * IN_ARRAY4 , DIM_TYPE DIM1 , DIM_TYPE DIM2 , DIM_TYPE DIM3 , DIM_TYPE DIM4 ) <nl> - * 18 . ( DIM_TYPE DIM1 , DIM_TYPE DIM2 , DIM_TYPE DIM3 , , DIM_TYPE DIM4 , DATA_TYPE * IN_ARRAY4 ) <nl> - * 19 . ( DATA_TYPE * IN_FARRAY4 , DIM_TYPE DIM1 , DIM_TYPE DIM2 , DIM_TYPE DIM3 , DIM_TYPE DIM4 ) <nl> - * 20 . ( DIM_TYPE DIM1 , DIM_TYPE DIM2 , DIM_TYPE DIM3 , DIM_TYPE DIM4 , DATA_TYPE * IN_FARRAY4 ) <nl> - * <nl> - * 21 . ( DATA_TYPE INPLACE_ARRAY1 [ ANY ] ) <nl> - * 22 . ( DATA_TYPE * INPLACE_ARRAY1 , DIM_TYPE DIM1 ) <nl> - * 23 . ( DIM_TYPE DIM1 , DATA_TYPE * INPLACE_ARRAY1 ) <nl> - * <nl> - * 24 . ( DATA_TYPE INPLACE_ARRAY2 [ ANY ] [ ANY ] ) <nl> - * 25 . ( DATA_TYPE * INPLACE_ARRAY2 , DIM_TYPE DIM1 , DIM_TYPE DIM2 ) <nl> - * 26 . ( DIM_TYPE DIM1 , DIM_TYPE DIM2 , DATA_TYPE * INPLACE_ARRAY2 ) <nl> - * 27 . ( DATA_TYPE * INPLACE_FARRAY2 , DIM_TYPE DIM1 , DIM_TYPE DIM2 ) <nl> - * 28 . ( DIM_TYPE DIM1 , DIM_TYPE DIM2 , DATA_TYPE * INPLACE_FARRAY2 ) <nl> - * <nl> - * 29 . ( DATA_TYPE INPLACE_ARRAY3 [ ANY ] [ ANY ] [ ANY ] ) <nl> - * 30 . ( DATA_TYPE * INPLACE_ARRAY3 , DIM_TYPE DIM1 , DIM_TYPE DIM2 , DIM_TYPE DIM3 ) <nl> - * 31 . ( DATA_TYPE * * INPLACE_ARRAY3 , DIM_TYPE DIM1 , DIM_TYPE DIM2 , DIM_TYPE DIM3 ) <nl> - * 32 . ( DIM_TYPE DIM1 , DIM_TYPE DIM2 , DIM_TYPE DIM3 , DATA_TYPE * INPLACE_ARRAY3 ) <nl> - * 33 . ( DATA_TYPE * INPLACE_FARRAY3 , DIM_TYPE DIM1 , DIM_TYPE DIM2 , DIM_TYPE DIM3 ) <nl> - * 34 . ( DIM_TYPE DIM1 , DIM_TYPE DIM2 , DIM_TYPE DIM3 , DATA_TYPE * INPLACE_FARRAY3 ) <nl> - * <nl> - * 35 . ( DATA_TYPE INPLACE_ARRAY4 [ ANY ] [ ANY ] [ ANY ] [ ANY ] ) <nl> - * 36 . ( DATA_TYPE * INPLACE_ARRAY4 , DIM_TYPE DIM1 , DIM_TYPE DIM2 , DIM_TYPE DIM3 , DIM_TYPE DIM4 ) <nl> - * 37 . ( DATA_TYPE * * INPLACE_ARRAY4 , DIM_TYPE DIM1 , DIM_TYPE DIM2 , DIM_TYPE DIM3 , DIM_TYPE DIM4 ) <nl> - * 38 . ( DIM_TYPE DIM1 , DIM_TYPE DIM2 , DIM_TYPE DIM3 , DIM_TYPE DIM4 , DATA_TYPE * INPLACE_ARRAY4 ) <nl> - * 39 . ( DATA_TYPE * INPLACE_FARRAY4 , DIM_TYPE DIM1 , DIM_TYPE DIM2 , DIM_TYPE DIM3 , DIM_TYPE DIM4 ) <nl> - * 40 . ( DIM_TYPE DIM1 , DIM_TYPE DIM2 , DIM_TYPE DIM3 , DIM_TYPE DIM4 , DATA_TYPE * INPLACE_FARRAY4 ) <nl> - * <nl> - * 41 . ( DATA_TYPE ARGOUT_ARRAY1 [ ANY ] ) <nl> - * 42 . ( DATA_TYPE * ARGOUT_ARRAY1 , DIM_TYPE DIM1 ) <nl> - * 43 . ( DIM_TYPE DIM1 , DATA_TYPE * ARGOUT_ARRAY1 ) <nl> - * <nl> - * 44 . ( DATA_TYPE ARGOUT_ARRAY2 [ ANY ] [ ANY ] ) <nl> - * <nl> - * 45 . ( DATA_TYPE ARGOUT_ARRAY3 [ ANY ] [ ANY ] [ ANY ] ) <nl> - * <nl> - * 46 . ( DATA_TYPE ARGOUT_ARRAY4 [ ANY ] [ ANY ] [ ANY ] [ ANY ] ) <nl> - * <nl> - * 47 . ( DATA_TYPE * * ARGOUTVIEW_ARRAY1 , DIM_TYPE * DIM1 ) <nl> - * 48 . ( DIM_TYPE * DIM1 , DATA_TYPE * * ARGOUTVIEW_ARRAY1 ) <nl> - * <nl> - * 49 . ( DATA_TYPE * * ARGOUTVIEW_ARRAY2 , DIM_TYPE * DIM1 , DIM_TYPE * DIM2 ) <nl> - * 50 . ( DIM_TYPE * DIM1 , DIM_TYPE * DIM2 , DATA_TYPE * * ARGOUTVIEW_ARRAY2 ) <nl> - * 51 . ( DATA_TYPE * * ARGOUTVIEW_FARRAY2 , DIM_TYPE * DIM1 , DIM_TYPE * DIM2 ) <nl> - * 52 . ( DIM_TYPE * DIM1 , DIM_TYPE * DIM2 , DATA_TYPE * * ARGOUTVIEW_FARRAY2 ) <nl> - * <nl> - * 53 . ( DATA_TYPE * * ARGOUTVIEW_ARRAY3 , DIM_TYPE * DIM1 , DIM_TYPE * DIM2 , DIM_TYPE * DIM3 ) <nl> - * 54 . ( DIM_TYPE * DIM1 , DIM_TYPE * DIM2 , DIM_TYPE * DIM3 , DATA_TYPE * * ARGOUTVIEW_ARRAY3 ) <nl> - * 55 . ( DATA_TYPE * * ARGOUTVIEW_FARRAY3 , DIM_TYPE * DIM1 , DIM_TYPE * DIM2 , DIM_TYPE * DIM3 ) <nl> - * 56 . ( DIM_TYPE * DIM1 , DIM_TYPE * DIM2 , DIM_TYPE * DIM3 , DATA_TYPE * * ARGOUTVIEW_FARRAY3 ) <nl> - * <nl> - * 57 . ( DATA_TYPE * * ARGOUTVIEW_ARRAY4 , DIM_TYPE * DIM1 , DIM_TYPE * DIM2 , DIM_TYPE * DIM3 , DIM_TYPE * DIM4 ) <nl> - * 58 . ( DIM_TYPE * DIM1 , DIM_TYPE * DIM2 , DIM_TYPE * DIM3 , DIM_TYPE * DIM4 , DATA_TYPE * * ARGOUTVIEW_ARRAY4 ) <nl> - * 59 . ( DATA_TYPE * * ARGOUTVIEW_FARRAY4 , DIM_TYPE * DIM1 , DIM_TYPE * DIM2 , DIM_TYPE * DIM3 , DIM_TYPE * DIM4 ) <nl> - * 60 . ( DIM_TYPE * DIM1 , DIM_TYPE * DIM2 , DIM_TYPE * DIM3 , DIM_TYPE * DIM4 , DATA_TYPE * * ARGOUTVIEW_FARRAY4 ) <nl> - * <nl> - * 61 . ( DATA_TYPE * * ARGOUTVIEWM_ARRAY1 , DIM_TYPE * DIM1 ) <nl> - * 62 . ( DIM_TYPE * DIM1 , DATA_TYPE * * ARGOUTVIEWM_ARRAY1 ) <nl> - * <nl> - * 63 . ( DATA_TYPE * * ARGOUTVIEWM_ARRAY2 , DIM_TYPE * DIM1 , DIM_TYPE * DIM2 ) <nl> - * 64 . ( DIM_TYPE * DIM1 , DIM_TYPE * DIM2 , DATA_TYPE * * ARGOUTVIEWM_ARRAY2 ) <nl> - * 65 . ( DATA_TYPE * * ARGOUTVIEWM_FARRAY2 , DIM_TYPE * DIM1 , DIM_TYPE * DIM2 ) <nl> - * 66 . ( DIM_TYPE * DIM1 , DIM_TYPE * DIM2 , DATA_TYPE * * ARGOUTVIEWM_FARRAY2 ) <nl> - * <nl> - * 67 . ( DATA_TYPE * * ARGOUTVIEWM_ARRAY3 , DIM_TYPE * DIM1 , DIM_TYPE * DIM2 , DIM_TYPE * DIM3 ) <nl> - * 68 . ( DIM_TYPE * DIM1 , DIM_TYPE * DIM2 , DIM_TYPE * DIM3 , DATA_TYPE * * ARGOUTVIEWM_ARRAY3 ) <nl> - * 69 . ( DATA_TYPE * * ARGOUTVIEWM_FARRAY3 , DIM_TYPE * DIM1 , DIM_TYPE * DIM2 , DIM_TYPE * DIM3 ) <nl> - * 70 . ( DIM_TYPE * DIM1 , DIM_TYPE * DIM2 , DIM_TYPE * DIM3 , DATA_TYPE * * ARGOUTVIEWM_FARRAY3 ) <nl> - * <nl> - * 71 . ( DATA_TYPE * * ARGOUTVIEWM_ARRAY4 , DIM_TYPE * DIM1 , DIM_TYPE * DIM2 , DIM_TYPE * DIM3 , DIM_TYPE * DIM4 ) <nl> - * 72 . ( DIM_TYPE * DIM1 , DIM_TYPE * DIM2 , DIM_TYPE * DIM3 , DIM_TYPE * DIM4 , DATA_TYPE * * ARGOUTVIEWM_ARRAY4 ) <nl> - * 73 . ( DATA_TYPE * * ARGOUTVIEWM_FARRAY4 , DIM_TYPE * DIM1 , DIM_TYPE * DIM2 , DIM_TYPE * DIM3 , DIM_TYPE * DIM4 ) <nl> - * 74 . ( DIM_TYPE * DIM1 , DIM_TYPE * DIM2 , DIM_TYPE * DIM3 , DIM_TYPE * DIM4 , DATA_TYPE * * ARGOUTVIEWM_FARRAY4 ) <nl> - * <nl> - * where " DATA_TYPE " is any type supported by the NumPy module , and <nl> - * " DIM_TYPE " is any int - like type suitable for specifying dimensions . <nl> - * The difference between " ARRAY " typemaps and " FARRAY " typemaps is <nl> - * that the " FARRAY " typemaps expect Fortran ordering of <nl> - * multidimensional arrays . In python , the dimensions will not need <nl> - * to be specified ( except for the " DATA_TYPE * ARGOUT_ARRAY1 " <nl> - * typemaps ) . The IN_ARRAYs can be a numpy array or any sequence that <nl> - * can be converted to a numpy array of the specified type . The <nl> - * INPLACE_ARRAYs must be numpy arrays of the appropriate type . The <nl> - * ARGOUT_ARRAYs will be returned as new numpy arrays of the <nl> - * appropriate type . <nl> - * <nl> - * These typemaps can be applied to existing functions using the <nl> - * % apply directive . For example : <nl> - * <nl> - * % apply ( double * IN_ARRAY1 , int DIM1 ) { ( double * series , int length ) } ; <nl> - * double prod ( double * series , int length ) ; <nl> - * <nl> - * % apply ( int DIM1 , int DIM2 , double * INPLACE_ARRAY2 ) <nl> - * { ( int rows , int cols , double * matrix ) } ; <nl> - * void floor ( int rows , int cols , double * matrix , double f ) ; <nl> - * <nl> - * % apply ( double IN_ARRAY3 [ ANY ] [ ANY ] [ ANY ] ) <nl> - * { ( double tensor [ 2 ] [ 2 ] [ 2 ] ) } ; <nl> - * % apply ( double ARGOUT_ARRAY3 [ ANY ] [ ANY ] [ ANY ] ) <nl> - * { ( double low [ 2 ] [ 2 ] [ 2 ] ) } ; <nl> - * % apply ( double ARGOUT_ARRAY3 [ ANY ] [ ANY ] [ ANY ] ) <nl> - * { ( double upp [ 2 ] [ 2 ] [ 2 ] ) } ; <nl> - * void luSplit ( double tensor [ 2 ] [ 2 ] [ 2 ] , <nl> - * double low [ 2 ] [ 2 ] [ 2 ] , <nl> - * double upp [ 2 ] [ 2 ] [ 2 ] ) ; <nl> - * <nl> - * or directly with <nl> - * <nl> - * double prod ( double * IN_ARRAY1 , int DIM1 ) ; <nl> - * <nl> - * void floor ( int DIM1 , int DIM2 , double * INPLACE_ARRAY2 , double f ) ; <nl> - * <nl> - * void luSplit ( double IN_ARRAY3 [ ANY ] [ ANY ] [ ANY ] , <nl> - * double ARGOUT_ARRAY3 [ ANY ] [ ANY ] [ ANY ] , <nl> - * double ARGOUT_ARRAY3 [ ANY ] [ ANY ] [ ANY ] ) ; <nl> - * / <nl> - <nl> - % define % numpy_typemaps ( DATA_TYPE , DATA_TYPECODE , DIM_TYPE ) <nl> - <nl> - / * * * * * * * * * * * * * * * * * * * * * * * * / <nl> - / * Input Array Typemaps * / <nl> - / * * * * * * * * * * * * * * * * * * * * * * * * / <nl> - <nl> - / * Typemap suite for ( DATA_TYPE IN_ARRAY1 [ ANY ] ) <nl> - * / <nl> - % typecheck ( SWIG_TYPECHECK_DOUBLE_ARRAY , <nl> - fragment = " NumPy_Macros " ) <nl> - ( DATA_TYPE IN_ARRAY1 [ ANY ] ) <nl> - { <nl> - $ 1 = is_array ( $ input ) | | PySequence_Check ( $ input ) ; <nl> - } <nl> - % typemap ( in , <nl> - fragment = " NumPy_Fragments " ) <nl> - ( DATA_TYPE IN_ARRAY1 [ ANY ] ) <nl> - ( PyArrayObject * array = NULL , int is_new_object = 0 ) <nl> - { <nl> - npy_intp size [ 1 ] = { $ 1_dim0 } ; <nl> - array = obj_to_array_contiguous_allow_conversion ( $ input , <nl> - DATA_TYPECODE , <nl> - & is_new_object ) ; <nl> - if ( ! array | | ! require_dimensions ( array , 1 ) | | <nl> - ! require_size ( array , size , 1 ) ) SWIG_fail ; <nl> - $ 1 = ( $ 1_ltype ) array_data ( array ) ; <nl> - } <nl> - % typemap ( freearg ) <nl> - ( DATA_TYPE IN_ARRAY1 [ ANY ] ) <nl> - { <nl> - if ( is_new_object $ argnum & & array $ argnum ) <nl> - { Py_DECREF ( array $ argnum ) ; } <nl> - } <nl> - <nl> - / * Typemap suite for ( DATA_TYPE * IN_ARRAY1 , DIM_TYPE DIM1 ) <nl> - * / <nl> - % typecheck ( SWIG_TYPECHECK_DOUBLE_ARRAY , <nl> - fragment = " NumPy_Macros " ) <nl> - ( DATA_TYPE * IN_ARRAY1 , DIM_TYPE DIM1 ) <nl> - { <nl> - $ 1 = is_array ( $ input ) | | PySequence_Check ( $ input ) ; <nl> - } <nl> - % typemap ( in , <nl> - fragment = " NumPy_Fragments " ) <nl> - ( DATA_TYPE * IN_ARRAY1 , DIM_TYPE DIM1 ) <nl> - ( PyArrayObject * array = NULL , int is_new_object = 0 ) <nl> - { <nl> - npy_intp size [ 1 ] = { - 1 } ; <nl> - array = obj_to_array_contiguous_allow_conversion ( $ input , <nl> - DATA_TYPECODE , <nl> - & is_new_object ) ; <nl> - if ( ! array | | ! require_dimensions ( array , 1 ) | | <nl> - ! require_size ( array , size , 1 ) ) SWIG_fail ; <nl> - $ 1 = ( DATA_TYPE * ) array_data ( array ) ; <nl> - $ 2 = ( DIM_TYPE ) array_size ( array , 0 ) ; <nl> - } <nl> - % typemap ( freearg ) <nl> - ( DATA_TYPE * IN_ARRAY1 , DIM_TYPE DIM1 ) <nl> - { <nl> - if ( is_new_object $ argnum & & array $ argnum ) <nl> - { Py_DECREF ( array $ argnum ) ; } <nl> - } <nl> - <nl> - / * Typemap suite for ( DIM_TYPE DIM1 , DATA_TYPE * IN_ARRAY1 ) <nl> - * / <nl> - % typecheck ( SWIG_TYPECHECK_DOUBLE_ARRAY , <nl> - fragment = " NumPy_Macros " ) <nl> - ( DIM_TYPE DIM1 , DATA_TYPE * IN_ARRAY1 ) <nl> - { <nl> - $ 1 = is_array ( $ input ) | | PySequence_Check ( $ input ) ; <nl> - } <nl> - % typemap ( in , <nl> - fragment = " NumPy_Fragments " ) <nl> - ( DIM_TYPE DIM1 , DATA_TYPE * IN_ARRAY1 ) <nl> - ( PyArrayObject * array = NULL , int is_new_object = 0 ) <nl> - { <nl> - npy_intp size [ 1 ] = { - 1 } ; <nl> - array = obj_to_array_contiguous_allow_conversion ( $ input , <nl> - DATA_TYPECODE , <nl> - & is_new_object ) ; <nl> - if ( ! array | | ! require_dimensions ( array , 1 ) | | <nl> - ! require_size ( array , size , 1 ) ) SWIG_fail ; <nl> - $ 1 = ( DIM_TYPE ) array_size ( array , 0 ) ; <nl> - $ 2 = ( DATA_TYPE * ) array_data ( array ) ; <nl> - } <nl> - % typemap ( freearg ) <nl> - ( DIM_TYPE DIM1 , DATA_TYPE * IN_ARRAY1 ) <nl> - { <nl> - if ( is_new_object $ argnum & & array $ argnum ) <nl> - { Py_DECREF ( array $ argnum ) ; } <nl> - } <nl> - <nl> - / * Typemap suite for ( DATA_TYPE IN_ARRAY2 [ ANY ] [ ANY ] ) <nl> - * / <nl> - % typecheck ( SWIG_TYPECHECK_DOUBLE_ARRAY , <nl> - fragment = " NumPy_Macros " ) <nl> - ( DATA_TYPE IN_ARRAY2 [ ANY ] [ ANY ] ) <nl> - { <nl> - $ 1 = is_array ( $ input ) | | PySequence_Check ( $ input ) ; <nl> - } <nl> - % typemap ( in , <nl> - fragment = " NumPy_Fragments " ) <nl> - ( DATA_TYPE IN_ARRAY2 [ ANY ] [ ANY ] ) <nl> - ( PyArrayObject * array = NULL , int is_new_object = 0 ) <nl> - { <nl> - npy_intp size [ 2 ] = { $ 1_dim0 , $ 1_dim1 } ; <nl> - array = obj_to_array_contiguous_allow_conversion ( $ input , <nl> - DATA_TYPECODE , <nl> - & is_new_object ) ; <nl> - if ( ! array | | ! require_dimensions ( array , 2 ) | | <nl> - ! require_size ( array , size , 2 ) ) SWIG_fail ; <nl> - $ 1 = ( $ 1_ltype ) array_data ( array ) ; <nl> - } <nl> - % typemap ( freearg ) <nl> - ( DATA_TYPE IN_ARRAY2 [ ANY ] [ ANY ] ) <nl> - { <nl> - if ( is_new_object $ argnum & & array $ argnum ) <nl> - { Py_DECREF ( array $ argnum ) ; } <nl> - } <nl> - <nl> - / * Typemap suite for ( DATA_TYPE * IN_ARRAY2 , DIM_TYPE DIM1 , DIM_TYPE DIM2 ) <nl> - * / <nl> - % typecheck ( SWIG_TYPECHECK_DOUBLE_ARRAY , <nl> - fragment = " NumPy_Macros " ) <nl> - ( DATA_TYPE * IN_ARRAY2 , DIM_TYPE DIM1 , DIM_TYPE DIM2 ) <nl> - { <nl> - $ 1 = is_array ( $ input ) | | PySequence_Check ( $ input ) ; <nl> - } <nl> - % typemap ( in , <nl> - fragment = " NumPy_Fragments " ) <nl> - ( DATA_TYPE * IN_ARRAY2 , DIM_TYPE DIM1 , DIM_TYPE DIM2 ) <nl> - ( PyArrayObject * array = NULL , int is_new_object = 0 ) <nl> - { <nl> - npy_intp size [ 2 ] = { - 1 , - 1 } ; <nl> - array = obj_to_array_contiguous_allow_conversion ( $ input , DATA_TYPECODE , <nl> - & is_new_object ) ; <nl> - if ( ! array | | ! require_dimensions ( array , 2 ) | | <nl> - ! require_size ( array , size , 2 ) ) SWIG_fail ; <nl> - $ 1 = ( DATA_TYPE * ) array_data ( array ) ; <nl> - $ 2 = ( DIM_TYPE ) array_size ( array , 0 ) ; <nl> - $ 3 = ( DIM_TYPE ) array_size ( array , 1 ) ; <nl> - } <nl> - % typemap ( freearg ) <nl> - ( DATA_TYPE * IN_ARRAY2 , DIM_TYPE DIM1 , DIM_TYPE DIM2 ) <nl> - { <nl> - if ( is_new_object $ argnum & & array $ argnum ) <nl> - { Py_DECREF ( array $ argnum ) ; } <nl> - } <nl> - <nl> - / * Typemap suite for ( DIM_TYPE DIM1 , DIM_TYPE DIM2 , DATA_TYPE * IN_ARRAY2 ) <nl> - * / <nl> - % typecheck ( SWIG_TYPECHECK_DOUBLE_ARRAY , <nl> - fragment = " NumPy_Macros " ) <nl> - ( DIM_TYPE DIM1 , DIM_TYPE DIM2 , DATA_TYPE * IN_ARRAY2 ) <nl> - { <nl> - $ 1 = is_array ( $ input ) | | PySequence_Check ( $ input ) ; <nl> - } <nl> - % typemap ( in , <nl> - fragment = " NumPy_Fragments " ) <nl> - ( DIM_TYPE DIM1 , DIM_TYPE DIM2 , DATA_TYPE * IN_ARRAY2 ) <nl> - ( PyArrayObject * array = NULL , int is_new_object = 0 ) <nl> - { <nl> - npy_intp size [ 2 ] = { - 1 , - 1 } ; <nl> - array = obj_to_array_contiguous_allow_conversion ( $ input , <nl> - DATA_TYPECODE , <nl> - & is_new_object ) ; <nl> - if ( ! array | | ! require_dimensions ( array , 2 ) | | <nl> - ! require_size ( array , size , 2 ) ) SWIG_fail ; <nl> - $ 1 = ( DIM_TYPE ) array_size ( array , 0 ) ; <nl> - $ 2 = ( DIM_TYPE ) array_size ( array , 1 ) ; <nl> - $ 3 = ( DATA_TYPE * ) array_data ( array ) ; <nl> - } <nl> - % typemap ( freearg ) <nl> - ( DIM_TYPE DIM1 , DIM_TYPE DIM2 , DATA_TYPE * IN_ARRAY2 ) <nl> - { <nl> - if ( is_new_object $ argnum & & array $ argnum ) <nl> - { Py_DECREF ( array $ argnum ) ; } <nl> - } <nl> - <nl> - / * Typemap suite for ( DATA_TYPE * IN_FARRAY2 , DIM_TYPE DIM1 , DIM_TYPE DIM2 ) <nl> - * / <nl> - % typecheck ( SWIG_TYPECHECK_DOUBLE_ARRAY , <nl> - fragment = " NumPy_Macros " ) <nl> - ( DATA_TYPE * IN_FARRAY2 , DIM_TYPE DIM1 , DIM_TYPE DIM2 ) <nl> - { <nl> - $ 1 = is_array ( $ input ) | | PySequence_Check ( $ input ) ; <nl> - } <nl> - % typemap ( in , <nl> - fragment = " NumPy_Fragments " ) <nl> - ( DATA_TYPE * IN_FARRAY2 , DIM_TYPE DIM1 , DIM_TYPE DIM2 ) <nl> - ( PyArrayObject * array = NULL , int is_new_object = 0 ) <nl> - { <nl> - npy_intp size [ 2 ] = { - 1 , - 1 } ; <nl> - array = obj_to_array_fortran_allow_conversion ( $ input , <nl> - DATA_TYPECODE , <nl> - & is_new_object ) ; <nl> - if ( ! array | | ! require_dimensions ( array , 2 ) | | <nl> - ! require_size ( array , size , 2 ) | | ! require_fortran ( array ) ) SWIG_fail ; <nl> - $ 1 = ( DATA_TYPE * ) array_data ( array ) ; <nl> - $ 2 = ( DIM_TYPE ) array_size ( array , 0 ) ; <nl> - $ 3 = ( DIM_TYPE ) array_size ( array , 1 ) ; <nl> - } <nl> - % typemap ( freearg ) <nl> - ( DATA_TYPE * IN_FARRAY2 , DIM_TYPE DIM1 , DIM_TYPE DIM2 ) <nl> - { <nl> - if ( is_new_object $ argnum & & array $ argnum ) <nl> - { Py_DECREF ( array $ argnum ) ; } <nl> - } <nl> - <nl> - / * Typemap suite for ( DIM_TYPE DIM1 , DIM_TYPE DIM2 , DATA_TYPE * IN_FARRAY2 ) <nl> - * / <nl> - % typecheck ( SWIG_TYPECHECK_DOUBLE_ARRAY , <nl> - fragment = " NumPy_Macros " ) <nl> - ( DIM_TYPE DIM1 , DIM_TYPE DIM2 , DATA_TYPE * IN_FARRAY2 ) <nl> - { <nl> - $ 1 = is_array ( $ input ) | | PySequence_Check ( $ input ) ; <nl> - } <nl> - % typemap ( in , <nl> - fragment = " NumPy_Fragments " ) <nl> - ( DIM_TYPE DIM1 , DIM_TYPE DIM2 , DATA_TYPE * IN_FARRAY2 ) <nl> - ( PyArrayObject * array = NULL , int is_new_object = 0 ) <nl> - { <nl> - npy_intp size [ 2 ] = { - 1 , - 1 } ; <nl> - array = obj_to_array_fortran_allow_conversion ( $ input , <nl> - DATA_TYPECODE , <nl> - & is_new_object ) ; <nl> - if ( ! array | | ! require_dimensions ( array , 2 ) | | <nl> - ! require_size ( array , size , 2 ) | | ! require_fortran ( array ) ) SWIG_fail ; <nl> - $ 1 = ( DIM_TYPE ) array_size ( array , 0 ) ; <nl> - $ 2 = ( DIM_TYPE ) array_size ( array , 1 ) ; <nl> - $ 3 = ( DATA_TYPE * ) array_data ( array ) ; <nl> - } <nl> - % typemap ( freearg ) <nl> - ( DIM_TYPE DIM1 , DIM_TYPE DIM2 , DATA_TYPE * IN_FARRAY2 ) <nl> - { <nl> - if ( is_new_object $ argnum & & array $ argnum ) <nl> - { Py_DECREF ( array $ argnum ) ; } <nl> - } <nl> - <nl> - / * Typemap suite for ( DATA_TYPE IN_ARRAY3 [ ANY ] [ ANY ] [ ANY ] ) <nl> - * / <nl> - % typecheck ( SWIG_TYPECHECK_DOUBLE_ARRAY , <nl> - fragment = " NumPy_Macros " ) <nl> - ( DATA_TYPE IN_ARRAY3 [ ANY ] [ ANY ] [ ANY ] ) <nl> - { <nl> - $ 1 = is_array ( $ input ) | | PySequence_Check ( $ input ) ; <nl> - } <nl> - % typemap ( in , <nl> - fragment = " NumPy_Fragments " ) <nl> - ( DATA_TYPE IN_ARRAY3 [ ANY ] [ ANY ] [ ANY ] ) <nl> - ( PyArrayObject * array = NULL , int is_new_object = 0 ) <nl> - { <nl> - npy_intp size [ 3 ] = { $ 1_dim0 , $ 1_dim1 , $ 1_dim2 } ; <nl> - array = obj_to_array_contiguous_allow_conversion ( $ input , <nl> - DATA_TYPECODE , <nl> - & is_new_object ) ; <nl> - if ( ! array | | ! require_dimensions ( array , 3 ) | | <nl> - ! require_size ( array , size , 3 ) ) SWIG_fail ; <nl> - $ 1 = ( $ 1_ltype ) array_data ( array ) ; <nl> - } <nl> - % typemap ( freearg ) <nl> - ( DATA_TYPE IN_ARRAY3 [ ANY ] [ ANY ] [ ANY ] ) <nl> - { <nl> - if ( is_new_object $ argnum & & array $ argnum ) <nl> - { Py_DECREF ( array $ argnum ) ; } <nl> - } <nl> - <nl> - / * Typemap suite for ( DATA_TYPE * IN_ARRAY3 , DIM_TYPE DIM1 , DIM_TYPE DIM2 , <nl> - * DIM_TYPE DIM3 ) <nl> - * / <nl> - % typecheck ( SWIG_TYPECHECK_DOUBLE_ARRAY , <nl> - fragment = " NumPy_Macros " ) <nl> - ( DATA_TYPE * IN_ARRAY3 , DIM_TYPE DIM1 , DIM_TYPE DIM2 , DIM_TYPE DIM3 ) <nl> - { <nl> - $ 1 = is_array ( $ input ) | | PySequence_Check ( $ input ) ; <nl> - } <nl> - % typemap ( in , <nl> - fragment = " NumPy_Fragments " ) <nl> - ( DATA_TYPE * IN_ARRAY3 , DIM_TYPE DIM1 , DIM_TYPE DIM2 , DIM_TYPE DIM3 ) <nl> - ( PyArrayObject * array = NULL , int is_new_object = 0 ) <nl> - { <nl> - npy_intp size [ 3 ] = { - 1 , - 1 , - 1 } ; <nl> - array = obj_to_array_contiguous_allow_conversion ( $ input , DATA_TYPECODE , <nl> - & is_new_object ) ; <nl> - if ( ! array | | ! require_dimensions ( array , 3 ) | | <nl> - ! require_size ( array , size , 3 ) ) SWIG_fail ; <nl> - $ 1 = ( DATA_TYPE * ) array_data ( array ) ; <nl> - $ 2 = ( DIM_TYPE ) array_size ( array , 0 ) ; <nl> - $ 3 = ( DIM_TYPE ) array_size ( array , 1 ) ; <nl> - $ 4 = ( DIM_TYPE ) array_size ( array , 2 ) ; <nl> - } <nl> - % typemap ( freearg ) <nl> - ( DATA_TYPE * IN_ARRAY3 , DIM_TYPE DIM1 , DIM_TYPE DIM2 , DIM_TYPE DIM3 ) <nl> - { <nl> - if ( is_new_object $ argnum & & array $ argnum ) <nl> - { Py_DECREF ( array $ argnum ) ; } <nl> - } <nl> - <nl> - / * Typemap suite for ( DATA_TYPE * * IN_ARRAY3 , DIM_TYPE DIM1 , DIM_TYPE DIM2 , <nl> - * DIM_TYPE DIM3 ) <nl> - * / <nl> - % typecheck ( SWIG_TYPECHECK_DOUBLE_ARRAY , <nl> - fragment = " NumPy_Macros " ) <nl> - ( DATA_TYPE * * IN_ARRAY3 , DIM_TYPE DIM1 , DIM_TYPE DIM2 , DIM_TYPE DIM3 ) <nl> - { <nl> - / * for now , only concerned with lists * / <nl> - $ 1 = PySequence_Check ( $ input ) ; <nl> - } <nl> - % typemap ( in , <nl> - fragment = " NumPy_Fragments " ) <nl> - ( DATA_TYPE * * IN_ARRAY3 , DIM_TYPE DIM1 , DIM_TYPE DIM2 , DIM_TYPE DIM3 ) <nl> - ( DATA_TYPE * * array = NULL , PyArrayObject * * object_array = NULL , int * is_new_object_array = NULL ) <nl> - { <nl> - npy_intp size [ 2 ] = { - 1 , - 1 } ; <nl> - PyArrayObject * temp_array ; <nl> - Py_ssize_t i ; <nl> - int is_new_object ; <nl> - <nl> - / * length of the list * / <nl> - $ 2 = PyList_Size ( $ input ) ; <nl> - <nl> - / * the arrays * / <nl> - array = ( DATA_TYPE * * ) malloc ( $ 2 * sizeof ( DATA_TYPE * ) ) ; <nl> - object_array = ( PyArrayObject * * ) calloc ( $ 2 , sizeof ( PyArrayObject * ) ) ; <nl> - is_new_object_array = ( int * ) calloc ( $ 2 , sizeof ( int ) ) ; <nl> - <nl> - if ( array = = NULL | | object_array = = NULL | | is_new_object_array = = NULL ) <nl> - { <nl> - SWIG_fail ; <nl> - } <nl> - <nl> - for ( i = 0 ; i < $ 2 ; i + + ) <nl> - { <nl> - temp_array = obj_to_array_contiguous_allow_conversion ( PySequence_GetItem ( $ input , i ) , DATA_TYPECODE , & is_new_object ) ; <nl> - <nl> - / * the new array must be stored so that it can be destroyed in freearg * / <nl> - object_array [ i ] = temp_array ; <nl> - is_new_object_array [ i ] = is_new_object ; <nl> - <nl> - if ( ! temp_array | | ! require_dimensions ( temp_array , 2 ) ) SWIG_fail ; <nl> - <nl> - / * store the size of the first array in the list , then use that for comparison . * / <nl> - if ( i = = 0 ) <nl> - { <nl> - size [ 0 ] = array_size ( temp_array , 0 ) ; <nl> - size [ 1 ] = array_size ( temp_array , 1 ) ; <nl> - } <nl> - <nl> - if ( ! require_size ( temp_array , size , 2 ) ) SWIG_fail ; <nl> - <nl> - array [ i ] = ( DATA_TYPE * ) array_data ( temp_array ) ; <nl> - } <nl> - <nl> - $ 1 = ( DATA_TYPE * * ) array ; <nl> - $ 3 = ( DIM_TYPE ) size [ 0 ] ; <nl> - $ 4 = ( DIM_TYPE ) size [ 1 ] ; <nl> - } <nl> - % typemap ( freearg ) <nl> - ( DATA_TYPE * * IN_ARRAY3 , DIM_TYPE DIM1 , DIM_TYPE DIM2 , DIM_TYPE DIM3 ) <nl> - { <nl> - Py_ssize_t i ; <nl> - <nl> - if ( array $ argnum ! = NULL ) free ( array $ argnum ) ; <nl> - <nl> - / * freeing the individual arrays if needed * / <nl> - if ( object_array $ argnum ! = NULL ) <nl> - { <nl> - if ( is_new_object_array $ argnum ! = NULL ) <nl> - { <nl> - for ( i = 0 ; i < $ 2 ; i + + ) <nl> - { <nl> - if ( object_array $ argnum [ i ] ! = NULL & & is_new_object_array $ argnum [ i ] ) <nl> - { Py_DECREF ( object_array $ argnum [ i ] ) ; } <nl> - } <nl> - free ( is_new_object_array $ argnum ) ; <nl> - } <nl> - free ( object_array $ argnum ) ; <nl> - } <nl> - } <nl> - <nl> - / * Typemap suite for ( DIM_TYPE DIM1 , DIM_TYPE DIM2 , DIM_TYPE DIM3 , <nl> - * DATA_TYPE * IN_ARRAY3 ) <nl> - * / <nl> - % typecheck ( SWIG_TYPECHECK_DOUBLE_ARRAY , <nl> - fragment = " NumPy_Macros " ) <nl> - ( DIM_TYPE DIM1 , DIM_TYPE DIM2 , DIM_TYPE DIM3 , DATA_TYPE * IN_ARRAY3 ) <nl> - { <nl> - $ 1 = is_array ( $ input ) | | PySequence_Check ( $ input ) ; <nl> - } <nl> - % typemap ( in , <nl> - fragment = " NumPy_Fragments " ) <nl> - ( DIM_TYPE DIM1 , DIM_TYPE DIM2 , DIM_TYPE DIM3 , DATA_TYPE * IN_ARRAY3 ) <nl> - ( PyArrayObject * array = NULL , int is_new_object = 0 ) <nl> - { <nl> - npy_intp size [ 3 ] = { - 1 , - 1 , - 1 } ; <nl> - array = obj_to_array_contiguous_allow_conversion ( $ input , DATA_TYPECODE , <nl> - & is_new_object ) ; <nl> - if ( ! array | | ! require_dimensions ( array , 3 ) | | <nl> - ! require_size ( array , size , 3 ) ) SWIG_fail ; <nl> - $ 1 = ( DIM_TYPE ) array_size ( array , 0 ) ; <nl> - $ 2 = ( DIM_TYPE ) array_size ( array , 1 ) ; <nl> - $ 3 = ( DIM_TYPE ) array_size ( array , 2 ) ; <nl> - $ 4 = ( DATA_TYPE * ) array_data ( array ) ; <nl> - } <nl> - % typemap ( freearg ) <nl> - ( DIM_TYPE DIM1 , DIM_TYPE DIM2 , DIM_TYPE DIM3 , DATA_TYPE * IN_ARRAY3 ) <nl> - { <nl> - if ( is_new_object $ argnum & & array $ argnum ) <nl> - { Py_DECREF ( array $ argnum ) ; } <nl> - } <nl> - <nl> - / * Typemap suite for ( DATA_TYPE * IN_FARRAY3 , DIM_TYPE DIM1 , DIM_TYPE DIM2 , <nl> - * DIM_TYPE DIM3 ) <nl> - * / <nl> - % typecheck ( SWIG_TYPECHECK_DOUBLE_ARRAY , <nl> - fragment = " NumPy_Macros " ) <nl> - ( DATA_TYPE * IN_FARRAY3 , DIM_TYPE DIM1 , DIM_TYPE DIM2 , DIM_TYPE DIM3 ) <nl> - { <nl> - $ 1 = is_array ( $ input ) | | PySequence_Check ( $ input ) ; <nl> - } <nl> - % typemap ( in , <nl> - fragment = " NumPy_Fragments " ) <nl> - ( DATA_TYPE * IN_FARRAY3 , DIM_TYPE DIM1 , DIM_TYPE DIM2 , DIM_TYPE DIM3 ) <nl> - ( PyArrayObject * array = NULL , int is_new_object = 0 ) <nl> - { <nl> - npy_intp size [ 3 ] = { - 1 , - 1 , - 1 } ; <nl> - array = obj_to_array_fortran_allow_conversion ( $ input , DATA_TYPECODE , <nl> - & is_new_object ) ; <nl> - if ( ! array | | ! require_dimensions ( array , 3 ) | | <nl> - ! require_size ( array , size , 3 ) | ! require_fortran ( array ) ) SWIG_fail ; <nl> - $ 1 = ( DATA_TYPE * ) array_data ( array ) ; <nl> - $ 2 = ( DIM_TYPE ) array_size ( array , 0 ) ; <nl> - $ 3 = ( DIM_TYPE ) array_size ( array , 1 ) ; <nl> - $ 4 = ( DIM_TYPE ) array_size ( array , 2 ) ; <nl> - } <nl> - % typemap ( freearg ) <nl> - ( DATA_TYPE * IN_FARRAY3 , DIM_TYPE DIM1 , DIM_TYPE DIM2 , DIM_TYPE DIM3 ) <nl> - { <nl> - if ( is_new_object $ argnum & & array $ argnum ) <nl> - { Py_DECREF ( array $ argnum ) ; } <nl> - } <nl> - <nl> - / * Typemap suite for ( DIM_TYPE DIM1 , DIM_TYPE DIM2 , DIM_TYPE DIM3 , <nl> - * DATA_TYPE * IN_FARRAY3 ) <nl> - * / <nl> - % typecheck ( SWIG_TYPECHECK_DOUBLE_ARRAY , <nl> - fragment = " NumPy_Macros " ) <nl> - ( DIM_TYPE DIM1 , DIM_TYPE DIM2 , DIM_TYPE DIM3 , DATA_TYPE * IN_FARRAY3 ) <nl> - { <nl> - $ 1 = is_array ( $ input ) | | PySequence_Check ( $ input ) ; <nl> - } <nl> - % typemap ( in , <nl> - fragment = " NumPy_Fragments " ) <nl> - ( DIM_TYPE DIM1 , DIM_TYPE DIM2 , DIM_TYPE DIM3 , DATA_TYPE * IN_FARRAY3 ) <nl> - ( PyArrayObject * array = NULL , int is_new_object = 0 ) <nl> - { <nl> - npy_intp size [ 3 ] = { - 1 , - 1 , - 1 } ; <nl> - array = obj_to_array_fortran_allow_conversion ( $ input , <nl> - DATA_TYPECODE , <nl> - & is_new_object ) ; <nl> - if ( ! array | | ! require_dimensions ( array , 3 ) | | <nl> - ! require_size ( array , size , 3 ) | | ! require_fortran ( array ) ) SWIG_fail ; <nl> - $ 1 = ( DIM_TYPE ) array_size ( array , 0 ) ; <nl> - $ 2 = ( DIM_TYPE ) array_size ( array , 1 ) ; <nl> - $ 3 = ( DIM_TYPE ) array_size ( array , 2 ) ; <nl> - $ 4 = ( DATA_TYPE * ) array_data ( array ) ; <nl> - } <nl> - % typemap ( freearg ) <nl> - ( DIM_TYPE DIM1 , DIM_TYPE DIM2 , DIM_TYPE DIM3 , DATA_TYPE * IN_FARRAY3 ) <nl> - { <nl> - if ( is_new_object $ argnum & & array $ argnum ) <nl> - { Py_DECREF ( array $ argnum ) ; } <nl> - } <nl> - <nl> - / * Typemap suite for ( DATA_TYPE IN_ARRAY4 [ ANY ] [ ANY ] [ ANY ] [ ANY ] ) <nl> - * / <nl> - % typecheck ( SWIG_TYPECHECK_DOUBLE_ARRAY , <nl> - fragment = " NumPy_Macros " ) <nl> - ( DATA_TYPE IN_ARRAY4 [ ANY ] [ ANY ] [ ANY ] [ ANY ] ) <nl> - { <nl> - $ 1 = is_array ( $ input ) | | PySequence_Check ( $ input ) ; <nl> - } <nl> - % typemap ( in , <nl> - fragment = " NumPy_Fragments " ) <nl> - ( DATA_TYPE IN_ARRAY4 [ ANY ] [ ANY ] [ ANY ] [ ANY ] ) <nl> - ( PyArrayObject * array = NULL , int is_new_object = 0 ) <nl> - { <nl> - npy_intp size [ 4 ] = { $ 1_dim0 , $ 1_dim1 , $ 1_dim2 , $ 1_dim3 } ; <nl> - array = obj_to_array_contiguous_allow_conversion ( $ input , DATA_TYPECODE , <nl> - & is_new_object ) ; <nl> - if ( ! array | | ! require_dimensions ( array , 4 ) | | <nl> - ! require_size ( array , size , 4 ) ) SWIG_fail ; <nl> - $ 1 = ( $ 1_ltype ) array_data ( array ) ; <nl> - } <nl> - % typemap ( freearg ) <nl> - ( DATA_TYPE IN_ARRAY4 [ ANY ] [ ANY ] [ ANY ] [ ANY ] ) <nl> - { <nl> - if ( is_new_object $ argnum & & array $ argnum ) <nl> - { Py_DECREF ( array $ argnum ) ; } <nl> - } <nl> - <nl> - / * Typemap suite for ( DATA_TYPE * IN_ARRAY4 , DIM_TYPE DIM1 , DIM_TYPE DIM2 , <nl> - * DIM_TYPE DIM3 , DIM_TYPE DIM4 ) <nl> - * / <nl> - % typecheck ( SWIG_TYPECHECK_DOUBLE_ARRAY , <nl> - fragment = " NumPy_Macros " ) <nl> - ( DATA_TYPE * IN_ARRAY4 , DIM_TYPE DIM1 , DIM_TYPE DIM2 , DIM_TYPE DIM3 , DIM_TYPE DIM4 ) <nl> - { <nl> - $ 1 = is_array ( $ input ) | | PySequence_Check ( $ input ) ; <nl> - } <nl> - % typemap ( in , <nl> - fragment = " NumPy_Fragments " ) <nl> - ( DATA_TYPE * IN_ARRAY4 , DIM_TYPE DIM1 , DIM_TYPE DIM2 , DIM_TYPE DIM3 , DIM_TYPE DIM4 ) <nl> - ( PyArrayObject * array = NULL , int is_new_object = 0 ) <nl> - { <nl> - npy_intp size [ 4 ] = { - 1 , - 1 , - 1 , - 1 } ; <nl> - array = obj_to_array_contiguous_allow_conversion ( $ input , DATA_TYPECODE , <nl> - & is_new_object ) ; <nl> - if ( ! array | | ! require_dimensions ( array , 4 ) | | <nl> - ! require_size ( array , size , 4 ) ) SWIG_fail ; <nl> - $ 1 = ( DATA_TYPE * ) array_data ( array ) ; <nl> - $ 2 = ( DIM_TYPE ) array_size ( array , 0 ) ; <nl> - $ 3 = ( DIM_TYPE ) array_size ( array , 1 ) ; <nl> - $ 4 = ( DIM_TYPE ) array_size ( array , 2 ) ; <nl> - $ 5 = ( DIM_TYPE ) array_size ( array , 3 ) ; <nl> - } <nl> - % typemap ( freearg ) <nl> - ( DATA_TYPE * IN_ARRAY4 , DIM_TYPE DIM1 , DIM_TYPE DIM2 , DIM_TYPE DIM3 , DIM_TYPE DIM4 ) <nl> - { <nl> - if ( is_new_object $ argnum & & array $ argnum ) <nl> - { Py_DECREF ( array $ argnum ) ; } <nl> - } <nl> - <nl> - / * Typemap suite for ( DATA_TYPE * * IN_ARRAY4 , DIM_TYPE DIM1 , DIM_TYPE DIM2 , <nl> - * DIM_TYPE DIM3 , DIM_TYPE DIM4 ) <nl> - * / <nl> - % typecheck ( SWIG_TYPECHECK_DOUBLE_ARRAY , <nl> - fragment = " NumPy_Macros " ) <nl> - ( DATA_TYPE * * IN_ARRAY4 , DIM_TYPE DIM1 , DIM_TYPE DIM2 , DIM_TYPE DIM3 , DIM_TYPE DIM4 ) <nl> - { <nl> - / * for now , only concerned with lists * / <nl> - $ 1 = PySequence_Check ( $ input ) ; <nl> - } <nl> - % typemap ( in , <nl> - fragment = " NumPy_Fragments " ) <nl> - ( DATA_TYPE * * IN_ARRAY4 , DIM_TYPE DIM1 , DIM_TYPE DIM2 , DIM_TYPE DIM3 , DIM_TYPE DIM4 ) <nl> - ( DATA_TYPE * * array = NULL , PyArrayObject * * object_array = NULL , int * is_new_object_array = NULL ) <nl> - { <nl> - npy_intp size [ 3 ] = { - 1 , - 1 , - 1 } ; <nl> - PyArrayObject * temp_array ; <nl> - Py_ssize_t i ; <nl> - int is_new_object ; <nl> - <nl> - / * length of the list * / <nl> - $ 2 = PyList_Size ( $ input ) ; <nl> - <nl> - / * the arrays * / <nl> - array = ( DATA_TYPE * * ) malloc ( $ 2 * sizeof ( DATA_TYPE * ) ) ; <nl> - object_array = ( PyArrayObject * * ) calloc ( $ 2 , sizeof ( PyArrayObject * ) ) ; <nl> - is_new_object_array = ( int * ) calloc ( $ 2 , sizeof ( int ) ) ; <nl> - <nl> - if ( array = = NULL | | object_array = = NULL | | is_new_object_array = = NULL ) <nl> - { <nl> - SWIG_fail ; <nl> - } <nl> - <nl> - for ( i = 0 ; i < $ 2 ; i + + ) <nl> - { <nl> - temp_array = obj_to_array_contiguous_allow_conversion ( PySequence_GetItem ( $ input , i ) , DATA_TYPECODE , & is_new_object ) ; <nl> - <nl> - / * the new array must be stored so that it can be destroyed in freearg * / <nl> - object_array [ i ] = temp_array ; <nl> - is_new_object_array [ i ] = is_new_object ; <nl> - <nl> - if ( ! temp_array | | ! require_dimensions ( temp_array , 3 ) ) SWIG_fail ; <nl> - <nl> - / * store the size of the first array in the list , then use that for comparison . * / <nl> - if ( i = = 0 ) <nl> - { <nl> - size [ 0 ] = array_size ( temp_array , 0 ) ; <nl> - size [ 1 ] = array_size ( temp_array , 1 ) ; <nl> - size [ 2 ] = array_size ( temp_array , 2 ) ; <nl> - } <nl> - <nl> - if ( ! require_size ( temp_array , size , 3 ) ) SWIG_fail ; <nl> - <nl> - array [ i ] = ( DATA_TYPE * ) array_data ( temp_array ) ; <nl> - } <nl> - <nl> - $ 1 = ( DATA_TYPE * * ) array ; <nl> - $ 3 = ( DIM_TYPE ) size [ 0 ] ; <nl> - $ 4 = ( DIM_TYPE ) size [ 1 ] ; <nl> - $ 5 = ( DIM_TYPE ) size [ 2 ] ; <nl> - } <nl> - % typemap ( freearg ) <nl> - ( DATA_TYPE * * IN_ARRAY4 , DIM_TYPE DIM1 , DIM_TYPE DIM2 , DIM_TYPE DIM3 , DIM_TYPE DIM4 ) <nl> - { <nl> - Py_ssize_t i ; <nl> - <nl> - if ( array $ argnum ! = NULL ) free ( array $ argnum ) ; <nl> - <nl> - / * freeing the individual arrays if needed * / <nl> - if ( object_array $ argnum ! = NULL ) <nl> - { <nl> - if ( is_new_object_array $ argnum ! = NULL ) <nl> - { <nl> - for ( i = 0 ; i < $ 2 ; i + + ) <nl> - { <nl> - if ( object_array $ argnum [ i ] ! = NULL & & is_new_object_array $ argnum [ i ] ) <nl> - { Py_DECREF ( object_array $ argnum [ i ] ) ; } <nl> - } <nl> - free ( is_new_object_array $ argnum ) ; <nl> - } <nl> - free ( object_array $ argnum ) ; <nl> - } <nl> - } <nl> - <nl> - / * Typemap suite for ( DIM_TYPE DIM1 , DIM_TYPE DIM2 , DIM_TYPE DIM3 , DIM_TYPE DIM4 , <nl> - * DATA_TYPE * IN_ARRAY4 ) <nl> - * / <nl> - % typecheck ( SWIG_TYPECHECK_DOUBLE_ARRAY , <nl> - fragment = " NumPy_Macros " ) <nl> - ( DIM_TYPE DIM1 , DIM_TYPE DIM2 , DIM_TYPE DIM3 , DIM_TYPE DIM4 , DATA_TYPE * IN_ARRAY4 ) <nl> - { <nl> - $ 1 = is_array ( $ input ) | | PySequence_Check ( $ input ) ; <nl> - } <nl> - % typemap ( in , <nl> - fragment = " NumPy_Fragments " ) <nl> - ( DIM_TYPE DIM1 , DIM_TYPE DIM2 , DIM_TYPE DIM3 , DIM_TYPE DIM4 , DATA_TYPE * IN_ARRAY4 ) <nl> - ( PyArrayObject * array = NULL , int is_new_object = 0 ) <nl> - { <nl> - npy_intp size [ 4 ] = { - 1 , - 1 , - 1 , - 1 } ; <nl> - array = obj_to_array_contiguous_allow_conversion ( $ input , DATA_TYPECODE , <nl> - & is_new_object ) ; <nl> - if ( ! array | | ! require_dimensions ( array , 4 ) | | <nl> - ! require_size ( array , size , 4 ) ) SWIG_fail ; <nl> - $ 1 = ( DIM_TYPE ) array_size ( array , 0 ) ; <nl> - $ 2 = ( DIM_TYPE ) array_size ( array , 1 ) ; <nl> - $ 3 = ( DIM_TYPE ) array_size ( array , 2 ) ; <nl> - $ 4 = ( DIM_TYPE ) array_size ( array , 3 ) ; <nl> - $ 5 = ( DATA_TYPE * ) array_data ( array ) ; <nl> - } <nl> - % typemap ( freearg ) <nl> - ( DIM_TYPE DIM1 , DIM_TYPE DIM2 , DIM_TYPE DIM3 , DIM_TYPE DIM4 , DATA_TYPE * IN_ARRAY4 ) <nl> - { <nl> - if ( is_new_object $ argnum & & array $ argnum ) <nl> - { Py_DECREF ( array $ argnum ) ; } <nl> - } <nl> - <nl> - / * Typemap suite for ( DATA_TYPE * IN_FARRAY4 , DIM_TYPE DIM1 , DIM_TYPE DIM2 , <nl> - * DIM_TYPE DIM3 , DIM_TYPE DIM4 ) <nl> - * / <nl> - % typecheck ( SWIG_TYPECHECK_DOUBLE_ARRAY , <nl> - fragment = " NumPy_Macros " ) <nl> - ( DATA_TYPE * IN_FARRAY4 , DIM_TYPE DIM1 , DIM_TYPE DIM2 , DIM_TYPE DIM3 , DIM_TYPE DIM4 ) <nl> - { <nl> - $ 1 = is_array ( $ input ) | | PySequence_Check ( $ input ) ; <nl> - } <nl> - % typemap ( in , <nl> - fragment = " NumPy_Fragments " ) <nl> - ( DATA_TYPE * IN_FARRAY4 , DIM_TYPE DIM1 , DIM_TYPE DIM2 , DIM_TYPE DIM3 , DIM_TYPE DIM4 ) <nl> - ( PyArrayObject * array = NULL , int is_new_object = 0 ) <nl> - { <nl> - npy_intp size [ 4 ] = { - 1 , - 1 , - 1 , - 1 } ; <nl> - array = obj_to_array_fortran_allow_conversion ( $ input , DATA_TYPECODE , <nl> - & is_new_object ) ; <nl> - if ( ! array | | ! require_dimensions ( array , 4 ) | | <nl> - ! require_size ( array , size , 4 ) | ! require_fortran ( array ) ) SWIG_fail ; <nl> - $ 1 = ( DATA_TYPE * ) array_data ( array ) ; <nl> - $ 2 = ( DIM_TYPE ) array_size ( array , 0 ) ; <nl> - $ 3 = ( DIM_TYPE ) array_size ( array , 1 ) ; <nl> - $ 4 = ( DIM_TYPE ) array_size ( array , 2 ) ; <nl> - $ 5 = ( DIM_TYPE ) array_size ( array , 3 ) ; <nl> - } <nl> - % typemap ( freearg ) <nl> - ( DATA_TYPE * IN_FARRAY4 , DIM_TYPE DIM1 , DIM_TYPE DIM2 , DIM_TYPE DIM3 , DIM_TYPE DIM4 ) <nl> - { <nl> - if ( is_new_object $ argnum & & array $ argnum ) <nl> - { Py_DECREF ( array $ argnum ) ; } <nl> - } <nl> - <nl> - / * Typemap suite for ( DIM_TYPE DIM1 , DIM_TYPE DIM2 , DIM_TYPE DIM3 , DIM_TYPE DIM4 , <nl> - * DATA_TYPE * IN_FARRAY4 ) <nl> - * / <nl> - % typecheck ( SWIG_TYPECHECK_DOUBLE_ARRAY , <nl> - fragment = " NumPy_Macros " ) <nl> - ( DIM_TYPE DIM1 , DIM_TYPE DIM2 , DIM_TYPE DIM3 , DIM_TYPE DIM4 , DATA_TYPE * IN_FARRAY4 ) <nl> - { <nl> - $ 1 = is_array ( $ input ) | | PySequence_Check ( $ input ) ; <nl> - } <nl> - % typemap ( in , <nl> - fragment = " NumPy_Fragments " ) <nl> - ( DIM_TYPE DIM1 , DIM_TYPE DIM2 , DIM_TYPE DIM3 , DIM_TYPE DIM4 , DATA_TYPE * IN_FARRAY4 ) <nl> - ( PyArrayObject * array = NULL , int is_new_object = 0 ) <nl> - { <nl> - npy_intp size [ 4 ] = { - 1 , - 1 , - 1 , - 1 } ; <nl> - array = obj_to_array_fortran_allow_conversion ( $ input , DATA_TYPECODE , <nl> - & is_new_object ) ; <nl> - if ( ! array | | ! require_dimensions ( array , 4 ) | | <nl> - ! require_size ( array , size , 4 ) | | ! require_fortran ( array ) ) SWIG_fail ; <nl> - $ 1 = ( DIM_TYPE ) array_size ( array , 0 ) ; <nl> - $ 2 = ( DIM_TYPE ) array_size ( array , 1 ) ; <nl> - $ 3 = ( DIM_TYPE ) array_size ( array , 2 ) ; <nl> - $ 4 = ( DIM_TYPE ) array_size ( array , 3 ) ; <nl> - $ 5 = ( DATA_TYPE * ) array_data ( array ) ; <nl> - } <nl> - % typemap ( freearg ) <nl> - ( DIM_TYPE DIM1 , DIM_TYPE DIM2 , DIM_TYPE DIM3 , DIM_TYPE DIM4 , DATA_TYPE * IN_FARRAY4 ) <nl> - { <nl> - if ( is_new_object $ argnum & & array $ argnum ) <nl> - { Py_DECREF ( array $ argnum ) ; } <nl> - } <nl> - <nl> - / * * * * * * * * * * * * * * * * * * * * * * * * * * * / <nl> - / * In - Place Array Typemaps * / <nl> - / * * * * * * * * * * * * * * * * * * * * * * * * * * * / <nl> - <nl> - / * Typemap suite for ( DATA_TYPE INPLACE_ARRAY1 [ ANY ] ) <nl> - * / <nl> - % typecheck ( SWIG_TYPECHECK_DOUBLE_ARRAY , <nl> - fragment = " NumPy_Macros " ) <nl> - ( DATA_TYPE INPLACE_ARRAY1 [ ANY ] ) <nl> - { <nl> - $ 1 = is_array ( $ input ) & & PyArray_EquivTypenums ( array_type ( $ input ) , <nl> - DATA_TYPECODE ) ; <nl> - } <nl> - % typemap ( in , <nl> - fragment = " NumPy_Fragments " ) <nl> - ( DATA_TYPE INPLACE_ARRAY1 [ ANY ] ) <nl> - ( PyArrayObject * array = NULL ) <nl> - { <nl> - npy_intp size [ 1 ] = { $ 1_dim0 } ; <nl> - array = obj_to_array_no_conversion ( $ input , DATA_TYPECODE ) ; <nl> - if ( ! array | | ! require_dimensions ( array , 1 ) | | ! require_size ( array , size , 1 ) | | <nl> - ! require_contiguous ( array ) | | ! require_native ( array ) ) SWIG_fail ; <nl> - $ 1 = ( $ 1_ltype ) array_data ( array ) ; <nl> - } <nl> - <nl> - / * Typemap suite for ( DATA_TYPE * INPLACE_ARRAY1 , DIM_TYPE DIM1 ) <nl> - * / <nl> - % typecheck ( SWIG_TYPECHECK_DOUBLE_ARRAY , <nl> - fragment = " NumPy_Macros " ) <nl> - ( DATA_TYPE * INPLACE_ARRAY1 , DIM_TYPE DIM1 ) <nl> - { <nl> - $ 1 = is_array ( $ input ) & & PyArray_EquivTypenums ( array_type ( $ input ) , <nl> - DATA_TYPECODE ) ; <nl> - } <nl> - % typemap ( in , <nl> - fragment = " NumPy_Fragments " ) <nl> - ( DATA_TYPE * INPLACE_ARRAY1 , DIM_TYPE DIM1 ) <nl> - ( PyArrayObject * array = NULL , int i = 1 ) <nl> - { <nl> - array = obj_to_array_no_conversion ( $ input , DATA_TYPECODE ) ; <nl> - if ( ! array | | ! require_dimensions ( array , 1 ) | | ! require_contiguous ( array ) <nl> - | | ! require_native ( array ) ) SWIG_fail ; <nl> - $ 1 = ( DATA_TYPE * ) array_data ( array ) ; <nl> - $ 2 = 1 ; <nl> - for ( i = 0 ; i < array_numdims ( array ) ; + + i ) $ 2 * = array_size ( array , i ) ; <nl> - } <nl> - <nl> - / * Typemap suite for ( DIM_TYPE DIM1 , DATA_TYPE * INPLACE_ARRAY1 ) <nl> - * / <nl> - % typecheck ( SWIG_TYPECHECK_DOUBLE_ARRAY , <nl> - fragment = " NumPy_Macros " ) <nl> - ( DIM_TYPE DIM1 , DATA_TYPE * INPLACE_ARRAY1 ) <nl> - { <nl> - $ 1 = is_array ( $ input ) & & PyArray_EquivTypenums ( array_type ( $ input ) , <nl> - DATA_TYPECODE ) ; <nl> - } <nl> - % typemap ( in , <nl> - fragment = " NumPy_Fragments " ) <nl> - ( DIM_TYPE DIM1 , DATA_TYPE * INPLACE_ARRAY1 ) <nl> - ( PyArrayObject * array = NULL , int i = 0 ) <nl> - { <nl> - array = obj_to_array_no_conversion ( $ input , DATA_TYPECODE ) ; <nl> - if ( ! array | | ! require_dimensions ( array , 1 ) | | ! require_contiguous ( array ) <nl> - | | ! require_native ( array ) ) SWIG_fail ; <nl> - $ 1 = 1 ; <nl> - for ( i = 0 ; i < array_numdims ( array ) ; + + i ) $ 1 * = array_size ( array , i ) ; <nl> - $ 2 = ( DATA_TYPE * ) array_data ( array ) ; <nl> - } <nl> - <nl> - / * Typemap suite for ( DATA_TYPE INPLACE_ARRAY2 [ ANY ] [ ANY ] ) <nl> - * / <nl> - % typecheck ( SWIG_TYPECHECK_DOUBLE_ARRAY , <nl> - fragment = " NumPy_Macros " ) <nl> - ( DATA_TYPE INPLACE_ARRAY2 [ ANY ] [ ANY ] ) <nl> - { <nl> - $ 1 = is_array ( $ input ) & & PyArray_EquivTypenums ( array_type ( $ input ) , <nl> - DATA_TYPECODE ) ; <nl> - } <nl> - % typemap ( in , <nl> - fragment = " NumPy_Fragments " ) <nl> - ( DATA_TYPE INPLACE_ARRAY2 [ ANY ] [ ANY ] ) <nl> - ( PyArrayObject * array = NULL ) <nl> - { <nl> - npy_intp size [ 2 ] = { $ 1_dim0 , $ 1_dim1 } ; <nl> - array = obj_to_array_no_conversion ( $ input , DATA_TYPECODE ) ; <nl> - if ( ! array | | ! require_dimensions ( array , 2 ) | | ! require_size ( array , size , 2 ) | | <nl> - ! require_contiguous ( array ) | | ! require_native ( array ) ) SWIG_fail ; <nl> - $ 1 = ( $ 1_ltype ) array_data ( array ) ; <nl> - } <nl> - <nl> - / * Typemap suite for ( DATA_TYPE * INPLACE_ARRAY2 , DIM_TYPE DIM1 , DIM_TYPE DIM2 ) <nl> - * / <nl> - % typecheck ( SWIG_TYPECHECK_DOUBLE_ARRAY , <nl> - fragment = " NumPy_Macros " ) <nl> - ( DATA_TYPE * INPLACE_ARRAY2 , DIM_TYPE DIM1 , DIM_TYPE DIM2 ) <nl> - { <nl> - $ 1 = is_array ( $ input ) & & PyArray_EquivTypenums ( array_type ( $ input ) , <nl> - DATA_TYPECODE ) ; <nl> - } <nl> - % typemap ( in , <nl> - fragment = " NumPy_Fragments " ) <nl> - ( DATA_TYPE * INPLACE_ARRAY2 , DIM_TYPE DIM1 , DIM_TYPE DIM2 ) <nl> - ( PyArrayObject * array = NULL ) <nl> - { <nl> - array = obj_to_array_no_conversion ( $ input , DATA_TYPECODE ) ; <nl> - if ( ! array | | ! require_dimensions ( array , 2 ) | | ! require_contiguous ( array ) <nl> - | | ! require_native ( array ) ) SWIG_fail ; <nl> - $ 1 = ( DATA_TYPE * ) array_data ( array ) ; <nl> - $ 2 = ( DIM_TYPE ) array_size ( array , 0 ) ; <nl> - $ 3 = ( DIM_TYPE ) array_size ( array , 1 ) ; <nl> - } <nl> - <nl> - / * Typemap suite for ( DIM_TYPE DIM1 , DIM_TYPE DIM2 , DATA_TYPE * INPLACE_ARRAY2 ) <nl> - * / <nl> - % typecheck ( SWIG_TYPECHECK_DOUBLE_ARRAY , <nl> - fragment = " NumPy_Macros " ) <nl> - ( DIM_TYPE DIM1 , DIM_TYPE DIM2 , DATA_TYPE * INPLACE_ARRAY2 ) <nl> - { <nl> - $ 1 = is_array ( $ input ) & & PyArray_EquivTypenums ( array_type ( $ input ) , <nl> - DATA_TYPECODE ) ; <nl> - } <nl> - % typemap ( in , <nl> - fragment = " NumPy_Fragments " ) <nl> - ( DIM_TYPE DIM1 , DIM_TYPE DIM2 , DATA_TYPE * INPLACE_ARRAY2 ) <nl> - ( PyArrayObject * array = NULL ) <nl> - { <nl> - array = obj_to_array_no_conversion ( $ input , DATA_TYPECODE ) ; <nl> - if ( ! array | | ! require_dimensions ( array , 2 ) | | ! require_contiguous ( array ) | | <nl> - ! require_native ( array ) ) SWIG_fail ; <nl> - $ 1 = ( DIM_TYPE ) array_size ( array , 0 ) ; <nl> - $ 2 = ( DIM_TYPE ) array_size ( array , 1 ) ; <nl> - $ 3 = ( DATA_TYPE * ) array_data ( array ) ; <nl> - } <nl> - <nl> - / * Typemap suite for ( DATA_TYPE * INPLACE_FARRAY2 , DIM_TYPE DIM1 , DIM_TYPE DIM2 ) <nl> - * / <nl> - % typecheck ( SWIG_TYPECHECK_DOUBLE_ARRAY , <nl> - fragment = " NumPy_Macros " ) <nl> - ( DATA_TYPE * INPLACE_FARRAY2 , DIM_TYPE DIM1 , DIM_TYPE DIM2 ) <nl> - { <nl> - $ 1 = is_array ( $ input ) & & PyArray_EquivTypenums ( array_type ( $ input ) , <nl> - DATA_TYPECODE ) ; <nl> - } <nl> - % typemap ( in , <nl> - fragment = " NumPy_Fragments " ) <nl> - ( DATA_TYPE * INPLACE_FARRAY2 , DIM_TYPE DIM1 , DIM_TYPE DIM2 ) <nl> - ( PyArrayObject * array = NULL ) <nl> - { <nl> - array = obj_to_array_no_conversion ( $ input , DATA_TYPECODE ) ; <nl> - if ( ! array | | ! require_dimensions ( array , 2 ) | | ! require_contiguous ( array ) <nl> - | | ! require_native ( array ) | | ! require_fortran ( array ) ) SWIG_fail ; <nl> - $ 1 = ( DATA_TYPE * ) array_data ( array ) ; <nl> - $ 2 = ( DIM_TYPE ) array_size ( array , 0 ) ; <nl> - $ 3 = ( DIM_TYPE ) array_size ( array , 1 ) ; <nl> - } <nl> - <nl> - / * Typemap suite for ( DIM_TYPE DIM1 , DIM_TYPE DIM2 , DATA_TYPE * INPLACE_FARRAY2 ) <nl> - * / <nl> - % typecheck ( SWIG_TYPECHECK_DOUBLE_ARRAY , <nl> - fragment = " NumPy_Macros " ) <nl> - ( DIM_TYPE DIM1 , DIM_TYPE DIM2 , DATA_TYPE * INPLACE_FARRAY2 ) <nl> - { <nl> - $ 1 = is_array ( $ input ) & & PyArray_EquivTypenums ( array_type ( $ input ) , <nl> - DATA_TYPECODE ) ; <nl> - } <nl> - % typemap ( in , <nl> - fragment = " NumPy_Fragments " ) <nl> - ( DIM_TYPE DIM1 , DIM_TYPE DIM2 , DATA_TYPE * INPLACE_FARRAY2 ) <nl> - ( PyArrayObject * array = NULL ) <nl> - { <nl> - array = obj_to_array_no_conversion ( $ input , DATA_TYPECODE ) ; <nl> - if ( ! array | | ! require_dimensions ( array , 2 ) | | ! require_contiguous ( array ) | | <nl> - ! require_native ( array ) | | ! require_fortran ( array ) ) SWIG_fail ; <nl> - $ 1 = ( DIM_TYPE ) array_size ( array , 0 ) ; <nl> - $ 2 = ( DIM_TYPE ) array_size ( array , 1 ) ; <nl> - $ 3 = ( DATA_TYPE * ) array_data ( array ) ; <nl> - } <nl> - <nl> - / * Typemap suite for ( DATA_TYPE INPLACE_ARRAY3 [ ANY ] [ ANY ] [ ANY ] ) <nl> - * / <nl> - % typecheck ( SWIG_TYPECHECK_DOUBLE_ARRAY , <nl> - fragment = " NumPy_Macros " ) <nl> - ( DATA_TYPE INPLACE_ARRAY3 [ ANY ] [ ANY ] [ ANY ] ) <nl> - { <nl> - $ 1 = is_array ( $ input ) & & PyArray_EquivTypenums ( array_type ( $ input ) , <nl> - DATA_TYPECODE ) ; <nl> - } <nl> - % typemap ( in , <nl> - fragment = " NumPy_Fragments " ) <nl> - ( DATA_TYPE INPLACE_ARRAY3 [ ANY ] [ ANY ] [ ANY ] ) <nl> - ( PyArrayObject * array = NULL ) <nl> - { <nl> - npy_intp size [ 3 ] = { $ 1_dim0 , $ 1_dim1 , $ 1_dim2 } ; <nl> - array = obj_to_array_no_conversion ( $ input , DATA_TYPECODE ) ; <nl> - if ( ! array | | ! require_dimensions ( array , 3 ) | | ! require_size ( array , size , 3 ) | | <nl> - ! require_contiguous ( array ) | | ! require_native ( array ) ) SWIG_fail ; <nl> - $ 1 = ( $ 1_ltype ) array_data ( array ) ; <nl> - } <nl> - <nl> - / * Typemap suite for ( DATA_TYPE * INPLACE_ARRAY3 , DIM_TYPE DIM1 , DIM_TYPE DIM2 , <nl> - * DIM_TYPE DIM3 ) <nl> - * / <nl> - % typecheck ( SWIG_TYPECHECK_DOUBLE_ARRAY , <nl> - fragment = " NumPy_Macros " ) <nl> - ( DATA_TYPE * INPLACE_ARRAY3 , DIM_TYPE DIM1 , DIM_TYPE DIM2 , DIM_TYPE DIM3 ) <nl> - { <nl> - $ 1 = is_array ( $ input ) & & PyArray_EquivTypenums ( array_type ( $ input ) , <nl> - DATA_TYPECODE ) ; <nl> - } <nl> - % typemap ( in , <nl> - fragment = " NumPy_Fragments " ) <nl> - ( DATA_TYPE * INPLACE_ARRAY3 , DIM_TYPE DIM1 , DIM_TYPE DIM2 , DIM_TYPE DIM3 ) <nl> - ( PyArrayObject * array = NULL ) <nl> - { <nl> - array = obj_to_array_no_conversion ( $ input , DATA_TYPECODE ) ; <nl> - if ( ! array | | ! require_dimensions ( array , 3 ) | | ! require_contiguous ( array ) | | <nl> - ! require_native ( array ) ) SWIG_fail ; <nl> - $ 1 = ( DATA_TYPE * ) array_data ( array ) ; <nl> - $ 2 = ( DIM_TYPE ) array_size ( array , 0 ) ; <nl> - $ 3 = ( DIM_TYPE ) array_size ( array , 1 ) ; <nl> - $ 4 = ( DIM_TYPE ) array_size ( array , 2 ) ; <nl> - } <nl> - <nl> - / * Typemap suite for ( DATA_TYPE * * INPLACE_ARRAY3 , DIM_TYPE DIM1 , DIM_TYPE DIM2 , <nl> - * DIM_TYPE DIM3 ) <nl> - * / <nl> - % typecheck ( SWIG_TYPECHECK_DOUBLE_ARRAY , <nl> - fragment = " NumPy_Macros " ) <nl> - ( DATA_TYPE * * INPLACE_ARRAY3 , DIM_TYPE DIM1 , DIM_TYPE DIM2 , DIM_TYPE DIM3 ) <nl> - { <nl> - $ 1 = PySequence_Check ( $ input ) ; <nl> - } <nl> - % typemap ( in , <nl> - fragment = " NumPy_Fragments " ) <nl> - ( DATA_TYPE * * INPLACE_ARRAY3 , DIM_TYPE DIM1 , DIM_TYPE DIM2 , DIM_TYPE DIM3 ) <nl> - ( DATA_TYPE * * array = NULL , PyArrayObject * * object_array = NULL ) <nl> - { <nl> - npy_intp size [ 2 ] = { - 1 , - 1 } ; <nl> - PyArrayObject * temp_array ; <nl> - Py_ssize_t i ; <nl> - <nl> - / * length of the list * / <nl> - $ 2 = PyList_Size ( $ input ) ; <nl> - <nl> - / * the arrays * / <nl> - array = ( DATA_TYPE * * ) malloc ( $ 2 * sizeof ( DATA_TYPE * ) ) ; <nl> - object_array = ( PyArrayObject * * ) calloc ( $ 2 , sizeof ( PyArrayObject * ) ) ; <nl> - <nl> - if ( array = = NULL | | object_array = = NULL ) <nl> - { <nl> - SWIG_fail ; <nl> - } <nl> - <nl> - for ( i = 0 ; i < $ 2 ; i + + ) <nl> - { <nl> - temp_array = obj_to_array_no_conversion ( PySequence_GetItem ( $ input , i ) , DATA_TYPECODE ) ; <nl> - <nl> - / * the new array must be stored so that it can be destroyed in freearg * / <nl> - object_array [ i ] = temp_array ; <nl> - <nl> - if ( ! temp_array | | ! require_dimensions ( temp_array , 2 ) | | <nl> - ! require_contiguous ( temp_array ) | | <nl> - ! require_native ( temp_array ) | | <nl> - ! PyArray_EquivTypenums ( array_type ( temp_array ) , DATA_TYPECODE ) <nl> - ) SWIG_fail ; <nl> - <nl> - / * store the size of the first array in the list , then use that for comparison . * / <nl> - if ( i = = 0 ) <nl> - { <nl> - size [ 0 ] = array_size ( temp_array , 0 ) ; <nl> - size [ 1 ] = array_size ( temp_array , 1 ) ; <nl> - } <nl> - <nl> - if ( ! require_size ( temp_array , size , 2 ) ) SWIG_fail ; <nl> - <nl> - array [ i ] = ( DATA_TYPE * ) array_data ( temp_array ) ; <nl> - } <nl> - <nl> - $ 1 = ( DATA_TYPE * * ) array ; <nl> - $ 3 = ( DIM_TYPE ) size [ 0 ] ; <nl> - $ 4 = ( DIM_TYPE ) size [ 1 ] ; <nl> - } <nl> - % typemap ( freearg ) <nl> - ( DATA_TYPE * * INPLACE_ARRAY3 , DIM_TYPE DIM1 , DIM_TYPE DIM2 , DIM_TYPE DIM3 ) <nl> - { <nl> - if ( array $ argnum ! = NULL ) free ( array $ argnum ) ; <nl> - if ( object_array $ argnum ! = NULL ) free ( object_array $ argnum ) ; <nl> - } <nl> - <nl> - / * Typemap suite for ( DIM_TYPE DIM1 , DIM_TYPE DIM2 , DIM_TYPE DIM3 , <nl> - * DATA_TYPE * INPLACE_ARRAY3 ) <nl> - * / <nl> - % typecheck ( SWIG_TYPECHECK_DOUBLE_ARRAY , <nl> - fragment = " NumPy_Macros " ) <nl> - ( DIM_TYPE DIM1 , DIM_TYPE DIM2 , DIM_TYPE DIM3 , DATA_TYPE * INPLACE_ARRAY3 ) <nl> - { <nl> - $ 1 = is_array ( $ input ) & & PyArray_EquivTypenums ( array_type ( $ input ) , <nl> - DATA_TYPECODE ) ; <nl> - } <nl> - % typemap ( in , <nl> - fragment = " NumPy_Fragments " ) <nl> - ( DIM_TYPE DIM1 , DIM_TYPE DIM2 , DIM_TYPE DIM3 , DATA_TYPE * INPLACE_ARRAY3 ) <nl> - ( PyArrayObject * array = NULL ) <nl> - { <nl> - array = obj_to_array_no_conversion ( $ input , DATA_TYPECODE ) ; <nl> - if ( ! array | | ! require_dimensions ( array , 3 ) | | ! require_contiguous ( array ) <nl> - | | ! require_native ( array ) ) SWIG_fail ; <nl> - $ 1 = ( DIM_TYPE ) array_size ( array , 0 ) ; <nl> - $ 2 = ( DIM_TYPE ) array_size ( array , 1 ) ; <nl> - $ 3 = ( DIM_TYPE ) array_size ( array , 2 ) ; <nl> - $ 4 = ( DATA_TYPE * ) array_data ( array ) ; <nl> - } <nl> - <nl> - / * Typemap suite for ( DATA_TYPE * INPLACE_FARRAY3 , DIM_TYPE DIM1 , DIM_TYPE DIM2 , <nl> - * DIM_TYPE DIM3 ) <nl> - * / <nl> - % typecheck ( SWIG_TYPECHECK_DOUBLE_ARRAY , <nl> - fragment = " NumPy_Macros " ) <nl> - ( DATA_TYPE * INPLACE_FARRAY3 , DIM_TYPE DIM1 , DIM_TYPE DIM2 , DIM_TYPE DIM3 ) <nl> - { <nl> - $ 1 = is_array ( $ input ) & & PyArray_EquivTypenums ( array_type ( $ input ) , <nl> - DATA_TYPECODE ) ; <nl> - } <nl> - % typemap ( in , <nl> - fragment = " NumPy_Fragments " ) <nl> - ( DATA_TYPE * INPLACE_FARRAY3 , DIM_TYPE DIM1 , DIM_TYPE DIM2 , DIM_TYPE DIM3 ) <nl> - ( PyArrayObject * array = NULL ) <nl> - { <nl> - array = obj_to_array_no_conversion ( $ input , DATA_TYPECODE ) ; <nl> - if ( ! array | | ! require_dimensions ( array , 3 ) | | ! require_contiguous ( array ) | | <nl> - ! require_native ( array ) | | ! require_fortran ( array ) ) SWIG_fail ; <nl> - $ 1 = ( DATA_TYPE * ) array_data ( array ) ; <nl> - $ 2 = ( DIM_TYPE ) array_size ( array , 0 ) ; <nl> - $ 3 = ( DIM_TYPE ) array_size ( array , 1 ) ; <nl> - $ 4 = ( DIM_TYPE ) array_size ( array , 2 ) ; <nl> - } <nl> - <nl> - / * Typemap suite for ( DIM_TYPE DIM1 , DIM_TYPE DIM2 , DIM_TYPE DIM3 , <nl> - * DATA_TYPE * INPLACE_FARRAY3 ) <nl> - * / <nl> - % typecheck ( SWIG_TYPECHECK_DOUBLE_ARRAY , <nl> - fragment = " NumPy_Macros " ) <nl> - ( DIM_TYPE DIM1 , DIM_TYPE DIM2 , DIM_TYPE DIM3 , DATA_TYPE * INPLACE_FARRAY3 ) <nl> - { <nl> - $ 1 = is_array ( $ input ) & & PyArray_EquivTypenums ( array_type ( $ input ) , <nl> - DATA_TYPECODE ) ; <nl> - } <nl> - % typemap ( in , <nl> - fragment = " NumPy_Fragments " ) <nl> - ( DIM_TYPE DIM1 , DIM_TYPE DIM2 , DIM_TYPE DIM3 , DATA_TYPE * INPLACE_FARRAY3 ) <nl> - ( PyArrayObject * array = NULL ) <nl> - { <nl> - array = obj_to_array_no_conversion ( $ input , DATA_TYPECODE ) ; <nl> - if ( ! array | | ! require_dimensions ( array , 3 ) | | ! require_contiguous ( array ) <nl> - | | ! require_native ( array ) | | ! require_fortran ( array ) ) SWIG_fail ; <nl> - $ 1 = ( DIM_TYPE ) array_size ( array , 0 ) ; <nl> - $ 2 = ( DIM_TYPE ) array_size ( array , 1 ) ; <nl> - $ 3 = ( DIM_TYPE ) array_size ( array , 2 ) ; <nl> - $ 4 = ( DATA_TYPE * ) array_data ( array ) ; <nl> - } <nl> - <nl> - / * Typemap suite for ( DATA_TYPE INPLACE_ARRAY4 [ ANY ] [ ANY ] [ ANY ] [ ANY ] ) <nl> - * / <nl> - % typecheck ( SWIG_TYPECHECK_DOUBLE_ARRAY , <nl> - fragment = " NumPy_Macros " ) <nl> - ( DATA_TYPE INPLACE_ARRAY4 [ ANY ] [ ANY ] [ ANY ] [ ANY ] ) <nl> - { <nl> - $ 1 = is_array ( $ input ) & & PyArray_EquivTypenums ( array_type ( $ input ) , <nl> - DATA_TYPECODE ) ; <nl> - } <nl> - % typemap ( in , <nl> - fragment = " NumPy_Fragments " ) <nl> - ( DATA_TYPE INPLACE_ARRAY4 [ ANY ] [ ANY ] [ ANY ] [ ANY ] ) <nl> - ( PyArrayObject * array = NULL ) <nl> - { <nl> - npy_intp size [ 4 ] = { $ 1_dim0 , $ 1_dim1 , $ 1_dim2 , $ 1_dim3 } ; <nl> - array = obj_to_array_no_conversion ( $ input , DATA_TYPECODE ) ; <nl> - if ( ! array | | ! require_dimensions ( array , 4 ) | | ! require_size ( array , size , 4 ) | | <nl> - ! require_contiguous ( array ) | | ! require_native ( array ) ) SWIG_fail ; <nl> - $ 1 = ( $ 1_ltype ) array_data ( array ) ; <nl> - } <nl> - <nl> - / * Typemap suite for ( DATA_TYPE * INPLACE_ARRAY4 , DIM_TYPE DIM1 , DIM_TYPE DIM2 , <nl> - * DIM_TYPE DIM3 , DIM_TYPE DIM4 ) <nl> - * / <nl> - % typecheck ( SWIG_TYPECHECK_DOUBLE_ARRAY , <nl> - fragment = " NumPy_Macros " ) <nl> - ( DATA_TYPE * INPLACE_ARRAY4 , DIM_TYPE DIM1 , DIM_TYPE DIM2 , DIM_TYPE DIM3 , DIM_TYPE DIM4 ) <nl> - { <nl> - $ 1 = is_array ( $ input ) & & PyArray_EquivTypenums ( array_type ( $ input ) , <nl> - DATA_TYPECODE ) ; <nl> - } <nl> - % typemap ( in , <nl> - fragment = " NumPy_Fragments " ) <nl> - ( DATA_TYPE * INPLACE_ARRAY4 , DIM_TYPE DIM1 , DIM_TYPE DIM2 , DIM_TYPE DIM3 , DIM_TYPE DIM4 ) <nl> - ( PyArrayObject * array = NULL ) <nl> - { <nl> - array = obj_to_array_no_conversion ( $ input , DATA_TYPECODE ) ; <nl> - if ( ! array | | ! require_dimensions ( array , 4 ) | | ! require_contiguous ( array ) | | <nl> - ! require_native ( array ) ) SWIG_fail ; <nl> - $ 1 = ( DATA_TYPE * ) array_data ( array ) ; <nl> - $ 2 = ( DIM_TYPE ) array_size ( array , 0 ) ; <nl> - $ 3 = ( DIM_TYPE ) array_size ( array , 1 ) ; <nl> - $ 4 = ( DIM_TYPE ) array_size ( array , 2 ) ; <nl> - $ 5 = ( DIM_TYPE ) array_size ( array , 3 ) ; <nl> - } <nl> - <nl> - / * Typemap suite for ( DATA_TYPE * * INPLACE_ARRAY4 , DIM_TYPE DIM1 , DIM_TYPE DIM2 , <nl> - * DIM_TYPE DIM3 , DIM_TYPE DIM4 ) <nl> - * / <nl> - % typecheck ( SWIG_TYPECHECK_DOUBLE_ARRAY , <nl> - fragment = " NumPy_Macros " ) <nl> - ( DATA_TYPE * * INPLACE_ARRAY4 , DIM_TYPE DIM1 , DIM_TYPE DIM2 , DIM_TYPE DIM3 , DIM_TYPE DIM4 ) <nl> - { <nl> - $ 1 = PySequence_Check ( $ input ) ; <nl> - } <nl> - % typemap ( in , <nl> - fragment = " NumPy_Fragments " ) <nl> - ( DATA_TYPE * * INPLACE_ARRAY4 , DIM_TYPE DIM1 , DIM_TYPE DIM2 , DIM_TYPE DIM3 , DIM_TYPE DIM4 ) <nl> - ( DATA_TYPE * * array = NULL , PyArrayObject * * object_array = NULL ) <nl> - { <nl> - npy_intp size [ 3 ] = { - 1 , - 1 , - 1 } ; <nl> - PyArrayObject * temp_array ; <nl> - Py_ssize_t i ; <nl> - <nl> - / * length of the list * / <nl> - $ 2 = PyList_Size ( $ input ) ; <nl> - <nl> - / * the arrays * / <nl> - array = ( DATA_TYPE * * ) malloc ( $ 2 * sizeof ( DATA_TYPE * ) ) ; <nl> - object_array = ( PyArrayObject * * ) calloc ( $ 2 , sizeof ( PyArrayObject * ) ) ; <nl> - <nl> - if ( array = = NULL | | object_array = = NULL ) <nl> - { <nl> - SWIG_fail ; <nl> - } <nl> - <nl> - for ( i = 0 ; i < $ 2 ; i + + ) <nl> - { <nl> - temp_array = obj_to_array_no_conversion ( PySequence_GetItem ( $ input , i ) , DATA_TYPECODE ) ; <nl> - <nl> - / * the new array must be stored so that it can be destroyed in freearg * / <nl> - object_array [ i ] = temp_array ; <nl> - <nl> - if ( ! temp_array | | ! require_dimensions ( temp_array , 3 ) | | <nl> - ! require_contiguous ( temp_array ) | | <nl> - ! require_native ( temp_array ) | | <nl> - ! PyArray_EquivTypenums ( array_type ( temp_array ) , DATA_TYPECODE ) <nl> - ) SWIG_fail ; <nl> - <nl> - / * store the size of the first array in the list , then use that for comparison . * / <nl> - if ( i = = 0 ) <nl> - { <nl> - size [ 0 ] = array_size ( temp_array , 0 ) ; <nl> - size [ 1 ] = array_size ( temp_array , 1 ) ; <nl> - size [ 2 ] = array_size ( temp_array , 2 ) ; <nl> - } <nl> - <nl> - if ( ! require_size ( temp_array , size , 3 ) ) SWIG_fail ; <nl> - <nl> - array [ i ] = ( DATA_TYPE * ) array_data ( temp_array ) ; <nl> - } <nl> - <nl> - $ 1 = ( DATA_TYPE * * ) array ; <nl> - $ 3 = ( DIM_TYPE ) size [ 0 ] ; <nl> - $ 4 = ( DIM_TYPE ) size [ 1 ] ; <nl> - $ 5 = ( DIM_TYPE ) size [ 2 ] ; <nl> - } <nl> - % typemap ( freearg ) <nl> - ( DATA_TYPE * * INPLACE_ARRAY4 , DIM_TYPE DIM1 , DIM_TYPE DIM2 , DIM_TYPE DIM3 , DIM_TYPE DIM4 ) <nl> - { <nl> - if ( array $ argnum ! = NULL ) free ( array $ argnum ) ; <nl> - if ( object_array $ argnum ! = NULL ) free ( object_array $ argnum ) ; <nl> - } <nl> - <nl> - / * Typemap suite for ( DIM_TYPE DIM1 , DIM_TYPE DIM2 , DIM_TYPE DIM3 , DIM_TYPE DIM4 , <nl> - * DATA_TYPE * INPLACE_ARRAY4 ) <nl> - * / <nl> - % typecheck ( SWIG_TYPECHECK_DOUBLE_ARRAY , <nl> - fragment = " NumPy_Macros " ) <nl> - ( DIM_TYPE DIM1 , DIM_TYPE DIM2 , DIM_TYPE DIM3 , DIM_TYPE DIM4 , DATA_TYPE * INPLACE_ARRAY4 ) <nl> - { <nl> - $ 1 = is_array ( $ input ) & & PyArray_EquivTypenums ( array_type ( $ input ) , <nl> - DATA_TYPECODE ) ; <nl> - } <nl> - % typemap ( in , <nl> - fragment = " NumPy_Fragments " ) <nl> - ( DIM_TYPE DIM1 , DIM_TYPE DIM2 , DIM_TYPE DIM3 , DIM_TYPE DIM4 , DATA_TYPE * INPLACE_ARRAY4 ) <nl> - ( PyArrayObject * array = NULL ) <nl> - { <nl> - array = obj_to_array_no_conversion ( $ input , DATA_TYPECODE ) ; <nl> - if ( ! array | | ! require_dimensions ( array , 4 ) | | ! require_contiguous ( array ) <nl> - | | ! require_native ( array ) ) SWIG_fail ; <nl> - $ 1 = ( DIM_TYPE ) array_size ( array , 0 ) ; <nl> - $ 2 = ( DIM_TYPE ) array_size ( array , 1 ) ; <nl> - $ 3 = ( DIM_TYPE ) array_size ( array , 2 ) ; <nl> - $ 4 = ( DIM_TYPE ) array_size ( array , 3 ) ; <nl> - $ 5 = ( DATA_TYPE * ) array_data ( array ) ; <nl> - } <nl> - <nl> - / * Typemap suite for ( DATA_TYPE * INPLACE_FARRAY4 , DIM_TYPE DIM1 , DIM_TYPE DIM2 , <nl> - * DIM_TYPE DIM3 , DIM_TYPE DIM4 ) <nl> - * / <nl> - % typecheck ( SWIG_TYPECHECK_DOUBLE_ARRAY , <nl> - fragment = " NumPy_Macros " ) <nl> - ( DATA_TYPE * INPLACE_FARRAY4 , DIM_TYPE DIM1 , DIM_TYPE DIM2 , DIM_TYPE DIM3 , DIM_TYPE DIM4 ) <nl> - { <nl> - $ 1 = is_array ( $ input ) & & PyArray_EquivTypenums ( array_type ( $ input ) , <nl> - DATA_TYPECODE ) ; <nl> - } <nl> - % typemap ( in , <nl> - fragment = " NumPy_Fragments " ) <nl> - ( DATA_TYPE * INPLACE_FARRAY4 , DIM_TYPE DIM1 , DIM_TYPE DIM2 , DIM_TYPE DIM3 , DIM_TYPE DIM4 ) <nl> - ( PyArrayObject * array = NULL ) <nl> - { <nl> - array = obj_to_array_no_conversion ( $ input , DATA_TYPECODE ) ; <nl> - if ( ! array | | ! require_dimensions ( array , 4 ) | | ! require_contiguous ( array ) | | <nl> - ! require_native ( array ) | | ! require_fortran ( array ) ) SWIG_fail ; <nl> - $ 1 = ( DATA_TYPE * ) array_data ( array ) ; <nl> - $ 2 = ( DIM_TYPE ) array_size ( array , 0 ) ; <nl> - $ 3 = ( DIM_TYPE ) array_size ( array , 1 ) ; <nl> - $ 4 = ( DIM_TYPE ) array_size ( array , 2 ) ; <nl> - $ 5 = ( DIM_TYPE ) array_size ( array , 3 ) ; <nl> - } <nl> - <nl> - / * Typemap suite for ( DIM_TYPE DIM1 , DIM_TYPE DIM2 , DIM_TYPE DIM3 , <nl> - * DATA_TYPE * INPLACE_FARRAY4 ) <nl> - * / <nl> - % typecheck ( SWIG_TYPECHECK_DOUBLE_ARRAY , <nl> - fragment = " NumPy_Macros " ) <nl> - ( DIM_TYPE DIM1 , DIM_TYPE DIM2 , DIM_TYPE DIM3 , DIM_TYPE DIM4 , DATA_TYPE * INPLACE_FARRAY4 ) <nl> - { <nl> - $ 1 = is_array ( $ input ) & & PyArray_EquivTypenums ( array_type ( $ input ) , <nl> - DATA_TYPECODE ) ; <nl> - } <nl> - % typemap ( in , <nl> - fragment = " NumPy_Fragments " ) <nl> - ( DIM_TYPE DIM1 , DIM_TYPE DIM2 , DIM_TYPE DIM3 , DIM_TYPE DIM4 , DATA_TYPE * INPLACE_FARRAY4 ) <nl> - ( PyArrayObject * array = NULL ) <nl> - { <nl> - array = obj_to_array_no_conversion ( $ input , DATA_TYPECODE ) ; <nl> - if ( ! array | | ! require_dimensions ( array , 4 ) | | ! require_contiguous ( array ) <nl> - | | ! require_native ( array ) | | ! require_fortran ( array ) ) SWIG_fail ; <nl> - $ 1 = ( DIM_TYPE ) array_size ( array , 0 ) ; <nl> - $ 2 = ( DIM_TYPE ) array_size ( array , 1 ) ; <nl> - $ 3 = ( DIM_TYPE ) array_size ( array , 2 ) ; <nl> - $ 4 = ( DIM_TYPE ) array_size ( array , 3 ) ; <nl> - $ 5 = ( DATA_TYPE * ) array_data ( array ) ; <nl> - } <nl> - <nl> - / * * * * * * * * * * * * * * * * * * * * * * * * * / <nl> - / * Argout Array Typemaps * / <nl> - / * * * * * * * * * * * * * * * * * * * * * * * * * / <nl> - <nl> - / * Typemap suite for ( DATA_TYPE ARGOUT_ARRAY1 [ ANY ] ) <nl> - * / <nl> - % typemap ( in , numinputs = 0 , <nl> - fragment = " NumPy_Backward_Compatibility , NumPy_Macros " ) <nl> - ( DATA_TYPE ARGOUT_ARRAY1 [ ANY ] ) <nl> - ( PyObject * array = NULL ) <nl> - { <nl> - npy_intp dims [ 1 ] = { $ 1_dim0 } ; <nl> - array = PyArray_SimpleNew ( 1 , dims , DATA_TYPECODE ) ; <nl> - if ( ! array ) SWIG_fail ; <nl> - $ 1 = ( $ 1_ltype ) array_data ( array ) ; <nl> - } <nl> - % typemap ( argout ) <nl> - ( DATA_TYPE ARGOUT_ARRAY1 [ ANY ] ) <nl> - { <nl> - $ result = SWIG_Python_AppendOutput ( $ result , ( PyObject * ) array $ argnum ) ; <nl> - } <nl> - <nl> - / * Typemap suite for ( DATA_TYPE * ARGOUT_ARRAY1 , DIM_TYPE DIM1 ) <nl> - * / <nl> - % typemap ( in , numinputs = 1 , <nl> - fragment = " NumPy_Fragments " ) <nl> - ( DATA_TYPE * ARGOUT_ARRAY1 , DIM_TYPE DIM1 ) <nl> - ( PyObject * array = NULL ) <nl> - { <nl> - npy_intp dims [ 1 ] ; <nl> - if ( ! PyInt_Check ( $ input ) ) <nl> - { <nl> - const char * typestring = pytype_string ( $ input ) ; <nl> - PyErr_Format ( PyExc_TypeError , <nl> - " Int dimension expected . ' % s ' given . " , <nl> - typestring ) ; <nl> - SWIG_fail ; <nl> - } <nl> - $ 2 = ( DIM_TYPE ) PyInt_AsLong ( $ input ) ; <nl> - dims [ 0 ] = ( npy_intp ) $ 2 ; <nl> - array = PyArray_SimpleNew ( 1 , dims , DATA_TYPECODE ) ; <nl> - if ( ! array ) SWIG_fail ; <nl> - $ 1 = ( DATA_TYPE * ) array_data ( array ) ; <nl> - } <nl> - % typemap ( argout ) <nl> - ( DATA_TYPE * ARGOUT_ARRAY1 , DIM_TYPE DIM1 ) <nl> - { <nl> - $ result = SWIG_Python_AppendOutput ( $ result , ( PyObject * ) array $ argnum ) ; <nl> - } <nl> - <nl> - / * Typemap suite for ( DIM_TYPE DIM1 , DATA_TYPE * ARGOUT_ARRAY1 ) <nl> - * / <nl> - % typemap ( in , numinputs = 1 , <nl> - fragment = " NumPy_Fragments " ) <nl> - ( DIM_TYPE DIM1 , DATA_TYPE * ARGOUT_ARRAY1 ) <nl> - ( PyObject * array = NULL ) <nl> - { <nl> - npy_intp dims [ 1 ] ; <nl> - if ( ! PyInt_Check ( $ input ) ) <nl> - { <nl> - const char * typestring = pytype_string ( $ input ) ; <nl> - PyErr_Format ( PyExc_TypeError , <nl> - " Int dimension expected . ' % s ' given . " , <nl> - typestring ) ; <nl> - SWIG_fail ; <nl> - } <nl> - $ 1 = ( DIM_TYPE ) PyInt_AsLong ( $ input ) ; <nl> - dims [ 0 ] = ( npy_intp ) $ 1 ; <nl> - array = PyArray_SimpleNew ( 1 , dims , DATA_TYPECODE ) ; <nl> - if ( ! array ) SWIG_fail ; <nl> - $ 2 = ( DATA_TYPE * ) array_data ( array ) ; <nl> - } <nl> - % typemap ( argout ) <nl> - ( DIM_TYPE DIM1 , DATA_TYPE * ARGOUT_ARRAY1 ) <nl> - { <nl> - $ result = SWIG_Python_AppendOutput ( $ result , ( PyObject * ) array $ argnum ) ; <nl> - } <nl> - <nl> - / * Typemap suite for ( DATA_TYPE ARGOUT_ARRAY2 [ ANY ] [ ANY ] ) <nl> - * / <nl> - % typemap ( in , numinputs = 0 , <nl> - fragment = " NumPy_Backward_Compatibility , NumPy_Macros " ) <nl> - ( DATA_TYPE ARGOUT_ARRAY2 [ ANY ] [ ANY ] ) <nl> - ( PyObject * array = NULL ) <nl> - { <nl> - npy_intp dims [ 2 ] = { $ 1_dim0 , $ 1_dim1 } ; <nl> - array = PyArray_SimpleNew ( 2 , dims , DATA_TYPECODE ) ; <nl> - if ( ! array ) SWIG_fail ; <nl> - $ 1 = ( $ 1_ltype ) array_data ( array ) ; <nl> - } <nl> - % typemap ( argout ) <nl> - ( DATA_TYPE ARGOUT_ARRAY2 [ ANY ] [ ANY ] ) <nl> - { <nl> - $ result = SWIG_Python_AppendOutput ( $ result , ( PyObject * ) array $ argnum ) ; <nl> - } <nl> - <nl> - / * Typemap suite for ( DATA_TYPE ARGOUT_ARRAY3 [ ANY ] [ ANY ] [ ANY ] ) <nl> - * / <nl> - % typemap ( in , numinputs = 0 , <nl> - fragment = " NumPy_Backward_Compatibility , NumPy_Macros " ) <nl> - ( DATA_TYPE ARGOUT_ARRAY3 [ ANY ] [ ANY ] [ ANY ] ) <nl> - ( PyObject * array = NULL ) <nl> - { <nl> - npy_intp dims [ 3 ] = { $ 1_dim0 , $ 1_dim1 , $ 1_dim2 } ; <nl> - array = PyArray_SimpleNew ( 3 , dims , DATA_TYPECODE ) ; <nl> - if ( ! array ) SWIG_fail ; <nl> - $ 1 = ( $ 1_ltype ) array_data ( array ) ; <nl> - } <nl> - % typemap ( argout ) <nl> - ( DATA_TYPE ARGOUT_ARRAY3 [ ANY ] [ ANY ] [ ANY ] ) <nl> - { <nl> - $ result = SWIG_Python_AppendOutput ( $ result , ( PyObject * ) array $ argnum ) ; <nl> - } <nl> - <nl> - / * Typemap suite for ( DATA_TYPE ARGOUT_ARRAY4 [ ANY ] [ ANY ] [ ANY ] [ ANY ] ) <nl> - * / <nl> - % typemap ( in , numinputs = 0 , <nl> - fragment = " NumPy_Backward_Compatibility , NumPy_Macros " ) <nl> - ( DATA_TYPE ARGOUT_ARRAY4 [ ANY ] [ ANY ] [ ANY ] [ ANY ] ) <nl> - ( PyObject * array = NULL ) <nl> - { <nl> - npy_intp dims [ 4 ] = { $ 1_dim0 , $ 1_dim1 , $ 1_dim2 , $ 1_dim3 } ; <nl> - array = PyArray_SimpleNew ( 4 , dims , DATA_TYPECODE ) ; <nl> - if ( ! array ) SWIG_fail ; <nl> - $ 1 = ( $ 1_ltype ) array_data ( array ) ; <nl> - } <nl> - % typemap ( argout ) <nl> - ( DATA_TYPE ARGOUT_ARRAY4 [ ANY ] [ ANY ] [ ANY ] [ ANY ] ) <nl> - { <nl> - $ result = SWIG_Python_AppendOutput ( $ result , ( PyObject * ) array $ argnum ) ; <nl> - } <nl> - <nl> - / * * * * * * * * * * * * * * * * * * * * * * * * * * * * * / <nl> - / * Argoutview Array Typemaps * / <nl> - / * * * * * * * * * * * * * * * * * * * * * * * * * * * * * / <nl> - <nl> - / * Typemap suite for ( DATA_TYPE * * ARGOUTVIEW_ARRAY1 , DIM_TYPE * DIM1 ) <nl> - * / <nl> - % typemap ( in , numinputs = 0 ) <nl> - ( DATA_TYPE * * ARGOUTVIEW_ARRAY1 , DIM_TYPE * DIM1 ) <nl> - ( DATA_TYPE * data_temp = NULL , DIM_TYPE dim_temp ) <nl> - { <nl> - $ 1 = & data_temp ; <nl> - $ 2 = & dim_temp ; <nl> - } <nl> - % typemap ( argout , <nl> - fragment = " NumPy_Backward_Compatibility " ) <nl> - ( DATA_TYPE * * ARGOUTVIEW_ARRAY1 , DIM_TYPE * DIM1 ) <nl> - { <nl> - npy_intp dims [ 1 ] = { * $ 2 } ; <nl> - PyObject * obj = PyArray_SimpleNewFromData ( 1 , dims , DATA_TYPECODE , ( void * ) ( * $ 1 ) ) ; <nl> - PyArrayObject * array = ( PyArrayObject * ) obj ; <nl> - <nl> - if ( ! array ) SWIG_fail ; <nl> - $ result = SWIG_Python_AppendOutput ( $ result , obj ) ; <nl> - } <nl> - <nl> - / * Typemap suite for ( DIM_TYPE * DIM1 , DATA_TYPE * * ARGOUTVIEW_ARRAY1 ) <nl> - * / <nl> - % typemap ( in , numinputs = 0 ) <nl> - ( DIM_TYPE * DIM1 , DATA_TYPE * * ARGOUTVIEW_ARRAY1 ) <nl> - ( DIM_TYPE dim_temp , DATA_TYPE * data_temp = NULL ) <nl> - { <nl> - $ 1 = & dim_temp ; <nl> - $ 2 = & data_temp ; <nl> - } <nl> - % typemap ( argout , <nl> - fragment = " NumPy_Backward_Compatibility " ) <nl> - ( DIM_TYPE * DIM1 , DATA_TYPE * * ARGOUTVIEW_ARRAY1 ) <nl> - { <nl> - npy_intp dims [ 1 ] = { * $ 1 } ; <nl> - PyObject * obj = PyArray_SimpleNewFromData ( 1 , dims , DATA_TYPECODE , ( void * ) ( * $ 2 ) ) ; <nl> - PyArrayObject * array = ( PyArrayObject * ) obj ; <nl> - <nl> - if ( ! array ) SWIG_fail ; <nl> - $ result = SWIG_Python_AppendOutput ( $ result , obj ) ; <nl> - } <nl> - <nl> - / * Typemap suite for ( DATA_TYPE * * ARGOUTVIEW_ARRAY2 , DIM_TYPE * DIM1 , DIM_TYPE * DIM2 ) <nl> - * / <nl> - % typemap ( in , numinputs = 0 ) <nl> - ( DATA_TYPE * * ARGOUTVIEW_ARRAY2 , DIM_TYPE * DIM1 , DIM_TYPE * DIM2 ) <nl> - ( DATA_TYPE * data_temp = NULL , DIM_TYPE dim1_temp , DIM_TYPE dim2_temp ) <nl> - { <nl> - $ 1 = & data_temp ; <nl> - $ 2 = & dim1_temp ; <nl> - $ 3 = & dim2_temp ; <nl> - } <nl> - % typemap ( argout , <nl> - fragment = " NumPy_Backward_Compatibility " ) <nl> - ( DATA_TYPE * * ARGOUTVIEW_ARRAY2 , DIM_TYPE * DIM1 , DIM_TYPE * DIM2 ) <nl> - { <nl> - npy_intp dims [ 2 ] = { * $ 2 , * $ 3 } ; <nl> - PyObject * obj = PyArray_SimpleNewFromData ( 2 , dims , DATA_TYPECODE , ( void * ) ( * $ 1 ) ) ; <nl> - PyArrayObject * array = ( PyArrayObject * ) obj ; <nl> - <nl> - if ( ! array ) SWIG_fail ; <nl> - $ result = SWIG_Python_AppendOutput ( $ result , obj ) ; <nl> - } <nl> - <nl> - / * Typemap suite for ( DIM_TYPE * DIM1 , DIM_TYPE * DIM2 , DATA_TYPE * * ARGOUTVIEW_ARRAY2 ) <nl> - * / <nl> - % typemap ( in , numinputs = 0 ) <nl> - ( DIM_TYPE * DIM1 , DIM_TYPE * DIM2 , DATA_TYPE * * ARGOUTVIEW_ARRAY2 ) <nl> - ( DIM_TYPE dim1_temp , DIM_TYPE dim2_temp , DATA_TYPE * data_temp = NULL ) <nl> - { <nl> - $ 1 = & dim1_temp ; <nl> - $ 2 = & dim2_temp ; <nl> - $ 3 = & data_temp ; <nl> - } <nl> - % typemap ( argout , <nl> - fragment = " NumPy_Backward_Compatibility " ) <nl> - ( DIM_TYPE * DIM1 , DIM_TYPE * DIM2 , DATA_TYPE * * ARGOUTVIEW_ARRAY2 ) <nl> - { <nl> - npy_intp dims [ 2 ] = { * $ 1 , * $ 2 } ; <nl> - PyObject * obj = PyArray_SimpleNewFromData ( 2 , dims , DATA_TYPECODE , ( void * ) ( * $ 3 ) ) ; <nl> - PyArrayObject * array = ( PyArrayObject * ) obj ; <nl> - <nl> - if ( ! array ) SWIG_fail ; <nl> - $ result = SWIG_Python_AppendOutput ( $ result , obj ) ; <nl> - } <nl> - <nl> - / * Typemap suite for ( DATA_TYPE * * ARGOUTVIEW_FARRAY2 , DIM_TYPE * DIM1 , DIM_TYPE * DIM2 ) <nl> - * / <nl> - % typemap ( in , numinputs = 0 ) <nl> - ( DATA_TYPE * * ARGOUTVIEW_FARRAY2 , DIM_TYPE * DIM1 , DIM_TYPE * DIM2 ) <nl> - ( DATA_TYPE * data_temp = NULL , DIM_TYPE dim1_temp , DIM_TYPE dim2_temp ) <nl> - { <nl> - $ 1 = & data_temp ; <nl> - $ 2 = & dim1_temp ; <nl> - $ 3 = & dim2_temp ; <nl> - } <nl> - % typemap ( argout , <nl> - fragment = " NumPy_Backward_Compatibility , NumPy_Array_Requirements " ) <nl> - ( DATA_TYPE * * ARGOUTVIEW_FARRAY2 , DIM_TYPE * DIM1 , DIM_TYPE * DIM2 ) <nl> - { <nl> - npy_intp dims [ 2 ] = { * $ 2 , * $ 3 } ; <nl> - PyObject * obj = PyArray_SimpleNewFromData ( 2 , dims , DATA_TYPECODE , ( void * ) ( * $ 1 ) ) ; <nl> - PyArrayObject * array = ( PyArrayObject * ) obj ; <nl> - <nl> - if ( ! array | | ! require_fortran ( array ) ) SWIG_fail ; <nl> - $ result = SWIG_Python_AppendOutput ( $ result , obj ) ; <nl> - } <nl> - <nl> - / * Typemap suite for ( DIM_TYPE * DIM1 , DIM_TYPE * DIM2 , DATA_TYPE * * ARGOUTVIEW_FARRAY2 ) <nl> - * / <nl> - % typemap ( in , numinputs = 0 ) <nl> - ( DIM_TYPE * DIM1 , DIM_TYPE * DIM2 , DATA_TYPE * * ARGOUTVIEW_FARRAY2 ) <nl> - ( DIM_TYPE dim1_temp , DIM_TYPE dim2_temp , DATA_TYPE * data_temp = NULL ) <nl> - { <nl> - $ 1 = & dim1_temp ; <nl> - $ 2 = & dim2_temp ; <nl> - $ 3 = & data_temp ; <nl> - } <nl> - % typemap ( argout , <nl> - fragment = " NumPy_Backward_Compatibility , NumPy_Array_Requirements " ) <nl> - ( DIM_TYPE * DIM1 , DIM_TYPE * DIM2 , DATA_TYPE * * ARGOUTVIEW_FARRAY2 ) <nl> - { <nl> - npy_intp dims [ 2 ] = { * $ 1 , * $ 2 } ; <nl> - PyObject * obj = PyArray_SimpleNewFromData ( 2 , dims , DATA_TYPECODE , ( void * ) ( * $ 3 ) ) ; <nl> - PyArrayObject * array = ( PyArrayObject * ) obj ; <nl> - <nl> - if ( ! array | | ! require_fortran ( array ) ) SWIG_fail ; <nl> - $ result = SWIG_Python_AppendOutput ( $ result , obj ) ; <nl> - } <nl> - <nl> - / * Typemap suite for ( DATA_TYPE * * ARGOUTVIEW_ARRAY3 , DIM_TYPE * DIM1 , DIM_TYPE * DIM2 , <nl> - DIM_TYPE * DIM3 ) <nl> - * / <nl> - % typemap ( in , numinputs = 0 ) <nl> - ( DATA_TYPE * * ARGOUTVIEW_ARRAY3 , DIM_TYPE * DIM1 , DIM_TYPE * DIM2 , DIM_TYPE * DIM3 ) <nl> - ( DATA_TYPE * data_temp = NULL , DIM_TYPE dim1_temp , DIM_TYPE dim2_temp , DIM_TYPE dim3_temp ) <nl> - { <nl> - $ 1 = & data_temp ; <nl> - $ 2 = & dim1_temp ; <nl> - $ 3 = & dim2_temp ; <nl> - $ 4 = & dim3_temp ; <nl> - } <nl> - % typemap ( argout , <nl> - fragment = " NumPy_Backward_Compatibility " ) <nl> - ( DATA_TYPE * * ARGOUTVIEW_ARRAY3 , DIM_TYPE * DIM1 , DIM_TYPE * DIM2 , DIM_TYPE * DIM3 ) <nl> - { <nl> - npy_intp dims [ 3 ] = { * $ 2 , * $ 3 , * $ 4 } ; <nl> - PyObject * obj = PyArray_SimpleNewFromData ( 3 , dims , DATA_TYPECODE , ( void * ) ( * $ 1 ) ) ; <nl> - PyArrayObject * array = ( PyArrayObject * ) obj ; <nl> - <nl> - if ( ! array ) SWIG_fail ; <nl> - $ result = SWIG_Python_AppendOutput ( $ result , obj ) ; <nl> - } <nl> - <nl> - / * Typemap suite for ( DIM_TYPE * DIM1 , DIM_TYPE * DIM2 , DIM_TYPE * DIM3 , <nl> - DATA_TYPE * * ARGOUTVIEW_ARRAY3 ) <nl> - * / <nl> - % typemap ( in , numinputs = 0 ) <nl> - ( DIM_TYPE * DIM1 , DIM_TYPE * DIM2 , DIM_TYPE * DIM3 , DATA_TYPE * * ARGOUTVIEW_ARRAY3 ) <nl> - ( DIM_TYPE dim1_temp , DIM_TYPE dim2_temp , DIM_TYPE dim3_temp , DATA_TYPE * data_temp = NULL ) <nl> - { <nl> - $ 1 = & dim1_temp ; <nl> - $ 2 = & dim2_temp ; <nl> - $ 3 = & dim3_temp ; <nl> - $ 4 = & data_temp ; <nl> - } <nl> - % typemap ( argout , <nl> - fragment = " NumPy_Backward_Compatibility " ) <nl> - ( DIM_TYPE * DIM1 , DIM_TYPE * DIM2 , DIM_TYPE * DIM3 , DATA_TYPE * * ARGOUTVIEW_ARRAY3 ) <nl> - { <nl> - npy_intp dims [ 3 ] = { * $ 1 , * $ 2 , * $ 3 } ; <nl> - PyObject * obj = PyArray_SimpleNewFromData ( 3 , dims , DATA_TYPECODE , ( void * ) ( * $ 4 ) ) ; <nl> - PyArrayObject * array = ( PyArrayObject * ) obj ; <nl> - <nl> - if ( ! array ) SWIG_fail ; <nl> - $ result = SWIG_Python_AppendOutput ( $ result , obj ) ; <nl> - } <nl> - <nl> - / * Typemap suite for ( DATA_TYPE * * ARGOUTVIEW_FARRAY3 , DIM_TYPE * DIM1 , DIM_TYPE * DIM2 , <nl> - DIM_TYPE * DIM3 ) <nl> - * / <nl> - % typemap ( in , numinputs = 0 ) <nl> - ( DATA_TYPE * * ARGOUTVIEW_FARRAY3 , DIM_TYPE * DIM1 , DIM_TYPE * DIM2 , DIM_TYPE * DIM3 ) <nl> - ( DATA_TYPE * data_temp = NULL , DIM_TYPE dim1_temp , DIM_TYPE dim2_temp , DIM_TYPE dim3_temp ) <nl> - { <nl> - $ 1 = & data_temp ; <nl> - $ 2 = & dim1_temp ; <nl> - $ 3 = & dim2_temp ; <nl> - $ 4 = & dim3_temp ; <nl> - } <nl> - % typemap ( argout , <nl> - fragment = " NumPy_Backward_Compatibility , NumPy_Array_Requirements " ) <nl> - ( DATA_TYPE * * ARGOUTVIEW_FARRAY3 , DIM_TYPE * DIM1 , DIM_TYPE * DIM2 , DIM_TYPE * DIM3 ) <nl> - { <nl> - npy_intp dims [ 3 ] = { * $ 2 , * $ 3 , * $ 4 } ; <nl> - PyObject * obj = PyArray_SimpleNewFromData ( 3 , dims , DATA_TYPECODE , ( void * ) ( * $ 1 ) ) ; <nl> - PyArrayObject * array = ( PyArrayObject * ) obj ; <nl> - <nl> - if ( ! array | | ! require_fortran ( array ) ) SWIG_fail ; <nl> - $ result = SWIG_Python_AppendOutput ( $ result , obj ) ; <nl> - } <nl> - <nl> - / * Typemap suite for ( DIM_TYPE * DIM1 , DIM_TYPE * DIM2 , DIM_TYPE * DIM3 , <nl> - DATA_TYPE * * ARGOUTVIEW_FARRAY3 ) <nl> - * / <nl> - % typemap ( in , numinputs = 0 ) <nl> - ( DIM_TYPE * DIM1 , DIM_TYPE * DIM2 , DIM_TYPE * DIM3 , DATA_TYPE * * ARGOUTVIEW_FARRAY3 ) <nl> - ( DIM_TYPE dim1_temp , DIM_TYPE dim2_temp , DIM_TYPE dim3_temp , DATA_TYPE * data_temp = NULL ) <nl> - { <nl> - $ 1 = & dim1_temp ; <nl> - $ 2 = & dim2_temp ; <nl> - $ 3 = & dim3_temp ; <nl> - $ 4 = & data_temp ; <nl> - } <nl> - % typemap ( argout , <nl> - fragment = " NumPy_Backward_Compatibility , NumPy_Array_Requirements " ) <nl> - ( DIM_TYPE * DIM1 , DIM_TYPE * DIM2 , DIM_TYPE * DIM3 , DATA_TYPE * * ARGOUTVIEW_FARRAY3 ) <nl> - { <nl> - npy_intp dims [ 3 ] = { * $ 1 , * $ 2 , * $ 3 } ; <nl> - PyObject * obj = PyArray_SimpleNewFromData ( 3 , dims , DATA_TYPECODE , ( void * ) ( * $ 4 ) ) ; <nl> - PyArrayObject * array = ( PyArrayObject * ) obj ; <nl> - <nl> - if ( ! array | | ! require_fortran ( array ) ) SWIG_fail ; <nl> - $ result = SWIG_Python_AppendOutput ( $ result , obj ) ; <nl> - } <nl> - <nl> - / * Typemap suite for ( DATA_TYPE * * ARGOUTVIEW_ARRAY4 , DIM_TYPE * DIM1 , DIM_TYPE * DIM2 , <nl> - DIM_TYPE * DIM3 , DIM_TYPE * DIM4 ) <nl> - * / <nl> - % typemap ( in , numinputs = 0 ) <nl> - ( DATA_TYPE * * ARGOUTVIEW_ARRAY4 , DIM_TYPE * DIM1 , DIM_TYPE * DIM2 , DIM_TYPE * DIM3 , DIM_TYPE * DIM4 ) <nl> - ( DATA_TYPE * data_temp = NULL , DIM_TYPE dim1_temp , DIM_TYPE dim2_temp , DIM_TYPE dim3_temp , DIM_TYPE dim4_temp ) <nl> - { <nl> - $ 1 = & data_temp ; <nl> - $ 2 = & dim1_temp ; <nl> - $ 3 = & dim2_temp ; <nl> - $ 4 = & dim3_temp ; <nl> - $ 5 = & dim4_temp ; <nl> - } <nl> - % typemap ( argout , <nl> - fragment = " NumPy_Backward_Compatibility " ) <nl> - ( DATA_TYPE * * ARGOUTVIEW_ARRAY4 , DIM_TYPE * DIM1 , DIM_TYPE * DIM2 , DIM_TYPE * DIM3 , DIM_TYPE * DIM4 ) <nl> - { <nl> - npy_intp dims [ 4 ] = { * $ 2 , * $ 3 , * $ 4 , * $ 5 } ; <nl> - PyObject * obj = PyArray_SimpleNewFromData ( 4 , dims , DATA_TYPECODE , ( void * ) ( * $ 1 ) ) ; <nl> - PyArrayObject * array = ( PyArrayObject * ) obj ; <nl> - <nl> - if ( ! array ) SWIG_fail ; <nl> - $ result = SWIG_Python_AppendOutput ( $ result , obj ) ; <nl> - } <nl> - <nl> - / * Typemap suite for ( DIM_TYPE * DIM1 , DIM_TYPE * DIM2 , DIM_TYPE * DIM3 , DIM_TYPE * DIM4 , <nl> - DATA_TYPE * * ARGOUTVIEW_ARRAY4 ) <nl> - * / <nl> - % typemap ( in , numinputs = 0 ) <nl> - ( DIM_TYPE * DIM1 , DIM_TYPE * DIM2 , DIM_TYPE * DIM3 , DIM_TYPE * DIM4 , DATA_TYPE * * ARGOUTVIEW_ARRAY4 ) <nl> - ( DIM_TYPE dim1_temp , DIM_TYPE dim2_temp , DIM_TYPE dim3_temp , DIM_TYPE dim4_temp , DATA_TYPE * data_temp = NULL ) <nl> - { <nl> - $ 1 = & dim1_temp ; <nl> - $ 2 = & dim2_temp ; <nl> - $ 3 = & dim3_temp ; <nl> - $ 4 = & dim4_temp ; <nl> - $ 5 = & data_temp ; <nl> - } <nl> - % typemap ( argout , <nl> - fragment = " NumPy_Backward_Compatibility " ) <nl> - ( DIM_TYPE * DIM1 , DIM_TYPE * DIM2 , DIM_TYPE * DIM3 , DIM_TYPE * DIM4 , DATA_TYPE * * ARGOUTVIEW_ARRAY4 ) <nl> - { <nl> - npy_intp dims [ 4 ] = { * $ 1 , * $ 2 , * $ 3 , * $ 4 } ; <nl> - PyObject * obj = PyArray_SimpleNewFromData ( 4 , dims , DATA_TYPECODE , ( void * ) ( * $ 5 ) ) ; <nl> - PyArrayObject * array = ( PyArrayObject * ) obj ; <nl> - <nl> - if ( ! array ) SWIG_fail ; <nl> - $ result = SWIG_Python_AppendOutput ( $ result , obj ) ; <nl> - } <nl> - <nl> - / * Typemap suite for ( DATA_TYPE * * ARGOUTVIEW_FARRAY4 , DIM_TYPE * DIM1 , DIM_TYPE * DIM2 , <nl> - DIM_TYPE * DIM3 , DIM_TYPE * DIM4 ) <nl> - * / <nl> - % typemap ( in , numinputs = 0 ) <nl> - ( DATA_TYPE * * ARGOUTVIEW_FARRAY4 , DIM_TYPE * DIM1 , DIM_TYPE * DIM2 , DIM_TYPE * DIM3 , DIM_TYPE * DIM4 ) <nl> - ( DATA_TYPE * data_temp = NULL , DIM_TYPE dim1_temp , DIM_TYPE dim2_temp , DIM_TYPE dim3_temp , DIM_TYPE dim4_temp ) <nl> - { <nl> - $ 1 = & data_temp ; <nl> - $ 2 = & dim1_temp ; <nl> - $ 3 = & dim2_temp ; <nl> - $ 4 = & dim3_temp ; <nl> - $ 5 = & dim4_temp ; <nl> - } <nl> - % typemap ( argout , <nl> - fragment = " NumPy_Backward_Compatibility , NumPy_Array_Requirements " ) <nl> - ( DATA_TYPE * * ARGOUTVIEW_FARRAY4 , DIM_TYPE * DIM1 , DIM_TYPE * DIM2 , DIM_TYPE * DIM3 , DIM_TYPE * DIM4 ) <nl> - { <nl> - npy_intp dims [ 4 ] = { * $ 2 , * $ 3 , * $ 4 , * $ 5 } ; <nl> - PyObject * obj = PyArray_SimpleNewFromData ( 4 , dims , DATA_TYPECODE , ( void * ) ( * $ 1 ) ) ; <nl> - PyArrayObject * array = ( PyArrayObject * ) obj ; <nl> - <nl> - if ( ! array | | ! require_fortran ( array ) ) SWIG_fail ; <nl> - $ result = SWIG_Python_AppendOutput ( $ result , obj ) ; <nl> - } <nl> - <nl> - / * Typemap suite for ( DIM_TYPE * DIM1 , DIM_TYPE * DIM2 , DIM_TYPE * DIM3 , DIM_TYPE * DIM4 , <nl> - DATA_TYPE * * ARGOUTVIEW_FARRAY4 ) <nl> - * / <nl> - % typemap ( in , numinputs = 0 ) <nl> - ( DIM_TYPE * DIM1 , DIM_TYPE * DIM2 , DIM_TYPE * DIM3 , DIM_TYPE * DIM4 , DATA_TYPE * * ARGOUTVIEW_FARRAY4 ) <nl> - ( DIM_TYPE dim1_temp , DIM_TYPE dim2_temp , DIM_TYPE dim3_temp , DIM_TYPE dim4_temp , DATA_TYPE * data_temp = NULL ) <nl> - { <nl> - $ 1 = & dim1_temp ; <nl> - $ 2 = & dim2_temp ; <nl> - $ 3 = & dim3_temp ; <nl> - $ 4 = & dim4_temp ; <nl> - $ 5 = & data_temp ; <nl> - } <nl> - % typemap ( argout , <nl> - fragment = " NumPy_Backward_Compatibility , NumPy_Array_Requirements " ) <nl> - ( DIM_TYPE * DIM1 , DIM_TYPE * DIM2 , DIM_TYPE * DIM3 , DIM_TYPE * DIM4 , DATA_TYPE * * ARGOUTVIEW_FARRAY4 ) <nl> - { <nl> - npy_intp dims [ 4 ] = { * $ 1 , * $ 2 , * $ 3 , * $ 4 } ; <nl> - PyObject * obj = PyArray_SimpleNewFromData ( 4 , dims , DATA_TYPECODE , ( void * ) ( * $ 5 ) ) ; <nl> - PyArrayObject * array = ( PyArrayObject * ) obj ; <nl> - <nl> - if ( ! array | | ! require_fortran ( array ) ) SWIG_fail ; <nl> - $ result = SWIG_Python_AppendOutput ( $ result , obj ) ; <nl> - } <nl> - <nl> - / * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * / <nl> - / * Managed Argoutview Array Typemaps * / <nl> - / * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * / <nl> - <nl> - / * Typemap suite for ( DATA_TYPE * * ARGOUTVIEWM_ARRAY1 , DIM_TYPE * DIM1 ) <nl> - * / <nl> - % typemap ( in , numinputs = 0 ) <nl> - ( DATA_TYPE * * ARGOUTVIEWM_ARRAY1 , DIM_TYPE * DIM1 ) <nl> - ( DATA_TYPE * data_temp = NULL , DIM_TYPE dim_temp ) <nl> - { <nl> - $ 1 = & data_temp ; <nl> - $ 2 = & dim_temp ; <nl> - } <nl> - % typemap ( argout , <nl> - fragment = " NumPy_Backward_Compatibility , NumPy_Utilities " ) <nl> - ( DATA_TYPE * * ARGOUTVIEWM_ARRAY1 , DIM_TYPE * DIM1 ) <nl> - { <nl> - npy_intp dims [ 1 ] = { * $ 2 } ; <nl> - PyObject * obj = PyArray_SimpleNewFromData ( 1 , dims , DATA_TYPECODE , ( void * ) ( * $ 1 ) ) ; <nl> - PyArrayObject * array = ( PyArrayObject * ) obj ; <nl> - <nl> - if ( ! array ) SWIG_fail ; <nl> - <nl> - % # ifdef SWIGPY_USE_CAPSULE <nl> - PyObject * cap = PyCapsule_New ( ( void * ) ( * $ 1 ) , SWIGPY_CAPSULE_NAME , free_cap ) ; <nl> - % # else <nl> - PyObject * cap = PyCObject_FromVoidPtr ( ( void * ) ( * $ 1 ) , free ) ; <nl> - % # endif <nl> - <nl> - % # if NPY_API_VERSION < 0x00000007 <nl> - PyArray_BASE ( array ) = cap ; <nl> - % # else <nl> - PyArray_SetBaseObject ( array , cap ) ; <nl> - % # endif <nl> - <nl> - $ result = SWIG_Python_AppendOutput ( $ result , obj ) ; <nl> - } <nl> - <nl> - / * Typemap suite for ( DIM_TYPE * DIM1 , DATA_TYPE * * ARGOUTVIEWM_ARRAY1 ) <nl> - * / <nl> - % typemap ( in , numinputs = 0 ) <nl> - ( DIM_TYPE * DIM1 , DATA_TYPE * * ARGOUTVIEWM_ARRAY1 ) <nl> - ( DIM_TYPE dim_temp , DATA_TYPE * data_temp = NULL ) <nl> - { <nl> - $ 1 = & dim_temp ; <nl> - $ 2 = & data_temp ; <nl> - } <nl> - % typemap ( argout , <nl> - fragment = " NumPy_Backward_Compatibility , NumPy_Utilities " ) <nl> - ( DIM_TYPE * DIM1 , DATA_TYPE * * ARGOUTVIEWM_ARRAY1 ) <nl> - { <nl> - npy_intp dims [ 1 ] = { * $ 1 } ; <nl> - PyObject * obj = PyArray_SimpleNewFromData ( 1 , dims , DATA_TYPECODE , ( void * ) ( * $ 2 ) ) ; <nl> - PyArrayObject * array = ( PyArrayObject * ) obj ; <nl> - <nl> - if ( ! array ) SWIG_fail ; <nl> - <nl> - % # ifdef SWIGPY_USE_CAPSULE <nl> - PyObject * cap = PyCapsule_New ( ( void * ) ( * $ 1 ) , SWIGPY_CAPSULE_NAME , free_cap ) ; <nl> - % # else <nl> - PyObject * cap = PyCObject_FromVoidPtr ( ( void * ) ( * $ 1 ) , free ) ; <nl> - % # endif <nl> - <nl> - % # if NPY_API_VERSION < 0x00000007 <nl> - PyArray_BASE ( array ) = cap ; <nl> - % # else <nl> - PyArray_SetBaseObject ( array , cap ) ; <nl> - % # endif <nl> - <nl> - $ result = SWIG_Python_AppendOutput ( $ result , obj ) ; <nl> - } <nl> - <nl> - / * Typemap suite for ( DATA_TYPE * * ARGOUTVIEWM_ARRAY2 , DIM_TYPE * DIM1 , DIM_TYPE * DIM2 ) <nl> - * / <nl> - % typemap ( in , numinputs = 0 ) <nl> - ( DATA_TYPE * * ARGOUTVIEWM_ARRAY2 , DIM_TYPE * DIM1 , DIM_TYPE * DIM2 ) <nl> - ( DATA_TYPE * data_temp = NULL , DIM_TYPE dim1_temp , DIM_TYPE dim2_temp ) <nl> - { <nl> - $ 1 = & data_temp ; <nl> - $ 2 = & dim1_temp ; <nl> - $ 3 = & dim2_temp ; <nl> - } <nl> - % typemap ( argout , <nl> - fragment = " NumPy_Backward_Compatibility , NumPy_Utilities " ) <nl> - ( DATA_TYPE * * ARGOUTVIEWM_ARRAY2 , DIM_TYPE * DIM1 , DIM_TYPE * DIM2 ) <nl> - { <nl> - npy_intp dims [ 2 ] = { * $ 2 , * $ 3 } ; <nl> - PyObject * obj = PyArray_SimpleNewFromData ( 2 , dims , DATA_TYPECODE , ( void * ) ( * $ 1 ) ) ; <nl> - PyArrayObject * array = ( PyArrayObject * ) obj ; <nl> - <nl> - if ( ! array ) SWIG_fail ; <nl> - <nl> - % # ifdef SWIGPY_USE_CAPSULE <nl> - PyObject * cap = PyCapsule_New ( ( void * ) ( * $ 1 ) , SWIGPY_CAPSULE_NAME , free_cap ) ; <nl> - % # else <nl> - PyObject * cap = PyCObject_FromVoidPtr ( ( void * ) ( * $ 1 ) , free ) ; <nl> - % # endif <nl> - <nl> - % # if NPY_API_VERSION < 0x00000007 <nl> - PyArray_BASE ( array ) = cap ; <nl> - % # else <nl> - PyArray_SetBaseObject ( array , cap ) ; <nl> - % # endif <nl> - <nl> - $ result = SWIG_Python_AppendOutput ( $ result , obj ) ; <nl> - } <nl> - <nl> - / * Typemap suite for ( DIM_TYPE * DIM1 , DIM_TYPE * DIM2 , DATA_TYPE * * ARGOUTVIEWM_ARRAY2 ) <nl> - * / <nl> - % typemap ( in , numinputs = 0 ) <nl> - ( DIM_TYPE * DIM1 , DIM_TYPE * DIM2 , DATA_TYPE * * ARGOUTVIEWM_ARRAY2 ) <nl> - ( DIM_TYPE dim1_temp , DIM_TYPE dim2_temp , DATA_TYPE * data_temp = NULL ) <nl> - { <nl> - $ 1 = & dim1_temp ; <nl> - $ 2 = & dim2_temp ; <nl> - $ 3 = & data_temp ; <nl> - } <nl> - % typemap ( argout , <nl> - fragment = " NumPy_Backward_Compatibility , NumPy_Utilities " ) <nl> - ( DIM_TYPE * DIM1 , DIM_TYPE * DIM2 , DATA_TYPE * * ARGOUTVIEWM_ARRAY2 ) <nl> - { <nl> - npy_intp dims [ 2 ] = { * $ 1 , * $ 2 } ; <nl> - PyObject * obj = PyArray_SimpleNewFromData ( 2 , dims , DATA_TYPECODE , ( void * ) ( * $ 3 ) ) ; <nl> - PyArrayObject * array = ( PyArrayObject * ) obj ; <nl> - <nl> - if ( ! array ) SWIG_fail ; <nl> - <nl> - % # ifdef SWIGPY_USE_CAPSULE <nl> - PyObject * cap = PyCapsule_New ( ( void * ) ( * $ 1 ) , SWIGPY_CAPSULE_NAME , free_cap ) ; <nl> - % # else <nl> - PyObject * cap = PyCObject_FromVoidPtr ( ( void * ) ( * $ 1 ) , free ) ; <nl> - % # endif <nl> - <nl> - % # if NPY_API_VERSION < 0x00000007 <nl> - PyArray_BASE ( array ) = cap ; <nl> - % # else <nl> - PyArray_SetBaseObject ( array , cap ) ; <nl> - % # endif <nl> - <nl> - $ result = SWIG_Python_AppendOutput ( $ result , obj ) ; <nl> - } <nl> - <nl> - / * Typemap suite for ( DATA_TYPE * * ARGOUTVIEWM_FARRAY2 , DIM_TYPE * DIM1 , DIM_TYPE * DIM2 ) <nl> - * / <nl> - % typemap ( in , numinputs = 0 ) <nl> - ( DATA_TYPE * * ARGOUTVIEWM_FARRAY2 , DIM_TYPE * DIM1 , DIM_TYPE * DIM2 ) <nl> - ( DATA_TYPE * data_temp = NULL , DIM_TYPE dim1_temp , DIM_TYPE dim2_temp ) <nl> - { <nl> - $ 1 = & data_temp ; <nl> - $ 2 = & dim1_temp ; <nl> - $ 3 = & dim2_temp ; <nl> - } <nl> - % typemap ( argout , <nl> - fragment = " NumPy_Backward_Compatibility , NumPy_Array_Requirements , NumPy_Utilities " ) <nl> - ( DATA_TYPE * * ARGOUTVIEWM_FARRAY2 , DIM_TYPE * DIM1 , DIM_TYPE * DIM2 ) <nl> - { <nl> - npy_intp dims [ 2 ] = { * $ 2 , * $ 3 } ; <nl> - PyObject * obj = PyArray_SimpleNewFromData ( 2 , dims , DATA_TYPECODE , ( void * ) ( * $ 1 ) ) ; <nl> - PyArrayObject * array = ( PyArrayObject * ) obj ; <nl> - <nl> - if ( ! array | | ! require_fortran ( array ) ) SWIG_fail ; <nl> - <nl> - % # ifdef SWIGPY_USE_CAPSULE <nl> - PyObject * cap = PyCapsule_New ( ( void * ) ( * $ 1 ) , SWIGPY_CAPSULE_NAME , free_cap ) ; <nl> - % # else <nl> - PyObject * cap = PyCObject_FromVoidPtr ( ( void * ) ( * $ 1 ) , free ) ; <nl> - % # endif <nl> - <nl> - % # if NPY_API_VERSION < 0x00000007 <nl> - PyArray_BASE ( array ) = cap ; <nl> - % # else <nl> - PyArray_SetBaseObject ( array , cap ) ; <nl> - % # endif <nl> - <nl> - $ result = SWIG_Python_AppendOutput ( $ result , obj ) ; <nl> - } <nl> - <nl> - / * Typemap suite for ( DIM_TYPE * DIM1 , DIM_TYPE * DIM2 , DATA_TYPE * * ARGOUTVIEWM_FARRAY2 ) <nl> - * / <nl> - % typemap ( in , numinputs = 0 ) <nl> - ( DIM_TYPE * DIM1 , DIM_TYPE * DIM2 , DATA_TYPE * * ARGOUTVIEWM_FARRAY2 ) <nl> - ( DIM_TYPE dim1_temp , DIM_TYPE dim2_temp , DATA_TYPE * data_temp = NULL ) <nl> - { <nl> - $ 1 = & dim1_temp ; <nl> - $ 2 = & dim2_temp ; <nl> - $ 3 = & data_temp ; <nl> - } <nl> - % typemap ( argout , <nl> - fragment = " NumPy_Backward_Compatibility , NumPy_Array_Requirements , NumPy_Utilities " ) <nl> - ( DIM_TYPE * DIM1 , DIM_TYPE * DIM2 , DATA_TYPE * * ARGOUTVIEWM_FARRAY2 ) <nl> - { <nl> - npy_intp dims [ 2 ] = { * $ 1 , * $ 2 } ; <nl> - PyObject * obj = PyArray_SimpleNewFromData ( 2 , dims , DATA_TYPECODE , ( void * ) ( * $ 3 ) ) ; <nl> - PyArrayObject * array = ( PyArrayObject * ) obj ; <nl> - <nl> - if ( ! array | | ! require_fortran ( array ) ) SWIG_fail ; <nl> - <nl> - % # ifdef SWIGPY_USE_CAPSULE <nl> - PyObject * cap = PyCapsule_New ( ( void * ) ( * $ 1 ) , SWIGPY_CAPSULE_NAME , free_cap ) ; <nl> - % # else <nl> - PyObject * cap = PyCObject_FromVoidPtr ( ( void * ) ( * $ 1 ) , free ) ; <nl> - % # endif <nl> - <nl> - % # if NPY_API_VERSION < 0x00000007 <nl> - PyArray_BASE ( array ) = cap ; <nl> - % # else <nl> - PyArray_SetBaseObject ( array , cap ) ; <nl> - % # endif <nl> - <nl> - $ result = SWIG_Python_AppendOutput ( $ result , obj ) ; <nl> - } <nl> - <nl> - / * Typemap suite for ( DATA_TYPE * * ARGOUTVIEWM_ARRAY3 , DIM_TYPE * DIM1 , DIM_TYPE * DIM2 , <nl> - DIM_TYPE * DIM3 ) <nl> - * / <nl> - % typemap ( in , numinputs = 0 ) <nl> - ( DATA_TYPE * * ARGOUTVIEWM_ARRAY3 , DIM_TYPE * DIM1 , DIM_TYPE * DIM2 , DIM_TYPE * DIM3 ) <nl> - ( DATA_TYPE * data_temp = NULL , DIM_TYPE dim1_temp , DIM_TYPE dim2_temp , DIM_TYPE dim3_temp ) <nl> - { <nl> - $ 1 = & data_temp ; <nl> - $ 2 = & dim1_temp ; <nl> - $ 3 = & dim2_temp ; <nl> - $ 4 = & dim3_temp ; <nl> - } <nl> - % typemap ( argout , <nl> - fragment = " NumPy_Backward_Compatibility , NumPy_Utilities " ) <nl> - ( DATA_TYPE * * ARGOUTVIEWM_ARRAY3 , DIM_TYPE * DIM1 , DIM_TYPE * DIM2 , DIM_TYPE * DIM3 ) <nl> - { <nl> - npy_intp dims [ 3 ] = { * $ 2 , * $ 3 , * $ 4 } ; <nl> - PyObject * obj = PyArray_SimpleNewFromData ( 3 , dims , DATA_TYPECODE , ( void * ) ( * $ 1 ) ) ; <nl> - PyArrayObject * array = ( PyArrayObject * ) obj ; <nl> - <nl> - if ( ! array ) SWIG_fail ; <nl> - <nl> - % # ifdef SWIGPY_USE_CAPSULE <nl> - PyObject * cap = PyCapsule_New ( ( void * ) ( * $ 1 ) , SWIGPY_CAPSULE_NAME , free_cap ) ; <nl> - % # else <nl> - PyObject * cap = PyCObject_FromVoidPtr ( ( void * ) ( * $ 1 ) , free ) ; <nl> - % # endif <nl> - <nl> - % # if NPY_API_VERSION < 0x00000007 <nl> - PyArray_BASE ( array ) = cap ; <nl> - % # else <nl> - PyArray_SetBaseObject ( array , cap ) ; <nl> - % # endif <nl> - <nl> - $ result = SWIG_Python_AppendOutput ( $ result , obj ) ; <nl> - } <nl> - <nl> - / * Typemap suite for ( DIM_TYPE * DIM1 , DIM_TYPE * DIM2 , DIM_TYPE * DIM3 , <nl> - DATA_TYPE * * ARGOUTVIEWM_ARRAY3 ) <nl> - * / <nl> - % typemap ( in , numinputs = 0 ) <nl> - ( DIM_TYPE * DIM1 , DIM_TYPE * DIM2 , DIM_TYPE * DIM3 , DATA_TYPE * * ARGOUTVIEWM_ARRAY3 ) <nl> - ( DIM_TYPE dim1_temp , DIM_TYPE dim2_temp , DIM_TYPE dim3_temp , DATA_TYPE * data_temp = NULL ) <nl> - { <nl> - $ 1 = & dim1_temp ; <nl> - $ 2 = & dim2_temp ; <nl> - $ 3 = & dim3_temp ; <nl> - $ 4 = & data_temp ; <nl> - } <nl> - % typemap ( argout , <nl> - fragment = " NumPy_Backward_Compatibility , NumPy_Utilities " ) <nl> - ( DIM_TYPE * DIM1 , DIM_TYPE * DIM2 , DIM_TYPE * DIM3 , DATA_TYPE * * ARGOUTVIEWM_ARRAY3 ) <nl> - { <nl> - npy_intp dims [ 3 ] = { * $ 1 , * $ 2 , * $ 3 } ; <nl> - PyObject * obj = PyArray_SimpleNewFromData ( 3 , dims , DATA_TYPECODE , ( void * ) ( * $ 4 ) ) ; <nl> - PyArrayObject * array = ( PyArrayObject * ) obj ; <nl> - <nl> - if ( ! array ) SWIG_fail ; <nl> - <nl> - % # ifdef SWIGPY_USE_CAPSULE <nl> - PyObject * cap = PyCapsule_New ( ( void * ) ( * $ 1 ) , SWIGPY_CAPSULE_NAME , free_cap ) ; <nl> - % # else <nl> - PyObject * cap = PyCObject_FromVoidPtr ( ( void * ) ( * $ 1 ) , free ) ; <nl> - % # endif <nl> - <nl> - % # if NPY_API_VERSION < 0x00000007 <nl> - PyArray_BASE ( array ) = cap ; <nl> - % # else <nl> - PyArray_SetBaseObject ( array , cap ) ; <nl> - % # endif <nl> - <nl> - $ result = SWIG_Python_AppendOutput ( $ result , obj ) ; <nl> - } <nl> - <nl> - / * Typemap suite for ( DATA_TYPE * * ARGOUTVIEWM_FARRAY3 , DIM_TYPE * DIM1 , DIM_TYPE * DIM2 , <nl> - DIM_TYPE * DIM3 ) <nl> - * / <nl> - % typemap ( in , numinputs = 0 ) <nl> - ( DATA_TYPE * * ARGOUTVIEWM_FARRAY3 , DIM_TYPE * DIM1 , DIM_TYPE * DIM2 , DIM_TYPE * DIM3 ) <nl> - ( DATA_TYPE * data_temp = NULL , DIM_TYPE dim1_temp , DIM_TYPE dim2_temp , DIM_TYPE dim3_temp ) <nl> - { <nl> - $ 1 = & data_temp ; <nl> - $ 2 = & dim1_temp ; <nl> - $ 3 = & dim2_temp ; <nl> - $ 4 = & dim3_temp ; <nl> - } <nl> - % typemap ( argout , <nl> - fragment = " NumPy_Backward_Compatibility , NumPy_Array_Requirements , NumPy_Utilities " ) <nl> - ( DATA_TYPE * * ARGOUTVIEWM_FARRAY3 , DIM_TYPE * DIM1 , DIM_TYPE * DIM2 , DIM_TYPE * DIM3 ) <nl> - { <nl> - npy_intp dims [ 3 ] = { * $ 2 , * $ 3 , * $ 4 } ; <nl> - PyObject * obj = PyArray_SimpleNewFromData ( 3 , dims , DATA_TYPECODE , ( void * ) ( * $ 1 ) ) ; <nl> - PyArrayObject * array = ( PyArrayObject * ) obj ; <nl> - <nl> - if ( ! array | | ! require_fortran ( array ) ) SWIG_fail ; <nl> - <nl> - % # ifdef SWIGPY_USE_CAPSULE <nl> - PyObject * cap = PyCapsule_New ( ( void * ) ( * $ 1 ) , SWIGPY_CAPSULE_NAME , free_cap ) ; <nl> - % # else <nl> - PyObject * cap = PyCObject_FromVoidPtr ( ( void * ) ( * $ 1 ) , free ) ; <nl> - % # endif <nl> - <nl> - % # if NPY_API_VERSION < 0x00000007 <nl> - PyArray_BASE ( array ) = cap ; <nl> - % # else <nl> - PyArray_SetBaseObject ( array , cap ) ; <nl> - % # endif <nl> - <nl> - $ result = SWIG_Python_AppendOutput ( $ result , obj ) ; <nl> - } <nl> - <nl> - / * Typemap suite for ( DIM_TYPE * DIM1 , DIM_TYPE * DIM2 , DIM_TYPE * DIM3 , <nl> - DATA_TYPE * * ARGOUTVIEWM_FARRAY3 ) <nl> - * / <nl> - % typemap ( in , numinputs = 0 ) <nl> - ( DIM_TYPE * DIM1 , DIM_TYPE * DIM2 , DIM_TYPE * DIM3 , DATA_TYPE * * ARGOUTVIEWM_FARRAY3 ) <nl> - ( DIM_TYPE dim1_temp , DIM_TYPE dim2_temp , DIM_TYPE dim3_temp , DATA_TYPE * data_temp = NULL ) <nl> - { <nl> - $ 1 = & dim1_temp ; <nl> - $ 2 = & dim2_temp ; <nl> - $ 3 = & dim3_temp ; <nl> - $ 4 = & data_temp ; <nl> - } <nl> - % typemap ( argout , <nl> - fragment = " NumPy_Backward_Compatibility , NumPy_Array_Requirements , NumPy_Utilities " ) <nl> - ( DIM_TYPE * DIM1 , DIM_TYPE * DIM2 , DIM_TYPE * DIM3 , DATA_TYPE * * ARGOUTVIEWM_FARRAY3 ) <nl> - { <nl> - npy_intp dims [ 3 ] = { * $ 1 , * $ 2 , * $ 3 } ; <nl> - PyObject * obj = PyArray_SimpleNewFromData ( 3 , dims , DATA_TYPECODE , ( void * ) ( * $ 4 ) ) ; <nl> - PyArrayObject * array = ( PyArrayObject * ) obj ; <nl> - <nl> - if ( ! array | | ! require_fortran ( array ) ) SWIG_fail ; <nl> - <nl> - % # ifdef SWIGPY_USE_CAPSULE <nl> - PyObject * cap = PyCapsule_New ( ( void * ) ( * $ 1 ) , SWIGPY_CAPSULE_NAME , free_cap ) ; <nl> - % # else <nl> - PyObject * cap = PyCObject_FromVoidPtr ( ( void * ) ( * $ 1 ) , free ) ; <nl> - % # endif <nl> - <nl> - % # if NPY_API_VERSION < 0x00000007 <nl> - PyArray_BASE ( array ) = cap ; <nl> - % # else <nl> - PyArray_SetBaseObject ( array , cap ) ; <nl> - % # endif <nl> - <nl> - $ result = SWIG_Python_AppendOutput ( $ result , obj ) ; <nl> - } <nl> - <nl> - / * Typemap suite for ( DATA_TYPE * * ARGOUTVIEWM_ARRAY4 , DIM_TYPE * DIM1 , DIM_TYPE * DIM2 , <nl> - DIM_TYPE * DIM3 , DIM_TYPE * DIM4 ) <nl> - * / <nl> - % typemap ( in , numinputs = 0 ) <nl> - ( DATA_TYPE * * ARGOUTVIEWM_ARRAY4 , DIM_TYPE * DIM1 , DIM_TYPE * DIM2 , DIM_TYPE * DIM3 , DIM_TYPE * DIM4 ) <nl> - ( DATA_TYPE * data_temp = NULL , DIM_TYPE dim1_temp , DIM_TYPE dim2_temp , DIM_TYPE dim3_temp , DIM_TYPE dim4_temp ) <nl> - { <nl> - $ 1 = & data_temp ; <nl> - $ 2 = & dim1_temp ; <nl> - $ 3 = & dim2_temp ; <nl> - $ 4 = & dim3_temp ; <nl> - $ 5 = & dim4_temp ; <nl> - } <nl> - % typemap ( argout , <nl> - fragment = " NumPy_Backward_Compatibility , NumPy_Utilities " ) <nl> - ( DATA_TYPE * * ARGOUTVIEWM_ARRAY4 , DIM_TYPE * DIM1 , DIM_TYPE * DIM2 , DIM_TYPE * DIM3 , DIM_TYPE * DIM4 ) <nl> - { <nl> - npy_intp dims [ 4 ] = { * $ 2 , * $ 3 , * $ 4 , * $ 5 } ; <nl> - PyObject * obj = PyArray_SimpleNewFromData ( 4 , dims , DATA_TYPECODE , ( void * ) ( * $ 1 ) ) ; <nl> - PyArrayObject * array = ( PyArrayObject * ) obj ; <nl> - <nl> - if ( ! array ) SWIG_fail ; <nl> - <nl> - % # ifdef SWIGPY_USE_CAPSULE <nl> - PyObject * cap = PyCapsule_New ( ( void * ) ( * $ 1 ) , SWIGPY_CAPSULE_NAME , free_cap ) ; <nl> - % # else <nl> - PyObject * cap = PyCObject_FromVoidPtr ( ( void * ) ( * $ 1 ) , free ) ; <nl> - % # endif <nl> - <nl> - % # if NPY_API_VERSION < 0x00000007 <nl> - PyArray_BASE ( array ) = cap ; <nl> - % # else <nl> - PyArray_SetBaseObject ( array , cap ) ; <nl> - % # endif <nl> - <nl> - $ result = SWIG_Python_AppendOutput ( $ result , obj ) ; <nl> - } <nl> - <nl> - / * Typemap suite for ( DIM_TYPE * DIM1 , DIM_TYPE * DIM2 , DIM_TYPE * DIM3 , DIM_TYPE * DIM4 , <nl> - DATA_TYPE * * ARGOUTVIEWM_ARRAY4 ) <nl> - * / <nl> - % typemap ( in , numinputs = 0 ) <nl> - ( DIM_TYPE * DIM1 , DIM_TYPE * DIM2 , DIM_TYPE * DIM3 , DIM_TYPE * DIM4 , DATA_TYPE * * ARGOUTVIEWM_ARRAY4 ) <nl> - ( DIM_TYPE dim1_temp , DIM_TYPE dim2_temp , DIM_TYPE dim3_temp , DIM_TYPE dim4_temp , DATA_TYPE * data_temp = NULL ) <nl> - { <nl> - $ 1 = & dim1_temp ; <nl> - $ 2 = & dim2_temp ; <nl> - $ 3 = & dim3_temp ; <nl> - $ 4 = & dim4_temp ; <nl> - $ 5 = & data_temp ; <nl> - } <nl> - % typemap ( argout , <nl> - fragment = " NumPy_Backward_Compatibility , NumPy_Utilities " ) <nl> - ( DIM_TYPE * DIM1 , DIM_TYPE * DIM2 , DIM_TYPE * DIM3 , DIM_TYPE * DIM4 , DATA_TYPE * * ARGOUTVIEWM_ARRAY4 ) <nl> - { <nl> - npy_intp dims [ 4 ] = { * $ 1 , * $ 2 , * $ 3 , * $ 4 } ; <nl> - PyObject * obj = PyArray_SimpleNewFromData ( 4 , dims , DATA_TYPECODE , ( void * ) ( * $ 5 ) ) ; <nl> - PyArrayObject * array = ( PyArrayObject * ) obj ; <nl> - <nl> - if ( ! array ) SWIG_fail ; <nl> - <nl> - % # ifdef SWIGPY_USE_CAPSULE <nl> - PyObject * cap = PyCapsule_New ( ( void * ) ( * $ 1 ) , SWIGPY_CAPSULE_NAME , free_cap ) ; <nl> - % # else <nl> - PyObject * cap = PyCObject_FromVoidPtr ( ( void * ) ( * $ 1 ) , free ) ; <nl> - % # endif <nl> - <nl> - % # if NPY_API_VERSION < 0x00000007 <nl> - PyArray_BASE ( array ) = cap ; <nl> - % # else <nl> - PyArray_SetBaseObject ( array , cap ) ; <nl> - % # endif <nl> - <nl> - $ result = SWIG_Python_AppendOutput ( $ result , obj ) ; <nl> - } <nl> - <nl> - / * Typemap suite for ( DATA_TYPE * * ARGOUTVIEWM_FARRAY4 , DIM_TYPE * DIM1 , DIM_TYPE * DIM2 , <nl> - DIM_TYPE * DIM3 , DIM_TYPE * DIM4 ) <nl> - * / <nl> - % typemap ( in , numinputs = 0 ) <nl> - ( DATA_TYPE * * ARGOUTVIEWM_FARRAY4 , DIM_TYPE * DIM1 , DIM_TYPE * DIM2 , DIM_TYPE * DIM3 , DIM_TYPE * DIM4 ) <nl> - ( DATA_TYPE * data_temp = NULL , DIM_TYPE dim1_temp , DIM_TYPE dim2_temp , DIM_TYPE dim3_temp , DIM_TYPE dim4_temp ) <nl> - { <nl> - $ 1 = & data_temp ; <nl> - $ 2 = & dim1_temp ; <nl> - $ 3 = & dim2_temp ; <nl> - $ 4 = & dim3_temp ; <nl> - $ 5 = & dim4_temp ; <nl> - } <nl> - % typemap ( argout , <nl> - fragment = " NumPy_Backward_Compatibility , NumPy_Array_Requirements , NumPy_Utilities " ) <nl> - ( DATA_TYPE * * ARGOUTVIEWM_FARRAY4 , DIM_TYPE * DIM1 , DIM_TYPE * DIM2 , DIM_TYPE * DIM3 ) <nl> - { <nl> - npy_intp dims [ 4 ] = { * $ 2 , * $ 3 , * $ 4 , * $ 5 } ; <nl> - PyObject * obj = PyArray_SimpleNewFromData ( 4 , dims , DATA_TYPECODE , ( void * ) ( * $ 1 ) ) ; <nl> - PyArrayObject * array = ( PyArrayObject * ) obj ; <nl> - <nl> - if ( ! array | | ! require_fortran ( array ) ) SWIG_fail ; <nl> - <nl> - % # ifdef SWIGPY_USE_CAPSULE <nl> - PyObject * cap = PyCapsule_New ( ( void * ) ( * $ 1 ) , SWIGPY_CAPSULE_NAME , free_cap ) ; <nl> - % # else <nl> - PyObject * cap = PyCObject_FromVoidPtr ( ( void * ) ( * $ 1 ) , free ) ; <nl> - % # endif <nl> - <nl> - % # if NPY_API_VERSION < 0x00000007 <nl> - PyArray_BASE ( array ) = cap ; <nl> - % # else <nl> - PyArray_SetBaseObject ( array , cap ) ; <nl> - % # endif <nl> - <nl> - $ result = SWIG_Python_AppendOutput ( $ result , obj ) ; <nl> - } <nl> - <nl> - / * Typemap suite for ( DIM_TYPE * DIM1 , DIM_TYPE * DIM2 , DIM_TYPE * DIM3 , DIM_TYPE * DIM4 , <nl> - DATA_TYPE * * ARGOUTVIEWM_FARRAY4 ) <nl> - * / <nl> - % typemap ( in , numinputs = 0 ) <nl> - ( DIM_TYPE * DIM1 , DIM_TYPE * DIM2 , DIM_TYPE * DIM3 , DIM_TYPE * DIM4 , DATA_TYPE * * ARGOUTVIEWM_FARRAY4 ) <nl> - ( DIM_TYPE dim1_temp , DIM_TYPE dim2_temp , DIM_TYPE dim3_temp , DIM_TYPE dim4_temp , DATA_TYPE * data_temp = NULL ) <nl> - { <nl> - $ 1 = & dim1_temp ; <nl> - $ 2 = & dim2_temp ; <nl> - $ 3 = & dim3_temp ; <nl> - $ 4 = & dim4_temp ; <nl> - $ 5 = & data_temp ; <nl> - } <nl> - % typemap ( argout , <nl> - fragment = " NumPy_Backward_Compatibility , NumPy_Array_Requirements , NumPy_Utilities " ) <nl> - ( DIM_TYPE * DIM1 , DIM_TYPE * DIM2 , DIM_TYPE * DIM3 , DIM_TYPE * DIM4 , DATA_TYPE * * ARGOUTVIEWM_FARRAY4 ) <nl> - { <nl> - npy_intp dims [ 4 ] = { * $ 1 , * $ 2 , * $ 3 , * $ 4 } ; <nl> - PyObject * obj = PyArray_SimpleNewFromData ( 4 , dims , DATA_TYPECODE , ( void * ) ( * $ 5 ) ) ; <nl> - PyArrayObject * array = ( PyArrayObject * ) obj ; <nl> - <nl> - if ( ! array | | ! require_fortran ( array ) ) SWIG_fail ; <nl> - <nl> - % # ifdef SWIGPY_USE_CAPSULE <nl> - PyObject * cap = PyCapsule_New ( ( void * ) ( * $ 1 ) , SWIGPY_CAPSULE_NAME , free_cap ) ; <nl> - % # else <nl> - PyObject * cap = PyCObject_FromVoidPtr ( ( void * ) ( * $ 1 ) , free ) ; <nl> - % # endif <nl> - <nl> - % # if NPY_API_VERSION < 0x00000007 <nl> - PyArray_BASE ( array ) = cap ; <nl> - % # else <nl> - PyArray_SetBaseObject ( array , cap ) ; <nl> - % # endif <nl> - <nl> - $ result = SWIG_Python_AppendOutput ( $ result , obj ) ; <nl> - } <nl> - <nl> - / * Typemap suite for ( DATA_TYPE * * ARGOUTVIEWM_ARRAY4 , DIM_TYPE * DIM1 , DIM_TYPE * DIM2 , <nl> - DIM_TYPE * DIM3 , DIM_TYPE * DIM4 ) <nl> - * / <nl> - % typemap ( in , numinputs = 0 ) <nl> - ( DATA_TYPE * * ARGOUTVIEWM_ARRAY4 , DIM_TYPE * DIM1 , DIM_TYPE * DIM2 , DIM_TYPE * DIM3 , DIM_TYPE * DIM4 ) <nl> - ( DATA_TYPE * data_temp = NULL , DIM_TYPE dim1_temp , DIM_TYPE dim2_temp , DIM_TYPE dim3_temp , DIM_TYPE dim4_temp ) <nl> - { <nl> - $ 1 = & data_temp ; <nl> - $ 2 = & dim1_temp ; <nl> - $ 3 = & dim2_temp ; <nl> - $ 4 = & dim3_temp ; <nl> - $ 5 = & dim4_temp ; <nl> - } <nl> - % typemap ( argout , <nl> - fragment = " NumPy_Backward_Compatibility , NumPy_Utilities " ) <nl> - ( DATA_TYPE * * ARGOUTVIEWM_ARRAY4 , DIM_TYPE * DIM1 , DIM_TYPE * DIM2 , DIM_TYPE * DIM3 , DIM_TYPE * DIM4 ) <nl> - { <nl> - npy_intp dims [ 4 ] = { * $ 2 , * $ 3 , * $ 4 , * $ 5 } ; <nl> - PyObject * obj = PyArray_SimpleNewFromData ( 4 , dims , DATA_TYPECODE , ( void * ) ( * $ 1 ) ) ; <nl> - PyArrayObject * array = ( PyArrayObject * ) obj ; <nl> - <nl> - if ( ! array ) SWIG_fail ; <nl> - <nl> - % # ifdef SWIGPY_USE_CAPSULE <nl> - PyObject * cap = PyCapsule_New ( ( void * ) ( * $ 1 ) , SWIGPY_CAPSULE_NAME , free_cap ) ; <nl> - % # else <nl> - PyObject * cap = PyCObject_FromVoidPtr ( ( void * ) ( * $ 1 ) , free ) ; <nl> - % # endif <nl> - <nl> - % # if NPY_API_VERSION < 0x00000007 <nl> - PyArray_BASE ( array ) = cap ; <nl> - % # else <nl> - PyArray_SetBaseObject ( array , cap ) ; <nl> - % # endif <nl> - <nl> - $ result = SWIG_Python_AppendOutput ( $ result , obj ) ; <nl> - } <nl> - <nl> - / * Typemap suite for ( DIM_TYPE * DIM1 , DIM_TYPE * DIM2 , DIM_TYPE * DIM3 , DIM_TYPE * DIM4 , <nl> - DATA_TYPE * * ARGOUTVIEWM_ARRAY4 ) <nl> - * / <nl> - % typemap ( in , numinputs = 0 ) <nl> - ( DIM_TYPE * DIM1 , DIM_TYPE * DIM2 , DIM_TYPE * DIM3 , DIM_TYPE * DIM4 , DATA_TYPE * * ARGOUTVIEWM_ARRAY4 ) <nl> - ( DIM_TYPE dim1_temp , DIM_TYPE dim2_temp , DIM_TYPE dim3_temp , DIM_TYPE dim4_temp , DATA_TYPE * data_temp = NULL ) <nl> - { <nl> - $ 1 = & dim1_temp ; <nl> - $ 2 = & dim2_temp ; <nl> - $ 3 = & dim3_temp ; <nl> - $ 4 = & dim4_temp ; <nl> - $ 5 = & data_temp ; <nl> - } <nl> - % typemap ( argout , <nl> - fragment = " NumPy_Backward_Compatibility , NumPy_Utilities " ) <nl> - ( DIM_TYPE * DIM1 , DIM_TYPE * DIM2 , DIM_TYPE * DIM3 , DIM_TYPE * DIM4 , DATA_TYPE * * ARGOUTVIEWM_ARRAY4 ) <nl> - { <nl> - npy_intp dims [ 4 ] = { * $ 1 , * $ 2 , * $ 3 , * $ 4 } ; <nl> - PyObject * obj = PyArray_SimpleNewFromData ( 4 , dims , DATA_TYPECODE , ( void * ) ( * $ 5 ) ) ; <nl> - PyArrayObject * array = ( PyArrayObject * ) obj ; <nl> - <nl> - if ( ! array ) SWIG_fail ; <nl> - <nl> - % # ifdef SWIGPY_USE_CAPSULE <nl> - PyObject * cap = PyCapsule_New ( ( void * ) ( * $ 1 ) , SWIGPY_CAPSULE_NAME , free_cap ) ; <nl> - % # else <nl> - PyObject * cap = PyCObject_FromVoidPtr ( ( void * ) ( * $ 1 ) , free ) ; <nl> - % # endif <nl> - <nl> - % # if NPY_API_VERSION < 0x00000007 <nl> - PyArray_BASE ( array ) = cap ; <nl> - % # else <nl> - PyArray_SetBaseObject ( array , cap ) ; <nl> - % # endif <nl> - <nl> - $ result = SWIG_Python_AppendOutput ( $ result , obj ) ; <nl> - } <nl> - <nl> - / * Typemap suite for ( DATA_TYPE * * ARGOUTVIEWM_FARRAY4 , DIM_TYPE * DIM1 , DIM_TYPE * DIM2 , <nl> - DIM_TYPE * DIM3 , DIM_TYPE * DIM4 ) <nl> - * / <nl> - % typemap ( in , numinputs = 0 ) <nl> - ( DATA_TYPE * * ARGOUTVIEWM_FARRAY4 , DIM_TYPE * DIM1 , DIM_TYPE * DIM2 , DIM_TYPE * DIM3 , DIM_TYPE * DIM4 ) <nl> - ( DATA_TYPE * data_temp = NULL , DIM_TYPE dim1_temp , DIM_TYPE dim2_temp , DIM_TYPE dim3_temp , DIM_TYPE dim4_temp ) <nl> - { <nl> - $ 1 = & data_temp ; <nl> - $ 2 = & dim1_temp ; <nl> - $ 3 = & dim2_temp ; <nl> - $ 4 = & dim3_temp ; <nl> - $ 5 = & dim4_temp ; <nl> - } <nl> - % typemap ( argout , <nl> - fragment = " NumPy_Backward_Compatibility , NumPy_Array_Requirements , NumPy_Utilities " ) <nl> - ( DATA_TYPE * * ARGOUTVIEWM_FARRAY4 , DIM_TYPE * DIM1 , DIM_TYPE * DIM2 , DIM_TYPE * DIM3 , DIM_TYPE * DIM4 ) <nl> - { <nl> - npy_intp dims [ 4 ] = { * $ 2 , * $ 3 , * $ 4 , * $ 5 } ; <nl> - PyObject * obj = PyArray_SimpleNewFromData ( 4 , dims , DATA_TYPECODE , ( void * ) ( * $ 1 ) ) ; <nl> - PyArrayObject * array = ( PyArrayObject * ) obj ; <nl> - <nl> - if ( ! array | | ! require_fortran ( array ) ) SWIG_fail ; <nl> - <nl> - % # ifdef SWIGPY_USE_CAPSULE <nl> - PyObject * cap = PyCapsule_New ( ( void * ) ( * $ 1 ) , SWIGPY_CAPSULE_NAME , free_cap ) ; <nl> - % # else <nl> - PyObject * cap = PyCObject_FromVoidPtr ( ( void * ) ( * $ 1 ) , free ) ; <nl> - % # endif <nl> - <nl> - % # if NPY_API_VERSION < 0x00000007 <nl> - PyArray_BASE ( array ) = cap ; <nl> - % # else <nl> - PyArray_SetBaseObject ( array , cap ) ; <nl> - % # endif <nl> - <nl> - $ result = SWIG_Python_AppendOutput ( $ result , obj ) ; <nl> - } <nl> - <nl> - / * Typemap suite for ( DIM_TYPE * DIM1 , DIM_TYPE * DIM2 , DIM_TYPE * DIM3 , DIM_TYPE * DIM4 , <nl> - DATA_TYPE * * ARGOUTVIEWM_FARRAY4 ) <nl> - * / <nl> - % typemap ( in , numinputs = 0 ) <nl> - ( DIM_TYPE * DIM1 , DIM_TYPE * DIM2 , DIM_TYPE * DIM3 , DIM_TYPE * DIM4 , DATA_TYPE * * ARGOUTVIEWM_FARRAY4 ) <nl> - ( DIM_TYPE dim1_temp , DIM_TYPE dim2_temp , DIM_TYPE dim3_temp , DIM_TYPE dim4_temp , DATA_TYPE * data_temp = NULL ) <nl> - { <nl> - $ 1 = & dim1_temp ; <nl> - $ 2 = & dim2_temp ; <nl> - $ 3 = & dim3_temp ; <nl> - $ 4 = & dim4_temp ; <nl> - $ 5 = & data_temp ; <nl> - } <nl> - % typemap ( argout , <nl> - fragment = " NumPy_Backward_Compatibility , NumPy_Array_Requirements , NumPy_Utilities " ) <nl> - ( DIM_TYPE * DIM1 , DIM_TYPE * DIM2 , DIM_TYPE * DIM3 , DIM_TYPE * DIM4 , DATA_TYPE * * ARGOUTVIEWM_FARRAY4 ) <nl> - { <nl> - npy_intp dims [ 4 ] = { * $ 1 , * $ 2 , * $ 3 , * $ 4 } ; <nl> - PyObject * obj = PyArray_SimpleNewFromData ( 4 , dims , DATA_TYPECODE , ( void * ) ( * $ 5 ) ) ; <nl> - PyArrayObject * array = ( PyArrayObject * ) obj ; <nl> - <nl> - if ( ! array | | ! require_fortran ( array ) ) SWIG_fail ; <nl> - <nl> - % # ifdef SWIGPY_USE_CAPSULE <nl> - PyObject * cap = PyCapsule_New ( ( void * ) ( * $ 1 ) , SWIGPY_CAPSULE_NAME , free_cap ) ; <nl> - % # else <nl> - PyObject * cap = PyCObject_FromVoidPtr ( ( void * ) ( * $ 1 ) , free ) ; <nl> - % # endif <nl> - <nl> - % # if NPY_API_VERSION < 0x00000007 <nl> - PyArray_BASE ( array ) = cap ; <nl> - % # else <nl> - PyArray_SetBaseObject ( array , cap ) ; <nl> - % # endif <nl> - <nl> - $ result = SWIG_Python_AppendOutput ( $ result , obj ) ; <nl> - } <nl> - <nl> - % enddef / * % numpy_typemaps ( ) macro * / <nl> - / * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * / <nl> - <nl> - / * Concrete instances of the % numpy_typemaps ( ) macro : Each invocation <nl> - * below applies all of the typemaps above to the specified data type . <nl> - * / <nl> - % numpy_typemaps ( signed char , NPY_BYTE , int ) <nl> - % numpy_typemaps ( unsigned char , NPY_UBYTE , int ) <nl> - % numpy_typemaps ( short , NPY_SHORT , int ) <nl> - % numpy_typemaps ( unsigned short , NPY_USHORT , int ) <nl> - % numpy_typemaps ( int , NPY_INT , int ) <nl> - % numpy_typemaps ( unsigned int , NPY_UINT , int ) <nl> - % numpy_typemaps ( long , NPY_LONG , int ) <nl> - % numpy_typemaps ( unsigned long , NPY_ULONG , int ) <nl> - % numpy_typemaps ( long long , NPY_LONGLONG , int ) <nl> - % numpy_typemaps ( unsigned long long , NPY_ULONGLONG , int ) <nl> - % numpy_typemaps ( float , NPY_FLOAT , int ) <nl> - % numpy_typemaps ( double , NPY_DOUBLE , int ) <nl> - <nl> - / * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * <nl> - * The follow macro expansion does not work , because C + + bool is 4 <nl> - * bytes and NPY_BOOL is 1 byte <nl> - * <nl> - * % numpy_typemaps ( bool , NPY_BOOL , int ) <nl> - * / <nl> - <nl> - / * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * <nl> - * On my Mac , I get the following warning for this macro expansion : <nl> - * ' swig / python detected a memory leak of type ' long double * ' , no destructor found . ' <nl> - * <nl> - * % numpy_typemaps ( long double , NPY_LONGDOUBLE , int ) <nl> - * / <nl> - <nl> - / * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * <nl> - * Swig complains about a syntax error for the following macro <nl> - * expansions : <nl> - * <nl> - * % numpy_typemaps ( complex float , NPY_CFLOAT , int ) <nl> - * <nl> - * % numpy_typemaps ( complex double , NPY_CDOUBLE , int ) <nl> - * <nl> - * % numpy_typemaps ( complex long double , NPY_CLONGDOUBLE , int ) <nl> - * / <nl> - <nl> - # endif / * SWIGPYTHON * / <nl> mmm a / tensorflow / python / saved_model / saved_model_test . py <nl> ppp b / tensorflow / python / saved_model / saved_model_test . py <nl> def testTags ( self ) : <nl> # Restore the graph with a single predefined tag whose variables were saved . <nl> with self . test_session ( graph = tf . Graph ( ) ) as sess : <nl> loader . load ( sess , [ constants . TAG_TRAINING ] , export_dir ) <nl> - tf . train . write_graph ( <nl> - sess . graph . as_graph_def ( ) , " / tmp / " , " training_graph " , as_text = True ) <nl> self . assertEqual ( 42 , tf . get_collection ( tf . GraphKeys . VARIABLES ) [ 0 ] . eval ( ) ) <nl> <nl> # Restore the graph with a single predefined tag whose variables were not <nl> # saved . <nl> with self . test_session ( graph = tf . Graph ( ) ) as sess : <nl> loader . load ( sess , [ constants . TAG_SERVING ] , export_dir ) <nl> - tf . train . write_graph ( <nl> - sess . graph . as_graph_def ( ) , " / tmp / " , " serving_graph " , as_text = True ) <nl> self . assertEqual ( 42 , tf . get_collection ( tf . GraphKeys . VARIABLES ) [ 0 ] . eval ( ) ) <nl> <nl> # Restore the graph with multiple tags . Provide duplicate tags to test set <nl> mmm a / tensorflow / python / training / gradient_descent_test . py <nl> ppp b / tensorflow / python / training / gradient_descent_test . py <nl> <nl> from __future__ import division <nl> from __future__ import print_function <nl> <nl> - import numpy as np <nl> import tensorflow as tf <nl> <nl> <nl> mmm a / tensorflow / python / training / server_lib . py <nl> ppp b / tensorflow / python / training / server_lib . py <nl> <nl> from __future__ import division <nl> from __future__ import print_function <nl> <nl> - import six # pylint : disable = unused - import <nl> - <nl> from tensorflow . core . protobuf import tensorflow_server_pb2 <nl> from tensorflow . python import pywrap_tensorflow <nl> from tensorflow . python . framework import errors <nl> mmm a / tensorflow / python / util / net_lib . py <nl> ppp b / tensorflow / python / util / net_lib . py <nl> <nl> from __future__ import division <nl> from __future__ import print_function <nl> <nl> - import six # pylint : disable = unused - import <nl> - <nl> from tensorflow . python import pywrap_tensorflow <nl> <nl> <nl> mmm a / tensorflow / tensorboard / components / tf - graph - common / lib / parser . ts <nl> ppp b / tensorflow / tensorboard / components / tf - graph - common / lib / parser . ts <nl> export function fetchAndParseMetadata ( path : string , tracker : ProgressTracker ) { <nl> } , <nl> tracker ) <nl> . then ( ( arrayBuffer : ArrayBuffer ) = > { <nl> - return tf . graph . util . runTask ( ' Parsing metadata . pbtxt ' , 60 , ( ) = > { <nl> - return arrayBuffer ! = null ? parseStatsPbTxt ( arrayBuffer ) : null ; <nl> - } , tracker ) ; <nl> + return tf . graph . util . runAsyncPromiseTask ( <nl> + ' Parsing metadata . pbtxt ' , 60 , ( ) = > { <nl> + return arrayBuffer ! = null ? parseStatsPbTxt ( arrayBuffer ) : <nl> + Promise . resolve ( null ) ; <nl> + } , tracker ) ; <nl> } ) ; <nl> } <nl> <nl> mmm a / tensorflow / tensorboard / components / tf - graph - common / lib / util . ts <nl> ppp b / tensorflow / tensorboard / components / tf - graph - common / lib / util . ts <nl> module tf . graph . util { <nl> } ) ; <nl> } <nl> <nl> + / * * <nl> + * Asynchronously runs an expensive task that returns a promise . Updates the <nl> + * tracker ' s progress after the promise resolves . Returns a new promise that <nl> + * resolves after the progress is updated . <nl> + * / <nl> + export function runAsyncPromiseTask < T > ( <nl> + msg : string , incProgressValue : number , task : ( ) = > Promise < T > , <nl> + tracker : ProgressTracker ) : Promise < T > { <nl> + return new Promise ( ( resolve , reject ) = > { <nl> + let handleError = function ( e ) { <nl> + / / Errors that happen inside asynchronous tasks are <nl> + / / reported to the tracker using a user - friendly message . <nl> + tracker . reportError ( ' Failed ' + msg , e ) ; <nl> + reject ( e ) ; <nl> + } ; <nl> + <nl> + / / Update the progress message to say the current running task . <nl> + tracker . setMessage ( msg ) ; <nl> + / / Run the expensive task with a delay that gives enough time for the <nl> + / / UI to update . <nl> + setTimeout ( function ( ) { <nl> + try { <nl> + let start = Date . now ( ) ; <nl> + task ( ) <nl> + . then ( function ( value ) { <nl> + / * tslint : disable * / <nl> + console . log ( msg , ' : ' , Date . now ( ) - start , ' ms ' ) ; <nl> + / / Update the progress value . <nl> + tracker . updateProgress ( incProgressValue ) ; <nl> + / / Return the result to be used by other tasks . <nl> + resolve ( value ) ; <nl> + } ) <nl> + . catch ( handleError ) ; <nl> + } catch ( e ) { <nl> + handleError ( e ) ; <nl> + } <nl> + } , ASYNC_TASK_DELAY ) ; <nl> + } ) ; <nl> + } <nl> + <nl> / * * <nl> * Returns a query selector with escaped special characters that are not <nl> * allowed in a query selector . <nl> deleted file mode 100644 <nl> index 60d9cce777bfd . . 0000000000000 <nl> mmm a / tensorflow / tensorboard / components / tf - imports / google / README . md <nl> ppp / dev / null <nl> <nl> - This file acts as import routers for third party javascript libraries , <nl> - e . g . Plottable and D3 from ` g3 / third_party ` ; it exists to facilitate development <nl> - inside google . <nl> deleted file mode 100644 <nl> index 9d5f26ac0ef11 . . 0000000000000 <nl> mmm a / tensorflow / tensorboard / components / tf - imports / google / d3 . html <nl> ppp / dev / null <nl> @ @ - 1 + 0 , 0 @ @ <nl> - < script src = " . . / d3 - library / d3 . js " > < / script > <nl> deleted file mode 100644 <nl> index 79e68a062e216 . . 0000000000000 <nl> mmm a / tensorflow / tensorboard / components / tf - imports / google / dagre . html <nl> ppp / dev / null <nl> @ @ - 1 + 0 , 0 @ @ <nl> - < link rel = " import " href = " . . / dagre - library / dagre . html " > <nl> deleted file mode 100644 <nl> index 65e1d43ecd3c7 . . 0000000000000 <nl> mmm a / tensorflow / tensorboard / components / tf - imports / google / graphlib . html <nl> ppp / dev / null <nl> @ @ - 1 + 0 , 0 @ @ <nl> - < link rel = " import " href = " . . / graphlib - library / graphlib . html " > <nl> deleted file mode 100644 <nl> index 9e731600fb50b . . 0000000000000 <nl> mmm a / tensorflow / tensorboard / components / tf - imports / google / lodash . html <nl> ppp / dev / null <nl> @ @ - 1 + 0 , 0 @ @ <nl> - < link rel = " import " href = " . . / lodash - library / lodash - library . html " > <nl> deleted file mode 100644 <nl> index ec2bec47fd24d . . 0000000000000 <nl> mmm a / tensorflow / tensorboard / components / tf - imports / google / plottable . html <nl> ppp / dev / null <nl> <nl> - < link rel = " import " href = " d3 . html " > <nl> - < link rel = " import " href = " . . / plottable - library / plottable . html " > <nl> mmm a / tensorflow / tensorboard / components / vz - projector / data . ts <nl> ppp b / tensorflow / tensorboard / components / vz - projector / data . ts <nl> limitations under the License . <nl> import { runAsyncTask } from ' . / async ' ; <nl> import { TSNE } from ' . / bh_tsne ' ; <nl> import * as knn from ' . / knn ' ; <nl> - import * as scatter from ' . / scatter ' ; <nl> + import * as scatterPlot from ' . / scatterPlot ' ; <nl> import { shuffle } from ' . / util ' ; <nl> import * as vector from ' . / vector ' ; <nl> <nl> export class DataSource { <nl> } <nl> } <nl> <nl> - export interface DataPoint extends scatter . DataPoint { <nl> + export interface DataPoint extends scatterPlot . DataPoint { <nl> / * * The point in the original space . * / <nl> vector : number [ ] ; <nl> <nl> const TRACE_METADATA_ATTR = ' __next__ ' ; <nl> * requires normalizing and shifting the vector space , we make a copy of the <nl> * data so we can still always create new subsets based on the original data . <nl> * / <nl> - export class DataSet implements scatter . DataSet { <nl> + export class DataSet implements scatterPlot . DataSet { <nl> points : DataPoint [ ] ; <nl> - traces : scatter . DataTrace [ ] ; <nl> + traces : scatterPlot . DataTrace [ ] ; <nl> <nl> sampledDataIndices : number [ ] = [ ] ; <nl> <nl> export class DataSet implements scatter . DataSet { <nl> <nl> private computeTraces ( points : DataPoint [ ] , indicesSeen : boolean [ ] ) { <nl> / / Compute traces . <nl> - let indexToTrace : { [ index : number ] : scatter . DataTrace } = { } ; <nl> - let traces : scatter . DataTrace [ ] = [ ] ; <nl> + let indexToTrace : { [ index : number ] : scatterPlot . DataTrace } = { } ; <nl> + let traces : scatterPlot . DataTrace [ ] = [ ] ; <nl> for ( let i = 0 ; i < points . length ; i + + ) { <nl> if ( indicesSeen [ i ] ) { <nl> continue ; <nl> export class DataSet implements scatter . DataSet { <nl> continue ; <nl> } <nl> / / The current point is pointing to a new / unseen trace . <nl> - let newTrace : scatter . DataTrace = { pointIndices : [ ] } ; <nl> + let newTrace : scatterPlot . DataTrace = { pointIndices : [ ] } ; <nl> indexToTrace [ i ] = newTrace ; <nl> traces . push ( newTrace ) ; <nl> let currentIndex = i ; <nl> export class DataSet implements scatter . DataSet { <nl> / * * Projects the dataset along the top 10 principal components . * / <nl> projectPCA ( ) : Promise < void > { <nl> if ( this . projections . has ( ' pca - 0 ' ) ) { <nl> - return Promise . resolve < void > ( ) ; <nl> + return Promise . resolve ( ) ; <nl> } <nl> return runAsyncTask ( ' Computing PCA . . . ' , ( ) = > { <nl> / / Approximate pca vectors by sampling the dimensions . <nl> new file mode 100644 <nl> index 0000000000000 . . 7dc14bf630095 <nl> mmm / dev / null <nl> ppp b / tensorflow / tensorboard / components / vz - projector / renderContext . ts <nl> <nl> + / * Copyright 2016 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> + / * * <nl> + * RenderContext contains all of the state required to color and render the data <nl> + * set . ScatterPlotWebGL passes this to every attached visualizer as part of the <nl> + * render callback . <nl> + * / <nl> + export class RenderContext { <nl> + camera : THREE . PerspectiveCamera ; <nl> + cameraTarget : THREE . Vector3 ; <nl> + screenWidth : number ; <nl> + screenHeight : number ; <nl> + nearestCameraSpacePointZ : number ; <nl> + farthestCameraSpacePointZ : number ; <nl> + colorAccessor : ( index : number ) = > string ; <nl> + labeledPoints : number [ ] ; <nl> + labelAccessor : ( index : number ) = > string ; <nl> + highlightedPoints : number [ ] ; <nl> + highlightStroke : ( index : number ) = > string ; <nl> + <nl> + constructor ( <nl> + camera : THREE . PerspectiveCamera , cameraTarget : THREE . Vector3 , <nl> + screenWidth : number , screenHeight : number , <nl> + nearestCameraSpacePointZ : number , farthestCameraSpacePointZ : number , <nl> + colorAccessor : ( index : number ) = > string , labeledPoints : number [ ] , <nl> + labelAccessor : ( index : number ) = > string , highlightedPoints : number [ ] , <nl> + highlightStroke : ( index : number ) = > string ) { <nl> + this . camera = camera ; <nl> + this . cameraTarget = cameraTarget ; <nl> + this . screenWidth = screenWidth ; <nl> + this . screenHeight = screenHeight ; <nl> + this . nearestCameraSpacePointZ = nearestCameraSpacePointZ ; <nl> + this . farthestCameraSpacePointZ = farthestCameraSpacePointZ ; <nl> + this . colorAccessor = colorAccessor ; <nl> + this . labeledPoints = labeledPoints ; <nl> + this . labelAccessor = labelAccessor ; <nl> + this . highlightedPoints = highlightedPoints ; <nl> + this . highlightStroke = highlightStroke ; <nl> + } <nl> + } <nl> similarity index 99 % <nl> rename from tensorflow / tensorboard / components / vz - projector / scatter . ts <nl> rename to tensorflow / tensorboard / components / vz - projector / scatterPlot . ts <nl> mmm a / tensorflow / tensorboard / components / vz - projector / scatter . ts <nl> ppp b / tensorflow / tensorboard / components / vz - projector / scatterPlot . ts <nl> export enum Mode { <nl> HOVER <nl> } <nl> <nl> - export interface Scatter { <nl> + export interface ScatterPlot { <nl> / * * Sets the data for the scatter plot . * / <nl> setDataSet ( dataSet : DataSet , spriteImage ? : HTMLImageElement ) : void ; <nl> / * * Called with each data point in order to get its color . * / <nl> similarity index 88 % <nl> rename from tensorflow / tensorboard / components / vz - projector / scatterWebGL . ts <nl> rename to tensorflow / tensorboard / components / vz - projector / scatterPlotWebGL . ts <nl> mmm a / tensorflow / tensorboard / components / vz - projector / scatterWebGL . ts <nl> ppp b / tensorflow / tensorboard / components / vz - projector / scatterPlotWebGL . ts <nl> See the License for the specific language governing permissions and <nl> limitations under the License . <nl> = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = * / <nl> <nl> - import { DataSet , Mode , OnHoverListener , OnSelectionListener , Scatter } from ' . / scatter ' ; <nl> + import { RenderContext } from ' . / renderContext ' ; <nl> + import { DataSet , Mode , OnHoverListener , OnSelectionListener , ScatterPlot } from ' . / scatterPlot ' ; <nl> + import { ScatterPlotWebGLVisualizer } from ' . / scatterPlotWebGLVisualizer ' ; <nl> + import { getNearFarPoints , getProjectedPointFromIndex , vector3DToScreenCoords } from ' . / util ' ; <nl> + import { dist_2D } from ' . / vector ' ; <nl> <nl> - import { dist_2D , Point2D } from ' . / vector ' ; <nl> <nl> / / Colors ( in various necessary formats ) . <nl> const BACKGROUND_COLOR_DAY = 0xffffff ; <nl> const TAR_2D = { <nl> } ; <nl> <nl> / * * <nl> - * ScatterWebGL maintains a three . js instantiation and context , <nl> + * Maintains a three . js instantiation and context , <nl> * animation state , day / night state , and all other logic that ' s <nl> - * independent of how a 3D scatter plot is actually rendered . <nl> + * independent of how a 3D scatter plot is actually rendered . Also holds an <nl> + * array of visualizers and dispatches application events to them . <nl> * / <nl> - export abstract class ScatterWebGL implements Scatter { <nl> - / * * Holds the indexes of the points to be labeled . * / <nl> - protected highlightedPoints : number [ ] = [ ] ; <nl> - <nl> - protected colorAccessor : ( index : number ) = > string ; <nl> - protected highlightStroke : ( i : number ) = > string ; <nl> - <nl> - protected abstract onRecreateScene ( <nl> - scene : THREE . Scene , sceneIs3D : boolean , backgroundColor : number ) ; <nl> - protected abstract removeAllFromScene ( scene : THREE . Scene ) ; <nl> - protected abstract onDataSet ( dataSet : DataSet , spriteImage : HTMLImageElement ) ; <nl> - protected abstract onSetColorAccessor ( ) ; <nl> - protected abstract onHighlightPoints ( <nl> - pointIndexes : number [ ] , highlightStroke : ( i : number ) = > string ) ; <nl> - protected abstract onPickingRender ( <nl> - camera : THREE . Camera , cameraTarget : THREE . Vector3 ) ; <nl> - protected abstract onRender ( <nl> - camera : THREE . Camera , cameraTarget : THREE . Vector3 , <nl> - labeledPoints : number [ ] , labelAccessor : ( index : number ) = > string ) ; <nl> - protected abstract onUpdate ( ) ; <nl> - protected abstract onResize ( newWidth : number , newHeight : number ) ; <nl> - protected abstract onSetDayNightMode ( isNight : boolean ) ; <nl> - <nl> + export class ScatterPlotWebGL implements ScatterPlot { <nl> private dataSet : DataSet ; <nl> private containerNode : HTMLElement ; <nl> <nl> + private visualizers : ScatterPlotWebGLVisualizer [ ] = [ ] ; <nl> + <nl> + private highlightedPoints : number [ ] = [ ] ; <nl> + private highlightStroke : ( index : number ) = > string ; <nl> private labeledPoints : number [ ] = [ ] ; <nl> private favorLabels : ( i : number ) = > boolean ; <nl> private labelAccessor : ( index : number ) = > string ; <nl> - <nl> + private colorAccessor : ( index : number ) = > string ; <nl> private onHoverListeners : OnHoverListener [ ] = [ ] ; <nl> private onSelectionListeners : OnSelectionListener [ ] = [ ] ; <nl> private lazySusanAnimation : number ; <nl> export abstract class ScatterWebGL implements Scatter { <nl> private isDragSequence = false ; <nl> private animationID : number ; <nl> <nl> - <nl> constructor ( <nl> container : d3 . Selection < any > , labelAccessor : ( index : number ) = > string ) { <nl> this . containerNode = container . node ( ) as HTMLElement ; <nl> export abstract class ScatterWebGL implements Scatter { <nl> * / <nl> private onMouseMove ( e : MouseEvent ) { <nl> if ( this . cameraControls . autoRotate ) { <nl> - / / Cancel the lazy susan . <nl> this . cameraControls . autoRotate = false ; <nl> cancelAnimationFrame ( this . lazySusanAnimation ) ; <nl> } <nl> - <nl> if ( ! this . dataSet ) { <nl> return ; <nl> } <nl> export abstract class ScatterWebGL implements Scatter { <nl> private setNearestPointToMouse ( e : MouseEvent ) { <nl> if ( this . pickingTexture = = null ) { <nl> this . nearestPoint = null ; <nl> + return ; <nl> } <nl> <nl> / / Create buffer for reading a single pixel . <nl> export abstract class ScatterWebGL implements Scatter { <nl> <nl> / * * Returns the squared distance to the mouse for the i - th point . * / <nl> private getDist2ToMouse ( i : number , e : MouseEvent ) { <nl> - let point = this . getProjectedPointFromIndex ( i ) ; <nl> - let screenCoords = this . vector3DToScreenCoords ( point ) ; <nl> + let point = getProjectedPointFromIndex ( this . dataSet , i ) ; <nl> + let screenCoords = vector3DToScreenCoords ( <nl> + this . perspCamera , this . width , this . height , point ) ; <nl> let dpr = window . devicePixelRatio ; <nl> return dist_2D ( <nl> [ e . offsetX * dpr , e . offsetY * dpr ] , [ screenCoords [ 0 ] , screenCoords [ 1 ] ] ) ; <nl> export abstract class ScatterWebGL implements Scatter { <nl> private adjustSelectionSphere ( e : MouseEvent ) { <nl> let dist = this . getDist2ToMouse ( this . nearestPoint , e ) / 100 ; <nl> this . selectionSphere . scale . set ( dist , dist , dist ) ; <nl> - let selectedPoints : Array < number > = new Array ( ) ; <nl> + let selectedPoints : number [ ] = [ ] ; <nl> this . dataSet . points . forEach ( point = > { <nl> let pt = point . projectedPoint ; <nl> let pointVect = new THREE . Vector3 ( pt [ 0 ] , pt [ 1 ] , pt [ 2 ] ) ; <nl> export abstract class ScatterWebGL implements Scatter { <nl> this . onSelectionListeners . forEach ( l = > l ( selectedPoints ) ) ; <nl> } <nl> <nl> - protected getProjectedPointFromIndex ( i : number ) : THREE . Vector3 { <nl> - return new THREE . Vector3 ( <nl> - this . dataSet . points [ i ] . projectedPoint [ 0 ] , <nl> - this . dataSet . points [ i ] . projectedPoint [ 1 ] , <nl> - this . dataSet . points [ i ] . projectedPoint [ 2 ] ) ; <nl> - } <nl> - <nl> - protected vector3DToScreenCoords ( v : THREE . Vector3 ) : Point2D { <nl> - let dpr = window . devicePixelRatio ; <nl> - let vector = new THREE . Vector3 ( ) . copy ( v ) . project ( this . perspCamera ) ; <nl> - let coords : Point2D = [ <nl> - / / project ( ) returns the point in perspCamera ' s coordinates , with the <nl> - / / origin in the center and a positive upward y . To get it into screen <nl> - / / coordinates , normalize by adding 1 and dividing by 2 . <nl> - ( ( vector . x + 1 ) / 2 * this . width ) * dpr , <nl> - - ( ( vector . y - 1 ) / 2 * this . height ) * dpr <nl> - ] ; <nl> - return coords ; <nl> - } <nl> - <nl> / * * Cancels current animation * / <nl> private cancelAnimation ( ) { <nl> if ( this . animationID ) { <nl> export abstract class ScatterWebGL implements Scatter { <nl> / * * Removes all geometry from the scene . * / <nl> private removeAll ( ) { <nl> this . removeOldAxes ( ) ; <nl> - this . removeAllFromScene ( this . scene ) ; <nl> + this . visualizers . forEach ( v = > { <nl> + v . removeAllFromScene ( this . scene ) ; <nl> + } ) ; <nl> } <nl> <nl> private createSelectionSphere ( ) { <nl> export abstract class ScatterWebGL implements Scatter { <nl> <nl> / / PUBLIC API <nl> <nl> + / * * Adds a visualizer to the set , will start dispatching events to it * / <nl> + addVisualizer ( visualizer : ScatterPlotWebGLVisualizer ) { <nl> + this . visualizers . push ( visualizer ) ; <nl> + } <nl> + <nl> recreateScene ( ) { <nl> this . removeAll ( ) ; <nl> this . cancelAnimation ( ) ; <nl> let sceneIs3D = this . zAccessor ! = null ; <nl> - this . onRecreateScene ( this . scene , sceneIs3D , this . backgroundColor ) ; <nl> + this . visualizers . forEach ( v = > { <nl> + v . onRecreateScene ( this . scene , sceneIs3D , this . backgroundColor ) ; <nl> + } ) ; <nl> this . resize ( false ) ; <nl> if ( this . zAccessor ) { <nl> this . addAxis3D ( ) ; <nl> export abstract class ScatterWebGL implements Scatter { <nl> setDataSet ( dataSet : DataSet , spriteImage : HTMLImageElement ) { <nl> this . removeAll ( ) ; <nl> this . dataSet = dataSet ; <nl> - this . onDataSet ( dataSet , spriteImage ) ; <nl> this . labeledPoints = [ ] ; <nl> this . highlightedPoints = [ ] ; <nl> + this . visualizers . forEach ( v = > { <nl> + v . onDataSet ( dataSet , spriteImage ) ; <nl> + } ) ; <nl> } <nl> <nl> update ( ) { <nl> this . cancelAnimation ( ) ; <nl> this . getPointsCoordinates ( ) ; <nl> - this . onUpdate ( ) ; <nl> + this . visualizers . forEach ( v = > { <nl> + v . onUpdate ( ) ; <nl> + } ) ; <nl> + this . render ( ) ; <nl> } <nl> <nl> render ( ) { <nl> export abstract class ScatterWebGL implements Scatter { <nl> return ; <nl> } <nl> <nl> + let cameraSpacePointExtents : [ number , number ] = getNearFarPoints ( <nl> + this . dataSet , this . perspCamera . position , this . cameraControls . target ) ; <nl> + <nl> / / Render first pass to picking target . This render fills pickingTexture <nl> / / with colors that are actually point ids , so that sampling the texture at <nl> / / the mouse ' s current x , y coordinates will reveal the data point that the <nl> / / mouse is over . <nl> - this . onPickingRender ( this . perspCamera , this . cameraControls . target ) ; <nl> + this . visualizers . forEach ( v = > { <nl> + v . onPickingRender ( this . perspCamera , this . cameraControls . target ) ; <nl> + } ) ; <nl> this . renderer . render ( this . scene , this . perspCamera , this . pickingTexture ) ; <nl> <nl> / / Render second pass to color buffer , to be displayed on the canvas . <nl> export abstract class ScatterWebGL implements Scatter { <nl> lightPos . x + = 1 ; <nl> lightPos . y + = 1 ; <nl> this . light . position . set ( lightPos . x , lightPos . y , lightPos . z ) ; <nl> - this . onRender ( <nl> - this . perspCamera , this . cameraControls . target , this . labeledPoints , <nl> - this . labelAccessor ) ; <nl> + <nl> + let rc = new RenderContext ( <nl> + this . perspCamera , this . cameraControls . target , this . width , this . height , <nl> + cameraSpacePointExtents [ 0 ] , cameraSpacePointExtents [ 1 ] , <nl> + this . colorAccessor , this . labeledPoints , this . labelAccessor , <nl> + this . highlightedPoints , this . highlightStroke ) ; <nl> + <nl> + this . visualizers . forEach ( v = > { <nl> + v . onRender ( rc ) ; <nl> + } ) ; <nl> this . renderer . render ( this . scene , this . perspCamera ) ; <nl> } <nl> <nl> setColorAccessor ( colorAccessor : ( index : number ) = > string ) { <nl> this . colorAccessor = colorAccessor ; <nl> - this . onSetColorAccessor ( ) ; <nl> this . render ( ) ; <nl> } <nl> <nl> export abstract class ScatterWebGL implements Scatter { <nl> <nl> highlightPoints ( <nl> pointIndexes : number [ ] , highlightStroke : ( i : number ) = > string , <nl> - favorLabels : ( i : number ) = > boolean ) : void { <nl> + favorLabels : ( i : number ) = > boolean ) { <nl> this . favorLabels = favorLabels ; <nl> this . highlightedPoints = pointIndexes ; <nl> this . labeledPoints = pointIndexes ; <nl> this . highlightStroke = highlightStroke ; <nl> - this . onHighlightPoints ( pointIndexes , highlightStroke ) ; <nl> this . render ( ) ; <nl> } <nl> <nl> export abstract class ScatterWebGL implements Scatter { <nl> this . backgroundColor = <nl> ( isNight ? BACKGROUND_COLOR_NIGHT : BACKGROUND_COLOR_DAY ) ; <nl> this . renderer . setClearColor ( this . backgroundColor ) ; <nl> - this . onSetDayNightMode ( isNight ) ; <nl> + this . visualizers . forEach ( v = > { <nl> + v . onSetDayNightMode ( isNight ) ; <nl> + } ) ; <nl> } <nl> <nl> showAxes ( show : boolean ) { } <nl> export abstract class ScatterWebGL implements Scatter { <nl> this . renderer . setSize ( this . width , this . height ) ; <nl> this . pickingTexture = new THREE . WebGLRenderTarget ( this . width , this . height ) ; <nl> this . pickingTexture . texture . minFilter = THREE . LinearFilter ; <nl> - this . onResize ( this . width , this . height ) ; <nl> + this . visualizers . forEach ( v = > { <nl> + v . onResize ( this . width , this . height ) ; <nl> + } ) ; <nl> if ( render ) { <nl> this . render ( ) ; <nl> } ; <nl> new file mode 100644 <nl> index 0000000000000 . . c95f8f08d6ac4 <nl> mmm / dev / null <nl> ppp b / tensorflow / tensorboard / components / vz - projector / scatterPlotWebGLVisualizer . ts <nl> <nl> + / * Copyright 2016 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> + import { RenderContext } from ' . / renderContext ' ; <nl> + import { DataSet } from ' . / scatterPlot ' ; <nl> + <nl> + <nl> + / * * <nl> + * ScatterPlotWebGLVisualizer is an interface used by ScatterPlotWebGLContainer <nl> + * to manage and aggregate any number of concurrent visualization behaviors . <nl> + * To add a new visualization to the 3D scatter plot , create a new class that <nl> + * implements this interface and attach it to the ScatterPlotWebGLContainer . <nl> + * / <nl> + export interface ScatterPlotWebGLVisualizer { <nl> + / * * <nl> + * Called when the main scatter plot builds the scene . Add all 3D geometry to <nl> + * the scene here , set up lights , etc . <nl> + * / <nl> + onRecreateScene ( <nl> + scene : THREE . Scene , sceneIs3D : boolean , backgroundColor : number ) ; <nl> + / * * <nl> + * Called when the main scatter plot tears down the scene . Remove all <nl> + * elements from the 3D scene here . <nl> + * / <nl> + removeAllFromScene ( scene : THREE . Scene ) ; <nl> + / * * <nl> + * Called when the projector data set changes . Do any dataset - specific <nl> + * initialization here . <nl> + * / <nl> + onDataSet ( dataSet : DataSet , spriteImage : HTMLImageElement ) ; <nl> + / * * <nl> + * Called immediately before the main scatter plot performs a picking <nl> + * ( selection ) render . Set up render state for any geometry to use picking IDs <nl> + * instead of visual colors . <nl> + * / <nl> + onPickingRender ( camera : THREE . Camera , cameraTarget : THREE . Vector3 ) ; <nl> + / * * <nl> + * Called immediately before the main scatter plot performs a color ( visual ) <nl> + * render . Set up render state , lights , etc here . <nl> + * / <nl> + onRender ( renderContext : RenderContext ) ; <nl> + / * * <nl> + * Called when the projector updates application state ( day / night mode , <nl> + * projection style , etc ) . Generally followed by a render . <nl> + * / <nl> + onUpdate ( ) ; <nl> + / * * <nl> + * Called when the canvas size changes . <nl> + * / <nl> + onResize ( newWidth : number , newHeight : number ) ; <nl> + / * * <nl> + * Called when the application toggles between day and night mode . <nl> + * / <nl> + onSetDayNightMode ( isNight : boolean ) ; <nl> + } <nl> new file mode 100644 <nl> index 0000000000000 . . caf52df93a4f3 <nl> mmm / dev / null <nl> ppp b / tensorflow / tensorboard / components / vz - projector / scatterPlotWebGLVisualizerCanvasLabels . ts <nl> <nl> + / * Copyright 2016 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> + import { BoundingBox , CollisionGrid } from ' . / label ' ; <nl> + import { RenderContext } from ' . / renderContext ' ; <nl> + import { DataSet } from ' . / scatterPlot ' ; <nl> + import { ScatterPlotWebGLVisualizer } from ' . / scatterPlotWebGLVisualizer ' ; <nl> + import { getProjectedPointFromIndex , vector3DToScreenCoords } from ' . / util ' ; <nl> + import { Point2D } from ' . / vector ' ; <nl> + <nl> + const LABEL_COLOR_DAY = 0x000000 ; <nl> + const LABEL_COLOR_NIGHT = 0xffffff ; <nl> + const LABEL_STROKE_DAY = 0xffffff ; <nl> + const LABEL_STROKE_NIGHT = 0x000000 ; <nl> + <nl> + / / The maximum number of labels to draw to keep the frame rate up . <nl> + const SAMPLE_SIZE = 10000 ; <nl> + <nl> + const FONT_SIZE = 10 ; <nl> + <nl> + / * * <nl> + * Creates and maintains a 2d canvas on top of the GL canvas . All labels , when <nl> + * active , are rendered to the 2d canvas as part of the visible render pass . <nl> + * / <nl> + export class ScatterPlotWebGLVisualizerCanvasLabels implements <nl> + ScatterPlotWebGLVisualizer { <nl> + private dataSet : DataSet ; <nl> + private gc : CanvasRenderingContext2D ; <nl> + private canvas : HTMLCanvasElement ; <nl> + private labelCanvasIsCleared = true ; <nl> + private labelColor : number = LABEL_COLOR_DAY ; <nl> + private labelStroke : number = LABEL_STROKE_DAY ; <nl> + private labelsActive : boolean = true ; <nl> + private sceneIs3D : boolean = true ; <nl> + <nl> + constructor ( container : d3 . Selection < any > ) { <nl> + this . canvas = container . append ( ' canvas ' ) . node ( ) as HTMLCanvasElement ; <nl> + this . gc = this . canvas . getContext ( ' 2d ' ) ; <nl> + d3 . select ( this . canvas ) . style ( { position : ' absolute ' , left : 0 , top : 0 } ) ; <nl> + this . canvas . style . pointerEvents = ' none ' ; <nl> + } <nl> + <nl> + private removeAllLabels ( ) { <nl> + / / If labels are already removed , do not spend compute power to clear the <nl> + / / canvas . <nl> + let pixelWidth = this . canvas . width * window . devicePixelRatio ; <nl> + let pixelHeight = this . canvas . height * window . devicePixelRatio ; <nl> + if ( ! this . labelCanvasIsCleared ) { <nl> + this . gc . clearRect ( 0 , 0 , pixelWidth , pixelHeight ) ; <nl> + this . labelCanvasIsCleared = true ; <nl> + } <nl> + } <nl> + <nl> + / * * <nl> + * Reset the positions of all labels , and check for overlapps using the <nl> + * collision grid . <nl> + * / <nl> + private makeLabels ( <nl> + labeledPoints : number [ ] , labelAccessor : ( index : number ) = > string , <nl> + highlightedPoints : number [ ] , camera : THREE . Camera , <nl> + cameraTarget : THREE . Vector3 , screenWidth : number , screenHeight : number , <nl> + nearestPointZ : number , farthestPointZ : number ) { <nl> + this . removeAllLabels ( ) ; <nl> + <nl> + if ( ! labeledPoints . length ) { <nl> + return ; <nl> + } <nl> + <nl> + this . labelCanvasIsCleared = false ; <nl> + <nl> + / / We never render more than ~ 500 labels , so when we get much past that <nl> + / / point , just break . <nl> + let numRenderedLabels : number = 0 ; <nl> + let labelHeight = parseInt ( this . gc . font , 10 ) ; <nl> + let dpr = window . devicePixelRatio ; <nl> + let pixelWidth = this . canvas . width * dpr ; <nl> + let pixelHeight = this . canvas . height * dpr ; <nl> + <nl> + / / Bounding box for collision grid . <nl> + let boundingBox : <nl> + BoundingBox = { loX : 0 , hiX : pixelWidth , loY : 0 , hiY : pixelHeight } ; <nl> + <nl> + / / Make collision grid with cells proportional to window dimensions . <nl> + let grid = <nl> + new CollisionGrid ( boundingBox , pixelWidth / 25 , pixelHeight / 50 ) ; <nl> + <nl> + let opacityRange = farthestPointZ - nearestPointZ ; <nl> + let camToTarget = <nl> + new THREE . Vector3 ( ) . copy ( camera . position ) . sub ( cameraTarget ) ; <nl> + <nl> + / / Setting styles for the labeled font . <nl> + this . gc . lineWidth = 6 ; <nl> + this . gc . textBaseline = ' middle ' ; <nl> + this . gc . font = ( FONT_SIZE * dpr ) . toString ( ) + ' px roboto ' ; <nl> + <nl> + / / Have extra space between neighboring labels . Don ' t pack too tightly . <nl> + let labelMargin = 2 ; <nl> + / / Shift the label to the right of the point circle . <nl> + let xShift = 3 ; <nl> + <nl> + let strokeStylePrefix : string ; <nl> + let fillStylePrefix : string ; <nl> + { <nl> + let ls = new THREE . Color ( this . labelStroke ) . multiplyScalar ( 255 ) ; <nl> + let lc = new THREE . Color ( this . labelColor ) . multiplyScalar ( 255 ) ; <nl> + strokeStylePrefix = ' rgba ( ' + ls . r + ' , ' + ls . g + ' , ' + ls . b + ' , ' ; <nl> + fillStylePrefix = ' rgba ( ' + lc . r + ' , ' + lc . g + ' , ' + lc . b + ' , ' ; <nl> + } <nl> + <nl> + for ( let i = 0 ; <nl> + ( i < labeledPoints . length ) & & ! ( numRenderedLabels > SAMPLE_SIZE ) ; <nl> + i + + ) { <nl> + let index = labeledPoints [ i ] ; <nl> + let point = getProjectedPointFromIndex ( this . dataSet , index ) ; <nl> + / / discard points that are behind the camera <nl> + let camToPoint = new THREE . Vector3 ( ) . copy ( camera . position ) . sub ( point ) ; <nl> + if ( camToTarget . dot ( camToPoint ) < 0 ) { <nl> + continue ; <nl> + } <nl> + let screenCoords = <nl> + vector3DToScreenCoords ( camera , screenWidth , screenHeight , point ) ; <nl> + let textBoundingBox = { <nl> + loX : screenCoords [ 0 ] + xShift - labelMargin , <nl> + / / Computing the width of the font is expensive , <nl> + / / so we assume width of 1 at first . Then , if the label doesn ' t <nl> + / / conflict with other labels , we measure the actual width . <nl> + hiX : screenCoords [ 0 ] + xShift + 1 + labelMargin , <nl> + loY : screenCoords [ 1 ] - labelHeight / 2 - labelMargin , <nl> + hiY : screenCoords [ 1 ] + labelHeight / 2 + labelMargin <nl> + } ; <nl> + <nl> + if ( grid . insert ( textBoundingBox , true ) ) { <nl> + let text = labelAccessor ( index ) ; <nl> + let labelWidth = this . gc . measureText ( text ) . width ; <nl> + <nl> + / / Now , check with properly computed width . <nl> + textBoundingBox . hiX + = labelWidth - 1 ; <nl> + if ( grid . insert ( textBoundingBox ) ) { <nl> + let p = new THREE . Vector3 ( point [ 0 ] , point [ 1 ] , point [ 2 ] ) ; <nl> + let lenToCamera = camera . position . distanceTo ( p ) ; <nl> + / / Opacity is scaled between 0 . 2 and 1 , based on how far a label is <nl> + / / from the camera ( Unless we are in 2d mode , in which case opacity is <nl> + / / just 1 ! ) <nl> + let opacity = this . sceneIs3D ? <nl> + 1 . 2 - ( lenToCamera - nearestPointZ ) / opacityRange : <nl> + 1 ; <nl> + this . formatLabel ( <nl> + text , screenCoords , strokeStylePrefix , fillStylePrefix , opacity ) ; <nl> + numRenderedLabels + + ; <nl> + } <nl> + } <nl> + } <nl> + <nl> + if ( highlightedPoints . length > 0 ) { <nl> + / / Force - draw the first favored point with increased font size . <nl> + let index = highlightedPoints [ 0 ] ; <nl> + let point = this . dataSet . points [ index ] ; <nl> + this . gc . font = ( FONT_SIZE * dpr * 1 . 7 ) . toString ( ) + ' px roboto ' ; <nl> + let coords = new THREE . Vector3 ( <nl> + point . projectedPoint [ 0 ] , point . projectedPoint [ 1 ] , <nl> + point . projectedPoint [ 2 ] ) ; <nl> + let screenCoords = <nl> + vector3DToScreenCoords ( camera , screenWidth , screenHeight , coords ) ; <nl> + let text = labelAccessor ( index ) ; <nl> + this . formatLabel ( <nl> + text , screenCoords , strokeStylePrefix , fillStylePrefix , 1 ) ; <nl> + } <nl> + } <nl> + <nl> + / * * Add a specific label to the canvas . * / <nl> + private formatLabel ( <nl> + text : string , point : Point2D , strokeStylePrefix : string , <nl> + fillStylePrefix : string , opacity : number ) { <nl> + this . gc . strokeStyle = strokeStylePrefix + opacity + ' ) ' ; <nl> + this . gc . fillStyle = fillStylePrefix + opacity + ' ) ' ; <nl> + this . gc . strokeText ( text , point [ 0 ] + 4 , point [ 1 ] ) ; <nl> + this . gc . fillText ( text , point [ 0 ] + 4 , point [ 1 ] ) ; <nl> + } <nl> + <nl> + onDataSet ( dataSet : DataSet , spriteImage : HTMLImageElement ) { <nl> + this . labelsActive = ( spriteImage = = null ) ; <nl> + this . dataSet = dataSet ; <nl> + } <nl> + <nl> + onResize ( newWidth : number , newHeight : number ) { <nl> + let dpr = window . devicePixelRatio ; <nl> + d3 . select ( this . canvas ) <nl> + . attr ( ' width ' , newWidth * dpr ) <nl> + . attr ( ' height ' , newHeight * dpr ) <nl> + . style ( { width : newWidth + ' px ' , height : newHeight + ' px ' } ) ; <nl> + } <nl> + <nl> + onRecreateScene ( <nl> + scene : THREE . Scene , sceneIs3D : boolean , backgroundColor : number ) { <nl> + this . sceneIs3D = sceneIs3D ; <nl> + } <nl> + <nl> + removeAllFromScene ( scene : THREE . Scene ) { <nl> + this . removeAllLabels ( ) ; <nl> + } <nl> + <nl> + onUpdate ( ) { <nl> + this . removeAllLabels ( ) ; <nl> + } <nl> + <nl> + onSetDayNightMode ( isNight : boolean ) { <nl> + this . labelColor = ( isNight ? LABEL_COLOR_NIGHT : LABEL_COLOR_DAY ) ; <nl> + this . labelStroke = ( isNight ? LABEL_STROKE_NIGHT : LABEL_STROKE_DAY ) ; <nl> + } <nl> + <nl> + onPickingRender ( camera : THREE . Camera , cameraTarget : THREE . Vector3 ) { } <nl> + <nl> + onRender ( rc : RenderContext ) { <nl> + if ( this . labelsActive ) { <nl> + this . makeLabels ( <nl> + rc . labeledPoints , rc . labelAccessor , rc . highlightedPoints , rc . camera , <nl> + rc . cameraTarget , rc . screenWidth , rc . screenHeight , <nl> + rc . nearestCameraSpacePointZ , rc . farthestCameraSpacePointZ ) ; <nl> + } <nl> + } <nl> + } <nl> similarity index 53 % <nl> rename from tensorflow / tensorboard / components / vz - projector / scatterWebGLPointsCanvasLabels . ts <nl> rename to tensorflow / tensorboard / components / vz - projector / scatterPlotWebGLVisualizerSprites . ts <nl> mmm a / tensorflow / tensorboard / components / vz - projector / scatterWebGLPointsCanvasLabels . ts <nl> ppp b / tensorflow / tensorboard / components / vz - projector / scatterPlotWebGLVisualizerSprites . ts <nl> See the License for the specific language governing permissions and <nl> limitations under the License . <nl> = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = * / <nl> <nl> - import { BoundingBox , CollisionGrid } from ' . / label ' ; <nl> - import { DataSet } from ' . / scatter ' ; <nl> - import { ScatterWebGL } from ' . / scatterWebGL ' ; <nl> - import { Point2D } from ' . / vector ' ; <nl> + import { RenderContext } from ' . / renderContext ' ; <nl> + import { DataSet } from ' . / scatterPlot ' ; <nl> + import { ScatterPlotWebGL } from ' . / scatterPlotWebGL ' ; <nl> + import { ScatterPlotWebGLVisualizer } from ' . / scatterPlotWebGLVisualizer ' ; <nl> <nl> - const FONT_SIZE = 10 ; <nl> const NUM_POINTS_FOG_THRESHOLD = 5000 ; <nl> const MIN_POINT_SIZE = 5 . 0 ; <nl> const IMAGE_SIZE = 30 ; <nl> <nl> - const LABEL_COLOR_DAY = 0x000000 ; <nl> - const LABEL_COLOR_NIGHT = 0xffffff ; <nl> - const LABEL_STROKE_DAY = 0xffffff ; <nl> - const LABEL_STROKE_NIGHT = 0x000000 ; <nl> const POINT_COLOR = 0x7575D9 ; <nl> const POINT_COLOR_GRAYED = 0x888888 ; <nl> <nl> const INDEX_NUM_BYTES = 1 ; <nl> / * * Item size of a single point in a bufferArray representing locations * / <nl> const XYZ_NUM_BYTES = 3 ; <nl> <nl> - / / The maximum number of labels to draw to keep the frame rate up . <nl> - const SAMPLE_SIZE = 10000 ; <nl> - <nl> const VERTEX_SHADER = ` <nl> / / Index of the specific vertex ( passed in as bufferAttribute ) , and the <nl> / / variable that will be used to pass it to the fragment shader . <nl> const FRAGMENT_SHADER = ` <nl> uniform bool isImage ; <nl> <nl> void main ( ) { <nl> - / / A mystery variable that is required to make the THREE shaderchunk for fog <nl> - / / work correctly . <nl> - vec3 outgoingLight = vec3 ( 0 . 0 ) ; <nl> - <nl> if ( isImage ) { <nl> / / Coordinates of the vertex within the entire sprite image . <nl> vec2 coords = ( gl_PointCoord + xyIndex ) / vec2 ( imageWidth , imageHeight ) ; <nl> const FRAGMENT_SHADER = ` <nl> } ` ; <nl> <nl> / * * <nl> - * ScatterWebGLPointCanvasLabels uses GL point sprites to render <nl> + * This uses GL point sprites to render <nl> * the scatter plot dataset , and a 2D HTML canvas to render labels . <nl> * / <nl> - export class ScatterWebGLPointsCanvasLabels extends ScatterWebGL { <nl> - / / TODO ( nicholsonc ) : the trailing _ here is temporary . <nl> - / / ScatterWebGLPointsCanvasLabels is going to become an aggregate of <nl> - / / ScatterWebGL , at which point the naming collision between <nl> - / / ScatterWebGL . dataSet and this dataSet will go away , and we can <nl> - / / rename dataSet_ here to dataSet . <nl> - private dataSet_ : DataSet ; <nl> - <nl> - private gc : CanvasRenderingContext2D ; <nl> - private canvas : HTMLCanvasElement ; <nl> - private labelCanvasIsCleared = true ; <nl> - private image : HTMLImageElement ; <nl> + export class ScatterPlotWebGLVisualizerSprites implements <nl> + ScatterPlotWebGLVisualizer { <nl> + private dataSet : DataSet ; <nl> <nl> + private image : HTMLImageElement ; <nl> private geometry : THREE . BufferGeometry ; <nl> - private materialParams : THREE . ShaderMaterialParameters ; <nl> private positionBuffer : THREE . BufferAttribute ; <nl> + private renderMaterial : THREE . ShaderMaterial ; <nl> + private pickingMaterial : THREE . ShaderMaterial ; <nl> + private uniforms : Object ; <nl> <nl> private defaultPointColor = POINT_COLOR ; <nl> private sceneIs3D : boolean = true ; <nl> export class ScatterWebGLPointsCanvasLabels extends ScatterWebGL { <nl> private traces : THREE . Line [ ] ; <nl> private tracePositionBuffer : { [ trace : number ] : THREE . BufferAttribute } = { } ; <nl> <nl> - private labelColor : number ; <nl> - private labelStroke : number ; <nl> - <nl> - private blending : THREE . Blending ; <nl> + private blending : THREE . Blending = BLENDING_DAY ; <nl> <nl> - constructor ( <nl> - container : d3 . Selection < any > , labelAccessor : ( index : number ) = > string ) { <nl> - super ( container , labelAccessor ) ; <nl> - this . canvas = container . append ( ' canvas ' ) . node ( ) as HTMLCanvasElement ; <nl> - this . gc = this . canvas . getContext ( ' 2d ' ) ; <nl> - d3 . select ( this . canvas ) . style ( { position : ' absolute ' , left : 0 , top : 0 } ) ; <nl> - this . canvas . style . pointerEvents = ' none ' ; <nl> - this . onSelection ( ( s : number [ ] ) = > this . onSelectionChanged ( s ) ) ; <nl> + constructor ( scatterPlotWebGL : ScatterPlotWebGL ) { <nl> + scatterPlotWebGL . onSelection ( ( s : number [ ] ) = > this . onSelectionChanged ( s ) ) ; <nl> } <nl> <nl> / * * <nl> export class ScatterWebGLPointsCanvasLabels extends ScatterWebGL { <nl> if ( this . image ) { <nl> pointSize = IMAGE_SIZE ; <nl> } <nl> - let uniforms = { <nl> + <nl> + this . uniforms = { <nl> texture : { type : ' t ' , value : tex } , <nl> imageWidth : { type : ' f ' , value : image . width / spriteDim } , <nl> imageHeight : { type : ' f ' , value : image . height / spriteDim } , <nl> export class ScatterWebGLPointsCanvasLabels extends ScatterWebGL { <nl> isImage : { type : ' bool ' , value : ! ! this . image } , <nl> pointSize : { type : ' f ' , value : pointSize } <nl> } ; <nl> - this . materialParams = { <nl> - uniforms : uniforms , <nl> + <nl> + let haveImage = ( this . image ! = null ) ; <nl> + <nl> + this . renderMaterial = new THREE . ShaderMaterial ( { <nl> + uniforms : this . uniforms , <nl> vertexShader : VERTEX_SHADER , <nl> fragmentShader : FRAGMENT_SHADER , <nl> - transparent : ( this . image ? false : true ) , <nl> - / / When rendering points with blending , we want depthTest / Write <nl> - / / turned off . <nl> - depthTest : ( this . image ? true : false ) , <nl> - depthWrite : ( this . image ? true : false ) , <nl> + transparent : ! haveImage , <nl> + depthTest : haveImage , <nl> + depthWrite : haveImage , <nl> fog : true , <nl> blending : ( this . image ? THREE . NormalBlending : this . blending ) , <nl> - } ; <nl> - / / Give it some material . <nl> - let material = new THREE . ShaderMaterial ( this . materialParams ) ; <nl> + } ) ; <nl> + <nl> + this . pickingMaterial = new THREE . ShaderMaterial ( { <nl> + uniforms : this . uniforms , <nl> + vertexShader : VERTEX_SHADER , <nl> + fragmentShader : FRAGMENT_SHADER , <nl> + transparent : false , <nl> + depthTest : true , <nl> + depthWrite : true , <nl> + fog : false , <nl> + blending : ( this . image ? THREE . NormalBlending : this . blending ) , <nl> + } ) ; <nl> <nl> / / And finally initialize it and add it to the scene . <nl> - this . points = new THREE . Points ( this . geometry , material ) ; <nl> + this . points = new THREE . Points ( this . geometry , this . renderMaterial ) ; <nl> scene . add ( this . points ) ; <nl> } <nl> <nl> export class ScatterWebGLPointsCanvasLabels extends ScatterWebGL { <nl> * Create line traces between connected points and instantiate the geometry . <nl> * / <nl> private addTraces ( scene : THREE . Scene ) { <nl> - if ( ! this . dataSet_ | | ! this . dataSet_ . traces ) { <nl> + if ( ! this . dataSet | | ! this . dataSet . traces ) { <nl> return ; <nl> } <nl> <nl> this . traces = [ ] ; <nl> <nl> - for ( let i = 0 ; i < this . dataSet_ . traces . length ; i + + ) { <nl> - let dataTrace = this . dataSet_ . traces [ i ] ; <nl> + for ( let i = 0 ; i < this . dataSet . traces . length ; i + + ) { <nl> + let dataTrace = this . dataSet . traces [ i ] ; <nl> <nl> let geometry = new THREE . BufferGeometry ( ) ; <nl> let colors : number [ ] = [ ] ; <nl> <nl> for ( let j = 0 ; j < dataTrace . pointIndices . length - 1 ; j + + ) { <nl> - this . dataSet_ . points [ dataTrace . pointIndices [ j ] ] . traceIndex = i ; <nl> - this . dataSet_ . points [ dataTrace . pointIndices [ j + 1 ] ] . traceIndex = i ; <nl> + this . dataSet . points [ dataTrace . pointIndices [ j ] ] . traceIndex = i ; <nl> + this . dataSet . points [ dataTrace . pointIndices [ j + 1 ] ] . traceIndex = i ; <nl> <nl> let color1 = <nl> this . getPointInTraceColor ( j , dataTrace . pointIndices . length ) ; <nl> export class ScatterWebGLPointsCanvasLabels extends ScatterWebGL { <nl> } <nl> } <nl> <nl> - / * * Removes all traces from the scene . * / <nl> private removeAllTraces ( scene : THREE . Scene ) { <nl> if ( ! this . traces ) { <nl> return ; <nl> export class ScatterWebGLPointsCanvasLabels extends ScatterWebGL { <nl> this . traces = [ ] ; <nl> } <nl> <nl> - / * * <nl> - * Returns the color of a point along a trace . <nl> - * / <nl> private getPointInTraceColor ( index : number , totalPoints : number ) { <nl> let hue = TRACE_START_HUE + <nl> ( TRACE_END_HUE - TRACE_START_HUE ) * index / totalPoints ; <nl> export class ScatterWebGLPointsCanvasLabels extends ScatterWebGL { <nl> } <nl> <nl> private calibratePointSize ( ) { <nl> - let numPts = this . dataSet_ . points . length ; <nl> + let numPts = this . dataSet . points . length ; <nl> let scaleConstant = 200 ; <nl> let logBase = 8 ; <nl> / / Scale point size inverse - logarithmically to the number of points . <nl> export class ScatterWebGLPointsCanvasLabels extends ScatterWebGL { <nl> / / by making the " far " value ( that is , the distance from the camera to the <nl> / / far edge of the fog ) proportional to the number of points . <nl> let multiplier = 2 - <nl> - Math . min ( this . dataSet_ . points . length , NUM_POINTS_FOG_THRESHOLD ) / <nl> + Math . min ( this . dataSet . points . length , NUM_POINTS_FOG_THRESHOLD ) / <nl> NUM_POINTS_FOG_THRESHOLD ; <nl> this . fog . far = farthestPointZ * multiplier ; <nl> } else { <nl> export class ScatterWebGLPointsCanvasLabels extends ScatterWebGL { <nl> } <nl> } <nl> <nl> - private getNearFarPoints ( <nl> - cameraPos : THREE . Vector3 , cameraTarget : THREE . Vector3 ) { <nl> - let shortestDist : number = Infinity ; <nl> - let furthestDist : number = 0 ; <nl> - let camToTarget = new THREE . Vector3 ( ) . copy ( cameraTarget ) . sub ( cameraPos ) ; <nl> - for ( let i = 0 ; i < this . dataSet_ . points . length ; i + + ) { <nl> - let point = this . getProjectedPointFromIndex ( i ) ; <nl> - / / discard points that are behind the camera <nl> - let camToPoint = new THREE . Vector3 ( ) . copy ( point ) . sub ( cameraPos ) ; <nl> - if ( camToTarget . dot ( camToPoint ) < 0 ) { <nl> - continue ; <nl> - } <nl> - <nl> - let distToCam = cameraPos . distanceToSquared ( point ) ; <nl> - furthestDist = Math . max ( furthestDist , distToCam ) ; <nl> - shortestDist = Math . min ( shortestDist , distToCam ) ; <nl> - } <nl> - furthestDist = Math . sqrt ( furthestDist ) ; <nl> - shortestDist = Math . sqrt ( shortestDist ) ; <nl> - return [ shortestDist , furthestDist ] ; <nl> - } <nl> - <nl> - private removeAllLabels ( ) { <nl> - / / If labels are already removed , do not spend compute power to clear the <nl> - / / canvas . <nl> - let pixelWidth = this . canvas . width * window . devicePixelRatio ; <nl> - let pixelHeight = this . canvas . height * window . devicePixelRatio ; <nl> - if ( ! this . labelCanvasIsCleared ) { <nl> - this . gc . clearRect ( 0 , 0 , pixelWidth , pixelHeight ) ; <nl> - this . labelCanvasIsCleared = true ; <nl> - } <nl> - } <nl> - <nl> - / * * <nl> - * Reset the positions of all labels , and check for overlapps using the <nl> - * collision grid . <nl> - * / <nl> - private makeLabels ( <nl> - labeledPoints : number [ ] , labelAccessor : ( index : number ) = > string , <nl> - cameraPos : THREE . Vector3 , cameraTarget : THREE . Vector3 , <nl> - nearestPointZ : number , farthestPointZ : number ) { <nl> - if ( this . points = = null ) { <nl> - return ; <nl> - } <nl> - / / First , remove all old labels . <nl> - this . removeAllLabels ( ) ; <nl> - <nl> - if ( ! labeledPoints . length ) { <nl> - return ; <nl> - } <nl> - <nl> - this . labelCanvasIsCleared = false ; <nl> - <nl> - / / We never render more than ~ 500 labels , so when we get much past that <nl> - / / point , just break . <nl> - let numRenderedLabels : number = 0 ; <nl> - let labelHeight = parseInt ( this . gc . font , 10 ) ; <nl> - let dpr = window . devicePixelRatio ; <nl> - let pixelWidth = this . canvas . width * dpr ; <nl> - let pixelHeight = this . canvas . height * dpr ; <nl> - <nl> - / / Bounding box for collision grid . <nl> - let boundingBox : <nl> - BoundingBox = { loX : 0 , hiX : pixelWidth , loY : 0 , hiY : pixelHeight } ; <nl> - <nl> - / / Make collision grid with cells proportional to window dimensions . <nl> - let grid = <nl> - new CollisionGrid ( boundingBox , pixelWidth / 25 , pixelHeight / 50 ) ; <nl> - <nl> - let opacityRange = farthestPointZ - nearestPointZ ; <nl> - let camToTarget = new THREE . Vector3 ( ) . copy ( cameraPos ) . sub ( cameraTarget ) ; <nl> - <nl> - / / Setting styles for the labeled font . <nl> - this . gc . lineWidth = 6 ; <nl> - this . gc . textBaseline = ' middle ' ; <nl> - this . gc . font = ( FONT_SIZE * dpr ) . toString ( ) + ' px roboto ' ; <nl> - <nl> - let strokeStylePrefix : string ; <nl> - let fillStylePrefix : string ; <nl> - { <nl> - let ls = new THREE . Color ( this . labelStroke ) . multiplyScalar ( 255 ) ; <nl> - let lc = new THREE . Color ( this . labelColor ) . multiplyScalar ( 255 ) ; <nl> - strokeStylePrefix = ' rgba ( ' + ls . r + ' , ' + ls . g + ' , ' + ls . b + ' , ' ; <nl> - fillStylePrefix = ' rgba ( ' + lc . r + ' , ' + lc . g + ' , ' + lc . b + ' , ' ; <nl> - } <nl> - <nl> - for ( let i = 0 ; <nl> - ( i < labeledPoints . length ) & & ! ( numRenderedLabels > SAMPLE_SIZE ) ; <nl> - i + + ) { <nl> - let index = labeledPoints [ i ] ; <nl> - let point = this . getProjectedPointFromIndex ( index ) ; <nl> - / / discard points that are behind the camera <nl> - let camToPoint = new THREE . Vector3 ( ) . copy ( cameraPos ) . sub ( point ) ; <nl> - if ( camToTarget . dot ( camToPoint ) < 0 ) { <nl> - continue ; <nl> - } <nl> - let screenCoords = this . vector3DToScreenCoords ( point ) ; <nl> - / / Have extra space between neighboring labels . Don ' t pack too tightly . <nl> - let labelMargin = 2 ; <nl> - / / Shift the label to the right of the point circle . <nl> - let xShift = 3 ; <nl> - let textBoundingBox = { <nl> - loX : screenCoords [ 0 ] + xShift - labelMargin , <nl> - / / Computing the width of the font is expensive , <nl> - / / so we assume width of 1 at first . Then , if the label doesn ' t <nl> - / / conflict with other labels , we measure the actual width . <nl> - hiX : screenCoords [ 0 ] + xShift + 1 + labelMargin , <nl> - loY : screenCoords [ 1 ] - labelHeight / 2 - labelMargin , <nl> - hiY : screenCoords [ 1 ] + labelHeight / 2 + labelMargin <nl> - } ; <nl> - <nl> - if ( grid . insert ( textBoundingBox , true ) ) { <nl> - let text = labelAccessor ( index ) ; <nl> - let labelWidth = this . gc . measureText ( text ) . width ; <nl> - <nl> - / / Now , check with properly computed width . <nl> - textBoundingBox . hiX + = labelWidth - 1 ; <nl> - if ( grid . insert ( textBoundingBox ) ) { <nl> - let p = new THREE . Vector3 ( point [ 0 ] , point [ 1 ] , point [ 2 ] ) ; <nl> - let lenToCamera = cameraPos . distanceTo ( p ) ; <nl> - / / Opacity is scaled between 0 . 2 and 1 , based on how far a label is <nl> - / / from the camera ( Unless we are in 2d mode , in which case opacity is <nl> - / / just 1 ! ) <nl> - let opacity = this . sceneIs3D ? <nl> - 1 . 2 - ( lenToCamera - nearestPointZ ) / opacityRange : <nl> - 1 ; <nl> - this . formatLabel ( <nl> - text , screenCoords , strokeStylePrefix , fillStylePrefix , opacity ) ; <nl> - numRenderedLabels + + ; <nl> - } <nl> - } <nl> - } <nl> - <nl> - if ( this . highlightedPoints . length > 0 ) { <nl> - / / Force - draw the first favored point with increased font size . <nl> - let index = this . highlightedPoints [ 0 ] ; <nl> - let point = this . dataSet_ . points [ index ] ; <nl> - this . gc . font = ( FONT_SIZE * dpr * 1 . 7 ) . toString ( ) + ' px roboto ' ; <nl> - let coords = new THREE . Vector3 ( <nl> - point . projectedPoint [ 0 ] , point . projectedPoint [ 1 ] , <nl> - point . projectedPoint [ 2 ] ) ; <nl> - let screenCoords = this . vector3DToScreenCoords ( coords ) ; <nl> - let text = labelAccessor ( index ) ; <nl> - this . formatLabel ( <nl> - text , screenCoords , strokeStylePrefix , fillStylePrefix , 255 ) ; <nl> - } <nl> - } <nl> - <nl> - / * * Add a specific label to the canvas . * / <nl> - private formatLabel ( <nl> - text : string , point : Point2D , strokeStylePrefix : string , <nl> - fillStylePrefix : string , opacity : number ) { <nl> - this . gc . strokeStyle = strokeStylePrefix + opacity + ' ) ' ; <nl> - this . gc . fillStyle = fillStylePrefix + opacity + ' ) ' ; <nl> - this . gc . strokeText ( text , point [ 0 ] + 4 , point [ 1 ] ) ; <nl> - this . gc . fillText ( text , point [ 0 ] + 4 , point [ 1 ] ) ; <nl> - } <nl> - <nl> - onResize ( newWidth : number , newHeight : number ) { <nl> - let dpr = window . devicePixelRatio ; <nl> - d3 . select ( this . canvas ) <nl> - . attr ( ' width ' , newWidth * dpr ) <nl> - . attr ( ' height ' , newHeight * dpr ) <nl> - . style ( { width : newWidth + ' px ' , height : newHeight + ' px ' } ) ; <nl> - } <nl> - <nl> / * * <nl> * Set up buffer attributes to be used for the points / images . <nl> * / <nl> private createBufferAttributes ( ) { <nl> - let numPoints = this . dataSet_ . points . length ; <nl> + let numPoints = this . dataSet . points . length ; <nl> this . pickingColors = new Float32Array ( numPoints * RGB_NUM_BYTES ) ; <nl> let colors = new THREE . BufferAttribute ( this . pickingColors , RGB_NUM_BYTES ) ; <nl> <nl> export class ScatterWebGLPointsCanvasLabels extends ScatterWebGL { <nl> <nl> / / Create the array of indices . <nl> for ( let i = 0 ; i < numPoints ; i + + ) { <nl> - indicesShader . setX ( i , this . dataSet_ . points [ i ] . dataSourceIndex ) ; <nl> + indicesShader . setX ( i , this . dataSet . points [ i ] . dataSourceIndex ) ; <nl> } <nl> <nl> / / Finally , add all attributes to the geometry . <nl> export class ScatterWebGLPointsCanvasLabels extends ScatterWebGL { <nl> this . geometry . addAttribute ( ' vertexIndex ' , indicesShader ) ; <nl> this . geometry . addAttribute ( ' isHighlight ' , highlights ) ; <nl> <nl> - / / For now , nothing is highlighted . <nl> this . colorSprites ( null ) ; <nl> + this . highlightSprites ( null , null ) ; <nl> } <nl> <nl> private resetTraces ( ) { <nl> export class ScatterWebGLPointsCanvasLabels extends ScatterWebGL { <nl> } <nl> } <nl> <nl> - private colorSprites ( highlightStroke : ( ( index : number ) = > string ) ) { <nl> - if ( ! this . geometry ) { <nl> + private colorSprites ( colorAccessor : ( index : number ) = > string ) { <nl> + if ( this . geometry = = null ) { <nl> return ; <nl> } <nl> - / / Update attributes to change colors <nl> let colors = this . geometry . getAttribute ( ' color ' ) as THREE . BufferAttribute ; <nl> + colors . array = this . renderColors ; <nl> + let getColor : ( index : number ) = > string = ( ( ) = > undefined ) ; <nl> + if ( this . image = = null ) { <nl> + getColor = <nl> + colorAccessor ? colorAccessor : ( ) = > ( this . defaultPointColor as any ) ; <nl> + } <nl> + for ( let i = 0 ; i < this . dataSet . points . length ; i + + ) { <nl> + let color = new THREE . Color ( getColor ( i ) ) ; <nl> + colors . setXYZ ( i , color . r , color . g , color . b ) ; <nl> + } <nl> + colors . needsUpdate = true ; <nl> + } <nl> + <nl> + private highlightSprites ( <nl> + highlightedPoints : number [ ] , highlightStroke : ( index : number ) = > string ) { <nl> + if ( this . geometry = = null ) { <nl> + return ; <nl> + } <nl> let highlights = <nl> this . geometry . getAttribute ( ' isHighlight ' ) as THREE . BufferAttribute ; <nl> - for ( let i = 0 ; i < this . dataSet_ . points . length ; i + + ) { <nl> - let unhighlightedColor = this . image ? <nl> - new THREE . Color ( ) : <nl> - new THREE . Color ( <nl> - this . colorAccessor ? this . colorAccessor ( i ) : <nl> - ( this . defaultPointColor as any ) ) ; <nl> - colors . setXYZ ( <nl> - i , unhighlightedColor . r , unhighlightedColor . g , unhighlightedColor . b ) ; <nl> + for ( let i = 0 ; i < this . dataSet . points . length ; i + + ) { <nl> highlights . setX ( i , 0 . 0 ) ; <nl> } <nl> - if ( highlightStroke ) { <nl> + if ( highlightedPoints & & highlightStroke ) { <nl> + let colors = this . geometry . getAttribute ( ' color ' ) as THREE . BufferAttribute ; <nl> / / Traverse in reverse so that the point we are hovering over <nl> / / ( highlightedPoints [ 0 ] ) is painted last . <nl> - for ( let i = this . highlightedPoints . length - 1 ; i > = 0 ; i - - ) { <nl> - let assocPoint = this . highlightedPoints [ i ] ; <nl> + for ( let i = highlightedPoints . length - 1 ; i > = 0 ; i - - ) { <nl> + let assocPoint = highlightedPoints [ i ] ; <nl> let color = new THREE . Color ( highlightStroke ( i ) ) ; <nl> / / Fill colors array ( single array of numPoints * 3 elements , <nl> / / triples of which refer to the rgb values of a single vertex ) . <nl> colors . setXYZ ( assocPoint , color . r , color . g , color . b ) ; <nl> highlights . setX ( assocPoint , 1 . 0 ) ; <nl> } <nl> + colors . needsUpdate = true ; <nl> } <nl> - colors . needsUpdate = true ; <nl> highlights . needsUpdate = true ; <nl> } <nl> <nl> / * Updates the positions buffer array to reflect the actual data . * / <nl> private updatePositionsArray ( ) { <nl> / / Update the points . <nl> - for ( let i = 0 ; i < this . dataSet_ . points . length ; i + + ) { <nl> + for ( let i = 0 ; i < this . dataSet . points . length ; i + + ) { <nl> / / Set position based on projected point . <nl> - let pp = this . dataSet_ . points [ i ] . projectedPoint ; <nl> + let pp = this . dataSet . points [ i ] . projectedPoint ; <nl> this . positionBuffer . setXYZ ( i , pp [ 0 ] , pp [ 1 ] , pp [ 2 ] ) ; <nl> } <nl> <nl> / / Update the traces . <nl> - for ( let i = 0 ; i < this . dataSet_ . traces . length ; i + + ) { <nl> - let dataTrace = this . dataSet_ . traces [ i ] ; <nl> + for ( let i = 0 ; i < this . dataSet . traces . length ; i + + ) { <nl> + let dataTrace = this . dataSet . traces [ i ] ; <nl> <nl> let vertexCount = 0 ; <nl> for ( let j = 0 ; j < dataTrace . pointIndices . length - 1 ; j + + ) { <nl> - let point1 = this . dataSet_ . points [ dataTrace . pointIndices [ j ] ] ; <nl> - let point2 = this . dataSet_ . points [ dataTrace . pointIndices [ j + 1 ] ] ; <nl> + let point1 = this . dataSet . points [ dataTrace . pointIndices [ j ] ] ; <nl> + let point2 = this . dataSet . points [ dataTrace . pointIndices [ j + 1 ] ] ; <nl> <nl> this . tracePositionBuffer [ i ] . setXYZ ( <nl> vertexCount , point1 . projectedPoint [ 0 ] , point1 . projectedPoint [ 1 ] , <nl> export class ScatterWebGLPointsCanvasLabels extends ScatterWebGL { <nl> if ( this . geometry ) { <nl> this . positionBuffer . needsUpdate = true ; <nl> <nl> - for ( let i = 0 ; i < this . dataSet_ . traces . length ; i + + ) { <nl> + for ( let i = 0 ; i < this . dataSet . traces . length ; i + + ) { <nl> this . tracePositionBuffer [ i ] . needsUpdate = true ; <nl> } <nl> } <nl> } <nl> <nl> - protected removeAllFromScene ( scene : THREE . Scene ) { <nl> + removeAllFromScene ( scene : THREE . Scene ) { <nl> scene . remove ( this . points ) ; <nl> - this . removeAllLabels ( ) ; <nl> this . removeAllTraces ( scene ) ; <nl> } <nl> <nl> / * * <nl> * Generate a texture for the points / images and sets some initial params <nl> * / <nl> - protected createTexture ( image : HTMLImageElement | <nl> - HTMLCanvasElement ) : THREE . Texture { <nl> + createTexture ( image : HTMLImageElement | HTMLCanvasElement ) : THREE . Texture { <nl> let tex = new THREE . Texture ( image ) ; <nl> tex . needsUpdate = true ; <nl> / / Used if the texture isn ' t a power of 2 . <nl> export class ScatterWebGLPointsCanvasLabels extends ScatterWebGL { <nl> return tex ; <nl> } <nl> <nl> - protected onDataSet ( dataSet : DataSet , spriteImage : HTMLImageElement ) { <nl> - this . dataSet_ = dataSet ; <nl> + onDataSet ( dataSet : DataSet , spriteImage : HTMLImageElement ) { <nl> + this . dataSet = dataSet ; <nl> + this . image = spriteImage ; <nl> this . points = null ; <nl> if ( this . geometry ) { <nl> this . geometry . dispose ( ) ; <nl> export class ScatterWebGLPointsCanvasLabels extends ScatterWebGL { <nl> this . calibratePointSize ( ) ; <nl> <nl> let positions = <nl> - new Float32Array ( this . dataSet_ . points . length * XYZ_NUM_BYTES ) ; <nl> + new Float32Array ( this . dataSet . points . length * XYZ_NUM_BYTES ) ; <nl> this . positionBuffer = new THREE . BufferAttribute ( positions , XYZ_NUM_BYTES ) ; <nl> <nl> / / Set up the position buffer arrays for each trace . <nl> - for ( let i = 0 ; i < this . dataSet_ . traces . length ; i + + ) { <nl> - let dataTrace = this . dataSet_ . traces [ i ] ; <nl> + for ( let i = 0 ; i < this . dataSet . traces . length ; i + + ) { <nl> + let dataTrace = this . dataSet . traces [ i ] ; <nl> let traces = new Float32Array ( <nl> 2 * ( dataTrace . pointIndices . length - 1 ) * XYZ_NUM_BYTES ) ; <nl> this . tracePositionBuffer [ i ] = <nl> new THREE . BufferAttribute ( traces , XYZ_NUM_BYTES ) ; <nl> } <nl> - <nl> - this . image = spriteImage ; <nl> - } <nl> - <nl> - protected onHighlightPoints ( <nl> - pointIndexes : number [ ] , highlightStroke : ( i : number ) = > string ) { <nl> - this . colorSprites ( highlightStroke ) ; <nl> - } <nl> - <nl> - protected onSetColorAccessor ( ) { <nl> - if ( this . geometry ) { <nl> - this . colorSprites ( this . highlightStroke ) ; <nl> - } <nl> } <nl> <nl> - private onSelectionChanged ( selection : number [ ] ) { <nl> + onSelectionChanged ( selection : number [ ] ) { <nl> this . resetTraces ( ) ; <nl> this . defaultPointColor = POINT_COLOR ; <nl> if ( selection . length > 0 ) { <nl> this . defaultPointColor = POINT_COLOR_GRAYED ; <nl> let selectedIndex = selection [ 0 ] ; <nl> - let traceIndex = this . dataSet_ . points [ selectedIndex ] . traceIndex ; <nl> + let traceIndex = this . dataSet . points [ selectedIndex ] . traceIndex ; <nl> if ( traceIndex ) { <nl> for ( let i = 0 ; i < this . traces . length ; i + + ) { <nl> this . traces [ i ] . material . opacity = TRACE_DESELECTED_OPACITY ; <nl> export class ScatterWebGLPointsCanvasLabels extends ScatterWebGL { <nl> } <nl> } <nl> <nl> - protected onSetDayNightMode ( isNight : boolean ) { <nl> - this . labelColor = ( isNight ? LABEL_COLOR_NIGHT : LABEL_COLOR_DAY ) ; <nl> - this . labelStroke = ( isNight ? LABEL_STROKE_NIGHT : LABEL_STROKE_DAY ) ; <nl> + onSetDayNightMode ( isNight : boolean ) { <nl> this . blending = ( isNight ? BLENDING_NIGHT : BLENDING_DAY ) ; <nl> } <nl> <nl> - protected onRecreateScene ( <nl> + onRecreateScene ( <nl> scene : THREE . Scene , sceneIs3D : boolean , backgroundColor : number ) { <nl> this . sceneIs3D = sceneIs3D ; <nl> this . fog = new THREE . Fog ( backgroundColor ) ; <nl> scene . fog = this . fog ; <nl> this . addSprites ( scene ) ; <nl> this . colorSprites ( null ) ; <nl> + this . highlightSprites ( null , null ) ; <nl> this . addTraces ( scene ) ; <nl> } <nl> <nl> - protected onUpdate ( ) { <nl> + onUpdate ( ) { <nl> this . updatePositionsArray ( ) ; <nl> - if ( this . geometry ) { <nl> - this . render ( ) ; <nl> - } <nl> } <nl> <nl> - protected onPickingRender ( camera : THREE . Camera , cameraTarget : THREE . Vector3 ) { <nl> + onResize ( newWidth : number , newHeight : number ) { } <nl> + <nl> + onPickingRender ( camera : THREE . Camera , cameraTarget : THREE . Vector3 ) { <nl> if ( ! this . geometry ) { <nl> return ; <nl> } <nl> - let colors = this . geometry . getAttribute ( ' color ' ) as THREE . BufferAttribute ; <nl> - / / Make shallow copy of the shader options and modify the necessary values . <nl> - let pickingState = <nl> - Object . create ( this . materialParams ) as THREE . ShaderMaterialParameters ; <nl> - this . fog . near = <nl> - Infinity ; / / Fog changes point colors , which alters the IDs . <nl> + / / Fog changes point colors , which alters the IDs . <nl> + this . fog . near = Infinity ; <nl> this . fog . far = Infinity ; <nl> - pickingState . transparent = false ; / / Alpha blending distorts the IDs . <nl> - pickingState . uniforms . isImage . value = false ; <nl> - pickingState . depthTest = true ; <nl> - pickingState . depthWrite = true ; <nl> - ( this . points . material as THREE . ShaderMaterial ) . setValues ( pickingState ) ; <nl> + <nl> + this . points . material = this . pickingMaterial ; <nl> + this . pickingMaterial . uniforms . isImage . value = false ; <nl> + <nl> + let colors = this . geometry . getAttribute ( ' color ' ) as THREE . BufferAttribute ; <nl> colors . array = this . pickingColors ; <nl> colors . needsUpdate = true ; <nl> } <nl> <nl> - protected onRender ( <nl> - camera : THREE . Camera , cameraTarget : THREE . Vector3 , <nl> - labeledPoints : number [ ] , labelAccessor : ( index : number ) = > string ) { <nl> + onRender ( rc : RenderContext ) { <nl> if ( ! this . geometry ) { <nl> return ; <nl> } <nl> - let nearFarPoints = this . getNearFarPoints ( camera . position , cameraTarget ) ; <nl> - this . makeLabels ( <nl> - labeledPoints , labelAccessor , camera . position , cameraTarget , <nl> - nearFarPoints [ 0 ] , nearFarPoints [ 1 ] ) ; <nl> - let shaderMaterial = this . points . material as THREE . ShaderMaterial ; <nl> + this . colorSprites ( rc . colorAccessor ) ; <nl> + this . highlightSprites ( rc . highlightedPoints , rc . highlightStroke ) ; <nl> + <nl> + this . setFogDistances ( <nl> + rc . nearestCameraSpacePointZ , rc . farthestCameraSpacePointZ ) ; <nl> + <nl> + this . points . material = this . renderMaterial ; <nl> + this . renderMaterial . uniforms . isImage . value = ! ! this . image ; <nl> + <nl> let colors = this . geometry . getAttribute ( ' color ' ) as THREE . BufferAttribute ; <nl> colors . array = this . renderColors ; <nl> colors . needsUpdate = true ; <nl> - <nl> - this . setFogDistances ( nearFarPoints [ 0 ] , nearFarPoints [ 1 ] ) ; <nl> - <nl> - shaderMaterial . setValues ( this . materialParams ) ; <nl> } <nl> } <nl> mmm a / tensorflow / tensorboard / components / vz - projector / util . ts <nl> ppp b / tensorflow / tensorboard / components / vz - projector / util . ts <nl> See the License for the specific language governing permissions and <nl> limitations under the License . <nl> = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = * / <nl> <nl> + import { DataSet } from ' . / scatterPlot ' ; <nl> + import { Point2D } from ' . / vector ' ; <nl> + <nl> / * * Shuffles the array in - place in O ( n ) time using Fisher - Yates algorithm . * / <nl> export function shuffle < T > ( array : T [ ] ) : T [ ] { <nl> let m = array . length ; <nl> export function shuffle < T > ( array : T [ ] ) : T [ ] { <nl> return array ; <nl> } <nl> <nl> + / * * Retrieves a projected point from the data set as a THREE . js vector * / <nl> + export function getProjectedPointFromIndex ( <nl> + dataSet : DataSet , i : number ) : THREE . Vector3 { <nl> + return new THREE . Vector3 ( <nl> + dataSet . points [ i ] . projectedPoint [ 0 ] , dataSet . points [ i ] . projectedPoint [ 1 ] , <nl> + dataSet . points [ i ] . projectedPoint [ 2 ] ) ; <nl> + } <nl> + <nl> + / * * Projects a 3d point into screen space * / <nl> + export function vector3DToScreenCoords ( <nl> + cam : THREE . Camera , w : number , h : number , v : THREE . Vector3 ) : Point2D { <nl> + let dpr = window . devicePixelRatio ; <nl> + let pv = new THREE . Vector3 ( ) . copy ( v ) . project ( cam ) ; <nl> + <nl> + / / The screen - space origin is at the middle of the screen , with + y up . <nl> + let coords : Point2D = <nl> + [ ( ( pv . x + 1 ) / 2 * w ) * dpr , - ( ( pv . y - 1 ) / 2 * h ) * dpr ] ; <nl> + return coords ; <nl> + } <nl> + <nl> + / * * <nl> + * Gets the camera - space z coordinates of the nearest and farthest points . <nl> + * Ignores points that are behind the camera . <nl> + * / <nl> + export function getNearFarPoints ( <nl> + dataSet : DataSet , cameraPos : THREE . Vector3 , <nl> + cameraTarget : THREE . Vector3 ) : [ number , number ] { <nl> + let shortestDist : number = Infinity ; <nl> + let furthestDist : number = 0 ; <nl> + let camToTarget = new THREE . Vector3 ( ) . copy ( cameraTarget ) . sub ( cameraPos ) ; <nl> + for ( let i = 0 ; i < dataSet . points . length ; i + + ) { <nl> + let point = getProjectedPointFromIndex ( dataSet , i ) ; <nl> + let camToPoint = new THREE . Vector3 ( ) . copy ( point ) . sub ( cameraPos ) ; <nl> + if ( camToTarget . dot ( camToPoint ) < 0 ) { <nl> + continue ; <nl> + } <nl> + let distToCam = cameraPos . distanceToSquared ( point ) ; <nl> + furthestDist = Math . max ( furthestDist , distToCam ) ; <nl> + shortestDist = Math . min ( shortestDist , distToCam ) ; <nl> + } <nl> + furthestDist = Math . sqrt ( furthestDist ) ; <nl> + shortestDist = Math . sqrt ( shortestDist ) ; <nl> + return [ shortestDist , furthestDist ] ; <nl> + } <nl> + <nl> / * * <nl> * Assert that the condition is satisfied ; if not , log user - specified message <nl> * to the console . <nl> mmm a / tensorflow / tensorboard / components / vz - projector / vz - projector . ts <nl> ppp b / tensorflow / tensorboard / components / vz - projector / vz - projector . ts <nl> limitations under the License . <nl> import { DataPoint , DataSet , DataSource , PCA_SAMPLE_DIM , SAMPLE_SIZE } from ' . / data ' ; <nl> import { DataProvider , getDataProvider } from ' . / data - loader ' ; <nl> import * as knn from ' . / knn ' ; <nl> - import { Mode , Scatter } from ' . / scatter ' ; <nl> - import { ScatterWebGLPointsCanvasLabels } from ' . / scatterWebGLPointsCanvasLabels ' ; <nl> + import { Mode , ScatterPlot } from ' . / scatterPlot ' ; <nl> + import { ScatterPlotWebGL } from ' . / scatterPlotWebGL ' ; <nl> + import { ScatterPlotWebGLVisualizerCanvasLabels } from ' . / scatterPlotWebGLVisualizerCanvasLabels ' ; <nl> + import { ScatterPlotWebGLVisualizerSprites } from ' . / scatterPlotWebGLVisualizerSprites ' ; <nl> import * as vector from ' . / vector ' ; <nl> import { ColorOption , DataPanel } from ' . / vz - projector - data - panel ' ; <nl> / / tslint : disable - next - line : no - unused - variable <nl> import { PolymerElement , PolymerHTMLElement } from ' . / vz - projector - util ' ; <nl> <nl> + <nl> / * * T - SNE perplexity . Roughly how many neighbors each point influences . * / <nl> let perplexity : number = 30 ; <nl> / * * T - SNE learning rate . * / <nl> export class Projector extends ProjectorPolymer { <nl> private hasPcaZ : boolean ; <nl> / / The working subset of the data source ' s original data set . <nl> private currentDataSet : DataSet ; <nl> - private scatter : Scatter ; <nl> + private scatterPlot : ScatterPlot ; <nl> private dim : number ; <nl> private selectedDistance : ( a : number [ ] , b : number [ ] ) = > number ; <nl> private highlightedPoints : { index : number , color : string } [ ] ; <nl> export class Projector extends ProjectorPolymer { <nl> let labelAccessor = ( i : number ) : string = > { <nl> return this . points [ i ] . metadata [ this . labelOption ] as string ; <nl> } ; <nl> - this . scatter . setLabelAccessor ( labelAccessor ) ; <nl> + this . scatterPlot . setLabelAccessor ( labelAccessor ) ; <nl> } <nl> <nl> colorOptionChanged ( ) { <nl> let colorMap = this . colorOption . map ; <nl> if ( colorMap = = null ) { <nl> - this . scatter . setColorAccessor ( null ) ; <nl> + this . scatterPlot . setColorAccessor ( null ) ; <nl> return ; <nl> } ; <nl> let colors = ( i : number ) = > { <nl> return colorMap ( this . points [ i ] . metadata [ this . colorOption . name ] ) ; <nl> } ; <nl> - this . scatter . setColorAccessor ( colors ) ; <nl> + this . scatterPlot . setColorAccessor ( colors ) ; <nl> } <nl> <nl> updateDataSource ( ds : DataSource ) { <nl> this . dataSource = ds ; <nl> - if ( this . scatter = = null | | this . dataSource = = null ) { <nl> + if ( this . scatterPlot = = null | | this . dataSource = = null ) { <nl> / / We are not ready yet . <nl> return ; <nl> } <nl> export class Projector extends ProjectorPolymer { <nl> <nl> private setDataSet ( ds : DataSet ) { <nl> this . currentDataSet = ds ; <nl> - this . scatter . setDataSet ( this . currentDataSet , this . dataSource . spriteImage ) ; <nl> + this . scatterPlot . setDataSet ( <nl> + this . currentDataSet , this . dataSource . spriteImage ) ; <nl> this . updateMenuButtons ( ) ; <nl> this . dim = this . currentDataSet . dim [ 1 ] ; <nl> this . dom . select ( ' span . numDataPoints ' ) . text ( this . currentDataSet . dim [ 0 ] ) ; <nl> export class Projector extends ProjectorPolymer { <nl> / / Make sure tsne stays in the same dimension as PCA . <nl> dimension = this . hasPcaZ ? 3 : 2 ; <nl> tsneToggle . checked = this . hasPcaZ ; <nl> - this . showPCA ( ( ) = > { this . scatter . recreateScene ( ) ; } ) ; <nl> + this . showPCA ( ( ) = > { <nl> + this . scatterPlot . recreateScene ( ) ; <nl> + } ) ; <nl> } ) ; <nl> this . dom . on ( ' pca - x - changed ' , ( ) = > this . showPCA ( ) ) ; <nl> this . dom . on ( ' pca - y - changed ' , ( ) = > this . showPCA ( ) ) ; <nl> export class Projector extends ProjectorPolymer { <nl> / / Make sure PCA stays in the same dimension as tsne . <nl> this . hasPcaZ = tsneToggle . checked ; <nl> dimension = tsneToggle . checked ? 3 : 2 ; <nl> - if ( this . scatter ) { <nl> + if ( this . scatterPlot ) { <nl> this . showTSNE ( ) ; <nl> - this . scatter . recreateScene ( ) ; <nl> + this . scatterPlot . recreateScene ( ) ; <nl> } <nl> } ) ; <nl> <nl> export class Projector extends ProjectorPolymer { <nl> <nl> / / View controls <nl> this . dom . select ( ' . reset - zoom ' ) . on ( ' click ' , ( ) = > { <nl> - this . scatter . resetZoom ( ) ; <nl> + this . scatterPlot . resetZoom ( ) ; <nl> } ) ; <nl> this . dom . select ( ' . zoom - in ' ) . on ( ' click ' , ( ) = > { <nl> - this . scatter . zoomStep ( 2 ) ; <nl> + this . scatterPlot . zoomStep ( 2 ) ; <nl> } ) ; <nl> this . dom . select ( ' . zoom - out ' ) . on ( ' click ' , ( ) = > { <nl> - this . scatter . zoomStep ( 0 . 5 ) ; <nl> + this . scatterPlot . zoomStep ( 0 . 5 ) ; <nl> } ) ; <nl> <nl> / / Toolbar controls <nl> export class Projector extends ProjectorPolymer { <nl> let searchInputChanged = ( value : string ) = > { <nl> if ( value . trim ( ) = = = ' ' ) { <nl> searchBoxInfo . style ( ' color ' , CALLOUT_COLOR ) . text ( ' Enter a regex . ' ) ; <nl> - if ( this . scatter ! = null ) { <nl> + if ( this . scatterPlot ! = null ) { <nl> this . selectedPoints = [ ] ; <nl> this . selectionWasUpdated ( ) ; <nl> } <nl> export class Projector extends ProjectorPolymer { <nl> let neighbors = this . findNeighbors ( indices [ 0 ] ) ; <nl> if ( indices . length = = = 1 ) { <nl> this . clickedPoint = indices [ 0 ] ; <nl> - this . scatter . clickOnPoint ( this . clickedPoint ) ; <nl> + this . scatterPlot . clickOnPoint ( this . clickedPoint ) ; <nl> } <nl> this . selectedPoints = indices ; <nl> this . updateNNList ( neighbors ) ; <nl> export class Projector extends ProjectorPolymer { <nl> let searchButton = this . dom . select ( ' . search ' ) ; <nl> <nl> searchButton . on ( ' click ' , ( ) = > { <nl> - let mode = this . scatter . getMode ( ) ; <nl> - this . scatter . setMode ( mode = = = Mode . SEARCH ? Mode . HOVER : Mode . SEARCH ) ; <nl> - if ( this . scatter . getMode ( ) = = = Mode . HOVER ) { <nl> + let mode = this . scatterPlot . getMode ( ) ; <nl> + this . scatterPlot . setMode ( mode = = = Mode . SEARCH ? Mode . HOVER : Mode . SEARCH ) ; <nl> + if ( this . scatterPlot . getMode ( ) = = = Mode . HOVER ) { <nl> this . selectedPoints = [ ] ; <nl> this . selectionWasUpdated ( ) ; <nl> } else { <nl> export class Projector extends ProjectorPolymer { <nl> let selectModeButton = this . dom . select ( ' . selectMode ' ) ; <nl> <nl> selectModeButton . on ( ' click ' , ( ) = > { <nl> - let mode = this . scatter . getMode ( ) ; <nl> - this . scatter . setMode ( mode = = = Mode . SELECT ? Mode . HOVER : Mode . SELECT ) ; <nl> + let mode = this . scatterPlot . getMode ( ) ; <nl> + this . scatterPlot . setMode ( mode = = = Mode . SELECT ? Mode . HOVER : Mode . SELECT ) ; <nl> this . updateMenuButtons ( ) ; <nl> } ) ; <nl> <nl> export class Projector extends ProjectorPolymer { <nl> let modeIsNight = dayNightModeButton . classed ( ' selected ' ) ; <nl> dayNightModeButton . on ( ' click ' , ( ) = > { <nl> modeIsNight = ! modeIsNight ; <nl> - this . scatter . setDayNightMode ( modeIsNight ) ; <nl> - this . scatter . update ( ) ; <nl> + this . scatterPlot . setDayNightMode ( modeIsNight ) ; <nl> + this . scatterPlot . update ( ) ; <nl> dayNightModeButton . classed ( ' selected ' , modeIsNight ) ; <nl> } ) ; <nl> <nl> / / Resize <nl> - window . addEventListener ( ' resize ' , ( ) = > { this . scatter . resize ( ) ; } ) ; <nl> + window . addEventListener ( ' resize ' , ( ) = > { <nl> + this . scatterPlot . resize ( ) ; <nl> + } ) ; <nl> <nl> / / Canvas <nl> - this . scatter = new ScatterWebGLPointsCanvasLabels ( <nl> - this . dom . select ( ' # scatter ' ) , <nl> - i = > ' ' + this . points [ i ] . metadata [ ' label ' ] ) ; <nl> - this . scatter . onHover ( hoveredIndex = > { <nl> + { <nl> + let container = this . dom . select ( ' # scatter ' ) ; <nl> + let scatterPlotWebGL = new ScatterPlotWebGL ( <nl> + container , i = > ' ' + this . points [ i ] . metadata [ ' label ' ] ) ; <nl> + <nl> + let pointsVisualizer = <nl> + new ScatterPlotWebGLVisualizerSprites ( scatterPlotWebGL ) ; <nl> + <nl> + let labelVisualizer = <nl> + new ScatterPlotWebGLVisualizerCanvasLabels ( container ) ; <nl> + <nl> + scatterPlotWebGL . addVisualizer ( pointsVisualizer ) ; <nl> + scatterPlotWebGL . addVisualizer ( labelVisualizer ) ; <nl> + <nl> + this . scatterPlot = scatterPlotWebGL ; <nl> + this . scatterPlot . setDayNightMode ( modeIsNight ) ; <nl> + } <nl> + <nl> + this . scatterPlot . onHover ( hoveredIndex = > { <nl> if ( hoveredIndex = = null ) { <nl> this . highlightedPoints = [ ] ; <nl> } else { <nl> export class Projector extends ProjectorPolymer { <nl> this . selectionWasUpdated ( ) ; <nl> } ) ; <nl> <nl> - this . scatter . onSelection ( <nl> + this . scatterPlot . onSelection ( <nl> selectedPoints = > this . updateSelection ( selectedPoints ) ) ; <nl> <nl> / / Selection controls <nl> export class Projector extends ProjectorPolymer { <nl> this . setDataSet ( subset ) ; <nl> this . dom . select ( ' . reset - filter ' ) . style ( ' display ' , null ) ; <nl> this . selectedPoints = [ ] ; <nl> - this . scatter . recreateScene ( ) ; <nl> + this . scatterPlot . recreateScene ( ) ; <nl> this . selectionWasUpdated ( ) ; <nl> this . updateIsolateButton ( ) ; <nl> } ) ; <nl> export class Projector extends ProjectorPolymer { <nl> <nl> this . dom . select ( ' . clear - selection ' ) . on ( ' click ' , ( ) = > { <nl> this . selectedPoints = [ ] ; <nl> - this . scatter . setMode ( Mode . HOVER ) ; <nl> - this . scatter . clickOnPoint ( null ) ; <nl> + this . scatterPlot . setMode ( Mode . HOVER ) ; <nl> + this . scatterPlot . clickOnPoint ( null ) ; <nl> this . updateMenuButtons ( ) ; <nl> this . selectionWasUpdated ( ) ; <nl> } ) ; <nl> export class Projector extends ProjectorPolymer { <nl> <nl> private showPCA ( callback ? : ( ) = > void ) { <nl> this . currentDataSet . projectPCA ( ) . then ( ( ) = > { <nl> - this . scatter . showTickLabels ( false ) ; <nl> + this . scatterPlot . showTickLabels ( false ) ; <nl> let x = this . pcaX ; <nl> let y = this . pcaY ; <nl> let z = this . pcaZ ; <nl> let hasZ = dimension = = = 3 ; <nl> - this . scatter . setXAccessor ( i = > this . points [ i ] . projections [ ' pca - ' + x ] ) ; <nl> - this . scatter . setYAccessor ( i = > this . points [ i ] . projections [ ' pca - ' + y ] ) ; <nl> - this . scatter . setZAccessor ( <nl> + this . scatterPlot . setXAccessor ( <nl> + i = > this . points [ i ] . projections [ ' pca - ' + x ] ) ; <nl> + this . scatterPlot . setYAccessor ( <nl> + i = > this . points [ i ] . projections [ ' pca - ' + y ] ) ; <nl> + this . scatterPlot . setZAccessor ( <nl> hasZ ? ( i = > this . points [ i ] . projections [ ' pca - ' + z ] ) : null ) ; <nl> - this . scatter . setAxisLabels ( ' pca - ' + x , ' pca - ' + y ) ; <nl> - this . scatter . update ( ) ; <nl> + this . scatterPlot . setAxisLabels ( ' pca - ' + x , ' pca - ' + y ) ; <nl> + this . scatterPlot . update ( ) ; <nl> if ( callback ) { <nl> callback ( ) ; <nl> } <nl> export class Projector extends ProjectorPolymer { <nl> pane . select ( ' . ink - panel - content [ data - panel = " ' + id + ' " ] ' ) <nl> . classed ( ' active ' , true ) ; <nl> if ( id = = = ' pca ' ) { <nl> - this . showPCA ( ( ) = > this . scatter . recreateScene ( ) ) ; <nl> + this . showPCA ( ( ) = > this . scatterPlot . recreateScene ( ) ) ; <nl> } else if ( id = = = ' tsne ' ) { <nl> this . showTSNE ( ) ; <nl> } else if ( id = = = ' custom ' ) { <nl> export class Projector extends ProjectorPolymer { <nl> } <nl> <nl> private showCustom ( ) { <nl> - this . scatter . showTickLabels ( true ) ; <nl> + this . scatterPlot . showTickLabels ( true ) ; <nl> let xDir = vector . sub ( this . centroids . xRight , this . centroids . xLeft ) ; <nl> this . currentDataSet . projectLinear ( xDir , ' linear - x ' ) ; <nl> - this . scatter . setXAccessor ( i = > this . points [ i ] . projections [ ' linear - x ' ] ) ; <nl> + this . scatterPlot . setXAccessor ( i = > this . points [ i ] . projections [ ' linear - x ' ] ) ; <nl> <nl> let yDir = vector . sub ( this . centroids . yUp , this . centroids . yDown ) ; <nl> this . currentDataSet . projectLinear ( yDir , ' linear - y ' ) ; <nl> - this . scatter . setYAccessor ( i = > this . points [ i ] . projections [ ' linear - y ' ] ) ; <nl> + this . scatterPlot . setYAccessor ( i = > this . points [ i ] . projections [ ' linear - y ' ] ) ; <nl> <nl> / / Scatter is only in 2D in projection mode . <nl> - this . scatter . setZAccessor ( null ) ; <nl> + this . scatterPlot . setZAccessor ( null ) ; <nl> <nl> let xLabel = this . centroidValues . xLeft + ' → ' + this . centroidValues . xRight ; <nl> let yLabel = this . centroidValues . yUp + ' → ' + this . centroidValues . yDown ; <nl> - this . scatter . setAxisLabels ( xLabel , yLabel ) ; <nl> - this . scatter . update ( ) ; <nl> - this . scatter . recreateScene ( ) ; <nl> + this . scatterPlot . setAxisLabels ( xLabel , yLabel ) ; <nl> + this . scatterPlot . update ( ) ; <nl> + this . scatterPlot . recreateScene ( ) ; <nl> } <nl> <nl> private get points ( ) { return this . currentDataSet . points ; } <nl> <nl> private showTSNE ( ) { <nl> - this . scatter . showTickLabels ( false ) ; <nl> - this . scatter . setXAccessor ( i = > this . points [ i ] . projections [ ' tsne - 0 ' ] ) ; <nl> - this . scatter . setYAccessor ( i = > this . points [ i ] . projections [ ' tsne - 1 ' ] ) ; <nl> - this . scatter . setZAccessor ( <nl> + this . scatterPlot . showTickLabels ( false ) ; <nl> + this . scatterPlot . setXAccessor ( i = > this . points [ i ] . projections [ ' tsne - 0 ' ] ) ; <nl> + this . scatterPlot . setYAccessor ( i = > this . points [ i ] . projections [ ' tsne - 1 ' ] ) ; <nl> + this . scatterPlot . setZAccessor ( <nl> dimension = = = 3 ? ( i = > this . points [ i ] . projections [ ' tsne - 2 ' ] ) : null ) ; <nl> - this . scatter . setAxisLabels ( ' tsne - 0 ' , ' tsne - 1 ' ) ; <nl> + this . scatterPlot . setAxisLabels ( ' tsne - 0 ' , ' tsne - 1 ' ) ; <nl> if ( ! this . currentDataSet . hasTSNERun ) { <nl> this . runTSNE ( ) ; <nl> } else { <nl> - this . scatter . update ( ) ; <nl> + this . scatterPlot . update ( ) ; <nl> } <nl> } <nl> <nl> export class Projector extends ProjectorPolymer { <nl> perplexity , learningRate , dimension , ( iteration : number ) = > { <nl> if ( iteration ! = null ) { <nl> this . dom . select ( ' . run - tsne - iter ' ) . text ( iteration ) ; <nl> - this . scatter . update ( ) ; <nl> + this . scatterPlot . update ( ) ; <nl> } <nl> } ) ; <nl> } <nl> export class Projector extends ProjectorPolymer { <nl> let favor = ( i : number ) = > { <nl> return i = = = 0 | | ( i < this . highlightedPoints . length ? false : true ) ; <nl> } ; <nl> - this . scatter . highlightPoints ( allPoints , stroke , favor ) ; <nl> + this . scatterPlot . highlightPoints ( allPoints , stroke , favor ) ; <nl> this . updateIsolateButton ( ) ; <nl> } <nl> <nl> private updateMenuButtons ( ) { <nl> let searchBox = this . dom . select ( ' . control . search - box ' ) ; <nl> this . dom . select ( ' . search ' ) . classed ( <nl> - ' selected ' , this . scatter . getMode ( ) = = = Mode . SEARCH ) ; <nl> - let searchMode = this . scatter . getMode ( ) = = = Mode . SEARCH ; <nl> + ' selected ' , this . scatterPlot . getMode ( ) = = = Mode . SEARCH ) ; <nl> + let searchMode = this . scatterPlot . getMode ( ) = = = Mode . SEARCH ; <nl> this . dom . select ( ' . control . search - box ' ) <nl> . style ( ' width ' , searchMode ? ' 110px ' : null ) <nl> . style ( ' margin - right ' , searchMode ? ' 10px ' : null ) ; <nl> ( searchBox . select ( ' input ' ) . node ( ) as HTMLInputElement ) . focus ( ) ; <nl> this . dom . select ( ' . selectMode ' ) <nl> - . classed ( ' selected ' , this . scatter . getMode ( ) = = = Mode . SELECT ) ; <nl> + . classed ( ' selected ' , this . scatterPlot . getMode ( ) = = = Mode . SELECT ) ; <nl> } <nl> <nl> / * * <nl> new file mode 100644 <nl> index 0000000000000 . . f25208c41672d <nl> mmm / dev / null <nl> ppp b / tensorflow / third_party / hadoop / BUILD <nl> <nl> + package ( default_visibility = [ " / / visibility : public " ] ) <nl> + <nl> + licenses ( [ " notice " ] ) # Apache 2 . 0 <nl> + <nl> + filegroup ( <nl> + name = " all_files " , <nl> + srcs = glob ( <nl> + [ " * * / * " ] , <nl> + exclude = [ <nl> + " * * / METADATA " , <nl> + " * * / OWNERS " , <nl> + ] , <nl> + ) , <nl> + visibility = [ " / / tensorflow : __subpackages__ " ] , <nl> + ) <nl> + <nl> + cc_library ( <nl> + name = " hdfs " , <nl> + hdrs = [ " hdfs . h " ] , <nl> + ) <nl> new file mode 100644 <nl> index 0000000000000 . . 560d8bba0e0e7 <nl> mmm / dev / null <nl> ppp b / tensorflow / third_party / hadoop / hdfs . h <nl> <nl> + / * * <nl> + * Licensed to the Apache Software Foundation ( ASF ) under one <nl> + * or more contributor license agreements . See the NOTICE file <nl> + * distributed with this work for additional information <nl> + * regarding copyright ownership . The ASF licenses this file <nl> + * to you under the Apache License , Version 2 . 0 ( the <nl> + * " License " ) ; you may not use this file except in compliance <nl> + * with the License . You may obtain a copy of the License at <nl> + * <nl> + * http : / / www . apache . org / licenses / LICENSE - 2 . 0 <nl> + * <nl> + * Unless required by applicable law or agreed to in writing , 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 LIBHDFS_HDFS_H <nl> + # define LIBHDFS_HDFS_H <nl> + <nl> + # include < errno . h > / * for EINTERNAL , etc . * / <nl> + # include < fcntl . h > / * for O_RDONLY , O_WRONLY * / <nl> + # include < stdint . h > / * for uint64_t , etc . * / <nl> + # include < time . h > / * for time_t * / <nl> + <nl> + / * <nl> + * Support export of DLL symbols during libhdfs build , and import of DLL symbols <nl> + * during client application build . A client application may optionally define <nl> + * symbol LIBHDFS_DLL_IMPORT in its build . This is not strictly required , but <nl> + * the compiler can produce more efficient code with it . <nl> + * / <nl> + # ifdef WIN32 <nl> + # ifdef LIBHDFS_DLL_EXPORT <nl> + # define LIBHDFS_EXTERNAL __declspec ( dllexport ) <nl> + # elif LIBHDFS_DLL_IMPORT <nl> + # define LIBHDFS_EXTERNAL __declspec ( dllimport ) <nl> + # else <nl> + # define LIBHDFS_EXTERNAL <nl> + # endif <nl> + # else <nl> + # ifdef LIBHDFS_DLL_EXPORT <nl> + # define LIBHDFS_EXTERNAL __attribute__ ( ( visibility ( " default " ) ) ) <nl> + # elif LIBHDFS_DLL_IMPORT <nl> + # define LIBHDFS_EXTERNAL __attribute__ ( ( visibility ( " default " ) ) ) <nl> + # else <nl> + # define LIBHDFS_EXTERNAL <nl> + # endif <nl> + # endif <nl> + <nl> + # ifndef O_RDONLY <nl> + # define O_RDONLY 1 <nl> + # endif <nl> + <nl> + # ifndef O_WRONLY <nl> + # define O_WRONLY 2 <nl> + # endif <nl> + <nl> + # ifndef EINTERNAL <nl> + # define EINTERNAL 255 <nl> + # endif <nl> + <nl> + # define ELASTIC_BYTE_BUFFER_POOL_CLASS \ <nl> + " org / apache / hadoop / io / ElasticByteBufferPool " <nl> + <nl> + / * * All APIs set errno to meaningful values * / <nl> + <nl> + # ifdef __cplusplus <nl> + extern " C " { <nl> + # endif <nl> + / * * <nl> + * Some utility decls used in libhdfs . <nl> + * / <nl> + struct hdfsBuilder ; <nl> + typedef int32_t tSize ; / / / size of data for read / write io ops <nl> + typedef time_t tTime ; / / / time type in seconds <nl> + typedef int64_t tOffset ; / / / offset within the file <nl> + typedef uint16_t tPort ; / / / port <nl> + typedef enum tObjectKind { <nl> + kObjectKindFile = ' F ' , <nl> + kObjectKindDirectory = ' D ' , <nl> + } tObjectKind ; <nl> + <nl> + / * * <nl> + * The C reflection of org . apache . org . hadoop . FileSystem . <nl> + * / <nl> + struct hdfs_internal ; <nl> + typedef struct hdfs_internal * hdfsFS ; <nl> + <nl> + struct hdfsFile_internal ; <nl> + typedef struct hdfsFile_internal * hdfsFile ; <nl> + <nl> + struct hadoopRzOptions ; <nl> + <nl> + struct hadoopRzBuffer ; <nl> + <nl> + / * * <nl> + * Determine if a file is open for read . <nl> + * <nl> + * @ param file The HDFS file <nl> + * @ return 1 if the file is open for read ; 0 otherwise <nl> + * / <nl> + LIBHDFS_EXTERNAL <nl> + int hdfsFileIsOpenForRead ( hdfsFile file ) ; <nl> + <nl> + / * * <nl> + * Determine if a file is open for write . <nl> + * <nl> + * @ param file The HDFS file <nl> + * @ return 1 if the file is open for write ; 0 otherwise <nl> + * / <nl> + LIBHDFS_EXTERNAL <nl> + int hdfsFileIsOpenForWrite ( hdfsFile file ) ; <nl> + <nl> + struct hdfsReadStatistics { <nl> + uint64_t totalBytesRead ; <nl> + uint64_t totalLocalBytesRead ; <nl> + uint64_t totalShortCircuitBytesRead ; <nl> + uint64_t totalZeroCopyBytesRead ; <nl> + } ; <nl> + <nl> + / * * <nl> + * Get read statistics about a file . This is only applicable to files <nl> + * opened for reading . <nl> + * <nl> + * @ param file The HDFS file <nl> + * @ param stats ( out parameter ) on a successful return , the read <nl> + * statistics . Unchanged otherwise . You must free the <nl> + * returned statistics with hdfsFileFreeReadStatistics . <nl> + * @ return 0 if the statistics were successfully returned , <nl> + * - 1 otherwise . On a failure , please check errno against <nl> + * ENOTSUP . webhdfs , LocalFilesystem , and so forth may <nl> + * not support read statistics . <nl> + * / <nl> + LIBHDFS_EXTERNAL <nl> + int hdfsFileGetReadStatistics ( hdfsFile file , struct hdfsReadStatistics * * stats ) ; <nl> + <nl> + / * * <nl> + * @ param stats HDFS read statistics for a file . <nl> + * <nl> + * @ return the number of remote bytes read . <nl> + * / <nl> + LIBHDFS_EXTERNAL <nl> + int64_t hdfsReadStatisticsGetRemoteBytesRead ( <nl> + const struct hdfsReadStatistics * stats ) ; <nl> + <nl> + / * * <nl> + * Clear the read statistics for a file . <nl> + * <nl> + * @ param file The file to clear the read statistics of . <nl> + * <nl> + * @ return 0 on success ; the error code otherwise . <nl> + * EINVAL : the file is not open for reading . <nl> + * ENOTSUP : the file does not support clearing the read <nl> + * statistics . <nl> + * Errno will also be set to this code on failure . <nl> + * / <nl> + LIBHDFS_EXTERNAL <nl> + int hdfsFileClearReadStatistics ( hdfsFile file ) ; <nl> + <nl> + / * * <nl> + * Free some HDFS read statistics . <nl> + * <nl> + * @ param stats The HDFS read statistics to free . <nl> + * / <nl> + LIBHDFS_EXTERNAL <nl> + void hdfsFileFreeReadStatistics ( struct hdfsReadStatistics * stats ) ; <nl> + <nl> + / * * <nl> + * hdfsConnectAsUser - Connect to a hdfs file system as a specific user <nl> + * Connect to the hdfs . <nl> + * @ param nn The NameNode . See hdfsBuilderSetNameNode for details . <nl> + * @ param port The port on which the server is listening . <nl> + * @ param user the user name ( this is hadoop domain user ) . Or NULL is equivelant <nl> + * to hhdfsConnect ( host , port ) <nl> + * @ return Returns a handle to the filesystem or NULL on error . <nl> + * @ deprecated Use hdfsBuilderConnect instead . <nl> + * / <nl> + LIBHDFS_EXTERNAL <nl> + hdfsFS hdfsConnectAsUser ( const char * nn , tPort port , const char * user ) ; <nl> + <nl> + / * * <nl> + * hdfsConnect - Connect to a hdfs file system . <nl> + * Connect to the hdfs . <nl> + * @ param nn The NameNode . See hdfsBuilderSetNameNode for details . <nl> + * @ param port The port on which the server is listening . <nl> + * @ return Returns a handle to the filesystem or NULL on error . <nl> + * @ deprecated Use hdfsBuilderConnect instead . <nl> + * / <nl> + LIBHDFS_EXTERNAL <nl> + hdfsFS hdfsConnect ( const char * nn , tPort port ) ; <nl> + <nl> + / * * <nl> + * hdfsConnect - Connect to an hdfs file system . <nl> + * <nl> + * Forces a new instance to be created <nl> + * <nl> + * @ param nn The NameNode . See hdfsBuilderSetNameNode for details . <nl> + * @ param port The port on which the server is listening . <nl> + * @ param user The user name to use when connecting <nl> + * @ return Returns a handle to the filesystem or NULL on error . <nl> + * @ deprecated Use hdfsBuilderConnect instead . <nl> + * / <nl> + LIBHDFS_EXTERNAL <nl> + hdfsFS hdfsConnectAsUserNewInstance ( const char * nn , tPort port , <nl> + const char * user ) ; <nl> + <nl> + / * * <nl> + * hdfsConnect - Connect to an hdfs file system . <nl> + * <nl> + * Forces a new instance to be created <nl> + * <nl> + * @ param nn The NameNode . See hdfsBuilderSetNameNode for details . <nl> + * @ param port The port on which the server is listening . <nl> + * @ return Returns a handle to the filesystem or NULL on error . <nl> + * @ deprecated Use hdfsBuilderConnect instead . <nl> + * / <nl> + LIBHDFS_EXTERNAL <nl> + hdfsFS hdfsConnectNewInstance ( const char * nn , tPort port ) ; <nl> + <nl> + / * * <nl> + * Connect to HDFS using the parameters defined by the builder . <nl> + * <nl> + * The HDFS builder will be freed , whether or not the connection was <nl> + * successful . <nl> + * <nl> + * Every successful call to hdfsBuilderConnect should be matched with a call <nl> + * to hdfsDisconnect , when the hdfsFS is no longer needed . <nl> + * <nl> + * @ param bld The HDFS builder <nl> + * @ return Returns a handle to the filesystem , or NULL on error . <nl> + * / <nl> + LIBHDFS_EXTERNAL <nl> + hdfsFS hdfsBuilderConnect ( struct hdfsBuilder * bld ) ; <nl> + <nl> + / * * <nl> + * Create an HDFS builder . <nl> + * <nl> + * @ return The HDFS builder , or NULL on error . <nl> + * / <nl> + LIBHDFS_EXTERNAL <nl> + struct hdfsBuilder * hdfsNewBuilder ( void ) ; <nl> + <nl> + / * * <nl> + * Force the builder to always create a new instance of the FileSystem , <nl> + * rather than possibly finding one in the cache . <nl> + * <nl> + * @ param bld The HDFS builder <nl> + * / <nl> + LIBHDFS_EXTERNAL <nl> + void hdfsBuilderSetForceNewInstance ( struct hdfsBuilder * bld ) ; <nl> + <nl> + / * * <nl> + * Set the HDFS NameNode to connect to . <nl> + * <nl> + * @ param bld The HDFS builder <nl> + * @ param nn The NameNode to use . <nl> + * <nl> + * If the string given is ' default ' , the default NameNode <nl> + * configuration will be used ( from the XML configuration files ) <nl> + * <nl> + * If NULL is given , a LocalFileSystem will be created . <nl> + * <nl> + * If the string starts with a protocol type such as file : / / or <nl> + * hdfs : / / , this protocol type will be used . If not , the <nl> + * hdfs : / / protocol type will be used . <nl> + * <nl> + * You may specify a NameNode port in the usual way by <nl> + * passing a string of the format hdfs : / / < hostname > : < port > . <nl> + * Alternately , you may set the port with <nl> + * hdfsBuilderSetNameNodePort . However , you must not pass the <nl> + * port in two different ways . <nl> + * / <nl> + LIBHDFS_EXTERNAL <nl> + void hdfsBuilderSetNameNode ( struct hdfsBuilder * bld , const char * nn ) ; <nl> + <nl> + / * * <nl> + * Set the port of the HDFS NameNode to connect to . <nl> + * <nl> + * @ param bld The HDFS builder <nl> + * @ param port The port . <nl> + * / <nl> + LIBHDFS_EXTERNAL <nl> + void hdfsBuilderSetNameNodePort ( struct hdfsBuilder * bld , tPort port ) ; <nl> + <nl> + / * * <nl> + * Set the username to use when connecting to the HDFS cluster . <nl> + * <nl> + * @ param bld The HDFS builder <nl> + * @ param userName The user name . The string will be shallow - copied . <nl> + * / <nl> + LIBHDFS_EXTERNAL <nl> + void hdfsBuilderSetUserName ( struct hdfsBuilder * bld , const char * userName ) ; <nl> + <nl> + / * * <nl> + * Set the path to the Kerberos ticket cache to use when connecting to <nl> + * the HDFS cluster . <nl> + * <nl> + * @ param bld The HDFS builder <nl> + * @ param kerbTicketCachePath The Kerberos ticket cache path . The string <nl> + * will be shallow - copied . <nl> + * / <nl> + LIBHDFS_EXTERNAL <nl> + void hdfsBuilderSetKerbTicketCachePath ( struct hdfsBuilder * bld , <nl> + const char * kerbTicketCachePath ) ; <nl> + <nl> + / * * <nl> + * Free an HDFS builder . <nl> + * <nl> + * It is normally not necessary to call this function since <nl> + * hdfsBuilderConnect frees the builder . <nl> + * <nl> + * @ param bld The HDFS builder <nl> + * / <nl> + LIBHDFS_EXTERNAL <nl> + void hdfsFreeBuilder ( struct hdfsBuilder * bld ) ; <nl> + <nl> + / * * <nl> + * Set a configuration string for an HdfsBuilder . <nl> + * <nl> + * @ param key The key to set . <nl> + * @ param val The value , or NULL to set no value . <nl> + * This will be shallow - copied . You are responsible for <nl> + * ensuring that it remains valid until the builder is <nl> + * freed . <nl> + * <nl> + * @ return 0 on success ; nonzero error code otherwise . <nl> + * / <nl> + LIBHDFS_EXTERNAL <nl> + int hdfsBuilderConfSetStr ( struct hdfsBuilder * bld , const char * key , <nl> + const char * val ) ; <nl> + <nl> + / * * <nl> + * Get a configuration string . <nl> + * <nl> + * @ param key The key to find <nl> + * @ param val ( out param ) The value . This will be set to NULL if the <nl> + * key isn ' t found . You must free this string with <nl> + * hdfsConfStrFree . <nl> + * <nl> + * @ return 0 on success ; nonzero error code otherwise . <nl> + * Failure to find the key is not an error . <nl> + * / <nl> + LIBHDFS_EXTERNAL <nl> + int hdfsConfGetStr ( const char * key , char * * val ) ; <nl> + <nl> + / * * <nl> + * Get a configuration integer . <nl> + * <nl> + * @ param key The key to find <nl> + * @ param val ( out param ) The value . This will NOT be changed if the <nl> + * key isn ' t found . <nl> + * <nl> + * @ return 0 on success ; nonzero error code otherwise . <nl> + * Failure to find the key is not an error . <nl> + * / <nl> + LIBHDFS_EXTERNAL <nl> + int hdfsConfGetInt ( const char * key , int32_t * val ) ; <nl> + <nl> + / * * <nl> + * Free a configuration string found with hdfsConfGetStr . <nl> + * <nl> + * @ param val A configuration string obtained from hdfsConfGetStr <nl> + * / <nl> + LIBHDFS_EXTERNAL <nl> + void hdfsConfStrFree ( char * val ) ; <nl> + <nl> + / * * <nl> + * hdfsDisconnect - Disconnect from the hdfs file system . <nl> + * Disconnect from hdfs . <nl> + * @ param fs The configured filesystem handle . <nl> + * @ return Returns 0 on success , - 1 on error . <nl> + * Even if there is an error , the resources associated with the <nl> + * hdfsFS will be freed . <nl> + * / <nl> + LIBHDFS_EXTERNAL <nl> + int hdfsDisconnect ( hdfsFS fs ) ; <nl> + <nl> + / * * <nl> + * hdfsOpenFile - Open a hdfs file in given mode . <nl> + * @ param fs The configured filesystem handle . <nl> + * @ param path The full path to the file . <nl> + * @ param flags - an | of bits / fcntl . h file flags - supported flags are <nl> + * O_RDONLY , O_WRONLY ( meaning create or overwrite i . e . , implies O_TRUNCAT ) , <nl> + * O_WRONLY | O_APPEND . Other flags are generally ignored other than ( O_RDWR | | <nl> + * ( O_EXCL & O_CREAT ) ) which return NULL and set errno equal ENOTSUP . <nl> + * @ param bufferSize Size of buffer for read / write - pass 0 if you want <nl> + * to use the default configured values . <nl> + * @ param replication Block replication - pass 0 if you want to use <nl> + * the default configured values . <nl> + * @ param blocksize Size of block - pass 0 if you want to use the <nl> + * default configured values . <nl> + * @ return Returns the handle to the open file or NULL on error . <nl> + * / <nl> + LIBHDFS_EXTERNAL <nl> + hdfsFile hdfsOpenFile ( hdfsFS fs , const char * path , int flags , int bufferSize , <nl> + short replication , tSize blocksize ) ; <nl> + <nl> + / * * <nl> + * hdfsTruncateFile - Truncate a hdfs file to given lenght . <nl> + * @ param fs The configured filesystem handle . <nl> + * @ param path The full path to the file . <nl> + * @ param newlength The size the file is to be truncated to <nl> + * @ return 1 if the file has been truncated to the desired newlength <nl> + * and is immediately available to be reused for write operations <nl> + * such as append . <nl> + * 0 if a background process of adjusting the length of the last <nl> + * block has been started , and clients should wait for it to <nl> + * complete before proceeding with further file updates . <nl> + * - 1 on error . <nl> + * / <nl> + int hdfsTruncateFile ( hdfsFS fs , const char * path , tOffset newlength ) ; <nl> + <nl> + / * * <nl> + * hdfsUnbufferFile - Reduce the buffering done on a file . <nl> + * <nl> + * @ param file The file to unbuffer . <nl> + * @ return 0 on success <nl> + * ENOTSUP if the file does not support unbuffering <nl> + * Errno will also be set to this value . <nl> + * / <nl> + LIBHDFS_EXTERNAL <nl> + int hdfsUnbufferFile ( hdfsFile file ) ; <nl> + <nl> + / * * <nl> + * hdfsCloseFile - Close an open file . <nl> + * @ param fs The configured filesystem handle . <nl> + * @ param file The file handle . <nl> + * @ return Returns 0 on success , - 1 on error . <nl> + * On error , errno will be set appropriately . <nl> + * If the hdfs file was valid , the memory associated with it will <nl> + * be freed at the end of this call , even if there was an I / O <nl> + * error . <nl> + * / <nl> + LIBHDFS_EXTERNAL <nl> + int hdfsCloseFile ( hdfsFS fs , hdfsFile file ) ; <nl> + <nl> + / * * <nl> + * hdfsExists - Checks if a given path exsits on the filesystem <nl> + * @ param fs The configured filesystem handle . <nl> + * @ param path The path to look for <nl> + * @ return Returns 0 on success , - 1 on error . <nl> + * / <nl> + LIBHDFS_EXTERNAL <nl> + int hdfsExists ( hdfsFS fs , const char * path ) ; <nl> + <nl> + / * * <nl> + * hdfsSeek - Seek to given offset in file . <nl> + * This works only for files opened in read - only mode . <nl> + * @ param fs The configured filesystem handle . <nl> + * @ param file The file handle . <nl> + * @ param desiredPos Offset into the file to seek into . <nl> + * @ return Returns 0 on success , - 1 on error . <nl> + * / <nl> + LIBHDFS_EXTERNAL <nl> + int hdfsSeek ( hdfsFS fs , hdfsFile file , tOffset desiredPos ) ; <nl> + <nl> + / * * <nl> + * hdfsTell - Get the current offset in the file , in bytes . <nl> + * @ param fs The configured filesystem handle . <nl> + * @ param file The file handle . <nl> + * @ return Current offset , - 1 on error . <nl> + * / <nl> + LIBHDFS_EXTERNAL <nl> + tOffset hdfsTell ( hdfsFS fs , hdfsFile file ) ; <nl> + <nl> + / * * <nl> + * hdfsRead - Read data from an open file . <nl> + * @ param fs The configured filesystem handle . <nl> + * @ param file The file handle . <nl> + * @ param buffer The buffer to copy read bytes into . <nl> + * @ param length The length of the buffer . <nl> + * @ return On success , a positive number indicating how many bytes <nl> + * were read . <nl> + * On end - of - file , 0 . <nl> + * On error , - 1 . Errno will be set to the error code . <nl> + * Just like the POSIX read function , hdfsRead will return - 1 <nl> + * and set errno to EINTR if data is temporarily unavailable , <nl> + * but we are not yet at the end of the file . <nl> + * / <nl> + LIBHDFS_EXTERNAL <nl> + tSize hdfsRead ( hdfsFS fs , hdfsFile file , void * buffer , tSize length ) ; <nl> + <nl> + / * * <nl> + * hdfsPread - Positional read of data from an open file . <nl> + * @ param fs The configured filesystem handle . <nl> + * @ param file The file handle . <nl> + * @ param position Position from which to read <nl> + * @ param buffer The buffer to copy read bytes into . <nl> + * @ param length The length of the buffer . <nl> + * @ return See hdfsRead <nl> + * / <nl> + LIBHDFS_EXTERNAL <nl> + tSize hdfsPread ( hdfsFS fs , hdfsFile file , tOffset position , void * buffer , <nl> + tSize length ) ; <nl> + <nl> + / * * <nl> + * hdfsWrite - Write data into an open file . <nl> + * @ param fs The configured filesystem handle . <nl> + * @ param file The file handle . <nl> + * @ param buffer The data . <nl> + * @ param length The no . of bytes to write . <nl> + * @ return Returns the number of bytes written , - 1 on error . <nl> + * / <nl> + LIBHDFS_EXTERNAL <nl> + tSize hdfsWrite ( hdfsFS fs , hdfsFile file , const void * buffer , tSize length ) ; <nl> + <nl> + / * * <nl> + * hdfsWrite - Flush the data . <nl> + * @ param fs The configured filesystem handle . <nl> + * @ param file The file handle . <nl> + * @ return Returns 0 on success , - 1 on error . <nl> + * / <nl> + LIBHDFS_EXTERNAL <nl> + int hdfsFlush ( hdfsFS fs , hdfsFile file ) ; <nl> + <nl> + / * * <nl> + * hdfsHFlush - Flush out the data in client ' s user buffer . After the <nl> + * return of this call , new readers will see the data . <nl> + * @ param fs configured filesystem handle <nl> + * @ param file file handle <nl> + * @ return 0 on success , - 1 on error and sets errno <nl> + * / <nl> + LIBHDFS_EXTERNAL <nl> + int hdfsHFlush ( hdfsFS fs , hdfsFile file ) ; <nl> + <nl> + / * * <nl> + * hdfsHSync - Similar to posix fsync , Flush out the data in client ' s <nl> + * user buffer . all the way to the disk device ( but the disk may have <nl> + * it in its cache ) . <nl> + * @ param fs configured filesystem handle <nl> + * @ param file file handle <nl> + * @ return 0 on success , - 1 on error and sets errno <nl> + * / <nl> + LIBHDFS_EXTERNAL <nl> + int hdfsHSync ( hdfsFS fs , hdfsFile file ) ; <nl> + <nl> + / * * <nl> + * hdfsAvailable - Number of bytes that can be read from this <nl> + * input stream without blocking . <nl> + * @ param fs The configured filesystem handle . <nl> + * @ param file The file handle . <nl> + * @ return Returns available bytes ; - 1 on error . <nl> + * / <nl> + LIBHDFS_EXTERNAL <nl> + int hdfsAvailable ( hdfsFS fs , hdfsFile file ) ; <nl> + <nl> + / * * <nl> + * hdfsCopy - Copy file from one filesystem to another . <nl> + * @ param srcFS The handle to source filesystem . <nl> + * @ param src The path of source file . <nl> + * @ param dstFS The handle to destination filesystem . <nl> + * @ param dst The path of destination file . <nl> + * @ return Returns 0 on success , - 1 on error . <nl> + * / <nl> + LIBHDFS_EXTERNAL <nl> + int hdfsCopy ( hdfsFS srcFS , const char * src , hdfsFS dstFS , const char * dst ) ; <nl> + <nl> + / * * <nl> + * hdfsMove - Move file from one filesystem to another . <nl> + * @ param srcFS The handle to source filesystem . <nl> + * @ param src The path of source file . <nl> + * @ param dstFS The handle to destination filesystem . <nl> + * @ param dst The path of destination file . <nl> + * @ return Returns 0 on success , - 1 on error . <nl> + * / <nl> + LIBHDFS_EXTERNAL <nl> + int hdfsMove ( hdfsFS srcFS , const char * src , hdfsFS dstFS , const char * dst ) ; <nl> + <nl> + / * * <nl> + * hdfsDelete - Delete file . <nl> + * @ param fs The configured filesystem handle . <nl> + * @ param path The path of the file . <nl> + * @ param recursive if path is a directory and set to <nl> + * non - zero , the directory is deleted else throws an exception . In <nl> + * case of a file the recursive argument is irrelevant . <nl> + * @ return Returns 0 on success , - 1 on error . <nl> + * / <nl> + LIBHDFS_EXTERNAL <nl> + int hdfsDelete ( hdfsFS fs , const char * path , int recursive ) ; <nl> + <nl> + / * * <nl> + * hdfsRename - Rename file . <nl> + * @ param fs The configured filesystem handle . <nl> + * @ param oldPath The path of the source file . <nl> + * @ param newPath The path of the destination file . <nl> + * @ return Returns 0 on success , - 1 on error . <nl> + * / <nl> + LIBHDFS_EXTERNAL <nl> + int hdfsRename ( hdfsFS fs , const char * oldPath , const char * newPath ) ; <nl> + <nl> + / * * <nl> + * hdfsGetWorkingDirectory - Get the current working directory for <nl> + * the given filesystem . <nl> + * @ param fs The configured filesystem handle . <nl> + * @ param buffer The user - buffer to copy path of cwd into . <nl> + * @ param bufferSize The length of user - buffer . <nl> + * @ return Returns buffer , NULL on error . <nl> + * / <nl> + LIBHDFS_EXTERNAL <nl> + char * hdfsGetWorkingDirectory ( hdfsFS fs , char * buffer , size_t bufferSize ) ; <nl> + <nl> + / * * <nl> + * hdfsSetWorkingDirectory - Set the working directory . All relative <nl> + * paths will be resolved relative to it . <nl> + * @ param fs The configured filesystem handle . <nl> + * @ param path The path of the new ' cwd ' . <nl> + * @ return Returns 0 on success , - 1 on error . <nl> + * / <nl> + LIBHDFS_EXTERNAL <nl> + int hdfsSetWorkingDirectory ( hdfsFS fs , const char * path ) ; <nl> + <nl> + / * * <nl> + * hdfsCreateDirectory - Make the given file and all non - existent <nl> + * parents into directories . <nl> + * @ param fs The configured filesystem handle . <nl> + * @ param path The path of the directory . <nl> + * @ return Returns 0 on success , - 1 on error . <nl> + * / <nl> + LIBHDFS_EXTERNAL <nl> + int hdfsCreateDirectory ( hdfsFS fs , const char * path ) ; <nl> + <nl> + / * * <nl> + * hdfsSetReplication - Set the replication of the specified <nl> + * file to the supplied value <nl> + * @ param fs The configured filesystem handle . <nl> + * @ param path The path of the file . <nl> + * @ return Returns 0 on success , - 1 on error . <nl> + * / <nl> + LIBHDFS_EXTERNAL <nl> + int hdfsSetReplication ( hdfsFS fs , const char * path , int16_t replication ) ; <nl> + <nl> + / * * <nl> + * hdfsFileInfo - Information about a file / directory . <nl> + * / <nl> + typedef struct { <nl> + tObjectKind mKind ; / * file or directory * / <nl> + char * mName ; / * the name of the file * / <nl> + tTime mLastMod ; / * the last modification time for the file in seconds * / <nl> + tOffset mSize ; / * the size of the file in bytes * / <nl> + short mReplication ; / * the count of replicas * / <nl> + tOffset mBlockSize ; / * the block size for the file * / <nl> + char * mOwner ; / * the owner of the file * / <nl> + char * mGroup ; / * the group associated with the file * / <nl> + short mPermissions ; / * the permissions associated with the file * / <nl> + tTime mLastAccess ; / * the last access time for the file in seconds * / <nl> + } hdfsFileInfo ; <nl> + <nl> + / * * <nl> + * hdfsListDirectory - Get list of files / directories for a given <nl> + * directory - path . hdfsFreeFileInfo should be called to deallocate memory . <nl> + * @ param fs The configured filesystem handle . <nl> + * @ param path The path of the directory . <nl> + * @ param numEntries Set to the number of files / directories in path . <nl> + * @ return Returns a dynamically - allocated array of hdfsFileInfo <nl> + * objects ; NULL on error . <nl> + * / <nl> + LIBHDFS_EXTERNAL <nl> + hdfsFileInfo * hdfsListDirectory ( hdfsFS fs , const char * path , int * numEntries ) ; <nl> + <nl> + / * * <nl> + * hdfsGetPathInfo - Get information about a path as a ( dynamically <nl> + * allocated ) single hdfsFileInfo struct . hdfsFreeFileInfo should be <nl> + * called when the pointer is no longer needed . <nl> + * @ param fs The configured filesystem handle . <nl> + * @ param path The path of the file . <nl> + * @ return Returns a dynamically - allocated hdfsFileInfo object ; <nl> + * NULL on error . <nl> + * / <nl> + LIBHDFS_EXTERNAL <nl> + hdfsFileInfo * hdfsGetPathInfo ( hdfsFS fs , const char * path ) ; <nl> + <nl> + / * * <nl> + * hdfsFreeFileInfo - Free up the hdfsFileInfo array ( including fields ) <nl> + * @ param hdfsFileInfo The array of dynamically - allocated hdfsFileInfo <nl> + * objects . <nl> + * @ param numEntries The size of the array . <nl> + * / <nl> + LIBHDFS_EXTERNAL <nl> + void hdfsFreeFileInfo ( hdfsFileInfo * hdfsFileInfo , int numEntries ) ; <nl> + <nl> + / * * <nl> + * hdfsFileIsEncrypted : determine if a file is encrypted based on its <nl> + * hdfsFileInfo . <nl> + * @ return - 1 if there was an error ( errno will be set ) , 0 if the file is <nl> + * not encrypted , 1 if the file is encrypted . <nl> + * / <nl> + LIBHDFS_EXTERNAL <nl> + int hdfsFileIsEncrypted ( hdfsFileInfo * hdfsFileInfo ) ; <nl> + <nl> + / * * <nl> + * hdfsGetHosts - Get hostnames where a particular block ( determined by <nl> + * pos & blocksize ) of a file is stored . The last element in the array <nl> + * is NULL . Due to replication , a single block could be present on <nl> + * multiple hosts . <nl> + * @ param fs The configured filesystem handle . <nl> + * @ param path The path of the file . <nl> + * @ param start The start of the block . <nl> + * @ param length The length of the block . <nl> + * @ return Returns a dynamically - allocated 2 - d array of blocks - hosts ; <nl> + * NULL on error . <nl> + * / <nl> + LIBHDFS_EXTERNAL <nl> + char * * * hdfsGetHosts ( hdfsFS fs , const char * path , tOffset start , <nl> + tOffset length ) ; <nl> + <nl> + / * * <nl> + * hdfsFreeHosts - Free up the structure returned by hdfsGetHosts <nl> + * @ param hdfsFileInfo The array of dynamically - allocated hdfsFileInfo <nl> + * objects . <nl> + * @ param numEntries The size of the array . <nl> + * / <nl> + LIBHDFS_EXTERNAL <nl> + void hdfsFreeHosts ( char * * * blockHosts ) ; <nl> + <nl> + / * * <nl> + * hdfsGetDefaultBlockSize - Get the default blocksize . <nl> + * <nl> + * @ param fs The configured filesystem handle . <nl> + * @ deprecated Use hdfsGetDefaultBlockSizeAtPath instead . <nl> + * <nl> + * @ return Returns the default blocksize , or - 1 on error . <nl> + * / <nl> + LIBHDFS_EXTERNAL <nl> + tOffset hdfsGetDefaultBlockSize ( hdfsFS fs ) ; <nl> + <nl> + / * * <nl> + * hdfsGetDefaultBlockSizeAtPath - Get the default blocksize at the <nl> + * filesystem indicated by a given path . <nl> + * <nl> + * @ param fs The configured filesystem handle . <nl> + * @ param path The given path will be used to locate the actual <nl> + * filesystem . The full path does not have to exist . <nl> + * <nl> + * @ return Returns the default blocksize , or - 1 on error . <nl> + * / <nl> + LIBHDFS_EXTERNAL <nl> + tOffset hdfsGetDefaultBlockSizeAtPath ( hdfsFS fs , const char * path ) ; <nl> + <nl> + / * * <nl> + * hdfsGetCapacity - Return the raw capacity of the filesystem . <nl> + * @ param fs The configured filesystem handle . <nl> + * @ return Returns the raw - capacity ; - 1 on error . <nl> + * / <nl> + LIBHDFS_EXTERNAL <nl> + tOffset hdfsGetCapacity ( hdfsFS fs ) ; <nl> + <nl> + / * * <nl> + * hdfsGetUsed - Return the total raw size of all files in the filesystem . <nl> + * @ param fs The configured filesystem handle . <nl> + * @ return Returns the total - size ; - 1 on error . <nl> + * / <nl> + LIBHDFS_EXTERNAL <nl> + tOffset hdfsGetUsed ( hdfsFS fs ) ; <nl> + <nl> + / * * <nl> + * Change the user and / or group of a file or directory . <nl> + * <nl> + * @ param fs The configured filesystem handle . <nl> + * @ param path the path to the file or directory <nl> + * @ param owner User string . Set to NULL for ' no change ' <nl> + * @ param group Group string . Set to NULL for ' no change ' <nl> + * @ return 0 on success else - 1 <nl> + * / <nl> + LIBHDFS_EXTERNAL <nl> + int hdfsChown ( hdfsFS fs , const char * path , const char * owner , <nl> + const char * group ) ; <nl> + <nl> + / * * <nl> + * hdfsChmod <nl> + * @ param fs The configured filesystem handle . <nl> + * @ param path the path to the file or directory <nl> + * @ param mode the bitmask to set it to <nl> + * @ return 0 on success else - 1 <nl> + * / <nl> + LIBHDFS_EXTERNAL <nl> + int hdfsChmod ( hdfsFS fs , const char * path , short mode ) ; <nl> + <nl> + / * * <nl> + * hdfsUtime <nl> + * @ param fs The configured filesystem handle . <nl> + * @ param path the path to the file or directory <nl> + * @ param mtime new modification time or - 1 for no change <nl> + * @ param atime new access time or - 1 for no change <nl> + * @ return 0 on success else - 1 <nl> + * / <nl> + LIBHDFS_EXTERNAL <nl> + int hdfsUtime ( hdfsFS fs , const char * path , tTime mtime , tTime atime ) ; <nl> + <nl> + / * * <nl> + * Allocate a zero - copy options structure . <nl> + * <nl> + * You must free all options structures allocated with this function using <nl> + * hadoopRzOptionsFree . <nl> + * <nl> + * @ return A zero - copy options structure , or NULL if one could <nl> + * not be allocated . If NULL is returned , errno will <nl> + * contain the error number . <nl> + * / <nl> + LIBHDFS_EXTERNAL <nl> + struct hadoopRzOptions * hadoopRzOptionsAlloc ( void ) ; <nl> + <nl> + / * * <nl> + * Determine whether we should skip checksums in read0 . <nl> + * <nl> + * @ param opts The options structure . <nl> + * @ param skip Nonzero to skip checksums sometimes ; zero to always <nl> + * check them . <nl> + * <nl> + * @ return 0 on success ; - 1 plus errno on failure . <nl> + * / <nl> + LIBHDFS_EXTERNAL <nl> + int hadoopRzOptionsSetSkipChecksum ( struct hadoopRzOptions * opts , int skip ) ; <nl> + <nl> + / * * <nl> + * Set the ByteBufferPool to use with read0 . <nl> + * <nl> + * @ param opts The options structure . <nl> + * @ param className If this is NULL , we will not use any <nl> + * ByteBufferPool . If this is non - NULL , it will be <nl> + * treated as the name of the pool class to use . <nl> + * For example , you can use <nl> + * ELASTIC_BYTE_BUFFER_POOL_CLASS . <nl> + * <nl> + * @ return 0 if the ByteBufferPool class was found and <nl> + * instantiated ; <nl> + * - 1 plus errno otherwise . <nl> + * / <nl> + LIBHDFS_EXTERNAL <nl> + int hadoopRzOptionsSetByteBufferPool ( struct hadoopRzOptions * opts , <nl> + const char * className ) ; <nl> + <nl> + / * * <nl> + * Free a hadoopRzOptionsFree structure . <nl> + * <nl> + * @ param opts The options structure to free . <nl> + * Any associated ByteBufferPool will also be freed . <nl> + * / <nl> + LIBHDFS_EXTERNAL <nl> + void hadoopRzOptionsFree ( struct hadoopRzOptions * opts ) ; <nl> + <nl> + / * * <nl> + * Perform a byte buffer read . <nl> + * If possible , this will be a zero - copy ( mmap ) read . <nl> + * <nl> + * @ param file The file to read from . <nl> + * @ param opts An options structure created by hadoopRzOptionsAlloc . <nl> + * @ param maxLength The maximum length to read . We may read fewer bytes <nl> + * than this length . <nl> + * <nl> + * @ return On success , we will return a new hadoopRzBuffer . <nl> + * This buffer will continue to be valid and readable <nl> + * until it is released by readZeroBufferFree . Failure to <nl> + * release a buffer will lead to a memory leak . <nl> + * You can access the data within the hadoopRzBuffer with <nl> + * hadoopRzBufferGet . If you have reached EOF , the data <nl> + * within the hadoopRzBuffer will be NULL . You must still <nl> + * free hadoopRzBuffer instances containing NULL . <nl> + * <nl> + * On failure , we will return NULL plus an errno code . <nl> + * errno = EOPNOTSUPP indicates that we could not do a <nl> + * zero - copy read , and there was no ByteBufferPool <nl> + * supplied . <nl> + * / <nl> + LIBHDFS_EXTERNAL <nl> + struct hadoopRzBuffer * hadoopReadZero ( hdfsFile file , <nl> + struct hadoopRzOptions * opts , <nl> + int32_t maxLength ) ; <nl> + <nl> + / * * <nl> + * Determine the length of the buffer returned from readZero . <nl> + * <nl> + * @ param buffer a buffer returned from readZero . <nl> + * @ return the length of the buffer . <nl> + * / <nl> + LIBHDFS_EXTERNAL <nl> + int32_t hadoopRzBufferLength ( const struct hadoopRzBuffer * buffer ) ; <nl> + <nl> + / * * <nl> + * Get a pointer to the raw buffer returned from readZero . <nl> + * <nl> + * To find out how many bytes this buffer contains , call <nl> + * hadoopRzBufferLength . <nl> + * <nl> + * @ param buffer a buffer returned from readZero . <nl> + * @ return a pointer to the start of the buffer . This will be <nl> + * NULL when end - of - file has been reached . <nl> + * / <nl> + LIBHDFS_EXTERNAL <nl> + const void * hadoopRzBufferGet ( const struct hadoopRzBuffer * buffer ) ; <nl> + <nl> + / * * <nl> + * Release a buffer obtained through readZero . <nl> + * <nl> + * @ param file The hdfs stream that created this buffer . This must be <nl> + * the same stream you called hadoopReadZero on . <nl> + * @ param buffer The buffer to release . <nl> + * / <nl> + LIBHDFS_EXTERNAL <nl> + void hadoopRzBufferFree ( hdfsFile file , struct hadoopRzBuffer * buffer ) ; <nl> + <nl> + # ifdef __cplusplus <nl> + } <nl> + # endif <nl> + <nl> + # undef LIBHDFS_EXTERNAL <nl> + # endif / * LIBHDFS_HDFS_H * / <nl> + <nl> + / * * <nl> + * vim : ts = 4 : sw = 4 : et <nl> + * / <nl> mmm a / tensorflow / tools / ci_build / builds / configured <nl> ppp b / tensorflow / tools / ci_build / builds / configured <nl> shift 1 <nl> <nl> # Enable support for Google Cloud Platform ( GCP ) <nl> export TF_NEED_GCP = 1 <nl> + # Enable support for HDFS <nl> + export TF_NEED_HDFS = 1 <nl> <nl> if [ [ " $ 1 " = = " - - disable - gcp " ] ] ; then <nl> export TF_NEED_GCP = 0 <nl> mmm a / tensorflow / tools / ci_build / builds / test_installation . sh <nl> ppp b / tensorflow / tools / ci_build / builds / test_installation . sh <nl> PY_TEST_BLACKLIST = " $ { PY_TEST_BLACKLIST } : " \ <nl> " tensorflow / python / util / protobuf / compare_test . py : " \ <nl> " tensorflow / python / framework / device_test . py : " \ <nl> " tensorflow / python / framework / file_system_test . py : " \ <nl> - " tensorflow / contrib / learn / python / learn / tests / early_stopping_test . py : " \ <nl> " tensorflow / contrib / quantization / python / dequantize_op_test . py : " \ <nl> " tensorflow / contrib / quantization / python / quantized_conv_ops_test . py : " \ <nl> " tensorflow / contrib / quantization / tools / quantize_graph_test . py : " \ <nl> PY_TEST_BLACKLIST = " $ { PY_TEST_BLACKLIST } : " \ <nl> " tensorflow / python / platform / default / _resource_loader_test . py : " \ <nl> " tensorflow / python / platform / default / flags_test . py : " \ <nl> " tensorflow / python / platform / default / logging_test . py : " \ <nl> - " tensorflow / contrib / learn / nonlinear_test . py : " \ <nl> - " tensorflow / contrib / learn / python / learn / tests / nonlinear_test . py " <nl> + " tensorflow / contrib / learn / nonlinear_test . py : " <nl> <nl> # Test blacklist : GPU - only <nl> PY_TEST_GPU_BLACKLIST = " $ { PY_TEST_GPU_BLACKLIST } : " \ <nl>
Merge commit for internal changes
tensorflow/tensorflow
6ce54c52abe04e54f66125aaedf130fa9c4018e7
2016-09-19T22:11:31Z
mmm a / scene / gui / line_edit . cpp <nl> ppp b / scene / gui / line_edit . cpp <nl> void LineEdit : : set_text ( String p_text ) { <nl> update ( ) ; <nl> cursor_pos = 0 ; <nl> window_pos = 0 ; <nl> - _text_changed ( ) ; <nl> } <nl> <nl> void LineEdit : : clear ( ) { <nl> mmm a / scene / gui / text_edit . cpp <nl> ppp b / scene / gui / text_edit . cpp <nl> Control : : CursorShape TextEdit : : get_cursor_shape ( const Point2 & p_pos ) const { <nl> void TextEdit : : set_text ( String p_text ) { <nl> <nl> setting_text = true ; <nl> - clear ( ) ; <nl> + _clear ( ) ; <nl> _insert_text_at_cursor ( p_text ) ; <nl> clear_undo_history ( ) ; <nl> cursor . column = 0 ; <nl> void TextEdit : : set_text ( String p_text ) { <nl> cursor_set_column ( 0 ) ; <nl> update ( ) ; <nl> setting_text = false ; <nl> - _text_changed_emit ( ) ; <nl> + <nl> / / get_range ( ) - > set ( 0 ) ; <nl> } ; <nl> <nl>
fix for TextEdit : : set_text firing signals it shouldn ' t .
godotengine/godot
2abec59db96496611bb16dd1300d9b7d3def9780
2018-05-19T18:38:13Z
mmm a / src / mongo / db / keys_collection_manager . cpp <nl> ppp b / src / mongo / db / keys_collection_manager . cpp <nl> namespace { <nl> <nl> Milliseconds kDefaultRefreshWaitTime ( 30 * 1000 ) ; <nl> Milliseconds kRefreshIntervalIfErrored ( 200 ) ; <nl> + Milliseconds kMaxRefreshWaitTime ( 10 * 60 * 1000 ) ; <nl> <nl> / * * <nl> * Returns the amount of time to wait until the monitoring thread should attempt to refresh again . <nl> Milliseconds howMuchSleepNeedFor ( const LogicalTime & currentTime , <nl> return interval ; <nl> } <nl> <nl> - return kRefreshIntervalIfErrored ; <nl> + return Milliseconds ( millisBeforeExpire ) ; <nl> } <nl> <nl> } / / unnamed namespace <nl> void KeysCollectionManager : : PeriodicRunner : : _doPeriodicRefresh ( ServiceContext * s <nl> auto opCtx = cc ( ) . makeOperationContext ( ) ; <nl> <nl> bool hasRefreshRequestInitially = false ; <nl> + unsigned errorCount = 0 ; <nl> std : : shared_ptr < RefreshFunc > doRefresh ; <nl> { <nl> stdx : : lock_guard < stdx : : mutex > lock ( _mutex ) ; <nl> void KeysCollectionManager : : PeriodicRunner : : _doPeriodicRefresh ( ServiceContext * s <nl> <nl> auto latestKeyStatusWith = ( * doRefresh ) ( opCtx . get ( ) ) ; <nl> if ( latestKeyStatusWith . getStatus ( ) . isOK ( ) ) { <nl> + errorCount = 0 ; <nl> const auto & latestKey = latestKeyStatusWith . getValue ( ) ; <nl> auto currentTime = LogicalClock : : get ( service ) - > getClusterTime ( ) ; <nl> <nl> nextWakeup = <nl> howMuchSleepNeedFor ( currentTime , latestKey . getExpiresAt ( ) , refreshInterval ) ; <nl> + } else { <nl> + errorCount + = 1 ; <nl> + nextWakeup = Milliseconds ( kRefreshIntervalIfErrored . count ( ) * errorCount ) ; <nl> + if ( nextWakeup > kMaxRefreshWaitTime ) { <nl> + nextWakeup = kMaxRefreshWaitTime ; <nl> + } <nl> } <nl> <nl> - / / TODO : Add backoff to nextWakeup if it has a very small value in a row to avoid spinning . <nl> - <nl> stdx : : unique_lock < stdx : : mutex > lock ( _mutex ) ; <nl> <nl> if ( _refreshRequest ) { <nl> mmm a / src / mongo / db / time_proof_service . h <nl> ppp b / src / mongo / db / time_proof_service . h <nl> class TimeProofService { <nl> * Returns true if it has proof for time greater or equal than the argument . <nl> * / <nl> bool hasProof ( LogicalTime time , const Key & key ) const { <nl> - return key = = _key & & time < = _time ; <nl> + return key = = _key & & time = = _time ; <nl> } <nl> <nl> TimeProof _proof ; <nl>
SERVER - 29508 Add backoff to key collection manager refresh scheduling
mongodb/mongo
c7aa40633696a49fea2e75750b30a8339117d072
2017-06-13T21:48:18Z
mmm a / editor / scene_tree_dock . cpp <nl> ppp b / editor / scene_tree_dock . cpp <nl> void SceneTreeDock : : _delete_confirm ( ) { <nl> } <nl> <nl> void SceneTreeDock : : _update_script_button ( ) { <nl> - if ( EditorNode : : get_singleton ( ) - > get_editor_selection ( ) - > get_selection ( ) . size ( ) = = 1 ) { <nl> + if ( EditorNode : : get_singleton ( ) - > get_editor_selection ( ) - > get_selection ( ) . size ( ) = = 0 ) { <nl> + button_create_script - > hide ( ) ; <nl> + button_clear_script - > hide ( ) ; <nl> + } else if ( EditorNode : : get_singleton ( ) - > get_editor_selection ( ) - > get_selection ( ) . size ( ) = = 1 ) { <nl> Node * n = EditorNode : : get_singleton ( ) - > get_editor_selection ( ) - > get_selected_node_list ( ) [ 0 ] ; <nl> if ( n - > get_script ( ) . is_null ( ) ) { <nl> button_create_script - > show ( ) ; <nl> void SceneTreeDock : : _update_script_button ( ) { <nl> } <nl> } else { <nl> button_create_script - > show ( ) ; <nl> + List < Node * > selection = EditorNode : : get_singleton ( ) - > get_editor_selection ( ) - > get_selected_node_list ( ) ; <nl> + for ( List < Node * > : : Element * E = selection . front ( ) ; E ; E = E - > next ( ) ) { <nl> + Node * n = E - > get ( ) ; <nl> + if ( ! n - > get_script ( ) . is_null ( ) ) { <nl> + button_clear_script - > show ( ) ; <nl> + return ; <nl> + } <nl> + } <nl> button_clear_script - > hide ( ) ; <nl> } <nl> } <nl>
Merge pull request from Chaosus / script
godotengine/godot
1ff502c5f439e66687cbd467b3564f439a4c8a57
2019-01-02T14:52:36Z
mmm a / tensorflow / python / kernel_tests / resource_variable_ops_test . py <nl> ppp b / tensorflow / python / kernel_tests / resource_variable_ops_test . py <nl> def testVariableEager ( self ) : <nl> self . assertEqual ( dtypes . int32 , v . dtype ) <nl> self . assertEqual ( " foo / var7 : 0 " , v . name ) <nl> self . assertAllEqual ( [ 10 , 20 , 35 ] , v . shape . as_list ( ) ) <nl> - self . assertEqual ( context . get_default_context ( ) . device_name , v . device ) <nl> self . assertTrue ( isinstance ( v . handle , ops . EagerTensor ) ) <nl> self . assertEqual ( constraint , v . constraint ) <nl> self . assertAllEqual ( init . numpy ( ) , v . read_value ( ) . numpy ( ) ) <nl> mmm a / tensorflow / python / ops / resource_variable_ops . py <nl> ppp b / tensorflow / python / ops / resource_variable_ops . py <nl> def _init_from_args ( self , <nl> shared_name = handle_name , <nl> name = name , <nl> graph_mode = self . _in_graph_mode ) <nl> - self . _handle_device = ( <nl> - self . _handle . device if self . _in_graph_mode else <nl> - context . get_default_context ( ) . device_name ) <nl> self . _shape = initial_value . get_shape ( ) <nl> else : <nl> initial_value = initial_value ( ) <nl> def _init_from_args ( self , <nl> shared_name = handle_name , <nl> name = name , <nl> graph_mode = False ) <nl> - self . _handle_device = ( <nl> - self . _handle . device if self . _in_graph_mode else <nl> - context . get_default_context ( ) . device_name ) <nl> self . _shape = initial_value . get_shape ( ) <nl> # pylint : enable = protected - access <nl> <nl> def _init_from_args ( self , <nl> shared_name = handle_name , <nl> name = name , <nl> graph_mode = self . _in_graph_mode ) <nl> - self . _handle_device = ( self . _handle . device if self . _in_graph_mode else <nl> - context . get_default_context ( ) . device_name ) <nl> self . _shape = initial_value . get_shape ( ) <nl> <nl> self . _initial_value = initial_value if self . _in_graph_mode else None <nl> def _init_from_args ( self , <nl> with ops . name_scope ( " Read " ) , ops . colocate_with ( self . _handle ) : <nl> # Manually assign reads to the handle ' s device to avoid log <nl> # messages . <nl> - with ops . device ( self . _handle_device ) : <nl> + with ops . device ( self . _handle . device ) : <nl> value = self . _read_variable_op ( ) <nl> self . _graph_element = value <nl> if caching_device is not None : <nl> def _init_from_args ( self , <nl> # cycles being uncollectable , and means that no __del__ will be defined at <nl> # all in graph mode . <nl> self . _handle_deleter = EagerResourceDeleter ( <nl> - handle = self . _handle , handle_device = self . _handle_device ) <nl> + handle = self . _handle , handle_device = self . _handle . device ) <nl> <nl> def _init_from_proto ( self , variable_def , import_scope = None ) : <nl> " " " Initializes from ` VariableDef ` proto . " " " <nl> def _init_from_proto ( self , variable_def , import_scope = None ) : <nl> variable_def . variable_name , import_scope = import_scope ) ) <nl> self . _shape = tensor_shape . TensorShape ( <nl> self . _handle . op . get_attr ( " shape " ) ) <nl> - self . _handle_device = self . _handle . device <nl> self . _handle_name = self . _handle . name <nl> self . _initializer_op = g . as_graph_element ( <nl> ops . prepend_name_scope ( <nl> def dtype ( self ) : <nl> @ property <nl> def device ( self ) : <nl> " " " The device this variable is on . " " " <nl> - return self . _handle_device <nl> + return self . _handle . device <nl> <nl> @ property <nl> def graph ( self ) : <nl> def value ( self ) : <nl> if self . _cached_value is not None : <nl> return self . _cached_value <nl> with ops . colocate_with ( None , ignore_existing = True ) : <nl> - with ops . device ( self . _handle_device ) : <nl> + with ops . device ( self . _handle . device ) : <nl> return self . _read_variable_op ( ) <nl> <nl> def _as_graph_element ( self ) : <nl> def read_value ( self ) : <nl> " " " <nl> with ops . name_scope ( " Read " ) : <nl> # Ensure we read the variable in the same device as the handle . <nl> - with ops . device ( self . _handle_device ) : <nl> + with ops . device ( self . _handle . device ) : <nl> value = self . _read_variable_op ( ) <nl> # Return an identity so it can get placed on whatever device the context <nl> # specifies instead of the device where the variable is . <nl> def _lazy_read ( self , op ) : <nl> if hasattr ( self , " _trainable " ) and self . _trainable : <nl> tape . watch_variable ( self ) <nl> return _UnreadVariable ( <nl> - self . _handle , self . dtype , self . _handle_device , self . _shape , <nl> - self . _in_graph_mode , <nl> + self . _handle , self . dtype , self . _shape , self . _in_graph_mode , <nl> self . _handle_deleter if not self . _in_graph_mode else None , op ) <nl> <nl> def assign ( self , value , use_locking = None , name = None , read_value = True ) : <nl> class _UnreadVariable ( ResourceVariable ) : <nl> Pretends to be the tensor if anyone looks . <nl> " " " <nl> <nl> - def __init__ ( self , handle , dtype , handle_device , # pylint : disable = super - init - not - called <nl> + def __init__ ( self , handle , dtype , # pylint : disable = super - init - not - called <nl> shape , in_graph_mode , deleter , parent_op ) : <nl> # We do not call super init on purpose . <nl> self . _trainable = False <nl> def __init__ ( self , handle , dtype , handle_device , # pylint : disable = super - init - n <nl> self . _graph_key = ops . get_default_graph ( ) . _graph_key # pylint : disable = protected - access <nl> self . _in_graph_mode = in_graph_mode <nl> self . _handle = handle <nl> - self . _handle_device = handle_device <nl> self . _shape = shape <nl> self . _initial_value = None <nl> if isinstance ( self . _handle , ops . EagerTensor ) : <nl>
No need to override _handle_device for variables anymore
tensorflow/tensorflow
cd810e21bdb0a5631836c69e5273135e4b15a441
2018-03-02T17:58:03Z
mmm a / site_scons / site_tools / ccache . py <nl> ppp b / site_scons / site_tools / ccache . py <nl> def generate ( env ) : <nl> if var . startswith ( " CCACHE_ " ) : <nl> env [ " ENV " ] [ var ] = host_value <nl> <nl> + # SERVER - 48289 : Adding roll - your - own CFLAGS and CXXFLAGS can cause some very " weird " issues <nl> + # with using icecc and ccache if they turn out not to be supported by the compiler . Rather <nl> + # than try to filter each and every flag someone might try for the ones we know don ' t <nl> + # work , we ' ll just let the compiler ignore them . A better approach might be to pre - filter <nl> + # flags coming in from the environment by passing them through the appropriate * IfSupported <nl> + # method , but that ' s a much larger effort . <nl> + if env . ToolchainIs ( " clang " ) : <nl> + env . AppendUnique ( CCFLAGS = [ " - Qunused - arguments " ] ) <nl> + <nl> # Record our found CCACHE_VERSION . Other tools that need to know <nl> # about ccache ( like iecc ) should query this variable to determine <nl> # if ccache is active . Looking at the CCACHE variable in the <nl>
SERVER - 48289 Ignore unused compiler flags
mongodb/mongo
1248eaec6e4d73484af9c2220ea9d22730ecbe44
2020-05-29T19:09:40Z
mmm a / src / wasm / wasm - macro - gen . h <nl> ppp b / src / wasm / wasm - macro - gen . h <nl> <nl> # define DEPTH_1 1 <nl> <nl> # define WASM_BLOCK ( count , . . . ) kExprBlock , __VA_ARGS__ , kExprEnd <nl> - # define WASM_INFINITE_LOOP \ <nl> - kExprLoop , kExprNop , kExprBr , ARITY_0 , DEPTH_0 , kExprEnd <nl> + # define WASM_INFINITE_LOOP kExprLoop , kExprBr , ARITY_0 , DEPTH_0 , kExprEnd <nl> # define WASM_LOOP ( count , . . . ) kExprLoop , __VA_ARGS__ , kExprEnd <nl> # define WASM_IF ( cond , tstmt ) cond , kExprIf , tstmt , kExprEnd <nl> # define WASM_IF_ELSE ( cond , tstmt , fstmt ) \ <nl> cond , kExprIf , tstmt , kExprElse , fstmt , kExprEnd <nl> # define WASM_SELECT ( tval , fval , cond ) tval , fval , cond , kExprSelect <nl> - # define WASM_BR ( depth ) kExprNop , kExprBr , ARITY_0 , static_cast < byte > ( depth ) <nl> + # define WASM_BR ( depth ) kExprBr , ARITY_0 , static_cast < byte > ( depth ) <nl> # define WASM_BR_IF ( depth , cond ) \ <nl> cond , kExprBrIf , ARITY_0 , static_cast < byte > ( depth ) <nl> # define WASM_BRV ( depth , val ) val , kExprBr , ARITY_1 , static_cast < byte > ( depth ) <nl> # define WASM_BRV_IF ( depth , val , cond ) \ <nl> val , cond , kExprBrIf , ARITY_1 , static_cast < byte > ( depth ) <nl> - # define WASM_BREAK ( depth ) \ <nl> - kExprNop , kExprBr , ARITY_0 , static_cast < byte > ( depth + 1 ) <nl> - # define WASM_CONTINUE ( depth ) \ <nl> - kExprNop , kExprBr , ARITY_0 , static_cast < byte > ( depth ) <nl> + # define WASM_BREAK ( depth ) kExprBr , ARITY_0 , static_cast < byte > ( depth + 1 ) <nl> + # define WASM_CONTINUE ( depth ) kExprBr , ARITY_0 , static_cast < byte > ( depth ) <nl> # define WASM_BREAKV ( depth , val ) \ <nl> val , kExprBr , ARITY_1 , static_cast < byte > ( depth + 1 ) <nl> # define WASM_RETURN0 kExprReturn , ARITY_0 <nl> mmm a / test / unittests / wasm / wasm - macro - gen - unittest . cc <nl> ppp b / test / unittests / wasm / wasm - macro - gen - unittest . cc <nl> TEST_F ( WasmMacroGenTest , Statements ) { <nl> <nl> EXPECT_SIZE ( 5 , WASM_SELECT ( WASM_ZERO , WASM_NOP , WASM_NOP ) ) ; <nl> <nl> - EXPECT_SIZE ( 4 , WASM_BR ( 0 ) ) ; <nl> + EXPECT_SIZE ( 3 , WASM_BR ( 0 ) ) ; <nl> EXPECT_SIZE ( 5 , WASM_BR_IF ( 0 , WASM_ZERO ) ) ; <nl> <nl> EXPECT_SIZE ( 3 , WASM_BLOCK ( 1 , WASM_NOP ) ) ; <nl> EXPECT_SIZE ( 4 , WASM_BLOCK ( 2 , WASM_NOP , WASM_NOP ) ) ; <nl> EXPECT_SIZE ( 5 , WASM_BLOCK ( 3 , WASM_NOP , WASM_NOP , WASM_NOP ) ) ; <nl> <nl> - EXPECT_SIZE ( 6 , WASM_INFINITE_LOOP ) ; <nl> + EXPECT_SIZE ( 5 , WASM_INFINITE_LOOP ) ; <nl> <nl> EXPECT_SIZE ( 3 , WASM_LOOP ( 1 , WASM_NOP ) ) ; <nl> EXPECT_SIZE ( 4 , WASM_LOOP ( 2 , WASM_NOP , WASM_NOP ) ) ; <nl> EXPECT_SIZE ( 5 , WASM_LOOP ( 3 , WASM_NOP , WASM_NOP , WASM_NOP ) ) ; <nl> - EXPECT_SIZE ( 6 , WASM_LOOP ( 1 , WASM_BR ( 0 ) ) ) ; <nl> + EXPECT_SIZE ( 5 , WASM_LOOP ( 1 , WASM_BR ( 0 ) ) ) ; <nl> EXPECT_SIZE ( 7 , WASM_LOOP ( 1 , WASM_BR_IF ( 0 , WASM_ZERO ) ) ) ; <nl> <nl> EXPECT_SIZE ( 2 , WASM_RETURN0 ) ; <nl> TEST_F ( WasmMacroGenTest , MacroStatements ) { <nl> EXPECT_SIZE ( 7 , WASM_INC_LOCAL ( 0 ) ) ; <nl> EXPECT_SIZE ( 7 , WASM_INC_LOCAL_BY ( 0 , 3 ) ) ; <nl> <nl> - EXPECT_SIZE ( 4 , WASM_BREAK ( 0 ) ) ; <nl> - EXPECT_SIZE ( 4 , WASM_CONTINUE ( 0 ) ) ; <nl> + EXPECT_SIZE ( 3 , WASM_BREAK ( 0 ) ) ; <nl> + EXPECT_SIZE ( 3 , WASM_CONTINUE ( 0 ) ) ; <nl> } <nl> <nl> TEST_F ( WasmMacroGenTest , BrTable ) { <nl>
[ wasm ] Remove unnecessary kExprNop from WASM_BR and other macros .
v8/v8
2949e05d1e38a51a6c649e4add898f5356eb3f6c
2016-05-03T08:20:04Z
mmm a / lib / IDE / CodeCompletion . cpp <nl> ppp b / lib / IDE / CodeCompletion . cpp <nl> calculateTypeRelationForDecl ( const Decl * D , Type ExpectedType , <nl> bool UseFuncResultType = true ) { <nl> auto VD = dyn_cast < ValueDecl > ( D ) ; <nl> auto DC = D - > getDeclContext ( ) ; <nl> - if ( ! VD | | ! VD - > hasInterfaceType ( ) ) <nl> + if ( ! VD | | ! VD - > getInterfaceType ( ) ) <nl> return CodeCompletionResult : : ExpectedTypeRelation : : Unrelated ; <nl> <nl> if ( auto FD = dyn_cast < AbstractFunctionDecl > ( VD ) ) { <nl> class CompletionLookup final : public swift : : VisibleDeclConsumer { <nl> addTypeAnnotation ( Builder , AFT - > getResult ( ) ) ; <nl> } ; <nl> <nl> - if ( ! AFD | | ! AFD - > hasInterfaceType ( ) | | <nl> + if ( ! AFD | | ! AFD - > getInterfaceType ( ) | | <nl> ! AFD - > getInterfaceType ( ) - > is < AnyFunctionType > ( ) ) { <nl> / / Probably , calling closure type expression . <nl> foundFunction ( AFT ) ; <nl> class CompletionLookup final : public swift : : VisibleDeclConsumer { <nl> setClangDeclKeywords ( TAD , Pairs , Builder ) ; <nl> addLeadingDot ( Builder ) ; <nl> Builder . addTextChunk ( TAD - > getName ( ) . str ( ) ) ; <nl> - if ( TAD - > hasInterfaceType ( ) ) { <nl> - auto underlyingType = TAD - > getUnderlyingType ( ) ; <nl> + if ( auto underlyingType = TAD - > getUnderlyingType ( ) ) { <nl> if ( underlyingType - > hasError ( ) ) { <nl> Type parentType ; <nl> if ( auto nominal = TAD - > getDeclContext ( ) - > getSelfNominalTypeDecl ( ) ) { <nl> class CompletionLookup final : public swift : : VisibleDeclConsumer { <nl> <nl> bool handleEnumElement ( ValueDecl * D , DeclVisibilityKind Reason , <nl> DynamicLookupInfo dynamicLookupInfo ) { <nl> - / / FIXME ( InterfaceTypeRequest ) : Remove this . <nl> - ( void ) D - > getInterfaceType ( ) ; <nl> - <nl> if ( auto * EED = dyn_cast < EnumElementDecl > ( D ) ) { <nl> addEnumElementRef ( EED , Reason , dynamicLookupInfo , <nl> / * HasTypeContext = * / true ) ; <nl> class CompletionLookup final : public swift : : VisibleDeclConsumer { <nl> llvm : : DenseSet < EnumElementDecl * > Elements ; <nl> ED - > getAllElements ( Elements ) ; <nl> for ( auto * Ele : Elements ) { <nl> - / / FIXME ( InterfaceTypeRequest ) : Remove this . <nl> - ( void ) Ele - > getInterfaceType ( ) ; <nl> addEnumElementRef ( Ele , Reason , dynamicLookupInfo , <nl> / * HasTypeContext = * / true ) ; <nl> } <nl> class CompletionOverrideLookup : public swift : : VisibleDeclConsumer { <nl> ( D - > isStatic ( ) & & D - > getAttrs ( ) . hasAttribute < HasInitialValueAttr > ( ) ) ) <nl> return ; <nl> <nl> - / / FIXME ( InterfaceTypeRequest ) : Remove this . <nl> - ( void ) D - > getInterfaceType ( ) ; <nl> - <nl> bool hasIntroducer = hasFuncIntroducer | | <nl> hasVarIntroducer | | <nl> hasTypealiasIntroducer ; <nl> mmm a / lib / Sema / CSApply . cpp <nl> ppp b / lib / Sema / CSApply . cpp <nl> namespace { <nl> return nullptr ; <nl> } <nl> <nl> - / / FIXME ( InterfaceTypeRequest ) : Remove this . <nl> - ( void ) fn - > getInterfaceType ( ) ; <nl> - <nl> / / Form a reference to the function . The bridging operations are generic , <nl> / / so we need to form substitutions and compute the resulting type . <nl> auto genericSig = fn - > getGenericSignature ( ) ; <nl> namespace { <nl> auto maxFloatTypeDecl = tc . Context . get_MaxBuiltinFloatTypeDecl ( ) ; <nl> <nl> if ( ! maxFloatTypeDecl | | <nl> - ! maxFloatTypeDecl - > hasInterfaceType ( ) | | <nl> + ! maxFloatTypeDecl - > getInterfaceType ( ) | | <nl> ! maxFloatTypeDecl - > getDeclaredInterfaceType ( ) - > is < BuiltinFloatType > ( ) ) { <nl> tc . diagnose ( expr - > getLoc ( ) , diag : : no_MaxBuiltinFloatType_found ) ; <nl> return nullptr ; <nl> } <nl> <nl> - / / FIXME ( InterfaceTypeRequest ) : Remove this . <nl> - ( void ) maxFloatTypeDecl - > getInterfaceType ( ) ; <nl> auto maxType = maxFloatTypeDecl - > getUnderlyingType ( ) ; <nl> <nl> DeclName initName ( tc . Context , DeclBaseName : : createConstructor ( ) , <nl> namespace { <nl> assert ( method & & " Didn ' t find a method ? " ) ; <nl> <nl> / / The declaration we found must be exposed to Objective - C . <nl> - / / FIXME ( InterfaceTypeRequest ) : Remove this . <nl> - ( void ) method - > getInterfaceType ( ) ; <nl> if ( ! method - > isObjC ( ) ) { <nl> / / If the method declaration lies in a protocol and we ' re providing <nl> / / a default implementation of the method through a protocol extension <nl> mmm a / lib / Sema / DerivedConformanceRawRepresentable . cpp <nl> ppp b / lib / Sema / DerivedConformanceRawRepresentable . cpp <nl> static bool canSynthesizeRawRepresentable ( DerivedConformance & derived ) { <nl> auto enumDecl = cast < EnumDecl > ( derived . Nominal ) ; <nl> auto & tc = derived . TC ; <nl> <nl> - / / Validate the enum and its raw type . <nl> - / / FIXME ( InterfaceTypeRequest ) : Remove this . <nl> - ( void ) enumDecl - > getInterfaceType ( ) ; <nl> - <nl> - / / It must have a valid raw type . <nl> Type rawType = enumDecl - > getRawType ( ) ; <nl> if ( ! rawType ) <nl> return false ; <nl> mmm a / lib / Sema / LookupVisibleDecls . cpp <nl> ppp b / lib / Sema / LookupVisibleDecls . cpp <nl> static bool isDeclVisibleInLookupMode ( ValueDecl * Member , LookupState LS , <nl> / / Accessors are never visible directly in the source language . <nl> if ( isa < AccessorDecl > ( Member ) ) <nl> return false ; <nl> - <nl> - / / FIXME ( InterfaceTypeRequest ) : Remove this . <nl> - ( void ) Member - > getInterfaceType ( ) ; <nl> <nl> / / Check access when relevant . <nl> if ( ! Member - > getDeclContext ( ) - > isLocalContext ( ) & & <nl> mmm a / lib / Sema / TypeCheckSwitchStmt . cpp <nl> ppp b / lib / Sema / TypeCheckSwitchStmt . cpp <nl> namespace { <nl> } <nl> case PatternKind : : EnumElement : { <nl> auto * VP = cast < EnumElementPattern > ( item ) ; <nl> - / / FIXME ( InterfaceTypeRequest ) : Remove this . <nl> - ( void ) item - > getType ( ) - > getEnumOrBoundGenericEnum ( ) - > getInterfaceType ( ) ; <nl> - <nl> auto * SP = VP - > getSubPattern ( ) ; <nl> if ( ! SP ) { <nl> / / If there ' s no sub - pattern then there ' s no further recursive <nl>
Merge remote - tracking branch ' origin / master ' into master - next
apple/swift
41d0ab088eae9ef5ca550ba1784cb2ea0ab34ad5
2019-09-24T18:29:41Z
mmm a / src / bloom . h <nl> ppp b / src / bloom . h <nl> class CBloomFilter <nl> * insert ( ) ' ed . . . but may also return true for items that were not inserted . <nl> * <nl> * It needs around 1 . 8 bytes per element per factor 0 . 1 of false positive rate . <nl> - * ( More accurately : 3 / ( log ( 256 ) * log ( 2 ) ) * log ( 1 / fpRate ) * nElements bytes ) <nl> + * For example , if we want 1000 elements , we ' d need : <nl> + * - ~ 1800 bytes for a false positive rate of 0 . 1 <nl> + * - ~ 3600 bytes for a false positive rate of 0 . 01 <nl> + * - ~ 5400 bytes for a false positive rate of 0 . 001 <nl> + * <nl> + * If we make these simplifying assumptions : <nl> + * - logFpRate / log ( 0 . 5 ) doesn ' t get rounded or clamped in the nHashFuncs calculation <nl> + * - nElements is even , so that nEntriesPerGeneration = = nElements / 2 <nl> + * <nl> + * Then we get a more accurate estimate for filter bytes : <nl> + * <nl> + * 3 / ( log ( 256 ) * log ( 2 ) ) * log ( 1 / fpRate ) * nElements <nl> * / <nl> class CRollingBloomFilter <nl> { <nl>
doc : clarify CRollingBloomFilter size estimate
bitcoin/bitcoin
d9141a0002bb508b2e94e206a1bd28ef8f97ffde
2020-10-02T05:22:56Z
mmm a / modules / cudaoptflow / perf / perf_optflow . cpp <nl> ppp b / modules / cudaoptflow / perf / perf_optflow . cpp <nl> <nl> / / M * / <nl> <nl> # include " perf_precomp . hpp " <nl> - # include " opencv2 / legacy . hpp " <nl> <nl> using namespace std ; <nl> using namespace testing ; <nl> PERF_TEST_P ( ImagePair , OpticalFlowDual_TVL1 , <nl> } <nl> else <nl> { <nl> - cv : : Mat flow ; <nl> - <nl> - cv : : Ptr < cv : : DenseOpticalFlow > alg = cv : : createOptFlow_DualTVL1 ( ) ; <nl> - alg - > set ( " medianFiltering " , 1 ) ; <nl> - alg - > set ( " innerIterations " , 1 ) ; <nl> - alg - > set ( " outerIterations " , 300 ) ; <nl> - <nl> - TEST_CYCLE ( ) alg - > calc ( frame0 , frame1 , flow ) ; <nl> - <nl> - CPU_SANITY_CHECK ( flow ) ; <nl> + FAIL_NO_CPU ( ) ; <nl> } <nl> } <nl> <nl> mmm a / modules / cudaoptflow / test / test_optflow . cpp <nl> ppp b / modules / cudaoptflow / test / test_optflow . cpp <nl> <nl> / / M * / <nl> <nl> # include " test_precomp . hpp " <nl> - # include " opencv2 / legacy . hpp " <nl> <nl> # ifdef HAVE_CUDA <nl> <nl>
removed legacy header
opencv/opencv
df8f1a4355a89d5f795db42e9f8681657fc67a97
2014-07-28T08:58:19Z
mmm a / tensorflow / BUILD <nl> ppp b / tensorflow / BUILD <nl> filegroup ( <nl> " / / tensorflow / contrib / graph_editor : all_files " , <nl> " / / tensorflow / contrib / grid_rnn : all_files " , <nl> " / / tensorflow / contrib / hooks : all_files " , <nl> + " / / tensorflow / contrib / hvx / hvx_ops_support_checker : all_files " , <nl> " / / tensorflow / contrib / image : all_files " , <nl> " / / tensorflow / contrib / imperative : all_files " , <nl> " / / tensorflow / contrib / input_pipeline : all_files " , <nl> new file mode 100644 <nl> index 0000000000000 . . 922996a686497 <nl> mmm / dev / null <nl> ppp b / tensorflow / contrib / hvx / hvx_ops_support_checker / BUILD <nl> <nl> + # Description : <nl> + # Contains a tool to dump TensorFlow ops which are not supported <nl> + # in TensorFlow HVX runtime . <nl> + <nl> + package ( default_visibility = [ " / / visibility : public " ] ) <nl> + <nl> + licenses ( [ " notice " ] ) # Apache 2 . 0 <nl> + <nl> + exports_files ( [ " LICENSE " ] ) <nl> + <nl> + filegroup ( <nl> + name = " all_files " , <nl> + srcs = glob ( <nl> + [ " * * / * " ] , <nl> + exclude = [ <nl> + " * * / METADATA " , <nl> + " * * / OWNERS " , <nl> + ] , <nl> + ) , <nl> + ) <nl> + <nl> + cc_binary ( <nl> + name = " hvx_ops_support_checker " , <nl> + testonly = 1 , <nl> + srcs = [ " hvx_ops_support_checker_main . cc " ] , <nl> + visibility = [ " / / visibility : public " ] , <nl> + deps = [ <nl> + " / / tensorflow / core : framework_internal " , <nl> + " / / tensorflow / core : lib " , <nl> + " / / tensorflow / core : protos_all_cc " , <nl> + " / / tensorflow / core : tensorflow " , <nl> + " / / tensorflow / core / kernels / hexagon : graph_transferer " , <nl> + " / / tensorflow / tools / graph_transforms : transform_utils " , <nl> + ] , <nl> + ) <nl> new file mode 100644 <nl> index 0000000000000 . . 200714046cecf <nl> mmm / dev / null <nl> ppp b / tensorflow / contrib / hvx / hvx_ops_support_checker / hvx_ops_support_checker_main . cc <nl> <nl> + / * Copyright 2017 The TensorFlow Authors . All Rights Reserved . <nl> + <nl> + Licensed under the Apache License , Version 2 . 0 ( the " License " ) ; <nl> + you may not use this file except in compliance with the License . <nl> + You may obtain a copy of the License at <nl> + <nl> + http : / / www . apache . org / licenses / LICENSE - 2 . 0 <nl> + <nl> + Unless required by applicable law or agreed to in writing , software <nl> + distributed under the License is distributed on an " AS IS " BASIS , <nl> + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND , either express or implied . <nl> + See the License for the specific language governing permissions and <nl> + limitations under the License . <nl> + = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = * / <nl> + <nl> + / / bazel build tensorflow / contrib / hvx / hvx_ops_support_checker & & <nl> + / / bazel - bin / tensorflow / contrib / hvx / hvx_ops_support_checker / hvx_ops_support_checker <nl> + / / \ <nl> + / / - - in_graph = graph_def . pb <nl> + <nl> + # include < unordered_set > <nl> + <nl> + # include " tensorflow / core / framework / graph . pb . h " <nl> + # include " tensorflow / core / framework / node_def . pb . h " <nl> + # include " tensorflow / core / kernels / hexagon / hexagon_ops_definitions . h " <nl> + # include " tensorflow / core / lib / core / status . h " <nl> + # include " tensorflow / core / lib / strings / str_util . h " <nl> + # include " tensorflow / core / platform / logging . h " <nl> + # include " tensorflow / core / util / command_line_flags . h " <nl> + # include " tensorflow / tools / graph_transforms / transform_utils . h " <nl> + <nl> + namespace tensorflow { <nl> + namespace { <nl> + static int ParseFlags ( int argc , char * argv [ ] , string * in_graph ) { <nl> + std : : vector < Flag > flag_list = { <nl> + Flag ( " in_graph " , in_graph , " input graph file name " ) , <nl> + } ; <nl> + CHECK ( Flags : : Parse ( & argc , argv , flag_list ) ) ; <nl> + string usage = Flags : : Usage ( argv [ 0 ] , flag_list ) ; <nl> + CHECK ( in_graph - > empty ( ) ) < < " in_graph graph can ' t be empty . \ n " < < usage ; <nl> + <nl> + return 0 ; <nl> + } <nl> + <nl> + static void CheckOpsSupport ( const GraphDef & graph_def ) { <nl> + const IGraphTransferOpsDefinitions & ops_definition = <nl> + HexagonOpsDefinitions : : getInstance ( ) ; <nl> + LOG ( INFO ) < < " Checking " < < graph_def . node_size ( ) < < " nodes " ; <nl> + <nl> + std : : unordered_set < string > unsupported_ops ; <nl> + bool all_supported = true ; <nl> + for ( const NodeDef & node : graph_def . node ( ) ) { <nl> + const int op_id = ops_definition . GetOpIdFor ( node . op ( ) ) ; <nl> + if ( op_id = = IGraphTransferOpsDefinitions : : INVALID_OP_ID ) { <nl> + all_supported = false ; <nl> + LOG ( ERROR ) < < " OP type : " < < node . op ( ) < < " is not supported on hvx . " <nl> + < < " Name = " < < node . name ( ) ; <nl> + unsupported_ops . emplace ( node . op ( ) ) ; <nl> + } <nl> + } <nl> + <nl> + LOG ( INFO ) < < " \ n " ; <nl> + LOG ( INFO ) < < " Unsupported ops : " ; <nl> + int count = 0 ; <nl> + for ( const string & op_type : unsupported_ops ) { <nl> + LOG ( INFO ) < < " ( " < < ( + + count ) < < " ) " < < op_type ; <nl> + } <nl> + if ( count = = 0 ) { <nl> + LOG ( INFO ) < < " All ops supported ! " ; <nl> + } else { <nl> + LOG ( INFO ) < < count < < " ops are not supported . " ; <nl> + } <nl> + } <nl> + <nl> + } / / namespace <nl> + } / / namespace tensorflow <nl> + <nl> + int main ( int argc , char * * argv ) { <nl> + tensorflow : : string in_graph ; <nl> + const int ret = tensorflow : : ParseFlags ( argc , argv , & in_graph ) ; <nl> + if ( ret ! = 0 ) { <nl> + return ret ; <nl> + } <nl> + <nl> + tensorflow : : GraphDef graph_def ; <nl> + TF_CHECK_OK ( tensorflow : : graph_transforms : : LoadTextOrBinaryGraphFile ( <nl> + in_graph , & graph_def ) ) ; <nl> + <nl> + tensorflow : : CheckOpsSupport ( graph_def ) ; <nl> + return 0 ; <nl> + } <nl> mmm a / tensorflow / core / kernels / hexagon / hexagon_ops_definitions . cc <nl> ppp b / tensorflow / core / kernels / hexagon / hexagon_ops_definitions . cc <nl> const std : : unordered_map < string , SupportedOpType > OP_NAME_TO_SOC_OP_TYPE_MAP { <nl> { " NoOp " , SupportedOpType : : NOP } , <nl> { IGraphTransferOpsDefinitions : : FLATTEN_OP_NAME , SupportedOpType : : FLATTEN } , <nl> / / Tensorflow op name <nl> + { " Const " , SupportedOpType : : OP_CONST } , <nl> { " QuantizedConv2D " , SupportedOpType : : QUANTIZEDCONV2D_8X8TO32 } , <nl> { " QuantizedMatMul " , SupportedOpType : : QUANTIZEDMATMUL_8X8TO32 } , <nl> { " QuantizeDownAndShrinkRange " , <nl>
Add a utility to check ops in a graph are supported on hvx
tensorflow/tensorflow
75fa9ea1acd363b6f1770a714a9391890993d0d5
2017-04-11T03:34:43Z
mmm a / src / ast / ast . h <nl> ppp b / src / ast / ast . h <nl> class ObjectLiteral final : public AggregateLiteral { <nl> void set_has_null_protoype ( bool has_null_prototype ) { <nl> bit_field_ = HasNullPrototypeField : : update ( bit_field_ , has_null_prototype ) ; <nl> } <nl> - <nl> uint32_t boilerplate_properties_ ; <nl> Handle < ObjectBoilerplateDescription > boilerplate_description_ ; <nl> ZoneList < Property * > properties_ ; <nl> mmm a / src / ast / prettyprinter . cc <nl> ppp b / src / ast / prettyprinter . cc <nl> CallPrinter : : CallPrinter ( Isolate * isolate , bool is_user_js ) <nl> is_call_error_ = false ; <nl> is_iterator_error_ = false ; <nl> is_async_iterator_error_ = false ; <nl> + destructuring_prop_ = nullptr ; <nl> + destructuring_assignment_ = nullptr ; <nl> is_user_js_ = is_user_js ; <nl> function_kind_ = kNormalFunction ; <nl> InitializeAstVisitor ( isolate ) ; <nl> void CallPrinter : : VisitVariableProxy ( VariableProxy * node ) { <nl> <nl> <nl> void CallPrinter : : VisitAssignment ( Assignment * node ) { <nl> - Find ( node - > target ( ) ) ; <nl> - if ( node - > target ( ) - > IsArrayLiteral ( ) ) { <nl> - / / Special case the visit for destructuring array assignment . <nl> - bool was_found = false ; <nl> - if ( node - > value ( ) - > position ( ) = = position_ ) { <nl> - is_iterator_error_ = true ; <nl> + bool was_found = false ; <nl> + if ( node - > target ( ) - > IsObjectLiteral ( ) ) { <nl> + ObjectLiteral * target = node - > target ( ) - > AsObjectLiteral ( ) ; <nl> + if ( target - > position ( ) = = position_ ) { <nl> was_found = ! found_ ; <nl> - if ( was_found ) { <nl> - found_ = true ; <nl> + found_ = true ; <nl> + destructuring_assignment_ = node ; <nl> + } else { <nl> + for ( ObjectLiteralProperty * prop : * target - > properties ( ) ) { <nl> + if ( prop - > value ( ) - > position ( ) = = position_ ) { <nl> + was_found = ! found_ ; <nl> + found_ = true ; <nl> + destructuring_prop_ = prop ; <nl> + destructuring_assignment_ = node ; <nl> + break ; <nl> + } <nl> } <nl> } <nl> - Find ( node - > value ( ) , true ) ; <nl> - if ( was_found ) { <nl> - done_ = true ; <nl> - found_ = false ; <nl> + } <nl> + if ( ! was_found ) { <nl> + Find ( node - > target ( ) ) ; <nl> + if ( node - > target ( ) - > IsArrayLiteral ( ) ) { <nl> + / / Special case the visit for destructuring array assignment . <nl> + bool was_found = false ; <nl> + if ( node - > value ( ) - > position ( ) = = position_ ) { <nl> + is_iterator_error_ = true ; <nl> + was_found = ! found_ ; <nl> + found_ = true ; <nl> + } <nl> + Find ( node - > value ( ) , true ) ; <nl> + if ( was_found ) { <nl> + done_ = true ; <nl> + found_ = false ; <nl> + } <nl> + } else { <nl> + Find ( node - > value ( ) ) ; <nl> } <nl> } else { <nl> - Find ( node - > value ( ) ) ; <nl> + Find ( node - > value ( ) , true ) ; <nl> + } <nl> + <nl> + if ( was_found ) { <nl> + done_ = true ; <nl> + found_ = false ; <nl> } <nl> } <nl> <nl> mmm a / src / ast / prettyprinter . h <nl> ppp b / src / ast / prettyprinter . h <nl> class CallPrinter final : public AstVisitor < CallPrinter > { <nl> kCallAndAsyncIterator <nl> } ; <nl> ErrorHint GetErrorHint ( ) const ; <nl> + ObjectLiteralProperty * destructuring_prop ( ) const { <nl> + return destructuring_prop_ ; <nl> + } <nl> + Assignment * destructuring_assignment ( ) const { <nl> + return destructuring_assignment_ ; <nl> + } <nl> <nl> / / Individual nodes <nl> # define DECLARE_VISIT ( type ) void Visit # # type ( type * node ) ; <nl> class CallPrinter final : public AstVisitor < CallPrinter > { <nl> bool is_iterator_error_ ; <nl> bool is_async_iterator_error_ ; <nl> bool is_call_error_ ; <nl> + ObjectLiteralProperty * destructuring_prop_ ; <nl> + Assignment * destructuring_assignment_ ; <nl> FunctionKind function_kind_ ; <nl> DEFINE_AST_VISITOR_SUBCLASS_MEMBERS ( ) ; <nl> <nl> mmm a / src / common / message - template . h <nl> ppp b / src / common / message - template . h <nl> namespace internal { <nl> T ( NoAccess , " no access " ) \ <nl> T ( NonCallableInInstanceOfCheck , \ <nl> " Right - hand side of ' instanceof ' is not callable " ) \ <nl> - T ( NonCoercible , " Cannot destructure ' undefined ' or ' null ' . " ) \ <nl> + T ( NonCoercible , " Cannot destructure ' % ' as it is % . " ) \ <nl> T ( NonCoercibleWithProperty , \ <nl> - " Cannot destructure property ` % ` of ' undefined ' or ' null ' . " ) \ <nl> + " Cannot destructure property ' % ' of ' % ' as it is % . " ) \ <nl> T ( NonExtensibleProto , " % is not extensible " ) \ <nl> T ( NonObjectInInstanceOfCheck , \ <nl> " Right - hand side of ' instanceof ' is not an object " ) \ <nl> mmm a / src / execution / messages . cc <nl> ppp b / src / execution / messages . cc <nl> <nl> # include < memory > <nl> <nl> # include " src / api / api - inl . h " <nl> + # include " src / ast / ast . h " <nl> + # include " src / ast / prettyprinter . h " <nl> # include " src / base / v8 - fallthrough . h " <nl> # include " src / execution / execution . h " <nl> + # include " src / execution / frames - inl . h " <nl> # include " src / execution / frames . h " <nl> # include " src / execution / isolate - inl . h " <nl> # include " src / logging / counters . h " <nl> <nl> # include " src / objects / keys . h " <nl> # include " src / objects / stack - frame - info - inl . h " <nl> # include " src / objects / struct - inl . h " <nl> + # include " src / parsing / parse - info . h " <nl> + # include " src / parsing / parsing . h " <nl> + # include " src / roots / roots . h " <nl> # include " src / strings / string - builder - inl . h " <nl> # include " src / wasm / wasm - code - manager . h " <nl> # include " src / wasm / wasm - objects . h " <nl> MaybeHandle < Object > ErrorUtils : : MakeGenericError ( <nl> no_caller , StackTraceCollection : : kDetailed ) ; <nl> } <nl> <nl> + namespace { <nl> + <nl> + bool ComputeLocation ( Isolate * isolate , MessageLocation * target ) { <nl> + JavaScriptFrameIterator it ( isolate ) ; <nl> + if ( ! it . done ( ) ) { <nl> + / / Compute the location from the function and the relocation info of the <nl> + / / baseline code . For optimized code this will use the deoptimization <nl> + / / information to get canonical location information . <nl> + std : : vector < FrameSummary > frames ; <nl> + it . frame ( ) - > Summarize ( & frames ) ; <nl> + auto & summary = frames . back ( ) . AsJavaScript ( ) ; <nl> + Handle < SharedFunctionInfo > shared ( summary . function ( ) - > shared ( ) , isolate ) ; <nl> + Handle < Object > script ( shared - > script ( ) , isolate ) ; <nl> + SharedFunctionInfo : : EnsureSourcePositionsAvailable ( isolate , shared ) ; <nl> + int pos = summary . abstract_code ( ) - > SourcePosition ( summary . code_offset ( ) ) ; <nl> + if ( script - > IsScript ( ) & & <nl> + ! ( Handle < Script > : : cast ( script ) - > source ( ) . IsUndefined ( isolate ) ) ) { <nl> + Handle < Script > casted_script = Handle < Script > : : cast ( script ) ; <nl> + * target = MessageLocation ( casted_script , pos , pos + 1 , shared ) ; <nl> + return true ; <nl> + } <nl> + } <nl> + return false ; <nl> + } <nl> + <nl> + Handle < String > BuildDefaultCallSite ( Isolate * isolate , Handle < Object > object ) { <nl> + IncrementalStringBuilder builder ( isolate ) ; <nl> + <nl> + builder . AppendString ( Object : : TypeOf ( isolate , object ) ) ; <nl> + if ( object - > IsString ( ) ) { <nl> + builder . AppendCString ( " \ " " ) ; <nl> + builder . AppendString ( Handle < String > : : cast ( object ) ) ; <nl> + builder . AppendCString ( " \ " " ) ; <nl> + } else if ( object - > IsNull ( isolate ) ) { <nl> + builder . AppendCString ( " " ) ; <nl> + builder . AppendString ( isolate - > factory ( ) - > null_string ( ) ) ; <nl> + } else if ( object - > IsTrue ( isolate ) ) { <nl> + builder . AppendCString ( " " ) ; <nl> + builder . AppendString ( isolate - > factory ( ) - > true_string ( ) ) ; <nl> + } else if ( object - > IsFalse ( isolate ) ) { <nl> + builder . AppendCString ( " " ) ; <nl> + builder . AppendString ( isolate - > factory ( ) - > false_string ( ) ) ; <nl> + } else if ( object - > IsNumber ( ) ) { <nl> + builder . AppendCString ( " " ) ; <nl> + builder . AppendString ( isolate - > factory ( ) - > NumberToString ( object ) ) ; <nl> + } <nl> + <nl> + return builder . Finish ( ) . ToHandleChecked ( ) ; <nl> + } <nl> + <nl> + Handle < String > RenderCallSite ( Isolate * isolate , Handle < Object > object , <nl> + MessageLocation * location , <nl> + CallPrinter : : ErrorHint * hint ) { <nl> + if ( ComputeLocation ( isolate , location ) ) { <nl> + ParseInfo info ( isolate , location - > shared ( ) ) ; <nl> + if ( parsing : : ParseAny ( & info , location - > shared ( ) , isolate ) ) { <nl> + info . ast_value_factory ( ) - > Internalize ( isolate ) ; <nl> + CallPrinter printer ( isolate , location - > shared ( ) - > IsUserJavaScript ( ) ) ; <nl> + Handle < String > str = printer . Print ( info . literal ( ) , location - > start_pos ( ) ) ; <nl> + * hint = printer . GetErrorHint ( ) ; <nl> + if ( str - > length ( ) > 0 ) return str ; <nl> + } else { <nl> + isolate - > clear_pending_exception ( ) ; <nl> + } <nl> + } <nl> + return BuildDefaultCallSite ( isolate , object ) ; <nl> + } <nl> + <nl> + MessageTemplate UpdateErrorTemplate ( CallPrinter : : ErrorHint hint , <nl> + MessageTemplate default_id ) { <nl> + switch ( hint ) { <nl> + case CallPrinter : : ErrorHint : : kNormalIterator : <nl> + return MessageTemplate : : kNotIterable ; <nl> + <nl> + case CallPrinter : : ErrorHint : : kCallAndNormalIterator : <nl> + return MessageTemplate : : kNotCallableOrIterable ; <nl> + <nl> + case CallPrinter : : ErrorHint : : kAsyncIterator : <nl> + return MessageTemplate : : kNotAsyncIterable ; <nl> + <nl> + case CallPrinter : : ErrorHint : : kCallAndAsyncIterator : <nl> + return MessageTemplate : : kNotCallableOrAsyncIterable ; <nl> + <nl> + case CallPrinter : : ErrorHint : : kNone : <nl> + return default_id ; <nl> + } <nl> + return default_id ; <nl> + } <nl> + <nl> + } / / namespace <nl> + <nl> + Handle < Object > ErrorUtils : : NewIteratorError ( Isolate * isolate , <nl> + Handle < Object > source ) { <nl> + MessageLocation location ; <nl> + CallPrinter : : ErrorHint hint = CallPrinter : : kNone ; <nl> + Handle < String > callsite = RenderCallSite ( isolate , source , & location , & hint ) ; <nl> + MessageTemplate id = MessageTemplate : : kNotIterableNoSymbolLoad ; <nl> + <nl> + if ( hint = = CallPrinter : : kNone ) { <nl> + Handle < Symbol > iterator_symbol = isolate - > factory ( ) - > iterator_symbol ( ) ; <nl> + return isolate - > factory ( ) - > NewTypeError ( id , callsite , iterator_symbol ) ; <nl> + } <nl> + <nl> + id = UpdateErrorTemplate ( hint , id ) ; <nl> + return isolate - > factory ( ) - > NewTypeError ( id , callsite ) ; <nl> + } <nl> + <nl> + Handle < Object > ErrorUtils : : NewCalledNonCallableError ( Isolate * isolate , <nl> + Handle < Object > source ) { <nl> + MessageLocation location ; <nl> + CallPrinter : : ErrorHint hint = CallPrinter : : kNone ; <nl> + Handle < String > callsite = RenderCallSite ( isolate , source , & location , & hint ) ; <nl> + MessageTemplate id = MessageTemplate : : kCalledNonCallable ; <nl> + id = UpdateErrorTemplate ( hint , id ) ; <nl> + return isolate - > factory ( ) - > NewTypeError ( id , callsite ) ; <nl> + } <nl> + <nl> + Handle < Object > ErrorUtils : : NewConstructedNonConstructable ( <nl> + Isolate * isolate , Handle < Object > source ) { <nl> + MessageLocation location ; <nl> + CallPrinter : : ErrorHint hint = CallPrinter : : kNone ; <nl> + Handle < String > callsite = RenderCallSite ( isolate , source , & location , & hint ) ; <nl> + MessageTemplate id = MessageTemplate : : kNotConstructor ; <nl> + return isolate - > factory ( ) - > NewTypeError ( id , callsite ) ; <nl> + } <nl> + <nl> + Object ErrorUtils : : ThrowLoadFromNullOrUndefined ( Isolate * isolate , <nl> + Handle < Object > object ) { <nl> + return ThrowLoadFromNullOrUndefined ( isolate , object , MaybeHandle < Object > ( ) ) ; <nl> + } <nl> + Object ErrorUtils : : ThrowLoadFromNullOrUndefined ( Isolate * isolate , <nl> + Handle < Object > object , <nl> + MaybeHandle < Object > key ) { <nl> + DCHECK ( object - > IsNullOrUndefined ( ) ) ; <nl> + <nl> + MaybeHandle < String > maybe_property_name ; <nl> + <nl> + / / Try to extract the property name from the given key , if any . <nl> + Handle < Object > key_handle ; <nl> + if ( key . ToHandle ( & key_handle ) ) { <nl> + if ( key_handle - > IsString ( ) ) { <nl> + maybe_property_name = Handle < String > : : cast ( key_handle ) ; <nl> + } <nl> + } <nl> + <nl> + Handle < String > callsite ; <nl> + <nl> + / / Inline the RenderCallSite logic here so that we can additonally access the <nl> + / / destructuring property . <nl> + bool location_computed = false ; <nl> + bool is_destructuring = false ; <nl> + MessageLocation location ; <nl> + if ( ComputeLocation ( isolate , & location ) ) { <nl> + location_computed = true ; <nl> + <nl> + ParseInfo info ( isolate , location . shared ( ) ) ; <nl> + if ( parsing : : ParseAny ( & info , location . shared ( ) , isolate ) ) { <nl> + info . ast_value_factory ( ) - > Internalize ( isolate ) ; <nl> + CallPrinter printer ( isolate , location . shared ( ) - > IsUserJavaScript ( ) ) ; <nl> + Handle < String > str = printer . Print ( info . literal ( ) , location . start_pos ( ) ) ; <nl> + <nl> + int pos = - 1 ; <nl> + is_destructuring = printer . destructuring_assignment ( ) ! = nullptr ; <nl> + <nl> + if ( is_destructuring ) { <nl> + / / If we don ' t have one yet , try to extract the property name from the <nl> + / / destructuring property in the AST . <nl> + ObjectLiteralProperty * destructuring_prop = <nl> + printer . destructuring_prop ( ) ; <nl> + if ( maybe_property_name . is_null ( ) & & destructuring_prop ! = nullptr & & <nl> + destructuring_prop - > key ( ) - > IsPropertyName ( ) ) { <nl> + maybe_property_name = destructuring_prop - > key ( ) <nl> + - > AsLiteral ( ) <nl> + - > AsRawPropertyName ( ) <nl> + - > string ( ) ; <nl> + / / Change the message location to point at the property name . <nl> + pos = destructuring_prop - > key ( ) - > position ( ) ; <nl> + } <nl> + if ( maybe_property_name . is_null ( ) ) { <nl> + / / Change the message location to point at the destructured value . <nl> + pos = printer . destructuring_assignment ( ) - > value ( ) - > position ( ) ; <nl> + } <nl> + <nl> + / / If we updated the pos to a valid pos , rewrite the location . <nl> + if ( pos ! = - 1 ) { <nl> + location = MessageLocation ( location . script ( ) , pos , pos + 1 , <nl> + location . shared ( ) ) ; <nl> + } <nl> + } <nl> + <nl> + if ( str - > length ( ) > 0 ) callsite = str ; <nl> + } else { <nl> + isolate - > clear_pending_exception ( ) ; <nl> + } <nl> + } <nl> + <nl> + if ( callsite . is_null ( ) ) { <nl> + callsite = BuildDefaultCallSite ( isolate , object ) ; <nl> + } <nl> + <nl> + Handle < Object > error ; <nl> + Handle < String > property_name ; <nl> + if ( is_destructuring ) { <nl> + if ( maybe_property_name . ToHandle ( & property_name ) ) { <nl> + error = isolate - > factory ( ) - > NewTypeError ( <nl> + MessageTemplate : : kNonCoercibleWithProperty , property_name , callsite , <nl> + object ) ; <nl> + } else { <nl> + error = isolate - > factory ( ) - > NewTypeError ( MessageTemplate : : kNonCoercible , <nl> + callsite , object ) ; <nl> + } <nl> + } else { <nl> + Handle < Object > key_handle ; <nl> + if ( ! key . ToHandle ( & key_handle ) ) { <nl> + key_handle = ReadOnlyRoots ( isolate ) . undefined_value_handle ( ) ; <nl> + } <nl> + if ( * key_handle = = ReadOnlyRoots ( isolate ) . iterator_symbol ( ) ) { <nl> + error = NewIteratorError ( isolate , object ) ; <nl> + } else { <nl> + error = isolate - > factory ( ) - > NewTypeError ( <nl> + MessageTemplate : : kNonObjectPropertyLoad , key_handle , object ) ; <nl> + } <nl> + } <nl> + <nl> + return isolate - > Throw ( * error , location_computed ? & location : nullptr ) ; <nl> + } <nl> + <nl> } / / namespace internal <nl> } / / namespace v8 <nl> mmm a / src / execution / messages . h <nl> ppp b / src / execution / messages . h <nl> class ErrorUtils : public AllStatic { <nl> static MaybeHandle < Object > FormatStackTrace ( Isolate * isolate , <nl> Handle < JSObject > error , <nl> Handle < Object > stack_trace ) ; <nl> + <nl> + static Handle < Object > NewIteratorError ( Isolate * isolate , <nl> + Handle < Object > source ) ; <nl> + static Handle < Object > NewCalledNonCallableError ( Isolate * isolate , <nl> + Handle < Object > source ) ; <nl> + static Handle < Object > NewConstructedNonConstructable ( Isolate * isolate , <nl> + Handle < Object > source ) ; <nl> + static Object ThrowLoadFromNullOrUndefined ( Isolate * isolate , <nl> + Handle < Object > object ) ; <nl> + static Object ThrowLoadFromNullOrUndefined ( Isolate * isolate , <nl> + Handle < Object > object , <nl> + MaybeHandle < Object > key ) ; <nl> } ; <nl> <nl> class MessageFormatter { <nl> mmm a / src / ic / ic . cc <nl> ppp b / src / ic / ic . cc <nl> <nl> # include " src / execution / execution . h " <nl> # include " src / execution / frames - inl . h " <nl> # include " src / execution / isolate - inl . h " <nl> + # include " src / execution / runtime - profiler . h " <nl> # include " src / handles / handles - inl . h " <nl> # include " src / ic / call - optimization . h " <nl> # include " src / ic / handler - configuration - inl . h " <nl> <nl> # include " src / objects / heap - number - inl . h " <nl> # include " src / objects / js - array - inl . h " <nl> # include " src / objects / module - inl . h " <nl> - # include " src / objects / struct - inl . h " <nl> - # include " src / utils / ostreams . h " <nl> - # include " src / execution / runtime - profiler . h " <nl> # include " src / objects / prototype . h " <nl> + # include " src / objects / struct - inl . h " <nl> # include " src / runtime / runtime - utils . h " <nl> # include " src / runtime / runtime . h " <nl> # include " src / tracing / trace - event . h " <nl> # include " src / tracing / tracing - category - observer . h " <nl> + # include " src / utils / ostreams . h " <nl> <nl> namespace v8 { <nl> namespace internal { <nl> MaybeHandle < Object > LoadIC : : Load ( Handle < Object > object , Handle < Name > name ) { <nl> } <nl> <nl> if ( * name = = ReadOnlyRoots ( isolate ( ) ) . iterator_symbol ( ) ) { <nl> - return Runtime : : ThrowIteratorError ( isolate ( ) , object ) ; <nl> + return isolate ( ) - > Throw < Object > ( <nl> + ErrorUtils : : NewIteratorError ( isolate ( ) , object ) ) ; <nl> + } <nl> + <nl> + if ( IsAnyHas ( ) ) { <nl> + return TypeError ( MessageTemplate : : kInvalidInOperatorUse , object , name ) ; <nl> + } else { <nl> + DCHECK ( object - > IsNullOrUndefined ( isolate ( ) ) ) ; <nl> + ErrorUtils : : ThrowLoadFromNullOrUndefined ( isolate ( ) , object , name ) ; <nl> + return MaybeHandle < Object > ( ) ; <nl> } <nl> - return TypeError ( IsAnyHas ( ) ? MessageTemplate : : kInvalidInOperatorUse <nl> - : MessageTemplate : : kNonObjectPropertyLoad , <nl> - object , name ) ; <nl> } <nl> <nl> if ( MigrateDeprecated ( isolate ( ) , object ) ) use_ic = false ; <nl> mmm a / src / interpreter / bytecode - generator . cc <nl> ppp b / src / interpreter / bytecode - generator . cc <nl> void BytecodeGenerator : : BuildDestructuringObjectAssignment ( <nl> LookupHoistingMode lookup_hoisting_mode ) { <nl> RegisterAllocationScope scope ( this ) ; <nl> <nl> - / / if ( value = = = null | | value = = = undefined ) <nl> - / / throw new TypeError ( kNonCoercible ) ; <nl> - / / <nl> - / / TODO ( leszeks ) : Eliminate check if value is known to be non - null ( e . g . <nl> - / / an object literal ) . <nl> - BytecodeLabel is_null_or_undefined , not_null_or_undefined ; <nl> - builder ( ) <nl> - - > JumpIfNull ( & is_null_or_undefined ) <nl> - . JumpIfNotUndefined ( & not_null_or_undefined ) ; <nl> - <nl> - { <nl> - builder ( ) - > Bind ( & is_null_or_undefined ) ; <nl> - builder ( ) - > SetExpressionPosition ( pattern ) ; <nl> - builder ( ) - > CallRuntime ( Runtime : : kThrowPatternAssignmentNonCoercible ) ; <nl> - } <nl> - <nl> / / Store the assignment value in a register . <nl> Register value ; <nl> RegisterList rest_runtime_callargs ; <nl> void BytecodeGenerator : : BuildDestructuringObjectAssignment ( <nl> } else { <nl> value = register_allocator ( ) - > NewRegister ( ) ; <nl> } <nl> - builder ( ) - > Bind ( & not_null_or_undefined ) . StoreAccumulatorInRegister ( value ) ; <nl> + builder ( ) - > StoreAccumulatorInRegister ( value ) ; <nl> + <nl> + / / if ( value = = = null | | value = = = undefined ) <nl> + / / throw new TypeError ( kNonCoercible ) ; <nl> + / / <nl> + / / Since the first property access on null / undefined will also trigger a <nl> + / / TypeError , we can elide this check . The exception is when there are no <nl> + / / properties and no rest property ( this is an empty literal ) , or when the <nl> + / / first property is a computed name and accessing it can have side effects . <nl> + / / <nl> + / / TODO ( leszeks ) : Also eliminate this check if the value is known to be <nl> + / / non - null ( e . g . an object literal ) . <nl> + if ( pattern - > properties ( ) - > is_empty ( ) | | <nl> + ( pattern - > properties ( ) - > at ( 0 ) - > is_computed_name ( ) & & <nl> + pattern - > properties ( ) - > at ( 0 ) - > kind ( ) ! = ObjectLiteralProperty : : SPREAD ) ) { <nl> + BytecodeLabel is_null_or_undefined , not_null_or_undefined ; <nl> + builder ( ) <nl> + - > JumpIfUndefinedOrNull ( & is_null_or_undefined ) <nl> + . Jump ( & not_null_or_undefined ) ; <nl> + <nl> + { <nl> + builder ( ) - > Bind ( & is_null_or_undefined ) ; <nl> + builder ( ) - > SetExpressionPosition ( pattern ) ; <nl> + builder ( ) - > CallRuntime ( Runtime : : kThrowPatternAssignmentNonCoercible , <nl> + value ) ; <nl> + } <nl> + builder ( ) - > Bind ( & not_null_or_undefined ) ; <nl> + } <nl> <nl> int i = 0 ; <nl> for ( ObjectLiteralProperty * pattern_property : * pattern - > properties ( ) ) { <nl> mmm a / src / runtime / runtime - internal . cc <nl> ppp b / src / runtime / runtime - internal . cc <nl> <nl> # include " src / execution / arguments - inl . h " <nl> # include " src / execution / frames - inl . h " <nl> # include " src / execution / isolate - inl . h " <nl> + # include " src / execution / messages . h " <nl> + # include " src / handles / maybe - handles . h " <nl> # include " src / init / bootstrapper . h " <nl> # include " src / logging / counters . h " <nl> # include " src / numbers / conversions . h " <nl> RUNTIME_FUNCTION ( Runtime_AllocateSeqTwoByteString ) { <nl> return * result ; <nl> } <nl> <nl> - namespace { <nl> - <nl> - bool ComputeLocation ( Isolate * isolate , MessageLocation * target ) { <nl> - JavaScriptFrameIterator it ( isolate ) ; <nl> - if ( ! it . done ( ) ) { <nl> - / / Compute the location from the function and the relocation info of the <nl> - / / baseline code . For optimized code this will use the deoptimization <nl> - / / information to get canonical location information . <nl> - std : : vector < FrameSummary > frames ; <nl> - it . frame ( ) - > Summarize ( & frames ) ; <nl> - auto & summary = frames . back ( ) . AsJavaScript ( ) ; <nl> - Handle < SharedFunctionInfo > shared ( summary . function ( ) - > shared ( ) , isolate ) ; <nl> - Handle < Object > script ( shared - > script ( ) , isolate ) ; <nl> - SharedFunctionInfo : : EnsureSourcePositionsAvailable ( isolate , shared ) ; <nl> - int pos = summary . abstract_code ( ) - > SourcePosition ( summary . code_offset ( ) ) ; <nl> - if ( script - > IsScript ( ) & & <nl> - ! ( Handle < Script > : : cast ( script ) - > source ( ) . IsUndefined ( isolate ) ) ) { <nl> - Handle < Script > casted_script = Handle < Script > : : cast ( script ) ; <nl> - * target = MessageLocation ( casted_script , pos , pos + 1 , shared ) ; <nl> - return true ; <nl> - } <nl> - } <nl> - return false ; <nl> - } <nl> - <nl> - Handle < String > BuildDefaultCallSite ( Isolate * isolate , Handle < Object > object ) { <nl> - IncrementalStringBuilder builder ( isolate ) ; <nl> - <nl> - builder . AppendString ( Object : : TypeOf ( isolate , object ) ) ; <nl> - if ( object - > IsString ( ) ) { <nl> - builder . AppendCString ( " \ " " ) ; <nl> - builder . AppendString ( Handle < String > : : cast ( object ) ) ; <nl> - builder . AppendCString ( " \ " " ) ; <nl> - } else if ( object - > IsNull ( isolate ) ) { <nl> - builder . AppendCString ( " " ) ; <nl> - builder . AppendString ( isolate - > factory ( ) - > null_string ( ) ) ; <nl> - } else if ( object - > IsTrue ( isolate ) ) { <nl> - builder . AppendCString ( " " ) ; <nl> - builder . AppendString ( isolate - > factory ( ) - > true_string ( ) ) ; <nl> - } else if ( object - > IsFalse ( isolate ) ) { <nl> - builder . AppendCString ( " " ) ; <nl> - builder . AppendString ( isolate - > factory ( ) - > false_string ( ) ) ; <nl> - } else if ( object - > IsNumber ( ) ) { <nl> - builder . AppendCString ( " " ) ; <nl> - builder . AppendString ( isolate - > factory ( ) - > NumberToString ( object ) ) ; <nl> - } <nl> - <nl> - return builder . Finish ( ) . ToHandleChecked ( ) ; <nl> - } <nl> - <nl> - Handle < String > RenderCallSite ( Isolate * isolate , Handle < Object > object , <nl> - CallPrinter : : ErrorHint * hint ) { <nl> - MessageLocation location ; <nl> - if ( ComputeLocation ( isolate , & location ) ) { <nl> - ParseInfo info ( isolate , location . shared ( ) ) ; <nl> - if ( parsing : : ParseAny ( & info , location . shared ( ) , isolate ) ) { <nl> - info . ast_value_factory ( ) - > Internalize ( isolate ) ; <nl> - CallPrinter printer ( isolate , location . shared ( ) - > IsUserJavaScript ( ) ) ; <nl> - Handle < String > str = printer . Print ( info . literal ( ) , location . start_pos ( ) ) ; <nl> - * hint = printer . GetErrorHint ( ) ; <nl> - if ( str - > length ( ) > 0 ) return str ; <nl> - } else { <nl> - isolate - > clear_pending_exception ( ) ; <nl> - } <nl> - } <nl> - return BuildDefaultCallSite ( isolate , object ) ; <nl> - } <nl> - <nl> - MessageTemplate UpdateErrorTemplate ( CallPrinter : : ErrorHint hint , <nl> - MessageTemplate default_id ) { <nl> - switch ( hint ) { <nl> - case CallPrinter : : ErrorHint : : kNormalIterator : <nl> - return MessageTemplate : : kNotIterable ; <nl> - <nl> - case CallPrinter : : ErrorHint : : kCallAndNormalIterator : <nl> - return MessageTemplate : : kNotCallableOrIterable ; <nl> - <nl> - case CallPrinter : : ErrorHint : : kAsyncIterator : <nl> - return MessageTemplate : : kNotAsyncIterable ; <nl> - <nl> - case CallPrinter : : ErrorHint : : kCallAndAsyncIterator : <nl> - return MessageTemplate : : kNotCallableOrAsyncIterable ; <nl> - <nl> - case CallPrinter : : ErrorHint : : kNone : <nl> - return default_id ; <nl> - } <nl> - return default_id ; <nl> - } <nl> - <nl> - } / / namespace <nl> - <nl> - MaybeHandle < Object > Runtime : : ThrowIteratorError ( Isolate * isolate , <nl> - Handle < Object > object ) { <nl> - CallPrinter : : ErrorHint hint = CallPrinter : : kNone ; <nl> - Handle < String > callsite = RenderCallSite ( isolate , object , & hint ) ; <nl> - MessageTemplate id = MessageTemplate : : kNotIterableNoSymbolLoad ; <nl> - <nl> - if ( hint = = CallPrinter : : kNone ) { <nl> - Handle < Symbol > iterator_symbol = isolate - > factory ( ) - > iterator_symbol ( ) ; <nl> - THROW_NEW_ERROR ( isolate , NewTypeError ( id , callsite , iterator_symbol ) , <nl> - Object ) ; <nl> - } <nl> - <nl> - id = UpdateErrorTemplate ( hint , id ) ; <nl> - THROW_NEW_ERROR ( isolate , NewTypeError ( id , callsite ) , Object ) ; <nl> - } <nl> - <nl> RUNTIME_FUNCTION ( Runtime_ThrowIteratorError ) { <nl> HandleScope scope ( isolate ) ; <nl> DCHECK_EQ ( 1 , args . length ( ) ) ; <nl> CONVERT_ARG_HANDLE_CHECKED ( Object , object , 0 ) ; <nl> - RETURN_RESULT_OR_FAILURE ( isolate , <nl> - Runtime : : ThrowIteratorError ( isolate , object ) ) ; <nl> + return isolate - > Throw ( * ErrorUtils : : NewIteratorError ( isolate , object ) ) ; <nl> } <nl> <nl> RUNTIME_FUNCTION ( Runtime_ThrowCalledNonCallable ) { <nl> HandleScope scope ( isolate ) ; <nl> DCHECK_EQ ( 1 , args . length ( ) ) ; <nl> CONVERT_ARG_HANDLE_CHECKED ( Object , object , 0 ) ; <nl> - CallPrinter : : ErrorHint hint = CallPrinter : : kNone ; <nl> - Handle < String > callsite = RenderCallSite ( isolate , object , & hint ) ; <nl> - MessageTemplate id = MessageTemplate : : kCalledNonCallable ; <nl> - id = UpdateErrorTemplate ( hint , id ) ; <nl> - THROW_NEW_ERROR_RETURN_FAILURE ( isolate , NewTypeError ( id , callsite ) ) ; <nl> + return isolate - > Throw ( <nl> + * ErrorUtils : : NewCalledNonCallableError ( isolate , object ) ) ; <nl> } <nl> <nl> RUNTIME_FUNCTION ( Runtime_ThrowConstructedNonConstructable ) { <nl> HandleScope scope ( isolate ) ; <nl> DCHECK_EQ ( 1 , args . length ( ) ) ; <nl> CONVERT_ARG_HANDLE_CHECKED ( Object , object , 0 ) ; <nl> - CallPrinter : : ErrorHint hint = CallPrinter : : kNone ; <nl> - Handle < String > callsite = RenderCallSite ( isolate , object , & hint ) ; <nl> - MessageTemplate id = MessageTemplate : : kNotConstructor ; <nl> - THROW_NEW_ERROR_RETURN_FAILURE ( isolate , NewTypeError ( id , callsite ) ) ; <nl> + return isolate - > Throw ( <nl> + * ErrorUtils : : NewConstructedNonConstructable ( isolate , object ) ) ; <nl> } <nl> <nl> - namespace { <nl> - <nl> - / / Helper visitor for ThrowPatternAssignmentNonCoercible which finds an <nl> - / / object literal ( representing a destructuring assignment ) at a given source <nl> - / / position . <nl> - class PatternFinder final : public AstTraversalVisitor < PatternFinder > { <nl> - public : <nl> - PatternFinder ( Isolate * isolate , Expression * root , int position ) <nl> - : AstTraversalVisitor ( isolate , root ) , <nl> - position_ ( position ) , <nl> - object_literal_ ( nullptr ) { } <nl> - <nl> - ObjectLiteral * object_literal ( ) const { return object_literal_ ; } <nl> - <nl> - private : <nl> - / / This is required so that the overriden Visit * methods can be <nl> - / / called by the base class ( template ) . <nl> - friend class AstTraversalVisitor < PatternFinder > ; <nl> - <nl> - void VisitObjectLiteral ( ObjectLiteral * lit ) { <nl> - / / TODO ( leszeks ) : This could be smarter in only traversing object literals <nl> - / / that are known to be a destructuring pattern . We could then also <nl> - / / potentially find the corresponding assignment value and report that too . <nl> - if ( lit - > position ( ) = = position_ ) { <nl> - object_literal_ = lit ; <nl> - return ; <nl> - } <nl> - AstTraversalVisitor : : VisitObjectLiteral ( lit ) ; <nl> - } <nl> - <nl> - int position_ ; <nl> - ObjectLiteral * object_literal_ ; <nl> - } ; <nl> - <nl> - } / / namespace <nl> - <nl> RUNTIME_FUNCTION ( Runtime_ThrowPatternAssignmentNonCoercible ) { <nl> HandleScope scope ( isolate ) ; <nl> - DCHECK_EQ ( 0 , args . length ( ) ) ; <nl> - <nl> - / / Find the object literal representing the destructuring assignment , so that <nl> - / / we can try to attribute the error to a property name on it rather than to <nl> - / / the literal itself . <nl> - MaybeHandle < String > maybe_property_name ; <nl> - MessageLocation location ; <nl> - if ( ComputeLocation ( isolate , & location ) ) { <nl> - ParseInfo info ( isolate , location . shared ( ) ) ; <nl> - if ( parsing : : ParseAny ( & info , location . shared ( ) , isolate ) ) { <nl> - info . ast_value_factory ( ) - > Internalize ( isolate ) ; <nl> - <nl> - PatternFinder finder ( isolate , info . literal ( ) , location . start_pos ( ) ) ; <nl> - finder . Run ( ) ; <nl> - if ( finder . object_literal ( ) ) { <nl> - for ( ObjectLiteralProperty * pattern_property : <nl> - * finder . object_literal ( ) - > properties ( ) ) { <nl> - Expression * key = pattern_property - > key ( ) ; <nl> - if ( key - > IsPropertyName ( ) ) { <nl> - int pos = key - > position ( ) ; <nl> - maybe_property_name = <nl> - key - > AsLiteral ( ) - > AsRawPropertyName ( ) - > string ( ) ; <nl> - / / Change the message location to point at the property name . <nl> - location = MessageLocation ( location . script ( ) , pos , pos + 1 , <nl> - location . shared ( ) ) ; <nl> - break ; <nl> - } <nl> - } <nl> - } <nl> - } else { <nl> - isolate - > clear_pending_exception ( ) ; <nl> - } <nl> - } <nl> - <nl> - / / Create a " non - coercible " type error with a property name if one is <nl> - / / available , otherwise create a generic one . <nl> - Handle < Object > error ; <nl> - Handle < String > property_name ; <nl> - if ( maybe_property_name . ToHandle ( & property_name ) ) { <nl> - error = isolate - > factory ( ) - > NewTypeError ( <nl> - MessageTemplate : : kNonCoercibleWithProperty , property_name ) ; <nl> - } else { <nl> - error = isolate - > factory ( ) - > NewTypeError ( MessageTemplate : : kNonCoercible ) ; <nl> - } <nl> - <nl> - / / Explicitly pass the calculated location , as we may have updated it to match <nl> - / / the property name . <nl> - return isolate - > Throw ( * error , & location ) ; <nl> + DCHECK_EQ ( 1 , args . length ( ) ) ; <nl> + CONVERT_ARG_HANDLE_CHECKED ( Object , object , 0 ) ; <nl> + return ErrorUtils : : ThrowLoadFromNullOrUndefined ( isolate , object , <nl> + MaybeHandle < Object > ( ) ) ; <nl> } <nl> <nl> RUNTIME_FUNCTION ( Runtime_ThrowConstructorReturnedNonObject ) { <nl> mmm a / src / runtime / runtime - object . cc <nl> ppp b / src / runtime / runtime - object . cc <nl> <nl> / / Use of this source code is governed by a BSD - style license that can be <nl> / / found in the LICENSE file . <nl> <nl> + # include " src / ast / prettyprinter . h " <nl> # include " src / common / message - template . h " <nl> # include " src / debug / debug . h " <nl> # include " src / execution / arguments - inl . h " <nl> # include " src / execution / isolate - inl . h " <nl> + # include " src / execution / messages . h " <nl> + # include " src / handles / maybe - handles . h " <nl> # include " src / heap / heap - inl . h " / / For ToBoolean . TODO ( jkummerow ) : Drop . <nl> # include " src / init / bootstrapper . h " <nl> # include " src / logging / counters . h " <nl> MaybeHandle < Object > Runtime : : GetObjectProperty ( Isolate * isolate , <nl> Handle < Object > key , <nl> bool * is_found_out ) { <nl> if ( object - > IsNullOrUndefined ( isolate ) ) { <nl> - if ( * key = = ReadOnlyRoots ( isolate ) . iterator_symbol ( ) ) { <nl> - return Runtime : : ThrowIteratorError ( isolate , object ) ; <nl> - } <nl> - THROW_NEW_ERROR ( <nl> - isolate , <nl> - NewTypeError ( MessageTemplate : : kNonObjectPropertyLoad , key , object ) , <nl> - Object ) ; <nl> + ErrorUtils : : ThrowLoadFromNullOrUndefined ( isolate , object , key ) ; <nl> + return MaybeHandle < Object > ( ) ; <nl> } <nl> <nl> bool success = false ; <nl> RUNTIME_FUNCTION ( Runtime_HasProperty ) { <nl> return isolate - > heap ( ) - > ToBoolean ( maybe . FromJust ( ) ) ; <nl> } <nl> <nl> - <nl> RUNTIME_FUNCTION ( Runtime_GetOwnPropertyKeys ) { <nl> HandleScope scope ( isolate ) ; <nl> DCHECK_EQ ( 2 , args . length ( ) ) ; <nl> RUNTIME_FUNCTION ( Runtime_GetOwnPropertyKeys ) { <nl> return * isolate - > factory ( ) - > NewJSArrayWithElements ( keys ) ; <nl> } <nl> <nl> - <nl> RUNTIME_FUNCTION ( Runtime_ToFastProperties ) { <nl> HandleScope scope ( isolate ) ; <nl> DCHECK_EQ ( 1 , args . length ( ) ) ; <nl> RUNTIME_FUNCTION ( Runtime_ToFastProperties ) { <nl> return * object ; <nl> } <nl> <nl> - <nl> RUNTIME_FUNCTION ( Runtime_AllocateHeapNumber ) { <nl> HandleScope scope ( isolate ) ; <nl> DCHECK_EQ ( 0 , args . length ( ) ) ; <nl> return * isolate - > factory ( ) - > NewHeapNumber ( 0 ) ; <nl> } <nl> <nl> - <nl> RUNTIME_FUNCTION ( Runtime_NewObject ) { <nl> HandleScope scope ( isolate ) ; <nl> DCHECK_EQ ( 2 , args . length ( ) ) ; <nl> RUNTIME_FUNCTION ( Runtime_CompleteInobjectSlackTrackingForMap ) { <nl> return ReadOnlyRoots ( isolate ) . undefined_value ( ) ; <nl> } <nl> <nl> - <nl> RUNTIME_FUNCTION ( Runtime_TryMigrateInstance ) { <nl> HandleScope scope ( isolate ) ; <nl> DCHECK_EQ ( 1 , args . length ( ) ) ; <nl> RUNTIME_FUNCTION ( Runtime_TryMigrateInstance ) { <nl> return * object ; <nl> } <nl> <nl> - <nl> static bool IsValidAccessor ( Isolate * isolate , Handle < Object > obj ) { <nl> return obj - > IsNullOrUndefined ( isolate ) | | obj - > IsCallable ( ) ; <nl> } <nl> <nl> - <nl> / / Implements part of 8 . 12 . 9 DefineOwnProperty . <nl> / / There are 3 cases that lead here : <nl> / / Step 4b - define a new accessor property . <nl> RUNTIME_FUNCTION ( Runtime_DefineAccessorPropertyUnchecked ) { <nl> return ReadOnlyRoots ( isolate ) . undefined_value ( ) ; <nl> } <nl> <nl> - <nl> RUNTIME_FUNCTION ( Runtime_DefineDataPropertyInLiteral ) { <nl> HandleScope scope ( isolate ) ; <nl> DCHECK_EQ ( 6 , args . length ( ) ) ; <nl> RUNTIME_FUNCTION ( Runtime_HasFastPackedElements ) { <nl> IsFastPackedElementsKind ( obj . map ( ) . elements_kind ( ) ) ) ; <nl> } <nl> <nl> - <nl> RUNTIME_FUNCTION ( Runtime_IsJSReceiver ) { <nl> SealHandleScope shs ( isolate ) ; <nl> DCHECK_EQ ( 1 , args . length ( ) ) ; <nl> RUNTIME_FUNCTION ( Runtime_IsJSReceiver ) { <nl> return isolate - > heap ( ) - > ToBoolean ( obj . IsJSReceiver ( ) ) ; <nl> } <nl> <nl> - <nl> RUNTIME_FUNCTION ( Runtime_ClassOf ) { <nl> SealHandleScope shs ( isolate ) ; <nl> DCHECK_EQ ( 1 , args . length ( ) ) ; <nl> RUNTIME_FUNCTION ( Runtime_CopyDataPropertiesWithExcludedProperties ) { <nl> DCHECK_LE ( 1 , args . length ( ) ) ; <nl> CONVERT_ARG_HANDLE_CHECKED ( Object , source , 0 ) ; <nl> <nl> - / / 2 . If source is undefined or null , let keys be an empty List . <nl> - if ( source - > IsUndefined ( isolate ) | | source - > IsNull ( isolate ) ) { <nl> - return ReadOnlyRoots ( isolate ) . undefined_value ( ) ; <nl> + / / If source is undefined or null , throw a non - coercible error . <nl> + if ( source - > IsNullOrUndefined ( isolate ) ) { <nl> + return ErrorUtils : : ThrowLoadFromNullOrUndefined ( isolate , source ) ; <nl> } <nl> <nl> ScopedVector < Handle < Object > > excluded_properties ( args . length ( ) - 1 ) ; <nl> RUNTIME_FUNCTION ( Runtime_ToNumeric ) { <nl> RETURN_RESULT_OR_FAILURE ( isolate , Object : : ToNumeric ( isolate , input ) ) ; <nl> } <nl> <nl> - <nl> RUNTIME_FUNCTION ( Runtime_ToLength ) { <nl> HandleScope scope ( isolate ) ; <nl> DCHECK_EQ ( 1 , args . length ( ) ) ; <nl> RUNTIME_FUNCTION ( Runtime_HasInPrototypeChain ) { <nl> return isolate - > heap ( ) - > ToBoolean ( result . FromJust ( ) ) ; <nl> } <nl> <nl> - <nl> / / ES6 section 7 . 4 . 7 CreateIterResultObject ( value , done ) <nl> RUNTIME_FUNCTION ( Runtime_CreateIterResultObject ) { <nl> HandleScope scope ( isolate ) ; <nl> mmm a / src / runtime / runtime . h <nl> ppp b / src / runtime / runtime . h <nl> namespace internal { <nl> / / inline ) , use the F macro below . To declare the runtime version and the inline <nl> / / version simultaneously , use the I macro below . <nl> <nl> - # define FOR_EACH_INTRINSIC_ARRAY ( F , I ) \ <nl> - F ( ArrayIncludes_Slow , 3 , 1 ) \ <nl> - F ( ArrayIndexOf , 3 , 1 ) \ <nl> - F ( ArrayIsArray , 1 , 1 ) \ <nl> - F ( ArraySpeciesConstructor , 1 , 1 ) \ <nl> - F ( GrowArrayElements , 2 , 1 ) \ <nl> - I ( IsArray , 1 , 1 ) \ <nl> - F ( NewArray , - 1 / * > = 3 * / , 1 ) \ <nl> - F ( NormalizeElements , 1 , 1 ) \ <nl> - F ( TransitionElementsKind , 2 , 1 ) \ <nl> - F ( TransitionElementsKindWithKind , 2 , 1 ) \ <nl> + # define FOR_EACH_INTRINSIC_ARRAY ( F , I ) \ <nl> + F ( ArrayIncludes_Slow , 3 , 1 ) \ <nl> + F ( ArrayIndexOf , 3 , 1 ) \ <nl> + F ( ArrayIsArray , 1 , 1 ) \ <nl> + F ( ArraySpeciesConstructor , 1 , 1 ) \ <nl> + F ( GrowArrayElements , 2 , 1 ) \ <nl> + I ( IsArray , 1 , 1 ) \ <nl> + F ( NewArray , - 1 / * > = 3 * / , 1 ) \ <nl> + F ( NormalizeElements , 1 , 1 ) \ <nl> + F ( TransitionElementsKind , 2 , 1 ) \ <nl> + F ( TransitionElementsKindWithKind , 2 , 1 ) <nl> <nl> # define FOR_EACH_INTRINSIC_ATOMICS ( F , I ) \ <nl> F ( AtomicsLoad64 , 2 , 1 ) \ <nl> namespace internal { <nl> F ( ThrowIteratorError , 1 , 1 ) \ <nl> F ( ThrowIteratorResultNotAnObject , 1 , 1 ) \ <nl> F ( ThrowNotConstructor , 1 , 1 ) \ <nl> - F ( ThrowPatternAssignmentNonCoercible , 0 , 1 ) \ <nl> + F ( ThrowPatternAssignmentNonCoercible , 1 , 1 ) \ <nl> F ( ThrowRangeError , - 1 / * > = 1 * / , 1 ) \ <nl> F ( ThrowReferenceError , 1 , 1 ) \ <nl> F ( ThrowAccessedUninitializedVariable , 1 , 1 ) \ <nl> class Runtime : public AllStatic { <nl> Isolate * isolate , Handle < Object > object ) ; <nl> } ; <nl> <nl> - <nl> class RuntimeState { <nl> public : <nl> # ifndef V8_INTL_SUPPORT <nl> mmm a / test / cctest / interpreter / bytecode_expectations / DestructuringAssignment . golden <nl> ppp b / test / cctest / interpreter / bytecode_expectations / DestructuringAssignment . golden <nl> snippet : " <nl> var x , a = { x : 1 } ; <nl> ( { x } = a ) ; <nl> " <nl> - frame size : 3 <nl> + frame size : 2 <nl> parameter count : 1 <nl> - bytecode array length : 26 <nl> + bytecode array length : 15 <nl> bytecodes : [ <nl> / * 30 E > * / B ( StackCheck ) , <nl> / * 45 S > * / B ( CreateObjectLiteral ) , U8 ( 0 ) , U8 ( 0 ) , U8 ( 41 ) , <nl> B ( Star ) , R ( 1 ) , <nl> - / * 52 S > * / B ( JumpIfNull ) , U8 ( 4 ) , <nl> - B ( JumpIfNotUndefined ) , U8 ( 7 ) , <nl> - / * 53 E > * / B ( CallRuntime ) , U16 ( Runtime : : kThrowPatternAssignmentNonCoercible ) , R ( 0 ) , U8 ( 0 ) , <nl> - B ( Star ) , R ( 2 ) , <nl> - / * 54 S > * / B ( LdaNamedProperty ) , R ( 2 ) , U8 ( 1 ) , U8 ( 1 ) , <nl> + / * 54 S > * / B ( LdaNamedProperty ) , R ( 1 ) , U8 ( 1 ) , U8 ( 1 ) , <nl> B ( Star ) , R ( 0 ) , <nl> B ( LdaUndefined ) , <nl> / * 63 S > * / B ( Return ) , <nl> snippet : " <nl> var x = { } , a = { y : 1 } ; <nl> ( { y : x . foo } = a ) ; <nl> " <nl> - frame size : 3 <nl> + frame size : 2 <nl> parameter count : 1 <nl> - bytecode array length : 31 <nl> + bytecode array length : 20 <nl> bytecodes : [ <nl> / * 30 E > * / B ( StackCheck ) , <nl> / * 40 S > * / B ( CreateEmptyObjectLiteral ) , <nl> B ( Star ) , R ( 0 ) , <nl> / * 48 S > * / B ( CreateObjectLiteral ) , U8 ( 0 ) , U8 ( 0 ) , U8 ( 41 ) , <nl> B ( Star ) , R ( 1 ) , <nl> - / * 55 S > * / B ( JumpIfNull ) , U8 ( 4 ) , <nl> - B ( JumpIfNotUndefined ) , U8 ( 7 ) , <nl> - / * 56 E > * / B ( CallRuntime ) , U16 ( Runtime : : kThrowPatternAssignmentNonCoercible ) , R ( 0 ) , U8 ( 0 ) , <nl> - / * 61 S > * / B ( Star ) , R ( 2 ) , <nl> - B ( LdaNamedProperty ) , R ( 2 ) , U8 ( 1 ) , U8 ( 1 ) , <nl> + / * 61 S > * / B ( LdaNamedProperty ) , R ( 1 ) , U8 ( 1 ) , U8 ( 1 ) , <nl> B ( StaNamedProperty ) , R ( 0 ) , U8 ( 2 ) , U8 ( 3 ) , <nl> B ( LdaUndefined ) , <nl> / * 72 S > * / B ( Return ) , <nl> snippet : " <nl> " <nl> frame size : 4 <nl> parameter count : 1 <nl> - bytecode array length : 41 <nl> + bytecode array length : 33 <nl> bytecodes : [ <nl> / * 30 E > * / B ( StackCheck ) , <nl> / * 45 S > * / B ( CreateObjectLiteral ) , U8 ( 0 ) , U8 ( 0 ) , U8 ( 41 ) , <nl> B ( Star ) , R ( 1 ) , <nl> - / * 62 S > * / B ( JumpIfNull ) , U8 ( 4 ) , <nl> - B ( JumpIfNotUndefined ) , U8 ( 7 ) , <nl> - / * 63 E > * / B ( CallRuntime ) , U16 ( Runtime : : kThrowPatternAssignmentNonCoercible ) , R ( 0 ) , U8 ( 0 ) , <nl> - B ( Star ) , R ( 2 ) , <nl> / * 64 S > * / B ( LdaConstant ) , U8 ( 1 ) , <nl> B ( Star ) , R ( 3 ) , <nl> - B ( LdaNamedProperty ) , R ( 2 ) , U8 ( 1 ) , U8 ( 1 ) , <nl> + B ( LdaNamedProperty ) , R ( 1 ) , U8 ( 1 ) , U8 ( 1 ) , <nl> + B ( Mov ) , R ( 1 ) , R ( 2 ) , <nl> B ( JumpIfNotUndefined ) , U8 ( 3 ) , <nl> B ( LdaZero ) , <nl> B ( Star ) , R ( 0 ) , <nl> mmm a / test / cctest / interpreter / bytecode_expectations / ForOfLoop . golden <nl> ppp b / test / cctest / interpreter / bytecode_expectations / ForOfLoop . golden <nl> snippet : " <nl> " <nl> frame size : 17 <nl> parameter count : 2 <nl> - bytecode array length : 191 <nl> + bytecode array length : 178 <nl> bytecodes : [ <nl> / * 10 E > * / B ( StackCheck ) , <nl> / * 41 S > * / B ( GetIterator ) , R ( arg0 ) , U8 ( 0 ) , <nl> bytecodes : [ <nl> B ( JumpIfJSReceiver ) , U8 ( 7 ) , <nl> B ( CallRuntime ) , U16 ( Runtime : : kThrowIteratorResultNotAnObject ) , R ( 12 ) , U8 ( 1 ) , <nl> B ( LdaNamedProperty ) , R ( 12 ) , U8 ( 1 ) , U8 ( 8 ) , <nl> - B ( JumpIfToBooleanTrue ) , U8 ( 50 ) , <nl> + B ( JumpIfToBooleanTrue ) , U8 ( 37 ) , <nl> B ( LdaNamedProperty ) , R ( 12 ) , U8 ( 2 ) , U8 ( 10 ) , <nl> B ( Star ) , R ( 12 ) , <nl> B ( LdaFalse ) , <nl> B ( Star ) , R ( 8 ) , <nl> B ( Mov ) , R ( 12 ) , R ( 0 ) , <nl> / * 20 E > * / B ( StackCheck ) , <nl> - / * 36 S > * / B ( Ldar ) , R ( 12 ) , <nl> - B ( JumpIfNull ) , U8 ( 4 ) , <nl> - B ( JumpIfNotUndefined ) , U8 ( 7 ) , <nl> - / * 29 E > * / B ( CallRuntime ) , U16 ( Runtime : : kThrowPatternAssignmentNonCoercible ) , R ( 0 ) , U8 ( 0 ) , <nl> - B ( Star ) , R ( 13 ) , <nl> - / * 31 S > * / B ( LdaNamedProperty ) , R ( 13 ) , U8 ( 3 ) , U8 ( 12 ) , <nl> + / * 31 S > * / B ( LdaNamedProperty ) , R ( 0 ) , U8 ( 3 ) , U8 ( 12 ) , <nl> B ( Star ) , R ( 3 ) , <nl> - / * 34 S > * / B ( LdaNamedProperty ) , R ( 13 ) , U8 ( 4 ) , U8 ( 14 ) , <nl> + / * 34 S > * / B ( LdaNamedProperty ) , R ( 0 ) , U8 ( 4 ) , U8 ( 14 ) , <nl> B ( Star ) , R ( 4 ) , <nl> / * 56 S > * / B ( Ldar ) , R ( 4 ) , <nl> / * 58 E > * / B ( Add ) , R ( 3 ) , U8 ( 16 ) , <nl> B ( Star ) , R ( 5 ) , <nl> - B ( JumpLoop ) , U8 ( 67 ) , I8 ( 0 ) , <nl> + B ( JumpLoop ) , U8 ( 54 ) , I8 ( 0 ) , <nl> B ( LdaSmi ) , I8 ( - 1 ) , <nl> B ( Star ) , R ( 10 ) , <nl> B ( Star ) , R ( 9 ) , <nl> constant pool : [ <nl> ONE_BYTE_INTERNALIZED_STRING_TYPE [ " " ] , <nl> ] <nl> handlers : [ <nl> - [ 31 , 101 , 109 ] , <nl> - [ 133 , 166 , 168 ] , <nl> + [ 31 , 88 , 96 ] , <nl> + [ 120 , 153 , 155 ] , <nl> ] <nl> <nl> mmm <nl> mmm a / test / cctest / interpreter / bytecode_expectations / StandardForLoop . golden <nl> ppp b / test / cctest / interpreter / bytecode_expectations / StandardForLoop . golden <nl> snippet : " <nl> " <nl> frame size : 4 <nl> parameter count : 1 <nl> - bytecode array length : 53 <nl> + bytecode array length : 44 <nl> bytecodes : [ <nl> / * 10 E > * / B ( StackCheck ) , <nl> / * 37 S > * / B ( CreateObjectLiteral ) , U8 ( 0 ) , U8 ( 0 ) , U8 ( 41 ) , <nl> - B ( JumpIfNull ) , U8 ( 4 ) , <nl> - B ( JumpIfNotUndefined ) , U8 ( 7 ) , <nl> - / * 26 E > * / B ( CallRuntime ) , U16 ( Runtime : : kThrowPatternAssignmentNonCoercible ) , R ( 0 ) , U8 ( 0 ) , <nl> B ( Star ) , R ( 3 ) , <nl> / * 28 S > * / B ( LdaNamedProperty ) , R ( 3 ) , U8 ( 1 ) , U8 ( 1 ) , <nl> B ( Star ) , R ( 0 ) , <nl> mmm a / test / message / fail / destructuring - undefined - computed - property . out <nl> ppp b / test / message / fail / destructuring - undefined - computed - property . out <nl> <nl> - * % ( basename ) s : 5 : TypeError : Cannot destructure ' undefined ' or ' null ' . <nl> + * % ( basename ) s : 5 : TypeError : Cannot destructure ' undefined ' as it is undefined . <nl> var { [ x ] : y } = undefined ; <nl> - ^ <nl> - TypeError : Cannot destructure ' undefined ' or ' null ' . <nl> + ^ <nl> + TypeError : Cannot destructure ' undefined ' as it is undefined . <nl> at * % ( basename ) s : 5 : 5 <nl> mmm a / test / message / fail / destructuring - undefined - number - property . out <nl> ppp b / test / message / fail / destructuring - undefined - number - property . out <nl> <nl> - * % ( basename ) s : 5 : TypeError : Cannot destructure ' undefined ' or ' null ' . <nl> + * % ( basename ) s : 5 : TypeError : Cannot destructure ' undefined ' as it is undefined . <nl> var { 1 : x } = undefined ; <nl> - ^ <nl> - TypeError : Cannot destructure ' undefined ' or ' null ' . <nl> - at * % ( basename ) s : 5 : 5 <nl> + ^ <nl> + TypeError : Cannot destructure ' undefined ' as it is undefined . <nl> + at * % ( basename ) s : 5 : 10 <nl> mmm a / test / message / fail / destructuring - undefined - string - property . out <nl> ppp b / test / message / fail / destructuring - undefined - string - property . out <nl> <nl> - * % ( basename ) s : 5 : TypeError : Cannot destructure property ` x ` of ' undefined ' or ' null ' . <nl> + * % ( basename ) s : 5 : TypeError : Cannot destructure property ' x ' of ' undefined ' as it is undefined . <nl> var { x } = undefined ; <nl> ^ <nl> - TypeError : Cannot destructure property ` x ` of ' undefined ' or ' null ' . <nl> - at * % ( basename ) s : 5 : 5 <nl> + TypeError : Cannot destructure property ' x ' of ' undefined ' as it is undefined . <nl> + at * % ( basename ) s : 5 : 7 <nl>
Reland " [ destructuring ] Elide coercible check for simple keys "
v8/v8
ef2df57aa5c64a2b4f2b7c66679c2914ce73f364
2019-08-30T10:51:49Z
mmm a / test / js - perf - test / BytecodeHandlers / run . js <nl> ppp b / test / js - perf - test / BytecodeHandlers / run . js <nl> <nl> <nl> load ( ' . . / base . js ' ) ; <nl> <nl> - load ( ' compare . js ' ) ; <nl> - load ( ' string - concat . js ' ) ; <nl> - load ( ' arithmetic . js ' ) ; <nl> - load ( ' bitwise . js ' ) ; <nl> + load ( arguments [ 0 ] + ' . js ' ) ; <nl> <nl> var success = true ; <nl> <nl> mmm a / test / js - perf - test / JSTests . json <nl> ppp b / test / js - perf - test / JSTests . json <nl> <nl> { <nl> " name " : " BytecodeHandlers " , <nl> " path " : [ " BytecodeHandlers " ] , <nl> - " main " : " run . js " , <nl> - " resources " : [ " compare . js " , " string - concat . js " , " arithmetic . js " , " bitwise . js " ] , <nl> " flags " : [ " - - no - opt " ] , <nl> - " results_regexp " : " ^ % s \ \ - BytecodeHandler \ \ ( Score \ \ ) : ( . + ) $ " , <nl> " tests " : [ <nl> - { " name " : " Smi - StrictEquals - True " } , <nl> - { " name " : " Smi - StrictEquals - False " } , <nl> - { " name " : " Number - StrictEquals - True " } , <nl> - { " name " : " Number - StrictEquals - False " } , <nl> - { " name " : " String - StrictEquals - True " } , <nl> - { " name " : " String - StrictEquals - False " } , <nl> - { " name " : " SmiString - StrictEquals " } , <nl> - { " name " : " Smi - Equals - True " } , <nl> - { " name " : " Smi - Equals - False " } , <nl> - { " name " : " Number - Equals - True " } , <nl> - { " name " : " Number - Equals - False " } , <nl> - { " name " : " String - Equals - True " } , <nl> - { " name " : " String - Equals - False " } , <nl> - { " name " : " ObjectNull - Equals " } , <nl> - { " name " : " SmiString - Equals " } , <nl> - { " name " : " Smi - RelationalCompare " } , <nl> - { " name " : " Number - RelationalCompare " } , <nl> - { " name " : " String - RelationalCompare " } , <nl> - { " name " : " SmiString - RelationalCompare " } , <nl> - { " name " : " ShortString - StringConcat - 2 " } , <nl> - { " name " : " ShortString - StringConcat - 3 " } , <nl> - { " name " : " ShortString - StringConcat - 5 " } , <nl> - { " name " : " ShortString - StringConcat - 10 " } , <nl> - { " name " : " LongString - StringConcat - 2 " } , <nl> - { " name " : " LongString - StringConcat - 3 " } , <nl> - { " name " : " LongString - StringConcat - 5 " } , <nl> - { " name " : " LongString - StringConcat - 10 " } , <nl> - { " name " : " NumberString - StringConcat - 2 " } , <nl> - { " name " : " NumberString - StringConcat - 3 " } , <nl> - { " name " : " NumberString - StringConcat - 5 " } , <nl> - { " name " : " NumberString - StringConcat - 10 " } , <nl> - { " name " : " Smi - Add " } , <nl> - { " name " : " Number - Add " } , <nl> - { " name " : " Number - Oddball - Add " } , <nl> - { " name " : " String - Add " } , <nl> - { " name " : " Object - Add " } , <nl> - { " name " : " Number - String - Add " } , <nl> - { " name " : " Smi - Sub " } , <nl> - { " name " : " Number - Sub " } , <nl> - { " name " : " Number - Oddball - Sub " } , <nl> - { " name " : " Object - Sub " } , <nl> - { " name " : " Smi - Mul " } , <nl> - { " name " : " Number - Mul " } , <nl> - { " name " : " Number - Oddball - Mul " } , <nl> - { " name " : " Object - Mul " } , <nl> - { " name " : " Smi - Div " } , <nl> - { " name " : " Number - Div " } , <nl> - { " name " : " Number - Oddball - Div " } , <nl> - { " name " : " Object - Div " } , <nl> - { " name " : " Smi - Mod " } , <nl> - { " name " : " Number - Mod " } , <nl> - { " name " : " Number - Oddball - Mod " } , <nl> - { " name " : " Object - Mod " } , <nl> - { " name " : " Smi - Constant - Add " } , <nl> - { " name " : " Smi - Constant - Sub " } , <nl> - { " name " : " Smi - Constant - Mul " } , <nl> - { " name " : " Smi - Constant - Div " } , <nl> - { " name " : " Smi - Constant - Mod " } , <nl> - { " name " : " Smi - Increment " } , <nl> - { " name " : " Number - Increment " } , <nl> - { " name " : " Smi - Decrement " } , <nl> - { " name " : " Number - Decrement " } , <nl> - { " name " : " Smi - Or " } , <nl> - { " name " : " Number - Or " } , <nl> - { " name " : " Smi - Xor " } , <nl> - { " name " : " Number - Xor " } , <nl> - { " name " : " Smi - And " } , <nl> - { " name " : " Number - And " } , <nl> - { " name " : " Smi - Constant - Or " } , <nl> - { " name " : " Smi - Constant - Xor " } , <nl> - { " name " : " Smi - Constant - And " } , <nl> - { " name " : " Smi - ShiftLeft " } , <nl> - { " name " : " Number - ShiftLeft " } , <nl> - { " name " : " Smi - ShiftRight " } , <nl> - { " name " : " Number - ShiftRight " } , <nl> - { " name " : " Smi - ShiftRightLogical " } , <nl> - { " name " : " Number - ShiftRightLogical " } , <nl> - { " name " : " Smi - Constant - ShiftLeft " } , <nl> - { " name " : " Smi - Constant - ShiftRight " } , <nl> - { " name " : " Smi - Constant - ShiftRightLogical " } <nl> + { <nl> + " name " : " Compare " , <nl> + " main " : " run . js " , <nl> + " resources " : [ " compare . js " ] , <nl> + " test_flags " : [ " compare " ] , <nl> + " results_regexp " : " ^ % s \ \ - BytecodeHandler \ \ ( Score \ \ ) : ( . + ) $ " , <nl> + " tests " : [ <nl> + { " name " : " Smi - StrictEquals - True " } , <nl> + { " name " : " Smi - StrictEquals - False " } , <nl> + { " name " : " Number - StrictEquals - True " } , <nl> + { " name " : " Number - StrictEquals - False " } , <nl> + { " name " : " String - StrictEquals - True " } , <nl> + { " name " : " String - StrictEquals - False " } , <nl> + { " name " : " SmiString - StrictEquals " } , <nl> + { " name " : " Smi - Equals - True " } , <nl> + { " name " : " Smi - Equals - False " } , <nl> + { " name " : " Number - Equals - True " } , <nl> + { " name " : " Number - Equals - False " } , <nl> + { " name " : " String - Equals - True " } , <nl> + { " name " : " String - Equals - False " } , <nl> + { " name " : " ObjectNull - Equals " } , <nl> + { " name " : " SmiString - Equals " } , <nl> + { " name " : " Smi - RelationalCompare " } , <nl> + { " name " : " Number - RelationalCompare " } , <nl> + { " name " : " String - RelationalCompare " } , <nl> + { " name " : " SmiString - RelationalCompare " } <nl> + ] <nl> + } , <nl> + { <nl> + " name " : " StringConcat " , <nl> + " main " : " run . js " , <nl> + " resources " : [ " string - concat . js " ] , <nl> + " test_flags " : [ " string - concat " ] , <nl> + " results_regexp " : " ^ % s \ \ - BytecodeHandler \ \ ( Score \ \ ) : ( . + ) $ " , <nl> + " tests " : [ <nl> + { " name " : " ShortString - StringConcat - 2 " } , <nl> + { " name " : " ShortString - StringConcat - 3 " } , <nl> + { " name " : " ShortString - StringConcat - 5 " } , <nl> + { " name " : " ShortString - StringConcat - 10 " } , <nl> + { " name " : " LongString - StringConcat - 2 " } , <nl> + { " name " : " LongString - StringConcat - 3 " } , <nl> + { " name " : " LongString - StringConcat - 5 " } , <nl> + { " name " : " LongString - StringConcat - 10 " } , <nl> + { " name " : " NumberString - StringConcat - 2 " } , <nl> + { " name " : " NumberString - StringConcat - 3 " } , <nl> + { " name " : " NumberString - StringConcat - 5 " } , <nl> + { " name " : " NumberString - StringConcat - 10 " } <nl> + ] <nl> + } , <nl> + { <nl> + " name " : " Arithmetic " , <nl> + " main " : " run . js " , <nl> + " resources " : [ " arithmetic . js " ] , <nl> + " test_flags " : [ " arithmetic " ] , <nl> + " results_regexp " : " ^ % s \ \ - BytecodeHandler \ \ ( Score \ \ ) : ( . + ) $ " , <nl> + " tests " : [ <nl> + { " name " : " Smi - Add " } , <nl> + { " name " : " Number - Add " } , <nl> + { " name " : " Number - Oddball - Add " } , <nl> + { " name " : " String - Add " } , <nl> + { " name " : " Object - Add " } , <nl> + { " name " : " Number - String - Add " } , <nl> + { " name " : " Smi - Sub " } , <nl> + { " name " : " Number - Sub " } , <nl> + { " name " : " Number - Oddball - Sub " } , <nl> + { " name " : " Object - Sub " } , <nl> + { " name " : " Smi - Mul " } , <nl> + { " name " : " Number - Mul " } , <nl> + { " name " : " Number - Oddball - Mul " } , <nl> + { " name " : " Object - Mul " } , <nl> + { " name " : " Smi - Div " } , <nl> + { " name " : " Number - Div " } , <nl> + { " name " : " Number - Oddball - Div " } , <nl> + { " name " : " Object - Div " } , <nl> + { " name " : " Smi - Mod " } , <nl> + { " name " : " Number - Mod " } , <nl> + { " name " : " Number - Oddball - Mod " } , <nl> + { " name " : " Object - Mod " } , <nl> + { " name " : " Smi - Constant - Add " } , <nl> + { " name " : " Smi - Constant - Sub " } , <nl> + { " name " : " Smi - Constant - Mul " } , <nl> + { " name " : " Smi - Constant - Div " } , <nl> + { " name " : " Smi - Constant - Mod " } , <nl> + { " name " : " Smi - Increment " } , <nl> + { " name " : " Number - Increment " } , <nl> + { " name " : " Smi - Decrement " } , <nl> + { " name " : " Number - Decrement " } <nl> + ] <nl> + } , <nl> + { <nl> + " name " : " Bitwise " , <nl> + " main " : " run . js " , <nl> + " resources " : [ " bitwise . js " ] , <nl> + " test_flags " : [ " bitwise " ] , <nl> + " results_regexp " : " ^ % s \ \ - BytecodeHandler \ \ ( Score \ \ ) : ( . + ) $ " , <nl> + " tests " : [ <nl> + { " name " : " Smi - Or " } , <nl> + { " name " : " Number - Or " } , <nl> + { " name " : " Smi - Xor " } , <nl> + { " name " : " Number - Xor " } , <nl> + { " name " : " Smi - And " } , <nl> + { " name " : " Number - And " } , <nl> + { " name " : " Smi - Constant - Or " } , <nl> + { " name " : " Smi - Constant - Xor " } , <nl> + { " name " : " Smi - Constant - And " } , <nl> + { " name " : " Smi - ShiftLeft " } , <nl> + { " name " : " Number - ShiftLeft " } , <nl> + { " name " : " Smi - ShiftRight " } , <nl> + { " name " : " Number - ShiftRight " } , <nl> + { " name " : " Smi - ShiftRightLogical " } , <nl> + { " name " : " Number - ShiftRightLogical " } , <nl> + { " name " : " Smi - Constant - ShiftLeft " } , <nl> + { " name " : " Smi - Constant - ShiftRight " } , <nl> + { " name " : " Smi - Constant - ShiftRightLogical " } <nl> + ] <nl> + } <nl> ] <nl> } <nl> ] <nl>
Sub - categorize bytecode handler benchmarks in test / js - perf - test .
v8/v8
05b9778d12f5fcdbdbc89a347fc9ab7916da9fb0
2017-06-09T10:43:49Z
mmm a / tensorflow / lite / toco / tflite / operator_test . cc <nl> ppp b / tensorflow / lite / toco / tflite / operator_test . cc <nl> TEST_F ( OperatorTest , VersioningMaxTest ) { <nl> EXPECT_EQ ( op - > GetVersion ( int8_signature ) , 2 ) ; <nl> } <nl> <nl> - TEST_F ( OperatorTest , VersioningMinTest ) { <nl> - TensorFlowMinimumOperator min_op ; <nl> - min_op . inputs = { " input1 " } ; <nl> - auto operator_by_type_map = BuildOperatorByTypeMap ( false / * enable_flex_ops * / ) ; <nl> - const BaseOperator * op = operator_by_type_map . at ( min_op . type ) . get ( ) ; <nl> - <nl> - Model uint8_model ; <nl> - Array & uint8_array = uint8_model . GetOrCreateArray ( min_op . inputs [ 0 ] ) ; <nl> - uint8_array . data_type = ArrayDataType : : kUint8 ; <nl> - OperatorSignature uint8_signature = { . op = & min_op , . model = & uint8_model } ; <nl> - EXPECT_EQ ( op - > GetVersion ( uint8_signature ) , 1 ) ; <nl> - <nl> - Model int8_model ; <nl> - Array & int8_array = int8_model . GetOrCreateArray ( min_op . inputs [ 0 ] ) ; <nl> - int8_array . data_type = ArrayDataType : : kInt8 ; <nl> - OperatorSignature int8_signature = { . op = & min_op , . model = & int8_model } ; <nl> - EXPECT_EQ ( op - > GetVersion ( int8_signature ) , 2 ) ; <nl> - } <nl> - <nl> TEST_F ( OperatorTest , BuiltinReshape ) { <nl> TensorFlowReshapeOperator op ; <nl> op . shape = { 1 , 2 , 4 , 5 , 8 } ; <nl> TEST_F ( OperatorTest , VersioningL2NormTest ) { <nl> SimpleOutputVersioningTest < L2NormalizationOperator > ( ) ; <nl> } <nl> <nl> + TEST_F ( OperatorTest , VersioningMinTest ) { <nl> + SimpleVersioningTest < TensorFlowMinimumOperator > ( ) ; <nl> + } <nl> + <nl> TEST_F ( OperatorTest , VersioningAddTest ) { SimpleVersioningTest < AddOperator > ( ) ; } <nl> <nl> TEST_F ( OperatorTest , VersioningSubTest ) { SimpleVersioningTest < SubOperator > ( ) ; } <nl>
Update operator_test for Min
tensorflow/tensorflow
74655dd35f38bfdb11f77c48b510111d468913f7
2019-02-26T20:41:48Z
mmm a / xbmc / windowing / gbm / CMakeLists . txt <nl> ppp b / xbmc / windowing / gbm / CMakeLists . txt <nl> <nl> set ( SOURCES GLContextEGL . cpp <nl> WinSystemGbm . cpp <nl> - GBMUtils . cpp ) <nl> + GBMUtils . cpp <nl> + DRMUtils . cpp <nl> + DRMLegacy . cpp <nl> + DRM . cpp ) <nl> <nl> set ( HEADERS GLContextEGL . h <nl> WinSystemGbm . h <nl> - GBMUtils . h ) <nl> + GBMUtils . h <nl> + DRMUtils . h <nl> + DRMLegacy . h <nl> + DRM . h ) <nl> <nl> if ( OPENGLES_FOUND ) <nl> list ( APPEND SOURCES WinSystemGbmGLESContext . cpp ) <nl> new file mode 100644 <nl> index 000000000000 . . 0cfc08d10868 <nl> mmm / dev / null <nl> ppp b / xbmc / windowing / gbm / DRM . cpp <nl> <nl> + / * <nl> + * Copyright ( C ) 2005 - 2013 Team XBMC <nl> + * http : / / xbmc . org <nl> + * <nl> + * This Program is free software ; you can redistribute it and / or modify <nl> + * it under the terms of the GNU General Public License as published by <nl> + * the Free Software Foundation ; either version 2 , or ( at your option ) <nl> + * any later version . <nl> + * <nl> + * This Program is distributed in the hope that it will be useful , <nl> + * but WITHOUT ANY WARRANTY ; without even the implied warranty of <nl> + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE . See the <nl> + * GNU General Public License for more details . <nl> + * <nl> + * You should have received a copy of the GNU General Public License <nl> + * along with XBMC ; see the file COPYING . If not , see <nl> + * < http : / / www . gnu . org / licenses / > . <nl> + * <nl> + * / <nl> + <nl> + # include " utils / log . h " <nl> + <nl> + # include " DRM . h " <nl> + # include " DRMLegacy . h " <nl> + <nl> + void CDRM : : FlipPage ( CGLContextEGL * pGLContext ) <nl> + { <nl> + CDRMLegacy : : FlipPage ( pGLContext ) ; <nl> + } <nl> + <nl> + bool CDRM : : SetVideoMode ( RESOLUTION_INFO res ) <nl> + { <nl> + return CDRMLegacy : : SetVideoMode ( res ) ; <nl> + } <nl> + <nl> + bool CDRM : : InitDrm ( drm * drm , gbm * gbm ) <nl> + { <nl> + if ( CDRMLegacy : : InitDrmLegacy ( drm , gbm ) ) <nl> + { <nl> + CLog : : Log ( LOGNOTICE , " CDRM : : % s - initialized Legacy DRM " , __FUNCTION__ ) ; <nl> + return true ; <nl> + } <nl> + <nl> + return false ; <nl> + } <nl> + <nl> + void CDRM : : DestroyDrm ( ) <nl> + { <nl> + CDRMLegacy : : DestroyDrmLegacy ( ) ; <nl> + } <nl> new file mode 100644 <nl> index 000000000000 . . 870a6fe2b93e <nl> mmm / dev / null <nl> ppp b / xbmc / windowing / gbm / DRM . h <nl> <nl> + / * <nl> + * Copyright ( C ) 2005 - 2013 Team XBMC <nl> + * http : / / xbmc . org <nl> + * <nl> + * This Program is free software ; you can redistribute it and / or modify <nl> + * it under the terms of the GNU General Public License as published by <nl> + * the Free Software Foundation ; either version 2 , or ( at your option ) <nl> + * any later version . <nl> + * <nl> + * This Program is distributed in the hope that it will be useful , <nl> + * but WITHOUT ANY WARRANTY ; without even the implied warranty of <nl> + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE . See the <nl> + * GNU General Public License for more details . <nl> + * <nl> + * You should have received a copy of the GNU General Public License <nl> + * along with XBMC ; see the file COPYING . If not , see <nl> + * < http : / / www . gnu . org / licenses / > . <nl> + * <nl> + * / <nl> + <nl> + # pragma once <nl> + <nl> + # include " DRMUtils . h " <nl> + # include " GLContextEGL . h " <nl> + <nl> + class CDRM <nl> + { <nl> + public : <nl> + ~ CDRM ( ) = default ; <nl> + void FlipPage ( CGLContextEGL * pGLContext ) ; <nl> + bool SetVideoMode ( RESOLUTION_INFO res ) ; <nl> + bool InitDrm ( drm * drm , gbm * gbm ) ; <nl> + void DestroyDrm ( ) ; <nl> + } ; <nl> new file mode 100644 <nl> index 000000000000 . . 8087293a999f <nl> mmm / dev / null <nl> ppp b / xbmc / windowing / gbm / DRMLegacy . cpp <nl> <nl> + / * <nl> + * Copyright ( C ) 2005 - 2013 Team XBMC <nl> + * http : / / xbmc . org <nl> + * <nl> + * This Program is free software ; you can redistribute it and / or modify <nl> + * it under the terms of the GNU General Public License as published by <nl> + * the Free Software Foundation ; either version 2 , or ( at your option ) <nl> + * any later version . <nl> + * <nl> + * This Program is distributed in the hope that it will be useful , <nl> + * but WITHOUT ANY WARRANTY ; without even the implied warranty of <nl> + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE . See the <nl> + * GNU General Public License for more details . <nl> + * <nl> + * You should have received a copy of the GNU General Public License <nl> + * along with XBMC ; see the file COPYING . If not , see <nl> + * < http : / / www . gnu . org / licenses / > . <nl> + * <nl> + * / <nl> + <nl> + # include < errno . h > <nl> + # include < fcntl . h > <nl> + # include < poll . h > <nl> + # include < stdint . h > <nl> + # include < stdio . h > <nl> + # include < stdlib . h > <nl> + # include < string . h > <nl> + # include < drm / drm_mode . h > <nl> + # include < EGL / egl . h > <nl> + # include < unistd . h > <nl> + <nl> + # include " WinSystemGbmGLESContext . h " <nl> + # include " guilib / gui3d . h " <nl> + # include " utils / log . h " <nl> + # include " settings / Settings . h " <nl> + <nl> + # include " DRMLegacy . h " <nl> + <nl> + static struct drm * m_drm = nullptr ; <nl> + static struct gbm * m_gbm = nullptr ; <nl> + <nl> + static struct drm_fb * m_drm_fb = new drm_fb ; <nl> + <nl> + static struct gbm_bo * m_bo = nullptr ; <nl> + static struct gbm_bo * m_next_bo = nullptr ; <nl> + <nl> + static int flip_happening = 0 ; <nl> + <nl> + static struct pollfd m_drm_fds ; <nl> + static drmEventContext m_drm_evctx ; <nl> + <nl> + bool CDRMLegacy : : SetVideoMode ( RESOLUTION_INFO res ) <nl> + { <nl> + CDRMUtils : : GetMode ( res ) ; <nl> + <nl> + gbm_surface_release_buffer ( m_gbm - > surface , m_bo ) ; <nl> + <nl> + m_bo = gbm_surface_lock_front_buffer ( m_gbm - > surface ) ; <nl> + m_drm_fb = CDRMUtils : : DrmFbGetFromBo ( m_bo ) ; <nl> + <nl> + auto ret = drmModeSetCrtc ( m_drm - > fd , <nl> + m_drm - > crtc_id , <nl> + m_drm_fb - > fb_id , <nl> + 0 , <nl> + 0 , <nl> + & m_drm - > connector_id , <nl> + 1 , <nl> + m_drm - > mode ) ; <nl> + <nl> + if ( ret < 0 ) <nl> + { <nl> + CLog : : Log ( LOGERROR , <nl> + " CDRMUtils : : % s - failed to set crtc mode : % dx % d % s @ % d Hz " , <nl> + __FUNCTION__ , <nl> + m_drm - > mode - > hdisplay , <nl> + m_drm - > mode - > vdisplay , <nl> + m_drm - > mode - > flags & DRM_MODE_FLAG_INTERLACE ? " i " : " " , <nl> + m_drm - > mode - > vrefresh ) ; <nl> + <nl> + return false ; <nl> + } <nl> + <nl> + CLog : : Log ( LOGDEBUG , " CDRMUtils : : % s - set crtc mode : % dx % d % s @ % d Hz " , <nl> + __FUNCTION__ , <nl> + m_drm - > mode - > hdisplay , <nl> + m_drm - > mode - > vdisplay , <nl> + m_drm - > mode - > flags & DRM_MODE_FLAG_INTERLACE ? " i " : " " , <nl> + m_drm - > mode - > vrefresh ) ; <nl> + <nl> + return true ; <nl> + } <nl> + <nl> + void CDRMLegacy : : PageFlipHandler ( int fd , unsigned int frame , unsigned int sec , <nl> + unsigned int usec , void * data ) <nl> + { <nl> + ( void ) fd , ( void ) frame , ( void ) sec , ( void ) usec ; <nl> + <nl> + int * flip_happening = static_cast < int * > ( data ) ; <nl> + * flip_happening = 0 ; <nl> + } <nl> + <nl> + bool CDRMLegacy : : WaitingForFlip ( ) <nl> + { <nl> + if ( ! flip_happening ) <nl> + { <nl> + return false ; <nl> + } <nl> + <nl> + m_drm_fds . fd = m_drm - > fd ; <nl> + m_drm_fds . events = POLLIN ; <nl> + <nl> + m_drm_evctx . version = DRM_EVENT_CONTEXT_VERSION ; <nl> + m_drm_evctx . page_flip_handler = PageFlipHandler ; <nl> + <nl> + m_drm_fds . revents = 0 ; <nl> + <nl> + while ( flip_happening ) <nl> + { <nl> + auto ret = poll ( & m_drm_fds , 1 , - 1 ) ; <nl> + <nl> + if ( ret < 0 ) <nl> + { <nl> + return true ; <nl> + } <nl> + <nl> + if ( m_drm_fds . revents & ( POLLHUP | POLLERR ) ) <nl> + { <nl> + return true ; <nl> + } <nl> + <nl> + if ( m_drm_fds . revents & POLLIN ) <nl> + { <nl> + drmHandleEvent ( m_drm - > fd , & m_drm_evctx ) ; <nl> + } <nl> + } <nl> + <nl> + gbm_surface_release_buffer ( m_gbm - > surface , m_bo ) ; <nl> + m_bo = m_next_bo ; <nl> + <nl> + return false ; <nl> + } <nl> + <nl> + bool CDRMLegacy : : QueueFlip ( ) <nl> + { <nl> + m_next_bo = gbm_surface_lock_front_buffer ( m_gbm - > surface ) ; <nl> + m_drm_fb = CDRMUtils : : DrmFbGetFromBo ( m_next_bo ) ; <nl> + <nl> + auto ret = drmModePageFlip ( m_drm - > fd , <nl> + m_drm - > crtc_id , <nl> + m_drm_fb - > fb_id , <nl> + DRM_MODE_PAGE_FLIP_EVENT , <nl> + & flip_happening ) ; <nl> + <nl> + if ( ret ) <nl> + { <nl> + CLog : : Log ( LOGDEBUG , " CDRMLegacy : : % s - failed to queue DRM page flip " , __FUNCTION__ ) ; <nl> + return false ; <nl> + } <nl> + <nl> + return true ; <nl> + } <nl> + <nl> + void CDRMLegacy : : FlipPage ( CGLContextEGL * pGLContext ) <nl> + { <nl> + if ( WaitingForFlip ( ) ) <nl> + { <nl> + return ; <nl> + } <nl> + <nl> + flip_happening = QueueFlip ( ) ; <nl> + <nl> + if ( g_Windowing . NoOfBuffers ( ) > = 3 & & gbm_surface_has_free_buffers ( m_gbm - > surface ) ) <nl> + { <nl> + return ; <nl> + } <nl> + <nl> + WaitingForFlip ( ) ; <nl> + } <nl> + <nl> + bool CDRMLegacy : : InitDrmLegacy ( drm * drm , gbm * gbm ) <nl> + { <nl> + m_drm = drm ; <nl> + m_gbm = gbm ; <nl> + <nl> + if ( ! CDRMUtils : : InitDrm ( m_drm ) ) <nl> + { <nl> + return false ; <nl> + } <nl> + <nl> + m_gbm - > dev = gbm_create_device ( m_drm - > fd ) ; <nl> + <nl> + if ( ! CGBMUtils : : InitGbm ( m_gbm , m_drm - > mode - > hdisplay , m_drm - > mode - > vdisplay ) ) <nl> + { <nl> + return false ; <nl> + } <nl> + <nl> + return true ; <nl> + } <nl> + <nl> + void CDRMLegacy : : DestroyDrmLegacy ( ) <nl> + { <nl> + CDRMUtils : : DestroyDrm ( ) ; <nl> + <nl> + if ( m_gbm - > surface ) <nl> + { <nl> + gbm_surface_destroy ( m_gbm - > surface ) ; <nl> + } <nl> + <nl> + if ( m_gbm - > dev ) <nl> + { <nl> + gbm_device_destroy ( m_gbm - > dev ) ; <nl> + } <nl> + } <nl> new file mode 100644 <nl> index 000000000000 . . 46411f5e187d <nl> mmm / dev / null <nl> ppp b / xbmc / windowing / gbm / DRMLegacy . h <nl> <nl> + / * <nl> + * Copyright ( C ) 2005 - 2013 Team XBMC <nl> + * http : / / xbmc . org <nl> + * <nl> + * This Program is free software ; you can redistribute it and / or modify <nl> + * it under the terms of the GNU General Public License as published by <nl> + * the Free Software Foundation ; either version 2 , or ( at your option ) <nl> + * any later version . <nl> + * <nl> + * This Program is distributed in the hope that it will be useful , <nl> + * but WITHOUT ANY WARRANTY ; without even the implied warranty of <nl> + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE . See the <nl> + * GNU General Public License for more details . <nl> + * <nl> + * You should have received a copy of the GNU General Public License <nl> + * along with XBMC ; see the file COPYING . If not , see <nl> + * < http : / / www . gnu . org / licenses / > . <nl> + * <nl> + * / <nl> + <nl> + # pragma once <nl> + <nl> + # include " DRMUtils . h " <nl> + # include " GLContextEGL . h " <nl> + <nl> + class CDRMLegacy : public CDRMUtils <nl> + { <nl> + public : <nl> + static void FlipPage ( CGLContextEGL * pGLContext ) ; <nl> + static bool SetVideoMode ( RESOLUTION_INFO res ) ; <nl> + static bool InitDrmLegacy ( drm * drm , gbm * gbm ) ; <nl> + static void DestroyDrmLegacy ( ) ; <nl> + <nl> + private : <nl> + static bool WaitingForFlip ( ) ; <nl> + static bool QueueFlip ( ) ; <nl> + static void PageFlipHandler ( int fd , unsigned int frame , unsigned int sec , <nl> + unsigned int usec , void * data ) ; <nl> + } ; <nl> new file mode 100644 <nl> index 000000000000 . . 2a696d27a799 <nl> mmm / dev / null <nl> ppp b / xbmc / windowing / gbm / DRMUtils . cpp <nl> <nl> + / * <nl> + * Copyright ( C ) 2005 - 2013 Team XBMC <nl> + * http : / / xbmc . org <nl> + * <nl> + * This Program is free software ; you can redistribute it and / or modify <nl> + * it under the terms of the GNU General Public License as published by <nl> + * the Free Software Foundation ; either version 2 , or ( at your option ) <nl> + * any later version . <nl> + * <nl> + * This Program is distributed in the hope that it will be useful , <nl> + * but WITHOUT ANY WARRANTY ; without even the implied warranty of <nl> + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE . See the <nl> + * GNU General Public License for more details . <nl> + * <nl> + * You should have received a copy of the GNU General Public License <nl> + * along with XBMC ; see the file COPYING . If not , see <nl> + * < http : / / www . gnu . org / licenses / > . <nl> + * <nl> + * / <nl> + <nl> + # include < errno . h > <nl> + # include < fcntl . h > <nl> + # include < stdint . h > <nl> + # include < stdio . h > <nl> + # include < stdlib . h > <nl> + # include < string . h > <nl> + # include < drm / drm_fourcc . h > <nl> + # include < drm / drm_mode . h > <nl> + # include < EGL / egl . h > <nl> + # include < unistd . h > <nl> + <nl> + # include " WinSystemGbmGLESContext . h " <nl> + # include " guilib / gui3d . h " <nl> + # include " utils / log . h " <nl> + <nl> + # include " DRMUtils . h " <nl> + <nl> + static struct drm * m_drm = nullptr ; <nl> + <nl> + static drmModeResPtr m_drm_resources = nullptr ; <nl> + static drmModeConnectorPtr m_drm_connector = nullptr ; <nl> + static drmModeEncoderPtr m_drm_encoder = nullptr ; <nl> + static drmModeCrtcPtr m_orig_crtc = nullptr ; <nl> + <nl> + bool CDRMUtils : : GetMode ( RESOLUTION_INFO res ) <nl> + { <nl> + m_drm - > mode = & m_drm_connector - > modes [ atoi ( res . strId . c_str ( ) ) ] ; <nl> + <nl> + CLog : : Log ( LOGDEBUG , " CDRMUtils : : % s - found crtc mode : % dx % d % s @ % d Hz " , <nl> + __FUNCTION__ , <nl> + m_drm - > mode - > hdisplay , <nl> + m_drm - > mode - > vdisplay , <nl> + m_drm - > mode - > flags & DRM_MODE_FLAG_INTERLACE ? " i " : " " , <nl> + m_drm - > mode - > vrefresh ) ; <nl> + <nl> + return true ; <nl> + } <nl> + <nl> + void CDRMUtils : : DrmFbDestroyCallback ( struct gbm_bo * bo , void * data ) <nl> + { <nl> + struct drm_fb * fb = static_cast < drm_fb * > ( data ) ; <nl> + <nl> + if ( fb - > fb_id ) <nl> + { <nl> + drmModeRmFB ( m_drm - > fd , fb - > fb_id ) ; <nl> + } <nl> + <nl> + delete ( fb ) ; <nl> + } <nl> + <nl> + drm_fb * CDRMUtils : : DrmFbGetFromBo ( struct gbm_bo * bo ) <nl> + { <nl> + { <nl> + struct drm_fb * fb = static_cast < drm_fb * > ( gbm_bo_get_user_data ( bo ) ) ; <nl> + if ( fb ) <nl> + { <nl> + return fb ; <nl> + } <nl> + } <nl> + <nl> + struct drm_fb * fb = new drm_fb ; <nl> + fb - > bo = bo ; <nl> + <nl> + uint32_t width , <nl> + height , <nl> + handles [ 4 ] = { 0 } , <nl> + strides [ 4 ] = { 0 } , <nl> + offsets [ 4 ] = { 0 } ; <nl> + <nl> + width = gbm_bo_get_width ( bo ) ; <nl> + height = gbm_bo_get_height ( bo ) ; <nl> + <nl> + handles [ 0 ] = gbm_bo_get_handle ( bo ) . u32 ; <nl> + strides [ 0 ] = gbm_bo_get_stride ( bo ) ; <nl> + memset ( offsets , 0 , 16 ) ; <nl> + <nl> + auto ret = drmModeAddFB2 ( m_drm - > fd , <nl> + width , <nl> + height , <nl> + DRM_FORMAT_ARGB8888 , <nl> + handles , <nl> + strides , <nl> + offsets , <nl> + & fb - > fb_id , <nl> + 0 ) ; <nl> + <nl> + if ( ret ) <nl> + { <nl> + delete ( fb ) ; <nl> + CLog : : Log ( LOGDEBUG , " CDRMUtils : : % s - failed to add framebuffer " , __FUNCTION__ ) ; <nl> + return nullptr ; <nl> + } <nl> + <nl> + gbm_bo_set_user_data ( bo , fb , DrmFbDestroyCallback ) ; <nl> + <nl> + return fb ; <nl> + } <nl> + <nl> + bool CDRMUtils : : GetResources ( ) <nl> + { <nl> + m_drm_resources = drmModeGetResources ( m_drm - > fd ) ; <nl> + if ( ! m_drm_resources ) <nl> + { <nl> + return false ; <nl> + } <nl> + <nl> + return true ; <nl> + } <nl> + <nl> + bool CDRMUtils : : GetConnector ( ) <nl> + { <nl> + for ( auto i = 0 ; i < m_drm_resources - > count_connectors ; i + + ) <nl> + { <nl> + m_drm_connector = drmModeGetConnector ( m_drm - > fd , <nl> + m_drm_resources - > connectors [ i ] ) ; <nl> + if ( m_drm_connector - > connection = = DRM_MODE_CONNECTED ) <nl> + { <nl> + CLog : : Log ( LOGDEBUG , " CDRMUtils : : % s - found connector : % d " , __FUNCTION__ , <nl> + m_drm_connector - > connector_type ) ; <nl> + break ; <nl> + } <nl> + drmModeFreeConnector ( m_drm_connector ) ; <nl> + m_drm_connector = nullptr ; <nl> + } <nl> + <nl> + if ( ! m_drm_connector ) <nl> + { <nl> + return false ; <nl> + } <nl> + <nl> + return true ; <nl> + } <nl> + <nl> + bool CDRMUtils : : GetEncoder ( ) <nl> + { <nl> + for ( auto i = 0 ; i < m_drm_resources - > count_encoders ; i + + ) <nl> + { <nl> + m_drm_encoder = drmModeGetEncoder ( m_drm - > fd , m_drm_resources - > encoders [ i ] ) ; <nl> + if ( m_drm_encoder - > encoder_id = = m_drm_connector - > encoder_id ) <nl> + { <nl> + CLog : : Log ( LOGDEBUG , " CDRMUtils : : % s - found encoder : % d " , __FUNCTION__ , <nl> + m_drm_encoder - > encoder_type ) ; <nl> + break ; <nl> + } <nl> + drmModeFreeEncoder ( m_drm_encoder ) ; <nl> + m_drm_encoder = nullptr ; <nl> + } <nl> + <nl> + if ( ! m_drm_encoder ) <nl> + { <nl> + return false ; <nl> + } <nl> + <nl> + return true ; <nl> + } <nl> + <nl> + bool CDRMUtils : : GetPreferredMode ( ) <nl> + { <nl> + for ( auto i = 0 , area = 0 ; i < m_drm_connector - > count_modes ; i + + ) <nl> + { <nl> + drmModeModeInfo * current_mode = & m_drm_connector - > modes [ i ] ; <nl> + <nl> + if ( current_mode - > type & DRM_MODE_TYPE_PREFERRED ) <nl> + { <nl> + m_drm - > mode = current_mode ; <nl> + CLog : : Log ( LOGDEBUG , <nl> + " CDRMUtils : : % s - found preferred mode : % dx % d % s @ % d Hz " , <nl> + __FUNCTION__ , <nl> + m_drm - > mode - > hdisplay , <nl> + m_drm - > mode - > vdisplay , <nl> + m_drm - > mode - > flags & DRM_MODE_FLAG_INTERLACE ? " i " : " " , <nl> + m_drm - > mode - > vrefresh ) ; <nl> + break ; <nl> + } <nl> + <nl> + auto current_area = current_mode - > hdisplay * current_mode - > vdisplay ; <nl> + if ( current_area > area ) <nl> + { <nl> + m_drm - > mode = current_mode ; <nl> + area = current_area ; <nl> + } <nl> + } <nl> + <nl> + if ( ! m_drm - > mode ) <nl> + { <nl> + CLog : : Log ( LOGDEBUG , " CDRMUtils : : % s - failed to find preferred mode " , __FUNCTION__ ) ; <nl> + return false ; <nl> + } <nl> + <nl> + return true ; <nl> + } <nl> + <nl> + bool CDRMUtils : : InitDrm ( drm * drm ) <nl> + { <nl> + m_drm = drm ; <nl> + const char * device = " / dev / dri / card0 " ; <nl> + <nl> + m_drm - > fd = open ( device , O_RDWR ) ; <nl> + <nl> + if ( m_drm - > fd < 0 ) <nl> + { <nl> + return false ; <nl> + } <nl> + <nl> + if ( ! GetResources ( ) ) <nl> + { <nl> + return false ; <nl> + } <nl> + <nl> + if ( ! GetConnector ( ) ) <nl> + { <nl> + return false ; <nl> + } <nl> + <nl> + if ( ! GetEncoder ( ) ) <nl> + { <nl> + return false ; <nl> + } <nl> + else <nl> + { <nl> + m_drm - > crtc_id = m_drm_encoder - > crtc_id ; <nl> + } <nl> + <nl> + if ( ! GetPreferredMode ( ) ) <nl> + { <nl> + return false ; <nl> + } <nl> + <nl> + for ( auto i = 0 ; i < m_drm_resources - > count_crtcs ; i + + ) <nl> + { <nl> + if ( m_drm_resources - > crtcs [ i ] = = m_drm - > crtc_id ) <nl> + { <nl> + m_drm - > crtc_index = i ; <nl> + break ; <nl> + } <nl> + } <nl> + <nl> + drmModeFreeResources ( m_drm_resources ) ; <nl> + <nl> + drmSetMaster ( m_drm - > fd ) ; <nl> + <nl> + m_drm - > connector_id = m_drm_connector - > connector_id ; <nl> + m_orig_crtc = drmModeGetCrtc ( m_drm - > fd , m_drm - > crtc_id ) ; <nl> + <nl> + return true ; <nl> + } <nl> + <nl> + bool CDRMUtils : : RestoreOriginalMode ( ) <nl> + { <nl> + if ( ! m_orig_crtc ) <nl> + { <nl> + return false ; <nl> + } <nl> + <nl> + auto ret = drmModeSetCrtc ( m_drm - > fd , <nl> + m_orig_crtc - > crtc_id , <nl> + m_orig_crtc - > buffer_id , <nl> + m_orig_crtc - > x , <nl> + m_orig_crtc - > y , <nl> + & m_drm - > connector_id , <nl> + 1 , <nl> + & m_orig_crtc - > mode ) ; <nl> + <nl> + if ( ret ) <nl> + { <nl> + CLog : : Log ( LOGERROR , " CDRMUtils : : % s - failed to set original crtc mode " , __FUNCTION__ ) ; <nl> + return false ; <nl> + } <nl> + <nl> + CLog : : Log ( LOGDEBUG , " CDRMUtils : : % s - set original crtc mode " , __FUNCTION__ ) ; <nl> + <nl> + drmModeFreeCrtc ( m_orig_crtc ) ; <nl> + m_orig_crtc = nullptr ; <nl> + <nl> + return true ; <nl> + } <nl> + <nl> + void CDRMUtils : : DestroyDrm ( ) <nl> + { <nl> + RestoreOriginalMode ( ) ; <nl> + <nl> + if ( m_drm_encoder ) <nl> + { <nl> + drmModeFreeEncoder ( m_drm_encoder ) ; <nl> + } <nl> + <nl> + if ( m_drm_connector ) <nl> + { <nl> + drmModeFreeConnector ( m_drm_connector ) ; <nl> + } <nl> + <nl> + if ( m_drm_resources ) <nl> + { <nl> + drmModeFreeResources ( m_drm_resources ) ; <nl> + } <nl> + <nl> + drmDropMaster ( m_drm - > fd ) ; <nl> + close ( m_drm - > fd ) ; <nl> + <nl> + m_drm_encoder = nullptr ; <nl> + m_drm_connector = nullptr ; <nl> + m_drm_resources = nullptr ; <nl> + <nl> + m_drm - > connector = nullptr ; <nl> + m_drm - > connector_id = 0 ; <nl> + m_drm - > crtc = nullptr ; <nl> + m_drm - > crtc_id = 0 ; <nl> + m_drm - > crtc_index = 0 ; <nl> + m_drm - > fd = - 1 ; <nl> + m_drm - > mode = nullptr ; <nl> + } <nl> + <nl> + bool CDRMUtils : : GetModes ( std : : vector < RESOLUTION_INFO > & resolutions ) <nl> + { <nl> + for ( auto i = 0 ; i < m_drm_connector - > count_modes ; i + + ) <nl> + { <nl> + RESOLUTION_INFO res ; <nl> + res . iScreen = 0 ; <nl> + res . iWidth = m_drm_connector - > modes [ i ] . hdisplay ; <nl> + res . iHeight = m_drm_connector - > modes [ i ] . vdisplay ; <nl> + res . iScreenWidth = m_drm_connector - > modes [ i ] . hdisplay ; <nl> + res . iScreenHeight = m_drm_connector - > modes [ i ] . vdisplay ; <nl> + res . fRefreshRate = m_drm_connector - > modes [ i ] . vrefresh ; <nl> + res . iSubtitles = static_cast < int > ( 0 . 965 * res . iHeight ) ; <nl> + res . fPixelRatio = 1 . 0f ; <nl> + res . bFullScreen = true ; <nl> + res . strMode = m_drm_connector - > modes [ i ] . name ; <nl> + res . strId = std : : to_string ( i ) ; <nl> + <nl> + if ( m_drm_connector - > modes [ i ] . flags & DRM_MODE_FLAG_3D_MASK ) <nl> + { <nl> + if ( m_drm_connector - > modes [ i ] . flags & DRM_MODE_FLAG_3D_TOP_AND_BOTTOM ) <nl> + { <nl> + res . dwFlags = D3DPRESENTFLAG_MODE3DTB ; <nl> + } <nl> + else if ( m_drm_connector - > modes [ i ] . flags <nl> + & DRM_MODE_FLAG_3D_SIDE_BY_SIDE_HALF ) <nl> + { <nl> + res . dwFlags = D3DPRESENTFLAG_MODE3DSBS ; <nl> + } <nl> + } <nl> + else if ( m_drm_connector - > modes [ i ] . flags & DRM_MODE_FLAG_INTERLACE ) <nl> + { <nl> + res . dwFlags = D3DPRESENTFLAG_INTERLACED ; <nl> + } <nl> + else <nl> + { <nl> + res . dwFlags = D3DPRESENTFLAG_PROGRESSIVE ; <nl> + } <nl> + <nl> + resolutions . push_back ( res ) ; <nl> + } <nl> + <nl> + return resolutions . size ( ) > 0 ; <nl> + } <nl> new file mode 100644 <nl> index 000000000000 . . 25eb2d02fa84 <nl> mmm / dev / null <nl> ppp b / xbmc / windowing / gbm / DRMUtils . h <nl> <nl> + / * <nl> + * Copyright ( C ) 2005 - 2013 Team XBMC <nl> + * http : / / xbmc . org <nl> + * <nl> + * This Program is free software ; you can redistribute it and / or modify <nl> + * it under the terms of the GNU General Public License as published by <nl> + * the Free Software Foundation ; either version 2 , or ( at your option ) <nl> + * any later version . <nl> + * <nl> + * This Program is distributed in the hope that it will be useful , <nl> + * but WITHOUT ANY WARRANTY ; without even the implied warranty of <nl> + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE . See the <nl> + * GNU General Public License for more details . <nl> + * <nl> + * You should have received a copy of the GNU General Public License <nl> + * along with XBMC ; see the file COPYING . If not , see <nl> + * < http : / / www . gnu . org / licenses / > . <nl> + * <nl> + * / <nl> + <nl> + # pragma once <nl> + <nl> + # include < xf86drm . h > <nl> + # include < xf86drmMode . h > <nl> + # include < gbm . h > <nl> + # include < vector > <nl> + <nl> + # include " guilib / Resolution . h " <nl> + # include " GBMUtils . h " <nl> + <nl> + struct crtc <nl> + { <nl> + drmModeCrtc * crtc ; <nl> + drmModeObjectProperties * props ; <nl> + drmModePropertyRes * * props_info ; <nl> + } ; <nl> + <nl> + struct connector <nl> + { <nl> + drmModeConnector * connector ; <nl> + drmModeObjectProperties * props ; <nl> + drmModePropertyRes * * props_info ; <nl> + } ; <nl> + <nl> + struct drm <nl> + { <nl> + int fd ; <nl> + <nl> + struct crtc * crtc ; <nl> + struct connector * connector ; <nl> + int crtc_index ; <nl> + <nl> + drmModeModeInfo * mode ; <nl> + uint32_t crtc_id ; <nl> + uint32_t connector_id ; <nl> + } ; <nl> + <nl> + struct drm_fb <nl> + { <nl> + struct gbm_bo * bo ; <nl> + uint32_t fb_id ; <nl> + } ; <nl> + <nl> + class CDRMUtils <nl> + { <nl> + public : <nl> + static bool InitDrm ( drm * drm ) ; <nl> + static void DestroyDrm ( ) ; <nl> + static bool GetModes ( std : : vector < RESOLUTION_INFO > & resolutions ) ; <nl> + <nl> + protected : <nl> + static bool GetMode ( RESOLUTION_INFO res ) ; <nl> + static drm_fb * DrmFbGetFromBo ( struct gbm_bo * bo ) ; <nl> + <nl> + private : <nl> + static bool GetResources ( ) ; <nl> + static bool GetConnector ( ) ; <nl> + static bool GetEncoder ( ) ; <nl> + static bool GetPreferredMode ( ) ; <nl> + static bool RestoreOriginalMode ( ) ; <nl> + static void DrmFbDestroyCallback ( struct gbm_bo * bo , void * data ) ; <nl> + } ; <nl> mmm a / xbmc / windowing / gbm / GBMUtils . cpp <nl> ppp b / xbmc / windowing / gbm / GBMUtils . cpp <nl> <nl> <nl> # include " GBMUtils . h " <nl> <nl> - static struct drm * m_drm = new drm ; <nl> - static struct drm_fb * m_drm_fb = new drm_fb ; <nl> - <nl> - static struct gbm * m_gbm = new gbm ; <nl> - <nl> - static struct gbm_bo * m_bo = nullptr ; <nl> - static struct gbm_bo * m_next_bo = nullptr ; <nl> - <nl> - static drmModeResPtr m_drm_resources = nullptr ; <nl> - static drmModeConnectorPtr m_drm_connector = nullptr ; <nl> - static drmModeEncoderPtr m_drm_encoder = nullptr ; <nl> - static drmModeCrtcPtr m_orig_crtc = nullptr ; <nl> - <nl> - static struct pollfd m_drm_fds ; <nl> - static drmEventContext m_drm_evctx ; <nl> - static int flip_happening = 0 ; <nl> - <nl> - drm * CGBMUtils : : GetDrm ( ) <nl> - { <nl> - return m_drm ; <nl> - } <nl> - <nl> - gbm * CGBMUtils : : GetGbm ( ) <nl> - { <nl> - return m_gbm ; <nl> - } <nl> - <nl> - bool CGBMUtils : : InitGbm ( RESOLUTION_INFO res ) <nl> + bool CGBMUtils : : InitGbm ( struct gbm * gbm , int hdisplay , int vdisplay ) <nl> { <nl> - GetMode ( res ) ; <nl> + gbm - > width = hdisplay ; <nl> + gbm - > height = vdisplay ; <nl> <nl> - m_gbm - > width = m_drm - > mode - > hdisplay ; <nl> - m_gbm - > height = m_drm - > mode - > vdisplay ; <nl> + gbm - > surface = gbm_surface_create ( gbm - > dev , <nl> + gbm - > width , <nl> + gbm - > height , <nl> + GBM_FORMAT_ARGB8888 , <nl> + GBM_BO_USE_SCANOUT | GBM_BO_USE_RENDERING ) ; <nl> <nl> - m_gbm - > surface = gbm_surface_create ( m_gbm - > dev , <nl> - m_gbm - > width , <nl> - m_gbm - > height , <nl> - GBM_FORMAT_ARGB8888 , <nl> - GBM_BO_USE_SCANOUT | GBM_BO_USE_RENDERING ) ; <nl> - <nl> - if ( ! m_gbm - > surface ) <nl> + if ( ! gbm - > surface ) <nl> { <nl> CLog : : Log ( LOGERROR , " CGBMUtils : : % s - failed to create surface " , __FUNCTION__ ) ; <nl> return false ; <nl> } <nl> <nl> CLog : : Log ( LOGDEBUG , " CGBMUtils : : % s - created surface with size % dx % d " , __FUNCTION__ , <nl> - m_gbm - > width , <nl> - m_gbm - > height ) ; <nl> + gbm - > width , <nl> + gbm - > height ) ; <nl> <nl> return true ; <nl> } <nl> <nl> - void CGBMUtils : : DestroyGbm ( ) <nl> - { <nl> - if ( m_gbm - > surface ) <nl> - { <nl> - gbm_surface_destroy ( m_gbm - > surface ) ; <nl> - } <nl> - <nl> - m_gbm - > surface = nullptr ; <nl> - } <nl> - <nl> - bool CGBMUtils : : SetVideoMode ( RESOLUTION_INFO res ) <nl> + void CGBMUtils : : DestroyGbm ( struct gbm * gbm ) <nl> { <nl> - GetMode ( res ) ; <nl> - <nl> - gbm_surface_release_buffer ( m_gbm - > surface , m_bo ) ; <nl> - <nl> - m_bo = gbm_surface_lock_front_buffer ( m_gbm - > surface ) ; <nl> - m_drm_fb = DrmFbGetFromBo ( m_bo ) ; <nl> - <nl> - auto ret = drmModeSetCrtc ( m_drm - > fd , <nl> - m_drm - > crtc_id , <nl> - m_drm_fb - > fb_id , <nl> - 0 , <nl> - 0 , <nl> - & m_drm - > connector_id , <nl> - 1 , <nl> - m_drm - > mode ) ; <nl> - <nl> - if ( ret = = - 1 ) <nl> + if ( gbm - > surface ) <nl> { <nl> - CLog : : Log ( LOGERROR , <nl> - " CGBMUtils : : % s - failed to set crtc mode : % dx % d % s @ % d Hz " , <nl> - __FUNCTION__ , <nl> - m_drm - > mode - > hdisplay , <nl> - m_drm - > mode - > vdisplay , <nl> - m_drm - > mode - > flags & DRM_MODE_FLAG_INTERLACE ? " i " : " " , <nl> - m_drm - > mode - > vrefresh ) ; <nl> - <nl> - return false ; <nl> - } <nl> - <nl> - CLog : : Log ( LOGDEBUG , " CGBMUtils : : % s - set crtc mode : % dx % d % s @ % d Hz " , <nl> - __FUNCTION__ , <nl> - m_drm - > mode - > hdisplay , <nl> - m_drm - > mode - > vdisplay , <nl> - m_drm - > mode - > flags & DRM_MODE_FLAG_INTERLACE ? " i " : " " , <nl> - m_drm - > mode - > vrefresh ) ; <nl> - <nl> - return true ; <nl> - } <nl> - <nl> - bool CGBMUtils : : GetMode ( RESOLUTION_INFO res ) <nl> - { <nl> - m_drm - > mode = & m_drm_connector - > modes [ atoi ( res . strId . c_str ( ) ) ] ; <nl> - <nl> - CLog : : Log ( LOGDEBUG , " CGBMUtils : : % s - found crtc mode : % dx % d % s @ % d Hz " , <nl> - __FUNCTION__ , <nl> - m_drm - > mode - > hdisplay , <nl> - m_drm - > mode - > vdisplay , <nl> - m_drm - > mode - > flags & DRM_MODE_FLAG_INTERLACE ? " i " : " " , <nl> - m_drm - > mode - > vrefresh ) ; <nl> - <nl> - return true ; <nl> - } <nl> - <nl> - void CGBMUtils : : DrmFbDestroyCallback ( struct gbm_bo * bo , void * data ) <nl> - { <nl> - struct drm_fb * fb = static_cast < drm_fb * > ( data ) ; <nl> - <nl> - if ( fb - > fb_id ) <nl> - { <nl> - drmModeRmFB ( m_drm - > fd , fb - > fb_id ) ; <nl> - } <nl> - <nl> - delete ( fb ) ; <nl> - } <nl> - <nl> - drm_fb * CGBMUtils : : DrmFbGetFromBo ( struct gbm_bo * bo ) <nl> - { <nl> - { <nl> - struct drm_fb * fb = static_cast < drm_fb * > ( gbm_bo_get_user_data ( bo ) ) ; <nl> - if ( fb ) <nl> - { <nl> - return fb ; <nl> - } <nl> - } <nl> - <nl> - struct drm_fb * fb = new drm_fb ; <nl> - fb - > bo = bo ; <nl> - <nl> - uint32_t width = gbm_bo_get_width ( bo ) ; <nl> - uint32_t height = gbm_bo_get_height ( bo ) ; <nl> - uint32_t stride = gbm_bo_get_stride ( bo ) ; <nl> - uint32_t handle = gbm_bo_get_handle ( bo ) . u32 ; <nl> - <nl> - auto ret = drmModeAddFB ( m_drm - > fd , <nl> - width , <nl> - height , <nl> - 24 , <nl> - 32 , <nl> - stride , <nl> - handle , <nl> - & fb - > fb_id ) ; <nl> - <nl> - if ( ret ) <nl> - { <nl> - delete ( fb ) ; <nl> - CLog : : Log ( LOGDEBUG , " CGBMUtils : : % s - failed to add framebuffer " , __FUNCTION__ ) ; <nl> - return nullptr ; <nl> - } <nl> - <nl> - gbm_bo_set_user_data ( bo , fb , DrmFbDestroyCallback ) ; <nl> - <nl> - return fb ; <nl> - } <nl> - <nl> - void CGBMUtils : : PageFlipHandler ( int fd , unsigned int frame , unsigned int sec , <nl> - unsigned int usec , void * data ) <nl> - { <nl> - ( void ) fd , ( void ) frame , ( void ) sec , ( void ) usec ; <nl> - <nl> - int * flip_happening = static_cast < int * > ( data ) ; <nl> - * flip_happening = 0 ; <nl> - } <nl> - <nl> - bool CGBMUtils : : WaitingForFlip ( ) <nl> - { <nl> - if ( ! flip_happening ) <nl> - { <nl> - return false ; <nl> - } <nl> - <nl> - m_drm_fds . revents = 0 ; <nl> - <nl> - while ( flip_happening ) <nl> - { <nl> - auto ret = poll ( & m_drm_fds , 1 , - 1 ) ; <nl> - <nl> - if ( ret < 0 ) <nl> - { <nl> - return true ; <nl> - } <nl> - <nl> - if ( m_drm_fds . revents & ( POLLHUP | POLLERR ) ) <nl> - { <nl> - return true ; <nl> - } <nl> - <nl> - if ( m_drm_fds . revents & POLLIN ) <nl> - { <nl> - drmHandleEvent ( m_drm - > fd , & m_drm_evctx ) ; <nl> - } <nl> - } <nl> - <nl> - gbm_surface_release_buffer ( m_gbm - > surface , m_bo ) ; <nl> - m_bo = m_next_bo ; <nl> - <nl> - return false ; <nl> - } <nl> - <nl> - bool CGBMUtils : : QueueFlip ( ) <nl> - { <nl> - m_next_bo = gbm_surface_lock_front_buffer ( m_gbm - > surface ) ; <nl> - m_drm_fb = DrmFbGetFromBo ( m_next_bo ) ; <nl> - <nl> - auto ret = drmModePageFlip ( m_drm - > fd , <nl> - m_drm - > crtc_id , <nl> - m_drm_fb - > fb_id , <nl> - DRM_MODE_PAGE_FLIP_EVENT , <nl> - & flip_happening ) ; <nl> - <nl> - if ( ret ) <nl> - { <nl> - CLog : : Log ( LOGDEBUG , " CGBMUtils : : % s - failed to queue DRM page flip " , __FUNCTION__ ) ; <nl> - return false ; <nl> - } <nl> - <nl> - return true ; <nl> - } <nl> - <nl> - void CGBMUtils : : FlipPage ( ) <nl> - { <nl> - if ( WaitingForFlip ( ) ) <nl> - { <nl> - return ; <nl> - } <nl> - <nl> - flip_happening = QueueFlip ( ) ; <nl> - <nl> - if ( g_Windowing . NoOfBuffers ( ) > = 3 & & gbm_surface_has_free_buffers ( m_gbm - > surface ) ) <nl> - { <nl> - return ; <nl> - } <nl> - <nl> - WaitingForFlip ( ) ; <nl> - } <nl> - <nl> - bool CGBMUtils : : GetResources ( ) <nl> - { <nl> - m_drm_resources = drmModeGetResources ( m_drm - > fd ) ; <nl> - if ( ! m_drm_resources ) <nl> - { <nl> - return false ; <nl> - } <nl> - <nl> - return true ; <nl> - } <nl> - <nl> - bool CGBMUtils : : GetConnector ( ) <nl> - { <nl> - for ( auto i = 0 ; i < m_drm_resources - > count_connectors ; i + + ) <nl> - { <nl> - m_drm_connector = drmModeGetConnector ( m_drm - > fd , <nl> - m_drm_resources - > connectors [ i ] ) ; <nl> - if ( m_drm_connector - > connection = = DRM_MODE_CONNECTED ) <nl> - { <nl> - CLog : : Log ( LOGDEBUG , " CGBMUtils : : % s - found connector : % d " , __FUNCTION__ , <nl> - m_drm_connector - > connector_type ) ; <nl> - break ; <nl> - } <nl> - drmModeFreeConnector ( m_drm_connector ) ; <nl> - m_drm_connector = nullptr ; <nl> - } <nl> - <nl> - if ( ! m_drm_connector ) <nl> - { <nl> - return false ; <nl> - } <nl> - <nl> - return true ; <nl> - } <nl> - <nl> - bool CGBMUtils : : GetEncoder ( ) <nl> - { <nl> - for ( auto i = 0 ; i < m_drm_resources - > count_encoders ; i + + ) <nl> - { <nl> - m_drm_encoder = drmModeGetEncoder ( m_drm - > fd , m_drm_resources - > encoders [ i ] ) ; <nl> - if ( m_drm_encoder - > encoder_id = = m_drm_connector - > encoder_id ) <nl> - { <nl> - CLog : : Log ( LOGDEBUG , " CGBMUtils : : % s - found encoder : % d " , __FUNCTION__ , <nl> - m_drm_encoder - > encoder_type ) ; <nl> - break ; <nl> - } <nl> - drmModeFreeEncoder ( m_drm_encoder ) ; <nl> - m_drm_encoder = nullptr ; <nl> - } <nl> - <nl> - if ( ! m_drm_encoder ) <nl> - { <nl> - return false ; <nl> - } <nl> - <nl> - return true ; <nl> - } <nl> - <nl> - bool CGBMUtils : : GetPreferredMode ( ) <nl> - { <nl> - for ( auto i = 0 , area = 0 ; i < m_drm_connector - > count_modes ; i + + ) <nl> - { <nl> - drmModeModeInfo * current_mode = & m_drm_connector - > modes [ i ] ; <nl> - <nl> - if ( current_mode - > type & DRM_MODE_TYPE_PREFERRED ) <nl> - { <nl> - m_drm - > mode = current_mode ; <nl> - CLog : : Log ( LOGDEBUG , <nl> - " CGBMUtils : : % s - found preferred mode : % dx % d % s @ % d Hz " , <nl> - __FUNCTION__ , <nl> - m_drm - > mode - > hdisplay , <nl> - m_drm - > mode - > vdisplay , <nl> - m_drm - > mode - > flags & DRM_MODE_FLAG_INTERLACE ? " i " : " " , <nl> - m_drm - > mode - > vrefresh ) ; <nl> - break ; <nl> - } <nl> - <nl> - auto current_area = current_mode - > hdisplay * current_mode - > vdisplay ; <nl> - if ( current_area > area ) <nl> - { <nl> - m_drm - > mode = current_mode ; <nl> - area = current_area ; <nl> - } <nl> - } <nl> - <nl> - if ( ! m_drm - > mode ) <nl> - { <nl> - CLog : : Log ( LOGDEBUG , " CGBMUtils : : % s - failed to find preferred mode " , __FUNCTION__ ) ; <nl> - return false ; <nl> - } <nl> - <nl> - return true ; <nl> - } <nl> - <nl> - bool CGBMUtils : : InitDrm ( ) <nl> - { <nl> - const char * device = " / dev / dri / card0 " ; <nl> - <nl> - m_drm - > fd = open ( device , O_RDWR ) ; <nl> - <nl> - if ( m_drm - > fd < 0 ) <nl> - { <nl> - return false ; <nl> - } <nl> - <nl> - if ( ! GetResources ( ) ) <nl> - { <nl> - return false ; <nl> - } <nl> - <nl> - if ( ! GetConnector ( ) ) <nl> - { <nl> - return false ; <nl> - } <nl> - <nl> - if ( ! GetEncoder ( ) ) <nl> - { <nl> - return false ; <nl> - } <nl> - else <nl> - { <nl> - m_drm - > crtc_id = m_drm_encoder - > crtc_id ; <nl> - } <nl> - <nl> - if ( ! GetPreferredMode ( ) ) <nl> - { <nl> - return false ; <nl> - } <nl> - <nl> - for ( auto i = 0 ; i < m_drm_resources - > count_crtcs ; i + + ) <nl> - { <nl> - if ( m_drm_resources - > crtcs [ i ] = = m_drm - > crtc_id ) <nl> - { <nl> - m_drm - > crtc_index = i ; <nl> - break ; <nl> - } <nl> - } <nl> - <nl> - drmModeFreeResources ( m_drm_resources ) ; <nl> - <nl> - drmSetMaster ( m_drm - > fd ) ; <nl> - <nl> - m_gbm - > dev = gbm_create_device ( m_drm - > fd ) ; <nl> - m_gbm - > surface = nullptr ; <nl> - <nl> - m_drm_fds . fd = m_drm - > fd ; <nl> - m_drm_fds . events = POLLIN ; <nl> - <nl> - m_drm_evctx . version = DRM_EVENT_CONTEXT_VERSION ; <nl> - m_drm_evctx . page_flip_handler = PageFlipHandler ; <nl> - <nl> - m_drm - > connector_id = m_drm_connector - > connector_id ; <nl> - m_orig_crtc = drmModeGetCrtc ( m_drm - > fd , m_drm - > crtc_id ) ; <nl> - <nl> - return true ; <nl> - } <nl> - <nl> - bool CGBMUtils : : RestoreOriginalMode ( ) <nl> - { <nl> - if ( ! m_orig_crtc ) <nl> - { <nl> - return false ; <nl> - } <nl> - <nl> - auto ret = drmModeSetCrtc ( m_drm - > fd , <nl> - m_orig_crtc - > crtc_id , <nl> - m_orig_crtc - > buffer_id , <nl> - m_orig_crtc - > x , <nl> - m_orig_crtc - > y , <nl> - & m_drm - > connector_id , <nl> - 1 , <nl> - & m_orig_crtc - > mode ) ; <nl> - <nl> - if ( ret ) <nl> - { <nl> - CLog : : Log ( LOGERROR , " CGBMUtils : : % s - failed to set original crtc mode " , __FUNCTION__ ) ; <nl> - return false ; <nl> - } <nl> - <nl> - CLog : : Log ( LOGDEBUG , " CGBMUtils : : % s - set original crtc mode " , __FUNCTION__ ) ; <nl> - <nl> - drmModeFreeCrtc ( m_orig_crtc ) ; <nl> - m_orig_crtc = nullptr ; <nl> - <nl> - return true ; <nl> - } <nl> - <nl> - void CGBMUtils : : DestroyDrm ( ) <nl> - { <nl> - RestoreOriginalMode ( ) ; <nl> - <nl> - if ( m_gbm - > surface ) <nl> - { <nl> - gbm_surface_destroy ( m_gbm - > surface ) ; <nl> - } <nl> - <nl> - if ( m_gbm - > dev ) <nl> - { <nl> - gbm_device_destroy ( m_gbm - > dev ) ; <nl> - } <nl> - <nl> - if ( m_drm_encoder ) <nl> - { <nl> - drmModeFreeEncoder ( m_drm_encoder ) ; <nl> - } <nl> - <nl> - if ( m_drm_connector ) <nl> - { <nl> - drmModeFreeConnector ( m_drm_connector ) ; <nl> - } <nl> - <nl> - if ( m_drm_resources ) <nl> - { <nl> - drmModeFreeResources ( m_drm_resources ) ; <nl> - } <nl> - <nl> - drmDropMaster ( m_drm - > fd ) ; <nl> - close ( m_drm - > fd ) ; <nl> - <nl> - m_drm_encoder = nullptr ; <nl> - m_drm_connector = nullptr ; <nl> - m_drm_resources = nullptr ; <nl> - <nl> - m_drm - > connector = nullptr ; <nl> - m_drm - > connector_id = 0 ; <nl> - m_drm - > crtc = nullptr ; <nl> - m_drm - > crtc_id = 0 ; <nl> - m_drm - > crtc_index = 0 ; <nl> - m_drm - > fd = - 1 ; <nl> - m_drm - > mode = nullptr ; <nl> - <nl> - m_gbm = nullptr ; <nl> - <nl> - m_bo = nullptr ; <nl> - m_next_bo = nullptr ; <nl> - } <nl> - <nl> - bool CGBMUtils : : GetModes ( std : : vector < RESOLUTION_INFO > & resolutions ) <nl> - { <nl> - for ( auto i = 0 ; i < m_drm_connector - > count_modes ; i + + ) <nl> - { <nl> - RESOLUTION_INFO res ; <nl> - res . iScreen = 0 ; <nl> - res . iWidth = m_drm_connector - > modes [ i ] . hdisplay ; <nl> - res . iHeight = m_drm_connector - > modes [ i ] . vdisplay ; <nl> - res . iScreenWidth = m_drm_connector - > modes [ i ] . hdisplay ; <nl> - res . iScreenHeight = m_drm_connector - > modes [ i ] . vdisplay ; <nl> - res . fRefreshRate = m_drm_connector - > modes [ i ] . vrefresh ; <nl> - res . iSubtitles = static_cast < int > ( 0 . 965 * res . iHeight ) ; <nl> - res . fPixelRatio = 1 . 0f ; <nl> - res . bFullScreen = true ; <nl> - res . strMode = m_drm_connector - > modes [ i ] . name ; <nl> - res . strId = std : : to_string ( i ) ; <nl> - <nl> - if ( m_drm_connector - > modes [ i ] . flags & DRM_MODE_FLAG_3D_MASK ) <nl> - { <nl> - if ( m_drm_connector - > modes [ i ] . flags & DRM_MODE_FLAG_3D_TOP_AND_BOTTOM ) <nl> - { <nl> - res . dwFlags = D3DPRESENTFLAG_MODE3DTB ; <nl> - } <nl> - else if ( m_drm_connector - > modes [ i ] . flags <nl> - & DRM_MODE_FLAG_3D_SIDE_BY_SIDE_HALF ) <nl> - { <nl> - res . dwFlags = D3DPRESENTFLAG_MODE3DSBS ; <nl> - } <nl> - } <nl> - else if ( m_drm_connector - > modes [ i ] . flags & DRM_MODE_FLAG_INTERLACE ) <nl> - { <nl> - res . dwFlags = D3DPRESENTFLAG_INTERLACED ; <nl> - } <nl> - else <nl> - { <nl> - res . dwFlags = D3DPRESENTFLAG_PROGRESSIVE ; <nl> - } <nl> - <nl> - resolutions . push_back ( res ) ; <nl> + gbm_surface_destroy ( gbm - > surface ) ; <nl> } <nl> <nl> - return resolutions . size ( ) > 0 ; <nl> + gbm - > surface = nullptr ; <nl> } <nl> mmm a / xbmc / windowing / gbm / GBMUtils . h <nl> ppp b / xbmc / windowing / gbm / GBMUtils . h <nl> struct gbm <nl> int width , height ; <nl> } ; <nl> <nl> - struct crtc <nl> - { <nl> - drmModeCrtc * crtc ; <nl> - drmModeObjectProperties * props ; <nl> - drmModePropertyRes * * props_info ; <nl> - } ; <nl> - <nl> - struct connector <nl> - { <nl> - drmModeConnector * connector ; <nl> - drmModeObjectProperties * props ; <nl> - drmModePropertyRes * * props_info ; <nl> - } ; <nl> - <nl> - struct drm <nl> - { <nl> - int fd ; <nl> - <nl> - struct crtc * crtc ; <nl> - struct connector * connector ; <nl> - int crtc_index ; <nl> - <nl> - drmModeModeInfo * mode ; <nl> - uint32_t crtc_id ; <nl> - uint32_t connector_id ; <nl> - } ; <nl> - <nl> - struct drm_fb <nl> - { <nl> - struct gbm_bo * bo ; <nl> - uint32_t fb_id ; <nl> - } ; <nl> - <nl> class CGBMUtils <nl> { <nl> public : <nl> - static gbm * GetGbm ( ) ; <nl> - static drm * GetDrm ( ) ; <nl> - static bool InitDrm ( ) ; <nl> - static bool InitGbm ( RESOLUTION_INFO res ) ; <nl> - static void DestroyGbm ( ) ; <nl> - static bool SetVideoMode ( RESOLUTION_INFO res ) ; <nl> - static void FlipPage ( ) ; <nl> - static void DestroyDrm ( ) ; <nl> - static bool GetModes ( std : : vector < RESOLUTION_INFO > & resolutions ) ; <nl> - private : <nl> - static bool GetMode ( RESOLUTION_INFO res ) ; <nl> - static bool GetResources ( ) ; <nl> - static bool GetConnector ( ) ; <nl> - static bool GetEncoder ( ) ; <nl> - static bool GetPreferredMode ( ) ; <nl> - static bool RestoreOriginalMode ( ) ; <nl> - static bool WaitingForFlip ( ) ; <nl> - static bool QueueFlip ( ) ; <nl> - static void PageFlipHandler ( int fd , unsigned int frame , unsigned int sec , <nl> - unsigned int usec , void * data ) ; <nl> - static void DrmFbDestroyCallback ( struct gbm_bo * bo , void * data ) ; <nl> - static drm_fb * DrmFbGetFromBo ( struct gbm_bo * bo ) ; <nl> + static bool InitGbm ( struct gbm * gbm , int hdisplay , int vdisplay ) ; <nl> + static void DestroyGbm ( struct gbm * gbm ) ; <nl> } ; <nl> mmm a / xbmc / windowing / gbm / WinSystemGbm . cpp <nl> ppp b / xbmc / windowing / gbm / WinSystemGbm . cpp <nl> <nl> # include " utils / log . h " <nl> <nl> CWinSystemGbm : : CWinSystemGbm ( ) : <nl> - m_gbm ( nullptr ) , <nl> - m_drm ( nullptr ) , <nl> m_nativeDisplay ( nullptr ) , <nl> m_nativeWindow ( nullptr ) <nl> { <nl> CWinSystemGbm : : CWinSystemGbm ( ) : <nl> <nl> bool CWinSystemGbm : : InitWindowSystem ( ) <nl> { <nl> - if ( ! CGBMUtils : : InitDrm ( ) ) <nl> + if ( ! m_DRM . InitDrm ( & m_drm , & m_gbm ) ) <nl> { <nl> CLog : : Log ( LOGERROR , " CWinSystemGbm : : % s - failed to initialize DRM " , __FUNCTION__ ) ; <nl> return false ; <nl> } <nl> <nl> - m_drm = CGBMUtils : : GetDrm ( ) ; <nl> - m_gbm = CGBMUtils : : GetGbm ( ) ; <nl> - <nl> - m_nativeDisplay = m_gbm - > dev ; <nl> - <nl> - if ( ! m_drm ) <nl> - { <nl> - return false ; <nl> - } <nl> - <nl> - if ( ! m_gbm ) <nl> - { <nl> - return false ; <nl> - } <nl> + m_nativeDisplay = m_gbm . dev ; <nl> <nl> CLog : : Log ( LOGDEBUG , " CWinSystemGbm : : % s - initialized DRM " , __FUNCTION__ ) ; <nl> return CWinSystemBase : : InitWindowSystem ( ) ; <nl> bool CWinSystemGbm : : InitWindowSystem ( ) <nl> <nl> bool CWinSystemGbm : : DestroyWindowSystem ( ) <nl> { <nl> - CGBMUtils : : DestroyDrm ( ) ; <nl> + m_DRM . DestroyDrm ( ) ; <nl> m_nativeDisplay = nullptr ; <nl> - m_drm = nullptr ; <nl> - m_gbm = nullptr ; <nl> <nl> CLog : : Log ( LOGDEBUG , " CWinSystemGbm : : % s - deinitialized DRM " , __FUNCTION__ ) ; <nl> return true ; <nl> bool CWinSystemGbm : : CreateNewWindow ( const std : : string & name , <nl> bool fullScreen , <nl> RESOLUTION_INFO & res ) <nl> { <nl> - if ( ! CGBMUtils : : InitGbm ( res ) ) <nl> + if ( ! CGBMUtils : : InitGbm ( & m_gbm , m_drm . mode - > hdisplay , m_drm . mode - > vdisplay ) ) <nl> { <nl> CLog : : Log ( LOGERROR , " CWinSystemGbm : : % s - failed to initialize GBM " , __FUNCTION__ ) ; <nl> return false ; <nl> } <nl> <nl> - m_nativeWindow = m_gbm - > surface ; <nl> + m_nativeWindow = m_gbm . surface ; <nl> <nl> CLog : : Log ( LOGDEBUG , " CWinSystemGbm : : % s - initialized GBM " , __FUNCTION__ ) ; <nl> return true ; <nl> bool CWinSystemGbm : : CreateNewWindow ( const std : : string & name , <nl> <nl> bool CWinSystemGbm : : DestroyWindow ( ) <nl> { <nl> - CGBMUtils : : DestroyGbm ( ) ; <nl> + CGBMUtils : : DestroyGbm ( & m_gbm ) ; <nl> m_nativeWindow = nullptr ; <nl> <nl> CLog : : Log ( LOGDEBUG , " CWinSystemGbm : : % s - deinitialized GBM " , __FUNCTION__ ) ; <nl> void CWinSystemGbm : : UpdateResolutions ( ) <nl> <nl> UpdateDesktopResolution ( CDisplaySettings : : GetInstance ( ) . GetResolutionInfo ( RES_DESKTOP ) , <nl> 0 , <nl> - m_drm - > mode - > hdisplay , <nl> - m_drm - > mode - > vdisplay , <nl> - m_drm - > mode - > vrefresh ) ; <nl> + m_drm . mode - > hdisplay , <nl> + m_drm . mode - > vdisplay , <nl> + m_drm . mode - > vrefresh ) ; <nl> <nl> std : : vector < RESOLUTION_INFO > resolutions ; <nl> <nl> - if ( ! CGBMUtils : : GetModes ( resolutions ) | | resolutions . empty ( ) ) <nl> + if ( ! CDRMUtils : : GetModes ( resolutions ) | | resolutions . empty ( ) ) <nl> { <nl> CLog : : Log ( LOGWARNING , " CWinSystemGbm : : % s - Failed to get resolutions " , __FUNCTION__ ) ; <nl> } <nl> else <nl> { <nl> - for ( auto i = 0 ; i < resolutions . size ( ) ; i + + ) <nl> + for ( unsigned int i = 0 ; i < resolutions . size ( ) ; i + + ) <nl> { <nl> g_graphicsContext . ResetOverscan ( resolutions [ i ] ) ; <nl> CDisplaySettings : : GetInstance ( ) . AddResolutionInfo ( resolutions [ i ] ) ; <nl> bool CWinSystemGbm : : ResizeWindow ( int newWidth , int newHeight , int newLeft , int n <nl> <nl> bool CWinSystemGbm : : SetFullScreen ( bool fullScreen , RESOLUTION_INFO & res , bool blankOtherDisplays ) <nl> { <nl> - auto ret = CGBMUtils : : SetVideoMode ( res ) ; <nl> - <nl> + auto ret = m_DRM . SetVideoMode ( res ) ; <nl> if ( ! ret ) <nl> { <nl> return false ; <nl> bool CWinSystemGbm : : SetFullScreen ( bool fullScreen , RESOLUTION_INFO & res , bool bl <nl> return true ; <nl> } <nl> <nl> + void CWinSystemGbm : : FlipPage ( CGLContextEGL * pGLContext ) <nl> + { <nl> + m_DRM . FlipPage ( pGLContext ) ; <nl> + } <nl> + <nl> void * CWinSystemGbm : : GetVaDisplay ( ) <nl> { <nl> # if defined ( HAVE_LIBVA ) <nl> bool CWinSystemGbm : : Show ( bool raise ) <nl> return true ; <nl> } <nl> <nl> - void CWinSystemGbm : : Register ( IDispResource * / * resource * / ) <nl> + void CWinSystemGbm : : Register ( IDispResource * resource ) <nl> { <nl> + CSingleLock lock ( m_resourceSection ) ; <nl> + m_resources . push_back ( resource ) ; <nl> } <nl> <nl> - void CWinSystemGbm : : Unregister ( IDispResource * / * resource * / ) <nl> + void CWinSystemGbm : : Unregister ( IDispResource * resource ) <nl> { <nl> + CSingleLock lock ( m_resourceSection ) ; <nl> + std : : vector < IDispResource * > : : iterator i = find ( m_resources . begin ( ) , m_resources . end ( ) , resource ) ; <nl> + if ( i ! = m_resources . end ( ) ) <nl> + { <nl> + m_resources . erase ( i ) ; <nl> + } <nl> } <nl> mmm a / xbmc / windowing / gbm / WinSystemGbm . h <nl> ppp b / xbmc / windowing / gbm / WinSystemGbm . h <nl> <nl> <nl> # include " threads / CriticalSection . h " <nl> # include " windowing / WinSystem . h " <nl> - # include " GBMUtils . h " <nl> + # include " DRM . h " <nl> + # include " GLContextEGL . h " <nl> <nl> class IDispResource ; <nl> <nl> class CWinSystemGbm : public CWinSystemBase <nl> bool ResizeWindow ( int newWidth , int newHeight , int newLeft , int newTop ) override ; <nl> bool SetFullScreen ( bool fullScreen , RESOLUTION_INFO & res , bool blankOtherDisplays ) override ; <nl> <nl> + void FlipPage ( CGLContextEGL * m_pGLContext ) ; <nl> + <nl> void UpdateResolutions ( ) override ; <nl> <nl> void * GetVaDisplay ( ) ; <nl> class CWinSystemGbm : public CWinSystemBase <nl> virtual void Unregister ( IDispResource * resource ) ; <nl> <nl> protected : <nl> - gbm * m_gbm ; <nl> - drm * m_drm ; <nl> + CDRM m_DRM ; <nl> + <nl> + gbm m_gbm ; <nl> + drm m_drm ; <nl> <nl> EGLDisplay m_nativeDisplay ; <nl> EGLNativeWindowType m_nativeWindow ; <nl> + <nl> + CCriticalSection m_resourceSection ; <nl> + std : : vector < IDispResource * > m_resources ; <nl> } ; <nl> mmm a / xbmc / windowing / gbm / WinSystemGbmGLESContext . cpp <nl> ppp b / xbmc / windowing / gbm / WinSystemGbmGLESContext . cpp <nl> bool CWinSystemGbmGLESContext : : CreateNewWindow ( const std : : string & name , <nl> <nl> bool CWinSystemGbmGLESContext : : SetFullScreen ( bool fullScreen , RESOLUTION_INFO & res , bool blankOtherDisplays ) <nl> { <nl> - if ( res . iWidth ! = m_drm - > mode - > hdisplay | | <nl> - res . iHeight ! = m_drm - > mode - > vdisplay ) <nl> + if ( res . iWidth ! = m_drm . mode - > hdisplay | | <nl> + res . iHeight ! = m_drm . mode - > vdisplay ) <nl> { <nl> CLog : : Log ( LOGDEBUG , " CWinSystemGbmGLESContext : : % s - resolution changed , creating a new window " , __FUNCTION__ ) ; <nl> CreateNewWindow ( " " , fullScreen , res ) ; <nl> void CWinSystemGbmGLESContext : : PresentRenderImpl ( bool rendered ) <nl> if ( rendered ) <nl> { <nl> m_pGLContext . SwapBuffers ( ) ; <nl> - CGBMUtils : : FlipPage ( ) ; <nl> + CWinSystemGbm : : FlipPage ( & m_pGLContext ) ; <nl> } <nl> } <nl> <nl>
Merge pull request from lrusak / drm - atomic - prep
xbmc/xbmc
ebca8c91911d50c215690171875ed916b438031b
2017-10-11T16:03:13Z
mmm a / lib / IRGen / GenKeyPath . cpp <nl> ppp b / lib / IRGen / GenKeyPath . cpp <nl> IRGenModule : : getAddrOfKeyPathPattern ( KeyPathPattern * pattern , <nl> / / / Generate a metadata accessor that produces metadata for the given type <nl> / / / using arguments from the generic context of the key path . <nl> auto emitMetadataGenerator = [ & ] ( CanType type ) - > llvm : : Function * { <nl> - if ( ! type - > hasTypeParameter ( ) ) <nl> - / / We can just use the regular metadata accessor . <nl> - / / TODO : Make a local copy of public symbols we can relative - reference ? <nl> - return getAddrOfTypeMetadataAccessFunction ( type , NotForDefinition ) ; <nl> + / / TODO : Use the standard metadata accessor when there are no arguments <nl> + / / and the metadata accessor is defined . <nl> <nl> / / Build a stub that loads the necessary bindings from the key path ' s <nl> / / argument buffer then fetches the metadata . <nl> IRGenModule : : getAddrOfKeyPathPattern ( KeyPathPattern * pattern , <nl> IRGenFunction IGF ( * this , accessorThunk ) ; <nl> if ( DebugInfo ) <nl> DebugInfo - > emitArtificialFunction ( IGF , accessorThunk ) ; <nl> - <nl> - auto bindingsBufPtr = IGF . collectParameters ( ) . claimNext ( ) ; <nl> <nl> - bindFromGenericRequirementsBuffer ( IGF , requirements , <nl> - Address ( bindingsBufPtr , getPointerAlignment ( ) ) , <nl> - [ & ] ( CanType t ) { <nl> - return genericEnv - > mapTypeIntoContext ( t ) - > getCanonicalType ( ) ; <nl> - } ) ; <nl> + if ( type - > hasTypeParameter ( ) ) { <nl> + auto bindingsBufPtr = IGF . collectParameters ( ) . claimNext ( ) ; <nl> + <nl> + bindFromGenericRequirementsBuffer ( IGF , requirements , <nl> + Address ( bindingsBufPtr , getPointerAlignment ( ) ) , <nl> + [ & ] ( CanType t ) { <nl> + if ( ! genericEnv ) <nl> + return t ; <nl> + return genericEnv - > mapTypeIntoContext ( t ) - > getCanonicalType ( ) ; <nl> + } ) ; <nl> <nl> - auto ret = IGF . emitTypeMetadataRef ( genericEnv - > mapTypeIntoContext ( type ) <nl> - - > getCanonicalType ( ) ) ; <nl> + type = genericEnv - > mapTypeIntoContext ( type ) - > getCanonicalType ( ) ; <nl> + } <nl> + auto ret = IGF . emitTypeMetadataRef ( type ) ; <nl> IGF . Builder . CreateRet ( ret ) ; <nl> } <nl> return accessorThunk ; <nl> mmm a / lib / IRGen / IRGenSIL . cpp <nl> ppp b / lib / IRGen / IRGenSIL . cpp <nl> void IRGenSILFunction : : visitKeyPathInst ( swift : : KeyPathInst * I ) { <nl> auto call = Builder . CreateCall ( IGM . getGetKeyPathFn ( ) , { patternPtr , args } ) ; <nl> call - > setDoesNotThrow ( ) ; <nl> <nl> + auto resultStorageTy = IGM . getTypeInfo ( I - > getType ( ) ) . getStorageType ( ) ; <nl> + <nl> Explosion e ; <nl> - e . add ( call ) ; <nl> + e . add ( Builder . CreateBitCast ( call , resultStorageTy ) ) ; <nl> setLoweredExplosion ( I , e ) ; <nl> } <nl> <nl> mmm a / stdlib / public / core / KeyPath . swift <nl> ppp b / stdlib / public / core / KeyPath . swift <nl> public func swift_getKeyPath ( pattern : UnsafeMutableRawPointer , <nl> / / These are resolved dynamically , so that they always reflect the dynamic <nl> / / capability of the properties involved . <nl> let oncePtr = pattern <nl> - let objectPtr = pattern . advanced ( by : MemoryLayout < Int > . size ) <nl> - let bufferPtr = objectPtr . advanced ( by : MemoryLayout < HeapObject > . size ) <nl> + let patternPtr = pattern . advanced ( by : MemoryLayout < Int > . size ) <nl> + let bufferPtr = patternPtr . advanced ( by : MemoryLayout < HeapObject > . size ) <nl> <nl> / / If the pattern is instantiable in - line , do a dispatch_once to <nl> / / initialize it . ( The resulting object will still have the collocated <nl> public func swift_getKeyPath ( pattern : UnsafeMutableRawPointer , <nl> bufferHeader . validateReservedBits ( ) <nl> <nl> if bufferHeader . instantiableInLine { <nl> - Builtin . onceWithContext ( oncePtr . _rawValue , _getKeyPath_instantiatedInline , <nl> - objectPtr . _rawValue ) <nl> + Builtin . onceWithContext ( oncePtr . _rawValue , _getKeyPath_instantiateInline , <nl> + patternPtr . _rawValue ) <nl> / / Return the instantiated object at + 1 . <nl> / / TODO : This will be unnecessary once we support global objects with inert <nl> / / refcounting . <nl> - let object = Unmanaged < AnyKeyPath > . fromOpaque ( objectPtr ) <nl> + let object = Unmanaged < AnyKeyPath > . fromOpaque ( patternPtr ) <nl> _ = object . retain ( ) <nl> - return UnsafeRawPointer ( objectPtr ) <nl> + return UnsafeRawPointer ( patternPtr ) <nl> + } <nl> + <nl> + / / Otherwise , instantiate a new key path object modeled on the pattern . <nl> + return _getKeyPath_instantiatedOutOfLine ( patternPtr , arguments ) <nl> + } <nl> + <nl> + internal func _getKeyPath_instantiatedOutOfLine ( <nl> + _ pattern : UnsafeRawPointer , <nl> + _ arguments : UnsafeRawPointer ) <nl> + - > UnsafeRawPointer { <nl> + / / Do a pass to determine the class of the key path we ' ll be instantiating <nl> + / / and how much space we ' ll need for it . <nl> + let ( keyPathClass , rootType , size ) <nl> + = _getKeyPathClassAndInstanceSize ( pattern , arguments ) <nl> + <nl> + / / Allocate the instance . <nl> + let instance = keyPathClass . _create ( capacityInBytes : size ) { instanceData in <nl> + / / Instantiate the pattern into the instance . <nl> + let patternBufferPtr = pattern . advanced ( by : MemoryLayout < HeapObject > . size ) <nl> + let patternBuffer = KeyPathBuffer ( base : patternBufferPtr ) <nl> + <nl> + _instantiateKeyPathBuffer ( patternBuffer , instanceData , rootType , arguments ) <nl> } <nl> - / / TODO : Handle cases that require per - instance instantiation <nl> - fatalError ( " not implemented " ) <nl> + <nl> + / / Hand it off at + 1 . <nl> + return UnsafeRawPointer ( Unmanaged . passRetained ( instance ) . toOpaque ( ) ) <nl> } <nl> <nl> - internal func _getKeyPath_instantiatedInline ( <nl> + internal func _getKeyPath_instantiateInline ( <nl> _ objectRawPtr : Builtin . RawPointer <nl> ) { <nl> let objectPtr = UnsafeMutableRawPointer ( objectRawPtr ) <nl> + <nl> + / / Do a pass to determine the class of the key path we ' ll be instantiating <nl> + / / and how much space we ' ll need for it . <nl> + / / The pattern argument doesn ' t matter since an in - place pattern should never <nl> + / / have arguments . <nl> + let ( keyPathClass , rootType , instantiatedSize ) <nl> + = _getKeyPathClassAndInstanceSize ( objectPtr , objectPtr ) <nl> + <nl> + / / TODO : Eventually , we ' ll need to handle cases where the instantiated <nl> + / / key path has a different size from the pattern ( because it involves <nl> + / / resilient types , for example ) . For now , require that the size match the <nl> + / / buffer . <nl> + <nl> let bufferPtr = objectPtr . advanced ( by : MemoryLayout < HeapObject > . size ) <nl> - var buffer = KeyPathBuffer ( base : bufferPtr ) <nl> - <nl> + let buffer = KeyPathBuffer ( base : bufferPtr ) <nl> + let totalSize = buffer . data . count + MemoryLayout < KeyPathBuffer . Header > . size <nl> + let bufferData = UnsafeMutableRawBufferPointer ( <nl> + start : bufferPtr , <nl> + count : totalSize ) <nl> + <nl> + _sanityCheck ( instantiatedSize = = totalSize , <nl> + " size - changing in - place instantiation not implemented " ) <nl> + <nl> + / / Instantiate the pattern in place . <nl> + _instantiateKeyPathBuffer ( buffer , bufferData , rootType , bufferPtr ) <nl> + <nl> + _swift_instantiateInertHeapObject ( objectPtr , <nl> + unsafeBitCast ( keyPathClass , to : OpaquePointer . self ) ) <nl> + } <nl> + <nl> + internal typealias MetadataAccessor = <nl> + @ convention ( c ) ( UnsafeRawPointer ) - > UnsafeRawPointer <nl> + <nl> + internal func _getKeyPathClassAndInstanceSize ( <nl> + _ pattern : UnsafeRawPointer , <nl> + _ arguments : UnsafeRawPointer <nl> + ) - > ( <nl> + keyPathClass : AnyKeyPath . Type , <nl> + rootType : Any . Type , <nl> + size : Int <nl> + ) { <nl> / / Resolve the root and leaf types . <nl> - typealias MetadataAccessor = @ convention ( c ) ( ) - > UnsafeRawPointer <nl> - let rootAccessor = objectPtr . load ( as : MetadataAccessor . self ) <nl> - let leafAccessor = objectPtr . load ( fromByteOffset : MemoryLayout < Int > . size , <nl> + let rootAccessor = pattern . load ( as : MetadataAccessor . self ) <nl> + let leafAccessor = pattern . load ( fromByteOffset : MemoryLayout < Int > . size , <nl> as : MetadataAccessor . self ) <nl> <nl> - let root = unsafeBitCast ( rootAccessor ( ) , to : Any . Type . self ) <nl> - let leaf = unsafeBitCast ( leafAccessor ( ) , to : Any . Type . self ) <nl> + let root = unsafeBitCast ( rootAccessor ( arguments ) , to : Any . Type . self ) <nl> + let leaf = unsafeBitCast ( leafAccessor ( arguments ) , to : Any . Type . self ) <nl> <nl> - / / Assume the key path is writable until proven otherwise <nl> + / / Scan the pattern to figure out the dynamic capability of the key path . <nl> + / / Start off assuming the key path is writable . <nl> var capability : KeyPathKind = . value <nl> - / / Track where the reference prefix begins <nl> - var endOfReferencePrefixComponent : UnsafeRawPointer ? = nil <nl> - var previousComponentAddr : UnsafeRawPointer ? = nil <nl> + <nl> + let bufferPtr = pattern . advanced ( by : MemoryLayout < HeapObject > . size ) <nl> + var buffer = KeyPathBuffer ( base : bufferPtr ) <nl> + let size = buffer . data . count + MemoryLayout < KeyPathBuffer . Header > . size <nl> + <nl> + scanComponents : while true { <nl> + let header = buffer . pop ( RawKeyPathComponent . Header . self ) <nl> + <nl> + func popOffset ( ) { <nl> + if header . payload = = RawKeyPathComponent . Header . unresolvedOffsetPayload <nl> + | | header . payload = = RawKeyPathComponent . Header . outOfLineOffsetPayload { <nl> + _ = buffer . pop ( UInt32 . self ) <nl> + } <nl> + } <nl> + <nl> + switch header . kind { <nl> + case . struct : <nl> + / / No effect on the capability . <nl> + / / TODO : we should dynamically prevent " let " properties from being <nl> + / / reassigned . <nl> + popOffset ( ) <nl> + case . class : <nl> + / / The rest of the key path could be reference - writable . <nl> + / / TODO : we should dynamically prevent " let " properties from being <nl> + / / reassigned . <nl> + capability = . reference <nl> + popOffset ( ) <nl> + case . optionalChain , <nl> + . optionalWrap : <nl> + / / Chaining always renders the whole key path read - only . <nl> + capability = . readOnly <nl> + break scanComponents <nl> + <nl> + case . optionalForce : <nl> + / / No effect . <nl> + break <nl> + } <nl> + <nl> + / / Break if this is the last component . <nl> + if buffer . data . count = = 0 { break } <nl> + <nl> + / / Pop the type accessor reference . <nl> + _ = buffer . popRaw ( MemoryLayout < Int > . size ) <nl> + } <nl> + <nl> + / / Grab the class object for the key path type we ' ll end up with . <nl> + func openRoot < Root > ( _ : Root . Type ) - > AnyKeyPath . Type { <nl> + func openLeaf < Leaf > ( _ : Leaf . Type ) - > AnyKeyPath . Type { <nl> + switch capability { <nl> + case . readOnly : <nl> + return KeyPath < Root , Leaf > . self <nl> + case . value : <nl> + return WritableKeyPath < Root , Leaf > . self <nl> + case . reference : <nl> + return ReferenceWritableKeyPath < Root , Leaf > . self <nl> + } <nl> + } <nl> + return _openExistential ( leaf , do : openLeaf ) <nl> + } <nl> + let classTy = _openExistential ( root , do : openRoot ) <nl> + <nl> + return ( keyPathClass : classTy , rootType : root , size : size ) <nl> + } <nl> + <nl> + internal func _instantiateKeyPathBuffer ( <nl> + _ origPatternBuffer : KeyPathBuffer , <nl> + _ origDestData : UnsafeMutableRawBufferPointer , <nl> + _ rootType : Any . Type , <nl> + _ arguments : UnsafeRawPointer <nl> + ) { <nl> + / / NB : patternBuffer and destData alias when the pattern is instantiable <nl> + / / in - line . Therefore , do not read from patternBuffer after the same position <nl> + / / in destBuffer has been written to . <nl> + <nl> + var patternBuffer = origPatternBuffer <nl> + let destHeaderPtr = origDestData . baseAddress . unsafelyUnwrapped <nl> + _sanityCheck ( origDestData . count > = MemoryLayout < KeyPathBuffer . Header > . size ) <nl> + var destData = UnsafeMutableRawBufferPointer ( <nl> + start : destHeaderPtr . advanced ( by : MemoryLayout < KeyPathBuffer . Header > . size ) , <nl> + count : origDestData . count - MemoryLayout < KeyPathBuffer . Header > . size ) <nl> + <nl> + func pushDest < T > ( _ value : T ) { <nl> + print ( " \ ( destData ) \ ( value ) " ) <nl> + let size = MemoryLayout < T > . size <nl> + _sanityCheck ( destData . count > = size ) <nl> + destData . storeBytes ( of : value , as : T . self ) <nl> + destData = UnsafeMutableRawBufferPointer ( <nl> + start : destData . baseAddress . unsafelyUnwrapped . advanced ( by : size ) , <nl> + count : destData . count - size ) <nl> + } <nl> + <nl> + / / Track where the reference prefix begins . <nl> + var endOfReferencePrefixComponent : UnsafeMutableRawPointer ? = nil <nl> + var previousComponentAddr : UnsafeMutableRawPointer ? = nil <nl> <nl> / / Instantiate components that need it . <nl> + var base : Any . Type = rootType <nl> while true { <nl> - let componentAddr = buffer . data . baseAddress . unsafelyUnwrapped <nl> - let header = buffer . pop ( RawKeyPathComponent . Header . self ) <nl> + let componentAddr = destData . baseAddress . unsafelyUnwrapped <nl> + let header = patternBuffer . pop ( RawKeyPathComponent . Header . self ) <nl> <nl> func tryToResolveOffset ( ) { <nl> if header . payload = = RawKeyPathComponent . Header . unresolvedOffsetPayload { <nl> - / / TODO : Look up offset in type metadata <nl> - fatalError ( " not implemented " ) <nl> + / / Look up offset in type metadata . The value in the pattern is the <nl> + / / offset within the metadata object . <nl> + let metadataPtr = unsafeBitCast ( base , to : UnsafeRawPointer . self ) <nl> + let offsetOfOffset = patternBuffer . pop ( UInt32 . self ) <nl> + let offset = metadataPtr . load ( fromByteOffset : Int ( offsetOfOffset ) , <nl> + as : UInt32 . self ) <nl> + / / Rewrite the header for a resolved offset . <nl> + var newHeader = header <nl> + newHeader . payload = RawKeyPathComponent . Header . outOfLineOffsetPayload <nl> + pushDest ( newHeader ) <nl> + pushDest ( offset ) <nl> + return <nl> } <nl> + <nl> + / / Otherwise , just transfer the pre - resolved component . <nl> + pushDest ( header ) <nl> if header . payload = = RawKeyPathComponent . Header . outOfLineOffsetPayload { <nl> - _ = buffer . pop ( UInt32 . self ) <nl> + let offset = patternBuffer . pop ( UInt32 . self ) <nl> + pushDest ( offset ) <nl> } <nl> } <nl> <nl> internal func _getKeyPath_instantiatedInline ( <nl> / / The offset may need to be resolved dynamically . <nl> tryToResolveOffset ( ) <nl> case . class : <nl> - / / The offset may need to be resolved dynamically . <nl> - tryToResolveOffset ( ) <nl> / / Crossing a class can end the reference prefix , and makes the following <nl> / / key path potentially reference - writable . <nl> endOfReferencePrefixComponent = previousComponentAddr <nl> - capability = . reference <nl> + / / The offset may need to be resolved dynamically . <nl> + tryToResolveOffset ( ) <nl> case . optionalChain , <nl> . optionalWrap , <nl> . optionalForce : <nl> / / No instantiation necessary . <nl> + pushDest ( header ) <nl> break <nl> } <nl> <nl> / / Break if this is the last component . <nl> - if buffer . data . count = = 0 { break } <nl> + if patternBuffer . data . count = = 0 { break } <nl> <nl> / / Resolve the component type . <nl> if MemoryLayout < Int > . size = = 4 { <nl> - let componentTyAccessor = buffer . data . load ( as : MetadataAccessor . self ) <nl> - let componentTy = unsafeBitCast ( componentTyAccessor , to : Any . Type . self ) <nl> - buffer . mutableData . storeBytes ( of : componentTy , as : Any . Type . self ) <nl> + let componentTyAccessor = patternBuffer . pop ( MetadataAccessor . self ) <nl> + base = unsafeBitCast ( componentTyAccessor ( arguments ) , to : Any . Type . self ) <nl> + pushDest ( base ) <nl> } else if MemoryLayout < Int > . size = = 8 { <nl> - let componentTyAccessorWords = buffer . data . load ( as : ( UInt32 , UInt32 ) . self ) <nl> + let componentTyAccessorWords = patternBuffer . pop ( ( UInt32 , UInt32 ) . self ) <nl> let componentTyAccessor = unsafeBitCast ( componentTyAccessorWords , <nl> to : MetadataAccessor . self ) <nl> - let componentTyWords = unsafeBitCast ( componentTyAccessor ( ) , <nl> + base = unsafeBitCast ( componentTyAccessor ( arguments ) , to : Any . Type . self ) <nl> + let componentTyWords = unsafeBitCast ( base , <nl> to : ( UInt32 , UInt32 ) . self ) <nl> - buffer . mutableData . storeBytes ( of : componentTyWords , <nl> - as : ( UInt32 , UInt32 ) . self ) <nl> + pushDest ( componentTyWords ) <nl> } else { <nl> fatalError ( " unsupported architecture " ) <nl> } <nl> - _ = buffer . pop ( Int . self ) <nl> previousComponentAddr = componentAddr <nl> } <nl> <nl> - / / Set up the reference prefix if there is one . <nl> - if let endOfReferencePrefixComponent = endOfReferencePrefixComponent { <nl> - var bufferHeader = bufferPtr . load ( as : KeyPathBuffer . Header . self ) <nl> - bufferHeader . hasReferencePrefix = true <nl> - bufferPtr . storeBytes ( of : bufferHeader , as : KeyPathBuffer . Header . self ) <nl> + / / We should have traversed both buffers . <nl> + _sanityCheck ( patternBuffer . data . isEmpty & & destData . isEmpty ) <nl> + <nl> + / / Write out the header . <nl> + let destHeader = KeyPathBuffer . Header ( size : origPatternBuffer . data . count , <nl> + trivial : true , / / TODO : nontrivial indexes <nl> + hasReferencePrefix : endOfReferencePrefixComponent ! = nil ) <nl> + <nl> + destHeaderPtr . storeBytes ( of : destHeader , as : KeyPathBuffer . Header . self ) <nl> <nl> + / / Mark the reference prefix if there is one . <nl> + if let endOfReferencePrefixComponent = endOfReferencePrefixComponent { <nl> var componentHeader = endOfReferencePrefixComponent <nl> . load ( as : RawKeyPathComponent . Header . self ) <nl> componentHeader . endOfReferencePrefix = true <nl> - UnsafeMutableRawPointer ( mutating : endOfReferencePrefixComponent ) <nl> - . storeBytes ( of : componentHeader , <nl> - as : RawKeyPathComponent . Header . self ) <nl> + endOfReferencePrefixComponent . storeBytes ( of : componentHeader , <nl> + as : RawKeyPathComponent . Header . self ) <nl> } <nl> - <nl> - / / Figure out the class type that the object will have based on its <nl> - / / dynamic capability . <nl> - func openRoot < Root > ( _ : Root . Type ) - > AnyKeyPath . Type { <nl> - func openLeaf < Leaf > ( _ : Leaf . Type ) - > AnyKeyPath . Type { <nl> - switch capability { <nl> - case . readOnly : <nl> - return KeyPath < Root , Leaf > . self <nl> - case . value : <nl> - return WritableKeyPath < Root , Leaf > . self <nl> - case . reference : <nl> - return ReferenceWritableKeyPath < Root , Leaf > . self <nl> - } <nl> - } <nl> - return _openExistential ( leaf , do : openLeaf ) <nl> - } <nl> - let classTy = _openExistential ( root , do : openRoot ) <nl> - <nl> - _swift_instantiateInertHeapObject ( <nl> - objectPtr , <nl> - unsafeBitCast ( classTy , to : OpaquePointer . self ) <nl> - ) <nl> } <nl> mmm a / test / stdlib / KeyPath . swift <nl> ppp b / test / stdlib / KeyPath . swift <nl> struct S < T : Equatable > : Equatable { <nl> } <nl> } <nl> <nl> - keyPath . test ( " key path instantiation " ) { <nl> - let s_x = ( # keyPath2 ( S < Int > , . x ) as AnyKeyPath ) as ! WritableKeyPath < S < Int > , Int > <nl> - let s_y = ( # keyPath2 ( S < Int > , . y ) as AnyKeyPath ) as ! WritableKeyPath < S < Int > , LifetimeTracked ? > <nl> - let s_z = ( # keyPath2 ( S < Int > , . z ) as AnyKeyPath ) as ! WritableKeyPath < S < Int > , Int > <nl> - let s_p = ( # keyPath2 ( S < Int > , . p ) as AnyKeyPath ) as ! WritableKeyPath < S < Int > , Point > <nl> - let s_p_x = ( # keyPath2 ( S < Int > , . p . x ) as AnyKeyPath ) as ! WritableKeyPath < S < Int > , Double > <nl> - let s_p_y = ( # keyPath2 ( S < Int > , . p . y ) as AnyKeyPath ) as ! WritableKeyPath < S < Int > , Double > <nl> - let s_c = ( # keyPath2 ( S < Int > , . c ) as AnyKeyPath ) as ! WritableKeyPath < S < Int > , C < Int > > <nl> - let s_c_x = ( # keyPath2 ( S < Int > , . c . x ) as AnyKeyPath ) as ! ReferenceWritableKeyPath < S < Int > , Int > <nl> - <nl> - let c_x = ( # keyPath2 ( C < Int > , . x ) as AnyKeyPath ) as ! ReferenceWritableKeyPath < C < Int > , Int > <nl> - let s_c_x_2 = s_c . appending ( path : c_x ) <nl> - <nl> - expectEqual ( s_c_x , s_c_x_2 ) <nl> - expectEqual ( s_c_x_2 , s_c_x ) <nl> - expectEqual ( s_c_x . hashValue , s_c_x_2 . hashValue ) <nl> + keyPath . test ( " key path in - place instantiation " ) { <nl> + for _ in 1 . . . 2 { <nl> + let s_x = ( # keyPath2 ( S < Int > , . x ) as AnyKeyPath ) as ! WritableKeyPath < S < Int > , Int > <nl> + let s_y = ( # keyPath2 ( S < Int > , . y ) as AnyKeyPath ) as ! WritableKeyPath < S < Int > , LifetimeTracked ? > <nl> + let s_z = ( # keyPath2 ( S < Int > , . z ) as AnyKeyPath ) as ! WritableKeyPath < S < Int > , Int > <nl> + let s_p = ( # keyPath2 ( S < Int > , . p ) as AnyKeyPath ) as ! WritableKeyPath < S < Int > , Point > <nl> + let s_p_x = ( # keyPath2 ( S < Int > , . p . x ) as AnyKeyPath ) as ! WritableKeyPath < S < Int > , Double > <nl> + let s_p_y = ( # keyPath2 ( S < Int > , . p . y ) as AnyKeyPath ) as ! WritableKeyPath < S < Int > , Double > <nl> + let s_c = ( # keyPath2 ( S < Int > , . c ) as AnyKeyPath ) as ! WritableKeyPath < S < Int > , C < Int > > <nl> + let s_c_x = ( # keyPath2 ( S < Int > , . c . x ) as AnyKeyPath ) as ! ReferenceWritableKeyPath < S < Int > , Int > <nl> + <nl> + let c_x = ( # keyPath2 ( C < Int > , . x ) as AnyKeyPath ) as ! ReferenceWritableKeyPath < C < Int > , Int > <nl> + let s_c_x_2 = s_c . appending ( path : c_x ) <nl> + <nl> + expectEqual ( s_c_x , s_c_x_2 ) <nl> + expectEqual ( s_c_x_2 , s_c_x ) <nl> + expectEqual ( s_c_x . hashValue , s_c_x_2 . hashValue ) <nl> + <nl> + let point_x = ( # keyPath2 ( Point , . x ) as AnyKeyPath ) as ! WritableKeyPath < Point , Double > <nl> + let point_y = ( # keyPath2 ( Point , . y ) as AnyKeyPath ) as ! WritableKeyPath < Point , Double > <nl> + <nl> + let s_p_x_2 = s_p . appending ( path : point_x ) <nl> + let s_p_y_2 = s_p . appending ( path : point_y ) <nl> + <nl> + expectEqual ( s_p_x , s_p_x_2 ) <nl> + expectEqual ( s_p_x_2 , s_p_x ) <nl> + expectEqual ( s_p_x_2 . hashValue , s_p_x . hashValue ) <nl> + expectEqual ( s_p_y , s_p_y_2 ) <nl> + expectEqual ( s_p_y_2 , s_p_y ) <nl> + expectEqual ( s_p_y_2 . hashValue , s_p_y . hashValue ) <nl> + } <nl> } <nl> <nl> + keyPath . test ( " key path generic instantiation " ) { <nl> + func testWithGenericParam < T : Equatable > ( _ : T . Type ) - > ReferenceWritableKeyPath < S < T > , Int > { <nl> + for i in 1 . . . 2 { <nl> + let s_x = ( # keyPath2 ( S < T > , . x ) as AnyKeyPath ) as ! WritableKeyPath < S < T > , Int > <nl> + let s_y = ( # keyPath2 ( S < T > , . y ) as AnyKeyPath ) as ! WritableKeyPath < S < T > , LifetimeTracked ? > <nl> + let s_z = ( # keyPath2 ( S < T > , . z ) as AnyKeyPath ) as ! WritableKeyPath < S < T > , T > <nl> + let s_p = ( # keyPath2 ( S < T > , . p ) as AnyKeyPath ) as ! WritableKeyPath < S < T > , Point > <nl> + let s_p_x = ( # keyPath2 ( S < T > , . p . x ) as AnyKeyPath ) as ! WritableKeyPath < S < T > , Double > <nl> + let s_p_y = ( # keyPath2 ( S < T > , . p . y ) as AnyKeyPath ) as ! WritableKeyPath < S < T > , Double > <nl> + let s_c = ( # keyPath2 ( S < T > , . c ) as AnyKeyPath ) as ! WritableKeyPath < S < T > , C < T > > <nl> + let s_c_x = ( # keyPath2 ( S < T > , . c . x ) as AnyKeyPath ) as ! ReferenceWritableKeyPath < S < T > , Int > <nl> + <nl> + let c_x = ( # keyPath2 ( C < T > , . x ) as AnyKeyPath ) as ! ReferenceWritableKeyPath < C < T > , Int > <nl> + let s_c_x_2 = s_c . appending ( path : c_x ) <nl> + <nl> + expectEqual ( s_c_x , s_c_x_2 ) <nl> + expectEqual ( s_c_x_2 , s_c_x ) <nl> + expectEqual ( s_c_x . hashValue , s_c_x_2 . hashValue ) <nl> + <nl> + let point_x = ( # keyPath2 ( Point , . x ) as AnyKeyPath ) as ! WritableKeyPath < Point , Double > <nl> + let point_y = ( # keyPath2 ( Point , . y ) as AnyKeyPath ) as ! WritableKeyPath < Point , Double > <nl> + <nl> + let s_p_x_2 = s_p . appending ( path : point_x ) <nl> + let s_p_y_2 = s_p . appending ( path : point_y ) <nl> + <nl> + expectEqual ( s_p_x , s_p_x_2 ) <nl> + expectEqual ( s_p_x_2 , s_p_x ) <nl> + expectEqual ( s_p_x_2 . hashValue , s_p_x . hashValue ) <nl> + expectEqual ( s_p_y , s_p_y_2 ) <nl> + expectEqual ( s_p_y_2 , s_p_y ) <nl> + expectEqual ( s_p_y_2 . hashValue , s_p_y . hashValue ) <nl> + <nl> + if i = = 2 { return s_c_x } <nl> + } <nl> + fatalError ( ) <nl> + } <nl> + let s_c_x_int = testWithGenericParam ( Int . self ) <nl> + let s_c_x_int2 = # keyPath2 ( S < Int > , . c . x ) <nl> + expectEqual ( s_c_x_int , s_c_x_int2 ) <nl> + <nl> + let s_c_x_string = testWithGenericParam ( String . self ) <nl> + let s_c_x_string2 = # keyPath2 ( S < String > , . c . x ) <nl> + expectEqual ( s_c_x_string , s_c_x_string2 ) <nl> + <nl> + let s_c_x_lt = testWithGenericParam ( LifetimeTracked . self ) <nl> + let s_c_x_lt2 = # keyPath2 ( S < LifetimeTracked > , . c . x ) <nl> + expectEqual ( s_c_x_lt , s_c_x_lt2 ) <nl> + } <nl> <nl> runAllTests ( ) <nl>
KeyPaths : Support out - of - place instantiation of generic key paths .
apple/swift
0bb83bb18524e988defcc193369ca8b4cf871965
2017-04-18T05:36:26Z
mmm a / eigen . BUILD <nl> ppp b / eigen . BUILD <nl> <nl> package ( default_visibility = [ " / / visibility : public " ] ) <nl> <nl> - archive_dir = " eigen - eigen - 772e357bb4f5 " <nl> + archive_dir = " eigen - eigen - c4f301c0c2a3 " <nl> <nl> cc_library ( <nl> name = " eigen " , <nl> mmm a / tensorflow / workspace . bzl <nl> ppp b / tensorflow / workspace . bzl <nl> def tf_workspace ( path_prefix = " " , tf_repo_name = " " ) : <nl> <nl> native . new_http_archive ( <nl> name = " eigen_archive " , <nl> - url = " https : / / bitbucket . org / eigen / eigen / get / 772e357bb4f5 . tar . gz " , <nl> - sha256 = " cbaec6f13c6a872e9f4be26894b113951ad9b9adb0dd109ac1298939843519b6 " , <nl> + url = " https : / / bitbucket . org / eigen / eigen / get / c4f301c0c2a3 . tar . gz " , <nl> + sha256 = " e60ef48bda97a41423714a49a4e6469abcd355eb1477d18813634f02e7aec475 " , <nl> build_file = path_prefix + " eigen . BUILD " , <nl> ) <nl> <nl> mmm a / third_party / eigen3 / Eigen / Cholesky <nl> ppp b / third_party / eigen3 / Eigen / Cholesky <nl> @ @ - 1 + 1 @ @ <nl> - # include " eigen - eigen - 772e357bb4f5 / Eigen / Cholesky " <nl> + # include " eigen - eigen - c4f301c0c2a3 / Eigen / Cholesky " <nl> mmm a / third_party / eigen3 / Eigen / Core <nl> ppp b / third_party / eigen3 / Eigen / Core <nl> @ @ - 1 + 1 @ @ <nl> - # include " eigen - eigen - 772e357bb4f5 / Eigen / Core " <nl> + # include " eigen - eigen - c4f301c0c2a3 / Eigen / Core " <nl> mmm a / third_party / eigen3 / Eigen / Eigenvalues <nl> ppp b / third_party / eigen3 / Eigen / Eigenvalues <nl> @ @ - 1 + 1 @ @ <nl> - # include " eigen - eigen - 772e357bb4f5 / Eigen / Eigenvalues " <nl> + # include " eigen - eigen - c4f301c0c2a3 / Eigen / Eigenvalues " <nl> mmm a / third_party / eigen3 / Eigen / LU <nl> ppp b / third_party / eigen3 / Eigen / LU <nl> @ @ - 1 + 1 @ @ <nl> - # include " eigen - eigen - 772e357bb4f5 / Eigen / LU " <nl> + # include " eigen - eigen - c4f301c0c2a3 / Eigen / LU " <nl> mmm a / third_party / eigen3 / Eigen / QR <nl> ppp b / third_party / eigen3 / Eigen / QR <nl> @ @ - 1 + 1 @ @ <nl> - # include " eigen - eigen - 772e357bb4f5 / Eigen / QR " <nl> + # include " eigen - eigen - c4f301c0c2a3 / Eigen / QR " <nl> mmm a / third_party / eigen3 / unsupported / Eigen / CXX11 / Tensor <nl> ppp b / third_party / eigen3 / unsupported / Eigen / CXX11 / Tensor <nl> @ @ - 1 + 1 @ @ <nl> - # include " eigen - eigen - 772e357bb4f5 / unsupported / Eigen / CXX11 / Tensor " <nl> + # include " eigen - eigen - c4f301c0c2a3 / unsupported / Eigen / CXX11 / Tensor " <nl>
TensorFlow : update eigen to latest release that has a fix to too large frame .
tensorflow/tensorflow
1a39c2c1979706084338352d1264951b3ec9c6bc
2016-03-18T15:47:22Z
mmm a / Marlin / planner . cpp <nl> ppp b / Marlin / planner . cpp <nl> float junction_deviation = 0 . 1 ; <nl> if ( de ) { <nl> if ( degHotend ( active_extruder ) < extrude_min_temp ) { <nl> position [ E_AXIS ] = target [ E_AXIS ] ; / / behave as if the move really took place , but ignore E part <nl> + de = 0 ; / / no difference <nl> SERIAL_ECHO_START ; <nl> SERIAL_ECHOLNPGM ( MSG_ERR_COLD_EXTRUDE_STOP ) ; <nl> } <nl> # ifdef PREVENT_LENGTHY_EXTRUDE <nl> if ( labs ( de ) > axis_steps_per_unit [ E_AXIS ] * EXTRUDE_MAXLENGTH ) { <nl> position [ E_AXIS ] = target [ E_AXIS ] ; / / Behave as if the move really took place , but ignore E part <nl> + de = 0 ; / / no difference <nl> SERIAL_ECHO_START ; <nl> SERIAL_ECHOLNPGM ( MSG_ERR_LONG_EXTRUDE_STOP ) ; <nl> } <nl>
Fix de after PREVENT_DANGEROUS_EXTRUDE
MarlinFirmware/Marlin
1d291be2baa73e4e3b29bcb748a5c9c9b2316d4a
2015-04-08T03:01:08Z
mmm a / include / swift / AST / Types . h <nl> ppp b / include / swift / AST / Types . h <nl> namespace swift { <nl> enum PointerTypeKind : unsigned ; <nl> struct ValueOwnershipKind ; <nl> <nl> - enum class TypeKind { <nl> + enum class TypeKind : uint8_t { <nl> # define TYPE ( id , parent ) id , <nl> # define TYPE_RANGE ( Id , FirstId , LastId ) \ <nl> First_ # # Id # # Type = FirstId , Last_ # # Id # # Type = LastId , <nl> enum class TypeMatchFlags { <nl> } ; <nl> using TypeMatchOptions = OptionSet < TypeMatchFlags > ; <nl> <nl> + # define NUMBITS ( E , V ) \ <nl> + enum { Num # # E # # Bits = V } ; \ <nl> + static_assert ( Num # # E # # Bits < = 64 , " fits in a uint64_t " ) <nl> + <nl> / / / TypeBase - Base class for all types in Swift . <nl> class alignas ( 1 < < TypeAlignInBits ) TypeBase { <nl> <nl> class alignas ( 1 < < TypeAlignInBits ) TypeBase { <nl> / / / form of a non - canonical type is requested . <nl> llvm : : PointerUnion < TypeBase * , const ASTContext * > CanonicalType ; <nl> <nl> - / / / Kind - The discriminator that indicates what subclass of type this is . <nl> - const TypeKind Kind ; <nl> - <nl> struct TypeBaseBitfields { <nl> + / / / Kind - The discriminator that indicates what subclass of type this is . <nl> + const TypeKind Kind ; / / Naturally sized for speed ( it only needs 6 bits ) . <nl> + <nl> unsigned Properties : RecursiveTypeProperties : : BitWidth ; <nl> } ; <nl> - <nl> - enum { NumTypeBaseBits = RecursiveTypeProperties : : BitWidth } ; <nl> - static_assert ( NumTypeBaseBits < = 32 , " fits in an unsigned " ) ; <nl> + NUMBITS ( TypeBase , RecursiveTypeProperties : : BitWidth + sizeof ( TypeKind ) * 8 ) ; <nl> <nl> / / / Returns true if the given type is a sugared type . <nl> / / / <nl> class alignas ( 1 < < TypeAlignInBits ) TypeBase { <nl> / / / Whether there is an original type . <nl> unsigned HasOriginalType : 1 ; <nl> } ; <nl> - enum { NumErrorTypeBits = NumTypeBaseBits + 1 } ; <nl> - static_assert ( NumErrorTypeBits < = 32 , " fits in an unsigned " ) ; <nl> + NUMBITS ( ErrorType , NumTypeBaseBits + 1 ) ; <nl> <nl> struct AnyFunctionTypeBitfields { <nl> unsigned : NumTypeBaseBits ; <nl> class alignas ( 1 < < TypeAlignInBits ) TypeBase { <nl> enum { NumExtInfoBits = 7 } ; <nl> unsigned ExtInfo : NumExtInfoBits ; <nl> } ; <nl> - enum { NumAnyFunctionTypeBits = NumTypeBaseBits + 7 } ; <nl> - static_assert ( NumAnyFunctionTypeBits < = 32 , " fits in an unsigned " ) ; <nl> + NUMBITS ( AnyFunctionType , NumTypeBaseBits + 7 ) ; <nl> <nl> struct ArchetypeTypeBitfields { <nl> unsigned : NumTypeBaseBits ; <nl> class alignas ( 1 < < TypeAlignInBits ) TypeBase { <nl> unsigned HasLayoutConstraint : 1 ; <nl> unsigned NumProtocols : 16 ; <nl> } ; <nl> - enum { NumArchetypeTypeBitfields = NumTypeBaseBits + 19 } ; <nl> - static_assert ( NumArchetypeTypeBitfields < = 32 , " fits in an unsigned " ) ; <nl> + NUMBITS ( ArchetypeType , NumTypeBaseBits + 19 ) ; <nl> <nl> struct TypeVariableTypeBitfields { <nl> unsigned : NumTypeBaseBits ; <nl> <nl> / / / \ brief The unique number assigned to this type variable . <nl> - unsigned ID : 32 - NumTypeBaseBits ; <nl> + unsigned ID : 64 - NumTypeBaseBits ; <nl> } ; <nl> - enum { NumTypeVariableTypeBits = NumTypeBaseBits + ( 32 - NumTypeBaseBits ) } ; <nl> - static_assert ( NumTypeVariableTypeBits < = 32 , " fits in an unsigned " ) ; <nl> + NUMBITS ( TypeVariableType , 64 ) ; <nl> <nl> struct SILFunctionTypeBitfields { <nl> unsigned : NumTypeBaseBits ; <nl> class alignas ( 1 < < TypeAlignInBits ) TypeBase { <nl> unsigned HasErrorResult : 1 ; <nl> unsigned CoroutineKind : 2 ; <nl> } ; <nl> - enum { NumSILFunctionTypeBits = NumTypeBaseBits + 12 } ; <nl> - static_assert ( NumSILFunctionTypeBits < = 32 , " fits in an unsigned " ) ; <nl> + NUMBITS ( SILFunctionType , NumTypeBaseBits + 12 ) ; <nl> <nl> struct AnyMetatypeTypeBitfields { <nl> unsigned : NumTypeBaseBits ; <nl> class alignas ( 1 < < TypeAlignInBits ) TypeBase { <nl> / / / the value is the representation + 1 <nl> unsigned Representation : 2 ; <nl> } ; <nl> - enum { NumAnyMetatypeTypeBits = NumTypeBaseBits + 2 } ; <nl> - static_assert ( NumAnyMetatypeTypeBits < = 32 , " fits in an unsigned " ) ; <nl> + NUMBITS ( AnyMetatypeType , NumTypeBaseBits + 2 ) ; <nl> <nl> struct ProtocolCompositionTypeBitfields { <nl> unsigned : NumTypeBaseBits ; <nl> class alignas ( 1 < < TypeAlignInBits ) TypeBase { <nl> / / / implied by any of our members . <nl> unsigned HasExplicitAnyObject : 1 ; <nl> } ; <nl> - enum { NumProtocolCompositionTypeBits = NumTypeBaseBits + 1 } ; <nl> - static_assert ( NumProtocolCompositionTypeBits < = 32 , " fits in an unsigned " ) ; <nl> + NUMBITS ( ProtocolCompositionType , NumTypeBaseBits + 1 ) ; <nl> + <nl> struct TupleTypeBitfields { <nl> unsigned : NumTypeBaseBits ; <nl> <nl> / / / Whether an element of the tuple is inout . <nl> unsigned HasInOutElement : 1 ; <nl> } ; <nl> - enum { NumTupleTypeBits = NumTypeBaseBits + 1 } ; <nl> - static_assert ( NumTupleTypeBits < = 32 , " fits in an unsigned " ) ; <nl> - <nl> + NUMBITS ( TupleType , NumTypeBaseBits + 1 ) ; <nl> + <nl> + # undef NUMBITS <nl> union { <nl> TypeBaseBitfields TypeBaseBits ; <nl> ErrorTypeBitfields ErrorTypeBits ; <nl> class alignas ( 1 < < TypeAlignInBits ) TypeBase { <nl> protected : <nl> TypeBase ( TypeKind kind , const ASTContext * CanTypeCtx , <nl> RecursiveTypeProperties properties ) <nl> - : CanonicalType ( ( TypeBase * ) nullptr ) , Kind ( kind ) { <nl> + : CanonicalType ( ( TypeBase * ) nullptr ) { <nl> + * const_cast < TypeKind * > ( & TypeBaseBits . Kind ) = kind ; <nl> / / If this type is canonical , switch the CanonicalType union to ASTContext . <nl> if ( CanTypeCtx ) <nl> CanonicalType = CanTypeCtx ; <nl> class alignas ( 1 < < TypeAlignInBits ) TypeBase { <nl> <nl> public : <nl> / / / getKind - Return what kind of type this is . <nl> - TypeKind getKind ( ) const { return Kind ; } <nl> + TypeKind getKind ( ) const { return TypeBaseBits . Kind ; } <nl> <nl> / / / isCanonical - Return true if this is a canonical type . <nl> bool isCanonical ( ) const { return CanonicalType . is < const ASTContext * > ( ) ; } <nl>
[ AST ] NFC : Shrink TypeKind size and optimize TypeBase layout
apple/swift
e8b50add467d2d38a65dc522d4a8e5f250888b0b
2017-12-01T17:31:36Z
mmm a / torch / distributed / pipeline / sync / pipe . py <nl> ppp b / torch / distributed / pipeline / sync / pipe . py <nl> def _split_module ( modules : nn . Sequential ) - > Tuple [ List [ nn . Sequential ] , List [ tor <nl> <nl> class Pipe ( Module ) : <nl> " " " Wraps an arbitrary : class : ` nn . Sequential < torch . nn . Sequential > ` module <nl> - to train on Pipe_ . If the module requires lots of memory , Pipe will be <nl> - very efficient . <nl> - : : <nl> + to train on using synchronous pipeline parallelism . If the module requires <nl> + lots of memory and doesn ' t fit on a single GPU , pipeline parallelism is a <nl> + useful technique to employ for training . <nl> <nl> - model = nn . Sequential ( a , b , c , d ) <nl> - model = Pipe ( model , chunks = 8 ) <nl> - output = model ( input ) <nl> + The implementation is based on the torchgpipe_ paper . <nl> <nl> - . . _Pipe : https : / / arxiv . org / abs / 2004 . 09910 <nl> + . . _torchgpipe : https : / / arxiv . org / abs / 2004 . 09910 <nl> <nl> Pipe combines pipeline parallelism with checkpointing to reduce peak <nl> memory required to train while minimizing device under - utilization . <nl> <nl> - You should place all the modules on the appropriate devices before passing <nl> - them to this API and wrap them into an ` ` nn . Sequential ` ` module defining the <nl> + You should place all the modules on the appropriate devices and wrap them <nl> + into an : class : ` nn . Sequential < torch . nn . Sequential > ` module defining the <nl> desired order of execution . <nl> <nl> - Args : <nl> - module ( ` ` torch . nn . Sequential ` ` ) : <nl> - Sequential module to be parallelized using pipelining . Each module <nl> + Arguments : <nl> + module ( : class : ` nn . Sequential < torch . nn . Sequential > ` ) : <nl> + sequential module to be parallelized using pipelining . Each module <nl> in the sequence has to have all of its parameters on a single <nl> device . Each module in the sequence has to either be an nn . Module <nl> - or ` ` nn . Sequential ` ` ( to combine multiple sequential modules on a single <nl> - device ) <nl> - <nl> - Keyword Args : <nl> + or : class : ` nn . Sequential < torch . nn . Sequential > ` ( to combine multiple <nl> + sequential modules on a single device ) <nl> chunks ( int ) : <nl> number of micro - batches ( default : ` ` 1 ` ` ) <nl> checkpoint ( str ) : <nl> when to enable checkpointing , one of ` ` ' always ' ` ` , <nl> - ` ` ' except_last ' ` ` , or ` ` ' never ' ` ` ( default : ` ` ' except_last ' ` ` ) <nl> + ` ` ' except_last ' ` ` , or ` ` ' never ' ` ` ( default : ` ` ' except_last ' ` ` ) . <nl> + ` ` ' never ' ` ` disables checkpointing completely , ` ` ' except_last ' ` ` <nl> + enables checkpointing for all micro - batches except the last one <nl> + and ` ` ' always ' ` ` enables checkpointing for all micro - batches . <nl> deferred_batch_norm ( bool ) : <nl> - whether to use deferred BatchNorm moving statistics ( default : <nl> - : data : ` False ` , see : ref : ` Deferred Batch Normalization ` for more <nl> - details ) <nl> + whether to use deferred ` ` BatchNorm ` ` moving statistics ( default : <nl> + : data : ` False ` ) . If set to : data : ` True ` , we track statistics across <nl> + multiple micro - batches to update the running statistics per <nl> + mini - batch . <nl> <nl> Raises : <nl> TypeError : <nl> the module is not a : class : ` nn . Sequential < torch . nn . Sequential > ` . <nl> ValueError : <nl> invalid arguments <nl> - IndexError : <nl> - the number of devices is fewer than the number of partitions . <nl> <nl> + Example : : <nl> + Pipeline of two FC layers across GPUs 0 and 1 . <nl> + <nl> + > > > fc1 = nn . Linear ( 16 , 8 ) . cuda ( 0 ) <nl> + > > > fc2 = nn . Linear ( 8 , 4 ) . cuda ( 1 ) <nl> + > > > model = nn . Sequential ( fc1 , fc2 ) <nl> + > > > model = Pipe ( model , chunks = 8 ) <nl> + > > > input = torch . rand ( 16 , 16 ) . cuda ( 0 ) <nl> + > > > output_rref = model ( input ) <nl> + <nl> + . . note : : <nl> + You can wrap a : class : ` Pipe ` model with <nl> + : class : ` torch . nn . parallel . DistributedDataParallel ` only when the <nl> + checkpoint parameter of : class : ` Pipe ` is ` ` ' never ' ` ` . <nl> + <nl> + . . note : : <nl> + : class : ` Pipe ` only supports intra - node pipelining currently , but <nl> + will be expanded to support inter - node pipelining in the future . <nl> + The forward function returns an : class : ` ~ torch . distributed . rpc . RRef ` <nl> + to allow for inter - node pipelining in the future , where the output <nl> + might be on a remote host . For intra - node pipelinining you can use <nl> + : meth : ` ~ torch . distributed . rpc . RRef . local_value ` to retrieve the <nl> + output locally . <nl> + <nl> + . . warning : : <nl> + : class : ` Pipe ` is experimental and subject to change . <nl> " " " <nl> <nl> - # : The number of micro - batches . <nl> - chunks : int = 1 <nl> - <nl> - # : The checkpoint mode to determine when to enable checkpointing . It is one <nl> - # : of ` ` ' always ' ` ` , ` ` ' except_last ' ` ` , or ` ` ' never ' ` ` . <nl> - checkpoint : str = " except_last " <nl> - <nl> def __init__ ( <nl> self , <nl> module : nn . Sequential , <nl> - chunks : int = chunks , <nl> - checkpoint : str = checkpoint , <nl> + chunks : int = 1 , <nl> + checkpoint : str = " except_last " , <nl> deferred_batch_norm : bool = False , <nl> ) - > None : <nl> super ( ) . __init__ ( ) <nl> def _ensure_copy_streams ( self ) - > List [ List [ AbstractStream ] ] : <nl> <nl> return self . _copy_streams <nl> <nl> - def forward ( self , input : TensorOrTensors ) - > RRef [ TensorOrTensors ] : # type : ignore <nl> - " " " : class : ` Pipe ` is a fairly transparent module wrapper . It doesn ' t <nl> + def forward ( self , input ) - > RRef : # type : ignore <nl> + " " " <nl> + Processes a single input mini - batch through the pipe and returns an <nl> + : class : ` ~ torch . distributed . rpc . RRef ` pointing to the output . <nl> + : class : ` Pipe ` is a fairly transparent module wrapper . It doesn ' t <nl> modify the input and output signature of the underlying module . But <nl> there ' s type restriction . Input and output have to be a <nl> : class : ` ~ torch . Tensor ` or a sequence of tensors . This restriction is <nl> applied at partition boundaries too . <nl> <nl> - Args : <nl> - input ( torch . Tensor or Sequence [ torch . Tensor ] ) : input mini - batch <nl> + The input tensor is split into multiple micro - batches based on the <nl> + ` ` chunks ` ` parameter used to initialize : class : ` Pipe ` . The batch size <nl> + is assumed to be the first dimension of the tensor and if the batch <nl> + size is less than ` ` chunks ` ` , the number of micro - batches is equal to <nl> + the batch size . <nl> + <nl> + Arguments : <nl> + input ( torch . Tensor or sequence of : class : ` ~ torch . Tensor ` ) : input mini - batch <nl> <nl> Returns : <nl> : class : ` ~ torch . distributed . rpc . RRef ` to the output of the mini - batch <nl> <nl> Raises : <nl> - TypeError : input is not a tensor or tensors . <nl> + TypeError : input is not a tensor or sequence of tensors . <nl> <nl> " " " <nl> microbatch . check ( input ) <nl>
Improve documentation for pipeline parallelism . ( )
pytorch/pytorch
8c52fdf5225cde0f92a6c0aa7a095af0277efc9a
2020-12-19T02:28:26Z
mmm a / hphp / hack / src / hhbc / hhas_parser . mly <nl> ppp b / hphp / hack / src / hhbc / hhas_parser . mly <nl> iarg : <nl> | AT ID { IAArrayno $ 2 } <nl> | ID COLON iarg { IAMemberkey ( $ 1 , $ 3 ) } <nl> | LANGLE iarglist RANGLE { IAArglist $ 2 } <nl> - | LPAR ID RPAR INT { IAIteratorid ( $ 2 , $ 4 ) } <nl> + | LANGLE iterbreaklist RANGLE { IAArglist $ 2 } <nl> ; <nl> iarglist : <nl> | / * empty * / { [ ] } <nl> | iarg iarglist { $ 1 : : $ 2 } <nl> | iarg COMMA iarglist { $ 1 : : $ 3 } <nl> ; <nl> + iterbreaklist : <nl> + | iterbreak { [ $ 1 ] } <nl> + | iterbreak COMMA iterbreaklist { $ 1 : : $ 3 } <nl> + ; <nl> + iterbreak : <nl> + | LPAR ID RPAR INT { IAIteratorid ( $ 2 , $ 4 ) } <nl> + ; <nl> decllist : <nl> / * empty * / { [ ] } <nl> | decl nl decllist { $ 1 : : $ 3 } <nl> mmm a / hphp / hack / src / hhbc / semdiff / rhl . ml <nl> ppp b / hphp / hack / src / hhbc / semdiff / rhl . ml <nl> match i , i ' with <nl> | VGetL ( Local . Named s ) , VGetL ( Local . Named s ' ) <nl> when s = s ' - > Some asn <nl> | VGetL _ , _ <nl> - | _ , VGetL _ - > None ( * can ' t handle the possible aliasing here , so bail * ) <nl> + | _ , VGetL _ - > None ( * can ' t handle the possible aliasing here , so bail * ) <nl> ( * default case , require literally equal instructions * ) <nl> | _ , _ - > if i = i ' then Some asn else None <nl> <nl> let equiv prog prog ' startlabelpairs = <nl> | _ , ILabel _ <nl> | _ , IComment _ - > <nl> check pc ( succ pc ' ) asn ( add_assumption ( pc , pc ' ) asn assumed ) todo <nl> + ( * For IterBreak , the lists have to be the same as we ' re not tracking correspondences <nl> + between iterators at the moment , and need the same freeing behaviour so exceptions <nl> + match up if we try to use them later * ) <nl> + | IIterator ( IterBreak ( lab , it_list ) ) , IIterator ( IterBreak ( lab ' , it_list ' ) ) - > <nl> + if it_list = it_list ' <nl> + then check ( hs_of_pc pc , LabelMap . find lab labelmap ) <nl> + ( hs_of_pc pc ' , LabelMap . find lab ' labelmap ' ) asn <nl> + ( add_assumption ( pc , pc ' ) asn assumed ) todo <nl> + else try_specials ( ) <nl> | IContFlow ( JmpZ lab ) , IContFlow ( JmpZ lab ' ) <nl> | IContFlow ( JmpNZ lab ) , IContFlow ( JmpNZ lab ' ) - > <nl> check ( succ pc ) ( succ pc ' ) asn <nl> let equiv prog prog ' startlabelpairs = <nl> ( add_assumption ( pc , pc ' ) asn assumed ) <nl> todo <nl> | _ , _ - > try_specials ( ) ) ( * leaves / stays - > mismatch * ) <nl> + | IContFlow ( Switch ( kind , offset , labs ) ) , IContFlow ( Switch ( kind ' , offset ' , labs ' ) ) <nl> + when kind = kind ' & & offset = offset ' - > <nl> + ( match List . zip labs labs ' with <nl> + | None - > try_specials ( ) ( * feebly , give up if different lengths * ) <nl> + | Some lab_pairs - > <nl> + let hs = hs_of_pc pc in <nl> + let hs ' = hs_of_pc pc ' in <nl> + let newtodo = List . fold_right ~ f : ( fun ( lab , lab ' ) accum - > <nl> + add_todo ( ( hs , LabelMap . find lab labelmap ) , ( hs ' , LabelMap . find lab ' labelmap ' ) ) <nl> + asn accum ) ~ init : todo lab_pairs in <nl> + donext ( add_assumption ( pc , pc ' ) asn assumed ) newtodo ) <nl> + | IContFlow ( SSwitch _ ) , _ <nl> + | _ , IContFlow ( SSwitch _ ) - > <nl> + failwith " SSwitch not implemented " <nl> | IContFlow _ , IContFlow _ - > try_specials ( ) <nl> ( * next block have no interesting controls flow or local <nl> variable effects <nl>
Dealing with IterBreak and Switch in semdiff
facebook/hhvm
32944b6f85bc0d36c0ab5f5c2f5528f0116dcf06
2017-06-03T00:17:47Z
mmm a / src / share / event_queue / event . hpp <nl> ppp b / src / share / event_queue / event . hpp <nl> <nl> # include " hash . hpp " <nl> # include " manipulator / manipulator_environment . hpp " <nl> # include " types . hpp " <nl> - # include < mpark / variant . hpp > <nl> # include < optional > <nl> # include < pqrs / hash . hpp > <nl> # include < pqrs / osx / system_preferences . hpp > <nl> # include < pqrs / osx / system_preferences / extra / nlohmann_json . hpp > <nl> + # include < variant > <nl> <nl> namespace krbn { <nl> namespace event_queue { <nl> class event { <nl> virtual_hid_keyboard_configuration_changed , <nl> } ; <nl> <nl> - using value_t = mpark : : variant < key_code : : value_t , / / For type : : key_code <nl> - consumer_key_code : : value_t , / / For type : : consumer_key_code <nl> - pointing_button : : value_t , / / For type : : pointing_button <nl> - pointing_motion , / / For type : : pointing_motion <nl> - int64_t , / / For type : : caps_lock_state_changed <nl> - std : : string , / / For shell_command <nl> - std : : vector < pqrs : : osx : : input_source_selector : : specifier > , / / For select_input_source <nl> - std : : pair < std : : string , int > , / / For set_variable <nl> - mouse_key , / / For mouse_key <nl> - pqrs : : osx : : frontmost_application_monitor : : application , / / For frontmost_application_changed <nl> - pqrs : : osx : : input_source : : properties , / / For input_source_changed <nl> - device_properties , / / For device_grabbed <nl> - pqrs : : osx : : system_preferences : : properties , / / For system_preferences_properties_changed <nl> - core_configuration : : details : : virtual_hid_keyboard , / / For virtual_hid_keyboard_configuration_changed <nl> - mpark : : monostate > ; / / For virtual events <nl> + using value_t = std : : variant < key_code : : value_t , / / For type : : key_code <nl> + consumer_key_code : : value_t , / / For type : : consumer_key_code <nl> + pointing_button : : value_t , / / For type : : pointing_button <nl> + pointing_motion , / / For type : : pointing_motion <nl> + int64_t , / / For type : : caps_lock_state_changed <nl> + std : : string , / / For shell_command <nl> + std : : vector < pqrs : : osx : : input_source_selector : : specifier > , / / For select_input_source <nl> + std : : pair < std : : string , int > , / / For set_variable <nl> + mouse_key , / / For mouse_key <nl> + pqrs : : osx : : frontmost_application_monitor : : application , / / For frontmost_application_changed <nl> + pqrs : : osx : : input_source : : properties , / / For input_source_changed <nl> + device_properties , / / For device_grabbed <nl> + pqrs : : osx : : system_preferences : : properties , / / For system_preferences_properties_changed <nl> + core_configuration : : details : : virtual_hid_keyboard , / / For virtual_hid_keyboard_configuration_changed <nl> + std : : monostate > ; / / For virtual events <nl> <nl> event ( void ) : type_ ( type : : none ) , <nl> - value_ ( mpark : : monostate ( ) ) { <nl> + value_ ( std : : monostate ( ) ) { <nl> } <nl> <nl> static event make_from_json ( const nlohmann : : json & json ) { <nl> class event { <nl> break ; <nl> <nl> case type : : system_preferences_properties_changed : <nl> - if ( auto v = mpark : : get_if < pqrs : : osx : : system_preferences : : properties > ( & value_ ) ) { <nl> + if ( auto v = std : : get_if < pqrs : : osx : : system_preferences : : properties > ( & value_ ) ) { <nl> json [ " system_preferences_properties " ] = * v ; <nl> } <nl> break ; <nl> <nl> case type : : virtual_hid_keyboard_configuration_changed : <nl> - if ( auto v = mpark : : get_if < core_configuration : : details : : virtual_hid_keyboard > ( & value_ ) ) { <nl> + if ( auto v = std : : get_if < core_configuration : : details : : virtual_hid_keyboard > ( & value_ ) ) { <nl> json [ " virtual_hid_keyboard_configuration " ] = * v ; <nl> } <nl> break ; <nl> class event { <nl> <nl> template < typename T > <nl> const T * find ( void ) const { <nl> - return mpark : : get_if < T > ( & value_ ) ; <nl> + return std : : get_if < T > ( & value_ ) ; <nl> } <nl> <nl> std : : optional < key_code : : value_t > get_key_code ( void ) const { <nl> try { <nl> if ( type_ = = type : : key_code ) { <nl> - return mpark : : get < key_code : : value_t > ( value_ ) ; <nl> + return std : : get < key_code : : value_t > ( value_ ) ; <nl> } <nl> - } catch ( mpark : : bad_variant_access & ) { <nl> + } catch ( std : : bad_variant_access & ) { <nl> } <nl> return std : : nullopt ; <nl> } <nl> class event { <nl> std : : optional < consumer_key_code : : value_t > get_consumer_key_code ( void ) const { <nl> try { <nl> if ( type_ = = type : : consumer_key_code ) { <nl> - return mpark : : get < consumer_key_code : : value_t > ( value_ ) ; <nl> + return std : : get < consumer_key_code : : value_t > ( value_ ) ; <nl> } <nl> - } catch ( mpark : : bad_variant_access & ) { <nl> + } catch ( std : : bad_variant_access & ) { <nl> } <nl> return std : : nullopt ; <nl> } <nl> class event { <nl> std : : optional < pointing_button : : value_t > get_pointing_button ( void ) const { <nl> try { <nl> if ( type_ = = type : : pointing_button ) { <nl> - return mpark : : get < pointing_button : : value_t > ( value_ ) ; <nl> + return std : : get < pointing_button : : value_t > ( value_ ) ; <nl> } <nl> - } catch ( mpark : : bad_variant_access & ) { <nl> + } catch ( std : : bad_variant_access & ) { <nl> } <nl> return std : : nullopt ; <nl> } <nl> class event { <nl> std : : optional < pointing_motion > get_pointing_motion ( void ) const { <nl> try { <nl> if ( type_ = = type : : pointing_motion ) { <nl> - return mpark : : get < pointing_motion > ( value_ ) ; <nl> + return std : : get < pointing_motion > ( value_ ) ; <nl> } <nl> - } catch ( mpark : : bad_variant_access & ) { <nl> + } catch ( std : : bad_variant_access & ) { <nl> } <nl> return std : : nullopt ; <nl> } <nl> class event { <nl> std : : optional < int64_t > get_integer_value ( void ) const { <nl> try { <nl> if ( type_ = = type : : caps_lock_state_changed ) { <nl> - return mpark : : get < int64_t > ( value_ ) ; <nl> + return std : : get < int64_t > ( value_ ) ; <nl> } <nl> - } catch ( mpark : : bad_variant_access & ) { <nl> + } catch ( std : : bad_variant_access & ) { <nl> } <nl> return std : : nullopt ; <nl> } <nl> class event { <nl> std : : optional < std : : string > get_shell_command ( void ) const { <nl> try { <nl> if ( type_ = = type : : shell_command ) { <nl> - return mpark : : get < std : : string > ( value_ ) ; <nl> + return std : : get < std : : string > ( value_ ) ; <nl> } <nl> - } catch ( mpark : : bad_variant_access & ) { <nl> + } catch ( std : : bad_variant_access & ) { <nl> } <nl> return std : : nullopt ; <nl> } <nl> class event { <nl> std : : optional < std : : vector < pqrs : : osx : : input_source_selector : : specifier > > get_input_source_specifiers ( void ) const { <nl> try { <nl> if ( type_ = = type : : select_input_source ) { <nl> - return mpark : : get < std : : vector < pqrs : : osx : : input_source_selector : : specifier > > ( value_ ) ; <nl> + return std : : get < std : : vector < pqrs : : osx : : input_source_selector : : specifier > > ( value_ ) ; <nl> } <nl> - } catch ( mpark : : bad_variant_access & ) { <nl> + } catch ( std : : bad_variant_access & ) { <nl> } <nl> return std : : nullopt ; <nl> } <nl> class event { <nl> std : : optional < std : : pair < std : : string , int > > get_set_variable ( void ) const { <nl> try { <nl> if ( type_ = = type : : set_variable ) { <nl> - return mpark : : get < std : : pair < std : : string , int > > ( value_ ) ; <nl> + return std : : get < std : : pair < std : : string , int > > ( value_ ) ; <nl> } <nl> - } catch ( mpark : : bad_variant_access & ) { <nl> + } catch ( std : : bad_variant_access & ) { <nl> } <nl> return std : : nullopt ; <nl> } <nl> class event { <nl> std : : optional < mouse_key > get_mouse_key ( void ) const { <nl> try { <nl> if ( type_ = = type : : mouse_key ) { <nl> - return mpark : : get < mouse_key > ( value_ ) ; <nl> + return std : : get < mouse_key > ( value_ ) ; <nl> } <nl> - } catch ( mpark : : bad_variant_access & ) { <nl> + } catch ( std : : bad_variant_access & ) { <nl> } <nl> return std : : nullopt ; <nl> } <nl> class event { <nl> std : : optional < pqrs : : osx : : frontmost_application_monitor : : application > get_frontmost_application ( void ) const { <nl> try { <nl> if ( type_ = = type : : frontmost_application_changed ) { <nl> - return mpark : : get < pqrs : : osx : : frontmost_application_monitor : : application > ( value_ ) ; <nl> + return std : : get < pqrs : : osx : : frontmost_application_monitor : : application > ( value_ ) ; <nl> } <nl> - } catch ( mpark : : bad_variant_access & ) { <nl> + } catch ( std : : bad_variant_access & ) { <nl> } <nl> return std : : nullopt ; <nl> } <nl> class event { <nl> std : : optional < pqrs : : osx : : input_source : : properties > get_input_source_properties ( void ) const { <nl> try { <nl> if ( type_ = = type : : input_source_changed ) { <nl> - return mpark : : get < pqrs : : osx : : input_source : : properties > ( value_ ) ; <nl> + return std : : get < pqrs : : osx : : input_source : : properties > ( value_ ) ; <nl> } <nl> - } catch ( mpark : : bad_variant_access & ) { <nl> + } catch ( std : : bad_variant_access & ) { <nl> } <nl> return std : : nullopt ; <nl> } <nl> class event { <nl> static event make_virtual_event ( type type ) { <nl> event e ; <nl> e . type_ = type ; <nl> - e . value_ = mpark : : monostate ( ) ; <nl> + e . value_ = std : : monostate ( ) ; <nl> return e ; <nl> } <nl> <nl> mmm a / src / share / manipulator / manipulators / post_event_to_virtual_devices / queue . hpp <nl> ppp b / src / share / manipulator / manipulators / post_event_to_virtual_devices / queue . hpp <nl> <nl> # include " keyboard_repeat_detector . hpp " <nl> # include " types . hpp " <nl> # include " virtual_hid_device_utility . hpp " <nl> - # include < mpark / variant . hpp > <nl> # include < pqrs / dispatcher . hpp > <nl> # include < pqrs / karabiner / driverkit / virtual_hid_device_service . hpp > <nl> + # include < variant > <nl> <nl> namespace krbn { <nl> namespace manipulator { <nl> class queue final : pqrs : : dispatcher : : extra : : dispatcher_client { <nl> <nl> std : : optional < pqrs : : karabiner : : driverkit : : virtual_hid_device_driver : : hid_report : : keyboard_input > get_keyboard_input ( void ) const { <nl> if ( type_ = = type : : keyboard_input ) { <nl> - return mpark : : get < pqrs : : karabiner : : driverkit : : virtual_hid_device_driver : : hid_report : : keyboard_input > ( value_ ) ; <nl> + return std : : get < pqrs : : karabiner : : driverkit : : virtual_hid_device_driver : : hid_report : : keyboard_input > ( value_ ) ; <nl> } <nl> return std : : nullopt ; <nl> } <nl> <nl> std : : optional < pqrs : : karabiner : : driverkit : : virtual_hid_device_driver : : hid_report : : consumer_input > get_consumer_input ( void ) const { <nl> if ( type_ = = type : : consumer_input ) { <nl> - return mpark : : get < pqrs : : karabiner : : driverkit : : virtual_hid_device_driver : : hid_report : : consumer_input > ( value_ ) ; <nl> + return std : : get < pqrs : : karabiner : : driverkit : : virtual_hid_device_driver : : hid_report : : consumer_input > ( value_ ) ; <nl> } <nl> return std : : nullopt ; <nl> } <nl> <nl> std : : optional < pqrs : : karabiner : : driverkit : : virtual_hid_device_driver : : hid_report : : apple_vendor_top_case_input > get_apple_vendor_top_case_input ( void ) const { <nl> if ( type_ = = type : : apple_vendor_top_case_input ) { <nl> - return mpark : : get < pqrs : : karabiner : : driverkit : : virtual_hid_device_driver : : hid_report : : apple_vendor_top_case_input > ( value_ ) ; <nl> + return std : : get < pqrs : : karabiner : : driverkit : : virtual_hid_device_driver : : hid_report : : apple_vendor_top_case_input > ( value_ ) ; <nl> } <nl> return std : : nullopt ; <nl> } <nl> <nl> std : : optional < pqrs : : karabiner : : driverkit : : virtual_hid_device_driver : : hid_report : : apple_vendor_keyboard_input > get_apple_vendor_keyboard_input ( void ) const { <nl> if ( type_ = = type : : apple_vendor_keyboard_input ) { <nl> - return mpark : : get < pqrs : : karabiner : : driverkit : : virtual_hid_device_driver : : hid_report : : apple_vendor_keyboard_input > ( value_ ) ; <nl> + return std : : get < pqrs : : karabiner : : driverkit : : virtual_hid_device_driver : : hid_report : : apple_vendor_keyboard_input > ( value_ ) ; <nl> } <nl> return std : : nullopt ; <nl> } <nl> <nl> std : : optional < pqrs : : karabiner : : driverkit : : virtual_hid_device_driver : : hid_report : : pointing_input > get_pointing_input ( void ) const { <nl> if ( type_ = = type : : pointing_input ) { <nl> - return mpark : : get < pqrs : : karabiner : : driverkit : : virtual_hid_device_driver : : hid_report : : pointing_input > ( value_ ) ; <nl> + return std : : get < pqrs : : karabiner : : driverkit : : virtual_hid_device_driver : : hid_report : : pointing_input > ( value_ ) ; <nl> } <nl> return std : : nullopt ; <nl> } <nl> <nl> std : : optional < std : : string > get_shell_command ( void ) const { <nl> if ( type_ = = type : : shell_command ) { <nl> - return mpark : : get < std : : string > ( value_ ) ; <nl> + return std : : get < std : : string > ( value_ ) ; <nl> } <nl> return std : : nullopt ; <nl> } <nl> <nl> std : : optional < std : : vector < pqrs : : osx : : input_source_selector : : specifier > > get_input_source_specifiers ( void ) const { <nl> if ( type_ = = type : : select_input_source ) { <nl> - return mpark : : get < std : : vector < pqrs : : osx : : input_source_selector : : specifier > > ( value_ ) ; <nl> + return std : : get < std : : vector < pqrs : : osx : : input_source_selector : : specifier > > ( value_ ) ; <nl> } <nl> return std : : nullopt ; <nl> } <nl> class queue final : pqrs : : dispatcher : : extra : : dispatcher_client { <nl> } <nl> <nl> type type_ ; <nl> - mpark : : variant < pqrs : : karabiner : : driverkit : : virtual_hid_device_driver : : hid_report : : keyboard_input , <nl> - pqrs : : karabiner : : driverkit : : virtual_hid_device_driver : : hid_report : : consumer_input , <nl> - pqrs : : karabiner : : driverkit : : virtual_hid_device_driver : : hid_report : : apple_vendor_top_case_input , <nl> - pqrs : : karabiner : : driverkit : : virtual_hid_device_driver : : hid_report : : apple_vendor_keyboard_input , <nl> - pqrs : : karabiner : : driverkit : : virtual_hid_device_driver : : hid_report : : pointing_input , <nl> - std : : string , / / For shell_command <nl> - std : : vector < pqrs : : osx : : input_source_selector : : specifier > / / For select_input_source <nl> - > <nl> + std : : variant < pqrs : : karabiner : : driverkit : : virtual_hid_device_driver : : hid_report : : keyboard_input , <nl> + pqrs : : karabiner : : driverkit : : virtual_hid_device_driver : : hid_report : : consumer_input , <nl> + pqrs : : karabiner : : driverkit : : virtual_hid_device_driver : : hid_report : : apple_vendor_top_case_input , <nl> + pqrs : : karabiner : : driverkit : : virtual_hid_device_driver : : hid_report : : apple_vendor_keyboard_input , <nl> + pqrs : : karabiner : : driverkit : : virtual_hid_device_driver : : hid_report : : pointing_input , <nl> + std : : string , / / For shell_command <nl> + std : : vector < pqrs : : osx : : input_source_selector : : specifier > / / For select_input_source <nl> + > <nl> value_ ; <nl> absolute_time_point time_stamp_ ; <nl> } ; <nl> mmm a / src / share / manipulator / types / event_definition . hpp <nl> ppp b / src / share / manipulator / types / event_definition . hpp <nl> <nl> # pragma once <nl> <nl> # include " event_queue . hpp " <nl> - # include < mpark / variant . hpp > <nl> # include < nlohmann / json . hpp > <nl> # include < optional > <nl> # include < pqrs / json . hpp > <nl> + # include < variant > <nl> <nl> namespace krbn { <nl> namespace manipulator { <nl> class event_definition final { <nl> mouse_key , <nl> } ; <nl> <nl> - using value_t = mpark : : variant < mpark : : monostate , <nl> - key_code : : value_t , <nl> - consumer_key_code : : value_t , <nl> - pointing_button : : value_t , <nl> - type , / / For any <nl> - std : : string , / / For shell_command <nl> - std : : vector < pqrs : : osx : : input_source_selector : : specifier > , / / For select_input_source <nl> - std : : pair < std : : string , int > , / / For set_variable <nl> - mouse_key / / For mouse_key <nl> - > ; <nl> + using value_t = std : : variant < std : : monostate , <nl> + key_code : : value_t , <nl> + consumer_key_code : : value_t , <nl> + pointing_button : : value_t , <nl> + type , / / For any <nl> + std : : string , / / For shell_command <nl> + std : : vector < pqrs : : osx : : input_source_selector : : specifier > , / / For select_input_source <nl> + std : : pair < std : : string , int > , / / For set_variable <nl> + mouse_key / / For mouse_key <nl> + > ; <nl> <nl> event_definition ( void ) : type_ ( type : : none ) , <nl> - value_ ( mpark : : monostate ( ) ) { <nl> + value_ ( std : : monostate ( ) ) { <nl> } <nl> <nl> ~ event_definition ( void ) { <nl> class event_definition final { <nl> <nl> std : : optional < key_code : : value_t > get_key_code ( void ) const { <nl> if ( type_ = = type : : key_code ) { <nl> - return mpark : : get < key_code : : value_t > ( value_ ) ; <nl> + return std : : get < key_code : : value_t > ( value_ ) ; <nl> } <nl> return std : : nullopt ; <nl> } <nl> <nl> std : : optional < consumer_key_code : : value_t > get_consumer_key_code ( void ) const { <nl> if ( type_ = = type : : consumer_key_code ) { <nl> - return mpark : : get < consumer_key_code : : value_t > ( value_ ) ; <nl> + return std : : get < consumer_key_code : : value_t > ( value_ ) ; <nl> } <nl> return std : : nullopt ; <nl> } <nl> <nl> std : : optional < pointing_button : : value_t > get_pointing_button ( void ) const { <nl> if ( type_ = = type : : pointing_button ) { <nl> - return mpark : : get < pointing_button : : value_t > ( value_ ) ; <nl> + return std : : get < pointing_button : : value_t > ( value_ ) ; <nl> } <nl> return std : : nullopt ; <nl> } <nl> <nl> std : : optional < type > get_any_type ( void ) const { <nl> if ( type_ = = type : : any ) { <nl> - return mpark : : get < type > ( value_ ) ; <nl> + return std : : get < type > ( value_ ) ; <nl> } <nl> return std : : nullopt ; <nl> } <nl> <nl> std : : optional < std : : string > get_shell_command ( void ) const { <nl> if ( type_ = = type : : shell_command ) { <nl> - return mpark : : get < std : : string > ( value_ ) ; <nl> + return std : : get < std : : string > ( value_ ) ; <nl> } <nl> return std : : nullopt ; <nl> } <nl> <nl> std : : optional < std : : vector < pqrs : : osx : : input_source_selector : : specifier > > get_input_source_specifiers ( void ) const { <nl> if ( type_ = = type : : select_input_source ) { <nl> - return mpark : : get < std : : vector < pqrs : : osx : : input_source_selector : : specifier > > ( value_ ) ; <nl> + return std : : get < std : : vector < pqrs : : osx : : input_source_selector : : specifier > > ( value_ ) ; <nl> } <nl> return std : : nullopt ; <nl> } <nl> <nl> std : : optional < std : : pair < std : : string , int > > get_set_variable ( void ) const { <nl> if ( type_ = = type : : set_variable ) { <nl> - return mpark : : get < std : : pair < std : : string , int > > ( value_ ) ; <nl> + return std : : get < std : : pair < std : : string , int > > ( value_ ) ; <nl> } <nl> return std : : nullopt ; <nl> } <nl> <nl> std : : optional < mouse_key > get_mouse_key ( void ) const { <nl> if ( type_ = = type : : mouse_key ) { <nl> - return mpark : : get < mouse_key > ( value_ ) ; <nl> + return std : : get < mouse_key > ( value_ ) ; <nl> } <nl> return std : : nullopt ; <nl> } <nl> class event_definition final { <nl> case type : : none : <nl> return std : : nullopt ; <nl> case type : : key_code : <nl> - return event_queue : : event ( mpark : : get < key_code : : value_t > ( value_ ) ) ; <nl> + return event_queue : : event ( std : : get < key_code : : value_t > ( value_ ) ) ; <nl> case type : : consumer_key_code : <nl> - return event_queue : : event ( mpark : : get < consumer_key_code : : value_t > ( value_ ) ) ; <nl> + return event_queue : : event ( std : : get < consumer_key_code : : value_t > ( value_ ) ) ; <nl> case type : : pointing_button : <nl> - return event_queue : : event ( mpark : : get < pointing_button : : value_t > ( value_ ) ) ; <nl> + return event_queue : : event ( std : : get < pointing_button : : value_t > ( value_ ) ) ; <nl> case type : : any : <nl> return std : : nullopt ; <nl> case type : : shell_command : <nl> - return event_queue : : event : : make_shell_command_event ( mpark : : get < std : : string > ( value_ ) ) ; <nl> + return event_queue : : event : : make_shell_command_event ( std : : get < std : : string > ( value_ ) ) ; <nl> case type : : select_input_source : <nl> - return event_queue : : event : : make_select_input_source_event ( mpark : : get < std : : vector < pqrs : : osx : : input_source_selector : : specifier > > ( value_ ) ) ; <nl> + return event_queue : : event : : make_select_input_source_event ( std : : get < std : : vector < pqrs : : osx : : input_source_selector : : specifier > > ( value_ ) ) ; <nl> case type : : set_variable : <nl> - return event_queue : : event : : make_set_variable_event ( mpark : : get < std : : pair < std : : string , int > > ( value_ ) ) ; <nl> + return event_queue : : event : : make_set_variable_event ( std : : get < std : : pair < std : : string , int > > ( value_ ) ) ; <nl> case type : : mouse_key : <nl> - return event_queue : : event : : make_mouse_key_event ( mpark : : get < mouse_key > ( value_ ) ) ; <nl> + return event_queue : : event : : make_mouse_key_event ( std : : get < mouse_key > ( value_ ) ) ; <nl> } <nl> } <nl> <nl> mmm a / src / share / types / key_down_up_valued_event . hpp <nl> ppp b / src / share / types / key_down_up_valued_event . hpp <nl> <nl> # include " consumer_key_code . hpp " <nl> # include " key_code . hpp " <nl> # include " pointing_button . hpp " <nl> - # include < mpark / variant . hpp > <nl> # include < nlohmann / json . hpp > <nl> # include < pqrs / hash . hpp > <nl> + # include < variant > <nl> <nl> namespace krbn { <nl> class key_down_up_valued_event final { <nl> public : <nl> - using value_t = mpark : : variant < key_code : : value_t , <nl> - consumer_key_code : : value_t , <nl> - pointing_button : : value_t , <nl> - mpark : : monostate > ; <nl> + using value_t = std : : variant < key_code : : value_t , <nl> + consumer_key_code : : value_t , <nl> + pointing_button : : value_t , <nl> + std : : monostate > ; <nl> <nl> - key_down_up_valued_event ( void ) : value_ ( mpark : : monostate ( ) ) { <nl> + key_down_up_valued_event ( void ) : value_ ( std : : monostate ( ) ) { <nl> } <nl> <nl> template < typename T > <nl> class key_down_up_valued_event final { <nl> <nl> template < typename T > <nl> const T * find ( void ) const { <nl> - return mpark : : get_if < T > ( & value_ ) ; <nl> + return std : : get_if < T > ( & value_ ) ; <nl> } <nl> <nl> bool modifier_flag ( void ) const { <nl> mmm a / tests / src / manipulator_basic / src / manipulator_basic_test . cpp <nl> ppp b / tests / src / manipulator_basic / src / manipulator_basic_test . cpp <nl> TEST_CASE ( " to " ) { <nl> { <nl> auto & d = b . get_to ( ) [ 0 ] . get_event_definition ( ) ; <nl> REQUIRE ( d . get_type ( ) = = event_definition : : type : : key_code ) ; <nl> - REQUIRE ( mpark : : get < krbn : : key_code : : value_t > ( d . get_value ( ) ) = = krbn : : key_code : : keyboard_tab ) ; <nl> + REQUIRE ( std : : get < krbn : : key_code : : value_t > ( d . get_value ( ) ) = = krbn : : key_code : : keyboard_tab ) ; <nl> } <nl> } <nl> <nl> TEST_CASE ( " to " ) { <nl> { <nl> auto & d = b . get_to ( ) [ 0 ] . get_event_definition ( ) ; <nl> REQUIRE ( d . get_type ( ) = = event_definition : : type : : key_code ) ; <nl> - REQUIRE ( mpark : : get < krbn : : key_code : : value_t > ( d . get_value ( ) ) = = krbn : : key_code : : keyboard_tab ) ; <nl> + REQUIRE ( std : : get < krbn : : key_code : : value_t > ( d . get_value ( ) ) = = krbn : : key_code : : keyboard_tab ) ; <nl> } <nl> { <nl> auto & d = b . get_to ( ) [ 1 ] . get_event_definition ( ) ; <nl> REQUIRE ( d . get_type ( ) = = event_definition : : type : : key_code ) ; <nl> - REQUIRE ( mpark : : get < krbn : : key_code : : value_t > ( d . get_value ( ) ) = = krbn : : key_code : : keyboard_spacebar ) ; <nl> + REQUIRE ( std : : get < krbn : : key_code : : value_t > ( d . get_value ( ) ) = = krbn : : key_code : : keyboard_spacebar ) ; <nl> } <nl> } <nl> } <nl> mmm a / tests / src / manipulator_basic / src / simultaneous_options_test . cpp <nl> ppp b / tests / src / manipulator_basic / src / simultaneous_options_test . cpp <nl> TEST_CASE ( " simultaneous_options . to_after_key_up " ) { <nl> { <nl> auto & d = o . get_to_after_key_up ( ) [ 0 ] . get_event_definition ( ) ; <nl> REQUIRE ( d . get_type ( ) = = event_definition : : type : : key_code ) ; <nl> - REQUIRE ( mpark : : get < krbn : : key_code : : value_t > ( d . get_value ( ) ) = = krbn : : key_code : : keyboard_tab ) ; <nl> + REQUIRE ( std : : get < krbn : : key_code : : value_t > ( d . get_value ( ) ) = = krbn : : key_code : : keyboard_tab ) ; <nl> } <nl> } <nl> <nl> TEST_CASE ( " simultaneous_options . to_after_key_up " ) { <nl> { <nl> auto & d = o . get_to_after_key_up ( ) [ 0 ] . get_event_definition ( ) ; <nl> REQUIRE ( d . get_type ( ) = = event_definition : : type : : key_code ) ; <nl> - REQUIRE ( mpark : : get < krbn : : key_code : : value_t > ( d . get_value ( ) ) = = krbn : : key_code : : keyboard_tab ) ; <nl> + REQUIRE ( std : : get < krbn : : key_code : : value_t > ( d . get_value ( ) ) = = krbn : : key_code : : keyboard_tab ) ; <nl> } <nl> { <nl> auto & d = o . get_to_after_key_up ( ) [ 1 ] . get_event_definition ( ) ; <nl> REQUIRE ( d . get_type ( ) = = event_definition : : type : : key_code ) ; <nl> - REQUIRE ( mpark : : get < krbn : : key_code : : value_t > ( d . get_value ( ) ) = = krbn : : key_code : : keyboard_spacebar ) ; <nl> + REQUIRE ( std : : get < krbn : : key_code : : value_t > ( d . get_value ( ) ) = = krbn : : key_code : : keyboard_spacebar ) ; <nl> } <nl> } <nl> } <nl> mmm a / tests / src / manipulator_basic / src / to_after_key_up_test . cpp <nl> ppp b / tests / src / manipulator_basic / src / to_after_key_up_test . cpp <nl> TEST_CASE ( " to_after_key_up " ) { <nl> { <nl> auto & d = b . get_to_after_key_up ( ) [ 0 ] . get_event_definition ( ) ; <nl> REQUIRE ( d . get_type ( ) = = event_definition : : type : : key_code ) ; <nl> - REQUIRE ( mpark : : get < krbn : : key_code : : value_t > ( d . get_value ( ) ) = = krbn : : key_code : : keyboard_tab ) ; <nl> + REQUIRE ( std : : get < krbn : : key_code : : value_t > ( d . get_value ( ) ) = = krbn : : key_code : : keyboard_tab ) ; <nl> } <nl> } <nl> <nl> TEST_CASE ( " to_after_key_up " ) { <nl> { <nl> auto & d = b . get_to_after_key_up ( ) [ 0 ] . get_event_definition ( ) ; <nl> REQUIRE ( d . get_type ( ) = = event_definition : : type : : key_code ) ; <nl> - REQUIRE ( mpark : : get < krbn : : key_code : : value_t > ( d . get_value ( ) ) = = krbn : : key_code : : keyboard_tab ) ; <nl> + REQUIRE ( std : : get < krbn : : key_code : : value_t > ( d . get_value ( ) ) = = krbn : : key_code : : keyboard_tab ) ; <nl> } <nl> { <nl> auto & d = b . get_to_after_key_up ( ) [ 1 ] . get_event_definition ( ) ; <nl> REQUIRE ( d . get_type ( ) = = event_definition : : type : : key_code ) ; <nl> - REQUIRE ( mpark : : get < krbn : : key_code : : value_t > ( d . get_value ( ) ) = = krbn : : key_code : : keyboard_spacebar ) ; <nl> + REQUIRE ( std : : get < krbn : : key_code : : value_t > ( d . get_value ( ) ) = = krbn : : key_code : : keyboard_spacebar ) ; <nl> } <nl> } <nl> } <nl> mmm a / tests / src / manipulator_basic / src / to_delayed_action_test . cpp <nl> ppp b / tests / src / manipulator_basic / src / to_delayed_action_test . cpp <nl> TEST_CASE ( " to_delayed_action " ) { <nl> { <nl> auto & d = b . get_to_delayed_action ( ) - > get_to_if_invoked ( ) [ 0 ] . get_event_definition ( ) ; <nl> REQUIRE ( d . get_type ( ) = = event_definition : : type : : key_code ) ; <nl> - REQUIRE ( mpark : : get < krbn : : key_code : : value_t > ( d . get_value ( ) ) = = krbn : : key_code : : keyboard_tab ) ; <nl> + REQUIRE ( std : : get < krbn : : key_code : : value_t > ( d . get_value ( ) ) = = krbn : : key_code : : keyboard_tab ) ; <nl> } <nl> <nl> / / to_if_canceled <nl> TEST_CASE ( " to_delayed_action " ) { <nl> { <nl> auto & d = b . get_to_delayed_action ( ) - > get_to_if_canceled ( ) [ 0 ] . get_event_definition ( ) ; <nl> REQUIRE ( d . get_type ( ) = = event_definition : : type : : key_code ) ; <nl> - REQUIRE ( mpark : : get < krbn : : key_code : : value_t > ( d . get_value ( ) ) = = krbn : : key_code : : keyboard_a ) ; <nl> + REQUIRE ( std : : get < krbn : : key_code : : value_t > ( d . get_value ( ) ) = = krbn : : key_code : : keyboard_a ) ; <nl> } <nl> } <nl> <nl> TEST_CASE ( " to_delayed_action " ) { <nl> { <nl> auto & d = b . get_to_delayed_action ( ) - > get_to_if_invoked ( ) [ 0 ] . get_event_definition ( ) ; <nl> REQUIRE ( d . get_type ( ) = = event_definition : : type : : key_code ) ; <nl> - REQUIRE ( mpark : : get < krbn : : key_code : : value_t > ( d . get_value ( ) ) = = krbn : : key_code : : keyboard_tab ) ; <nl> + REQUIRE ( std : : get < krbn : : key_code : : value_t > ( d . get_value ( ) ) = = krbn : : key_code : : keyboard_tab ) ; <nl> } <nl> { <nl> auto & d = b . get_to_delayed_action ( ) - > get_to_if_invoked ( ) [ 1 ] . get_event_definition ( ) ; <nl> REQUIRE ( d . get_type ( ) = = event_definition : : type : : key_code ) ; <nl> - REQUIRE ( mpark : : get < krbn : : key_code : : value_t > ( d . get_value ( ) ) = = krbn : : key_code : : keyboard_spacebar ) ; <nl> + REQUIRE ( std : : get < krbn : : key_code : : value_t > ( d . get_value ( ) ) = = krbn : : key_code : : keyboard_spacebar ) ; <nl> } <nl> <nl> / / to_if_canceled <nl> TEST_CASE ( " to_delayed_action " ) { <nl> { <nl> auto & d = b . get_to_delayed_action ( ) - > get_to_if_canceled ( ) [ 0 ] . get_event_definition ( ) ; <nl> REQUIRE ( d . get_type ( ) = = event_definition : : type : : key_code ) ; <nl> - REQUIRE ( mpark : : get < krbn : : key_code : : value_t > ( d . get_value ( ) ) = = krbn : : key_code : : keyboard_a ) ; <nl> + REQUIRE ( std : : get < krbn : : key_code : : value_t > ( d . get_value ( ) ) = = krbn : : key_code : : keyboard_a ) ; <nl> } <nl> { <nl> auto & d = b . get_to_delayed_action ( ) - > get_to_if_canceled ( ) [ 1 ] . get_event_definition ( ) ; <nl> REQUIRE ( d . get_type ( ) = = event_definition : : type : : key_code ) ; <nl> - REQUIRE ( mpark : : get < krbn : : key_code : : value_t > ( d . get_value ( ) ) = = krbn : : key_code : : keyboard_b ) ; <nl> + REQUIRE ( std : : get < krbn : : key_code : : value_t > ( d . get_value ( ) ) = = krbn : : key_code : : keyboard_b ) ; <nl> } <nl> } <nl> } <nl> mmm a / tests / src / manipulator_basic / src / to_if_alone_test . cpp <nl> ppp b / tests / src / manipulator_basic / src / to_if_alone_test . cpp <nl> TEST_CASE ( " to_if_alone " ) { <nl> { <nl> auto & d = b . get_to_if_alone ( ) [ 0 ] . get_event_definition ( ) ; <nl> REQUIRE ( d . get_type ( ) = = event_definition : : type : : key_code ) ; <nl> - REQUIRE ( mpark : : get < krbn : : key_code : : value_t > ( d . get_value ( ) ) = = krbn : : key_code : : keyboard_tab ) ; <nl> + REQUIRE ( std : : get < krbn : : key_code : : value_t > ( d . get_value ( ) ) = = krbn : : key_code : : keyboard_tab ) ; <nl> } <nl> } <nl> <nl> TEST_CASE ( " to_if_alone " ) { <nl> { <nl> auto & d = b . get_to_if_alone ( ) [ 0 ] . get_event_definition ( ) ; <nl> REQUIRE ( d . get_type ( ) = = event_definition : : type : : key_code ) ; <nl> - REQUIRE ( mpark : : get < krbn : : key_code : : value_t > ( d . get_value ( ) ) = = krbn : : key_code : : keyboard_tab ) ; <nl> + REQUIRE ( std : : get < krbn : : key_code : : value_t > ( d . get_value ( ) ) = = krbn : : key_code : : keyboard_tab ) ; <nl> } <nl> { <nl> auto & d = b . get_to_if_alone ( ) [ 1 ] . get_event_definition ( ) ; <nl> REQUIRE ( d . get_type ( ) = = event_definition : : type : : key_code ) ; <nl> - REQUIRE ( mpark : : get < krbn : : key_code : : value_t > ( d . get_value ( ) ) = = krbn : : key_code : : keyboard_spacebar ) ; <nl> + REQUIRE ( std : : get < krbn : : key_code : : value_t > ( d . get_value ( ) ) = = krbn : : key_code : : keyboard_spacebar ) ; <nl> } <nl> } <nl> } <nl> mmm a / tests / src / manipulator_basic / src / to_if_held_down_test . cpp <nl> ppp b / tests / src / manipulator_basic / src / to_if_held_down_test . cpp <nl> TEST_CASE ( " to_if_held_down " ) { <nl> { <nl> auto & d = b . get_to_if_held_down ( ) - > get_to ( ) [ 0 ] . get_event_definition ( ) ; <nl> REQUIRE ( d . get_type ( ) = = event_definition : : type : : key_code ) ; <nl> - REQUIRE ( mpark : : get < krbn : : key_code : : value_t > ( d . get_value ( ) ) = = krbn : : key_code : : keyboard_tab ) ; <nl> + REQUIRE ( std : : get < krbn : : key_code : : value_t > ( d . get_value ( ) ) = = krbn : : key_code : : keyboard_tab ) ; <nl> } <nl> } <nl> <nl> TEST_CASE ( " to_if_held_down " ) { <nl> { <nl> auto & d = b . get_to_if_held_down ( ) - > get_to ( ) [ 0 ] . get_event_definition ( ) ; <nl> REQUIRE ( d . get_type ( ) = = event_definition : : type : : key_code ) ; <nl> - REQUIRE ( mpark : : get < krbn : : key_code : : value_t > ( d . get_value ( ) ) = = krbn : : key_code : : keyboard_tab ) ; <nl> + REQUIRE ( std : : get < krbn : : key_code : : value_t > ( d . get_value ( ) ) = = krbn : : key_code : : keyboard_tab ) ; <nl> } <nl> { <nl> auto & d = b . get_to_if_held_down ( ) - > get_to ( ) [ 1 ] . get_event_definition ( ) ; <nl> REQUIRE ( d . get_type ( ) = = event_definition : : type : : key_code ) ; <nl> - REQUIRE ( mpark : : get < krbn : : key_code : : value_t > ( d . get_value ( ) ) = = krbn : : key_code : : keyboard_spacebar ) ; <nl> + REQUIRE ( std : : get < krbn : : key_code : : value_t > ( d . get_value ( ) ) = = krbn : : key_code : : keyboard_spacebar ) ; <nl> } <nl> } <nl> } <nl>
mpark : : variant - > std : : variant
pqrs-org/Karabiner-Elements
acc70980337bfc4ff80e5f6972686491736960fd
2020-09-13T14:38:23Z
mmm a / src / app / document . cpp <nl> ppp b / src / app / document . cpp <nl> Document : : Document ( Sprite * sprite ) <nl> , m_extraCel ( NULL ) <nl> , m_extraImage ( NULL ) <nl> , m_extraCelBlendMode ( BLEND_MODE_NORMAL ) <nl> + , m_extraCelType ( render : : ExtraType : : NONE ) <nl> / / Mask <nl> , m_mask ( new Mask ( ) ) <nl> , m_maskVisible ( true ) <nl> void Document : : destroyExtraCel ( ) <nl> <nl> m_extraCel = NULL ; <nl> m_extraImage . reset ( NULL ) ; <nl> + m_extraCelType = render : : ExtraType : : NONE ; <nl> } <nl> <nl> void Document : : prepareExtraCel ( const gfx : : Rect & bounds , int opacity ) <nl> void Document : : prepareExtraCel ( const gfx : : Rect & bounds , int opacity ) <nl> m_extraCel - > setOpacity ( opacity ) ; <nl> } <nl> <nl> + void Document : : setExtraCelType ( render : : ExtraType type ) <nl> + { <nl> + m_extraCelType = type ; <nl> + } <nl> + <nl> Cel * Document : : getExtraCel ( ) const <nl> { <nl> return m_extraCel ; <nl> mmm a / src / app / document . h <nl> ppp b / src / app / document . h <nl> <nl> # include " doc / pixel_format . h " <nl> # include " gfx / rect . h " <nl> # include " gfx / transformation . h " <nl> + # include " render / extra_type . h " <nl> <nl> # include < string > <nl> <nl> namespace app { <nl> / / Extra Cel ( it is used to draw pen preview , pixels in movement , etc . ) <nl> <nl> void prepareExtraCel ( const gfx : : Rect & bounds , int opacity ) ; <nl> + void setExtraCelType ( render : : ExtraType type ) ; <nl> void destroyExtraCel ( ) ; <nl> Cel * getExtraCel ( ) const ; <nl> Image * getExtraCelImage ( ) const ; <nl> - <nl> + render : : ExtraType getExtraCelType ( ) const { return m_extraCelType ; } <nl> int getExtraCelBlendMode ( ) const { return m_extraCelBlendMode ; } <nl> void setExtraCelBlendMode ( int mode ) { m_extraCelBlendMode = mode ; } <nl> <nl> namespace app { <nl> / / Image of the extra cel . <nl> ImageRef m_extraImage ; <nl> int m_extraCelBlendMode ; <nl> + render : : ExtraType m_extraCelType ; <nl> <nl> / / Current mask . <nl> base : : UniquePtr < Mask > m_mask ; <nl> mmm a / src / app / tools / tool_box . cpp <nl> ppp b / src / app / tools / tool_box . cpp <nl> const char * WellKnownIntertwiners : : AsEllipses = " as_ellipses " ; <nl> const char * WellKnownIntertwiners : : AsBezier = " as_bezier " ; <nl> const char * WellKnownIntertwiners : : AsPixelPerfect = " as_pixel_perfect " ; <nl> <nl> + const char * WellKnownPointShapes : : None = " none " ; <nl> + const char * WellKnownPointShapes : : Pixel = " pixel " ; <nl> + const char * WellKnownPointShapes : : Brush = " brush " ; <nl> + const char * WellKnownPointShapes : : FloodFill = " floodfill " ; <nl> + const char * WellKnownPointShapes : : Spray = " spray " ; <nl> + <nl> ToolBox : : ToolBox ( ) <nl> { <nl> PRINTF ( " Toolbox module : installing \ n " ) ; <nl> ToolBox : : ToolBox ( ) <nl> m_controllers [ " two_points " ] = new TwoPointsController ( ) ; <nl> m_controllers [ " four_points " ] = new FourPointsController ( ) ; <nl> <nl> - m_pointshapers [ " none " ] = new NonePointShape ( ) ; <nl> - m_pointshapers [ " pixel " ] = new PixelPointShape ( ) ; <nl> - m_pointshapers [ " brush " ] = new BrushPointShape ( ) ; <nl> - m_pointshapers [ " floodfill " ] = new FloodFillPointShape ( ) ; <nl> - m_pointshapers [ " spray " ] = new SprayPointShape ( ) ; <nl> + m_pointshapers [ WellKnownPointShapes : : None ] = new NonePointShape ( ) ; <nl> + m_pointshapers [ WellKnownPointShapes : : Pixel ] = new PixelPointShape ( ) ; <nl> + m_pointshapers [ WellKnownPointShapes : : Brush ] = new BrushPointShape ( ) ; <nl> + m_pointshapers [ WellKnownPointShapes : : FloodFill ] = new FloodFillPointShape ( ) ; <nl> + m_pointshapers [ WellKnownPointShapes : : Spray ] = new SprayPointShape ( ) ; <nl> <nl> m_intertwiners [ WellKnownIntertwiners : : None ] = new IntertwineNone ( ) ; <nl> m_intertwiners [ WellKnownIntertwiners : : AsLines ] = new IntertwineAsLines ( ) ; <nl> Intertwine * ToolBox : : getIntertwinerById ( const std : : string & id ) <nl> return m_intertwiners [ id ] ; <nl> } <nl> <nl> + PointShape * ToolBox : : getPointShapeById ( const std : : string & id ) <nl> + { <nl> + return m_pointshapers [ id ] ; <nl> + } <nl> + <nl> void ToolBox : : loadTools ( ) <nl> { <nl> PRINTF ( " Loading Aseprite tools \ n " ) ; <nl> mmm a / src / app / tools / tool_box . h <nl> ppp b / src / app / tools / tool_box . h <nl> namespace app { <nl> extern const char * AsPixelPerfect ; <nl> } ; <nl> <nl> + namespace WellKnownPointShapes { <nl> + extern const char * None ; <nl> + extern const char * Pixel ; <nl> + extern const char * Brush ; <nl> + extern const char * FloodFill ; <nl> + extern const char * Spray ; <nl> + } ; <nl> + <nl> typedef std : : list < Tool * > ToolList ; <nl> typedef ToolList : : iterator ToolIterator ; <nl> typedef ToolList : : const_iterator ToolConstIterator ; <nl> namespace app { <nl> Tool * getToolById ( const std : : string & id ) ; <nl> Ink * getInkById ( const std : : string & id ) ; <nl> Intertwine * getIntertwinerById ( const std : : string & id ) ; <nl> + PointShape * getPointShapeById ( const std : : string & id ) ; <nl> int getGroupsCount ( ) const { return m_groups . size ( ) ; } <nl> <nl> private : <nl> mmm a / src / app / ui / document_view . cpp <nl> ppp b / src / app / ui / document_view . cpp <nl> class AppEditor : public Editor , <nl> set_current_palette ( editor - > sprite ( ) - > palette ( editor - > frame ( ) ) , true ) ; <nl> } <nl> <nl> + void onAfterLayerChanged ( Editor * editor ) override { <nl> + App : : instance ( ) - > getMainWindow ( ) - > getPreviewEditor ( ) - > updateUsingEditor ( this ) ; <nl> + } <nl> + <nl> / / EditorCustomizationDelegate implementation <nl> tools : : Tool * getQuickTool ( tools : : Tool * currentTool ) override { <nl> return KeyboardShortcuts : : instance ( ) <nl> mmm a / src / app / ui / editor / cursor . cpp <nl> ppp b / src / app / ui / editor / cursor . cpp <nl> <nl> # include " app / ini_file . h " <nl> # include " app / modules / editors . h " <nl> # include " app / settings / settings . h " <nl> + # include " app / tools / controller . h " <nl> # include " app / tools / ink . h " <nl> + # include " app / tools / intertwine . h " <nl> + # include " app / tools / point_shape . h " <nl> # include " app / tools / tool . h " <nl> + # include " app / tools / tool_loop . h " <nl> + # include " app / ui / editor / tool_loop_impl . h " <nl> # include " app / ui_context . h " <nl> # include " app / util / boundary . h " <nl> # include " base / memory . h " <nl> # include " doc / algo . h " <nl> # include " doc / brush . h " <nl> + # include " doc / cel . h " <nl> # include " doc / image . h " <nl> # include " doc / layer . h " <nl> # include " doc / primitives . h " <nl> + # include " doc / site . h " <nl> # include " doc / sprite . h " <nl> + # include " render / render . h " <nl> # include " ui / base . h " <nl> # include " ui / system . h " <nl> # include " ui / widget . h " <nl> void Editor : : drawBrushPreview ( const gfx : : Point & pos , bool refresh ) <nl> <nl> Brush * brush = editor_get_current_brush ( this ) ; <nl> gfx : : Rect brushBounds = brush - > bounds ( ) ; <nl> + brushBounds . offset ( spritePos ) ; <nl> + / / brushBounds . x = m_zoom . remove ( m_zoom . apply ( brushBounds . x ) ) ; <nl> + / / brushBounds . y = m_zoom . remove ( m_zoom . apply ( brushBounds . y ) ) ; <nl> + / / brushBounds = m_zoom . remove ( m_zoom . apply ( brushBounds ) ) ; <nl> + / / brushBounds . enlarge ( 1 ) ; <nl> <nl> / / Create the extra cel to show the brush preview <nl> + Site site = getSite ( ) ; <nl> + Cel * cel = site . cel ( ) ; <nl> + <nl> m_document - > prepareExtraCel ( <nl> - gfx : : Rect ( brushBounds ) . offset ( spritePos ) , <nl> - tool_settings - > getOpacity ( ) ) ; <nl> + brushBounds , <nl> + cel ? cel - > opacity ( ) : 255 ) ; <nl> + m_document - > setExtraCelType ( render : : ExtraType : : NONE ) ; <nl> + m_document - > setExtraCelBlendMode ( <nl> + m_layer ? static_cast < LayerImage * > ( m_layer ) - > getBlendMode ( ) : BLEND_MODE_NORMAL ) ; <nl> <nl> / / In ' indexed ' images , if the current color is 0 , we have to use <nl> / / a different mask color ( different from 0 ) to draw the extra layer <nl> void Editor : : drawBrushPreview ( const gfx : : Point & pos , bool refresh ) <nl> <nl> Image * extraImage = m_document - > getExtraCelImage ( ) ; <nl> extraImage - > setMaskColor ( mask_color ) ; <nl> - draw_brush ( extraImage , brush , - brushBounds . x , - brushBounds . y , <nl> - brush_color , extraImage - > maskColor ( ) ) ; <nl> + clear_image ( extraImage , mask_color ) ; <nl> + <nl> + if ( m_layer ) { <nl> + render : : Render ( ) . renderLayer ( <nl> + extraImage , m_layer , m_frame , <nl> + gfx : : Clip ( 0 , 0 , brushBounds ) , <nl> + BLEND_MODE_COPY ) ; <nl> + <nl> + / / This extra cel is a patch for the current layer / frame <nl> + m_document - > setExtraCelType ( render : : ExtraType : : PATCH ) ; <nl> + } <nl> + <nl> + tools : : ToolLoop * loop = create_tool_loop_preview ( <nl> + this , UIContext : : instance ( ) , extraImage , <nl> + - gfx : : Point ( brushBounds . x , <nl> + brushBounds . y ) ) ; <nl> + if ( loop ) { <nl> + loop - > getInk ( ) - > prepareInk ( loop ) ; <nl> + loop - > getIntertwine ( ) - > prepareIntertwine ( ) ; <nl> + loop - > getController ( ) - > prepareController ( ) ; <nl> + loop - > getPointShape ( ) - > preparePointShape ( loop ) ; <nl> + loop - > getPointShape ( ) - > transformPoint ( <nl> + loop , - brush - > bounds ( ) . x , - brush - > bounds ( ) . y ) ; <nl> + delete loop ; <nl> + } <nl> <nl> if ( refresh ) { <nl> m_document - > notifySpritePixelsModified <nl> - ( m_sprite , <nl> - gfx : : Region ( gfx : : Rect ( <nl> - spritePos . x + brushBounds . x , <nl> - spritePos . y + brushBounds . y , <nl> - brushBounds . w , brushBounds . h ) ) ) ; <nl> + ( m_sprite , gfx : : Region ( brushBounds ) ) ; <nl> } <nl> } <nl> <nl> void Editor : : clearBrushPreview ( bool refresh ) <nl> Brush * brush = editor_get_current_brush ( this ) ; <nl> gfx : : Rect brushBounds = brush - > bounds ( ) ; <nl> <nl> - m_document - > prepareExtraCel ( <nl> - gfx : : Rect ( brushBounds ) . offset ( pos ) , <nl> - 0 ) ; / / Opacity = 0 <nl> + m_document - > destroyExtraCel ( ) ; <nl> <nl> if ( refresh ) { <nl> m_document - > notifySpritePixelsModified <nl> mmm a / src / app / ui / editor / editor . cpp <nl> ppp b / src / app / ui / editor / editor . cpp <nl> void Editor : : drawOneSpriteUnclippedRect ( ui : : Graphics * g , const gfx : : Rect & sprite <nl> } <nl> } <nl> <nl> - m_renderEngine . setExtraImage ( <nl> - m_document - > getExtraCel ( ) , <nl> - m_document - > getExtraCelImage ( ) , <nl> - m_document - > getExtraCelBlendMode ( ) , <nl> - m_layer , m_frame ) ; <nl> + if ( m_document - > getExtraCelType ( ) ! = render : : ExtraType : : NONE ) { <nl> + ASSERT ( m_document - > getExtraCel ( ) ) ; <nl> + <nl> + m_renderEngine . setExtraImage ( <nl> + m_document - > getExtraCelType ( ) , <nl> + m_document - > getExtraCel ( ) , <nl> + m_document - > getExtraCelImage ( ) , <nl> + m_document - > getExtraCelBlendMode ( ) , <nl> + m_layer , m_frame ) ; <nl> + } <nl> <nl> m_renderEngine . renderSprite ( rendered , m_sprite , m_frame , <nl> gfx : : Clip ( 0 , 0 , rc ) , m_zoom ) ; <nl> void Editor : : flashCurrentLayer ( ) <nl> m_renderEngine . removePreviewImage ( ) ; <nl> <nl> m_document - > prepareExtraCel ( m_sprite - > bounds ( ) , 255 ) ; <nl> + m_document - > setExtraCelType ( render : : ExtraType : : COMPOSITE ) ; <nl> + <nl> Image * flash_image = m_document - > getExtraCelImage ( ) ; <nl> <nl> clear_image ( flash_image , flash_image - > maskColor ( ) ) ; <nl> mmm a / src / app / ui / editor / pixels_movement . cpp <nl> ppp b / src / app / ui / editor / pixels_movement . cpp <nl> <nl> # include " doc / algorithm / rotsprite . h " <nl> # include " doc / cel . h " <nl> # include " doc / image . h " <nl> + # include " doc / layer . h " <nl> # include " doc / mask . h " <nl> # include " doc / site . h " <nl> # include " doc / sprite . h " <nl> PixelsMovement : : PixelsMovement ( Context * context , <nl> <nl> ContextWriter writer ( m_reader , 500 ) ; <nl> m_document - > prepareExtraCel ( m_sprite - > bounds ( ) , opacity ) ; <nl> + m_document - > setExtraCelType ( render : : ExtraType : : COMPOSITE ) ; <nl> + m_document - > setExtraCelBlendMode ( <nl> + static_cast < LayerImage * > ( m_layer ) - > getBlendMode ( ) ) ; <nl> <nl> redrawExtraImage ( ) ; <nl> <nl> mmm a / src / app / ui / editor / tool_loop_impl . cpp <nl> ppp b / src / app / ui / editor / tool_loop_impl . cpp <nl> <nl> # include " app / settings / settings . h " <nl> # include " app / tools / controller . h " <nl> # include " app / tools / ink . h " <nl> + # include " app / tools / point_shape . h " <nl> # include " app / tools / shade_table . h " <nl> # include " app / tools / shading_options . h " <nl> # include " app / tools / tool . h " <nl> <nl> # include " app / util / expand_cel_canvas . h " <nl> # include " doc / brush . h " <nl> # include " doc / cel . h " <nl> + # include " doc / image . h " <nl> # include " doc / layer . h " <nl> # include " doc / mask . h " <nl> # include " doc / sprite . h " <nl> namespace app { <nl> <nl> using namespace ui ; <nl> <nl> + / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / <nl> + / / For ToolLoopController <nl> + <nl> class ToolLoopImpl : public tools : : ToolLoop , <nl> public tools : : ShadingOptions { <nl> Editor * m_editor ; <nl> tools : : ToolLoop * create_tool_loop ( Editor * editor , Context * context ) <nl> } <nl> } <nl> <nl> + / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / <nl> + / / For preview <nl> + <nl> + class PreviewToolLoopImpl : public tools : : ToolLoop , <nl> + public tools : : ShadingOptions { <nl> + Editor * m_editor ; <nl> + Context * m_context ; <nl> + tools : : Tool * m_tool ; <nl> + Brush * m_brush ; <nl> + Document * m_document ; <nl> + Sprite * m_sprite ; <nl> + Layer * m_layer ; <nl> + frame_t m_frame ; <nl> + ISettings * m_settings ; <nl> + DocumentPreferences & m_docPref ; <nl> + IToolSettings * m_toolSettings ; <nl> + int m_opacity ; <nl> + int m_tolerance ; <nl> + bool m_contiguous ; <nl> + gfx : : Point m_offset ; <nl> + gfx : : Point m_speed ; <nl> + bool m_canceled ; <nl> + tools : : ToolLoop : : Button m_button ; <nl> + tools : : Ink * m_ink ; <nl> + int m_primary_color ; <nl> + int m_secondary_color ; <nl> + gfx : : Region m_dirtyArea ; <nl> + tools : : ShadeTable8 * m_shadeTable ; <nl> + Image * m_image ; <nl> + tools : : PointShape * m_pointShape ; <nl> + <nl> + public : <nl> + PreviewToolLoopImpl ( <nl> + Editor * editor , <nl> + Context * context , <nl> + tools : : Tool * tool , <nl> + tools : : Ink * ink , <nl> + Document * document , <nl> + tools : : ToolLoop : : Button button , <nl> + const app : : Color & primary_color , <nl> + const app : : Color & secondary_color , <nl> + Image * image , <nl> + const gfx : : Point & offset ) <nl> + : m_editor ( editor ) <nl> + , m_context ( context ) <nl> + , m_tool ( tool ) <nl> + , m_document ( document ) <nl> + , m_sprite ( editor - > sprite ( ) ) <nl> + , m_layer ( editor - > layer ( ) ) <nl> + , m_frame ( editor - > frame ( ) ) <nl> + , m_settings ( m_context - > settings ( ) ) <nl> + , m_docPref ( App : : instance ( ) - > preferences ( ) . document ( m_document ) ) <nl> + , m_toolSettings ( m_settings - > getToolSettings ( m_tool ) ) <nl> + , m_offset ( offset ) <nl> + , m_canceled ( false ) <nl> + , m_button ( button ) <nl> + , m_ink ( ink ) <nl> + , m_primary_color ( color_utils : : color_for_layer ( primary_color , m_layer ) ) <nl> + , m_secondary_color ( color_utils : : color_for_layer ( secondary_color , m_layer ) ) <nl> + , m_shadeTable ( NULL ) <nl> + , m_image ( image ) <nl> + { <nl> + / / Create the brush <nl> + IBrushSettings * brush_settings = m_toolSettings - > getBrush ( ) ; <nl> + ASSERT ( brush_settings ! = NULL ) ; <nl> + <nl> + m_brush = new Brush ( <nl> + brush_settings - > getType ( ) , <nl> + brush_settings - > getSize ( ) , <nl> + brush_settings - > getAngle ( ) ) ; <nl> + <nl> + m_opacity = m_toolSettings - > getOpacity ( ) ; <nl> + m_tolerance = m_toolSettings - > getTolerance ( ) ; <nl> + m_contiguous = m_toolSettings - > getContiguous ( ) ; <nl> + m_speed . x = 0 ; <nl> + m_speed . y = 0 ; <nl> + <nl> + / / Avoid preview for spray and flood fill like tools <nl> + m_pointShape = m_tool - > getPointShape ( m_button ) ; <nl> + if ( m_pointShape - > isSpray ( ) ) { <nl> + m_pointShape = App : : instance ( ) - > getToolBox ( ) - > getPointShapeById ( <nl> + tools : : WellKnownPointShapes : : Brush ) ; <nl> + } <nl> + else if ( m_pointShape - > isFloodFill ( ) ) { <nl> + m_pointShape = App : : instance ( ) - > getToolBox ( ) - > getPointShapeById ( <nl> + tools : : WellKnownPointShapes : : Pixel ) ; <nl> + } <nl> + } <nl> + <nl> + / / IToolLoop interface <nl> + void dispose ( ) override { } <nl> + tools : : Tool * getTool ( ) override { return m_tool ; } <nl> + Brush * getBrush ( ) override { return m_brush ; } <nl> + Document * getDocument ( ) override { return m_document ; } <nl> + Sprite * sprite ( ) override { return m_sprite ; } <nl> + Layer * getLayer ( ) override { return m_layer ; } <nl> + frame_t getFrame ( ) override { return m_frame ; } <nl> + const Image * getSrcImage ( ) override { return m_image ; } <nl> + Image * getDstImage ( ) override { return m_image ; } <nl> + void validateSrcImage ( const gfx : : Region & rgn ) override { } <nl> + void validateDstImage ( const gfx : : Region & rgn ) override { } <nl> + void invalidateDstImage ( ) override { } <nl> + void invalidateDstImage ( const gfx : : Region & rgn ) override { } <nl> + void copyValidDstToSrcImage ( const gfx : : Region & rgn ) override { } <nl> + <nl> + RgbMap * getRgbMap ( ) override { return m_sprite - > rgbMap ( m_frame ) ; } <nl> + bool useMask ( ) override { return false ; / / m_useMask ; <nl> + } <nl> + Mask * getMask ( ) override { return nullptr ; / / m_mask ; <nl> + } <nl> + void setMask ( Mask * newMask ) override { } <nl> + gfx : : Point getMaskOrigin ( ) override { return gfx : : Point ( 0 , 0 ) ; / / m_maskOrigin ; <nl> + } <nl> + const render : : Zoom & zoom ( ) override { return m_editor - > zoom ( ) ; } <nl> + ToolLoop : : Button getMouseButton ( ) override { return m_button ; } <nl> + int getPrimaryColor ( ) override { return m_primary_color ; } <nl> + void setPrimaryColor ( int color ) override { m_primary_color = color ; } <nl> + int getSecondaryColor ( ) override { return m_secondary_color ; } <nl> + void setSecondaryColor ( int color ) override { m_secondary_color = color ; } <nl> + int getOpacity ( ) override { return m_opacity ; } <nl> + int getTolerance ( ) override { return m_tolerance ; } <nl> + bool getContiguous ( ) override { return m_contiguous ; } <nl> + SelectionMode getSelectionMode ( ) override { return m_editor - > getSelectionMode ( ) ; } <nl> + ISettings * settings ( ) override { return m_settings ; } <nl> + filters : : TiledMode getTiledMode ( ) override { return m_docPref . tiled . mode ( ) ; } <nl> + bool getGridVisible ( ) override { return m_docPref . grid . visible ( ) ; } <nl> + bool getSnapToGrid ( ) override { return m_docPref . grid . snap ( ) ; } <nl> + gfx : : Rect getGridBounds ( ) override { return m_docPref . grid . bounds ( ) ; } <nl> + bool getFilled ( ) override { return false ; } <nl> + bool getPreviewFilled ( ) override { return false ; } <nl> + int getSprayWidth ( ) override { return 0 ; } <nl> + int getSpraySpeed ( ) override { return 0 ; } <nl> + gfx : : Point getOffset ( ) override { return m_offset ; } <nl> + void setSpeed ( const gfx : : Point & speed ) override { m_speed = speed ; } <nl> + gfx : : Point getSpeed ( ) override { return m_speed ; } <nl> + tools : : Ink * getInk ( ) override { return m_ink ; } <nl> + tools : : Controller * getController ( ) override { return m_tool - > getController ( m_button ) ; } <nl> + tools : : PointShape * getPointShape ( ) override { return m_pointShape ; } <nl> + tools : : Intertwine * getIntertwine ( ) override { return m_tool - > getIntertwine ( m_button ) ; } <nl> + tools : : TracePolicy getTracePolicy ( ) override { return m_tool - > getTracePolicy ( m_button ) ; } <nl> + tools : : ShadingOptions * getShadingOptions ( ) override { return this ; } <nl> + <nl> + void cancel ( ) override { } <nl> + bool isCanceled ( ) override { return true ; } <nl> + <nl> + gfx : : Point screenToSprite ( const gfx : : Point & screenPoint ) override { <nl> + return m_editor - > screenToEditor ( screenPoint ) ; <nl> + } <nl> + <nl> + gfx : : Region & getDirtyArea ( ) override { <nl> + return m_dirtyArea ; <nl> + } <nl> + <nl> + void updateDirtyArea ( ) override { <nl> + } <nl> + <nl> + void updateStatusBar ( const char * text ) override { <nl> + StatusBar : : instance ( ) - > setStatusText ( 0 , text ) ; <nl> + } <nl> + <nl> + / / ShadingOptions implementation <nl> + tools : : ShadeTable8 * getShadeTable ( ) override { <nl> + if ( m_shadeTable = = NULL ) { <nl> + app : : ColorSwatches * colorSwatches = m_settings - > getColorSwatches ( ) ; <nl> + ASSERT ( colorSwatches ! = NULL ) ; <nl> + m_shadeTable = new tools : : ShadeTable8 ( * colorSwatches , <nl> + tools : : kRotateShadingMode ) ; <nl> + } <nl> + return m_shadeTable ; <nl> + } <nl> + <nl> + } ; <nl> + <nl> + tools : : ToolLoop * create_tool_loop_preview ( <nl> + Editor * editor , Context * context , Image * image , <nl> + const gfx : : Point & offset ) <nl> + { <nl> + tools : : Tool * current_tool = editor - > getCurrentEditorTool ( ) ; <nl> + tools : : Ink * current_ink = editor - > getCurrentEditorInk ( ) ; <nl> + if ( ! current_tool | | ! current_ink ) <nl> + return NULL ; <nl> + <nl> + Layer * layer = editor - > layer ( ) ; <nl> + if ( ! layer | | <nl> + ! layer - > isVisible ( ) | | <nl> + ! layer - > isEditable ( ) ) { <nl> + return nullptr ; <nl> + } <nl> + <nl> + / / Get fg / bg colors <nl> + ColorBar * colorbar = ColorBar : : instance ( ) ; <nl> + app : : Color fg = colorbar - > getFgColor ( ) ; <nl> + app : : Color bg = colorbar - > getBgColor ( ) ; <nl> + if ( ! fg . isValid ( ) | | ! bg . isValid ( ) ) <nl> + return nullptr ; <nl> + <nl> + / / Create the new tool loop <nl> + try { <nl> + return new PreviewToolLoopImpl ( <nl> + editor , context , <nl> + current_tool , <nl> + current_ink , <nl> + editor - > document ( ) , <nl> + tools : : ToolLoop : : Left , <nl> + fg , bg , image , offset ) ; <nl> + } <nl> + catch ( const std : : exception & ) { <nl> + return nullptr ; <nl> + } <nl> + } <nl> + <nl> + / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / <nl> + <nl> } / / namespace app <nl> mmm a / src / app / ui / editor / tool_loop_impl . h <nl> ppp b / src / app / ui / editor / tool_loop_impl . h <nl> <nl> # define APP_UI_EDITOR_TOOL_LOOP_IMPL_H_INCLUDED <nl> # pragma once <nl> <nl> + # include " gfx / fwd . h " <nl> + <nl> + namespace doc { <nl> + class Image ; <nl> + } <nl> + <nl> namespace app { <nl> class Context ; <nl> class Editor ; <nl> namespace app { <nl> class ToolLoop ; <nl> } <nl> <nl> - tools : : ToolLoop * create_tool_loop ( Editor * editor , Context * context ) ; <nl> + tools : : ToolLoop * create_tool_loop ( <nl> + Editor * editor , Context * context ) ; <nl> + <nl> + tools : : ToolLoop * create_tool_loop_preview ( <nl> + Editor * editor , Context * context , doc : : Image * image , <nl> + const gfx : : Point & offset ) ; <nl> <nl> } / / namespace app <nl> <nl> new file mode 100644 <nl> index 000000000 . . 3402b9593 <nl> mmm / dev / null <nl> ppp b / src / render / extra_type . h <nl> <nl> + / / Aseprite Render Library <nl> + / / Copyright ( c ) 2001 - 2015 David Capello <nl> + / / <nl> + / / This file is released under the terms of the MIT license . <nl> + / / Read LICENSE . txt for more information . <nl> + <nl> + # ifndef RENDER_EXTRA_TYPE_H_INCLUDED <nl> + # define RENDER_EXTRA_TYPE_H_INCLUDED <nl> + # pragma once <nl> + <nl> + namespace render { <nl> + <nl> + enum class ExtraType { <nl> + NONE , <nl> + <nl> + / / The extra cel indicates a " patch " for the current layer / frame <nl> + / / given in Render : : setExtraImage ( ) <nl> + PATCH , <nl> + <nl> + / / The extra cel indicates an extra composition for the current <nl> + / / layer / frame . <nl> + COMPOSITE , <nl> + } ; <nl> + <nl> + } / / namespace render <nl> + <nl> + # endif <nl> mmm a / src / render / render . cpp <nl> ppp b / src / render / render . cpp <nl> <nl> # include " render / render . h " <nl> <nl> # include " doc / doc . h " <nl> + # include " gfx / clip . h " <nl> + # include " gfx / region . h " <nl> <nl> namespace render { <nl> <nl> Render : : Render ( ) <nl> : m_sprite ( NULL ) <nl> , m_currentLayer ( NULL ) <nl> , m_currentFrame ( 0 ) <nl> + , m_extraType ( ExtraType : : NONE ) <nl> , m_extraCel ( NULL ) <nl> , m_extraImage ( NULL ) <nl> , m_bgType ( BgType : : TRANSPARENT ) <nl> void Render : : setPreviewImage ( const Layer * layer , frame_t frame , Image * image ) <nl> } <nl> <nl> void Render : : setExtraImage ( <nl> + ExtraType type , <nl> const Cel * cel , const Image * image , int blendMode , <nl> const Layer * currentLayer , <nl> frame_t currentFrame ) <nl> { <nl> + m_extraType = type ; <nl> m_extraCel = cel ; <nl> m_extraImage = image ; <nl> m_extraBlendMode = blendMode ; <nl> void Render : : removePreviewImage ( ) <nl> <nl> void Render : : removeExtraImage ( ) <nl> { <nl> + m_extraType = ExtraType : : NONE ; <nl> m_extraCel = NULL ; <nl> } <nl> <nl> void Render : : renderLayer ( <nl> Image * dstImage , <nl> const Layer * layer , <nl> frame_t frame , <nl> - const gfx : : Clip & area ) <nl> + const gfx : : Clip & area , <nl> + int blend_mode ) <nl> { <nl> m_sprite = layer - > sprite ( ) ; <nl> <nl> void Render : : renderLayer ( <nl> m_globalOpacity = 255 ; <nl> renderLayer ( layer , dstImage , area , <nl> frame , Zoom ( 1 , 1 ) , scaled_func , <nl> - true , true , - 1 ) ; <nl> + true , true , blend_mode ) ; <nl> } <nl> <nl> void Render : : renderSprite ( <nl> void Render : : renderLayer ( <nl> if ( ! layer - > isVisible ( ) ) <nl> return ; <nl> <nl> + gfx : : Rect extraArea ; <nl> + bool drawExtra = ( m_extraCel & & <nl> + m_extraImage & & <nl> + layer = = m_currentLayer & & <nl> + frame = = m_currentFrame ) ; <nl> + if ( drawExtra ) { <nl> + extraArea = gfx : : Rect ( <nl> + m_extraCel - > x ( ) , <nl> + m_extraCel - > y ( ) , <nl> + m_extraImage - > width ( ) , <nl> + m_extraImage - > height ( ) ) ; <nl> + extraArea = zoom . apply ( extraArea ) ; <nl> + if ( zoom . scale ( ) < 1 . 0 ) { <nl> + extraArea . w - - ; <nl> + extraArea . h - - ; <nl> + } <nl> + if ( extraArea . w < 1 ) extraArea . w = 1 ; <nl> + if ( extraArea . h < 1 ) extraArea . h = 1 ; <nl> + } <nl> + <nl> switch ( layer - > type ( ) ) { <nl> <nl> case ObjectType : : LayerImage : { <nl> void Render : : renderLayer ( <nl> <nl> const Cel * cel = layer - > cel ( frame ) ; <nl> if ( cel ! = NULL ) { <nl> + Palette * pal = m_sprite - > palette ( frame ) ; <nl> Image * src_image ; <nl> <nl> / / Is the ' m_previewImage ' set to be used with this layer ? <nl> void Render : : renderLayer ( <nl> <nl> ASSERT ( src_image - > maskColor ( ) = = m_sprite - > transparentColor ( ) ) ; <nl> <nl> - renderCel ( image , src_image , <nl> - m_sprite - > palette ( frame ) , <nl> - cel , area , scaled_func , <nl> - output_opacity , <nl> + int layer_blend_mode = <nl> ( blend_mode < 0 ? <nl> - static_cast < const LayerImage * > ( layer ) - > getBlendMode ( ) : <nl> - blend_mode ) , <nl> - zoom ) ; <nl> + static_cast < const LayerImage * > ( layer ) - > getBlendMode ( ) : <nl> + blend_mode ) ; <nl> + <nl> + / / Draw parts outside the " m_extraCel " area <nl> + if ( drawExtra & & m_extraType = = ExtraType : : PATCH ) { <nl> + gfx : : Region originalAreas ( area . srcBounds ( ) ) ; <nl> + originalAreas . createSubtraction ( <nl> + originalAreas , gfx : : Region ( extraArea ) ) ; <nl> + <nl> + for ( auto rc : originalAreas ) { <nl> + renderCel ( <nl> + image , src_image , pal , <nl> + cel , gfx : : Clip ( area . dst . x + rc . x - area . src . x , <nl> + area . dst . y + rc . y - area . src . y , rc ) , scaled_func , <nl> + output_opacity , <nl> + layer_blend_mode , zoom ) ; <nl> + } <nl> + } <nl> + / / Draw the whole cel <nl> + else { <nl> + renderCel ( <nl> + image , src_image , pal , <nl> + cel , area , scaled_func , <nl> + output_opacity , <nl> + layer_blend_mode , zoom ) ; <nl> + } <nl> } <nl> } <nl> break ; <nl> void Render : : renderLayer ( <nl> } <nl> <nl> / / Draw extras <nl> - if ( m_extraCel & & <nl> - m_extraImage & & <nl> - layer = = m_currentLayer & & <nl> - frame = = m_currentFrame ) { <nl> + if ( drawExtra & & m_extraType ! = ExtraType : : NONE ) { <nl> if ( m_extraCel - > opacity ( ) > 0 ) { <nl> - renderCel ( image , m_extraImage , <nl> + renderCel ( <nl> + image , m_extraImage , <nl> m_sprite - > palette ( frame ) , <nl> - m_extraCel , area , scaled_func , <nl> + m_extraCel , <nl> + gfx : : Clip ( area . dst . x + extraArea . x - area . src . x , <nl> + area . dst . y + extraArea . y - area . src . y , <nl> + extraArea ) , <nl> + scaled_func , <nl> m_extraCel - > opacity ( ) , <nl> m_extraBlendMode , zoom ) ; <nl> } <nl> mmm a / src / render / render . h <nl> ppp b / src / render / render . h <nl> <nl> / / Aseprite Render Library <nl> - / / Copyright ( c ) 2001 - 2014 David Capello <nl> + / / Copyright ( c ) 2001 - 2015 David Capello <nl> / / <nl> / / This file is released under the terms of the MIT license . <nl> / / Read LICENSE . txt for more information . <nl> <nl> # include " doc / pixel_format . h " <nl> # include " gfx / fwd . h " <nl> # include " gfx / size . h " <nl> + # include " render / extra_type . h " <nl> # include " render / zoom . h " <nl> <nl> namespace gfx { <nl> namespace render { <nl> class Render { <nl> public : <nl> Render ( ) ; <nl> - <nl> + <nl> / / Background configuration <nl> void setBgType ( BgType type ) ; <nl> void setBgZoom ( bool state ) ; <nl> namespace render { <nl> / / Sets an extra cel / image to be drawn after the current <nl> / / layer / frame . <nl> void setExtraImage ( <nl> + ExtraType type , <nl> const Cel * cel , const Image * image , int blendMode , <nl> const Layer * currentLayer , <nl> frame_t currentFrame ) ; <nl> namespace render { <nl> Image * dstImage , <nl> const Layer * layer , <nl> frame_t frame , <nl> - const gfx : : Clip & area ) ; <nl> + const gfx : : Clip & area , <nl> + int blend_mode = - 1 ) ; <nl> <nl> / / Main function used to render the sprite . Draws the given sprite <nl> / / frame in a new image and return it . Note : zoomedRect must have <nl> namespace render { <nl> const Sprite * m_sprite ; <nl> const Layer * m_currentLayer ; <nl> frame_t m_currentFrame ; <nl> + ExtraType m_extraType ; <nl> const Cel * m_extraCel ; <nl> const Image * m_extraImage ; <nl> int m_extraBlendMode ; <nl>
Use a PreviewToolLoopImpl to preview the current tool ink / point shape / etc
aseprite/aseprite
4e6db14cae2974d871030d50924f683e63727b3a
2015-04-26T18:59:28Z
mmm a / tests / test_sanity . py <nl> ppp b / tests / test_sanity . py <nl> class sanity ( RunnerCore ) : <nl> @ classmethod <nl> def setUpClass ( cls ) : <nl> super ( sanity , cls ) . setUpClass ( ) <nl> + # Unlike the other test suites we explicitly don ' t want to be skipping <nl> + # the sanity checks here <nl> + del os . environ [ ' EMCC_SKIP_SANITY_CHECK ' ] <nl> shutil . copyfile ( CONFIG_FILE , CONFIG_FILE + ' _backup ' ) <nl> <nl> print ( ) <nl> mmm a / tools / shared . py <nl> ppp b / tools / shared . py <nl> def check_sanity ( force = False ) : <nl> EM_CONFIG ( so , we re - check sanity when the settings are changed ) . We also <nl> re - check sanity and clear the cache when the version changes . <nl> " " " <nl> + if not force and os . environ . get ( ' EMCC_SKIP_SANITY_CHECK ' ) = = ' 1 ' : <nl> + return <nl> + # We set EMCC_SKIP_SANITY_CHECK so that any subprocesses that we launch will <nl> + # not re - run the tests . <nl> + os . environ [ ' EMCC_SKIP_SANITY_CHECK ' ] = ' 1 ' <nl> with ToolchainProfiler . profile_block ( ' sanity ' ) : <nl> check_llvm_version ( ) <nl> expected = generate_sanity ( ) <nl> - if os . environ . get ( ' EMCC_SKIP_SANITY_CHECK ' ) = = ' 1 ' : <nl> - return <nl> reason = None <nl> if not CONFIG_FILE : <nl> return # config stored directly in EM_CONFIG = > skip sanity checks <nl>
Skip sanity checked in sub - processes ( )
emscripten-core/emscripten
125fd951b05c4f311d68299d660222e99f6cf393
2019-09-19T17:04:57Z
mmm a / lib / FrontendTool / FrontendTool . cpp <nl> ppp b / lib / FrontendTool / FrontendTool . cpp <nl> static void debugFailWithCrash ( ) { <nl> <nl> / / / Performs the compile requested by the user . <nl> / / / \ param Instance Will be reset after performIRGeneration when the verifier <nl> - / / / mode is NoVerify . <nl> + / / / mode is NoVerify and there were no errors . <nl> / / / \ returns true on error <nl> static bool performCompile ( std : : unique_ptr < CompilerInstance > & Instance , <nl> CompilerInvocation & Invocation , <nl>
Updated comment to clarify condition for free
apple/swift
4497083a0aef39770e23543681dfbe6c1be36912
2016-12-15T20:59:46Z
mmm a / src / library_gl . js <nl> ppp b / src / library_gl . js <nl> var LibraryGL = { <nl> textures : [ ] , <nl> uniforms : [ ] , <nl> shaders : [ ] , <nl> + vaos : [ ] , <nl> <nl> # if FULL_ES2 <nl> clientBuffers : [ ] , <nl> var LibraryGL = { <nl> <nl> / / Extension available from Firefox 26 and Google Chrome 30 <nl> GL . instancedArraysExt = GLctx . getExtension ( ' ANGLE_instanced_arrays ' ) ; <nl> + <nl> + / / Extension available from Firefox 25 and WebKit <nl> + GL . vaoExt = Module . ctx . getExtension ( ' OES_vertex_array_object ' ) ; <nl> <nl> / / These are the ' safe ' feature - enabling extensions that don ' t add any performance impact related to e . g . debugging , and <nl> / / should be enabled by default so that client GLES2 / GL code will not need to go through extra hoops to get its stuff working . <nl> var LibraryGL = { <nl> return GLctx . isFramebuffer ( fb ) ; <nl> } , <nl> <nl> + glGenVertexArrays__sig : ' vii ' , <nl> + glGenVertexArrays : function ( n , arrays ) { <nl> + # if ASSERTIONS <nl> + assert ( GL . vaoExt , ' Must have OES_vertex_array_object to use vao ' ) ; <nl> + # endif <nl> + for ( var i = 0 ; i < n ; i + + ) { <nl> + var id = GL . getNewId ( GL . vaos ) ; <nl> + var vao = GL . vaoExt . createVertexArrayOES ( ) ; <nl> + vao . name = id ; <nl> + GL . vaos [ id ] = vao ; <nl> + { { { makeSetValue ( ' arrays ' , ' i * 4 ' , ' id ' , ' i32 ' ) } } } ; <nl> + } <nl> + } , <nl> + <nl> + glDeleteVertexArrays__sig : ' vii ' , <nl> + glDeleteVertexArrays : function ( n , vaos ) { <nl> + # if ASSERTIONS <nl> + assert ( GL . vaoExt , ' Must have OES_vertex_array_object to use vao ' ) ; <nl> + # endif <nl> + for ( var i = 0 ; i < n ; i + + ) { <nl> + var id = { { { makeGetValue ( ' vaos ' , ' i * 4 ' , ' i32 ' ) } } } ; <nl> + GL . vaoExt . deleteVertexArrayOES ( GL . vaos [ id ] ) ; <nl> + GL . vaos [ id ] = null ; <nl> + } <nl> + } , <nl> + <nl> + glBindVertexArray__sig : ' vi ' , <nl> + glBindVertexArray : function ( vao ) { <nl> + # if ASSERTIONS <nl> + assert ( GL . vaoExt , ' Must have OES_vertex_array_object to use vao ' ) ; <nl> + # endif <nl> + GL . vaoExt . bindVertexArrayOES ( GL . vaos [ vao ] ) ; <nl> + } , <nl> + <nl> + glIsVertexArray__sig : ' ii ' , <nl> + glIsVertexArray : function ( array ) { <nl> + # if ASSERTIONS <nl> + assert ( GL . vaoExt , ' Must have OES_vertex_array_object to use vao ' ) ; <nl> + # endif <nl> + var vao = GL . vaos [ array ] ; <nl> + if ( ! vao ) return 0 ; <nl> + return GL . vaoExt . isVertexArrayOES ( vao ) ; <nl> + } , <nl> + <nl> # if LEGACY_GL_EMULATION <nl> <nl> / / GL emulation : provides misc . functionality not present in OpenGL ES 2 . 0 or WebGL <nl> var LibraryGL = { <nl> } , <nl> <nl> / / Vertex array object ( VAO ) support . TODO : when the WebGL extension is popular , use that and remove this code and GL . vaos <nl> - glGenVertexArrays__deps : [ ' $ GLEmulation ' ] , <nl> - glGenVertexArrays__sig : ' vii ' , <nl> - glGenVertexArrays : function ( n , vaos ) { <nl> + emulGlGenVertexArrays__deps : [ ' $ GLEmulation ' ] , <nl> + emulGlGenVertexArrays__sig : ' vii ' , <nl> + emulGlGenVertexArrays : function ( n , vaos ) { <nl> for ( var i = 0 ; i < n ; i + + ) { <nl> var id = GL . getNewId ( GLEmulation . vaos ) ; <nl> GLEmulation . vaos [ id ] = { <nl> var LibraryGL = { <nl> { { { makeSetValue ( ' vaos ' , ' i * 4 ' , ' id ' , ' i32 ' ) } } } ; <nl> } <nl> } , <nl> - glDeleteVertexArrays__sig : ' vii ' , <nl> - glDeleteVertexArrays : function ( n , vaos ) { <nl> + emulGlDeleteVertexArrays__sig : ' vii ' , <nl> + emulGlDeleteVertexArrays : function ( n , vaos ) { <nl> for ( var i = 0 ; i < n ; i + + ) { <nl> var id = { { { makeGetValue ( ' vaos ' , ' i * 4 ' , ' i32 ' ) } } } ; <nl> GLEmulation . vaos [ id ] = null ; <nl> if ( GLEmulation . currentVao & & GLEmulation . currentVao . id = = id ) GLEmulation . currentVao = null ; <nl> } <nl> } , <nl> - glBindVertexArray__deps : [ ' glBindBuffer ' , ' glEnableVertexAttribArray ' , ' glVertexAttribPointer ' , ' glEnableClientState ' ] , <nl> - glBindVertexArray__sig : ' vi ' , <nl> - glBindVertexArray : function ( vao ) { <nl> + emulGlBindVertexArray__deps : [ ' glBindBuffer ' , ' glEnableVertexAttribArray ' , ' glVertexAttribPointer ' , ' glEnableClientState ' ] , <nl> + emulGlBindVertexArray__sig : ' vi ' , <nl> + emulGlBindVertexArray : function ( vao ) { <nl> / / undo vao - related things , wipe the slate clean , both for vao of 0 or an actual vao <nl> GLEmulation . currentVao = null ; / / make sure the commands we run here are not recorded <nl> if ( GLImmediate . lastRenderer ) GLImmediate . lastRenderer . cleanup ( ) ; <nl> var LibraryGL = { <nl> glCheckFramebufferStatusOES : ' glCheckFramebufferStatus ' , <nl> glDeleteFramebuffersOES : ' glDeleteFramebuffers ' , <nl> glDeleteRenderbuffersOES : ' glDeleteRenderbuffers ' , <nl> - glGenVertexArraysOES : ' glGenVertexArrays ' , <nl> - glDeleteVertexArraysOES : ' glDeleteVertexArrays ' , <nl> - glBindVertexArrayOES : ' glBindVertexArray ' , <nl> glFramebufferTexture2DOES : ' glFramebufferTexture2D ' , <nl> <nl> # else / / LEGACY_GL_EMULATION <nl> <nl> glVertexPointer : function ( ) { throw ' Legacy GL function ( glVertexPointer ) called . If you want legacy GL emulation , you need to compile with - s LEGACY_GL_EMULATION = 1 to enable legacy GL emulation . ' ; } , <nl> - glGenVertexArrays : function ( ) { throw ' Legacy GL function ( glGenVertexArrays ) called . If you want legacy GL emulation , you need to compile with - s LEGACY_GL_EMULATION = 1 to enable legacy GL emulation . ' ; } , <nl> glMatrixMode : function ( ) { throw ' Legacy GL function ( glMatrixMode ) called . If you want legacy GL emulation , you need to compile with - s LEGACY_GL_EMULATION = 1 to enable legacy GL emulation . ' ; } , <nl> glBegin : function ( ) { throw ' Legacy GL function ( glBegin ) called . If you want legacy GL emulation , you need to compile with - s LEGACY_GL_EMULATION = 1 to enable legacy GL emulation . ' ; } , <nl> glLoadIdentity : function ( ) { throw ' Legacy GL function ( glLoadIdentity ) called . If you want legacy GL emulation , you need to compile with - s LEGACY_GL_EMULATION = 1 to enable legacy GL emulation . ' ; } , <nl>
VAO Extension
emscripten-core/emscripten
940543a71ccd5bd5638f58fa8d316e19c008514a
2014-02-19T15:42:54Z
mmm a / src / AbstractCommand . cc <nl> ppp b / src / AbstractCommand . cc <nl> bool AbstractCommand : : execute ( ) <nl> return true ; <nl> } <nl> <nl> - Timer wakeTime ( global : : wallclock ( ) ) ; <nl> - wakeTime . advance ( <nl> - std : : chrono : : seconds ( getOption ( ) - > getAsInt ( PREF_RETRY_WAIT ) ) ) ; <nl> - req_ - > setWakeTime ( wakeTime ) ; <nl> + if ( err . getErrorCode ( ) = = error_code : : HTTP_SERVICE_UNAVAILABLE ) { <nl> + Timer wakeTime ( global : : wallclock ( ) ) ; <nl> + wakeTime . advance ( <nl> + std : : chrono : : seconds ( getOption ( ) - > getAsInt ( PREF_RETRY_WAIT ) ) ) ; <nl> + req_ - > setWakeTime ( wakeTime ) ; <nl> + } <nl> + <nl> return prepareForRetry ( 0 ) ; <nl> } <nl> catch ( DownloadFailureException & err ) { <nl>
Apply - - retry - wait on 503 only
aria2/aria2
d38da969a5f2274d022a2c934416922d2014340b
2016-06-21T14:46:54Z
mmm a / tensorflow / contrib / cmake / tf_core_framework . cmake <nl> ppp b / tensorflow / contrib / cmake / tf_core_framework . cmake <nl> add_dependencies ( tf_core_framework <nl> tf_core_lib <nl> proto_text <nl> ) <nl> - <nl> - if ( WIN32 ) <nl> - # Cmake > 3 . 6 will quote this as - D " __VERSION__ = \ " MSVC \ " " which nvcc fails on . <nl> - # Instead of defining this global , limit it to tf_core_framework where its used . <nl> - target_compile_definitions ( tf_core_framework PRIVATE __VERSION__ = " MSVC " ) <nl> - endif ( ) <nl> mmm a / tensorflow / tensorflow . bzl <nl> ppp b / tensorflow / tensorflow . bzl <nl> def if_override_eigen_strong_inline ( a ) : <nl> <nl> def get_win_copts ( is_external = False ) : <nl> WINDOWS_COPTS = [ <nl> - " / D__VERSION__ = \ \ \ " MSVC \ \ \ " " , <nl> " / DPLATFORM_WINDOWS " , <nl> " / DEIGEN_HAS_C99_MATH " , <nl> " / DTENSORFLOW_USE_EIGEN_THREADPOOL " , <nl> mmm a / tensorflow / tools / git / gen_git_source . py <nl> ppp b / tensorflow / tools / git / gen_git_source . py <nl> def write_version_info ( filename , git_version ) : <nl> contents = " " " / * Generated by gen_git_source . py * / <nl> # include < string > <nl> const char * tf_git_version ( ) { return " % s " ; } <nl> - const char * tf_compiler_version ( ) { return __VERSION__ ; } <nl> + const char * tf_compiler_version ( ) { <nl> + # ifdef _MSC_VER <nl> + # define STRINGIFY ( x ) # x <nl> + # define TOSTRING ( x ) STRINGIFY ( x ) <nl> + return " MSVC " TOSTRING ( _MSC_FULL_VER ) ; <nl> + # else <nl> + return __VERSION__ ; <nl> + # endif <nl> + } <nl> const int tf_cxx11_abi_flag ( ) { <nl> # ifdef _GLIBCXX_USE_CXX11_ABI <nl> return _GLIBCXX_USE_CXX11_ABI ; <nl> mmm a / tensorflow / tools / git / gen_git_source . sh <nl> ppp b / tensorflow / tools / git / gen_git_source . sh <nl> fi <nl> cat < < EOF > $ { OUTPUT_FILENAME } <nl> # include < string > <nl> const char * tf_git_version ( ) { return " $ { GIT_VERSION } " ; } <nl> - const char * tf_compiler_version ( ) { return __VERSION__ ; } <nl> + const char * tf_compiler_version ( ) { <nl> + # ifdef _MSC_VER <nl> + # define STRINGIFY ( x ) # x <nl> + # define TOSTRING ( x ) STRINGIFY ( x ) <nl> + return " MSVC " TOSTRING ( _MSC_FULL_VER ) ; <nl> + # else <nl> + return __VERSION__ ; <nl> + # endif <nl> + } <nl> const int tf_cxx11_abi_flag ( ) { <nl> # ifdef _GLIBCXX_USE_CXX11_ABI <nl> return _GLIBCXX_USE_CXX11_ABI ; <nl>
[ MSVC ] Remove - D__VERSION__ flag and implement tf_compiler_version properly ( )
tensorflow/tensorflow
3add17c999e7a50442fb5c97d2bb2d88597d5039
2018-04-12T19:57:26Z
mmm a / editor / editor_node . cpp <nl> ppp b / editor / editor_node . cpp <nl> EditorNode : : EditorNode ( ) { <nl> scene_distraction = false ; <nl> script_distraction = false ; <nl> <nl> - FileAccess : : set_backup_save ( EDITOR_DEF ( " filesystem / on_save / safe_save_on_backup_then_rename " , true ) ) ; <nl> - <nl> TranslationServer : : get_singleton ( ) - > set_enabled ( false ) ; <nl> / / load settings <nl> if ( ! EditorSettings : : get_singleton ( ) ) <nl> EditorSettings : : create ( ) ; <nl> <nl> + FileAccess : : set_backup_save ( EDITOR_GET ( " filesystem / on_save / safe_save_on_backup_then_rename " ) ) ; <nl> + <nl> { <nl> int dpi_mode = EditorSettings : : get_singleton ( ) - > get ( " interface / editor / hidpi_mode " ) ; <nl> if ( dpi_mode = = 0 ) { <nl> mmm a / editor / editor_settings . cpp <nl> ppp b / editor / editor_settings . cpp <nl> void EditorSettings : : _load_defaults ( Ref < ConfigFile > p_extra_config ) { <nl> _initial_set ( " filesystem / resources / auto_reload_modified_images " , true ) ; <nl> <nl> _initial_set ( " filesystem / import / automatic_reimport_on_sources_changed " , true ) ; <nl> + _initial_set ( " filesystem / on_save / safe_save_on_backup_then_rename " , true ) ; <nl> <nl> if ( p_extra_config . is_valid ( ) ) { <nl> <nl>
Properly save the new save safe setting , avoid crash .
godotengine/godot
702e28f2657b3b0f50c1e118caf207c0a438f8f1
2018-01-12T20:18:40Z
mmm a / tools / depends / native / cmake - native / Makefile <nl> ppp b / tools / depends / native / cmake - native / Makefile <nl> PLATFORM = $ ( NATIVEPLATFORM ) <nl> DEPS = . . / . . / Makefile . include . in Makefile <nl> <nl> APPNAME = cmake <nl> - VERSION = 2 . 8 . 8 <nl> + VERSION = 2 . 8 . 12 <nl> SOURCE = $ ( APPNAME ) - $ ( VERSION ) <nl> ARCHIVE = $ ( SOURCE ) . tar . gz <nl> <nl> mmm a / tools / depends / target / Toolchain . cmake . in <nl> ppp b / tools / depends / target / Toolchain . cmake . in <nl> SET ( OS " @ platform_os @ " ) <nl> IF ( " $ { OS } " STREQUAL " linux " OR " $ { OS } " STREQUAL " android " ) <nl> SET ( CMAKE_SYSTEM_NAME Linux ) <nl> ENDIF ( ) <nl> + IF ( " $ { OS } " STREQUAL " ios " OR " $ { OS } " STREQUAL " osx " ) <nl> + SET ( CMAKE_OSX_SYSROOT @ use_sdk_path @ ) <nl> + ENDIF ( ) <nl> SET ( CMAKE_SYSTEM_VERSION 1 ) <nl> <nl> # specify the cross compiler <nl>
[ xcode5 ] cmake fix build
xbmc/xbmc
3c4fa6590d2593f912c1382299e715f8ac38f0c9
2013-10-16T17:47:53Z
mmm a / tests / test_sanity . py <nl> ppp b / tests / test_sanity . py <nl> def test_with_fake ( report , expected ) : <nl> if os . environ . get ( ' LLVM ' ) : <nl> del os . environ [ ' LLVM ' ] <nl> <nl> + return # TODO : the rest of this <nl> + <nl> + # check separate cache dirs are used <nl> + <nl> + restore ( ) <nl> + self . check_working ( [ EMCC ] , ' ' ) <nl> + <nl> + root_cache = os . path . expanduser ( ' ~ / . emscripten_cache ' ) <nl> + if os . path . exists ( os . path . join ( root_cache , ' asmjs ' ) ) : <nl> + shutil . rmtree ( os . path . join ( root_cache , ' asmjs ' ) ) <nl> + if os . path . exists ( os . path . join ( root_cache , ' wasm ' ) ) : <nl> + shutil . rmtree ( os . path . join ( root_cache , ' wasm ' ) ) <nl> + <nl> + try : <nl> + os . environ [ ' EMCC_WASM_BACKEND ' ] = ' 1 ' <nl> + self . check_working ( [ EMCC , ' tests / hello_world . c ' ] , ' ' ) <nl> + assert os . path . exists ( os . path . join ( root_cache , ' wasm ' ) ) <nl> + os . environ [ ' EMCC_WASM_BACKEND ' ] = ' 0 ' <nl> + self . check_working ( [ EMCC , ' tests / hello_world . c ' ] , ' ' ) <nl> + assert os . path . exists ( os . path . join ( root_cache , ' asmjs ' ) ) <nl> + shutil . rmtree ( os . path . join ( root_cache , ' asmjs ' ) ) <nl> + del os . environ [ ' EMCC_WASM_BACKEND ' ] <nl> + self . check_working ( [ EMCC , ' tests / hello_world . c ' ] , ' ' ) <nl> + assert os . path . exists ( os . path . join ( root_cache , ' asmjs ' ) ) <nl> + finally : <nl> + del os . environ [ ' EMCC_WASM_BACKEND ' ] <nl> + <nl>
prepare a test for separate cache dirs
emscripten-core/emscripten
098b241c787019f54ce447d801f652dfddab2b6b
2016-03-10T03:04:59Z
mmm a / jstests / aggregation / sources / graphLookup / filter . js <nl> ppp b / jstests / aggregation / sources / graphLookup / filter . js <nl> <nl> assert . eq ( res . results . length , 1 ) ; <nl> <nl> / / $ expr is allowed inside the ' restrictSearchWithMatch ' match expression . <nl> - / / TODO SERVER - 31029 : This should not throw once support is added for top - level $ expr within $ or <nl> - / / and $ and . <nl> - assert . throws ( function ( ) { <nl> - local . aggregate ( { <nl> - $ graphLookup : { <nl> - from : " foreign " , <nl> - startWith : " $ starting " , <nl> - connectFromField : " to " , <nl> - connectToField : " from " , <nl> - as : " results " , <nl> - restrictSearchWithMatch : { $ expr : { $ eq : [ " $ shouldBeIncluded " , true ] } } <nl> - } <nl> - } ) ; <nl> - } ) ; <nl> + res = local <nl> + . aggregate ( { <nl> + $ graphLookup : { <nl> + from : " foreign " , <nl> + startWith : " $ starting " , <nl> + connectFromField : " to " , <nl> + connectToField : " from " , <nl> + as : " results " , <nl> + restrictSearchWithMatch : { $ expr : { $ eq : [ " $ shouldBeIncluded " , true ] } } <nl> + } <nl> + } ) <nl> + . toArray ( ) [ 0 ] ; <nl> + <nl> + assert . eq ( res . results . length , 1 ) ; <nl> } ) ( ) ; <nl> mmm a / jstests / aggregation / sources / match / expr_match . js <nl> ppp b / jstests / aggregation / sources / match / expr_match . js <nl> <nl> / / $ match with constant expression and no field path . <nl> assert . eq ( 4 , coll . aggregate ( [ { $ match : { $ expr : { $ gte : [ 10 , 5 ] } } } ] ) . itcount ( ) ) ; <nl> assert . eq ( 0 , coll . aggregate ( [ { $ match : { $ expr : { $ gte : [ 5 , 10 ] } } } ] ) . itcount ( ) ) ; <nl> + <nl> + / / $ match with $ expr works inside a $ or . <nl> + assert . eq ( 4 , <nl> + coll . aggregate ( [ { $ match : { $ or : [ { $ expr : { $ eq : [ " $ foo " , " $ bar " ] } } , { b : { $ gt : 3 } } ] } } ] ) <nl> + . itcount ( ) ) ; <nl> + <nl> + / / $ match with $ expr works inside a $ and . <nl> + assert . eq ( 2 , <nl> + coll . aggregate ( [ { $ match : { $ and : [ { $ expr : { $ eq : [ " $ foo " , " $ bar " ] } } , { x : { $ lt : 2 } } ] } } ] ) <nl> + . itcount ( ) ) ; <nl> } ) ( ) ; <nl> new file mode 100644 <nl> index 000000000000 . . df1f2470261e <nl> mmm / dev / null <nl> ppp b / jstests / core / expr_valid_positions . js <nl> <nl> + / / Verify that $ expr can be used in the top - level position , but not in subdocuments . <nl> + <nl> + ( function ( ) { <nl> + " use strict " ; <nl> + <nl> + const coll = db . expr_valid_positions ; <nl> + <nl> + / / Works at the BSON root level . <nl> + assert . eq ( 0 , coll . find ( { $ expr : { $ eq : [ " $ foo " , " $ bar " ] } } ) . itcount ( ) ) ; <nl> + <nl> + / / Works inside a $ or . <nl> + assert . eq ( 0 , coll . find ( { $ or : [ { $ expr : { $ eq : [ " $ foo " , " $ bar " ] } } , { b : { $ gt : 3 } } ] } ) . itcount ( ) ) ; <nl> + <nl> + / / Fails inside an elemMatch . <nl> + assert . throws ( function ( ) { <nl> + coll . find ( { a : { $ elemMatch : { $ expr : { $ eq : [ " $ foo " , " $ bar " ] } } } } ) . itcount ( ) ; <nl> + } ) ; <nl> + <nl> + / / Fails inside an _internalSchemaObjectMatch . <nl> + assert . throws ( function ( ) { <nl> + coll . find ( { a : { $ _internalSchemaObjectMatch : { $ expr : { $ eq : [ " $ foo " , " $ bar " ] } } } } ) . itcount ( ) ; <nl> + } ) ; <nl> + } ( ) ) ; <nl> \ No newline at end of file <nl> mmm a / jstests / core / update_arrayFilters . js <nl> ppp b / jstests / core / update_arrayFilters . js <nl> <nl> " Cannot use an expression without a top - level field name in arrayFilters " ) , <nl> " update failed for a reason other than missing a top - level field name in arrayFilter " ) ; <nl> <nl> + / / Array filter with $ text inside fails to parse . <nl> + res = coll . update ( <nl> + { _id : 0 } , { $ set : { " a . $ [ i ] " : 5 } } , { arrayFilters : [ { $ text : { $ search : " foo " } } ] } ) ; <nl> + assert . writeErrorWithCode ( res , ErrorCodes . BadValue ) ; <nl> + <nl> + / / Array filter with $ where inside fails to parse . <nl> + res = <nl> + coll . update ( { _id : 0 } , { $ set : { " a . $ [ i ] " : 5 } } , { arrayFilters : [ { $ where : " this . a = = 2 " } ] } ) ; <nl> + assert . writeErrorWithCode ( res , ErrorCodes . BadValue ) ; <nl> + <nl> + / / Array filter with $ geoNear inside fails to parse . <nl> + res = coll . update ( <nl> + { _id : 0 } , { $ set : { " a . $ [ i ] " : 5 } } , { arrayFilters : [ { loc : { $ geoNear : [ 50 , 50 ] } } ] } ) ; <nl> + assert . writeErrorWithCode ( res , ErrorCodes . BadValue ) ; <nl> + <nl> + / / Array filter with $ expr inside fails to parse . <nl> + res = coll . update ( <nl> + { _id : 0 } , { $ set : { " a . $ [ i ] " : 5 } } , { arrayFilters : [ { $ expr : { $ eq : [ " $ foo " , " $ bar " ] } } ] } ) ; <nl> + assert . writeErrorWithCode ( res , ErrorCodes . QueryFeatureNotAllowed ) ; <nl> + <nl> / / Good value for arrayFilters succeeds . <nl> assert . writeOK ( coll . update ( <nl> { _id : 0 } , { $ set : { " a . $ [ i ] " : 5 , " a . $ [ j ] " : 6 } } , { arrayFilters : [ { i : 0 } , { j : 0 } ] } ) ) ; <nl> mmm a / src / mongo / db / matcher / expression_parser . cpp <nl> ppp b / src / mongo / db / matcher / expression_parser . cpp <nl> bool hasNode ( const MatchExpression * root , MatchExpression : : MatchType type ) { <nl> return false ; <nl> } <nl> <nl> - const boost : : container : : flat_set < StringData > topLevelOperators { " $ _internalSchemaAllowedProperties " , <nl> - " $ _internalSchemaMaxProperties " , <nl> - " $ _internalSchemaMinProperties " , <nl> - " $ _internalSchemaXor " , <nl> - " $ and " , <nl> - " $ nor " , <nl> - " $ or " , <nl> - " $ where " } ; <nl> - <nl> + const boost : : container : : flat_set < StringData > kPathlessOperators { " $ _internalSchemaAllowedProperties " , <nl> + " $ _internalSchemaCond " , <nl> + " $ _internalSchemaMaxProperties " , <nl> + " $ _internalSchemaMinProperties " , <nl> + " $ _internalSchemaRootDocEq " , <nl> + " $ _internalSchemaXor " , <nl> + " $ alwaysFalse " , <nl> + " $ alwaysTrue " , <nl> + " $ and " , <nl> + " $ atomic " , <nl> + " $ comment " , <nl> + " $ expr " , <nl> + " $ isolated " <nl> + " $ jsonSchema " , <nl> + " $ nor " , <nl> + " $ or " , <nl> + " $ text " , <nl> + " $ where " } ; <nl> } / / namespace <nl> <nl> namespace mongo { <nl> StatusWithMatchExpression MatchExpressionParser : : _parseSubField ( <nl> const BSONElement & e , <nl> const boost : : intrusive_ptr < ExpressionContext > & expCtx , <nl> AllowedFeatureSet allowedFeatures , <nl> - bool topLevel ) { <nl> + DocumentParseLevel currentLevel ) { <nl> if ( mongoutils : : str : : equals ( " $ eq " , e . fieldName ( ) ) ) <nl> return _parseComparison ( name , new EqualityMatchExpression ( ) , e , expCtx , allowedFeatures ) ; <nl> <nl> if ( mongoutils : : str : : equals ( " $ not " , e . fieldName ( ) ) ) { <nl> - return _parseNot ( name , e , expCtx , allowedFeatures , topLevel ) ; <nl> + return _parseNot ( name , e , expCtx , allowedFeatures , currentLevel ) ; <nl> } <nl> <nl> auto parseExpMatchType = MatchExpressionParser : : parsePathAcceptingKeyword ( e ) ; <nl> if ( ! parseExpMatchType ) { <nl> - / / $ where cannot be a sub - expression because it works on top - level documents only . <nl> - if ( mongoutils : : str : : equals ( " $ where " , e . fieldName ( ) ) ) { <nl> - return { Status ( ErrorCodes : : BadValue , " $ where cannot be applied to a field " ) } ; <nl> + if ( kPathlessOperators . find ( e . fieldNameStringData ( ) ) ! = kPathlessOperators . end ( ) ) { <nl> + return { Status ( ErrorCodes : : FailedToParse , <nl> + mongoutils : : str : : stream ( ) < < e . fieldNameStringData ( ) <nl> + < < " cannot be applied to a field path . " ) } ; <nl> } <nl> <nl> - return { Status ( ErrorCodes : : BadValue , <nl> - mongoutils : : str : : stream ( ) < < " unknown operator : " < < e . fieldName ( ) ) } ; <nl> + return { <nl> + Status ( ErrorCodes : : BadValue , <nl> + mongoutils : : str : : stream ( ) < < " unknown operator : " < < e . fieldNameStringData ( ) ) } ; <nl> } <nl> <nl> switch ( * parseExpMatchType ) { <nl> StatusWithMatchExpression MatchExpressionParser : : _parseSubField ( <nl> } <nl> <nl> case PathAcceptingKeyword : : ELEM_MATCH : <nl> - return _parseElemMatch ( name , e , expCtx , allowedFeatures , topLevel ) ; <nl> + return _parseElemMatch ( name , e , expCtx , allowedFeatures ) ; <nl> <nl> case PathAcceptingKeyword : : ALL : <nl> - return _parseAll ( name , e , expCtx , allowedFeatures , topLevel ) ; <nl> + return _parseAll ( name , e , expCtx , allowedFeatures ) ; <nl> <nl> case PathAcceptingKeyword : : WITHIN : <nl> case PathAcceptingKeyword : : GEO_INTERSECTS : <nl> StatusWithMatchExpression MatchExpressionParser : : _parseSubField ( <nl> str : : stream ( ) < < " $ _internalSchemaObjectMatch must be an object " ) ; <nl> } <nl> <nl> - auto parsedSubObjExpr = _parse ( e . Obj ( ) , expCtx , allowedFeatures , topLevel ) ; <nl> + auto parsedSubObjExpr = <nl> + _parse ( e . Obj ( ) , expCtx , allowedFeatures , DocumentParseLevel : : kUserSubDocument ) ; <nl> if ( ! parsedSubObjExpr . isOK ( ) ) { <nl> return parsedSubObjExpr ; <nl> } <nl> StatusWithMatchExpression MatchExpressionParser : : _parseSubField ( <nl> } <nl> <nl> case PathAcceptingKeyword : : INTERNAL_SCHEMA_MATCH_ARRAY_INDEX : { <nl> - return _parseInternalSchemaMatchArrayIndex ( name , e , expCtx ) ; <nl> + return _parseInternalSchemaMatchArrayIndex ( <nl> + name , e , expCtx , allowedFeatures , currentLevel ) ; <nl> } <nl> <nl> case PathAcceptingKeyword : : INTERNAL_SCHEMA_ALL_ELEM_MATCH_FROM_INDEX : { <nl> StatusWithMatchExpression MatchExpressionParser : : _parseSubField ( <nl> < < " must be an object " ) ; <nl> } <nl> <nl> + auto filter = _parse ( second . embeddedObject ( ) , <nl> + expCtx , <nl> + kBanAllSpecialFeatures , <nl> + DocumentParseLevel : : kUserSubDocument ) ; <nl> + <nl> + if ( ! filter . isOK ( ) ) { <nl> + return filter . getStatus ( ) ; <nl> + } <nl> + <nl> auto exprWithPlaceholder = <nl> - ExpressionWithPlaceholder : : parse ( second . embeddedObject ( ) , expCtx ) ; <nl> + ExpressionWithPlaceholder : : make ( std : : move ( filter . getValue ( ) ) ) ; <nl> if ( ! exprWithPlaceholder . isOK ( ) ) { <nl> return exprWithPlaceholder . getStatus ( ) ; <nl> } <nl> StatusWithMatchExpression MatchExpressionParser : : _parse ( <nl> const BSONObj & obj , <nl> const boost : : intrusive_ptr < ExpressionContext > & expCtx , <nl> AllowedFeatureSet allowedFeatures , <nl> - bool topLevel ) { <nl> + DocumentParseLevel currentLevel ) { <nl> std : : unique_ptr < AndMatchExpression > root = stdx : : make_unique < AndMatchExpression > ( ) ; <nl> <nl> - const bool childIsTopLevel = false ; <nl> + const DocumentParseLevel nextLevel = ( currentLevel = = DocumentParseLevel : : kPredicateTopLevel ) <nl> + ? DocumentParseLevel : : kUserDocumentTopLevel <nl> + : currentLevel ; <nl> BSONObjIterator i ( obj ) ; <nl> while ( i . more ( ) ) { <nl> BSONElement e = i . next ( ) ; <nl> StatusWithMatchExpression MatchExpressionParser : : _parse ( <nl> if ( e . type ( ) ! = Array ) <nl> return { Status ( ErrorCodes : : BadValue , " $ or must be an array " ) } ; <nl> std : : unique_ptr < OrMatchExpression > temp = stdx : : make_unique < OrMatchExpression > ( ) ; <nl> - Status s = <nl> - _parseTreeList ( e . Obj ( ) , temp . get ( ) , expCtx , allowedFeatures , childIsTopLevel ) ; <nl> + Status s = _parseTreeList ( e . Obj ( ) , temp . get ( ) , expCtx , allowedFeatures , nextLevel ) ; <nl> if ( ! s . isOK ( ) ) <nl> return s ; <nl> root - > add ( temp . release ( ) ) ; <nl> StatusWithMatchExpression MatchExpressionParser : : _parse ( <nl> if ( e . type ( ) ! = Array ) <nl> return { Status ( ErrorCodes : : BadValue , " $ and must be an array " ) } ; <nl> std : : unique_ptr < AndMatchExpression > temp = stdx : : make_unique < AndMatchExpression > ( ) ; <nl> - Status s = <nl> - _parseTreeList ( e . Obj ( ) , temp . get ( ) , expCtx , allowedFeatures , childIsTopLevel ) ; <nl> + Status s = _parseTreeList ( e . Obj ( ) , temp . get ( ) , expCtx , allowedFeatures , nextLevel ) ; <nl> if ( ! s . isOK ( ) ) <nl> return s ; <nl> root - > add ( temp . release ( ) ) ; <nl> StatusWithMatchExpression MatchExpressionParser : : _parse ( <nl> if ( e . type ( ) ! = Array ) <nl> return { Status ( ErrorCodes : : BadValue , " $ nor must be an array " ) } ; <nl> std : : unique_ptr < NorMatchExpression > temp = stdx : : make_unique < NorMatchExpression > ( ) ; <nl> - Status s = <nl> - _parseTreeList ( e . Obj ( ) , temp . get ( ) , expCtx , allowedFeatures , childIsTopLevel ) ; <nl> + Status s = _parseTreeList ( e . Obj ( ) , temp . get ( ) , expCtx , allowedFeatures , nextLevel ) ; <nl> if ( ! s . isOK ( ) ) <nl> return s ; <nl> root - > add ( temp . release ( ) ) ; <nl> } else if ( mongoutils : : str : : equals ( " atomic " , rest ) | | <nl> mongoutils : : str : : equals ( " isolated " , rest ) ) { <nl> - if ( ! topLevel ) <nl> - return { Status ( ErrorCodes : : BadValue , <nl> + if ( currentLevel ! = DocumentParseLevel : : kPredicateTopLevel ) { <nl> + return { Status ( ErrorCodes : : FailedToParse , <nl> " $ atomic / $ isolated has to be at the top level " ) } ; <nl> + } <nl> / / Don ' t do anything with the expression ; CanonicalQuery : : init ( ) will look through <nl> / / the BSONObj again for a $ atomic / $ isolated . <nl> } else if ( mongoutils : : str : : equals ( " where " , rest ) ) { <nl> StatusWithMatchExpression MatchExpressionParser : : _parse ( <nl> return { Status ( ErrorCodes : : BadValue , " $ where is not allowed in this context " ) } ; <nl> } <nl> <nl> + if ( currentLevel = = DocumentParseLevel : : kUserSubDocument ) { <nl> + return { Status ( ErrorCodes : : FailedToParse , <nl> + " $ where can only be applied to the top - level document " ) } ; <nl> + } <nl> + <nl> StatusWithMatchExpression s = _extensionsCallback - > parseWhere ( e ) ; <nl> if ( ! s . isOK ( ) ) <nl> return s ; <nl> root - > add ( s . getValue ( ) . release ( ) ) ; <nl> } else if ( mongoutils : : str : : equals ( " expr " , rest ) ) { <nl> - if ( ! topLevel ) { <nl> - return { Status ( ErrorCodes : : BadValue , " $ expr has to be at the top level " ) } ; <nl> + if ( currentLevel = = DocumentParseLevel : : kUserSubDocument ) { <nl> + return { Status ( ErrorCodes : : FailedToParse , <nl> + " $ expr can only be applied to the top - level document " ) } ; <nl> } <nl> <nl> auto status = _parseExpr ( e , allowedFeatures , expCtx ) ; <nl> StatusWithMatchExpression MatchExpressionParser : : _parse ( <nl> <nl> root - > add ( eq . release ( ) ) ; <nl> } else if ( mongoutils : : str : : equals ( " _internalSchemaAllowedProperties " , rest ) ) { <nl> - auto allowedProperties = _parseInternalSchemaAllowedProperties ( e , expCtx ) ; <nl> + auto allowedProperties = <nl> + _parseInternalSchemaAllowedProperties ( e , expCtx , allowedFeatures , nextLevel ) ; <nl> if ( ! allowedProperties . isOK ( ) ) { <nl> return allowedProperties . getStatus ( ) ; <nl> } <nl> StatusWithMatchExpression MatchExpressionParser : : _parse ( <nl> } else if ( mongoutils : : str : : equals ( " _internalSchemaCond " , rest ) ) { <nl> auto condExpr = <nl> _parseInternalSchemaFixedArityArgument < InternalSchemaCondMatchExpression > ( <nl> - InternalSchemaCondMatchExpression : : kName , e , expCtx , allowedFeatures ) ; <nl> + InternalSchemaCondMatchExpression : : kName , <nl> + e , <nl> + expCtx , <nl> + allowedFeatures , <nl> + nextLevel ) ; <nl> if ( ! condExpr . isOK ( ) ) { <nl> return condExpr . getStatus ( ) ; <nl> } <nl> StatusWithMatchExpression MatchExpressionParser : : _parse ( <nl> return { <nl> Status ( ErrorCodes : : TypeMismatch , " $ _internalSchemaXor must be an array " ) } ; <nl> auto xorExpr = stdx : : make_unique < InternalSchemaXorMatchExpression > ( ) ; <nl> - Status s = _parseTreeList ( <nl> - e . Obj ( ) , xorExpr . get ( ) , expCtx , allowedFeatures , childIsTopLevel ) ; <nl> + Status s = <nl> + _parseTreeList ( e . Obj ( ) , xorExpr . get ( ) , expCtx , allowedFeatures , nextLevel ) ; <nl> if ( ! s . isOK ( ) ) <nl> return s ; <nl> root - > add ( xorExpr . release ( ) ) ; <nl> StatusWithMatchExpression MatchExpressionParser : : _parse ( <nl> auto alwaysTrueExpr = stdx : : make_unique < AlwaysTrueMatchExpression > ( ) ; <nl> root - > add ( alwaysTrueExpr . release ( ) ) ; <nl> } else if ( mongoutils : : str : : equals ( " _internalSchemaRootDocEq " , rest ) ) { <nl> - if ( ! topLevel ) { <nl> + if ( currentLevel ! = DocumentParseLevel : : kPredicateTopLevel ) { <nl> return { Status ( ErrorCodes : : FailedToParse , <nl> str : : stream ( ) < < InternalSchemaRootDocEqMatchExpression : : kName <nl> < < " must be at the top level " ) } ; <nl> StatusWithMatchExpression MatchExpressionParser : : _parse ( <nl> } <nl> <nl> if ( _isExpressionDocument ( e , false ) ) { <nl> - Status s = _parseSub ( <nl> - e . fieldName ( ) , e . Obj ( ) , root . get ( ) , expCtx , allowedFeatures , childIsTopLevel ) ; <nl> + Status s = <nl> + _parseSub ( e . fieldName ( ) , e . Obj ( ) , root . get ( ) , expCtx , allowedFeatures , nextLevel ) ; <nl> if ( ! s . isOK ( ) ) <nl> return s ; <nl> continue ; <nl> Status MatchExpressionParser : : _parseSub ( const char * name , <nl> AndMatchExpression * root , <nl> const boost : : intrusive_ptr < ExpressionContext > & expCtx , <nl> AllowedFeatureSet allowedFeatures , <nl> - bool topLevel ) { <nl> + DocumentParseLevel currentLevel ) { <nl> / / The one exception to { field : { fully contained argument } } is , of course , geo . Example : <nl> / / sub = = { field : { $ near [ Sphere ] : [ 0 , 0 ] , $ maxDistance : 1000 , $ minDistance : 10 } } <nl> / / We peek inside of ' sub ' to see if it ' s possibly a $ near . If so , we can ' t iterate over <nl> Status MatchExpressionParser : : _parseSub ( const char * name , <nl> while ( j . more ( ) ) { <nl> BSONElement deep = j . next ( ) ; <nl> <nl> - const bool childIsTopLevel = false ; <nl> StatusWithMatchExpression s = <nl> - _parseSubField ( sub , root , name , deep , expCtx , allowedFeatures , childIsTopLevel ) ; <nl> + _parseSubField ( sub , root , name , deep , expCtx , allowedFeatures , currentLevel ) ; <nl> if ( ! s . isOK ( ) ) <nl> return s . getStatus ( ) ; <nl> <nl> StatusWithMatchExpression MatchExpressionParser : : _parseElemMatch ( <nl> const char * name , <nl> const BSONElement & e , <nl> const boost : : intrusive_ptr < ExpressionContext > & expCtx , <nl> - AllowedFeatureSet allowedFeatures , <nl> - bool topLevel ) { <nl> + AllowedFeatureSet allowedFeatures ) { <nl> if ( e . type ( ) ! = Object ) <nl> return { Status ( ErrorCodes : : BadValue , " $ elemMatch needs an Object " ) } ; <nl> <nl> BSONObj obj = e . Obj ( ) ; <nl> <nl> - / / $ elemMatch value case applies when the children all <nl> - / / work on the field ' name ' . <nl> - / / This is the case when : <nl> - / / 1 ) the argument is an expression document ; and <nl> - / / 2 ) expression is not a AND / NOR / OR logical operator . Children of <nl> - / / these logical operators are initialized with field names . <nl> - / / 3 ) expression is not a WHERE operator . WHERE works on objects instead <nl> - / / of specific field . <nl> + / / We distinguish here between $ elemMatch value and $ elemMatch object . The $ elemMatch can only <nl> + / / be $ elemMatch value if the argument is an expression document whose operator is <nl> + / / path - accepting . <nl> bool isElemMatchValue = false ; <nl> if ( _isExpressionDocument ( e , true ) ) { <nl> BSONObj o = e . Obj ( ) ; <nl> StatusWithMatchExpression MatchExpressionParser : : _parseElemMatch ( <nl> invariant ( ! elt . eoo ( ) ) ; <nl> <nl> isElemMatchValue = <nl> - topLevelOperators . find ( elt . fieldNameStringData ( ) ) = = topLevelOperators . end ( ) ; <nl> + kPathlessOperators . find ( elt . fieldNameStringData ( ) ) = = kPathlessOperators . end ( ) ; <nl> } <nl> <nl> if ( isElemMatchValue ) { <nl> / / value case <nl> <nl> AndMatchExpression theAnd ; <nl> - Status s = _parseSub ( " " , obj , & theAnd , expCtx , allowedFeatures , topLevel ) ; <nl> + Status s = _parseSub ( <nl> + " " , obj , & theAnd , expCtx , allowedFeatures , DocumentParseLevel : : kUserSubDocument ) ; <nl> if ( ! s . isOK ( ) ) <nl> return s ; <nl> <nl> StatusWithMatchExpression MatchExpressionParser : : _parseElemMatch ( <nl> <nl> / / object case <nl> <nl> - StatusWithMatchExpression subRaw = _parse ( obj , expCtx , allowedFeatures , topLevel ) ; <nl> + StatusWithMatchExpression subRaw = <nl> + _parse ( obj , expCtx , allowedFeatures , DocumentParseLevel : : kUserSubDocument ) ; <nl> if ( ! subRaw . isOK ( ) ) <nl> return subRaw ; <nl> std : : unique_ptr < MatchExpression > sub = std : : move ( subRaw . getValue ( ) ) ; <nl> <nl> - / / $ where is not supported under $ elemMatch because $ where <nl> - / / applies to top - level document , not array elements in a field . <nl> - if ( hasNode ( sub . get ( ) , MatchExpression : : WHERE ) ) { <nl> - return { Status ( ErrorCodes : : BadValue , " $ elemMatch cannot contain $ where expression " ) } ; <nl> - } <nl> - <nl> std : : unique_ptr < ElemMatchObjectMatchExpression > temp = <nl> stdx : : make_unique < ElemMatchObjectMatchExpression > ( ) ; <nl> Status status = temp - > init ( name , sub . release ( ) ) ; <nl> StatusWithMatchExpression MatchExpressionParser : : _parseAll ( <nl> const char * name , <nl> const BSONElement & e , <nl> const boost : : intrusive_ptr < ExpressionContext > & expCtx , <nl> - AllowedFeatureSet allowedFeatures , <nl> - bool topLevel ) { <nl> + AllowedFeatureSet allowedFeatures ) { <nl> if ( e . type ( ) ! = Array ) <nl> return { Status ( ErrorCodes : : BadValue , " $ all needs an array " ) } ; <nl> <nl> StatusWithMatchExpression MatchExpressionParser : : _parseAll ( <nl> return { Status ( ErrorCodes : : BadValue , " $ all / $ elemMatch has to be consistent " ) } ; <nl> } <nl> <nl> - const bool childIsTopLevel = false ; <nl> - StatusWithMatchExpression inner = _parseElemMatch ( name , <nl> - hopefullyElemMatchObj . firstElement ( ) , <nl> - expCtx , <nl> - allowedFeatures , <nl> - childIsTopLevel ) ; <nl> + StatusWithMatchExpression inner = _parseElemMatch ( <nl> + name , hopefullyElemMatchObj . firstElement ( ) , expCtx , allowedFeatures ) ; <nl> if ( ! inner . isOK ( ) ) <nl> return inner ; <nl> myAnd - > add ( inner . getValue ( ) . release ( ) ) ; <nl> StatusWith < long long > MatchExpressionParser : : parseIntegerElementToLong ( BSONEleme <nl> return number ; <nl> } <nl> <nl> + StatusWith < std : : unique_ptr < ExpressionWithPlaceholder > > <nl> + MatchExpressionParser : : _parseExprWithPlaceholder ( <nl> + const BSONObj & containingObject , <nl> + StringData exprWithPlaceholderFieldName , <nl> + StringData expressionName , <nl> + StringData expectedPlaceholder , <nl> + const boost : : intrusive_ptr < ExpressionContext > & expCtx , <nl> + AllowedFeatureSet allowedFeatures , <nl> + DocumentParseLevel currentLevel ) { <nl> + auto exprWithPlaceholderElem = containingObject [ exprWithPlaceholderFieldName ] ; <nl> + if ( ! exprWithPlaceholderElem ) { <nl> + return { ErrorCodes : : FailedToParse , <nl> + str : : stream ( ) < < expressionName < < " requires ' " < < exprWithPlaceholderFieldName <nl> + < < " ' " } ; <nl> + } else if ( exprWithPlaceholderElem . type ( ) ! = BSONType : : Object ) { <nl> + return { ErrorCodes : : TypeMismatch , <nl> + str : : stream ( ) < < expressionName < < " found ' " < < exprWithPlaceholderFieldName <nl> + < < " ' , which is an incompatible type : " <nl> + < < exprWithPlaceholderElem . type ( ) } ; <nl> + } <nl> + <nl> + auto filter = _parse ( <nl> + exprWithPlaceholderElem . embeddedObject ( ) , expCtx , kBanAllSpecialFeatures , currentLevel ) ; <nl> + <nl> + if ( ! filter . isOK ( ) ) { <nl> + return filter . getStatus ( ) ; <nl> + } <nl> + <nl> + auto result = ExpressionWithPlaceholder : : make ( std : : move ( filter . getValue ( ) ) ) ; <nl> + if ( ! result . isOK ( ) ) { <nl> + return result . getStatus ( ) ; <nl> + } <nl> + <nl> + auto placeholder = result . getValue ( ) - > getPlaceholder ( ) ; <nl> + if ( placeholder & & ( * placeholder ! = expectedPlaceholder ) ) { <nl> + return { ErrorCodes : : FailedToParse , <nl> + str : : stream ( ) < < expressionName < < " expected a name placeholder of " <nl> + < < expectedPlaceholder <nl> + < < " , but ' " <nl> + < < exprWithPlaceholderElem . fieldName ( ) <nl> + < < " ' has a mismatching placeholder ' " <nl> + < < * placeholder <nl> + < < " ' " } ; <nl> + } <nl> + return result ; <nl> + } <nl> + <nl> + StatusWith < std : : vector < InternalSchemaAllowedPropertiesMatchExpression : : PatternSchema > > <nl> + MatchExpressionParser : : _parsePatternProperties ( <nl> + BSONElement patternPropertiesElem , <nl> + StringData expectedPlaceholder , <nl> + const boost : : intrusive_ptr < ExpressionContext > & expCtx , <nl> + AllowedFeatureSet allowedFeatures , <nl> + DocumentParseLevel currentLevel ) { <nl> + if ( ! patternPropertiesElem ) { <nl> + return { ErrorCodes : : FailedToParse , <nl> + str : : stream ( ) < < InternalSchemaAllowedPropertiesMatchExpression : : kName <nl> + < < " requires ' patternProperties ' " } ; <nl> + } else if ( patternPropertiesElem . type ( ) ! = BSONType : : Array ) { <nl> + return { ErrorCodes : : TypeMismatch , <nl> + str : : stream ( ) < < InternalSchemaAllowedPropertiesMatchExpression : : kName <nl> + < < " requires ' patternProperties ' to be an array , not " <nl> + < < patternPropertiesElem . type ( ) } ; <nl> + } <nl> + <nl> + std : : vector < InternalSchemaAllowedPropertiesMatchExpression : : PatternSchema > patternProperties ; <nl> + for ( auto & & constraintElem : patternPropertiesElem . embeddedObject ( ) ) { <nl> + if ( constraintElem . type ( ) ! = BSONType : : Object ) { <nl> + return { ErrorCodes : : TypeMismatch , <nl> + str : : stream ( ) < < InternalSchemaAllowedPropertiesMatchExpression : : kName <nl> + < < " requires ' patternProperties ' to be an array of objects " } ; <nl> + } <nl> + <nl> + auto constraint = constraintElem . embeddedObject ( ) ; <nl> + if ( constraint . nFields ( ) ! = 2 ) { <nl> + return { ErrorCodes : : FailedToParse , <nl> + str : : stream ( ) < < InternalSchemaAllowedPropertiesMatchExpression : : kName <nl> + < < " requires ' patternProperties ' to be an array of objects " <nl> + " containing exactly two fields , ' regex ' and ' expression ' " } ; <nl> + } <nl> + <nl> + auto expressionWithPlaceholder = <nl> + _parseExprWithPlaceholder ( constraint , <nl> + " expression " _sd , <nl> + InternalSchemaAllowedPropertiesMatchExpression : : kName , <nl> + expectedPlaceholder , <nl> + expCtx , <nl> + allowedFeatures , <nl> + currentLevel ) ; <nl> + if ( ! expressionWithPlaceholder . isOK ( ) ) { <nl> + return expressionWithPlaceholder . getStatus ( ) ; <nl> + } <nl> + <nl> + auto regexElem = constraint [ " regex " ] ; <nl> + if ( ! regexElem ) { <nl> + return { <nl> + ErrorCodes : : FailedToParse , <nl> + str : : stream ( ) < < InternalSchemaAllowedPropertiesMatchExpression : : kName <nl> + < < " requires each object in ' patternProperties ' to have a ' regex ' " } ; <nl> + } <nl> + if ( regexElem . type ( ) ! = BSONType : : RegEx ) { <nl> + return { ErrorCodes : : TypeMismatch , <nl> + str : : stream ( ) < < InternalSchemaAllowedPropertiesMatchExpression : : kName <nl> + < < " requires ' patternProperties ' to be an array of objects , " <nl> + " where ' regex ' is a regular expression " } ; <nl> + } <nl> + if ( * regexElem . regexFlags ( ) ! = ' \ 0 ' ) { <nl> + return { <nl> + ErrorCodes : : BadValue , <nl> + str : : stream ( ) <nl> + < < InternalSchemaAllowedPropertiesMatchExpression : : kName <nl> + < < " does not accept regex flags for pattern schemas in ' patternProperties ' " } ; <nl> + } <nl> + <nl> + patternProperties . emplace_back ( <nl> + InternalSchemaAllowedPropertiesMatchExpression : : Pattern ( regexElem . regex ( ) ) , <nl> + std : : move ( expressionWithPlaceholder . getValue ( ) ) ) ; <nl> + } <nl> + <nl> + return std : : move ( patternProperties ) ; <nl> + } <nl> + <nl> StatusWithMatchExpression MatchExpressionParser : : _parseInternalSchemaFmod ( const char * name , <nl> const BSONElement & elem ) { <nl> StringData path ( name ) ; <nl> StatusWithMatchExpression MatchExpressionParser : : _parseInternalSchemaFixedArityA <nl> StringData name , <nl> const BSONElement & input , <nl> const boost : : intrusive_ptr < ExpressionContext > & expCtx , <nl> - AllowedFeatureSet allowedFeatures ) { <nl> + AllowedFeatureSet allowedFeatures , <nl> + DocumentParseLevel currentLevel ) { <nl> constexpr auto arity = T : : arity ( ) ; <nl> if ( input . type ( ) ! = BSONType : : Array ) { <nl> return { ErrorCodes : : FailedToParse , <nl> StatusWithMatchExpression MatchExpressionParser : : _parseInternalSchemaFixedArityA <nl> < < elem . type ( ) } ; <nl> } <nl> <nl> - const bool isTopLevel = false ; <nl> - auto subexpr = _parse ( elem . embeddedObject ( ) , expCtx , allowedFeatures , isTopLevel ) ; <nl> + auto subexpr = _parse ( elem . embeddedObject ( ) , expCtx , allowedFeatures , currentLevel ) ; <nl> if ( ! subexpr . isOK ( ) ) { <nl> return subexpr . getStatus ( ) ; <nl> } <nl> StatusWith < StringData > parseNamePlaceholder ( const BSONObj & containingObject , <nl> return { namePlaceholderElem . valueStringData ( ) } ; <nl> } <nl> <nl> - / * * <nl> - * Looks at the field named ' exprWithPlaceholderFieldName ' within ' containingObject ' and parses an <nl> - * ExpressionWithPlaceholder from that element . Fails if an error occurs during parsing , or if the <nl> - * ExpressionWithPlaceholder has a different name placeholder than ' expectedPlaceholder ' . <nl> - * ' expressionName ' is the name of the expression that requires the ExpressionWithPlaceholder and is <nl> - * used to generate helpful error messages . <nl> - * / <nl> - StatusWith < std : : unique_ptr < ExpressionWithPlaceholder > > parseExprWithPlaceholder ( <nl> - const BSONObj & containingObject , <nl> - StringData exprWithPlaceholderFieldName , <nl> - StringData expressionName , <nl> - StringData expectedPlaceholder , <nl> - const boost : : intrusive_ptr < ExpressionContext > & expCtx ) { <nl> - auto exprWithPlaceholderElem = containingObject [ exprWithPlaceholderFieldName ] ; <nl> - if ( ! exprWithPlaceholderElem ) { <nl> - return { ErrorCodes : : FailedToParse , <nl> - str : : stream ( ) < < expressionName < < " requires ' " < < exprWithPlaceholderFieldName <nl> - < < " ' " } ; <nl> - } else if ( exprWithPlaceholderElem . type ( ) ! = BSONType : : Object ) { <nl> - return { ErrorCodes : : TypeMismatch , <nl> - str : : stream ( ) < < expressionName < < " found ' " < < exprWithPlaceholderFieldName <nl> - < < " ' , which is an incompatible type : " <nl> - < < exprWithPlaceholderElem . type ( ) } ; <nl> - } <nl> - <nl> - auto result = <nl> - ExpressionWithPlaceholder : : parse ( exprWithPlaceholderElem . embeddedObject ( ) , expCtx ) ; <nl> - if ( ! result . isOK ( ) ) { <nl> - return result . getStatus ( ) ; <nl> - } <nl> - <nl> - auto placeholder = result . getValue ( ) - > getPlaceholder ( ) ; <nl> - if ( placeholder & & ( * placeholder ! = expectedPlaceholder ) ) { <nl> - return { ErrorCodes : : FailedToParse , <nl> - str : : stream ( ) < < expressionName < < " expected a name placeholder of " <nl> - < < expectedPlaceholder <nl> - < < " , but ' " <nl> - < < exprWithPlaceholderElem . fieldName ( ) <nl> - < < " ' has a mismatching placeholder ' " <nl> - < < * placeholder <nl> - < < " ' " } ; <nl> - } <nl> - return result ; <nl> - } <nl> - <nl> - StatusWith < std : : vector < InternalSchemaAllowedPropertiesMatchExpression : : PatternSchema > > <nl> - parsePatternProperties ( BSONElement patternPropertiesElem , <nl> - StringData expectedPlaceholder , <nl> - const boost : : intrusive_ptr < ExpressionContext > & expCtx ) { <nl> - if ( ! patternPropertiesElem ) { <nl> - return { ErrorCodes : : FailedToParse , <nl> - str : : stream ( ) < < InternalSchemaAllowedPropertiesMatchExpression : : kName <nl> - < < " requires ' patternProperties ' " } ; <nl> - } else if ( patternPropertiesElem . type ( ) ! = BSONType : : Array ) { <nl> - return { ErrorCodes : : TypeMismatch , <nl> - str : : stream ( ) < < InternalSchemaAllowedPropertiesMatchExpression : : kName <nl> - < < " requires ' patternProperties ' to be an array , not " <nl> - < < patternPropertiesElem . type ( ) } ; <nl> - } <nl> - <nl> - std : : vector < InternalSchemaAllowedPropertiesMatchExpression : : PatternSchema > patternProperties ; <nl> - for ( auto & & constraintElem : patternPropertiesElem . embeddedObject ( ) ) { <nl> - if ( constraintElem . type ( ) ! = BSONType : : Object ) { <nl> - return { ErrorCodes : : TypeMismatch , <nl> - str : : stream ( ) < < InternalSchemaAllowedPropertiesMatchExpression : : kName <nl> - < < " requires ' patternProperties ' to be an array of objects " } ; <nl> - } <nl> - <nl> - auto constraint = constraintElem . embeddedObject ( ) ; <nl> - if ( constraint . nFields ( ) ! = 2 ) { <nl> - return { ErrorCodes : : FailedToParse , <nl> - str : : stream ( ) < < InternalSchemaAllowedPropertiesMatchExpression : : kName <nl> - < < " requires ' patternProperties ' to be an array of objects " <nl> - " containing exactly two fields , ' regex ' and ' expression ' " } ; <nl> - } <nl> - <nl> - auto expressionWithPlaceholder = <nl> - parseExprWithPlaceholder ( constraint , <nl> - " expression " _sd , <nl> - InternalSchemaAllowedPropertiesMatchExpression : : kName , <nl> - expectedPlaceholder , <nl> - expCtx ) ; <nl> - if ( ! expressionWithPlaceholder . isOK ( ) ) { <nl> - return expressionWithPlaceholder . getStatus ( ) ; <nl> - } <nl> - <nl> - auto regexElem = constraint [ " regex " ] ; <nl> - if ( ! regexElem ) { <nl> - return { <nl> - ErrorCodes : : FailedToParse , <nl> - str : : stream ( ) < < InternalSchemaAllowedPropertiesMatchExpression : : kName <nl> - < < " requires each object in ' patternProperties ' to have a ' regex ' " } ; <nl> - } <nl> - if ( regexElem . type ( ) ! = BSONType : : RegEx ) { <nl> - return { ErrorCodes : : TypeMismatch , <nl> - str : : stream ( ) < < InternalSchemaAllowedPropertiesMatchExpression : : kName <nl> - < < " requires ' patternProperties ' to be an array of objects , " <nl> - " where ' regex ' is a regular expression " } ; <nl> - } else if ( * regexElem . regexFlags ( ) ! = ' \ 0 ' ) { <nl> - return { <nl> - ErrorCodes : : BadValue , <nl> - str : : stream ( ) <nl> - < < InternalSchemaAllowedPropertiesMatchExpression : : kName <nl> - < < " does not accept regex flags for pattern schemas in ' patternProperties ' " } ; <nl> - } <nl> - <nl> - patternProperties . emplace_back ( <nl> - InternalSchemaAllowedPropertiesMatchExpression : : Pattern ( regexElem . regex ( ) ) , <nl> - std : : move ( expressionWithPlaceholder . getValue ( ) ) ) ; <nl> - } <nl> - <nl> - return std : : move ( patternProperties ) ; <nl> - } <nl> - <nl> StatusWith < boost : : container : : flat_set < StringData > > parseProperties ( BSONElement propertiesElem ) { <nl> if ( ! propertiesElem ) { <nl> return { ErrorCodes : : FailedToParse , <nl> StatusWith < boost : : container : : flat_set < StringData > > parseProperties ( BSONElement p <nl> StatusWithMatchExpression MatchExpressionParser : : _parseInternalSchemaMatchArrayIndex ( <nl> const char * path , <nl> const BSONElement & elem , <nl> - const boost : : intrusive_ptr < ExpressionContext > & expCtx ) { <nl> + const boost : : intrusive_ptr < ExpressionContext > & expCtx , <nl> + AllowedFeatureSet allowedFeatures , <nl> + DocumentParseLevel currentLevel ) { <nl> if ( elem . type ( ) ! = BSONType : : Object ) { <nl> return { ErrorCodes : : TypeMismatch , <nl> str : : stream ( ) < < InternalSchemaMatchArrayIndexMatchExpression : : kName <nl> StatusWithMatchExpression MatchExpressionParser : : _parseInternalSchemaMatchArrayI <nl> } <nl> <nl> auto expressionWithPlaceholder = <nl> - parseExprWithPlaceholder ( subobj , <nl> - " expression " _sd , <nl> - InternalSchemaMatchArrayIndexMatchExpression : : kName , <nl> - namePlaceholder . getValue ( ) , <nl> - expCtx ) ; <nl> + _parseExprWithPlaceholder ( subobj , <nl> + " expression " _sd , <nl> + InternalSchemaMatchArrayIndexMatchExpression : : kName , <nl> + namePlaceholder . getValue ( ) , <nl> + expCtx , <nl> + allowedFeatures , <nl> + currentLevel ) ; <nl> if ( ! expressionWithPlaceholder . isOK ( ) ) { <nl> return expressionWithPlaceholder . getStatus ( ) ; <nl> } <nl> StatusWithMatchExpression MatchExpressionParser : : _parseInternalSchemaMatchArrayI <nl> } <nl> <nl> StatusWithMatchExpression MatchExpressionParser : : _parseInternalSchemaAllowedProperties ( <nl> - const BSONElement & elem , const boost : : intrusive_ptr < ExpressionContext > & expCtx ) { <nl> + const BSONElement & elem , <nl> + const boost : : intrusive_ptr < ExpressionContext > & expCtx , <nl> + AllowedFeatureSet allowedFeatures , <nl> + DocumentParseLevel currentLevel ) { <nl> if ( elem . type ( ) ! = BSONType : : Object ) { <nl> return { ErrorCodes : : TypeMismatch , <nl> str : : stream ( ) < < InternalSchemaAllowedPropertiesMatchExpression : : kName <nl> StatusWithMatchExpression MatchExpressionParser : : _parseInternalSchemaAllowedProp <nl> return namePlaceholder . getStatus ( ) ; <nl> } <nl> <nl> - auto patternProperties = <nl> - parsePatternProperties ( subobj [ " patternProperties " ] , namePlaceholder . getValue ( ) , expCtx ) ; <nl> + auto patternProperties = _parsePatternProperties ( subobj [ " patternProperties " ] , <nl> + namePlaceholder . getValue ( ) , <nl> + expCtx , <nl> + allowedFeatures , <nl> + currentLevel ) ; <nl> if ( ! patternProperties . isOK ( ) ) { <nl> return patternProperties . getStatus ( ) ; <nl> } <nl> <nl> - auto otherwise = parseExprWithPlaceholder ( subobj , <nl> - " otherwise " _sd , <nl> - InternalSchemaAllowedPropertiesMatchExpression : : kName , <nl> - namePlaceholder . getValue ( ) , <nl> - expCtx ) ; <nl> + auto otherwise = <nl> + _parseExprWithPlaceholder ( subobj , <nl> + " otherwise " _sd , <nl> + InternalSchemaAllowedPropertiesMatchExpression : : kName , <nl> + namePlaceholder . getValue ( ) , <nl> + expCtx , <nl> + allowedFeatures , <nl> + currentLevel ) ; <nl> if ( ! otherwise . isOK ( ) ) { <nl> return otherwise . getStatus ( ) ; <nl> } <nl> mmm a / src / mongo / db / matcher / expression_parser . h <nl> ppp b / src / mongo / db / matcher / expression_parser . h <nl> <nl> # include " mongo / db / matcher / expression_leaf . h " <nl> # include " mongo / db / matcher / expression_tree . h " <nl> # include " mongo / db / matcher / expression_type . h " <nl> + # include " mongo / db / matcher / expression_with_placeholder . h " <nl> # include " mongo / db / matcher / extensions_callback . h " <nl> # include " mongo / db / matcher / extensions_callback_noop . h " <nl> + # include " mongo / db / matcher / schema / expression_internal_schema_allowed_properties . h " <nl> # include " mongo / db / pipeline / expression . h " <nl> # include " mongo / db / pipeline / expression_context . h " <nl> # include " mongo / stdx / functional . h " <nl> class MatchExpressionParser { <nl> const ExtensionsCallback & extensionsCallback = ExtensionsCallbackNoop ( ) , <nl> AllowedFeatureSet allowedFeatures = kDefaultSpecialFeatures ) { <nl> invariant ( expCtx . get ( ) ) ; <nl> - const bool topLevelCall = true ; <nl> return MatchExpressionParser ( & extensionsCallback ) <nl> - . _parse ( obj , expCtx , allowedFeatures , topLevelCall ) ; <nl> + . _parse ( obj , expCtx , allowedFeatures , DocumentParseLevel : : kPredicateTopLevel ) ; <nl> } <nl> <nl> / * * <nl> class MatchExpressionParser { <nl> static StatusWith < long long > parseIntegerElementToLong ( BSONElement elem ) ; <nl> <nl> private : <nl> + / * * <nl> + * ' DocumentParseLevel ' refers to the current position of the parser as it descends a <nl> + * MatchExpression tree . <nl> + * / <nl> + enum class DocumentParseLevel { <nl> + / / Indicates that the parser is looking at the root level of the BSON object containing the <nl> + / / user ' s query predicate . <nl> + kPredicateTopLevel , <nl> + / / Indicates that match expression nodes in this position will match against the complete <nl> + / / user document , as opposed to matching against a nested document or a subdocument inside <nl> + / / an array . <nl> + kUserDocumentTopLevel , <nl> + / / Indicates that match expression nodes in this position will match against a nested <nl> + / / document or a subdocument inside an array . <nl> + kUserSubDocument , <nl> + } ; <nl> + <nl> MatchExpressionParser ( const ExtensionsCallback * extensionsCallback ) <nl> : _extensionsCallback ( extensionsCallback ) { } <nl> <nl> class MatchExpressionParser { <nl> <nl> / * * <nl> * Parse ' obj ' and return either a MatchExpression or an error . <nl> - * <nl> - * ' topLevel ' indicates whether or not the we are at the top level of the tree across recursive <nl> - * class to this function . This is used to apply special logic at the top level . <nl> * / <nl> StatusWithMatchExpression _parse ( const BSONObj & obj , <nl> const boost : : intrusive_ptr < ExpressionContext > & expCtx , <nl> AllowedFeatureSet allowedFeatures , <nl> - bool topLevel ) ; <nl> + DocumentParseLevel currentLevel ) ; <nl> <nl> / * * <nl> * parses a field in a sub expression <nl> * if the query is { x : { $ gt : 5 , $ lt : 8 } } <nl> - * e is { $ gt : 5 , $ lt : 8 } <nl> + * obj is { $ gt : 5 , $ lt : 8 } <nl> * / <nl> Status _parseSub ( const char * name , <nl> const BSONObj & obj , <nl> AndMatchExpression * root , <nl> const boost : : intrusive_ptr < ExpressionContext > & expCtx , <nl> AllowedFeatureSet allowedFeatures , <nl> - bool topLevel ) ; <nl> + DocumentParseLevel currentLevel ) ; <nl> <nl> / * * <nl> * parses a single field in a sub expression <nl> class MatchExpressionParser { <nl> const BSONElement & e , <nl> const boost : : intrusive_ptr < ExpressionContext > & expCtx , <nl> AllowedFeatureSet allowedFeatures , <nl> - bool topLevel ) ; <nl> + DocumentParseLevel currentLevel ) ; <nl> <nl> StatusWithMatchExpression _parseComparison ( <nl> const char * name , <nl> class MatchExpressionParser { <nl> StatusWithMatchExpression _parseElemMatch ( const char * name , <nl> const BSONElement & e , <nl> const boost : : intrusive_ptr < ExpressionContext > & expCtx , <nl> - AllowedFeatureSet allowedFeatures , <nl> - bool topLevel ) ; <nl> + AllowedFeatureSet allowedFeatures ) ; <nl> <nl> StatusWithMatchExpression _parseAll ( const char * name , <nl> const BSONElement & e , <nl> const boost : : intrusive_ptr < ExpressionContext > & expCtx , <nl> - AllowedFeatureSet allowedFeatures , <nl> - bool topLevel ) ; <nl> + AllowedFeatureSet allowedFeatures ) ; <nl> <nl> / / tree <nl> <nl> class MatchExpressionParser { <nl> ListOfMatchExpression * out , <nl> const boost : : intrusive_ptr < ExpressionContext > & expCtx , <nl> AllowedFeatureSet allowedFeatures , <nl> - bool topLevel ) ; <nl> + DocumentParseLevel currentLevel ) ; <nl> <nl> StatusWithMatchExpression _parseNot ( const char * name , <nl> const BSONElement & e , <nl> const boost : : intrusive_ptr < ExpressionContext > & expCtx , <nl> AllowedFeatureSet allowedFeatures , <nl> - bool topLevel ) ; <nl> + DocumentParseLevel currentLevel ) ; <nl> <nl> / * * <nl> * Parses ' e ' into a BitTestMatchExpression . <nl> class MatchExpressionParser { <nl> <nl> StatusWithMatchExpression _parseInternalSchemaFmod ( const char * name , const BSONElement & e ) ; <nl> <nl> + / * * <nl> + * Looks at the field named ' exprWithPlaceholderFieldName ' within ' containingObject ' and parses <nl> + * an ExpressionWithPlaceholder from that element . Fails if an error occurs during parsing , or <nl> + * if the ExpressionWithPlaceholder has a different name placeholder than ' expectedPlaceholder ' . <nl> + * ' expressionName ' is the name of the expression that requires the ExpressionWithPlaceholder <nl> + * and is used to generate helpful error messages . <nl> + * / <nl> + StatusWith < std : : unique_ptr < ExpressionWithPlaceholder > > _parseExprWithPlaceholder ( <nl> + const BSONObj & containingObject , <nl> + StringData exprWithPlaceholderFieldName , <nl> + StringData expressionName , <nl> + StringData expectedPlaceholder , <nl> + const boost : : intrusive_ptr < ExpressionContext > & expCtx , <nl> + AllowedFeatureSet allowedFeatures , <nl> + DocumentParseLevel currentLevel ) ; <nl> + <nl> + StatusWith < std : : vector < InternalSchemaAllowedPropertiesMatchExpression : : PatternSchema > > <nl> + _parsePatternProperties ( BSONElement patternPropertiesElem , <nl> + StringData expectedPlaceholder , <nl> + const boost : : intrusive_ptr < ExpressionContext > & expCtx , <nl> + AllowedFeatureSet allowedFeatures , <nl> + DocumentParseLevel currentLevel ) ; <nl> + <nl> / * * <nl> * Parses a MatchExpression which takes a fixed - size array of MatchExpressions as arguments . <nl> * / <nl> class MatchExpressionParser { <nl> StringData name , <nl> const BSONElement & elem , <nl> const boost : : intrusive_ptr < ExpressionContext > & expCtx , <nl> - AllowedFeatureSet allowedFeatures ) ; <nl> + AllowedFeatureSet allowedFeatures , <nl> + DocumentParseLevel currentLevel ) ; <nl> <nl> / * * <nl> * Parses the given BSONElement into a single integer argument and creates a MatchExpression <nl> class MatchExpressionParser { <nl> StatusWithMatchExpression _parseInternalSchemaMatchArrayIndex ( <nl> const char * path , <nl> const BSONElement & elem , <nl> - const boost : : intrusive_ptr < ExpressionContext > & expCtx ) ; <nl> + const boost : : intrusive_ptr < ExpressionContext > & expCtx , <nl> + AllowedFeatureSet allowedFeatures , <nl> + DocumentParseLevel currentLevel ) ; <nl> <nl> StatusWithMatchExpression _parseInternalSchemaAllowedProperties ( <nl> - const BSONElement & elem , const boost : : intrusive_ptr < ExpressionContext > & expCtx ) ; <nl> + const BSONElement & elem , <nl> + const boost : : intrusive_ptr < ExpressionContext > & expCtx , <nl> + AllowedFeatureSet allowedFeatures , <nl> + DocumentParseLevel currentLevel ) ; <nl> <nl> / / Performs parsing for the match extensions . We do not own this pointer - it has to live <nl> / / as long as the parser is active . <nl> mmm a / src / mongo / db / matcher / expression_parser_test . cpp <nl> ppp b / src / mongo / db / matcher / expression_parser_test . cpp <nl> TEST ( MatchExpressionParserTest , ExprParsesSuccessfullyWithAdditionalTopLevelPred <nl> ASSERT_OK ( MatchExpressionParser : : parse ( query , expCtx ) . getStatus ( ) ) ; <nl> } <nl> <nl> - TEST ( MatchExpressionParserTest , ExprFailsToParseWithinTopLevelOr ) { <nl> + TEST ( MatchExpressionParserTest , ExprParsesSuccessfullyWithinTopLevelOr ) { <nl> auto query = fromjson ( " { $ or : [ { x : 1 } , { $ expr : { $ eq : [ ' $ a ' , 5 ] } } ] } " ) ; <nl> boost : : intrusive_ptr < ExpressionContextForTest > expCtx ( new ExpressionContextForTest ( ) ) ; <nl> - ASSERT_NOT_OK ( MatchExpressionParser : : parse ( query , expCtx ) . getStatus ( ) ) ; <nl> + ASSERT_OK ( <nl> + MatchExpressionParser : : parse ( <nl> + query , expCtx , ExtensionsCallbackNoop ( ) , MatchExpressionParser : : AllowedFeatures : : kExpr ) <nl> + . getStatus ( ) ) ; <nl> + } <nl> + <nl> + TEST ( MatchExpressionParserTest , ExprParsesSuccessfullyWithinTopLevelAnd ) { <nl> + auto query = fromjson ( " { $ and : [ { x : 1 } , { $ expr : { $ eq : [ ' $ a ' , 5 ] } } ] } " ) ; <nl> + boost : : intrusive_ptr < ExpressionContextForTest > expCtx ( new ExpressionContextForTest ( ) ) ; <nl> + ASSERT_OK ( <nl> + MatchExpressionParser : : parse ( <nl> + query , expCtx , ExtensionsCallbackNoop ( ) , MatchExpressionParser : : AllowedFeatures : : kExpr ) <nl> + . getStatus ( ) ) ; <nl> + } <nl> + <nl> + TEST ( MatchExpressionParserTest , ExprFailsToParseWithinElemMatch ) { <nl> + auto query = fromjson ( " { a : { $ elemMatch : { $ expr : { $ eq : [ ' $ foo ' , ' $ bar ' ] } } } } " ) ; <nl> + boost : : intrusive_ptr < ExpressionContextForTest > expCtx ( new ExpressionContextForTest ( ) ) ; <nl> + ASSERT_NOT_OK ( <nl> + MatchExpressionParser : : parse ( <nl> + query , expCtx , ExtensionsCallbackNoop ( ) , MatchExpressionParser : : AllowedFeatures : : kExpr ) <nl> + . getStatus ( ) ) ; <nl> + } <nl> + <nl> + TEST ( MatchExpressionParserTest , ExprNestedFailsToParseWithinElemMatch ) { <nl> + auto query = <nl> + fromjson ( " { a : { $ elemMatch : { b : 1 , $ or : [ { $ expr : { $ eq : [ ' $ foo ' , ' $ bar ' ] } } , { c : 1 } ] } } } " ) ; <nl> + boost : : intrusive_ptr < ExpressionContextForTest > expCtx ( new ExpressionContextForTest ( ) ) ; <nl> + ASSERT_NOT_OK ( <nl> + MatchExpressionParser : : parse ( <nl> + query , expCtx , ExtensionsCallbackNoop ( ) , MatchExpressionParser : : AllowedFeatures : : kExpr ) <nl> + . getStatus ( ) ) ; <nl> + } <nl> + <nl> + TEST ( MatchExpressionParserTest , ExprFailsToParseWithinInternalSchemaObjectMatch ) { <nl> + auto query = fromjson ( " { a : { $ _internalSchemaObjectMatch : { $ expr : { $ eq : [ ' $ foo ' , ' $ bar ' ] } } } } " ) ; <nl> + boost : : intrusive_ptr < ExpressionContextForTest > expCtx ( new ExpressionContextForTest ( ) ) ; <nl> + ASSERT_NOT_OK ( <nl> + MatchExpressionParser : : parse ( <nl> + query , expCtx , ExtensionsCallbackNoop ( ) , MatchExpressionParser : : AllowedFeatures : : kExpr ) <nl> + . getStatus ( ) ) ; <nl> } <nl> } <nl> mmm a / src / mongo / db / matcher / expression_parser_tree . cpp <nl> ppp b / src / mongo / db / matcher / expression_parser_tree . cpp <nl> Status MatchExpressionParser : : _parseTreeList ( const BSONObj & arr , <nl> ListOfMatchExpression * out , <nl> const boost : : intrusive_ptr < ExpressionContext > & expCtx , <nl> AllowedFeatureSet allowedFeatures , <nl> - bool topLevel ) { <nl> + DocumentParseLevel currentLevel ) { <nl> if ( arr . isEmpty ( ) ) <nl> return Status ( ErrorCodes : : BadValue , " $ and / $ or / $ nor must be a nonempty array " ) ; <nl> <nl> Status MatchExpressionParser : : _parseTreeList ( const BSONObj & arr , <nl> if ( e . type ( ) ! = Object ) <nl> return Status ( ErrorCodes : : BadValue , " $ or / $ and / $ nor entries need to be full objects " ) ; <nl> <nl> - StatusWithMatchExpression sub = _parse ( e . Obj ( ) , expCtx , allowedFeatures , topLevel ) ; <nl> + StatusWithMatchExpression sub = _parse ( e . Obj ( ) , expCtx , allowedFeatures , currentLevel ) ; <nl> if ( ! sub . isOK ( ) ) <nl> return sub . getStatus ( ) ; <nl> <nl> StatusWithMatchExpression MatchExpressionParser : : _parseNot ( <nl> const BSONElement & e , <nl> const boost : : intrusive_ptr < ExpressionContext > & expCtx , <nl> AllowedFeatureSet allowedFeatures , <nl> - bool topLevel ) { <nl> + DocumentParseLevel currentLevel ) { <nl> if ( e . type ( ) = = RegEx ) { <nl> StatusWithMatchExpression s = _parseRegexElement ( name , e ) ; <nl> if ( ! s . isOK ( ) ) <nl> StatusWithMatchExpression MatchExpressionParser : : _parseNot ( <nl> return StatusWithMatchExpression ( ErrorCodes : : BadValue , " $ not cannot be empty " ) ; <nl> <nl> std : : unique_ptr < AndMatchExpression > theAnd = stdx : : make_unique < AndMatchExpression > ( ) ; <nl> - Status s = _parseSub ( name , notObject , theAnd . get ( ) , expCtx , allowedFeatures , topLevel ) ; <nl> + Status s = _parseSub ( name , notObject , theAnd . get ( ) , expCtx , allowedFeatures , currentLevel ) ; <nl> if ( ! s . isOK ( ) ) <nl> return StatusWithMatchExpression ( s ) ; <nl> <nl> mmm a / src / mongo / db / matcher / expression_with_placeholder . cpp <nl> ppp b / src / mongo / db / matcher / expression_with_placeholder . cpp <nl> <nl> <nl> # include " mongo / db / matcher / expression_with_placeholder . h " <nl> <nl> + # include " mongo / db / matcher / expression_parser . h " <nl> + <nl> # include < regex > <nl> <nl> namespace mongo { <nl> bool ExpressionWithPlaceholder : : equivalent ( const ExpressionWithPlaceholder * othe <nl> const std : : regex ExpressionWithPlaceholder : : placeholderRegex ( " ^ [ a - z ] [ a - zA - Z0 - 9 ] * $ " ) ; <nl> <nl> / / static <nl> - StatusWith < std : : unique_ptr < ExpressionWithPlaceholder > > ExpressionWithPlaceholder : : parse ( <nl> - BSONObj rawFilter , const boost : : intrusive_ptr < ExpressionContext > & expCtx ) { <nl> - StatusWithMatchExpression statusWithFilter = MatchExpressionParser : : parse ( <nl> - rawFilter , expCtx , ExtensionsCallbackNoop ( ) , MatchExpressionParser : : kBanAllSpecialFeatures ) ; <nl> - <nl> - if ( ! statusWithFilter . isOK ( ) ) { <nl> - return statusWithFilter . getStatus ( ) ; <nl> - } <nl> - auto filter = std : : move ( statusWithFilter . getValue ( ) ) ; <nl> - <nl> + StatusWith < std : : unique_ptr < ExpressionWithPlaceholder > > ExpressionWithPlaceholder : : make ( <nl> + std : : unique_ptr < MatchExpression > filter ) { <nl> auto statusWithId = parseTopLevelFieldName ( filter . get ( ) ) ; <nl> if ( ! statusWithId . isOK ( ) ) { <nl> return statusWithId . getStatus ( ) ; <nl> mmm a / src / mongo / db / matcher / expression_with_placeholder . h <nl> ppp b / src / mongo / db / matcher / expression_with_placeholder . h <nl> <nl> # include < boost / optional . hpp > <nl> # include < regex > <nl> <nl> - # include " mongo / db / matcher / expression_parser . h " <nl> + # include " mongo / base / status_with . h " <nl> + # include " mongo / db / matcher / expression . h " <nl> + # include " mongo / db / pipeline / expression_context . h " <nl> <nl> namespace mongo { <nl> <nl> class ExpressionWithPlaceholder { <nl> static const std : : regex placeholderRegex ; <nl> <nl> / * * <nl> - * Parses ' rawFilter ' to an ExpressionWithPlaceholder . This succeeds if ' rawFilter ' is a <nl> - * filter over a single top - level field , which begins with a lowercase letter and contains <nl> - * no special characters . Otherwise , a non - OK status is returned . Callers must maintain <nl> - * ownership of ' rawFilter ' . <nl> + * Constructs an ExpressionWithPlaceholder from an existing match expression . Returns a non - OK <nl> + * status if the paths inside the match expression do not name a consistent placeholder string . <nl> * / <nl> - static StatusWith < std : : unique_ptr < ExpressionWithPlaceholder > > parse ( <nl> - BSONObj rawFilter , const boost : : intrusive_ptr < ExpressionContext > & expCtx ) ; <nl> + static StatusWith < std : : unique_ptr < ExpressionWithPlaceholder > > make ( <nl> + std : : unique_ptr < MatchExpression > filter ) ; <nl> <nl> / * * <nl> * Construct a new ExpressionWithPlaceholder . ' filter ' must point to a valid MatchExpression . <nl> mmm a / src / mongo / db / matcher / expression_with_placeholder_test . cpp <nl> ppp b / src / mongo / db / matcher / expression_with_placeholder_test . cpp <nl> <nl> <nl> # include " mongo / db / json . h " <nl> # include " mongo / db / matcher / expression_always_boolean . h " <nl> + # include " mongo / db / matcher / expression_parser . h " <nl> # include " mongo / db / matcher / expression_with_placeholder . h " <nl> # include " mongo / db / pipeline / expression_context_for_test . h " <nl> # include " mongo / db / query / collation / collator_interface_mock . h " <nl> using unittest : : assertGet ; <nl> TEST ( ExpressionWithPlaceholderTest , ParseBasic ) { <nl> boost : : intrusive_ptr < ExpressionContextForTest > expCtx ( new ExpressionContextForTest ( ) ) ; <nl> auto rawFilter = fromjson ( " { i : 0 } " ) ; <nl> - auto filter = assertGet ( ExpressionWithPlaceholder : : parse ( rawFilter , expCtx ) ) ; <nl> + auto parsedFilter = assertGet ( MatchExpressionParser : : parse ( rawFilter , expCtx ) ) ; <nl> + auto filter = assertGet ( ExpressionWithPlaceholder : : make ( std : : move ( parsedFilter ) ) ) ; <nl> ASSERT ( filter - > getPlaceholder ( ) ) ; <nl> ASSERT_EQ ( * filter - > getPlaceholder ( ) , " i " ) ; <nl> ASSERT_TRUE ( filter - > getFilter ( ) - > matchesBSON ( fromjson ( " { i : 0 } " ) ) ) ; <nl> TEST ( ExpressionWithPlaceholderTest , ParseBasic ) { <nl> TEST ( ExpressionWithPlaceholderTest , ParseDottedField ) { <nl> boost : : intrusive_ptr < ExpressionContextForTest > expCtx ( new ExpressionContextForTest ( ) ) ; <nl> auto rawFilter = fromjson ( " { ' i . a ' : 0 , ' i . b ' : 1 } " ) ; <nl> - auto filter = assertGet ( ExpressionWithPlaceholder : : parse ( rawFilter , expCtx ) ) ; <nl> + auto parsedFilter = assertGet ( MatchExpressionParser : : parse ( rawFilter , expCtx ) ) ; <nl> + auto filter = assertGet ( ExpressionWithPlaceholder : : make ( std : : move ( parsedFilter ) ) ) ; <nl> ASSERT ( filter - > getPlaceholder ( ) ) ; <nl> ASSERT_EQ ( * filter - > getPlaceholder ( ) , " i " ) ; <nl> ASSERT_TRUE ( filter - > getFilter ( ) - > matchesBSON ( fromjson ( " { i : { a : 0 , b : 1 } } " ) ) ) ; <nl> TEST ( ExpressionWithPlaceholderTest , ParseDottedField ) { <nl> TEST ( ExpressionWithPlaceholderTest , ParseLogicalQuery ) { <nl> boost : : intrusive_ptr < ExpressionContextForTest > expCtx ( new ExpressionContextForTest ( ) ) ; <nl> auto rawFilter = fromjson ( " { $ and : [ { i : { $ gte : 0 } } , { i : { $ lte : 0 } } ] } " ) ; <nl> - auto filter = assertGet ( ExpressionWithPlaceholder : : parse ( rawFilter , expCtx ) ) ; <nl> + auto parsedFilter = assertGet ( MatchExpressionParser : : parse ( rawFilter , expCtx ) ) ; <nl> + auto filter = assertGet ( ExpressionWithPlaceholder : : make ( std : : move ( parsedFilter ) ) ) ; <nl> ASSERT ( filter - > getPlaceholder ( ) ) ; <nl> ASSERT_EQ ( * filter - > getPlaceholder ( ) , " i " ) ; <nl> ASSERT_TRUE ( filter - > getFilter ( ) - > matchesBSON ( fromjson ( " { i : 0 } " ) ) ) ; <nl> TEST ( ExpressionWithPlaceholderTest , ParseLogicalQuery ) { <nl> TEST ( ExpressionWithPlaceholderTest , ParseElemMatch ) { <nl> boost : : intrusive_ptr < ExpressionContextForTest > expCtx ( new ExpressionContextForTest ( ) ) ; <nl> auto rawFilter = fromjson ( " { i : { $ elemMatch : { a : 0 } } } " ) ; <nl> - auto filter = assertGet ( ExpressionWithPlaceholder : : parse ( rawFilter , expCtx ) ) ; <nl> + auto parsedFilter = assertGet ( MatchExpressionParser : : parse ( rawFilter , expCtx ) ) ; <nl> + auto filter = assertGet ( ExpressionWithPlaceholder : : make ( std : : move ( parsedFilter ) ) ) ; <nl> ASSERT ( filter - > getPlaceholder ( ) ) ; <nl> ASSERT_EQ ( * filter - > getPlaceholder ( ) , " i " ) ; <nl> ASSERT_TRUE ( filter - > getFilter ( ) - > matchesBSON ( fromjson ( " { i : [ { a : 0 } ] } " ) ) ) ; <nl> TEST ( ExpressionWithPlaceholderTest , ParseCollation ) { <nl> boost : : intrusive_ptr < ExpressionContextForTest > expCtx ( new ExpressionContextForTest ( ) ) ; <nl> expCtx - > setCollator ( & collator ) ; <nl> auto rawFilter = fromjson ( " { i : ' abc ' } " ) ; <nl> - auto filter = assertGet ( ExpressionWithPlaceholder : : parse ( rawFilter , expCtx ) ) ; <nl> + auto parsedFilter = assertGet ( MatchExpressionParser : : parse ( rawFilter , expCtx ) ) ; <nl> + auto filter = assertGet ( ExpressionWithPlaceholder : : make ( std : : move ( parsedFilter ) ) ) ; <nl> ASSERT ( filter - > getPlaceholder ( ) ) ; <nl> ASSERT_EQ ( * filter - > getPlaceholder ( ) , " i " ) ; <nl> ASSERT_TRUE ( filter - > getFilter ( ) - > matchesBSON ( fromjson ( " { i : ' cba ' } " ) ) ) ; <nl> TEST ( ExpressionWithPlaceholderTest , ParseCollation ) { <nl> TEST ( ExpressionWithPlaceholderTest , ParseIdContainsNumbersAndCapitals ) { <nl> boost : : intrusive_ptr < ExpressionContextForTest > expCtx ( new ExpressionContextForTest ( ) ) ; <nl> auto rawFilter = fromjson ( " { iA3 : 0 } " ) ; <nl> - auto filter = assertGet ( ExpressionWithPlaceholder : : parse ( rawFilter , expCtx ) ) ; <nl> + auto parsedFilter = assertGet ( MatchExpressionParser : : parse ( rawFilter , expCtx ) ) ; <nl> + auto filter = assertGet ( ExpressionWithPlaceholder : : make ( std : : move ( parsedFilter ) ) ) ; <nl> ASSERT ( filter - > getPlaceholder ( ) ) ; <nl> ASSERT_EQ ( * filter - > getPlaceholder ( ) , " iA3 " ) ; <nl> ASSERT_TRUE ( filter - > getFilter ( ) - > matchesBSON ( fromjson ( " { ' iA3 ' : 0 } " ) ) ) ; <nl> ASSERT_FALSE ( filter - > getFilter ( ) - > matchesBSON ( fromjson ( " { ' iA3 ' : 1 } " ) ) ) ; <nl> } <nl> <nl> - TEST ( ExpressionWithPlaceholderTest , BadMatchExpressionFailsToParse ) { <nl> - boost : : intrusive_ptr < ExpressionContextForTest > expCtx ( new ExpressionContextForTest ( ) ) ; <nl> - auto rawFilter = fromjson ( " { $ and : 0 } " ) ; <nl> - auto status = ExpressionWithPlaceholder : : parse ( rawFilter , expCtx ) ; <nl> - ASSERT_NOT_OK ( status . getStatus ( ) ) ; <nl> - } <nl> - <nl> TEST ( ExpressionWithPlaceholderTest , EmptyMatchExpressionParsesSuccessfully ) { <nl> boost : : intrusive_ptr < ExpressionContextForTest > expCtx ( new ExpressionContextForTest ( ) ) ; <nl> auto rawFilter = fromjson ( " { } " ) ; <nl> - auto result = assertGet ( ExpressionWithPlaceholder : : parse ( rawFilter , expCtx ) ) ; <nl> + auto parsedFilter = assertGet ( MatchExpressionParser : : parse ( rawFilter , expCtx ) ) ; <nl> + auto result = assertGet ( ExpressionWithPlaceholder : : make ( std : : move ( parsedFilter ) ) ) ; <nl> ASSERT_FALSE ( result - > getPlaceholder ( ) ) ; <nl> } <nl> <nl> TEST ( ExpressionWithPlaceholderTest , NestedEmptyMatchExpressionParsesSuccessfully ) { <nl> boost : : intrusive_ptr < ExpressionContextForTest > expCtx ( new ExpressionContextForTest ( ) ) ; <nl> auto rawFilter = fromjson ( " { $ or : [ { $ and : [ { } ] } ] } " ) ; <nl> - auto result = assertGet ( ExpressionWithPlaceholder : : parse ( rawFilter , expCtx ) ) ; <nl> + auto parsedFilter = assertGet ( MatchExpressionParser : : parse ( rawFilter , expCtx ) ) ; <nl> + auto result = assertGet ( ExpressionWithPlaceholder : : make ( std : : move ( parsedFilter ) ) ) ; <nl> ASSERT_FALSE ( result - > getPlaceholder ( ) ) ; <nl> } <nl> <nl> TEST ( ExpressionWithPlaceholderTest , <nl> NestedMatchExpressionParsesSuccessfullyWhenSomeClausesHaveNoFieldName ) { <nl> boost : : intrusive_ptr < ExpressionContextForTest > expCtx ( new ExpressionContextForTest ( ) ) ; <nl> auto rawFilter = fromjson ( " { $ or : [ { $ and : [ { } ] } , { i : 0 } , { i : 1 } , { $ and : [ { } ] } ] } " ) ; <nl> - auto result = assertGet ( ExpressionWithPlaceholder : : parse ( rawFilter , expCtx ) ) ; <nl> + auto parsedFilter = assertGet ( MatchExpressionParser : : parse ( rawFilter , expCtx ) ) ; <nl> + auto result = assertGet ( ExpressionWithPlaceholder : : make ( std : : move ( parsedFilter ) ) ) ; <nl> ASSERT ( result - > getPlaceholder ( ) ) ; <nl> ASSERT_EQ ( * result - > getPlaceholder ( ) , " i " _sd ) ; <nl> } <nl> TEST ( ExpressionWithPlaceholderTest , SuccessfullyParsesExpressionsWithTypeOther ) <nl> boost : : intrusive_ptr < ExpressionContextForTest > expCtx ( new ExpressionContextForTest ( ) ) ; <nl> auto rawFilter = <nl> fromjson ( " { a : { $ _internalSchemaObjectMatch : { $ _internalSchemaMinProperties : 5 } } } " ) ; <nl> - auto result = assertGet ( ExpressionWithPlaceholder : : parse ( rawFilter , expCtx ) ) ; <nl> + auto parsedFilter = assertGet ( MatchExpressionParser : : parse ( rawFilter , expCtx ) ) ; <nl> + auto result = assertGet ( ExpressionWithPlaceholder : : make ( std : : move ( parsedFilter ) ) ) ; <nl> ASSERT ( result - > getPlaceholder ( ) ) ; <nl> ASSERT_EQ ( * result - > getPlaceholder ( ) , " a " _sd ) ; <nl> <nl> rawFilter = fromjson ( " { a : { $ _internalSchemaType : ' string ' } } " ) ; <nl> - result = assertGet ( ExpressionWithPlaceholder : : parse ( rawFilter , expCtx ) ) ; <nl> + parsedFilter = assertGet ( MatchExpressionParser : : parse ( rawFilter , expCtx ) ) ; <nl> + result = assertGet ( ExpressionWithPlaceholder : : make ( std : : move ( parsedFilter ) ) ) ; <nl> ASSERT ( result - > getPlaceholder ( ) ) ; <nl> ASSERT_EQ ( * result - > getPlaceholder ( ) , " a " _sd ) ; <nl> <nl> rawFilter = fromjson ( " { $ _internalSchemaMinProperties : 1 } } " ) ; <nl> - result = assertGet ( ExpressionWithPlaceholder : : parse ( rawFilter , expCtx ) ) ; <nl> + parsedFilter = assertGet ( MatchExpressionParser : : parse ( rawFilter , expCtx ) ) ; <nl> + result = assertGet ( ExpressionWithPlaceholder : : make ( std : : move ( parsedFilter ) ) ) ; <nl> ASSERT_FALSE ( result - > getPlaceholder ( ) ) ; <nl> <nl> rawFilter = fromjson ( " { $ _internalSchemaCond : [ { a : { $ exists : true } } , { b : 1 } , { c : 1 } ] } " ) ; <nl> - result = assertGet ( ExpressionWithPlaceholder : : parse ( rawFilter , expCtx ) ) ; <nl> + parsedFilter = assertGet ( MatchExpressionParser : : parse ( rawFilter , expCtx ) ) ; <nl> + result = assertGet ( ExpressionWithPlaceholder : : make ( std : : move ( parsedFilter ) ) ) ; <nl> ASSERT_FALSE ( result - > getPlaceholder ( ) ) ; <nl> } <nl> <nl> TEST ( ExpressionWithPlaceholderTest , SuccessfullyParsesAlwaysTrue ) { <nl> boost : : intrusive_ptr < ExpressionContextForTest > expCtx ( new ExpressionContextForTest ( ) ) ; <nl> auto rawFilter = BSON ( AlwaysTrueMatchExpression : : kName < < 1 ) ; <nl> - auto result = assertGet ( ExpressionWithPlaceholder : : parse ( rawFilter , expCtx ) ) ; <nl> + auto parsedFilter = <nl> + assertGet ( MatchExpressionParser : : parse ( rawFilter , <nl> + expCtx , <nl> + ExtensionsCallbackNoop ( ) , <nl> + MatchExpressionParser : : kBanAllSpecialFeatures ) ) ; <nl> + auto result = assertGet ( ExpressionWithPlaceholder : : make ( std : : move ( parsedFilter ) ) ) ; <nl> ASSERT_FALSE ( result - > getPlaceholder ( ) ) ; <nl> } <nl> <nl> TEST ( ExpressionWithPlaceholderTest , SuccessfullyParsesAlwaysFalse ) { <nl> boost : : intrusive_ptr < ExpressionContextForTest > expCtx ( new ExpressionContextForTest ( ) ) ; <nl> auto rawFilter = BSON ( AlwaysFalseMatchExpression : : kName < < 1 ) ; <nl> - auto result = assertGet ( ExpressionWithPlaceholder : : parse ( rawFilter , expCtx ) ) ; <nl> + auto parsedFilter = assertGet ( MatchExpressionParser : : parse ( rawFilter , expCtx ) ) ; <nl> + auto result = assertGet ( ExpressionWithPlaceholder : : make ( std : : move ( parsedFilter ) ) ) ; <nl> ASSERT_FALSE ( result - > getPlaceholder ( ) ) ; <nl> } <nl> <nl> TEST ( ExpressionWithPlaceholderTest , EmptyFieldNameFailsToParse ) { <nl> boost : : intrusive_ptr < ExpressionContextForTest > expCtx ( new ExpressionContextForTest ( ) ) ; <nl> auto rawFilter = fromjson ( " { ' ' : 0 } " ) ; <nl> - auto status = ExpressionWithPlaceholder : : parse ( rawFilter , expCtx ) ; <nl> + auto parsedFilter = assertGet ( MatchExpressionParser : : parse ( rawFilter , expCtx ) ) ; <nl> + auto status = ExpressionWithPlaceholder : : make ( std : : move ( parsedFilter ) ) ; <nl> ASSERT_NOT_OK ( status . getStatus ( ) ) ; <nl> } <nl> <nl> TEST ( ExpressionWithPlaceholderTest , EmptyElemMatchFieldNameFailsToParse ) { <nl> boost : : intrusive_ptr < ExpressionContextForTest > expCtx ( new ExpressionContextForTest ( ) ) ; <nl> auto rawFilter = fromjson ( " { ' ' : { $ elemMatch : { a : 0 } } } " ) ; <nl> - auto status = ExpressionWithPlaceholder : : parse ( rawFilter , expCtx ) ; <nl> + auto parsedFilter = assertGet ( MatchExpressionParser : : parse ( rawFilter , expCtx ) ) ; <nl> + auto status = ExpressionWithPlaceholder : : make ( std : : move ( parsedFilter ) ) ; <nl> ASSERT_NOT_OK ( status . getStatus ( ) ) ; <nl> } <nl> <nl> TEST ( ExpressionWithPlaceholderTest , EmptyTopLevelFieldNameFailsToParse ) { <nl> boost : : intrusive_ptr < ExpressionContextForTest > expCtx ( new ExpressionContextForTest ( ) ) ; <nl> auto rawFilter = fromjson ( " { ' . i ' : 0 } " ) ; <nl> - auto status = ExpressionWithPlaceholder : : parse ( rawFilter , expCtx ) ; <nl> + auto parsedFilter = assertGet ( MatchExpressionParser : : parse ( rawFilter , expCtx ) ) ; <nl> + auto status = ExpressionWithPlaceholder : : make ( std : : move ( parsedFilter ) ) ; <nl> ASSERT_NOT_OK ( status . getStatus ( ) ) ; <nl> } <nl> <nl> TEST ( ExpressionWithPlaceholderTest , MultipleTopLevelFieldsFailsToParse ) { <nl> boost : : intrusive_ptr < ExpressionContextForTest > expCtx ( new ExpressionContextForTest ( ) ) ; <nl> auto rawFilter = fromjson ( " { $ and : [ { i : 0 } , { j : 0 } ] } " ) ; <nl> - auto status = ExpressionWithPlaceholder : : parse ( rawFilter , expCtx ) ; <nl> + auto parsedFilter = assertGet ( MatchExpressionParser : : parse ( rawFilter , expCtx ) ) ; <nl> + auto status = ExpressionWithPlaceholder : : make ( std : : move ( parsedFilter ) ) ; <nl> ASSERT_NOT_OK ( status . getStatus ( ) ) ; <nl> } <nl> <nl> TEST ( ExpressionWithPlaceholderTest , SpecialCharactersInFieldNameFailsToParse ) { <nl> boost : : intrusive_ptr < ExpressionContextForTest > expCtx ( new ExpressionContextForTest ( ) ) ; <nl> auto rawFilter = fromjson ( " { ' i & ' : 0 } " ) ; <nl> - auto status = ExpressionWithPlaceholder : : parse ( rawFilter , expCtx ) ; <nl> + auto parsedFilter = assertGet ( MatchExpressionParser : : parse ( rawFilter , expCtx ) ) ; <nl> + auto status = ExpressionWithPlaceholder : : make ( std : : move ( parsedFilter ) ) ; <nl> ASSERT_NOT_OK ( status . getStatus ( ) ) ; <nl> } <nl> <nl> TEST ( ExpressionWithPlaceholderTest , FieldNameStartingWithNumberFailsToParse ) { <nl> boost : : intrusive_ptr < ExpressionContextForTest > expCtx ( new ExpressionContextForTest ( ) ) ; <nl> auto rawFilter = fromjson ( " { ' 3i ' : 0 } " ) ; <nl> - auto status = ExpressionWithPlaceholder : : parse ( rawFilter , expCtx ) ; <nl> + auto parsedFilter = assertGet ( MatchExpressionParser : : parse ( rawFilter , expCtx ) ) ; <nl> + auto status = ExpressionWithPlaceholder : : make ( std : : move ( parsedFilter ) ) ; <nl> ASSERT_NOT_OK ( status . getStatus ( ) ) ; <nl> } <nl> <nl> TEST ( ExpressionWithPlaceholderTest , FieldNameStartingWithCapitalFailsToParse ) { <nl> boost : : intrusive_ptr < ExpressionContextForTest > expCtx ( new ExpressionContextForTest ( ) ) ; <nl> auto rawFilter = fromjson ( " { ' Ai ' : 0 } " ) ; <nl> - auto status = ExpressionWithPlaceholder : : parse ( rawFilter , expCtx ) ; <nl> - ASSERT_NOT_OK ( status . getStatus ( ) ) ; <nl> - } <nl> - <nl> - TEST ( ExpressionWithPlaceholderTest , TextSearchExpressionFailsToParse ) { <nl> - boost : : intrusive_ptr < ExpressionContextForTest > expCtx ( new ExpressionContextForTest ( ) ) ; <nl> - auto rawFilter = fromjson ( " { $ text : { $ search : ' search terms ' } } " ) ; <nl> - auto status = ExpressionWithPlaceholder : : parse ( rawFilter , expCtx ) ; <nl> + auto parsedFilter = assertGet ( MatchExpressionParser : : parse ( rawFilter , expCtx ) ) ; <nl> + auto status = ExpressionWithPlaceholder : : make ( std : : move ( parsedFilter ) ) ; <nl> ASSERT_NOT_OK ( status . getStatus ( ) ) ; <nl> - } <nl> - <nl> - TEST ( ExpressionWithPlaceholderTest , WhereExpressionFailsToParse ) { <nl> - boost : : intrusive_ptr < ExpressionContextForTest > expCtx ( new ExpressionContextForTest ( ) ) ; <nl> - auto rawFilter = fromjson ( " { $ where : ' sleep ( 100 ) ' } " ) ; <nl> - auto status = ExpressionWithPlaceholder : : parse ( rawFilter , expCtx ) ; <nl> - ASSERT_NOT_OK ( status . getStatus ( ) ) ; <nl> - } <nl> - <nl> - TEST ( ExpressionWithPlaceholderTest , GeoNearExpressionFailsToParse ) { <nl> - boost : : intrusive_ptr < ExpressionContextForTest > expCtx ( new ExpressionContextForTest ( ) ) ; <nl> - auto rawFilter = <nl> - fromjson ( " { i : { $ nearSphere : { $ geometry : { type : ' Point ' , coordinates : [ 0 , 0 ] } } } } " ) ; <nl> - auto status = ExpressionWithPlaceholder : : parse ( rawFilter , expCtx ) ; <nl> - ASSERT_NOT_OK ( status . getStatus ( ) ) ; <nl> - } <nl> - <nl> - TEST ( ExpressionWithPlaceholderTest , ExprExpressionFailsToParse ) { <nl> - boost : : intrusive_ptr < ExpressionContextForTest > expCtx ( new ExpressionContextForTest ( ) ) ; <nl> - auto rawFilter = fromjson ( " { $ expr : { $ eq : [ ' $ i ' , 5 ] } } " ) ; <nl> - auto status = ExpressionWithPlaceholder : : parse ( rawFilter , expCtx ) ; <nl> - ASSERT_NOT_OK ( status . getStatus ( ) ) ; <nl> - ASSERT_EQ ( status . getStatus ( ) . code ( ) , ErrorCodes : : QueryFeatureNotAllowed ) ; <nl> - } <nl> - <nl> - TEST ( ExpressionWithPlaceholderTest , JSONSchemaExpressionFailsToParse ) { <nl> - boost : : intrusive_ptr < ExpressionContextForTest > expCtx ( new ExpressionContextForTest ( ) ) ; <nl> - auto rawFilter = fromjson ( " { $ jsonSchema : { } } " ) ; <nl> - auto status = ExpressionWithPlaceholder : : parse ( rawFilter , expCtx ) ; <nl> - ASSERT_NOT_OK ( status . getStatus ( ) ) ; <nl> - ASSERT_EQ ( status . getStatus ( ) . code ( ) , ErrorCodes : : QueryFeatureNotAllowed ) ; <nl> + ASSERT_EQ ( status . getStatus ( ) . code ( ) , ErrorCodes : : BadValue ) ; <nl> } <nl> <nl> TEST ( ExpressionWithPlaceholderTest , EquivalentIfPlaceholderAndExpressionMatch ) { <nl> boost : : intrusive_ptr < ExpressionContextForTest > expCtx ( new ExpressionContextForTest ( ) ) ; <nl> auto rawFilter1 = fromjson ( " { i : 5 } } " ) ; <nl> - auto expressionWithPlaceholder1 = ExpressionWithPlaceholder : : parse ( rawFilter1 , expCtx ) ; <nl> + auto parsedFilter1 = assertGet ( MatchExpressionParser : : parse ( rawFilter1 , expCtx ) ) ; <nl> + auto expressionWithPlaceholder1 = ExpressionWithPlaceholder : : make ( std : : move ( parsedFilter1 ) ) ; <nl> ASSERT_OK ( expressionWithPlaceholder1 . getStatus ( ) ) ; <nl> <nl> auto rawFilter2 = fromjson ( " { i : 5 } " ) ; <nl> - auto expressionWithPlaceholder2 = ExpressionWithPlaceholder : : parse ( rawFilter2 , expCtx ) ; <nl> + auto parsedFilter2 = assertGet ( MatchExpressionParser : : parse ( rawFilter2 , expCtx ) ) ; <nl> + auto expressionWithPlaceholder2 = ExpressionWithPlaceholder : : make ( std : : move ( parsedFilter2 ) ) ; <nl> ASSERT_OK ( expressionWithPlaceholder2 . getStatus ( ) ) ; <nl> ASSERT_TRUE ( expressionWithPlaceholder1 . getValue ( ) - > equivalent ( <nl> expressionWithPlaceholder2 . getValue ( ) . get ( ) ) ) ; <nl> TEST ( ExpressionWithPlaceholderTest , EquivalentIfPlaceholderAndExpressionMatch ) { <nl> TEST ( ExpressionWithPlaceholderTest , EmptyMatchExpressionsAreEquivalent ) { <nl> boost : : intrusive_ptr < ExpressionContextForTest > expCtx ( new ExpressionContextForTest ( ) ) ; <nl> auto rawFilter1 = fromjson ( " { } " ) ; <nl> - auto expressionWithPlaceholder1 = ExpressionWithPlaceholder : : parse ( rawFilter1 , expCtx ) ; <nl> + auto parsedFilter1 = assertGet ( MatchExpressionParser : : parse ( rawFilter1 , expCtx ) ) ; <nl> + auto expressionWithPlaceholder1 = ExpressionWithPlaceholder : : make ( std : : move ( parsedFilter1 ) ) ; <nl> ASSERT_OK ( expressionWithPlaceholder1 . getStatus ( ) ) ; <nl> <nl> auto rawFilter2 = fromjson ( " { } " ) ; <nl> - auto expressionWithPlaceholder2 = ExpressionWithPlaceholder : : parse ( rawFilter2 , expCtx ) ; <nl> + auto parsedFilter2 = assertGet ( MatchExpressionParser : : parse ( rawFilter2 , expCtx ) ) ; <nl> + auto expressionWithPlaceholder2 = ExpressionWithPlaceholder : : make ( std : : move ( parsedFilter2 ) ) ; <nl> ASSERT_OK ( expressionWithPlaceholder2 . getStatus ( ) ) ; <nl> - ASSERT ( expressionWithPlaceholder1 . getValue ( ) - > equivalent ( <nl> + ASSERT_TRUE ( expressionWithPlaceholder1 . getValue ( ) - > equivalent ( <nl> expressionWithPlaceholder2 . getValue ( ) . get ( ) ) ) ; <nl> } <nl> <nl> TEST ( ExpressionWithPlaceholderTest , NestedEmptyMatchExpressionsAreEquivalent ) { <nl> boost : : intrusive_ptr < ExpressionContextForTest > expCtx ( new ExpressionContextForTest ( ) ) ; <nl> auto rawFilter1 = fromjson ( " { $ or : [ { $ and : [ { } ] } ] } " ) ; <nl> - auto expressionWithPlaceholder1 = ExpressionWithPlaceholder : : parse ( rawFilter1 , expCtx ) ; <nl> + auto parsedFilter1 = assertGet ( MatchExpressionParser : : parse ( rawFilter1 , expCtx ) ) ; <nl> + auto expressionWithPlaceholder1 = ExpressionWithPlaceholder : : make ( std : : move ( parsedFilter1 ) ) ; <nl> ASSERT_OK ( expressionWithPlaceholder1 . getStatus ( ) ) ; <nl> <nl> auto rawFilter2 = fromjson ( " { $ or : [ { $ and : [ { } ] } ] } " ) ; <nl> - auto expressionWithPlaceholder2 = ExpressionWithPlaceholder : : parse ( rawFilter2 , expCtx ) ; <nl> + auto parsedFilter2 = assertGet ( MatchExpressionParser : : parse ( rawFilter2 , expCtx ) ) ; <nl> + auto expressionWithPlaceholder2 = ExpressionWithPlaceholder : : make ( std : : move ( parsedFilter2 ) ) ; <nl> ASSERT_OK ( expressionWithPlaceholder2 . getStatus ( ) ) ; <nl> - ASSERT ( expressionWithPlaceholder1 . getValue ( ) - > equivalent ( <nl> + ASSERT_TRUE ( expressionWithPlaceholder1 . getValue ( ) - > equivalent ( <nl> expressionWithPlaceholder2 . getValue ( ) . get ( ) ) ) ; <nl> } <nl> <nl> TEST ( ExpressionWithPlaceholderTest , SameObjectMatchesAreEquivalent ) { <nl> boost : : intrusive_ptr < ExpressionContextForTest > expCtx ( new ExpressionContextForTest ( ) ) ; <nl> auto rawFilter1 = <nl> fromjson ( " { a : { $ _internalSchemaObjectMatch : { $ _internalSchemaMaxProperties : 2 } } } " ) ; <nl> - auto expressionWithPlaceholder1 = ExpressionWithPlaceholder : : parse ( rawFilter1 , expCtx ) ; <nl> + auto parsedFilter1 = assertGet ( MatchExpressionParser : : parse ( rawFilter1 , expCtx ) ) ; <nl> + auto expressionWithPlaceholder1 = ExpressionWithPlaceholder : : make ( std : : move ( parsedFilter1 ) ) ; <nl> ASSERT_OK ( expressionWithPlaceholder1 . getStatus ( ) ) ; <nl> <nl> auto rawFilter2 = <nl> fromjson ( " { a : { $ _internalSchemaObjectMatch : { $ _internalSchemaMaxProperties : 2 } } } " ) ; <nl> - auto expressionWithPlaceholder2 = ExpressionWithPlaceholder : : parse ( rawFilter2 , expCtx ) ; <nl> + auto parsedFilter2 = assertGet ( MatchExpressionParser : : parse ( rawFilter2 , expCtx ) ) ; <nl> + auto expressionWithPlaceholder2 = ExpressionWithPlaceholder : : make ( std : : move ( parsedFilter2 ) ) ; <nl> ASSERT_OK ( expressionWithPlaceholder2 . getStatus ( ) ) ; <nl> - ASSERT ( expressionWithPlaceholder1 . getValue ( ) - > equivalent ( <nl> + ASSERT_TRUE ( expressionWithPlaceholder1 . getValue ( ) - > equivalent ( <nl> expressionWithPlaceholder2 . getValue ( ) . get ( ) ) ) ; <nl> } <nl> <nl> TEST ( ExpressionWithPlaceholderTest , AlwaysTruesAreEquivalent ) { <nl> boost : : intrusive_ptr < ExpressionContextForTest > expCtx ( new ExpressionContextForTest ( ) ) ; <nl> auto rawFilter1 = BSON ( AlwaysTrueMatchExpression : : kName < < 1 ) ; <nl> - auto expressionWithPlaceholder1 = ExpressionWithPlaceholder : : parse ( rawFilter1 , expCtx ) ; <nl> + auto parsedFilter1 = assertGet ( MatchExpressionParser : : parse ( rawFilter1 , expCtx ) ) ; <nl> + auto expressionWithPlaceholder1 = ExpressionWithPlaceholder : : make ( std : : move ( parsedFilter1 ) ) ; <nl> ASSERT_OK ( expressionWithPlaceholder1 . getStatus ( ) ) ; <nl> <nl> auto rawFilter2 = BSON ( AlwaysTrueMatchExpression : : kName < < 1 ) ; <nl> - auto expressionWithPlaceholder2 = ExpressionWithPlaceholder : : parse ( rawFilter2 , expCtx ) ; <nl> + auto parsedFilter2 = assertGet ( MatchExpressionParser : : parse ( rawFilter2 , expCtx ) ) ; <nl> + auto expressionWithPlaceholder2 = ExpressionWithPlaceholder : : make ( std : : move ( parsedFilter2 ) ) ; <nl> ASSERT_OK ( expressionWithPlaceholder2 . getStatus ( ) ) ; <nl> - ASSERT ( expressionWithPlaceholder1 . getValue ( ) - > equivalent ( <nl> + ASSERT_TRUE ( expressionWithPlaceholder1 . getValue ( ) - > equivalent ( <nl> expressionWithPlaceholder2 . getValue ( ) . get ( ) ) ) ; <nl> } <nl> <nl> TEST ( ExpressionWithPlaceholderTest , NotEquivalentIfPlaceholderDoesNotMatch ) { <nl> boost : : intrusive_ptr < ExpressionContextForTest > expCtx ( new ExpressionContextForTest ( ) ) ; <nl> auto rawFilter1 = fromjson ( " { i : { $ type : ' array ' } } " ) ; <nl> - auto expressionWithPlaceholder1 = ExpressionWithPlaceholder : : parse ( rawFilter1 , expCtx ) ; <nl> + auto parsedFilter1 = assertGet ( MatchExpressionParser : : parse ( rawFilter1 , expCtx ) ) ; <nl> + auto expressionWithPlaceholder1 = ExpressionWithPlaceholder : : make ( std : : move ( parsedFilter1 ) ) ; <nl> ASSERT_OK ( expressionWithPlaceholder1 . getStatus ( ) ) ; <nl> <nl> auto rawFilter2 = fromjson ( " { j : { $ type : ' array ' } } " ) ; <nl> - auto expressionWithPlaceholder2 = ExpressionWithPlaceholder : : parse ( rawFilter2 , expCtx ) ; <nl> + auto parsedFilter2 = assertGet ( MatchExpressionParser : : parse ( rawFilter2 , expCtx ) ) ; <nl> + auto expressionWithPlaceholder2 = ExpressionWithPlaceholder : : make ( std : : move ( parsedFilter2 ) ) ; <nl> ASSERT_OK ( expressionWithPlaceholder2 . getStatus ( ) ) ; <nl> ASSERT_FALSE ( expressionWithPlaceholder1 . getValue ( ) - > equivalent ( <nl> expressionWithPlaceholder2 . getValue ( ) . get ( ) ) ) ; <nl> TEST ( ExpressionWithPlaceholderTest , NotEquivalentIfPlaceholderDoesNotMatch ) { <nl> TEST ( ExpressionWithPlaceholder , NotEquivalentIfOnePlaceholderIsEmpty ) { <nl> boost : : intrusive_ptr < ExpressionContextForTest > expCtx ( new ExpressionContextForTest ( ) ) ; <nl> auto rawFilter1 = fromjson ( " { } " ) ; <nl> - auto expressionWithPlaceholder1 = ExpressionWithPlaceholder : : parse ( rawFilter1 , expCtx ) ; <nl> + auto parsedFilter1 = assertGet ( MatchExpressionParser : : parse ( rawFilter1 , expCtx ) ) ; <nl> + auto expressionWithPlaceholder1 = ExpressionWithPlaceholder : : make ( std : : move ( parsedFilter1 ) ) ; <nl> ASSERT_OK ( expressionWithPlaceholder1 . getStatus ( ) ) ; <nl> <nl> auto rawFilter2 = fromjson ( " { i : 5 } " ) ; <nl> - auto expressionWithPlaceholder2 = ExpressionWithPlaceholder : : parse ( rawFilter2 , expCtx ) ; <nl> + auto parsedFilter2 = assertGet ( MatchExpressionParser : : parse ( rawFilter2 , expCtx ) ) ; <nl> + auto expressionWithPlaceholder2 = ExpressionWithPlaceholder : : make ( std : : move ( parsedFilter2 ) ) ; <nl> ASSERT_OK ( expressionWithPlaceholder2 . getStatus ( ) ) ; <nl> ASSERT_FALSE ( expressionWithPlaceholder1 . getValue ( ) - > equivalent ( <nl> expressionWithPlaceholder2 . getValue ( ) . get ( ) ) ) ; <nl> TEST ( ExpressionWithPlaceholder , NotEquivalentIfOnePlaceholderIsEmpty ) { <nl> TEST ( ExpressionWithPlaceholderTest , NotEquivalentIfExpressionDoesNotMatch ) { <nl> boost : : intrusive_ptr < ExpressionContextForTest > expCtx ( new ExpressionContextForTest ( ) ) ; <nl> auto rawFilter1 = fromjson ( " { i : { $ lte : 5 } } " ) ; <nl> - auto expressionWithPlaceholder1 = ExpressionWithPlaceholder : : parse ( rawFilter1 , expCtx ) ; <nl> + auto parsedFilter1 = assertGet ( MatchExpressionParser : : parse ( rawFilter1 , expCtx ) ) ; <nl> + auto expressionWithPlaceholder1 = ExpressionWithPlaceholder : : make ( std : : move ( parsedFilter1 ) ) ; <nl> ASSERT_OK ( expressionWithPlaceholder1 . getStatus ( ) ) ; <nl> <nl> auto rawFilter2 = fromjson ( " { i : { $ gte : 5 } } " ) ; <nl> - auto expressionWithPlaceholder2 = ExpressionWithPlaceholder : : parse ( rawFilter2 , expCtx ) ; <nl> + auto parsedFilter2 = assertGet ( MatchExpressionParser : : parse ( rawFilter2 , expCtx ) ) ; <nl> + auto expressionWithPlaceholder2 = ExpressionWithPlaceholder : : make ( std : : move ( parsedFilter2 ) ) ; <nl> ASSERT_OK ( expressionWithPlaceholder2 . getStatus ( ) ) ; <nl> ASSERT_FALSE ( expressionWithPlaceholder1 . getValue ( ) - > equivalent ( <nl> expressionWithPlaceholder2 . getValue ( ) . get ( ) ) ) ; <nl> mmm a / src / mongo / db / matcher / schema / expression_parser_schema_test . cpp <nl> ppp b / src / mongo / db / matcher / schema / expression_parser_schema_test . cpp <nl> TEST ( MatchExpressionParserSchemaTest , ObjectMatchSubExprRejectsTopLevelOperators <nl> " } } } " ) ; <nl> boost : : intrusive_ptr < ExpressionContextForTest > expCtx ( new ExpressionContextForTest ( ) ) ; <nl> auto result = MatchExpressionParser : : parse ( query , expCtx ) ; <nl> - ASSERT_EQ ( result . getStatus ( ) , ErrorCodes : : BadValue ) ; <nl> + ASSERT_EQ ( result . getStatus ( ) , ErrorCodes : : FailedToParse ) ; <nl> } <nl> <nl> / / <nl> TEST ( MatchExpressionParserSchemaTest , RootDocEqMustBeTopLevel ) { <nl> auto query = fromjson ( " { a : { $ _internalSchemaRootDocEq : 1 } } " ) ; <nl> boost : : intrusive_ptr < ExpressionContextForTest > expCtx ( new ExpressionContextForTest ( ) ) ; <nl> auto rootDocEq = MatchExpressionParser : : parse ( query , expCtx ) ; <nl> - ASSERT_EQ ( rootDocEq . getStatus ( ) , ErrorCodes : : BadValue ) ; <nl> + ASSERT_EQ ( rootDocEq . getStatus ( ) , ErrorCodes : : FailedToParse ) ; <nl> <nl> query = fromjson ( " { $ or : [ { a : 1 } , { $ _internalSchemaRootDocEq : 1 } ] } " ) ; <nl> rootDocEq = MatchExpressionParser : : parse ( query , expCtx ) ; <nl> TEST ( MatchExpressionParserSchemaTest , RootDocEqMustBeTopLevel ) { <nl> <nl> query = fromjson ( " { a : { $ elemMatch : { $ _internalSchemaRootDocEq : 1 } } } " ) ; <nl> rootDocEq = MatchExpressionParser : : parse ( query , expCtx ) ; <nl> - ASSERT_EQ ( rootDocEq . getStatus ( ) , ErrorCodes : : BadValue ) ; <nl> + ASSERT_EQ ( rootDocEq . getStatus ( ) , ErrorCodes : : FailedToParse ) ; <nl> } <nl> <nl> TEST ( MatchExpressionParserSchemaTest , RootDocEqParsesSuccessfully ) { <nl> mmm a / src / mongo / db / ops / parsed_update . cpp <nl> ppp b / src / mongo / db / ops / parsed_update . cpp <nl> Status ParsedUpdate : : parseArrayFilters ( ) { <nl> for ( auto rawArrayFilter : _request - > getArrayFilters ( ) ) { <nl> boost : : intrusive_ptr < ExpressionContext > expCtx ( <nl> new ExpressionContext ( _opCtx , _collator . get ( ) ) ) ; <nl> - auto arrayFilterStatus = <nl> - ExpressionWithPlaceholder : : parse ( rawArrayFilter , std : : move ( expCtx ) ) ; <nl> - if ( ! arrayFilterStatus . isOK ( ) ) { <nl> - return Status ( arrayFilterStatus . getStatus ( ) . code ( ) , <nl> + auto parsedArrayFilter = <nl> + MatchExpressionParser : : parse ( rawArrayFilter , <nl> + std : : move ( expCtx ) , <nl> + ExtensionsCallbackNoop ( ) , <nl> + MatchExpressionParser : : kBanAllSpecialFeatures ) ; <nl> + if ( ! parsedArrayFilter . isOK ( ) ) { <nl> + return Status ( parsedArrayFilter . getStatus ( ) . code ( ) , <nl> str : : stream ( ) < < " Error parsing array filter : " <nl> - < < arrayFilterStatus . getStatus ( ) . reason ( ) ) ; <nl> + < < parsedArrayFilter . getStatus ( ) . reason ( ) ) ; <nl> } <nl> - auto arrayFilter = std : : move ( arrayFilterStatus . getValue ( ) ) ; <nl> - auto fieldName = arrayFilter - > getPlaceholder ( ) ; <nl> + auto parsedArrayFilterWithPlaceholder = <nl> + ExpressionWithPlaceholder : : make ( std : : move ( parsedArrayFilter . getValue ( ) ) ) ; <nl> + if ( ! parsedArrayFilterWithPlaceholder . isOK ( ) ) { <nl> + return Status ( parsedArrayFilterWithPlaceholder . getStatus ( ) . code ( ) , <nl> + str : : stream ( ) < < " Error parsing array filter : " <nl> + < < parsedArrayFilterWithPlaceholder . getStatus ( ) . reason ( ) ) ; <nl> + } <nl> + auto finalArrayFilter = std : : move ( parsedArrayFilterWithPlaceholder . getValue ( ) ) ; <nl> + auto fieldName = finalArrayFilter - > getPlaceholder ( ) ; <nl> if ( ! fieldName ) { <nl> return Status ( <nl> ErrorCodes : : FailedToParse , <nl> Status ParsedUpdate : : parseArrayFilters ( ) { <nl> < < * fieldName ) ; <nl> } <nl> <nl> - _arrayFilters [ * fieldName ] = std : : move ( arrayFilter ) ; <nl> + _arrayFilters [ * fieldName ] = std : : move ( finalArrayFilter ) ; <nl> } <nl> <nl> return Status : : OK ( ) ; <nl> mmm a / src / mongo / db / update / update_array_node_test . cpp <nl> ppp b / src / mongo / db / update / update_array_node_test . cpp <nl> <nl> # include " mongo / bson / mutable / algorithm . h " <nl> # include " mongo / bson / mutable / mutable_bson_test_utils . h " <nl> # include " mongo / db / json . h " <nl> + # include " mongo / db / matcher / expression_parser . h " <nl> # include " mongo / db / pipeline / expression_context_for_test . h " <nl> # include " mongo / db / update / update_node_test_fixture . h " <nl> # include " mongo / db / update / update_object_node . h " <nl> namespace { <nl> <nl> using UpdateArrayNodeTest = UpdateNodeTest ; <nl> using mongo : : mutablebson : : Element ; <nl> + using unittest : : assertGet ; <nl> <nl> TEST_F ( UpdateArrayNodeTest , ApplyCreatePathFails ) { <nl> auto update = fromjson ( " { $ set : { ' a . b . $ [ i ] ' : 0 } } " ) ; <nl> auto arrayFilter = fromjson ( " { i : 0 } " ) ; <nl> boost : : intrusive_ptr < ExpressionContextForTest > expCtx ( new ExpressionContextForTest ( ) ) ; <nl> std : : map < StringData , std : : unique_ptr < ExpressionWithPlaceholder > > arrayFilters ; <nl> - arrayFilters [ " i " ] = uassertStatusOK ( ExpressionWithPlaceholder : : parse ( arrayFilter , expCtx ) ) ; <nl> + auto parsedFilter = assertGet ( MatchExpressionParser : : parse ( arrayFilter , expCtx ) ) ; <nl> + arrayFilters [ " i " ] = assertGet ( ExpressionWithPlaceholder : : make ( std : : move ( parsedFilter ) ) ) ; <nl> std : : set < std : : string > foundIdentifiers ; <nl> UpdateObjectNode root ; <nl> ASSERT_OK ( UpdateObjectNode : : parseAndMerge ( & root , <nl> TEST_F ( UpdateArrayNodeTest , ApplyToNonArrayFails ) { <nl> auto arrayFilter = fromjson ( " { i : 0 } " ) ; <nl> boost : : intrusive_ptr < ExpressionContextForTest > expCtx ( new ExpressionContextForTest ( ) ) ; <nl> std : : map < StringData , std : : unique_ptr < ExpressionWithPlaceholder > > arrayFilters ; <nl> - arrayFilters [ " i " ] = uassertStatusOK ( ExpressionWithPlaceholder : : parse ( arrayFilter , expCtx ) ) ; <nl> + auto parsedFilter = assertGet ( MatchExpressionParser : : parse ( arrayFilter , expCtx ) ) ; <nl> + arrayFilters [ " i " ] = assertGet ( ExpressionWithPlaceholder : : make ( std : : move ( parsedFilter ) ) ) ; <nl> std : : set < std : : string > foundIdentifiers ; <nl> UpdateObjectNode root ; <nl> ASSERT_OK ( UpdateObjectNode : : parseAndMerge ( & root , <nl> TEST_F ( UpdateArrayNodeTest , UpdateIsAppliedToAllMatchingElements ) { <nl> auto arrayFilter = fromjson ( " { i : 0 } " ) ; <nl> boost : : intrusive_ptr < ExpressionContextForTest > expCtx ( new ExpressionContextForTest ( ) ) ; <nl> std : : map < StringData , std : : unique_ptr < ExpressionWithPlaceholder > > arrayFilters ; <nl> - arrayFilters [ " i " ] = uassertStatusOK ( ExpressionWithPlaceholder : : parse ( arrayFilter , expCtx ) ) ; <nl> + auto parsedFilter = assertGet ( MatchExpressionParser : : parse ( arrayFilter , expCtx ) ) ; <nl> + arrayFilters [ " i " ] = assertGet ( ExpressionWithPlaceholder : : make ( std : : move ( parsedFilter ) ) ) ; <nl> std : : set < std : : string > foundIdentifiers ; <nl> UpdateObjectNode root ; <nl> ASSERT_OK ( UpdateObjectNode : : parseAndMerge ( & root , <nl> DEATH_TEST_F ( UpdateArrayNodeTest , <nl> auto arrayFilter = fromjson ( " { ' i . c ' : 0 } " ) ; <nl> boost : : intrusive_ptr < ExpressionContextForTest > expCtx ( new ExpressionContextForTest ( ) ) ; <nl> std : : map < StringData , std : : unique_ptr < ExpressionWithPlaceholder > > arrayFilters ; <nl> - arrayFilters [ " i " ] = uassertStatusOK ( ExpressionWithPlaceholder : : parse ( arrayFilter , expCtx ) ) ; <nl> + auto parsedFilter = assertGet ( MatchExpressionParser : : parse ( arrayFilter , expCtx ) ) ; <nl> + arrayFilters [ " i " ] = assertGet ( ExpressionWithPlaceholder : : make ( std : : move ( parsedFilter ) ) ) ; <nl> std : : set < std : : string > foundIdentifiers ; <nl> UpdateObjectNode root ; <nl> ASSERT_OK ( UpdateObjectNode : : parseAndMerge ( & root , <nl> TEST_F ( UpdateArrayNodeTest , ApplyMultipleUpdatesToArrayElement ) { <nl> auto arrayFilterK = fromjson ( " { ' k . d ' : 0 } " ) ; <nl> boost : : intrusive_ptr < ExpressionContextForTest > expCtx ( new ExpressionContextForTest ( ) ) ; <nl> std : : map < StringData , std : : unique_ptr < ExpressionWithPlaceholder > > arrayFilters ; <nl> - arrayFilters [ " i " ] = uassertStatusOK ( ExpressionWithPlaceholder : : parse ( arrayFilterI , expCtx ) ) ; <nl> - arrayFilters [ " j " ] = uassertStatusOK ( ExpressionWithPlaceholder : : parse ( arrayFilterJ , expCtx ) ) ; <nl> - arrayFilters [ " k " ] = uassertStatusOK ( ExpressionWithPlaceholder : : parse ( arrayFilterK , expCtx ) ) ; <nl> + <nl> + auto parsedFilterI = assertGet ( MatchExpressionParser : : parse ( arrayFilterI , expCtx ) ) ; <nl> + auto parsedFilterJ = assertGet ( MatchExpressionParser : : parse ( arrayFilterJ , expCtx ) ) ; <nl> + auto parsedFilterK = assertGet ( MatchExpressionParser : : parse ( arrayFilterK , expCtx ) ) ; <nl> + <nl> + arrayFilters [ " i " ] = assertGet ( ExpressionWithPlaceholder : : make ( std : : move ( parsedFilterI ) ) ) ; <nl> + arrayFilters [ " j " ] = assertGet ( ExpressionWithPlaceholder : : make ( std : : move ( parsedFilterJ ) ) ) ; <nl> + arrayFilters [ " k " ] = assertGet ( ExpressionWithPlaceholder : : make ( std : : move ( parsedFilterK ) ) ) ; <nl> + <nl> std : : set < std : : string > foundIdentifiers ; <nl> UpdateObjectNode root ; <nl> ASSERT_OK ( UpdateObjectNode : : parseAndMerge ( & root , <nl> TEST_F ( UpdateArrayNodeTest , ApplyMultipleUpdatesToArrayElementsUsingMergedChildr <nl> auto arrayFilterJ = fromjson ( " { ' j . c ' : 0 } " ) ; <nl> boost : : intrusive_ptr < ExpressionContextForTest > expCtx ( new ExpressionContextForTest ( ) ) ; <nl> std : : map < StringData , std : : unique_ptr < ExpressionWithPlaceholder > > arrayFilters ; <nl> - arrayFilters [ " i " ] = uassertStatusOK ( ExpressionWithPlaceholder : : parse ( arrayFilterI , expCtx ) ) ; <nl> - arrayFilters [ " j " ] = uassertStatusOK ( ExpressionWithPlaceholder : : parse ( arrayFilterJ , expCtx ) ) ; <nl> + <nl> + auto parsedFilterI = assertGet ( MatchExpressionParser : : parse ( arrayFilterI , expCtx ) ) ; <nl> + auto parsedFilterJ = assertGet ( MatchExpressionParser : : parse ( arrayFilterJ , expCtx ) ) ; <nl> + <nl> + arrayFilters [ " i " ] = assertGet ( ExpressionWithPlaceholder : : make ( std : : move ( parsedFilterI ) ) ) ; <nl> + arrayFilters [ " j " ] = assertGet ( ExpressionWithPlaceholder : : make ( std : : move ( parsedFilterJ ) ) ) ; <nl> + <nl> std : : set < std : : string > foundIdentifiers ; <nl> UpdateObjectNode root ; <nl> ASSERT_OK ( UpdateObjectNode : : parseAndMerge ( & root , <nl> TEST_F ( UpdateArrayNodeTest , ApplyMultipleUpdatesToArrayElementsWithoutMergedChil <nl> auto arrayFilterK = fromjson ( " { ' k . d ' : 0 } " ) ; <nl> boost : : intrusive_ptr < ExpressionContextForTest > expCtx ( new ExpressionContextForTest ( ) ) ; <nl> std : : map < StringData , std : : unique_ptr < ExpressionWithPlaceholder > > arrayFilters ; <nl> - arrayFilters [ " i " ] = uassertStatusOK ( ExpressionWithPlaceholder : : parse ( arrayFilterI , expCtx ) ) ; <nl> - arrayFilters [ " j " ] = uassertStatusOK ( ExpressionWithPlaceholder : : parse ( arrayFilterJ , expCtx ) ) ; <nl> - arrayFilters [ " k " ] = uassertStatusOK ( ExpressionWithPlaceholder : : parse ( arrayFilterK , expCtx ) ) ; <nl> + <nl> + auto parsedFilterI = assertGet ( MatchExpressionParser : : parse ( arrayFilterI , expCtx ) ) ; <nl> + auto parsedFilterJ = assertGet ( MatchExpressionParser : : parse ( arrayFilterJ , expCtx ) ) ; <nl> + auto parsedFilterK = assertGet ( MatchExpressionParser : : parse ( arrayFilterK , expCtx ) ) ; <nl> + <nl> + arrayFilters [ " i " ] = assertGet ( ExpressionWithPlaceholder : : make ( std : : move ( parsedFilterI ) ) ) ; <nl> + arrayFilters [ " j " ] = assertGet ( ExpressionWithPlaceholder : : make ( std : : move ( parsedFilterJ ) ) ) ; <nl> + arrayFilters [ " k " ] = assertGet ( ExpressionWithPlaceholder : : make ( std : : move ( parsedFilterK ) ) ) ; <nl> + <nl> std : : set < std : : string > foundIdentifiers ; <nl> UpdateObjectNode root ; <nl> ASSERT_OK ( UpdateObjectNode : : parseAndMerge ( & root , <nl> TEST_F ( UpdateArrayNodeTest , ApplyNestedArrayUpdates ) { <nl> auto arrayFilterL = fromjson ( " { ' l . d ' : 0 } " ) ; <nl> boost : : intrusive_ptr < ExpressionContextForTest > expCtx ( new ExpressionContextForTest ( ) ) ; <nl> std : : map < StringData , std : : unique_ptr < ExpressionWithPlaceholder > > arrayFilters ; <nl> - arrayFilters [ " i " ] = uassertStatusOK ( ExpressionWithPlaceholder : : parse ( arrayFilterI , expCtx ) ) ; <nl> - arrayFilters [ " j " ] = uassertStatusOK ( ExpressionWithPlaceholder : : parse ( arrayFilterJ , expCtx ) ) ; <nl> - arrayFilters [ " k " ] = uassertStatusOK ( ExpressionWithPlaceholder : : parse ( arrayFilterK , expCtx ) ) ; <nl> - arrayFilters [ " l " ] = uassertStatusOK ( ExpressionWithPlaceholder : : parse ( arrayFilterL , expCtx ) ) ; <nl> + <nl> + auto parsedFilterI = assertGet ( MatchExpressionParser : : parse ( arrayFilterI , expCtx <nl> + <nl> + ) ) ; <nl> + auto parsedFilterJ = assertGet ( MatchExpressionParser : : parse ( arrayFilterJ , expCtx <nl> + <nl> + ) ) ; <nl> + auto parsedFilterK = assertGet ( MatchExpressionParser : : parse ( arrayFilterK , expCtx <nl> + <nl> + ) ) ; <nl> + auto parsedFilterL = assertGet ( MatchExpressionParser : : parse ( arrayFilterL , expCtx <nl> + <nl> + ) ) ; <nl> + <nl> + arrayFilters [ " i " ] = assertGet ( ExpressionWithPlaceholder : : make ( std : : move ( parsedFilterI ) ) ) ; <nl> + arrayFilters [ " j " ] = assertGet ( ExpressionWithPlaceholder : : make ( std : : move ( parsedFilterJ ) ) ) ; <nl> + arrayFilters [ " k " ] = assertGet ( ExpressionWithPlaceholder : : make ( std : : move ( parsedFilterK ) ) ) ; <nl> + arrayFilters [ " l " ] = assertGet ( ExpressionWithPlaceholder : : make ( std : : move ( parsedFilterL ) ) ) ; <nl> + <nl> std : : set < std : : string > foundIdentifiers ; <nl> UpdateObjectNode root ; <nl> ASSERT_OK ( UpdateObjectNode : : parseAndMerge ( & root , <nl> TEST_F ( UpdateArrayNodeTest , ApplyUpdatesWithMergeConflictToArrayElementFails ) { <nl> auto arrayFilterJ = fromjson ( " { ' j ' : 0 } " ) ; <nl> boost : : intrusive_ptr < ExpressionContextForTest > expCtx ( new ExpressionContextForTest ( ) ) ; <nl> std : : map < StringData , std : : unique_ptr < ExpressionWithPlaceholder > > arrayFilters ; <nl> - arrayFilters [ " i " ] = uassertStatusOK ( ExpressionWithPlaceholder : : parse ( arrayFilterI , expCtx ) ) ; <nl> - arrayFilters [ " j " ] = uassertStatusOK ( ExpressionWithPlaceholder : : parse ( arrayFilterJ , expCtx ) ) ; <nl> + <nl> + auto parsedFilterI = assertGet ( MatchExpressionParser : : parse ( arrayFilterI , expCtx <nl> + <nl> + ) ) ; <nl> + auto parsedFilterJ = assertGet ( MatchExpressionParser : : parse ( arrayFilterJ , expCtx <nl> + <nl> + ) ) ; <nl> + <nl> + arrayFilters [ " i " ] = assertGet ( ExpressionWithPlaceholder : : make ( std : : move ( parsedFilterI ) ) ) ; <nl> + arrayFilters [ " j " ] = assertGet ( ExpressionWithPlaceholder : : make ( std : : move ( parsedFilterJ ) ) ) ; <nl> + <nl> std : : set < std : : string > foundIdentifiers ; <nl> UpdateObjectNode root ; <nl> ASSERT_OK ( UpdateObjectNode : : parseAndMerge ( & root , <nl> TEST_F ( UpdateArrayNodeTest , ApplyUpdatesWithEmptyIdentifiersWithMergeConflictToA <nl> auto arrayFilterJ = fromjson ( " { ' j ' : 0 } " ) ; <nl> boost : : intrusive_ptr < ExpressionContextForTest > expCtx ( new ExpressionContextForTest ( ) ) ; <nl> std : : map < StringData , std : : unique_ptr < ExpressionWithPlaceholder > > arrayFilters ; <nl> - arrayFilters [ " i " ] = uassertStatusOK ( ExpressionWithPlaceholder : : parse ( arrayFilterI , expCtx ) ) ; <nl> - arrayFilters [ " j " ] = uassertStatusOK ( ExpressionWithPlaceholder : : parse ( arrayFilterJ , expCtx ) ) ; <nl> + <nl> + auto parsedFilterI = assertGet ( MatchExpressionParser : : parse ( arrayFilterI , expCtx <nl> + <nl> + ) ) ; <nl> + auto parsedFilterJ = assertGet ( MatchExpressionParser : : parse ( arrayFilterJ , expCtx <nl> + <nl> + ) ) ; <nl> + <nl> + arrayFilters [ " i " ] = assertGet ( ExpressionWithPlaceholder : : make ( std : : move ( parsedFilterI ) ) ) ; <nl> + arrayFilters [ " j " ] = assertGet ( ExpressionWithPlaceholder : : make ( std : : move ( parsedFilterJ ) ) ) ; <nl> + <nl> std : : set < std : : string > foundIdentifiers ; <nl> UpdateObjectNode root ; <nl> ASSERT_OK ( UpdateObjectNode : : parseAndMerge ( & root , <nl> TEST_F ( UpdateArrayNodeTest , ApplyNestedArrayUpdatesWithMergeConflictFails ) { <nl> auto arrayFilterL = fromjson ( " { l : 0 } " ) ; <nl> boost : : intrusive_ptr < ExpressionContextForTest > expCtx ( new ExpressionContextForTest ( ) ) ; <nl> std : : map < StringData , std : : unique_ptr < ExpressionWithPlaceholder > > arrayFilters ; <nl> - arrayFilters [ " i " ] = uassertStatusOK ( ExpressionWithPlaceholder : : parse ( arrayFilterI , expCtx ) ) ; <nl> - arrayFilters [ " j " ] = uassertStatusOK ( ExpressionWithPlaceholder : : parse ( arrayFilterJ , expCtx ) ) ; <nl> - arrayFilters [ " k " ] = uassertStatusOK ( ExpressionWithPlaceholder : : parse ( arrayFilterK , expCtx ) ) ; <nl> - arrayFilters [ " l " ] = uassertStatusOK ( ExpressionWithPlaceholder : : parse ( arrayFilterL , expCtx ) ) ; <nl> + <nl> + auto parsedFilterI = assertGet ( MatchExpressionParser : : parse ( arrayFilterI , expCtx <nl> + <nl> + ) ) ; <nl> + auto parsedFilterJ = assertGet ( MatchExpressionParser : : parse ( arrayFilterJ , expCtx <nl> + <nl> + ) ) ; <nl> + auto parsedFilterK = assertGet ( MatchExpressionParser : : parse ( arrayFilterK , expCtx <nl> + <nl> + ) ) ; <nl> + auto parsedFilterL = assertGet ( MatchExpressionParser : : parse ( arrayFilterL , expCtx <nl> + <nl> + ) ) ; <nl> + <nl> + arrayFilters [ " i " ] = assertGet ( ExpressionWithPlaceholder : : make ( std : : move ( parsedFilterI ) ) ) ; <nl> + arrayFilters [ " j " ] = assertGet ( ExpressionWithPlaceholder : : make ( std : : move ( parsedFilterJ ) ) ) ; <nl> + arrayFilters [ " k " ] = assertGet ( ExpressionWithPlaceholder : : make ( std : : move ( parsedFilterK ) ) ) ; <nl> + arrayFilters [ " l " ] = assertGet ( ExpressionWithPlaceholder : : make ( std : : move ( parsedFilterL ) ) ) ; <nl> + <nl> std : : set < std : : string > foundIdentifiers ; <nl> UpdateObjectNode root ; <nl> ASSERT_OK ( UpdateObjectNode : : parseAndMerge ( & root , <nl> TEST_F ( UpdateArrayNodeTest , NoArrayElementsMatch ) { <nl> auto arrayFilter = fromjson ( " { ' i ' : 0 } " ) ; <nl> boost : : intrusive_ptr < ExpressionContextForTest > expCtx ( new ExpressionContextForTest ( ) ) ; <nl> std : : map < StringData , std : : unique_ptr < ExpressionWithPlaceholder > > arrayFilters ; <nl> - arrayFilters [ " i " ] = uassertStatusOK ( ExpressionWithPlaceholder : : parse ( arrayFilter , expCtx ) ) ; <nl> + auto parsedFilter = assertGet ( MatchExpressionParser : : parse ( arrayFilter , expCtx <nl> + <nl> + ) ) ; <nl> + arrayFilters [ " i " ] = assertGet ( ExpressionWithPlaceholder : : make ( std : : move ( parsedFilter ) ) ) ; <nl> std : : set < std : : string > foundIdentifiers ; <nl> UpdateObjectNode root ; <nl> ASSERT_OK ( UpdateObjectNode : : parseAndMerge ( & root , <nl> TEST_F ( UpdateArrayNodeTest , UpdatesToAllArrayElementsAreNoops ) { <nl> auto arrayFilter = fromjson ( " { ' i ' : 0 } " ) ; <nl> boost : : intrusive_ptr < ExpressionContextForTest > expCtx ( new ExpressionContextForTest ( ) ) ; <nl> std : : map < StringData , std : : unique_ptr < ExpressionWithPlaceholder > > arrayFilters ; <nl> - arrayFilters [ " i " ] = uassertStatusOK ( ExpressionWithPlaceholder : : parse ( arrayFilter , expCtx ) ) ; <nl> + auto parsedFilter = assertGet ( MatchExpressionParser : : parse ( arrayFilter , expCtx <nl> + <nl> + ) ) ; <nl> + arrayFilters [ " i " ] = assertGet ( ExpressionWithPlaceholder : : make ( std : : move ( parsedFilter ) ) ) ; <nl> std : : set < std : : string > foundIdentifiers ; <nl> UpdateObjectNode root ; <nl> ASSERT_OK ( UpdateObjectNode : : parseAndMerge ( & root , <nl> TEST_F ( UpdateArrayNodeTest , NoArrayElementAffectsIndexes ) { <nl> auto arrayFilter = fromjson ( " { ' i . c ' : 0 } " ) ; <nl> boost : : intrusive_ptr < ExpressionContextForTest > expCtx ( new ExpressionContextForTest ( ) ) ; <nl> std : : map < StringData , std : : unique_ptr < ExpressionWithPlaceholder > > arrayFilters ; <nl> - arrayFilters [ " i " ] = uassertStatusOK ( ExpressionWithPlaceholder : : parse ( arrayFilter , expCtx ) ) ; <nl> + auto parsedFilter = assertGet ( MatchExpressionParser : : parse ( arrayFilter , expCtx <nl> + <nl> + ) ) ; <nl> + arrayFilters [ " i " ] = assertGet ( ExpressionWithPlaceholder : : make ( std : : move ( parsedFilter ) ) ) ; <nl> std : : set < std : : string > foundIdentifiers ; <nl> UpdateObjectNode root ; <nl> ASSERT_OK ( UpdateObjectNode : : parseAndMerge ( & root , <nl> TEST_F ( UpdateArrayNodeTest , WhenOneElementIsMatchedLogElementUpdateDirectly ) { <nl> auto arrayFilter = fromjson ( " { ' i . c ' : 0 } " ) ; <nl> boost : : intrusive_ptr < ExpressionContextForTest > expCtx ( new ExpressionContextForTest ( ) ) ; <nl> std : : map < StringData , std : : unique_ptr < ExpressionWithPlaceholder > > arrayFilters ; <nl> - arrayFilters [ " i " ] = uassertStatusOK ( ExpressionWithPlaceholder : : parse ( arrayFilter , expCtx ) ) ; <nl> + auto parsedFilter = assertGet ( MatchExpressionParser : : parse ( arrayFilter , expCtx <nl> + <nl> + ) ) ; <nl> + arrayFilters [ " i " ] = assertGet ( ExpressionWithPlaceholder : : make ( std : : move ( parsedFilter ) ) ) ; <nl> std : : set < std : : string > foundIdentifiers ; <nl> UpdateObjectNode root ; <nl> ASSERT_OK ( UpdateObjectNode : : parseAndMerge ( & root , <nl> TEST_F ( UpdateArrayNodeTest , WhenOneElementIsModifiedLogElement ) { <nl> auto arrayFilter = fromjson ( " { ' i . c ' : 0 } " ) ; <nl> boost : : intrusive_ptr < ExpressionContextForTest > expCtx ( new ExpressionContextForTest ( ) ) ; <nl> std : : map < StringData , std : : unique_ptr < ExpressionWithPlaceholder > > arrayFilters ; <nl> - arrayFilters [ " i " ] = uassertStatusOK ( ExpressionWithPlaceholder : : parse ( arrayFilter , expCtx ) ) ; <nl> + auto parsedFilter = assertGet ( MatchExpressionParser : : parse ( arrayFilter , expCtx <nl> + <nl> + ) ) ; <nl> + arrayFilters [ " i " ] = assertGet ( ExpressionWithPlaceholder : : make ( std : : move ( parsedFilter ) ) ) ; <nl> std : : set < std : : string > foundIdentifiers ; <nl> UpdateObjectNode root ; <nl> ASSERT_OK ( UpdateObjectNode : : parseAndMerge ( & root , <nl> TEST_F ( UpdateArrayNodeTest , ApplyPositionalInsideArrayUpdate ) { <nl> auto arrayFilter = fromjson ( " { ' i . c ' : 0 } " ) ; <nl> boost : : intrusive_ptr < ExpressionContextForTest > expCtx ( new ExpressionContextForTest ( ) ) ; <nl> std : : map < StringData , std : : unique_ptr < ExpressionWithPlaceholder > > arrayFilters ; <nl> - arrayFilters [ " i " ] = uassertStatusOK ( ExpressionWithPlaceholder : : parse ( arrayFilter , expCtx ) ) ; <nl> + auto parsedFilter = assertGet ( MatchExpressionParser : : parse ( arrayFilter , expCtx <nl> + <nl> + ) ) ; <nl> + arrayFilters [ " i " ] = assertGet ( ExpressionWithPlaceholder : : make ( std : : move ( parsedFilter ) ) ) ; <nl> std : : set < std : : string > foundIdentifiers ; <nl> UpdateObjectNode root ; <nl> ASSERT_OK ( UpdateObjectNode : : parseAndMerge ( & root , <nl> TEST_F ( UpdateArrayNodeTest , ApplyArrayUpdateFromReplication ) { <nl> auto arrayFilter = fromjson ( " { ' i ' : 0 } " ) ; <nl> boost : : intrusive_ptr < ExpressionContextForTest > expCtx ( new ExpressionContextForTest ( ) ) ; <nl> std : : map < StringData , std : : unique_ptr < ExpressionWithPlaceholder > > arrayFilters ; <nl> - arrayFilters [ " i " ] = uassertStatusOK ( ExpressionWithPlaceholder : : parse ( arrayFilter , expCtx ) ) ; <nl> + auto parsedFilter = assertGet ( MatchExpressionParser : : parse ( arrayFilter , expCtx <nl> + <nl> + ) ) ; <nl> + arrayFilters [ " i " ] = assertGet ( ExpressionWithPlaceholder : : make ( std : : move ( parsedFilter ) ) ) ; <nl> std : : set < std : : string > foundIdentifiers ; <nl> UpdateObjectNode root ; <nl> ASSERT_OK ( UpdateObjectNode : : parseAndMerge ( & root , <nl> TEST_F ( UpdateArrayNodeTest , ApplyArrayUpdateNotFromReplication ) { <nl> auto arrayFilter = fromjson ( " { ' i ' : 0 } " ) ; <nl> boost : : intrusive_ptr < ExpressionContextForTest > expCtx ( new ExpressionContextForTest ( ) ) ; <nl> std : : map < StringData , std : : unique_ptr < ExpressionWithPlaceholder > > arrayFilters ; <nl> - arrayFilters [ " i " ] = uassertStatusOK ( ExpressionWithPlaceholder : : parse ( arrayFilter , expCtx ) ) ; <nl> + auto parsedFilter = assertGet ( MatchExpressionParser : : parse ( arrayFilter , expCtx <nl> + <nl> + ) ) ; <nl> + arrayFilters [ " i " ] = assertGet ( ExpressionWithPlaceholder : : make ( std : : move ( parsedFilter ) ) ) ; <nl> std : : set < std : : string > foundIdentifiers ; <nl> UpdateObjectNode root ; <nl> ASSERT_OK ( UpdateObjectNode : : parseAndMerge ( & root , <nl> TEST_F ( UpdateArrayNodeTest , ApplyArrayUpdateWithoutLogBuilderOrIndexData ) { <nl> auto arrayFilter = fromjson ( " { ' i ' : 0 } " ) ; <nl> boost : : intrusive_ptr < ExpressionContextForTest > expCtx ( new ExpressionContextForTest ( ) ) ; <nl> std : : map < StringData , std : : unique_ptr < ExpressionWithPlaceholder > > arrayFilters ; <nl> - arrayFilters [ " i " ] = uassertStatusOK ( ExpressionWithPlaceholder : : parse ( arrayFilter , expCtx ) ) ; <nl> + auto parsedFilter = assertGet ( MatchExpressionParser : : parse ( arrayFilter , expCtx <nl> + <nl> + ) ) ; <nl> + arrayFilters [ " i " ] = assertGet ( ExpressionWithPlaceholder : : make ( std : : move ( parsedFilter ) ) ) ; <nl> std : : set < std : : string > foundIdentifiers ; <nl> UpdateObjectNode root ; <nl> ASSERT_OK ( UpdateObjectNode : : parseAndMerge ( & root , <nl> mmm a / src / mongo / db / update / update_object_node_test . cpp <nl> ppp b / src / mongo / db / update / update_object_node_test . cpp <nl> <nl> # include " mongo / bson / mutable / algorithm . h " <nl> # include " mongo / bson / mutable / mutable_bson_test_utils . h " <nl> # include " mongo / db / json . h " <nl> + # include " mongo / db / matcher / expression_parser . h " <nl> # include " mongo / db / pipeline / expression_context_for_test . h " <nl> # include " mongo / db / query / collation / collator_interface_mock . h " <nl> # include " mongo / db / update / conflict_placeholder_node . h " <nl> namespace { <nl> <nl> using UpdateObjectNodeTest = UpdateNodeTest ; <nl> using mongo : : mutablebson : : Element ; <nl> + using unittest : : assertGet ; <nl> <nl> TEST ( UpdateObjectNodeTest , InvalidPathFailsToParse ) { <nl> auto update = fromjson ( " { $ set : { ' ' : 5 } } " ) ; <nl> TEST ( UpdateObjectNodeTest , IdentifierWithArrayFilterParsesSuccessfully ) { <nl> auto arrayFilter = fromjson ( " { i : 0 } " ) ; <nl> boost : : intrusive_ptr < ExpressionContextForTest > expCtx ( new ExpressionContextForTest ( ) ) ; <nl> std : : map < StringData , std : : unique_ptr < ExpressionWithPlaceholder > > arrayFilters ; <nl> - arrayFilters [ " i " ] = uassertStatusOK ( ExpressionWithPlaceholder : : parse ( arrayFilter , expCtx ) ) ; <nl> + auto parsedFilter = assertGet ( MatchExpressionParser : : parse ( arrayFilter , expCtx ) ) ; <nl> + arrayFilters [ " i " ] = assertGet ( ExpressionWithPlaceholder : : make ( std : : move ( parsedFilter ) ) ) ; <nl> std : : set < std : : string > foundIdentifiers ; <nl> UpdateObjectNode root ; <nl> ASSERT_OK ( UpdateObjectNode : : parseAndMerge ( & root , <nl> TEST ( UpdateObjectNodeTest , IdentifierWithArrayFilterInMiddleOfPathParsesSuccessf <nl> auto arrayFilter = fromjson ( " { i : 0 } " ) ; <nl> boost : : intrusive_ptr < ExpressionContextForTest > expCtx ( new ExpressionContextForTest ( ) ) ; <nl> std : : map < StringData , std : : unique_ptr < ExpressionWithPlaceholder > > arrayFilters ; <nl> - arrayFilters [ " i " ] = uassertStatusOK ( ExpressionWithPlaceholder : : parse ( arrayFilter , expCtx ) ) ; <nl> + auto parsedFilter = assertGet ( MatchExpressionParser : : parse ( arrayFilter , expCtx ) ) ; <nl> + arrayFilters [ " i " ] = assertGet ( ExpressionWithPlaceholder : : make ( std : : move ( parsedFilter ) ) ) ; <nl> std : : set < std : : string > foundIdentifiers ; <nl> UpdateObjectNode root ; <nl> ASSERT_OK ( UpdateObjectNode : : parseAndMerge ( & root , <nl> TEST ( UpdateObjectNodeTest , IdentifierInFirstPositionFailsToParse ) { <nl> auto arrayFilter = fromjson ( " { i : 0 } " ) ; <nl> boost : : intrusive_ptr < ExpressionContextForTest > expCtx ( new ExpressionContextForTest ( ) ) ; <nl> std : : map < StringData , std : : unique_ptr < ExpressionWithPlaceholder > > arrayFilters ; <nl> - arrayFilters [ " i " ] = uassertStatusOK ( ExpressionWithPlaceholder : : parse ( arrayFilter , expCtx ) ) ; <nl> + auto parsedFilter = assertGet ( MatchExpressionParser : : parse ( arrayFilter , expCtx ) ) ; <nl> + arrayFilters [ " i " ] = assertGet ( ExpressionWithPlaceholder : : make ( std : : move ( parsedFilter ) ) ) ; <nl> std : : set < std : : string > foundIdentifiers ; <nl> UpdateObjectNode root ; <nl> auto result = UpdateObjectNode : : parseAndMerge ( & root , <nl> TEST ( UpdateObjectNodeTest , IdentifierInFirstPositionWithSuffixFailsToParse ) { <nl> auto arrayFilter = fromjson ( " { i : 0 } " ) ; <nl> boost : : intrusive_ptr < ExpressionContextForTest > expCtx ( new ExpressionContextForTest ( ) ) ; <nl> std : : map < StringData , std : : unique_ptr < ExpressionWithPlaceholder > > arrayFilters ; <nl> - arrayFilters [ " i " ] = uassertStatusOK ( ExpressionWithPlaceholder : : parse ( arrayFilter , expCtx ) ) ; <nl> + auto parsedFilter = assertGet ( MatchExpressionParser : : parse ( arrayFilter , expCtx ) ) ; <nl> + arrayFilters [ " i " ] = assertGet ( ExpressionWithPlaceholder : : make ( std : : move ( parsedFilter ) ) ) ; <nl> std : : set < std : : string > foundIdentifiers ; <nl> UpdateObjectNode root ; <nl> auto result = UpdateObjectNode : : parseAndMerge ( & root , <nl> TEST ( UpdateObjectNodeTest , CreateObjectNodeInSamePositionAsArrayNodeFailsToParse <nl> auto arrayFilter = fromjson ( " { i : 0 } " ) ; <nl> boost : : intrusive_ptr < ExpressionContextForTest > expCtx ( new ExpressionContextForTest ( ) ) ; <nl> std : : map < StringData , std : : unique_ptr < ExpressionWithPlaceholder > > arrayFilters ; <nl> - arrayFilters [ " i " ] = uassertStatusOK ( ExpressionWithPlaceholder : : parse ( arrayFilter , expCtx ) ) ; <nl> + auto parsedFilter = assertGet ( MatchExpressionParser : : parse ( arrayFilter , expCtx ) ) ; <nl> + arrayFilters [ " i " ] = assertGet ( ExpressionWithPlaceholder : : make ( std : : move ( parsedFilter ) ) ) ; <nl> std : : set < std : : string > foundIdentifiers ; <nl> UpdateObjectNode root ; <nl> ASSERT_OK ( UpdateObjectNode : : parseAndMerge ( & root , <nl> TEST ( UpdateObjectNodeTest , CreateArrayNodeInSamePositionAsObjectNodeFailsToParse <nl> auto arrayFilter = fromjson ( " { i : 0 } " ) ; <nl> boost : : intrusive_ptr < ExpressionContextForTest > expCtx ( new ExpressionContextForTest ( ) ) ; <nl> std : : map < StringData , std : : unique_ptr < ExpressionWithPlaceholder > > arrayFilters ; <nl> - arrayFilters [ " i " ] = uassertStatusOK ( ExpressionWithPlaceholder : : parse ( arrayFilter , expCtx ) ) ; <nl> + auto parsedFilter = assertGet ( MatchExpressionParser : : parse ( arrayFilter , expCtx ) ) ; <nl> + arrayFilters [ " i " ] = assertGet ( ExpressionWithPlaceholder : : make ( std : : move ( parsedFilter ) ) ) ; <nl> std : : set < std : : string > foundIdentifiers ; <nl> UpdateObjectNode root ; <nl> ASSERT_OK ( UpdateObjectNode : : parseAndMerge ( & root , <nl> TEST ( UpdateObjectNodeTest , CreateLeafNodeInSamePositionAsArrayNodeFailsToParse ) <nl> auto arrayFilter = fromjson ( " { i : 0 } " ) ; <nl> boost : : intrusive_ptr < ExpressionContextForTest > expCtx ( new ExpressionContextForTest ( ) ) ; <nl> std : : map < StringData , std : : unique_ptr < ExpressionWithPlaceholder > > arrayFilters ; <nl> - arrayFilters [ " i " ] = uassertStatusOK ( ExpressionWithPlaceholder : : parse ( arrayFilter , expCtx ) ) ; <nl> + auto parsedFilter = assertGet ( MatchExpressionParser : : parse ( arrayFilter , expCtx ) ) ; <nl> + arrayFilters [ " i " ] = assertGet ( ExpressionWithPlaceholder : : make ( std : : move ( parsedFilter ) ) ) ; <nl> std : : set < std : : string > foundIdentifiers ; <nl> UpdateObjectNode root ; <nl> ASSERT_OK ( UpdateObjectNode : : parseAndMerge ( & root , <nl> TEST ( UpdateObjectNodeTest , CreateArrayNodeInSamePositionAsLeafNodeFailsToParse ) <nl> auto arrayFilter = fromjson ( " { i : 0 } " ) ; <nl> boost : : intrusive_ptr < ExpressionContextForTest > expCtx ( new ExpressionContextForTest ( ) ) ; <nl> std : : map < StringData , std : : unique_ptr < ExpressionWithPlaceholder > > arrayFilters ; <nl> - arrayFilters [ " i " ] = uassertStatusOK ( ExpressionWithPlaceholder : : parse ( arrayFilter , expCtx ) ) ; <nl> + auto parsedFilter = assertGet ( MatchExpressionParser : : parse ( arrayFilter , expCtx ) ) ; <nl> + arrayFilters [ " i " ] = assertGet ( ExpressionWithPlaceholder : : make ( std : : move ( parsedFilter ) ) ) ; <nl> std : : set < std : : string > foundIdentifiers ; <nl> UpdateObjectNode root ; <nl> ASSERT_OK ( UpdateObjectNode : : parseAndMerge ( & root , <nl> TEST ( UpdateObjectNodeTest , CreateTwoChildrenOfArrayNodeParsesSuccessfully ) { <nl> auto arrayFilterJ = fromjson ( " { j : 0 } " ) ; <nl> boost : : intrusive_ptr < ExpressionContextForTest > expCtx ( new ExpressionContextForTest ( ) ) ; <nl> std : : map < StringData , std : : unique_ptr < ExpressionWithPlaceholder > > arrayFilters ; <nl> - arrayFilters [ " i " ] = uassertStatusOK ( ExpressionWithPlaceholder : : parse ( arrayFilterI , expCtx ) ) ; <nl> - arrayFilters [ " j " ] = uassertStatusOK ( ExpressionWithPlaceholder : : parse ( arrayFilterJ , expCtx ) ) ; <nl> + <nl> + auto parsedFilterI = assertGet ( MatchExpressionParser : : parse ( arrayFilterI , expCtx ) ) ; <nl> + auto parsedFilterJ = assertGet ( MatchExpressionParser : : parse ( arrayFilterJ , expCtx ) ) ; <nl> + <nl> + arrayFilters [ " i " ] = assertGet ( ExpressionWithPlaceholder : : make ( std : : move ( parsedFilterI ) ) ) ; <nl> + arrayFilters [ " j " ] = assertGet ( ExpressionWithPlaceholder : : make ( std : : move ( parsedFilterJ ) ) ) ; <nl> + <nl> std : : set < std : : string > foundIdentifiers ; <nl> UpdateObjectNode root ; <nl> ASSERT_OK ( UpdateObjectNode : : parseAndMerge ( & root , <nl> TEST ( UpdateObjectNodeTest , CreateTwoChildrenOfArrayNodeParsesSuccessfully ) { <nl> TEST ( UpdateObjectNodeTest , ConflictAtArrayNodeChildFailsToParse ) { <nl> auto update1 = fromjson ( " { $ set : { ' a . $ [ i ] ' : 5 } } " ) ; <nl> auto update2 = fromjson ( " { $ set : { ' a . $ [ i ] ' : 6 } } " ) ; <nl> - auto arrayFilterI = fromjson ( " { i : 0 } " ) ; <nl> + auto arrayFilter = fromjson ( " { i : 0 } " ) ; <nl> boost : : intrusive_ptr < ExpressionContextForTest > expCtx ( new ExpressionContextForTest ( ) ) ; <nl> std : : map < StringData , std : : unique_ptr < ExpressionWithPlaceholder > > arrayFilters ; <nl> - arrayFilters [ " i " ] = uassertStatusOK ( ExpressionWithPlaceholder : : parse ( arrayFilterI , expCtx ) ) ; <nl> + auto parsedFilter = assertGet ( MatchExpressionParser : : parse ( arrayFilter , expCtx ) ) ; <nl> + arrayFilters [ " i " ] = assertGet ( ExpressionWithPlaceholder : : make ( std : : move ( parsedFilter ) ) ) ; <nl> std : : set < std : : string > foundIdentifiers ; <nl> UpdateObjectNode root ; <nl> ASSERT_OK ( UpdateObjectNode : : parseAndMerge ( & root , <nl> TEST ( UpdateObjectNodeTest , ConflictAtArrayNodeChildFailsToParse ) { <nl> <nl> TEST ( UpdateObjectNodeTest , ConflictThroughArrayNodeChildFailsToParse ) { <nl> auto update = fromjson ( " { $ set : { ' a . $ [ i ] . b ' : 5 , ' a . $ [ i ] . b . c ' : 6 } } " ) ; <nl> - auto arrayFilterI = fromjson ( " { i : 0 } " ) ; <nl> + auto arrayFilter = fromjson ( " { i : 0 } " ) ; <nl> boost : : intrusive_ptr < ExpressionContextForTest > expCtx ( new ExpressionContextForTest ( ) ) ; <nl> std : : map < StringData , std : : unique_ptr < ExpressionWithPlaceholder > > arrayFilters ; <nl> - arrayFilters [ " i " ] = uassertStatusOK ( ExpressionWithPlaceholder : : parse ( arrayFilterI , expCtx ) ) ; <nl> + auto parsedFilter = assertGet ( MatchExpressionParser : : parse ( arrayFilter , expCtx ) ) ; <nl> + arrayFilters [ " i " ] = assertGet ( ExpressionWithPlaceholder : : make ( std : : move ( parsedFilter ) ) ) ; <nl> std : : set < std : : string > foundIdentifiers ; <nl> UpdateObjectNode root ; <nl> ASSERT_OK ( UpdateObjectNode : : parseAndMerge ( & root , <nl> TEST ( UpdateObjectNodeTest , NoConflictDueToDifferentArrayNodeChildrenParsesSucces <nl> auto arrayFilterJ = fromjson ( " { j : 0 } " ) ; <nl> boost : : intrusive_ptr < ExpressionContextForTest > expCtx ( new ExpressionContextForTest ( ) ) ; <nl> std : : map < StringData , std : : unique_ptr < ExpressionWithPlaceholder > > arrayFilters ; <nl> - arrayFilters [ " i " ] = uassertStatusOK ( ExpressionWithPlaceholder : : parse ( arrayFilterI , expCtx ) ) ; <nl> - arrayFilters [ " j " ] = uassertStatusOK ( ExpressionWithPlaceholder : : parse ( arrayFilterJ , expCtx ) ) ; <nl> + auto parsedFilterI = assertGet ( MatchExpressionParser : : parse ( arrayFilterI , expCtx ) ) ; <nl> + auto parsedFilterJ = assertGet ( MatchExpressionParser : : parse ( arrayFilterJ , expCtx ) ) ; <nl> + <nl> + arrayFilters [ " i " ] = assertGet ( ExpressionWithPlaceholder : : make ( std : : move ( parsedFilterI ) ) ) ; <nl> + arrayFilters [ " j " ] = assertGet ( ExpressionWithPlaceholder : : make ( std : : move ( parsedFilterJ ) ) ) ; <nl> + <nl> std : : set < std : : string > foundIdentifiers ; <nl> UpdateObjectNode root ; <nl> ASSERT_OK ( UpdateObjectNode : : parseAndMerge ( & root , <nl> TEST ( UpdateObjectNodeTest , MultipleArrayNodesAlongPathParsesSuccessfully ) { <nl> auto arrayFilterJ = fromjson ( " { j : 0 } " ) ; <nl> boost : : intrusive_ptr < ExpressionContextForTest > expCtx ( new ExpressionContextForTest ( ) ) ; <nl> std : : map < StringData , std : : unique_ptr < ExpressionWithPlaceholder > > arrayFilters ; <nl> - arrayFilters [ " i " ] = uassertStatusOK ( ExpressionWithPlaceholder : : parse ( arrayFilterI , expCtx ) ) ; <nl> - arrayFilters [ " j " ] = uassertStatusOK ( ExpressionWithPlaceholder : : parse ( arrayFilterJ , expCtx ) ) ; <nl> + <nl> + auto parsedFilterI = assertGet ( MatchExpressionParser : : parse ( arrayFilterI , expCtx ) ) ; <nl> + auto parsedFilterJ = assertGet ( MatchExpressionParser : : parse ( arrayFilterJ , expCtx ) ) ; <nl> + <nl> + arrayFilters [ " i " ] = assertGet ( ExpressionWithPlaceholder : : make ( std : : move ( parsedFilterI ) ) ) ; <nl> + arrayFilters [ " j " ] = assertGet ( ExpressionWithPlaceholder : : make ( std : : move ( parsedFilterJ ) ) ) ; <nl> + <nl> std : : set < std : : string > foundIdentifiers ; <nl> UpdateObjectNode root ; <nl> ASSERT_OK ( UpdateObjectNode : : parseAndMerge ( & root , <nl> DEATH_TEST ( UpdateObjectNodeTest , <nl> FieldRef fakeFieldRef ( " root " ) ; <nl> boost : : intrusive_ptr < ExpressionContextForTest > expCtx ( new ExpressionContextForTest ( ) ) ; <nl> auto arrayFilterI = fromjson ( " { i : 0 } " ) ; <nl> - std : : map < StringData , std : : unique_ptr < ExpressionWithPlaceholder > > arrayFilters1 ; <nl> - arrayFilters1 [ " i " ] = uassertStatusOK ( ExpressionWithPlaceholder : : parse ( arrayFilterI , expCtx ) ) ; <nl> auto arrayFilterJ = fromjson ( " { j : 0 } " ) ; <nl> + std : : map < StringData , std : : unique_ptr < ExpressionWithPlaceholder > > arrayFilters1 ; <nl> std : : map < StringData , std : : unique_ptr < ExpressionWithPlaceholder > > arrayFilters2 ; <nl> - arrayFilters2 [ " j " ] = uassertStatusOK ( ExpressionWithPlaceholder : : parse ( arrayFilterJ , expCtx ) ) ; <nl> + auto parsedFilterI = assertGet ( MatchExpressionParser : : parse ( arrayFilterI , expCtx ) ) ; <nl> + auto parsedFilterJ = assertGet ( MatchExpressionParser : : parse ( arrayFilterJ , expCtx ) ) ; <nl> + arrayFilters1 [ " i " ] = assertGet ( ExpressionWithPlaceholder : : make ( std : : move ( parsedFilterI ) ) ) ; <nl> + arrayFilters2 [ " j " ] = assertGet ( ExpressionWithPlaceholder : : make ( std : : move ( parsedFilterJ ) ) ) ; <nl> std : : set < std : : string > foundIdentifiers ; <nl> UpdateObjectNode setRoot1 , setRoot2 ; <nl> ASSERT_OK ( UpdateObjectNode : : parseAndMerge ( & setRoot1 , <nl> TEST ( UpdateObjectNodeTest , MergingArrayNodeWithObjectNodeFails ) { <nl> boost : : intrusive_ptr < ExpressionContextForTest > expCtx ( new ExpressionContextForTest ( ) ) ; <nl> auto arrayFilter = fromjson ( " { i : 0 } " ) ; <nl> std : : map < StringData , std : : unique_ptr < ExpressionWithPlaceholder > > arrayFilters ; <nl> - arrayFilters [ " i " ] = uassertStatusOK ( ExpressionWithPlaceholder : : parse ( arrayFilter , expCtx ) ) ; <nl> + auto parsedFilter = assertGet ( MatchExpressionParser : : parse ( arrayFilter , expCtx ) ) ; <nl> + arrayFilters [ " i " ] = assertGet ( ExpressionWithPlaceholder : : make ( std : : move ( parsedFilter ) ) ) ; <nl> std : : set < std : : string > foundIdentifiers ; <nl> UpdateObjectNode setRoot1 , setRoot2 ; <nl> ASSERT_OK ( UpdateObjectNode : : parseAndMerge ( & setRoot1 , <nl> TEST ( UpdateObjectNodeTest , MergingArrayNodeWithLeafNodeFails ) { <nl> boost : : intrusive_ptr < ExpressionContextForTest > expCtx ( new ExpressionContextForTest ( ) ) ; <nl> auto arrayFilter = fromjson ( " { i : 0 } " ) ; <nl> std : : map < StringData , std : : unique_ptr < ExpressionWithPlaceholder > > arrayFilters ; <nl> - arrayFilters [ " i " ] = uassertStatusOK ( ExpressionWithPlaceholder : : parse ( arrayFilter , expCtx ) ) ; <nl> + auto parsedFilter = assertGet ( MatchExpressionParser : : parse ( arrayFilter , expCtx ) ) ; <nl> + arrayFilters [ " i " ] = assertGet ( ExpressionWithPlaceholder : : make ( std : : move ( parsedFilter ) ) ) ; <nl> std : : set < std : : string > foundIdentifiers ; <nl> UpdateObjectNode setRoot1 , setRoot2 ; <nl> ASSERT_OK ( UpdateObjectNode : : parseAndMerge ( & setRoot1 , <nl> TEST ( UpdateObjectNodeTest , MergingTwoArrayNodesSucceeds ) { <nl> auto arrayFilterI = fromjson ( " { i : 0 } " ) ; <nl> auto arrayFilterJ = fromjson ( " { j : 0 } " ) ; <nl> std : : map < StringData , std : : unique_ptr < ExpressionWithPlaceholder > > arrayFilters ; <nl> - arrayFilters [ " i " ] = uassertStatusOK ( ExpressionWithPlaceholder : : parse ( arrayFilterI , expCtx ) ) ; <nl> - arrayFilters [ " j " ] = uassertStatusOK ( ExpressionWithPlaceholder : : parse ( arrayFilterJ , expCtx ) ) ; <nl> + <nl> + auto parsedFilterI = assertGet ( MatchExpressionParser : : parse ( arrayFilterI , expCtx ) ) ; <nl> + auto parsedFilterJ = assertGet ( MatchExpressionParser : : parse ( arrayFilterJ , expCtx ) ) ; <nl> + <nl> + arrayFilters [ " i " ] = assertGet ( ExpressionWithPlaceholder : : make ( std : : move ( parsedFilterI ) ) ) ; <nl> + arrayFilters [ " j " ] = assertGet ( ExpressionWithPlaceholder : : make ( std : : move ( parsedFilterJ ) ) ) ; <nl> + <nl> std : : set < std : : string > foundIdentifiers ; <nl> UpdateObjectNode setRoot1 , setRoot2 ; <nl> ASSERT_OK ( UpdateObjectNode : : parseAndMerge ( & setRoot1 , <nl> TEST ( UpdateObjectNodeTest , MergeConflictThroughArrayNodesFails ) { <nl> boost : : intrusive_ptr < ExpressionContextForTest > expCtx ( new ExpressionContextForTest ( ) ) ; <nl> auto arrayFilter = fromjson ( " { i : 0 } " ) ; <nl> std : : map < StringData , std : : unique_ptr < ExpressionWithPlaceholder > > arrayFilters ; <nl> - arrayFilters [ " i " ] = uassertStatusOK ( ExpressionWithPlaceholder : : parse ( arrayFilter , expCtx ) ) ; <nl> + auto parsedFilter = assertGet ( MatchExpressionParser : : parse ( arrayFilter , expCtx ) ) ; <nl> + arrayFilters [ " i " ] = assertGet ( ExpressionWithPlaceholder : : make ( std : : move ( parsedFilter ) ) ) ; <nl> std : : set < std : : string > foundIdentifiers ; <nl> UpdateObjectNode setRoot1 , setRoot2 ; <nl> ASSERT_OK ( UpdateObjectNode : : parseAndMerge ( & setRoot1 , <nl> TEST ( UpdateObjectNodeTest , NoMergeConflictThroughArrayNodesSucceeds ) { <nl> boost : : intrusive_ptr < ExpressionContextForTest > expCtx ( new ExpressionContextForTest ( ) ) ; <nl> auto arrayFilter = fromjson ( " { i : 0 } " ) ; <nl> std : : map < StringData , std : : unique_ptr < ExpressionWithPlaceholder > > arrayFilters ; <nl> - arrayFilters [ " i " ] = uassertStatusOK ( ExpressionWithPlaceholder : : parse ( arrayFilter , expCtx ) ) ; <nl> + auto parsedFilter = assertGet ( MatchExpressionParser : : parse ( arrayFilter , expCtx ) ) ; <nl> + arrayFilters [ " i " ] = assertGet ( ExpressionWithPlaceholder : : make ( std : : move ( parsedFilter ) ) ) ; <nl> std : : set < std : : string > foundIdentifiers ; <nl> UpdateObjectNode setRoot1 , setRoot2 ; <nl> ASSERT_OK ( UpdateObjectNode : : parseAndMerge ( & setRoot1 , <nl>
SERVER - 31029 Add support for top - level $ expr within $ or and $ and
mongodb/mongo
95fedb251673c87b5172269e1f8c116b5e05fb16
2017-10-09T15:48:40Z
mmm a / emscripten . py <nl> ppp b / emscripten . py <nl> def load_from_cache ( chunk ) : <nl> <nl> funcs_js = ' ' . join ( [ output [ 0 ] for output in outputs ] ) <nl> if settings . get ( ' ASM_JS ' ) : <nl> + exports = [ ] <nl> + for export in settings [ ' EXPORTED_FUNCTIONS ' ] + settings [ ' EXPORTED_GLOBALS ' ] : <nl> + exports . append ( " ' % s ' : % s " % ( export , export ) ) <nl> + exports = ' { ' + ' , ' . join ( exports ) + ' } ' <nl> funcs_js = ' ' ' <nl> var asm = ( function ( env , buffer ) { <nl> ' use asm ' ; <nl> def load_from_cache ( chunk ) : <nl> var HEAPF32 = new env . Float32Array ( buffer ) ; <nl> var HEAPF64 = new env . Float64Array ( buffer ) ; <nl> ' ' ' + funcs_js . replace ( ' \ n ' , ' \ n ' ) + ' ' ' <nl> - return { } ; <nl> + return % s ; <nl> } ) ( { } , buffer ) ; <nl> - ' ' ' <nl> + for ( var export in asm ) Module [ export ] = asm [ export ] ; <nl> + ' ' ' % exports <nl> <nl> for func_js , curr_forwarded_data in outputs : <nl> # merge forwarded data <nl> mmm a / src / jsifier . js <nl> ppp b / src / jsifier . js <nl> function JSify ( data , functionsOnly , givenFunctions ) { <nl> } <nl> js + = ' \ n ' + makePointer ( ' [ 0 ] ' , null , allocator , [ ' void * ' ] , index ) + ' ; ' ; <nl> } <nl> - if ( EXPORT_ALL | | ( item . ident in EXPORTED_GLOBALS ) ) { <nl> + if ( ! ASM_JS & & ( EXPORT_ALL | | ( item . ident in EXPORTED_GLOBALS ) ) ) { <nl> js + = ' \ nModule [ " ' + item . ident + ' " ] = ' + item . ident + ' ; ' ; <nl> } <nl> if ( BUILD_AS_SHARED_LIB = = 2 & & ! item . private_ ) { <nl> function JSify ( data , functionsOnly , givenFunctions ) { <nl> func . JS + = ' \ n / / FUNCTION_END_MARKER_OF_SOURCE_FILE_ ' + associatedSourceFile + ' \ n ' ; <nl> } <nl> <nl> - if ( EXPORT_ALL | | ( func . ident in EXPORTED_FUNCTIONS ) ) { <nl> + if ( ! ASM_JS & & ( EXPORT_ALL | | ( func . ident in EXPORTED_GLOBALS ) ) ) { <nl> func . JS + = ' Module [ " ' + func . ident + ' " ] = ' + func . ident + ' ; ' ; <nl> } <nl> <nl>
work towards exports
emscripten-core/emscripten
3c38471a75ccc1f0f6dc142e97fde2cf615a625b
2012-12-07T22:23:18Z
mmm a / cocos / renderer / CCMaterial . cpp <nl> ppp b / cocos / renderer / CCMaterial . cpp <nl> <nl> <nl> NS_CC_BEGIN <nl> <nl> + Material * Material : : _diffuseSkinnedMaterial = nullptr ; <nl> + Material * Material : : _diffuseMaterial = nullptr ; <nl> + <nl> / / Helpers declaration <nl> static const char * getOptionalString ( Properties * properties , const char * key , const char * defaultValue ) ; <nl> static bool isValidUniform ( const char * name ) ; <nl> Material : : Material ( ) <nl> : _name ( " " ) <nl> , _target ( nullptr ) <nl> , _currentTechnique ( nullptr ) <nl> + , _materialType ( Material : : MaterialType : : CUSTOM ) <nl> { <nl> } <nl> <nl> Material * Material : : clone ( ) const <nl> / / current technique <nl> auto name = _currentTechnique - > getName ( ) ; <nl> material - > _currentTechnique = material - > getTechniqueByName ( name ) ; <nl> + material - > _materialType = _materialType ; <nl> <nl> material - > autorelease ( ) ; <nl> } <nl> ssize_t Material : : getTechniqueCount ( ) const <nl> return _techniques . size ( ) ; <nl> } <nl> <nl> + Material * Material : : createDiffuseMaterial ( bool skinned ) <nl> + { <nl> + if ( skinned ) <nl> + { <nl> + return _diffuseSkinnedMaterial - > clone ( ) ; <nl> + } <nl> + <nl> + return _diffuseMaterial - > clone ( ) ; <nl> + } <nl> + <nl> + void Material : : loadDefaultMaterial ( Material : : MaterialType type ) <nl> + { <nl> + if ( _diffuseMaterial = = nullptr ) <nl> + { <nl> + auto glProgramState = GLProgramState : : create ( < # cocos2d : : GLProgram * glprogram # > ) <nl> + _diffuseMaterial = Material : : createWithGLStateProgram ( ) ; <nl> + } <nl> + if ( _diffuseSkinnedMaterial = = nullptr ) <nl> + { <nl> + _diffuseSkinnedMaterial = Material : : createWithGLStateProgram ( ) ; <nl> + } <nl> + } <nl> <nl> / / Helpers implementation <nl> static bool isValidUniform ( const char * name ) <nl> mmm a / cocos / renderer / CCMaterial . h <nl> ppp b / cocos / renderer / CCMaterial . h <nl> class CC_DLL Material : public RenderState <nl> friend class Mesh ; <nl> <nl> public : <nl> + <nl> + enum class MaterialType <nl> + { <nl> + DIFFUSE , <nl> + NORMAL , <nl> + LIGHTMAP , <nl> + CUSTOM , <nl> + } ; <nl> + <nl> / * * <nl> * Creates a Material using the data from the Properties object defined at the specified URL , <nl> * where the URL is of the format " < file - path > . < extension > # < namespace - id > / < namespace - id > / . . . / < namespace - id > " <nl> class CC_DLL Material : public RenderState <nl> <nl> / * * returns a clone ( deep - copy ) of the material * / <nl> Material * clone ( ) const ; <nl> + <nl> + / * * create default diffuse material * / <nl> + static Material * createDiffuseMaterial ( bool skinned ) ; <nl> + <nl> + MaterialType getMaterialType ( ) const { return _materialType ; } <nl> <nl> protected : <nl> Material ( ) ; <nl> class CC_DLL Material : public RenderState <nl> bool parseUniform ( GLProgramState * programState , Properties * properties , const char * uniformName ) ; <nl> bool parseRenderState ( RenderState * renderState , Properties * properties ) ; <nl> <nl> - <nl> + static void loadDefaultMaterial ( MaterialType type ) ; <nl> + <nl> / / material name <nl> std : : string _name ; <nl> <nl> class CC_DLL Material : public RenderState <nl> <nl> / / weak reference <nl> Node * _target ; <nl> + <nl> + MaterialType _materialType ; <nl> + static Material * _diffuseSkinnedMaterial ; <nl> + static Material * _diffuseMaterial ; <nl> + / / static Material * <nl> } ; <nl> <nl> NS_CC_END <nl>
tmp
cocos2d/cocos2d-x
d17c04cf0e58f048932836e9d13836629ba44985
2015-08-26T08:35:42Z
mmm a / src / jsoncharutils . h <nl> ppp b / src / jsoncharutils . h <nl> inline size_t codepoint_to_utf8 ( uint32_t cp , uint8_t * c ) { <nl> / / The following code is used in number parsing . It is not <nl> / / properly " char utils " stuff , but we move it here so that <nl> / / it does not get copied multiple times in the binaries ( once <nl> - / / per instructin set ) . <nl> + / / per instruction set ) . <nl> / / / <nl> <nl> <nl>
Fixing typo .
simdjson/simdjson
3c1b403c4ea1b61306568e9ed3f8fc88d6a70db6
2020-04-20T22:19:38Z
new file mode 100644 <nl> index 000000000000 . . aeebad4dbdb5 <nl> mmm / dev / null <nl> ppp b / caffe2 / core / storage . h <nl> <nl> + # ifndef CAFFE2_CORE_STORAGE_H_ <nl> + # define CAFFE2_CORE_STORAGE_H_ <nl> + <nl> + # include < cstddef > <nl> + # include < cstdint > <nl> + # include < fstream > <nl> + # include < sstream > <nl> + # include < type_traits > <nl> + # include < typeinfo > <nl> + # include < vector > <nl> + <nl> + # include " caffe2 / core / allocator . h " <nl> + # include " caffe2 / core / common . h " <nl> + # include " caffe2 / core / context . h " <nl> + # include " caffe2 / core / flags . h " <nl> + # include " caffe2 / core / logging . h " <nl> + # include " caffe2 / core / typeid . h " <nl> + <nl> + namespace caffe2 { <nl> + <nl> + using DataType = TypeMeta ; <nl> + <nl> + class StorageImpl ; <nl> + using Storage = std : : shared_ptr < StorageImpl > ; <nl> + <nl> + class StorageImpl { <nl> + public : <nl> + StorageImpl ( ) = delete ; <nl> + StorageImpl ( const StorageImpl & ) = delete ; <nl> + StorageImpl & operator = ( const StorageImpl & ) = delete ; <nl> + <nl> + explicit StorageImpl ( DeviceType device_type ) : device_type_ ( device_type ) { } <nl> + StorageImpl ( DeviceType device_type , TypeMeta data_type ) <nl> + : data_type_ ( data_type ) , device_type_ ( device_type ) { } <nl> + <nl> + void reset ( ) { <nl> + data_ptr_ . reset ( ) ; <nl> + capacity_ = 0 ; <nl> + } <nl> + <nl> + template < typename T > <nl> + inline bool IsType ( ) const { <nl> + return data_type_ . Match < T > ( ) ; <nl> + } <nl> + <nl> + const void * data_ptr ( ) const { <nl> + return data_ptr_ . get ( ) ; <nl> + } <nl> + <nl> + void * data_ptr ( ) { <nl> + return data_ptr_ . get ( ) ; <nl> + } <nl> + <nl> + const DataType & dtype ( ) const { <nl> + return data_type_ ; <nl> + } <nl> + <nl> + size_t capacity ( ) const { <nl> + return capacity_ ; <nl> + } <nl> + <nl> + int64_t numel ( ) const { <nl> + return capacity_ / itemsize ( ) ; <nl> + } <nl> + <nl> + inline void set_device_type ( DeviceType device_type ) { <nl> + device_type_ = device_type ; <nl> + } <nl> + <nl> + inline DeviceType device_type ( ) const { <nl> + return device_type_ ; <nl> + } <nl> + <nl> + inline size_t itemsize ( ) const { <nl> + return data_type_ . itemsize ( ) ; <nl> + } <nl> + <nl> + / / Rule of Five <nl> + StorageImpl ( StorageImpl & & ) = default ; <nl> + ~ StorageImpl ( ) = default ; <nl> + StorageImpl & operator = ( StorageImpl & & ) = default ; <nl> + <nl> + protected : <nl> + template < typename Deleter = MemoryDeleter > <nl> + void ShareExternalPointer ( <nl> + void * src , <nl> + const DataType & data_type , <nl> + size_t capacity = 0 , <nl> + Deleter d = nullptr ) { <nl> + / / Check if the deleter is a MemoryDeleter and is a simple nullptr . <nl> + if ( std : : is_same < MemoryDeleter , Deleter > : : value & & <nl> + reinterpret_cast < MemoryDeleter * > ( & d ) [ 0 ] = = nullptr ) { <nl> + / / Use aliasing constructor trick to avoid calling the destructor . <nl> + data_ptr_ = std : : shared_ptr < void > ( std : : shared_ptr < void > ( ) , src ) ; <nl> + } else { <nl> + data_ptr_ . reset ( src , d ) ; <nl> + } <nl> + / / Sets capacity . If not specified , we will implicitly assume that <nl> + / / the capacity is the current size . <nl> + if ( capacity ) { <nl> + capacity_ = capacity ; <nl> + } <nl> + } <nl> + <nl> + / / TODO : changed to DataPtr in Aten when shared folder <nl> + / / is ready <nl> + using DataPtr = std : : shared_ptr < void > ; <nl> + int64_t capacity_ = 0 ; <nl> + DataType data_type_ ; <nl> + DataPtr data_ptr_ ; <nl> + / / allocator_ takes precedence over StaticContext from device_type_ <nl> + / / Allocator * allocator_ ; <nl> + DeviceType device_type_ = CPU ; <nl> + <nl> + friend class Tensor ; <nl> + } ; <nl> + <nl> + } / / namespace caffe2 <nl> + <nl> + # endif / / CAFFE2_CORE_STORAGE_H_ <nl> mmm a / caffe2 / core / tensor . h <nl> ppp b / caffe2 / core / tensor . h <nl> <nl> # ifndef CAFFE2_CORE_TENSOR_H_ <nl> # define CAFFE2_CORE_TENSOR_H_ <nl> <nl> - # include < cstddef > <nl> - # include < cstdint > <nl> - # include < fstream > <nl> - # include < sstream > <nl> - # include < type_traits > <nl> - # include < typeinfo > <nl> - # include < vector > <nl> - <nl> - # include " caffe2 / core / common . h " <nl> - # include " caffe2 / core / flags . h " <nl> - # include " caffe2 / core / context . h " <nl> - # include " caffe2 / core / typeid . h " <nl> - # include " caffe2 / core / logging . h " <nl> + # include " caffe2 / core / storage . h " <nl> <nl> / / A global boolean variable to control whether we free memory when a Tensor <nl> / / is shrinked to a smaller size . As a result , a Tensor is always going to <nl> inline int canonical_axis_index_ ( int axis_index , int ndims ) { <nl> class Tensor { <nl> public : <nl> Tensor ( ) = delete ; <nl> - explicit Tensor ( DeviceType type ) : device_type_ ( type ) { } <nl> + explicit Tensor ( DeviceType device_type ) <nl> + : storage_ ( std : : make_shared < StorageImpl > ( device_type ) ) { } <nl> <nl> / * * <nl> * @ brief Creates a tensor of the given dimension . <nl> class Tensor { <nl> * Note that the actual data allocation is not going to be carried out until <nl> * the first time mutable_data ( ) is called . <nl> * / <nl> - explicit Tensor ( const vector < TIndex > & dims , DeviceType type ) <nl> - : device_type_ ( type ) { <nl> + / / TODO : here , we create a Storage <nl> + / / and immediately discard it in Resize ( ) since <nl> + / / reset_tensor will be true and FreeMemory will be called , <nl> + / / we might want to avoid creating Storage twice ? <nl> + explicit Tensor ( const vector < TIndex > & dims , DeviceType device_type ) <nl> + : storage_ ( std : : make_shared < StorageImpl > ( device_type ) ) { <nl> Resize ( dims ) ; <nl> } <nl> - explicit Tensor ( const vector < int > & dims , DeviceType type ) <nl> - : device_type_ ( type ) { <nl> + explicit Tensor ( const vector < int > & dims , DeviceType device_type ) <nl> + : storage_ ( std : : make_shared < StorageImpl > ( device_type ) ) { <nl> Resize ( dims ) ; <nl> } <nl> <nl> / * Now we require that context_for_copy has the same device type as src since <nl> * template is removed <nl> * / <nl> - Tensor ( const Tensor & src , BaseContext * context_for_copy , DeviceType type ) <nl> - : device_type_ ( type ) { <nl> + Tensor ( <nl> + const Tensor & src , <nl> + BaseContext * context_for_copy , <nl> + DeviceType device_type ) <nl> + : storage_ ( std : : make_shared < StorageImpl > ( device_type ) ) { <nl> CopyFrom ( src , context_for_copy ) ; <nl> } <nl> <nl> class Tensor { <nl> * @ brief : Create a Tensor of DeviceType ` type ` and initialize it with <nl> * src Tensor <nl> * / <nl> - Tensor ( const Tensor & src , DeviceType type ) : device_type_ ( type ) { <nl> + Tensor ( const Tensor & src , DeviceType device_type ) <nl> + : storage_ ( std : : make_shared < StorageImpl > ( device_type ) ) { <nl> CopyFrom ( src ) ; <nl> } <nl> <nl> class Tensor { <nl> const vector < TIndex > & dims , <nl> const vector < T > & values , <nl> BaseContext * context ) <nl> - : meta_ ( TypeMeta : : Make < T > ( ) ) { <nl> + : storage_ ( std : : make_shared < StorageImpl > ( <nl> + context - > GetDevicetype ( ) , <nl> + TypeMeta : : Make < T > ( ) ) ) { <nl> Resize ( dims ) ; <nl> CAFFE_ENFORCE_EQ_WITH_CALLER ( values . size ( ) , size_ ) ; <nl> - device_type_ = context - > GetDevicetype ( ) ; <nl> - context - > CopyItemsFromCPU ( meta_ , size_ , values . data ( ) , mutable_data < T > ( ) ) ; <nl> + context - > CopyItemsFromCPU ( <nl> + storage_ - > dtype ( ) , size_ , values . data ( ) , mutable_data < T > ( ) ) ; <nl> } <nl> <nl> / * * <nl> class Tensor { <nl> template < <nl> typename T , <nl> typename = typename std : : enable_if < std : : is_scalar < T > : : value > : : type > <nl> - Tensor ( const T & value , BaseContext * context ) : meta_ ( TypeMeta : : Make < T > ( ) ) { <nl> + Tensor ( const T & value , BaseContext * context ) <nl> + : storage_ ( std : : make_shared < StorageImpl > ( <nl> + context - > GetDevicetype ( ) , <nl> + TypeMeta : : Make < T > ( ) ) ) { <nl> Resize ( vector < TIndex > { } ) ; <nl> - device_type_ = context - > GetDevicetype ( ) ; <nl> - context - > CopyItemsFromCPU ( meta_ , size_ , & value , mutable_data < T > ( ) ) ; <nl> + context - > CopyItemsFromCPU ( <nl> + storage_ - > dtype ( ) , size_ , & value , mutable_data < T > ( ) ) ; <nl> } <nl> <nl> / * <nl> class Tensor { <nl> * context pointer in tensor , which indicates the type of the tensor . <nl> * / <nl> BaseStaticContext * GetStaticContext ( ) const { <nl> - return GET_STATIC_CONTEXT ( device_type_ ) ; <nl> + return GET_STATIC_CONTEXT ( GetDeviceType ( ) ) ; <nl> } <nl> <nl> / * @ brief <nl> class Tensor { <nl> } <nl> <nl> DeviceType GetDeviceType ( ) const { <nl> - return device_type_ ; <nl> + return storage_ - > device_type ( ) ; <nl> } <nl> + <nl> / * * <nl> * @ brief Copies the data from a source tensor , with a contex provided to <nl> * carry out the underlying memcpy operation . <nl> class Tensor { <nl> if ( ( void * ) & src = = ( void * ) this ) { <nl> return ; <nl> } <nl> - meta_ = src . meta ( ) ; <nl> + storage_ - > data_type_ = src . storage ( ) - > dtype ( ) ; <nl> if ( src . size ( ) = = - 1 ) { <nl> dims_ . clear ( ) ; <nl> size_ = - 1 ; <nl> - data_ . reset ( ) ; <nl> - capacity_ = 0 ; <nl> - reserved_ = false ; <nl> + storage_ - > reset ( ) ; <nl> return ; <nl> } <nl> Resize ( src . dims ( ) ) ; <nl> if ( size ( ) > 0 ) { <nl> - if ( meta_ . copy ( ) ) { <nl> + if ( storage_ - > dtype ( ) . copy ( ) ) { <nl> CAFFE_ENFORCE ( <nl> GetDeviceType ( ) = = CPU , <nl> " In CopyFrom source and dest tensors must both be CPU for meta copy " ) ; <nl> CAFFE_ENFORCE ( <nl> src . GetDeviceType ( ) = = CPU , <nl> " In CopyFrom source and dest tensors must both be CPU for meta copy " ) ; <nl> - meta_ . copy ( ) ( src . raw_data ( ) , raw_mutable_data ( ) , size ( ) ) ; <nl> + storage_ - > dtype ( ) . copy ( ) ( src . raw_data ( ) , raw_mutable_data ( ) , size ( ) ) ; <nl> } else { <nl> / / We ' ll need to use a non - CPU context to perform the copy if <nl> / / one of the context is not CPU since only non - CPU context <nl> class Tensor { <nl> CAFFE_ENFORCE_GE_WITH_CALLER ( dims_ . size ( ) , 1 ) ; <nl> CAFFE_ENFORCE_GE_WITH_CALLER ( <nl> num , 0 , " ` num ` must be non - negative for Extend " ) ; <nl> + CAFFE_ENFORCE ( <nl> + storage_ . use_count ( ) = = 1 , <nl> + " Can ' t call Extend on shared storage , please call Resize instead " ) ; <nl> auto newDims = dims_ ; <nl> newDims [ 0 ] + = num ; <nl> - if ( ! data_ ) { <nl> + if ( ! storage_ - > data_ptr ( ) ) { <nl> Resize ( newDims ) ; <nl> return ; <nl> } <nl> class Tensor { <nl> newDims . end ( ) , <nl> static_cast < TIndex > ( 1 ) , <nl> std : : multiplies < TIndex > ( ) ) ; <nl> - if ( newSize * meta_ . itemsize ( ) < = capacity_ ) { <nl> + if ( newSize * storage_ - > itemsize ( ) < = storage_ - > capacity ( ) ) { <nl> dims_ = newDims ; <nl> size_ = newSize ; <nl> return ; <nl> class Tensor { <nl> auto newCapacity = dims_ ; <nl> newCapacity [ 0 ] = std : : max < size_t > ( <nl> newDims [ 0 ] , std : : ceil ( dims_ [ 0 ] * ( growthPct + 100 ) / 100 ) ) ; <nl> - auto oldData = std : : move ( data_ ) ; <nl> + auto oldData = std : : move ( storage_ - > data_ptr_ ) ; <nl> auto oldSize = size_ ; <nl> auto oldDims = dims_ ; <nl> Resize ( newCapacity ) ; <nl> - auto * newData = raw_mutable_data ( meta_ ) ; <nl> + auto * newData = raw_mutable_data ( storage_ - > dtype ( ) ) ; <nl> CAFFE_ENFORCE ( <nl> context ! = nullptr , " Context must be provided to Extend the tensor " ) ; <nl> - context - > CopyItemsSameDevice ( meta_ , oldSize , oldData . get ( ) , newData ) ; <nl> + context - > CopyItemsSameDevice ( <nl> + storage_ - > dtype ( ) , oldSize , oldData . get ( ) , newData ) ; <nl> reserved_ = true ; <nl> dims_ = newDims ; <nl> size_ = newSize ; <nl> class Tensor { <nl> CAFFE_ENFORCE_WITH_CALLER ( <nl> outer_dim < = dims_ [ 0 ] , <nl> " New outer dimension must be smaller than current . " ) ; <nl> + CAFFE_ENFORCE ( <nl> + storage_ . use_count ( ) = = 1 , <nl> + " Can ' t call ShrinkTo on shared storage , please call Resize instead . " ) ; <nl> dims_ [ 0 ] = outer_dim ; <nl> size_ = std : : accumulate ( <nl> dims_ . begin ( ) , <nl> class Tensor { <nl> void ReserveSpace ( const T & outer_dim ) { <nl> CAFFE_ENFORCE ( <nl> size_ ! = - 1 , " size should be initialized before calling ReserveSpace " ) ; <nl> + CAFFE_ENFORCE ( <nl> + storage_ . use_count ( ) = = 1 , <nl> + " Can ' t call ReserveSpace on shared storage . " ) ; <nl> auto newCapacity = dims_ ; <nl> newCapacity [ 0 ] = outer_dim ; <nl> auto newSize = std : : accumulate ( <nl> class Tensor { <nl> newCapacity . end ( ) , <nl> static_cast < TIndex > ( 1 ) , <nl> std : : multiplies < TIndex > ( ) ) ; <nl> - if ( newSize * meta_ . itemsize ( ) < = capacity_ ) { <nl> + if ( newSize * storage_ - > itemsize ( ) < = storage_ - > capacity ( ) ) { <nl> return ; <nl> } <nl> / / Old data is discarded <nl> - data_ . reset ( ) ; <nl> + storage_ - > data_ptr_ . reset ( ) ; <nl> auto oldSize = size_ ; <nl> auto oldDims = dims_ ; <nl> Resize ( newCapacity ) ; <nl> - / / Allocate new memory and don ' t copy over the data <nl> - raw_mutable_data ( meta_ ) ; <nl> + / / Allocate new memory but don ' t copy over the data <nl> + raw_mutable_data ( storage_ - > dtype ( ) ) ; <nl> dims_ = oldDims ; <nl> size_ = oldSize ; <nl> reserved_ = true ; <nl> class Tensor { <nl> if ( size_changed ) { <nl> / / If needed , we will free the data . the next mutable_data ( ) call <nl> / / will create the data storage . <nl> - int64_t new_size = size_ * meta_ . itemsize ( ) ; <nl> bool reset_tensor = false ; <nl> if ( reserved_ ) { <nl> - / / If tensor is reserved then don ' t claim its memeory unless capacity_ <nl> + / / If tensor is reserved then don ' t claim its memeory unless capacity ( ) <nl> / / is smaller than new size <nl> - reset_tensor = capacity_ < new_size ; <nl> + reset_tensor = storage_ - > capacity ( ) < size_ * storage_ - > itemsize ( ) ; <nl> } else { <nl> - reset_tensor = capacity_ < new_size | | ! FLAGS_caffe2_keep_on_shrink | | <nl> - capacity_ - new_size > FLAGS_caffe2_max_keep_on_shrink_memory ; <nl> + reset_tensor = storage_ - > capacity ( ) < size_ * storage_ - > itemsize ( ) | | <nl> + ! FLAGS_caffe2_keep_on_shrink | | <nl> + storage_ - > capacity ( ) - size_ * storage_ - > itemsize ( ) > <nl> + FLAGS_caffe2_max_keep_on_shrink_memory ; <nl> } <nl> <nl> if ( reset_tensor ) { <nl> class Tensor { <nl> * allocation . <nl> * / <nl> inline void FreeMemory ( ) { <nl> - data_ . reset ( ) ; <nl> - capacity_ = 0 ; <nl> - / / If reserved is true and we changed tensor memory then it is fine <nl> - / / to switch it to false , if Resize is called from Reserve and it triggers <nl> - / / FreeMemory ( ) then reserved_ will be set to true at end of ReserveSpace ( ) <nl> - reserved_ = false ; <nl> + / / We ' ll detach from the old Storage and create a new one <nl> + storage_ = std : : make_shared < StorageImpl > ( <nl> + storage_ - > device_type ( ) , storage_ - > dtype ( ) ) ; <nl> } <nl> <nl> / * * <nl> class Tensor { <nl> * / <nl> string DebugString ( ) const { <nl> std : : stringstream ss ; <nl> - ss < < " A Tensor of item size " < < itemsize ( ) < < " and type " <nl> - < < meta_ . name ( ) < < " and dimension ( " ; <nl> + ss < < " A Tensor of item size " < < storage_ - > itemsize ( ) < < " and type " <nl> + < < storage_ - > dtype ( ) . name ( ) < < " and dimension ( " ; <nl> for ( int d : dims_ ) { <nl> ss < < d < < " , " ; <nl> } <nl> class Tensor { <nl> void swap ( Tensor & other ) noexcept { <nl> std : : swap ( dims_ , other . dims_ ) ; <nl> std : : swap ( size_ , other . size_ ) ; <nl> - std : : swap ( meta_ , other . meta_ ) ; <nl> - std : : swap ( data_ , other . data_ ) ; <nl> - std : : swap ( capacity_ , other . capacity_ ) ; <nl> - std : : swap ( reserved_ , other . reserved_ ) ; <nl> - std : : swap ( device_type_ , other . device_type_ ) ; <nl> + std : : swap ( storage_ , other . storage_ ) ; <nl> } <nl> <nl> / * * <nl> class Tensor { <nl> * The source tensor should already have its data allocated . <nl> * / <nl> void ShareData ( const Tensor & src ) { <nl> - meta_ = src . meta ( ) ; <nl> + CAFFE_ENFORCE ( <nl> + storage_ . use_count ( ) = = 1 , <nl> + " Can ' t share data if underlying storage used by more than one tensor " ) ; <nl> + storage_ - > data_type_ = src . storage ( ) - > data_type_ ; <nl> CAFFE_ENFORCE_EQ_WITH_CALLER ( <nl> src . size_ , <nl> size_ , <nl> class Tensor { <nl> / / in which case ShareData ( ) doesn ' t make much sense since we don ' t really <nl> / / know what to share yet . <nl> CAFFE_ENFORCE_WITH_CALLER ( <nl> - src . data_ . get ( ) | | src . size_ = = 0 , <nl> + src . storage ( ) - > data_ptr ( ) | | src . size_ = = 0 , <nl> " Source tensor has no content and has size > 0 " ) ; <nl> / / Finally , do sharing . <nl> - data_ = src . data_ ; <nl> - capacity_ = src . capacity_ ; <nl> + storage_ - > data_ptr_ = src . storage ( ) - > data_ptr_ ; <nl> + storage_ - > capacity_ = src . storage ( ) - > capacity_ ; <nl> } <nl> <nl> / * * <nl> class Tensor { <nl> * using it . If a Deleter object is passed in , when this tensor is reallocated <nl> * or freed , the deleter function is going to be called . <nl> * / <nl> + / / TODO : Change to ShareExternalStorage <nl> template < typename T , typename Deleter = MemoryDeleter > <nl> void ShareExternalPointer ( T * src , size_t capacity = 0 , Deleter d = nullptr ) { <nl> ShareExternalPointer ( src , TypeMeta : : Make < T > ( ) , capacity , d ) ; <nl> + / / Sets capacity . If not specified , we will implicitly assume that <nl> + / / the capacity is the current size . <nl> + if ( ! capacity ) { <nl> + capacity = size_ * storage_ - > itemsize ( ) ; <nl> + } <nl> + storage_ - > capacity_ = capacity ; <nl> } <nl> <nl> template < typename Deleter = MemoryDeleter > <nl> void ShareExternalPointer ( <nl> void * src , <nl> - const TypeMeta & meta , <nl> + const TypeMeta & data_type , <nl> size_t capacity = 0 , <nl> Deleter d = nullptr ) { <nl> - meta_ = meta ; <nl> + CAFFE_ENFORCE ( <nl> + storage_ . use_count ( ) = = 1 , <nl> + " Can ' t share external pointer if underlying storage used by more than one tensor " ) ; <nl> + storage_ - > data_type_ = data_type ; <nl> CAFFE_ENFORCE_WITH_CALLER ( <nl> - meta_ . id ( ) ! = TypeIdentifier : : uninitialized ( ) , <nl> + storage_ - > data_type_ . id ( ) ! = TypeIdentifier : : uninitialized ( ) , <nl> " To share with a raw external pointer you need to have meta " <nl> " already set . " ) ; <nl> CAFFE_ENFORCE_WITH_CALLER ( <nl> size_ > = 0 , <nl> " To share data with a raw pointer , you need to set shape first . " ) ; <nl> - / / Check if the deleter is a MemoryDeleter and is a simple nullptr . <nl> - if ( std : : is_same < MemoryDeleter , Deleter > : : value & & <nl> - reinterpret_cast < MemoryDeleter * > ( & d ) [ 0 ] = = nullptr ) { <nl> - / / Use aliasing constructor trick to avoid calling the destructor . <nl> - data_ = std : : shared_ptr < void > ( std : : shared_ptr < void > ( ) , src ) ; <nl> - } else { <nl> - data_ . reset ( src , d ) ; <nl> - } <nl> - / / Sets capacity . If not specified , we will implicitly assume that <nl> - / / the capacity is the current size . <nl> - if ( capacity ) { <nl> - capacity_ = capacity ; <nl> - } else { <nl> - capacity_ = nbytes ( ) ; <nl> - } <nl> + storage_ - > ShareExternalPointer ( src , data_type , capacity , d ) ; <nl> } <nl> <nl> / * * <nl> class Tensor { <nl> * or raw_mutable_data ( ) must have been called prior to this function call . <nl> * / <nl> inline const void * raw_data ( ) const { <nl> - CAFFE_ENFORCE_WITH_CALLER ( data_ . get ( ) | | size_ = = 0 ) ; <nl> - return data_ . get ( ) ; <nl> + CAFFE_ENFORCE_WITH_CALLER ( storage_ - > data_ptr ( ) | | size_ = = 0 ) ; <nl> + return storage_ - > data_ptr ( ) ; <nl> } <nl> <nl> / * * <nl> class Tensor { <nl> template < typename T > <nl> inline const T * data ( ) const { <nl> CAFFE_ENFORCE_WITH_CALLER ( <nl> - data_ . get ( ) | | size_ = = 0 , <nl> + storage_ - > data_ptr ( ) | | size_ = = 0 , <nl> " The tensor is of non - zero shape , but its data is not allocated yet . " <nl> " Caffe2 uses a lazy allocation , so you will need to call " <nl> " mutable_data ( ) or raw_mutable_data ( ) to actually allocate memory . " ) ; <nl> class Tensor { <nl> " Tensor type mismatch , caller expects elements to be " , <nl> TypeMeta : : TypeName < T > ( ) , <nl> " while tensor contains " , <nl> - meta_ . name ( ) ) ; <nl> - return static_cast < T * > ( data_ . get ( ) ) ; <nl> + storage_ - > dtype ( ) . name ( ) ) ; <nl> + return static_cast < T * > ( storage_ - > data_ptr ( ) ) ; <nl> } <nl> <nl> / * * <nl> class Tensor { <nl> * / <nl> inline void * raw_mutable_data ( const TypeMeta & meta ) { <nl> / / For 0 - size tensors it ' s fine to return any pointer ( including nullptr ) <nl> - if ( meta_ = = meta & & ( data_ . get ( ) | | size_ = = 0 ) ) { <nl> - return data_ . get ( ) ; <nl> + if ( storage_ - > dtype ( ) = = meta & & ( storage_ - > data_ptr ( ) | | size_ = = 0 ) ) { <nl> + return storage_ - > data_ptr ( ) ; <nl> } else { <nl> - bool had_special_dtor = meta_ . dtor ( ) ! = nullptr ; <nl> - meta_ = meta ; <nl> + bool had_special_dtor = storage_ - > dtype ( ) . dtor ( ) ! = nullptr ; <nl> + / / TODO : we should create a new Storage here . <nl> + storage_ - > data_type_ = meta ; <nl> CAFFE_ENFORCE_WITH_CALLER ( <nl> size_ > = 0 , <nl> " Tensor is not initialized . You probably need to call Resize ( ) " <nl> class Tensor { <nl> / / constructor . <nl> if ( size_ = = 0 | | <nl> ( meta . ctor ( ) = = nullptr & & ! had_special_dtor & & <nl> - capacity_ > = size_ * meta_ . itemsize ( ) ) ) { <nl> - return data_ . get ( ) ; <nl> + storage_ - > capacity ( ) > = size_ * storage_ - > itemsize ( ) ) ) { <nl> + return storage_ - > data_ptr ( ) ; <nl> } <nl> if ( meta . ctor ( ) ) { <nl> / / For types that need placement new , we will call it , as well as <nl> / / making sure that when the data is freed , it calls the right <nl> / / destruction procedure . <nl> auto size = size_ ; <nl> - auto dtor = meta_ . dtor ( ) ; <nl> + auto dtor = storage_ - > dtype ( ) . dtor ( ) ; <nl> auto ptr_and_deleter = <nl> - GetStaticContext ( ) - > New ( size_ * meta_ . itemsize ( ) ) ; <nl> + GetStaticContext ( ) - > New ( size_ * storage_ - > itemsize ( ) ) ; <nl> auto deleter = ptr_and_deleter . second ; <nl> - data_ . reset ( <nl> + storage_ - > data_ptr_ . reset ( <nl> ptr_and_deleter . first , [ size , dtor , deleter ] ( void * ptr ) - > void { <nl> dtor ( ptr , size ) ; <nl> deleter ( ptr ) ; <nl> } ) ; <nl> - meta_ . ctor ( ) ( data_ . get ( ) , size_ ) ; <nl> + storage_ - > dtype ( ) . ctor ( ) ( storage_ - > data_ptr ( ) , size_ ) ; <nl> } else { <nl> / / For fundamental type , new and delete is easier . <nl> auto ptr_and_deleter = <nl> - GetStaticContext ( ) - > New ( size_ * meta_ . itemsize ( ) ) ; <nl> - data_ . reset ( ptr_and_deleter . first , ptr_and_deleter . second ) ; <nl> + GetStaticContext ( ) - > New ( size_ * storage_ - > itemsize ( ) ) ; <nl> + storage_ - > data_ptr_ . reset ( <nl> + ptr_and_deleter . first , ptr_and_deleter . second ) ; <nl> } <nl> - capacity_ = size_ * meta_ . itemsize ( ) ; <nl> - return data_ . get ( ) ; <nl> + storage_ - > capacity_ = size_ * storage_ - > itemsize ( ) ; <nl> + return storage_ - > data_ptr ( ) ; <nl> } <nl> } <nl> <nl> class Tensor { <nl> * / <nl> inline void * raw_mutable_data ( ) { <nl> CAFFE_ENFORCE_WITH_CALLER ( <nl> - meta_ . id ( ) ! = TypeIdentifier : : uninitialized ( ) , <nl> + storage_ - > dtype ( ) . id ( ) ! = TypeIdentifier : : uninitialized ( ) , <nl> " Calling raw_mutable_data ( ) without meta , but the current meta is " <nl> " of unknown type . " ) ; <nl> - return raw_mutable_data ( meta_ ) ; <nl> + return raw_mutable_data ( storage_ - > dtype ( ) ) ; <nl> } <nl> <nl> / * * <nl> class Tensor { <nl> * For fundamental types , we reuse possible existing storage if there <nl> * is sufficient capacity . <nl> * / <nl> - template < typename T > <nl> - inline T * mutable_data ( ) { <nl> - if ( ( size_ = = 0 | | data_ . get ( ) ) & & IsType < T > ( ) ) { <nl> - return static_cast < T * > ( data_ . get ( ) ) ; <nl> - } <nl> - / / Check it here statically - otherwise TypeMeta would throw the runtime <nl> - / / error in attempt to invoke TypeMeta : : ctor ( ) <nl> - static_assert ( <nl> - std : : is_default_constructible < T > : : value , <nl> - " Tensor can ' t hold non - default - constructible types " ) ; <nl> - return static_cast < T * > ( raw_mutable_data ( TypeMeta : : Make < T > ( ) ) ) ; <nl> + template < typename T > <nl> + inline T * mutable_data ( ) { <nl> + if ( ( size_ = = 0 | | storage_ - > data_ptr ( ) ) & & IsType < T > ( ) ) { <nl> + return static_cast < T * > ( storage_ - > data_ptr ( ) ) ; <nl> } <nl> + / / Check it here statically - otherwise TypeMeta would throw the runtime <nl> + / / error in attempt to invoke TypeMeta : : ctor ( ) <nl> + static_assert ( <nl> + std : : is_default_constructible < T > : : value , <nl> + " Tensor can ' t hold non - default - constructible types " ) ; <nl> + return static_cast < T * > ( raw_mutable_data ( TypeMeta : : Make < T > ( ) ) ) ; <nl> + } <nl> <nl> + / * * <nl> + * Returns the underlying Stoarge for the Tensor <nl> + * / <nl> + inline Storage storage ( ) { <nl> + return storage_ ; <nl> + } <nl> + <nl> + inline Storage storage ( ) const { <nl> + return storage_ ; <nl> + } <nl> <nl> / * * <nl> * Returns the number of dimensions of the data . <nl> * / <nl> - inline int ndim ( ) const { return dims_ . size ( ) ; } <nl> + inline int ndim ( ) const { <nl> + return dims_ . size ( ) ; <nl> + } <nl> / * * <nl> * Returns the size ( i . e . the number of items ) of the tensor . <nl> * / <nl> - inline TIndex size ( ) const { return size_ ; } <nl> + inline TIndex size ( ) const { <nl> + return size_ ; <nl> + } <nl> / * * <nl> * Return the number of bytes each item takes in the tensor . <nl> * / <nl> - inline size_t itemsize ( ) const { return meta_ . itemsize ( ) ; } <nl> + inline size_t itemsize ( ) const { <nl> + return storage_ - > itemsize ( ) ; <nl> + } <nl> / * * <nl> * Returns the total number of bytes of the storage . <nl> * <nl> * This is equivalent to calling size ( ) * itemsize ( ) . <nl> * / <nl> - inline size_t nbytes ( ) const { return size_ * meta_ . itemsize ( ) ; } <nl> + inline size_t nbytes ( ) const { <nl> + return size_ * itemsize ( ) ; <nl> + ; <nl> + } <nl> <nl> inline size_t capacity_nbytes ( ) const { <nl> - return capacity_ ; <nl> + return storage_ - > capacity ( ) ; <nl> } <nl> / * * <nl> * Returns the dimensions of the tensor as a vector . <nl> class Tensor { <nl> * Checks if the tensor content is of the given data type . <nl> * / <nl> template < typename T > <nl> - inline bool IsType ( ) const { return meta_ . Match < T > ( ) ; } <nl> + inline bool IsType ( ) const { <nl> + return storage_ - > IsType < T > ( ) ; <nl> + } <nl> / * * <nl> * Returns the TypeMeta object associated with the current data type . <nl> * / <nl> - inline const TypeMeta & meta ( ) const { return meta_ ; } <nl> + inline const TypeMeta & meta ( ) const { <nl> + return storage_ - > dtype ( ) ; <nl> + } <nl> <nl> / * * <nl> * Returns the i - th dimension of the tensor in int . <nl> class Tensor { <nl> } <nl> <nl> protected : <nl> - vector < TIndex > dims_ ; <nl> - TIndex size_ = - 1 ; <nl> - TypeMeta meta_ ; <nl> - std : : shared_ptr < void > data_ ; <nl> - size_t capacity_ = 0 ; <nl> - / / we decide to keep reserved and it will <nl> + using DimVector = std : : vector < TIndex > ; <nl> + DimVector dims_ ; / / sizes_ <nl> + TIndex size_ = - 1 ; / / numel_ <nl> + / / we decide to keep reserved_ and it will <nl> / / live in Tensor after the split <nl> / / The logic is that if Extend ( ) or ReserveSpace ( ) were ever called , <nl> / / then subsequent Resize ( ) s will not free up Storage . <nl> bool reserved_ = false ; <nl> - DeviceType device_type_ = CPU ; <nl> - / / In case of chunk load we store how much data was already loaded <nl> + Storage storage_ ; <nl> + / / int64_t storage_offset_ ; <nl> <nl> private : <nl> template < <nl>
Split storage from tensor ( )
pytorch/pytorch
523bdc8ec14b26c886a914f80351eebef6c7673f
2018-08-15T23:40:14Z
mmm a / dbms / src / AggregateFunctions / AggregateFunctionAvg . cpp <nl> ppp b / dbms / src / AggregateFunctions / AggregateFunctionAvg . cpp <nl> namespace DB <nl> namespace <nl> { <nl> <nl> + template < typename T > <nl> + struct Avg <nl> + { <nl> + using FieldType = std : : conditional_t < IsDecimalNumber < T > , Decimal128 , typename NearestFieldType < T > : : Type > ; <nl> + using Function = AggregateFunctionAvg < T , AggregateFunctionAvgData < FieldType > > ; <nl> + } ; <nl> + <nl> + template < typename T > <nl> + using AggregateFuncAvg = typename Avg < T > : : Function ; <nl> + <nl> AggregateFunctionPtr createAggregateFunctionAvg ( const std : : string & name , const DataTypes & argument_types , const Array & parameters ) <nl> { <nl> assertNoParameters ( name , parameters ) ; <nl> assertUnary ( name , argument_types ) ; <nl> <nl> - AggregateFunctionPtr res ( createWithNumericType < AggregateFunctionAvg > ( * argument_types [ 0 ] ) ) ; <nl> + AggregateFunctionPtr res ; <nl> + DataTypePtr data_type = argument_types [ 0 ] ; <nl> + if ( isDecimal ( data_type ) ) <nl> + res . reset ( createWithDecimalType < AggregateFuncAvg > ( * data_type ) ) ; <nl> + else <nl> + res . reset ( createWithNumericType < AggregateFuncAvg > ( * data_type ) ) ; <nl> <nl> if ( ! res ) <nl> - throw Exception ( " Illegal type " + argument_types [ 0 ] - > getName ( ) + " of argument for aggregate function " + name , ErrorCodes : : ILLEGAL_TYPE_OF_ARGUMENT ) ; <nl> - <nl> + throw Exception ( " Illegal type " + argument_types [ 0 ] - > getName ( ) + " of argument for aggregate function " + name , <nl> + ErrorCodes : : ILLEGAL_TYPE_OF_ARGUMENT ) ; <nl> return res ; <nl> } <nl> <nl> mmm a / dbms / src / AggregateFunctions / AggregateFunctionAvg . h <nl> ppp b / dbms / src / AggregateFunctions / AggregateFunctionAvg . h <nl> <nl> # include < IO / ReadHelpers . h > <nl> <nl> # include < DataTypes / DataTypesNumber . h > <nl> + # include < DataTypes / DataTypesDecimal . h > <nl> # include < Columns / ColumnsNumber . h > <nl> <nl> # include < AggregateFunctions / IAggregateFunction . h > <nl> struct AggregateFunctionAvgData <nl> <nl> <nl> / / / Calculates arithmetic mean of numbers . <nl> - template < typename T > <nl> - class AggregateFunctionAvg final : public IAggregateFunctionDataHelper < AggregateFunctionAvgData < typename NearestFieldType < T > : : Type > , AggregateFunctionAvg < T > > <nl> + template < typename T , typename Data > <nl> + class AggregateFunctionAvg final : public IAggregateFunctionDataHelper < Data , AggregateFunctionAvg < T , Data > > <nl> { <nl> public : <nl> + using ResultType = std : : conditional_t < IsDecimalNumber < T > , Decimal128 , Float64 > ; <nl> + using ResultDataType = std : : conditional_t < IsDecimalNumber < T > , DataTypeDecimal < Decimal128 > , DataTypeNumber < Float64 > > ; <nl> + using ColVecType = std : : conditional_t < IsDecimalNumber < T > , ColumnDecimal < T > , ColumnVector < T > > ; <nl> + using ColVecResult = std : : conditional_t < IsDecimalNumber < T > , ColumnDecimal < Decimal128 > , ColumnVector < Float64 > > ; <nl> + <nl> + / / / ctor for native types <nl> + AggregateFunctionAvg ( ) <nl> + : scale ( 0 ) <nl> + { } <nl> + <nl> + / / / ctor for Decimals <nl> + AggregateFunctionAvg ( const IDataType & data_type ) <nl> + : scale ( getDecimalScale ( data_type ) ) <nl> + { } <nl> + <nl> String getName ( ) const override { return " avg " ; } <nl> <nl> DataTypePtr getReturnType ( ) const override <nl> { <nl> - return std : : make_shared < DataTypeFloat64 > ( ) ; <nl> + if constexpr ( IsDecimalNumber < T > ) <nl> + return std : : make_shared < ResultDataType > ( ResultDataType : : maxPrecision ( ) , scale ) ; <nl> + else <nl> + return std : : make_shared < ResultDataType > ( ) ; <nl> } <nl> <nl> void add ( AggregateDataPtr place , const IColumn * * columns , size_t row_num , Arena * ) const override <nl> { <nl> - this - > data ( place ) . sum + = static_cast < const ColumnVector < T > & > ( * columns [ 0 ] ) . getData ( ) [ row_num ] ; <nl> + const auto & column = static_cast < const ColVecType & > ( * columns [ 0 ] ) ; <nl> + this - > data ( place ) . sum + = column . getData ( ) [ row_num ] ; <nl> + + this - > data ( place ) . count ; <nl> } <nl> <nl> class AggregateFunctionAvg final : public IAggregateFunctionDataHelper < Aggregate <nl> <nl> void insertResultInto ( ConstAggregateDataPtr place , IColumn & to ) const override <nl> { <nl> - static_cast < ColumnFloat64 & > ( to ) . getData ( ) . push_back ( <nl> - static_cast < Float64 > ( this - > data ( place ) . sum ) / this - > data ( place ) . count ) ; <nl> + auto & column = static_cast < ColVecResult & > ( to ) ; <nl> + column . getData ( ) . push_back ( static_cast < ResultType > ( this - > data ( place ) . sum ) / this - > data ( place ) . count ) ; <nl> } <nl> <nl> const char * getHeaderFilePath ( ) const override { return __FILE__ ; } <nl> + <nl> + private : <nl> + UInt32 scale ; <nl> } ; <nl> <nl> <nl> mmm a / dbms / src / AggregateFunctions / AggregateFunctionQuantile . cpp <nl> ppp b / dbms / src / AggregateFunctions / AggregateFunctionQuantile . cpp <nl> namespace ErrorCodes <nl> namespace <nl> { <nl> <nl> - template < template < typename > class Data , typename Name , bool have_second_arg , typename FloatReturnType , bool returns_many > <nl> + template < typename T > using FuncQuantile = AggregateFunctionQuantile < T , QuantileReservoirSampler < T > , NameQuantile , false , Float64 , false > ; <nl> + template < typename T > using FuncQuantiles = AggregateFunctionQuantile < T , QuantileReservoirSampler < T > , NameQuantile , false , Float64 , true > ; <nl> + <nl> + template < typename T > using FuncQuantileDeterministic = AggregateFunctionQuantile < T , QuantileReservoirSamplerDeterministic < T > , NameQuantileDeterministic , true , Float64 , false > ; <nl> + template < typename T > using FuncQuantilesDeterministic = AggregateFunctionQuantile < T , QuantileReservoirSamplerDeterministic < T > , NameQuantilesDeterministic , true , Float64 , true > ; <nl> + <nl> + template < typename T > using FuncQuantileExact = AggregateFunctionQuantile < T , QuantileExact < T > , NameQuantileExact , false , void , false > ; <nl> + template < typename T > using FuncQuantilesExact = AggregateFunctionQuantile < T , QuantileExact < T > , NameQuantilesExact , false , void , true > ; <nl> + <nl> + template < typename T > using FuncQuantileExactWeighted = AggregateFunctionQuantile < T , QuantileExactWeighted < T > , NameQuantileExactWeighted , true , void , false > ; <nl> + template < typename T > using FuncQuantilesExactWeighted = AggregateFunctionQuantile < T , QuantileExactWeighted < T > , NameQuantilesExactWeighted , true , void , true > ; <nl> + <nl> + template < typename T > using FuncQuantileTiming = AggregateFunctionQuantile < T , QuantileTiming < T > , NameQuantileTiming , false , Float32 , false > ; <nl> + template < typename T > using FuncQuantilesTiming = AggregateFunctionQuantile < T , QuantileTiming < T > , NameQuantilesTiming , false , Float32 , true > ; <nl> + <nl> + template < typename T > using FuncQuantileTimingWeighted = AggregateFunctionQuantile < T , QuantileTiming < T > , NameQuantileTimingWeighted , true , Float32 , false > ; <nl> + template < typename T > using FuncQuantilesTimingWeighted = AggregateFunctionQuantile < T , QuantileTiming < T > , NameQuantilesTimingWeighted , true , Float32 , true > ; <nl> + <nl> + template < typename T > using FuncQuantileTDigest = AggregateFunctionQuantile < T , QuantileTDigest < T > , NameQuantileTDigest , false , Float32 , false > ; <nl> + template < typename T > using FuncQuantilesTDigest = AggregateFunctionQuantile < T , QuantileTDigest < T > , NameQuantilesTDigest , false , Float32 , true > ; <nl> + <nl> + template < typename T > using FuncQuantileTDigestWeighted = AggregateFunctionQuantile < T , QuantileTDigest < T > , NameQuantileTDigestWeighted , true , Float32 , false > ; <nl> + template < typename T > using FuncQuantilesTDigestWeighted = AggregateFunctionQuantile < T , QuantileTDigest < T > , NameQuantilesTDigestWeighted , true , Float32 , true > ; <nl> + <nl> + <nl> + template < template < typename > class Function > <nl> + static constexpr bool SupportDecimal ( ) <nl> + { <nl> + return std : : is_same_v < Function < Float32 > , FuncQuantileExact < Float32 > > | | <nl> + std : : is_same_v < Function < Float32 > , FuncQuantilesExact < Float32 > > ; <nl> + } <nl> + <nl> + <nl> + template < template < typename > class Function , bool have_second_arg > <nl> AggregateFunctionPtr createAggregateFunctionQuantile ( const std : : string & name , const DataTypes & argument_types , const Array & params ) <nl> { <nl> - if ( have_second_arg ) <nl> + if constexpr ( have_second_arg ) <nl> assertBinary ( name , argument_types ) ; <nl> else <nl> assertUnary ( name , argument_types ) ; <nl> <nl> const DataTypePtr & argument_type = argument_types [ 0 ] ; <nl> - <nl> WhichDataType which ( argument_type ) ; <nl> - # define CREATE ( TYPE ) \ <nl> - if ( which . idx = = TypeIndex : : TYPE ) \ <nl> - return std : : make_shared < AggregateFunctionQuantile < TYPE , Data < TYPE > , Name , have_second_arg , FloatReturnType , returns_many > > ( argument_type , params ) ; <nl> - FOR_NUMERIC_TYPES ( CREATE ) <nl> - # undef CREATE <nl> - <nl> - if ( which . idx = = TypeIndex : : Date ) <nl> - return std : : make_shared < AggregateFunctionQuantile < <nl> - DataTypeDate : : FieldType , Data < DataTypeDate : : FieldType > , Name , have_second_arg , void , returns_many > > ( argument_type , params ) ; <nl> - if ( which . idx = = TypeIndex : : DateTime ) <nl> - return std : : make_shared < AggregateFunctionQuantile < <nl> - DataTypeDateTime : : FieldType , Data < DataTypeDateTime : : FieldType > , Name , have_second_arg , void , returns_many > > ( argument_type , params ) ; <nl> - <nl> - throw Exception ( " Illegal type " + argument_type - > getName ( ) + " of argument for aggregate function " + name , ErrorCodes : : ILLEGAL_TYPE_OF_ARGUMENT ) ; <nl> - } <nl> <nl> + # define DISPATCH ( TYPE ) \ <nl> + if ( which . idx = = TypeIndex : : TYPE ) return std : : make_shared < Function < TYPE > > ( argument_type , params ) ; <nl> + FOR_NUMERIC_TYPES ( DISPATCH ) <nl> + # undef DISPATCH <nl> # undef FOR_NUMERIC_TYPES <nl> + if ( which . idx = = TypeIndex : : Date ) return std : : make_shared < Function < DataTypeDate : : FieldType > > ( argument_type , params ) ; <nl> + if ( which . idx = = TypeIndex : : DateTime ) return std : : make_shared < Function < DataTypeDateTime : : FieldType > > ( argument_type , params ) ; <nl> + <nl> + if constexpr ( SupportDecimal < Function > ( ) ) <nl> + { <nl> + if ( which . idx = = TypeIndex : : Decimal32 ) return std : : make_shared < Function < Decimal32 > > ( argument_type , params ) ; <nl> + if ( which . idx = = TypeIndex : : Decimal64 ) return std : : make_shared < Function < Decimal64 > > ( argument_type , params ) ; <nl> + if ( which . idx = = TypeIndex : : Decimal128 ) return std : : make_shared < Function < Decimal128 > > ( argument_type , params ) ; <nl> + } <nl> + <nl> + throw Exception ( " Illegal type " + argument_type - > getName ( ) + " of argument for aggregate function " + name , <nl> + ErrorCodes : : ILLEGAL_TYPE_OF_ARGUMENT ) ; <nl> + } <nl> <nl> } <nl> <nl> void registerAggregateFunctionsQuantile ( AggregateFunctionFactory & factory ) <nl> { <nl> - factory . registerFunction ( NameQuantile : : name , <nl> - createAggregateFunctionQuantile < QuantileReservoirSampler , NameQuantile , false , Float64 , false > ) ; <nl> - factory . registerFunction ( NameQuantiles : : name , <nl> - createAggregateFunctionQuantile < QuantileReservoirSampler , NameQuantiles , false , Float64 , true > ) ; <nl> - <nl> - factory . registerFunction ( NameQuantileDeterministic : : name , <nl> - createAggregateFunctionQuantile < QuantileReservoirSamplerDeterministic , NameQuantileDeterministic , true , Float64 , false > ) ; <nl> - factory . registerFunction ( NameQuantilesDeterministic : : name , <nl> - createAggregateFunctionQuantile < QuantileReservoirSamplerDeterministic , NameQuantilesDeterministic , true , Float64 , true > ) ; <nl> - <nl> - factory . registerFunction ( NameQuantileExact : : name , <nl> - createAggregateFunctionQuantile < QuantileExact , NameQuantileExact , false , void , false > ) ; <nl> - factory . registerFunction ( NameQuantilesExact : : name , <nl> - createAggregateFunctionQuantile < QuantileExact , NameQuantilesExact , false , void , true > ) ; <nl> - <nl> - factory . registerFunction ( NameQuantileExactWeighted : : name , <nl> - createAggregateFunctionQuantile < QuantileExactWeighted , NameQuantileExactWeighted , true , void , false > ) ; <nl> - factory . registerFunction ( NameQuantilesExactWeighted : : name , <nl> - createAggregateFunctionQuantile < QuantileExactWeighted , NameQuantilesExactWeighted , true , void , true > ) ; <nl> - <nl> - factory . registerFunction ( NameQuantileTiming : : name , <nl> - createAggregateFunctionQuantile < QuantileTiming , NameQuantileTiming , false , Float32 , false > ) ; <nl> - factory . registerFunction ( NameQuantilesTiming : : name , <nl> - createAggregateFunctionQuantile < QuantileTiming , NameQuantilesTiming , false , Float32 , true > ) ; <nl> - <nl> - factory . registerFunction ( NameQuantileTimingWeighted : : name , <nl> - createAggregateFunctionQuantile < QuantileTiming , NameQuantileTimingWeighted , true , Float32 , false > ) ; <nl> - factory . registerFunction ( NameQuantilesTimingWeighted : : name , <nl> - createAggregateFunctionQuantile < QuantileTiming , NameQuantilesTimingWeighted , true , Float32 , true > ) ; <nl> - <nl> - factory . registerFunction ( NameQuantileTDigest : : name , <nl> - createAggregateFunctionQuantile < QuantileTDigest , NameQuantileTDigest , false , Float32 , false > ) ; <nl> - factory . registerFunction ( NameQuantilesTDigest : : name , <nl> - createAggregateFunctionQuantile < QuantileTDigest , NameQuantilesTDigest , false , Float32 , true > ) ; <nl> - <nl> - factory . registerFunction ( NameQuantileTDigestWeighted : : name , <nl> - createAggregateFunctionQuantile < QuantileTDigest , NameQuantileTDigestWeighted , true , Float32 , false > ) ; <nl> - factory . registerFunction ( NameQuantilesTDigestWeighted : : name , <nl> - createAggregateFunctionQuantile < QuantileTDigest , NameQuantilesTDigestWeighted , true , Float32 , true > ) ; <nl> + factory . registerFunction ( NameQuantile : : name , createAggregateFunctionQuantile < FuncQuantile , false > ) ; <nl> + factory . registerFunction ( NameQuantiles : : name , createAggregateFunctionQuantile < FuncQuantiles , false > ) ; <nl> + <nl> + factory . registerFunction ( NameQuantileDeterministic : : name , createAggregateFunctionQuantile < FuncQuantileDeterministic , true > ) ; <nl> + factory . registerFunction ( NameQuantilesDeterministic : : name , createAggregateFunctionQuantile < FuncQuantilesDeterministic , true > ) ; <nl> + <nl> + factory . registerFunction ( NameQuantileExact : : name , createAggregateFunctionQuantile < FuncQuantileExact , false > ) ; <nl> + factory . registerFunction ( NameQuantilesExact : : name , createAggregateFunctionQuantile < FuncQuantilesExact , false > ) ; <nl> + <nl> + factory . registerFunction ( NameQuantileExactWeighted : : name , createAggregateFunctionQuantile < FuncQuantileExactWeighted , true > ) ; <nl> + factory . registerFunction ( NameQuantilesExactWeighted : : name , createAggregateFunctionQuantile < FuncQuantilesExactWeighted , true > ) ; <nl> + <nl> + factory . registerFunction ( NameQuantileTiming : : name , createAggregateFunctionQuantile < FuncQuantileTiming , false > ) ; <nl> + factory . registerFunction ( NameQuantilesTiming : : name , createAggregateFunctionQuantile < FuncQuantilesTiming , false > ) ; <nl> + <nl> + factory . registerFunction ( NameQuantileTimingWeighted : : name , createAggregateFunctionQuantile < FuncQuantileTimingWeighted , true > ) ; <nl> + factory . registerFunction ( NameQuantilesTimingWeighted : : name , createAggregateFunctionQuantile < FuncQuantilesTimingWeighted , true > ) ; <nl> + <nl> + factory . registerFunction ( NameQuantileTDigest : : name , createAggregateFunctionQuantile < FuncQuantileTDigest , false > ) ; <nl> + factory . registerFunction ( NameQuantilesTDigest : : name , createAggregateFunctionQuantile < FuncQuantilesTDigest , false > ) ; <nl> + <nl> + factory . registerFunction ( NameQuantileTDigestWeighted : : name , createAggregateFunctionQuantile < FuncQuantileTDigestWeighted , true > ) ; <nl> + factory . registerFunction ( NameQuantilesTDigestWeighted : : name , createAggregateFunctionQuantile < FuncQuantilesTDigestWeighted , true > ) ; <nl> <nl> / / / ' median ' is an alias for ' quantile ' <nl> factory . registerAlias ( " median " , NameQuantile : : name ) ; <nl> mmm a / dbms / src / AggregateFunctions / AggregateFunctionQuantile . h <nl> ppp b / dbms / src / AggregateFunctions / AggregateFunctionQuantile . h <nl> <nl> <nl> # include < Columns / ColumnArray . h > <nl> # include < Columns / ColumnsNumber . h > <nl> + # include < Columns / ColumnDecimal . h > <nl> <nl> <nl> namespace DB <nl> class AggregateFunctionQuantile final : public IAggregateFunctionDataHelper < Data <nl> AggregateFunctionQuantile < Value , Data , Name , have_second_arg , FloatReturnType , returns_many > > <nl> { <nl> private : <nl> + using ColVecType = std : : conditional_t < IsDecimalNumber < Value > , ColumnDecimal < Value > , ColumnVector < Value > > ; <nl> + <nl> static constexpr bool returns_float = ! std : : is_same_v < FloatReturnType , void > ; <nl> + static_assert ( ! IsDecimalNumber < Value > | | ! returns_float ) ; <nl> <nl> QuantileLevels < Float64 > levels ; <nl> <nl> class AggregateFunctionQuantile final : public IAggregateFunctionDataHelper < Data <nl> <nl> void add ( AggregateDataPtr place , const IColumn * * columns , size_t row_num , Arena * ) const override <nl> { <nl> + const auto & column = static_cast < const ColVecType & > ( * columns [ 0 ] ) ; <nl> if constexpr ( have_second_arg ) <nl> this - > data ( place ) . add ( <nl> - static_cast < const ColumnVector < Value > & > ( * columns [ 0 ] ) . getData ( ) [ row_num ] , <nl> + column . getData ( ) [ row_num ] , <nl> columns [ 1 ] - > getUInt ( row_num ) ) ; <nl> else <nl> - this - > data ( place ) . add ( <nl> - static_cast < const ColumnVector < Value > & > ( * columns [ 0 ] ) . getData ( ) [ row_num ] ) ; <nl> + this - > data ( place ) . add ( column . getData ( ) [ row_num ] ) ; <nl> } <nl> <nl> void merge ( AggregateDataPtr place , ConstAggregateDataPtr rhs , Arena * ) const override <nl> class AggregateFunctionQuantile final : public IAggregateFunctionDataHelper < Data <nl> } <nl> else <nl> { <nl> - auto & data_to = static_cast < ColumnVector < Value > & > ( arr_to . getData ( ) ) . getData ( ) ; <nl> + auto & data_to = static_cast < ColVecType & > ( arr_to . getData ( ) ) . getData ( ) ; <nl> size_t old_size = data_to . size ( ) ; <nl> data_to . resize ( data_to . size ( ) + size ) ; <nl> <nl> class AggregateFunctionQuantile final : public IAggregateFunctionDataHelper < Data <nl> if constexpr ( returns_float ) <nl> static_cast < ColumnVector < FloatReturnType > & > ( to ) . getData ( ) . push_back ( data . getFloat ( level ) ) ; <nl> else <nl> - static_cast < ColumnVector < Value > & > ( to ) . getData ( ) . push_back ( data . get ( level ) ) ; <nl> + static_cast < ColVecType & > ( to ) . getData ( ) . push_back ( data . get ( level ) ) ; <nl> } <nl> } <nl> <nl> mmm a / dbms / src / AggregateFunctions / AggregateFunctionSum . cpp <nl> ppp b / dbms / src / AggregateFunctions / AggregateFunctionSum . cpp <nl> namespace <nl> { <nl> <nl> template < typename T > <nl> - using AggregateFunctionSumSimple = AggregateFunctionSum < T , typename NearestFieldType < T > : : Type , AggregateFunctionSumData < typename NearestFieldType < T > : : Type > > ; <nl> + struct SumSimple <nl> + { <nl> + / / / @ note It uses slow Decimal128 ( cause we need such a variant ) . sumWithOverflow is faster for Decimal32 / 64 <nl> + using ResultType = std : : conditional_t < IsDecimalNumber < T > , Decimal128 , typename NearestFieldType < T > : : Type > ; <nl> + using AggregateDataType = AggregateFunctionSumData < ResultType > ; <nl> + using Function = AggregateFunctionSum < T , ResultType , AggregateDataType > ; <nl> + } ; <nl> <nl> template < typename T > <nl> - using AggregateFunctionSumWithOverflow = AggregateFunctionSum < T , T , AggregateFunctionSumData < T > > ; <nl> + struct SumSameType <nl> + { <nl> + using ResultType = T ; <nl> + using AggregateDataType = AggregateFunctionSumData < ResultType > ; <nl> + using Function = AggregateFunctionSum < T , ResultType , AggregateDataType > ; <nl> + } ; <nl> <nl> template < typename T > <nl> - using AggregateFunctionSumKahan = AggregateFunctionSum < T , Float64 , AggregateFunctionSumKahanData < Float64 > > ; <nl> + struct SumKahan <nl> + { <nl> + using ResultType = Float64 ; <nl> + using AggregateDataType = AggregateFunctionSumKahanData < ResultType > ; <nl> + using Function = AggregateFunctionSum < T , ResultType , AggregateDataType > ; <nl> + } ; <nl> + <nl> + template < typename T > using AggregateFunctionSumSimple = typename SumSimple < T > : : Function ; <nl> + template < typename T > using AggregateFunctionSumWithOverflow = typename SumSameType < T > : : Function ; <nl> + template < typename T > using AggregateFunctionSumKahan = <nl> + std : : conditional_t < IsDecimalNumber < T > , typename SumSimple < T > : : Function , typename SumKahan < T > : : Function > ; <nl> <nl> <nl> template < template < typename > class Function > <nl> AggregateFunctionPtr createAggregateFunctionSum ( const std : : string & name , const <nl> assertNoParameters ( name , parameters ) ; <nl> assertUnary ( name , argument_types ) ; <nl> <nl> - AggregateFunctionPtr res ( createWithNumericType < Function > ( * argument_types [ 0 ] ) ) ; <nl> + AggregateFunctionPtr res ; <nl> + DataTypePtr data_type = argument_types [ 0 ] ; <nl> + if ( isDecimal ( data_type ) ) <nl> + res . reset ( createWithDecimalType < Function > ( * data_type ) ) ; <nl> + else <nl> + res . reset ( createWithNumericType < Function > ( * data_type ) ) ; <nl> <nl> if ( ! res ) <nl> - throw Exception ( " Illegal type " + argument_types [ 0 ] - > getName ( ) + " of argument for aggregate function " + name , ErrorCodes : : ILLEGAL_TYPE_OF_ARGUMENT ) ; <nl> - <nl> + throw Exception ( " Illegal type " + argument_types [ 0 ] - > getName ( ) + " of argument for aggregate function " + name , <nl> + ErrorCodes : : ILLEGAL_TYPE_OF_ARGUMENT ) ; <nl> return res ; <nl> } <nl> <nl> mmm a / dbms / src / AggregateFunctions / AggregateFunctionSum . h <nl> ppp b / dbms / src / AggregateFunctions / AggregateFunctionSum . h <nl> <nl> # include < IO / ReadHelpers . h > <nl> <nl> # include < DataTypes / DataTypesNumber . h > <nl> + # include < DataTypes / DataTypesDecimal . h > <nl> # include < Columns / ColumnVector . h > <nl> <nl> # include < AggregateFunctions / IAggregateFunction . h > <nl> template < typename T , typename TResult , typename Data > <nl> class AggregateFunctionSum final : public IAggregateFunctionDataHelper < Data , AggregateFunctionSum < T , TResult , Data > > <nl> { <nl> public : <nl> + using ResultDataType = std : : conditional_t < IsDecimalNumber < T > , DataTypeDecimal < TResult > , DataTypeNumber < TResult > > ; <nl> + using ColVecType = std : : conditional_t < IsDecimalNumber < T > , ColumnDecimal < T > , ColumnVector < T > > ; <nl> + using ColVecResult = std : : conditional_t < IsDecimalNumber < T > , ColumnDecimal < TResult > , ColumnVector < TResult > > ; <nl> + <nl> String getName ( ) const override { return " sum " ; } <nl> <nl> + AggregateFunctionSum ( ) <nl> + : scale ( 0 ) <nl> + { } <nl> + <nl> + AggregateFunctionSum ( const IDataType & data_type ) <nl> + : scale ( getDecimalScale ( data_type ) ) <nl> + { } <nl> + <nl> DataTypePtr getReturnType ( ) const override <nl> { <nl> - return std : : make_shared < DataTypeNumber < TResult > > ( ) ; <nl> + if constexpr ( IsDecimalNumber < T > ) <nl> + return std : : make_shared < ResultDataType > ( ResultDataType : : maxPrecision ( ) , scale ) ; <nl> + else <nl> + return std : : make_shared < ResultDataType > ( ) ; <nl> } <nl> <nl> void add ( AggregateDataPtr place , const IColumn * * columns , size_t row_num , Arena * ) const override <nl> { <nl> - this - > data ( place ) . add ( static_cast < const ColumnVector < T > & > ( * columns [ 0 ] ) . getData ( ) [ row_num ] ) ; <nl> + const auto & column = static_cast < const ColVecType & > ( * columns [ 0 ] ) ; <nl> + this - > data ( place ) . add ( column . getData ( ) [ row_num ] ) ; <nl> } <nl> <nl> void merge ( AggregateDataPtr place , ConstAggregateDataPtr rhs , Arena * ) const override <nl> class AggregateFunctionSum final : public IAggregateFunctionDataHelper < Data , Agg <nl> <nl> void insertResultInto ( ConstAggregateDataPtr place , IColumn & to ) const override <nl> { <nl> - static_cast < ColumnVector < TResult > & > ( to ) . getData ( ) . push_back ( this - > data ( place ) . get ( ) ) ; <nl> + auto & column = static_cast < ColVecResult & > ( to ) ; <nl> + column . getData ( ) . push_back ( this - > data ( place ) . get ( ) ) ; <nl> } <nl> <nl> const char * getHeaderFilePath ( ) const override { return __FILE__ ; } <nl> - } ; <nl> <nl> + private : <nl> + UInt32 scale ; <nl> + } ; <nl> <nl> } <nl> mmm a / dbms / src / AggregateFunctions / Helpers . h <nl> ppp b / dbms / src / AggregateFunctions / Helpers . h <nl> namespace DB <nl> <nl> / * * Create an aggregate function with a numeric type in the template parameter , depending on the type of the argument . <nl> * / <nl> - template < template < typename , typename . . . TArgs > class AggregateFunctionTemplate , typename . . . TArgs > <nl> + template < template < typename > class AggregateFunctionTemplate , typename . . . TArgs > <nl> static IAggregateFunction * createWithNumericType ( const IDataType & argument_type , TArgs & & . . . args ) <nl> { <nl> WhichDataType which ( argument_type ) ; <nl> static IAggregateFunction * createWithNumericType ( const IDataType & argument_typ <nl> return nullptr ; <nl> } <nl> <nl> - <nl> template < template < typename , typename > class AggregateFunctionTemplate , template < typename > class Data , typename . . . TArgs > <nl> static IAggregateFunction * createWithUnsignedIntegerType ( const IDataType & argument_type , TArgs & & . . . args ) <nl> { <nl> static IAggregateFunction * createWithUnsignedIntegerType ( const IDataType & argu <nl> return nullptr ; <nl> } <nl> <nl> + template < template < typename > class AggregateFunctionTemplate , typename . . . TArgs > <nl> + static IAggregateFunction * createWithDecimalType ( const IDataType & argument_type , TArgs & & . . . args ) <nl> + { <nl> + WhichDataType which ( argument_type ) ; <nl> + if ( which . idx = = TypeIndex : : Decimal32 ) return new AggregateFunctionTemplate < Decimal32 > ( argument_type , std : : forward < TArgs > ( args ) . . . ) ; <nl> + if ( which . idx = = TypeIndex : : Decimal64 ) return new AggregateFunctionTemplate < Decimal64 > ( argument_type , std : : forward < TArgs > ( args ) . . . ) ; <nl> + if ( which . idx = = TypeIndex : : Decimal128 ) return new AggregateFunctionTemplate < Decimal128 > ( argument_type , std : : forward < TArgs > ( args ) . . . ) ; <nl> + return nullptr ; <nl> + } <nl> + <nl> <nl> / * * For template with two arguments . <nl> * / <nl> mmm a / dbms / src / Columns / ColumnDecimal . h <nl> ppp b / dbms / src / Columns / ColumnDecimal . h <nl> class DecimalPaddedPODArray : public PaddedPODArray < T > <nl> template < typename T > <nl> class ColumnDecimal final : public COWPtrHelper < IColumn , ColumnDecimal < T > > <nl> { <nl> + static_assert ( IsDecimalNumber < T > ) ; <nl> + <nl> private : <nl> using Self = ColumnDecimal < T > ; <nl> friend class COWPtrHelper < IColumn , Self > ; <nl> mmm a / dbms / src / Columns / ColumnVector . h <nl> ppp b / dbms / src / Columns / ColumnVector . h <nl> template < > inline UInt64 unionCastToUInt64 ( Float32 x ) <nl> template < typename T > <nl> class ColumnVector final : public COWPtrHelper < IColumn , ColumnVector < T > > <nl> { <nl> + static_assert ( ! IsDecimalNumber < T > ) ; <nl> + <nl> private : <nl> using Self = ColumnVector < T > ; <nl> friend class COWPtrHelper < IColumn , Self > ; <nl> mmm a / dbms / src / DataTypes / DataTypeNumberBase . h <nl> ppp b / dbms / src / DataTypes / DataTypeNumberBase . h <nl> namespace DB <nl> template < typename T > <nl> class DataTypeNumberBase : public IDataType <nl> { <nl> + static_assert ( IsNumber < T > ) ; <nl> + <nl> public : <nl> static constexpr bool is_parametric = false ; <nl> using FieldType = T ; <nl> mmm a / dbms / src / DataTypes / DataTypesDecimal . h <nl> ppp b / dbms / src / DataTypes / DataTypesDecimal . h <nl> DataTypePtr createDecimal ( UInt64 precision , UInt64 scale ) ; <nl> template < typename T > <nl> class DataTypeDecimal final : public DataTypeSimpleSerialization <nl> { <nl> + static_assert ( IsDecimalNumber < T > ) ; <nl> + <nl> public : <nl> using FieldType = T ; <nl> using ColumnType = ColumnDecimal < T > ; <nl> mmm a / dbms / src / Functions / FunctionsArithmetic . h <nl> ppp b / dbms / src / Functions / FunctionsArithmetic . h <nl> template < typename A , typename Op > <nl> struct UnaryOperationImpl <nl> { <nl> using ResultType = typename Op : : ResultType ; <nl> - using ArrayA = typename ColumnVector < A > : : Container ; <nl> - using ArrayC = typename ColumnVector < ResultType > : : Container ; <nl> + using ColVecA = std : : conditional_t < IsDecimalNumber < A > , ColumnDecimal < A > , ColumnVector < A > > ; <nl> + using ColVecC = std : : conditional_t < IsDecimalNumber < ResultType > , ColumnDecimal < ResultType > , ColumnVector < ResultType > > ; <nl> + using ArrayA = typename ColVecA : : Container ; <nl> + using ArrayC = typename ColVecC : : Container ; <nl> <nl> static void NO_INLINE vector ( const ArrayA & a , ArrayC & c ) <nl> { <nl> struct DecimalBinaryOperation <nl> using ResultType = ResultType_ ; <nl> using NativeResultType = typename NativeType < ResultType > : : Type ; <nl> using Op = Operation < NativeResultType , NativeResultType > ; <nl> - using ArrayA = std : : conditional_t < IsDecimalNumber < A > , typename ColumnDecimal < A > : : Container , typename ColumnVector < A > : : Container > ; <nl> - using ArrayB = std : : conditional_t < IsDecimalNumber < B > , typename ColumnDecimal < B > : : Container , typename ColumnVector < B > : : Container > ; <nl> + using ColVecA = std : : conditional_t < IsDecimalNumber < A > , ColumnDecimal < A > , ColumnVector < A > > ; <nl> + using ColVecB = std : : conditional_t < IsDecimalNumber < B > , ColumnDecimal < B > , ColumnVector < B > > ; <nl> + using ArrayA = typename ColVecA : : Container ; <nl> + using ArrayB = typename ColVecB : : Container ; <nl> using ArrayC = typename ColumnDecimal < ResultType > : : Container ; <nl> using SelfNoOverflow = DecimalBinaryOperation < A , B , Operation , ResultType_ , false > ; <nl> <nl> mmm a / dbms / src / Functions / FunctionsConversion . h <nl> ppp b / dbms / src / Functions / FunctionsConversion . h <nl> template < typename FromDataType , typename Name > <nl> struct ConvertImpl < FromDataType , std : : enable_if_t < ! std : : is_same_v < FromDataType , DataTypeString > , DataTypeString > , Name > <nl> { <nl> using FromFieldType = typename FromDataType : : FieldType ; <nl> + using ColVecType = std : : conditional_t < IsDecimalNumber < FromFieldType > , ColumnDecimal < FromFieldType > , ColumnVector < FromFieldType > > ; <nl> <nl> static void execute ( Block & block , const ColumnNumbers & arguments , size_t result , size_t / * input_rows_count * / ) <nl> { <nl> struct ConvertImpl < FromDataType , std : : enable_if_t < ! std : : is_same_v < FromDataType , <nl> if constexpr ( std : : is_same_v < FromDataType , DataTypeDateTime > ) <nl> time_zone = & extractTimeZoneFromFunctionArguments ( block , arguments , 1 , 0 ) ; <nl> <nl> - if ( const auto col_from = checkAndGetColumn < ColumnVector < FromFieldType > > ( col_with_type_and_name . column . get ( ) ) ) <nl> + if ( const auto col_from = checkAndGetColumn < ColVecType > ( col_with_type_and_name . column . get ( ) ) ) <nl> { <nl> auto col_to = ColumnString : : create ( ) ; <nl> <nl> - const typename ColumnVector < FromFieldType > : : Container & vec_from = col_from - > getData ( ) ; <nl> + const typename ColVecType : : Container & vec_from = col_from - > getData ( ) ; <nl> ColumnString : : Chars_t & data_to = col_to - > getChars ( ) ; <nl> ColumnString : : Offsets & offsets_to = col_to - > getOffsets ( ) ; <nl> size_t size = vec_from . size ( ) ; <nl> mmm a / dbms / src / IO / ReadHelpers . h <nl> ppp b / dbms / src / IO / ReadHelpers . h <nl> inline void readBinary ( String & x , ReadBuffer & buf ) { readStringBinary ( x , buf ) ; <nl> inline void readBinary ( Int128 & x , ReadBuffer & buf ) { readPODBinary ( x , buf ) ; } <nl> inline void readBinary ( UInt128 & x , ReadBuffer & buf ) { readPODBinary ( x , buf ) ; } <nl> inline void readBinary ( UInt256 & x , ReadBuffer & buf ) { readPODBinary ( x , buf ) ; } <nl> + inline void readBinary ( Decimal32 & x , ReadBuffer & buf ) { readPODBinary ( x , buf ) ; } <nl> + inline void readBinary ( Decimal64 & x , ReadBuffer & buf ) { readPODBinary ( x , buf ) ; } <nl> + inline void readBinary ( Decimal128 & x , ReadBuffer & buf ) { readPODBinary ( x , buf ) ; } <nl> inline void readBinary ( LocalDate & x , ReadBuffer & buf ) { readPODBinary ( x , buf ) ; } <nl> <nl> <nl> mmm a / dbms / src / IO / WriteHelpers . h <nl> ppp b / dbms / src / IO / WriteHelpers . h <nl> inline void writeBinary ( const StringRef & x , WriteBuffer & buf ) { writeStringBin <nl> inline void writeBinary ( const Int128 & x , WriteBuffer & buf ) { writePODBinary ( x , buf ) ; } <nl> inline void writeBinary ( const UInt128 & x , WriteBuffer & buf ) { writePODBinary ( x , buf ) ; } <nl> inline void writeBinary ( const UInt256 & x , WriteBuffer & buf ) { writePODBinary ( x , buf ) ; } <nl> + inline void writeBinary ( const Decimal32 & x , WriteBuffer & buf ) { writePODBinary ( x , buf ) ; } <nl> + inline void writeBinary ( const Decimal64 & x , WriteBuffer & buf ) { writePODBinary ( x , buf ) ; } <nl> + inline void writeBinary ( const Decimal128 & x , WriteBuffer & buf ) { writePODBinary ( x , buf ) ; } <nl> inline void writeBinary ( const LocalDate & x , WriteBuffer & buf ) { writePODBinary ( x , buf ) ; } <nl> inline void writeBinary ( const LocalDateTime & x , WriteBuffer & buf ) { writePODBinary ( x , buf ) ; } <nl> <nl> new file mode 100644 <nl> index 00000000000 . . d958ad4f8f7 <nl> mmm / dev / null <nl> ppp b / dbms / tests / queries / 0_stateless / 00700_decimal_aggregates . reference <nl> <nl> + 101 101 101 <nl> + [ - 50 . 0000 , 50 . 0000 ] [ - 16 . 66666666 , 16 . 66666666 ] [ - 10 . 00000000 , 10 . 00000000 ] <nl> + 0 . 0000 0 . 00000000 0 . 00000000 0 . 0000 0 . 00000000 0 . 00000000 <nl> + 1275 . 0000 424 . 99999983 255 . 00000000 1275 . 0000 424 . 99999983 255 . 00000000 <nl> + - 1275 . 0000 - 424 . 99999983 - 255 . 00000000 - 1275 . 0000 - 424 . 99999983 - 255 . 00000000 <nl> + 101 . 0000 101 . 00000000 101 . 00000000 101 . 0000 101 . 00000000 101 . 00000000 <nl> + - 101 . 0000 - 101 . 00000000 - 101 . 00000000 - 101 . 0000 - 101 . 00000000 - 101 . 00000000 <nl> + 0 . 0000 0 . 00000000 0 . 00000000 <nl> + 25 . 5000 8 . 49999999 5 . 10000000 <nl> + - 25 . 5000 - 8 . 49999999 - 5 . 10000000 <nl> + ( 101 , 101 , 101 ) ( 101 , 101 , 101 ) ( 101 , 101 , 101 ) ( 102 , 100 , 101 ) <nl> + 5 5 5 <nl> + 10 10 10 <nl> + - 50 . 0000 - 50 . 0000 - 16 . 66666666 - 16 . 66666666 - 10 . 00000000 - 10 . 00000000 <nl> + 1 . 0000 1 . 0000 0 . 33333333 0 . 33333333 0 . 20000000 0 . 20000000 <nl> + 50 . 0000 50 . 0000 16 . 66666666 16 . 66666666 10 . 00000000 10 . 00000000 <nl> + - 1 . 0000 - 1 . 0000 - 0 . 33333333 - 0 . 33333333 - 0 . 20000000 - 0 . 20000000 <nl> + 0 . 0000 0 . 00000000 0 . 00000000 <nl> + - 25 . 0000 - 8 . 33333333 - 5 . 00000000 <nl> + 0 . 0000 0 . 00000000 0 . 00000000 <nl> + 10 . 0000 3 . 33333333 2 . 00000000 <nl> + 20 . 0000 6 . 66666666 4 . 00000000 <nl> + 30 . 0000 10 . 00000000 6 . 00000000 <nl> + 40 . 0000 13 . 33333333 8 . 00000000 <nl> + 50 . 0000 16 . 66666666 10 . 00000000 <nl> + [ - 50 . 0000 , - 40 . 0000 , - 30 . 0000 , - 20 . 0000 , - 10 . 0000 , 0 . 0000 , 10 . 0000 , 20 . 0000 , 30 . 0000 , 40 . 0000 , 50 . 0000 ] <nl> + [ - 16 . 66666666 , - 13 . 33333333 , - 10 . 00000000 , - 6 . 66666666 , - 3 . 33333333 , 0 . 00000000 , 3 . 33333333 , 6 . 66666666 , 10 . 00000000 , 13 . 33333333 , 16 . 66666666 ] <nl> + [ - 10 . 00000000 , - 8 . 00000000 , - 6 . 00000000 , - 4 . 00000000 , - 2 . 00000000 , 0 . 00000000 , 2 . 00000000 , 4 . 00000000 , 6 . 00000000 , 8 . 00000000 , 10 . 00000000 ] <nl> new file mode 100644 <nl> index 00000000000 . . 968ede183ca <nl> mmm / dev / null <nl> ppp b / dbms / tests / queries / 0_stateless / 00700_decimal_aggregates . sql <nl> <nl> + SET allow_experimental_decimal_type = 1 ; <nl> + SET send_logs_level = ' none ' ; <nl> + <nl> + CREATE DATABASE IF NOT EXISTS test ; <nl> + DROP TABLE IF EXISTS test . decimal ; <nl> + <nl> + CREATE TABLE test . decimal <nl> + ( <nl> + a Decimal32 ( 4 ) , <nl> + b Decimal64 ( 8 ) , <nl> + c Decimal128 ( 8 ) <nl> + ) ENGINE = Memory ; <nl> + <nl> + INSERT INTO test . decimal ( a , b , c ) <nl> + SELECT toDecimal32 ( number - 50 , 4 ) , toDecimal64 ( number - 50 , 8 ) / 3 , toDecimal128 ( number - 50 , 8 ) / 5 <nl> + FROM system . numbers LIMIT 101 ; <nl> + <nl> + SELECT count ( a ) , count ( b ) , count ( c ) FROM test . decimal ; <nl> + SELECT [ min ( a ) , max ( a ) ] , [ min ( b ) , max ( b ) ] , [ min ( c ) , max ( c ) ] FROM test . decimal ; <nl> + <nl> + SELECT sum ( a ) , sum ( b ) , sum ( c ) , sumWithOverflow ( a ) , sumWithOverflow ( b ) , sumWithOverflow ( c ) FROM test . decimal ; <nl> + SELECT sum ( a ) , sum ( b ) , sum ( c ) , sumWithOverflow ( a ) , sumWithOverflow ( b ) , sumWithOverflow ( c ) FROM test . decimal WHERE a > 0 ; <nl> + SELECT sum ( a ) , sum ( b ) , sum ( c ) , sumWithOverflow ( a ) , sumWithOverflow ( b ) , sumWithOverflow ( c ) FROM test . decimal WHERE a < 0 ; <nl> + SELECT sum ( a + 1 ) , sum ( b + 1 ) , sum ( c + 1 ) , sumWithOverflow ( a + 1 ) , sumWithOverflow ( b + 1 ) , sumWithOverflow ( c + 1 ) FROM test . decimal ; <nl> + SELECT sum ( a - 1 ) , sum ( b - 1 ) , sum ( c - 1 ) , sumWithOverflow ( a - 1 ) , sumWithOverflow ( b - 1 ) , sumWithOverflow ( c - 1 ) FROM test . decimal ; <nl> + <nl> + SELECT avg ( a ) , avg ( b ) , avg ( c ) FROM test . decimal ; <nl> + SELECT avg ( a ) , avg ( b ) , avg ( c ) FROM test . decimal WHERE a > 0 ; <nl> + SELECT avg ( a ) , avg ( b ) , avg ( c ) FROM test . decimal WHERE a < 0 ; <nl> + <nl> + SELECT ( uniq ( a ) , uniq ( b ) , uniq ( c ) ) , <nl> + ( uniqCombined ( a ) , uniqCombined ( b ) , uniqCombined ( c ) ) , <nl> + ( uniqExact ( a ) , uniqExact ( b ) , uniqExact ( c ) ) , <nl> + ( uniqHLL12 ( a ) , uniqHLL12 ( b ) , uniqHLL12 ( c ) ) <nl> + FROM ( SELECT * FROM test . decimal ORDER BY a ) ; <nl> + <nl> + SELECT uniqUpTo ( 10 ) ( a ) , uniqUpTo ( 10 ) ( b ) , uniqUpTo ( 10 ) ( c ) FROM test . decimal WHERE a > = 0 AND a < 5 ; <nl> + SELECT uniqUpTo ( 10 ) ( a ) , uniqUpTo ( 10 ) ( b ) , uniqUpTo ( 10 ) ( c ) FROM test . decimal WHERE a > = 0 AND a < 10 ; <nl> + <nl> + SELECT argMin ( a , b ) , argMin ( a , c ) , argMin ( b , a ) , argMin ( b , c ) , argMin ( c , a ) , argMin ( c , b ) FROM test . decimal ; <nl> + SELECT argMin ( a , b ) , argMin ( a , c ) , argMin ( b , a ) , argMin ( b , c ) , argMin ( c , a ) , argMin ( c , b ) FROM test . decimal WHERE a > 0 ; <nl> + SELECT argMax ( a , b ) , argMax ( a , c ) , argMax ( b , a ) , argMax ( b , c ) , argMax ( c , a ) , argMax ( c , b ) FROM test . decimal ; <nl> + SELECT argMax ( a , b ) , argMax ( a , c ) , argMax ( b , a ) , argMax ( b , c ) , argMax ( c , a ) , argMax ( c , b ) FROM test . decimal WHERE a < 0 ; <nl> + <nl> + SELECT medianExact ( a ) , medianExact ( b ) , medianExact ( c ) FROM test . decimal ; <nl> + SELECT quantileExact ( a ) , quantileExact ( b ) , quantileExact ( c ) FROM test . decimal WHERE a < 0 ; <nl> + SELECT quantileExact ( 0 . 0 ) ( a ) , quantileExact ( 0 . 0 ) ( b ) , quantileExact ( 0 . 0 ) ( c ) FROM test . decimal WHERE a > = 0 ; <nl> + SELECT quantileExact ( 0 . 2 ) ( a ) , quantileExact ( 0 . 2 ) ( b ) , quantileExact ( 0 . 2 ) ( c ) FROM test . decimal WHERE a > = 0 ; <nl> + SELECT quantileExact ( 0 . 4 ) ( a ) , quantileExact ( 0 . 4 ) ( b ) , quantileExact ( 0 . 4 ) ( c ) FROM test . decimal WHERE a > = 0 ; <nl> + SELECT quantileExact ( 0 . 6 ) ( a ) , quantileExact ( 0 . 6 ) ( b ) , quantileExact ( 0 . 6 ) ( c ) FROM test . decimal WHERE a > = 0 ; <nl> + SELECT quantileExact ( 0 . 8 ) ( a ) , quantileExact ( 0 . 8 ) ( b ) , quantileExact ( 0 . 8 ) ( c ) FROM test . decimal WHERE a > = 0 ; <nl> + SELECT quantileExact ( 1 . 0 ) ( a ) , quantileExact ( 1 . 0 ) ( b ) , quantileExact ( 1 . 0 ) ( c ) FROM test . decimal WHERE a > = 0 ; <nl> + SELECT quantilesExact ( 0 . 0 , 0 . 1 , 0 . 2 , 0 . 3 , 0 . 4 , 0 . 5 , 0 . 6 , 0 . 7 , 0 . 8 , 0 . 9 , 1 . 0 ) ( a ) FROM test . decimal ; <nl> + SELECT quantilesExact ( 0 . 0 , 0 . 1 , 0 . 2 , 0 . 3 , 0 . 4 , 0 . 5 , 0 . 6 , 0 . 7 , 0 . 8 , 0 . 9 , 1 . 0 ) ( b ) FROM test . decimal ; <nl> + SELECT quantilesExact ( 0 . 0 , 0 . 1 , 0 . 2 , 0 . 3 , 0 . 4 , 0 . 5 , 0 . 6 , 0 . 7 , 0 . 8 , 0 . 9 , 1 . 0 ) ( c ) FROM test . decimal ; <nl> + <nl> + - - TODO : sumMap <nl> + - - TODO : other quantile ( s ) <nl> + - - TODO : groupArray , groupArrayInsertAt , groupUniqArray <nl> + - - TODO : topK <nl>
Merge pull request from 4ertus2 / decimal
ClickHouse/ClickHouse
5998496790002fbc5ca3faebc8a672b6ee4f29eb
2018-09-13T00:01:27Z
mmm a / tools / SourceKit / lib / SwiftLang / SwiftEditor . cpp <nl> ppp b / tools / SourceKit / lib / SwiftLang / SwiftEditor . cpp <nl> ImmutableTextSnapshotRef SwiftEditorDocument : : initializeText ( <nl> return Impl . EditableBuffer - > getSnapshot ( ) ; <nl> } <nl> <nl> + static void updateSemaInfo ( RefPtr < SwiftDocumentSemanticInfo > SemanticInfo , <nl> + EditableTextBufferRef EditableBuffer ) { <nl> + if ( SemanticInfo ) { <nl> + SemanticInfo - > processLatestSnapshotAsync ( EditableBuffer ) ; <nl> + } <nl> + } <nl> + <nl> ImmutableTextSnapshotRef SwiftEditorDocument : : replaceText ( <nl> unsigned Offset , unsigned Length , llvm : : MemoryBuffer * Buf , <nl> bool ProvideSemanticInfo , std : : string & error ) { <nl> <nl> - llvm : : sys : : ScopedLock L ( Impl . AccessMtx ) ; <nl> + ImmutableTextSnapshotRef Snapshot ; <nl> + EditableTextBufferRef EditableBuffer ; <nl> + RefPtr < SwiftDocumentSemanticInfo > SemanticInfo ; <nl> + { <nl> + llvm : : sys : : ScopedLock L ( Impl . AccessMtx ) ; <nl> <nl> - / / Validate offset and length . <nl> - if ( ( Offset + Length ) > Impl . EditableBuffer - > getSize ( ) ) { <nl> - error = " ' offset ' + ' length ' is out of range " ; <nl> - return nullptr ; <nl> - } <nl> + EditableBuffer = Impl . EditableBuffer ; <nl> + SemanticInfo = Impl . SemanticInfo ; <nl> + <nl> + / / Validate offset and length . <nl> + if ( ( Offset + Length ) > EditableBuffer - > getSize ( ) ) { <nl> + error = " ' offset ' + ' length ' is out of range " ; <nl> + return nullptr ; <nl> + } <nl> + <nl> + Impl . Edited = true ; <nl> + llvm : : StringRef Str = Buf - > getBuffer ( ) ; <nl> + <nl> + / / Update the buffer itself <nl> + Snapshot = EditableBuffer - > replace ( Offset , Length , Str ) ; <nl> <nl> - Impl . Edited = true ; <nl> - llvm : : StringRef Str = Buf - > getBuffer ( ) ; <nl> + / / Update the old syntax map offsets to account for the replaced range . <nl> + / / Also set the initial AffectedRange to cover any tokens that <nl> + / / the replaced range intersected . This allows for clients that split <nl> + / / multi - line tokens at line boundaries , and ensure all parts of these tokens <nl> + / / will be cleared . <nl> + Impl . AffectedRange = <nl> + Impl . SyntaxMap . adjustForReplacement ( Offset , Length , Str . size ( ) ) ; <nl> <nl> - / / Update the buffer itself <nl> - ImmutableTextSnapshotRef Snapshot = <nl> - Impl . EditableBuffer - > replace ( Offset , Length , Str ) ; <nl> + / / We need to release ` AccessMtx ` before calling into the ASTManager , since <nl> + / / it may call back to the editor for document state . <nl> + } <nl> <nl> if ( ProvideSemanticInfo ) { <nl> / / If this is not a no - op , update semantic info . <nl> if ( Length ! = 0 | | Buf - > getBufferSize ( ) ! = 0 ) { <nl> - updateSemaInfo ( ) ; <nl> + : : updateSemaInfo ( SemanticInfo , EditableBuffer ) ; <nl> <nl> / / FIXME : we should also update any " interesting " ASTs that depend on this <nl> / / document here , e . g . any ASTs for files visible in an editor . However , <nl> ImmutableTextSnapshotRef SwiftEditorDocument : : replaceText ( <nl> } <nl> } <nl> <nl> - / / Update the old syntax map offsets to account for the replaced range . <nl> - / / Also set the initial AffectedRange to cover any tokens that <nl> - / / the replaced range intersected . This allows for clients that split <nl> - / / multi - line tokens at line boundaries , and ensure all parts of these tokens <nl> - / / will be cleared . <nl> - Impl . AffectedRange = Impl . SyntaxMap . adjustForReplacement ( Offset , Length , Str . size ( ) ) ; <nl> - <nl> return Snapshot ; <nl> } <nl> <nl> void SwiftEditorDocument : : updateSemaInfo ( ) { <nl> Impl . AccessMtx . lock ( ) ; <nl> auto EditableBuffer = Impl . EditableBuffer ; <nl> auto SemanticInfo = Impl . SemanticInfo ; <nl> - Impl . AccessMtx . unlock ( ) ; / / Not a recursive mutex , so unlock before processing <nl> + / / We need to release ` AccessMtx ` before calling into the ASTManager , since it <nl> + / / may call back to the editor for document state . <nl> + Impl . AccessMtx . unlock ( ) ; <nl> <nl> - if ( SemanticInfo ) { <nl> - SemanticInfo - > processLatestSnapshotAsync ( EditableBuffer ) ; <nl> - } <nl> + : : updateSemaInfo ( SemanticInfo , EditableBuffer ) ; <nl> } <nl> <nl> void SwiftEditorDocument : : parse ( ImmutableTextSnapshotRef Snapshot , <nl>
[ sourcekit ] Fix a lock inversion in editorReplaceText found by TSan
apple/swift
e2ee2b6a6780b9d7f5a4c4a281e7db185df22f6a
2018-09-21T18:24:58Z
mmm a / Kodi . xcodeproj / project . pbxproj <nl> ppp b / Kodi . xcodeproj / project . pbxproj <nl> <nl> 38F4E56E13CCCB3B00664821 / * ThreadLocal . h * / = { isa = PBXFileReference ; fileEncoding = 4 ; lastKnownFileType = sourcecode . c . h ; path = ThreadLocal . h ; sourceTree = " < group > " ; } ; <nl> 395897131AAD94F00033D27C / * KeyboardLayoutManager . cpp * / = { isa = PBXFileReference ; fileEncoding = 4 ; lastKnownFileType = sourcecode . cpp . cpp ; path = KeyboardLayoutManager . cpp ; sourceTree = " < group > " ; } ; <nl> 395897141AAD94F00033D27C / * KeyboardLayoutManager . h * / = { isa = PBXFileReference ; fileEncoding = 4 ; lastKnownFileType = sourcecode . c . h ; path = KeyboardLayoutManager . h ; sourceTree = " < group > " ; } ; <nl> + 395938731AC28F5A0053A590 / * EmbeddedArt . h * / = { isa = PBXFileReference ; fileEncoding = 4 ; lastKnownFileType = sourcecode . c . h ; path = EmbeddedArt . h ; sourceTree = " < group > " ; } ; <nl> 395C29BA1A94733100EBC7AD / * Key . cpp * / = { isa = PBXFileReference ; fileEncoding = 4 ; lastKnownFileType = sourcecode . cpp . cpp ; path = Key . cpp ; sourceTree = " < group > " ; } ; <nl> 395C29BB1A94733100EBC7AD / * Key . h * / = { isa = PBXFileReference ; fileEncoding = 4 ; lastKnownFileType = sourcecode . c . h ; path = Key . h ; sourceTree = " < group > " ; } ; <nl> 395C29BF1A98A0A000EBC7AD / * Webinterface . cpp * / = { isa = PBXFileReference ; fileEncoding = 4 ; lastKnownFileType = sourcecode . cpp . cpp ; path = Webinterface . cpp ; sourceTree = " < group > " ; } ; <nl> <nl> 880DBE4A0DC223FF00E26B71 / * Artist . h * / , <nl> 5EB3113A1A978B9B00551907 / * CueInfoLoader . cpp * / , <nl> 5EB3113B1A978B9B00551907 / * CueInfoLoader . h * / , <nl> + 395938731AC28F5A0053A590 / * EmbeddedArt . h * / , <nl> E38E17FB0D25F9FA00618676 / * GUIViewStateMusic . cpp * / , <nl> E38E17FC0D25F9FA00618676 / * GUIViewStateMusic . h * / , <nl> E38E1D8F0D25F9FD00618676 / * MusicDatabase . cpp * / , <nl> mmm a / project / VS2010Express / XBMC . vcxproj <nl> ppp b / project / VS2010Express / XBMC . vcxproj <nl> <nl> < ClInclude Include = " . . \ . . \ xbmc \ interfaces \ python \ pythreadstate . h " / > <nl> < ClInclude Include = " . . \ . . \ xbmc \ media \ MediaType . h " / > <nl> < ClInclude Include = " . . \ . . \ xbmc \ music \ CueInfoLoader . h " / > <nl> + < ClInclude Include = " . . \ . . \ xbmc \ music \ EmbeddedArt . h " / > <nl> < ClInclude Include = " . . \ . . \ xbmc \ music \ karaoke \ karaokevideobackground . h " / > <nl> < ClInclude Include = " . . \ . . \ xbmc \ music \ tags \ ReplayGain . h " / > <nl> < ClInclude Include = " . . \ . . \ xbmc \ network \ httprequesthandler \ HTTPFileHandler . h " / > <nl> <nl> < / VisualStudio > <nl> < / ProjectExtensions > <nl> < Import Project = " $ ( SolutionDir ) \ $ ( ProjectFileName ) . targets . user " Condition = " Exists ( ' $ ( SolutionDir ) \ $ ( ProjectFileName ) . targets . user ' ) " / > <nl> - < / Project > <nl> + < / Project > <nl> \ No newline at end of file <nl> mmm a / project / VS2010Express / XBMC . vcxproj . filters <nl> ppp b / project / VS2010Express / XBMC . vcxproj . filters <nl> <nl> - < ? xml version = " 1 . 0 " encoding = " utf - 8 " ? > <nl> +  < ? xml version = " 1 . 0 " encoding = " utf - 8 " ? > <nl> < Project ToolsVersion = " 4 . 0 " xmlns = " http : / / schemas . microsoft . com / developer / msbuild / 2003 " > <nl> < ItemGroup > <nl> < Filter Include = " win32 " > <nl> <nl> < ClCompile Include = " . . \ . . \ xbmc \ music \ CueInfoLoader . cpp " > <nl> < Filter > music < / Filter > <nl> < / ClCompile > <nl> + < ClCompile Include = " . . \ . . \ xbmc \ filesystem \ NFSDirectory . cpp " / > <nl> < / ItemGroup > <nl> < ItemGroup > <nl> < ClInclude Include = " . . \ . . \ xbmc \ win32 \ pch . h " > <nl> <nl> < ClInclude Include = " . . \ . . \ xbmc \ input \ KeyboardLayoutManager . h " > <nl> < Filter > input < / Filter > <nl> < / ClInclude > <nl> + < ClInclude Include = " . . \ . . \ xbmc \ music \ EmbeddedArt . h " > <nl> + < Filter > music < / Filter > <nl> + < / ClInclude > <nl> < / ItemGroup > <nl> < ItemGroup > <nl> < ResourceCompile Include = " . . \ . . \ xbmc \ win32 \ XBMC_PC . rc " > <nl> <nl> < Filter > interfaces \ swig < / Filter > <nl> < / CustomBuild > <nl> < / ItemGroup > <nl> - < / Project > <nl> + < / Project > <nl> \ No newline at end of file <nl> mmm a / xbmc / Application . cpp <nl> ppp b / xbmc / Application . cpp <nl> <nl> # include " utils / XMLUtils . h " <nl> # include " addons / AddonInstaller . h " <nl> # include " addons / AddonManager . h " <nl> + # include " music / tags / MusicInfoTag . h " <nl> # include " music / tags / MusicInfoTagLoaderFactory . h " <nl> # include " CompileInfo . h " <nl> <nl> mmm a / xbmc / music / Album . cpp <nl> ppp b / xbmc / music / Album . cpp <nl> <nl> * / <nl> <nl> # include " Album . h " <nl> + # include " music / tags / MusicInfoTag . h " <nl> # include " settings / AdvancedSettings . h " <nl> # include " utils / StringUtils . h " <nl> # include " utils / XMLUtils . h " <nl> mmm a / xbmc / music / CueInfoLoader . cpp <nl> ppp b / xbmc / music / CueInfoLoader . cpp <nl> <nl> * <nl> * / <nl> # include " CueInfoLoader . h " <nl> + # include " music / tags / MusicInfoTag . h " <nl> <nl> void CueInfoLoader : : Load ( const std : : string & aStrCuesheet , CFileItemPtr aFileItem ) <nl> { <nl> new file mode 100644 <nl> index 000000000000 . . 55bf2bb25a33 <nl> mmm / dev / null <nl> ppp b / xbmc / music / EmbeddedArt . h <nl> <nl> + # pragma once <nl> + / * <nl> + * Copyright ( C ) 2015 Team XBMC <nl> + * http : / / xbmc . org <nl> + * <nl> + * This Program is free software ; you can redistribute it and / or modify <nl> + * it under the terms of the GNU General Public License as published by <nl> + * the Free Software Foundation ; either version 2 , or ( at your option ) <nl> + * any later version . <nl> + * <nl> + * This Program is distributed in the hope that it will be useful , <nl> + * but WITHOUT ANY WARRANTY ; without even the implied warranty of <nl> + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE . See the <nl> + * GNU General Public License for more details . <nl> + * <nl> + * You should have received a copy of the GNU General Public License <nl> + * along with XBMC ; see the file COPYING . If not , see <nl> + * < http : / / www . gnu . org / licenses / > . <nl> + * <nl> + * / <nl> + <nl> + # include < stdint . h > <nl> + # include < string > <nl> + # include < vector > <nl> + <nl> + # include " utils / IArchivable . h " <nl> + <nl> + namespace MUSIC_INFO <nl> + { <nl> + class EmbeddedArtInfo : public IArchivable <nl> + { <nl> + public : <nl> + EmbeddedArtInfo ( ) { } <nl> + EmbeddedArtInfo ( size_t size , const std : : string & mime ) ; <nl> + ~ EmbeddedArtInfo ( ) { } <nl> + <nl> + / / implementation of IArchivable <nl> + virtual void Archive ( CArchive & ar ) ; <nl> + <nl> + void set ( size_t size , const std : : string & mime ) ; <nl> + void clear ( ) ; <nl> + bool empty ( ) const ; <nl> + bool matches ( const EmbeddedArtInfo & right ) const ; <nl> + <nl> + size_t size ; <nl> + std : : string mime ; <nl> + } ; <nl> + <nl> + class EmbeddedArt : public EmbeddedArtInfo <nl> + { <nl> + public : <nl> + EmbeddedArt ( ) { } <nl> + EmbeddedArt ( const uint8_t * data , size_t size , const std : : string & mime ) ; <nl> + ~ EmbeddedArt ( ) { } <nl> + <nl> + void set ( const uint8_t * data , size_t size , const std : : string & mime ) ; <nl> + <nl> + std : : vector < uint8_t > data ; <nl> + } ; <nl> + } <nl> \ No newline at end of file <nl> mmm a / xbmc / music / Song . h <nl> ppp b / xbmc / music / Song . h <nl> <nl> <nl> # include " utils / ISerializable . h " <nl> # include " XBDateTime . h " <nl> - # include " music / tags / MusicInfoTag . h " / / for EmbeddedArt <nl> + # include " music / EmbeddedArt . h " <nl> + # include " music / tags / ReplayGain . h " <nl> # include " Artist . h " <nl> # include < map > <nl> # include < string > <nl> mmm a / xbmc / music / tags / MusicInfoTag . h <nl> ppp b / xbmc / music / tags / MusicInfoTag . h <nl> class CArtist ; <nl> # include < string > <nl> # include < stdint . h > <nl> <nl> + # include " music / EmbeddedArt . h " <nl> # include " utils / IArchivable . h " <nl> # include " utils / ISerializable . h " <nl> # include " utils / ISortable . h " <nl> class CArtist ; <nl> <nl> namespace MUSIC_INFO <nl> { <nl> - class EmbeddedArtInfo : public IArchivable <nl> - { <nl> - public : <nl> - EmbeddedArtInfo ( ) { } ; <nl> - EmbeddedArtInfo ( size_t size , const std : : string & mime ) ; <nl> - void set ( size_t size , const std : : string & mime ) ; <nl> - void clear ( ) ; <nl> - bool empty ( ) const ; <nl> - bool matches ( const EmbeddedArtInfo & right ) const ; <nl> - virtual void Archive ( CArchive & ar ) ; <nl> - size_t size ; <nl> - std : : string mime ; <nl> - } ; <nl> - <nl> - class EmbeddedArt : public EmbeddedArtInfo <nl> - { <nl> - public : <nl> - EmbeddedArt ( ) { } ; <nl> - EmbeddedArt ( const uint8_t * data , size_t size , const std : : string & mime ) ; <nl> - void set ( const uint8_t * data , size_t size , const std : : string & mime ) ; <nl> - std : : vector < uint8_t > data ; <nl> - } ; <nl> - <nl> class CMusicInfoTag : public IArchivable , public ISerializable , public ISortable <nl> { <nl> public : <nl>
music : move EmbeddedArt and EmbeddedArtInfo from MusicInfoTag . h into its own header file
xbmc/xbmc
eb06fd40f8007e54c057c5e6a275dc73a89f1c2b
2015-04-01T08:24:58Z
mmm a / src / yuzu / configuration / config . cpp <nl> ppp b / src / yuzu / configuration / config . cpp <nl> void Config : : ReadMotionTouchValues ( ) { <nl> void Config : : ReadCoreValues ( ) { <nl> qt_config - > beginGroup ( QStringLiteral ( " Core " ) ) ; <nl> <nl> - ReadSettingGlobal ( Settings : : values . use_multi_core , QStringLiteral ( " use_multi_core " ) , false ) ; <nl> + ReadSettingGlobal ( Settings : : values . use_multi_core , QStringLiteral ( " use_multi_core " ) , true ) ; <nl> <nl> qt_config - > endGroup ( ) ; <nl> } <nl> void Config : : ReadRendererValues ( ) { <nl> QStringLiteral ( " use_disk_shader_cache " ) , true ) ; <nl> ReadSettingGlobal ( Settings : : values . gpu_accuracy , QStringLiteral ( " gpu_accuracy " ) , 0 ) ; <nl> ReadSettingGlobal ( Settings : : values . use_asynchronous_gpu_emulation , <nl> - QStringLiteral ( " use_asynchronous_gpu_emulation " ) , false ) ; <nl> + QStringLiteral ( " use_asynchronous_gpu_emulation " ) , true ) ; <nl> ReadSettingGlobal ( Settings : : values . use_nvdec_emulation , QStringLiteral ( " use_nvdec_emulation " ) , <nl> true ) ; <nl> ReadSettingGlobal ( Settings : : values . use_vsync , QStringLiteral ( " use_vsync " ) , true ) ; <nl> ReadSettingGlobal ( Settings : : values . use_assembly_shaders , QStringLiteral ( " use_assembly_shaders " ) , <nl> - false ) ; <nl> + true ) ; <nl> ReadSettingGlobal ( Settings : : values . use_asynchronous_shaders , <nl> QStringLiteral ( " use_asynchronous_shaders " ) , false ) ; <nl> ReadSettingGlobal ( Settings : : values . use_fast_gpu_time , QStringLiteral ( " use_fast_gpu_time " ) , <nl> void Config : : SaveControlValues ( ) { <nl> void Config : : SaveCoreValues ( ) { <nl> qt_config - > beginGroup ( QStringLiteral ( " Core " ) ) ; <nl> <nl> - WriteSettingGlobal ( QStringLiteral ( " use_multi_core " ) , Settings : : values . use_multi_core , false ) ; <nl> + WriteSettingGlobal ( QStringLiteral ( " use_multi_core " ) , Settings : : values . use_multi_core , true ) ; <nl> <nl> qt_config - > endGroup ( ) ; <nl> } <nl> void Config : : SaveRendererValues ( ) { <nl> static_cast < int > ( Settings : : values . gpu_accuracy . GetValue ( global ) ) , <nl> Settings : : values . gpu_accuracy . UsingGlobal ( ) , 0 ) ; <nl> WriteSettingGlobal ( QStringLiteral ( " use_asynchronous_gpu_emulation " ) , <nl> - Settings : : values . use_asynchronous_gpu_emulation , false ) ; <nl> + Settings : : values . use_asynchronous_gpu_emulation , true ) ; <nl> WriteSettingGlobal ( QStringLiteral ( " use_nvdec_emulation " ) , Settings : : values . use_nvdec_emulation , <nl> true ) ; <nl> WriteSettingGlobal ( QStringLiteral ( " use_vsync " ) , Settings : : values . use_vsync , true ) ; <nl> WriteSettingGlobal ( QStringLiteral ( " use_assembly_shaders " ) , <nl> - Settings : : values . use_assembly_shaders , false ) ; <nl> + Settings : : values . use_assembly_shaders , true ) ; <nl> WriteSettingGlobal ( QStringLiteral ( " use_asynchronous_shaders " ) , <nl> Settings : : values . use_asynchronous_shaders , false ) ; <nl> WriteSettingGlobal ( QStringLiteral ( " use_fast_gpu_time " ) , Settings : : values . use_fast_gpu_time , <nl> mmm a / src / yuzu_cmd / config . cpp <nl> ppp b / src / yuzu_cmd / config . cpp <nl> void Config : : ReadValues ( ) { <nl> <nl> / / Core <nl> Settings : : values . use_multi_core . SetValue ( <nl> - sdl2_config - > GetBoolean ( " Core " , " use_multi_core " , false ) ) ; <nl> + sdl2_config - > GetBoolean ( " Core " , " use_multi_core " , true ) ) ; <nl> <nl> / / Renderer <nl> const int renderer_backend = sdl2_config - > GetInteger ( <nl> void Config : : ReadValues ( ) { <nl> const int gpu_accuracy_level = sdl2_config - > GetInteger ( " Renderer " , " gpu_accuracy " , 0 ) ; <nl> Settings : : values . gpu_accuracy . SetValue ( static_cast < Settings : : GPUAccuracy > ( gpu_accuracy_level ) ) ; <nl> Settings : : values . use_asynchronous_gpu_emulation . SetValue ( <nl> - sdl2_config - > GetBoolean ( " Renderer " , " use_asynchronous_gpu_emulation " , false ) ) ; <nl> + sdl2_config - > GetBoolean ( " Renderer " , " use_asynchronous_gpu_emulation " , true ) ) ; <nl> Settings : : values . use_vsync . SetValue ( <nl> static_cast < u16 > ( sdl2_config - > GetInteger ( " Renderer " , " use_vsync " , 1 ) ) ) ; <nl> Settings : : values . use_assembly_shaders . SetValue ( <nl> - sdl2_config - > GetBoolean ( " Renderer " , " use_assembly_shaders " , false ) ) ; <nl> + sdl2_config - > GetBoolean ( " Renderer " , " use_assembly_shaders " , true ) ) ; <nl> Settings : : values . use_asynchronous_shaders . SetValue ( <nl> sdl2_config - > GetBoolean ( " Renderer " , " use_asynchronous_shaders " , false ) ) ; <nl> Settings : : values . use_asynchronous_shaders . SetValue ( <nl> mmm a / src / yuzu_cmd / default_ini . h <nl> ppp b / src / yuzu_cmd / default_ini . h <nl> udp_pad_index = <nl> <nl> [ Core ] <nl> # Whether to use multi - core for CPU emulation <nl> - # 0 ( default ) : Disabled , 1 : Enabled <nl> + # 0 : Disabled , 1 ( default ) : Enabled <nl> use_multi_core = <nl> <nl> [ Cpu ] <nl> max_anisotropy = <nl> use_vsync = <nl> <nl> # Whether to use OpenGL assembly shaders or not . NV_gpu_program5 is required . <nl> - # 0 ( default ) : Off , 1 : On <nl> + # 0 : Off , 1 ( default ) : On <nl> use_assembly_shaders = <nl> <nl> # Whether to allow asynchronous shader building . <nl>
Merge pull request from bunnei / update - defaults
yuzu-emu/yuzu
cd92a94965a726a90032b15dbcc5ead877fac030
2020-10-27T06:14:09Z
new file mode 100644 <nl> index 000000000000 . . 3f9c1a3edf5b <nl> mmm / dev / null <nl> ppp b / include / swift / Runtime / Atomic . h <nl> <nl> + / / = = = mmm Atomic . h - Utilities for atomic operations . mmmmmmmmmmmm * - C + + - * - = = = / / <nl> + / / <nl> + / / This source file is part of the Swift . org open source project <nl> + / / <nl> + / / Copyright ( c ) 2014 - 2018 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> + / / Utilities for atomic operations , to use with std : : atomic . <nl> + / / <nl> + / / = = = mmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmm - = = = / / <nl> + <nl> + # ifndef SWIFT_RUNTIME_ATOMIC_H <nl> + # define SWIFT_RUNTIME_ATOMIC_H <nl> + <nl> + / / FIXME : Workaround for rdar : / / problem / 18889711 . ' Consume ' does not require <nl> + / / a barrier on ARM64 , but LLVM doesn ' t know that . Although ' relaxed ' <nl> + / / is formally UB by C + + 11 language rules , we should be OK because neither <nl> + / / the processor model nor the optimizer can realistically reorder our uses <nl> + / / of ' consume ' . <nl> + # if __arm64__ | | __arm__ <nl> + # define SWIFT_MEMORY_ORDER_CONSUME ( std : : memory_order_relaxed ) <nl> + # else <nl> + # define SWIFT_MEMORY_ORDER_CONSUME ( std : : memory_order_consume ) <nl> + # endif <nl> + <nl> + # endif <nl> mmm a / include / swift / Runtime / Concurrent . h <nl> ppp b / include / swift / Runtime / Concurrent . h <nl> <nl> # ifndef SWIFT_RUNTIME_CONCURRENTUTILS_H <nl> # define SWIFT_RUNTIME_CONCURRENTUTILS_H <nl> # include < iterator > <nl> + # include < algorithm > <nl> # include < atomic > <nl> # include < functional > <nl> # include < stdint . h > <nl> # include " llvm / Support / Allocator . h " <nl> + # include " Atomic . h " <nl> + # include " Debug . h " <nl> + # include " Mutex . h " <nl> <nl> # if defined ( __FreeBSD__ ) | | defined ( __CYGWIN__ ) | | defined ( __HAIKU__ ) <nl> # include < stdio . h > <nl> class ConcurrentMap <nl> } <nl> } ; <nl> <nl> + <nl> + / / / An append - only array that can be read without taking locks . Writes <nl> + / / / are still locked and serialized , but only with respect to other <nl> + / / / writes . <nl> + template < class ElemTy > struct ConcurrentReadableArray { <nl> + private : <nl> + / / / The struct used for the array ' s storage . The ` Elem ` member is <nl> + / / / considered to be the first element of a variable - length array , <nl> + / / / whose size is determined by the allocation . The ` Capacity ` member <nl> + / / / from ` ConcurrentReadableArray ` indicates how large it can be . <nl> + struct Storage { <nl> + std : : atomic < size_t > Count ; <nl> + typename std : : aligned_storage < sizeof ( ElemTy ) , alignof ( ElemTy ) > : : type Elem ; <nl> + <nl> + static Storage * allocate ( size_t capacity ) { <nl> + auto size = sizeof ( Storage ) + ( capacity - 1 ) * sizeof ( Storage ( ) . Elem ) ; <nl> + auto * ptr = reinterpret_cast < Storage * > ( malloc ( size ) ) ; <nl> + if ( ! ptr ) swift : : crash ( " Could not allocate memory . " ) ; <nl> + ptr - > Count . store ( 0 , std : : memory_order_relaxed ) ; <nl> + return ptr ; <nl> + } <nl> + <nl> + void deallocate ( ) { <nl> + for ( size_t i = 0 ; i < Count ; i + + ) { <nl> + data ( ) [ i ] . ~ ElemTy ( ) ; <nl> + } <nl> + free ( this ) ; <nl> + } <nl> + <nl> + ElemTy * data ( ) { <nl> + return reinterpret_cast < ElemTy * > ( & Elem ) ; <nl> + } <nl> + } ; <nl> + <nl> + size_t Capacity ; <nl> + std : : atomic < size_t > ReaderCount ; <nl> + std : : atomic < Storage * > Elements ; <nl> + Mutex WriterLock ; <nl> + std : : vector < Storage * > FreeList ; <nl> + <nl> + public : <nl> + / / This type cannot be safely copied , moved , or deleted . <nl> + ConcurrentReadableArray ( const ConcurrentReadableArray & ) = delete ; <nl> + ConcurrentReadableArray ( ConcurrentReadableArray & & ) = delete ; <nl> + ConcurrentReadableArray & operator = ( const ConcurrentReadableArray & ) = delete ; <nl> + <nl> + ConcurrentReadableArray ( ) : Capacity ( 0 ) , ReaderCount ( 0 ) , Elements ( nullptr ) { } <nl> + <nl> + void push_back ( const ElemTy & elem ) { <nl> + ScopedLock guard ( WriterLock ) ; <nl> + <nl> + auto * storage = Elements . load ( std : : memory_order_relaxed ) ; <nl> + auto count = storage ? storage - > Count . load ( std : : memory_order_relaxed ) : 0 ; <nl> + if ( count > = Capacity ) { <nl> + auto newCapacity = std : : max ( ( size_t ) 16 , count * 2 ) ; <nl> + auto * newStorage = Storage : : allocate ( newCapacity ) ; <nl> + if ( storage ) { <nl> + std : : copy ( storage - > data ( ) , storage - > data ( ) + count , newStorage - > data ( ) ) ; <nl> + newStorage - > Count . store ( count , std : : memory_order_relaxed ) ; <nl> + FreeList . push_back ( storage ) ; <nl> + } <nl> + <nl> + storage = newStorage ; <nl> + Capacity = newCapacity ; <nl> + Elements . store ( storage , std : : memory_order_release ) ; <nl> + } <nl> + <nl> + new ( & storage - > data ( ) [ count ] ) ElemTy ( elem ) ; <nl> + storage - > Count . store ( count + 1 , std : : memory_order_release ) ; <nl> + <nl> + if ( ReaderCount . load ( std : : memory_order_acquire ) = = 0 ) <nl> + for ( Storage * storage : FreeList ) <nl> + storage - > deallocate ( ) ; <nl> + } <nl> + <nl> + / / / Read the contents of the array . The parameter ` f ` is called with <nl> + / / / two parameters : a pointer to the elements in the array , and the <nl> + / / / count . This represents a snapshot of the contents at the time <nl> + / / / ` read ` was called . The pointer becomes invalid after ` f ` returns . <nl> + template < class F > auto read ( F f ) - > decltype ( f ( nullptr , 0 ) ) { <nl> + ReaderCount . fetch_add ( 1 , std : : memory_order_acquire ) ; <nl> + auto * storage = Elements . load ( SWIFT_MEMORY_ORDER_CONSUME ) ; <nl> + auto count = storage - > Count . load ( std : : memory_order_acquire ) ; <nl> + const auto * ptr = storage - > data ( ) ; <nl> + <nl> + decltype ( f ( nullptr , 0 ) ) result = f ( ptr , count ) ; <nl> + <nl> + ReaderCount . fetch_sub ( 1 , std : : memory_order_release ) ; <nl> + <nl> + return result ; <nl> + } <nl> + <nl> + / / / Get the current count . It ' s just a snapshot and may be obsolete immediately . <nl> + size_t count ( ) { <nl> + return read ( [ ] ( const ElemTy * ptr , size_t count ) - > size_t { <nl> + return count ; <nl> + } ) ; <nl> + } <nl> + } ; <nl> + <nl> } / / end namespace swift <nl> <nl> # endif / / SWIFT_RUNTIME_CONCURRENTUTILS_H <nl> mmm a / stdlib / public / SwiftShims / RefCount . h <nl> ppp b / stdlib / public / SwiftShims / RefCount . h <nl> typedef InlineRefCountsPlaceholder InlineRefCounts ; <nl> <nl> # include " llvm / Support / Compiler . h " <nl> # include " swift / Basic / type_traits . h " <nl> + # include " swift / Runtime / Atomic . h " <nl> # include " swift / Runtime / Config . h " <nl> # include " swift / Runtime / Debug . h " <nl> <nl> - / / FIXME : Workaround for rdar : / / problem / 18889711 . ' Consume ' does not require <nl> - / / a barrier on ARM64 , but LLVM doesn ' t know that . Although ' relaxed ' <nl> - / / is formally UB by C + + 11 language rules , we should be OK because neither <nl> - / / the processor model nor the optimizer can realistically reorder our uses <nl> - / / of ' consume ' . <nl> - # if __arm64__ | | __arm__ <nl> - # define SWIFT_MEMORY_ORDER_CONSUME ( std : : memory_order_relaxed ) <nl> - # else <nl> - # define SWIFT_MEMORY_ORDER_CONSUME ( std : : memory_order_consume ) <nl> - # endif <nl> <nl> / * <nl> An object conceptually has three refcounts . These refcounts <nl> mmm a / stdlib / public / runtime / ProtocolConformance . cpp <nl> ppp b / stdlib / public / runtime / ProtocolConformance . cpp <nl> <nl> # include " swift / Runtime / Concurrent . h " <nl> # include " swift / Runtime / HeapObject . h " <nl> # include " swift / Runtime / Metadata . h " <nl> - # include " swift / Runtime / Mutex . h " <nl> # include " swift / Runtime / Unreachable . h " <nl> # include " CompatibilityOverride . h " <nl> # include " ImageInspection . h " <nl> namespace { <nl> const void * Type ; <nl> const ProtocolDescriptor * Proto ; <nl> std : : atomic < const WitnessTable * > Table ; <nl> - std : : atomic < uintptr_t > FailureGeneration ; <nl> + std : : atomic < size_t > FailureGeneration ; <nl> <nl> public : <nl> ConformanceCacheEntry ( ConformanceCacheKey key , <nl> const WitnessTable * table , <nl> - uintptr_t failureGeneration ) <nl> + size_t failureGeneration ) <nl> : Type ( key . Type ) , Proto ( key . Proto ) , Table ( table ) , <nl> FailureGeneration ( failureGeneration ) { <nl> } <nl> namespace { <nl> Table . store ( table , std : : memory_order_release ) ; <nl> } <nl> <nl> - void updateFailureGeneration ( uintptr_t failureGeneration ) { <nl> + void updateFailureGeneration ( size_t failureGeneration ) { <nl> assert ( ! isSuccessful ( ) ) ; <nl> FailureGeneration . store ( failureGeneration , std : : memory_order_relaxed ) ; <nl> } <nl> namespace { <nl> return Table . load ( std : : memory_order_acquire ) ; <nl> } <nl> <nl> - / / / Get the generation number under which this lookup failed . <nl> - unsigned getFailureGeneration ( ) const { <nl> + / / / Get the generation in which this lookup failed . <nl> + size_t getFailureGeneration ( ) const { <nl> assert ( ! isSuccessful ( ) ) ; <nl> return FailureGeneration . load ( std : : memory_order_relaxed ) ; <nl> } <nl> namespace { <nl> / / Conformance Cache . <nl> struct ConformanceState { <nl> ConcurrentMap < ConformanceCacheEntry > Cache ; <nl> - std : : vector < ConformanceSection > SectionsToScan ; <nl> - Mutex SectionsToScanLock ; <nl> + ConcurrentReadableArray < ConformanceSection > SectionsToScan ; <nl> <nl> ConformanceState ( ) { <nl> - SectionsToScan . reserve ( 16 ) ; <nl> initializeProtocolConformanceLookup ( ) ; <nl> } <nl> <nl> void cacheSuccess ( const void * type , const ProtocolDescriptor * proto , <nl> const WitnessTable * witness ) { <nl> auto result = Cache . getOrInsert ( ConformanceCacheKey ( type , proto ) , <nl> - witness , uintptr_t ( 0 ) ) ; <nl> + witness , 0 ) ; <nl> <nl> / / If the entry was already present , we may need to update it . <nl> if ( ! result . second ) { <nl> struct ConformanceState { <nl> } <nl> } <nl> <nl> - void cacheFailure ( const void * type , const ProtocolDescriptor * proto ) { <nl> - uintptr_t failureGeneration = SectionsToScan . size ( ) ; <nl> + void cacheFailure ( const void * type , const ProtocolDescriptor * proto , <nl> + size_t failureGeneration ) { <nl> auto result = Cache . getOrInsert ( ConformanceCacheKey ( type , proto ) , <nl> ( const WitnessTable * ) nullptr , <nl> failureGeneration ) ; <nl> void ConformanceState : : verify ( ) const { <nl> / / Iterate over all of the sections and verify all of the protocol <nl> / / descriptors . <nl> auto & Self = const_cast < ConformanceState & > ( * this ) ; <nl> - ScopedLock guard ( Self . SectionsToScanLock ) ; <nl> - <nl> - for ( const auto & Section : SectionsToScan ) { <nl> - for ( const auto & Record : Section ) { <nl> - Record . get ( ) - > verify ( ) ; <nl> + Self . SectionsToScan . read ( [ ] ( const ConformanceSection * ptr , size_t count ) - > char { <nl> + for ( size_t i = 0 ; i < count ; i + + ) { <nl> + for ( const auto & Record : ptr [ i ] ) { <nl> + Record . get ( ) - > verify ( ) ; <nl> + } <nl> } <nl> - } <nl> + return 0 ; <nl> + } ) ; <nl> } <nl> # endif <nl> <nl> static void <nl> _registerProtocolConformances ( ConformanceState & C , <nl> const ProtocolConformanceRecord * begin , <nl> const ProtocolConformanceRecord * end ) { <nl> - ScopedLock guard ( C . SectionsToScanLock ) ; <nl> C . SectionsToScan . push_back ( ConformanceSection { begin , end } ) ; <nl> } <nl> <nl> searchInConformanceCache ( const Metadata * type , <nl> } <nl> <nl> / / Check if the negative cache entry is up - to - date . <nl> - / / FIXME : Using SectionsToScan . size ( ) outside SectionsToScanLock <nl> - / / is undefined . <nl> - if ( Value - > getFailureGeneration ( ) = = C . SectionsToScan . size ( ) ) { <nl> + if ( Value - > getFailureGeneration ( ) = = C . SectionsToScan . count ( ) ) { <nl> / / Negative cache entry is up - to - date . Return failure along with <nl> / / the original query type ' s own cache entry , if we found one . <nl> / / ( That entry may be out of date but the caller still has use for it . ) <nl> swift_conformsToProtocolImpl ( const Metadata * const type , <nl> <nl> / / See if we have a cached conformance . The ConcurrentMap data structure <nl> / / allows us to insert and search the map concurrently without locking . <nl> - / / We do lock the slow path because the SectionsToScan data structure is not <nl> - / / concurrent . <nl> auto FoundConformance = searchInConformanceCache ( type , protocol ) ; <nl> / / If the result ( positive or negative ) is authoritative , return it . <nl> if ( FoundConformance . isAuthoritative ) <nl> swift_conformsToProtocolImpl ( const Metadata * const type , <nl> <nl> auto failureEntry = FoundConformance . failureEntry ; <nl> <nl> - / / No up - to - date cache entry found . <nl> - / / Acquire the lock so we can scan conformance records . <nl> - ScopedLock guard ( C . SectionsToScanLock ) ; <nl> - <nl> - / / The world may have changed while we waited for the lock . <nl> - / / If we found an out - of - date negative cache entry before <nl> - / / acquiring the lock , make sure the entry is still negative and out of date . <nl> - / / If we found no entry before acquiring the lock , search the cache again . <nl> - if ( failureEntry ) { <nl> - if ( failureEntry - > isSuccessful ( ) ) { <nl> - / / Somebody else found a conformance . <nl> - return failureEntry - > getWitnessTable ( ) ; <nl> - } <nl> - if ( failureEntry - > getFailureGeneration ( ) = = C . SectionsToScan . size ( ) ) { <nl> - / / Somebody else brought the negative cache entry up to date . <nl> - return nullptr ; <nl> - } <nl> - } <nl> - else { <nl> - FoundConformance = searchInConformanceCache ( type , protocol ) ; <nl> - if ( FoundConformance . isAuthoritative ) { <nl> - / / Somebody else found a conformance or cached an up - to - date failure . <nl> - return FoundConformance . witnessTable ; <nl> - } <nl> - failureEntry = FoundConformance . failureEntry ; <nl> - } <nl> - <nl> - / / We are now caught up after acquiring the lock . <nl> / / Prepare to scan conformance records . <nl> - <nl> - / / Scan only sections that were not scanned yet . <nl> - / / If we found an out - of - date negative cache entry , <nl> - / / we need not to re - scan the sections that it covers . <nl> - unsigned startSectionIdx = <nl> - failureEntry ? failureEntry - > getFailureGeneration ( ) : 0 ; <nl> - <nl> - unsigned endSectionIdx = C . SectionsToScan . size ( ) ; <nl> - <nl> - / / If there are no unscanned sections outstanding <nl> - / / then we can cache failure and give up now . <nl> - if ( startSectionIdx = = endSectionIdx ) { <nl> - C . cacheFailure ( type , protocol ) ; <nl> - return nullptr ; <nl> - } <nl> - <nl> - / / / Local function to retrieve the witness table and record the result . <nl> - auto recordWitnessTable = [ & ] ( const ProtocolConformanceDescriptor & descriptor , <nl> - const Metadata * type ) { <nl> - switch ( descriptor . getConformanceKind ( ) ) { <nl> - case ConformanceFlags : : ConformanceKind : : WitnessTable : <nl> - / / If the record provides a nondependent witness table for all <nl> - / / instances of a generic type , cache it for the generic pattern . <nl> - C . cacheSuccess ( type , protocol , descriptor . getStaticWitnessTable ( ) ) ; <nl> - return ; <nl> - <nl> - case ConformanceFlags : : ConformanceKind : : WitnessTableAccessor : <nl> - / / If the record provides a dependent witness table accessor , <nl> - / / cache the result for the instantiated type metadata . <nl> - C . cacheSuccess ( type , protocol , descriptor . getWitnessTable ( type ) ) ; <nl> - return ; <nl> - <nl> - case ConformanceFlags : : ConformanceKind : : ConditionalWitnessTableAccessor : { <nl> - / / Note : we might end up doing more scanning for other conformances <nl> - / / when checking the conditional requirements , so do a gross unlock / lock . <nl> - / / FIXME : Don ' t do this : ) <nl> - C . SectionsToScanLock . unlock ( ) ; <nl> - auto witnessTable = descriptor . getWitnessTable ( type ) ; <nl> - C . SectionsToScanLock . lock ( ) ; <nl> - if ( witnessTable ) <nl> - C . cacheSuccess ( type , protocol , witnessTable ) ; <nl> - else <nl> - C . cacheFailure ( type , protocol ) ; <nl> - return ; <nl> - } <nl> + size_t scannedCount ; <nl> + auto returnNull = C . SectionsToScan <nl> + . read ( [ & ] ( const ConformanceSection * ptr , size_t count ) - > bool { <nl> + scannedCount = count ; <nl> + / / Scan only sections that were not scanned yet . <nl> + / / If we found an out - of - date negative cache entry , <nl> + / / we need not to re - scan the sections that it covers . <nl> + auto startIndex = failureEntry ? failureEntry - > getFailureGeneration ( ) : 0 ; <nl> + auto endIndex = count ; <nl> + <nl> + / / If there are no unscanned sections outstanding <nl> + / / then we can cache failure and give up now . <nl> + if ( startIndex = = endIndex ) { <nl> + C . cacheFailure ( type , protocol , count ) ; <nl> + return true ; <nl> } <nl> <nl> - / / Always fail , because we cannot interpret a future conformance <nl> - / / kind . <nl> - C . cacheFailure ( type , protocol ) ; <nl> - } ; <nl> - <nl> - / / Really scan conformance records . <nl> - <nl> - for ( unsigned sectionIdx = startSectionIdx ; <nl> - sectionIdx < endSectionIdx ; <nl> - + + sectionIdx ) { <nl> - auto & section = C . SectionsToScan [ sectionIdx ] ; <nl> - / / Eagerly pull records for nondependent witnesses into our cache . <nl> - for ( const auto & record : section ) { <nl> - auto & descriptor = * record . get ( ) ; <nl> - <nl> - / / If the record applies to a specific type , cache it . <nl> - if ( auto metadata = descriptor . getCanonicalTypeMetadata ( ) ) { <nl> - auto P = descriptor . getProtocol ( ) ; <nl> - <nl> - / / Look for an exact match . <nl> - if ( protocol ! = P ) <nl> - continue ; <nl> - <nl> - if ( ! isRelatedType ( type , metadata , / * candidateIsMetadata = * / true ) ) <nl> - continue ; <nl> - <nl> - / / Record the witness table . <nl> - recordWitnessTable ( descriptor , metadata ) ; <nl> - <nl> - / / TODO : " Nondependent witness table " probably deserves its own flag . <nl> - / / An accessor function might still be necessary even if the witness table <nl> - / / can be shared . <nl> - } else if ( descriptor . getTypeKind ( ) <nl> - = = TypeMetadataRecordKind : : DirectNominalTypeDescriptor | | <nl> - descriptor . getTypeKind ( ) <nl> - = = TypeMetadataRecordKind : : IndirectNominalTypeDescriptor ) { <nl> - auto R = descriptor . getTypeContextDescriptor ( ) ; <nl> - auto P = descriptor . getProtocol ( ) ; <nl> - <nl> - / / Look for an exact match . <nl> - if ( protocol ! = P ) <nl> - continue ; <nl> - <nl> - if ( ! isRelatedType ( type , R , / * candidateIsMetadata = * / false ) ) <nl> - continue ; <nl> + / / / Local function to retrieve the witness table and record the result . <nl> + auto recordWitnessTable = [ & ] ( const ProtocolConformanceDescriptor & descriptor , <nl> + const Metadata * type ) { <nl> + switch ( descriptor . getConformanceKind ( ) ) { <nl> + case ConformanceFlags : : ConformanceKind : : WitnessTable : <nl> + / / If the record provides a nondependent witness table for all <nl> + / / instances of a generic type , cache it for the generic pattern . <nl> + C . cacheSuccess ( type , protocol , descriptor . getStaticWitnessTable ( ) ) ; <nl> + return ; <nl> + <nl> + case ConformanceFlags : : ConformanceKind : : WitnessTableAccessor : <nl> + / / If the record provides a dependent witness table accessor , <nl> + / / cache the result for the instantiated type metadata . <nl> + C . cacheSuccess ( type , protocol , descriptor . getWitnessTable ( type ) ) ; <nl> + return ; <nl> + <nl> + case ConformanceFlags : : ConformanceKind : : ConditionalWitnessTableAccessor : { <nl> + auto witnessTable = descriptor . getWitnessTable ( type ) ; <nl> + if ( witnessTable ) <nl> + C . cacheSuccess ( type , protocol , witnessTable ) ; <nl> + else <nl> + C . cacheFailure ( type , protocol , count ) ; <nl> + return ; <nl> + } <nl> + } <nl> <nl> - recordWitnessTable ( descriptor , type ) ; <nl> + / / Always fail , because we cannot interpret a future conformance <nl> + / / kind . <nl> + C . cacheFailure ( type , protocol , count ) ; <nl> + } ; <nl> + <nl> + / / Really scan conformance records . <nl> + for ( size_t i = startIndex ; i < endIndex ; i + + ) { <nl> + auto & section = ptr [ i ] ; <nl> + / / Eagerly pull records for nondependent witnesses into our cache . <nl> + for ( const auto & record : section ) { <nl> + auto & descriptor = * record . get ( ) ; <nl> + <nl> + / / If the record applies to a specific type , cache it . <nl> + if ( auto metadata = descriptor . getCanonicalTypeMetadata ( ) ) { <nl> + auto P = descriptor . getProtocol ( ) ; <nl> + <nl> + / / Look for an exact match . <nl> + if ( protocol ! = P ) <nl> + continue ; <nl> + <nl> + if ( ! isRelatedType ( type , metadata , / * candidateIsMetadata = * / true ) ) <nl> + continue ; <nl> + <nl> + / / Record the witness table . <nl> + recordWitnessTable ( descriptor , metadata ) ; <nl> + <nl> + / / TODO : " Nondependent witness table " probably deserves its own flag . <nl> + / / An accessor function might still be necessary even if the witness table <nl> + / / can be shared . <nl> + } else if ( descriptor . getTypeKind ( ) <nl> + = = TypeMetadataRecordKind : : DirectNominalTypeDescriptor | | <nl> + descriptor . getTypeKind ( ) <nl> + = = TypeMetadataRecordKind : : IndirectNominalTypeDescriptor ) { <nl> + auto R = descriptor . getTypeContextDescriptor ( ) ; <nl> + auto P = descriptor . getProtocol ( ) ; <nl> + <nl> + / / Look for an exact match . <nl> + if ( protocol ! = P ) <nl> + continue ; <nl> + <nl> + if ( ! isRelatedType ( type , R , / * candidateIsMetadata = * / false ) ) <nl> + continue ; <nl> + <nl> + recordWitnessTable ( descriptor , type ) ; <nl> + } <nl> } <nl> } <nl> - } <nl> - <nl> + return false ; <nl> + } ) ; <nl> + <nl> + if ( returnNull ) return nullptr ; <nl> + <nl> / / Conformance scan is complete . <nl> / / Search the cache once more , and this time update the cache if necessary . <nl> <nl> swift_conformsToProtocolImpl ( const Metadata * const type , <nl> if ( FoundConformance . isAuthoritative ) { <nl> return FoundConformance . witnessTable ; <nl> } else { <nl> - C . cacheFailure ( type , protocol ) ; <nl> + C . cacheFailure ( type , protocol , scannedCount ) ; <nl> return nullptr ; <nl> } <nl> } <nl> const TypeContextDescriptor * <nl> swift : : _searchConformancesByMangledTypeName ( Demangle : : NodePointer node ) { <nl> auto & C = Conformances . get ( ) ; <nl> <nl> - ScopedLock guard ( C . SectionsToScanLock ) ; <nl> - <nl> - unsigned sectionIdx = 0 ; <nl> - unsigned endSectionIdx = C . SectionsToScan . size ( ) ; <nl> - <nl> - for ( ; sectionIdx < endSectionIdx ; + + sectionIdx ) { <nl> - auto & section = C . SectionsToScan [ sectionIdx ] ; <nl> - for ( const auto & record : section ) { <nl> - if ( auto ntd = record - > getTypeContextDescriptor ( ) ) { <nl> - if ( _contextDescriptorMatchesMangling ( ntd , node ) ) <nl> - return ntd ; <nl> + return C . SectionsToScan <nl> + . read ( [ & ] ( const ConformanceSection * ptr , size_t count ) - > const TypeContextDescriptor * { <nl> + for ( size_t i = 0 ; i < count ; i + + ) { <nl> + auto & section = ptr [ i ] ; <nl> + for ( const auto & record : section ) { <nl> + if ( auto ntd = record - > getTypeContextDescriptor ( ) ) { <nl> + if ( _contextDescriptorMatchesMangling ( ntd , node ) ) <nl> + return ntd ; <nl> + } <nl> } <nl> } <nl> - } <nl> - <nl> - return nullptr ; <nl> + return nullptr ; <nl> + } ) ; <nl> } <nl> <nl> / / / Resolve a reference to a generic parameter to type metadata . <nl>
Merge pull request from mikeash / runtime - conformance - scanning - lockless - array
apple/swift
0e952b45bc7c1e3c9017474f6d6a79c65072daea
2018-05-16T18:03:10Z
mmm a / lib / Driver / Tools . cpp <nl> ppp b / lib / Driver / Tools . cpp <nl> std : : unique_ptr < Job > Swift : : constructJob ( const JobAction & JA , <nl> / / Pass through the values passed to - Xfrontend . <nl> Args . AddAllArgValues ( Arguments , options : : OPT_Xfrontend ) ; <nl> <nl> + Args . AddLastArg ( Arguments , options : : OPT_parse_as_library ) ; <nl> + <nl> + Args . AddLastArg ( Arguments , options : : OPT_parse_stdlib ) ; <nl> <nl> / / Add the output file argument if necessary . <nl> if ( Output - > getType ( ) ! = types : : TY_Nothing ) { <nl>
[ driver ] Add support for passing - parse - as - library and - parse - stdlib to the frontend .
apple/swift
86fe23de298771f28d1de85d3cf4f877b7cc1c44
2014-01-11T00:33:29Z
diff - - git a / code / data_structures / Segment Tree / Segment_Tree_RMQ . cpp b / code / data_structures / Segment Tree / Segment_Tree_RMQ . cpp <nl> new file mode 100644 <nl> index 0000000000 . . b7306ab021 <nl> mmm / dev / null <nl> ppp b / code / data_structures / Segment Tree / Segment_Tree_RMQ . cpp <nl> <nl> + / * Name : Mohit Khare <nl> + B . Tech 2nd Year <nl> + Computer Science and Engineering <nl> + MNNIT Allahabad <nl> + * / <nl> + # include < bits / stdc + + . h > <nl> + using namespace std ; <nl> + <nl> + typedef long long int ll ; <nl> + <nl> + # define mod 1000000007 <nl> + const int maxn = 1e5 + 1 ; <nl> + <nl> + void build ( ll segtree [ ] , ll arr [ ] , int low , int high , int pos ) <nl> + { <nl> + if ( low = = high ) <nl> + { <nl> + segtree [ pos ] = arr [ low ] ; <nl> + return ; <nl> + } <nl> + int mid = ( low + high ) / 2 ; <nl> + build ( segtree , arr , low , mid , 2 * pos + 1 ) ; <nl> + build ( segtree , arr , mid + 1 , high , 2 * pos + 2 ) ; <nl> + segtree [ pos ] = min ( segtree [ 2 * pos + 2 ] , segtree [ 2 * pos + 1 ] ) ; <nl> + } <nl> + <nl> + ll query ( ll segtree [ ] , ll arr [ ] , int low , int high , int qs , int qe , int pos ) <nl> + { <nl> + if ( qe < low | | qs > high ) return LLONG_MAX ; <nl> + if ( qs < = low & & high < = qe ) return segtree [ pos ] ; <nl> + int mid = ( low + high ) / 2 ; <nl> + ll left = query ( segtree , arr , low , mid , qs , qe , 2 * pos + 1 ) ; <nl> + ll right = query ( segtree , arr , mid + 1 , high , qs , qe , 2 * pos + 2 ) ; <nl> + return min ( right , left ) ; <nl> + } <nl> + int main ( ) <nl> + { <nl> + int n , m ; <nl> + printf ( " Input no of input elements and no . of queries \ n " ) ; <nl> + scanf ( " % d % d " , & n , & m ) ; <nl> + ll segtree [ 4 * n ] , arr [ n ] ; <nl> + printf ( " Input Array elements \ n " ) ; <nl> + for ( int i = 0 ; i < n ; i + + ) <nl> + scanf ( " % lld " , & arr [ i ] ) ; <nl> + build ( segtree , arr , 0 , n - 1 , 0 ) ; <nl> + for ( int i = 0 ; i < m ; i + + ) <nl> + { <nl> + int l , r ; <nl> + printf ( " Enter range - l and r \ n " ) ; <nl> + scanf ( " % d % d " , & l , & r ) ; <nl> + l - - ; r - - ; <nl> + printf ( " Result is : % lld \ n " , query ( segtree , arr , 0 , n - 1 , l , r , 0 ) ) ; <nl> + } <nl> + return 0 ; <nl> + } <nl> + <nl> + / * Test Case <nl> + <nl> + 5 2 <nl> + Input Array elements <nl> + 3 4 2 1 5 <nl> + 1 2 <nl> + Result is : 3 <nl> + 2 5 <nl> + Result is : 1 <nl> + <nl> + * / <nl>
Adding Segment Tree - Range Minimum Query - O ( N * logN )
OpenGenus/cosmos
06701cae1a5466c300e264ac267f99b5a3ff5015
2017-10-04T04:42:08Z
mmm a / src / heap / heap . cc <nl> ppp b / src / heap / heap . cc <nl> void Heap : : DampenOldGenerationAllocationLimit ( size_t old_gen_size , <nl> } <nl> } <nl> <nl> + bool Heap : : ShouldOptimizeForLoadTime ( ) { <nl> + return isolate ( ) - > rail_mode ( ) = = PERFORMANCE_LOAD & & <nl> + PromotedTotalSize ( ) < initial_old_generation_size_ & & <nl> + MonotonicallyIncreasingTimeInMs ( ) < <nl> + isolate ( ) - > LoadStartTimeMs ( ) + kMaxLoadTimeMs ; <nl> + } <nl> + <nl> / / This predicate is called when an old generation space cannot allocated from <nl> / / the free list and is about to add a new page . Returning false will cause a <nl> / / major GC . It happens when the old generation allocation limit is reached and <nl> bool Heap : : ShouldExpandOldGenerationOnSlowAllocation ( ) { <nl> <nl> if ( ShouldOptimizeForMemoryUsage ( ) ) return false ; <nl> <nl> + if ( ShouldOptimizeForLoadTime ( ) ) return true ; <nl> + <nl> if ( incremental_marking ( ) - > NeedsFinalization ( ) ) { <nl> return ! AllocationLimitOvershotByLargeMargin ( ) ; <nl> } <nl> mmm a / src / heap / heap . h <nl> ppp b / src / heap / heap . h <nl> class Heap { <nl> / / Growing strategy . = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = <nl> / / = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = <nl> <nl> + / / For some webpages RAIL mode does not switch from PERFORMANCE_LOAD . <nl> + / / This constant limits the effect of load RAIL mode on GC . <nl> + / / The value is arbitrary and chosen as the largest load time observed in <nl> + / / v8 browsing benchmarks . <nl> + static const int kMaxLoadTimeMs = 3000 ; <nl> + <nl> + bool ShouldOptimizeForLoadTime ( ) ; <nl> + <nl> / / Decrease the allocation limit if the new limit based on the given <nl> / / parameters is lower than the current limit . <nl> void DampenOldGenerationAllocationLimit ( size_t old_gen_size , double gc_speed , <nl> mmm a / src / isolate . cc <nl> ppp b / src / isolate . cc <nl> Isolate : : Isolate ( bool enable_serializer ) <nl> / / be fixed once the default isolate cleanup is done . <nl> random_number_generator_ ( NULL ) , <nl> rail_mode_ ( PERFORMANCE_ANIMATION ) , <nl> + load_start_time_ms_ ( 0 ) , <nl> serializer_enabled_ ( enable_serializer ) , <nl> has_fatal_error_ ( false ) , <nl> initialized_from_snapshot_ ( false ) , <nl> void Isolate : : CheckDetachedContextsAfterGC ( ) { <nl> } <nl> } <nl> <nl> + double Isolate : : LoadStartTimeMs ( ) { <nl> + base : : LockGuard < base : : Mutex > guard ( & rail_mutex_ ) ; <nl> + return load_start_time_ms_ ; <nl> + } <nl> + <nl> void Isolate : : SetRAILMode ( RAILMode rail_mode ) { <nl> + RAILMode old_rail_mode = rail_mode_ . Value ( ) ; <nl> + if ( old_rail_mode ! = PERFORMANCE_LOAD & & rail_mode = = PERFORMANCE_LOAD ) { <nl> + base : : LockGuard < base : : Mutex > guard ( & rail_mutex_ ) ; <nl> + load_start_time_ms_ = heap ( ) - > MonotonicallyIncreasingTimeInMs ( ) ; <nl> + } <nl> rail_mode_ . SetValue ( rail_mode ) ; <nl> + if ( old_rail_mode = = PERFORMANCE_LOAD & & rail_mode ! = PERFORMANCE_LOAD ) { <nl> + heap ( ) - > incremental_marking ( ) - > incremental_marking_job ( ) - > ScheduleTask ( <nl> + heap ( ) ) ; <nl> + } <nl> if ( FLAG_trace_rail ) { <nl> PrintIsolate ( this , " RAIL mode : % s \ n " , RAILModeName ( rail_mode ) ) ; <nl> } <nl> mmm a / src / isolate . h <nl> ppp b / src / isolate . h <nl> class Isolate { <nl> <nl> void SetRAILMode ( RAILMode rail_mode ) ; <nl> <nl> + RAILMode rail_mode ( ) { return rail_mode_ . Value ( ) ; } <nl> + <nl> + double LoadStartTimeMs ( ) ; <nl> + <nl> void IsolateInForegroundNotification ( ) ; <nl> <nl> void IsolateInBackgroundNotification ( ) ; <nl> class Isolate { <nl> AccessCompilerData * access_compiler_data_ ; <nl> base : : RandomNumberGenerator * random_number_generator_ ; <nl> base : : AtomicValue < RAILMode > rail_mode_ ; <nl> + base : : Mutex rail_mutex_ ; <nl> + double load_start_time_ms_ ; <nl> <nl> / / Whether the isolate has been created for snapshotting . <nl> bool serializer_enabled_ ; <nl>
[ heap ] Reland " Use RAIL mode for initial heap sizing " .
v8/v8
7bdb906946b94e9ba10de13e104a39bbcabedbd6
2016-12-16T16:59:44Z
mmm a / xbmc / addons / AddonCallbacksGUI . cpp <nl> ppp b / xbmc / addons / AddonCallbacksGUI . cpp <nl> CGUIAddonWindowDialog : : ~ CGUIAddonWindowDialog ( void ) <nl> bool CGUIAddonWindowDialog : : OnMessage ( CGUIMessage & message ) <nl> { <nl> if ( message . GetMessage ( ) = = GUI_MSG_WINDOW_DEINIT ) <nl> - { <nl> - CGUIWindow * pWindow = g_windowManager . GetWindow ( g_windowManager . GetActiveWindow ( ) ) ; <nl> - if ( pWindow ) <nl> - g_windowManager . ShowOverlay ( pWindow - > GetOverlayState ( ) ) ; <nl> return CGUIWindow : : OnMessage ( message ) ; <nl> - } <nl> + <nl> return CGUIAddonWindow : : OnMessage ( message ) ; <nl> } <nl> <nl> mmm a / xbmc / guilib / GUIDialog . cpp <nl> ppp b / xbmc / guilib / GUIDialog . cpp <nl> bool CGUIDialog : : OnMessage ( CGUIMessage & message ) <nl> { <nl> case GUI_MSG_WINDOW_DEINIT : <nl> { <nl> - CGUIWindow * pWindow = g_windowManager . GetWindow ( g_windowManager . GetActiveWindow ( ) ) ; <nl> - if ( pWindow ) <nl> - g_windowManager . ShowOverlay ( pWindow - > GetOverlayState ( ) ) ; <nl> - <nl> CGUIWindow : : OnMessage ( message ) ; <nl> return true ; <nl> } <nl> mmm a / xbmc / guilib / GUIWindow . cpp <nl> ppp b / xbmc / guilib / GUIWindow . cpp <nl> CGUIWindow : : CGUIWindow ( int id , const std : : string & xmlFile ) <nl> SetID ( id ) ; <nl> SetProperty ( " xmlfile " , xmlFile ) ; <nl> m_lastControlID = 0 ; <nl> - m_overlayState = OVERLAY_STATE_PARENT_WINDOW ; / / Use parent or previous window ' s state <nl> m_isDialog = false ; <nl> m_needsScaling = true ; <nl> m_windowLoaded = false ; <nl> bool CGUIWindow : : Load ( TiXmlElement * pRootElement ) <nl> pControl = pControl - > NextSiblingElement ( ) ; <nl> } <nl> } <nl> - else if ( strValue = = " allowoverlay " ) <nl> - { <nl> - bool overlay = false ; <nl> - if ( XMLUtils : : GetBoolean ( pRootElement , " allowoverlay " , overlay ) ) <nl> - m_overlayState = overlay ? OVERLAY_STATE_SHOWN : OVERLAY_STATE_HIDDEN ; <nl> - } <nl> <nl> pChild = pChild - > NextSiblingElement ( ) ; <nl> } <nl> void CGUIWindow : : OnInitWindow ( ) <nl> RestoreControlStates ( ) ; <nl> SetInitialVisibility ( ) ; <nl> QueueAnimation ( ANIM_TYPE_WINDOW_OPEN ) ; <nl> - g_windowManager . ShowOverlay ( m_overlayState ) ; <nl> <nl> if ( ! m_manualRunActions ) <nl> { <nl> void CGUIWindow : : SetDefaults ( ) <nl> m_defaultAlways = false ; <nl> m_defaultControl = 0 ; <nl> m_posX = m_posY = m_width = m_height = 0 ; <nl> - m_overlayState = OVERLAY_STATE_PARENT_WINDOW ; / / Use parent or previous window ' s state <nl> m_previousWindow = WINDOW_INVALID ; <nl> m_animations . clear ( ) ; <nl> m_origins . clear ( ) ; <nl> mmm a / xbmc / guilib / GUIWindow . h <nl> ppp b / xbmc / guilib / GUIWindow . h <nl> class CGUIWindow : public CGUIControlGroup , protected CCriticalSection <nl> / / versions of UpdateVisibility , and are deemed visible if they ' re in <nl> / / the window manager ' s active list . <nl> <nl> - enum OVERLAY_STATE { OVERLAY_STATE_PARENT_WINDOW = 0 , OVERLAY_STATE_SHOWN , OVERLAY_STATE_HIDDEN } ; <nl> - <nl> - OVERLAY_STATE GetOverlayState ( ) const { return m_overlayState ; } ; <nl> - <nl> virtual bool IsAnimating ( ANIMATION_TYPE animType ) ; <nl> void DisableAnimations ( ) ; <nl> <nl> class CGUIWindow : public CGUIControlGroup , protected CCriticalSection <nl> void LoadControl ( TiXmlElement * pControl , CGUIControlGroup * pGroup , const CRect & rect ) ; <nl> <nl> std : : vector < int > m_idRange ; <nl> - OVERLAY_STATE m_overlayState ; <nl> RESOLUTION_INFO m_coordsRes ; / / resolution that the window coordinates are in . <nl> bool m_needsScaling ; <nl> bool m_windowLoaded ; / / true if the window ' s xml file has been loaded <nl> mmm a / xbmc / guilib / GUIWindowManager . cpp <nl> ppp b / xbmc / guilib / GUIWindowManager . cpp <nl> using namespace KODI : : MESSAGING ; <nl> CGUIWindowManager : : CGUIWindowManager ( void ) <nl> { <nl> m_pCallback = NULL ; <nl> - m_bShowOverlay = true ; <nl> m_iNested = 0 ; <nl> m_initialized = false ; <nl> } <nl> void CGUIWindowManager : : PreviousWindow ( ) <nl> / / tell our info manager which window we are going to <nl> g_infoManager . SetNextWindow ( previousWindow ) ; <nl> <nl> - / / set our overlay state ( enables out animations on window change ) <nl> - HideOverlay ( pNewWindow - > GetOverlayState ( ) ) ; <nl> - <nl> / / deinitialize our window <nl> CloseWindowSync ( pCurrentWindow ) ; <nl> <nl> void CGUIWindowManager : : ActivateWindow_Internal ( int iWindowID , const std : : vector <nl> <nl> g_infoManager . SetNextWindow ( iWindowID ) ; <nl> <nl> - / / set our overlay state <nl> - HideOverlay ( pNewWindow - > GetOverlayState ( ) ) ; <nl> - <nl> / / deactivate any window <nl> int currentWindow = GetActiveWindow ( ) ; <nl> CGUIWindow * pWindow = GetWindow ( currentWindow ) ; <nl> void CGUIWindowManager : : UnloadNotOnDemandWindows ( ) <nl> } <nl> } <nl> <nl> - bool CGUIWindowManager : : IsOverlayAllowed ( ) const <nl> - { <nl> - if ( GetActiveWindow ( ) = = WINDOW_FULLSCREEN_VIDEO | | <nl> - GetActiveWindow ( ) = = WINDOW_SCREENSAVER ) <nl> - return false ; <nl> - return m_bShowOverlay ; <nl> - } <nl> - <nl> - void CGUIWindowManager : : ShowOverlay ( CGUIWindow : : OVERLAY_STATE state ) <nl> - { <nl> - if ( state ! = CGUIWindow : : OVERLAY_STATE_PARENT_WINDOW ) <nl> - m_bShowOverlay = state = = CGUIWindow : : OVERLAY_STATE_SHOWN ; <nl> - } <nl> - <nl> - void CGUIWindowManager : : HideOverlay ( CGUIWindow : : OVERLAY_STATE state ) <nl> - { <nl> - if ( state = = CGUIWindow : : OVERLAY_STATE_HIDDEN ) <nl> - m_bShowOverlay = false ; <nl> - } <nl> - <nl> void CGUIWindowManager : : AddToWindowHistory ( int newWindowID ) <nl> { <nl> / / Check the window stack to see if this window is in our history , <nl> mmm a / xbmc / guilib / GUIWindowManager . h <nl> ppp b / xbmc / guilib / GUIWindowManager . h <nl> class CGUIWindowManager : public KODI : : MESSAGING : : IMessageTarget <nl> bool IsWindowActive ( const std : : string & xmlFile , bool ignoreClosing = true ) const ; <nl> bool IsWindowVisible ( const std : : string & xmlFile ) const ; <nl> bool IsWindowTopMost ( const std : : string & xmlFile ) const ; <nl> - bool IsOverlayAllowed ( ) const ; <nl> / * ! \ brief Checks if the given window is an addon window . <nl> * <nl> * \ return true if the given window is an addon window , otherwise false . <nl> class CGUIWindowManager : public KODI : : MESSAGING : : IMessageTarget <nl> * \ return true if the given window is a python window , otherwise false . <nl> * / <nl> bool IsPythonWindow ( int id ) const { return ( id > = WINDOW_PYTHON_START & & id < = WINDOW_PYTHON_END ) ; } ; <nl> - void ShowOverlay ( CGUIWindow : : OVERLAY_STATE state ) ; <nl> void GetActiveModelessWindows ( std : : vector < int > & ids ) ; <nl> # ifdef _DEBUG <nl> void DumpTextureUse ( ) ; <nl> class CGUIWindowManager : public KODI : : MESSAGING : : IMessageTarget <nl> <nl> void LoadNotOnDemandWindows ( ) ; <nl> void UnloadNotOnDemandWindows ( ) ; <nl> - void HideOverlay ( CGUIWindow : : OVERLAY_STATE state ) ; <nl> void AddToWindowHistory ( int newWindowID ) ; <nl> void ClearWindowHistory ( ) ; <nl> void CloseWindowSync ( CGUIWindow * window , int nextWindowID = 0 ) ; <nl> class CGUIWindowManager : public KODI : : MESSAGING : : IMessageTarget <nl> CCriticalSection m_critSection ; <nl> std : : vector < IMsgTargetCallback * > m_vecMsgTargets ; <nl> <nl> - bool m_bShowOverlay ; <nl> int m_iNested ; <nl> bool m_initialized ; <nl> <nl> mmm a / xbmc / interfaces / legacy / Window . cpp <nl> ppp b / xbmc / interfaces / legacy / Window . cpp <nl> namespace XBMCAddon <nl> XBMC_TRACE ; <nl> switch ( message . GetMessage ( ) ) <nl> { <nl> - case GUI_MSG_WINDOW_DEINIT : <nl> - { <nl> - g_windowManager . ShowOverlay ( ref ( window ) - > OVERLAY_STATE_SHOWN ) ; <nl> - } <nl> - break ; <nl> - <nl> - case GUI_MSG_WINDOW_INIT : <nl> - { <nl> - ref ( window ) - > OnMessage ( message ) ; <nl> - g_windowManager . ShowOverlay ( ref ( window ) - > OVERLAY_STATE_HIDDEN ) ; <nl> - return true ; <nl> - } <nl> - break ; <nl> - <nl> case GUI_MSG_CLICKED : <nl> { <nl> int iControl = message . GetSenderId ( ) ; <nl> mmm a / xbmc / interfaces / legacy / WindowXML . cpp <nl> ppp b / xbmc / interfaces / legacy / WindowXML . cpp <nl> namespace XBMCAddon <nl> { <nl> XBMC_TRACE ; <nl> if ( message . GetMessage ( ) = = GUI_MSG_WINDOW_DEINIT ) <nl> - { <nl> - CGUIWindow * pWindow = g_windowManager . GetWindow ( g_windowManager . GetActiveWindow ( ) ) ; <nl> - if ( pWindow ) <nl> - g_windowManager . ShowOverlay ( pWindow - > GetOverlayState ( ) ) ; <nl> return A ( CGUIWindow : : OnMessage ( message ) ) ; <nl> - } <nl> + <nl> return WindowXML : : OnMessage ( message ) ; <nl> } <nl> <nl> mmm a / xbmc / pictures / GUIWindowSlideShow . cpp <nl> ppp b / xbmc / pictures / GUIWindowSlideShow . cpp <nl> void CGUIWindowSlideShow : : OnDeinitWindow ( int nextWindowID ) <nl> if ( nextWindowID ! = WINDOW_PICTURES ) <nl> m_ImageLib . Unload ( ) ; <nl> <nl> - g_windowManager . ShowOverlay ( OVERLAY_STATE_SHOWN ) ; <nl> - <nl> if ( nextWindowID ! = WINDOW_FULLSCREEN_VIDEO ) <nl> { <nl> / / wait for any outstanding picture loads <nl> bool CGUIWindowSlideShow : : OnMessage ( CGUIMessage & message ) <nl> if ( message . GetParam1 ( ) ! = WINDOW_PICTURES ) <nl> m_ImageLib . Load ( ) ; <nl> <nl> - g_windowManager . ShowOverlay ( OVERLAY_STATE_HIDDEN ) ; <nl> - <nl> / / turn off slideshow if we only have 1 image <nl> if ( m_slides - > Size ( ) < = 1 ) <nl> m_bSlideShow = false ; <nl> mmm a / xbmc / settings / windows / GUIWindowSettingsScreenCalibration . cpp <nl> ppp b / xbmc / settings / windows / GUIWindowSettingsScreenCalibration . cpp <nl> bool CGUIWindowSettingsScreenCalibration : : OnMessage ( CGUIMessage & message ) <nl> CDisplaySettings : : GetInstance ( ) . UpdateCalibrations ( ) ; <nl> CSettings : : GetInstance ( ) . Save ( ) ; <nl> g_graphicsContext . SetCalibrating ( false ) ; <nl> - g_windowManager . ShowOverlay ( OVERLAY_STATE_SHOWN ) ; <nl> / / reset our screen resolution to what it was initially <nl> g_graphicsContext . SetVideoResolution ( CDisplaySettings : : GetInstance ( ) . GetCurrentResolution ( ) ) ; <nl> / / Inform the player so we can update the resolution <nl> bool CGUIWindowSettingsScreenCalibration : : OnMessage ( CGUIMessage & message ) <nl> case GUI_MSG_WINDOW_INIT : <nl> { <nl> CGUIWindow : : OnMessage ( message ) ; <nl> - g_windowManager . ShowOverlay ( OVERLAY_STATE_HIDDEN ) ; <nl> g_graphicsContext . SetCalibrating ( true ) ; <nl> <nl> / / Get the allowable resolutions that we can calibrate . . . <nl> mmm a / xbmc / windows / GUIWindowScreensaver . cpp <nl> ppp b / xbmc / windows / GUIWindowScreensaver . cpp <nl> bool CGUIWindowScreensaver : : OnMessage ( CGUIMessage & message ) <nl> / / RESOLUTION res = g_graphicsContext . GetVideoResolution ( ) ; <nl> / / g_graphicsContext . SetVideoResolution ( res , FALSE ) ; <nl> <nl> - / / enable the overlay <nl> - g_windowManager . ShowOverlay ( OVERLAY_STATE_SHOWN ) ; <nl> } <nl> break ; <nl> <nl> bool CGUIWindowScreensaver : : OnMessage ( CGUIMessage & message ) <nl> / / RESOLUTION res = g_graphicsContext . GetVideoResolution ( ) ; <nl> / / g_graphicsContext . SetVideoResolution ( res , TRUE ) ; <nl> <nl> - / / disable the overlay <nl> - g_windowManager . ShowOverlay ( OVERLAY_STATE_HIDDEN ) ; <nl> return true ; <nl> } <nl> case GUI_MSG_CHECK_LOCK : <nl>
Merge pull request from xhaggi / cleanup - allowoverlay
xbmc/xbmc
382696a54cac9a07e312040f88a5dff6a9eb3697
2015-09-22T12:45:01Z
mmm a / folly / io / async / Request . h <nl> ppp b / folly / io / async / Request . h <nl> class RequestContext { <nl> / / Create a unique requext context for this request . <nl> / / It will be passed between queues / threads ( where implemented ) , <nl> / / so it should be valid for the lifetime of the request . <nl> - static bool create ( ) { <nl> + static void create ( ) { <nl> if ( ! FLAGS_enable_request_context ) { <nl> - return false ; <nl> + return ; <nl> } <nl> - bool prev = getStaticContext ( ) . get ( ) ! = nullptr ; <nl> - getStaticContext ( ) . reset ( new std : : shared_ptr < RequestContext > ( <nl> - std : : make_shared < RequestContext > ( ) ) ) ; <nl> - return prev ; <nl> + getStaticContext ( ) = std : : make_shared < RequestContext > ( ) ; <nl> } <nl> <nl> / / Get the current context . <nl> static RequestContext * get ( ) { <nl> - if ( ! FLAGS_enable_request_context | | <nl> - getStaticContext ( ) . get ( ) = = nullptr ) { <nl> + if ( getStaticContext ( ) = = nullptr ) { <nl> if ( defaultContext = = nullptr ) { <nl> defaultContext = new RequestContext ; <nl> } <nl> return defaultContext ; <nl> } <nl> - return getStaticContext ( ) . get ( ) - > get ( ) ; <nl> + return getStaticContext ( ) . get ( ) ; <nl> } <nl> <nl> / / The following API may be used to set per - request data in a thread - safe way . <nl> class RequestContext { <nl> setContext ( std : : shared_ptr < RequestContext > ctx ) { <nl> if ( FLAGS_enable_request_context ) { <nl> std : : shared_ptr < RequestContext > old_ctx ; <nl> - if ( getStaticContext ( ) . get ( ) ) { <nl> - old_ctx = * getStaticContext ( ) . get ( ) ; <nl> - } <nl> - if ( ctx = = nullptr ) { <nl> - getStaticContext ( ) . reset ( nullptr ) ; <nl> - } else { <nl> - getStaticContext ( ) . reset ( new std : : shared_ptr < RequestContext > ( ctx ) ) ; <nl> + if ( getStaticContext ( ) ) { <nl> + old_ctx = getStaticContext ( ) ; <nl> } <nl> + getStaticContext ( ) = ctx ; <nl> return old_ctx ; <nl> } <nl> - return std : : shared_ptr < RequestContext > ( ) ; <nl> + return nullptr ; <nl> } <nl> <nl> static std : : shared_ptr < RequestContext > saveContext ( ) { <nl> - if ( ! FLAGS_enable_request_context ) { <nl> - return std : : shared_ptr < RequestContext > ( ) ; <nl> - } <nl> - if ( getStaticContext ( ) . get ( ) = = nullptr ) { <nl> - return std : : shared_ptr < RequestContext > ( ) ; <nl> - } else { <nl> - return * getStaticContext ( ) . get ( ) ; <nl> - } <nl> + return getStaticContext ( ) ; <nl> } <nl> <nl> / / Used to solve static destruction ordering issue . Any static object <nl> class RequestContext { <nl> / / See below link for more details . <nl> / / http : / / stackoverflow . com / questions / 335369 / <nl> / / finding - c - static - initialization - order - problems # 335746 <nl> - static folly : : ThreadLocalPtr < std : : shared_ptr < RequestContext > > & <nl> + static std : : shared_ptr < RequestContext > & <nl> getStaticContext ( ) { <nl> - static folly : : ThreadLocalPtr < std : : shared_ptr < RequestContext > > context ; <nl> - return context ; <nl> + static folly : : ThreadLocal < std : : shared_ptr < RequestContext > > context ; <nl> + return * context ; <nl> } <nl> <nl> private : <nl> class RequestContext { <nl> std : : map < std : : string , std : : unique_ptr < RequestData > > data_ ; <nl> } ; <nl> <nl> - / * * <nl> - * Set the request context for a specific scope . For example , <nl> - * if you ran a part of a request in another thread you could <nl> - * use RequestContextGuard to copy apply the request context <nl> - * inside the other therad . <nl> - * / <nl> - class RequestContextGuard { <nl> - public : <nl> - explicit RequestContextGuard ( std : : shared_ptr < RequestContext > ctx ) { <nl> - oldctx_ = RequestContext : : setContext ( std : : move ( ctx ) ) ; <nl> - } <nl> - <nl> - ~ RequestContextGuard ( ) { <nl> - RequestContext : : setContext ( std : : move ( oldctx_ ) ) ; <nl> - } <nl> - <nl> - private : <nl> - std : : shared_ptr < RequestContext > oldctx_ ; <nl> - } ; <nl> - <nl> } <nl>
Clean up RequestContext
facebook/folly
84e83ecc389494103b5970e33f0cbf75883bf42e
2014-11-19T20:52:13Z
mmm a / drivers / javascript / rethinkdb / query / expression . js <nl> ppp b / drivers / javascript / rethinkdb / query / expression . js <nl> goog . exportProperty ( rethinkdb . Expression . prototype , ' pick ' , <nl> * @ param { string | Array . < string > } attrs The attributes NOT to include in the result . <nl> * @ return { rethinkdb . Expression } <nl> * / <nl> - rethinkdb . Expression . prototype . without = function ( attrs ) { <nl> + rethinkdb . Expression . prototype . unpick = function ( attrs ) { <nl> if ( ! goog . isArray ( attrs ) ) { <nl> attrs = [ attrs ] ; <nl> } <nl> rethinkdb . Expression . prototype . without = function ( attrs ) { <nl> } <nl> } ) ; <nl> } ; <nl> - goog . exportProperty ( rethinkdb . Expression . prototype , ' without ' , <nl> - rethinkdb . Expression . prototype . without ) ; <nl> + goog . exportProperty ( rethinkdb . Expression . prototype , ' unpick ' , <nl> + rethinkdb . Expression . prototype . unpick ) ; <nl> <nl> / * * <nl> * Shortcut to map a pick attrs over a sequence . <nl> mmm a / drivers / javascript / rethinkdb / test . js <nl> ppp b / drivers / javascript / rethinkdb / test . js <nl> function testPickAttrs ( ) { <nl> } <nl> <nl> function testWithout ( ) { <nl> - tobj . without ( ' a ' ) . run ( objeq ( { b : 2 , c : 3 } ) ) ; <nl> - tobj . without ( [ ' a ' , ' b ' ] ) . run ( objeq ( { c : 3 } ) ) ; <nl> + tobj . unpick ( ' a ' ) . run ( objeq ( { b : 2 , c : 3 } ) ) ; <nl> + tobj . unpick ( [ ' a ' , ' b ' ] ) . run ( objeq ( { c : 3 } ) ) ; <nl> } <nl> <nl> function testR ( ) { <nl>
js client , renames without to unpick addresses
rethinkdb/rethinkdb
c9e0f698954ff5b180902f41e0b010c19366a88c
2012-09-24T23:58:20Z
mmm a / tensorflow / python / keras / preprocessing / image . py <nl> ppp b / tensorflow / python / keras / preprocessing / image . py <nl> class or list / tuple if multiple classes . - if ` class_mode ` is <nl> - ` " raw " ` : numpy array of values in ` y_col ` column ( s ) , <nl> - ` " sparse " ` : 1D numpy array of integer labels , - ` None ` , no targets <nl> are returned ( the generator will only yield batches of image data , <nl> - which is useful to use in ` model . predict_generator ( ) ` ) . <nl> + which is useful to use in ` model . predict ( ) ` ) . <nl> batch_size : Integer , size of a batch . <nl> shuffle : Boolean , whether to shuffle the data between epochs . <nl> seed : Random seed for data shuffling . <nl> class ImageDataGenerator ( image . ImageDataGenerator ) : <nl> seed = seed ) <nl> # combine generators into one which yields image and masks <nl> train_generator = zip ( image_generator , mask_generator ) <nl> - model . fit_generator ( <nl> + model . fit ( <nl> train_generator , <nl> steps_per_epoch = 2000 , <nl> epochs = 50 ) <nl> def flow_from_directory ( self , <nl> will be images identical to input images ( mainly used to work with <nl> autoencoders ) . - If None , no labels are returned ( the generator <nl> will only yield batches of image data , which is useful to use with <nl> - ` model . predict_generator ( ) ` ) . Please note that in case of <nl> + ` model . predict ( ) ` ) . Please note that in case of <nl> class_mode None , the data still needs to reside in a subdirectory <nl> of ` directory ` for it to work correctly . <nl> batch_size : Size of the batches of data ( default : 32 ) . <nl> def flow_from_dataframe ( self , <nl> - ` " raw " ` : numpy array of values in ` y_col ` column ( s ) , <nl> - ` " sparse " ` : 1D numpy array of integer labels , - ` None ` , no targets <nl> are returned ( the generator will only yield batches of image data , <nl> - which is useful to use in ` model . predict_generator ( ) ` ) . <nl> + which is useful to use in ` model . predict ( ) ` ) . <nl> batch_size : size of the batches of data ( default : 32 ) . <nl> shuffle : whether to shuffle the data ( default : True ) <nl> seed : optional random seed for shuffling and transformations . <nl>
Merge pull request from Harirai : patch - 1
tensorflow/tensorflow
10e801a1affd39ebb5d6fb65aeece84b85022494
2020-07-06T18:32:08Z
mmm a / xbmc / filesystem / HDDirectory . cpp <nl> ppp b / xbmc / filesystem / HDDirectory . cpp <nl> bool CHDDirectory : : GetDirectory ( const CStdString & strPath1 , CFileItemList & items <nl> if ( strLabel ! = " . " & & strLabel ! = " . . " ) <nl> { <nl> CFileItemPtr pItem ( new CFileItem ( strLabel ) ) ; <nl> - CStdString itemPath = strRoot + strLabel ; <nl> + CStdString itemPath ( URIUtils : : AddFileToFolder ( strRoot , strLabel ) ) ; <nl> URIUtils : : AddSlashAtEnd ( itemPath ) ; <nl> pItem - > SetPath ( itemPath ) ; <nl> pItem - > m_bIsFolder = true ; <nl> bool CHDDirectory : : GetDirectory ( const CStdString & strPath1 , CFileItemList & items <nl> else <nl> { <nl> CFileItemPtr pItem ( new CFileItem ( strLabel ) ) ; <nl> - pItem - > SetPath ( strRoot + strLabel ) ; <nl> + pItem - > SetPath ( URIUtils : : AddFileToFolder ( strRoot , strLabel ) ) ; <nl> pItem - > m_bIsFolder = false ; <nl> pItem - > m_dwSize = CUtil : : ToInt64 ( wfd . nFileSizeHigh , wfd . nFileSizeLow ) ; <nl> FileTimeToLocalFileTime ( & wfd . ftLastWriteTime , & localTime ) ; <nl>
Merge pull request from Karlson2k / dir_cache_fix_01
xbmc/xbmc
b37d5b7e6bece8c0da6b4088ab32267a616a9311
2013-10-17T20:31:30Z
mmm a / src / compiler / ast - graph - builder . cc <nl> ppp b / src / compiler / ast - graph - builder . cc <nl> Node * AstGraphBuilder : : GetFunctionClosure ( ) { <nl> if ( ! function_closure_ . is_set ( ) ) { <nl> / / Parameter - 1 is special for the function closure <nl> Operator * op = common ( ) - > Parameter ( - 1 ) ; <nl> - Node * node = NewNode ( op ) ; <nl> + Node * node = NewNode ( op , graph ( ) - > start ( ) ) ; <nl> function_closure_ . set ( node ) ; <nl> } <nl> return function_closure_ . get ( ) ; <nl> Node * AstGraphBuilder : : GetFunctionContext ( ) { <nl> if ( ! function_context_ . is_set ( ) ) { <nl> / / Parameter ( arity + 1 ) is special for the outer context of the function <nl> Operator * op = common ( ) - > Parameter ( info ( ) - > num_parameters ( ) + 1 ) ; <nl> - Node * node = NewNode ( op ) ; <nl> + Node * node = NewNode ( op , graph ( ) - > start ( ) ) ; <nl> function_context_ . set ( node ) ; <nl> } <nl> return function_context_ . get ( ) ; <nl> bool AstGraphBuilder : : CreateGraph ( ) { <nl> SourcePosition ( info ( ) - > shared_info ( ) - > start_position ( ) ) ) ; <nl> <nl> / / Set up the basic structure of the graph . <nl> - graph ( ) - > SetStart ( graph ( ) - > NewNode ( common ( ) - > Start ( ) ) ) ; <nl> + graph ( ) - > SetStart ( <nl> + graph ( ) - > NewNode ( common ( ) - > Start ( info ( ) - > num_parameters ( ) ) ) ) ; <nl> <nl> / / Initialize the top - level environment . <nl> Environment env ( this , scope , graph ( ) - > start ( ) ) ; <nl> AstGraphBuilder : : Environment : : Environment ( AstGraphBuilder * builder , <nl> DCHECK_EQ ( scope - > num_parameters ( ) + 1 , parameters_count ( ) ) ; <nl> <nl> / / Bind the receiver variable . <nl> - Node * receiver = builder - > graph ( ) - > NewNode ( common ( ) - > Parameter ( 0 ) ) ; <nl> + Node * receiver = builder - > graph ( ) - > NewNode ( common ( ) - > Parameter ( 0 ) , <nl> + builder - > graph ( ) - > start ( ) ) ; <nl> values ( ) - > push_back ( receiver ) ; <nl> <nl> / / Bind all parameter variables . The parameter indices are shifted by 1 <nl> / / ( receiver is parameter index - 1 but environment index 0 ) . <nl> for ( int i = 0 ; i < scope - > num_parameters ( ) ; + + i ) { <nl> - Node * parameter = builder - > graph ( ) - > NewNode ( common ( ) - > Parameter ( i + 1 ) ) ; <nl> + Node * parameter = builder - > graph ( ) - > NewNode ( common ( ) - > Parameter ( i + 1 ) , <nl> + builder - > graph ( ) - > start ( ) ) ; <nl> values ( ) - > push_back ( parameter ) ; <nl> } <nl> <nl> Node * AstGraphBuilder : : BuildLocalFunctionContext ( Node * context , Node * closure ) { <nl> if ( ! variable - > IsContextSlot ( ) ) continue ; <nl> / / Temporary parameter node . The parameter indices are shifted by 1 <nl> / / ( receiver is parameter index - 1 but environment index 0 ) . <nl> - Node * parameter = NewNode ( common ( ) - > Parameter ( i + 1 ) ) ; <nl> + Node * parameter = NewNode ( common ( ) - > Parameter ( i + 1 ) , graph ( ) - > start ( ) ) ; <nl> / / Context variable ( at bottom of the context chain ) . <nl> DCHECK_EQ ( 0 , info ( ) - > scope ( ) - > ContextChainLength ( variable - > scope ( ) ) ) ; <nl> Operator * op = javascript ( ) - > StoreContext ( 0 , variable - > index ( ) ) ; <nl> mmm a / src / compiler / common - operator . h <nl> ppp b / src / compiler / common - operator . h <nl> class CommonOperatorBuilder { <nl> return new ( zone_ ) ControlOperator ( IrOpcode : : k # # name , Operator : : kFoldable , \ <nl> inputs , 0 , controls , # name ) ; <nl> <nl> - Operator * Start ( ) { CONTROL_OP ( Start , 0 , 0 ) ; } <nl> + Operator * Start ( int num_formal_parameters ) { <nl> + / / Outputs are formal parameters , plus context , receiver , and JSFunction . <nl> + int outputs = num_formal_parameters + 3 ; <nl> + return new ( zone_ ) ControlOperator ( IrOpcode : : kStart , Operator : : kFoldable , 0 , <nl> + outputs , 0 , " Start " ) ; <nl> + } <nl> Operator * Dead ( ) { CONTROL_OP ( Dead , 0 , 0 ) ; } <nl> Operator * End ( ) { CONTROL_OP ( End , 0 , 1 ) ; } <nl> Operator * Branch ( ) { CONTROL_OP ( Branch , 1 , 1 ) ; } <nl> class CommonOperatorBuilder { <nl> } <nl> <nl> Operator * Parameter ( int index ) { <nl> - return new ( zone_ ) Operator1 < int > ( IrOpcode : : kParameter , Operator : : kPure , 0 , <nl> + return new ( zone_ ) Operator1 < int > ( IrOpcode : : kParameter , Operator : : kPure , 1 , <nl> 1 , " Parameter " , index ) ; <nl> } <nl> Operator * Int32Constant ( int32_t value ) { <nl> mmm a / src / compiler / opcodes . h <nl> ppp b / src / compiler / opcodes . h <nl> <nl> <nl> / / Opcodes for common operators . <nl> # define LEAF_OP_LIST ( V ) \ <nl> - V ( Parameter ) \ <nl> V ( Int32Constant ) \ <nl> V ( Int64Constant ) \ <nl> V ( Float64Constant ) \ <nl> <nl> V ( EffectPhi ) \ <nl> V ( FrameState ) \ <nl> V ( Call ) \ <nl> + V ( Parameter ) \ <nl> V ( Projection ) <nl> <nl> # define COMMON_OP_LIST ( V ) \ <nl> mmm a / src / compiler / raw - machine - assembler . cc <nl> ppp b / src / compiler / raw - machine - assembler . cc <nl> RawMachineAssembler : : RawMachineAssembler ( <nl> parameters_ ( NULL ) , <nl> exit_label_ ( schedule ( ) - > exit ( ) ) , <nl> current_block_ ( schedule ( ) - > entry ( ) ) { <nl> + Node * s = graph - > NewNode ( common_ . Start ( parameter_count ( ) ) ) ; <nl> + graph - > SetStart ( s ) ; <nl> if ( parameter_count ( ) = = 0 ) return ; <nl> parameters_ = zone ( ) - > NewArray < Node * > ( parameter_count ( ) ) ; <nl> for ( int i = 0 ; i < parameter_count ( ) ; + + i ) { <nl> - parameters_ [ i ] = NewNode ( common ( ) - > Parameter ( i ) ) ; <nl> + parameters_ [ i ] = NewNode ( common ( ) - > Parameter ( i ) , graph - > start ( ) ) ; <nl> } <nl> } <nl> <nl> mmm a / src / compiler / structured - machine - assembler . cc <nl> ppp b / src / compiler / structured - machine - assembler . cc <nl> StructuredMachineAssembler : : StructuredMachineAssembler ( <nl> current_environment_ ( new ( zone ( ) ) <nl> Environment ( zone ( ) , schedule ( ) - > entry ( ) , false ) ) , <nl> number_of_variables_ ( 0 ) { <nl> + Node * s = graph - > NewNode ( common_ . Start ( parameter_count ( ) ) ) ; <nl> + graph - > SetStart ( s ) ; <nl> if ( parameter_count ( ) = = 0 ) return ; <nl> parameters_ = zone ( ) - > NewArray < Node * > ( parameter_count ( ) ) ; <nl> for ( int i = 0 ; i < parameter_count ( ) ; + + i ) { <nl> - parameters_ [ i ] = NewNode ( common ( ) - > Parameter ( i ) ) ; <nl> + parameters_ [ i ] = NewNode ( common ( ) - > Parameter ( i ) , graph - > start ( ) ) ; <nl> } <nl> } <nl> <nl> mmm a / src / compiler / verifier . cc <nl> ppp b / src / compiler / verifier . cc <nl> GenericGraphVisit : : Control Verifier : : Visitor : : Pre ( Node * node ) { <nl> Node : : Uses uses = node - > uses ( ) ; <nl> for ( Node : : Uses : : iterator it = uses . begin ( ) ; it ! = uses . end ( ) ; + + it ) { <nl> CHECK ( ! NodeProperties : : IsValueEdge ( it . edge ( ) ) | | <nl> - ( * it ) - > opcode ( ) = = IrOpcode : : kProjection ) ; <nl> + ( * it ) - > opcode ( ) = = IrOpcode : : kProjection | | <nl> + ( * it ) - > opcode ( ) = = IrOpcode : : kParameter ) ; <nl> } <nl> } <nl> <nl> GenericGraphVisit : : Control Verifier : : Visitor : : Pre ( Node * node ) { <nl> case IrOpcode : : kThrow : <nl> / / TODO ( rossberg ) : what are the constraints on these ? <nl> break ; <nl> - case IrOpcode : : kParameter : <nl> - / / Parameters have no inputs . <nl> - CHECK_EQ ( 0 , input_count ) ; <nl> + case IrOpcode : : kParameter : { <nl> + / / Parameters have the start node as inputs . <nl> + CHECK_EQ ( 1 , input_count ) ; <nl> + CHECK_EQ ( IrOpcode : : kStart , <nl> + NodeProperties : : GetValueInput ( node , 0 ) - > opcode ( ) ) ; <nl> + / / Parameter has an input that produces enough values . <nl> + int index = static_cast < Operator1 < int > * > ( node - > op ( ) ) - > parameter ( ) ; <nl> + Node * input = NodeProperties : : GetValueInput ( node , 0 ) ; <nl> + / / Currently , parameter indices start at - 1 instead of 0 . <nl> + CHECK_GT ( NodeProperties : : GetValueOutputCount ( input ) , index + 1 ) ; <nl> break ; <nl> + } <nl> case IrOpcode : : kInt32Constant : <nl> case IrOpcode : : kInt64Constant : <nl> case IrOpcode : : kFloat64Constant : <nl> mmm a / test / cctest / compiler / graph - builder - tester . cc <nl> ppp b / test / cctest / compiler / graph - builder - tester . cc <nl> void MachineCallHelper : : InitParameters ( GraphBuilder * builder , <nl> DCHECK_EQ ( NULL , parameters_ ) ; <nl> graph_ = builder - > graph ( ) ; <nl> if ( parameter_count ( ) = = 0 ) return ; <nl> - parameters_ = builder - > graph ( ) - > zone ( ) - > NewArray < Node * > ( parameter_count ( ) ) ; <nl> + parameters_ = graph_ - > zone ( ) - > NewArray < Node * > ( parameter_count ( ) ) ; <nl> for ( int i = 0 ; i < parameter_count ( ) ; + + i ) { <nl> - parameters_ [ i ] = builder - > NewNode ( common - > Parameter ( i ) ) ; <nl> + parameters_ [ i ] = builder - > NewNode ( common - > Parameter ( i ) , graph_ - > start ( ) ) ; <nl> } <nl> } <nl> <nl> mmm a / test / cctest / compiler / graph - builder - tester . h <nl> ppp b / test / cctest / compiler / graph - builder - tester . h <nl> class MachineCallHelper : public CallHelper { <nl> MachineRepresentation * parameters ) ; <nl> void InitParameters ( GraphBuilder * builder , CommonOperatorBuilder * common ) ; <nl> <nl> - private : <nl> + protected : <nl> int parameter_count ( ) const { <nl> return call_descriptor_builder_ - > parameter_count ( ) ; <nl> } <nl> + <nl> + private : <nl> MachineCallDescriptorBuilder * call_descriptor_builder_ ; <nl> Node * * parameters_ ; <nl> / / TODO ( dcarney ) : shouldn ' t need graph stored . <nl> class GraphBuilderTester <nl> p0 , p1 , p2 , p3 , p4 ) ) , <nl> SimplifiedGraphBuilder ( main_graph_ , & main_common_ , & main_machine_ , <nl> & main_simplified_ ) { <nl> - Begin ( ) ; <nl> + Begin ( parameter_count ( ) ) ; <nl> InitParameters ( this , & main_common_ ) ; <nl> } <nl> virtual ~ GraphBuilderTester ( ) { } <nl> mmm a / test / cctest / compiler / graph - tester . h <nl> ppp b / test / cctest / compiler / graph - tester . h <nl> class GraphTester : public HandleAndZoneScope , public Graph { <nl> <nl> class GraphWithStartNodeTester : public GraphTester { <nl> public : <nl> - GraphWithStartNodeTester ( ) <nl> - : builder_ ( main_zone ( ) ) , start_node_ ( NewNode ( builder_ . Start ( ) ) ) { <nl> + explicit GraphWithStartNodeTester ( int num_parameters = 0 ) <nl> + : builder_ ( main_zone ( ) ) , <nl> + start_node_ ( NewNode ( builder_ . Start ( num_parameters ) ) ) { <nl> SetStart ( start_node_ ) ; <nl> } <nl> <nl> mmm a / test / cctest / compiler / simplified - graph - builder . cc <nl> ppp b / test / cctest / compiler / simplified - graph - builder . cc <nl> SimplifiedGraphBuilder : : SimplifiedGraphBuilder ( <nl> simplified_ ( simplified ) { } <nl> <nl> <nl> - void SimplifiedGraphBuilder : : Begin ( ) { <nl> + void SimplifiedGraphBuilder : : Begin ( int num_parameters ) { <nl> DCHECK ( graph ( ) - > start ( ) = = NULL ) ; <nl> - Node * start = graph ( ) - > NewNode ( common ( ) - > Start ( ) ) ; <nl> + Node * start = graph ( ) - > NewNode ( common ( ) - > Start ( num_parameters ) ) ; <nl> graph ( ) - > SetStart ( start ) ; <nl> set_environment ( new ( zone ( ) ) Environment ( this , start ) ) ; <nl> } <nl> mmm a / test / cctest / compiler / simplified - graph - builder . h <nl> ppp b / test / cctest / compiler / simplified - graph - builder . h <nl> class SimplifiedGraphBuilder <nl> } <nl> <nl> / / Initialize graph and builder . <nl> - void Begin ( ) ; <nl> + void Begin ( int num_parameters ) ; <nl> <nl> void Return ( Node * value ) ; <nl> <nl> mmm a / test / cctest / compiler / test - js - context - specialization . cc <nl> ppp b / test / cctest / compiler / test - js - context - specialization . cc <nl> class ContextSpecializationTester <nl> TEST ( ReduceJSLoadContext ) { <nl> ContextSpecializationTester t ; <nl> <nl> - Node * start = t . NewNode ( t . common ( ) - > Start ( ) ) ; <nl> + Node * start = t . NewNode ( t . common ( ) - > Start ( 0 ) ) ; <nl> t . graph ( ) - > SetStart ( start ) ; <nl> <nl> / / Make a context and initialize it a bit for this test . <nl> TEST ( ReduceJSLoadContext ) { <nl> native - > set ( slot , * expected ) ; <nl> <nl> Node * const_context = t . jsgraph ( ) - > Constant ( native ) ; <nl> - Node * param_context = t . NewNode ( t . common ( ) - > Parameter ( 0 ) ) ; <nl> + Node * param_context = t . NewNode ( t . common ( ) - > Parameter ( 0 ) , start ) ; <nl> JSContextSpecializer spec ( t . info ( ) , t . jsgraph ( ) , const_context ) ; <nl> <nl> { <nl> static void CheckEffectInput ( Node * effect , Node * use ) { <nl> TEST ( SpecializeToContext ) { <nl> ContextSpecializationTester t ; <nl> <nl> - Node * start = t . NewNode ( t . common ( ) - > Start ( ) ) ; <nl> + Node * start = t . NewNode ( t . common ( ) - > Start ( 0 ) ) ; <nl> t . graph ( ) - > SetStart ( start ) ; <nl> <nl> / / Make a context and initialize it a bit for this test . <nl> TEST ( SpecializeToContext ) { <nl> t . info ( ) - > SetContext ( native ) ; <nl> <nl> Node * const_context = t . jsgraph ( ) - > Constant ( native ) ; <nl> - Node * param_context = t . NewNode ( t . common ( ) - > Parameter ( 0 ) ) ; <nl> + Node * param_context = t . NewNode ( t . common ( ) - > Parameter ( 0 ) , start ) ; <nl> JSContextSpecializer spec ( t . info ( ) , t . jsgraph ( ) , const_context ) ; <nl> <nl> { <nl> / / Check that SpecializeToContext ( ) replaces values and forwards effects <nl> / / correctly , and folds values from constant and non - constant contexts <nl> - Node * effect_in = t . NewNode ( t . common ( ) - > Start ( ) ) ; <nl> + Node * effect_in = t . NewNode ( t . common ( ) - > Start ( 0 ) ) ; <nl> Node * load = t . NewNode ( t . javascript ( ) - > LoadContext ( 0 , slot , true ) , <nl> const_context , const_context , effect_in , start ) ; <nl> <nl> mmm a / test / cctest / compiler / test - js - typed - lowering . cc <nl> ppp b / test / cctest / compiler / test - js - typed - lowering . cc <nl> using namespace v8 : : internal : : compiler ; <nl> <nl> class JSTypedLoweringTester : public HandleAndZoneScope { <nl> public : <nl> - JSTypedLoweringTester ( ) <nl> + explicit JSTypedLoweringTester ( int num_parameters = 0 ) <nl> : isolate ( main_isolate ( ) ) , <nl> binop ( NULL ) , <nl> unop ( NULL ) , <nl> class JSTypedLoweringTester : public HandleAndZoneScope { <nl> source_positions ( & graph ) , <nl> context_node ( NULL ) { <nl> typer . DecorateGraph ( & graph ) ; <nl> + Node * s = graph . NewNode ( common . Start ( num_parameters ) ) ; <nl> + graph . SetStart ( s ) ; <nl> } <nl> <nl> Isolate * isolate ; <nl> class JSTypedLoweringTester : public HandleAndZoneScope { <nl> Node * context_node ; <nl> <nl> Node * Parameter ( Type * t , int32_t index = 0 ) { <nl> - Node * n = graph . NewNode ( common . Parameter ( index ) ) ; <nl> + Node * n = graph . NewNode ( common . Parameter ( index ) , graph . start ( ) ) ; <nl> NodeProperties : : SetBounds ( n , Bounds ( Type : : None ( ) , t ) ) ; <nl> return n ; <nl> } <nl> class JSTypedLoweringTester : public HandleAndZoneScope { <nl> return node ; <nl> } <nl> <nl> - Node * start ( ) { <nl> - Node * s = graph . start ( ) ; <nl> - if ( s = = NULL ) { <nl> - s = graph . NewNode ( common . Start ( ) ) ; <nl> - graph . SetStart ( s ) ; <nl> - } <nl> - return s ; <nl> - } <nl> + Node * start ( ) { return graph . start ( ) ; } <nl> <nl> Node * context ( ) { <nl> if ( context_node = = NULL ) { <nl> - context_node = graph . NewNode ( common . Parameter ( - 1 ) ) ; <nl> + context_node = graph . NewNode ( common . Parameter ( - 1 ) , graph . start ( ) ) ; <nl> } <nl> return context_node ; <nl> } <nl> mmm a / test / cctest / compiler / test - machine - operator - reducer . cc <nl> ppp b / test / cctest / compiler / test - machine - operator - reducer . cc <nl> Operator * NewConstantOperator < double > ( CommonOperatorBuilder * common , <nl> <nl> class ReducerTester : public HandleAndZoneScope { <nl> public : <nl> - ReducerTester ( ) <nl> + explicit ReducerTester ( int num_parameters = 0 ) <nl> : isolate ( main_isolate ( ) ) , <nl> binop ( NULL ) , <nl> unop ( NULL ) , <nl> machine ( main_zone ( ) ) , <nl> common ( main_zone ( ) ) , <nl> graph ( main_zone ( ) ) , <nl> - maxuint32 ( Constant < int32_t > ( kMaxUInt32 ) ) { } <nl> + maxuint32 ( Constant < int32_t > ( kMaxUInt32 ) ) { <nl> + Node * s = graph . NewNode ( common . Start ( num_parameters ) ) ; <nl> + graph . SetStart ( s ) ; <nl> + } <nl> <nl> Isolate * isolate ; <nl> Operator * binop ; <nl> class ReducerTester : public HandleAndZoneScope { <nl> } <nl> <nl> Node * Parameter ( int32_t index = 0 ) { <nl> - return graph . NewNode ( common . Parameter ( index ) ) ; <nl> + return graph . NewNode ( common . Parameter ( index ) , graph . start ( ) ) ; <nl> } <nl> } ; <nl> <nl> mmm a / test / cctest / compiler / test - phi - reducer . cc <nl> ppp b / test / cctest / compiler / test - phi - reducer . cc <nl> using namespace v8 : : internal : : compiler ; <nl> <nl> class PhiReducerTester : HandleAndZoneScope { <nl> public : <nl> - PhiReducerTester ( ) <nl> + explicit PhiReducerTester ( int num_parameters = 0 ) <nl> : isolate ( main_isolate ( ) ) , <nl> common ( main_zone ( ) ) , <nl> graph ( main_zone ( ) ) , <nl> - self ( graph . NewNode ( common . Start ( ) ) ) , <nl> - dead ( graph . NewNode ( common . Dead ( ) ) ) { } <nl> + self ( graph . NewNode ( common . Start ( num_parameters ) ) ) , <nl> + dead ( graph . NewNode ( common . Dead ( ) ) ) { <nl> + graph . SetStart ( self ) ; <nl> + } <nl> <nl> Isolate * isolate ; <nl> CommonOperatorBuilder common ; <nl> class PhiReducerTester : HandleAndZoneScope { <nl> } <nl> <nl> Node * Parameter ( int32_t index = 0 ) { <nl> - return graph . NewNode ( common . Parameter ( index ) ) ; <nl> + return graph . NewNode ( common . Parameter ( index ) , graph . start ( ) ) ; <nl> } <nl> <nl> Node * Phi ( Node * a ) { <nl> mmm a / test / cctest / compiler / test - representation - change . cc <nl> ppp b / test / cctest / compiler / test - representation - change . cc <nl> namespace compiler { <nl> class RepresentationChangerTester : public HandleAndZoneScope , <nl> public GraphAndBuilders { <nl> public : <nl> - RepresentationChangerTester ( ) <nl> + explicit RepresentationChangerTester ( int num_parameters = 0 ) <nl> : GraphAndBuilders ( main_zone ( ) ) , <nl> typer_ ( main_zone ( ) ) , <nl> jsgraph_ ( main_graph_ , & main_common_ , & typer_ ) , <nl> changer_ ( & jsgraph_ , & main_simplified_ , & main_machine_ , main_isolate ( ) ) { <nl> + Node * s = graph ( ) - > NewNode ( common ( ) - > Start ( num_parameters ) ) ; <nl> + graph ( ) - > SetStart ( s ) ; <nl> } <nl> <nl> Typer typer_ ; <nl> class RepresentationChangerTester : public HandleAndZoneScope , <nl> } <nl> <nl> Node * Parameter ( int index = 0 ) { <nl> - return graph ( ) - > NewNode ( common ( ) - > Parameter ( index ) ) ; <nl> + return graph ( ) - > NewNode ( common ( ) - > Parameter ( index ) , graph ( ) - > start ( ) ) ; <nl> } <nl> <nl> void CheckTypeError ( RepTypeUnion from , RepTypeUnion to ) { <nl> mmm a / test / cctest / compiler / test - schedule . cc <nl> ppp b / test / cctest / compiler / test - schedule . cc <nl> TEST ( BuildMulNodeGraph ) { <nl> CommonOperatorBuilder common ( scope . main_zone ( ) ) ; <nl> MachineOperatorBuilder machine ( scope . main_zone ( ) , kMachineWord32 ) ; <nl> <nl> - Node * start = graph . NewNode ( common . Start ( ) ) ; <nl> + Node * start = graph . NewNode ( common . Start ( 0 ) ) ; <nl> graph . SetStart ( start ) ; <nl> - Node * param0 = graph . NewNode ( common . Parameter ( 0 ) ) ; <nl> - Node * param1 = graph . NewNode ( common . Parameter ( 1 ) ) ; <nl> + Node * param0 = graph . NewNode ( common . Parameter ( 0 ) , graph . start ( ) ) ; <nl> + Node * param1 = graph . NewNode ( common . Parameter ( 1 ) , graph . start ( ) ) ; <nl> <nl> Node * mul = graph . NewNode ( machine . Int32Mul ( ) , param0 , param1 ) ; <nl> Node * ret = graph . NewNode ( common . Return ( ) , mul , start ) ; <nl> mmm a / test / cctest / compiler / test - scheduler . cc <nl> ppp b / test / cctest / compiler / test - scheduler . cc <nl> TEST ( BuildScheduleEmpty ) { <nl> HandleAndZoneScope scope ; <nl> Graph graph ( scope . main_zone ( ) ) ; <nl> CommonOperatorBuilder builder ( scope . main_zone ( ) ) ; <nl> - graph . SetStart ( graph . NewNode ( builder . Start ( ) ) ) ; <nl> + graph . SetStart ( graph . NewNode ( builder . Start ( 0 ) ) ) ; <nl> graph . SetEnd ( graph . NewNode ( builder . End ( ) , graph . start ( ) ) ) ; <nl> <nl> Scheduler scheduler ( scope . main_zone ( ) ) ; <nl> TEST ( BuildScheduleOneParameter ) { <nl> HandleAndZoneScope scope ; <nl> Graph graph ( scope . main_zone ( ) ) ; <nl> CommonOperatorBuilder builder ( scope . main_zone ( ) ) ; <nl> - graph . SetStart ( graph . NewNode ( builder . Start ( ) ) ) ; <nl> + graph . SetStart ( graph . NewNode ( builder . Start ( 0 ) ) ) ; <nl> <nl> - Node * p1 = graph . NewNode ( builder . Parameter ( 0 ) ) ; <nl> + Node * p1 = graph . NewNode ( builder . Parameter ( 0 ) , graph . start ( ) ) ; <nl> Node * ret = graph . NewNode ( builder . Return ( ) , p1 , graph . start ( ) , graph . start ( ) ) ; <nl> <nl> graph . SetEnd ( graph . NewNode ( builder . End ( ) , ret ) ) ; <nl> TEST ( BuildScheduleIfSplit ) { <nl> Graph graph ( scope . main_zone ( ) ) ; <nl> CommonOperatorBuilder builder ( scope . main_zone ( ) ) ; <nl> JSOperatorBuilder js_builder ( scope . main_zone ( ) ) ; <nl> - graph . SetStart ( graph . NewNode ( builder . Start ( ) ) ) ; <nl> + graph . SetStart ( graph . NewNode ( builder . Start ( 3 ) ) ) ; <nl> <nl> - Node * p1 = graph . NewNode ( builder . Parameter ( 0 ) ) ; <nl> - Node * p2 = graph . NewNode ( builder . Parameter ( 1 ) ) ; <nl> - Node * p3 = graph . NewNode ( builder . Parameter ( 2 ) ) ; <nl> - Node * p4 = graph . NewNode ( builder . Parameter ( 3 ) ) ; <nl> - Node * p5 = graph . NewNode ( builder . Parameter ( 4 ) ) ; <nl> + Node * p1 = graph . NewNode ( builder . Parameter ( 0 ) , graph . start ( ) ) ; <nl> + Node * p2 = graph . NewNode ( builder . Parameter ( 1 ) , graph . start ( ) ) ; <nl> + Node * p3 = graph . NewNode ( builder . Parameter ( 2 ) , graph . start ( ) ) ; <nl> + Node * p4 = graph . NewNode ( builder . Parameter ( 3 ) , graph . start ( ) ) ; <nl> + Node * p5 = graph . NewNode ( builder . Parameter ( 4 ) , graph . start ( ) ) ; <nl> Node * cmp = graph . NewNode ( js_builder . LessThanOrEqual ( ) , p1 , p2 , p3 , <nl> graph . start ( ) , graph . start ( ) ) ; <nl> Node * branch = graph . NewNode ( builder . Branch ( ) , cmp , graph . start ( ) ) ; <nl> TEST ( BuildScheduleIfSplitWithEffects ) { <nl> / / return c * c - a ; <nl> / / } <nl> / / } <nl> + op = common_builder . Start ( 0 ) ; <nl> + Node * n0 = graph . NewNode ( op ) ; <nl> + USE ( n0 ) ; <nl> Node * nil = graph . NewNode ( common_builder . Dead ( ) ) ; <nl> op = common_builder . End ( ) ; <nl> Node * n23 = graph . NewNode ( op , nil ) ; <nl> TEST ( BuildScheduleIfSplitWithEffects ) { <nl> Node * n11 = graph . NewNode ( op , nil , nil , nil , nil , nil ) ; <nl> USE ( n11 ) ; <nl> op = common_builder . Parameter ( 0 ) ; <nl> - Node * n2 = graph . NewNode ( op ) ; <nl> + Node * n2 = graph . NewNode ( op , n0 ) ; <nl> USE ( n2 ) ; <nl> n11 - > ReplaceInput ( 0 , n2 ) ; <nl> op = common_builder . Parameter ( 0 ) ; <nl> - Node * n3 = graph . NewNode ( op ) ; <nl> + Node * n3 = graph . NewNode ( op , n0 ) ; <nl> USE ( n3 ) ; <nl> n11 - > ReplaceInput ( 1 , n3 ) ; <nl> op = common_builder . HeapConstant ( unique_constant ) ; <nl> TEST ( BuildScheduleIfSplitWithEffects ) { <nl> n8 - > ReplaceInput ( 0 , n2 ) ; <nl> n8 - > ReplaceInput ( 1 , n3 ) ; <nl> n8 - > ReplaceInput ( 2 , n7 ) ; <nl> - op = common_builder . Start ( ) ; <nl> - Node * n0 = graph . NewNode ( op ) ; <nl> - USE ( n0 ) ; <nl> n8 - > ReplaceInput ( 3 , n0 ) ; <nl> n8 - > ReplaceInput ( 4 , n0 ) ; <nl> n11 - > ReplaceInput ( 3 , n8 ) ; <nl> TEST ( BuildScheduleIfSplitWithEffects ) { <nl> Node * n12 = graph . NewNode ( op , nil , nil , nil , nil , nil ) ; <nl> USE ( n12 ) ; <nl> op = common_builder . Parameter ( 0 ) ; <nl> - Node * n4 = graph . NewNode ( op ) ; <nl> + Node * n4 = graph . NewNode ( op , n0 ) ; <nl> USE ( n4 ) ; <nl> n12 - > ReplaceInput ( 0 , n4 ) ; <nl> n12 - > ReplaceInput ( 1 , n4 ) ; <nl> TEST ( BuildScheduleIfSplitWithEffects ) { <nl> n14 - > ReplaceInput ( 4 , n10 ) ; <nl> n15 - > ReplaceInput ( 0 , n14 ) ; <nl> op = common_builder . Parameter ( 0 ) ; <nl> - Node * n5 = graph . NewNode ( op ) ; <nl> + Node * n5 = graph . NewNode ( op , n0 ) ; <nl> USE ( n5 ) ; <nl> n15 - > ReplaceInput ( 1 , n5 ) ; <nl> n15 - > ReplaceInput ( 2 , n7 ) ; <nl> TEST ( BuildScheduleSimpleLoop ) { <nl> / / } <nl> / / return a ; <nl> / / } <nl> + op = common_builder . Start ( 0 ) ; <nl> + Node * n0 = graph . NewNode ( op ) ; <nl> + USE ( n0 ) ; <nl> Node * nil = graph . NewNode ( common_builder . Dead ( ) ) ; <nl> op = common_builder . End ( ) ; <nl> Node * n20 = graph . NewNode ( op , nil ) ; <nl> TEST ( BuildScheduleSimpleLoop ) { <nl> Node * n8 = graph . NewNode ( op , nil , nil , nil ) ; <nl> USE ( n8 ) ; <nl> op = common_builder . Parameter ( 0 ) ; <nl> - Node * n2 = graph . NewNode ( op ) ; <nl> + Node * n2 = graph . NewNode ( op , n0 ) ; <nl> USE ( n2 ) ; <nl> n8 - > ReplaceInput ( 0 , n2 ) ; <nl> op = js_builder . Add ( ) ; <nl> TEST ( BuildScheduleSimpleLoop ) { <nl> Node * n9 = graph . NewNode ( op , nil , nil , nil ) ; <nl> USE ( n9 ) ; <nl> op = common_builder . Parameter ( 0 ) ; <nl> - Node * n3 = graph . NewNode ( op ) ; <nl> + Node * n3 = graph . NewNode ( op , n0 ) ; <nl> USE ( n3 ) ; <nl> n9 - > ReplaceInput ( 0 , n3 ) ; <nl> n9 - > ReplaceInput ( 1 , n9 ) ; <nl> op = common_builder . Loop ( 2 ) ; <nl> Node * n6 = graph . NewNode ( op , nil , nil ) ; <nl> USE ( n6 ) ; <nl> - op = common_builder . Start ( ) ; <nl> - Node * n0 = graph . NewNode ( op ) ; <nl> - USE ( n0 ) ; <nl> n6 - > ReplaceInput ( 0 , n0 ) ; <nl> op = common_builder . IfTrue ( ) ; <nl> Node * n14 = graph . NewNode ( op , nil ) ; <nl> TEST ( BuildScheduleComplexLoops ) { <nl> / / } <nl> / / return a ; <nl> / / } <nl> + op = common_builder . Start ( 0 ) ; <nl> + Node * n0 = graph . NewNode ( op ) ; <nl> + USE ( n0 ) ; <nl> Node * nil = graph . NewNode ( common_builder . Dead ( ) ) ; <nl> op = common_builder . End ( ) ; <nl> Node * n46 = graph . NewNode ( op , nil ) ; <nl> TEST ( BuildScheduleComplexLoops ) { <nl> Node * n9 = graph . NewNode ( op , nil , nil , nil ) ; <nl> USE ( n9 ) ; <nl> op = common_builder . Parameter ( 0 ) ; <nl> - Node * n2 = graph . NewNode ( op ) ; <nl> + Node * n2 = graph . NewNode ( op , n0 ) ; <nl> USE ( n2 ) ; <nl> n9 - > ReplaceInput ( 0 , n2 ) ; <nl> op = common_builder . Phi ( 2 ) ; <nl> TEST ( BuildScheduleComplexLoops ) { <nl> Node * n10 = graph . NewNode ( op , nil , nil , nil ) ; <nl> USE ( n10 ) ; <nl> op = common_builder . Parameter ( 0 ) ; <nl> - Node * n3 = graph . NewNode ( op ) ; <nl> + Node * n3 = graph . NewNode ( op , n0 ) ; <nl> USE ( n3 ) ; <nl> n10 - > ReplaceInput ( 0 , n3 ) ; <nl> op = common_builder . Phi ( 2 ) ; <nl> TEST ( BuildScheduleComplexLoops ) { <nl> op = common_builder . Loop ( 2 ) ; <nl> Node * n7 = graph . NewNode ( op , nil , nil ) ; <nl> USE ( n7 ) ; <nl> - op = common_builder . Start ( ) ; <nl> - Node * n0 = graph . NewNode ( op ) ; <nl> - USE ( n0 ) ; <nl> n7 - > ReplaceInput ( 0 , n0 ) ; <nl> op = common_builder . IfFalse ( ) ; <nl> Node * n30 = graph . NewNode ( op , nil ) ; <nl> TEST ( BuildScheduleComplexLoops ) { <nl> Node * n11 = graph . NewNode ( op , nil , nil , nil ) ; <nl> USE ( n11 ) ; <nl> op = common_builder . Parameter ( 0 ) ; <nl> - Node * n4 = graph . NewNode ( op ) ; <nl> + Node * n4 = graph . NewNode ( op , n0 ) ; <nl> USE ( n4 ) ; <nl> n11 - > ReplaceInput ( 0 , n4 ) ; <nl> n11 - > ReplaceInput ( 1 , n25 ) ; <nl> TEST ( BuildScheduleBreakAndContinue ) { <nl> / / } <nl> / / return a + d ; <nl> / / } <nl> + op = common_builder . Start ( 0 ) ; <nl> + Node * n0 = graph . NewNode ( op ) ; <nl> + USE ( n0 ) ; <nl> Node * nil = graph . NewNode ( common_builder . Dead ( ) ) ; <nl> op = common_builder . End ( ) ; <nl> Node * n58 = graph . NewNode ( op , nil ) ; <nl> TEST ( BuildScheduleBreakAndContinue ) { <nl> Node * n10 = graph . NewNode ( op , nil , nil , nil ) ; <nl> USE ( n10 ) ; <nl> op = common_builder . Parameter ( 0 ) ; <nl> - Node * n2 = graph . NewNode ( op ) ; <nl> + Node * n2 = graph . NewNode ( op , n0 ) ; <nl> USE ( n2 ) ; <nl> n10 - > ReplaceInput ( 0 , n2 ) ; <nl> op = common_builder . Phi ( 2 ) ; <nl> TEST ( BuildScheduleBreakAndContinue ) { <nl> Node * n11 = graph . NewNode ( op , nil , nil , nil ) ; <nl> USE ( n11 ) ; <nl> op = common_builder . Parameter ( 0 ) ; <nl> - Node * n3 = graph . NewNode ( op ) ; <nl> + Node * n3 = graph . NewNode ( op , n0 ) ; <nl> USE ( n3 ) ; <nl> n11 - > ReplaceInput ( 0 , n3 ) ; <nl> op = common_builder . Phi ( 2 ) ; <nl> TEST ( BuildScheduleBreakAndContinue ) { <nl> op = common_builder . Loop ( 2 ) ; <nl> Node * n8 = graph . NewNode ( op , nil , nil ) ; <nl> USE ( n8 ) ; <nl> - op = common_builder . Start ( ) ; <nl> - Node * n0 = graph . NewNode ( op ) ; <nl> - USE ( n0 ) ; <nl> n8 - > ReplaceInput ( 0 , n0 ) ; <nl> op = common_builder . Merge ( 2 ) ; <nl> Node * n53 = graph . NewNode ( op , nil , nil ) ; <nl> TEST ( BuildScheduleBreakAndContinue ) { <nl> Node * n12 = graph . NewNode ( op , nil , nil , nil ) ; <nl> USE ( n12 ) ; <nl> op = common_builder . Parameter ( 0 ) ; <nl> - Node * n4 = graph . NewNode ( op ) ; <nl> + Node * n4 = graph . NewNode ( op , n0 ) ; <nl> USE ( n4 ) ; <nl> n12 - > ReplaceInput ( 0 , n4 ) ; <nl> op = common_builder . Phi ( 2 ) ; <nl> TEST ( BuildScheduleSimpleLoopWithCodeMotion ) { <nl> / / } <nl> / / return a ; <nl> / / } <nl> + op = common_builder . Start ( 0 ) ; <nl> + Node * n0 = graph . NewNode ( op ) ; <nl> + USE ( n0 ) ; <nl> Node * nil = graph . NewNode ( common_builder . Dead ( ) ) ; <nl> op = common_builder . End ( ) ; <nl> Node * n22 = graph . NewNode ( op , nil ) ; <nl> TEST ( BuildScheduleSimpleLoopWithCodeMotion ) { <nl> Node * n9 = graph . NewNode ( op , nil , nil , nil ) ; <nl> USE ( n9 ) ; <nl> op = common_builder . Parameter ( 0 ) ; <nl> - Node * n2 = graph . NewNode ( op ) ; <nl> + Node * n2 = graph . NewNode ( op , n0 ) ; <nl> USE ( n2 ) ; <nl> n9 - > ReplaceInput ( 0 , n2 ) ; <nl> op = js_builder . Add ( ) ; <nl> TEST ( BuildScheduleSimpleLoopWithCodeMotion ) { <nl> Node * n10 = graph . NewNode ( op , nil , nil , nil ) ; <nl> USE ( n10 ) ; <nl> op = common_builder . Parameter ( 0 ) ; <nl> - Node * n3 = graph . NewNode ( op ) ; <nl> + Node * n3 = graph . NewNode ( op , n0 ) ; <nl> USE ( n3 ) ; <nl> n10 - > ReplaceInput ( 0 , n3 ) ; <nl> n10 - > ReplaceInput ( 1 , n10 ) ; <nl> op = common_builder . Loop ( 2 ) ; <nl> Node * n7 = graph . NewNode ( op , nil , nil ) ; <nl> USE ( n7 ) ; <nl> - op = common_builder . Start ( ) ; <nl> - Node * n0 = graph . NewNode ( op ) ; <nl> - USE ( n0 ) ; <nl> n7 - > ReplaceInput ( 0 , n0 ) ; <nl> op = common_builder . IfTrue ( ) ; <nl> Node * n17 = graph . NewNode ( op , nil ) ; <nl> TEST ( BuildScheduleSimpleLoopWithCodeMotion ) { <nl> Node * n11 = graph . NewNode ( op , nil , nil , nil ) ; <nl> USE ( n11 ) ; <nl> op = common_builder . Parameter ( 0 ) ; <nl> - Node * n4 = graph . NewNode ( op ) ; <nl> + Node * n4 = graph . NewNode ( op , n0 ) ; <nl> USE ( n4 ) ; <nl> n11 - > ReplaceInput ( 0 , n4 ) ; <nl> n11 - > ReplaceInput ( 1 , n11 ) ; <nl>
Make start node a value input to parameter nodes .
v8/v8
8322577eeb5e07317d2b6d4b37e0f231b6a08d7a
2014-08-05T08:47:39Z
mmm a / tensorflow / core / kernels / transpose_functor_cpu . cc <nl> ppp b / tensorflow / core / kernels / transpose_functor_cpu . cc <nl> void TransposeUsingEigen ( const Device & d , const Tensor & in , <nl> auto y = typename TTypes < T , NDIMS > : : Tensor ( <nl> reinterpret_cast < T * > ( const_cast < char * > ( out - > tensor_data ( ) . data ( ) ) ) , <nl> out - > shape ( ) . AsEigenDSizes < NDIMS > ( ) ) ; <nl> - auto nelem = in . NumElements ( ) ; <nl> - static const int64 kInlineThreshold = 131072 ; <nl> - if ( nelem * sizeof ( T ) < kInlineThreshold ) { <nl> - / / Don ' t bother multi - threaded transpose if ' in ' is small . <nl> - y = x . shuffle ( p ) ; <nl> - } else { <nl> - y . device ( d ) = x . shuffle ( p ) ; <nl> - } <nl> + y . device ( d ) = x . shuffle ( p ) ; <nl> } <nl> <nl> } / / end namespace internal <nl>
Rely on the tensor cost model to figure out the best strategy to parallelize
tensorflow/tensorflow
313408ba1f5c46a3248980c96399e1804fd6d436
2016-05-12T20:51:48Z
mmm a / lib / Sema / CSApply . cpp <nl> ppp b / lib / Sema / CSApply . cpp <nl> getCallerDefaultArg ( TypeChecker & tc , DeclContext * dc , <nl> static Expr * lookThroughIdentityExprs ( Expr * expr ) { <nl> while ( true ) { <nl> if ( auto ident = dyn_cast < IdentityExpr > ( expr ) ) { <nl> - expr = ident ; <nl> - } else if ( auto ident = dyn_cast < AnyTryExpr > ( expr ) ) { <nl> - expr = ident ; <nl> + expr = ident - > getSubExpr ( ) ; <nl> + } else if ( auto anyTry = dyn_cast < AnyTryExpr > ( expr ) ) { <nl> + expr = anyTry - > getSubExpr ( ) ; <nl> } else { <nl> return expr ; <nl> } <nl> mmm a / test / Constraints / tuple . swift <nl> ppp b / test / Constraints / tuple . swift <nl> func invalidPatternCrash ( let k : Int ) { <nl> } <nl> } <nl> <nl> + / / < rdar : / / problem / 21875219 > Tuple to tuple conversion with IdentityExpr / AnyTryExpr hang <nl> + class Paws { <nl> + init ( ) throws { } <nl> + } <nl> <nl> + func scruff ( ) - > ( AnyObject ? , ErrorType ? ) { <nl> + do { <nl> + return try ( Paws ( ) , nil ) <nl> + } catch { <nl> + return ( nil , error ) <nl> + } <nl> + } <nl>
Sema : Fix infinite loop in lookThroughIdentityExprs ( )
apple/swift
edcd279d75ea50e625ec192eebffe997dc331610
2015-07-17T22:27:34Z
mmm a / docs / en / operations / system_tables . md <nl> ppp b / docs / en / operations / system_tables . md <nl> Columns : <nl> - ` user ` ( String ) — Name of the user who initiated the current query . <nl> - ` query_id ` ( String ) — ID of the query . <nl> - ` address ` ( FixedString ( 16 ) ) — IP address the query was initiated from . <nl> - - ` port ` ( UInt16 ) — The server port that was used to receive the query . <nl> + - ` port ` ( UInt16 ) — The client port that was used to make the query . <nl> - ` initial_user ` ( String ) — Name of the user who ran the parent query ( for distributed query execution ) . <nl> - ` initial_query_id ` ( String ) — ID of the parent query . <nl> - ` initial_address ` ( FixedString ( 16 ) ) — IP address that the parent query was launched from . <nl> - - ` initial_port ` ( UInt16 ) — The server port that was used to receive the parent query from the client . <nl> + - ` initial_port ` ( UInt16 ) — The client port that was used to make the parent query . <nl> - ` interface ` ( UInt8 ) — Interface that the query was initiated from . Possible values : <nl> - 1 — TCP . <nl> - 2 — HTTP . <nl> Columns : <nl> - ` user ` ( String ) — Name of the user who initiated the current query . <nl> - ` query_id ` ( String ) — ID of the query . <nl> - ` address ` ( FixedString ( 16 ) ) — IP address the query was initiated from . <nl> - - ` port ` ( UInt16 ) — The server port that was used to receive the query . <nl> + - ` port ` ( UInt16 ) — The client port that was used to make the query . <nl> - ` initial_user ` ( String ) — Name of the user who ran the parent query ( for distributed query execution ) . <nl> - ` initial_query_id ` ( String ) — ID of the parent query . <nl> - ` initial_address ` ( FixedString ( 16 ) ) — IP address that the parent query was launched from . <nl> - - ` initial_port ` ( UInt16 ) — The server port that was used to receive the parent query from the client . <nl> + - ` initial_port ` ( UInt16 ) — The client port that was used to make the parent query . <nl> - ` interface ` ( UInt8 ) — Interface that the query was initiated from . Possible values : <nl> - 1 — TCP . <nl> - 2 — HTTP . <nl> mmm a / docs / ru / operations / system_tables . md <nl> ppp b / docs / ru / operations / system_tables . md <nl> ClickHouse создаёт таблицу только в том случае , к <nl> - ` user ` ( String ) — пользователь , запустивший текущий запрос . <nl> - ` query_id ` ( String ) — ID запроса . <nl> - ` address ` ( FixedString ( 16 ) ) — IP адрес , с которого пришел запрос . <nl> - - ` port ` ( UInt16 ) — порт , на котором сервер принял запрос . <nl> + - ` port ` ( UInt16 ) — порт , с которого клиент сделал запрос <nl> - ` initial_user ` ( String ) — пользователь , запустивший первоначальный запрос ( для распределенных запросов ) . <nl> - ` initial_query_id ` ( String ) — ID родительского запроса . <nl> - ` initial_address ` ( FixedString ( 16 ) ) — IP адрес , с которого пришел родительский запрос . <nl> - - ` initial_port ` ( UInt16 ) — порт , на котором сервер принял родительский запрос от клиента . <nl> + - ` initial_port ` ( UInt16 ) — порт , с которого клиент сделал родительский запрос . <nl> - ` interface ` ( UInt8 ) — интерфейс , с которого ушёл запрос . Возможные значения : <nl> - 1 — TCP . <nl> - 2 — HTTP . <nl> ClickHouse создаёт таблицу только в том случае , к <nl> - ` user ` ( String ) — пользователь , запустивший текущий запрос . <nl> - ` query_id ` ( String ) — ID запроса . <nl> - ` address ` ( FixedString ( 16 ) ) — IP адрес , с которого пришел запрос . <nl> - - ` port ` ( UInt16 ) — порт , на котором сервер принял запрос . <nl> + - ` port ` ( UInt16 ) — порт , с которого клиент сделал запрос <nl> - ` initial_user ` ( String ) — пользователь , запустивший первоначальный запрос ( для распределенных запросов ) . <nl> - ` initial_query_id ` ( String ) — ID родительского запроса . <nl> - ` initial_address ` ( FixedString ( 16 ) ) — IP адрес , с которого пришел родительский запрос . <nl> - - ` initial_port ` ( UInt16 ) — порт , на котором сервер принял родительский запрос от клиента . <nl> + - ` initial_port ` ( UInt16 ) — порт , с которого клиент сделал родительский запрос . <nl> - ` interface ` ( UInt8 ) — интерфейс , с которого ушёл запрос . Возможные значения : <nl> - 1 — TCP . <nl> - 2 — HTTP . <nl>
Fix ports columns documentation
ClickHouse/ClickHouse
3f4faf9c9ba58a512d10ba6a6428438969076e6a
2019-12-02T11:48:52Z
new file mode 100644 <nl> index 00000000000 . . df5b7df7aea <nl> mmm / dev / null <nl> ppp b / tools / reproduceriter . py <nl> <nl> + ' ' ' <nl> + <nl> + * This is a work in progress * <nl> + <nl> + Reproducer Rewriter <nl> + = = = = = = = = = = = = = = = = = = = <nl> + <nl> + Processes a project and rewrites it so as to generate deterministic , <nl> + reproducible automatic results . For example , you can run this on a <nl> + game , and then when the game is run it will record user input and <nl> + sources of nondeterminism like Math . random ( ) . You can then run <nl> + that recording as a benchmark or as a demo , it should give nearly <nl> + identical results every time it is run to the data that was <nl> + recorded . <nl> + <nl> + Usage : <nl> + <nl> + 1 . Run this script as <nl> + <nl> + reproduceriter . py IN_DIR OUT_DIR FIRST_JS START_COMMAND <nl> + <nl> + IN_DIR should be the project directory , and OUT_DIR will be <nl> + created with the instrumented code ( OUT_DIR should not <nl> + exist ) . FIRST_JS should be a path ( relative to IN_DIR ) to <nl> + the first JavaScript file loaded by the project ( this tool <nl> + will add code to that ) . <nl> + <nl> + 2 . Run the instrumented project in OUR_DIR and interact with <nl> + the program . When you are done recording , open the web <nl> + console and run <nl> + <nl> + Recorder . finish ( ) ; <nl> + <nl> + This will write out the recorded data into the current tab . <nl> + Save it as <nl> + <nl> + repro . data <nl> + <nl> + in OUT_DIR . <nl> + <nl> + 3 . To re - play the recorded data , run the instrumented build <nl> + with <nl> + <nl> + & reproduce = repro . data <nl> + <nl> + Notes : <nl> + <nl> + * When we start to replay events , the assumption is that <nl> + there is nothing asynchronous that affects execution . So <nl> + asynchronous loading of files should have already <nl> + completed . <nl> + <nl> + TODO : start running recorded events with some trigger , for example the fullscreen button in BananaBread <nl> + ' ' ' <nl> + <nl> + import os , sys , shutil <nl> + <nl> + assert len ( sys . argv ) = = 4 , ' Usage : reproduceriter . py IN_DIR OUT_DIR ' <nl> + <nl> + # Process input args <nl> + <nl> + in_dir = sys . argv [ 1 ] <nl> + out_dir = sys . argv [ 2 ] <nl> + first_js = sys . argv [ 3 ] <nl> + <nl> + assert not os . path . exists ( out_dir ) , ' OUT_DIR must not exist ' <nl> + assert os . path . exists ( os . path . join ( in_dir , first_js ) ) <nl> + <nl> + # Copy project <nl> + <nl> + shutil . copytree ( in_dir , out_dir ) <nl> + <nl> + # Add our boilerplate <nl> + <nl> + open ( os . path . join ( out_dir , first_js ) , ' w ' ) . write ( ' ' ' <nl> + var Recorder = ( function ( ) { <nl> + var recorder ; <nl> + var init = ' & reproduce = ' ; <nl> + var initLocation = window . location . search . indexOf ( init ) ; <nl> + var replaying = initLocation > = 0 <nl> + if ( replaying ) { <nl> + / / load recording <nl> + var dataPath = window . location . search . substring ( initLocation ) ; <nl> + var baseURL = window . location . toString ( ) . replace ( ' : / / ' , ' cheez999 ' ) . split ( ' ? ' ) [ 0 ] . split ( ' / ' ) [ 0 ] . replace ( ' cheez999 ' , ' : / / ' ) ; <nl> + if ( baseURL [ baseURL . length - 1 ] ! = ' / ' ) baseURL + = ' / ' ; <nl> + var request = new XMLHttpRequest ( ) ; <nl> + request . open ( ' GET ' , baseURL + dataPath , false ) ; <nl> + request . send ( ) ; <nl> + recorder = JSON . parse ( request . responseText ) ; <nl> + / / prepare to replay <nl> + / / Math . random <nl> + var warned = false ; <nl> + Math . random = function ( ) { <nl> + if ( recorder . randoms . length > 0 ) { <nl> + return recorder . randoms . shift ( ) ; <nl> + } else { <nl> + if ( ! warned ) { <nl> + console . log ( ' warning : consuming too many values ! ' ) <nl> + warned = true ; <nl> + } <nl> + return Math . random ( ) ; <nl> + } <nl> + } ; <nl> + / / Date . now , performance . now <nl> + var warned = false ; <nl> + Date . now = function ( ) { <nl> + if ( recorder . dnows . length > 0 ) { <nl> + return recorder . dnows . shift ( ) ; <nl> + } else { <nl> + if ( ! warned ) { <nl> + console . log ( ' warning : consuming too many values ! ' ) <nl> + warned = true ; <nl> + } <nl> + return Date . now ( ) ; <nl> + } <nl> + } ; <nl> + var warned = false ; <nl> + performance . now = function ( ) { <nl> + if ( recorder . pnows . length > 0 ) { <nl> + return recorder . pnows . shift ( ) ; <nl> + } else { <nl> + if ( ! warned ) { <nl> + console . log ( ' warning : consuming too many values ! ' ) <nl> + warned = true ; <nl> + } <nl> + return performance . now ( ) ; <nl> + } <nl> + } ; <nl> + } else { <nl> + / / prepare to record <nl> + recorder = { } ; <nl> + / / Math . random <nl> + recorder . randoms = [ ] ; <nl> + var random = Math . random ( ) <nl> + Math . random = function ( ) { <nl> + var ret = random ( ) ; <nl> + recorder . randoms . push ( ret ) ; <nl> + return ret ; <nl> + } ; <nl> + / / Date . now , performance . now <nl> + recorder . dnows = [ ] ; <nl> + var dnow = Date . now ( ) ; <nl> + Date . now = function ( ) { <nl> + var ret = dnow ( ) ; <nl> + recorder . dnows . push ( ret ) ; <nl> + return ret ; <nl> + } ; <nl> + recorder . pnows = [ ] ; <nl> + var pnow = performance . now ( ) ; <nl> + performance . now = function ( ) { <nl> + var ret = pnow ( ) ; <nl> + recorder . pnows . push ( ret ) ; <nl> + return ret ; <nl> + } ; <nl> + / / finish <nl> + recorder . finish = function ( ) { <nl> + document . write ( JSON . stringify ( recorder ) ) ; <nl> + throw ' all done , remember to save ! ' ; <nl> + } ; <nl> + } <nl> + return recorder ; <nl> + } ) ( ) ; <nl> + ' ' ' + open ( os . path . join ( in_dir , first_js ) ) . read ( ) <nl> + ) <nl> + <nl>
initial work on reproducer - rewriter
emscripten-core/emscripten
ce5523f896495b571e321970be68a8da4b1059fb
2012-09-07T01:23:41Z
mmm a / hphp / doc / ir . specification <nl> ppp b / hphp / doc / ir . specification <nl> To string conversions : <nl> computed by returning the value of their count method . Objects that do not <nl> implement Countable have a count of 1 . <nl> <nl> - | CountVec , D ( Int ) , S ( VArr , Vec ) , NF <nl> + | CountVec , D ( Int ) , S ( VArr , Vec ) , LA <nl> <nl> - | CountDict , D ( Int ) , S ( DArr , Dict ) , NF <nl> + | CountDict , D ( Int ) , S ( DArr , Dict ) , LA <nl> <nl> - | CountKeyset , D ( Int ) , S ( Keyset ) , NF <nl> + | CountKeyset , D ( Int ) , S ( Keyset ) , LA <nl> <nl> | CountCollection , D ( Int ) , S ( Obj ) , NF <nl> <nl> fields of that struct for holding intermediate values . <nl> <nl> | UnsetLegacyDict , D ( Dict ) , S ( Dict ) , CRc | PRc <nl> <nl> - Enable / disable the legacy bit on the vec / dict in S0 , copying it if necessary <nl> + Enable / disable the legacy bit on the vec / dict in S0 , copying it if necessary <nl> and returning the tagged array . <nl> <nl> <nl> mmm a / hphp / runtime / base / bespoke - array . cpp <nl> ppp b / hphp / runtime / base / bespoke - array . cpp <nl> const BespokeArray * BespokeArray : : asBespoke ( const ArrayData * ad ) { <nl> } <nl> <nl> const bespoke : : Layout * BespokeArray : : layout ( ) const { <nl> - return bespoke : : layoutForIndex ( ~ m_size ) ; <nl> + return bespoke : : layoutForIndex ( m_extra ) ; <nl> } <nl> void BespokeArray : : setLayout ( const bespoke : : Layout * layout ) { <nl> - m_size = uint32_t ( ~ layout - > index ( ) ) ; <nl> + m_extra = layout - > index ( ) ; <nl> } <nl> <nl> size_t BespokeArray : : heapSize ( ) const { <nl> mmm a / hphp / runtime / base / bespoke - array . h <nl> ppp b / hphp / runtime / base / bespoke - array . h <nl> void waitOnExportProfiles ( ) ; <nl> * a variety of possible memory layouts . Eventually , our goal is to generate <nl> * these layouts at runtime , based on profiling information . <nl> * <nl> - * Bespoke arrays have an m_size that is the ones - complement of their bespoke <nl> - * layout id . This means we will always call Vsize ( ) for these arrays . <nl> + * Bespoke arrays store their bespoke layout in the ArrayData ' s m_extra field . <nl> * / <nl> struct BespokeArray : ArrayData { <nl> static BespokeArray * asBespoke ( ArrayData * ) ; <nl> mmm a / hphp / runtime / base / bespoke / logging - array . cpp <nl> ppp b / hphp / runtime / base / bespoke / logging - array . cpp <nl> HeaderKind getBespokeKind ( ArrayData : : ArrayKind kind ) { <nl> return HeaderKind ( kind | ArrayData : : kBespokeKindMask ) ; <nl> } <nl> <nl> - LoggingArray * makeWithProfile ( ArrayData * ad , LoggingProfile * prof ) { <nl> - assertx ( ad - > isVanilla ( ) ) ; <nl> - <nl> - auto lad = static_cast < LoggingArray * > ( tl_heap - > objMallocIndex ( kSizeIndex ) ) ; <nl> - lad - > initHeader_16 ( getBespokeKind ( ad - > kind ( ) ) , OneReference , ad - > auxBits ( ) ) ; <nl> - lad - > setLayout ( s_layout ) ; <nl> - lad - > wrapped = ad ; <nl> - lad - > profile = prof ; <nl> - assertx ( lad - > checkInvariants ( ) ) ; <nl> - return lad ; <nl> - } <nl> - <nl> template < typename . . . Ts > <nl> void logEvent ( const ArrayData * ad , ArrayOp op , const Ts & . . . args ) { <nl> LoggingArray : : asLogging ( ad ) - > profile - > logEvent ( op , args . . . ) ; <nl> ArrayData * maybeMakeLoggingArray ( ArrayData * ad ) { <nl> tvIsString ( k ) ? profile - > logEvent ( ArrayOp : : ConstructStr , val ( k ) . pstr , v ) <nl> : profile - > logEvent ( ArrayOp : : ConstructInt , val ( k ) . num , v ) ; <nl> } ) ; <nl> - return makeWithProfile ( ad , profile ) ; <nl> + return LoggingArray : : Make ( ad , profile ) ; <nl> } <nl> <nl> const ArrayData * maybeMakeLoggingArray ( const ArrayData * ad ) { <nl> const ArrayData * maybeMakeLoggingArray ( const ArrayData * ad ) { <nl> <nl> / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / <nl> <nl> - LoggingArray * LoggingArray : : MakeStatic ( ArrayData * ad , LoggingProfile * prof ) { <nl> + LoggingArray * LoggingArray : : Make ( ArrayData * ad , LoggingProfile * profile ) { <nl> + assertx ( ad - > isVanilla ( ) ) ; <nl> + <nl> + auto lad = static_cast < LoggingArray * > ( tl_heap - > objMallocIndex ( kSizeIndex ) ) ; <nl> + lad - > initHeader_16 ( getBespokeKind ( ad - > kind ( ) ) , OneReference , ad - > auxBits ( ) ) ; <nl> + lad - > m_size = ad - > size ( ) ; <nl> + lad - > setLayout ( s_layout ) ; <nl> + lad - > wrapped = ad ; <nl> + lad - > profile = profile ; <nl> + assertx ( lad - > checkInvariants ( ) ) ; <nl> + return lad ; <nl> + } <nl> + <nl> + LoggingArray * LoggingArray : : MakeStatic ( ArrayData * ad , LoggingProfile * profile ) { <nl> + assertx ( ad - > isVanilla ( ) ) ; <nl> assertx ( ad - > isStatic ( ) ) ; <nl> <nl> auto const size = sizeof ( LoggingArray ) ; <nl> auto lad = static_cast < LoggingArray * > ( <nl> RO : : EvalLowStaticArrays ? low_malloc ( size ) : uncounted_malloc ( size ) ) ; <nl> lad - > initHeader_16 ( getBespokeKind ( ad - > kind ( ) ) , StaticValue , ad - > auxBits ( ) ) ; <nl> + lad - > m_size = ad - > size ( ) ; <nl> lad - > setLayout ( s_layout ) ; <nl> lad - > wrapped = ad ; <nl> - lad - > profile = prof ; <nl> - <nl> + lad - > profile = profile ; <nl> + assertx ( lad - > checkInvariants ( ) ) ; <nl> return lad ; <nl> } <nl> <nl> bool LoggingArray : : checkInvariants ( ) const { <nl> assertx ( kindIsValid ( ) ) ; <nl> assertx ( wrapped - > isVanilla ( ) ) ; <nl> assertx ( wrapped - > kindIsValid ( ) ) ; <nl> + assertx ( wrapped - > getSize ( ) = = getSize ( ) ) ; <nl> assertx ( wrapped - > toDataType ( ) = = toDataType ( ) ) ; <nl> assertx ( asBespoke ( this ) - > layout ( ) = = s_layout ) ; <nl> assertx ( m_kind = = getBespokeKind ( wrapped - > kind ( ) ) ) ; <nl> const LoggingArray * LoggingArray : : asLogging ( const ArrayData * ad ) { <nl> return asLogging ( const_cast < ArrayData * > ( ad ) ) ; <nl> } <nl> <nl> - LoggingArray * LoggingArray : : updateKind ( ) { <nl> - auto const kind = getBespokeKind ( wrapped - > kind ( ) ) ; <nl> - assertx ( IMPLIES ( kind ! = m_kind , hasExactlyOneRef ( ) ) ) ; <nl> - m_kind = kind ; <nl> + void LoggingArray : : updateKindAndSize ( ) { <nl> + if ( hasExactlyOneRef ( ) ) { <nl> + m_kind = getBespokeKind ( wrapped - > kind ( ) ) ; <nl> + m_size = wrapped - > size ( ) ; <nl> + } <nl> assertx ( checkInvariants ( ) ) ; <nl> - return this ; <nl> } <nl> <nl> size_t LoggingLayout : : heapSize ( const ArrayData * ) const { <nl> ssize_t LoggingLayout : : getStrPos ( const ArrayData * ad , const StringData * k ) const <nl> <nl> namespace { <nl> ArrayData * escalate ( LoggingArray * lad , ArrayData * result ) { <nl> + lad - > updateKindAndSize ( ) ; <nl> if ( result = = lad - > wrapped ) return lad ; <nl> - return makeWithProfile ( result , lad - > profile ) ; <nl> + return LoggingArray : : Make ( result , lad - > profile ) ; <nl> } <nl> <nl> arr_lval escalate ( LoggingArray * lad , arr_lval result ) { <nl> ArrayData * convert ( ArrayData * ad , F & & f ) { <nl> auto const lad = LoggingArray : : asLogging ( ad ) ; <nl> auto const wrapped = lad - > wrapped ; <nl> auto const result = f ( wrapped ) ; <nl> + lad - > updateKindAndSize ( ) ; <nl> <nl> / / Reuse existing profile for in - place conversions . <nl> - if ( result = = wrapped ) return lad - > updateKind ( ) ; <nl> + if ( result = = wrapped ) return lad ; <nl> <nl> / / Reuse existing profile for conversions that don ' t change array layout . <nl> if ( ( wrapped - > hasVanillaMixedLayout ( ) & & result - > hasVanillaMixedLayout ( ) ) | | <nl> ( wrapped - > hasVanillaPackedLayout ( ) & & result - > hasVanillaPackedLayout ( ) ) | | <nl> ( wrapped - > isKeysetKind ( ) & & result - > isKeysetKind ( ) ) ) { <nl> - return makeWithProfile ( result , lad - > profile ) ; <nl> + return LoggingArray : : Make ( result , lad - > profile ) ; <nl> } <nl> <nl> / / If the layout has changed , make a fresh profile at the new creation site . <nl> ArrayData * convert ( ArrayData * ad , F & & f ) { <nl> return result ; <nl> } <nl> <nl> - auto const prof = getLoggingProfile ( sk , result ) ; <nl> - if ( ! prof ) return result ; <nl> + auto const profile = getLoggingProfile ( sk , result ) ; <nl> + if ( ! profile ) return result ; <nl> <nl> / / We expect 1 / SampleRate LoggingArrays to make it here . Bump sampleCount <nl> / / for the cast site accordingly . Since we sample the second array created <nl> ArrayData * convert ( ArrayData * ad , F & & f ) { <nl> / / <nl> / / TODO ( kshaunak ) : Treat this site like a constructor and log pseudo - ops . <nl> uint64_t expected = 0 ; <nl> - if ( ! prof - > sampleCount . compare_exchange_strong ( expected , 2 ) ) { <nl> - prof - > sampleCount + = RO : : EvalEmitLoggingArraySampleRate ; <nl> + if ( ! profile - > sampleCount . compare_exchange_strong ( expected , 2 ) ) { <nl> + profile - > sampleCount + = RO : : EvalEmitLoggingArraySampleRate ; <nl> } <nl> - prof - > loggingArraysEmitted + + ; <nl> + profile - > loggingArraysEmitted + + ; <nl> <nl> - return makeWithProfile ( result , prof ) ; <nl> + return LoggingArray : : Make ( result , profile ) ; <nl> } <nl> } <nl> <nl> ArrayData * LoggingLayout : : copy ( const ArrayData * ad ) const { <nl> logEvent ( ad , ArrayOp : : Copy ) ; <nl> auto const lad = LoggingArray : : asLogging ( ad ) ; <nl> - return makeWithProfile ( lad - > wrapped - > copy ( ) , lad - > profile ) ; <nl> + return LoggingArray : : Make ( lad - > wrapped - > copy ( ) , lad - > profile ) ; <nl> } <nl> ArrayData * LoggingLayout : : toVArray ( ArrayData * ad , bool copy ) const { <nl> logEvent ( ad , ArrayOp : : ToVArray ) ; <nl> mmm a / hphp / runtime / base / bespoke / logging - array . h <nl> ppp b / hphp / runtime / base / bespoke / logging - array . h <nl> struct LoggingProfile ; <nl> struct LoggingArray : BespokeArray { <nl> static LoggingArray * asLogging ( ArrayData * ad ) ; <nl> static const LoggingArray * asLogging ( const ArrayData * ad ) ; <nl> - static LoggingArray * MakeStatic ( ArrayData * ad , LoggingProfile * prof ) ; <nl> + static LoggingArray * Make ( ArrayData * ad , LoggingProfile * profile ) ; <nl> + static LoggingArray * MakeStatic ( ArrayData * ad , LoggingProfile * profile ) ; <nl> static void FreeStatic ( LoggingArray * lad ) ; <nl> <nl> - / / Updates m_kind in place to match the wrapped array ' s kind . Returns this . <nl> - LoggingArray * updateKind ( ) ; <nl> + / / Update m_kind and m_size after doing a mutation on the wrapped array . <nl> + void updateKindAndSize ( ) ; <nl> <nl> bool checkInvariants ( ) const ; <nl> <nl> mmm a / hphp / runtime / base / bespoke / logging - profile . cpp <nl> ppp b / hphp / runtime / base / bespoke / logging - profile . cpp <nl> void LoggingProfile : : logEventImpl ( const EventKey & key ) { <nl> if ( s_exportStarted . load ( std : : memory_order_relaxed ) ) return ; <nl> <nl> EventMap : : accessor it ; <nl> - auto const sink = getSrcKey ( ) ; <nl> + auto const has_sink = key . getOp ( ) ! = ArrayOp : : ReleaseUncounted ; <nl> + auto const sink = has_sink ? getSrcKey ( ) : SrcKey { } ; <nl> if ( events . insert ( it , { sink , key . toUInt64 ( ) } ) ) { <nl> it - > second = 1 ; <nl> } else { <nl> mmm a / hphp / runtime / vm / hhbc . h <nl> ppp b / hphp / runtime / vm / hhbc . h <nl> constexpr bool isBinaryOp ( Op opcode ) { <nl> opcode = = Op : : Xor ; <nl> } <nl> <nl> - constexpr bool isCast ( Op opcode ) { <nl> - return <nl> - opcode = = Op : : CastBool | | <nl> - opcode = = Op : : CastInt | | <nl> - opcode = = Op : : CastDouble | | <nl> - opcode = = Op : : CastString | | <nl> - opcode = = Op : : CastDict | | <nl> - opcode = = Op : : CastKeyset | | <nl> - opcode = = Op : : CastVec | | <nl> - opcode = = Op : : CastVArray | | <nl> - opcode = = Op : : CastDArray ; <nl> - } <nl> - <nl> constexpr bool isFCallClsMethod ( Op opcode ) { <nl> return <nl> opcode = = OpFCallClsMethod | | <nl> mmm a / hphp / runtime / vm / iter . cpp <nl> ppp b / hphp / runtime / vm / iter . cpp <nl> int64_t new_iter_array ( Iter * dest , ArrayData * ad , TypedValue * valOut ) { <nl> <nl> auto const size = ad - > getSize ( ) ; <nl> if ( UNLIKELY ( size = = 0 ) ) { <nl> - if ( ! Local ) { <nl> - if ( UNLIKELY ( ad - > decWillRelease ( ) ) ) { <nl> - if ( ad - > hasVanillaPackedLayout ( ) ) return iter_next_free_packed ( dest , ad ) ; <nl> - if ( ad - > hasVanillaMixedLayout ( ) ) return iter_next_free_mixed ( dest , ad ) ; <nl> - } <nl> - ad - > decRefCount ( ) ; <nl> - } <nl> + if ( ! Local ) decRefArr ( ad ) ; <nl> dest - > kill ( ) ; <nl> return 0 ; <nl> } <nl> int64_t new_iter_array_key ( Iter * dest , <nl> <nl> auto const size = ad - > getSize ( ) ; <nl> if ( UNLIKELY ( size = = 0 ) ) { <nl> - if ( ! Local ) { <nl> - if ( UNLIKELY ( ad - > decWillRelease ( ) ) ) { <nl> - if ( ad - > hasVanillaPackedLayout ( ) ) return iter_next_free_packed ( dest , ad ) ; <nl> - if ( ad - > hasVanillaMixedLayout ( ) ) return iter_next_free_mixed ( dest , ad ) ; <nl> - } <nl> - ad - > decRefCount ( ) ; <nl> - } <nl> + if ( ! Local ) decRefArr ( ad ) ; <nl> dest - > kill ( ) ; <nl> return 0 ; <nl> } <nl> mmm a / hphp / runtime / vm / jit / irgen - bespoke . cpp <nl> ppp b / hphp / runtime / vm / jit / irgen - bespoke . cpp <nl> namespace HPHP { namespace jit { namespace irgen { <nl> <nl> namespace { <nl> <nl> + folly : : Optional < Type > getTypeForArrLikeCast ( Op op ) { <nl> + switch ( op ) { <nl> + case Op : : CastVec : return TVec ; <nl> + case Op : : CastDict : return TDict ; <nl> + case Op : : CastKeyset : return TKeyset ; <nl> + case Op : : CastVArray : return TVArr ; <nl> + case Op : : CastDArray : return TDArr ; <nl> + default : return folly : : none ; <nl> + } <nl> + } <nl> + <nl> using Locations = TinyVector < Location , 2 > ; <nl> <nl> Locations getVanillaLocationsForBuiltin ( const IRGS & env , SrcKey sk ) { <nl> Locations getVanillaLocations ( const IRGS & env , SrcKey sk ) { <nl> return getVanillaLocationsForCall ( env , sk ) ; <nl> } else if ( isBinaryOp ( op ) ) { <nl> return { Location : : Stack { soff } , Location : : Stack { soff - 1 } } ; <nl> - } else if ( isCast ( op ) ) { <nl> + } else if ( getTypeForArrLikeCast ( op ) ) { <nl> return { Location : : Stack { soff } } ; <nl> } else if ( isMemberDimOp ( op ) | | isMemberFinalOp ( op ) ) { <nl> return { Location : : MBase { } } ; <nl> Locations getVanillaLocations ( const IRGS & env , SrcKey sk ) { <nl> } <nl> <nl> / / Miscellaneous ops that constrain one stack value . <nl> - case Op : : BitNot : <nl> case Op : : ClassGetTS : <nl> case Op : : IterInit : <nl> - case Op : : JmpNZ : <nl> - case Op : : JmpZ : <nl> - case Op : : Not : <nl> return { Location : : Stack { soff } } ; <nl> <nl> default : <nl> Locations getVanillaLocations ( const IRGS & env , SrcKey sk ) { <nl> always_assert ( false ) ; <nl> } <nl> <nl> - / / Returns a type ` t ` such that if the input is a subtype of ` t ` , the cast <nl> - / / is trivial . For non - casts , or casts we don ' t care about , returns TBottom . <nl> - Type getTypeForCast ( Op op ) { <nl> - switch ( op ) { <nl> - case Op : : CastVec : return TVec ; <nl> - case Op : : CastDict : return TDict ; <nl> - case Op : : CastKeyset : return TKeyset ; <nl> - case Op : : CastVArray : return TVArr ; <nl> - case Op : : CastDArray : return TDArr ; <nl> - default : return TBottom ; <nl> - } <nl> - } <nl> - <nl> void guardToVanilla ( IRGS & env , SrcKey sk , Location loc ) { <nl> auto const & type = env . irb - > typeOf ( loc , DataTypeSpecific ) ; <nl> if ( ! ( type . isKnownDataType ( ) & & type < = TArrLike ) ) return ; <nl> bool skipVanillaGuards ( IRGS & env , SrcKey sk , const Locations & locs ) { <nl> if ( op = = Op : : Same | | op = = Op : : NSame ) { <nl> assertx ( locs . size ( ) = = 2 ) ; <nl> return ! is_arrlike ( locs [ 0 ] ) | | ! is_arrlike ( locs [ 1 ] ) ; <nl> - } else if ( isCast ( op ) ) { <nl> + } else if ( auto const type = getTypeForArrLikeCast ( op ) ) { <nl> assertx ( locs . size ( ) = = 1 ) ; <nl> - return env . irb - > fs ( ) . typeOf ( locs [ 0 ] ) < = getTypeForCast ( op ) ; <nl> + return env . irb - > fs ( ) . typeOf ( locs [ 0 ] ) < = * type ; <nl> } <nl> return false ; <nl> } <nl> mmm a / hphp / runtime / vm / jit / irgen - builtin . cpp <nl> ppp b / hphp / runtime / vm / jit / irgen - builtin . cpp <nl> const hphp_fast_string_imap < OptEmitFn > s_opt_emit_fns { <nl> / / ( if any ) we need a vanilla input for to generate optimized HHIR . <nl> <nl> const hphp_fast_string_imap < int > s_vanilla_params { <nl> - { " count " , 0 } , <nl> - { " sizeof " , 0 } , <nl> { " HH \ \ Shapes : : idx " , 0 } , <nl> { " HH \ \ Lib \ \ _Private \ \ Native \ \ first " , 0 } , <nl> { " HH \ \ Lib \ \ _Private \ \ Native \ \ last " , 0 } , <nl> mmm a / hphp / runtime / vm / jit / simplify . cpp <nl> ppp b / hphp / runtime / vm / jit / simplify . cpp <nl> SSATmp * simplifyConvTVToInt ( State & env , const IRInstruction * inst ) { <nl> <nl> if ( srcType < = TInt ) return src ; <nl> if ( srcType < = TNull ) return cns ( env , 0 ) ; <nl> - if ( srcType < = TArr ) { <nl> - auto const length = gen ( env , Count , src ) ; <nl> - return gen ( env , Select , length , cns ( env , 1 ) , cns ( env , 0 ) ) ; <nl> - } <nl> if ( srcType . subtypeOfAny ( TVec , TVArr ) ) { <nl> auto const length = gen ( env , CountVec , src ) ; <nl> return gen ( env , Select , length , cns ( env , 1 ) , cns ( env , 0 ) ) ; <nl> SSATmp * simplifyConvTVToDbl ( State & env , const IRInstruction * inst ) { <nl> <nl> if ( srcType < = TDbl ) return src ; <nl> if ( srcType < = TNull ) return cns ( env , 0 . 0 ) ; <nl> - if ( srcType < = TArr ) return gen ( env , ConvArrToDbl , src ) ; <nl> if ( srcType . subtypeOfAny ( TVec , TVArr ) ) { <nl> auto const length = gen ( env , CountVec , src ) ; <nl> return gen ( env , ConvBoolToDbl , gen ( env , ConvIntToBool , length ) ) ; <nl>
Move bespoke layout ID to m_extra
facebook/hhvm
4fc9eb294ca1069c7ea274460de40d1b4ecf555f
2020-09-02T20:08:34Z
mmm a / db / namespace . cpp <nl> ppp b / db / namespace . cpp <nl> namespace mongo { <nl> <nl> assert ( len < 400000000 ) ; <nl> int passes = 0 ; <nl> - int maxPasses = len / 32 ; / / 30 is about the smallest entry that could go in the oplog <nl> + int maxPasses = ( len / 30 ) + 2 ; / / 30 is about the smallest entry that could go in the oplog <nl> if ( maxPasses < 5000 ) { <nl> / / this is for bacwards safety since 5000 was the old value <nl> maxPasses = 5000 ; <nl>
better maxPasses again SERVER - 649
mongodb/mongo
8e311b0094ea53e289b57b88c9183801e9626af2
2010-02-19T19:38:02Z
mmm a / dbms / src / IO / WriteBufferFromS3 . cpp <nl> ppp b / dbms / src / IO / WriteBufferFromS3 . cpp <nl> void WriteBufferFromS3 : : nextImpl ( ) <nl> if ( ! offset ( ) ) <nl> return ; <nl> <nl> + <nl> + LOG_TRACE ( ( & Logger : : get ( " WriteBufferFromS3 " ) ) , " nextImpl ( ) , offset ( ) = = " < < offset ( ) ) ; <nl> + <nl> temporary_buffer - > write ( working_buffer . begin ( ) , offset ( ) ) ; <nl> <nl> last_part_size + = offset ( ) ; <nl> void WriteBufferFromS3 : : nextImpl ( ) <nl> <nl> void WriteBufferFromS3 : : finalize ( ) <nl> { <nl> + LOG_TRACE ( ( & Logger : : get ( " WriteBufferFromS3 " ) ) , " finalize ( ) " ) ; <nl> temporary_buffer - > finish ( ) ; <nl> if ( ! buffer_string . empty ( ) ) <nl> { <nl> + LOG_TRACE ( ( & Logger : : get ( " WriteBufferFromS3 " ) ) , " finalize ( ) , writing last part " ) ; <nl> writePart ( buffer_string ) ; <nl> } <nl> <nl> mmm a / dbms / src / Storages / StorageS3 . cpp <nl> ppp b / dbms / src / Storages / StorageS3 . cpp <nl> BlockInputStreams StorageS3 : : read ( const Names & column_names , <nl> return { std : : make_shared < AddingDefaultsBlockInputStream > ( block_input , column_defaults , context ) } ; <nl> } <nl> <nl> - void StorageS3 : : rename ( const String & / * new_path_to_db * / , const String & / * new_database_name * / , const String & / * new_table_name * / , TableStructureWriteLockHolder & ) <nl> + void StorageS3 : : rename ( const String & / * new_path_to_db * / , const String & new_database_name , const String & new_table_name , TableStructureWriteLockHolder & ) <nl> { <nl> - / / FIXME <nl> + table_name = new_table_name ; <nl> + database_name = new_database_name ; <nl> } <nl> <nl> BlockOutputStreamPtr StorageS3 : : write ( const ASTPtr & / * query * / , const Context & / * context * / ) <nl> mmm a / dbms / src / Storages / StorageS3 . h <nl> ppp b / dbms / src / Storages / StorageS3 . h <nl> class StorageS3 : public ext : : shared_ptr_helper < StorageS3 > , public IStorage <nl> , database_name ( database_name_ ) <nl> , table_name ( table_name_ ) <nl> { <nl> + setColumns ( columns_ ) ; <nl> } <nl> <nl> String getName ( ) const override <nl>
Merge fix .
ClickHouse/ClickHouse
1b715069fb832c26267a7ff37c486171df0a43c3
2019-09-12T14:38:53Z
mmm a / example / bench . cpp <nl> ppp b / example / bench . cpp <nl> void bench ( int howmany , std : : shared_ptr < spdlog : : logger > log ) <nl> auto start = system_clock : : now ( ) ; <nl> for ( auto i = 0 ; i < howmany ; + + i ) <nl> { <nl> - log - > info ( " Hello logger : msg number " , i ) ; <nl> + log - > info ( " Hello logger : msg number { } " , i ) ; <nl> } <nl> <nl> <nl> mmm a / include / spdlog / details / pattern_formatter_impl . h <nl> ppp b / include / spdlog / details / pattern_formatter_impl . h <nl> class T_formatter : public flag_formatter <nl> class z_formatter : public flag_formatter <nl> { <nl> public : <nl> - const std : : chrono : : seconds cache_refresh = const std : : chrono : : seconds ( 5 ) ; <nl> + const std : : chrono : : seconds cache_refresh = std : : chrono : : seconds ( 5 ) ; <nl> <nl> z_formatter ( ) : _last_update ( std : : chrono : : seconds ( 0 ) ) { } <nl> z_formatter ( const z_formatter & ) = delete ; <nl>
some fixes for gcc
gabime/spdlog
2278e9230fc20a78edeab91403a3a414793ab675
2014-12-01T22:18:44Z
mmm a / modules / core / perf / perf_dft . cpp <nl> ppp b / modules / core / perf / perf_dft . cpp <nl> using namespace perf ; <nl> using std : : tr1 : : make_tuple ; <nl> using std : : tr1 : : get ; <nl> <nl> + / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / dft / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / <nl> + <nl> # define MAT_TYPES_DFT CV_32FC1 , CV_32FC2 , CV_64FC1 <nl> # define MAT_SIZES_DFT cv : : Size ( 320 , 480 ) , cv : : Size ( 800 , 600 ) , cv : : Size ( 1280 , 1024 ) , sz1080p , sz2K <nl> CV_ENUM ( FlagsType , 0 , DFT_INVERSE , DFT_SCALE , DFT_COMPLEX_OUTPUT , DFT_ROWS , DFT_INVERSE | DFT_COMPLEX_OUTPUT ) <nl> PERF_TEST_P ( Size_MatType_FlagsType , dft , TEST_MATS_DFT ) <nl> <nl> TEST_CYCLE ( ) dft ( src , dst , flags ) ; <nl> <nl> + SANITY_CHECK ( dst , 1e - 5 , ERROR_RELATIVE ) ; <nl> + } <nl> + <nl> + / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / dct / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / <nl> + <nl> + CV_ENUM ( DCT_FlagsType , 0 , DCT_INVERSE , DCT_ROWS , DCT_INVERSE | DCT_ROWS ) <nl> + <nl> + typedef std : : tr1 : : tuple < Size , MatType , DCT_FlagsType > Size_MatType_Flag_t ; <nl> + typedef perf : : TestBaseWithParam < Size_MatType_Flag_t > Size_MatType_Flag ; <nl> + <nl> + PERF_TEST_P ( Size_MatType_Flag , dct , testing : : Combine ( <nl> + testing : : Values ( cv : : Size ( 320 , 240 ) , cv : : Size ( 800 , 600 ) , <nl> + cv : : Size ( 1024 , 768 ) , cv : : Size ( 1280 , 1024 ) , <nl> + sz1080p , sz2K ) , <nl> + testing : : Values ( CV_32FC1 , CV_64FC1 ) , DCT_FlagsType : : all ( ) ) ) <nl> + { <nl> + Size sz = get < 0 > ( GetParam ( ) ) ; <nl> + int type = get < 1 > ( GetParam ( ) ) ; <nl> + int flags = get < 2 > ( GetParam ( ) ) ; <nl> + <nl> + Mat src ( sz , type ) ; <nl> + Mat dst ( sz , type ) ; <nl> + <nl> + declare <nl> + . in ( src , WARMUP_RNG ) <nl> + . out ( dst ) <nl> + . time ( 60 ) ; <nl> + <nl> + TEST_CYCLE ( ) dct ( src , dst , flags ) ; <nl> + <nl> SANITY_CHECK ( dst , 1e - 5 , ERROR_RELATIVE ) ; <nl> } <nl> \ No newline at end of file <nl> mmm a / modules / core / src / dxt . cpp <nl> ppp b / modules / core / src / dxt . cpp <nl> static void IDCT_64f ( const double * src , int src_step , double * dft_src , double * d <nl> <nl> } <nl> <nl> + namespace cv <nl> + { <nl> + # if defined HAVE_IPP & & IPP_VERSION_MAJOR > = 7 & & ! defined HAVE_IPP_ICV_ONLY <nl> + <nl> + typedef IppStatus ( CV_STDCALL * ippiDCTFunc ) ( const Ipp32f * , int , Ipp32f * , int , const void * , Ipp8u * ) ; <nl> + typedef IppStatus ( CV_STDCALL * ippiDCTInitAlloc ) ( void * * , IppiSize , IppHintAlgorithm ) ; <nl> + typedef IppStatus ( CV_STDCALL * ippiDCTFree ) ( void * pDCTSpec ) ; <nl> + typedef IppStatus ( CV_STDCALL * ippiDCTGetBufSize ) ( const void * , int * ) ; <nl> + <nl> + template < typename Dct > <nl> + class DctIPPLoop_Invoker : public ParallelLoopBody <nl> + { <nl> + public : <nl> + <nl> + DctIPPLoop_Invoker ( const Mat & _src , Mat & _dst , const Dct * _ippidct , bool _inv , bool * _ok ) : <nl> + ParallelLoopBody ( ) , src ( & _src ) , dst ( & _dst ) , ippidct ( _ippidct ) , inv ( _inv ) , ok ( _ok ) <nl> + { <nl> + * ok = true ; <nl> + } <nl> + <nl> + virtual void operator ( ) ( const Range & range ) const <nl> + { <nl> + void * pDCTSpec ; <nl> + AutoBuffer < uchar > buf ; <nl> + uchar * pBuffer = 0 ; <nl> + int bufSize = 0 ; <nl> + <nl> + IppiSize srcRoiSize = { src - > cols , 1 } ; <nl> + <nl> + CV_SUPPRESS_DEPRECATED_START <nl> + <nl> + ippiDCTInitAlloc ippInitAlloc = inv ? ( ippiDCTInitAlloc ) ippiDCTInvInitAlloc_32f : ( ippiDCTInitAlloc ) ippiDCTFwdInitAlloc_32f ; <nl> + ippiDCTFree ippFree = inv ? ( ippiDCTFree ) ippiDCTInvFree_32f : ( ippiDCTFree ) ippiDCTFwdFree_32f ; <nl> + ippiDCTGetBufSize ippGetBufSize = inv ? ( ippiDCTGetBufSize ) ippiDCTInvGetBufSize_32f : ( ippiDCTGetBufSize ) ippiDCTFwdGetBufSize_32f ; <nl> + <nl> + if ( ippInitAlloc ( & pDCTSpec , srcRoiSize , ippAlgHintNone ) > = 0 & & ippGetBufSize ( pDCTSpec , & bufSize ) > = 0 ) <nl> + { <nl> + buf . allocate ( bufSize ) ; <nl> + pBuffer = ( uchar * ) buf ; <nl> + <nl> + for ( int i = range . start ; i < range . end ; + + i ) <nl> + if ( ! ( * ippidct ) ( ( float * ) ( src - > data + i * src - > step ) , ( int ) src - > step , ( float * ) ( dst - > data + i * dst - > step ) , ( int ) dst - > step , pDCTSpec , ( Ipp8u * ) pBuffer ) ) <nl> + * ok = false ; <nl> + } <nl> + else <nl> + * ok = false ; <nl> + <nl> + if ( pDCTSpec ) <nl> + ippFree ( pDCTSpec ) ; <nl> + <nl> + CV_SUPPRESS_DEPRECATED_END <nl> + } <nl> + <nl> + private : <nl> + const Mat * src ; <nl> + Mat * dst ; <nl> + const Dct * ippidct ; <nl> + bool inv ; <nl> + bool * ok ; <nl> + } ; <nl> + <nl> + template < typename Dct > <nl> + bool DctIPPLoop ( const Mat & src , Mat & dst , const Dct & ippidct , bool inv ) <nl> + { <nl> + bool ok ; <nl> + parallel_for_ ( Range ( 0 , src . rows ) , DctIPPLoop_Invoker < Dct > ( src , dst , & ippidct , inv , & ok ) , src . rows / ( double ) ( 1 < < 4 ) ) ; <nl> + return ok ; <nl> + } <nl> + <nl> + struct IPPDCTFunctor <nl> + { <nl> + IPPDCTFunctor ( ippiDCTFunc _func ) : func ( _func ) { } <nl> + <nl> + bool operator ( ) ( const Ipp32f * src , int srcStep , Ipp32f * dst , int dstStep , const void * pDCTSpec , Ipp8u * pBuffer ) const <nl> + { <nl> + return func ? func ( src , srcStep , dst , dstStep , pDCTSpec , pBuffer ) > = 0 : false ; <nl> + } <nl> + private : <nl> + ippiDCTFunc func ; <nl> + } ; <nl> + <nl> + static bool ippi_DCT_32f ( const Mat & src , Mat & dst , bool inv , bool row ) <nl> + { <nl> + ippiDCTFunc ippFunc = inv ? ( ippiDCTFunc ) ippiDCTInv_32f_C1R : ( ippiDCTFunc ) ippiDCTFwd_32f_C1R ; <nl> + <nl> + if ( row ) <nl> + return ( DctIPPLoop ( src , dst , IPPDCTFunctor ( ippFunc ) , inv ) ) ; <nl> + else <nl> + { <nl> + IppStatus status ; <nl> + void * pDCTSpec ; <nl> + AutoBuffer < uchar > buf ; <nl> + uchar * pBuffer = 0 ; <nl> + int bufSize = 0 ; <nl> + <nl> + IppiSize srcRoiSize = { src . cols , src . rows } ; <nl> + <nl> + CV_SUPPRESS_DEPRECATED_START <nl> + <nl> + ippiDCTInitAlloc ippInitAlloc = inv ? ( ippiDCTInitAlloc ) ippiDCTInvInitAlloc_32f : ( ippiDCTInitAlloc ) ippiDCTFwdInitAlloc_32f ; <nl> + ippiDCTFree ippFree = inv ? ( ippiDCTFree ) ippiDCTInvFree_32f : ( ippiDCTFree ) ippiDCTFwdFree_32f ; <nl> + ippiDCTGetBufSize ippGetBufSize = inv ? ( ippiDCTGetBufSize ) ippiDCTInvGetBufSize_32f : ( ippiDCTGetBufSize ) ippiDCTFwdGetBufSize_32f ; <nl> + <nl> + status = ippStsErr ; <nl> + <nl> + if ( ippInitAlloc ( & pDCTSpec , srcRoiSize , ippAlgHintNone ) > = 0 & & ippGetBufSize ( pDCTSpec , & bufSize ) > = 0 ) <nl> + { <nl> + buf . allocate ( bufSize ) ; <nl> + pBuffer = ( uchar * ) buf ; <nl> + <nl> + status = ippFunc ( ( float * ) src . data , ( int ) src . step , ( float * ) dst . data , ( int ) dst . step , pDCTSpec , ( Ipp8u * ) pBuffer ) ; <nl> + } <nl> + <nl> + if ( pDCTSpec ) <nl> + ippFree ( pDCTSpec ) ; <nl> + <nl> + CV_SUPPRESS_DEPRECATED_END <nl> + <nl> + return status > = 0 ; <nl> + } <nl> + } <nl> + <nl> + # endif <nl> + } <nl> + <nl> void cv : : dct ( InputArray _src0 , OutputArray _dst , int flags ) <nl> { <nl> static DCTFunc dct_tbl [ 4 ] = <nl> void cv : : dct ( InputArray _src0 , OutputArray _dst , int flags ) <nl> bool inv = ( flags & DCT_INVERSE ) ! = 0 ; <nl> Mat src0 = _src0 . getMat ( ) , src = src0 ; <nl> int type = src . type ( ) , depth = src . depth ( ) ; <nl> - void / * * spec_dft = 0 , * / * spec = 0 ; <nl> + void * spec = 0 ; <nl> <nl> double scale = 1 . ; <nl> int prev_len = 0 , nf = 0 , stage , end_stage ; <nl> void cv : : dct ( InputArray _src0 , OutputArray _dst , int flags ) <nl> _dst . create ( src . rows , src . cols , type ) ; <nl> Mat dst = _dst . getMat ( ) ; <nl> <nl> + # if defined ( HAVE_IPP ) & & ( IPP_VERSION_MAJOR > = 7 ) & & ! defined HAVE_IPP_ICV_ONLY <nl> + bool row = ( flags & DCT_ROWS ) ! = 0 ; <nl> + if ( src . type ( ) = = CV_32F ) <nl> + { <nl> + if ( ippi_DCT_32f ( src , dst , inv , row ) ) <nl> + return ; <nl> + setIppErrorStatus ( ) ; <nl> + } <nl> + # endif <nl> + <nl> DCTFunc dct_func = dct_tbl [ ( int ) inv + ( depth = = CV_64F ) * 2 ] ; <nl> <nl> if ( ( flags & DCT_ROWS ) | | src . rows = = 1 | | <nl> void cv : : dct ( InputArray _src0 , OutputArray _dst , int flags ) <nl> <nl> spec = 0 ; <nl> inplace_transform = 1 ; <nl> - / * if ( len * count > = 64 & & DFTInitAlloc_R_32f_p ) <nl> - { <nl> - int ipp_sz = 0 ; <nl> - if ( depth = = CV_32F ) <nl> - { <nl> - if ( spec_dft ) <nl> - IPPI_CALL ( DFTFree_R_32f_p ( spec_dft ) ) ; <nl> - IPPI_CALL ( DFTInitAlloc_R_32f_p ( & spec_dft , len , 8 , cvAlgHintNone ) ) ; <nl> - IPPI_CALL ( DFTGetBufSize_R_32f_p ( spec_dft , & ipp_sz ) ) ; <nl> - } <nl> - else <nl> - { <nl> - if ( spec_dft ) <nl> - IPPI_CALL ( DFTFree_R_64f_p ( spec_dft ) ) ; <nl> - IPPI_CALL ( DFTInitAlloc_R_64f_p ( & spec_dft , len , 8 , cvAlgHintNone ) ) ; <nl> - IPPI_CALL ( DFTGetBufSize_R_64f_p ( spec_dft , & ipp_sz ) ) ; <nl> - } <nl> - spec = spec_dft ; <nl> - sz + = ipp_sz ; <nl> - } <nl> - else * / <nl> { <nl> sz + = len * ( complex_elem_size + sizeof ( int ) ) + complex_elem_size ; <nl> <nl> mmm a / modules / imgproc / src / distransform . cpp <nl> ppp b / modules / imgproc / src / distransform . cpp <nl> trueDistTrans ( const Mat & src , Mat & dst ) <nl> for ( ; i < = m * 3 ; i + + ) <nl> sat_tab [ i ] = i - shift ; <nl> <nl> - cv : : parallel_for_ ( cv : : Range ( 0 , n ) , cv : : DTColumnInvoker ( & src , & dst , sat_tab , sqr_tab ) ) ; <nl> + cv : : parallel_for_ ( cv : : Range ( 0 , n ) , cv : : DTColumnInvoker ( & src , & dst , sat_tab , sqr_tab ) , src . total ( ) / ( double ) ( 1 < < 16 ) ) ; <nl> <nl> / / stage 2 : compute modified distance transform for each row <nl> float * inv_tab = sqr_tab + n ; <nl>
Merge pull request from ElenaGvozdeva : ippiDCT
opencv/opencv
0e1bf581953a5be91c133d170324221599d1424f
2014-05-07T10:49:13Z
mmm a / libraries / chain / chain_controller . cpp <nl> ppp b / libraries / chain / chain_controller . cpp <nl> bool chain_controller : : _push_block ( const signed_block & new_block ) <nl> for ( const auto & cycle : new_block . cycles ) <nl> for ( const auto & thread : cycle ) <nl> trxcount + = thread . user_input . size ( ) ; <nl> - ilog ( " producer = [ $ { prod } ] , blocktime = $ { bktm } , blocknum = $ { bknu } , trxcount = $ { txco } , pendingcount = $ { pend } , exectime_ms = $ { extm } " , <nl> - ( " prod " , new_block . producer ) <nl> - ( " bktm " , new_block . timestamp ) <nl> - ( " bknu " , new_block . block_num ( ) ) <nl> - ( " txco " , trxcount ) <nl> - ( " pend " , _pending_transactions . size ( ) ) <nl> + ilog ( " $ { producer } # $ { num } @ $ { time } | $ { trxcount } trx , $ { pending } pending , exectime_ms = $ { extm } " , <nl> + ( " producer " , new_block . producer ) <nl> + ( " time " , new_block . timestamp ) <nl> + ( " num " , new_block . block_num ( ) ) <nl> + ( " trxcount " , trxcount ) <nl> + ( " pending " , _pending_transactions . size ( ) ) <nl> ( " extm " , exec_ms . count ( ) ) <nl> ) ; <nl> } <nl> ProcessedTransaction chain_controller : : _push_transaction ( const SignedTransaction <nl> temp_session . squash ( ) ; <nl> <nl> / / notify anyone listening to pending transactions <nl> - on_pending_transaction ( trx ) ; / / / TODO move this to apply . . . <nl> + on_pending_transaction ( trx ) ; / / / TODO move this to apply . . . ? ? ? why . . . <nl> <nl> return pt ; <nl> } <nl> void chain_controller : : _apply_block ( const signed_block & next_block ) <nl> <nl> void chain_controller : : check_transaction_authorization ( const SignedTransaction & trx , bool allow_unused_signatures ) const { <nl> if ( ( _skip_flags & skip_transaction_signatures ) & & ( _skip_flags & skip_authority_check ) ) { <nl> - ilog ( " Skipping auth and sigs checks " ) ; <nl> + / / ilog ( " Skipping auth and sigs checks " ) ; <nl> return ; <nl> } <nl> <nl> void chain_controller : : replay ( ) { <nl> <nl> const auto last_block_num = last_block - > block_num ( ) ; <nl> <nl> - ilog ( " Replaying blocks . . . " ) ; <nl> + ilog ( " Replaying $ { n } blocks . . . " , ( " n " , last_block_num ) ) ; <nl> for ( uint32_t i = 1 ; i < = last_block_num ; + + i ) { <nl> if ( i % 5000 = = 0 ) <nl> std : : cerr < < " " < < double ( i * 100 ) / last_block_num < < " % " < < i < < " of " < < last_block_num < < " \ n " ; <nl> mmm a / plugins / chain_plugin / chain_plugin . cpp <nl> ppp b / plugins / chain_plugin / chain_plugin . cpp <nl> bool chain_plugin : : accept_block ( const chain : : signed_block & block , bool currently <nl> ( " p " , block . producer ) ) ; <nl> } <nl> <nl> - return chain ( ) . push_block ( block ) ; <nl> + return chain ( ) . push_block ( block , my - > skip_flags ) ; <nl> } <nl> <nl> void chain_plugin : : accept_transaction ( const chain : : SignedTransaction & trx ) { <nl> mmm a / plugins / net_plugin / include / eos / net_plugin / protocol . hpp <nl> ppp b / plugins / net_plugin / include / eos / net_plugin / protocol . hpp <nl> namespace eos { <nl> uint32_t end_block ; <nl> } ; <nl> <nl> - struct peer_message { <nl> - vector < fc : : sha256 > peers ; <nl> - } ; <nl> - <nl> using net_message = static_variant < handshake_message , <nl> - peer_message , <nl> notice_message , <nl> request_message , <nl> sync_request_message , <nl> FC_REFLECT ( eos : : block_summary_message , ( block ) ( trx_ids ) ) <nl> FC_REFLECT ( eos : : notice_message , ( known_trx ) ( known_blocks ) ) <nl> FC_REFLECT ( eos : : request_message , ( req_trx ) ( req_blocks ) ) <nl> FC_REFLECT ( eos : : sync_request_message , ( start_block ) ( end_block ) ) <nl> - FC_REFLECT ( eos : : peer_message , ( peers ) ) <nl> <nl> / * * <nl> * <nl> mmm a / plugins / net_plugin / net_plugin . cpp <nl> ppp b / plugins / net_plugin / net_plugin . cpp <nl> namespace eos { <nl> return fc : : ip : : endpoint ( addr , ep . port ( ) ) ; <nl> } <nl> <nl> - void send_peer_message ( ) { <nl> - peer_message pm ; <nl> - for ( auto & c : connections ) { <nl> - if ( ( c - > remote_node_id . _hash [ 0 ] | c - > remote_node_id . _hash [ 1 ] | c - > remote_node_id . _hash [ 2 ] | c - > remote_node_id . _hash [ 0 ] ) = = 0 ) { <nl> - return ; <nl> - } <nl> - pm . peers . push_back ( c - > remote_node_id ) ; <nl> - } <nl> - if ( ! pm . peers . empty ( ) ) { <nl> - for ( auto & c : connections ) { <nl> - if ( c - > out_sync_state . size ( ) = = 0 ) { <nl> - c - > send ( pm ) ; <nl> - } <nl> - } <nl> - } <nl> - } <nl> - <nl> / / template < typename T > <nl> void send_all ( const SignedTransaction & msg ) { <nl> for ( auto & c : connections ) { <nl> namespace eos { <nl> } <nl> <nl> c - > remote_node_id = msg . node_id ; <nl> - send_peer_message ( ) ; <nl> } <nl> c - > last_handshake = msg ; <nl> } <nl> <nl> - void handle_message ( connection_ptr c , const peer_message & msg ) { <nl> - dlog ( " got a peer message with $ { pc } from $ { r } " , ( " pc " , msg . peers . size ( ) ) ( " r " , c - > last_handshake . p2p_address ) ) ; <nl> - c - > shared_peers . clear ( ) ; <nl> - for ( auto pnode : msg . peers ) { <nl> - if ( pnode = = node_id ) { <nl> - dlog ( " skipping self peernode " ) ; <nl> - continue ; <nl> - } <nl> - if ( pnode = = c - > remote_node_id ) { <nl> - dlog ( " skipping received connection ' s node " ) ; <nl> - continue ; <nl> - } <nl> - for ( auto & conn : connections ) { <nl> - if ( conn - > remote_node_id = = pnode ) { <nl> - c - > mutual_peers . insert ( conn ) ; <nl> - break ; <nl> - } <nl> - } <nl> - c - > shared_peers . insert ( pnode ) ; <nl> - } <nl> - } <nl> - <nl> void handle_message ( connection_ptr c , const notice_message & msg ) { <nl> dlog ( " got a notice message " ) ; <nl> notice_message fwd ; <nl> namespace eos { <nl> node_transaction_state nts = { msg . id ( ) , time_point : : now ( ) , msg . expiration , <nl> msg , bn , true } ; <nl> local_txns . insert ( nts ) ; <nl> - forward ( c , msg ) ; <nl> + forward ( c , msg ) ; <nl> } <nl> } <nl> <nl> namespace eos { <nl> chain_controller & cc = chain_plug - > chain ( ) ; <nl> <nl> if ( cc . is_known_block ( msg . id ( ) ) ) { <nl> - / / dlog ( " block id $ { id } is known " , ( " id " , msg . id ( ) ) ) ; <nl> + dlog ( " block id $ { id } is known " , ( " id " , msg . id ( ) ) ) ; <nl> return ; <nl> } <nl> uint32_t num = 0 ; <nl> <nl> - for ( auto ss = c - > in_sync_state . begin ( ) ; ss ! = c - > in_sync_state . end ( ) ; ) { <nl> + for ( auto ss = c - > in_sync_state . begin ( ) ; ss ! = c - > in_sync_state . end ( ) ; + + ss ) { <nl> if ( msg . block_num ( ) = = ss - > last + 1 & & msg . block_num ( ) < = ss - > end_block ) { <nl> num = msg . block_num ( ) ; <nl> ss . get_node ( ) - > value ( ) . last = num ; <nl> namespace eos { <nl> my - > acceptor - > set_option ( tcp : : acceptor : : reuse_address ( true ) ) ; <nl> my - > acceptor - > bind ( my - > listen_endpoint ) ; <nl> my - > acceptor - > listen ( ) ; <nl> - my - > chain_plug - > chain ( ) . on_pending_transaction . connect ( & net_plugin_impl : : pending_txn ) ; <nl> + my - > chain_plug - > chain ( ) . on_pending_transaction . connect ( & net_plugin_impl : : pending_txn ) ; <nl> <nl> my - > start_listen_loop ( ) ; <nl> } <nl> mmm a / programs / eosc / main . cpp <nl> ppp b / programs / eosc / main . cpp <nl> void create_account ( Name creator , Name newaccount , public_key_type owner , public <nl> int main ( int argc , char * * argv ) { <nl> CLI : : App app { " Command Line Interface to Eos Daemon " } ; <nl> app . require_subcommand ( ) ; <nl> + app . add_option ( " - p , - - port " , port , " the port where eosd is running " , true ) ; <nl> <nl> / / Create subcommand <nl> auto create = app . add_subcommand ( " create " , " Create various items , on and off the blockchain " , false ) ; <nl> mmm a / testnet . md <nl> ppp b / testnet . md <nl> <nl> [ toc ] <nl> <nl> - # EOS Testnet <nl> + # EOS Testnet <nl> To date , all work done to experiment with the EOS blockchain has been performed using a single instance of eosd hosting all 21 block producers . While this is a perfectly valid solution for validating features of the blockchain , developing new contracts , or whatever , it does not scale . Nor does it expose the sort of issues raised when contract and block data must be shared across multiple instances . Providing the ability to scale involves deploying multiple eosd nodes across many hosts and lining then into a peer - to - peer ( p2p ) network . Composing this network involves tailoring and distributing configuration files , coordinating starts and stops and other tasks . <nl> <nl> Doing this manually is a tedious task and easily error prone . Fortunately a solution is provided , in the form of the Launcher application , described below . <nl> Network topology or " shape " describes how the nodes are connected in order to sh <nl> <nl> The Launcher has definitions of three different network " shapes " based on inter - nodal connections , which can be selected by a command line option , or you can supply your own network topology by editing the Launcher generated configuration file . <nl> <nl> - # # # # Ring network <nl> + # # # # Ring network <nl> This is the simplest network , where each node identifies just the node next to it as it ' s only peer . <nl> <nl> - # # # # Star network <nl> + # # # # Star network <nl> A " star " is intended to support the use larger number nodes in the testnet . In this case the number of peers connected to a node and the distribution of those nodes varies based on the number of nodes in the network . <nl> <nl> - # # # # Mesh network <nl> + # # # # Mesh network <nl> In a " mesh " network , each node is connected to as many peer nodes as possible . <nl> <nl> - # The Launcher Application <nl> + # The Launcher Application <nl> To address the complexity implied by distributing multiple eosd nodes across a LAN or a wider network , the launcher application was created . <nl> <nl> Based on a handful of command line arguments the Launcher is able to compose per - node configuration files , distribute these files securely amongst the peer hosts , then start up the multiple instances of eosd . <nl> <nl> Eosd instances started this way have their output logged in individual text files . Finally the launcher application is also able to shut down some or all of the test network . <nl> <nl> - # # Running the Launcher application <nl> + # # Running the Launcher application <nl> <nl> The launcher program is used to configure and deploy producing and non - producing eosd nodes that talk to each other using configured routes . The configuration for each node is stored in separate directories , permitting multiple nodes to be active on the same host , assuming the machine has sufficient memory and disk space for multiple eosd instances . The launcher makes use of multiple configuration sources in order to deploy a testnet . A handful of command line arguments can be used to set up simple local networks . <nl> <nl> The ssh helper fields are paths to ssh and scp , an identity if necessary , and an <nl> <nl> The rest of the testnet . json file is the collection of node descriptors . The fragment shown above was created with the command line ` programs / launcher / launcher - p6 - s mesh - o testnet . json ` and then edited to refer to a remote host named " remoteserv . " <nl> <nl> - # # # Elements Of The JSON File <nl> + # # # Elements Of The JSON File <nl> This table describes all of the key / value pairs used in the testnet . json file . <nl> <nl> | Value | Description <nl>
Merge pull request from EOSIO / networkfixes
EOSIO/eos
190ea1eed16c2bf228dafb5ef1d83180a6508842
2017-09-01T15:44:00Z
mmm a / src / base / division - by - constant . cc <nl> ppp b / src / base / division - by - constant . cc <nl> MagicNumbersForDivision < T > SignedDivisionByConstant ( T d ) { <nl> delta = ad - r2 ; <nl> } while ( q1 < delta | | ( q1 = = delta & & r1 = = 0 ) ) ; <nl> T mul = q2 + 1 ; <nl> - return { neg ? ( 0 - mul ) : mul , p - bits , false } ; <nl> + return MagicNumbersForDivision < T > ( neg ? ( 0 - mul ) : mul , p - bits , false ) ; <nl> } <nl> <nl> <nl> MagicNumbersForDivision < T > UnsignedDivisionByConstant ( T d , <nl> } <nl> delta = d - 1 - r2 ; <nl> } while ( p < bits * 2 & & ( q1 < delta | | ( q1 = = delta & & r1 = = 0 ) ) ) ; <nl> - return { q2 + 1 , p - bits , a } ; <nl> + return MagicNumbersForDivision < T > ( q2 + 1 , p - bits , a ) ; <nl> } <nl> <nl> <nl>
Fixed compilation with older clang versions .
v8/v8
ac1224eafd8a6149f0f9f459d8778a44640572f4
2014-10-07T09:04:39Z
mmm a / tools / shared . py <nl> ppp b / tools / shared . py <nl> def line_splitter ( data ) : <nl> <nl> return out <nl> <nl> - def limit_size ( string , MAX = 80 * 20 ) : <nl> + def limit_size ( string , MAX = 120 * 20 ) : <nl> if len ( string ) < MAX : return string <nl> return string [ 0 : MAX / 2 ] + ' \ n [ . . ] \ n ' + string [ - MAX / 2 : ] <nl> <nl>
increase logging output , fixes s_0_0 . test_safe_heap
emscripten-core/emscripten
73153d7146aa1ee2493f42de55ddc2888d69873e
2013-08-05T21:00:39Z
mmm a / configure <nl> ppp b / configure <nl> test - x / | | exit 1 " <nl> as_suggested = " as_lineno_1 = " ; as_suggested = $ as_suggested $ LINENO ; as_suggested = $ as_suggested " as_lineno_1a = \ $ LINENO <nl> as_lineno_2 = " ; as_suggested = $ as_suggested $ LINENO ; as_suggested = $ as_suggested " as_lineno_2a = \ $ LINENO <nl> eval ' test \ " x \ $ as_lineno_1 ' \ $ as_run ' \ " ! = \ " x \ $ as_lineno_2 ' \ $ as_run ' \ " & & <nl> - test \ " x \ ` expr \ $ as_lineno_1 ' \ $ as_run ' + 1 \ ` \ " = \ " x \ $ as_lineno_2 ' \ $ as_run ' \ " ' | | exit 1 " <nl> + test \ " x \ ` expr \ $ as_lineno_1 ' \ $ as_run ' + 1 \ ` \ " = \ " x \ $ as_lineno_2 ' \ $ as_run ' \ " ' | | exit 1 <nl> + test \ $ ( ( 1 + 1 ) ) = 2 | | exit 1 " <nl> if ( eval " $ as_required " ) 2 > / dev / null ; then : <nl> as_have_required = yes <nl> else <nl> build_os <nl> build_vendor <nl> build_cpu <nl> build <nl> + SED <nl> ac_ct_CXX <nl> CXXFLAGS <nl> CXX <nl> ac_compile = ' $ CC - c $ CFLAGS $ CPPFLAGS conftest . $ ac_ext > & 5 ' <nl> ac_link = ' $ CC - o conftest $ ac_exeext $ CFLAGS $ CPPFLAGS $ LDFLAGS conftest . $ ac_ext $ LIBS > & 5 ' <nl> ac_compiler_gnu = $ ac_cv_c_compiler_gnu <nl> <nl> + { $ as_echo " $ as_me : $ { as_lineno - $ LINENO } : checking for a sed that does not truncate output " > & 5 <nl> + $ as_echo_n " checking for a sed that does not truncate output . . . " > & 6 ; } <nl> + if $ { ac_cv_path_SED + : } false ; then : <nl> + $ as_echo_n " ( cached ) " > & 6 <nl> + else <nl> + ac_script = s / aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa / bbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb / <nl> + for ac_i in 1 2 3 4 5 6 7 ; do <nl> + ac_script = " $ ac_script $ as_nl $ ac_script " <nl> + done <nl> + echo " $ ac_script " 2 > / dev / null | sed 99q > conftest . sed <nl> + { ac_script = ; unset ac_script ; } <nl> + if test - z " $ SED " ; then <nl> + ac_path_SED_found = false <nl> + # Loop through the user ' s path and test for each of PROGNAME - LIST <nl> + as_save_IFS = $ IFS ; IFS = $ PATH_SEPARATOR <nl> + for as_dir in $ PATH <nl> + do <nl> + IFS = $ as_save_IFS <nl> + test - z " $ as_dir " & & as_dir = . <nl> + for ac_prog in sed gsed ; do <nl> + for ac_exec_ext in ' ' $ ac_executable_extensions ; do <nl> + ac_path_SED = " $ as_dir / $ ac_prog $ ac_exec_ext " <nl> + as_fn_executable_p " $ ac_path_SED " | | continue <nl> + # Check for GNU ac_path_SED and select it if it is found . <nl> + # Check for GNU $ ac_path_SED <nl> + case ` " $ ac_path_SED " - - version 2 > & 1 ` in <nl> + * GNU * ) <nl> + ac_cv_path_SED = " $ ac_path_SED " ac_path_SED_found = : ; ; <nl> + * ) <nl> + ac_count = 0 <nl> + $ as_echo_n 0123456789 > " conftest . in " <nl> + while : <nl> + do <nl> + cat " conftest . in " " conftest . in " > " conftest . tmp " <nl> + mv " conftest . tmp " " conftest . in " <nl> + cp " conftest . in " " conftest . nl " <nl> + $ as_echo ' ' > > " conftest . nl " <nl> + " $ ac_path_SED " - f conftest . sed < " conftest . nl " > " conftest . out " 2 > / dev / null | | break <nl> + diff " conftest . out " " conftest . nl " > / dev / null 2 > & 1 | | break <nl> + as_fn_arith $ ac_count + 1 & & ac_count = $ as_val <nl> + if test $ ac_count - gt $ { ac_path_SED_max - 0 } ; then <nl> + # Best one so far , save it but keep looking for a better one <nl> + ac_cv_path_SED = " $ ac_path_SED " <nl> + ac_path_SED_max = $ ac_count <nl> + fi <nl> + # 10 * ( 2 ^ 10 ) chars as input seems more than enough <nl> + test $ ac_count - gt 10 & & break <nl> + done <nl> + rm - f conftest . in conftest . tmp conftest . nl conftest . out ; ; <nl> + esac <nl> + <nl> + $ ac_path_SED_found & & break 3 <nl> + done <nl> + done <nl> + done <nl> + IFS = $ as_save_IFS <nl> + if test - z " $ ac_cv_path_SED " ; then <nl> + as_fn_error $ ? " no acceptable sed could be found in \ $ PATH " " $ LINENO " 5 <nl> + fi <nl> + else <nl> + ac_cv_path_SED = $ SED <nl> + fi <nl> + <nl> + fi <nl> + { $ as_echo " $ as_me : $ { as_lineno - $ LINENO } : result : $ ac_cv_path_SED " > & 5 <nl> + $ as_echo " $ ac_cv_path_SED " > & 6 ; } <nl> + SED = " $ ac_cv_path_SED " <nl> + rm - f conftest . sed <nl> + <nl> ac_ext = cpp <nl> ac_cpp = ' $ CXXCPP $ CPPFLAGS ' <nl> ac_compile = ' $ CXX - c $ CXXFLAGS $ CPPFLAGS conftest . $ ac_ext > & 5 ' <nl> extract ( ) { <nl> fi <nl> <nl> # Convert " - " to " \ n " if not between quotes <nl> - string = $ ( echo " $ * " | sed - e ' s : - : \ n : g ' - e ' s : " \ ( . * \ ) \ n \ ( . * \ ) " : \ " \ 1 - \ 2 " : g ' - e " s : ' \ ( . * \ ) \ n \ ( . * \ ) ' : \ ' \ 1 - \ 2 ' : g " ) <nl> + string = $ ( echo " $ * " | $ SED - e ' s : - : \ n : g ' - e ' s : " \ ( . * \ ) \ n \ ( . * \ ) " : \ " \ 1 - \ 2 " : g ' - e " s : ' \ ( . * \ ) \ n \ ( . * \ ) ' : \ ' \ 1 - \ 2 ' : g " ) <nl> SAVEIFS = $ IFS <nl> IFS = $ ( printf " \ n \ b " ) <nl> for i in $ string ; do <nl> mmm a / configure . ac <nl> ppp b / configure . ac <nl> AC_CONFIG_AUX_DIR ( [ build - aux ] ) <nl> AC_CONFIG_MACRO_DIR ( [ m4 ] ) <nl> AC_PROG_CC <nl> AC_PROG_CXX <nl> + AC_PROG_SED <nl> AC_LANG ( C + + ) <nl> AC_CANONICAL_HOST <nl> AM_INIT_AUTOMAKE <nl> extract ( ) { <nl> fi <nl> <nl> # Convert " - " to " \ n " if not between quotes <nl> - string = $ ( echo " $ * " | sed - e ' s : - : \ n : g ' - e ' s : " \ ( . * \ ) \ n \ ( . * \ ) " : \ " \ 1 - \ 2 " : g ' - e " s : ' \ ( . * \ ) \ n \ ( . * \ ) ' : \ ' \ 1 - \ 2 ' : g " ) <nl> + string = $ ( echo " $ * " | $ SED - e ' s : - : \ n : g ' - e ' s : " \ ( . * \ ) \ n \ ( . * \ ) " : \ " \ 1 - \ 2 " : g ' - e " s : ' \ ( . * \ ) \ n \ ( . * \ ) ' : \ ' \ 1 - \ 2 ' : g " ) <nl> SAVEIFS = $ IFS <nl> IFS = $ ( printf " \ n \ b " ) <nl> for i in $ string ; do <nl>
Make configure search for sed .
qbittorrent/qBittorrent
112dd203959ff44433d2e70ac7055fd678fbd79a
2014-11-23T17:59:27Z