1.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000 1.2 +++ b/xpcom/reflect/xptcall/src/md/unix/xptcinvoke_x86_solaris.cpp Wed Dec 31 06:09:35 2014 +0100 1.3 @@ -0,0 +1,67 @@ 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 +/* Platform specific code to invoke XPCOM methods on native objects */ 1.11 + 1.12 +#include "xptcprivate.h" 1.13 + 1.14 +extern "C" { 1.15 + 1.16 +// Remember that these 'words' are 32bit DWORDS 1.17 + 1.18 +uint32_t 1.19 +invoke_count_words(uint32_t paramCount, nsXPTCVariant* s) 1.20 +{ 1.21 + uint32_t result = 0; 1.22 + for(uint32_t i = 0; i < paramCount; i++, s++) 1.23 + { 1.24 + if(s->IsPtrData()) 1.25 + { 1.26 + result++; 1.27 + continue; 1.28 + } 1.29 + result++; 1.30 + switch(s->type) 1.31 + { 1.32 + case nsXPTType::T_I64 : 1.33 + case nsXPTType::T_U64 : 1.34 + case nsXPTType::T_DOUBLE : 1.35 + result++; 1.36 + break; 1.37 + } 1.38 + } 1.39 + return result; 1.40 +} 1.41 + 1.42 +void 1.43 +invoke_copy_to_stack(uint32_t paramCount, nsXPTCVariant* s, uint32_t* d) 1.44 +{ 1.45 + for(uint32_t i = 0; i < paramCount; i++, d++, s++) 1.46 + { 1.47 + if(s->IsPtrData()) 1.48 + { 1.49 + *((void**)d) = s->ptr; 1.50 + continue; 1.51 + } 1.52 + 1.53 +/* XXX: the following line is here (rather than as the default clause in 1.54 + * the following switch statement) so that the Sun native compiler 1.55 + * will generate the correct assembly code on the Solaris Intel 1.56 + * platform. See the comments in bug #28817 for more details. 1.57 + */ 1.58 + 1.59 + *((void**)d) = s->val.p; 1.60 + 1.61 + switch(s->type) 1.62 + { 1.63 + case nsXPTType::T_I64 : *((int64_t*) d) = s->val.i64; d++; break; 1.64 + case nsXPTType::T_U64 : *((uint64_t*)d) = s->val.u64; d++; break; 1.65 + case nsXPTType::T_DOUBLE : *((double*) d) = s->val.d; d++; break; 1.66 + } 1.67 + } 1.68 +} 1.69 + 1.70 +}