[PATCH v2 2/3] vcomp: Implement _vcomp_for_dynamic_next_i8()

David Koller dk at cs.stanford.edu
Wed Feb 16 19:54:07 CST 2022


Wine-Bug: https://bugs.winehq.org/show_bug.cgi?id=52012
Signed-off-by: David Koller <dk at cs.stanford.edu>
---
 dlls/vcomp/main.c           | 44 +++++++++++++++++++++++++++++++++++++
 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, 50 insertions(+), 6 deletions(-)

diff --git a/dlls/vcomp/main.c b/dlls/vcomp/main.c
index 91c16714ea6..239302eca7b 100644
--- a/dlls/vcomp/main.c
+++ b/dlls/vcomp/main.c
@@ -1616,6 +1616,50 @@ int CDECL _vcomp_for_dynamic_next(unsigned int *begin, unsigned int *end)
     return 0;
 }
 
+int CDECL _vcomp_for_dynamic_next_i8(ULONG64 *begin, ULONG64 *end)
+{
+    struct vcomp_thread_data *thread_data = vcomp_init_thread_data();
+    struct vcomp_task_data *task_data = thread_data->task;
+    struct vcomp_team_data *team_data = thread_data->team;
+    int num_threads = team_data ? team_data->num_threads : 1;
+
+    TRACE("(%p, %p)\n", begin, end);
+
+    if (thread_data->dynamic_type == VCOMP_DYNAMIC_FLAGS_STATIC)
+    {
+        *begin = thread_data->dynamic_begin_i8;
+        *end   = thread_data->dynamic_end_i8;
+        thread_data->dynamic_type = 0;
+        return 1;
+    }
+    else if (thread_data->dynamic_type == VCOMP_DYNAMIC_FLAGS_CHUNKED ||
+             thread_data->dynamic_type == VCOMP_DYNAMIC_FLAGS_GUIDED)
+    {
+        ULONG64 iterations = 0;
+        EnterCriticalSection(&vcomp_section);
+        if (thread_data->dynamic == task_data->dynamic &&
+            task_data->dynamic_iterations_i8 != 0)
+        {
+            iterations = min(task_data->dynamic_iterations_i8, task_data->dynamic_chunksize_i8);
+            if (thread_data->dynamic_type == VCOMP_DYNAMIC_FLAGS_GUIDED &&
+                task_data->dynamic_iterations_i8 > num_threads * task_data->dynamic_chunksize_i8)
+            {
+                iterations = (task_data->dynamic_iterations_i8 + num_threads - 1) / num_threads;
+            }
+            *begin = task_data->dynamic_first_i8;
+            *end   = task_data->dynamic_first_i8 + (iterations - 1) * task_data->dynamic_step_i8;
+            task_data->dynamic_iterations_i8 -= iterations;
+            task_data->dynamic_first_i8      += iterations * task_data->dynamic_step_i8;
+            if (!task_data->dynamic_iterations_i8)
+                *end = task_data->dynamic_last_i8;
+        }
+        LeaveCriticalSection(&vcomp_section);
+        return iterations != 0;
+    }
+
+    return 0;
+}
+
 int CDECL omp_in_parallel(void)
 {
     TRACE("()\n");
diff --git a/dlls/vcomp/vcomp.spec b/dlls/vcomp/vcomp.spec
index 3b87ee11127..f5fb23d7ad1 100644
--- a/dlls/vcomp/vcomp.spec
+++ b/dlls/vcomp/vcomp.spec
@@ -58,7 +58,7 @@
 @ cdecl _vcomp_for_dynamic_init(long long long long long)
 @ 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_dynamic_next_i8(ptr ptr)
 @ cdecl _vcomp_for_static_end()
 @ cdecl _vcomp_for_static_init(long long long long ptr ptr ptr ptr ptr)
 @ cdecl _vcomp_for_static_init_i8(int64 int64 int64 int64 ptr ptr ptr ptr ptr)
diff --git a/dlls/vcomp100/vcomp100.spec b/dlls/vcomp100/vcomp100.spec
index 3b87ee11127..f5fb23d7ad1 100644
--- a/dlls/vcomp100/vcomp100.spec
+++ b/dlls/vcomp100/vcomp100.spec
@@ -58,7 +58,7 @@
 @ cdecl _vcomp_for_dynamic_init(long long long long long)
 @ 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_dynamic_next_i8(ptr ptr)
 @ cdecl _vcomp_for_static_end()
 @ cdecl _vcomp_for_static_init(long long long long ptr ptr ptr ptr ptr)
 @ cdecl _vcomp_for_static_init_i8(int64 int64 int64 int64 ptr ptr ptr ptr ptr)
diff --git a/dlls/vcomp110/vcomp110.spec b/dlls/vcomp110/vcomp110.spec
index 9f0d22e273a..8f3458fa9a2 100644
--- a/dlls/vcomp110/vcomp110.spec
+++ b/dlls/vcomp110/vcomp110.spec
@@ -59,7 +59,7 @@
 @ cdecl _vcomp_for_dynamic_init(long long long long long)
 @ 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_dynamic_next_i8(ptr ptr)
 @ cdecl _vcomp_for_static_end()
 @ cdecl _vcomp_for_static_init(long long long long ptr ptr ptr ptr ptr)
 @ cdecl _vcomp_for_static_init_i8(int64 int64 int64 int64 ptr ptr ptr ptr ptr)
diff --git a/dlls/vcomp120/vcomp120.spec b/dlls/vcomp120/vcomp120.spec
index 9f0d22e273a..8f3458fa9a2 100644
--- a/dlls/vcomp120/vcomp120.spec
+++ b/dlls/vcomp120/vcomp120.spec
@@ -59,7 +59,7 @@
 @ cdecl _vcomp_for_dynamic_init(long long long long long)
 @ 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_dynamic_next_i8(ptr ptr)
 @ cdecl _vcomp_for_static_end()
 @ cdecl _vcomp_for_static_init(long long long long ptr ptr ptr ptr ptr)
 @ cdecl _vcomp_for_static_init_i8(int64 int64 int64 int64 ptr ptr ptr ptr ptr)
diff --git a/dlls/vcomp140/vcomp140.spec b/dlls/vcomp140/vcomp140.spec
index 9f0d22e273a..8f3458fa9a2 100644
--- a/dlls/vcomp140/vcomp140.spec
+++ b/dlls/vcomp140/vcomp140.spec
@@ -59,7 +59,7 @@
 @ cdecl _vcomp_for_dynamic_init(long long long long long)
 @ 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_dynamic_next_i8(ptr ptr)
 @ cdecl _vcomp_for_static_end()
 @ cdecl _vcomp_for_static_init(long long long long ptr ptr ptr ptr ptr)
 @ cdecl _vcomp_for_static_init_i8(int64 int64 int64 int64 ptr ptr ptr ptr ptr)
diff --git a/dlls/vcomp90/vcomp90.spec b/dlls/vcomp90/vcomp90.spec
index b618896c1f4..21bded4cdfd 100644
--- a/dlls/vcomp90/vcomp90.spec
+++ b/dlls/vcomp90/vcomp90.spec
@@ -58,7 +58,7 @@
 @ cdecl _vcomp_for_dynamic_init(long long long long long) vcomp._vcomp_for_dynamic_init
 @ 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_dynamic_next_i8(ptr ptr) vcomp._vcomp_for_dynamic_next_i8
 @ cdecl _vcomp_for_static_end() vcomp._vcomp_for_static_end
 @ cdecl _vcomp_for_static_init(long long long long ptr ptr ptr ptr ptr) vcomp._vcomp_for_static_init
 @ cdecl _vcomp_for_static_init_i8(int64 int64 int64 int64 ptr ptr ptr ptr ptr) vcomp._vcomp_for_static_init_i8
-- 
2.25.1




More information about the wine-devel mailing list