aboutsummaryrefslogtreecommitdiffhomepage
path: root/interp/values.go
diff options
context:
space:
mode:
authorAyke van Laethem <[email protected]>2018-11-14 12:20:06 +0100
committerAyke van Laethem <[email protected]>2018-11-14 12:25:27 +0100
commit7d8b269f2e396b731463cae8ceaa21292968f597 (patch)
tree7e7fe40763bcc7b99c1f9d8edb193c0ba39cebce /interp/values.go
parenteccbd572eb434f3699bc7ba43e538f4431310691 (diff)
downloadtinygo-7d8b269f2e396b731463cae8ceaa21292968f597.tar.gz
tinygo-7d8b269f2e396b731463cae8ceaa21292968f597.zip
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.
Diffstat (limited to 'interp/values.go')
-rw-r--r--interp/values.go4
1 files changed, 2 insertions, 2 deletions
diff --git a/interp/values.go b/interp/values.go
index ffadda303..8c4de67db 100644
--- a/interp/values.go
+++ b/interp/values.go
@@ -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.