Bug 176262 - WSL should check unreachable code and no returns
Summary: WSL should check unreachable code and no returns
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-01 18:19 PDT by Filip Pizlo
Modified: 2018-10-13 17:09 PDT (History)
3 users (show)

See Also:


Attachments
the patch (12.18 KB, patch)
2017-09-01 18:23 PDT, Filip Pizlo
mmaxfield: 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-01 18:19:12 PDT
Patch forthcoming.
Comment 1 Filip Pizlo 2017-09-01 18:23:43 PDT
Created attachment 319684 [details]
the patch
Comment 2 Myles C. Maxfield 2017-09-01 19:18:17 PDT
Comment on attachment 319684 [details]
the patch

I'd like to add control flow statements soon. Hopefully I'm up to the task!
Comment 3 Filip Pizlo 2017-09-01 19:33:02 PDT
(In reply to Myles C. Maxfield from comment #2)
> Comment on attachment 319684 [details]
> the patch
> 
> I'd like to add control flow statements soon. Hopefully I'm up to the task!

The nice thing about those is that the type system basically doesn't have to know about them, so you can probably just let the Checker's and NameResolver's default Visitor methods take care of those control flow nodes.

The one exception is ternaries.  But that's easy - just verify that the two cases return the same type, and then return that type.

I guess to do control flow, we'll either need a bool type, or we'll need a story for which types can be used as bools.  How should that work?

I guess bool could be a native type.  Then you'd need to add a BoolLiteral class.  Shouldn't be that hard.  Do you want to do that, too?
Comment 4 Filip Pizlo 2017-09-01 19:34:27 PDT
Landed in https://trac.webkit.org/changeset/221513/webkit
Comment 5 Myles C. Maxfield 2017-09-02 10:54:38 PDT
(In reply to Filip Pizlo from comment #3)
> (In reply to Myles C. Maxfield from comment #2)
> > Comment on attachment 319684 [details]
> > the patch
> > 
> > I'd like to add control flow statements soon. Hopefully I'm up to the task!
> 
> The nice thing about those is that the type system basically doesn't have to
> know about them, so you can probably just let the Checker's and
> NameResolver's default Visitor methods take care of those control flow nodes.
> 
> The one exception is ternaries.  But that's easy - just verify that the two
> cases return the same type, and then return that type.
> 
> I guess to do control flow, we'll either need a bool type, or we'll need a
> story for which types can be used as bools.  How should that work?
> 
> I guess bool could be a native type.  Then you'd need to add a BoolLiteral
> class.  Shouldn't be that hard.  Do you want to do that, too?

HLSL, GLSL, Metal, and OpenCL all have a native bool type. I see no reason to be different here.
Comment 6 Radar WebKit Bug Importer 2017-09-27 12:54:00 PDT
<rdar://problem/34694242>
Comment 7 Myles C. Maxfield 2018-10-13 17:09:51 PDT
Migrated to https://github.com/gpuweb/WHLSL/issues/161