Angelscript on Raspberry Pi
It would appear that there is something wrong with handling objects registered with the asOBJ_ASHANDLE flag. It could be that the code in as_callfunc_arm.cpp thinks the object is a handle, but in reality it is an object passed/returned by value.
The connection was terrible today and it was taking too long to update the screen to be bearable to continue debugging the code. I'll try again at a later time.
AngelCode.com - game development and more - Reference DB - game developer references
AngelScript - free scripting library - BMFont - free bitmap font generator - Tower - free puzzle game
Actually I think there´s something maxing out the CPU, that´s why you´re seeing a slow screen refresh. I´ll reboot it now so you can continue debugging if you feel like doing it.
EDIT: Done! The RPi is waiting.
I found the problem. The flag AS_CALLEE_DESTROY_OBJ_BY_VAL was defined in as_config.h for gnuc/linux/arm, and this caused AngelScript to skip destroying the CScriptHandles that had been passed by value to the application function. This is what caused the memory leaks and the error message from the GC.
By removing the flag (that was there before you started this work) all tests pass successfully without any memory leaks.
Do you plan on doing anything further on the code? Otherwise I'd like to receive the code so I can merge it into the library.
AngelCode.com - game development and more - Reference DB - game developer references
AngelScript - free scripting library - BMFont - free bitmap font generator - Tower - free puzzle game
Great! So now the work is complete! Until a bug appears...
I´ll send you the files later today so you can integrate them into the lib. I guess we´ll have to run some tests to check if the platform is being correctly identified when using "make" to build the lib.
Now.... All this exposure to ARM asm left me thinking... how difficult could it be to make a JIT compiler (based on an existing one for some other platform)? Maybe I´m being a bit optimistic, but hey, it won´t kill to ask, right?
I'm sure that it wouldn't be too difficult. Though it will likely be a lot of iterations of disassembly, implementation, and testing.
Quarnster has shared an early version that he implemented as a proof of concept.
http://asarmjit.svn.beanstalkapp.com/asarmjit/trunk/ (edit: it seems this link doesn't work anymore. Perhaps it's possible to find the project on google? Or maybe quarnster has it somewhere else?)
Perhaps his work and the JIT compiler that Blind Mind studios wrote for x86 can be combined:
https://github.com/BlindMindStudios/AngelScript-JIT-Compiler
AngelCode.com - game development and more - Reference DB - game developer references
AngelScript - free scripting library - BMFont - free bitmap font generator - Tower - free puzzle game
One thing I forgot to mention is that when I build the lib on the RPi, I need to set the "no-threads" flag, otherwise I get lots of undefined symbol errors. What are the pre-requisites for getting threading to work with the lib?
The gnuc compiler/CPU needs to provide support for atomic instructions, and in your case it must have proper support for Posix threads.
Currently the as_config.h defines AS_NO_ATOMIC. You should probably remove that, and in the makefile make sure to link with pthreads when building your application.
What are the undefined symbols?
AngelCode.com - game development and more - Reference DB - game developer references
AngelScript - free scripting library - BMFont - free bitmap font generator - Tower - free puzzle game
Mmmm.... this is weird. I just rebuilt the library removind the "no-threads" flag to post the errors I was getting, and guess what? It builds fine... I´m sure I was getting undefined references to thread-related functions, and I´m sure those errors went away when I added the flag...
About AS_NO_ATOMIC... what´s exactly its function? What kind of atomic operations does AS expect to be supported and when should them be supported?
It's for the reference counters. Check as_atomic.cpp.
Regards,
Andreas
AngelCode.com - game development and more - Reference DB - game developer references
AngelScript - free scripting library - BMFont - free bitmap font generator - Tower - free puzzle game