From 8c20c3dcdf3e237940ba99da83d2af84e58c0d20 Mon Sep 17 00:00:00 2001 From: "C. Guy Yarvin" Date: Thu, 16 Nov 2017 11:44:52 -0800 Subject: [PATCH] Larger slab allocations make profiling work. --- Makefile | 2 +- include/noun/allocate.h | 5 +++++ include/noun/trace.h | 2 +- noun/allocate.c | 7 ++----- noun/imprison.c | 2 +- 5 files changed, 10 insertions(+), 8 deletions(-) diff --git a/Makefile b/Makefile index 36c558cff..c63b19041 100644 --- a/Makefile +++ b/Makefile @@ -72,7 +72,7 @@ CLD=c++ $(CFLAGS) -L/usr/local/lib $(OPTLOCALLFLAGS) $(OPENSSLLFLAGS) ifeq ($(OS),osx) CLDOSFLAGS=-bind_at_load - OSLIBS=-framework CoreServices -framework CoreFoundation + OSLIBS=-lprofiler -framework CoreServices -framework CoreFoundation endif ifeq ($(OS),linux) OSLIBS=-lpthread -lrt -lcurses diff --git a/include/noun/allocate.h b/include/noun/allocate.h index aec2662f0..1549948f8 100644 --- a/include/noun/allocate.h +++ b/include/noun/allocate.h @@ -400,6 +400,11 @@ void u3a_print_memory(c3_c* cap_c, c3_w wor_w); + /* u3a_deadbeef(): write 0xdeadbeef from hat to cap. + */ + void + u3a_deadbeef(void); + /* Atoms from proto-atoms. */ /* u3a_slab(): create a length-bounded proto-atom. diff --git a/include/noun/trace.h b/include/noun/trace.h index e629639c8..5b847f521 100644 --- a/include/noun/trace.h +++ b/include/noun/trace.h @@ -6,7 +6,7 @@ **/ /* U3_CPU_DEBUG: activate profiling. */ -# define U3_CPU_DEBUG +# undef U3_CPU_DEBUG /** Data structures. **/ diff --git a/noun/allocate.c b/noun/allocate.c index b0238276a..9c18b58b8 100644 --- a/noun/allocate.c +++ b/noun/allocate.c @@ -662,7 +662,7 @@ u3a_malloc(size_t len_i) /* u3a_cellblock(): allocate a block of cells on the hat. */ -c3_o +static c3_o u3a_cellblock(c3_w num_w) { u3p(u3a_fbox) fre_p; @@ -758,10 +758,7 @@ u3a_celloc(void) return u3a_walloc(c3_wiseof(u3a_cell)); } else { -#ifdef U3_CPU_DEBUG - u3R->pro.cel_d++; -#endif - if ( c3n == u3a_cellblock(1024) ) { + if ( c3n == u3a_cellblock(256 << 10) ) { return u3a_walloc(c3_wiseof(u3a_cell)); } cel_p = u3R->all.cel_p; diff --git a/noun/imprison.c b/noun/imprison.c index fc667e004..c08e967f4 100644 --- a/noun/imprison.c +++ b/noun/imprison.c @@ -204,7 +204,7 @@ u3i_cell(u3_noun a, u3_noun b) #ifdef U3_CPU_DEBUG u3R->pro.cel_d++; -#endif +#endif { // c3_w* nov_w = u3a_walloc(c3_wiseof(u3a_cell)); c3_w* nov_w = u3a_celloc();