Bug 198313 - [WHLSL] The checker should not have pointers/references into its maps
Summary: [WHLSL] The checker should not have pointers/references into its maps
Status: RESOLVED DUPLICATE of bug 198876
Alias: None
Product: WebKit
Classification: Unclassified
Component: WebGPU (show other bugs)
Version: WebKit Nightly Build
Hardware: Unspecified Unspecified
: P1 Normal
Assignee: Saam Barati
URL:
Keywords: InRadar
Depends on:
Blocks:
 
Reported: 2019-05-28 17:12 PDT by Robin Morisset
Modified: 2019-06-18 16:41 PDT (History)
4 users (show)

See Also:


Attachments
WIP (4.47 KB, patch)
2019-05-28 17:27 PDT, Robin Morisset
no flags Details | Formatted Diff | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Robin Morisset 2019-05-28 17:12:04 PDT
m_typeMap is currently HashMap<AST::Expression*, ResolvingType> m_typeMap;
This is buggy, because some code in the checker has references into it, and they get invalidated whenever the typeMap is resized. Instead the Map should contain UniqueRef<ResolvingType>, and then we should only have references to the ResolvingType itself.
This bugs currently prevents checking the full standard library.
Comment 1 Robin Morisset 2019-05-28 17:27:44 PDT
Created attachment 370812 [details]
WIP
Comment 2 Myles C. Maxfield 2019-05-29 13:30:27 PDT
Comment on attachment 370812 [details]
WIP

View in context: https://bugs.webkit.org/attachment.cgi?id=370812&action=review

> Source/WebCore/Modules/webgpu/WHLSL/WHLSLChecker.cpp:494
> +    HashMap<AST::Expression*, std::unique_ptr<ResolvingType>> m_typeMap;

UniqueRef didn't work?
Comment 3 Robin Morisset 2019-05-29 14:57:15 PDT
No, because it does not offer the right methods to be in a HashMap (I think it is missing a copy operator or something. I could have looked in detail, and tried to improve either HashMap or UniqueRef to work together, but using std::unique_ptr seemed way easier and good enough for this purpose.

(In reply to Myles C. Maxfield from comment #2)
> Comment on attachment 370812 [details]
> WIP
> 
> View in context:
> https://bugs.webkit.org/attachment.cgi?id=370812&action=review
> 
> > Source/WebCore/Modules/webgpu/WHLSL/WHLSLChecker.cpp:494
> > +    HashMap<AST::Expression*, std::unique_ptr<ResolvingType>> m_typeMap;
> 
> UniqueRef didn't work?
Comment 4 Radar WebKit Bug Importer 2019-05-30 20:26:36 PDT
<rdar://problem/51288768>
Comment 5 Saam Barati 2019-06-18 16:37:55 PDT
patch forthcoming with tests.
Comment 6 Saam Barati 2019-06-18 16:40:56 PDT
actually, just gonna do this as part of the matrix patch. it's too difficult to split up as we'll end up with checker errors.
Comment 7 Saam Barati 2019-06-18 16:41:06 PDT

*** This bug has been marked as a duplicate of bug 198876 ***