1 /* i/n/t.h 2 ** 3 ** This file is in the public domain. 4 */ 5 /** Options. 6 **/ 7 /* U3_CPU_DEBUG: activate profiling. 8 */ 9 # undef U3_CPU_DEBUG 10 11 /** Data structures. 12 **/ 13 /* u3t_trace: fast execution flags. 14 */ 15 typedef struct _u3t_trace { 16 c3_o noc_o; // now executing in nock interpreter 17 c3_o glu_o; // now executing in jet glue 18 c3_o mal_o; // now executing in allocator 19 c3_o far_o; // now executing in fragmentor 20 c3_o coy_o; // now executing in copy 21 c3_o euq_o; // now executing in equal 22 } u3t_trace; 23 24 /** Macros. 25 **/ 26 # ifdef U3_CPU_DEBUG 27 # define u3t_on(var) \ 28 (u3T.var = (u3C.wag_w & u3o_debug_cpu) \ 29 ? (c3n == u3T.var) ? c3y : (abort(), 0) \ 30 : u3T.var) 31 # else 32 # define u3t_on(var) 33 #endif 34 35 # ifdef U3_CPU_DEBUG 36 # define u3t_off(var) \ 37 (u3T.var = (u3C.wag_w & u3o_debug_cpu) \ 38 ? (c3y == u3T.var) ? c3n : (abort(), 0) \ 39 : u3T.var) 40 # else 41 # define u3t_off(var) 42 #endif 43 44 45 /** Functions. 46 **/ 47 /* u3t_init(): initialize tracing layer. 48 */ 49 void 50 u3t_init(void); 51 52 /* u3t_push(): push on trace stack. 53 */ 54 void 55 u3t_push(u3_noun mon); 56 57 /* u3t_mean(): push `[%mean roc]` on trace stack. 58 */ 59 void 60 u3t_mean(u3_noun roc); 61 62 /* u3t_drop(): drop from meaning stack. 63 */ 64 void 65 u3t_drop(void); 66 67 /* u3t_slog(): print directly. 68 */ 69 void 70 u3t_slog(u3_noun hod); 71 72 /* u3t_heck(): profile point. 73 */ 74 void 75 u3t_heck(u3_atom cog); 76 77 /* u3t_samp(): sample. 78 */ 79 void 80 u3t_samp(void); 81 82 /* u3t_come(): push on profile stack; return yes if active push. RETAIN. 83 */ 84 c3_o 85 u3t_come(u3_noun bat); 86 87 /* u3t_flee(): pop off profile stack. 88 */ 89 void 90 u3t_flee(void); 91 92 /* u3t_damp(): print and clear profile data. 93 */ 94 void 95 u3t_damp(void); 96 97 /* u3t_boff(): turn profile sampling off. 98 */ 99 void 100 u3t_boff(void); 101 102 /* u3t_boot(): turn sampling on. 103 */ 104 void 105 u3t_boot(void); 106 107 108 /** Globals. 109 **/ 110 /* u3_Trace / u3C: global memory control. 111 */ 112 c3_global u3t_trace u3t_Trace; 113 # define u3T u3t_Trace 114 115