* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * This source file is part of SableVM. * * * * See the file "LICENSE" for the copyright information and for * * the terms and conditions for copying, distribution and * * modification of this source file. * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *** SableVM small memory footprint *** Purpose ======= To generate the smallest binary at compile time and use the smallest amount of memory at run time. This is generally useful for systems with memory constraints. TODO ==== * Optimize memory consumption at run time. How to enable it ================ Add the --enable-small-footprint flag to the configure script. How to save additional static memory footprint =============================================== A common way to save additional static memory footprint is to use the ``strip'' utility (generally found in the GNU binutils package) to remove the symbols from the shared object. How it works ============ The _SABLEVM_SMALL_FOOTPRINT macro ---------------------------------- This macro is being used at compile time to trigger which code should be included to generate the smallest binary. The ``XXXXX_sfp.c'' files ----------------------------- These files contain their respective ``XXXXX.c'' functionnality that is being refactored in a more generic way. This allows us to reuse code and save some static memory footprint. For instance, the file ``error_throwing_sfp.c'' contains the functionnality of the file ``error_throwing.c'' in a space-efficient manner. Splay tree ---------- Data structures that need to be included in a splay tree (typically found in types.h) should be declared in the following way: struct _svmt_sequence_node_struct { /* * Splay tree node pointers need to be at the beginning of the struct * and in the same order as shown here. */ _svmt_sequence_node *parent; _svmt_sequence_node *left; _svmt_sequence_node *right; /* * Object specific */ size_t instructions_length; jint *instructions; size_t implementation_length; void *implementation; }; The above rule needs to be followed at all times since splay_tree_sfp.c depends on it to perform its work, using an explicit cast of type _svmt_splay_tree_node. See splay_tree_sfp.c for more details.