[njs] Moving ctor from njs_vmcode_t to corresponding structure.
Dmitry Volyntsev
xeioex at nginx.com
Mon Jul 29 14:33:32 UTC 2019
details: https://hg.nginx.org/njs/rev/44d40e75aadf
branches:
changeset: 1084:44d40e75aadf
user: hongzhidao <hongzhidao at gmail.com>
date: Sun Jul 28 02:26:23 2019 -0400
description:
Moving ctor from njs_vmcode_t to corresponding structure.
diffstat:
njs/njs_disassembler.c | 6 +++---
njs/njs_generator.c | 6 +++---
njs/njs_vmcode.c | 6 +++---
njs/njs_vmcode.h | 4 +++-
4 files changed, 12 insertions(+), 10 deletions(-)
diffs (125 lines):
diff -r 57a50d1ad5cc -r 44d40e75aadf njs/njs_disassembler.c
--- a/njs/njs_disassembler.c Fri Jul 26 23:01:38 2019 -0400
+++ b/njs/njs_disassembler.c Sun Jul 28 02:26:23 2019 -0400
@@ -196,7 +196,7 @@ njs_disassemble(u_char *start, u_char *e
nxt_printf("%05uz ARRAY %04Xz %uz%s\n",
p - start, (size_t) array->retval,
- (size_t) array->length, array->code.ctor ? " INIT" : "");
+ (size_t) array->length, array->ctor ? " INIT" : "");
p += sizeof(njs_vmcode_array_t);
@@ -282,7 +282,7 @@ njs_disassemble(u_char *start, u_char *e
nxt_printf("%05uz FUNCTION FRAME %04Xz %uz%s\n",
p - start, (size_t) function->name, function->nargs,
- function->code.ctor ? " CTOR" : "");
+ function->ctor ? " CTOR" : "");
p += sizeof(njs_vmcode_function_frame_t);
@@ -295,7 +295,7 @@ njs_disassemble(u_char *start, u_char *e
nxt_printf("%05uz METHOD FRAME %04Xz %04Xz %uz%s\n",
p - start, (size_t) method->object,
(size_t) method->method, method->nargs,
- method->code.ctor ? " CTOR" : "");
+ method->ctor ? " CTOR" : "");
p += sizeof(njs_vmcode_method_frame_t);
continue;
diff -r 57a50d1ad5cc -r 44d40e75aadf njs/njs_generator.c
--- a/njs/njs_generator.c Fri Jul 26 23:01:38 2019 -0400
+++ b/njs/njs_generator.c Sun Jul 28 02:26:23 2019 -0400
@@ -1907,7 +1907,7 @@ njs_generate_array(njs_vm_t *vm, njs_gen
njs_generate_code(generator, njs_vmcode_array_t, array,
NJS_VMCODE_ARRAY, 1, 1);
- array->code.ctor = node->ctor;
+ array->ctor = node->ctor;
array->retval = node->index;
array->length = node->u.length;
@@ -2605,7 +2605,7 @@ njs_generate_function_call(njs_vm_t *vm,
njs_generate_code(generator, njs_vmcode_function_frame_t, func,
NJS_VMCODE_FUNCTION_FRAME, 2, 0);
func_offset = njs_code_offset(generator, func);
- func->code.ctor = node->ctor;
+ func->ctor = node->ctor;
func->name = name->index;
ret = njs_generate_call(vm, generator, node);
@@ -2649,7 +2649,7 @@ njs_generate_method_call(njs_vm_t *vm, n
njs_generate_code(generator, njs_vmcode_method_frame_t, method,
NJS_VMCODE_METHOD_FRAME, 3, 0);
method_offset = njs_code_offset(generator, method);
- method->code.ctor = node->ctor;
+ method->ctor = node->ctor;
method->object = prop->left->index;
method->method = prop->right->index;
diff -r 57a50d1ad5cc -r 44d40e75aadf njs/njs_vmcode.c
--- a/njs/njs_vmcode.c Fri Jul 26 23:01:38 2019 -0400
+++ b/njs/njs_vmcode.c Sun Jul 28 02:26:23 2019 -0400
@@ -681,7 +681,7 @@ next:
ret = njs_function_frame_create(vm, value1,
&njs_value_undefined,
(uintptr_t) value2,
- function_frame->code.ctor);
+ function_frame->ctor);
if (nxt_slow_path(ret != NXT_OK)) {
goto error;
@@ -901,7 +901,7 @@ njs_vmcode_array(njs_vm_t *vm, u_char *p
if (nxt_fast_path(array != NULL)) {
- if (code->code.ctor) {
+ if (code->ctor) {
/* Array of the form [,,,], [1,,]. */
value = array->start;
length = array->length;
@@ -1808,7 +1808,7 @@ njs_vmcode_method_frame(njs_vm_t *vm, nj
}
ret = njs_function_frame_create(vm, value, object, method->nargs,
- method->code.ctor);
+ method->ctor);
if (nxt_fast_path(ret == NXT_OK)) {
return sizeof(njs_vmcode_method_frame_t);
diff -r 57a50d1ad5cc -r 44d40e75aadf njs/njs_vmcode.h
--- a/njs/njs_vmcode.h Fri Jul 26 23:01:38 2019 -0400
+++ b/njs/njs_vmcode.h Sun Jul 28 02:26:23 2019 -0400
@@ -120,7 +120,6 @@ typedef struct {
njs_vmcode_operation_t operation;
uint8_t operands; /* 2 bits */
uint8_t retval; /* 1 bit */
- uint8_t ctor; /* 1 bit */
} njs_vmcode_t;
@@ -182,6 +181,7 @@ typedef struct {
njs_vmcode_t code;
njs_index_t retval;
uintptr_t length;
+ uint8_t ctor; /* 1 bit */
} njs_vmcode_array_t;
@@ -286,6 +286,7 @@ typedef struct {
njs_vmcode_t code;
njs_index_t nargs;
njs_index_t name;
+ uint8_t ctor; /* 1 bit */
} njs_vmcode_function_frame_t;
@@ -294,6 +295,7 @@ typedef struct {
njs_index_t nargs;
njs_index_t object;
njs_index_t method;
+ uint8_t ctor; /* 1 bit */
} njs_vmcode_method_frame_t;
More information about the nginx-devel
mailing list