aboutsummaryrefslogtreecommitdiff
path: root/src/compiler/analyzer.zc
Commit message (Collapse)AuthorAgeFilesLines
* lsp: borrow errors ranged on the use, with related information for where the ↵Gravatar zinc 12 days1-1/+2
| | | | owner ended and was declared; vscode client passes relatedInformation through
* analyzer: check borrow returns of forward-called functions at the unit's ↵Gravatar zinc 12 days1-0/+48
| | | | end; borrows clause for prototypes, definitions, externs and function types, checked against the body
* analyzer: use-after-end messages name the borrower, the owner and how the ↵Gravatar zinc 12 days1-9/+22
| | | | owner ended (freed, moved, .d parameter, push, global, reassignment), with fixtures
* x86-64 jit: inline new_k, recycle_leaf and own fast paths, in o3 regions and ↵Gravatar zinc 13 days1-2/+2
| | | | | | | | | | | | | | plain blocks a call to rt.new_k / rt.recycle_leaf with a constant class, or to rt.own, does its class-list pop or push (or owner store) inline and goes on after the call; an empty list, memdebug, a held range, a block outside memory, a translated word or a type/class mismatch takes the ordinary call. in a region this replaces the o3_invoke round trip. o3 frees of leaf objects now use recycle_leaf too (new_k stamps the type inside o3 since b86db60). ZYNOFASTALLOC=1 turns it off; ZYPERFMAP=1 writes a perf map of translated code. tests/programs/o3_freelist.zc: reuse, zeroing, an empty list, untyped neighbours, memdebug; jit vs ZYNOFASTALLOC vs ZYO3INTERP.
* prover: do not restore length facts after a call-loopGravatar zinc 13 days1-6/+6
| | | | | | | Restoring undirtied lafacts when the body might free was wrong: push can grow an array without dirtying its name, so a[99] after push warned against a stale length 0. Keep the old lafact_keep rule; reorder explain_prover so the constant/affine cases run before the touch() loops.
* prover: len/cross-array/fixed-new/affine proofs; keep facts past call loopsGravatar zinc 13 days1-19/+27
| | | | | | | | Rebased the prover WIP onto main. lafact_keep restores undirtied allocation facts even when the loop body might free (so a later touch() no longer drops every length fact). proven_p uses ptr_still so an outer call keeps the check. entry_fact still supplies the size for the "might free" explain reason. bounds_prover.zc and explain_prover.zc land with test.sh coverage.
* wip: prover gaps (inline len bound, cross-array, rt.new depth, fixed new, ↵Gravatar zinc 13 days1-34/+92
| | | | affine i*n+k); unbuilt and untested
* destructors: reassigning an m owner that still holds a value frees the old ↵Gravatar zinc 13 days1-2/+33
| | | | value first, running its drop (right side first, then the free, then the store), with hint: x: reassigning frees the old value; a new value that is part of the old one is an error; u, d and captured owners keep the leak error; the new value's size, leaf type and drop are recorded like a declaration's; spec 6.8.5, 6.15.2
* destructors: heap(v), drop(v, f) / v.drop(f) / v.drop = f, struct drop ↵Gravatar zinc 13 days1-1/+4
| | | | methods, collector drops after the sweep (once, resurrection), freed blocks forget their drop, temporaries drop at statement end with a hint, actor send check; o3: no collection inside a region (pending until the outermost exit), no drops set or ended inside o3; spec 3.11.6, 4.10.3-4, 6.15
* detach doc comments on internal bounds helpers (genome size); todo: reuse ↵Gravatar zinc 13 days1-0/+19
| | | | capture_scan in the body scanner
* explain-checks: the record writer moves to src/lib/explain.zc, embedded and ↵Gravatar zinc 13 days1-53/+10
| | | | compiled only in that mode; the genome keeps the call sites and a hook
* bounds: body scan, loop-entry hoisting, pointer proofs from requested size, ↵Gravatar zinc 13 days1-0/+328
| | | | --explain-checks v1 (non-o3 code)
* bounds checking: port agent/bounds-checking onto main 0879d0a; unbounded ↵Gravatar zinc 13 days1-0/+20
| | | | main in o3call, o3 tests expect no check, boundsrules, bounds_fixed, bounds_heap and zc0unbounded tests
* zc: add the defer statementGravatar zinc 13 days1-0/+1
| | | | | | | | | | | | defer expr; and defer { ... } register code that runs when the enclosing block ends: at the end of the block, and at return, break and continue that leave it. the tokens are kept at the defer and compiled again at each exit (block_close, body, kw_return, kw_break, kw_continue), newest first, before the block's variables are released, so the analyzer sees a deferred rt.free(p) as the transfer of p where it runs. names mean what they meant at the defer; values are read when it runs. return, break and continue inside a deferred statement are errors, reported once. works in unchecked code and closures (own base per function context).
* split compiler.zc into files by phaseGravatar zinc 13 days1-0/+1236
src/compiler/compiler.zc is now twelve files under src/compiler/, listed in order in src/compiler/parts. cat of the parts in order is byte-identical to the old file, so every compiler and image except the language server's is unchanged. no function was edited. consumers read the list: the makefile, bootstrap-check, genmap (which still writes one compiler.zc into a generated map directory), tinyvm.bat, test.sh, test_win.ps1 and the lsp drivers. the language server embeds each part and serves them joined as the one document tinyvm:/compiler.zc.