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

Thu, 22 Jan 2015 13:21:57 +0100

author
Michael Schloh von Bennewitz <michael@schloh.com>
date
Thu, 22 Jan 2015 13:21:57 +0100
branch
TOR_BUG_9701
changeset 15
b8a032363ba2
permissions
-rw-r--r--

Incorporate requested changes from Mozilla in review:
https://bugzilla.mozilla.org/show_bug.cgi?id=1123480#c6

     1 /* -*- Mode: C; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 4 -*-
     2  *
     3  * This Source Code Form is subject to the terms of the Mozilla Public
     4  * License, v. 2.0. If a copy of the MPL was not distributed with this
     5  * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
     7 /* Platform specific code to invoke XPCOM methods on native objects */
     9 #include "xptcprivate.h"
    11 extern "C" {
    13 // Remember that these 'words' are 32bit DWORDS
    15 uint32_t
    16 invoke_count_words(uint32_t paramCount, nsXPTCVariant* s)
    17 {
    18     uint32_t result = 0;
    19     for(uint32_t i = 0; i < paramCount; i++, s++)
    20     {
    21         if(s->IsPtrData())
    22         {
    23             result++;
    24             continue;
    25         }
    26         result++;
    27         switch(s->type)
    28         {
    29         case nsXPTType::T_I64    :
    30         case nsXPTType::T_U64    :
    31         case nsXPTType::T_DOUBLE :
    32             result++;
    33             break;
    34         }
    35     }
    36     return result;
    37 }
    39 void
    40 invoke_copy_to_stack(uint32_t paramCount, nsXPTCVariant* s, uint32_t* d)
    41 {
    42     for(uint32_t i = 0; i < paramCount; i++, d++, s++)
    43     {
    44         if(s->IsPtrData())
    45         {
    46             *((void**)d) = s->ptr;
    47             continue;
    48         }
    50 /* XXX: the following line is here (rather than as the default clause in
    51  *      the following switch statement) so that the Sun native compiler
    52  *      will generate the correct assembly code on the Solaris Intel
    53  *      platform. See the comments in bug #28817 for more details.
    54  */
    56         *((void**)d) = s->val.p;
    58         switch(s->type)
    59         {
    60         case nsXPTType::T_I64    : *((int64_t*) d) = s->val.i64; d++;    break;
    61         case nsXPTType::T_U64    : *((uint64_t*)d) = s->val.u64; d++;    break;
    62         case nsXPTType::T_DOUBLE : *((double*)  d) = s->val.d;   d++;    break;
    63         }
    64     }
    65 }
    67 }

mercurial