From dfac9e2005f4d412347f340d647bd85eef4f78d6 Mon Sep 17 00:00:00 2001 From: Aidan Lee Date: Mon, 15 Jun 2026 21:18:51 +0100 Subject: [PATCH 1/7] Update weak hash test for new msvc optimisations --- test/haxe/TestWeakHash.hx | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/test/haxe/TestWeakHash.hx b/test/haxe/TestWeakHash.hx index d1db98627..4ea6662a9 100644 --- a/test/haxe/TestWeakHash.hx +++ b/test/haxe/TestWeakHash.hx @@ -70,7 +70,15 @@ class TestWeakHash extends Test public function test() { - final map = createMapDeep(20,1000); + var map : WeakMap = null; + + final sema = new sys.thread.Semaphore(0); + sys.thread.Thread.create(() -> { + map = createMapDeep(20,1000); + sema.release(); + }); + sema.acquire(); + cpp.vm.Gc.run(true); deepCheckMap(10,map,500); deepClearRetained(10); From 38275aee91fa0601ea5d155433d381ce5edccf29 Mon Sep 17 00:00:00 2001 From: Aidan Lee Date: Mon, 15 Jun 2026 21:37:49 +0100 Subject: [PATCH 2/7] sleep, just in case --- test/haxe/TestWeakHash.hx | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/test/haxe/TestWeakHash.hx b/test/haxe/TestWeakHash.hx index 4ea6662a9..a193270ff 100644 --- a/test/haxe/TestWeakHash.hx +++ b/test/haxe/TestWeakHash.hx @@ -78,7 +78,10 @@ class TestWeakHash extends Test sema.release(); }); sema.acquire(); - + + // Give the thread enough time to exit and unregister itself from the GC + Sys.sleep(1); + cpp.vm.Gc.run(true); deepCheckMap(10,map,500); deepClearRetained(10); From 7821244ce254452321354fc5adda02db37ded364 Mon Sep 17 00:00:00 2001 From: Aidan Lee Date: Tue, 16 Jun 2026 18:42:35 +0100 Subject: [PATCH 3/7] When cloning the haxe repo get the exact version for nightly used --- .github/workflows/test.yml | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index 315c0842a..43dba149a 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -196,10 +196,24 @@ jobs: steps: - name: checkout uses: actions/checkout@v4 + - name: Get Haxe commit SHA + if: inputs.haxe == 'latest' + id: haxe_sha + shell: bash + env: + GH_TOKEN: ${{ github.token }} + run: | + version=$(haxe --version) + short_sha=${version##*+} + full_sha=$(gh api repos/HaxeFoundation/haxe/commits/$short_sha --jq '.sha') + echo "Haxe version: $version" + echo "sha=$full_sha" >> "$GITHUB_OUTPUT" + echo "Commit SHA: $short_sha, Full SHA: $full_sha" - name: checkout haxe (latest) if: inputs.haxe == 'latest' uses: actions/checkout@v4 with: + ref: ${{ steps.haxe_sha.outputs.sha }} repository: HaxeFoundation/haxe path: haxe - name: checkout haxe (stable) From 2941b7b1d0ade6f8980fea1d273aae0c6a170cc9 Mon Sep 17 00:00:00 2001 From: Aidan Lee Date: Tue, 16 Jun 2026 19:03:48 +0100 Subject: [PATCH 4/7] override workspace for sha gathering step --- .github/workflows/test.yml | 2 ++ 1 file changed, 2 insertions(+) diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index 43dba149a..28811f0b5 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -200,6 +200,8 @@ jobs: if: inputs.haxe == 'latest' id: haxe_sha shell: bash + working-directory: + ${{env.GITHUB_WORKSPACE}} env: GH_TOKEN: ${{ github.token }} run: | From b0fa41e474454c484c526eb0912dced214226e30 Mon Sep 17 00:00:00 2001 From: Aidan Lee Date: Tue, 16 Jun 2026 19:08:09 +0100 Subject: [PATCH 5/7] reorder so we setup haxe first --- .github/workflows/test.yml | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index 28811f0b5..97fe0a7f0 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -196,12 +196,16 @@ jobs: steps: - name: checkout uses: actions/checkout@v4 + - name: setup + uses: ./.github/workflows/setup + with: + haxe: ${{ inputs.haxe }} - name: Get Haxe commit SHA if: inputs.haxe == 'latest' id: haxe_sha shell: bash working-directory: - ${{env.GITHUB_WORKSPACE}} + ${{github.workspace}} env: GH_TOKEN: ${{ github.token }} run: | @@ -225,10 +229,6 @@ jobs: repository: HaxeFoundation/haxe path: haxe ref: ${{ inputs.haxe }} - - name: setup - uses: ./.github/workflows/setup - with: - haxe: ${{ inputs.haxe }} - name: install haxe libs run: haxelib install compile-cpp.hxml --always # haxe 4 tests don't build with latest utest From ce471f46646487dec46757b2a0ecdf68e4a58f0b Mon Sep 17 00:00:00 2001 From: Aidan Lee Date: Tue, 16 Jun 2026 20:26:48 +0100 Subject: [PATCH 6/7] More on thread work to avoid msvc optimisations --- test/haxe/TestWeakHash.hx | 34 +++++++++++++++++++++++++++++++--- 1 file changed, 31 insertions(+), 3 deletions(-) diff --git a/test/haxe/TestWeakHash.hx b/test/haxe/TestWeakHash.hx index a193270ff..3b842c92c 100644 --- a/test/haxe/TestWeakHash.hx +++ b/test/haxe/TestWeakHash.hx @@ -83,10 +83,38 @@ class TestWeakHash extends Test Sys.sleep(1); cpp.vm.Gc.run(true); - deepCheckMap(10,map,500); - deepClearRetained(10); + + final sema = new sys.thread.Semaphore(0); + sys.thread.Thread.create(() -> { + checkMap(map,500); + sema.release(); + }); + sema.acquire(); + + // Give the thread enough time to exit and unregister itself from the GC + Sys.sleep(1); + + final sema = new sys.thread.Semaphore(0); + sys.thread.Thread.create(() -> { + retained = []; + sema.release(); + }); + sema.acquire(); + + // Give the thread enough time to exit and unregister itself from the GC + Sys.sleep(1); + cpp.vm.Gc.run(true); - checkMap(map,0); + + final sema = new sys.thread.Semaphore(0); + sys.thread.Thread.create(() -> { + checkMap(map,0); + sema.release(); + }); + sema.acquire(); + + // Give the thread enough time to exit and unregister itself from the GC + Sys.sleep(1); Assert.pass(); } From 2d47106f009dd70daa5b5d611920b3b1837a54f3 Mon Sep 17 00:00:00 2001 From: Aidan Lee Date: Tue, 16 Jun 2026 21:02:44 +0100 Subject: [PATCH 7/7] Dead code removal --- test/haxe/TestWeakHash.hx | 17 +---------------- 1 file changed, 1 insertion(+), 16 deletions(-) diff --git a/test/haxe/TestWeakHash.hx b/test/haxe/TestWeakHash.hx index 3b842c92c..385570be5 100644 --- a/test/haxe/TestWeakHash.hx +++ b/test/haxe/TestWeakHash.hx @@ -52,21 +52,6 @@ class TestWeakHash extends Test Assert.isTrue(oddFound<=2, "Too many odd values retained " + oddFound); Assert.isTrue(valid>=expect && valid, expect:Int) - { - if (inDepth<1) - checkMap(map,expect); - else - deepCheckMap(inDepth-1, map, expect); - } - - function deepClearRetained(inRecurse:Int) - { - if (inRecurse>0) - deepClearRetained(inRecurse-1); - else - retained = []; - } public function test() { @@ -74,7 +59,7 @@ class TestWeakHash extends Test final sema = new sys.thread.Semaphore(0); sys.thread.Thread.create(() -> { - map = createMapDeep(20,1000); + map = createMap(1000); sema.release(); }); sema.acquire();