xpcom/reflect/xptcall/src/md/unix/xptcstubs_x86_solaris.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/xptcstubs_x86_solaris.cpp	Wed Dec 31 06:09:35 2014 +0100
     1.3 @@ -0,0 +1,77 @@
     1.4 +/* -*- Mode: C; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 4 -*-
     1.5 + *
     1.6 + * This Source Code Form is subject to the terms of the Mozilla Public
     1.7 + * License, v. 2.0. If a copy of the MPL was not distributed with this
     1.8 + * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
     1.9 +
    1.10 +/* Implement shared vtbl methods. */
    1.11 +
    1.12 +#include "xptcprivate.h"
    1.13 +#include "xptiprivate.h"
    1.14 +
    1.15 +nsresult ATTRIBUTE_USED
    1.16 +PrepareAndDispatch(nsXPTCStubBase* self, uint32_t methodIndex, uint32_t* args)
    1.17 +{
    1.18 +#define PARAM_BUFFER_COUNT     16
    1.19 +
    1.20 +    nsXPTCMiniVariant paramBuffer[PARAM_BUFFER_COUNT];
    1.21 +    nsXPTCMiniVariant* dispatchParams = nullptr;
    1.22 +    const nsXPTMethodInfo* info;
    1.23 +    uint8_t paramCount;
    1.24 +    uint8_t i;
    1.25 +    nsresult result = NS_ERROR_FAILURE;
    1.26 +
    1.27 +    NS_ASSERTION(self,"no self");
    1.28 +
    1.29 +    self->mEntry->GetMethodInfo(uint16_t(methodIndex), &info);
    1.30 +    NS_ASSERTION(info,"no interface info");
    1.31 +
    1.32 +    paramCount = info->GetParamCount();
    1.33 +
    1.34 +    // setup variant array pointer
    1.35 +    if(paramCount > PARAM_BUFFER_COUNT)
    1.36 +        dispatchParams = new nsXPTCMiniVariant[paramCount];
    1.37 +    else
    1.38 +        dispatchParams = paramBuffer;
    1.39 +    NS_ASSERTION(dispatchParams,"no place for params");
    1.40 +
    1.41 +    uint32_t* ap = args;
    1.42 +    for(i = 0; i < paramCount; i++, ap++)
    1.43 +    {
    1.44 +        const nsXPTParamInfo& param = info->GetParam(i);
    1.45 +        const nsXPTType& type = param.GetType();
    1.46 +        nsXPTCMiniVariant* dp = &dispatchParams[i];
    1.47 +
    1.48 +        if(param.IsOut() || !type.IsArithmetic())
    1.49 +        {
    1.50 +            dp->val.p = (void*) *ap;
    1.51 +            continue;
    1.52 +        }
    1.53 +        // else
    1.54 +	    dp->val.p = (void*) *ap;
    1.55 +        switch(type)
    1.56 +        {
    1.57 +        case nsXPTType::T_I64    : dp->val.i64 = *((int64_t*) ap); ap++; break;
    1.58 +        case nsXPTType::T_U64    : dp->val.u64 = *((uint64_t*)ap); ap++; break;
    1.59 +        case nsXPTType::T_DOUBLE : dp->val.d   = *((double*)  ap); ap++; break;
    1.60 +        }
    1.61 +    }
    1.62 +
    1.63 +    result = self->mOuter->CallMethod((uint16_t)methodIndex, info, dispatchParams);
    1.64 +
    1.65 +    if(dispatchParams != paramBuffer)
    1.66 +        delete [] dispatchParams;
    1.67 +
    1.68 +    return result;
    1.69 +}
    1.70 +
    1.71 +#define STUB_ENTRY(n)
    1.72 +
    1.73 +#define SENTINEL_ENTRY(n) \
    1.74 +nsresult nsXPTCStubBase::Sentinel##n() \
    1.75 +{ \
    1.76 +    NS_ERROR("nsXPTCStubBase::Sentinel called"); \
    1.77 +    return NS_ERROR_NOT_IMPLEMENTED; \
    1.78 +}
    1.79 +
    1.80 +#include "xptcstubsdef.inc"

mercurial