本文整理汇总了C++中StackVariables::nil_p方法的典型用法代码示例。如果您正苦于以下问题:C++ StackVariables::nil_p方法的具体用法?C++ StackVariables::nil_p怎么用?C++ StackVariables::nil_p使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类StackVariables
的用法示例。
在下文中一共展示了StackVariables::nil_p方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: execute_interpreter
// Installed by default in BlockEnvironment::execute, it runs the bytecodes
// for the block in the interpreter.
//
// Future code will detect hot blocks and queue them in the JIT, whereby the
// JIT will install a newly minted machine function into ::execute.
Object* BlockEnvironment::execute_interpreter(STATE, CallFrame* previous,
BlockEnvironment* env, Arguments& args,
BlockInvocation& invocation)
{
// Don't use env->machine_code() because it might lock and the work should
// already be done.
MachineCode* const mcode = env->compiled_code_->machine_code();
if(!mcode) {
Exception::internal_error(state, previous, "invalid bytecode method");
return 0;
}
#ifdef ENABLE_LLVM
if(mcode->call_count >= 0) {
if(mcode->call_count >= state->shared().config.jit_threshold_compile) {
OnStack<1> os(state, env);
G(jit)->compile_soon(state, env->compiled_code(), previous,
invocation.self->direct_class(state), env, true);
} else {
mcode->call_count++;
}
}
#endif
StackVariables* scope = ALLOCA_STACKVARIABLES(mcode->number_of_locals);
Module* mod = invocation.module;
if(!mod) mod = env->module();
Object* block = cNil;
if(VariableScope* scope = env->top_scope_) {
if(!scope->nil_p()) block = scope->block();
}
scope->initialize(invocation.self, block, mod, mcode->number_of_locals);
scope->set_parent(env->scope_);
InterpreterCallFrame* frame = ALLOCA_CALLFRAME(mcode->stack_size);
frame->prepare(mcode->stack_size);
frame->previous = previous;
frame->constant_scope_ = invocation.constant_scope;
frame->arguments = &args;
frame->dispatch_data = env;
frame->compiled_code = env->compiled_code_;
frame->scope = scope;
frame->top_scope_ = env->top_scope_;
frame->flags = invocation.flags | CallFrame::cMultipleScopes
| CallFrame::cBlock;
if(!GenericArguments::call(state, frame, mcode, scope, args, invocation.flags)) {
if(state->vm()->thread_state()->raise_reason() == cNone) {
Exception* exc =
Exception::make_argument_error(state, mcode->required_args, args.total(),
mcode->name());
exc->locations(state, Location::from_call_stack(state, previous));
state->raise_exception(exc);
}
return NULL;
}
#ifdef RBX_PROFILER
if(unlikely(state->vm()->tooling())) {
Module* mod = scope->module();
if(SingletonClass* sc = try_as<SingletonClass>(mod)) {
if(Module* ma = try_as<Module>(sc->singleton())) {
mod = ma;
}
}
OnStack<2> os(state, env, mod);
// Check the stack and interrupts here rather than in the interpreter
// loop itself.
GCTokenImpl gct;
if(!state->check_interrupts(gct, frame, frame)) return NULL;
state->checkpoint(gct, frame);
tooling::BlockEntry method(state, env, mod);
return (*mcode->run)(state, mcode, frame);
} else {
// Check the stack and interrupts here rather than in the interpreter
// loop itself.
GCTokenImpl gct;
if(!state->check_interrupts(gct, frame, frame)) return NULL;
//.........这里部分代码省略.........