Bug 160010 - FTL snippet generators should be able to request a different register for output and input
Summary: FTL snippet generators should be able to request a different register for out...
Status: RESOLVED FIXED
Alias: None
Product: WebKit
Classification: Unclassified
Component: JavaScriptCore (show other bugs)
Version: WebKit Nightly Build
Hardware: All All
: P2 Normal
Assignee: Filip Pizlo
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2016-07-20 21:12 PDT by Filip Pizlo
Modified: 2016-07-20 22:26 PDT (History)
5 users (show)

See Also:


Attachments
the patch (11.74 KB, patch)
2016-07-20 21:15 PDT, Filip Pizlo
saam: review+
Details | Formatted Diff | Diff
patch for landing (14.59 KB, patch)
2016-07-20 22:03 PDT, Filip Pizlo
no flags Details | Formatted Diff | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Filip Pizlo 2016-07-20 21:12:17 PDT
Patch forthcoming.
Comment 1 Filip Pizlo 2016-07-20 21:15:23 PDT
Created attachment 284186 [details]
the patch
Comment 2 Mark Lam 2016-07-20 21:26:35 PDT
Comment on attachment 284186 [details]
the patch

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

> Source/JavaScriptCore/b3/B3ValueRep.h:69
> +        

nit: please remove empty spaces here.

> Source/JavaScriptCore/b3/B3ValueRep.h:78
> -
> +        

Unnecessary change.  Please remove.
Comment 3 Saam Barati 2016-07-20 21:34:07 PDT
Comment on attachment 284186 [details]
the patch

r=me
Can you add some testb3 specific tests that uses a patchpoint and SomeEarlyRegister to ensure that no input has the same register as the output register.
Comment 4 Mark Lam 2016-07-20 21:36:11 PDT
Comment on attachment 284186 [details]
the patch

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

> Source/JavaScriptCore/ChangeLog:4
> +        https://bugs.webkit.org/show_bug.cgi?id=160010

Can you also add the radar url here after the bugzilla one?  I think it's customary to do that now.
Comment 5 Filip Pizlo 2016-07-20 21:39:41 PDT
Thanks for the feedback guys!

I've got a 100% repro test that I'll also add:

var toggle = 0;

function bar()
{
    if (toggle ^= 1)
        return 42;
    else
        return {valueOf: function() { return 42; }};
}

noInline(bar);

function baz()
{
    return 7;
}

noInline(baz);

function foo()
{
    return bar() ^ baz();
}

noInline(foo);

for (var i = 0; i < 100000; ++i) {
    var result = foo();
    if (result != 45)
        throw "Error: bad result: " + result;
}
Comment 6 Filip Pizlo 2016-07-20 21:40:41 PDT
(In reply to comment #2)
> Comment on attachment 284186 [details]
> the patch
> 
> View in context:
> https://bugs.webkit.org/attachment.cgi?id=284186&action=review
> 
> > Source/JavaScriptCore/b3/B3ValueRep.h:69
> > +        
> 
> nit: please remove empty spaces here.

Fixed.

> 
> > Source/JavaScriptCore/b3/B3ValueRep.h:78
> > -
> > +        
> 
> Unnecessary change.  Please remove.

Fixed.
Comment 7 Filip Pizlo 2016-07-20 22:02:37 PDT
(In reply to comment #3)
> Comment on attachment 284186 [details]
> the patch
> 
> r=me
> Can you add some testb3 specific tests that uses a patchpoint and
> SomeEarlyRegister to ensure that no input has the same register as the
> output register.

Sure!  I added a test that runs the same compile in two modes: one in which an arrangement of patchpoints causes some patchpoint to see the same register for input and output because it's presented as an ultra-tempting register coalescing oppportunity, and another in which we use SomeEarlyRegister to prevent coalescing.
Comment 8 Filip Pizlo 2016-07-20 22:02:57 PDT
(In reply to comment #4)
> Comment on attachment 284186 [details]
> the patch
> 
> View in context:
> https://bugs.webkit.org/attachment.cgi?id=284186&action=review
> 
> > Source/JavaScriptCore/ChangeLog:4
> > +        https://bugs.webkit.org/show_bug.cgi?id=160010
> 
> Can you also add the radar url here after the bugzilla one?  I think it's
> customary to do that now.

OK!
Comment 9 Filip Pizlo 2016-07-20 22:03:29 PDT
Created attachment 284191 [details]
patch for landing
Comment 10 WebKit Commit Bot 2016-07-20 22:04:59 PDT
Attachment 284191 [details] did not pass style-queue:


ERROR: Source/JavaScriptCore/b3/testb3.cpp:12382:  Place brace on its own line for function definitions.  [whitespace/braces] [4]
ERROR: Source/JavaScriptCore/b3/testb3.cpp:12391:  Place brace on its own line for function definitions.  [whitespace/braces] [4]
ERROR: Source/JavaScriptCore/b3/testb3.cpp:12404:  Place brace on its own line for function definitions.  [whitespace/braces] [4]
Total errors found: 3 in 10 files


If any of these errors are false positives, please file a bug against check-webkit-style.
Comment 11 Filip Pizlo 2016-07-20 22:26:18 PDT
Landed in https://trac.webkit.org/changeset/203488