[njs] VM: removed unused NJS_VMCODE_OBJECT_COPY instruction.

Dmitry Volyntsev xeioex at nginx.com
Thu Apr 13 01:28:44 UTC 2023


details:   https://hg.nginx.org/njs/rev/b2bd614ce046
branches:  
changeset: 2086:b2bd614ce046
user:      Dmitry Volyntsev <xeioex at nginx.com>
date:      Wed Apr 12 18:26:40 2023 -0700
description:
VM: removed unused NJS_VMCODE_OBJECT_COPY instruction.

diffstat:

 src/njs_disassembler.c |   2 -
 src/njs_vmcode.c       |  56 --------------------------------------------------
 src/njs_vmcode.h       |   1 -
 3 files changed, 0 insertions(+), 59 deletions(-)

diffs (110 lines):

diff -r 29ddc56f7aa5 -r b2bd614ce046 src/njs_disassembler.c
--- a/src/njs_disassembler.c	Mon Apr 10 23:06:34 2023 -0700
+++ b/src/njs_disassembler.c	Wed Apr 12 18:26:40 2023 -0700
@@ -29,8 +29,6 @@ static njs_code_name_t  code_names[] = {
           njs_str("REGEXP          ") },
     { NJS_VMCODE_TEMPLATE_LITERAL, sizeof(njs_vmcode_template_literal_t),
           njs_str("TEMPLATE LITERAL") },
-    { NJS_VMCODE_OBJECT_COPY, sizeof(njs_vmcode_object_copy_t),
-          njs_str("OBJECT COPY     ") },
 
     { NJS_VMCODE_FUNCTION_COPY, sizeof(njs_vmcode_function_copy_t),
           njs_str("FUNCTION COPY   ") },
diff -r 29ddc56f7aa5 -r b2bd614ce046 src/njs_vmcode.c
--- a/src/njs_vmcode.c	Mon Apr 10 23:06:34 2023 -0700
+++ b/src/njs_vmcode.c	Wed Apr 12 18:26:40 2023 -0700
@@ -20,8 +20,6 @@ static njs_jump_off_t njs_vmcode_argumen
 static njs_jump_off_t njs_vmcode_regexp(njs_vm_t *vm, u_char *pc);
 static njs_jump_off_t njs_vmcode_template_literal(njs_vm_t *vm,
     njs_value_t *inlvd1, njs_value_t *inlvd2);
-static njs_jump_off_t njs_vmcode_object_copy(njs_vm_t *vm, njs_value_t *value,
-    njs_value_t *invld);
 static njs_jump_off_t njs_vmcode_function_copy(njs_vm_t *vm, njs_value_t *value,
     njs_index_t retval);
 
@@ -206,7 +204,6 @@ njs_vmcode_interpreter(njs_vm_t *vm, u_c
         NJS_GOTO_ROW(NJS_VMCODE_LEFT_SHIFT),
         NJS_GOTO_ROW(NJS_VMCODE_RIGHT_SHIFT),
         NJS_GOTO_ROW(NJS_VMCODE_UNSIGNED_RIGHT_SHIFT),
-        NJS_GOTO_ROW(NJS_VMCODE_OBJECT_COPY),
         NJS_GOTO_ROW(NJS_VMCODE_TEMPLATE_LITERAL),
         NJS_GOTO_ROW(NJS_VMCODE_PROPERTY_IN),
         NJS_GOTO_ROW(NJS_VMCODE_PROPERTY_DELETE),
@@ -874,23 +871,6 @@ NEXT_LBL;
         njs_set_uint32(retval, njs_number_to_uint32(num) >> u32);
         NEXT;
 
-    CASE (NJS_VMCODE_OBJECT_COPY):
-        njs_vmcode_debug_opcode();
-
-        njs_vmcode_operand(vm, vmcode->operand2, value1);
-
-        ret = njs_vmcode_object_copy(vm, value1, NULL);
-
-        if (njs_slow_path(ret < 0 && ret >= NJS_PREEMPT)) {
-            goto error;
-        }
-
-        njs_vmcode_operand(vm, vmcode->operand1, retval);
-        njs_release(vm, retval);
-        *retval = vm->retval;
-
-        BREAK;
-
     CASE (NJS_VMCODE_TEMPLATE_LITERAL):
         njs_vmcode_debug_opcode();
 
@@ -2042,42 +2022,6 @@ njs_vmcode_template_literal(njs_vm_t *vm
 
 
 static njs_jump_off_t
-njs_vmcode_object_copy(njs_vm_t *vm, njs_value_t *value, njs_value_t *invld)
-{
-    njs_object_t    *object;
-    njs_function_t  *function;
-
-    switch (value->type) {
-
-    case NJS_OBJECT:
-        object = njs_object_value_copy(vm, value);
-        if (njs_slow_path(object == NULL)) {
-            return NJS_ERROR;
-        }
-
-        break;
-
-    case NJS_FUNCTION:
-        function = njs_function_value_copy(vm, value);
-        if (njs_slow_path(function == NULL)) {
-            return NJS_ERROR;
-        }
-
-        break;
-
-    default:
-        break;
-    }
-
-    vm->retval = *value;
-
-    njs_retain(value);
-
-    return sizeof(njs_vmcode_object_copy_t);
-}
-
-
-static njs_jump_off_t
 njs_vmcode_function_copy(njs_vm_t *vm, njs_value_t *value, njs_index_t retidx)
 {
     njs_value_t     *retval;
diff -r 29ddc56f7aa5 -r b2bd614ce046 src/njs_vmcode.h
--- a/src/njs_vmcode.h	Mon Apr 10 23:06:34 2023 -0700
+++ b/src/njs_vmcode.h	Wed Apr 12 18:26:40 2023 -0700
@@ -92,7 +92,6 @@ enum {
     NJS_VMCODE_LEFT_SHIFT,
     NJS_VMCODE_RIGHT_SHIFT,
     NJS_VMCODE_UNSIGNED_RIGHT_SHIFT,
-    NJS_VMCODE_OBJECT_COPY,
     NJS_VMCODE_TEMPLATE_LITERAL,
     NJS_VMCODE_PROPERTY_IN,
     NJS_VMCODE_PROPERTY_DELETE,


More information about the nginx-devel mailing list