Jump to content
  • Advertisement


  • Content Count

  • Joined

  • Last visited

Community Reputation

134 Neutral

About IkarusX

  • Rank
  1. IkarusX

    BlindMindStudios JIT-Compiler and AS 2.3

    Thank you! Can't wait to test it out!
  2. IkarusX

    BlindMindStudios JIT-Compiler and AS 2.3

    GGLucas - Thanks for the head's up! Cannot wait! Had a bad feeling the project just died. Objectively I have only seen benchmarks by others and some of them are old (like this). I personally haven't tried making an apple to apple comparison as that would involve writing equal functions in several scripting languages. And I don't want to write them in Lua or something similar, because I hate it's syntax (that is the reason why I'm here happily using AS ). But I guess I will try to do some benchmarks with some languages if that can improve AS performance down the line. But I did test JIT compilation about a year back and I must say I saw a great increase in speed. A simple loop in AS is about 10x slower than native O3 C++, but only about 3x slower in JIT (I did a loop with 20k iterations calling a C++ function in each one). I don't know about optimizations AS compiler does for things like loops, but maybe even loop unrolling could be of benefit. I have looked into GCCJIT and similar (i.e. Clang related) projects as well that allows JIT compiling using already mature compilation frameworks. So if we had AS JIT just an implementation using gccjit then optimization wise a lot of things would get simpler. Sadly none of those JIT compilers are complete and are only partly maintained. So while it is worth checking out, I don't think it's worth investing now.   The amount of contributors is sadly not large either. I am in a project like that now too, where it is actually very promising and I will personally use it till I die, but it is hard to get others who are competent enough to help and willing enough to do so. As I use AS more and more and I am hoping to help later on with development too. But then you will have to switch to Git. I honestly think that would also help with getting more contributors.   Sadly all I can do is donate the money I can spare. Maybe a bit more popularity to AS is required, before more people start using it. AS is quite old already, but for some reason it didn't catch on as some other languages did.   This is also something I have been pondering about, because I want AS to be used as an extension system as well, not just a scripting language. So I am thinking on how to allow loading and calling dynamic libraries (like dll's on windows) purely from AS. Has anyone tried it? In C++ I would need to use GetProcAddress which involves pointers which we cannot have in AS. In C# it is easier, but doesn't apply here. So is a there a way to load a .dll and call a function from it purely via script?
  3. IkarusX

    BlindMindStudios JIT-Compiler and AS 2.3

    I think an official JIT project would actually be very beneficial, as AS is sadly known to be very slow compared to other scripting languages. JIT greatly reduces these problems. I know it requires a lot of effort and you are the only main developer (AFAIK), but there is already a good base in place. Projects like GCC JIT could also be worth investigating as the base (would make VERY fast code), but it is also slowly developed.
  4. IkarusX

    BlindMindStudios JIT-Compiler and AS 2.3

    I think several of us have tried and failed at one point or another. In my research half a year ago I found that there is only a few places that the changes are needed. But sadly I didn't know enough about AS or the JIT to make the changes. Recently I tried again, but other jobs got in the way. Maybe if we are extra polite Andreas himself will take a stab at it?
  5. IkarusX

    Refactoring suggestions

    While it might be the least important thing in this discussion - I also think you should use GitHub. It is superior to SVN in many ways, even though I agree it might seem more complicated. But programs like GitHub Desktop have greatly reduced the complexity. I personally just don't like SourceForge as a site too (very cluttered) and that is more of a reason why I would like seeing AS on GitHub than actually SVN as source control. Also seeing commits and diff's are a lot easier on GitHub. While I'm trying to fix JIT compiler (still) I noticed that finding changes between AS versions are hard on SourceForge. Ended up downloading two commits and using Windows search to actually find if function is added or removed.
  6. IkarusX

    ASM thumb error when compiling on ARM

    Do you also compile with the thumb instructions or the regular arm? My gcc has defined "--with-mode=thumb". When I added the "#ifndef AS_MAX_PORTABILITY" I got it to compile. But when I launch the project it segfaults on AS functions. It manages to create the engine, but the next function which is registering the error callback crashes (quite ironic). At first I thought it was because of asCALL_CDECL, because at that point I was running the AS_MAX_PORTABILITY flag. So I changed it into asCALL_GENERIC and same thing. I posted both of the segfaults. The callstack doesn't go any deeper than this. The whole backtrace only shows the path until it calls this function.     Then I tried removing it, just to see if it would go further. But the next function is RegisterStdString, which then calls RegisterStdStringGeneric and crashes. It also compiled when I removed the AS_MAX_PORTABILITY and instead added the -marm flag (which is the same as --with-mode=arm). In that case everything is the same. It crashes at SetMessageCallback and when I remove it, it calls RegisterStdString, which then calls RegisterStdStringNative and crashes. Here is the full backtrace for both:   Everything works fine on Windows x86 and x64. I'm using the 2.30 version of AS.
  7. Hi. I tried compiling AS on Jetson Tegra K1 which uses ARM processor. I used the gnuc makefile and everything compiles except as_callfunc_arm.cpp.s. It returns error about THUMB instruction not being in IT block. The whole log: You can also see I tried compiling with -DAS_MAX_PORTABILITY with the idea it will not use the ASM at all, but it still compiled it and threw the error. Is there some kind of flag I need to change? The ASM has defined blocks for THUMB1, THUMB2 and ARM, so techniclly I could disable THUMB and fallback to ARM?   Compiler: For some reason I cannot post the whole g++ -v here. So I posted it here: http://pastebin.com/n4uXrVXb    
  8. IkarusX

    CallSystemFunction signature change

    FYI I posted a ticket on the JIT repo as well: https://github.com/BlindMindStudios/AngelScript-JIT-Compiler/issues/18 Maybe I too will try to make it work looking at the AS diff.
  9. IkarusX

    Threading execution

    I have weird results with globals. The docs doesn't say how the globals a defined, it just says:     Which is okay, as I understand "global" as in C++ global. That means in script like this: int a = 0; //This is global void main(){ print("A = "+formatInt(a,"")+"\n"); ++a; } the int a is global right? I get confirmation on my theory when I set "SetEngineProperty(asEP_DISALLOW_GLOBAL_VARS, true)" which makes the script error out because of the global variable. But if I load the same code in two theads with two contexts (but the same module name) I get this output: One thread sleeps for 100ms after each script call, while the other sleeps 1100ms. I would expect to see a getting incremented all the time, but here the two threads use a different variable "a". If a is global, then it should be shared by contexts within a module no? This is actually what I need and what I want, but it contradicts the docs. Maybe I'm doing something wrong.   And how would I create a unqiue struct instance inside AS? I want to make a system where a person can create all the things he needs only using scripts, so he wouldn't need to create a C++ struct and pass it in. So I get that I can do this: struct number{ int a; } void init(){ number n; n.a = 5; } void update(){ //How to access unique number.a? I could access global a here. } But each execution will have the same object?
  10. IkarusX

    Threading execution

    Thank you for all the answers.   This might be the issue. I ran Build on several threads thinking it will just wait internally. I will probably do your queue method later, but right now I just did while (r == asBUILD_IN_PROGRESS) r = mod->Build(). For now I haven't gotten the empty section error.   Good tip! It's just that GetModule() also creates the module (with proper flag or when using scriptbuilder) and so I was just thinking GetFunction also does that. Only when function->Released() crashed my program did I came to realize it's somehow different.   I compile with GCC and -pthread flag (which links with -lpthread and defines the -D_REENTRANT. I also tried disabling string pool thinking it might not be thread safe, but after looking at the formatInt function I don't see why it would crash for me. It just does sprintf. So I went back to no-threading just to see if the problem is somewhere else. And weirdly enough it now crashes without threads too. It did work previously though, so I'm not sure what's the problem. Will look into this in the morning.   When I fix my integer to string problem I will look into how to deal with globals painlessly.   edit: 30 seconds after posting I tried another thing which I totally forgotten - I use Jit by BlindMindStudios. And I haven't tried formatInt with Jit. It turns out that it is the reason why it crashes. If I remove Jit the function works fine. Can anyone replicate this?
  11. IkarusX

    Threading execution

    Hello! I have started using AS and it's been a blast. The best scripting language I have used hands down.   But now I have hit a hurdle. I'm making a block based system - you take many blocks and link them all together. Every block is programmed in AS and threaded. Now the question is which parts I can thread? The doc's says the engine is totally thread safe if I only use one. Couldn't see anything specific about contexts or modules. Recent commits seems to have put locks on modules though (haven't tested the WIP version), which seems to me that it wasn't thread safe. I have tried this: //This is done once asPrepareMultithread(); asIScriptEngine *engine = asCreateScriptEngine(ANGELSCRIPT_VERSION); //Then in each thread: asIScriptContext *ctx = engine->CreateContext(); string code; as::LoadScriptFile(script, code); asAcquireExclusiveLock(); asIScriptModule *mod = engine->GetModule("my_module", asGM_ALWAYS_CREATE); asReleaseExclusiveLock(); mod->AddScriptSection("my_module", code.c_str()); // Build the module int r = mod->Build(); if( r < 0 ) { printf("Please correct the errors in the script and try again.\n"); return; } asIScriptFunction *func = mod->GetFunctionByDecl("void main()"); if( func == 0 ) { printf("The script must have the function %s. Please add it and try again.\n", function.c_str()); return -1; } while (true){ //This executes the function in the thread until it breaks ctx->Prepare(func); int r = ctx->Execute(); if (thread_break == true) break; } ctx->Release(); asThreadCleanup(); //Here threads end The problem here is that it sometimes crashes. When I put asAcquireExclusiveLock(); around every as call then it doesn't, but then it impacts the framerate as it stalls for large amount of time. So what else needs to be locked specify? I could experiment and find out, but I would like to know what is recommend. Like if GetModule are not thread safe, then is GetFunctionByDecl neither? What is thread specific? Like can I call a function from the same context in two threads the same time (if they don't have any shared or global variables)? Do I need to Release "function" pointers just like I need to release contexts and engines?   And I seem to have problems with "Script section empty" error. I have tried several methods on loading files and I don't know why, but it sometimes fails. I tried the ScriptBuilder, as well as code from "Compiling scripts" section of the docs. When I have this error, I have to modify and save the file again for it to load. I do autoload files though based on their modify date, which could be the issue (I load it before it has finished writing on the disk??). I will add a delay and see if that helps. I do see that in threads formatInt() and other string functions crashes. Not sure if I'm at fault.   Another question is about variable sharing. I need to have several blocks, like "BlockA" and "BlockB". I need have several instances of the same block, like "BlockA1" and "BlockA2". Then I need to execute the blocks in parallel without them interfering with one another. In AS terms each of my unique blocks (A and B) would be separate modules - "ModuleA" and "ModuleB". Then separate instances of blocks would be different contexts "ContextA1" and "ContextA2" right? So if contexts are different, then they won't interfere with one another? Like I need them to have global variables (declared outside any function, so it holds the state if you will), because each block is made out of several functions. Like this: int s = 0; //State that doesn't change between function calls void funcInit(){ //This is called from C++ s = 5; } void funcUpdate(){ s = s + 1; //This changes the state and is called from C++ } I guess this is how something like that would work?
  • Advertisement

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

GameDev.net is your game development community. Create an account for your GameDev Portfolio and participate in the largest developer community in the games industry.

Sign me up!