MCPcopy Create free account
hub / github.com/anjo76/angelscript / CallSystemFunctionNative

Function CallSystemFunctionNative

sdk/angelscript/source/as_callfunc_arm.cpp:297–685  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

295extern "C" asQWORD armFuncR0ObjLast (const asDWORD *, int, asFUNCTION_t, asDWORD r0, asDWORD obj);
296
297asQWORD CallSystemFunctionNative(asCContext *context, asCScriptFunction *descr, void *obj, asDWORD *args, void *retPointer, asQWORD &retQW2, void *secondObject)
298{
299 asCScriptEngine *engine = context->m_engine;
300 asSSystemFunctionInterface *sysFunc = descr->sysFuncIntf;
301 int callConv = sysFunc->callConv;
302
303 asQWORD retQW = 0;
304 asFUNCTION_t func = sysFunc->func;
305 int paramSize = sysFunc->paramSize;
306 asFUNCTION_t *vftable;
307
308 //---------------------------------------------------------------------------- RPi
309 int freeFloatSlot = VFP_OFFSET;
310 int freeDoubleSlot = VFP_OFFSET;
311 int stackPos = STACK_OFFSET;
312 int stackSize = 0;
313 //----------------------------------------------------------------------------
314
315 //---------------------------------------------------------------------------- RPi
316 // We�ll divide paramBuffer into several segments:
317 //
318 // 0-1 Unused
319 // 2-5 (+8 / +0 asm) values that should be placed in R0 - R3
320 // 6-67 (+24 / +16 asm) values that should be placed on the stack
321 // 68 (+272 / +264 asm) number of values stored in r registers (R0 - R3)
322 // 69 (+276 / +268 asm) number of args stored on the stack
323 // 70-85 (+280 / +272 asm) values that should be placed in VFP registers (16)
324 // 86-87 (+344 / +336 asm) sp original value - sp final value - for debugging
325 // 88-103 (+352 / +344 asm) Check area for free-used VFP registers
326 //
327 // Total number of elements: 104
328 //
329 // When passing the paramBuffer to the asm routines via the args pointer we are
330 // offsetting the start of the array to being at element # 2. That�s why in asm
331 // all addresses must have an offset of -2 words (-8 bytes).
332 //---------------------------------------------------------------------------- RPi
333
334 asDWORD paramBuffer[PARAM_BUFFER_SIZE];
335 memset(paramBuffer, 0, sizeof(asDWORD) * PARAM_BUFFER_SIZE);
336
337 if( sysFunc->hostReturnInMemory )
338 {
339 // TODO: runtime optimize: This check should be done in PrepareSystemFunction
340 if ( !( descr->returnType.GetTypeInfo()->flags & COMPLEX_RETURN_MASK ) &&
341 ( descr->returnType.GetTypeInfo()->flags & asOBJ_APP_CLASS_ALLFLOATS ) &&
342 descr->returnType.GetSizeInMemoryBytes() <= 16 )
343 callConv--;
344
345 // The return is made in memory
346 callConv++;
347 }
348
349 bool isThisCallMethod = callConv >= ICC_THISCALL_OBJLAST;
350
351 // Linux needs to align 64bit types on even registers, but this isn't done on iOS or Windows Phone
352 // TODO: optimize runtime: There should be a check for this in PrepareSystemFunction() so this
353 // doesn't have to be done for functions that don't have any 64bit types
354 {

Callers

nothing calls this directly

Calls 15

FuncPtrToUIntFunction · 0.85
GetTypeInfoMethod · 0.80
GetSizeInMemoryBytesMethod · 0.80
IsObjectMethod · 0.80
IsObjectHandleMethod · 0.80
GetSizeInMemoryDWordsMethod · 0.80
GetSizeOnStackDWordsMethod · 0.80
CallFreeMethod · 0.80
IsFloatTypeMethod · 0.80
IsDoubleTypeMethod · 0.80
GetTokenTypeMethod · 0.80
IsAnyTypeMethod · 0.80

Tested by

no test coverage detected