diff --git a/go.mod b/go.mod index feb4e0d6..a50f1174 100644 --- a/go.mod +++ b/go.mod @@ -17,7 +17,7 @@ require ( golang.org/x/sys v0.0.0-20220829200755-d48e67d00261 golang.org/x/tools v0.1.11 gopkg.in/yaml.v2 v2.4.0 - tinygo.org/x/go-llvm v0.0.0-20220921144624-dabbe3f30634 + tinygo.org/x/go-llvm v0.0.0-20220922113433-4b5ad7ff76ec ) require ( diff --git a/go.sum b/go.sum index 907364f9..4af03408 100644 --- a/go.sum +++ b/go.sum @@ -64,5 +64,5 @@ gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8 gopkg.in/yaml.v2 v2.4.0 h1:D8xgwECY7CYvx+Y2n4sBz93Jn9JRvxdiyyo8CTfuKaY= gopkg.in/yaml.v2 v2.4.0/go.mod h1:RDklbk79AGWmwhnvt/jBztapEOGDOx6ZbXqjP6csGnQ= gopkg.in/yaml.v3 v3.0.0-20200313102051-9f266ea9e77c h1:dUUwHk2QECo/6vqA44rthZ8ie2QXMNeKRTHCNY2nXvo= -tinygo.org/x/go-llvm v0.0.0-20220921144624-dabbe3f30634 h1:hihbmHkJjalV4kGshoCF03P/G4IjoXcNAbzLblXLa/M= -tinygo.org/x/go-llvm v0.0.0-20220921144624-dabbe3f30634/go.mod h1:GFbusT2VTA4I+l4j80b17KFK+6whv69Wtny5U+T8RR0= +tinygo.org/x/go-llvm v0.0.0-20220922113433-4b5ad7ff76ec h1:FYtAFrw/YQPc644uNN65dW50FrEuVNaPBf70x23ApY4= +tinygo.org/x/go-llvm v0.0.0-20220922113433-4b5ad7ff76ec/go.mod h1:GFbusT2VTA4I+l4j80b17KFK+6whv69Wtny5U+T8RR0= diff --git a/interp/interpreter.go b/interp/interpreter.go index d029aa33..8c783a70 100644 --- a/interp/interpreter.go +++ b/interp/interpreter.go @@ -637,7 +637,7 @@ func (r *runner) run(fn *function, params []value, parentMem *memoryView, indent // Create the new object. size := operands[0].(literalValue).value.(uint64) alloca := object{ - llvmType: inst.llvmInst.Type(), + llvmType: inst.llvmInst.AllocatedType(), globalName: r.pkgName + "$alloca", buffer: newRawValue(uint32(size)), size: uint32(size), diff --git a/interp/memory.go b/interp/memory.go index 583f9355..6a537bad 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