Commit fa30790c authored by Kevin Modzelewski's avatar Kevin Modzelewski

sum() was failing its ics by running out of instruction space

parent a1d9091d
......@@ -80,6 +80,8 @@ public:
const ICInfo* getICInfo() { return ic; }
const char* debugName() { return debug_name; }
friend class ICInfo;
};
......
......@@ -888,15 +888,22 @@ void Rewriter::commit() {
assert(!finished);
initPhaseEmitting();
static StatCounter ic_rewrites_aborted_assemblyfail("ic_rewrites_aborted_assemblyfail");
static StatCounter ic_rewrites_aborted_failed("ic_rewrites_aborted_failed");
if (failed) {
ic_rewrites_aborted_failed.log();
this->abort();
return;
}
static StatCounter ic_rewrites_aborted_assemblyfail("ic_rewrites_aborted_assemblyfail");
auto on_assemblyfail = [&]() {
ic_rewrites_aborted_assemblyfail.log();
#if 0
std::string per_name_stat_name = "ic_rewrites_aborted_assemblyfail_" + std::string(debugName());
uint64_t* counter = Stats::getStatCounter(per_name_stat_name);
Stats::log(counter);
#endif
this->abort();
};
......@@ -944,6 +951,7 @@ void Rewriter::commit() {
actions[i].action();
if (failed) {
ic_rewrites_aborted_failed.log();
this->abort();
return;
}
......
......@@ -474,6 +474,8 @@ public:
TypeRecorder* getTypeRecorder();
const char* debugName() { return rewrite->debugName(); }
void trap();
RewriterVar* loadConst(int64_t val, Location loc = Location::any());
// can_call_into_python: whether this call could result in arbitrary Python code being called.
......
......@@ -78,7 +78,7 @@ public:
class BinopIC : public RuntimeIC {
public:
BinopIC() : RuntimeIC((void*)binop, 2, 160) {}
BinopIC() : RuntimeIC((void*)binop, 2, 240) {}
Box* call(Box* lhs, Box* rhs, int op_type) { return (Box*)call_ptr(lhs, rhs, op_type); }
};
......
......@@ -3731,6 +3731,13 @@ extern "C" Box* binopInternal(Box* lhs, Box* rhs, int op_type, bool inplace, Bin
extern "C" Box* binop(Box* lhs, Box* rhs, int op_type) {
STAT_TIMER(t0, "us_timer_slowpath_binop", 10);
bool can_patchpoint = !isUserDefined(lhs->cls) && !isUserDefined(rhs->cls);
#if 0
static uint64_t* st_id = Stats::getStatCounter("us_timer_slowpath_binop_patchable");
static uint64_t* st_id_nopatch = Stats::getStatCounter("us_timer_slowpath_binop_nopatch");
bool havepatch = (bool)getICInfo(__builtin_extract_return_addr(__builtin_return_address(0)));
ScopedStatTimer st((havepatch && can_patchpoint)? st_id : st_id_nopatch, 10);
#endif
static StatCounter slowpath_binop("slowpath_binop");
slowpath_binop.log();
......@@ -3744,7 +3751,6 @@ extern "C" Box* binop(Box* lhs, Box* rhs, int op_type) {
// resolving it one way right now (ex, using the value from lhs.__add__) means that later
// we'll resolve it the same way, even for the same argument types.
// TODO implement full resolving semantics inside the rewrite?
bool can_patchpoint = !isUserDefined(lhs->cls) && !isUserDefined(rhs->cls);
if (can_patchpoint)
rewriter.reset(
Rewriter::createRewriter(__builtin_extract_return_addr(__builtin_return_address(0)), 3, "binop"));
......
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