Bug 198580 - [WHLSL] Do not generate duplicate constructors/copy constructors in synthesizeConstructors
Summary: [WHLSL] Do not generate duplicate constructors/copy constructors in synthesiz...
Status: RESOLVED FIXED
Alias: None
Product: WebKit
Classification: Unclassified
Component: WebGPU (show other bugs)
Version: WebKit Nightly Build
Hardware: Unspecified Unspecified
: P2 Normal
Assignee: Saam Barati
URL:
Keywords: InRadar
Depends on:
Blocks:
 
Reported: 2019-06-05 14:19 PDT by Saam Barati
Modified: 2019-06-18 10:52 PDT (History)
8 users (show)

See Also:


Attachments
WIP (70.33 KB, patch)
2019-06-13 16:52 PDT, Saam Barati
no flags Details | Formatted Diff | Diff
patch (29.50 KB, patch)
2019-06-14 12:26 PDT, Saam Barati
no flags Details | Formatted Diff | Diff
patch (29.50 KB, patch)
2019-06-14 12:29 PDT, Saam Barati
rmorisset: review+
Details | Formatted Diff | Diff
patch for landing (40.32 KB, patch)
2019-06-17 18:57 PDT, Saam Barati
no flags Details | Formatted Diff | Diff
patch for landing (40.98 KB, patch)
2019-06-18 10:36 PDT, Saam Barati
commit-queue: commit-queue-
Details | Formatted Diff | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Saam Barati 2019-06-05 14:19:27 PDT
e.g:
void foo(thread int*) { }
void foo2(thread int*) { }
void foo3(thread int*) { }
void foo4(thread int*) { }
void foo5(thread int*) { }


We will end up with a bunch of constructors/copy constructors for "thread int*"
Comment 1 Saam Barati 2019-06-13 11:39:47 PDT
This crashes the overload resolution in autoInitializeVariables.
Comment 2 Saam Barati 2019-06-13 16:52:55 PDT
Created attachment 372083 [details]
WIP

contains code from OOB patch. Might be done besides just waiting for that patch to land.
Comment 3 Saam Barati 2019-06-14 12:26:10 PDT
Created attachment 372131 [details]
patch
Comment 4 EWS Watchlist 2019-06-14 12:27:47 PDT
Attachment 372131 [details] did not pass style-queue:


ERROR: Source/WebCore/Modules/webgpu/WHLSL/AST/WHLSLTypeReference.h:116:  Weird number of spaces at line-start.  Are you using a 4-space indent?  [whitespace/indent] [3]
Total errors found: 1 in 14 files


If any of these errors are false positives, please file a bug against check-webkit-style.
Comment 5 Saam Barati 2019-06-14 12:29:32 PDT
Created attachment 372134 [details]
patch

fix style issue
Comment 6 Robin Morisset 2019-06-14 14:09:05 PDT
Comment on attachment 372134 [details]
patch

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

r=me

> Source/WebCore/Modules/webgpu/WHLSL/WHLSLNameResolver.cpp:93
>      newNameResolver.setCurrentFunctionDefinition(m_currentFunction);

These repeated copying of m_currentFunction and m_resolvingCalls make me think we should have a constructor of NameResolver that takes a reference to a parent NameResolver.
This constructor could easily then do the copying and could even take care of allocating the new NameContext.
This is not super urgent or important though, it would just be cleaner.

> Source/WebCore/Modules/webgpu/WHLSL/WHLSLNameResolver.cpp:225
> +    if (m_isResolvingCalls) {

This could be made a tad more readable by an early exit:
if (!m_isResolvingCalls)
  return;
and then the old code. 5 nested if expressions is getting a bit much.
Comment 7 Saam Barati 2019-06-17 18:57:52 PDT
Created attachment 372312 [details]
patch for landing
Comment 8 Saam Barati 2019-06-18 10:27:59 PDT
Comment on attachment 372134 [details]
patch

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

>> Source/WebCore/Modules/webgpu/WHLSL/WHLSLNameResolver.cpp:93
>>      newNameResolver.setCurrentFunctionDefinition(m_currentFunction);
> 
> These repeated copying of m_currentFunction and m_resolvingCalls make me think we should have a constructor of NameResolver that takes a reference to a parent NameResolver.
> This constructor could easily then do the copying and could even take care of allocating the new NameContext.
> This is not super urgent or important though, it would just be cleaner.

I will make this change.

>> Source/WebCore/Modules/webgpu/WHLSL/WHLSLNameResolver.cpp:225
>> +    if (m_isResolvingCalls) {
> 
> This could be made a tad more readable by an early exit:
> if (!m_isResolvingCalls)
>   return;
> and then the old code. 5 nested if expressions is getting a bit much.

I agree it's not great, but I'm going to leave this as is, since we do things at the end of the if that we do if we do/don't take it.
Comment 9 Saam Barati 2019-06-18 10:36:28 PDT
Created attachment 372348 [details]
patch for landing
Comment 10 WebKit Commit Bot 2019-06-18 10:38:43 PDT
Comment on attachment 372348 [details]
patch for landing

Rejecting attachment 372348 [details] from commit-queue.

Failed to run "['/Volumes/Data/EWS/WebKit/Tools/Scripts/webkit-patch', '--status-host=webkit-queues.webkit.org', '--bot-id=webkit-cq-03', 'validate-changelog', '--check-oops', '--non-interactive', 372348, '--port=mac']" exit_code: 1 cwd: /Volumes/Data/EWS/WebKit

Robin Morisset found in /Volumes/Data/EWS/WebKit/LayoutTests/ChangeLog does not appear to be a valid reviewer according to contributors.json.
/Volumes/Data/EWS/WebKit/LayoutTests/ChangeLog neither lists a valid reviewer nor contains the string "Unreviewed" or "Rubber stamp" (case insensitive).

Full output: https://webkit-queues.webkit.org/results/12509627
Comment 11 Saam Barati 2019-06-18 10:50:07 PDT
landed in:
https://trac.webkit.org/changeset/246550/webkit
Comment 12 Radar WebKit Bug Importer 2019-06-18 10:52:10 PDT
<rdar://problem/51856246>