Bug 21571 - VoidPtrPair breaks CTI on Linux
Summary: VoidPtrPair breaks CTI on Linux
Status: RESOLVED FIXED
Alias: None
Product: WebKit
Classification: Unclassified
Component: JavaScriptCore (show other bugs)
Version: 528+ (Nightly build)
Hardware: All Linux
: P2 Normal
Assignee: Nobody
URL:
Keywords: Gtk
Depends on: 20760
Blocks:
  Show dependency treegraph
 
Reported: 2008-10-13 11:18 PDT by Alp Toker
Modified: 2008-10-30 02:36 PDT (History)
3 users (show)

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Alp Toker 2008-10-13 11:18:21 PDT
VoidPtrPair return in revision r37457 broke CTI on Linux, which I was hoping to switch on by default (bug #20760, r37457).

The problem is that the convention on Linux is to always use the stack for struct returns (pcc convention) while gcc on Darwin uses the register for small structs. The new code assumes the latter.

There are a few possible workarounds:

1) Build with -freg-struct-return. This sounds like quite a large change to calling conventions but curiously doesn't seem to break any applications or cause any regressions. If this is viable and is shown to prove performance elsewhere, we may actually want to turn this on in Linux builds at some point, but to do that we need to do more research. It would actually be nice to turn this on since it can generate better code for C++ smart pointers which are used extensively in WebCore. Not an immediate solution unless anyone can advice better here.

2) Use a union to vectorise the structure to a uint64_t and return that. This works, but generates different machine code even when building with -freg-struct-return so needs to be perf tested in Darwin builds or made platform-conditional. I have a patch to do this if anyone's interested.

3) ifdef the new code and re-introduce the original code conditionally.

4) Conditionally generate machine code that reads the structure's values according to the pcc convention.

Any thoughts on which way to go?
Comment 1 Alp Toker 2008-10-14 01:56:45 PDT
Noticed this in the gcc 4.3.0 release notes:

 * Fastcall for i386 has been changed not to pass aggregate arguments in registers, following Microsoft compilers.

http://gcc.gnu.org/gcc-4.3/changes.html
Comment 2 Alp Toker 2008-10-30 02:36:04 PDT
Landed in r37995.