Bug 177269 - WSL should not type-check functions in the standard library that it does not use
Summary: WSL should not type-check functions in the standard library that it does not use
Status: RESOLVED FIXED
Alias: None
Product: WebKit
Classification: Unclassified
Component: WebGPU (show other bugs)
Version: WebKit Nightly Build
Hardware: All All
: P2 Normal
Assignee: Filip Pizlo
URL:
Keywords: InRadar
Depends on:
Blocks: 176199
  Show dependency treegraph
 
Reported: 2017-09-20 14:13 PDT by Filip Pizlo
Modified: 2018-10-13 19:32 PDT (History)
3 users (show)

See Also:


Attachments
the patch (21.08 KB, patch)
2017-09-20 14:19 PDT, Filip Pizlo
jfbastien: review+
Details | Formatted Diff | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Filip Pizlo 2017-09-20 14:13:53 PDT
Patch forthcoming.
Comment 1 Filip Pizlo 2017-09-20 14:19:11 PDT
Created attachment 321367 [details]
the patch
Comment 2 JF Bastien 2017-09-20 14:26:04 PDT
Comment on attachment 321367 [details]
the patch

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

r=me

> Tools/WebGPUShadingLanguageRI/NameContext.js:97
> +        if (thing.kind == Func) {

=== ?

> Tools/WebGPUShadingLanguageRI/Prepare.js:29
> +    return function(origin, lineNumberOffset, text) {

Why?

> Tools/WebGPUShadingLanguageRI/ProgramWithUnnecessaryThingsRemoved.js:33
> +        if (statement.origin.originKind == "user")

=== ?

> Tools/WebGPUShadingLanguageRI/ProgramWithUnnecessaryThingsRemoved.js:40
> +    // We need these even if the program doesn't mention them by name.

Why?
Comment 3 Filip Pizlo 2017-09-20 15:09:14 PDT
(In reply to JF Bastien from comment #2)
> Comment on attachment 321367 [details]
> the patch
> 
> View in context:
> https://bugs.webkit.org/attachment.cgi?id=321367&action=review
> 
> r=me
> 
> > Tools/WebGPUShadingLanguageRI/NameContext.js:97
> > +        if (thing.kind == Func) {
> 
> === ?

Fixed.

> 
> > Tools/WebGPUShadingLanguageRI/Prepare.js:29
> > +    return function(origin, lineNumberOffset, text) {
> 
> Why?

arguments.length doesn't work in arrow functions.

> 
> > Tools/WebGPUShadingLanguageRI/ProgramWithUnnecessaryThingsRemoved.js:33
> > +        if (statement.origin.originKind == "user")
> 
> === ?

Fixed.

> 
> > Tools/WebGPUShadingLanguageRI/ProgramWithUnnecessaryThingsRemoved.js:40
> > +    // We need these even if the program doesn't mention them by name.
> 
> Why?

Later phases resolve these directly sometimes (the compiler will say things like program.globalNameContext.get(Type, "void") and expect non-null).

For example even if you compile "int foo() { return 42; }", we will resolve void just to make sure that int isn't the same as void - because if int was void then the return shouldn't return a value.

Also if you compile "double foo() { return 42; }" we will also resolve int because "42" might be an int (we actually select double as 42's type but not before trying int).
Comment 4 Filip Pizlo 2017-09-20 15:41:17 PDT
Landed in https://trac.webkit.org/changeset/222295/webkit
Comment 5 Radar WebKit Bug Importer 2017-09-27 12:20:01 PDT
<rdar://problem/34693070>
Comment 6 Myles C. Maxfield 2018-10-13 19:32:20 PDT
Migrated to https://github.com/gpuweb/WHLSL/issues/177