Bug 199462 - [WHLSL] "Semantic" should be held by a unique_ptr, not an Optional
Summary: [WHLSL] "Semantic" should be held by a unique_ptr, not an Optional
Alias: None
Product: WebKit
Classification: Unclassified
Component: WebGPU (show other bugs)
Version: WebKit Nightly Build
Hardware: Unspecified Unspecified
: P2 Normal
Assignee: Robin Morisset
Keywords: InRadar
Depends on:
Reported: 2019-07-03 13:48 PDT by Robin Morisset
Modified: 2019-07-03 15:12 PDT (History)
3 users (show)

See Also:

Patch (41.46 KB, patch)
2019-07-03 13:51 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-07-03 13:48:18 PDT
Most StructureElement, FunctionDeclaration and (especially) VariableDeclaration don't have a 'Semantic' field.
Using an Optional<Semantic> to represent this is a major memory waste, as Semantic is 56 bytes, so Optional<Semantic> is 64 bytes!
Putting one level of indirection through a unique_ptr thus saves 56 bytes for each VariableDeclaration (and FunctionDeclaration and StructureElement) that does not have a Semantic, at the low cost of one pointer dereference when accessing the field for those that have one.
Comment 1 Robin Morisset 2019-07-03 13:51:56 PDT
Created attachment 373413 [details]
Comment 2 WebKit Commit Bot 2019-07-03 15:11:42 PDT
Comment on attachment 373413 [details]

Clearing flags on attachment: 373413

Committed r247110: <https://trac.webkit.org/changeset/247110>
Comment 3 WebKit Commit Bot 2019-07-03 15:11:43 PDT
All reviewed patches have been landed.  Closing bug.
Comment 4 Radar WebKit Bug Importer 2019-07-03 15:12:19 PDT