Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Re-land [Wasm-GC] Implement packed types in arrays
https://bugs.webkit.org/show_bug.cgi?id=247576 Reviewed by Justin Michaud. This patch implements support for packed types (i8, i16) in Wasm GC arrays. Packed types are represented with new entries in wasm.json and are only allowed for use in StorageTypes, which are a new kind of type used for struct and array type definition fields. Packed structs are not yet allowed with this patch. Relanded patch fixes an invalid move in the Air generator for non-x86 platforms. It also refactors StorageType use slightly and also eliminates redundant LLInt opcodes. * JSTests/wasm/gc/arrays.js: (testArrayDeclaration): * JSTests/wasm/gc/packed-arrays.js: Added. (module): (check): (testArrayGetPacked): (testArrayGetUWithNewCanonPacked): (testArrayGetSWithNewCanonPacked): (testTypeMismatch64): (testTypeMismatchArrayGet): (testPackedTypeOutOfContext): (testSetGetTruncate): (testArraySet): (testArrayGetUnreachable): * JSTests/wasm/wasm.json: * Source/JavaScriptCore/bytecode/BytecodeList.rb: * Source/JavaScriptCore/wasm/WasmAirIRGeneratorBase.h: (JSC::Wasm::ExpressionType>::addArrayNewDefault): (JSC::Wasm::ExpressionType>::addArrayGet): (JSC::Wasm::ExpressionType>::addStructGet): (JSC::Wasm::ExpressionType>::addStructSet): * Source/JavaScriptCore/wasm/WasmB3IRGenerator.cpp: (JSC::Wasm::B3IRGenerator::emitStructSet): (JSC::Wasm::B3IRGenerator::pushArrayNew): (JSC::Wasm::B3IRGenerator::addArrayNew): (JSC::Wasm::B3IRGenerator::addArrayNewDefault): (JSC::Wasm::B3IRGenerator::addArrayGet): (JSC::Wasm::B3IRGenerator::addStructGet): * Source/JavaScriptCore/wasm/WasmFormat.h: (JSC::Wasm::isRefType): (JSC::Wasm::isRefWithRecursiveReference): (JSC::Wasm::isSubtype): (JSC::Wasm::isDefaultableType): * Source/JavaScriptCore/wasm/WasmFunctionParser.h: (JSC::Wasm::FunctionParser<Context>::parseExpression): (JSC::Wasm::FunctionParser<Context>::parseUnreachableExpression): * Source/JavaScriptCore/wasm/WasmLLIntGenerator.cpp: (JSC::Wasm::LLIntGenerator::addArrayGet): * Source/JavaScriptCore/wasm/WasmOperations.cpp: (JSC::Wasm::JSC_DEFINE_JIT_OPERATION): * Source/JavaScriptCore/wasm/WasmSectionParser.cpp: (JSC::Wasm::SectionParser::parsePackedType): (JSC::Wasm::SectionParser::parseStorageType): (JSC::Wasm::SectionParser::parseStructType): (JSC::Wasm::SectionParser::parseArrayType): * Source/JavaScriptCore/wasm/WasmSectionParser.h: * Source/JavaScriptCore/wasm/WasmSlowPaths.cpp: (JSC::LLInt::WASM_SLOW_PATH_DECL): * Source/JavaScriptCore/wasm/WasmTypeDefinition.cpp: (JSC::Wasm::StructType::dump const): (JSC::Wasm::StructType::StructType): (JSC::Wasm::ArrayType::dump const): (JSC::Wasm::StorageType::dump const): (JSC::Wasm::computeStructTypeHash): (JSC::Wasm::computeArrayTypeHash): (JSC::Wasm::TypeDefinition::replacePlaceholders const): * Source/JavaScriptCore/wasm/WasmTypeDefinition.h: (JSC::Wasm::StorageType::is const): (JSC::Wasm::StorageType::as const): (JSC::Wasm::StorageType::StorageType): (JSC::Wasm::StorageType::unpacked const): (JSC::Wasm::StorageType::elementSize const): (JSC::Wasm::StorageType::operator== const): (JSC::Wasm::StorageType::operator!= const): (JSC::Wasm::StorageType::typeCode const): (JSC::Wasm::StorageType::index const): (JSC::Wasm::makeString): (JSC::Wasm::typeSizeInBytes): * Source/JavaScriptCore/wasm/generateWasm.py: (Wasm.__init__): * Source/JavaScriptCore/wasm/generateWasmOpsHeader.py: (cppMacro): (cppMacroPacked): (packedTypeMacroizer): * Source/JavaScriptCore/wasm/js/JSWebAssemblyArray.cpp: (JSC::JSWebAssemblyArray::JSWebAssemblyArray): (JSC::JSWebAssemblyArray::~JSWebAssemblyArray): (JSC::JSWebAssemblyArray::visitChildrenImpl): * Source/JavaScriptCore/wasm/js/JSWebAssemblyArray.h: * Source/JavaScriptCore/wasm/js/JSWebAssemblyStruct.cpp: (JSC::JSWebAssemblyStruct::get const): (JSC::JSWebAssemblyStruct::set): * Source/JavaScriptCore/wasm/wasm.json: Canonical link: https://commits.webkit.org/258463@main
- Loading branch information