summaryrefslogtreecommitdiffstats
path: root/lib.h
diff options
context:
space:
mode:
authorKaz Kylheku <kaz@kylheku.com>2018-04-25 06:46:37 -0700
committerKaz Kylheku <kaz@kylheku.com>2018-04-25 06:46:37 -0700
commit182edce101eccdeb9da8679f857f096c5e60b7db (patch)
tree0333d57c4ecd3213f711727b5707b05f135f87e9 /lib.h
parentae5c55a50e3637c4a0df10596a252b55d4cf014a (diff)
downloadtxr-182edce101eccdeb9da8679f857f096c5e60b7db.tar.gz
txr-182edce101eccdeb9da8679f857f096c5e60b7db.tar.bz2
txr-182edce101eccdeb9da8679f857f096c5e60b7db.zip
vm: de-inline opcode dispatch.
The vm_execute function is heavily inlined by gcc, and requires almost 500 bytes of stack space. The stack space really adds up when the vm re-enters itself recursively. Also, pointers to garbage can hide in areas of that bloated stack frame that are not being used by execution paths, adding to the spurious retention problem. * lib.h (NOINLINE): New preprocessor symbol. * vm.c (vm_prof, vm_frame, vm_sframe, vm_dframe, vm_end, vm_fin, vm_call, vm_apply, vm_gcall, vm_gapply, vm_movrs, vm_movsr, vm_movrr, vm_movrsi, vm_movsmi, vm_movrbi, vm_if, vm_ifq, vm_ifql, vm_swtch, vm_uwprot, vm_block, vm_no_block_err, vm_retsr, vm_retrs, vm_retrr, vm_abscsr, vm_catch, vm_handle, vm_getsym, vm_getbind, vm_setsym, vm_bindv, vm_close, vm_execute): Apply INLINE to functions.
Diffstat (limited to 'lib.h')
-rw-r--r--lib.h2
1 files changed, 2 insertions, 0 deletions
diff --git a/lib.h b/lib.h
index b485caed..4866893d 100644
--- a/lib.h
+++ b/lib.h
@@ -53,8 +53,10 @@ typedef uint_ptr_t ucnum;
#ifdef __GNUC__
#define noreturn __attribute__((noreturn))
+#define NOINLINE __attribute__((noinline))
#else
#define noreturn
+#define NOINLINE
#endif
typedef enum type {