Bug 118957 - fourthTier: It should be easy to figure out which blocks nodes belong to
Summary: fourthTier: It should be easy to figure out which blocks nodes belong to
Status: RESOLVED FIXED
Alias: None
Product: WebKit
Classification: Unclassified
Component: JavaScriptCore (show other bugs)
Version: 528+ (Nightly build)
Hardware: All All
: P2 Normal
Assignee: Filip Pizlo
URL:
Keywords:
Depends on:
Blocks: 118749
  Show dependency treegraph
 
Reported: 2013-07-21 15:38 PDT by Filip Pizlo
Modified: 2013-07-21 20:57 PDT (History)
7 users (show)

See Also:


Attachments
the patch (2.40 KB, patch)
2013-07-21 16:10 PDT, Filip Pizlo
no flags Details | Formatted Diff | Diff
the patch (3.18 KB, patch)
2013-07-21 20:43 PDT, Filip Pizlo
sam: 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 2013-07-21 15:38:54 PDT
Patch forthcoming.
Comment 1 Filip Pizlo 2013-07-21 16:10:37 PDT
Created attachment 207217 [details]
the patch
Comment 2 Sam Weinig 2013-07-21 18:17:11 PDT
Comment on attachment 207217 [details]
the patch

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

> Source/JavaScriptCore/dfg/DFGNode.h:1404
>      union {
>          Node* replacement;
> +        BasicBlock* owner;
>      } misc;

Can you add clarification about what ensures that a node only has either a replacement or an owner.
Comment 3 Filip Pizlo 2013-07-21 20:40:54 PDT
(In reply to comment #2)
> (From update of attachment 207217 [details])
> View in context: https://bugs.webkit.org/attachment.cgi?id=207217&action=review
> 
> > Source/JavaScriptCore/dfg/DFGNode.h:1404
> >      union {
> >          Node* replacement;
> > +        BasicBlock* owner;
> >      } misc;
> 
> Can you add clarification about what ensures that a node only has either a replacement or an owner.

It's not like that.  These fields only become valid if you initialize them.  You have to make up your mind, when you initialize them, whether your phase needs to use replacement, or needs to know the node-to-block mapping.  Most phases need neither of these pieces of information.  Only three phases use replacements, and the only phases that will use owners are LICM and possibly GVN.
Comment 4 Filip Pizlo 2013-07-21 20:43:37 PDT
Created attachment 207222 [details]
the patch
Comment 5 Sam Weinig 2013-07-21 20:44:27 PDT
Comment on attachment 207217 [details]
the patch

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

>>> Source/JavaScriptCore/dfg/DFGNode.h:1404
>>>      } misc;
>> 
>> Can you add clarification about what ensures that a node only has either a replacement or an owner.
> 
> It's not like that.  These fields only become valid if you initialize them.  You have to make up your mind, when you initialize them, whether your phase needs to use replacement, or needs to know the node-to-block mapping.  Most phases need neither of these pieces of information.  Only three phases use replacements, and the only phases that will use owners are LICM and possibly GVN.

Ok.  You probably want to add some indication of that (or an assertion if possible), as it wasn't clear.
Comment 6 Sam Weinig 2013-07-21 20:45:12 PDT
(In reply to comment #5)
> (From update of attachment 207217 [details])
> View in context: https://bugs.webkit.org/attachment.cgi?id=207217&action=review
> 
> >>> Source/JavaScriptCore/dfg/DFGNode.h:1404
> >>>      } misc;
> >> 
> >> Can you add clarification about what ensures that a node only has either a replacement or an owner.
> > 
> > It's not like that.  These fields only become valid if you initialize them.  You have to make up your mind, when you initialize them, whether your phase needs to use replacement, or needs to know the node-to-block mapping.  Most phases need neither of these pieces of information.  Only three phases use replacements, and the only phases that will use owners are LICM and possibly GVN.
> 
> Ok.  You probably want to add some indication of that (or an assertion if possible), as it wasn't clear.

Moments later, you updated it!  r=me.
Comment 7 Filip Pizlo 2013-07-21 20:48:40 PDT
(In reply to comment #5)
> (From update of attachment 207217 [details])
> View in context: https://bugs.webkit.org/attachment.cgi?id=207217&action=review
> 
> >>> Source/JavaScriptCore/dfg/DFGNode.h:1404
> >>>      } misc;
> >> 
> >> Can you add clarification about what ensures that a node only has either a replacement or an owner.
> > 
> > It's not like that.  These fields only become valid if you initialize them.  You have to make up your mind, when you initialize them, whether your phase needs to use replacement, or needs to know the node-to-block mapping.  Most phases need neither of these pieces of information.  Only three phases use replacements, and the only phases that will use owners are LICM and possibly GVN.
> 
> Ok.  You probably want to add some indication of that (or an assertion if possible), as it wasn't clear.

I don't think an assertion is either possible or profitable - we don't have any kind of natural way of checking if a pointer points to a Node or a BasicBlock.  Also, each phase first initializes 'misc', and then uses it, often in a very obvious way.  Like, you'll literally see one loop that initializes them and another loop that uses them.
Comment 8 Filip Pizlo 2013-07-21 20:57:03 PDT
Landed in http://trac.webkit.org/changeset/152958