Commit 44a1a9b5 authored by Kevin Modzelewski's avatar Kevin Modzelewski

Change log colors for different JIT levels

Also, quiet some debug output
parent 1ee6db5b
......@@ -790,7 +790,7 @@ public:
}
}
if (VERBOSITY("types")) {
if (VERBOSITY("types") >= 2) {
printf("Type analysis: %d BBs, %d evaluations = %.1f evaluations/block\n", starting_types.size(),
num_evaluations, 1.0 * num_evaluations / starting_types.size());
}
......
......@@ -135,12 +135,6 @@ static void compileIR(CompiledFunction* cf, EffortLevel effort) {
assert(cf);
assert(cf->func);
// g.engine->finalizeOBject();
if (VERBOSITY("irgen") >= 1) {
printf("Compiling...\n");
// g.cur_module->dump();
}
void* compiled = NULL;
cf->code = NULL;
if (effort > EffortLevel::INTERPRETED) {
......@@ -195,12 +189,20 @@ CompiledFunction* compileFunction(CLFunction* f, FunctionSpecialization* spec, E
ASSERT(f->versions.size() < 20, "%s %ld", name.c_str(), f->versions.size());
if (VERBOSITY("irgen") >= 1) {
if (VERBOSITY("irgen") >= 2 || (VERBOSITY("irgen") == 1 && effort > EffortLevel::INTERPRETED)) {
std::string s;
llvm::raw_string_ostream ss(s);
const char* colors[] = {
"30", // grey/black
"34", // blue
"31", // red
"31;40", // red-on-black/grey
};
RELEASE_ASSERT((int)effort < sizeof(colors) / sizeof(colors[0]), "");
if (spec) {
ss << "\033[34;1mJIT'ing " << source->fn << ":" << name << " with signature (";
ss << "\033[" << colors[(int)effort] << ";1mJIT'ing " << source->fn << ":" << name << " with signature (";
for (int i = 0; i < spec->arg_types.size(); i++) {
if (i > 0)
ss << ", ";
......@@ -210,8 +212,8 @@ CompiledFunction* compileFunction(CLFunction* f, FunctionSpecialization* spec, E
ss << ") -> ";
ss << spec->rtn_type->debugName();
} else {
ss << "\033[34;1mDoing OSR-entry partial compile of " << source->fn << ":" << name
<< ", starting with backedge to block " << entry_descriptor->backedge->target->idx;
ss << "\033[" << colors[(int)effort] << ";1mDoing OSR-entry partial compile of " << source->fn << ":"
<< name << ", starting with backedge to block " << entry_descriptor->backedge->target->idx;
}
ss << " at effort level " << (int)effort << '\n';
......@@ -255,7 +257,7 @@ CompiledFunction* compileFunction(CLFunction* f, FunctionSpecialization* spec, E
static StatCounter us_compiling("us_compiling");
us_compiling.log(us);
if (VERBOSITY() >= 1 && us > 100000) {
printf("Took %ldms to compile %s::%s!\n", us / 1000, source->fn.c_str(), name.c_str());
printf("Took %ldms to compile %s::%s (effort %d)!\n", us / 1000, source->fn.c_str(), name.c_str(), (int)effort);
}
static StatCounter num_compiles("num_compiles");
......
......@@ -174,7 +174,7 @@ public:
continue;
llvm::Function* f = g.func_addr_registry.getLLVMFuncAtAddress((void*)addr);
if (f == NULL) {
if (VERBOSITY()) {
if (VERBOSITY() >= 3) {
printf("Giving up on inlining %s:\n",
g.func_addr_registry.getFuncNameAtAddress((void*)addr, true).c_str());
call->dump();
......@@ -233,16 +233,16 @@ public:
llvm::InlineCost IC = cost_analysis->getInlineCost(cs, threshold);
bool do_inline = false;
if (IC.isAlways()) {
if (VERBOSITY("irgen.inlining") >= 2)
llvm::errs() << "always inline\n";
// if (VERBOSITY("irgen.inlining") >= 2)
// llvm::errs() << "always inline\n";
do_inline = true;
} else if (IC.isNever()) {
if (VERBOSITY("irgen.inlining") >= 2)
llvm::errs() << "never inline\n";
// if (VERBOSITY("irgen.inlining") >= 2)
// llvm::errs() << "never inline\n";
do_inline = false;
} else {
if (VERBOSITY("irgen.inlining") >= 2)
llvm::errs() << "Inline cost: " << IC.getCost() << '\n';
// if (VERBOSITY("irgen.inlining") >= 2)
// llvm::errs() << "Inline cost: " << IC.getCost() << '\n';
do_inline = (bool)IC;
}
......
......@@ -401,7 +401,7 @@ static inline bool find_call_site_entry(const lsda_info_t* info, const uint8_t*
while (p < info->action_table) { // The call site table ends where the action table begins.
p = parse_call_site_entry(p, info, entry);
if (VERBOSITY("cxx_unwind") >= 3) {
if (VERBOSITY("cxx_unwind") >= 5) {
printf(" start %p end %p landingpad %p action %lx\n", entry->instrs_start,
entry->instrs_start + entry->instrs_len_bytes, entry->landing_pad, entry->action_offset_plus_one);
}
......@@ -424,7 +424,7 @@ static inline NORETURN void resume(unw_cursor_t* cursor, const uint8_t* landing_
const ExcData* exc_data) {
exc_data->check();
assert(landing_pad);
if (VERBOSITY("cxx_unwind") >= 2)
if (VERBOSITY("cxx_unwind") >= 4)
printf(" * RESUMED: ip %p switch_value %ld\n", (const void*)landing_pad, (long)switch_value);
if (0 != switch_value) {
......@@ -465,7 +465,7 @@ static inline int64_t determine_action(const lsda_info_t* info, const call_site_
return CLEANUP_ACTION;
// Read a chain of actions.
if (VERBOSITY("cxx_unwind") >= 3) {
if (VERBOSITY("cxx_unwind") >= 5) {
printf(" reading action chain\n");
}
......@@ -477,7 +477,7 @@ static inline int64_t determine_action(const lsda_info_t* info, const call_site_
ptrdiff_t offset = p - info->action_table;
int64_t type_filter;
p = next_action(p, &type_filter);
if (VERBOSITY("cxx_unwind") >= 3) {
if (VERBOSITY("cxx_unwind") >= 5) {
if (p)
printf(" %ld: filter %ld next %ld\n", offset, type_filter, p - info->action_table);
else
......@@ -539,7 +539,7 @@ static inline void unwind_loop(const ExcData* exc_data) {
assert((pip.lsda == 0) == (pip.handler == 0));
assert(pip.flags == 0);
if (VERBOSITY("cxx_unwind") >= 2) {
if (VERBOSITY("cxx_unwind") >= 4) {
print_frame(&cursor, &pip);
}
......@@ -586,7 +586,7 @@ static inline void unwind_loop(const ExcData* exc_data) {
}
// After this point we are guaranteed to resume something rather than unwinding further.
if (VERBOSITY("cxx_unwind") >= 3) {
if (VERBOSITY("cxx_unwind") >= 4) {
print_lsda(&info);
}
......@@ -633,7 +633,7 @@ extern "C" void _Unwind_Resume(struct _Unwind_Exception* _exc) {
#endif
pyston::us_unwind_cleanup.log(pyston::per_thread_cleanup_timer.end());
if (VERBOSITY("cxx_unwind"))
if (VERBOSITY("cxx_unwind") >= 4)
printf("***** _Unwind_Resume() *****\n");
// we give `_exc' type `struct _Unwind_Exception*' because unwind.h demands it; it's not actually accurate
const pyston::ExcData* data = (const pyston::ExcData*)_exc;
......@@ -680,7 +680,7 @@ extern "C" void* __cxa_begin_catch(void* exc_obj_in) noexcept {
assert(exc_obj_in);
pyston::us_unwind_resume_catch.log(pyston::per_thread_resume_catch_timer.end());
if (VERBOSITY("cxx_unwind"))
if (VERBOSITY("cxx_unwind") >= 4)
printf("***** __cxa_begin_catch() *****\n");
pyston::ExcData* e = (pyston::ExcData*)exc_obj_in;
......@@ -689,7 +689,7 @@ extern "C" void* __cxa_begin_catch(void* exc_obj_in) noexcept {
}
extern "C" void __cxa_end_catch() {
if (VERBOSITY("cxx_unwind"))
if (VERBOSITY("cxx_unwind") >= 4)
printf("***** __cxa_end_catch() *****\n");
// See comment in __cxa_begin_catch for why we don't clear the exception ferry here.
}
......@@ -704,7 +704,7 @@ extern "C" void __cxa_throw(void* exc_obj, std::type_info* tinfo, void (*dtor)(v
assert(exc_obj);
RELEASE_ASSERT(tinfo == &EXCINFO_TYPE_INFO, "can't throw a non-ExcInfo value! type info: %p", tinfo);
if (VERBOSITY("cxx_unwind"))
if (VERBOSITY("cxx_unwind") >= 4)
printf("***** __cxa_throw() *****\n");
const pyston::ExcData* exc_data = (const pyston::ExcData*)exc_obj;
......
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