Skip to content

Commit 0fea35f

Browse files
Merge main into MRK2009/main
2 parents 73332aa + d8f9651 commit 0fea35f

29 files changed

Lines changed: 499 additions & 50 deletions

File tree

‎.github/workflows/haxe5.yml‎

Lines changed: 2 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,6 @@
11
name: haxe 5 preview
2+
# Not on pull requests: its failures are only warnings, and main runs it once
3+
# a change lands
24
on:
35
push:
46
branches: [main, 'release/**']
@@ -7,12 +9,6 @@ on:
79
- 'docs/**'
810
- 'LICENSE.txt'
911
- '.github/ISSUE_TEMPLATE/**'
10-
pull_request:
11-
paths-ignore:
12-
- '**.md'
13-
- 'docs/**'
14-
- 'LICENSE.txt'
15-
- '.github/ISSUE_TEMPLATE/**'
1612
workflow_dispatch:
1713

1814
# A newer push to the same branch or pull request supersedes the run in progress,

‎.github/workflows/main.yml‎

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,9 @@ concurrency:
2323
group: ${{ github.workflow }}-${{ github.event.pull_request.number || ((github.ref == 'refs/heads/main' || startsWith(github.ref, 'refs/heads/release/')) && github.sha) || github.ref }}
2424
cancel-in-progress: true
2525

26+
# A pull request runs the quick checks, the sanitizers and the core suites on
27+
# Linux 64, Windows 64 and macOS arm64. Pushes to main and release branches
28+
# run everything, and a failure there is fixed or tracked like any other
2629
jobs:
2730
check-headers:
2831
name: Check headers
@@ -55,6 +58,7 @@ jobs:
5558

5659
check-msvc-llvm:
5760
name: Check MSVC builds with clang-cl
61+
if: github.event_name != 'pull_request'
5862
runs-on: windows-latest
5963
steps:
6064
- name: checkout
@@ -75,6 +79,7 @@ jobs:
7579

7680
check-android:
7781
name: Build for Android (${{ matrix.abi }})
82+
if: github.event_name != 'pull_request'
7883
strategy:
7984
fail-fast: false
8085
matrix:
@@ -113,6 +118,7 @@ jobs:
113118

114119
check-musl:
115120
name: Check Linux with musl
121+
if: github.event_name != 'pull_request'
116122
runs-on: ubuntu-latest
117123
steps:
118124
- name: checkout
@@ -208,6 +214,7 @@ jobs:
208214
# a browser's event loop, workers or cross-origin isolation (libhxcpp #337).
209215
check-emscripten:
210216
name: Check Emscripten
217+
if: github.event_name != 'pull_request'
211218
runs-on: ubuntu-latest
212219
timeout-minutes: 120
213220
env:
@@ -270,6 +277,7 @@ jobs:
270277
271278
check-pgo:
272279
name: Check HXCPP_PGO with ${{ matrix.name }}
280+
if: github.event_name != 'pull_request'
273281
strategy:
274282
fail-fast: false
275283
matrix:
@@ -297,6 +305,7 @@ jobs:
297305
298306
check-haxelib:
299307
name: Check installing with haxelib
308+
if: github.event_name != 'pull_request'
300309
strategy:
301310
fail-fast: false
302311
matrix:
@@ -326,3 +335,4 @@ jobs:
326335
uses: ./.github/workflows/platforms.yml
327336
with:
328337
haxe: 4.3.7
338+
pr: ${{ github.event_name == 'pull_request' }}

‎.github/workflows/platforms.yml‎

Lines changed: 13 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,9 +13,16 @@ on:
1313
required: false
1414
type: string
1515
default: smoke
16+
# A pull request: the core suites on Linux 64, Windows 64 and macOS arm64
17+
# only. main runs everything once the change lands
18+
pr:
19+
required: false
20+
type: boolean
21+
default: false
1622

1723
jobs:
1824
Windows32:
25+
if: ${{ !inputs.pr }}
1926
uses: ./.github/workflows/test.yml
2027
name: Windows 32
2128
with:
@@ -34,9 +41,11 @@ jobs:
3441
sep: \
3542
ext: .dll
3643
os: windows-latest
44+
scope: ${{ inputs.pr && 'smoke' || 'full' }}
3745
stress: '["default generational verify", "generational-verify moving big-blocks", "always-move check-pointer", "big-generational big-verify nursery dynamic-size debug-level"]'
3846

3947
MacOS64:
48+
if: ${{ !inputs.pr }}
4049
uses: ./.github/workflows/test.yml
4150
name: macOS Intel
4251
with:
@@ -57,9 +66,11 @@ jobs:
5766
sep: /
5867
ext: .dylib
5968
os: macos-latest
69+
scope: ${{ inputs.pr && 'smoke' || 'full' }}
6070
bindir: MacArm64
6171

6272
Linux32:
73+
if: ${{ !inputs.pr }}
6374
uses: ./.github/workflows/test.yml
6475
name: Linux 32
6576
with:
@@ -78,12 +89,13 @@ jobs:
7889
sep: /
7990
ext: .dso
8091
os: ubuntu-latest
92+
scope: ${{ inputs.pr && 'smoke' || 'full' }}
8193
stress: '["default generational verify", "generational-verify moving big-blocks", "always-move check-pointer", "big-generational big-verify nursery dynamic-size debug-level"]'
8294
bindir: Linux64
8395

8496
# Haxe 4.3.7 has no Linux arm64 build, so this runs with the nightly
8597
LinuxArm64:
86-
if: inputs.haxe != '4.3.7'
98+
if: inputs.haxe != '4.3.7' && !inputs.pr
8799
uses: ./.github/workflows/test.yml
88100
name: Linux arm64
89101
with:

‎CONTRIBUTING.md‎

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -45,6 +45,7 @@ Most of the collector's defines are not used by any default build, so code behin
4545
- A new or newly documented define comes with coverage: an entry in `test/gc-defines/check.sh` (or the equivalent build check for its area), a mode in the GC stress jobs in `.github/workflows/test.yml` when it changes how the collector runs, and a line in `docs/build_xml/Defines.md`.
4646
- A CI failure is fixed, or tracked as an issue and fixed, never merged around, even when `main` fails the same way.
4747
- The Haxe 5 preview workflow is the exception: Haxe 5 is not released, so its failures are warnings. Each still gets an issue, but it holds back neither a merge nor a release.
48+
- A pull request runs a smaller set: the quick checks, the sanitizers and the core suites on Linux 64, Windows 64 and macOS arm64. A push to `main` runs everything, Haxe 5 included, and what fails there after a merge is fixed or tracked the same way. To run everything before merging, run the main workflow on the branch from the Actions tab.
4849

4950
## Pull requests
5051

‎Changes.md‎

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,11 @@
22
libhxcpp 6.0.0 (unreleased)
33
------------------------------------------------------------
44

5+
* Added timedWait to hx::thread::ConditionVariable, which Haxe 5's sys.thread.Condition.timedWait calls: with the Haxe nightly, every program that used Condition failed to compile. It returns true once a signal or broadcast came and false when the time ran out, and it waits out the wakeups MSVC's timed waits give just before the deadline with nothing signalled
6+
* Fixed an exception from blit, setSize or resize under the cppia JIT ending the process instead of reaching the script's catch, on typed arrays and on Array<Dynamic>: their native calls had no exception bridge. The script catches it, as it does interpreted and in compiled code (libhxcpp #404)
7+
* Fixed resize() and cpp.NativeArray.setSize() on an Array<Dynamic> under the cppia JIT evaluating the array expression twice, so a call in it ran twice and the array it returned the second time was the one resized. The JIT evaluates it once (libhxcpp #411)
8+
* Fixed indexOf and lastIndexOf on an Array<Dynamic> under the cppia JIT ignoring fromIndex: the JIT never generated it, so a call or exception in it was lost too. The search starts from it, as it does interpreted and in compiled code (libhxcpp #410)
9+
* Fixed reverse() and resize() on an Array<Dynamic> in interpreted cppia doing nothing: the interpreter had no case for them, and resize never evaluated its argument. They reverse and resize the array, as they do under the JIT and in compiled code (libhxcpp #409)
510
* Added HXCPP_PROGRESS_PERCENT, which shows a group's compile progress as a percentage of its files, [42.5% ], instead of a count, [425/1000]
611
* Fixed a program on Linux with glibc staying as large as its largest burst of large allocations, such as the files a game reads while it loads: glibc keeps a freed buffer's memory in its heap unless it had mapped the buffer on its own, and once a buffer mapped on its own has been freed it stops mapping those of that size or less, up to 32 MB. The memory of the large buffers a collection freed then stayed the process's. The collector now trims the C heap once 16 MB has been freed to it, on the thread that frees the buffers. A program that dropped 384 MB of 4 MB buffers stayed at 396 MB resident and now returns to 12 MB
712
* Fixed a native extension that includes hx/CFFI.h before hx/CFFIPrime.h, as SteamWrap does, failing to compile with hxs_encoding, hxs_utf16 and alloc_hxs_utf8 not declared: CFFI.h included first declares the CFFI API without HXCPP_PRIME, so without the Prime string functions that the ordinary wrapper of a DEFINE_PRIME function now uses. CFFIPrime.h declares them then

‎include/hx/thread/ConditionVariable.hpp‎

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,8 @@ namespace hx
1818
bool tryAcquire();
1919
void release();
2020
void wait();
21+
// True when woken, false when the time ran out
22+
bool timedWait(double seconds);
2123
void signal();
2224
void broadcast();
2325

‎src/hx/cppia/ArrayBuiltin.cpp‎

Lines changed: 35 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -99,6 +99,35 @@ static ArrayBase * SLJIT_CALL array_expand_size(ArrayBase *inArray, int inSize)
9999
return inArray;
100100
}
101101

102+
// blit, __SetSizeExact and resize throw for a range or size the array cannot
103+
// take, and the exception becomes the script's pending one, which the code
104+
// after the call checks. They are ArrayBase's whatever the element type, so
105+
// each is one function here: a copy for every element type and builtin, each
106+
// with its own exception handling, would take more sections than MSVC's
107+
// object file format allows.
108+
static void SLJIT_CALL array_set_size_exact(ArrayBase *inArray, int inSize)
109+
{
110+
TRY_NATIVE
111+
inArray->__SetSizeExact(inSize);
112+
CATCH_NATIVE
113+
}
114+
115+
static void SLJIT_CALL array_resize(ArrayBase *inArray, int inSize)
116+
{
117+
TRY_NATIVE
118+
inArray->resize(inSize);
119+
CATCH_NATIVE
120+
}
121+
122+
static void SLJIT_CALL array_blit(JitMultiArg *inArgs)
123+
{
124+
// this, inDestElement, inSourceArray, inSourceElement, inElementCount
125+
TRY_NATIVE
126+
ArrayBase *dest = (ArrayBase *)inArgs[0].obj;
127+
dest->Blit( inArgs[1].ival, (ArrayBase *)inArgs[2].obj, inArgs[3].ival, inArgs[4].ival );
128+
CATCH_NATIVE
129+
}
130+
102131
#endif
103132

104133

@@ -1245,16 +1274,6 @@ struct ArrayBuiltin : public ArrayBuiltinBase
12451274
return inArray->keyValueIterator().mPtr;
12461275
}
12471276

1248-
static void SLJIT_CALL runSetSizeExact( Array_obj<ELEM> *inArray, int size )
1249-
{
1250-
inArray->__SetSizeExact(size);
1251-
}
1252-
1253-
static void SLJIT_CALL runResize( Array_obj<ELEM> *inArray, int size )
1254-
{
1255-
inArray->resize(size);
1256-
}
1257-
12581277

12591278
static void SLJIT_CALL runToString( Array_obj<ELEM> *inArray, String *outString )
12601279
{
@@ -1268,14 +1287,6 @@ struct ArrayBuiltin : public ArrayBuiltinBase
12681287
return inArray->copy().mPtr;
12691288
}
12701289

1271-
static void SLJIT_CALL runBlit( JitMultiArg *inArgs)
1272-
{
1273-
// this, inDestElement, inSourceArray, inSourceElement, inElementCount
1274-
Array_obj<ELEM> *dest = (Array_obj<ELEM> *)inArgs[0].obj;
1275-
Array_obj<ELEM> *src = (Array_obj<ELEM> *)inArgs[2].obj;
1276-
dest->blit( inArgs[1].ival, src, inArgs[3].ival, inArgs[4].ival );
1277-
}
1278-
12791290

12801291
static hx::Object * SLJIT_CALL runProcess( Array_obj<ELEM> *inArray, hx::Object *inFunction)
12811292
{
@@ -1891,7 +1902,8 @@ struct ArrayBuiltin : public ArrayBuiltinBase
18911902
thisExpr->genCode(compiler, thisVal, etObject);
18921903
genNullReferenceExceptionCheck(compiler, thisVal);
18931904
args[0]->genCode(compiler, sJitArg1.as(jtInt), etInt);
1894-
compiler->callNative( (void *)runSetSizeExact, thisVal, sJitArg1.as(jtInt));
1905+
compiler->callNative( (void *)array_set_size_exact, thisVal, sJitArg1.as(jtInt));
1906+
compiler->checkException();
18951907
break;
18961908
}
18971909

@@ -1901,7 +1913,8 @@ struct ArrayBuiltin : public ArrayBuiltinBase
19011913
thisExpr->genCode(compiler, thisVal, etObject);
19021914
genNullReferenceExceptionCheck(compiler, thisVal);
19031915
args[0]->genCode(compiler, sJitArg1.as(jtInt), etInt);
1904-
compiler->callNative( (void *)runResize, thisVal, sJitArg1.as(jtInt));
1916+
compiler->callNative( (void *)array_resize, thisVal, sJitArg1.as(jtInt));
1917+
compiler->checkException();
19051918
break;
19061919
}
19071920

@@ -1916,7 +1929,8 @@ struct ArrayBuiltin : public ArrayBuiltinBase
19161929
args[1]->genCode(compiler, fargs.arg(2,jtPointer), etObject);
19171930
args[2]->genCode(compiler, fargs.arg(3,jtInt), etInt);
19181931
args[3]->genCode(compiler, fargs.arg(4,jtInt), etInt);
1919-
compiler->callNative( (void *)runBlit, fargs );
1932+
compiler->callNative( (void *)array_blit, fargs );
1933+
compiler->checkException();
19201934
break;
19211935
}
19221936

0 commit comments

Comments
 (0)