Advertisement

ARM questions

Started by October 12, 2017 11:06 AM
8 comments, last by vballDrummer 4 years, 9 months ago

So, I have a few questions about the ARM support in Angelscript.

1. Can I use as_callfunc_arm_gcc.S with clang, or is this specifically for gcc?

2. My compiler is complaining about casting a 64 bit void* to asDWORD in as_callfunc_arm.cpp, on lines like these, where secondObject is a void*. Can I ignore this as just a warning instead, or is that unsafe?


paramBuffer[dpos++] = (asDWORD)secondObject;

Thanks!

gcc and clang is for the most part compatible. While I haven't tried it, odds are that as_callfunc_arm_gcc.S will work with clang too.

From your second question I gather that you're compiling for 64bit ARM. Unfortunately AngelScript doesn't yet have support for native calling conventions on 64bit ARM platforms, only 32bit. 

You'll have to use the generic calling convention on 64bit ARM platforms for now. The auto wrapper add-on will allow to skip writing lots of wrappers manually. 

 

AngelCode.com - game development and more - Reference DB - game developer references
AngelScript - free scripting library - BMFont - free bitmap font generator - Tower - free puzzle game

Advertisement

Thanks for the help. I've switched to using 32 bit for now, especially since the platform I'm building for doesn't necessarily need a 64 bit build.

The assembly file does compile and link on clang 32 bit, but I have yet to run it to see if it actually works.

Perhaps a dumb question, but please clarify "switching to 32-bit" …. I've been developing on Win64, but my target is an nVidia Xavier arm64. Can I compile 32-bit with arm-linux-gnueabi-g++ and use native calling or do I need to switch to generic convention on the arm64? Also, having viewed the generic calling convention and auto wrapper add-on, are there any limitations to using generic convention … I'm currently using the following angelscript registrations in my app: RegisterGlobalFunction, RegisterGlobalProperty, RegisterObjectType, RegisterObjectMethod and RegisterFuncdef.

In the meantime, I'll begin the process of adding the generics for !AS_MAX_PORTABILITY on the arm64 and continue to build 64-bit.

I'm not too familiar with developing for mobile devices, but if your target platform allows 32bit apps even though the CPU is capable of 64bit then you can certainly compile for arm32. I think the move by Apple and Google is to stop supporting 32bit apps on iOS and Android (I'm not sure if they already have).

There is no known limitations to the generic calling convention. You'll be able to do everything you already do with the generic calling convention you just need to add the wrappers. The auto-wrappers makes this process quite easy as in most cases it is just a matter of changing the macro for obtaining the function/method pointer, and the templates in the auto-wrapper will take care of creating the wrapper for you. In some cases you may have to manually code the wrapper, but even that is not something that takes up a whole lot of effort.

The need for the wrappers may increase the size of the compiled code a bit (but unless you have a very large API exposed to the script, it should probably not be an significant increase).

The wrappers does not necessarily mean a decreased performance though, in some cases they may even give a performance boost, since the C++ compiler is able to do compile time optimizations that may end up being faster than the runtime dynamic set up done by angelscript to call functions through the native calling convention.

AngelCode.com - game development and more - Reference DB - game developer references
AngelScript - free scripting library - BMFont - free bitmap font generator - Tower - free puzzle game

Putting wrappers on the arm64. How do I wrap new types (classes) and references to types? Below are my !AS_MAX_PORTABILITY registrations:

r = m_pEngine->RegisterObjectType("ScriptEngine", 0, asOBJ_REF | asOBJ_NOCOUNT); assert(r >= 0);
-and-
r = engine->RegisterObjectType("pod", sizeof(pod), asOBJ_VALUE | asOBJ_POD); assert( r >= 0 );

Advertisement

vballDrummer said:

Putting wrappers on the arm64. How do I wrap new types (classes) and references to types? Below are my !AS_MAX_PORTABILITY registrations:

r = m_pEngine->RegisterObjectType("ScriptEngine", 0, asOBJ_REF | asOBJ_NOCOUNT); assert(r >= 0);
-and-
r = engine->RegisterObjectType("pod", sizeof(pod), asOBJ_VALUE | asOBJ_POD); assert( r >= 0 );

Is this working?

None

vballDrummer said:

Putting wrappers on the arm64. How do I wrap new types (classes) and references to types? Below are my !AS_MAX_PORTABILITY registrations:

r = m_pEngine->RegisterObjectType("ScriptEngine", 0, asOBJ_REF | asOBJ_NOCOUNT); assert(r >= 0);
-and-
r = engine->RegisterObjectType("pod", sizeof(pod), asOBJ_VALUE | asOBJ_POD); assert( r >= 0 );

These calls do not change with AS_MAX_PORTABILITY

Only the functions and class methods needs wrappers. All the rest remains the same.

AngelCode.com - game development and more - Reference DB - game developer references
AngelScript - free scripting library - BMFont - free bitmap font generator - Tower - free puzzle game

I did miss that subtlety … only methods where calling convention is used to invoke them need to be changed. I should have thought about that a little longer. My application using generic calling seems to be working on arm64 (lightly tested so far)

Thank you

This topic is closed to new replies.

Advertisement