本文整理汇总了C++中CallFrame::jitted_p方法的典型用法代码示例。如果您正苦于以下问题:C++ CallFrame::jitted_p方法的具体用法?C++ CallFrame::jitted_p怎么用?C++ CallFrame::jitted_p使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类CallFrame
的用法示例。
在下文中一共展示了CallFrame::jitted_p方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: compile_callframe
void LLVMState::compile_callframe(STATE, GCToken gct, CompiledCode* start,
CallFrame* call_frame, int primitive)
{
// TODO: Fix compile policy checks
if(!start->keywords()->nil_p()) {
metrics().m.jit_metrics.methods_failed++;
return;
}
if(debug_search) {
std::cout << std::endl << "JIT: triggered: "
<< enclosure_name(start) << "#"
<< symbol_debug_str(start->name()) << std::endl;
}
CallFrame* candidate = find_candidate(state, start, call_frame);
if(!candidate || candidate->jitted_p() || candidate->inline_method_p()) {
if(config().jit_show_compiling) {
llvm::outs() << "[[[ JIT error finding call frame "
<< enclosure_name(start) << "#" << symbol_debug_str(start->name());
if(!candidate) {
llvm::outs() << " no candidate";
} else {
if(candidate->jitted_p()) {
llvm::outs() << " candidate is jitted";
}
if(candidate->inline_method_p()) {
llvm::outs() << " candidate is inlined";
}
}
llvm::outs() << " ]]]\n";
}
return;
}
if(debug_search) {
std::cout << "! ";
candidate->print_backtrace(state, 1);
}
if(candidate->compiled_code->machine_code()->call_count <= 1) {
if(!start || start->machine_code()->jitted_p()) return;
// Ignore it. compile this one.
candidate = call_frame;
}
if(candidate->block_p()) {
compile_soon(state, gct, candidate->compiled_code, call_frame,
candidate->self()->direct_class(state), candidate->block_env(), true);
} else {
if(candidate->compiled_code->can_specialize_p()) {
compile_soon(state, gct, candidate->compiled_code, call_frame,
candidate->self()->direct_class(state));
} else {
compile_soon(state, gct, candidate->compiled_code, call_frame, NULL);
}
}
}
示例2: print_backtraces
void SignalThread::print_backtraces() {
STATE = shared_.env()->state;
ThreadList* threads = shared_.thread_nexus()->threads();
for(ThreadList::iterator i = threads->begin(); i != threads->end(); ++i) {
VM* vm = (*i)->as_vm();
if(!vm) continue;
bool first = true;
CallFrame* frame = vm->call_frame();
while(frame) {
if(first) {
logger::fatal("--- %s %d backtrace ---", vm->kind_name(), vm->thread_id());
first = false;
}
std::ostringstream stream;
if(NativeMethodFrame* nmf = frame->native_method_frame()) {
stream << static_cast<void*>(frame) << ": ";
NativeMethod* nm = try_as<NativeMethod>(nmf->get_object(nmf->method()));
if(nm && nm->name()->symbol_p()) {
stream << "capi:" << nm->name()->debug_str(state) << " at ";
stream << nm->file()->c_str(state);
} else {
stream << "unknown capi";
}
} else if(frame->compiled_code) {
if(frame->is_block_p(state)) {
stream << "__block__";
} else {
if(SingletonClass* sc = try_as<SingletonClass>(frame->module())) {
Object* obj = sc->singleton();
if(Module* mod = try_as<Module>(obj)) {
stream << mod->debug_str(state) << ".";
} else {
if(obj == G(main)) {
stream << "MAIN.";
} else {
stream << "#<" << obj->class_object(state)->debug_str(state) <<
":" << (void*)obj->id(state)->to_native() << ">.";
}
}
} else if(IncludedModule* im = try_as<IncludedModule>(frame->module())) {
stream << im->module()->debug_str(state) << "#";
} else {
Symbol* name;
std::string mod_name;
if(frame->module()->nil_p()) {
mod_name = frame->lexical_scope()->module()->debug_str(state);
} else {
if((name = try_as<Symbol>(frame->module()->module_name()))) {
mod_name = name->debug_str(state);
} else if((name = try_as<Symbol>(
frame->lexical_scope()->module()->module_name()))) {
mod_name = name->debug_str(state);
} else {
mod_name = "<anonymous module>";
}
}
stream << mod_name << "#";
}
Symbol* name = try_as<Symbol>(frame->name());
if(name) {
stream << name->debug_str(state);
} else {
stream << frame->compiled_code->name()->debug_str(state);
}
}
stream << " in ";
if(Symbol* file_sym = try_as<Symbol>(frame->compiled_code->file())) {
stream << file_sym->debug_str(state) << ":" << frame->line(state);
} else {
stream << "<unknown>";
}
stream << " (+" << frame->ip();
if(frame->is_inline_frame()) {
stream << " inline";
} else if(frame->jitted_p()) {
stream << " jit";
}
stream << ")";
}
logger::fatal(stream.str().c_str());
frame = frame->previous;
}
}
}
示例3: print_backtrace
void CallFrame::print_backtrace(STATE, std::ostream& stream, int total, bool filter) {
CallFrame* cf = this;
int i = -1;
while(cf) {
i++;
if(total > 0 && i == total) return;
if(NativeMethodFrame* nmf = cf->native_method_frame()) {
stream << static_cast<void*>(cf) << ": ";
NativeMethod* nm = try_as<NativeMethod>(nmf->get_object(nmf->method()));
if(nm && nm->name()->symbol_p()) {
stream << "capi:" << nm->name()->debug_str(state) << " at ";
stream << nm->file()->c_str(state);
} else {
stream << "unknown capi";
}
stream << std::endl;
cf = cf->previous;
continue;
}
if(!cf->compiled_code) {
cf = cf->previous;
continue;
}
if(filter && cf->compiled_code->kernel_method(state)) {
cf = cf->previous;
continue;
}
stream << static_cast<void*>(cf) << ": ";
if(cf->is_block_p(state)) {
stream << "__block__";
} else {
if(SingletonClass* sc = try_as<SingletonClass>(cf->module())) {
Object* obj = sc->attached_instance();
if(Module* mod = try_as<Module>(obj)) {
stream << mod->debug_str(state) << ".";
} else {
if(obj == G(main)) {
stream << "MAIN.";
} else {
stream << "#<" << obj->class_object(state)->debug_str(state) <<
":" << (void*)obj->id(state)->to_native() << ">.";
}
}
} else if(IncludedModule* im = try_as<IncludedModule>(cf->module())) {
stream << im->module()->debug_str(state) << "#";
} else {
Symbol* name;
std::string mod_name;
if(cf->module()->nil_p()) {
mod_name = cf->constant_scope()->module()->debug_str(state);
} else {
if((name = try_as<Symbol>(cf->module()->module_name()))) {
mod_name = name->debug_str(state);
} else if((name = try_as<Symbol>(
cf->constant_scope()->module()->module_name()))) {
mod_name = name->debug_str(state);
} else {
mod_name = "<anonymous module>";
}
}
stream << mod_name << "#";
}
Symbol* name = try_as<Symbol>(cf->name());
if(name) {
stream << name->debug_str(state);
} else {
stream << cf->compiled_code->name()->debug_str(state);
}
}
stream << " in ";
if(Symbol* file_sym = try_as<Symbol>(cf->compiled_code->file())) {
stream << file_sym->debug_str(state) << ":" << cf->line(state);
} else {
stream << "<unknown>";
}
stream << " (+" << cf->ip();
if(cf->is_inline_frame()) {
stream << " inline";
} else if(cf->jitted_p()) {
stream << " jit";
}
stream << ")";
stream << std::endl;
cf = cf->previous;
}
//.........这里部分代码省略.........
示例4: find_candidate
//.........这里部分代码省略.........
CompiledCode* cur = callee->compiled_code;
if(!cur) {
if(debug_search) {
std::cout << "JIT: STOP. reason: synthetic CallFrame hit" << std::endl;
}
return callee;
}
MachineCode* mcode = cur->machine_code();
if(debug_search) {
std::cout << "> call_count: " << mcode->call_count
<< " size: " << mcode->total
<< " sends: " << mcode->call_site_count()
<< std::endl;
call_frame->print_backtrace(state, 1);
}
/*
if(call_frame->block_p()
|| mcode->required_args != mcode->total_args // has a splat
|| mcode->call_count < 200 // not called much
|| mcode->jitted() // already jitted
|| mcode->parent() // is a block
) return callee;
*/
if(mcode->required_args != mcode->total_args) {
if(debug_search) {
std::cout << "JIT: STOP. reason: req_args != total_args" << std::endl;
}
return callee;
}
if(mcode->call_count < config_.jit_threshold_inline) {
if(debug_search) {
std::cout << "JIT: STOP. reason: call_count too small: "
<< mcode->call_count << " < "
<< config_.jit_threshold_inline << std::endl;
}
return callee;
}
if(mcode->jitted_p()) {
if(debug_search) {
std::cout << "JIT: STOP. reason: already jitted" << std::endl;
}
return callee;
}
if(mcode->no_inline_p()) {
if(debug_search) {
std::cout << "JIT: STOP. reason: no_inline_p() = true" << std::endl;
}
return callee;
}
if(callee->jitted_p() || callee->inline_method_p()) {
return callee;
}
if(mcode->call_site_count() > eMaxInlineSendCount) {
if(debug_search) {
std::cout << "JIT: STOP. reason: high send count" << std::endl;
}
return callee;
}
// if(mcode->required_args != mcode->total_args // has a splat
// || mcode->call_count < 200 // not called much
// || mcode->jitted() // already jitted
// || !mcode->no_inline_p() // method marked as not inlineable
// ) return callee;
// if(cur->machine_code()->total > SMALL_METHOD_SIZE) {
// if(debug_search) {
// std::cout << "JIT: STOP. reason: big method: "
// << cur->machine_code()->total << " > "
// << SMALL_METHOD_SIZE
// << "\n";
// }
// return call_frame;
// }
// if(!next || cur->machine_code()->total > SMALL_METHOD_SIZE) return call_frame;
callee = callee->previous;
}
return callee;
}