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

Add heuristic code to estimate space and resize if required jit buffer.

This commit is contained in:
pcpa 2013-01-29 16:37:43 -02:00
parent 16d18f11d3
commit 44d4fa5444
9 changed files with 111 additions and 82 deletions

View file

@ -784,7 +784,7 @@ _jit_retval_d(jit_state_t *_jit, jit_int32_t r0)
}
jit_pointer_t
_jit_emit(jit_state_t *_jit)
_emit_code(jit_state_t *_jit)
{
jit_node_t *node;
jit_node_t *temp;
@ -801,23 +801,6 @@ _jit_emit(jit_state_t *_jit)
jit_int32_t patch_offset;
} undo;
if (_jit->function)
jit_epilog();
jit_optimize();
_jit->emit = 1;
_jit->code.length = 16 * 1024 * 1024;
_jit->code.ptr = mmap(NULL, _jit->code.length,
PROT_EXEC | PROT_READ | PROT_WRITE,
MAP_PRIVATE | MAP_ANON, -1, 0);
assert(_jit->code.ptr != MAP_FAILED);
_jit->pc.uc = _jit->code.ptr;
/* clear jit_flag_patch from label nodes if reallocating buffer
* and starting over
*/
_jit->function = NULL;
jit_reglive_setup();
@ -1025,6 +1008,9 @@ _jit_emit(jit_state_t *_jit)
} \
break
for (node = _jit->head; node; node = node->next) {
if (_jit->pc.uc >= _jit->code.end)
return (NULL);
value = jit_classify(node->code);
jit_regarg_set(node, value);
switch (node->code) {
@ -1542,8 +1528,6 @@ _jit_emit(jit_state_t *_jit)
}
__clear_cache(_jit->code.ptr, _jit->pc.uc);
_jit->done = 1;
jit_annotate();
return (_jit->code.ptr);
}