本文整理汇总了C++中VariableScope::locals方法的典型用法代码示例。如果您正苦于以下问题:C++ VariableScope::locals方法的具体用法?C++ VariableScope::locals怎么用?C++ VariableScope::locals使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类VariableScope
的用法示例。
在下文中一共展示了VariableScope::locals方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1:
void VariableScope::Info::mark(Object* obj, memory::ObjectMark& mark) {
auto_mark(obj, mark);
VariableScope* vs = as<VariableScope>(obj);
if(!vs->isolated_p()) {
Object** ary = vs->locals();
size_t locals = vs->number_of_locals();
for(size_t i = 0; i < locals; i++) {
if(Object* tmp = mark.call(ary[i])) {
ary[i] = tmp;
}
}
}
}
示例2: create_heap_alias
VariableScope* StackVariables::create_heap_alias(STATE, CallFrame* call_frame,
bool full)
{
if(on_heap_) return on_heap_;
MachineCode* mcode = call_frame->compiled_code->machine_code();
VariableScope* scope =
state->memory()->new_object<VariableScope>(state, G(variable_scope));
if(parent_) {
scope->parent(state, parent_);
} else {
scope->parent(state, nil<VariableScope>());
}
scope->self(state, self_);
scope->block(state, block_);
scope->module(state, module_);
scope->method(state, call_frame->compiled_code);
scope->heap_locals(state, nil<Tuple>());
scope->last_match(state, last_match_);
scope->fiber(state, state->vm()->thread()->current_fiber());
scope->number_of_locals(mcode->number_of_locals);
scope->isolated(0);
scope->flags(call_frame->flags);
scope->_lock_.init();
if(!full) {
scope->isolated(1);
scope->heap_locals(state, Tuple::create(state, mcode->number_of_locals));
for(int i = 0; i < scope->number_of_locals(); i++) {
scope->set_local(state, i, locals_[i]);
}
}
scope->locals(locals_);
scope->dynamic_locals(state, nil<LookupTable>());
on_heap_ = scope;
return scope;
}