本文整理汇总了C++中NativeMethodEnvironment::update_cached_data方法的典型用法代码示例。如果您正苦于以下问题:C++ NativeMethodEnvironment::update_cached_data方法的具体用法?C++ NativeMethodEnvironment::update_cached_data怎么用?C++ NativeMethodEnvironment::update_cached_data使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类NativeMethodEnvironment
的用法示例。
在下文中一共展示了NativeMethodEnvironment::update_cached_data方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: rb_apply
VALUE rb_apply(VALUE recv, ID mid, VALUE args) {
NativeMethodEnvironment* env = NativeMethodEnvironment::get();
env->flush_cached_data();
Array* ary = capi::c_as<Array>(env->get_object(args));
Object* obj = env->get_object(recv);
// Unlock, we're leaving extension code.
LEAVE_CAPI(env->state());
Object* ret = obj->send(env->state(), env->current_call_frame(),
reinterpret_cast<Symbol*>(mid), ary, cNil);
// We need to get the handle for the return value before getting
// the GEL so that ret isn't accidentally GCd while we wait.
VALUE ret_handle = 0;
if(ret) ret_handle = env->get_handle(ret);
// Re-entering extension code
ENTER_CAPI(env->state());
env->update_cached_data();
// An exception occurred
if(!ret) env->current_ep()->return_to(env);
return ret_handle;
}
示例2: capi_funcall_backend
/**
* Common implementation for rb_funcall*
*/
VALUE capi_funcall_backend(const char* file, int line,
VALUE receiver, ID method_name,
size_t arg_count, VALUE* arg_array)
{
NativeMethodEnvironment* env = NativeMethodEnvironment::get();
env->flush_cached_data();
Array* args = Array::create(env->state(), arg_count);
for(size_t i = 0; i < arg_count; i++) {
args->set(env->state(), i, env->get_object(arg_array[i]));
}
Object* blk = RBX_Qnil;
if(VALUE blk_handle = env->outgoing_block()) {
blk = env->get_object(blk_handle);
env->set_outgoing_block(0);
}
Object* recv = env->get_object(receiver);
Object* ret = recv->send(env->state(), env->current_call_frame(),
reinterpret_cast<Symbol*>(method_name), args, blk);
env->update_cached_data();
// An exception occurred
if(!ret) env->current_ep()->return_to(env);
return env->get_handle(ret);
}
示例3: rb_apply
VALUE rb_apply(VALUE recv, ID mid, VALUE args) {
NativeMethodEnvironment* env = NativeMethodEnvironment::get();
env->flush_cached_data();
Array* ary = capi::c_as<Array>(env->get_object(args));
Object* obj = env->get_object(recv);
Object* ret = obj->send(env->state(), env->current_call_frame(),
reinterpret_cast<Symbol*>(mid), ary, RBX_Qnil);
env->update_cached_data();
// An exception occurred
if(!ret) env->current_ep()->return_to(env);
return env->get_handle(ret);
}
示例4: capi_funcall_backend
/**
* Common implementation for rb_funcall*
*/
VALUE capi_funcall_backend(const char* file, int line,
VALUE receiver, ID method_name,
size_t arg_count, VALUE* arg_array)
{
NativeMethodEnvironment* env = NativeMethodEnvironment::get();
env->flush_cached_data();
Array* args = Array::create(env->state(), arg_count);
for(size_t i = 0; i < arg_count; i++) {
args->set(env->state(), i, env->get_object(arg_array[i]));
}
Object* blk = cNil;
if(VALUE blk_handle = env->outgoing_block()) {
blk = env->get_object(blk_handle);
env->set_outgoing_block(0);
}
Object* recv = env->get_object(receiver);
// Unlock, we're leaving extension code.
LEAVE_CAPI(env->state());
Object* ret = recv->send(env->state(), env->current_call_frame(),
reinterpret_cast<Symbol*>(method_name), args, blk);
// We need to get the handle for the return value before getting
// the GEL so that ret isn't accidentally GCd while we wait.
VALUE ret_handle = 0;
if(ret) ret_handle = env->get_handle(ret);
// Re-entering extension code
ENTER_CAPI(env->state());
env->update_cached_data();
// An exception occurred
if(!ret) env->current_ep()->return_to(env);
return ret_handle;
}