mirror of
https://gitlab.winehq.org/wine/wine-gecko.git
synced 2024-09-13 09:24:08 -07:00
7890c85b6f
For register-rich ABIs (e.g. x86-64 and ARM), QueryInterface's incoming registers are going to look like: arg register 1: |this| arg register 2: the IID of interest arg register 3: the outparam instance pointer Most of our QI implementations call NS_TableDrivenQI, which expects arguments like so: arg register 1: |this| arg register 2: the QITableEntry table arg register 3: the IID of interest arg register 4: the outparam instance pointer So we're going to have to do a register shuffle of the IID and the outparam to be able to load the QITableEntry pointer before calling into NS_TableDrivenQI. This patch reorders the argument list of NS_TableDrivenQI so that the first three arguments match the order that QueryInterface receives them in. Then your typical QueryInterface implementation becomes: - load local |table| - tail-call NS_TableDrivenQI Eliminating the register shuffling reduces text size by 12K on an Android ARM build.
27 lines
729 B
C++
27 lines
729 B
C++
/* This Source Code Form is subject to the terms of the Mozilla Public
|
|
* License, v. 2.0. If a copy of the MPL was not distributed with this
|
|
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
|
|
|
|
#include "nsISupportsImpl.h"
|
|
|
|
nsresult NS_FASTCALL
|
|
NS_TableDrivenQI(void* aThis, REFNSIID aIID, void **aInstancePtr,
|
|
const QITableEntry* entries)
|
|
{
|
|
do {
|
|
if (aIID.Equals(*entries->iid)) {
|
|
nsISupports* r =
|
|
reinterpret_cast<nsISupports*>
|
|
(reinterpret_cast<char*>(aThis) + entries->offset);
|
|
NS_ADDREF(r);
|
|
*aInstancePtr = r;
|
|
return NS_OK;
|
|
}
|
|
|
|
++entries;
|
|
} while (entries->iid);
|
|
|
|
*aInstancePtr = nullptr;
|
|
return NS_ERROR_NO_INTERFACE;
|
|
}
|