xpcom/reflect/xptcall/src/md/win32/xptcinvoke_x86_64.cpp

changeset 0
6474c204b198
     1.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     1.2 +++ b/xpcom/reflect/xptcall/src/md/win32/xptcinvoke_x86_64.cpp	Wed Dec 31 06:09:35 2014 +0100
     1.3 @@ -0,0 +1,59 @@
     1.4 +/* -*- Mode: C; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
     1.5 +/* This Source Code Form is subject to the terms of the Mozilla Public
     1.6 + * License, v. 2.0. If a copy of the MPL was not distributed with this
     1.7 + * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
     1.8 +
     1.9 +/* Platform specific code to invoke XPCOM methods on native objects */
    1.10 +
    1.11 +#include "xptcprivate.h"
    1.12 +
    1.13 +extern "C" void
    1.14 +invoke_copy_to_stack(uint64_t* d, uint32_t paramCount, nsXPTCVariant* s)
    1.15 +{
    1.16 +   for(; paramCount > 0; paramCount--, d++, s++)
    1.17 +    {
    1.18 +        if(s->IsPtrData())
    1.19 +        {
    1.20 +            *((void**)d) = s->ptr;
    1.21 +            continue;
    1.22 +        }
    1.23 +
    1.24 +        /*
    1.25 +         * AMD64 platform uses 8 bytes align.
    1.26 +         */
    1.27 +
    1.28 +        switch(s->type)
    1.29 +        {
    1.30 +        case nsXPTType::T_I8     : *((int8_t*)  d) = s->val.i8;          break;
    1.31 +        case nsXPTType::T_I16    : *((int16_t*) d) = s->val.i16;         break;
    1.32 +        case nsXPTType::T_I32    : *((int32_t*) d) = s->val.i32;         break;
    1.33 +        case nsXPTType::T_I64    : *((int64_t*) d) = s->val.i64;         break;
    1.34 +        case nsXPTType::T_U8     : *((uint8_t*) d) = s->val.u8;          break;
    1.35 +        case nsXPTType::T_U16    : *((uint16_t*)d) = s->val.u16;         break;
    1.36 +        case nsXPTType::T_U32    : *((uint32_t*)d) = s->val.u32;         break;
    1.37 +        case nsXPTType::T_U64    : *((uint64_t*)d) = s->val.u64;         break;
    1.38 +        case nsXPTType::T_FLOAT  : *((float*)   d) = s->val.f;           break;
    1.39 +        case nsXPTType::T_DOUBLE : *((double*)  d) = s->val.d;           break;
    1.40 +        case nsXPTType::T_BOOL   : *((bool*)  d) = s->val.b;           break;
    1.41 +        case nsXPTType::T_CHAR   : *((char*)    d) = s->val.c;           break;
    1.42 +        case nsXPTType::T_WCHAR  : *((wchar_t*) d) = s->val.wc;          break;
    1.43 +        default:
    1.44 +            // all the others are plain pointer types
    1.45 +            *((void**)d) = s->val.p;
    1.46 +            break;
    1.47 +        }
    1.48 +    }
    1.49 +}
    1.50 +
    1.51 +extern "C" nsresult
    1.52 +XPTC__InvokebyIndex(nsISupports* that, uint32_t methodIndex,
    1.53 +                    uint32_t paramCount, nsXPTCVariant* params);
    1.54 +
    1.55 +extern "C"
    1.56 +EXPORT_XPCOM_API(nsresult)
    1.57 +NS_InvokeByIndex(nsISupports* that, uint32_t methodIndex,
    1.58 +                   uint32_t paramCount, nsXPTCVariant* params)
    1.59 +{
    1.60 +    return XPTC__InvokebyIndex(that, methodIndex, paramCount, params);
    1.61 +}
    1.62 +

mercurial