Jump to content
Posted 28 December 2012 - 07:03 PM
Posted 28 December 2012 - 07:09 PM
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.
Edited by Tzarls, 28 December 2012 - 07:15 PM.
Posted 30 December 2012 - 09:44 AM
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.
Posted 30 December 2012 - 11:55 AM
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?
Posted 30 December 2012 - 02:31 PM
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:
Edited by Andreas Jonsson, 30 December 2012 - 02:34 PM.
Posted 01 January 2013 - 05:53 PM
Posted 01 January 2013 - 06:57 PM
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?
Posted 01 January 2013 - 07:30 PM
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?
Posted 01 January 2013 - 10:47 PM
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?
Edited by Tzarls, 01 January 2013 - 11:19 PM.
Posted 02 January 2013 - 07:13 AM
It's for the reference counters. Check as_atomic.cpp.
Posted 10 January 2013 - 04:55 AM
http://asarmjit.svn....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?)
It lives in https://github.com/quarnster/asarmjit nowadays, although it's untouched since I last worked on it so probably needs changes to work at all and I never got around to implementing a satisfying solution to the floating point operations, so none of those byte codes were ever implemented.
There's also my AOT compiler at https://github.com/quarnster/asaot which IIRC tested successfully on Android, but again has been untouched for a while so might need changes too.
Not entierly related to Angelscript, but I also have a small standalone fork of Mozilla's nanojit at https://github.com/quarnster/nanojit/tree/master/nanojit if you want to write your own platform independent jit. At the time of the fork the License was MPL1.1/GPL 2.0/LGPL 2.1, but looks like the TOT version http://hg.mozilla.org/tamarin-redux/file/f5191c18b0e4/nanojit has been updated to MPL2.0. I don't recall exactly what the obligations under MPL1.1 are, but I know that MPL2.0 is not viral so that you can statically link in MPL2.0 code without having to make your whole program's source code available, nor do you need to make the object code (for re-linking) available. If you make any changes to the MPL2.0 licensed files themselves you have to make those source code changes available though.