Bug 176336 - Make the distinction between entrypoints and CFG roots more clear by naming things better
Summary: Make the distinction between entrypoints and CFG roots more clear by naming t...
Status: RESOLVED FIXED
Alias: None
Product: WebKit
Classification: Unclassified
Component: JavaScriptCore (show other bugs)
Version: WebKit Nightly Build
Hardware: Unspecified Unspecified
: P2 Normal
Assignee: Saam Barati
URL:
Keywords: InRadar
Depends on: 175396
Blocks:
  Show dependency treegraph
 
Reported: 2017-09-04 14:49 PDT by Saam Barati
Modified: 2017-09-27 12:37 PDT (History)
13 users (show)

See Also:


Attachments
patch (25.36 KB, patch)
2017-09-05 13:10 PDT, Saam Barati
mark.lam: review+
Details | Formatted Diff | Diff
patch for landing (25.57 KB, patch)
2017-09-05 13:47 PDT, Saam Barati
no flags Details | Formatted Diff | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Saam Barati 2017-09-04 14:49:13 PDT
I think this will make the code easier cleaner, instead of just having comments stating that a particular field is only used in SSA.
Comment 1 Saam Barati 2017-09-05 12:40:21 PDT
The vector called m_entrypoints now I'm going to rename to m_roots. This represents the CFG roots. I'll also rename m_entrypointToArguments to m_rootToArguments. Similarly, I'll rename Graph::isEntrypoint to Graph::isRoot

m_numberOfEntrypoints is only used in SSA, and I'll keep the same name. That field represents the number of logical entrypoints this compilation is making. It's not necessarily the number of CFG roots.
Comment 2 Saam Barati 2017-09-05 13:10:45 PDT
Created attachment 319930 [details]
patch
Comment 3 Mark Lam 2017-09-05 13:13:34 PDT
Comment on attachment 319930 [details]
patch

r=me
Comment 4 Keith Miller 2017-09-05 13:16:14 PDT
Comment on attachment 319930 [details]
patch

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

r=me too.

> Source/JavaScriptCore/ChangeLog:17
> +

You should probably say that you renamed m_entrypoints to m_roots in the changelog.
Comment 5 Michael Saboff 2017-09-05 13:20:48 PDT
Comment on attachment 319930 [details]
patch

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

r=me.  The code changes seem fine.  Please update the ChangeLog.

> Source/JavaScriptCore/ChangeLog:16
> +        Graph::m_numberOfEntrypoints is only used in SSA when compiling with
> +        EntrySwitch. It represents the logical number of entrypoints the compilation
> +        will end up with. Crucially, Graph::m_numberOfEntrypoints != Graph::m_roots.size().
> +        This is the main reason I've renamed the fields and related methods.

I don't find changes to m_numberOfEntrypoints in the patch.  It would be good to discuss the reasoning behind the change of m_entrypointToArguments to m_rootToArguments.
Comment 6 Saam Barati 2017-09-05 13:34:11 PDT
Comment on attachment 319930 [details]
patch

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

>> Source/JavaScriptCore/ChangeLog:16
>> +        This is the main reason I've renamed the fields and related methods.
> 
> I don't find changes to m_numberOfEntrypoints in the patch.  It would be good to discuss the reasoning behind the change of m_entrypointToArguments to m_rootToArguments.

This patch doesn't change m_numberOfEntrypoints on purpose. That field is retaining its name because it describes its purpose.

Also, this patch renames m_entrypointToArguments to m_rootToArguments to be consistent with the change of m_entrypoints to m_roots.

>> Source/JavaScriptCore/ChangeLog:17
>> +
> 
> You should probably say that you renamed m_entrypoints to m_roots in the changelog.

It says this above.
Comment 7 Saam Barati 2017-09-05 13:40:41 PDT
New changelog:

This patch does renaming to make the distinction between Graph::m_entrypoints
and Graph::m_numberOfEntrypoints more clear. The source of confusion is that
Graph::m_entrypoints.size() is not equivalent to Graph::m_numberOfEntrypoints.
Graph::m_entrypoints is really just the CFG roots. In CPS, this vector has
size >= 1. In SSA, the size is always 1. This patch renames Graph::m_entrypoints
to Graph::m_roots. To be consistent, this patch also renames Graph's m_entrypointToArguments
field to m_rootToArguments.

Graph::m_numberOfEntrypoints retains its name. This field is only used in SSA
when compiling with EntrySwitch. It represents the logical number of entrypoints
the compilation will end up with. Each EntrySwitch has m_numberOfEntrypoints
cases.
Comment 8 Saam Barati 2017-09-05 13:47:52 PDT
Created attachment 319932 [details]
patch for landing
Comment 9 WebKit Commit Bot 2017-09-05 14:30:09 PDT
Comment on attachment 319932 [details]
patch for landing

Clearing flags on attachment: 319932

Committed r221637: <http://trac.webkit.org/changeset/221637>
Comment 10 WebKit Commit Bot 2017-09-05 14:30:11 PDT
All reviewed patches have been landed.  Closing bug.
Comment 11 Radar WebKit Bug Importer 2017-09-27 12:37:40 PDT
<rdar://problem/34693633>