corrected assembly, from Ulrich Drepper <drepper@cygnus.com> (16612, r=shaver)

This commit is contained in:
shaver%netscape.com 1999-10-19 19:03:01 +00:00
Родитель 312e7468d9
Коммит 4543b5f224
2 изменённых файлов: 37 добавлений и 38 удалений

Просмотреть файл

@ -73,7 +73,7 @@ invoke_count_words(PRUint32 paramCount, nsXPTCVariant* s)
} }
static void static void
invoke_copy_to_stack(PRUint32* d, PRUint32 paramCount, nsXPTCVariant* s) invoke_copy_to_stack(PRUint32 paramCount, nsXPTCVariant* s, PRUint32* d)
{ {
for(PRUint32 i = 0; i < paramCount; i++, d++, s++) for(PRUint32 i = 0; i < paramCount; i++, d++, s++)
{ {
@ -110,28 +110,21 @@ XPTC_InvokeByIndex(nsISupports* that, PRUint32 methodIndex,
PRUint32 paramCount, nsXPTCVariant* params) PRUint32 paramCount, nsXPTCVariant* params)
{ {
PRUint32 result; PRUint32 result;
void* fn_count = invoke_count_words; PRUint32 n = invoke_count_words (paramCount, params) * 4;
void* fn_copy = invoke_copy_to_stack; void (*fn_copy) (unsigned int, nsXPTCVariant *, PRUint32 *) = invoke_copy_to_stack;
int temp1, temp2, temp3;
__asm__ __volatile__( __asm__ __volatile__(
"pushl %4\n\t" "subl %8, %%esp\n\t" /* make room for params */
"pushl %3\n\t" "pushl %%esp\n\t"
"movl %5, %%eax\n\t" "pushl %7\n\t"
"call *%%eax\n\t" /* count words */ "pushl %6\n\t"
"addl $0x8, %%esp\n\t" "call *%0\n\t" /* copy params */
"shl $2, %%eax\n\t" /* *= 4 */
"subl %%eax, %%esp\n\t" /* make room for params */
"movl %%esp, %%edx\n\t"
"pushl %4\n\t"
"pushl %3\n\t"
"pushl %%edx\n\t"
"movl %6, %%eax\n\t"
"call *%%eax\n\t" /* copy params */
"addl $0xc, %%esp\n\t" "addl $0xc, %%esp\n\t"
"movl %1, %%ecx\n\t" "movl %4, %%ecx\n\t"
#ifdef CFRONT_STYLE_THIS_ADJUST #ifdef CFRONT_STYLE_THIS_ADJUST
"movl (%%ecx), %%edx\n\t" "movl (%%ecx), %%edx\n\t"
"movl %2, %%eax\n\t" /* function index */ "movl %5, %%eax\n\t" /* function index */
"shl $3, %%eax\n\t" /* *= 8 */ "shl $3, %%eax\n\t" /* *= 8 */
"addl $8, %%eax\n\t" /* += 8 skip first entry */ "addl $8, %%eax\n\t" /* += 8 skip first entry */
"addl %%eax, %%edx\n\t" "addl %%eax, %%edx\n\t"
@ -142,21 +135,23 @@ XPTC_InvokeByIndex(nsISupports* that, PRUint32 methodIndex,
#else /* THUNK_BASED_THIS_ADJUST */ #else /* THUNK_BASED_THIS_ADJUST */
"pushl %%ecx\n\t" "pushl %%ecx\n\t"
"movl (%%ecx), %%edx\n\t" "movl (%%ecx), %%edx\n\t"
"movl %2, %%eax\n\t" /* function index */ "movl %5, %%eax\n\t" /* function index */
"shl $2, %%eax\n\t" /* *= 4 */ "leal 8(%%edx,%%eax,4), %%edx\n\t"
"addl $8, %%eax\n\t" /* += 8 */
"addl %%eax, %%edx\n\t"
#endif #endif
"call *(%%edx)\n\t" /* safe to not cleanup esp */ "call *(%%edx)\n\t" /* safe to not cleanup esp */
"movl %%eax, %0" "addl $4, %%esp\n\t"
: "=g" (result) /* %0 */ "addl %8, %%esp"
: "g" (that), /* %1 */ : "=a" (result), /* %0 */
"g" (methodIndex), /* %2 */ "=c" (temp1), /* %1 */
"g" (paramCount), /* %3 */ "=d" (temp2), /* %2 */
"g" (params), /* %4 */ "=g" (temp3) /* %3 */
"g" (fn_count), /* %5 */ : "g" (that), /* %4 */
"g" (fn_copy) /* %6 */ "g" (methodIndex), /* %5 */
: "ax", "cx", "dx", "memory" "1" (paramCount), /* %6 */
"2" (params), /* %7 */
"g" (n), /* %8 */
"0" (fn_copy) /* %3 */
: "memory"
); );
return result; return result;

Просмотреть файл

@ -98,7 +98,8 @@ PrepareAndDispatch(nsXPTCStubBase* self, uint32 methodIndex, PRUint32* args)
#define STUB_ENTRY(n) \ #define STUB_ENTRY(n) \
nsresult nsXPTCStubBase::Stub##n() \ nsresult nsXPTCStubBase::Stub##n() \
{ \ { \
register void* method = PrepareAndDispatch; \ register nsresult (*method) (nsXPTCStubBase *, unsigned int, PRUint32 *) = PrepareAndDispatch; \
int temp0, temp1; \
register nsresult result; \ register nsresult result; \
__asm__ __volatile__( \ __asm__ __volatile__( \
"leal 0x0c(%%ebp), %%ecx\n\t" /* args */ \ "leal 0x0c(%%ebp), %%ecx\n\t" /* args */ \
@ -106,10 +107,13 @@ nsresult nsXPTCStubBase::Stub##n() \
"pushl $"#n"\n\t" /* method index */ \ "pushl $"#n"\n\t" /* method index */ \
"movl 0x08(%%ebp), %%ecx\n\t" /* this */ \ "movl 0x08(%%ebp), %%ecx\n\t" /* this */ \
"pushl %%ecx\n\t" \ "pushl %%ecx\n\t" \
"call *%%edx" /* PrepareAndDispatch */ \ "call *%%edx\n\t" /* PrepareAndDispatch */ \
: "=a" (result) /* %0 */ \ "addl $12, %%esp" \
: "d" (method) /* %1 */ \ : "=a" (result), /* %0 */ \
: "cx", "memory" ); \ "=&c" (temp0), /* %1 */ \
"=d" (temp1) /* %2 */ \
: "2" (method) /* %2 */ \
: "memory" ); \
return result; \ return result; \
} }