Preserve the nearbyint implementation and regression coverage while incorporating current main. The write-watch registration prerequisite is now part of main.
Validation: freshly compiled production MathExact.cpp regression passes; ASan/UBSan passes with detect_leaks=0. The same fixture compiles against main Math.cpp and fails at the FE_INEXACT assertion (exit 134). Conventions, whitespace and 235 script registrations pass. Full product build and full CTest were not rerun for this synchronization.
The per-thread retry entries are a 64-entry cache. More threads faulting in
turn on a page whose protection does not explain the fault evict each
other's entries before their next attempt, so each count restarted at 1 and
the faults were retried forever. Retries between two untraps are now also
counted in total, up to 64 times the per-thread budget.
Co-Authored-By: Claude Opus 5.5 <[email protected]>
A caller that traps the same range at every label then needs no record of
its own of which ranges are trapped, which registering memory again could
leave stale.
Co-Authored-By: Claude Opus 5.5 <[email protected]>
A fault that reaches the handler after its page was given back is retried.
The budget for that was shared by every thread faulting on the page, so the
17th delayed reader of one untrap was passed on as a crash. Each thread now
has its own budget per page and untrap, which still bounds a fault the page's
protection does not explain.
Co-Authored-By: Claude Opus 5.5 <[email protected]>
GuestWriteWatchTrapReads takes all access to the pages of a range until
the resolver set with GuestWriteWatchSetReadTrapResolver has run for it.
A fault on a trapped page waits while the resolver runs on the watch's
own thread; host writes and GuestWriteWatchProtect run it first on the
calling thread. Collections keep trapped pages inaccessible, and
registering or unregistering memory drops its traps.
Co-Authored-By: Claude Opus 5.5 <[email protected]>
libSceAgcDriver decides per 64 KiB block whether a pending storage image
keeps the CPU's bytes. A window that ran into the next block marked it
CPU-written and dropped the GPU results there (agc_storage_write_back,
agc_idle_publish_wait, array layer and depth plane tests).
Co-Authored-By: Claude Opus 5.5 <[email protected]>
A guest thread that writes a large watched range in order takes one
write-watch fault per page. Under Rosetta 2 each fault is a Mach
exception round trip. When the two pages before the faulting one were
written since the last collection, the handler now unprotects up to 32
pages from it that have the same protection and records them as
written. APS5_WRITE_WATCH_FAULT_AHEAD sets the count; 0 or 1 keeps one
page per fault.
Co-Authored-By: Claude Opus 5.5 <[email protected]>
Emscripten targets wasm64 without x86 assembly, Linux-only headers or the
x87 long double. These changes add __EMSCRIPTEN__ paths beside the host
ones; native builds compile the same code as before.
- libc: long doubles in guest varargs and scanf go through
GuestLongDouble, a plain copy where long double is the x87 format;
APS5_EXPORT emits no assembler alias; the guest arena is one aligned
allocation that zeroes pages when they are committed again; getifaddrs
keeps its link-level entries on Linux; /proc lookups and the host
stderr duplicate are left out.
- libkernel: file-backed mmap, EVFILT_VNODE watches, getcontext and
setcontext throw; getdents replaces the raw getdents64 syscall;
getdtablesize takes the resource limit alone.
- VideoOut leaves SDL, the display window and the HDR probe out,
Sysmodule asks libkernel for unwind information and Net includes
sys/time.h.