Welcome! Log In Create A New Profile

Advanced

[njs] Introduced njs_vm_invoke().

Dmitry Volyntsev
February 03, 2019 04:42AM
details: https://hg.nginx.org/njs/rev/d57755edf40b
branches:
changeset: 753:d57755edf40b
user: hongzhidao <hongzhidao@gmail.com>
date: Sat Feb 02 16:01:39 2019 +0800
description:
Introduced njs_vm_invoke().

diffstat:

njs/njs.c | 19 ++++++++++++++++---
1 files changed, 16 insertions(+), 3 deletions(-)

diffs (46 lines):

diff -r 596d26bb5fea -r d57755edf40b njs/njs.c
--- a/njs/njs.c Sat Feb 02 14:21:26 2019 +0800
+++ b/njs/njs.c Sat Feb 02 16:01:39 2019 +0800
@@ -10,6 +10,8 @@


static nxt_int_t njs_vm_init(njs_vm_t *vm);
+static nxt_int_t njs_vm_invoke(njs_vm_t *vm, njs_function_t *function,
+ const njs_value_t *args, nxt_uint_t nargs, njs_index_t retval);
static nxt_int_t njs_vm_handle_events(njs_vm_t *vm);


@@ -455,6 +457,14 @@ nxt_int_t
njs_vm_call(njs_vm_t *vm, njs_function_t *function, const njs_value_t *args,
nxt_uint_t nargs)
{
+ return njs_vm_invoke(vm, function, args, nargs, NJS_INDEX_GLOBAL_RETVAL);
+}
+
+
+static nxt_int_t
+njs_vm_invoke(njs_vm_t *vm, njs_function_t *function, const njs_value_t *args,
+ nxt_uint_t nargs, njs_index_t retval)
+{
u_char *current;
njs_ret_t ret;
njs_value_t *this;
@@ -465,12 +475,15 @@ njs_vm_call(njs_vm_t *vm, njs_function_t

vm->current = (u_char *) njs_continuation_nexus;

- ret = njs_function_activate(vm, function, this, args, nargs,
- NJS_INDEX_GLOBAL_RETVAL,
+ ret = njs_function_activate(vm, function, this, args, nargs, retval,
sizeof(njs_vmcode_generic_t));

if (nxt_fast_path(ret == NJS_APPLIED)) {
- ret = njs_vm_start(vm);
+ ret = njs_vmcode_interpreter(vm);
+
+ if (ret == NJS_STOP) {
+ ret = NXT_OK;
+ }
}

vm->current = current;
_______________________________________________
nginx-devel mailing list
nginx-devel@nginx.org
http://mailman.nginx.org/mailman/listinfo/nginx-devel
Subject Author Views Posted

[njs] Introduced njs_vm_invoke().

Dmitry Volyntsev 60 February 03, 2019 04:42AM



Sorry, you do not have permission to post/reply in this forum.

Online Users

Guests: 73
Record Number of Users: 6 on February 13, 2018
Record Number of Guests: 421 on December 02, 2018
Powered by nginx      Powered by FreeBSD      PHP Powered      Powered by MariaDB      ipv6 ready