WebKit Bugzilla
Attachment 370812 Details for
Bug 198313
: [WHLSL] The checker should not have pointers/references into its maps
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Requests
|
Help
|
New Account
|
Log In
Remember
[x]
|
Forgot Password
Login:
[x]
[patch]
WIP
patch198313 (text/plain), 4.47 KB, created by
Robin Morisset
on 2019-05-28 17:27:44 PDT
(
hide
)
Description:
WIP
Filename:
MIME Type:
Creator:
Robin Morisset
Created:
2019-05-28 17:27:44 PDT
Size:
4.47 KB
patch
obsolete
>Index: Source/WebCore/ChangeLog >=================================================================== >--- Source/WebCore/ChangeLog (revision 245834) >+++ Source/WebCore/ChangeLog (working copy) >@@ -1,3 +1,19 @@ >+2019-05-28 Robin Morisset <rmorisset@apple.com> >+ >+ [WHLSL] The checker should not have pointers/references into its maps >+ https://bugs.webkit.org/show_bug.cgi?id=198313 >+ >+ Reviewed by NOBODY (OOPS!). >+ >+ Using std::unique_ptr instead of UniqueRef, because UniqueRef is not usable inside HashMap. >+ Still no automated test as there is no test harness for WHLSL. Tested manually on the full standard library. >+ >+ * Modules/webgpu/WHLSL/WHLSLChecker.cpp: >+ (WebCore::WHLSL::Checker::assignTypes): >+ (WebCore::WHLSL::Checker::getInfo): >+ (WebCore::WHLSL::Checker::assignType): >+ (WebCore::WHLSL::Checker::forwardType): >+ > 2019-05-28 Shawn Roberts <sroberts@apple.com> > > Unreviewed, rolling out r245475. >Index: Source/WebCore/Modules/webgpu/WHLSL/WHLSLChecker.cpp >=================================================================== >--- Source/WebCore/Modules/webgpu/WHLSL/WHLSLChecker.cpp (revision 245822) >+++ Source/WebCore/Modules/webgpu/WHLSL/WHLSLChecker.cpp (working copy) >@@ -491,7 +491,7 @@ > void visit(AST::TernaryExpression&) override; > void visit(AST::CallExpression&) override; > >- HashMap<AST::Expression*, ResolvingType> m_typeMap; >+ HashMap<AST::Expression*, std::unique_ptr<ResolvingType>> m_typeMap; > HashMap<AST::Expression*, AST::TypeAnnotation> m_typeAnnotations; > HashSet<String> m_vertexEntryPoints; > HashSet<String> m_fragmentEntryPoints; >@@ -521,7 +521,7 @@ > bool Checker::assignTypes() > { > for (auto& keyValuePair : m_typeMap) { >- auto success = keyValuePair.value.visit(WTF::makeVisitor([&](UniqueRef<AST::UnnamedType>& unnamedType) -> bool { >+ auto success = keyValuePair.value->visit(WTF::makeVisitor([&](UniqueRef<AST::UnnamedType>& unnamedType) -> bool { > keyValuePair.key->setType(unnamedType->clone()); > return true; > }, [&](RefPtr<ResolvableTypeReference>& resolvableTypeReference) -> bool { >@@ -766,7 +766,7 @@ > setError(); > return WTF::nullopt; > } >- return {{ typeIterator->value, typeAnnotationIterator->value }}; >+ return {{ *typeIterator->value, typeAnnotationIterator->value }}; > } > > void Checker::visit(AST::VariableDeclaration& variableDeclaration) >@@ -788,7 +788,7 @@ > > void Checker::assignType(AST::Expression& expression, UniqueRef<AST::UnnamedType>&& unnamedType, AST::TypeAnnotation typeAnnotation = AST::RightValue()) > { >- auto addResult = m_typeMap.add(&expression, WTFMove(unnamedType)); >+ auto addResult = m_typeMap.add(&expression, std::make_unique<ResolvingType>(WTFMove(unnamedType))); > ASSERT_UNUSED(addResult, addResult.isNewEntry); > auto typeAnnotationAddResult = m_typeAnnotations.add(&expression, WTFMove(typeAnnotation)); > ASSERT_UNUSED(typeAnnotationAddResult, typeAnnotationAddResult.isNewEntry); >@@ -796,7 +796,7 @@ > > void Checker::assignType(AST::Expression& expression, RefPtr<ResolvableTypeReference>&& resolvableTypeReference, AST::TypeAnnotation typeAnnotation = AST::RightValue()) > { >- auto addResult = m_typeMap.add(&expression, WTFMove(resolvableTypeReference)); >+ auto addResult = m_typeMap.add(&expression, std::make_unique<ResolvingType>(WTFMove(resolvableTypeReference))); > ASSERT_UNUSED(addResult, addResult.isNewEntry); > auto typeAnnotationAddResult = m_typeAnnotations.add(&expression, WTFMove(typeAnnotation)); > ASSERT_UNUSED(typeAnnotationAddResult, typeAnnotationAddResult.isNewEntry); >@@ -805,10 +805,10 @@ > void Checker::forwardType(AST::Expression& expression, ResolvingType& resolvingType, AST::TypeAnnotation typeAnnotation = AST::RightValue()) > { > resolvingType.visit(WTF::makeVisitor([&](UniqueRef<AST::UnnamedType>& result) { >- auto addResult = m_typeMap.add(&expression, result->clone()); >+ auto addResult = m_typeMap.add(&expression, std::make_unique<ResolvingType>(result->clone())); > ASSERT_UNUSED(addResult, addResult.isNewEntry); > }, [&](RefPtr<ResolvableTypeReference>& result) { >- auto addResult = m_typeMap.add(&expression, result.copyRef()); >+ auto addResult = m_typeMap.add(&expression, std::make_unique<ResolvingType>(result.copyRef())); > ASSERT_UNUSED(addResult, addResult.isNewEntry); > })); > auto typeAnnotationAddResult = m_typeAnnotations.add(&expression, WTFMove(typeAnnotation));
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Diff
View Attachment As Raw
Actions:
View
|
Formatted Diff
|
Diff
Attachments on
bug 198313
: 370812