-
Notifications
You must be signed in to change notification settings - Fork 1.3k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[Wasm-GC] Add support for final attribute
https://bugs.webkit.org/show_bug.cgi?id=250107 Reviewed by Justin Michaud. Adds support for `final` attribute on `sub` types. This enables types to be marked final, in which case they cannot be inherited from. This changes the default for shorthands like `struct` to be final. As a result, the representation of subtypes needs to change to allow 0 or 1 supertypes (previously, 0 supertype subs were normalized to not using a Subtype constructor). To accommodate this, the representation is changed to allow an arbitrary number of supertypes (though restricted to 0 or 1 in practice). This patch also fixes some additional bugs found in related code, such as a missing subtype check for certain kinds of `rec` types and fixing a case where type indices were resolved too early in array operation validation. In addition to tests for final attributes, this patch updates tests where the a new `sub` is needed due to changes in default finality. It also updates GC spec tests where needed to the version in commit c7de5a1c1e261808a0c7744177589f6eb25da145 of the GC proposal repo. * JSTests/wasm/gc-spec-tests/ref_cast.wast.js: * JSTests/wasm/gc-spec-tests/type-subtyping.wast.js: * JSTests/wasm/gc/arrays.js: (testArrayNewDefault): (testArrayGet): * JSTests/wasm/gc/bug247874.js: (i.instantiate.module.type.struct.type.sub.0.struct.field.i32.global.import.string_appeared_here.string_appeared_here): Deleted. * JSTests/wasm/gc/casts.js: (testSubtypeCasts): * JSTests/wasm/gc/structs.js: (testStructNewDefault): * JSTests/wasm/gc/sub.js: (testSubDeclaration): * JSTests/wasm/wasm.json: * Source/JavaScriptCore/wasm/WasmBBQJIT.cpp: (JSC::Wasm::BBQJIT::sizeOfType): (JSC::Wasm::BBQJIT::toValueKind): (JSC::Wasm::BBQJIT::getGlobal): (JSC::Wasm::BBQJIT::setGlobal): (JSC::Wasm::BBQJIT::addTopLevel): (JSC::Wasm::BBQJIT::emitCatchImpl): (JSC::Wasm::BBQJIT::emitCCall): * Source/JavaScriptCore/wasm/WasmCallingConvention.h: (JSC::Wasm::WasmCallingConvention::numberOfStackResults const): (JSC::Wasm::WasmCallingConvention::numberOfStackArguments const): * Source/JavaScriptCore/wasm/WasmFormat.h: (JSC::Wasm::arrayrefType): * Source/JavaScriptCore/wasm/WasmFunctionParser.h: (JSC::Wasm::FunctionParser<Context>::parseArrayTypeDefinition): * Source/JavaScriptCore/wasm/WasmLLIntGenerator.cpp: (JSC::Wasm::LLIntGenerator::callInformationForCaller): (JSC::Wasm::LLIntGenerator::callInformationForCallee): (JSC::Wasm::LLIntGenerator::addArguments): * Source/JavaScriptCore/wasm/WasmSectionParser.cpp: (JSC::Wasm::SectionParser::parseType): (JSC::Wasm::SectionParser::parseRecursionGroup): (JSC::Wasm::SectionParser::checkSubtypeValidity): (JSC::Wasm::SectionParser::parseSubtype): * Source/JavaScriptCore/wasm/WasmSectionParser.h: * Source/JavaScriptCore/wasm/WasmTypeDefinition.cpp: (JSC::Wasm::Subtype::dump const): (JSC::Wasm::Subtype::cleanup): (JSC::Wasm::computeSubtypeHash): (JSC::Wasm::TypeDefinition::hash const): (JSC::Wasm::TypeDefinition::tryCreateSubtype): (JSC::Wasm::TypeDefinition::replacePlaceholders const): (JSC::Wasm::TypeDefinition::hasRecursiveReference const): (JSC::Wasm::TypeInformation::signatureForLLIntBuiltin): (JSC::Wasm::SubtypeParameterTypes::hash): (JSC::Wasm::SubtypeParameterTypes::equal): (JSC::Wasm::SubtypeParameterTypes::translate): (JSC::Wasm::TypeInformation::TypeInformation): (JSC::Wasm::TypeInformation::typeDefinitionForSubtype): (JSC::Wasm::TypeInformation::canonicalRTTForType): * Source/JavaScriptCore/wasm/WasmTypeDefinition.h: (JSC::Wasm::typeKindSizeInBytes): (JSC::Wasm::Subtype::Subtype): (JSC::Wasm::Subtype::supertypeCount const): (JSC::Wasm::Subtype::isFinal const): (JSC::Wasm::Subtype::firstSuperType const): (JSC::Wasm::Subtype::superType const): (JSC::Wasm::Subtype::getSuperType): (JSC::Wasm::TypeDefinition::TypeDefinition): * Source/JavaScriptCore/wasm/js/JSWebAssemblyStruct.cpp: (JSC::JSWebAssemblyStruct::set): * Source/JavaScriptCore/wasm/js/WasmToJS.cpp: (JSC::Wasm::wasmToJS): * Source/JavaScriptCore/wasm/wasm.json: Canonical link: https://commits.webkit.org/266890@main
- Loading branch information
Showing
20 changed files
with
581 additions
and
197 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Large diffs are not rendered by default.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.