本文整理汇总了C++中slot_visitor::visit_handle方法的典型用法代码示例。如果您正苦于以下问题:C++ slot_visitor::visit_handle方法的具体用法?C++ slot_visitor::visit_handle怎么用?C++ slot_visitor::visit_handle使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类slot_visitor
的用法示例。
在下文中一共展示了slot_visitor::visit_handle方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: operator
/*
next -> [entry_point]
[size]
[return address] -- x86 only, backend adds 1 to each spill location
[spill area]
...
frame -> [entry_point]
[size]
*/
void operator()(stack_frame *frame)
{
cell return_address = parent->frame_offset(frame);
if(return_address == (cell)-1)
return;
code_block *compiled = visitor->fixup.translate_code(parent->frame_code(frame));
gc_info *info = compiled->block_gc_info();
assert(return_address < compiled->size());
cell callsite = info->return_address_index(return_address);
if(callsite == (cell)-1)
return;
#ifdef DEBUG_GC_MAPS
std::cout << "call frame code block " << compiled << " with offset " << return_address << std::endl;
#endif
cell *stack_pointer = (cell *)(parent->frame_successor(frame) + 1);
u8 *bitmap = info->gc_info_bitmap();
/* Subtract old value of base pointer from every derived pointer. */
for(cell spill_slot = 0; spill_slot < info->derived_root_count; spill_slot++)
{
u32 base_pointer = info->lookup_base_pointer(callsite, spill_slot);
if(base_pointer != (u32)-1)
{
#ifdef DEBUG_GC_MAPS
std::cout << "visiting derived root " << spill_slot
<< " with base pointer " << base_pointer
<< std::endl;
#endif
stack_pointer[spill_slot] -= stack_pointer[base_pointer];
}
}
/* Update all GC roots, including base pointers. */
cell callsite_gc_roots = info->callsite_gc_roots(callsite);
for(cell spill_slot = 0; spill_slot < info->gc_root_count; spill_slot++)
{
if(bitmap_p(bitmap,callsite_gc_roots + spill_slot))
{
#ifdef DEBUG_GC_MAPS
std::cout << "visiting GC root " << spill_slot << std::endl;
#endif
visitor->visit_handle(stack_pointer + spill_slot);
}
}
/* Add the base pointers to obtain new derived pointer values. */
for(cell spill_slot = 0; spill_slot < info->derived_root_count; spill_slot++)
{
u32 base_pointer = info->lookup_base_pointer(callsite, spill_slot);
if(base_pointer != (u32)-1)
stack_pointer[spill_slot] += stack_pointer[base_pointer];
}
}
示例2: operator
/*
frame top -> [return address]
[spill area]
...
[entry_point]
[size]
*/
void operator()(void* frame_top, cell frame_size, code_block* owner,
void* addr) {
cell return_address = owner->offset(addr);
code_block* compiled =
Fixup::translated_code_block_map ? owner
: visitor->fixup.translate_code(owner);
gc_info* info = compiled->block_gc_info();
FACTOR_ASSERT(return_address < compiled->size());
cell callsite = info->return_address_index(return_address);
if (callsite == (cell)-1)
return;
#ifdef DEBUG_GC_MAPS
std::cout << "call frame code block " << compiled << " with offset "
<< return_address << std::endl;
#endif
cell* stack_pointer = (cell*)frame_top;
uint8_t* bitmap = info->gc_info_bitmap();
/* Subtract old value of base pointer from every derived pointer. */
for (cell spill_slot = 0; spill_slot < info->derived_root_count;
spill_slot++) {
uint32_t base_pointer = info->lookup_base_pointer(callsite, spill_slot);
if (base_pointer != (uint32_t)-1) {
#ifdef DEBUG_GC_MAPS
std::cout << "visiting derived root " << spill_slot
<< " with base pointer " << base_pointer << std::endl;
#endif
stack_pointer[spill_slot] -= stack_pointer[base_pointer];
}
}
/* Update all GC roots, including base pointers. */
cell callsite_gc_roots = info->callsite_gc_roots(callsite);
for (cell spill_slot = 0; spill_slot < info->gc_root_count; spill_slot++) {
if (bitmap_p(bitmap, callsite_gc_roots + spill_slot)) {
#ifdef DEBUG_GC_MAPS
std::cout << "visiting GC root " << spill_slot << std::endl;
#endif
visitor->visit_handle(stack_pointer + spill_slot);
}
}
/* Add the base pointers to obtain new derived pointer values. */
for (cell spill_slot = 0; spill_slot < info->derived_root_count;
spill_slot++) {
uint32_t base_pointer = info->lookup_base_pointer(callsite, spill_slot);
if (base_pointer != (uint32_t)-1)
stack_pointer[spill_slot] += stack_pointer[base_pointer];
}
}
示例3: trace_partial_objects
void trace_partial_objects(cell start, cell end, cell card_start, cell card_end)
{
if(card_start < end)
{
start += sizeof(cell);
if(start < card_start) start = card_start;
if(end > card_end) end = card_end;
cell *slot_ptr = (cell *)start;
cell *end_ptr = (cell *)end;
for(; slot_ptr < end_ptr; slot_ptr++)
data_visitor.visit_handle(slot_ptr);
}
}
示例4: operator
/*
next -> [entry_point]
[size]
[return address] -- x86 only, backend adds 1 to each spill location
[spill area]
...
frame -> [entry_point]
[size]
*/
void operator()(stack_frame *frame)
{
cell return_address = parent->frame_offset(frame);
if(return_address == (cell)-1)
return;
code_block *compiled = visitor->fixup.translate_code(parent->frame_code(frame));
gc_info *info = compiled->block_gc_info();
assert(return_address < compiled->size());
int index = info->return_address_index(return_address);
if(index == -1)
return;
u8 *bitmap = info->gc_info_bitmap();
cell base = info->spill_slot_base(index);
cell *stack_pointer = (cell *)(parent->frame_successor(frame) + 1);
for(cell spill_slot = 0; spill_slot < info->gc_root_count; spill_slot++)
{
if(bitmap_p(bitmap,base + spill_slot))
visitor->visit_handle(&stack_pointer[spill_slot]);
}
}
示例5: trace_handle
void trace_handle(cell *handle)
{
data_visitor.visit_handle(handle);
}