mirror of
https://github.com/irmen/prog8.git
synced 2024-07-25 13:29:03 +00:00
shuffle variable sorting around to attempt smaller compiled programs
This commit is contained in:
parent
549c598f51
commit
d0b18dec8e
@ -88,7 +88,7 @@ internal class VariableAllocator(private val symboltable: SymbolTable,
|
|||||||
// try to allocate any other interger variables into the zeropage until it is full.
|
// try to allocate any other interger variables into the zeropage until it is full.
|
||||||
// TODO some form of intelligent priorization? most often used variables first? loopcounter vars first? ...?
|
// TODO some form of intelligent priorization? most often used variables first? loopcounter vars first? ...?
|
||||||
if(errors.noErrors()) {
|
if(errors.noErrors()) {
|
||||||
val sortedList = varsDontCare.sortedWith(compareBy<StStaticVariable> { it.scopedName.count { chr -> chr=='.'}}.thenBy { it.scopedName })
|
val sortedList = varsDontCare.sortedByDescending { it.scopedName }
|
||||||
for (variable in sortedList) {
|
for (variable in sortedList) {
|
||||||
if(variable.dt in IntegerDatatypes) {
|
if(variable.dt in IntegerDatatypes) {
|
||||||
if(zeropage.free.isEmpty()) {
|
if(zeropage.free.isEmpty()) {
|
||||||
@ -125,6 +125,6 @@ internal class VariableAllocator(private val symboltable: SymbolTable,
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
collect(st)
|
collect(st)
|
||||||
return vars.sortedWith(compareBy<StStaticVariable> { it.scopedName }.thenBy { it.dt })
|
return vars.sortedBy { it.dt }
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user