Angelscript on Raspberry Pi
About the refactoring: I can test when needed, and of course you can log into my RPi when you feel necessary, I have no problems with that.
I was also thinking about a way to speed up all this parameter passing functions at runtime, maybe at least for functions with "simple" arguments (primitives? int, double, etc) - objects might be more complicated (or not?). In those kind of functions maybe AS, at compile time, can build a "map" that outlines where (in the stack, in register, etc) each argument should be placed. At runtime, the CallSystemFunctionNative(...) function would only have to copy the arguments to the paramBuffer based on what the map says - less decisions to make at runtime. What do you think?
The question is if it is really worth it. The overhead of taking all these runtime decisions haven't shown to be causing any major impact in any of the applications that use AngelScript so far.
AngelCode.com - game development and more - Reference DB - game developer references
AngelScript - free scripting library - BMFont - free bitmap font generator - Tower - free puzzle game
Though, you may want to experiment with using the generic calling convention first. When the ABI is as complex as this, the generic calling convention often ends up winning in terms of performance.
You should also review the functions you call the most frequently to make sure the overhead with the parameters is as small as possible. Definitely avoid passing objects by value, and try to use primitives where possible.
AngelCode.com - game development and more - Reference DB - game developer references
AngelScript - free scripting library - BMFont - free bitmap font generator - Tower - free puzzle game
- If the object has any member that is NOT a float (int, double, etc) the the whole object is passed using the stack.
- If the object is all-floats but has more floats than available "s" registers, then the object is passed using the stack.
- The object doesn´t need to be aligned as a double - in other words, if s0 is already in use, the object will be passed starting at s1.
- The object won´t use any "wasted" registers. In other words, if s0 is in use, d1 is in use but s1 is available, the object will be passed starting at s4.
I think I know how to proceed now.
AngelCode.com - game development and more - Reference DB - game developer references
AngelScript - free scripting library - BMFont - free bitmap font generator - Tower - free puzzle game
Now to the next bug: test_vector3.cpp fails at lines 114 and 120.
// Test some operator overloads
r = ExecuteString(engine, "vector3 v(1,0,0); assert( (v*2).length() == 2 );");
if( r != asEXECUTION_FINISHED )
{
TEST_FAILED;
}
r = ExecuteString(engine, "vector3 v(1,0,0); assert( (2*v).length() == 2 );");
if( r != asEXECUTION_FINISHED )
{
TEST_FAILED;
}
I´ll start investigating this tomorrow, but if you can think of anything obvious to watch for let me know.
Take a look in the scriptmath3d.cpp function RegisterScriptMath3D_Native().
[source]
void RegisterScriptMath3D_Native(asIScriptEngine *engine)
{
int r;
// Register the type
r = engine->RegisterObjectType("vector3", sizeof(Vector3), asOBJ_VALUE | asOBJ_POD | asOBJ_APP_CLASS_CAK); assert( r >= 0 );
[/source]
I believe addding the asOBJ_APP_CLASS_ALLFLOATS flag will make the tests pass successfully.
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 added the asOBJ_APP_CLASS_ALLFLOATS flag when registering the type as you suggested but it didn´t work - meanwhile the operator* is being called using the armFuncR0R1, and based on previous experiences I guess it should be called using armFuncR0, right? So if the problem is that the callConv is getting incremented even when I specify asOBJ_APP_CLASS_ALLFLOATS when registering the object type, maybe there´s some other flag we should check for to see if we have to actually increment callConv or not?
This is the code I´m using to check if I should increment callConv or not:
if( sysFunc->hostReturnInMemory )
if ( !( descr->returnType.GetObjectType()->flags & COMPLEX_RETURN_MASK ) &&
{
int vv=1;
( descr->returnType.GetObjectType()->flags & asOBJ_APP_CLASS_ALLFLOATS ) &&
descr->returnType.GetSizeInMemoryBytes() <= 8 )
vv--;
// The return is made in memory
callConv += vv;
}
(I know this piece of code can be optimized, but it gets the job done and I prefer to leave optimizations as the last step).