1
Fork 0
mirror of https://git.savannah.gnu.org/git/guile.git synced 2025-05-01 12:20:26 +02:00

Add a simple memory management wrapper.

* lib/jit_memory.c: Implement a simple memory allocation wrapper
	to allow overriding calls to malloc/calloc/realloc/free, as well
	as ensuring all memory containing pointers is zero or points to
	allocated memory.

	* include/lightning.h, include/lightning/jit_private.h: Definitions
	for the memory allocation wrapper.

	* lib/Makefile.am: Update for new jit_memory.c file.

	* lib/jit_arm.c, lib/jit_disasm.c, lib/jit_mips.c, lib/jit_note.c,
	lib/jit_ppc.c, lib/jit_sparc.c, lib/jit_x86.c, lib/lightning.c:
	Use the new memory allocation wrapper code.
This commit is contained in:
pcpa 2013-03-29 12:10:36 -03:00
parent be9068f2ee
commit c39def9dce
13 changed files with 263 additions and 148 deletions

View file

@ -747,6 +747,10 @@ typedef enum {
jit_code_x86_retval_f, jit_code_x86_retval_d,
} jit_code_t;
typedef void* (*jit_alloc_func_ptr) (size_t);
typedef void* (*jit_realloc_func_ptr) (void*, size_t);
typedef void (*jit_free_func_ptr) (void*);
/*
* Prototypes
*/
@ -882,4 +886,11 @@ extern jit_node_t *_jit_new_node_pwd(jit_state_t*, jit_code_t,
#define jit_disassemble() _jit_disassemble(_jit)
extern void _jit_disassemble(jit_state_t*);
extern void jit_set_memory_functions(jit_alloc_func_ptr,
jit_realloc_func_ptr,
jit_free_func_ptr);
extern void jit_get_memory_functions(jit_alloc_func_ptr*,
jit_realloc_func_ptr*,
jit_free_func_ptr*);
#endif /* _lightning_h */