1
Fork 0
mirror of https://git.savannah.gnu.org/git/guile.git synced 2025-06-21 11:10:21 +02:00

Add code to release all memory used by the jit state.

* include/lightning.h, lib/lightning.c: Implement the new
	jit_clear_state and jit_destroy_state calls. jit_clear_state
	releases all memory not required during jit_execution; that
	is, leaves only the mmap'ed data and code buffers allocated.
	jit_destroy_state releases the mmap'ed buffers as well as
	the jit_state_t object itself, that holds pointers to the
	code and data buffers, as well as annotation pointers (for
	disassembly or backtrace) in the data buffer.

	* lib/jit_note.c: Correct invalid vector offset access.

	* check/ccall.c, check/lightning.c, doc/ifib.c, doc/incr.c,
	doc/printf.c, doc/rfib.c, doc/rpn.c: Use the new jit_clear_state
	and jit_destroy_state calls, to demonstrate the new code to
	release all jit memory.

	* doc/body.texi: Add basic documentation and usage description
	of jit_clear_state and jit_destroy_state.
This commit is contained in:
pcpa 2013-02-11 15:51:55 -02:00
parent 6039794ec3
commit 8f020fe044
12 changed files with 138 additions and 4 deletions

View file

@ -177,12 +177,12 @@ _jit_set_note(jit_state_t *_jit, jit_note_t *note,
else {
line = note->lines + index;
index = offset_insert_index(line, offset);
if (line->offsets[index] == offset) {
if (index < line->length && line->offsets[index] == offset) {
/* common case if no code was generated for several source lines */
if (line->linenos[index] < lineno)
line->linenos[index] = lineno;
}
else if (line->linenos[index] == lineno) {
else if (index < line->length && line->linenos[index] == lineno) {
/* common case of extending entry */
if (line->offsets[index] > offset)
line->offsets[index] = offset;