void CompiledMethod::Info::show(STATE, Object* self, int level) { CompiledMethod* cm = as<CompiledMethod>(self); class_header(state, self); indent_attribute(++level, "file"); cm->file()->show(state, level); indent_attribute(level, "iseq"); cm->iseq()->show(state, level); indent_attribute(level, "lines"); cm->lines()->show_simple(state, level); indent_attribute(level, "literals"); cm->literals()->show_simple(state, level); indent_attribute(level, "local_count"); cm->local_count()->show(state, level); indent_attribute(level, "local_names"); cm->local_names()->show_simple(state, level); indent_attribute(level, "name"); cm->name()->show(state, level); indent_attribute(level, "required_args"); cm->required_args()->show(state, level); indent_attribute(level, "scope"); cm->scope()->show(state, level); indent_attribute(level, "splat"); cm->splat()->show(state, level); indent_attribute(level, "stack_size"); cm->stack_size()->show(state, level); indent_attribute(level, "total_args"); cm->total_args()->show(state, level); #ifdef ENABLE_LLVM if(cm->backend_method_ && cm->backend_method_->jitted()) { llvm::outs() << "<LLVM>\n" << *cm->backend_method_->llvm_function() << "</LLVM>\n<MachineCode>\n"; LLVMState::show_machine_code( cm->backend_method_->jitted_impl(), cm->backend_method_->jitted_bytes()); llvm::outs() << "</MachineCode>\n"; } #endif close_body(level); }
void Tuple::Info::show_simple(STATE, Object* self, int level) { Tuple* tup = as<Tuple>(self); native_int size = tup->num_fields(); native_int stop = size < 6 ? size : 6; if(size == 0) { class_info(state, self, true); return; } class_info(state, self); std::cout << ": " << size << std::endl; ++level; for(native_int i = 0; i < stop; i++) { indent(level); Object* obj = tup->at(state, i); if(Tuple* t = try_as<Tuple>(obj)) { class_info(state, self); std::cout << ": " << t->num_fields() << ">" << std::endl; } else { obj->show_simple(state, level); } } if(tup->num_fields() > stop) ellipsis(level); close_body(level); }
void MethodTable::Info::show(STATE, Object* self, int level) { MethodTable* tbl = as<MethodTable>(self); size_t size = tbl->bins()->to_native(); if(size == 0) { class_info(state, self, true); return; } class_info(state, self); std::cout << ": " << size << std::endl; indent(++level); for(size_t i = 0; i < size; i++) { MethodTableBucket* entry = try_as<MethodTableBucket>(tbl->values()->at(state, i)); while(entry) { if(Symbol* sym = try_as<Symbol>(entry->name())) { std::cout << ":" << sym->debug_str(state); } else if(Fixnum* fix = try_as<Fixnum>(entry->name())) { std::cout << fix->to_native(); } entry = try_as<MethodTableBucket>(entry->next()); } if(i < size - 1) std::cout << ", "; } std::cout << std::endl; close_body(level); }
void Array::Info::show(STATE, Object* self, int level) { Array* ary = as<Array>(self); native_int size = ary->size(); native_int stop = size < 5 ? size : 5; if(size == 0) { class_info(state, self, true); return; } class_info(state, self); std::cout << ": " << size << std::endl; ++level; for(native_int i = 0; i < stop; i++) { indent(level); Object* obj = ary->get(state, i); if(obj == ary) { class_info(state, obj, true); } else { obj->show(state, level); } } if(ary->size() > stop) ellipsis(level); close_body(level); }
void InstructionSequence::Info::show(STATE, Object* self, int level) { InstructionSequence* iseq = as<InstructionSequence>(self); class_header(state, self); indent_attribute(++level, "opcodes"); iseq->opcodes()->show(state, level); close_body(level); }
void MethodVisibility::Info::show(STATE, Object* self, int level) { MethodVisibility* mv = as<MethodVisibility>(self); class_header(state, self); indent_attribute(++level, "visibility"); mv->visibility()->show(state, level); indent_attribute(level, "method"); mv->method()->show(state, level); close_body(level); }
void Encoding::Info::show(STATE, Object* self, int level) { Encoding* enc = as<Encoding>(self); class_header(state, self); indent_attribute(++level, "name"); enc->name()->show_simple(state, level); indent_attribute(level, "dummy?"); enc->dummy()->show_simple(state, level); close_body(level); }
void Exception::Info::show(STATE, Object* self, int level) { Exception* exc = as<Exception>(self); class_header(state, self); indent_attribute(++level, "message"); exc->message()->show(state, level); indent_attribute(level, "locations"); exc->locations()->show_simple(state, level); close_body(level); }
void BlockEnvironment::Info::show(STATE, Object* self, int level) { BlockEnvironment* be = as<BlockEnvironment>(self); class_header(state, self); //indent_attribute(++level, "scope"); be->scope()->show(state, level); // indent_attribute(level, "top_scope"); be->top_scope()->show(state, level); indent_attribute(level, "compiled_code"); be->compiled_code()->show(state, level); close_body(level); }
void Module::Info::show(STATE, Object* self, int level) { Module* mod = as<Module>(self); class_header(state, self); indent_attribute(++level, "name"); mod->name()->show(state, level); indent_attribute(level, "superclass"); class_info(state, mod->superclass(), true); indent_attribute(level, "constants"); mod->constants()->show(state, level); indent_attribute(level, "method_table"); mod->method_table()->show(state, level); close_body(level); }
void BlockEnvironment::Info::show(STATE, Object* self, int level) { BlockEnvironment* be = as<BlockEnvironment>(self); class_header(state, self); indent_attribute(++level, "home"); be->home()->show(state, level); indent_attribute(level, "home_block"); be->home_block()->show(state, level); indent_attribute(level, "local_count"); be->local_count()->show(state, level); indent_attribute(level, "method"); be->method()->show(state, level); close_body(level); }
void SendSite::Info::show(STATE, Object* self, int level) { SendSite* ss = as<SendSite>(self); class_header(state, self); indent_attribute(++level, "name"); ss->name()->show(state, level); indent_attribute(level, "sender"); class_info(state, ss->sender(), true); indent_attribute(level, "selector"); class_info(state, ss->selector(), true); indent_attribute(level, "hits"); std::cout << ss->hits << std::endl; indent_attribute(level, "misses"); std::cout << ss->misses << std::endl; indent_attribute(level, "module"); class_info(state, ss->module(), true); indent_attribute(level, "method"); class_info(state, ss->method(), true); indent_attribute(level, "recv_class"); class_info(state, ss->recv_class(), true); close_body(level); }
void CompiledCode::Info::show(STATE, Object* self, int level) { CompiledCode* code = as<CompiledCode>(self); class_header(state, self); indent_attribute(++level, "file"); code->file()->show(state, level); indent_attribute(level, "iseq"); code->iseq()->show(state, level); indent_attribute(level, "lines"); code->lines()->show_simple(state, level); indent_attribute(level, "literals"); code->literals()->show_simple(state, level); indent_attribute(level, "local_count"); code->local_count()->show(state, level); indent_attribute(level, "local_names"); code->local_names()->show_simple(state, level); indent_attribute(level, "name"); code->name()->show(state, level); indent_attribute(level, "required_args"); code->required_args()->show(state, level); indent_attribute(level, "scope"); code->scope()->show(state, level); indent_attribute(level, "splat"); code->splat()->show(state, level); indent_attribute(level, "stack_size"); code->stack_size()->show(state, level); indent_attribute(level, "total_args"); code->total_args()->show(state, level); indent_attribute(level, "internalized"); if(!code->machine_code_) { std::cout << "no\n"; } else { std::cout << "yes\n"; #ifdef ENABLE_LLVM MachineCode* v = code->machine_code(); for(int i = 0; i < MachineCode::cMaxSpecializations; i++) { if(!v->specializations[i].jit_data) continue; llvm::Function* func = v->specializations[i].jit_data->llvm_function(); llvm::outs() << "<LLVM>\n" << *func << "</LLVM>\n<MachineCode>\n"; LLVMState::show_machine_code( v->specializations[i].jit_data->native_func(), v->specializations[i].jit_data->native_size()); llvm::outs() << "</MachineCode>\n"; } #endif } close_body(level); }
void CompiledMethod::Info::show(STATE, Object* self, int level) { CompiledMethod* cm = as<CompiledMethod>(self); class_header(state, self); indent_attribute(++level, "exceptions"); cm->exceptions()->show_simple(state, level); indent_attribute(level, "file"); cm->file()->show(state, level); indent_attribute(level, "iseq"); cm->iseq()->show(state, level); indent_attribute(level, "lines"); cm->lines()->show_simple(state, level); indent_attribute(level, "literals"); cm->literals()->show_simple(state, level); indent_attribute(level, "local_count"); cm->local_count()->show(state, level); indent_attribute(level, "local_names"); cm->local_names()->show_simple(state, level); indent_attribute(level, "name"); cm->name()->show(state, level); indent_attribute(level, "required_args"); cm->required_args()->show(state, level); indent_attribute(level, "scope"); cm->scope()->show(state, level); indent_attribute(level, "splat"); cm->splat()->show(state, level); indent_attribute(level, "stack_size"); cm->stack_size()->show(state, level); indent_attribute(level, "total_args"); cm->total_args()->show(state, level); close_body(level); }
void LookupTable::Info::show(STATE, Object* self, int level) { LookupTable* tbl = as<LookupTable>(self); size_t size = tbl->entries()->to_native(); Array* keys = tbl->all_keys(state); if(size == 0) { class_info(state, self, true); return; } class_info(state, self); std::cout << ": " << size << std::endl; indent(++level); for(size_t i = 0; i < size; i++) { std::cout << ":" << as<Symbol>(keys->get(state, i))->c_str(state); if(i < size - 1) std::cout << ", "; } std::cout << std::endl; close_body(level); }
void MethodTable::Info::show(STATE, Object* self, int level) { MethodTable* tbl = as<MethodTable>(self); size_t size = tbl->entries()->to_native(); Array* names = tbl->all_names(state); if(size == 0) { class_info(state, self, true); return; } class_info(state, self); std::cout << ": " << size << std::endl; indent(++level); for(size_t i = 0; i < size; i++) { if(Symbol* sym = try_as<Symbol>(names->get(state, i))) { std::cout << ":" << sym->c_str(state); } else if(Fixnum* fix = try_as<Fixnum>(names->get(state, i))) { std::cout << fix->to_native(); } if(i < size - 1) std::cout << ", "; } std::cout << std::endl; close_body(level); }