details: https://hg.nginx.org/njs/rev/294b69d82ea4 branches: changeset: 2080:294b69d82ea4 user: Dmitry Volyntsev <xei...@nginx.com> date: Tue Apr 04 22:19:48 2023 -0700 description: VM: removed vm->variables_hash.
diffstat: src/njs_builtin.c | 4 ++-- src/njs_shell.c | 7 ++++--- src/njs_vm.c | 1 - src/njs_vm.h | 1 - 4 files changed, 6 insertions(+), 7 deletions(-) diffs (67 lines): diff -r b2cacf654542 -r 294b69d82ea4 src/njs_builtin.c --- a/src/njs_builtin.c Tue Apr 04 22:17:26 2023 -0700 +++ b/src/njs_builtin.c Tue Apr 04 22:19:48 2023 -0700 @@ -588,7 +588,7 @@ njs_vm_expression_completions(njs_vm_t * var_node.key = (uintptr_t) lhq.value; - node = njs_rbtree_find(vm->variables_hash, &var_node.node); + node = njs_rbtree_find(&vm->global_scope->variables, &var_node.node); if (njs_slow_path(node == NULL)) { return NULL; } @@ -1018,7 +1018,7 @@ njs_global_this_prop_handler(njs_vm_t *v var_node.key = (uintptr_t) lhq.value; - rb_node = njs_rbtree_find(vm->variables_hash, &var_node.node); + rb_node = njs_rbtree_find(&vm->global_scope->variables, &var_node.node); if (rb_node == NULL) { return NJS_DECLINED; } diff -r b2cacf654542 -r 294b69d82ea4 src/njs_shell.c --- a/src/njs_shell.c Tue Apr 04 22:17:26 2023 -0700 +++ b/src/njs_shell.c Tue Apr 04 22:19:48 2023 -0700 @@ -1205,8 +1205,8 @@ njs_completion_generator(const char *tex cmpl->length = njs_strlen(text); cmpl->suffix_completions = NULL; - if (vm->variables_hash != NULL) { - cmpl->node = njs_rbtree_min(vm->variables_hash); + if (vm->global_scope != NULL) { + cmpl->node = njs_rbtree_min(&vm->global_scope->variables); } } @@ -1214,7 +1214,8 @@ next: switch (cmpl->phase) { case NJS_COMPLETION_VAR: - variables = vm->variables_hash; + variables = (vm->global_scope != NULL) ? &vm->global_scope->variables + : NULL; if (variables == NULL) { njs_next_phase(cmpl); diff -r b2cacf654542 -r 294b69d82ea4 src/njs_vm.c --- a/src/njs_vm.c Tue Apr 04 22:17:26 2023 -0700 +++ b/src/njs_vm.c Tue Apr 04 22:19:48 2023 -0700 @@ -228,7 +228,6 @@ njs_vm_compile(njs_vm_t *vm, u_char **st njs_scope_value_set(vm, njs_scope_global_this_index(), &vm->global_value); vm->start = generator.code_start; - vm->variables_hash = &scope->variables; vm->global_scope = scope; if (vm->options.disassemble) { diff -r b2cacf654542 -r 294b69d82ea4 src/njs_vm.h --- a/src/njs_vm.h Tue Apr 04 22:17:26 2023 -0700 +++ b/src/njs_vm.h Tue Apr 04 22:19:48 2023 -0700 @@ -132,7 +132,6 @@ struct njs_vm_s { njs_native_frame_t *top_frame; njs_frame_t *active_frame; - njs_rbtree_t *variables_hash; njs_lvlhsh_t keywords_hash; njs_lvlhsh_t values_hash; _______________________________________________ nginx-devel mailing list nginx-devel@nginx.org https://mailman.nginx.org/mailman/listinfo/nginx-devel