Repository navigation
Conversation
A 32-bit host cannot reserve the 8 GiB corpus or 2 GiB per worker stack: the binary stops at "reservation failed". There the corpus is 1 GiB and a stack 64 MiB; a 64-bit host is unchanged. The corpus hints above 4 GiB truncate to NULL and are refused, so corpus_map needs no change. Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01NeFHfjcD91QfgepK9AbuXt
read_at and write_at keep their U32 offset in an intptr_t, which a 32-bit host sign-extends past 2^31: zero-extend it. File.read and TCP.recv allocate max bytes up front, which only a 64-bit address space affords: on a 32-bit host a read grows its buffer from 64 KiB and a recv fills at most 16 MiB. A 64-bit host takes the same paths as before. Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01NeFHfjcD91QfgepK9AbuXt
64-bit file offsets and clocks, where the C library has both sizes, and no warning for preserve_none on a target without it (the segments then use the default convention, still under musttail). Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01NeFHfjcD91QfgepK9AbuXt
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
TLDR: I well know that this change has little chance being included, yet it might serve others in need of an off the shelf 32 bit version.
The rest has been made by Claude Fable 5.2.
A binary built by
bend main.bend -o mainfor a 32-bit Linux target stops atbend: reservation failed: the runtime reserves an 8 GiB corpus and 2 GiB perworker stack. These three commits make it run there. A 64-bit host takes the
same paths as before.
What changes
comp.ts): on a 32-bit host the corpus is 1 GiB and a stack64 MiB.
effs/):read_atandwrite_atzero-extend their U32offset, which an
intptr_tsign-extended past 2^31.File.readgrows itsbuffer from 64 KiB instead of allocating
maxbytes up front, andTCP.recvfills 16 MiB at most.main.ts):-D_FILE_OFFSET_BITS=64 -D_TIME_BITS=64, and-Wno-ignored-attributesforpreserve_noneon a target without it.35 lines added, 12 removed. No new file, no change to
bend.ts.Why
A Raspberry Pi 2 experiment with a Bend program. Through the JS target it takes
11.05 ms of processor per frame and 68 MiB; through the C target, with this change,
5.34 ms and 2 MiB.
Tested
On a Raspberry Pi 2 Model B (ARMv7, 902 MiB, glibc 2.44), cross-compiled with
clang 22, the commits applied on 0e2f38f:
tests/(compile to C, build, run, comparewith the
#|lines): 1 866 files, 897 pass, 953 not run by the C lane,12 need X11 or ALSA, 4 fail. The four are below.
target's, for three sets of options (one does FFTs in F32).
On x86-64 (clang 18), the commits rebased on 6180be5, same script: 904 pass,
1 fails (
io_tcp_text_residue).Not tested, and limits
tests/iofail on the Pi and were not investigated:io_process_run(it also runs/usr/bin/perl, absent there),io_tcp_text_residue(fails on x86-64 too),io_tcp_send_slow_peer(out of time) and
io_file_write_at_control(it interposespwrite; with64-bit file offsets the runtime calls
pwrite64, which is probably why).runs on the Pi are on 0e2f38f.
32-bit x86 does not build: clang 22 crashes on it.
gates/repo.tsneeds ttok, which I could not run:the change adds a few lines to
comp.tsandmain.ts, and I do not knowhow close they are to their caps.
recursion faults at 64 MiB of stack instead of 2 GiB.