aboutsummaryrefslogtreecommitdiffhomepage
path: root/interp
diff options
context:
space:
mode:
authorNia Waldvogel <[email protected]>2021-12-31 14:53:19 -0500
committerNia <[email protected]>2022-01-19 14:42:02 -0500
commitc6ae1c58fcb2f2a70a6d31e7319a1e9dadfe715f (patch)
tree73f1e52e0cff4a784a1fad830d335d82bba026c9 /interp
parent0c2fefa09b4b7751d9b325e2418c8813b5929537 (diff)
downloadtinygo-c6ae1c58fcb2f2a70a6d31e7319a1e9dadfe715f.tar.gz
tinygo-c6ae1c58fcb2f2a70a6d31e7319a1e9dadfe715f.zip
compiler: remove parentHandle from calling convention
This removes the parentHandle argument from the internal calling convention. It was formerly used to implment coroutines. Now that coroutines have been removed, it is no longer necessary.
Diffstat (limited to 'interp')
-rw-r--r--interp/interp.go2
-rw-r--r--interp/interpreter.go4
-rw-r--r--interp/testdata/revert.ll24
-rw-r--r--interp/testdata/revert.out.ll12
4 files changed, 21 insertions, 21 deletions
diff --git a/interp/interp.go b/interp/interp.go
index 3f5e9e506..9b9df8929 100644
--- a/interp/interp.go
+++ b/interp/interp.go
@@ -118,7 +118,7 @@ func Run(mod llvm.Module, debug bool) error {
// Create a call to the package initializer (which was
// previously deleted).
i8undef := llvm.Undef(r.i8ptrType)
- r.builder.CreateCall(fn, []llvm.Value{i8undef, i8undef}, "")
+ r.builder.CreateCall(fn, []llvm.Value{i8undef}, "")
// Make sure that any globals touched by the package
// initializer, won't be accessed by later package initializers.
r.markExternalLoad(fn)
diff --git a/interp/interpreter.go b/interp/interpreter.go
index 694c42ce0..17ae02df7 100644
--- a/interp/interpreter.go
+++ b/interp/interpreter.go
@@ -444,7 +444,7 @@ func (r *runner) run(fn *function, params []value, parentMem *memoryView, indent
}
// Load the type code of the interface value.
- typecodeIDBitCast, err := operands[len(operands)-3].toLLVMValue(inst.llvmInst.Operand(len(operands)-4).Type(), &mem)
+ typecodeIDBitCast, err := operands[len(operands)-2].toLLVMValue(inst.llvmInst.Operand(len(operands)-3).Type(), &mem)
if err != nil {
return nil, mem, r.errorAt(inst, err)
}
@@ -492,7 +492,7 @@ func (r *runner) run(fn *function, params []value, parentMem *memoryView, indent
// Call a function with a definition available. Run it as usual,
// possibly trying to recover from it if it failed to execute.
if r.debug {
- argStrings := make([]string, len(operands)-1)
+ argStrings := make([]string, len(operands))
for i := range argStrings {
argStrings[i] = operands[i+1].String()
}
diff --git a/interp/testdata/revert.ll b/interp/testdata/revert.ll
index c8929719b..dc6ee5c2a 100644
--- a/interp/testdata/revert.ll
+++ b/interp/testdata/revert.ll
@@ -13,27 +13,27 @@ declare void @externalCall(i64)
define void @runtime.initAll() unnamed_addr {
entry:
- call void @baz.init(i8* undef, i8* undef)
- call void @foo.init(i8* undef, i8* undef)
- call void @bar.init(i8* undef, i8* undef)
- call void @main.init(i8* undef, i8* undef)
- call void @x.init(i8* undef, i8* undef)
- call void @y.init(i8* undef, i8* undef)
+ call void @baz.init(i8* undef)
+ call void @foo.init(i8* undef)
+ call void @bar.init(i8* undef)
+ call void @main.init(i8* undef)
+ call void @x.init(i8* undef)
+ call void @y.init(i8* undef)
ret void
}
-define internal void @foo.init(i8* %context, i8* %parentHandle) unnamed_addr {
+define internal void @foo.init(i8* %context) unnamed_addr {
store i64 5, i64* @foo.knownAtRuntime
unreachable ; this triggers a revert of @foo.init.
}
-define internal void @bar.init(i8* %context, i8* %parentHandle) unnamed_addr {
+define internal void @bar.init(i8* %context) unnamed_addr {
%val = load i64, i64* @foo.knownAtRuntime
store i64 %val, i64* @bar.knownAtRuntime
ret void
}
-define internal void @baz.init(i8* %context, i8* %parentHandle) unnamed_addr {
+define internal void @baz.init(i8* %context) unnamed_addr {
; Test extractvalue/insertvalue with more than one index.
%val = load [3 x {i64, i32}], [3 x {i64, i32}]* @baz.someGlobal
%part = extractvalue [3 x {i64, i32}] %val, 0, 1
@@ -41,14 +41,14 @@ define internal void @baz.init(i8* %context, i8* %parentHandle) unnamed_addr {
unreachable ; trigger revert
}
-define internal void @main.init(i8* %context, i8* %parentHandle) unnamed_addr {
+define internal void @main.init(i8* %context) unnamed_addr {
entry:
call void @externalCall(i64 3)
ret void
}
-define internal void @x.init(i8* %context, i8* %parentHandle) unnamed_addr {
+define internal void @x.init(i8* %context) unnamed_addr {
; Test atomic and volatile memory accesses.
store atomic i32 1, i32* @x.atomicNum seq_cst, align 4
%x = load atomic i32, i32* @x.atomicNum seq_cst, align 4
@@ -58,7 +58,7 @@ define internal void @x.init(i8* %context, i8* %parentHandle) unnamed_addr {
ret void
}
-define internal void @y.init(i8* %context, i8* %parentHandle) unnamed_addr {
+define internal void @y.init(i8* %context) unnamed_addr {
entry:
br label %loop
diff --git a/interp/testdata/revert.out.ll b/interp/testdata/revert.out.ll
index e8fc94858..030734d8e 100644
--- a/interp/testdata/revert.out.ll
+++ b/interp/testdata/revert.out.ll
@@ -13,8 +13,8 @@ declare void @externalCall(i64) local_unnamed_addr
define void @runtime.initAll() unnamed_addr {
entry:
- call fastcc void @baz.init(i8* undef, i8* undef)
- call fastcc void @foo.init(i8* undef, i8* undef)
+ call fastcc void @baz.init(i8* undef)
+ call fastcc void @foo.init(i8* undef)
%val = load i64, i64* @foo.knownAtRuntime, align 8
store i64 %val, i64* @bar.knownAtRuntime, align 8
call void @externalCall(i64 3)
@@ -23,20 +23,20 @@ entry:
store i32 %x, i32* @x.atomicNum, align 4
%y = load volatile i32, i32* @x.volatileNum, align 4
store volatile i32 %y, i32* @x.volatileNum, align 4
- call fastcc void @y.init(i8* undef, i8* undef)
+ call fastcc void @y.init(i8* undef)
ret void
}
-define internal fastcc void @foo.init(i8* %context, i8* %parentHandle) unnamed_addr {
+define internal fastcc void @foo.init(i8* %context) unnamed_addr {
store i64 5, i64* @foo.knownAtRuntime, align 8
unreachable
}
-define internal fastcc void @baz.init(i8* %context, i8* %parentHandle) unnamed_addr {
+define internal fastcc void @baz.init(i8* %context) unnamed_addr {
unreachable
}
-define internal fastcc void @y.init(i8* %context, i8* %parentHandle) unnamed_addr {
+define internal fastcc void @y.init(i8* %context) unnamed_addr {
entry:
br label %loop