Commit 91ac4569 authored by Kevin Modzelewski's avatar Kevin Modzelewski

Rename these functions

parent 4b7c277f
...@@ -333,7 +333,7 @@ Box* ASTInterpreter::execJITedBlock(CFGBlock* b) { ...@@ -333,7 +333,7 @@ Box* ASTInterpreter::execJITedBlock(CFGBlock* b) {
auto source = getCL()->source.get(); auto source = getCL()->source.get();
stmt->cxx_exception_count++; stmt->cxx_exception_count++;
exceptionCaughtInInterpreter(LineInfo(stmt->lineno, stmt->col_offset, source->fn, source->getName()), &e); caughtCxxException(LineInfo(stmt->lineno, stmt->col_offset, source->fn, source->getName()), &e);
next_block = ((AST_Invoke*)stmt)->exc_dest; next_block = ((AST_Invoke*)stmt)->exc_dest;
last_exception = e; last_exception = e;
...@@ -773,7 +773,7 @@ Value ASTInterpreter::visit_invoke(AST_Invoke* node) { ...@@ -773,7 +773,7 @@ Value ASTInterpreter::visit_invoke(AST_Invoke* node) {
auto source = getCL()->source.get(); auto source = getCL()->source.get();
node->cxx_exception_count++; node->cxx_exception_count++;
exceptionCaughtInInterpreter(LineInfo(node->lineno, node->col_offset, source->fn, source->getName()), &e); caughtCxxException(LineInfo(node->lineno, node->col_offset, source->fn, source->getName()), &e);
next_block = node->exc_dest; next_block = node->exc_dest;
last_exception = e; last_exception = e;
......
...@@ -39,10 +39,6 @@ void compileAndRunModule(AST_Module* m, BoxedModule* bm); ...@@ -39,10 +39,6 @@ void compileAndRunModule(AST_Module* m, BoxedModule* bm);
// will we always want to generate unique function names? (ie will this function always be reasonable?) // will we always want to generate unique function names? (ie will this function always be reasonable?)
CompiledFunction* cfForMachineFunctionName(const std::string&); CompiledFunction* cfForMachineFunctionName(const std::string&);
extern "C" void capiExcCaughtInJit(AST_stmt* current_stmt, void* source_info);
// This is just meant for the use of the JIT (normal runtime code should call throwCAPIException)
extern "C" void reraiseJitCapiExc() __attribute__((noreturn));
extern "C" Box* exec(Box* boxedCode, Box* globals, Box* locals, FutureFlags caller_future_flags); extern "C" Box* exec(Box* boxedCode, Box* globals, Box* locals, FutureFlags caller_future_flags);
extern "C" Box* eval(Box* boxedCode, Box* globals, Box* locals); extern "C" Box* eval(Box* boxedCode, Box* globals, Box* locals);
extern "C" Box* compile(Box* source, Box* filename, Box* mode, Box** _args /* flags, dont_inherit */); extern "C" Box* compile(Box* source, Box* filename, Box* mode, Box** _args /* flags, dont_inherit */);
......
...@@ -2805,14 +2805,14 @@ public: ...@@ -2805,14 +2805,14 @@ public:
capi_current_statements[final_dest] = current_stmt; capi_current_statements[final_dest] = current_stmt;
emitter.setCurrentBasicBlock(capi_exc_dest); emitter.setCurrentBasicBlock(capi_exc_dest);
emitter.getBuilder()->CreateCall2(g.funcs.capiExcCaughtInJit, emitter.getBuilder()->CreateCall2(g.funcs.caughtCapiException,
embedRelocatablePtr(current_stmt, g.llvm_aststmt_type_ptr), embedRelocatablePtr(current_stmt, g.llvm_aststmt_type_ptr),
embedRelocatablePtr(irstate->getSourceInfo(), g.i8_ptr)); embedRelocatablePtr(irstate->getSourceInfo(), g.i8_ptr));
if (!final_dest) { if (!final_dest) {
// Propagate the exception out of the function: // Propagate the exception out of the function:
if (irstate->getExceptionStyle() == CXX) { if (irstate->getExceptionStyle() == CXX) {
emitter.getBuilder()->CreateCall(g.funcs.reraiseJitCapiExc); emitter.getBuilder()->CreateCall(g.funcs.reraiseCapiExcAsCxx);
emitter.getBuilder()->CreateUnreachable(); emitter.getBuilder()->CreateUnreachable();
} else { } else {
emitter.getBuilder()->CreateRet(getNullPtr(g.llvm_value_type_ptr)); emitter.getBuilder()->CreateRet(getNullPtr(g.llvm_value_type_ptr));
......
...@@ -312,8 +312,8 @@ void initGlobalFuncs(GlobalState& g) { ...@@ -312,8 +312,8 @@ void initGlobalFuncs(GlobalState& g) {
GET(PyErr_Fetch); GET(PyErr_Fetch);
GET(PyErr_NormalizeException); GET(PyErr_NormalizeException);
GET(PyErr_Restore); GET(PyErr_Restore);
GET(capiExcCaughtInJit); GET(caughtCapiException);
GET(reraiseJitCapiExc); GET(reraiseCapiExcAsCxx);
GET(deopt); GET(deopt);
GET(div_float_float); GET(div_float_float);
......
...@@ -51,7 +51,7 @@ struct GlobalFuncs { ...@@ -51,7 +51,7 @@ struct GlobalFuncs {
llvm::Value* __cxa_end_catch; llvm::Value* __cxa_end_catch;
llvm::Value* raise0, *raise3, *raise3_capi; llvm::Value* raise0, *raise3, *raise3_capi;
llvm::Value* PyErr_Fetch, *PyErr_NormalizeException, *PyErr_Restore, *capiExcCaughtInJit, *reraiseJitCapiExc; llvm::Value* PyErr_Fetch, *PyErr_NormalizeException, *PyErr_Restore, *caughtCapiException, *reraiseCapiExcAsCxx;
llvm::Value* deopt; llvm::Value* deopt;
llvm::Value* div_float_float, *floordiv_float_float, *mod_float_float, *pow_float_float; llvm::Value* div_float_float, *floordiv_float_float, *mod_float_float, *pow_float_float;
......
...@@ -53,7 +53,9 @@ void logException(ExcInfo* exc_info); ...@@ -53,7 +53,9 @@ void logException(ExcInfo* exc_info);
void startReraise(); void startReraise();
bool exceptionAtLineCheck(); bool exceptionAtLineCheck();
void exceptionAtLine(LineInfo line_info, Box** traceback); void exceptionAtLine(LineInfo line_info, Box** traceback);
void exceptionCaughtInInterpreter(LineInfo line_info, ExcInfo* exc_info); void caughtCxxException(LineInfo line_info, ExcInfo* exc_info);
extern "C" void caughtCapiException(AST_stmt* current_stmt, void* source_info);
extern "C" void reraiseCapiExcAsCxx() __attribute__((noreturn));
CLFunction* getTopPythonFunction(); CLFunction* getTopPythonFunction();
......
...@@ -220,14 +220,14 @@ void logException(ExcInfo* exc_info) { ...@@ -220,14 +220,14 @@ void logException(ExcInfo* exc_info) {
#endif #endif
} }
extern "C" void capiExcCaughtInJit(AST_stmt* stmt, void* _source_info) { extern "C" void caughtCapiException(AST_stmt* stmt, void* _source_info) {
SourceInfo* source = static_cast<SourceInfo*>(_source_info); SourceInfo* source = static_cast<SourceInfo*>(_source_info);
PyThreadState* tstate = PyThreadState_GET(); PyThreadState* tstate = PyThreadState_GET();
exceptionAtLine(LineInfo(stmt->lineno, stmt->col_offset, source->fn, source->getName()), &tstate->curexc_traceback); exceptionAtLine(LineInfo(stmt->lineno, stmt->col_offset, source->fn, source->getName()), &tstate->curexc_traceback);
} }
extern "C" void reraiseJitCapiExc() { extern "C" void reraiseCapiExcAsCxx() {
ensureCAPIExceptionSet(); ensureCAPIExceptionSet();
// TODO: we are normalizing to many times? // TODO: we are normalizing to many times?
ExcInfo e = excInfoForRaise(cur_thread_state.curexc_type, cur_thread_state.curexc_value, ExcInfo e = excInfoForRaise(cur_thread_state.curexc_type, cur_thread_state.curexc_value,
...@@ -237,7 +237,7 @@ extern "C" void reraiseJitCapiExc() { ...@@ -237,7 +237,7 @@ extern "C" void reraiseJitCapiExc() {
throw e; throw e;
} }
void exceptionCaughtInInterpreter(LineInfo line_info, ExcInfo* exc_info) { void caughtCxxException(LineInfo line_info, ExcInfo* exc_info) {
static StatCounter frames_unwound("num_frames_unwound_python"); static StatCounter frames_unwound("num_frames_unwound_python");
frames_unwound.log(); frames_unwound.log();
......
...@@ -130,8 +130,8 @@ void force() { ...@@ -130,8 +130,8 @@ void force() {
FORCE(PyErr_Fetch); FORCE(PyErr_Fetch);
FORCE(PyErr_NormalizeException); FORCE(PyErr_NormalizeException);
FORCE(PyErr_Restore); FORCE(PyErr_Restore);
FORCE(capiExcCaughtInJit); FORCE(caughtCapiException);
FORCE(reraiseJitCapiExc); FORCE(reraiseCapiExcAsCxx);
FORCE(deopt); FORCE(deopt);
FORCE(div_i64_i64); FORCE(div_i64_i64);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment