Commit c0a273ff authored by Marius Wachtler's avatar Marius Wachtler

BST: remove the cxx_exception_count field

parent 482d2e86
......@@ -366,7 +366,7 @@ Box* ASTInterpreter::execJITedBlock(CFGBlock* b) {
assert(getPythonFrameInfo(0) == getFrameInfo());
stmt->cxx_exception_count++;
++getCode()->cxx_exception_count[stmt];
caughtCxxException(&e);
next_block = ((BST_Invoke*)stmt)->exc_dest;
......@@ -774,7 +774,7 @@ Value ASTInterpreter::visit_invoke(BST_Invoke* node) {
assert(getPythonFrameInfo(0) == getFrameInfo());
node->cxx_exception_count++;
++getCode()->cxx_exception_count[node];
caughtCxxException(&e);
next_block = node->exc_dest;
......
......@@ -36,6 +36,7 @@ class IREmitter;
struct UnwindInfo {
public:
BoxedCode* code;
BST_stmt* current_stmt;
llvm::BasicBlock* exc_dest;
......@@ -45,15 +46,15 @@ public:
bool hasHandler() const { return exc_dest != NULL; }
UnwindInfo(BST_stmt* current_stmt, llvm::BasicBlock* exc_dest, bool is_after_deopt = false)
: current_stmt(current_stmt), exc_dest(exc_dest), is_after_deopt(is_after_deopt) {}
UnwindInfo(BoxedCode* code, BST_stmt* current_stmt, llvm::BasicBlock* exc_dest, bool is_after_deopt = false)
: code(code), current_stmt(current_stmt), exc_dest(exc_dest), is_after_deopt(is_after_deopt) {}
ExceptionStyle preferredExceptionStyle() const;
// Risky! This means that we can't unwind from this location, and should be used in the
// rare case that there are language-specific reasons that the statement should not unwind
// (ex: loading function arguments into the appropriate scopes).
static UnwindInfo cantUnwind() { return UnwindInfo(NULL, NULL); }
static UnwindInfo cantUnwind() { return UnwindInfo(NULL, NULL, NULL); }
};
// TODO get rid of this
......
......@@ -145,7 +145,7 @@ ExceptionStyle UnwindInfo::preferredExceptionStyle() const {
// tend to run this check after executing the statement a somewhat-fixed
// number of times.
// We might want to zero these out after we are done compiling, though.
if (current_stmt->cxx_exception_count >= 10)
if (code && code->cxx_exception_count[current_stmt] >= 10)
return CAPI;
return CXX;
......@@ -715,7 +715,7 @@ public:
llvm::Value* createDeopt(BST_stmt* current_stmt, llvm::Value* node_value) override {
llvm::Instruction* v = createIC(createDeoptIC(), (void*)pyston::deopt, { node_value },
UnwindInfo(current_stmt, NULL, /* is_after_deopt*/ true));
UnwindInfo(irstate->getCode(), current_stmt, NULL, /* is_after_deopt*/ true));
llvm::Value* rtn = createAfter<llvm::IntToPtrInst>(v, v, g.llvm_value_type_ptr, "");
setType(rtn, RefType::OWNED);
return rtn;
......@@ -2448,7 +2448,7 @@ private:
assert(!unw_info.hasHandler());
BST_Invoke* invoke = bst_cast<BST_Invoke>(node);
doStmt(invoke->stmt, UnwindInfo(node, entry_blocks[invoke->exc_dest]));
doStmt(invoke->stmt, UnwindInfo(irstate->getCode(), node, entry_blocks[invoke->exc_dest]));
assert(state == RUNNING || state == DEAD);
if (state == RUNNING) {
......@@ -2951,7 +2951,7 @@ public:
doSafePoint(block->body[i]);
#endif
doStmt(block->body[i], UnwindInfo(block->body[i], NULL));
doStmt(block->body[i], UnwindInfo(irstate->getCode(), block->body[i], NULL));
}
if (VERBOSITY("irgenerator") >= 2) { // print ending symbol table
printf(" %d fini:", block->idx);
......
......@@ -636,7 +636,7 @@ public:
if (!getIsReraiseFlag()) {
// TODO: shouldn't fetch this multiple times?
frame_iter.getCurrentStatement()->cxx_exception_count++;
++frame_iter.getFrameInfo()->code->cxx_exception_count[frame_iter.getCurrentStatement()];
exceptionAtLine(&exc_info.traceback);
} else
getIsReraiseFlag() = false;
......
......@@ -134,7 +134,6 @@ public:
const BST_TYPE::BST_TYPE type;
uint32_t lineno;
int cxx_exception_count = 0;
virtual void accept(BSTVisitor* v) = 0;
virtual void accept_stmt(StmtVisitor* v) = 0;
......
......@@ -1120,6 +1120,7 @@ public:
long bjit_num_inside = 0;
std::vector<std::unique_ptr<JitCodeBlock>> code_blocks;
ICInvalidator dependent_interp_callsites;
llvm::DenseMap<BST_stmt*, int> cxx_exception_count;
// Functions can provide an "internal" version, which will get called instead
......
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