1
Fork 0
mirror of https://git.savannah.gnu.org/git/guile.git synced 2025-06-29 14:30:34 +02:00

Add code to calculate code buffer size based on devel time information.

* lib/jit_aarch64-sz.c, lib/jit_arm-sz.c, lib/jit_hppa-sz.c,
	lib/jit_ia64-sz.c, lib/jit_mips-sz.c, lib/jit_ppc-sz.c,
	lib/jit_s390x-sz.c, lib/jit_size.c, lib/jit_sparc-sz.c,
	lib/jit_x86-sz.c: New files implementing static tables
	with longest known instructions length generated to match
	a lightning instruction. These tables should make it easier
	to make it very unlikely to ever miscalculate, or by too
	much, the size of a code buffer.

	* lib/jit_size.c: New file that aids to either collect
	jit code size information, or use the information depending
	on build options.

	* size.c: New helper file that parses input for, and create
	an initial jit_$arch-sz.c file, that needs some minor edit
	for arches with multiple configurations.

	* configure.ac, Makefile.am: Add the new, devel mode only
	--enable-devel-get-jit-size configure option, that sets
	compile time flags to collect jit code size information,
	that will be used as input for the "noinst size program".

	* lib/jit_aarch64.c, lib/jit_arm.c, lib/jit_disasm.c,
	lib/jit_hppa.c, lib/jit_ia64.c, lib/jit_memory.c,
	lib/jit_mips.c, lib/jit_ppc.c, lib/jit_s390x.c,
	lib/jit_sparc.c, lib/jit_x86.c, lib/lightning.c: Minor
	changes for the --enable-devel-get-jit-size build mode,
	as well as the "production build mode" with jit code
	size information.
This commit is contained in:
pcpa 2013-09-24 03:31:54 -03:00
parent 95e3fbc8bc
commit b768fab8b1
29 changed files with 5269 additions and 48 deletions

View file

@ -432,8 +432,14 @@ struct jit_compiler {
} prolog;
jit_bool_t jump;
#endif
/* global flag for code buffer heuristic size computation */
#if GET_JIT_SIZE
/* Temporary storage to calculate instructions length */
jit_word_t size;
/* Global flag for code buffer heuristic size computation */
jit_word_t mult;
/* Pointer to code to prevent miscalculation if reallocating buffer */
jit_uint8_t *cptr;
#endif
};
#define _jitc _jit->comp
@ -557,13 +563,26 @@ extern void jit_alloc(jit_pointer_t*, jit_word_t);
extern void jit_realloc(jit_pointer_t*, jit_word_t, jit_word_t);
void jit_free(jit_pointer_t*);
#if HAVE_MREMAP
# define jit_remap() _jit_remap(_jit)
extern jit_bool_t _jit_remap(jit_state_t*);
extern void jit_init_size(void);
extern void jit_finish_size(void);
#if GET_JIT_SIZE
# define jit_size_prepare() _jit_size_prepare(_jit)
extern void
_jit_size_prepare(jit_state_t*);
# define jit_size_collect(node) _jit_size_collect(_jit, node)
extern void
_jit_size_collect(jit_state_t*, jit_node_t*);
#else
# define jit_remap() 0
# define jit_get_size() _jit_get_size(_jit)
extern jit_word_t
_jit_get_size(jit_state_t*);
#endif
extern jit_word_t
jit_get_max_instr(void);
/*
* Externs
*/