You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
This commit was created on GitHub.com and signed with GitHub’s verified signature.
Builds with the compile cache no longer size the whole cache each time: with 29792 files that took 98 ms to over a second before every build, even one with nothing to compile, and takes 3 to 14 ms now. The cache is trimmed to HXCPP_CACHE_MB at most once in ten minutes (libhxcpp #473)
Fixed an edit to some of the runtime's headers rebuilding nothing, as when a haxelib git or dev checkout updates: hxcpp.h includes headers, hx/Functions.h and cpp/FastIterator.h among them, that the build tool's depend lists did not name, so neither the objects compiled with them nor the compile cache were checked against them, and a stale precompiled header stopped clang builds. Every header hxcpp.h and the runtime include is listed now, and CI checks that it stays so (libhxcpp #469)
Fixed three build tool settings that did nothing or failed: a file with its own cxx_standard in a group with a precompiled header failed to compile (C2855 on MSVC), an group was given the host compiler's flags because its tag was compared instead of set, and -DNDKV20 and up were ignored, so the newest NDK was used instead. An NDK without meta/platforms.json no longer stops the build with "Invalid field access : toString" (libhxcpp #472)
Fixed the build tool reusing stale objects when a define that changes how files compile was switched without the compile cache: only defines containing hxcpp, and a few others, were compared, so adding -D CPPIA_NO_JIT to a scriptable build failed to link, removing it linked a host without its JIT, and ABI, OBJC_ARC, STDLIBCPP and the others like them did nothing until the objects changed. Each now rebuilds what it affects (libhxcpp #470)
Fixed the build tool linking a stale object and exiting 0 when a compile failed and its old object could not be deleted, as when it is read-only or another process has it open, and hanging when a compile thread exited, as with HXCPP_EXIT_ON_ERROR on a compile error, or with an error such as two optimisation tags on one file. Both fail the build now, and HXCPP_EXIT_ON_ERROR works as a -D define, not only from the environment (libhxcpp #471)
Fixed cppia's adoptInstances moving instances that code then used with the wrong layout: a class whose methods changed order or number moved, so old code still running called its moved instances by the old vtable slots, reaching another method or crashing, and a class moved while a field could hold an instance of a class that stayed, which new code read past its end. Such classes keep their instances now, and the report says why: methods must be the same, in the same slots, and so must the script interfaces a class implements, fields compare their types by name, and a class stays with the classes its fields can hold (libhxcpp #464)
Fixed malformed cppia files crashing the host instead of failing to load: a MAIN in a module with no types, an unknown script enum constructor or one called with the wrong number of arguments, two classes with one type id, a string constant or file id past the string table, which grew the table to it, an enum parameter index past the value, break or continue outside a loop under the JIT, and a super constructor call to a class other than the super class. Each fails to load, or is read safely (libhxcpp #467)
Fixed cppia's interpreter and JIT giving different results for array builtins, both of them now matching C++: under the JIT, a[i] += x and the other compound assignments on an Array stored x alone, a[i]++, insert and toString on one did nothing, a Bool stored in an Array became an Int, bitwise compound assignments on an Array<Null> did nothing, an Int array read out of range as a String gave "null", and ++d[i] on a Dynamic as a statement decremented. Interpreted, a typed indexOf or lastIndexOf used as a Float gave 0, and join, toString and the iterators used as a statement did not run (libhxcpp #468)
Fixed two counts with HXCPP_GC_INCREMENTAL: Gc.memInfo64(MEM_INFO_LIVE) after an incremental cycle reported every used row as live, several times the bytes really live, where it is meant to report the last full reclaim, and Gc.trace with a cycle part done counted only the objects the cycle had not marked yet. MEM_INFO_LIVE changes only with a full reclaim now, and Gc.trace starts the cycle again, as __hxcpp_gc_census does (libhxcpp #453)
Fixed a cpp.Pointer field, or a pointer boxed in a Dynamic, letting what it points into be freed when it points further in than 64 bytes, or 32 on 32-bit, as cpp.Pointer.arrayElem(a, 100) does: the fix for Haxe 4's AtomicInt kept only what a stack word would keep. A pointer field keeps its whole allocation now, large ones included, and pins it under HXCPP_GC_MOVING (libhxcpp #451)
Fixed cppia hanging or crashing when several threads asked Std.isOfType about script objects, or cast them to host interfaces, at once: each question about an interface a class did not implement inserted into that class's table, unlocked, while other threads searched it. Loading modules on several threads at once could likewise fail with "No base defined for non-interface", or hang, as each load inserted the host class names it missed into a map the others walked. Both are only read after they are filled now (libhxcpp #466)
Fixed Semaphore.tryAcquire with a negative timeout waiting for ever, as tryAcquire(deadline - now) does once the deadline has passed: since the fix for Haxe 5's Lock.wait() (libhxcpp #420), any negative timeout meant no limit. Only -1, which Haxe 5.0.0-preview.1's Lock.wait() passes for no timeout, waits with no limit now, and any other negative timeout returns at once, as 0 does (libhxcpp #461)
Fixed 32-bit Windows programs stopping with "Bad local allocator - requesting memory from unregistered thread!" when the process had used 64 TLS slots before the runtime started, as a host with many DLLs, or a late-loaded hxcpp DLL, can: the collector read its per-thread context from the thread's inline TLS slots, of which there are only 64. Later slots are read with TlsGetValue, as on x64 (libhxcpp #458)
Fixed Windows programs not starting on Windows 8.1, Server 2012 R2 and Windows 10 before 1607 with a missing entry point, HXCPP_WINXP_COMPAT or not: every program imported GetThreadDescription and SetThreadDescription, which those lack. They are looked up when used now, and where they are missing a thread's name is null and setting it does nothing (libhxcpp #456)
Fixed Sys.sleep, Sys.command and Sys.getch ending the process with "GCFree Zone mismatch" when called inside a GC-free zone the caller had entered, as with cpp.vm.Gc.enterGCFreeZone around a blocking call: they left that zone themselves, so the caller's own exit failed. They keep the caller's zone, as Mutex, Lock and Semaphore do. CFFI's gc_safe_point, between gc_enter_blocking and gc_exit_blocking, no longer pauses as if outside the zone, which ended the process with "Bad Allocation while collecting" or waited for ever (libhxcpp #457)
Fixed a data race in the HXCPP_GC_GENERATIONAL write barrier, which ThreadSanitizer reported when two threads stored into one old array at once: the barrier read an object's mark byte while another thread set the remembered bit in it, and the young log's count was shared the same way. Both are atomic accesses now, as cheap as before where they compile to plain loads
Fixed a cppia class that implements both a script interface and a host interface, such as haxe.Constraints.IMap, calling the wrong method or crashing: the script interface's first method that the host does not know got the slot of the host's last interface method, so both were stored in one slot. Script interface methods are numbered after the host's now (libhxcpp #462)
Fixed a thread spinning on Haxe 4's haxe.atomic.AtomicInt, as in while (flag.load() == 0) {}, stopping every collection, and so every other thread, for as long as it spun: the atomic operations were not safe points, so a collection waited for it, and it waited for a flag the collecting thread would set afterwards. They stop for a pending collection now, as Haxe 5's AtomicInt and Mutex.tryAcquire do, and so do the AtomicObject operations (libhxcpp #455)
Fixed trace, Sys.print and Sys.println stopping every thread when stdout blocked, as it does for a pipe nobody reads, a slow log reader or a Windows console with text selected: they wrote outside a GC-free zone, so the next collection on any thread waited for the blocked write, and every other thread waited for the collection. On Windows, Process.stdin.close() did the same while another thread was blocked writing to the child, and waited itself until the child exited. They write in a zone now, and stdin.close() cancels the writes in progress before it closes, as Process.close() does (libhxcpp #454)
Fixed a finalizer set with cpp.vm.Gc.setFinalizer that takes a Mutex ending the process with "Bad Allocation while collecting - from finalizer?", even with the lock free: finalizers run on the collecting thread inside the collection, and Mutex's uncontended path stopped there for the collection as if it were another thread. The collecting thread passes that stop now, so a finalizer can take a Mutex, as with stock hxcpp. A finalizer still must not allocate (libhxcpp #452)
Fixed exceptions under the cppia JIT running on past the throw, or skipping the script's catch, when they came from a native helper of the jitted code: a Dynamic field or index updated with +=, -= and the others, Dynamic + Dynamic, ++ and -- on a Dynamic, a Dynamic or host ArrayAccess index, the typed array setters and increments, Array stores, string iterators and enum construction. Some of these caught the exception and the jitted code never looked, so it ran on and, if it allocated, could free the exception before the catch got it, crashing the next call; the rest let it unwind through the jitted frames, past the script's catch to the host's, or out of the process. Each now catches, the jitted code checks after each call, and the collector keeps a caught exception until it is handled. MSVC builds now compile with -bigobj, as debug builds already did (libhxcpp #465)
Fixed three cppia array builtins writing to the wrong memory: under the JIT, a[i]++ or --a[i] whose result was used as a Float stored that result through whatever the third argument register held, corrupting the array or memory near it, and a typed push made room before running its argument, so an argument that grew the same array had the value stored past its buffer. Interpreted, a[i] = rhs and a[i] += rhs found the element before running rhs, so an rhs that grew the array stored into the old buffer, and a[a.length] = a.length stored the length after the store. The interpreter and the JIT now agree, and match the other targets (libhxcpp #463)
Fixed HXCPP_GC_MOVING, and HXCPP_GC_DEBUG_ALWAYS_MOVE without generational, corrupting live objects after a collection that ran out of blocks to move into: the block it was emptying kept, in part, the start bits of the objects it had moved out, and a stale stack word holding one of their old addresses had a later collection take the moved header for an object of 254 rows and mark rows past the block's row table, over the objects in its first rows. The start bits go as the objects move, and a moved header is never taken for an object (libhxcpp #450)