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

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

mercurial