profiling_sample::profiling_sample(factor_vm *vm,
profiling_sample_count const &counts,
- context *ctx)
+ cell thread)
:
counts(counts),
- ctx(ctx)
+ thread(thread)
{
vm->record_callstack_sample(&callstack_begin, &callstack_end);
}
{
profiling_sample_count counts = safepoint_sample_counts.record_counts();
if (!counts.empty())
- samples.push_back(profiling_sample(this, counts, ctx));
+ samples.push_back(profiling_sample(this,
+ counts, special_objects[OBJ_CURRENT_THREAD]));
}
void factor_vm::record_callstack_sample(cell *begin, cell *end)
set_array_nth(sample.untagged(),2,tag_fixnum(from_iter->counts.foreign_sample_count));
set_array_nth(sample.untagged(),3,tag_fixnum(from_iter->counts.foreign_thread_sample_count));
- cell ctx = allot_alien((void*)from_iter->ctx);
- set_array_nth(sample.untagged(),4,ctx);
+ set_array_nth(sample.untagged(),4,from_iter->thread);
cell callstack_size = from_iter->callstack_end - from_iter->callstack_begin;
data_root<array> callstack(allot_array(callstack_size,false_object),this);
{
// Sample counts
profiling_sample_count counts;
- // Active context during sample
- context *ctx;
+ // Active thread during sample
+ cell thread;
/* The callstack at safepoint time. Indexes to the beginning and ending
code_block entries in the vm sample_callstacks array. */
cell callstack_begin, callstack_end;
profiling_sample(factor_vm *vm,
profiling_sample_count const &counts,
- context *ctx);
+ cell thread);
};
}
void visit_code_block_objects(code_block *compiled);
void visit_embedded_literals(code_block *compiled);
void visit_sample_callstacks();
+ void visit_sample_threads();
};
template<typename Fixup>
}
}
+template<typename Fixup>
+void slot_visitor<Fixup>::visit_sample_threads()
+{
+ for (std::vector<profiling_sample>::iterator iter = parent->samples.begin();
+ iter != parent->samples.end();
+ ++iter)
+ {
+ visit_handle(&iter->thread);
+ }
+}
+
template<typename Fixup>
void slot_visitor<Fixup>::visit_roots()
{
visit_callback_roots();
visit_literal_table_roots();
visit_sample_callstacks();
+ visit_sample_threads();
visit_object_array(parent->special_objects,parent->special_objects + special_object_count);
}