-
-
Save MasterDuke17/7ddafa9a98898c57b4a63cecc55a4a37 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| diff --git src/core/alloc.h src/core/alloc.h | |
| index d5f25b21c..3b7b250a2 100644 | |
| --- src/core/alloc.h | |
| +++ src/core/alloc.h | |
| @@ -1,5 +1,9 @@ | |
| +#include "TracyC.h" | |
| MVM_STATIC_INLINE void * MVM_malloc(size_t size) { | |
| void *ptr = malloc(size); | |
| + fprintf(stderr, "m %p\n", ptr); | |
| + | |
| + TracyCAlloc(ptr, size); | |
| if (!ptr) | |
| MVM_panic_allocation_failed(size); | |
| @@ -9,6 +13,9 @@ MVM_STATIC_INLINE void * MVM_malloc(size_t size) { | |
| MVM_STATIC_INLINE void * MVM_calloc(size_t num, size_t size) { | |
| void *ptr = calloc(num, size); | |
| + fprintf(stderr, "c %p\n", ptr); | |
| + | |
| + TracyCAlloc(ptr, num * size); | |
| if (!ptr) | |
| MVM_panic_allocation_failed(num * size); | |
| @@ -18,6 +25,12 @@ MVM_STATIC_INLINE void * MVM_calloc(size_t num, size_t size) { | |
| MVM_STATIC_INLINE void * MVM_realloc(void *p, size_t size) { | |
| void *ptr = realloc(p, size); | |
| + fprintf(stderr, "rm %p\n", ptr); | |
| + | |
| + if (p != ptr) { | |
| + TracyCFree(p); | |
| + TracyCAlloc(ptr, size); | |
| + } | |
| if (!ptr && size > 0) | |
| MVM_panic_allocation_failed(size); | |
| @@ -27,6 +40,12 @@ MVM_STATIC_INLINE void * MVM_realloc(void *p, size_t size) { | |
| MVM_STATIC_INLINE void * MVM_recalloc(void *p, size_t old_size, size_t size) { | |
| void *ptr = realloc(p, size); | |
| + fprintf(stderr, "rc %p\n", ptr); | |
| + | |
| + if (p != ptr) { | |
| + TracyCFree(p); | |
| + TracyCAlloc(ptr, size); | |
| + } | |
| if (size > 0) { | |
| if (!ptr) | |
| @@ -40,6 +59,7 @@ MVM_STATIC_INLINE void * MVM_recalloc(void *p, size_t old_size, size_t size) { | |
| } | |
| MVM_STATIC_INLINE void MVM_free(void *p) { | |
| + TracyCFree(p); | |
| free(p); | |
| } | |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| diff --git src/main.c src/main.c | |
| index 784dc60ad..380aec870 100644 | |
| --- src/main.c | |
| +++ src/main.c | |
| @@ -3,6 +3,7 @@ | |
| #include <string.h> | |
| #include <moar.h> | |
| #include "platform/io.h" | |
| +#include "TracyC.h" | |
| #if MVM_TRACING | |
| # define TRACING_OPT "[--tracing] " | |
| @@ -277,6 +278,7 @@ int wmain(int argc, wchar_t *wargv[]) | |
| return EXIT_FAILURE; | |
| } | |
| + TracyCZone(ctx_a, 1); | |
| instance = MVM_vm_create_instance(); | |
| input_file = argv[argi++]; | |
| @@ -311,6 +313,7 @@ int wmain(int argc, wchar_t *wargv[]) | |
| } | |
| #endif | |
| + TracyCZoneEnd(ctx_a); | |
| if (full_cleanup) { | |
| MVM_vm_destroy_instance(instance); | |
| return EXIT_SUCCESS; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| --- Makefile 2021-04-26 07:08:30.093180118 -0400 | |
| +++ Makefile.tracy 2021-04-26 06:46:51.409440071 -0400 | |
| @@ -44,9 +44,10 @@ | |
| PKGCONFIGDIR = /home/dan/Source/perl6/install/share/pkgconfig | |
| -CFLAGS = -std=gnu99 -Wextra -Wall -Wno-unused-parameter -Wno-unused-function -Wno-missing-braces -Werror=pointer-arith -O3 -DNDEBUG -g3 -D_REENTRANT -D_FILE_OFFSET_BITS=64 -fPIC -DDEBUG_HELPERS -DMVM_DTRACE_SUPPORT -DHAVE_TELEMEH -DMVM_HEAPSNAPSHOT_FORMAT=3 -march=native -DMVM_TRACING=$(TRACING) -DMVM_CGOTO=$(CGOTO) -DMVM_RDTSCP=$(RDTSCP) | |
| +CFLAGS = -std=gnu99 -Wextra -Wall -Wno-unused-parameter -Wno-unused-function -Wno-missing-braces -Werror=pointer-arith -O3 -DNDEBUG -g3 -D_REENTRANT -D_FILE_OFFSET_BITS=64 -fPIC -DDEBUG_HELPERS -DMVM_DTRACE_SUPPORT -DHAVE_TELEMEH -DMVM_HEAPSNAPSHOT_FORMAT=3 -march=native -DMVM_TRACING=$(TRACING) -DMVM_CGOTO=$(CGOTO) -DMVM_RDTSCP=$(RDTSCP) -DTRACY_ENABLE | |
| CINCLUDES = -I3rdparty/libuv/include -I3rdparty/libuv/src -I3rdparty/libatomicops/src -I3rdparty/libtommath -I3rdparty/dyncall/dynload -I3rdparty/dyncall/dyncall -I3rdparty/dyncall/dyncallback \ | |
| -I3rdparty/sha1 \ | |
| + -I3rdparty/tracy \ | |
| -isystem3rdparty/tinymt \ | |
| -isystem3rdparty/dynasm \ | |
| -isystem3rdparty/cmp \ | |
| @@ -54,7 +55,7 @@ | |
| \ | |
| -Isrc | |
| LDFLAGS = -O3 -DNDEBUG -g3 -Wl,-rpath,"//home/dan/Source/perl6/install/lib" | |
| -LDLIBS = -lm -lpthread -lrt -ldl -lzstd | |
| +LDLIBS = -lm -lpthread -lrt -ldl -lzstd -lstdc++ | |
| MAIN_LIBS = -L. -lmoar | |
| DLL_LIBS = 3rdparty/cmp/libcmp.a 3rdparty/dyncall/dyncall/libdyncall_s.a 3rdparty/dyncall/dyncallback/libdyncallback_s.a 3rdparty/dyncall/dynload/libdynload_s.a 3rdparty/libatomicops/src/libatomic_ops.a 3rdparty/tinymt/libtinymt.a 3rdparty/sha1/libsha1.a 3rdparty/libtommath/libtommath.a 3rdparty/libuv/libuv.a $(LDLIBS) | |
| ARFLAGS = rcs | |
| @@ -256,6 +257,7 @@ | |
| src/platform/memmem32.o \ | |
| 3rdparty/freebsd/memmem.o \ | |
| src/platform/malloc_trim.o \ | |
| + 3rdparty/tracy/TracyClient.o \ | |
| src/moar.o \ | |
| $(PLATFORM_POSIX) \ | |
| $(JIT_OBJECTS) $(JIT_ARCH_X64) | |
| @@ -680,6 +682,9 @@ | |
| $(MSG) compiling $@ | |
| $(CMD)$(CC) -c $(CFLAGS) -DMVM_BUILD_SHARED -fPIC $(CINCLUDES) -o $@ $*.c | |
| +3rdparty/tracy/TracyClient.o: 3rdparty/tracy/TracyClient.cpp | |
| + $(MSG) compiling $@ | |
| + $(CMD)$(CC) -c $(CFLAGS) -DMVM_SHARED $(CINCLUDES) -o $@ $*.cpp | |
| src/main.o: src/main.c | |
| $(MSG) compiling $@ |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment