mirror of
https://git.savannah.gnu.org/git/guile.git
synced 2025-06-20 18:50:21 +02:00
Rework to better describe what is used only during jit generation.
* include/lightning/jit_private.h, lib/jit_arm-cpu.c, lib/jit_arm.c, lib/jit_disasm.c, lib/jit_mips-cpu.c, lib/jit_mips.c, lib/jit_note.c, lib/jit_ppc-cpu.c, lib/jit_ppc.c, lib/jit_print.c, lib/jit_sparc-cpu.c, lib/jit_sparc.c, lib/jit_x86-cpu.c, lib/jit_x86.c, lib/lightning.c: Add an extra structure for data storage during jit generation, and release it after generating jit, to reduce a bit memory usage, and also to make it easier to understand what data is available during jit runtime.
This commit is contained in:
parent
f39eee6694
commit
9afca85921
16 changed files with 1328 additions and 1299 deletions
|
@ -863,22 +863,22 @@ _alui(jit_state_t *_jit, jit_int32_t code, jit_int32_t r0, jit_word_t i0)
|
|||
static void
|
||||
_save(jit_state_t *_jit, jit_int32_t r0)
|
||||
{
|
||||
if (!_jit->function->regoff[r0]) {
|
||||
_jit->function->regoff[r0] = jit_allocai(sizeof(jit_word_t));
|
||||
_jit->again = 1;
|
||||
if (!_jitc->function->regoff[r0]) {
|
||||
_jitc->function->regoff[r0] = jit_allocai(sizeof(jit_word_t));
|
||||
_jitc->again = 1;
|
||||
}
|
||||
assert(!jit_regset_tstbit(_jit->regsav, r0));
|
||||
jit_regset_setbit(_jit->regsav, r0);
|
||||
stxi(_jit->function->regoff[r0], _RBP_REGNO, r0);
|
||||
assert(!jit_regset_tstbit(_jitc->regsav, r0));
|
||||
jit_regset_setbit(_jitc->regsav, r0);
|
||||
stxi(_jitc->function->regoff[r0], _RBP_REGNO, r0);
|
||||
}
|
||||
|
||||
static void
|
||||
_load(jit_state_t *_jit, jit_int32_t r0)
|
||||
{
|
||||
assert(_jit->function->regoff[r0]);
|
||||
assert(jit_regset_tstbit(_jit->regsav, r0));
|
||||
jit_regset_clrbit(_jit->regsav, r0);
|
||||
ldxi(r0, _RBP_REGNO, _jit->function->regoff[r0]);
|
||||
assert(_jitc->function->regoff[r0]);
|
||||
assert(jit_regset_tstbit(_jitc->regsav, r0));
|
||||
jit_regset_clrbit(_jitc->regsav, r0);
|
||||
ldxi(r0, _RBP_REGNO, _jitc->function->regoff[r0]);
|
||||
}
|
||||
|
||||
static void
|
||||
|
@ -1199,8 +1199,8 @@ _muli(jit_state_t *_jit, jit_int32_t r0, jit_int32_t r1, jit_word_t i0)
|
|||
if (set & (1 << rn)) \
|
||||
(void)jit_get_reg(rv|jit_class_gpr|jit_class_named); \
|
||||
if (sav & (1 << rn)) { \
|
||||
if ( jit_regset_tstbit(_jit->regsav, rv) || \
|
||||
!jit_regset_tstbit(_jit->reglive, rv)) \
|
||||
if ( jit_regset_tstbit(_jitc->regsav, rv) || \
|
||||
!jit_regset_tstbit(_jitc->reglive, rv)) \
|
||||
sav &= ~(1 << rn); \
|
||||
else \
|
||||
save(rv); \
|
||||
|
@ -3303,39 +3303,39 @@ static void
|
|||
_prolog(jit_state_t *_jit, jit_node_t *node)
|
||||
{
|
||||
#if __WORDSIZE == 32
|
||||
_jit->function->stack = (((_jit->function->self.alen -
|
||||
_jit->function->self.aoff) + 15) & -16) + 12;
|
||||
_jitc->function->stack = (((_jitc->function->self.alen -
|
||||
_jitc->function->self.aoff) + 15) & -16) + 12;
|
||||
#else
|
||||
_jit->function->stack = (((_jit->function->self.alen -
|
||||
_jit->function->self.aoff) + 15) & -16) + 8;
|
||||
_jitc->function->stack = (((_jitc->function->self.alen -
|
||||
_jitc->function->self.aoff) + 15) & -16) + 8;
|
||||
#endif
|
||||
|
||||
/* callee save registers */
|
||||
subi(_RSP_REGNO, _RSP_REGNO, stack_framesize - sizeof(jit_word_t));
|
||||
#if __WORDSIZE == 32
|
||||
if (jit_regset_tstbit(_jit->function->regset, _RDI))
|
||||
if (jit_regset_tstbit(_jitc->function->regset, _RDI))
|
||||
stxi(12, _RSP_REGNO, _RDI_REGNO);
|
||||
if (jit_regset_tstbit(_jit->function->regset, _RSI))
|
||||
if (jit_regset_tstbit(_jitc->function->regset, _RSI))
|
||||
stxi( 8, _RSP_REGNO, _RSI_REGNO);
|
||||
if (jit_regset_tstbit(_jit->function->regset, _RBX))
|
||||
if (jit_regset_tstbit(_jitc->function->regset, _RBX))
|
||||
stxi( 4, _RSP_REGNO, _RBX_REGNO);
|
||||
#else
|
||||
if (jit_regset_tstbit(_jit->function->regset, _RBX))
|
||||
if (jit_regset_tstbit(_jitc->function->regset, _RBX))
|
||||
stxi(40, _RSP_REGNO, _RBX_REGNO);
|
||||
if (jit_regset_tstbit(_jit->function->regset, _R12))
|
||||
if (jit_regset_tstbit(_jitc->function->regset, _R12))
|
||||
stxi(32, _RSP_REGNO, _R12_REGNO);
|
||||
if (jit_regset_tstbit(_jit->function->regset, _R13))
|
||||
if (jit_regset_tstbit(_jitc->function->regset, _R13))
|
||||
stxi(24, _RSP_REGNO, _R13_REGNO);
|
||||
if (jit_regset_tstbit(_jit->function->regset, _R14))
|
||||
if (jit_regset_tstbit(_jitc->function->regset, _R14))
|
||||
stxi(16, _RSP_REGNO, _R14_REGNO);
|
||||
if (jit_regset_tstbit(_jit->function->regset, _R15))
|
||||
if (jit_regset_tstbit(_jitc->function->regset, _R15))
|
||||
stxi( 8, _RSP_REGNO, _R15_REGNO);
|
||||
#endif
|
||||
stxi(0, _RSP_REGNO, _RBP_REGNO);
|
||||
movr(_RBP_REGNO, _RSP_REGNO);
|
||||
|
||||
/* alloca */
|
||||
subi(_RSP_REGNO, _RSP_REGNO, _jit->function->stack);
|
||||
subi(_RSP_REGNO, _RSP_REGNO, _jitc->function->stack);
|
||||
}
|
||||
|
||||
static void
|
||||
|
@ -3344,22 +3344,22 @@ _epilog(jit_state_t *_jit, jit_node_t *node)
|
|||
/* callee save registers */
|
||||
movr(_RSP_REGNO, _RBP_REGNO);
|
||||
#if __WORDSIZE == 32
|
||||
if (jit_regset_tstbit(_jit->function->regset, _RDI))
|
||||
if (jit_regset_tstbit(_jitc->function->regset, _RDI))
|
||||
ldxi(_RDI_REGNO, _RSP_REGNO, 12);
|
||||
if (jit_regset_tstbit(_jit->function->regset, _RSI))
|
||||
if (jit_regset_tstbit(_jitc->function->regset, _RSI))
|
||||
ldxi(_RSI_REGNO, _RSP_REGNO, 8);
|
||||
if (jit_regset_tstbit(_jit->function->regset, _RBX))
|
||||
if (jit_regset_tstbit(_jitc->function->regset, _RBX))
|
||||
ldxi(_RBX_REGNO, _RSP_REGNO, 4);
|
||||
#else
|
||||
if (jit_regset_tstbit(_jit->function->regset, _RBX))
|
||||
if (jit_regset_tstbit(_jitc->function->regset, _RBX))
|
||||
ldxi(_RBX_REGNO, _RSP_REGNO, 40);
|
||||
if (jit_regset_tstbit(_jit->function->regset, _R12))
|
||||
if (jit_regset_tstbit(_jitc->function->regset, _R12))
|
||||
ldxi(_R12_REGNO, _RSP_REGNO, 32);
|
||||
if (jit_regset_tstbit(_jit->function->regset, _R13))
|
||||
if (jit_regset_tstbit(_jitc->function->regset, _R13))
|
||||
ldxi(_R13_REGNO, _RSP_REGNO, 24);
|
||||
if (jit_regset_tstbit(_jit->function->regset, _R14))
|
||||
if (jit_regset_tstbit(_jitc->function->regset, _R14))
|
||||
ldxi(_R14_REGNO, _RSP_REGNO, 16);
|
||||
if (jit_regset_tstbit(_jit->function->regset, _R15))
|
||||
if (jit_regset_tstbit(_jitc->function->regset, _R15))
|
||||
ldxi(_R15_REGNO, _RSP_REGNO, 8);
|
||||
#endif
|
||||
ldxi(_RBP_REGNO, _RSP_REGNO, 0);
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue