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

Heap Snapshot #46862

Merged
merged 25 commits into from
Oct 5, 2022
Merged
Show file tree
Hide file tree
Changes from 17 commits
Commits
Show all changes
25 commits
Select commit Hold shift + click to select a range
01b6af2
Added heap profiler.
apaz-cli Sep 8, 2022
03addad
Updated/Rewrote heap snapshot PR. Moved to Profile package, optimized…
apaz-cli Sep 8, 2022
72206ea
remove newline
apaz-cli Sep 23, 2022
8acc854
Update src/gc-heap-snapshot.cpp
apaz-cli Sep 26, 2022
042bc5b
Removed unnecessary cast
apaz-cli Sep 26, 2022
f300a21
Remove extra todo
apaz-cli Sep 26, 2022
3b5a832
Update src/gc.c
apaz-cli Sep 26, 2022
19fbec8
Added cleanup to test.
apaz-cli Sep 27, 2022
325ca8b
Added back cast, removed check for jl_buff_tag.
apaz-cli Sep 27, 2022
a814039
Added docs about all_one.
apaz-cli Sep 27, 2022
59ce09b
Added take_heap_snapshot() to Profile docs.
apaz-cli Sep 27, 2022
5a40b9e
TODOs only for gc_heap_snapshot_record
apaz-cli Sep 27, 2022
868c0ff
Changed stack frame size to 0 so synthetic root node doesn't show up …
apaz-cli Sep 27, 2022
0354572
Remove gc_heap_snapshot_record_module_to_binding
apaz-cli Sep 27, 2022
dc8df96
Fully removed record module edge.
apaz-cli Sep 27, 2022
89cf29e
Using jl_atomic_load_relaxed() to load atomic fields from binding.
apaz-cli Sep 27, 2022
f7d2978
Fixed style again.
apaz-cli Sep 27, 2022
94f20ef
Fixed trailing whitespace and added atomic load to appease the saniti…
apaz-cli Sep 28, 2022
3d49b4b
Put the brace back on a new line, as requested.
apaz-cli Sep 28, 2022
1fdd355
style: Moved all { after functions in gc-heap-snapshot.c to a new line.
apaz-cli Sep 30, 2022
adc9e59
Update style
apaz-cli Oct 3, 2022
e511021
Updated the description of take_heap_snapshot()
apaz-cli Oct 4, 2022
3bf039a
Updated the description of take_heap_snapshot()
apaz-cli Oct 4, 2022
2ae020d
Fixed style
apaz-cli Oct 4, 2022
3aa4fdb
Added cast from task to value.
apaz-cli Oct 4, 2022
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
6 changes: 4 additions & 2 deletions src/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ SRCS := \
dlload sys init task array dump staticdata toplevel jl_uv datatype \
simplevector runtime_intrinsics precompile jloptions \
threading partr stackwalk gc gc-debug gc-pages gc-stacks gc-alloc-profiler method \
jlapi signal-handling safepoint timing subtype rtutils \
jlapi signal-handling safepoint timing subtype rtutils gc-heap-snapshot \
crc32c APInt-C processor ircode opaque_closure codegen-stubs coverage runtime_ccall

RT_LLVMLINK :=
Expand Down Expand Up @@ -293,7 +293,9 @@ $(BUILDDIR)/disasm.o $(BUILDDIR)/disasm.dbg.obj: $(SRCDIR)/debuginfo.h $(SRCDIR)
$(BUILDDIR)/dump.o $(BUILDDIR)/dump.dbg.obj: $(addprefix $(SRCDIR)/,common_symbols1.inc common_symbols2.inc builtin_proto.h serialize.h)
$(BUILDDIR)/gc-debug.o $(BUILDDIR)/gc-debug.dbg.obj: $(SRCDIR)/gc.h
$(BUILDDIR)/gc-pages.o $(BUILDDIR)/gc-pages.dbg.obj: $(SRCDIR)/gc.h
$(BUILDDIR)/gc.o $(BUILDDIR)/gc.dbg.obj: $(SRCDIR)/gc.h $(SRCDIR)/gc-alloc-profiler.h
$(BUILDDIR)/gc.o $(BUILDDIR)/gc.dbg.obj: $(SRCDIR)/gc.h $(SRCDIR)/gc-heap-snapshot.h $(SRCDIR)/gc-alloc-profiler.h
$(BUILDDIR)/gc-heap-snapshot.o $(BUILDDIR)/gc-heap-snapshot.dbg.obj: $(SRCDIR)/gc.h $(SRCDIR)/gc-heap-snapshot.h
$(BUILDDIR)/gc-alloc-profiler.o $(BUILDDIR)/gc-alloc-profiler.dbg.obj: $(SRCDIR)/gc.h $(SRCDIR)/gc-alloc-profiler.h
$(BUILDDIR)/init.o $(BUILDDIR)/init.dbg.obj: $(SRCDIR)/builtin_proto.h
$(BUILDDIR)/interpreter.o $(BUILDDIR)/interpreter.dbg.obj: $(SRCDIR)/builtin_proto.h
$(BUILDDIR)/jitlayers.o $(BUILDDIR)/jitlayers.dbg.obj: $(SRCDIR)/jitlayers.h $(SRCDIR)/codegen_shared.h $(SRCDIR)/debug-registry.h
Expand Down
17 changes: 6 additions & 11 deletions src/gc-debug.c
Original file line number Diff line number Diff line change
Expand Up @@ -1227,20 +1227,17 @@ void gc_count_pool(void)
jl_safe_printf("************************\n");
}

int gc_slot_to_fieldidx(void *obj, void *slot)
int gc_slot_to_fieldidx(void *obj, void *slot, jl_datatype_t *vt) JL_NOTSAFEPOINT
{
jl_datatype_t *vt = (jl_datatype_t*)jl_typeof(obj);
int nf = (int)jl_datatype_nfields(vt);
for (int i = 0; i < nf; i++) {
void *fieldaddr = (char*)obj + jl_field_offset(vt, i);
if (fieldaddr >= slot) {
return i;
}
for (int i = 1; i < nf; i++) {
if (slot < (void*)((char*)obj + jl_field_offset(vt, i)))
return i - 1;
}
return -1;
return nf - 1;
}

int gc_slot_to_arrayidx(void *obj, void *_slot)
int gc_slot_to_arrayidx(void *obj, void *_slot) JL_NOTSAFEPOINT
{
char *slot = (char*)_slot;
jl_datatype_t *vt = (jl_datatype_t*)jl_typeof(obj);
Expand All @@ -1258,8 +1255,6 @@ int gc_slot_to_arrayidx(void *obj, void *_slot)
}
else if (vt->name == jl_array_typename) {
jl_array_t *a = (jl_array_t*)obj;
if (!a->flags.ptrarray)
return -1;
start = (char*)a->data;
len = jl_array_len(a);
elsize = a->elsize;
Expand Down
Loading