Back to index

lightning-sunbird  0.9+nobinonly
Defines | Functions
xptcinvoke_ppc_linux.cpp File Reference
#include "xptcprivate.h"

Go to the source code of this file.

Defines

#define GPR_COUNT   8
#define FPR_COUNT   8

Functions

PRUint32 invoke_count_words (PRUint32 paramCount, nsXPTCVariant *s)
void invoke_copy_to_stack (PRUint32 *d, PRUint32 paramCount, nsXPTCVariant *s, PRUint32 *gpregs, double *fpregs)
 XPTC_InvokeByIndex (nsISupports *that, PRUint32 methodIndex, PRUint32 paramCount, nsXPTCVariant *params)

Define Documentation

#define FPR_COUNT   8

Definition at line 58 of file xptcinvoke_ppc_linux.cpp.

#define GPR_COUNT   8

Definition at line 54 of file xptcinvoke_ppc_linux.cpp.


Function Documentation

void invoke_copy_to_stack ( PRUint32 d,
PRUint32  paramCount,
nsXPTCVariant s,
PRUint32 gpregs,
double *  fpregs 
)

Definition at line 67 of file xptcinvoke_ppc_linux.cpp.

{
    PRUint32 gpr = 1; // skip one GP reg for 'that'
    PRUint32 fpr = 0;
    PRUint32 tempu32;
    PRUint64 tempu64;
    
    for(uint32 i = 0; i < paramCount; i++, s++) {
        if(s->IsPtrData())
            tempu32 = (PRUint32) s->ptr;
        else {
            switch(s->type) {
            case nsXPTType::T_FLOAT:                                  break;
            case nsXPTType::T_DOUBLE:                                 break;
            case nsXPTType::T_I8:     tempu32 = s->val.i8;            break;
            case nsXPTType::T_I16:    tempu32 = s->val.i16;           break;
            case nsXPTType::T_I32:    tempu32 = s->val.i32;           break;
            case nsXPTType::T_I64:    tempu64 = s->val.i64;           break;
            case nsXPTType::T_U8:     tempu32 = s->val.u8;            break;
            case nsXPTType::T_U16:    tempu32 = s->val.u16;           break;
            case nsXPTType::T_U32:    tempu32 = s->val.u32;           break;
            case nsXPTType::T_U64:    tempu64 = s->val.u64;           break;
            case nsXPTType::T_BOOL:   tempu32 = s->val.b;             break;
            case nsXPTType::T_CHAR:   tempu32 = s->val.c;             break;
            case nsXPTType::T_WCHAR:  tempu32 = s->val.wc;            break;
            default:                  tempu32 = (PRUint32) s->val.p;  break;
            }
        }

        if (!s->IsPtrData() && s->type == nsXPTType::T_DOUBLE) {
            if (fpr < FPR_COUNT)
                fpregs[fpr++]    = s->val.d;
            else {
                if ((PRUint32) d & 4) d++; // doubles are 8-byte aligned on stack
                *((double*) d) = s->val.d;
                d += 2;
            }
        }
        else if (!s->IsPtrData() && s->type == nsXPTType::T_FLOAT) {
            if (fpr < FPR_COUNT)
                fpregs[fpr++]   = s->val.f; // if passed in registers, floats are promoted to doubles
            else
                *((float*) d++) = s->val.f;
        }
        else if (!s->IsPtrData() && (s->type == nsXPTType::T_I64
                                     || s->type == nsXPTType::T_U64)) {
            if ((gpr + 1) < GPR_COUNT) {
                if (gpr & 1) gpr++; // longlongs are aligned in odd/even register pairs, eg. r5/r6
                *((PRUint64*) &gpregs[gpr]) = tempu64;
                gpr += 2;
            }
            else {
                if ((PRUint32) d & 4) d++; // longlongs are 8-byte aligned on stack
                *((PRUint64*) d)            = tempu64;
                d += 2;
            }
        }
        else {
            if (gpr < GPR_COUNT)
                gpregs[gpr++] = tempu32;
            else
                *d++          = tempu32;
        }
        
    }
}

Here is the call graph for this function:

Definition at line 61 of file xptcinvoke_ppc_linux.cpp.

{
  return PRUint32(((paramCount * 2) + 3) & ~3);
}
XPTC_InvokeByIndex ( nsISupports *  that,
PRUint32  methodIndex,
PRUint32  paramCount,
nsXPTCVariant params 
)

Definition at line 142 of file xptcinvoke_mac.cpp.

{
    return _XPTC_InvokeByIndex(that, methodIndex, paramCount, params);
}