Commit c46e70bf authored by Kevin Modzelewski's avatar Kevin Modzelewski

Merge pull request #618 from toshok/callattr-descr-aborts

add a stat for the number of times we abort a callattr rewrite because we had to call into python
parents cae875ec b0fb7325
...@@ -29,6 +29,7 @@ namespace pyston { ...@@ -29,6 +29,7 @@ namespace pyston {
#define DISABLE_STATS 0 #define DISABLE_STATS 0
#define STAT_ALLOCATIONS (0 && !DISABLE_STATS) #define STAT_ALLOCATIONS (0 && !DISABLE_STATS)
#define STAT_CALLATTR_DESCR_ABORTS (0 && !DISABLE_STATS)
#define STAT_EXCEPTIONS (0 && !DISABLE_STATS) #define STAT_EXCEPTIONS (0 && !DISABLE_STATS)
#define STAT_EXCEPTIONS_LOCATION (0 && STAT_EXCEPTIONS) #define STAT_EXCEPTIONS_LOCATION (0 && STAT_EXCEPTIONS)
#define STAT_ICS (0 && !DISABLE_STATS) #define STAT_ICS (0 && !DISABLE_STATS)
......
...@@ -1573,6 +1573,14 @@ Box* getattrInternalGeneric(Box* obj, llvm::StringRef attr, GetattrRewriteArgs* ...@@ -1573,6 +1573,14 @@ Box* getattrInternalGeneric(Box* obj, llvm::StringRef attr, GetattrRewriteArgs*
// Have to abort because we're about to call now, but there will be before more // Have to abort because we're about to call now, but there will be before more
// guards between this call and the next... // guards between this call and the next...
if (for_call) { if (for_call) {
#if STAT_CALLATTR_DESCR_ABORTS
if (rewrite_args) {
std::string attr_name = "num_callattr_descr_abort";
Stats::log(Stats::getStatCounter(attr_name));
logByCurrentPythonLine(attr_name);
}
#endif
rewrite_args = NULL; rewrite_args = NULL;
REWRITE_ABORTED(""); REWRITE_ABORTED("");
} }
...@@ -1678,6 +1686,14 @@ Box* getattrInternalGeneric(Box* obj, llvm::StringRef attr, GetattrRewriteArgs* ...@@ -1678,6 +1686,14 @@ Box* getattrInternalGeneric(Box* obj, llvm::StringRef attr, GetattrRewriteArgs*
Box* res; Box* res;
if (for_call) { if (for_call) {
#if STAT_CALLATTR_DESCR_ABORTS
if (rewrite_args) {
std::string attr_name = "num_callattr_descr_abort";
Stats::log(Stats::getStatCounter(attr_name));
logByCurrentPythonLine(attr_name);
}
#endif
rewrite_args = NULL; rewrite_args = NULL;
REWRITE_ABORTED(""); REWRITE_ABORTED("");
} }
...@@ -1725,6 +1741,14 @@ Box* getattrInternalGeneric(Box* obj, llvm::StringRef attr, GetattrRewriteArgs* ...@@ -1725,6 +1741,14 @@ Box* getattrInternalGeneric(Box* obj, llvm::StringRef attr, GetattrRewriteArgs*
if (descr_get) { if (descr_get) {
// this could happen for the callattr path... // this could happen for the callattr path...
if (for_call) { if (for_call) {
#if STAT_CALLATTR_DESCR_ABORTS
if (rewrite_args) {
std::string attr_name = "num_callattr_descr_abort";
Stats::log(Stats::getStatCounter(attr_name));
logByCurrentPythonLine(attr_name);
}
#endif
rewrite_args = NULL; rewrite_args = NULL;
REWRITE_ABORTED(""); REWRITE_ABORTED("");
} }
......
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