aboutsummaryrefslogtreecommitdiffhomepage
path: root/interp/memory.go
diff options
context:
space:
mode:
authorAyke van Laethem <[email protected]>2022-09-22 01:06:40 +0200
committerRon Evans <[email protected]>2022-10-19 22:23:19 +0200
commit229746b71ef8c6ab095f0e97aa722959c6f07268 (patch)
treee0270085fdb27908533b27708bf8c5f8da704e60 /interp/memory.go
parent09ec846c9f3204837ae0695077f6e1359c545fe9 (diff)
downloadtinygo-229746b71ef8c6ab095f0e97aa722959c6f07268.tar.gz
tinygo-229746b71ef8c6ab095f0e97aa722959c6f07268.zip
interp: change object.llvmType to the initializer type
Previously it was a pointer type, which won't work with opaque pointers. Instead, use the global initializer type instead.
Diffstat (limited to 'interp/memory.go')
-rw-r--r--interp/memory.go4
1 files changed, 2 insertions, 2 deletions
diff --git a/interp/memory.go b/interp/memory.go
index 583f9355f..6a537bad8 100644
--- a/interp/memory.go
+++ b/interp/memory.go
@@ -37,7 +37,7 @@ import (
// ability to roll back interpreting a function.
type object struct {
llvmGlobal llvm.Value
- llvmType llvm.Type // must match llvmGlobal.Type() if both are set, may be unset if llvmGlobal is set
+ llvmType llvm.Type // must match llvmGlobal.GlobalValueType() if both are set, may be unset if llvmGlobal is set
llvmLayoutType llvm.Type // LLVM type based on runtime.alloc layout parameter, if available
globalName string // name, if not yet created (not guaranteed to be the final name)
buffer value // buffer with value as given by interp, nil if external
@@ -594,7 +594,7 @@ func (v pointerValue) toLLVMValue(llvmType llvm.Type, mem *memoryView) (llvm.Val
var globalType llvm.Type
if !obj.llvmType.IsNil() {
// The exact type is known.
- globalType = obj.llvmType.ElementType()
+ globalType = obj.llvmType
} else { // !obj.llvmLayoutType.IsNil()
// The exact type isn't known, but the object layout is known.
globalType = obj.llvmLayoutType