Wine-Bug: https://bugs.winehq.org/show_bug.cgi?id=52012 Signed-off-by: David Koller dk@cs.stanford.edu --- dlls/vcomp/main.c | 103 +++++++++++++++++++++++++++++++++--- dlls/vcomp/vcomp.spec | 2 +- dlls/vcomp100/vcomp100.spec | 2 +- dlls/vcomp110/vcomp110.spec | 2 +- dlls/vcomp120/vcomp120.spec | 2 +- dlls/vcomp140/vcomp140.spec | 2 +- dlls/vcomp90/vcomp90.spec | 2 +- 7 files changed, 102 insertions(+), 13 deletions(-)
diff --git a/dlls/vcomp/main.c b/dlls/vcomp/main.c index c4f2572c86a..91c16714ea6 100644 --- a/dlls/vcomp/main.c +++ b/dlls/vcomp/main.c @@ -81,8 +81,14 @@ struct vcomp_thread_data /* dynamic */ unsigned int dynamic; unsigned int dynamic_type; - unsigned int dynamic_begin; - unsigned int dynamic_end; + union { + unsigned int dynamic_begin; + ULONG64 dynamic_begin_i8; + }; + union { + unsigned int dynamic_end; + ULONG64 dynamic_end_i8; + }; };
struct vcomp_team_data @@ -113,11 +119,22 @@ struct vcomp_task_data
/* dynamic */ unsigned int dynamic; - unsigned int dynamic_first; - unsigned int dynamic_last; - unsigned int dynamic_iterations; - int dynamic_step; - unsigned int dynamic_chunksize; + union { + struct { + unsigned int dynamic_first; + unsigned int dynamic_last; + unsigned int dynamic_iterations; + int dynamic_step; + unsigned int dynamic_chunksize; + }; + struct { + ULONG64 dynamic_first_i8; + ULONG64 dynamic_last_i8; + ULONG64 dynamic_iterations_i8; + LONG64 dynamic_step_i8; + ULONG64 dynamic_chunksize_i8; + }; + }; };
static void **ptr_from_va_list(va_list valist) @@ -1483,6 +1500,78 @@ void CDECL _vcomp_for_dynamic_init(unsigned int flags, unsigned int first, unsig } }
+void CDECL _vcomp_for_dynamic_init_i8(unsigned int flags, ULONG64 first, ULONG64 last, + LONG64 step, ULONG64 chunksize) +{ + ULONG64 iterations, per_thread, remaining; + struct vcomp_thread_data *thread_data = vcomp_init_thread_data(); + struct vcomp_team_data *team_data = thread_data->team; + struct vcomp_task_data *task_data = thread_data->task; + int num_threads = team_data ? team_data->num_threads : 1; + int thread_num = thread_data->thread_num; + unsigned int type = flags & ~VCOMP_DYNAMIC_FLAGS_INCREMENT; + + TRACE("(%u, %s, %s, %s, %s)\n", flags, wine_dbgstr_longlong(first), wine_dbgstr_longlong(last), + wine_dbgstr_longlong(step), wine_dbgstr_longlong(chunksize)); + + if (step <= 0) + { + thread_data->dynamic_type = 0; + return; + } + + if (flags & VCOMP_DYNAMIC_FLAGS_INCREMENT) + iterations = 1 + (last - first) / step; + else + { + iterations = 1 + (first - last) / step; + step *= -1; + } + + if (type == VCOMP_DYNAMIC_FLAGS_STATIC) + { + per_thread = iterations / num_threads; + remaining = iterations - per_thread * num_threads; + + if (thread_num < remaining) + per_thread++; + else if (per_thread) + first += remaining * step; + else + { + thread_data->dynamic_type = 0; + return; + } + + thread_data->dynamic_type = VCOMP_DYNAMIC_FLAGS_STATIC; + thread_data->dynamic_begin_i8 = first + per_thread * thread_num * step; + thread_data->dynamic_end_i8 = thread_data->dynamic_begin_i8 + (per_thread - 1) * step; + } + else + { + if (type != VCOMP_DYNAMIC_FLAGS_CHUNKED && + type != VCOMP_DYNAMIC_FLAGS_GUIDED) + { + FIXME("unsupported flags %u\n", flags); + type = VCOMP_DYNAMIC_FLAGS_GUIDED; + } + + EnterCriticalSection(&vcomp_section); + thread_data->dynamic++; + thread_data->dynamic_type = type; + if ((int)(thread_data->dynamic - task_data->dynamic) > 0) + { + task_data->dynamic = thread_data->dynamic; + task_data->dynamic_first_i8 = first; + task_data->dynamic_last_i8 = last; + task_data->dynamic_iterations_i8 = iterations; + task_data->dynamic_step_i8 = step; + task_data->dynamic_chunksize_i8 = chunksize; + } + LeaveCriticalSection(&vcomp_section); + } +} + int CDECL _vcomp_for_dynamic_next(unsigned int *begin, unsigned int *end) { struct vcomp_thread_data *thread_data = vcomp_init_thread_data(); diff --git a/dlls/vcomp/vcomp.spec b/dlls/vcomp/vcomp.spec index fb67146e058..3b87ee11127 100644 --- a/dlls/vcomp/vcomp.spec +++ b/dlls/vcomp/vcomp.spec @@ -56,7 +56,7 @@ @ cdecl _vcomp_enter_critsect(ptr) @ cdecl _vcomp_flush() @ cdecl _vcomp_for_dynamic_init(long long long long long) -@ stub _vcomp_for_dynamic_init_i8 +@ cdecl _vcomp_for_dynamic_init_i8(long int64 int64 int64 int64) @ cdecl _vcomp_for_dynamic_next(ptr ptr) @ stub _vcomp_for_dynamic_next_i8 @ cdecl _vcomp_for_static_end() diff --git a/dlls/vcomp100/vcomp100.spec b/dlls/vcomp100/vcomp100.spec index fb67146e058..3b87ee11127 100644 --- a/dlls/vcomp100/vcomp100.spec +++ b/dlls/vcomp100/vcomp100.spec @@ -56,7 +56,7 @@ @ cdecl _vcomp_enter_critsect(ptr) @ cdecl _vcomp_flush() @ cdecl _vcomp_for_dynamic_init(long long long long long) -@ stub _vcomp_for_dynamic_init_i8 +@ cdecl _vcomp_for_dynamic_init_i8(long int64 int64 int64 int64) @ cdecl _vcomp_for_dynamic_next(ptr ptr) @ stub _vcomp_for_dynamic_next_i8 @ cdecl _vcomp_for_static_end() diff --git a/dlls/vcomp110/vcomp110.spec b/dlls/vcomp110/vcomp110.spec index e1cb8ab9931..9f0d22e273a 100644 --- a/dlls/vcomp110/vcomp110.spec +++ b/dlls/vcomp110/vcomp110.spec @@ -57,7 +57,7 @@ @ cdecl _vcomp_enter_critsect(ptr) @ cdecl _vcomp_flush() @ cdecl _vcomp_for_dynamic_init(long long long long long) -@ stub _vcomp_for_dynamic_init_i8 +@ cdecl _vcomp_for_dynamic_init_i8(long int64 int64 int64 int64) @ cdecl _vcomp_for_dynamic_next(ptr ptr) @ stub _vcomp_for_dynamic_next_i8 @ cdecl _vcomp_for_static_end() diff --git a/dlls/vcomp120/vcomp120.spec b/dlls/vcomp120/vcomp120.spec index e1cb8ab9931..9f0d22e273a 100644 --- a/dlls/vcomp120/vcomp120.spec +++ b/dlls/vcomp120/vcomp120.spec @@ -57,7 +57,7 @@ @ cdecl _vcomp_enter_critsect(ptr) @ cdecl _vcomp_flush() @ cdecl _vcomp_for_dynamic_init(long long long long long) -@ stub _vcomp_for_dynamic_init_i8 +@ cdecl _vcomp_for_dynamic_init_i8(long int64 int64 int64 int64) @ cdecl _vcomp_for_dynamic_next(ptr ptr) @ stub _vcomp_for_dynamic_next_i8 @ cdecl _vcomp_for_static_end() diff --git a/dlls/vcomp140/vcomp140.spec b/dlls/vcomp140/vcomp140.spec index e1cb8ab9931..9f0d22e273a 100644 --- a/dlls/vcomp140/vcomp140.spec +++ b/dlls/vcomp140/vcomp140.spec @@ -57,7 +57,7 @@ @ cdecl _vcomp_enter_critsect(ptr) @ cdecl _vcomp_flush() @ cdecl _vcomp_for_dynamic_init(long long long long long) -@ stub _vcomp_for_dynamic_init_i8 +@ cdecl _vcomp_for_dynamic_init_i8(long int64 int64 int64 int64) @ cdecl _vcomp_for_dynamic_next(ptr ptr) @ stub _vcomp_for_dynamic_next_i8 @ cdecl _vcomp_for_static_end() diff --git a/dlls/vcomp90/vcomp90.spec b/dlls/vcomp90/vcomp90.spec index 9fac400ea0e..b618896c1f4 100644 --- a/dlls/vcomp90/vcomp90.spec +++ b/dlls/vcomp90/vcomp90.spec @@ -56,7 +56,7 @@ @ cdecl _vcomp_enter_critsect(ptr) vcomp._vcomp_enter_critsect @ cdecl _vcomp_flush() vcomp._vcomp_flush @ cdecl _vcomp_for_dynamic_init(long long long long long) vcomp._vcomp_for_dynamic_init -@ stub _vcomp_for_dynamic_init_i8 +@ cdecl _vcomp_for_dynamic_init_i8(long int64 int64 int64 int64) vcomp._vcomp_for_dynamic_init_i8 @ cdecl _vcomp_for_dynamic_next(ptr ptr) vcomp._vcomp_for_dynamic_next @ stub _vcomp_for_dynamic_next_i8 @ cdecl _vcomp_for_static_end() vcomp._vcomp_for_static_end