本文整理汇总了C++中CompiledMethod::name方法的典型用法代码示例。如果您正苦于以下问题:C++ CompiledMethod::name方法的具体用法?C++ CompiledMethod::name怎么用?C++ CompiledMethod::name使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类CompiledMethod
的用法示例。
在下文中一共展示了CompiledMethod::name方法的13个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: original_name
Symbol* original_name() {
if(multiple_scopes_p()) {
if(block_as_method_p()) return cm->name();
return top_scope_->method()->name();
}
return cm->name();
}
示例2: test_enter_method
void test_enter_method() {
Symbol* meth = state->symbol("meth");
CompiledMethod* cm = CompiledMethod::create(state);
cm->name(state, meth);
state->shared.enable_profiling(state);
profiler::Profiler* prof = state->profiler();
Dispatch dis(meth, G(object), cm);
Arguments args;
profiler::MethodEntry* me1 = new profiler::MethodEntry(state, dis, args, cm);
TS_ASSERT_EQUALS(prof->methods_.size(), 1U);
TS_ASSERT_EQUALS(me1->method_, prof->methods_.find(me1->method_->id())->second);
dis.module = G(object)->metaclass(state);
profiler::MethodEntry* me2 = new profiler::MethodEntry(state, dis, args);
TS_ASSERT_EQUALS(prof->methods_.size(), 2U);
TS_ASSERT_EQUALS(me2->method_, prof->methods_.find(me2->method_->id())->second);
delete me1;
delete me2;
}
示例3: test_enter_block
void test_enter_block() {
Symbol* meth = state->symbol("meth");
CompiledMethod* cm = CompiledMethod::create(state);
cm->name(state, meth);
Symbol* name = state->symbol("ModName");
Module* mod = Module::create(state);
mod->name(state, name);
state->shared.enable_profiling(state);
profiler::Profiler* prof = state->profiler();
profiler::MethodEntry* me1 = new profiler::MethodEntry(state, meth, mod, cm);
TS_ASSERT_EQUALS(prof->methods_.size(), 1U);
TS_ASSERT_EQUALS(me1->method_, prof->methods_.find(me1->method_->id())->second);
mod = G(object)->metaclass(state);
profiler::MethodEntry* me2 = new profiler::MethodEntry(state, meth, mod, cm);
TS_ASSERT_EQUALS(prof->methods_.size(), 2U);
TS_ASSERT_EQUALS(me2->method_, prof->methods_.find(me2->method_->id())->second);
delete me1;
delete me2;
}
示例4: test_cmethod
void test_cmethod() {
std::string str = "M\n1\nn\nx\n12\nobject_equal\nx\n4\ntest\ni\n1\n0\nI\na\nI\n0\nI\n0\nI\n0\nn\np\n2\nI\n1\nI\n2\np\n1\np\n3\nI\n0\nI\n1\nI\n1\nx\n8\nnot_real\np\n1\nx\n4\nblah\n";
mar->sstream.str(str);
Object* obj = mar->unmarshal();
TS_ASSERT(kind_of<CompiledMethod>(obj));
CompiledMethod* cm = as<CompiledMethod>(obj);
TS_ASSERT_EQUALS(cm->ivars(), Qnil);
TS_ASSERT_EQUALS(cm->primitive(), state->symbol("object_equal"));
TS_ASSERT_EQUALS(cm->name(), state->symbol("test"));
TS_ASSERT(tuple_equals(cm->iseq()->opcodes(), Tuple::from(state, 1, Fixnum::from(0))));
TS_ASSERT_EQUALS(cm->stack_size(), Fixnum::from(10));
TS_ASSERT_EQUALS(cm->local_count(), Fixnum::from(0));
TS_ASSERT_EQUALS(cm->required_args(), Fixnum::from(0));
TS_ASSERT_EQUALS(cm->total_args(), Fixnum::from(0));
TS_ASSERT_EQUALS(cm->splat(), Qnil);
TS_ASSERT(tuple_equals(cm->literals(), Tuple::from(state, 2, Fixnum::from(1), Fixnum::from(2))));
TS_ASSERT(tuple_equals(cm->lines(), Tuple::from(state, 1,
Tuple::from(state, 3, Fixnum::from(0), Fixnum::from(1), Fixnum::from(1)))));
TS_ASSERT_EQUALS(cm->file(), state->symbol("not_real"));
TS_ASSERT(tuple_equals(cm->local_names(), Tuple::from(state, 1, state->symbol("blah"))));
}
示例5:
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);
}
示例6: get_cmethod
CompiledMethod* UnMarshaller::get_cmethod() {
size_t ver;
stream >> ver;
CompiledMethod* cm = CompiledMethod::create(state);
cm->ivars(state, unmarshal());
cm->primitive(state, (Symbol*)unmarshal());
cm->name(state, (Symbol*)unmarshal());
cm->iseq(state, (InstructionSequence*)unmarshal());
cm->stack_size(state, (Fixnum*)unmarshal());
cm->local_count(state, (Fixnum*)unmarshal());
cm->required_args(state, (Fixnum*)unmarshal());
cm->total_args(state, (Fixnum*)unmarshal());
cm->splat(state, unmarshal());
cm->literals(state, (Tuple*)unmarshal());
cm->exceptions(state, (Tuple*)unmarshal());
cm->lines(state, (Tuple*)unmarshal());
cm->file(state, (Symbol*)unmarshal());
cm->local_names(state, (Tuple*)unmarshal());
cm->post_marshal(state);
return cm;
}
示例7: compile_method
void Compiler::compile_method(LLVMState* ls, BackgroundCompileRequest* req) {
CompiledMethod* cm = req->method();
if(ls->config().jit_inline_debug) {
struct timeval tv;
gettimeofday(&tv, NULL);
ls->log() << "JIT: compiling "
<< ls->enclosure_name(cm)
<< "#"
<< ls->symbol_debug_str(cm->name())
<< " (" << tv.tv_sec << "." << tv.tv_usec << ")\n";
}
JITMethodInfo info(ctx_, cm, cm->backend_method());
info.is_block = false;
if(Class* cls = req->receiver_class()) {
info.set_self_class(cls);
}
ctx_.set_root(&info);
jit::MethodBuilder work(ls, info);
work.setup();
compile_builder(ctx_, ls, info, work);
}
示例8: FlashRuby_eval
FREObject FlashRuby_eval(FREContext ctx, void* funcData, uint32_t argc, FREObject argv[])
{
uint32_t length = 0;
const uint8_t* fl_str = NULL;
FREGetObjectAsUTF8(argv[0], &length, &fl_str);
InterpreterCallFrame* frame = ALLOCA_CALLFRAME(0);
frame->prepare(0);
frame->previous = NULL;
frame->dispatch_data = NULL;
frame->flags = 0;
CompiledMethod* cm = CompiledMethod::create(state);
cm->metadata(state, state->symbol("__script__"));
cm->name(state, state->symbol("__script__"));
frame->cm = cm;
StackVariables* scope = ALLOCA_STACKVARIABLES(0);
scope->initialize(G(main), cNil, G(object), 0);
scope->on_heap_ = VariableScope::synthesize(state, cm, G(object), cNil, G(main), cNil, state->new_object<Tuple>(G(tuple)));
frame->scope = scope;
Arguments* arguments = new Arguments(state->symbol("script"), G(main), cNil, 0, 0);
frame->arguments = arguments;
state->set_call_frame(frame);
String* str = String::create(state, (const char*)fl_str);
Array* eval_args = Array::create(state, 1);
eval_args->append(state, str);
Object* result_obj = G(main)->send(state, frame, state->symbol("instance_eval"), eval_args);
const char* result_c_str = result_obj->to_s(state)->c_str_null_safe(state);
FREObject result_str;
FRENewObjectFromUTF8(strlen(result_c_str), (const uint8_t*)result_c_str, &result_str);
return result_str;
}
示例9:
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);
indent_attribute(level, "internalized");
if(!cm->backend_method_) {
std::cout << "no\n";
} else {
std::cout << "yes\n";
#ifdef ENABLE_LLVM
VMMethod* v = cm->backend_method();
for(int i = 0; i < VMMethod::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);
}
示例10: generate_tramp
CompiledMethod* CompiledMethod::generate_tramp(STATE, size_t stack_size) {
CompiledMethod* cm = CompiledMethod::create(state);
cm->stack_size(state, Fixnum::from(stack_size));
cm->required_args(state, Fixnum::from(0));
cm->total_args(state, cm->required_args());
cm->name(state, state->symbol("__halt__"));
cm->iseq(state, InstructionSequence::create(state, 1));
cm->iseq()->opcodes()->put(state, 0, Fixnum::from(InstructionSequence::insn_halt));
StaticScope* ss = StaticScope::create(state);
ss->module(state, G(object));
cm->scope(state, ss);
cm->formalize(state, false);
return cm;
}
示例11:
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);
}
示例12: activate
ExecuteStatus CompiledMethod::activate(STATE, Executable* exec, Task* task, Message& msg) {
CompiledMethod* meth = as<CompiledMethod>(msg.recv);
Object* recv = msg.get_argument(0);
Module* mod = as<Module>(msg.get_argument(1));
Array* args = as<Array>(msg.get_argument(2));
// Leave msg.block set and pass it through.
msg.recv = recv;
msg.method = meth;
msg.module = mod;
msg.set_arguments(state, args);
msg.name = meth->name();
msg.priv = true;
msg.method_missing = false;
// NOTE even when we're activating a method_missing, we don't
// push the name given, because there really isn't one. So if
// this is used to call a method_missing, you have to supply all
// the args.
return meth->execute(state, task, msg);
}
示例13: is_block_p
bool is_block_p(STATE) {
return cm->name() == state->symbol("__block__");
}