]> git.kaiwu.me - njs.git/commit
Generator: bound value preservation analysis
authorDmitry Volyntsev <xeioex@nginx.com>
Fri, 4 Sep 2026 01:09:17 +0000 (18:09 -0700)
committerDmitry Volyntsev <xeioexception@gmail.com>
Thu, 10 Sep 2026 03:11:04 +0000 (20:11 -0700)
commitc837f4c511c014131dd47626c59231cbd6b7910b
treedf6b1ec1f6bcc6092d599c6a760329bbb50ad1e2
parentfd54d52de55754dc50c2e544c9dd6e81b5fba2f4
Generator: bound value preservation analysis

Value-preservation analysis recursively examines the upcoming expression before
the generator decides whether mutable-slot operands need temporary copies.
Deeply nested binary expressions and arrays could therefore exhaust the native
stack.

Move the generator-specific predicate out of the parser API and limit its
recursive walk to 128 levels.  At the limit, conservatively require
preservation: an extra move is safe, whereas missing a deeper side effect can
change evaluation semantics.
src/njs_generator.c
src/njs_parser.c
src/njs_parser.h
src/test/njs_unit_test.c