本文整理汇总了C++中CompiledMethod::stack_size方法的典型用法代码示例。如果您正苦于以下问题:C++ CompiledMethod::stack_size方法的具体用法?C++ CompiledMethod::stack_size怎么用?C++ CompiledMethod::stack_size使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类CompiledMethod
的用法示例。
在下文中一共展示了CompiledMethod::stack_size方法的8个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: test_dup
void test_dup() {
// Create a realistic MethodContext
// Is there a better way to do this?
Task* task = Task::create(state);
// create a target CM
CompiledMethod* target = CompiledMethod::create(state);
target->iseq(state, InstructionSequence::create(state, 1));
target->iseq()->opcodes()->put(state, 0, Fixnum::from(InstructionSequence::insn_ret));
target->total_args(state, Fixnum::from(0));
target->required_args(state, target->total_args());
target->stack_size(state, Fixnum::from(10));
target->formalize(state);
// create a containing CM
CompiledMethod* cm = CompiledMethod::create(state);
cm->iseq(state, InstructionSequence::create(state, 10));
cm->stack_size(state, Fixnum::from(10));
cm->local_count(state, Fixnum::from(0));
cm->literals(state, Tuple::create(state, 10));
Symbol* name = state->symbol("blah");
G(true_class)->method_table()->store(state, name, target);
SendSite* ss = SendSite::create(state, name);
cm->literals()->put(state, 0, ss);
cm->formalize(state);
MethodContext* ctx = MethodContext::create(state, Qnil, cm);
task->make_active(ctx);
task->push(Qtrue);
// Dup right before we run so we can compare later
MethodContext* dup = ctx->dup(state);
// Compare the dup'd with the original
TS_ASSERT_EQUALS(ctx->sender(), dup->sender());
TS_ASSERT_EQUALS(dup, dup->home());
TS_ASSERT_EQUALS(ctx->self(), dup->self());
TS_ASSERT_EQUALS(ctx->cm(), dup->cm());
TS_ASSERT_EQUALS(ctx->module(), dup->module());
TS_ASSERT_EQUALS(ctx->block(), dup->block());
TS_ASSERT_EQUALS(ctx->name(), dup->name());
TS_ASSERT_EQUALS(ctx->vmm, dup->vmm);
TS_ASSERT_EQUALS(ctx->ip, dup->ip);
TS_ASSERT_EQUALS(ctx->args, dup->args);
TS_ASSERT_EQUALS(ctx->stack_size, dup->stack_size);
TS_ASSERT_SAME_DATA(&ctx->js, &dup->js, sizeof(dup->js));
}
示例2: 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"))));
}
示例3:
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);
}
示例4: 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;
}
示例5: create_cm
CompiledMethod* create_cm() {
CompiledMethod* cm = CompiledMethod::create(state);
cm->iseq(state, InstructionSequence::create(state, 1));
cm->iseq()->opcodes()->put(state, 0, Fixnum::from(InstructionSequence::insn_ret));
cm->stack_size(state, Fixnum::from(10));
cm->total_args(state, Fixnum::from(0));
cm->required_args(state, cm->total_args());
// cm->formalize(state);
return cm;
}
示例6:
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);
}
示例7: 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;
}
示例8:
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);
}