Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Rework VM dispatch #4967

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Commits on Jan 20, 2022

  1. Rework VM dispatch

    Overview:
    - `VM_OC_*` opcodes are removed, now the dispatch is based on the `CBC`/`CBC_EXT` opcode
    - The common argument decoding is removed, now each opcode resolves it's arguments individually using `VM_DECODE_{EXT}_...` macros. Whenever an argument is decoded the dispatcher continues with the same opcode increased by `VM_OPCODE_DECODED_ARG`.
    - E.g.: A opcode with 2 literal arguments dispatches as the following:
      - step_1: `case opcode: goto resolve_first_literal`, opcode increment by `VM_OPCODE_DECODED_ARG`, dispatch again (Hidden by macro)
      - step_2: `case VM_OPCODE_ONE_LITERAL(opcode): goto resolve_second_literal`, opcode increment by `VM_OPCODE_DECODED_ARG`, dispatch again (Hidden by macro)
      - step_3: `case VM_OPCODE_TWO_LITERALS (opcode):` Opcode handler implementation goes here.
      - The opcode handler implementation goes as the following:
    ```c
      case VM_OPCODE_TWO_LITERALS (opcode):
      {
        VM_DECODE_LITERAL_LITERAL (opcode);
    
       /* use left and right value as before */
      }
    ```
    - The put result block is optimized, each assignment knows whether an ident or property reference should be resolved
    - `free_left_value` and `free_both_values` labels are removed, due to the extra long jumps they caused to execute 1 or 2 simple calls.
    
    JerryScript-DCO-1.0-Signed-off-by: Robert Fancsik robert.fancsik@h-lab.eu
    Robert Fancsik committed Jan 20, 2022
    Configuration menu
    Copy the full SHA
    cc74bcc View commit details
    Browse the repository at this point in the history