Skip to content

Instantly share code, notes, and snippets.

@MasterDuke17
Last active April 28, 2019 11:29
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save MasterDuke17/4bd90508faba10c22151ddb2e6172262 to your computer and use it in GitHub Desktop.
Save MasterDuke17/4bd90508faba10c22151ddb2e6172262 to your computer and use it in GitHub Desktop.
diff --git a/src/gc/debug.h b/src/gc/debug.h
index 1dd4f17bb..6daf4c9ef 100644
--- a/src/gc/debug.h
+++ b/src/gc/debug.h
@@ -3,7 +3,7 @@
* 1 = Checks on reference assignments and other relatively cheap cases
* 2 = Checks on every object register access (slow)
*/
-#define MVM_GC_DEBUG 0
+#define MVM_GC_DEBUG 2
#if MVM_GC_DEBUG
#define MVM_ASSERT_NOT_FROMSPACE(tc, c) do { \
diff --git a/src/gc/worklist.h b/src/gc/worklist.h
index 062f383d8..9725ca934 100644
--- a/src/gc/worklist.h
+++ b/src/gc/worklist.h
@@ -1,3 +1,4 @@
+#include "memdebug.h"
/* A worklist holds the current set of pointers we have got in the queue
* to scan. We hide away the details of it behind this abstraction since
* the order in which we hand things back from it can have a big influence
@@ -48,9 +49,12 @@ struct MVMGCWorklist {
else if (((*item_to_add)->flags & MVM_CF_STABLE) == 0 && !STABLE(*item_to_add)) \
MVM_panic(1, "NULL STable in item added to GC worklist"); \
if ((char *)*item_to_add >= (char *)tc->nursery_alloc && \
- (char *)*item_to_add < (char *)tc->nursery_alloc_limit) \
+ (char *)*item_to_add < (char *)tc->nursery_alloc_limit) { \
+ char command[128]; snprintf(&command, 128, "who_points_at %p", *item_to_add); VALGRIND_MONITOR_COMMAND(command); \
+ VALGRIND_PRINTF_BACKTRACE("valgrind gc_worklist_add: Adding pointer %p to past fromspace to GC worklist", *item_to_add); \
MVM_panic(1, "Adding pointer %p to past fromspace to GC worklist", \
*item_to_add); \
+ } \
} \
if (*item_to_add && (worklist->include_gen2 || !((*item_to_add)->flags & MVM_CF_SECOND_GEN))) { \
if (worklist->items == worklist->alloc) \
[dan@alexandria p6-mqtt]$ MVM_JIT_DISABLE=1 pv6 --profile -I lib/ t/regex.t
================================================================================================
This is Rakudo Perl 6 running in valgrind, a tool for debugging and profiling programs.
Running a program in valgrind usually takes *a lot* more time than running it directly,
so please be patient.
Valgrind options can be added with MVM_VALGRIND_OPTS environment variable.
This Rakudo version is 2019.03.1.248.g.4.e.677.f.048 built on MoarVM version 2019.03.102.g.423.a.9.cc.7.d,
running on arch (5.0.8.arch.1.1.arch) / linux (1.SMP.PREEMPT.Wed.Mar.27.17.53.10.UTC.2019)
------------------------------------------------------------------------------------------------
==29731== Memcheck, a memory error detector
==29731== Copyright (C) 2002-2017, and GNU GPL'd, by Julian Seward et al.
==29731== Using Valgrind-3.14.0 and LibVEX; rerun with -h for copyright info
==29731== Command: /home/dan/Source/perl6/install/bin/perl6-m --profile -I lib/ t/regex.t
==29731==
ok 1 - 4.7.1.2, 'sport/tennis/player1' should match 'sport/tennis/player1/ \#'
ok 2 - 4.7.1.2, 'sport/tennis/player1/ranking' should match 'sport/tennis/player1/ \#'
ok 3 - 4.7.1.2, 'sport/tennis/player1/wimbledon' should match 'sport/tennis/player1/ \#'
ok 4 - 4.7.1.2, 'sport' should match 'sport/ \#'
ok 5 - 4.7.1.3, 'sport/tennis/player1' should match 'sport/tennis/+'
ok 6 - 4.7.1.3, 'sport/tennis/player2' should match 'sport/tennis/+'
ok 7 - 4.7.1.3, 'sport/tennis/player1/ranking' should not match 'sport/tennis/+'
ok 8 - 4.7.1.3, 'sport' should not match 'sport/+'
ok 9 - 4.7.1.3, 'sport/' should match 'sport/+'
ok 10 - 4.7.2.1, '$SYS/something' should not match ' \#'
ok 11 - 4.7.2.1, '$SYS/monitor/Clients' should not match '+/monitor/Clients'
==29731== Searching for pointers to 0x597e3c8
==29731== *0x597e378 points at 0x597e3c8
==29731== Address 0x597e378 is 1,307,448 bytes inside a block of size 4,194,304 alloc'd
==29731== at 0x483AB65: calloc (vg_replace_malloc.c:752)
==29731== by 0x4A4EB83: MVM_calloc (alloc.h:11)
==29731== by 0x4A4EB83: MVM_tc_create (threadcontext.c:16)
==29731== by 0x4B5CFD8: MVM_vm_create_instance (moar.c:89)
==29731== by 0x109EE0: main (main.c:319)
==29731== *0xce60598 points at 0x597e3c8
==29731== Address 0xce60598 is 1,608 bytes inside a block of size 2,112 alloc'd
==29731== at 0x483AD7B: realloc (vg_replace_malloc.c:826)
==29731== by 0x4B56868: MVM_realloc (alloc.h:20)
==29731== by 0x4B56868: MVM_profiler_log_gc_deallocate (log.c:320)
==29731== by 0x4A84050: MVM_gc_collect_free_nursery_uncopied (collect.c:629)
==29731== by 0x4A7A6CE: finish_gc (orchestrate.c:237)
==29731== by 0x4A7A6CE: run_gc (orchestrate.c:412)
==29731== by 0x4A7B1CE: MVM_gc_enter_from_allocator (orchestrate.c:525)
==29731== by 0x4A7B545: MVM_gc_allocate_nursery (allocation.c:35)
==29731== by 0x4A7B87E: MVM_gc_allocate_object (allocation.c:89)
==29731== by 0x4A563AB: MVM_frame_takeclosure (frame.c:1195)
==29731== by 0x4A40E47: MVM_interp_run (interp.c:1230)
==29731== by 0x4B5DF24: MVM_vm_run_file (moar.c:444)
==29731== by 0x109FB8: main (main.c:341)
==29731== tid 1 register R11 pointing at 0x597e3c8
**29731** valgrind gc_worklist_add: Adding pointer 0x597E3C8 to past fromspace to GC worklist at 0x4B533A5: VALGRIND_PRINTF_BACKTRACE.constprop.6 (valgrind.h:6306)
==29731== by 0x4B55AC9: mark_gc_entries (instrument.c:807)
==29731== by 0x4B55AC9: MVM_profile_instrumented_mark_data (instrument.c:830)
==29731== by 0x4A7E8E7: MVM_gc_root_add_tc_roots_to_worklist (roots.c:191)
==29731== by 0x4A839B7: MVM_gc_collect (collect.c:122)
==29731== by 0x4A7A5AE: run_gc (orchestrate.c:408)
==29731== by 0x4A7B1CE: MVM_gc_enter_from_allocator (orchestrate.c:525)
==29731== by 0x4A7B545: MVM_gc_allocate_nursery (allocation.c:35)
==29731== by 0x4A7B87E: MVM_gc_allocate_object (allocation.c:89)
==29731== by 0x4A1E171: MVM_args_set_result_str (args.c:543)
==29731== by 0x4A2CED2: MVM_interp_run (interp.c:528)
==29731== by 0x4B5DF24: MVM_vm_run_file (moar.c:444)
==29731== by 0x109FB8: main (main.c:341)
MoarVM panic: Adding pointer 0x597e3c8 to past fromspace to GC worklist
==29731==
==29731== HEAP SUMMARY:
==29731== in use at exit: 88,994,291 bytes in 300,401 blocks
==29731== total heap usage: 773,771 allocs, 241,677 frees, 304,705,706 bytes allocated
==29731==
Memcheck: mc_main.c:5761 (vgMemCheck_is_valid_aligned_word): Assertion 'VG_IS_WORD_ALIGNED(a)' failed.
host stacktrace:
==29731== at 0x58048114: show_sched_status_wrk (m_libcassert.c:369)
==29731== by 0x58048227: report_and_quit (m_libcassert.c:440)
==29731== by 0x580483B9: vgPlain_assert_fail (m_libcassert.c:506)
==29731== by 0x58012C29: vgMemCheck_is_valid_aligned_word (mc_main.c:5761)
==29731== by 0x580017A8: heuristic_reachedness.isra.3 (mc_leakcheck.c:782)
==29731== by 0x58001C77: lc_push_without_clique_if_a_chunk_ptr (mc_leakcheck.c:915)
==29731== by 0x5800240D: lc_push_if_a_chunk_ptr (mc_leakcheck.c:1000)
==29731== by 0x5800240D: lc_scan_memory (mc_leakcheck.c:1170)
==29731== by 0x58002A22: lc_process_markstack (mc_leakcheck.c:1194)
==29731== by 0x5800487E: vgMemCheck_detect_memory_leaks (mc_leakcheck.c:2183)
==29731== by 0x58007B0E: mc_fini (mc_main.c:8003)
==29731== by 0x580B9FE5: shutdown_actions_NORETURN (m_main.c:2149)
==29731== by 0x580F58E3: run_a_thread_NORETURN (syswrap-linux.c:203)
sched status:
running_tid=1
Note: see also the FAQ in the source distribution.
It contains workarounds to several common problems.
In particular, if Valgrind aborted or crashed after
identifying problems in your program, there's a good chance
that fixing those problems will prevent Valgrind aborting or
crashing, especially if it happened in m_mallocfree.c.
If that doesn't help, please report this bug to: www.valgrind.org
In the bug report, send all the above text, the valgrind
version, and what OS and version you are using. Thanks.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment