Jump to content
  • Advertisement
Sign in to follow this  
Sami Vuorela

BMS JIT crashes during script compilation

This topic is 1505 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

I've been trying to use the Blind Mind Studios' JIT compiler for AS, but never got it working.


My setup is:

  • MSVC 2013
  • 64bit
  • Angelscript version 2.29.1
  • latest version of the JIT (update 23 10 2014)


I'm building these files along with my project:

  • as_jit.cpp
  • virtual_asm_windows.cpp
  • virtual_asm_x64.cpp

I hope thats correct, anything else seemed to cause linker errors.


I'm starting the JIT like this:

asCJITCompiler* jit = new asCJITCompiler(0);
engine->SetEngineProperty(as::asEP_INCLUDE_JIT_INSTRUCTIONS, 1);

Right after engine creation, before compiling or running any scripts.




The problem is that script compilation crashes every time, if the script is anything even remotely complex. Calling a few print functions works fine, but trying to create even 1 object causes the compilation to crash.


This is the call stack when it crashes: 

  KernelBase.dll!000007fefcc8940d() Unknown
  msvcr120d.dll!000007fee439c366() Unknown
> as tests_debug.exe!AngelScript::assembler::Processor::end_short_jump(void * p) Line 547 C++
  as tests_debug.exe!AngelScript::asCJITCompiler::CompileFunction(AngelScript::asIScriptFunction * function, void (AngelScript::asSVMRegisters *, unsigned __int64) * * output) Line 1840 C++
  as tests_debug.exe!AngelScript::asCScriptFunction::JITCompile() Line 1439 C++
  as tests_debug.exe!AngelScript::asCModule::JITCompile() Line 241 C++
  as tests_debug.exe!AngelScript::asCModule::Build() Line 290 C++
  as tests_debug.exe!AngelScript::CScriptBuilder::Build() Line 501 C++
  as tests_debug.exe!AngelScript::CScriptBuilder::BuildModule() Line 104 C++
  as tests_debug.exe!AngelScript::main_contents() Line 19 C++
  as tests_debug.exe!main() Line 47 C++
  [External Code] 


This thing seems to be throwing its exception, because offset is 138 and CHAR_MAX is 127

void assembler::Processor::end_short_jump(void* p) {
  volatile byte* jumpFrom = (volatile byte*)p;
  int64_t offset = ((size_t)op - (size_t)jumpFrom) - 1;
  if(offset < CHAR_MIN || offset > CHAR_MAX)
    throw "Short jump too long.";
  *jumpFrom = (char)offset;



Am I doing something wrong or is the JIT broked?
Edited by Sami Vuorela

Share this post

Link to post
Share on other sites

In the future, please report issues with the JIT to the github page. I only check this forum occasionally, while the github page will notify me of new issues.


It looks like the function call being made for the FREE is larger than expected. I'll fix this shortly.

Share this post

Link to post
Share on other sites
Sign in to follow this  

  • 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!