Repository navigation
Compile and serve a Symfony app natively: ownership/inference fixes, leak fixes, reflection and dispatch gaps - #165
Merged
Merged
Conversation
…depth A nested try/finally inside a finally reused the outer finally's depth index and took over its deferred return, failing the ownership flow with 'edge never reached its target' (symfony Dotenv::loadEnv).
…ays (#156) - an erased foreach value bound to a name the function stores a cell into anywhere is a cell, not only when the loop body does - an alias of an erased array parameter beside a concrete array store joins the erased release class - the key of an erased-element vec is a cell, as InferNodes types it
…ds (#156, #157, #160) - a property typed from a stored array no longer inherits that value's docblock shape, so a child's wider shape can read its own keys - a closure beside a scalar at a merge boxes like any other tag-carried kind - an instanceof-narrowed arm that never stores the local keeps its entry representation for the merge, and a box-back pair is not taken back while the arm's slot disagrees with the other arm Fixes #157, Fixes #160
… into a bare-array param (#161)
…e loop's reset, so a hidden local does not flip the per-iteration verdict
…eset reclaims it and a hidden local flips the reset verdict
…o a fresh receiver takes the shared name chain
…ing else reclaims the string (cmp_minted_string_cell_no_leak)
…l too; log the function and operand kinds in MANTICORE_DYNM_TRACE
…e spread unsafe-name set to the call site (#168 repro)
…roperty without its set hook (Symfony Request::setProperty)
…et hook's typed parameter (Fixes #169)
…embers derivable from existing metadata; by-ref parameter bit; interfaces ride along with a reflected class
… and properties (compiler-synthesized per-class table, gated on the program asking)
…e class that uses that trait
… or polymorphic operand
…expression position
…ction_exists('apcu_fetch') is now false
…t, not proof for the return/argument check
… when typing a property's elements
…s TypeError at the call site instead of failing the build php checks a parameter type when the call is made, so a call that cannot succeed (an inherited new static cloned per subclass, a branch behind a feature guard) is a run-time TypeError, not a compile error. The last argument becomes true ? throw new TypeError(...) : arg, so earlier arguments evaluate first, and a build-time warning stays. analyze (collect mode) and bin/build (which exports MANTICORE_TYPECHECK_STRICT) keep it an error, so the tree compiling itself and the analyzer report every such site. Memory-safety checks (array repr, shape) stay fatal.
…of per arm, ending the O(N^2) unwind-pad blowup
…pread into one array so the site takes the shared dispatch instead of a per-candidate inline chain
… and passes the call's arguments to the constructor
…ere read as plain values, so the caller never saw the out param). Fixes #177
… classes, ending its O(classes x methods x params) inline dispatch
…oup instead of one call per class
…receiver; count freed shells in the collector's productivity
… a 256-entry map per call; method_exists/is_a/property_exists runtime tables: sorted rows + binary search
…g translates); filter_var: integer fast path and no regex for FILTER_VALIDATE_INT
…a real leak is orders of magnitude above
…y app failed to link: DSO missing from command line)
…needed it, the first request answered 500
…t is an Iterator or an IteratorAggregate: rewind() was called on an aggregate, writing through another class's layout
…e aggregate inside a generator
…fony's ReflectionClassResource hashes a class through them, so a cold prod cache answered 500
…g parameter through __toString: stdlib bodies reach the program's dispatcher via the hook (the stdlib has no arm for a user class), every __toString class gets an arm, builtins get the cast (Fixes #269)
…ps attribute rows for constants (#244); a cold prod cache hashes every class through it
…nference # Conflicts: # docs/builtins.md # src/Compile/Mir/Passes/LowerFromAst.php # src/Runtime/Stdlib/VarExtra.php
… statement end: the emitter releases it right after the call, so its destructor runs before the echo as in php (regressed by b0a5867)
… is stripped before the entry copy, and a bare ?array param promoted to a cell boxes its raw null as NULL, not int 0 ($a ??= $_SERVER['argv'])
… a by-reference cell parameter accept a cell-element array local (scratch cell, unboxed after the call), Exception/Error declare a reflectable private $trace; skip CI pushes that only touch examples/symfony-*
… native binary, with the build steps and the differences from a stock skeleton
…w declares $trace like php, so the exact property count of a Throwable cast is not a stable expectation
…d a cell starts as a Borrow, so the else edge no longer drops the caller's array; drop the duplicate discardedIncDec left by a merge
…nds to a block with an if, and the else arm inherited the then arm's ownership state, so the callee dropped the caller's array (musl abort)
blacktrs
added a commit
that referenced
this pull request
Oct 16, 2026
…ogress, COMPILER_VERSION (#286) * Add CLI golden test: pin command behaviour before the restructure * Fix CLI golden test exit-code capture and compile+run probe * Add Cli\Command contract, declared options and generated help; migrate version * Move dump-* and split-ir into Cli\Commands * Move analyze into Cli\Commands * Move build into Cli\Commands * Move compile into Cli\Commands; drop compile_arg_spec * Remove the legacy closure command path; document the Command contract * Fix stale compile driver pointer; correct build --no-analyze help * install.sh: strict mode, --check, staged atomic swap with rollback; ship it as share/install.sh * install.sh: strict exit 5 on post-swap failure, never source-build in strict mode, rollback only own swap * Add manticore upgrade (--check, --version) over the shipped install.sh * Document manticore upgrade * Harden upgrade rollback and staging; fix upgrade docs placement; add tag/version CI check * Restore the bin/build 'atomically swaps in' wording in docs/modules.md * Extract Cli\Install from upgrade; add version --check and Cli::registry() * Add manticore doctor * Add manticore completions (bash, zsh, fish); document doctor and completions * Add COMPILER_VERSION as the single version source; bin/build generates Version.php * Enforce COMPILER_VERSION in CI and release * Add build progress: Compile\Progress, Cli\Style, --progress/--quiet/--timings/--color * Fix progress option error wording; harden truncation and progress tests * Announce stage starts and counters for the live progress line * Report clang n/N for split builds; fix nested live stage; document progress options * Harden split progress: liveness check, cache-free tests, README order * Pair stage begin/end names; keep live progress clean under stats; refresh stale profiler text * Make the live/stats progress tests real * Re-baseline CLI golden IR/MIR checksums after merging main (#165 codegen changes) * Document the CLI: command reference page, bootstrap versions, roadmap * Trim README build-progress to a pointer at docs/cli.md
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.
What
Takes the Symfony skeleton (
symfony-app) from "fails in EmitLlvm" to a compiledbinary that serves
/(200) and an HTML 404 underHttp\Server, with no leak onthe request path and a markedly faster hot path. Refs #156 #157 #160; fixes #153
#157 #160 #164 #169 #177 #181 #182 #185 #190 #191 #192 #198 #199 #202 #208 #232
#239 #246.
Changes
Ownership / inference — a slot no longer holds a cell word and a raw pointer at
once; foreach bindings, erased arrays, by-ref params, closures' captured arrays and
finallydeferred jumps agree between flow and inference;SpillFreshBasesnow alsoowns fresh object arguments of may-throw calls so cleanup pads drop them on unwind.
Leaks on the request path (404 growth 1.7 KB → ~60 B per request)
+,[...$a]and__mir_cell_to_bagretained a key string twice;array_pop/array_shiftresults used as arguments, in-place invoked closureenvs, closure by-ref cell params,
(array)$objresults were never released;Dispatch and codegen —
$c::$m(...)and dynamicnewshare helpers (IR −34%);erased-receiver return joins; static/callable-array invoke;
extract()andincluded templates; fiber-local backtrace segments (was the 404 slowdown); EINTR in
io_poll.Reflection / stdlib — Stringable objects bound to string parameters of builtins and the stdlib
render through
__toString(#269); Reflection__toString(method, property), modifier constants, lazy-objectand reference APIs,
ReflectionClass('Closure');class_parents/implementsofinterfaces; DATE_* and CASE_* constants;
hash_initalgos; named groups inpreg_replace_callback;(*MARK); typed-argument TypeError at the call site.Performance (
GET /, macOS, prod,wrk): 1 worker 8.9k → 15.8k rps, 8 workers56k → 83k rps. On Linux (Docker VM) 14k rps per worker and ~100k on 8.
strtrbyte form is a native builtin (it built a 256-entry table per call);method_exists/is_a/property_existswith runtime names use sorted tables andbinary search (was a linear
strcasecmpscan);filter_var: integer fast path, no regex forFILTER_VALIDATE_INT;array_key_existsis O(1); intswitchlowers to one LLVMswitch.Verification
fresh_temp_builtin_arg_destructs_late, red before thelater work on this branch).
4bebb13b2082 pass / 4 fail (the same caseplus three new leak tests whose RSS thresholds were too tight for Linux; loosened, re-run green). Later
commits were re-checked with targeted runs only.
wrkinside):/14.0k rps on 1 worker, 54.8k on 4,101k on 8 (113.9k at 128 connections); stable workers, 200 on the first request with an empty
var/cache.Found and fixed there: manifest builds did not link
-lm;foreachover aTraversable-typedIteratorAggregate called
rewind()through another class's layout (heap corruption on glibc).Not verified
tools/difftest.sh,tools/selfhost_fixpoint.shand the amd64 Linux gate werenot run on this branch.
Closure::binddoes not co-own the new$this(Closure::bind does not co-own the new $this: it is freed with the last outside owner. #262) — fresh object arguments ofbind/bindTo/callare deliberately not spilled until that is fixed.ReflectionClassConstant::getAttributes()answers none until the compiler keeps attribute rows forconstants (ReflectionClassConstant::getAttributes() is missing (Call to undefined method); symfony's ReflectionClassResource calls it. #244).
objects into the prelude).