hhyyrylainen / Leviathan

Leviathan Game Engine
Other
17 stars 8 forks source link

Added AngelscriptJIT #42

Closed NillyTheKid closed 5 years ago

NillyTheKid commented 5 years ago

Issue #6

I'm unsure whether the JIT is actually being used to execute the scripts and have yet to add an optional build flag for the engine to use it.

hhyyrylainen commented 5 years ago

It's now compiling but the tests are failing. It seems to be related to supporting exceptions going through the scripts.

NillyTheKid commented 5 years ago

I believe the JIT might not be able to deal with exceptions Since the tests only run succesfully on my machine when I disable it (JIT is disabled in this commit)

hhyyrylainen commented 5 years ago

Well, then the JIT needs to be modified to support exceptions. I think as it currently doesn't hard crash the only problem is that the exception is not properly translated and instead the JIT swallows the message.

Of course if it is too difficult it might be possible to write a new JIT implementation using LLVM (and that should handle exceptions just fine): https://stackoverflow.com/questions/27731637/llvm-jit-pass-c-exception-through-jit-code-back-to-host-application

That could then also in theory be used to have C++ files as "scripts" or just take advantage of debug information creation that LLVM JIT can do (that maybe would make debugging scripts easier?).

NillyTheKid commented 5 years ago

After looking into it I noticed I don't have the skill or knowledge required to implement the JIT yet I'll close the pull request and move back to dealing with simpler, smaller issues to get more comfortable with the inner workings of Leviathan and Thrive