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:
Ayke van Laethem
2018-11-14 12:20:06 +01:00
parent eccbd572eb
commit 7d8b269f2e
2 changed files with 28 additions and 23 deletions
+2 -2
View File
@@ -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.