]> git.kaiwu.me - njs.git/commit
Code generator refactored.
authorDmitry Volyntsev <xeioex@nginx.com>
Fri, 7 Dec 2018 14:11:33 +0000 (17:11 +0300)
committerDmitry Volyntsev <xeioex@nginx.com>
Fri, 7 Dec 2018 14:11:33 +0000 (17:11 +0300)
commit55ad9032ba5d2c827bb4ebed234dd4f992a11726
treed6331b84fe6fb3b83050dac205923cdde6645f35
parentd21df8520e8b10c03d1daa6350c065df9d314db2
Code generator refactored.

Previously, the code size had to be calculated before code generation
phase because raw pointers to instruction were used to determine proper
jump offsets. It introduced unnecessary coupling between parser and
generator as well as complicated the parser because it had to know in
advance what instructions will be generated.

The solution is the dynamic reallocation of the code during generation
phase and the usage of relative offsets when calculating jump instructions.
njs/njs_core.h
njs/njs_generator.c
njs/njs_generator.h [new file with mode: 0644]
njs/njs_parser.c
njs/njs_parser.h
njs/njs_parser_expression.c