[wasm interpreter] Add trace in LoadMem/StoreMem builtin [v8/v8 : main]

0 views
Skip to first unread message

王忠齐 (Gerrit)

unread,
Nov 16, 2025, 12:27:14 PM (3 days ago) Nov 16
to Paolo Severini, v8-re...@googlegroups.com, was...@google.com
Attention needed from Paolo Severini

王忠齐 added 1 comment

Patchset-level comments
File-level comment, Patchset 3 (Latest):
王忠齐 . resolved

This change is ready for review.

Open in Gerrit

Related details

Attention is currently required from:
  • Paolo Severini
Submit Requirements:
  • requirement is not satisfiedCode-Owners
  • requirement is not satisfiedCode-Review
  • requirement is not satisfiedReview-Enforcement
Inspect html for hidden footers to help with email filtering. To unsubscribe visit settings. DiffyGerrit
Gerrit-MessageType: comment
Gerrit-Project: v8/v8
Gerrit-Branch: main
Gerrit-Change-Id: I4e8da9ed3591f1711e5aa6c216593453796a4481
Gerrit-Change-Number: 7157156
Gerrit-PatchSet: 3
Gerrit-Owner: 王忠齐 <wzq225...@gmail.com>
Gerrit-Reviewer: Paolo Severini <paol...@microsoft.com>
Gerrit-Attention: Paolo Severini <paol...@microsoft.com>
Gerrit-Comment-Date: Sun, 16 Nov 2025 17:27:08 +0000
Gerrit-HasComments: Yes
Gerrit-Has-Labels: No
unsatisfied_requirement
open
diffy

Paolo Severini (Gerrit)

unread,
Nov 16, 2025, 1:45:07 PM (3 days ago) Nov 16
to 王忠齐, was...@google.com, v8-re...@googlegroups.com
Attention needed from 王忠齐

Paolo Severini added 3 comments

Patchset-level comments
Paolo Severini . resolved

Thank you!

If there is a bug in `ShadowStack::Print` we should fix it, but I am not sure we should add push/pop tracing to the load/store builtins. Calling these C++ functions from precompiled builtins seems a little fragile to me, even though DrumBrake tracing is not enabled by default and even require an additional build flag.

File src/wasm/interpreter/x64/interpreter-builtins-x64.cc
Line 1720, Patchset 3 (Latest): __ pushq(rax);
__ pushq(rcx);
__ pushq(rdx);
__ pushq(r8);
__ pushq(r9);
__ pushq(r10);
__ pushq(r11);
Paolo Severini . unresolved

Is this working in all architectures?
On Linux x64 we need to save and restore RAX RCX RDX RSI RDI R8 R9 R10 R11
On Windows x64 we need to save only RAX RCX RDX R8 R9 R10 R11.

But when the instruction handlers deal with floating point we also need to save fp registers:
On Linux XMM0–XMM15
On Windows XMM0–XMM5

But there is also the arm64 version in interpreter-builtins-arm64.cc to consider.

Line 2122, Patchset 3 (Latest): EmitTracePush<0>(masm, wasm_runtime,
Paolo Severini . unresolved

We should pass true or false instead of 1 or 0, or even better, an enum value that describes the meaning of the template argument.

Open in Gerrit

Related details

Attention is currently required from:
  • 王忠齐
Submit Requirements:
    • requirement is not satisfiedCode-Owners
    • requirement is not satisfiedCode-Review
    • requirement is not satisfiedNo-Unresolved-Comments
    • requirement is not satisfiedReview-Enforcement
    Inspect html for hidden footers to help with email filtering. To unsubscribe visit settings. DiffyGerrit
    Gerrit-MessageType: comment
    Gerrit-Project: v8/v8
    Gerrit-Branch: main
    Gerrit-Change-Id: I4e8da9ed3591f1711e5aa6c216593453796a4481
    Gerrit-Change-Number: 7157156
    Gerrit-PatchSet: 3
    Gerrit-Owner: 王忠齐 <wzq225...@gmail.com>
    Gerrit-Reviewer: Paolo Severini <paol...@microsoft.com>
    Gerrit-Attention: 王忠齐 <wzq225...@gmail.com>
    Gerrit-Comment-Date: Sun, 16 Nov 2025 18:45:03 +0000
    Gerrit-HasComments: Yes
    Gerrit-Has-Labels: No
    unsatisfied_requirement
    open
    diffy

    王忠齐 (Gerrit)

    unread,
    Nov 16, 2025, 3:46:02 PM (3 days ago) Nov 16
    to Paolo Severini, was...@google.com, v8-re...@googlegroups.com
    Attention needed from Paolo Severini

    王忠齐 added 3 comments

    Patchset-level comments
    File src/wasm/interpreter/x64/interpreter-builtins-x64.cc
    Line 1720, Patchset 3: __ pushq(rax);

    __ pushq(rcx);
    __ pushq(rdx);
    __ pushq(r8);
    __ pushq(r9);
    __ pushq(r10);
    __ pushq(r11);
    Paolo Severini . resolved

    Is this working in all architectures?
    On Linux x64 we need to save and restore RAX RCX RDX RSI RDI R8 R9 R10 R11
    On Windows x64 we need to save only RAX RCX RDX R8 R9 R10 R11.

    But when the instruction handlers deal with floating point we also need to save fp registers:
    On Linux XMM0–XMM15
    On Windows XMM0–XMM5

    But there is also the arm64 version in interpreter-builtins-arm64.cc to consider.

    王忠齐

    Thanks for your advise. I just consider the register currently in use. This will make the program more robust.

    Line 2122, Patchset 3: EmitTracePush<0>(masm, wasm_runtime,
    Paolo Severini . resolved

    We should pass true or false instead of 1 or 0, or even better, an enum value that describes the meaning of the template argument.

    王忠齐

    Thanks! This seems to make the code more readable.

    Open in Gerrit

    Related details

    Attention is currently required from:
    • Paolo Severini
    Submit Requirements:
      • requirement is not satisfiedCode-Owners
      • requirement is not satisfiedCode-Review
      • requirement is not satisfiedReview-Enforcement
      Inspect html for hidden footers to help with email filtering. To unsubscribe visit settings. DiffyGerrit
      Gerrit-MessageType: comment
      Gerrit-Project: v8/v8
      Gerrit-Branch: main
      Gerrit-Change-Id: I4e8da9ed3591f1711e5aa6c216593453796a4481
      Gerrit-Change-Number: 7157156
      Gerrit-PatchSet: 4
      Gerrit-Owner: 王忠齐 <wzq225...@gmail.com>
      Gerrit-Reviewer: Paolo Severini <paol...@microsoft.com>
      Gerrit-Attention: Paolo Severini <paol...@microsoft.com>
      Gerrit-Comment-Date: Sun, 16 Nov 2025 20:45:54 +0000
      Gerrit-HasComments: Yes
      Gerrit-Has-Labels: No
      Comment-In-Reply-To: Paolo Severini <paol...@microsoft.com>
      unsatisfied_requirement
      open
      diffy

      王忠齐 (Gerrit)

      unread,
      Nov 16, 2025, 8:38:38 PM (2 days ago) Nov 16
      to Paolo Severini, was...@google.com, v8-re...@googlegroups.com
      Attention needed from Paolo Severini

      王忠齐 added 2 comments

      Patchset-level comments
      Paolo Severini . resolved

      Thank you!

      If there is a bug in `ShadowStack::Print` we should fix it, but I am not sure we should add push/pop tracing to the load/store builtins. Calling these C++ functions from precompiled builtins seems a little fragile to me, even though DrumBrake tracing is not enabled by default and even require an additional build flag.

      王忠齐

      The other plan is add the trace functions into to the instruction table like trace_PushConstI32Slot, but it the case we need to save extra stack_offset and kind in it. I think it may cause others error in the future, because we need to save twice stack_offset in the trace function and the LoadMem builtin. If we changed one and forget the other, it will get a wrong result. As a dev tool, I think only save one stack_offset in the LoadMem/StoreMem builtin will produce less incorrect results, so I add the trace function in the LoadMem/StoreMem builtin.

      File src/wasm/interpreter/x64/interpreter-builtins-x64.cc
      Line 1720, Patchset 3: __ pushq(rax);
      __ pushq(rcx);
      __ pushq(rdx);
      __ pushq(r8);
      __ pushq(r9);
      __ pushq(r10);
      __ pushq(r11);
      Paolo Severini . resolved

      Is this working in all architectures?
      On Linux x64 we need to save and restore RAX RCX RDX RSI RDI R8 R9 R10 R11
      On Windows x64 we need to save only RAX RCX RDX R8 R9 R10 R11.

      But when the instruction handlers deal with floating point we also need to save fp registers:
      On Linux XMM0–XMM15
      On Windows XMM0–XMM5

      But there is also the arm64 version in interpreter-builtins-arm64.cc to consider.

      王忠齐

      Thanks for your advise. I just consider the register currently in use. This will make the program more robust.

      王忠齐

      In arm64, LoadMem/StoreMem builtins haven't been supported. Maybe I shouldn't add it currently, because I cann't test it now. I think it could be supported with the LoadMem/StoreMem builtin in arm64. I will add it to my plan, and I will do it when I am free.

      Open in Gerrit

      Related details

      Attention is currently required from:
      • Paolo Severini
      Submit Requirements:
      • requirement is not satisfiedCode-Owners
      • requirement is not satisfiedCode-Review
      • requirement is not satisfiedReview-Enforcement
      Inspect html for hidden footers to help with email filtering. To unsubscribe visit settings. DiffyGerrit
      Gerrit-MessageType: comment
      Gerrit-Project: v8/v8
      Gerrit-Branch: main
      Gerrit-Change-Id: I4e8da9ed3591f1711e5aa6c216593453796a4481
      Gerrit-Change-Number: 7157156
      Gerrit-PatchSet: 4
      Gerrit-Owner: 王忠齐 <wzq225...@gmail.com>
      Gerrit-Reviewer: Paolo Severini <paol...@microsoft.com>
      Gerrit-Attention: Paolo Severini <paol...@microsoft.com>
      Gerrit-Comment-Date: Mon, 17 Nov 2025 01:38:33 +0000
      Gerrit-HasComments: Yes
      Gerrit-Has-Labels: No
      Comment-In-Reply-To: Paolo Severini <paol...@microsoft.com>
      Comment-In-Reply-To: 王忠齐 <wzq225...@gmail.com>
      unsatisfied_requirement
      open
      diffy

      Paolo Severini (Gerrit)

      unread,
      Nov 17, 2025, 8:45:27 AM (2 days ago) Nov 17
      to 王忠齐, was...@google.com, v8-re...@googlegroups.com
      Attention needed from 王忠齐

      Paolo Severini added 2 comments

      Patchset-level comments
      File-level comment, Patchset 3:
      Paolo Severini . unresolved

      Thank you!

      If there is a bug in `ShadowStack::Print` we should fix it, but I am not sure we should add push/pop tracing to the load/store builtins. Calling these C++ functions from precompiled builtins seems a little fragile to me, even though DrumBrake tracing is not enabled by default and even require an additional build flag.

      王忠齐

      The other plan is add the trace functions into to the instruction table like trace_PushConstI32Slot, but it the case we need to save extra stack_offset and kind in it. I think it may cause others error in the future, because we need to save twice stack_offset in the trace function and the LoadMem builtin. If we changed one and forget the other, it will get a wrong result. As a dev tool, I think only save one stack_offset in the LoadMem/StoreMem builtin will produce less incorrect results, so I add the trace function in the LoadMem/StoreMem builtin.

      Paolo Severini

      A apologize for not having provided a better solution sooner.

      I checked better and in V8 there is already a portable way to call C++ function from builtins, through the `CallRuntime` assembly macro.
      Something like:
      ```
      __ CallRuntime(Runtime::kWasmInterpreterTracePop, <args>);
      ```
      We should reuse this mechanism, without recreating it.
      File src/wasm/interpreter/x64/interpreter-builtins-x64.cc
      Line 1720, Patchset 3: __ pushq(rax);
      __ pushq(rcx);
      __ pushq(rdx);
      __ pushq(r8);
      __ pushq(r9);
      __ pushq(r10);
      __ pushq(r11);
      Paolo Severini . resolved

      Is this working in all architectures?
      On Linux x64 we need to save and restore RAX RCX RDX RSI RDI R8 R9 R10 R11
      On Windows x64 we need to save only RAX RCX RDX R8 R9 R10 R11.

      But when the instruction handlers deal with floating point we also need to save fp registers:
      On Linux XMM0–XMM15
      On Windows XMM0–XMM5

      But there is also the arm64 version in interpreter-builtins-arm64.cc to consider.

      王忠齐

      Thanks for your advise. I just consider the register currently in use. This will make the program more robust.

      王忠齐

      In arm64, LoadMem/StoreMem builtins haven't been supported. Maybe I shouldn't add it currently, because I cann't test it now. I think it could be supported with the LoadMem/StoreMem builtin in arm64. I will add it to my plan, and I will do it when I am free.

      Paolo Severini

      You are totally right that these builtins are not supported on arm64.

      Open in Gerrit

      Related details

      Attention is currently required from:
      • 王忠齐
      Submit Requirements:
        • requirement is not satisfiedCode-Owners
        • requirement is not satisfiedCode-Review
        • requirement is not satisfiedNo-Unresolved-Comments
        • requirement is not satisfiedReview-Enforcement
        Inspect html for hidden footers to help with email filtering. To unsubscribe visit settings. DiffyGerrit
        Gerrit-MessageType: comment
        Gerrit-Project: v8/v8
        Gerrit-Branch: main
        Gerrit-Change-Id: I4e8da9ed3591f1711e5aa6c216593453796a4481
        Gerrit-Change-Number: 7157156
        Gerrit-PatchSet: 4
        Gerrit-Owner: 王忠齐 <wzq225...@gmail.com>
        Gerrit-Reviewer: Paolo Severini <paol...@microsoft.com>
        Gerrit-Attention: 王忠齐 <wzq225...@gmail.com>
        Gerrit-Comment-Date: Mon, 17 Nov 2025 13:45:24 +0000
        unsatisfied_requirement
        open
        diffy

        王忠齐 (Gerrit)

        unread,
        Nov 17, 2025, 10:49:39 AM (2 days ago) Nov 17
        to Paolo Severini, was...@google.com, v8-re...@googlegroups.com
        Attention needed from Paolo Severini

        王忠齐 added 1 comment

        Patchset-level comments
        Paolo Severini . unresolved

        Thank you!

        If there is a bug in `ShadowStack::Print` we should fix it, but I am not sure we should add push/pop tracing to the load/store builtins. Calling these C++ functions from precompiled builtins seems a little fragile to me, even though DrumBrake tracing is not enabled by default and even require an additional build flag.

        王忠齐

        The other plan is add the trace functions into to the instruction table like trace_PushConstI32Slot, but it the case we need to save extra stack_offset and kind in it. I think it may cause others error in the future, because we need to save twice stack_offset in the trace function and the LoadMem builtin. If we changed one and forget the other, it will get a wrong result. As a dev tool, I think only save one stack_offset in the LoadMem/StoreMem builtin will produce less incorrect results, so I add the trace function in the LoadMem/StoreMem builtin.

        Paolo Severini

        A apologize for not having provided a better solution sooner.

        I checked better and in V8 there is already a portable way to call C++ function from builtins, through the `CallRuntime` assembly macro.
        Something like:
        ```
        __ CallRuntime(Runtime::kWasmInterpreterTracePop, <args>);
        ```
        We should reuse this mechanism, without recreating it.
        王忠齐

        It only be used in a JS function currently, the rumtime function will get param as JS abi. It looks strange that passing a JS value from a c function to the other c function.

        Open in Gerrit

        Related details

        Attention is currently required from:
        • Paolo Severini
        Submit Requirements:
        • requirement is not satisfiedCode-Owners
        • requirement is not satisfiedCode-Review
        • requirement is not satisfiedNo-Unresolved-Comments
        • requirement is not satisfiedReview-Enforcement
        Inspect html for hidden footers to help with email filtering. To unsubscribe visit settings. DiffyGerrit
        Gerrit-MessageType: comment
        Gerrit-Project: v8/v8
        Gerrit-Branch: main
        Gerrit-Change-Id: I4e8da9ed3591f1711e5aa6c216593453796a4481
        Gerrit-Change-Number: 7157156
        Gerrit-PatchSet: 4
        Gerrit-Owner: 王忠齐 <wzq225...@gmail.com>
        Gerrit-Reviewer: Paolo Severini <paol...@microsoft.com>
        Gerrit-Attention: Paolo Severini <paol...@microsoft.com>
        Gerrit-Comment-Date: Mon, 17 Nov 2025 15:49:31 +0000
        unsatisfied_requirement
        open
        diffy

        王忠齐 (Gerrit)

        unread,
        Nov 17, 2025, 10:57:11 AM (2 days ago) Nov 17
        to Paolo Severini, was...@google.com, v8-re...@googlegroups.com
        Attention needed from Paolo Severini

        王忠齐 added 1 comment

        Patchset-level comments
        Paolo Severini . unresolved

        Thank you!

        If there is a bug in `ShadowStack::Print` we should fix it, but I am not sure we should add push/pop tracing to the load/store builtins. Calling these C++ functions from precompiled builtins seems a little fragile to me, even though DrumBrake tracing is not enabled by default and even require an additional build flag.

        王忠齐

        The other plan is add the trace functions into to the instruction table like trace_PushConstI32Slot, but it the case we need to save extra stack_offset and kind in it. I think it may cause others error in the future, because we need to save twice stack_offset in the trace function and the LoadMem builtin. If we changed one and forget the other, it will get a wrong result. As a dev tool, I think only save one stack_offset in the LoadMem/StoreMem builtin will produce less incorrect results, so I add the trace function in the LoadMem/StoreMem builtin.

        Paolo Severini

        A apologize for not having provided a better solution sooner.

        I checked better and in V8 there is already a portable way to call C++ function from builtins, through the `CallRuntime` assembly macro.
        Something like:
        ```
        __ CallRuntime(Runtime::kWasmInterpreterTracePop, <args>);
        ```
        We should reuse this mechanism, without recreating it.
        王忠齐

        It only be used in a JS function currently, the rumtime function will get param as JS abi. It looks strange that passing a JS value from a c function to the other c function.

        王忠齐

        maybe __ CallCFunction will be better.

        Open in Gerrit

        Related details

        Attention is currently required from:
        • Paolo Severini
        Submit Requirements:
        • requirement is not satisfiedCode-Owners
        • requirement is not satisfiedCode-Review
        • requirement is not satisfiedNo-Unresolved-Comments
        • requirement is not satisfiedReview-Enforcement
        Inspect html for hidden footers to help with email filtering. To unsubscribe visit settings. DiffyGerrit
        Gerrit-MessageType: comment
        Gerrit-Project: v8/v8
        Gerrit-Branch: main
        Gerrit-Change-Id: I4e8da9ed3591f1711e5aa6c216593453796a4481
        Gerrit-Change-Number: 7157156
        Gerrit-PatchSet: 4
        Gerrit-Owner: 王忠齐 <wzq225...@gmail.com>
        Gerrit-Reviewer: Paolo Severini <paol...@microsoft.com>
        Gerrit-Attention: Paolo Severini <paol...@microsoft.com>
        Gerrit-Comment-Date: Mon, 17 Nov 2025 15:57:05 +0000
        unsatisfied_requirement
        open
        diffy

        王忠齐 (Gerrit)

        unread,
        Nov 17, 2025, 11:10:04 AM (2 days ago) Nov 17
        to Paolo Severini, was...@google.com, v8-re...@googlegroups.com
        Attention needed from Paolo Severini

        王忠齐 added 2 comments

        Patchset-level comments
        File-level comment, Patchset 3:
        Paolo Severini . resolved

        Thank you!

        If there is a bug in `ShadowStack::Print` we should fix it, but I am not sure we should add push/pop tracing to the load/store builtins. Calling these C++ functions from precompiled builtins seems a little fragile to me, even though DrumBrake tracing is not enabled by default and even require an additional build flag.

        王忠齐

        The other plan is add the trace functions into to the instruction table like trace_PushConstI32Slot, but it the case we need to save extra stack_offset and kind in it. I think it may cause others error in the future, because we need to save twice stack_offset in the trace function and the LoadMem builtin. If we changed one and forget the other, it will get a wrong result. As a dev tool, I think only save one stack_offset in the LoadMem/StoreMem builtin will produce less incorrect results, so I add the trace function in the LoadMem/StoreMem builtin.

        Paolo Severini

        A apologize for not having provided a better solution sooner.

        I checked better and in V8 there is already a portable way to call C++ function from builtins, through the `CallRuntime` assembly macro.
        Something like:
        ```
        __ CallRuntime(Runtime::kWasmInterpreterTracePop, <args>);
        ```
        We should reuse this mechanism, without recreating it.
        王忠齐

        It only be used in a JS function currently, the rumtime function will get param as JS abi. It looks strange that passing a JS value from a c function to the other c function.

        王忠齐

        maybe __ CallCFunction will be better.

        王忠齐

        Done

        Open in Gerrit

        Related details

        Attention is currently required from:
        • Paolo Severini
        Submit Requirements:
          • requirement is not satisfiedCode-Owners
          • requirement is not satisfiedCode-Review
          • requirement is not satisfiedReview-Enforcement
          Inspect html for hidden footers to help with email filtering. To unsubscribe visit settings. DiffyGerrit
          Gerrit-MessageType: comment
          Gerrit-Project: v8/v8
          Gerrit-Branch: main
          Gerrit-Change-Id: I4e8da9ed3591f1711e5aa6c216593453796a4481
          Gerrit-Change-Number: 7157156
          Gerrit-PatchSet: 5
          Gerrit-Owner: 王忠齐 <wzq225...@gmail.com>
          Gerrit-Reviewer: Paolo Severini <paol...@microsoft.com>
          Gerrit-Attention: Paolo Severini <paol...@microsoft.com>
          Gerrit-Comment-Date: Mon, 17 Nov 2025 16:09:58 +0000
          unsatisfied_requirement
          open
          diffy

          Paolo Severini (Gerrit)

          unread,
          Nov 17, 2025, 1:02:00 PM (2 days ago) Nov 17
          to 王忠齐, was...@google.com, v8-re...@googlegroups.com
          Attention needed from 王忠齐

          Paolo Severini added 1 comment

          File src/wasm/interpreter/x64/interpreter-builtins-x64.cc
          Line 1761, Patchset 5: __ movq(rdi, wasm_runtime);
          __ movq(rsi, Immediate(kind));
          __ movq(rdx, slot_offset);
          Paolo Severini . unresolved

          We overwrite the values of rdi, rsi rdx (or other registers on Windows) which might be used by the code later. Usually in these builtins rdx is the stack pointer, rcx points to the current bytecode and r8 point to the wasm_runtime. So the following handlers probably don't work.

          You might try to build and run all mjsunit tests with the `jitless` variant locally, with something like this, in the /src/v8 folder:
          ```
          python3 tools/run-tests.py --variants=jitless --outdir=..\out\debug_x64 mjsunit/wasm/*
          ```

          Open in Gerrit

          Related details

          Attention is currently required from:
          • 王忠齐
          Submit Requirements:
            • requirement is not satisfiedCode-Owners
            • requirement is not satisfiedCode-Review
            • requirement is not satisfiedNo-Unresolved-Comments
            • requirement is not satisfiedReview-Enforcement
            Inspect html for hidden footers to help with email filtering. To unsubscribe visit settings. DiffyGerrit
            Gerrit-MessageType: comment
            Gerrit-Project: v8/v8
            Gerrit-Branch: main
            Gerrit-Change-Id: I4e8da9ed3591f1711e5aa6c216593453796a4481
            Gerrit-Change-Number: 7157156
            Gerrit-PatchSet: 5
            Gerrit-Owner: 王忠齐 <wzq225...@gmail.com>
            Gerrit-Reviewer: Paolo Severini <paol...@microsoft.com>
            Gerrit-Attention: 王忠齐 <wzq225...@gmail.com>
            Gerrit-Comment-Date: Mon, 17 Nov 2025 18:01:56 +0000
            Gerrit-HasComments: Yes
            Gerrit-Has-Labels: No
            unsatisfied_requirement
            open
            diffy

            王忠齐 (Gerrit)

            unread,
            Nov 17, 2025, 1:08:29 PM (2 days ago) Nov 17
            to Paolo Severini, was...@google.com, v8-re...@googlegroups.com
            Attention needed from Paolo Severini

            王忠齐 added 1 comment

            File src/wasm/interpreter/x64/interpreter-builtins-x64.cc
            Line 1761, Patchset 5: __ movq(rdi, wasm_runtime);
            __ movq(rsi, Immediate(kind));
            __ movq(rdx, slot_offset);
            Paolo Severini . resolved

            We overwrite the values of rdi, rsi rdx (or other registers on Windows) which might be used by the code later. Usually in these builtins rdx is the stack pointer, rcx points to the current bytecode and r8 point to the wasm_runtime. So the following handlers probably don't work.

            You might try to build and run all mjsunit tests with the `jitless` variant locally, with something like this, in the /src/v8 folder:
            ```
            python3 tools/run-tests.py --variants=jitless --outdir=..\out\debug_x64 mjsunit/wasm/*
            ```

            王忠齐

            Thanks, I find the bug too. I have check the CallCFunction, it didn't save the caller saved register for us. So I save the caller saved register as before in patch set 6.

            Open in Gerrit

            Related details

            Attention is currently required from:
            • Paolo Severini
            Submit Requirements:
              • requirement is not satisfiedCode-Owners
              • requirement is not satisfiedCode-Review
              • requirement is not satisfiedReview-Enforcement
              Inspect html for hidden footers to help with email filtering. To unsubscribe visit settings. DiffyGerrit
              Gerrit-MessageType: comment
              Gerrit-Project: v8/v8
              Gerrit-Branch: main
              Gerrit-Change-Id: I4e8da9ed3591f1711e5aa6c216593453796a4481
              Gerrit-Change-Number: 7157156
              Gerrit-PatchSet: 6
              Gerrit-Owner: 王忠齐 <wzq225...@gmail.com>
              Gerrit-Reviewer: Paolo Severini <paol...@microsoft.com>
              Gerrit-Attention: Paolo Severini <paol...@microsoft.com>
              Gerrit-Comment-Date: Mon, 17 Nov 2025 18:08:22 +0000
              Gerrit-HasComments: Yes
              Gerrit-Has-Labels: No
              Comment-In-Reply-To: Paolo Severini <paol...@microsoft.com>
              unsatisfied_requirement
              open
              diffy

              Paolo Severini (Gerrit)

              unread,
              Nov 17, 2025, 1:23:51 PM (2 days ago) Nov 17
              to 王忠齐, was...@google.com, v8-re...@googlegroups.com
              Attention needed from 王忠齐

              Paolo Severini added 2 comments

              File src/wasm/interpreter/x64/interpreter-builtins-x64.cc
              Line 1819, Patchset 6 (Latest): FrameScope scope(masm, StackFrame::MANUAL);
              Paolo Severini . unresolved

              What is the purpose of a `FrameScope` here?

              Line 1820, Patchset 6 (Latest): SaveCallerSavedRegister(masm);
              Paolo Severini . unresolved

              We are saving registers at the beginning of the builtin and then restoring them at the end, but some registers, like rcx==code pointer, rdx==stack pointer, but also others, can be modified inside the builtin and we need to go to the next builtin with the modified value.

              I think you should just save the registers you are using to pass values to `CallCFunction` before calling it and then restore them immediately after the call.

              You should verify that everything works by running at least the wasm-interpreter.js tests with `--jitless --wasm-jitless --trace-drumbrake-execution --trace-drumbrake-execution-verbose` (in addition to all the other arguments).

              Open in Gerrit

              Related details

              Attention is currently required from:
              • 王忠齐
              Submit Requirements:
                • requirement is not satisfiedCode-Owners
                • requirement is not satisfiedCode-Review
                • requirement is not satisfiedNo-Unresolved-Comments
                • requirement is not satisfiedReview-Enforcement
                Inspect html for hidden footers to help with email filtering. To unsubscribe visit settings. DiffyGerrit
                Gerrit-MessageType: comment
                Gerrit-Project: v8/v8
                Gerrit-Branch: main
                Gerrit-Change-Id: I4e8da9ed3591f1711e5aa6c216593453796a4481
                Gerrit-Change-Number: 7157156
                Gerrit-PatchSet: 6
                Gerrit-Owner: 王忠齐 <wzq225...@gmail.com>
                Gerrit-Reviewer: Paolo Severini <paol...@microsoft.com>
                Gerrit-Attention: 王忠齐 <wzq225...@gmail.com>
                Gerrit-Comment-Date: Mon, 17 Nov 2025 18:23:48 +0000
                Gerrit-HasComments: Yes
                Gerrit-Has-Labels: No
                unsatisfied_requirement
                open
                diffy

                王忠齐 (Gerrit)

                unread,
                Nov 17, 2025, 1:38:29 PM (2 days ago) Nov 17
                to Paolo Severini, was...@google.com, v8-re...@googlegroups.com
                Attention needed from Paolo Severini

                王忠齐 added 2 comments

                File src/wasm/interpreter/x64/interpreter-builtins-x64.cc
                Line 1819, Patchset 6 (Latest): FrameScope scope(masm, StackFrame::MANUAL);
                Paolo Severini . resolved

                What is the purpose of a `FrameScope` here?

                王忠齐

                There is a DCHECK in CallCFunction, a FrameScope is needed by it.

                Line 1820, Patchset 6 (Latest): SaveCallerSavedRegister(masm);
                Paolo Severini . resolved

                We are saving registers at the beginning of the builtin and then restoring them at the end, but some registers, like rcx==code pointer, rdx==stack pointer, but also others, can be modified inside the builtin and we need to go to the next builtin with the modified value.

                I think you should just save the registers you are using to pass values to `CallCFunction` before calling it and then restore them immediately after the call.

                You should verify that everything works by running at least the wasm-interpreter.js tests with `--jitless --wasm-jitless --trace-drumbrake-execution --trace-drumbrake-execution-verbose` (in addition to all the other arguments).

                王忠齐

                Thanks for your advise, save register just before call instruction may cann't restore the register used as paramter. And I will test it locally.

                Open in Gerrit

                Related details

                Attention is currently required from:
                • Paolo Severini
                Submit Requirements:
                  • requirement is not satisfiedCode-Owners
                  • requirement is not satisfiedCode-Review
                  • requirement is not satisfiedReview-Enforcement
                  Inspect html for hidden footers to help with email filtering. To unsubscribe visit settings. DiffyGerrit
                  Gerrit-MessageType: comment
                  Gerrit-Project: v8/v8
                  Gerrit-Branch: main
                  Gerrit-Change-Id: I4e8da9ed3591f1711e5aa6c216593453796a4481
                  Gerrit-Change-Number: 7157156
                  Gerrit-PatchSet: 6
                  Gerrit-Owner: 王忠齐 <wzq225...@gmail.com>
                  Gerrit-Reviewer: Paolo Severini <paol...@microsoft.com>
                  Gerrit-Attention: Paolo Severini <paol...@microsoft.com>
                  Gerrit-Comment-Date: Mon, 17 Nov 2025 18:38:21 +0000
                  Gerrit-HasComments: Yes
                  Gerrit-Has-Labels: No
                  Comment-In-Reply-To: Paolo Severini <paol...@microsoft.com>
                  unsatisfied_requirement
                  open
                  diffy

                  王忠齐 (Gerrit)

                  unread,
                  Nov 18, 2025, 8:52:03 AM (24 hours ago) Nov 18
                  to Paolo Severini, was...@google.com, v8-re...@googlegroups.com
                  Attention needed from Paolo Severini

                  王忠齐 added 1 comment

                  File src/wasm/interpreter/x64/interpreter-builtins-x64.cc
                  Line 1820, Patchset 6: SaveCallerSavedRegister(masm);
                  Paolo Severini . resolved

                  We are saving registers at the beginning of the builtin and then restoring them at the end, but some registers, like rcx==code pointer, rdx==stack pointer, but also others, can be modified inside the builtin and we need to go to the next builtin with the modified value.

                  I think you should just save the registers you are using to pass values to `CallCFunction` before calling it and then restore them immediately after the call.

                  You should verify that everything works by running at least the wasm-interpreter.js tests with `--jitless --wasm-jitless --trace-drumbrake-execution --trace-drumbrake-execution-verbose` (in addition to all the other arguments).

                  王忠齐

                  Thanks for your advise, save register just before call instruction may cann't restore the register used as paramter. And I will test it locally.

                  王忠齐

                  I have pass the test case wasm-interpreter.js in Patchset 7, PTAL.

                  Open in Gerrit

                  Related details

                  Attention is currently required from:
                  • Paolo Severini
                  Submit Requirements:
                  • requirement is not satisfiedCode-Owners
                  • requirement is not satisfiedCode-Review
                  • requirement is not satisfiedReview-Enforcement
                  Inspect html for hidden footers to help with email filtering. To unsubscribe visit settings. DiffyGerrit
                  Gerrit-MessageType: comment
                  Gerrit-Project: v8/v8
                  Gerrit-Branch: main
                  Gerrit-Change-Id: I4e8da9ed3591f1711e5aa6c216593453796a4481
                  Gerrit-Change-Number: 7157156
                  Gerrit-PatchSet: 7
                  Gerrit-Owner: 王忠齐 <wzq225...@gmail.com>
                  Gerrit-Reviewer: Paolo Severini <paol...@microsoft.com>
                  Gerrit-Attention: Paolo Severini <paol...@microsoft.com>
                  Gerrit-Comment-Date: Tue, 18 Nov 2025 13:51:57 +0000
                  Gerrit-HasComments: Yes
                  Gerrit-Has-Labels: No
                  Comment-In-Reply-To: Paolo Severini <paol...@microsoft.com>
                  Comment-In-Reply-To: 王忠齐 <wzq225...@gmail.com>
                  unsatisfied_requirement
                  open
                  diffy
                  Reply all
                  Reply to author
                  Forward
                  0 new messages