mirror of
https://git.savannah.gnu.org/git/guile.git
synced 2025-06-21 19:20:21 +02:00
Add filename and line number annotation abstraction.
* lib/jit_note.c: New file implementing a simple string+integer annotation, that should be used to map filename and line number to offsets in the generated jit. * include/lightning.h, lib/lightning.c: Update for the new note code. Add an extra mandatory argument to init_jit, that is used as argument to bfd_openr. Change from generic void* to char* the argument to jit_note and add an extra integer argument, to map to filename and line number. * check/ccall.c, check/lightning.c, include/lightning/jit_private.h, lib/jit_arm.c, lib/jit_disasm.c, lib/jit_mips.c, lib/jit_ppc.c, lib/jit_print.c, lib/jit_x86.c: lib/Makefile.am: Update for the new annotation code. * configure.ac, check/Makefile.am: Update to work with latest automake.
This commit is contained in:
parent
4fe47942eb
commit
a34410eee2
17 changed files with 464 additions and 46 deletions
|
@ -126,12 +126,18 @@ static void
|
|||
_patch_register(jit_state_t *jit, jit_node_t *node, jit_node_t *link,
|
||||
jit_int32_t regno, jit_int32_t patch);
|
||||
|
||||
/*
|
||||
* Initialization
|
||||
*/
|
||||
const char *jit_progname;
|
||||
|
||||
/*
|
||||
* Implementation
|
||||
*/
|
||||
void
|
||||
init_jit(void)
|
||||
init_jit(char *progname)
|
||||
{
|
||||
jit_progname = progname;
|
||||
jit_get_cpu();
|
||||
jit_init_debug();
|
||||
}
|
||||
|
@ -406,6 +412,29 @@ _jit_data(jit_state_t *_jit, jit_pointer_t data, jit_word_t length)
|
|||
return (node);
|
||||
}
|
||||
|
||||
jit_node_t *
|
||||
_jit_note(jit_state_t *_jit, char *name, int line)
|
||||
{
|
||||
jit_node_t *node;
|
||||
|
||||
node = new_node(jit_code_note);
|
||||
if (name)
|
||||
node->v.n = jit_data(name, strlen(name));
|
||||
else
|
||||
node->v.p = NULL;
|
||||
node->w.w = line;
|
||||
|
||||
(void)link_node(node);
|
||||
if (_jit->note.head == NULL)
|
||||
_jit->note.head = _jit->note.tail = node;
|
||||
else {
|
||||
_jit->note.tail->link = node;
|
||||
_jit->note.tail = node;
|
||||
}
|
||||
|
||||
return (node);
|
||||
}
|
||||
|
||||
static void
|
||||
_new_pool(jit_state_t *_jit)
|
||||
{
|
||||
|
@ -1113,7 +1142,6 @@ _jit_optimize(jit_state_t *_jit)
|
|||
}
|
||||
}
|
||||
|
||||
#if JIT_HASH_CONSTS
|
||||
/* create read only data buffer */
|
||||
if ((_jit->data.length = (_jit->data.offset + 4095) & -4096)) {
|
||||
jit_uint8_t *ptr;
|
||||
|
@ -1132,7 +1160,18 @@ _jit_optimize(jit_state_t *_jit)
|
|||
}
|
||||
}
|
||||
}
|
||||
#endif
|
||||
}
|
||||
|
||||
void
|
||||
_jit_annotate(jit_state_t *_jit)
|
||||
{
|
||||
jit_node_t *node;
|
||||
|
||||
for (node = _jit->note.head; node; node = node->link) {
|
||||
if (node->v.p)
|
||||
jit_set_note(node->v.n->u.p, node->w.w,
|
||||
(jit_uint8_t *)node->u.p - _jit->code.ptr);
|
||||
}
|
||||
}
|
||||
|
||||
void
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue