Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

mark-ro-instrumentation #97482

Closed
wants to merge 5 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
24 changes: 24 additions & 0 deletions src/coreclr/gc/gc.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -30262,9 +30262,15 @@ void gc_heap::process_ephemeral_boundaries (uint8_t* x,
inline
void gc_heap::seg_set_mark_bits (heap_segment* seg)
{
uint32_t pid = GCToOSInterface::GetCurrentProcessId();
int tid = (int)GCToOSInterface::GetCurrentThreadIdForLogging ();
printf("%d %d Performing seg_set_mark_bits\n", pid, tid);
fflush(stdout);
uint8_t* o = heap_segment_mem (seg);
while (o < heap_segment_allocated (seg))
{
printf("%d %d Walking at object %p\n", pid, tid, o);
fflush(stdout);
set_marked (o);
o = o + Align (size(o));
}
Expand All @@ -30289,26 +30295,44 @@ void gc_heap::seg_clear_mark_bits (heap_segment* seg)
// all of them on the in range ro segs.
void gc_heap::mark_ro_segments()
{
uint32_t pid = GCToOSInterface::GetCurrentProcessId();
int tid = (int)GCToOSInterface::GetCurrentThreadIdForLogging ();
printf("%d %d: mark_ro_segment_begins\n", pid, tid);
fflush(stdout);
#ifndef USE_REGIONS
if ((settings.condemned_generation == max_generation) && ro_segments_in_range)
{
printf("%d %d: performing mark_ro_segment_begins\n", pid, tid);
fflush(stdout);
heap_segment* seg = generation_start_segment (generation_of (max_generation));

while (seg)
{
printf("%d %d: working on segment %p\n", pid, tid, seg);
printf("%d %d: heap_segment_mem is %p\n", pid, tid, heap_segment_mem(seg));
printf("%d %d: heap_segment_allocated is %p\n", pid, tid, heap_segment_allocated(seg));
printf("%d %d: heap_segment_committed is %p\n", pid, tid, heap_segment_committed(seg));
printf("%d %d: heap_segment_reserved is %p\n", pid, tid, heap_segment_reserved(seg));
fflush(stdout);
if (!heap_segment_read_only_p (seg))
break;

if (heap_segment_in_range_p (seg))
{
printf("%d %d: The segment is decided to be in range\n", pid, tid);
fflush(stdout);
#ifdef BACKGROUND_GC
if (settings.concurrent)
{
printf("%d %d: Working on the case for background GC\n", pid, tid);
fflush(stdout);
seg_set_mark_array_bits_soh (seg);
}
else
#endif //BACKGROUND_GC
{
printf("%d %d: Working on the case for blocking GC\n", pid, tid);
fflush(stdout);
seg_set_mark_bits (seg);
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -58,26 +58,30 @@ unw_get_proc_info_in_range (unw_word_t start_ip,
if (eh_frame_table != 0) {
unw_accessors_t *a = unw_get_accessors_int (as);

struct dwarf_eh_frame_hdr* exhdr = NULL;
if ((*a->access_mem)(as, eh_frame_table, (unw_word_t*)&exhdr, 0, arg) < 0) {
unw_word_t data;
if ((*a->access_mem)(as, eh_frame_table, &data, 0, arg) < 0) {
return -UNW_EINVAL;
}
/* we are reading only the first 4 `char` members of `struct dwarf_eh_frame_hdr`, which
* are guaranteed to fit into the first `sizeof(unw_word_t)` bytes */
struct dwarf_eh_frame_hdr exhdr;
memcpy(&exhdr, &data, sizeof(data));

if (exhdr->version != DW_EH_VERSION) {
Debug (1, "Unexpected version %d\n", exhdr->version);
if (exhdr.version != DW_EH_VERSION) {
Debug (1, "Unexpected version %d\n", exhdr.version);
return -UNW_EBADVERSION;
}
unw_word_t addr = eh_frame_table + offsetof(struct dwarf_eh_frame_hdr, eh_frame);
unw_word_t eh_frame_start;
unw_word_t fde_count;

/* read eh_frame_ptr */
if ((ret = dwarf_read_encoded_pointer(as, a, &addr, exhdr->eh_frame_ptr_enc, pi, &eh_frame_start, arg)) < 0) {
if ((ret = dwarf_read_encoded_pointer(as, a, &addr, exhdr.eh_frame_ptr_enc, pi, &eh_frame_start, arg)) < 0) {
return ret;
}

/* read fde_count */
if ((ret = dwarf_read_encoded_pointer(as, a, &addr, exhdr->fde_count_enc, pi, &fde_count, arg)) < 0) {
if ((ret = dwarf_read_encoded_pointer(as, a, &addr, exhdr.fde_count_enc, pi, &fde_count, arg)) < 0) {
return ret;
}

Expand All @@ -87,8 +91,8 @@ unw_get_proc_info_in_range (unw_word_t start_ip,
return -UNW_ENOINFO;
}

if (exhdr->table_enc != (DW_EH_PE_datarel | DW_EH_PE_sdata4)) {
Debug (1, "Table encoding not supported %x\n", exhdr->table_enc);
if (exhdr.table_enc != (DW_EH_PE_datarel | DW_EH_PE_sdata4)) {
Debug (1, "Table encoding not supported %x\n", exhdr.table_enc);
return -UNW_EINVAL;
}

Expand All @@ -113,3 +117,4 @@ unw_get_proc_info_in_range (unw_word_t start_ip,
}
return UNW_ESUCCESS;
}

Loading