More ARM fixes; initialize free reg list correctly initially. Also use LastReg+1 instead of NJ_MAX_REGISTERS in RegAlloc -- LastReg+1 is what's used in the .h file, to avoid any mismatches.

This commit is contained in:
Vladimir Vukicevic 2008-10-20 15:31:28 -07:00
Родитель e679a5cf13
Коммит 3f2b9889ea
2 изменённых файлов: 11 добавлений и 3 удалений

Просмотреть файл

@ -300,7 +300,14 @@ Assembler::nRegisterResetAll(RegAlloc& a)
// add scratch registers to our free list for the allocator
a.clear();
a.used = 0;
a.free = rmask(R0) | rmask(R1) | rmask(R2) | rmask(R3) | rmask(R4) | rmask(R5) | FpRegs;
a.free =
rmask(R0) | rmask(R1) | rmask(R2) | rmask(R3) | rmask(R4) |
rmask(R5) | rmask(R6) | rmask(R7) | rmask(R8) | rmask(R9) |
rmask(R10);
#ifdef NJ_ARM_VFP
a.free |= FpRegs;
#endif
debug_only(a.managed = a.free);
}

Просмотреть файл

@ -49,7 +49,7 @@ namespace nanojit
{
free = 0;
used = 0;
memset(active, 0, NJ_MAX_REGISTERS * sizeof(LIns*));
memset(active, 0, (LastReg+1) * sizeof(LIns*));
}
bool RegAlloc::isFree(Register r)
@ -120,6 +120,7 @@ namespace nanojit
}
}
}
NanoAssert(a != 0);
return a;
}
@ -130,7 +131,7 @@ namespace nanojit
if (!frag || !frag->lirbuf)
return;
LirNameMap *names = frag->lirbuf->names;
for(int i=0; i<NJ_MAX_REGISTERS; i++)
for(int i=0; i<(LastReg+1); i++)
{
LIns* ins = regs.active[i];
Register r = (Register)i;