xpcom/reflect/xptcall/src/md/unix/xptcinvoke_ppc_aix64.cpp

changeset 0
6474c204b198
     1.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     1.2 +++ b/xpcom/reflect/xptcall/src/md/unix/xptcinvoke_ppc_aix64.cpp	Wed Dec 31 06:09:35 2014 +0100
     1.3 @@ -0,0 +1,63 @@
     1.4 +/* This Source Code Form is subject to the terms of the Mozilla Public
     1.5 + * License, v. 2.0. If a copy of the MPL was not distributed with this
     1.6 + * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
     1.7 +
     1.8 +/* Platform specific code to invoke XPCOM methods on native objects */
     1.9 +
    1.10 +#include "xptcprivate.h"
    1.11 +
    1.12 +#ifdef _AIX
    1.13 +
    1.14 +extern "C" void
    1.15 +invoke_copy_to_stack(uint64_t* d, uint32_t paramCount, nsXPTCVariant* s, double *fprData)
    1.16 +{
    1.17 +/*
    1.18 +    We need to copy the parameters for this function to locals and use them
    1.19 +    from there since the parameters occupy the same stack space as the stack
    1.20 +    we're trying to populate.
    1.21 +*/
    1.22 +    uint64_t *l_d = d;
    1.23 +    nsXPTCVariant *l_s = s;
    1.24 +    uint32_t l_paramCount = paramCount, fpCount = 0;
    1.25 +    double *l_fprData = fprData;
    1.26 +
    1.27 +    for(uint32_t i = 0; i < l_paramCount; i++, l_d++, l_s++)
    1.28 +    {
    1.29 +        if(l_s->IsPtrData())
    1.30 +        {
    1.31 +            *l_d = (uint64_t)l_s->ptr;
    1.32 +            continue;
    1.33 +        }
    1.34 +        switch(l_s->type)
    1.35 +        {
    1.36 +        case nsXPTType::T_I8:    *l_d = (uint64_t)l_s->val.i8;   break;
    1.37 +        case nsXPTType::T_I16:   *l_d = (uint64_t)l_s->val.i16;  break;
    1.38 +        case nsXPTType::T_I32:   *l_d = (uint64_t)l_s->val.i32;  break;
    1.39 +        case nsXPTType::T_I64:   *l_d = (uint64_t)l_s->val.i64;  break;
    1.40 +        case nsXPTType::T_U8:    *l_d = (uint64_t)l_s->val.u8;   break;
    1.41 +        case nsXPTType::T_U16:   *l_d = (uint64_t)l_s->val.u16;  break;
    1.42 +        case nsXPTType::T_U32:   *l_d = (uint64_t)l_s->val.u32;  break;
    1.43 +        case nsXPTType::T_U64:   *l_d = (uint64_t)l_s->val.u64;  break;
    1.44 +        case nsXPTType::T_BOOL:  *l_d = (uint64_t)l_s->val.b;    break;
    1.45 +        case nsXPTType::T_CHAR:  *l_d = (uint64_t)l_s->val.c;    break;
    1.46 +        case nsXPTType::T_WCHAR: *l_d = (uint64_t)l_s->val.wc;   break;
    1.47 +
    1.48 +        case nsXPTType::T_DOUBLE:
    1.49 +            *((double*)l_d) = l_s->val.d;
    1.50 +            if(fpCount < 13)
    1.51 +                l_fprData[fpCount++] = l_s->val.d;
    1.52 +            break;
    1.53 +        case nsXPTType::T_FLOAT:
    1.54 +            *((float*)l_d) = l_s->val.f;
    1.55 +            if(fpCount < 13)
    1.56 +                l_fprData[fpCount++] = l_s->val.f;
    1.57 +            break;
    1.58 +        default:
    1.59 +            // all the others are plain pointer types
    1.60 +            *l_d = (uint64_t)l_s->val.p;
    1.61 +            break;
    1.62 +        }
    1.63 +    }
    1.64 +}
    1.65 +#endif
    1.66 +

mercurial