mirror of
https://github.com/tinygo-org/tinygo.git
synced 2026-08-11 14:33:41 +00:00
interp: fix several bugs related to constant vs dirty values
* Loading from a dirty global must be done at runtime (!). For some reason this wasn't already the case. * Global variables somehow had IsConstant() the wrong way round, returning the inverse from what they should. * Do binary and logical operations at runtime if necessary, relying on const propagation in the IR builder. * Don't try to interpret functions that take a dirty parameter. Call them at runtime.
This commit is contained in:
+2
-2
@@ -127,9 +127,9 @@ func (v *GlobalValue) Type() llvm.Type {
|
||||
// IsConstant returns true if this global is not dirty, false otherwise.
|
||||
func (v *GlobalValue) IsConstant() bool {
|
||||
if _, ok := v.Eval.dirtyGlobals[v.Underlying]; ok {
|
||||
return true
|
||||
return false
|
||||
}
|
||||
return false
|
||||
return true
|
||||
}
|
||||
|
||||
// Load returns the initializer of the global variable.
|
||||
|
||||
Reference in New Issue
Block a user