| 41 | } |
| 42 | |
| 43 | void JitDumpLog(FILE *file, VMScriptFunction *sfunc) |
| 44 | { |
| 45 | using namespace asmjit; |
| 46 | StringLogger logger; |
| 47 | |
| 48 | if(sfunc->VarFlags & VARF_Abstract) |
| 49 | { |
| 50 | // Printf(TEXTCOLOR_ORANGE "Skipping abstract function during JIT dump: %s\n", sfunc->PrintableName.GetChars()); |
| 51 | return; |
| 52 | } |
| 53 | |
| 54 | try |
| 55 | { |
| 56 | ThrowingErrorHandler errorHandler; |
| 57 | CodeHolder code; |
| 58 | code.init(GetHostCodeInfo()); |
| 59 | code.setErrorHandler(&errorHandler); |
| 60 | code.setLogger(&logger); |
| 61 | |
| 62 | JitCompiler compiler(&code, sfunc); |
| 63 | compiler.Codegen(); |
| 64 | |
| 65 | fwrite(logger.getString(), logger.getLength(), 1, file); |
| 66 | } |
| 67 | catch (const std::exception &e) |
| 68 | { |
| 69 | fwrite(logger.getString(), logger.getLength(), 1, file); |
| 70 | |
| 71 | FString err; |
| 72 | err.Format("Unexpected JIT error: %s\n", e.what()); |
| 73 | fwrite(err.GetChars(), err.Len(), 1, file); |
| 74 | fclose(file); |
| 75 | |
| 76 | I_FatalError("Unexpected JIT error: %s\n", e.what()); |
| 77 | } |
| 78 | } |
| 79 | |
| 80 | static void OutputJitLog(const asmjit::StringLogger &logger) |
| 81 | { |
no test coverage detected