This should speedup regedit tests from ~60s to ~4s.
-- v2: regedit.exe: Add a direct import for shcore. regedit.exe: Call InitCommonControls after command-line has been processed. shcore: Use delay import for user32 and ole32. makedep: Link with imported libs before delay imported libs. makedep: Link default imports separately from direct imports. makedep: Add an import type parameter to add_import_libs.
From: Rémi Bernon rbernon@codeweavers.com
--- tools/makedep.c | 19 ++++++++++++------- 1 file changed, 12 insertions(+), 7 deletions(-)
diff --git a/tools/makedep.c b/tools/makedep.c index 69b4a4c660b..7045dab9541 100644 --- a/tools/makedep.c +++ b/tools/makedep.c @@ -2176,12 +2176,17 @@ static struct strarray add_default_imports( const struct makefile *make, struct return ret; }
+enum import_type +{ + IMPORT_TYPE_DIRECT, + IMPORT_TYPE_DELAYED, +};
/******************************************************************* * add_import_libs */ static struct strarray add_import_libs( const struct makefile *make, struct strarray *deps, - struct strarray imports, int delay, int is_cross ) + struct strarray imports, enum import_type type, int is_cross ) { struct strarray ret = empty_strarray; unsigned int i, j; @@ -2215,7 +2220,7 @@ static struct strarray add_import_libs( const struct makefile *make, struct stra { const char *ext = NULL;
- if (delay && !delay_load_flag && (is_cross || !*dll_ext)) ext = ".delay.a"; + if (type == IMPORT_TYPE_DELAYED && !delay_load_flag && (is_cross || !*dll_ext)) ext = ".delay.a"; else if (is_cross) ext = ".cross.a"; if (ext) lib = replace_extension( lib, ".a", ext ); strarray_add_uniq( deps, lib ); @@ -2967,7 +2972,7 @@ static void output_source_spec( struct makefile *make, struct incl_file *source, if (!dll_flags.count) dll_flags = make->extradllflags; if (!strarray_exists( &dll_flags, "-nodefaultlibs" )) imports = add_default_imports( make, imports );
- all_libs = add_import_libs( make, &dep_libs, imports, 0, make->is_cross ); + all_libs = add_import_libs( make, &dep_libs, imports, IMPORT_TYPE_DIRECT, make->is_cross ); dll_name = strmake( "%s.dll%s", obj, make->is_cross ? "" : dll_ext ); obj_name = strmake( "%s%s", obj_dir_path( make, obj ), make->is_cross ? ".cross.o" : ".o" ); output_file = obj_dir_path( make, dll_name ); @@ -3166,8 +3171,8 @@ static void output_module( struct makefile *make ) if (!strarray_exists( &make->extradllflags, "-nodefaultlibs" )) imports = add_default_imports( make, imports );
- strarray_addall( &all_libs, add_import_libs( make, &dep_libs, make->delayimports, 1, make->is_cross )); - strarray_addall( &all_libs, add_import_libs( make, &dep_libs, imports, 0, make->is_cross )); + strarray_addall( &all_libs, add_import_libs( make, &dep_libs, make->delayimports, IMPORT_TYPE_DELAYED, make->is_cross )); + strarray_addall( &all_libs, add_import_libs( make, &dep_libs, imports, IMPORT_TYPE_DIRECT, make->is_cross ));
if (!make->use_msvcrt) { @@ -3331,7 +3336,7 @@ static void output_unix_lib( struct makefile *make ) strarray_add( &unix_imports, "winecrt0" ); if (spec_file) strarray_add( &unix_deps, spec_file );
- strarray_addall( &unix_libs, add_import_libs( make, &unix_deps, unix_imports, 0, 0 )); + strarray_addall( &unix_libs, add_import_libs( make, &unix_deps, unix_imports, IMPORT_TYPE_DIRECT, 0 )); strarray_addall( &unix_libs, get_expanded_make_var_array( make, "UNIX_LIBS" )); strarray_addall( &unix_libs, libs ); } @@ -3455,7 +3460,7 @@ static void output_test_module( struct makefile *make ) char *testres = replace_extension( make->testdll, ".dll", "_test.res" ); struct strarray dep_libs = empty_strarray; struct strarray all_libs = add_import_libs( make, &dep_libs, add_default_imports( make, make->imports ), - 0, make->is_cross ); + IMPORT_TYPE_DIRECT, make->is_cross ); struct makefile *parent = get_parent_makefile( make ); const char *ext = make->is_cross ? "" : dll_ext; const char *debug_file;
From: Rémi Bernon rbernon@codeweavers.com
--- tools/makedep.c | 36 ++++++++++++++++++++++-------------- 1 file changed, 22 insertions(+), 14 deletions(-)
diff --git a/tools/makedep.c b/tools/makedep.c index 7045dab9541..527cbd3c058 100644 --- a/tools/makedep.c +++ b/tools/makedep.c @@ -2151,19 +2151,17 @@ static const char *get_crt_define( const struct makefile *make )
/******************************************************************* - * add_default_imports + * get_default_imports */ -static struct strarray add_default_imports( const struct makefile *make, struct strarray imports ) +static struct strarray get_default_imports( const struct makefile *make, struct strarray imports ) { struct strarray ret = empty_strarray; const char *crt_dll = get_default_crt( make ); unsigned int i;
for (i = 0; i < imports.count; i++) - { - if (is_crt_module( imports.str[i] )) crt_dll = imports.str[i]; - else strarray_add( &ret, imports.str[i] ); - } + if (is_crt_module( imports.str[i] )) + crt_dll = imports.str[i];
strarray_add( &ret, "winecrt0" ); if (crt_dll) strarray_add( &ret, crt_dll ); @@ -2180,6 +2178,7 @@ enum import_type { IMPORT_TYPE_DIRECT, IMPORT_TYPE_DELAYED, + IMPORT_TYPE_DEFAULT, };
/******************************************************************* @@ -2196,6 +2195,9 @@ static struct strarray add_import_libs( const struct makefile *make, struct stra const char *name = imports.str[i]; const char *lib = NULL;
+ /* add crt import lib only when adding the default imports libs */ + if (is_crt_module( imports.str[i] ) && type != IMPORT_TYPE_DEFAULT) continue; + if (name[0] == '-') { switch (name[1]) @@ -2964,15 +2966,18 @@ static void output_source_spec( struct makefile *make, struct incl_file *source, { struct strarray imports = get_expanded_file_local_var( make, obj, "IMPORTS" ); struct strarray dll_flags = get_expanded_file_local_var( make, obj, "EXTRADLLFLAGS" ); - struct strarray all_libs, dep_libs = empty_strarray; + struct strarray all_libs = empty_strarray, dep_libs = empty_strarray; + struct strarray default_imports = empty_strarray; char *dll_name, *obj_name, *output_file; const char *debug_file;
if (!imports.count) imports = make->imports; if (!dll_flags.count) dll_flags = make->extradllflags; - if (!strarray_exists( &dll_flags, "-nodefaultlibs" )) imports = add_default_imports( make, imports ); + if (!strarray_exists( &dll_flags, "-nodefaultlibs" )) default_imports = get_default_imports( make, imports ); + + strarray_addall( &all_libs, add_import_libs( make, &dep_libs, imports, IMPORT_TYPE_DIRECT, make->is_cross ) ); + strarray_addall( &all_libs, add_import_libs( make, &dep_libs, default_imports, IMPORT_TYPE_DEFAULT, make->is_cross ) );
- all_libs = add_import_libs( make, &dep_libs, imports, IMPORT_TYPE_DIRECT, make->is_cross ); dll_name = strmake( "%s.dll%s", obj, make->is_cross ? "" : dll_ext ); obj_name = strmake( "%s%s", obj_dir_path( make, obj ), make->is_cross ? ".cross.o" : ".o" ); output_file = obj_dir_path( make, dll_name ); @@ -3152,6 +3157,7 @@ static char *get_unix_lib_name( struct makefile *make ) */ static void output_module( struct makefile *make ) { + struct strarray default_imports = empty_strarray; struct strarray all_libs = empty_strarray; struct strarray dep_libs = empty_strarray; struct strarray imports = make->imports; @@ -3168,11 +3174,11 @@ static void output_module( struct makefile *make ) if (*dll_ext && !make->is_cross && !make->data_only) module_name = strmake( "%s%s", make->module, dll_ext );
- if (!strarray_exists( &make->extradllflags, "-nodefaultlibs" )) - imports = add_default_imports( make, imports ); + if (!strarray_exists( &make->extradllflags, "-nodefaultlibs" )) default_imports = get_default_imports( make, imports );
strarray_addall( &all_libs, add_import_libs( make, &dep_libs, make->delayimports, IMPORT_TYPE_DELAYED, make->is_cross )); strarray_addall( &all_libs, add_import_libs( make, &dep_libs, imports, IMPORT_TYPE_DIRECT, make->is_cross )); + strarray_addall( &all_libs, add_import_libs( make, &dep_libs, default_imports, IMPORT_TYPE_DEFAULT, make->is_cross ) );
if (!make->use_msvcrt) { @@ -3458,14 +3464,16 @@ static void output_test_module( struct makefile *make ) char *testmodule = replace_extension( make->testdll, ".dll", "_test.exe" ); char *stripped = replace_extension( make->testdll, ".dll", "_test-stripped.exe" ); char *testres = replace_extension( make->testdll, ".dll", "_test.res" ); - struct strarray dep_libs = empty_strarray; - struct strarray all_libs = add_import_libs( make, &dep_libs, add_default_imports( make, make->imports ), - IMPORT_TYPE_DIRECT, make->is_cross ); + struct strarray default_imports = get_default_imports( make, make->imports ); + struct strarray dep_libs = empty_strarray, all_libs = empty_strarray; struct makefile *parent = get_parent_makefile( make ); const char *ext = make->is_cross ? "" : dll_ext; const char *debug_file; char *output_file;
+ strarray_addall( &all_libs, add_import_libs( make, &dep_libs, make->imports, IMPORT_TYPE_DIRECT, make->is_cross ) ); + strarray_addall( &all_libs, add_import_libs( make, &dep_libs, default_imports, IMPORT_TYPE_DEFAULT, make->is_cross ) ); + strarray_add( &make->all_targets, strmake( "%s%s", testmodule, ext )); strarray_add( &make->clean_files, strmake( "%s%s", stripped, ext )); output_file = strmake( "%s%s", obj_dir_path( make, testmodule ), ext );
From: Rémi Bernon rbernon@codeweavers.com
In order to favor direct imports over delayed imports, for instance when the delay imported module forwards symbols from the imported module. --- tools/makedep.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/tools/makedep.c b/tools/makedep.c index 527cbd3c058..d7e045bdd6e 100644 --- a/tools/makedep.c +++ b/tools/makedep.c @@ -3176,8 +3176,8 @@ static void output_module( struct makefile *make )
if (!strarray_exists( &make->extradllflags, "-nodefaultlibs" )) default_imports = get_default_imports( make, imports );
- strarray_addall( &all_libs, add_import_libs( make, &dep_libs, make->delayimports, IMPORT_TYPE_DELAYED, make->is_cross )); strarray_addall( &all_libs, add_import_libs( make, &dep_libs, imports, IMPORT_TYPE_DIRECT, make->is_cross )); + strarray_addall( &all_libs, add_import_libs( make, &dep_libs, make->delayimports, IMPORT_TYPE_DELAYED, make->is_cross )); strarray_addall( &all_libs, add_import_libs( make, &dep_libs, default_imports, IMPORT_TYPE_DEFAULT, make->is_cross ) );
if (!make->use_msvcrt)
From: Rémi Bernon rbernon@codeweavers.com
And drop gdi32 which isn't required. --- dlls/shcore/Makefile.in | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-)
diff --git a/dlls/shcore/Makefile.in b/dlls/shcore/Makefile.in index 7c4d161a558..61840e9a056 100644 --- a/dlls/shcore/Makefile.in +++ b/dlls/shcore/Makefile.in @@ -1,6 +1,7 @@ MODULE = shcore.dll IMPORTLIB = shcore -IMPORTS = user32 gdi32 ole32 advapi32 +IMPORTS = advapi32 +DELAYIMPORTS = user32 ole32
EXTRADLLFLAGS = -Wb,--prefer-native
From: Rémi Bernon rbernon@codeweavers.com
Avoid triggering the load of comctl32 early. --- programs/regedit/main.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/programs/regedit/main.c b/programs/regedit/main.c index e776ec9d0f7..b1035629726 100644 --- a/programs/regedit/main.c +++ b/programs/regedit/main.c @@ -132,8 +132,6 @@ int WINAPI wWinMain(HINSTANCE hInstance, HINSTANCE hPrevInstance, LPWSTR lpCmdLi HACCEL hAccel; BOOL is_wow64;
- InitCommonControls(); - if (ProcessCmdLine(GetCommandLineW())) { return 0; } @@ -161,6 +159,8 @@ int WINAPI wWinMain(HINSTANCE hInstance, HINSTANCE hPrevInstance, LPWSTR lpCmdLi Wow64RevertWow64FsRedirection( redir ); }
+ InitCommonControls(); + /* Initialize global strings */ LoadStringW(hInstance, IDS_APP_TITLE, szTitle, ARRAY_SIZE(szTitle)); LoadStringW(hInstance, IDS_REGISTRY_DEFAULT_VALUE, g_pszDefaultValueName, ARRAY_SIZE(g_pszDefaultValueName));
From: Rémi Bernon rbernon@codeweavers.com
For CommandLineToArgvW. --- programs/regedit/Makefile.in | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/programs/regedit/Makefile.in b/programs/regedit/Makefile.in index 9f8fb5af165..77ef7b3163a 100644 --- a/programs/regedit/Makefile.in +++ b/programs/regedit/Makefile.in @@ -1,5 +1,5 @@ MODULE = regedit.exe -IMPORTS = advapi32 +IMPORTS = advapi32 shcore DELAYIMPORTS = shlwapi shell32 comdlg32 comctl32 user32 gdi32
EXTRADLLFLAGS = -mwindows -municode
On Thu Sep 29 18:13:40 2022 +0000, Rémi Bernon wrote:
changed this line in [version 2 of the diff](/wine/wine/-/merge_requests/964/diffs?diff_id=12644&start_sha=3c626918c6721e99eafd04950db8c907a1929ea6)
Indeed, I think it should be better now.