xpcom/reflect/xptcall/src/md/win32/xptcinvoke_x86_64.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 /* This Source Code Form is subject to the terms of the Mozilla Public
michael@0 3 * License, v. 2.0. If a copy of the MPL was not distributed with this
michael@0 4 * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
michael@0 5
michael@0 6 /* Platform specific code to invoke XPCOM methods on native objects */
michael@0 7
michael@0 8 #include "xptcprivate.h"
michael@0 9
michael@0 10 extern "C" void
michael@0 11 invoke_copy_to_stack(uint64_t* d, uint32_t paramCount, nsXPTCVariant* s)
michael@0 12 {
michael@0 13 for(; paramCount > 0; paramCount--, d++, s++)
michael@0 14 {
michael@0 15 if(s->IsPtrData())
michael@0 16 {
michael@0 17 *((void**)d) = s->ptr;
michael@0 18 continue;
michael@0 19 }
michael@0 20
michael@0 21 /*
michael@0 22 * AMD64 platform uses 8 bytes align.
michael@0 23 */
michael@0 24
michael@0 25 switch(s->type)
michael@0 26 {
michael@0 27 case nsXPTType::T_I8 : *((int8_t*) d) = s->val.i8; break;
michael@0 28 case nsXPTType::T_I16 : *((int16_t*) d) = s->val.i16; break;
michael@0 29 case nsXPTType::T_I32 : *((int32_t*) d) = s->val.i32; break;
michael@0 30 case nsXPTType::T_I64 : *((int64_t*) d) = s->val.i64; break;
michael@0 31 case nsXPTType::T_U8 : *((uint8_t*) d) = s->val.u8; break;
michael@0 32 case nsXPTType::T_U16 : *((uint16_t*)d) = s->val.u16; break;
michael@0 33 case nsXPTType::T_U32 : *((uint32_t*)d) = s->val.u32; break;
michael@0 34 case nsXPTType::T_U64 : *((uint64_t*)d) = s->val.u64; break;
michael@0 35 case nsXPTType::T_FLOAT : *((float*) d) = s->val.f; break;
michael@0 36 case nsXPTType::T_DOUBLE : *((double*) d) = s->val.d; break;
michael@0 37 case nsXPTType::T_BOOL : *((bool*) d) = s->val.b; break;
michael@0 38 case nsXPTType::T_CHAR : *((char*) d) = s->val.c; break;
michael@0 39 case nsXPTType::T_WCHAR : *((wchar_t*) d) = s->val.wc; break;
michael@0 40 default:
michael@0 41 // all the others are plain pointer types
michael@0 42 *((void**)d) = s->val.p;
michael@0 43 break;
michael@0 44 }
michael@0 45 }
michael@0 46 }
michael@0 47
michael@0 48 extern "C" nsresult
michael@0 49 XPTC__InvokebyIndex(nsISupports* that, uint32_t methodIndex,
michael@0 50 uint32_t paramCount, nsXPTCVariant* params);
michael@0 51
michael@0 52 extern "C"
michael@0 53 EXPORT_XPCOM_API(nsresult)
michael@0 54 NS_InvokeByIndex(nsISupports* that, uint32_t methodIndex,
michael@0 55 uint32_t paramCount, nsXPTCVariant* params)
michael@0 56 {
michael@0 57 return XPTC__InvokebyIndex(that, methodIndex, paramCount, params);
michael@0 58 }
michael@0 59

mercurial