transform: fix non-determinism in the interface lowering pass
This non-determinism was introduced in https://github.com/tinygo-org/tinygo/pull/2640. Non-determinism in the compiler is a bug because it makes it harder to find whether a compiler change actually affected the binary. Fixes https://github.com/tinygo-org/tinygo/issues/3504
Этот коммит содержится в:
родитель
1cce1ea423
коммит
517098c468
1 изменённых файлов: 9 добавлений и 1 удалений
|
@ -302,10 +302,18 @@ func (p *lowerInterfacesPass) run() error {
|
||||||
use.EraseFromParentAsInstruction()
|
use.EraseFromParentAsInstruction()
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Create a sorted list of type names, for predictable iteration.
|
||||||
|
var typeNames []string
|
||||||
|
for name := range p.types {
|
||||||
|
typeNames = append(typeNames, name)
|
||||||
|
}
|
||||||
|
sort.Strings(typeNames)
|
||||||
|
|
||||||
// Remove all method sets, which are now unnecessary and inhibit later
|
// Remove all method sets, which are now unnecessary and inhibit later
|
||||||
// optimizations if they are left in place.
|
// optimizations if they are left in place.
|
||||||
zero := llvm.ConstInt(p.ctx.Int32Type(), 0, false)
|
zero := llvm.ConstInt(p.ctx.Int32Type(), 0, false)
|
||||||
for _, t := range p.types {
|
for _, name := range typeNames {
|
||||||
|
t := p.types[name]
|
||||||
if !t.methodSet.IsNil() {
|
if !t.methodSet.IsNil() {
|
||||||
initializer := t.typecode.Initializer()
|
initializer := t.typecode.Initializer()
|
||||||
var newInitializerFields []llvm.Value
|
var newInitializerFields []llvm.Value
|
||||||
|
|
Загрузка…
Создание таблицы
Сослаться в новой задаче