Ignore:
Timestamp:
May 3, 2021, 4:00:43 AM (4 years ago)
Author:
[email protected]
Message:

[WASM-Function-References] Add call_ref instruction
https://bugs.webkit.org/show_bug.cgi?id=222903

Patch by Dmitry Bezhetskov <dbezhetskov> on 2021-05-03
Reviewed by Yusuke Suzuki.

JSTests:

Add basic tests for new call_ref instruction:
https://github.com/WebAssembly/function-references/blob/master/proposals/function-references/Overview.md.
Add tests for calling same-instance wasm function, foreign-instance
wasm function and for calling imported js function.

  • wasm.yaml:
  • wasm/function-references/call_ref.js: Added.

(module):
(async basics):
(async indirectCall):
(async importHostCall):

  • wasm/wasm.json:

Source/JavaScriptCore:

Add support for call_ref instruction from the typed function
references proposal: https://github.com/WebAssembly/function-references/blob/master/proposals/function-references/Overview.md.
call_ref calls the given function references from the stack
and it does almost the same stuff as call_indirect but
it doesn't check signatures because wasm types system guaranties
correctness.

  • bytecode/BytecodeList.rb:
  • dfg/DFGCapabilities.cpp:

(JSC::DFG::capabilityLevel):

  • llint/LowLevelInterpreter.asm:
  • llint/WebAssembly.asm:
  • runtime/Gate.h:
  • wasm/WasmAirIRGenerator.cpp:

(JSC::Wasm::AirIRGenerator::addCallIndirect):
(JSC::Wasm::AirIRGenerator::addCallRef):
(JSC::Wasm::AirIRGenerator::emitIndirectCall):

  • wasm/WasmB3IRGenerator.cpp:

(JSC::Wasm::B3IRGenerator::emitIndirectCall):
(JSC::Wasm::B3IRGenerator::addCallIndirect):
(JSC::Wasm::B3IRGenerator::addCallRef):

  • wasm/WasmFunctionParser.h:

(JSC::Wasm::FunctionParser<Context>::parseExpression):
(JSC::Wasm::FunctionParser<Context>::parseUnreachableExpression):

  • wasm/WasmLLIntGenerator.cpp:

(JSC::Wasm::LLIntGenerator::addCallRef):

  • wasm/WasmSlowPaths.cpp:

(JSC::LLInt::doWasmCallRef):
(JSC::LLInt::WASM_SLOW_PATH_DECL):

  • wasm/WasmSlowPaths.h:
  • wasm/js/JSWebAssemblyTable.cpp:
  • wasm/js/WebAssemblyFunction.cpp:

(JSC::WebAssemblyFunction::WebAssemblyFunction):

  • wasm/js/WebAssemblyFunction.h:
  • wasm/js/WebAssemblyFunctionBase.cpp:

(JSC::WebAssemblyFunctionBase::WebAssemblyFunctionBase):

  • wasm/js/WebAssemblyFunctionBase.h:

(JSC::WebAssemblyFunctionBase::offsetOfEntrypointLoadLocation):

  • wasm/js/WebAssemblyWrapperFunction.cpp:

(JSC::WebAssemblyWrapperFunction::WebAssemblyWrapperFunction):

  • wasm/js/WebAssemblyWrapperFunction.h:
  • wasm/wasm.json:
File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/Source/JavaScriptCore/dfg/DFGCapabilities.cpp

    r276427 r276896  
    369369    case wasm_trampoline_wasm_call_indirect:
    370370    case wasm_trampoline_wasm_call_indirect_no_tls:
     371    case wasm_trampoline_wasm_call_ref:
     372    case wasm_trampoline_wasm_call_ref_no_tls:
    371373        return CannotCompile;
    372374    }
Note: See TracChangeset for help on using the changeset viewer.