本文整理汇总了C++中NativeMethodEnvironment::set_current_block方法的典型用法代码示例。如果您正苦于以下问题:C++ NativeMethodEnvironment::set_current_block方法的具体用法?C++ NativeMethodEnvironment::set_current_block怎么用?C++ NativeMethodEnvironment::set_current_block使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类NativeMethodEnvironment
的用法示例。
在下文中一共展示了NativeMethodEnvironment::set_current_block方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: executor_implementation
Object* NativeMethod::executor_implementation(STATE,
CallFrame* call_frame, Dispatch& msg, Arguments& args) {
NativeMethod* nm = as<NativeMethod>(msg.method);
int arity = nm->arity()->to_int();
if(arity >= 0 && (size_t)arity != args.total()) {
Exception* exc = Exception::make_argument_error(
state, arity, args.total(), msg.name);
exc->locations(state, System::vm_backtrace(state, Fixnum::from(1), call_frame));
state->thread_state()->raise_exception(exc);
return NULL;
}
NativeMethodEnvironment* env = native_method_environment.get();
NativeMethodFrame nmf(env->current_native_frame());
CallFrame* saved_frame = env->current_call_frame();
Object* saved_block = env->block();
env->set_current_call_frame(call_frame);
env->set_current_native_frame(&nmf);
env->set_current_block(args.block());
Object* ret;
ExceptionPoint ep(env);
PLACE_EXCEPTION_POINT(ep);
if(unlikely(ep.jumped_to())) {
ret = NULL;
} else {
#ifdef RBX_PROFILER
if(unlikely(state->shared.profiling())) {
profiler::MethodEntry method(state, msg, args);
ret = nm->call(state, env, args);
} else {
ret = nm->call(state, env, args);
}
#else
ret = nm->call(state, env, args);
#endif
}
env->set_current_block(saved_block);
env->set_current_call_frame(saved_frame);
env->set_current_native_frame(nmf.previous());
ep.pop(env);
return ret;
}