Branch: refs/heads/main Home: https://github.com/WebKit/WebKit Commit: e537d9e945bcca2099c45ab6faa837f0488e8300 https://github.com/WebKit/WebKit/commit/e537d9e945bcca2099c45ab6faa837f0488e8300 Author: Asumu Takikawa <as...@igalia.com> Date: 2023-03-29 (Wed, 29 Mar 2023)
Changed paths: A JSTests/wasm/gc/extern.js M JSTests/wasm/wasm.json M Source/JavaScriptCore/bytecode/BytecodeList.rb M Source/JavaScriptCore/llint/WebAssembly32_64.asm M Source/JavaScriptCore/llint/WebAssembly64.asm M Source/JavaScriptCore/runtime/JSType.cpp M Source/JavaScriptCore/runtime/JSType.h M Source/JavaScriptCore/wasm/WasmAirIRGeneratorBase.h M Source/JavaScriptCore/wasm/WasmB3IRGenerator.cpp M Source/JavaScriptCore/wasm/WasmBBQJIT.cpp M Source/JavaScriptCore/wasm/WasmFormat.h M Source/JavaScriptCore/wasm/WasmFunctionParser.h M Source/JavaScriptCore/wasm/WasmLLIntBuiltin.h M Source/JavaScriptCore/wasm/WasmLLIntGenerator.cpp M Source/JavaScriptCore/wasm/WasmOperations.cpp M Source/JavaScriptCore/wasm/WasmOperations.h M Source/JavaScriptCore/wasm/WasmOperationsInlines.h M Source/JavaScriptCore/wasm/WasmSlowPaths.cpp M Source/JavaScriptCore/wasm/WasmTypeDefinition.cpp M Source/JavaScriptCore/wasm/WasmTypeDefinition.h M Source/JavaScriptCore/wasm/js/JSWebAssemblyArray.h M Source/JavaScriptCore/wasm/js/JSWebAssemblyStruct.h M Source/JavaScriptCore/wasm/wasm.json Log Message: ----------- [Wasm-GC] Add extern.internalize/externalize https://bugs.webkit.org/show_bug.cgi?id=251039 Reviewed by Justin Michaud. Adds extern conversion instructions to convert between anyref (internal references) and externref. The any to extern direction is currently a no-op. The extern to any direction requires checking for Numbers in the i31 range and converting them to i31ref representation. The any to extern is a no-op because JSC's value representation allows i31s to just be JSC 32-bit exact integers, and structs and arrays are represented as objects. This would need to change if the representation were to change, so that, e.g., structs and arrays have an optimized non-object wasm representation and a wrapper object is used to interop with JS. The addition of internalize means non-Wasm values (JS objects, strings, etc) can be converted into an internal reference as "host references" that are opaque to Wasm. These need to be distinguishable from true Wasm values, including in JIT code, which requires adding a WasmGCObjectType JSType. * JSTests/wasm/gc/extern.js: Added. (testInternalize): (testRoundtrip): (testTable): * JSTests/wasm/wasm.json: * Source/JavaScriptCore/bytecode/BytecodeList.rb: * Source/JavaScriptCore/llint/WebAssembly32_64.asm: * Source/JavaScriptCore/llint/WebAssembly64.asm: * Source/JavaScriptCore/runtime/JSType.cpp: (WTF::printInternal): * Source/JavaScriptCore/runtime/JSType.h: * Source/JavaScriptCore/wasm/WasmAirIRGeneratorBase.h: (JSC::Wasm::ExpressionType>::emitRefTestOrCast): (JSC::Wasm::ExpressionType>::makeBranchNotWasmGCObject): (JSC::Wasm::ExpressionType>::addExternInternalize): (JSC::Wasm::ExpressionType>::addExternExternalize): * Source/JavaScriptCore/wasm/WasmB3IRGenerator.cpp: (JSC::Wasm::B3IRGenerator::emitRefTestOrCast): (JSC::Wasm::B3IRGenerator::addExternInternalize): (JSC::Wasm::B3IRGenerator::addExternExternalize): * Source/JavaScriptCore/wasm/WasmBBQJIT.cpp: (JSC::Wasm::BBQJIT::addExternInternalize): (JSC::Wasm::BBQJIT::addExternExternalize): * Source/JavaScriptCore/wasm/WasmFormat.h: (JSC::Wasm::externrefType): (JSC::Wasm::anyrefType): * Source/JavaScriptCore/wasm/WasmFunctionParser.h: (JSC::Wasm::FunctionParser<Context>::parseExpression): * Source/JavaScriptCore/wasm/WasmLLIntBuiltin.h: * Source/JavaScriptCore/wasm/WasmLLIntGenerator.cpp: (JSC::Wasm::LLIntGenerator::addExternInternalize): (JSC::Wasm::LLIntGenerator::addExternExternalize): * Source/JavaScriptCore/wasm/WasmOperations.cpp: (JSC::Wasm::JSC_DEFINE_JIT_OPERATION): * Source/JavaScriptCore/wasm/WasmOperations.h: * Source/JavaScriptCore/wasm/WasmOperationsInlines.h: (JSC::Wasm::refCast): (JSC::Wasm::externInternalize): * Source/JavaScriptCore/wasm/WasmSlowPaths.cpp: (JSC::LLInt::WASM_SLOW_PATH_DECL): * Source/JavaScriptCore/wasm/WasmTypeDefinition.cpp: (JSC::Wasm::TypeInformation::signatureForLLIntBuiltin): (JSC::Wasm::TypeInformation::TypeInformation): * Source/JavaScriptCore/wasm/WasmTypeDefinition.h: * Source/JavaScriptCore/wasm/js/JSWebAssemblyArray.h: * Source/JavaScriptCore/wasm/js/JSWebAssemblyStruct.h: * Source/JavaScriptCore/wasm/wasm.json: Canonical link: https://commits.webkit.org/262282@main _______________________________________________ webkit-changes mailing list webkit-changes@lists.webkit.org https://lists.webkit.org/mailman/listinfo/webkit-changes