| 13 | static void OutputJitLog(const asmjit::StringLogger &logger); |
| 14 | |
| 15 | JitFuncPtr JitCompile(VMScriptFunction *sfunc) |
| 16 | { |
| 17 | #if 0 |
| 18 | if (strcmp(sfunc->PrintableName, "StatusScreen.drawNum") != 0) |
| 19 | return nullptr; |
| 20 | #endif |
| 21 | |
| 22 | using namespace asmjit; |
| 23 | StringLogger logger; |
| 24 | try |
| 25 | { |
| 26 | ThrowingErrorHandler errorHandler; |
| 27 | CodeHolder code; |
| 28 | code.init(GetHostCodeInfo()); |
| 29 | code.setErrorHandler(&errorHandler); |
| 30 | code.setLogger(&logger); |
| 31 | |
| 32 | JitCompiler compiler(&code, sfunc); |
| 33 | return reinterpret_cast<JitFuncPtr>(AddJitFunction(&code, &compiler)); |
| 34 | } |
| 35 | catch (const CRecoverableError &e) |
| 36 | { |
| 37 | OutputJitLog(logger); |
| 38 | Printf("%s: Unexpected JIT error: %s\n",sfunc->PrintableName, e.what()); |
| 39 | return nullptr; |
| 40 | } |
| 41 | } |
| 42 | |
| 43 | void JitDumpLog(FILE *file, VMScriptFunction *sfunc) |
| 44 | { |
no test coverage detected