|
|
|
|
@ -67,8 +67,10 @@ |
|
|
|
|
#include "llvm/Support/Timer.h" |
|
|
|
|
#include "llvm/System/Threading.h" |
|
|
|
|
|
|
|
|
|
extern "C" { |
|
|
|
|
void LLVMInitializeX86AsmPrinter(); |
|
|
|
|
void LLVMInitializePowerPCAsmPrinter(); |
|
|
|
|
} |
|
|
|
|
#include "llvm/Target/TargetSelect.h" |
|
|
|
|
#include "llvm/Target/TargetData.h" |
|
|
|
|
#include "llvm/Target/TargetOptions.h" |
|
|
|
|
@ -133,7 +135,10 @@ struct cli_bcengine { |
|
|
|
|
extern "C" uint8_t cli_debug_flag; |
|
|
|
|
namespace { |
|
|
|
|
|
|
|
|
|
#ifndef LLVM28 |
|
|
|
|
#define LLVM28 |
|
|
|
|
#endif |
|
|
|
|
|
|
|
|
|
#ifdef LLVM28 |
|
|
|
|
#define llvm_report_error(x) report_fatal_error(x) |
|
|
|
|
#define llvm_install_error_handler(x) install_fatal_error_handler(x) |
|
|
|
|
@ -214,7 +219,7 @@ void do_shutdown() { |
|
|
|
|
|
|
|
|
|
static void NORETURN jit_exception_handler(void) |
|
|
|
|
{ |
|
|
|
|
jmp_buf* buf = (jmp_buf*)ExceptionReturn.get(); |
|
|
|
|
jmp_buf* buf = const_cast<jmp_buf*>(ExceptionReturn.get()); |
|
|
|
|
if (buf) { |
|
|
|
|
// For errors raised during bytecode generation and execution.
|
|
|
|
|
longjmp(*buf, 1); |
|
|
|
|
@ -224,7 +229,7 @@ static void NORETURN jit_exception_handler(void) |
|
|
|
|
cli_errmsg("[Bytecode JIT]: exception handler called, but no recovery point set up"); |
|
|
|
|
// should never happen, we remove the error handler when we don't use
|
|
|
|
|
// LLVM anymore, and when we use it, we do set an error recovery point.
|
|
|
|
|
assert(0 && "[Bytecode JIT]: no exception handler recovery installed, but exception hit!"); |
|
|
|
|
llvm_unreachable("Bytecode JIT]: no exception handler recovery installed, but exception hit!"); |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
@ -2281,9 +2286,9 @@ void cli_bytecode_debug_printsrc(const struct cli_bc_ctx *ctx) |
|
|
|
|
} |
|
|
|
|
assert(ctx->line < lines->linev.size()); |
|
|
|
|
|
|
|
|
|
#ifndef LLVM28 |
|
|
|
|
int line = (int)ctx->line ? (int)ctx->line : -1; |
|
|
|
|
int col = (int)ctx->col ? (int)ctx->col : -1; |
|
|
|
|
#ifndef LLVM28 |
|
|
|
|
//TODO: print this ourselves, instead of using SMDiagnostic
|
|
|
|
|
SMDiagnostic diag(ctx->file, line, col, |
|
|
|
|
"", std::string(lines->linev[ctx->line-1], lines->linev[ctx->line]-1)); |
|
|
|
|
|