[webkit-changes] [WebKit/WebKit] a5637e: Add atomics to IPInt

Keith Miller noreply at github.com
Thu Sep 21 07:34:06 PDT 2023


  Branch: refs/heads/main
  Home:   https://github.com/WebKit/WebKit
  Commit: a5637e2156cb073b5fb5c820ad02b9115c88e4d7
      https://github.com/WebKit/WebKit/commit/a5637e2156cb073b5fb5c820ad02b9115c88e4d7
  Author: Keith Miller <keith_miller at apple.com>
  Date:   2023-09-21 (Thu, 21 Sep 2023)

  Changed paths:
    M Source/JavaScriptCore/llint/InPlaceInterpreter.asm
    M Source/JavaScriptCore/llint/InPlaceInterpreter.cpp
    M Source/JavaScriptCore/llint/InPlaceInterpreter.h
    M Source/JavaScriptCore/runtime/OptionsList.h
    M Source/JavaScriptCore/wasm/WasmFunctionIPIntMetadataGenerator.cpp
    M Source/JavaScriptCore/wasm/WasmFunctionIPIntMetadataGenerator.h
    M Source/JavaScriptCore/wasm/WasmIPIntGenerator.cpp
    M Source/JavaScriptCore/wasm/WasmOperationsInlines.h
    M Source/JavaScriptCore/wasm/WasmSlowPaths.cpp
    M Source/JavaScriptCore/wasm/WasmSlowPaths.h

  Log Message:
  -----------
  Add atomics to IPInt
https://bugs.webkit.org/show_bug.cgi?id=261855

Reviewed by Yusuke Suzuki.

Add support for the wasm thread proposal's atomic instructions to IPInt.
Right now this only works for arm64(e) as the IPInt seems to have other
issues when running on X86_64. Although the structure of the
atomic instructions should be implemented for X86_64.

A lot of the instructions were implemented in the LLInt so they
could be "straightforwardly" copied to the IPInt. The LLInt seems
to do a decent amount of extra work that doesn't seem to be necessary
(at least on ARM64E). For example, LLInt ands the low bits of the atomic
RMW result even though the instructions zero extend anyway.

Additionally, this patch fixes trapping from wasm. Previously,
the callee save registers were not saved in the same order that the
C++ code expects (in decreasing order). This was fine for IPInt code
but broke when doing `genericUnwind`.

Lastly, this patch adds an FunctionIPIntMetadataGenerator::addLength
for wasm bytecodes that have variable length but no metatdata. This
is currently only the extended opcodes since the extended instruction
is encoded as a varUInt32 and can be non-canonically encoded as
something longer than 1 byte. I believe the other extended bytecodes
are incorrect but I will fix those in a follow up patch.

* Source/JavaScriptCore/llint/InPlaceInterpreter.asm:
* Source/JavaScriptCore/llint/InPlaceInterpreter.cpp:
(JSC::IPInt::initialize):
* Source/JavaScriptCore/llint/InPlaceInterpreter.h:
* Source/JavaScriptCore/runtime/OptionsList.h:
* Source/JavaScriptCore/wasm/WasmFunctionIPIntMetadataGenerator.cpp:
(JSC::Wasm::FunctionIPIntMetadataGenerator::addLength):
* Source/JavaScriptCore/wasm/WasmFunctionIPIntMetadataGenerator.h:
* Source/JavaScriptCore/wasm/WasmIPIntGenerator.cpp:
(JSC::Wasm::IPIntGenerator::atomicLoad):
(JSC::Wasm::IPIntGenerator::atomicStore):
(JSC::Wasm::IPIntGenerator::atomicBinaryRMW):
(JSC::Wasm::IPIntGenerator::atomicCompareExchange):
(JSC::Wasm::IPIntGenerator::atomicWait):
(JSC::Wasm::IPIntGenerator::atomicNotify):
(JSC::Wasm::IPIntGenerator::atomicFence):
* Source/JavaScriptCore/wasm/WasmOperationsInlines.h:
(JSC::Wasm::memoryAtomicWait32):
(JSC::Wasm::memoryAtomicWait64):
* Source/JavaScriptCore/wasm/WasmSlowPaths.cpp:
(JSC::LLInt::WASM_IPINT_EXTERN_CPP_DECL):
* Source/JavaScriptCore/wasm/WasmSlowPaths.h:

Canonical link: https://commits.webkit.org/268252@main




More information about the webkit-changes mailing list