diff options
author | Ayke van Laethem <[email protected]> | 2020-03-24 00:06:16 +0100 |
---|---|---|
committer | Ron Evans <[email protected]> | 2020-03-24 14:49:24 +0100 |
commit | 25fcf3e18e3baf6496dddba0a3f8811b2ca90609 (patch) | |
tree | 103cd9bbe51ee7d60856e8ad5614aa4eee47a1fe /interp/testdata | |
parent | 5133604b511fd8cf8f9b55e08cc4f70cd2d84af6 (diff) | |
download | tinygo-25fcf3e18e3baf6496dddba0a3f8811b2ca90609.tar.gz tinygo-25fcf3e18e3baf6496dddba0a3f8811b2ca90609.zip |
interp: better support interface operations
This commit teaches the interp scanner that supported interface
operations (type assertions, interface assertions) are supported.
This fixes a problem with math/rand in Go 1.14.
Diffstat (limited to 'interp/testdata')
-rw-r--r-- | interp/testdata/scan.ll | 17 |
1 files changed, 17 insertions, 0 deletions
diff --git a/interp/testdata/scan.ll b/interp/testdata/scan.ll index 946a8a072..bf44750e1 100644 --- a/interp/testdata/scan.ll +++ b/interp/testdata/scan.ll @@ -1,6 +1,11 @@ target datalayout = "e-m:e-i64:64-f80:128-n8:16:32:64-S128" target triple = "x86_64--linux" +%runtime.typecodeID = type { %runtime.typecodeID*, i64 } + +declare i1 @runtime.typeAssert(i64, %runtime.typecodeID*, i8*, i8*) +declare i1 @runtime.interfaceImplements(i64, i8**) + define i64 @returnsConst() { ret i64 0 } @@ -59,3 +64,15 @@ define i64 @callFunctionPointer() { %result = call i64 %fp() ret i64 %result } + +define i1 @callTypeAssert() { + ; Note: parameters are not realistic. + %ok = call i1 @runtime.typeAssert(i64 0, %runtime.typecodeID* null, i8* undef, i8* null) + ret i1 %ok +} + +define i1 @callInterfaceImplements() { + ; Note: parameters are not realistic. + %ok = call i1 @runtime.interfaceImplements(i64 0, i8** null) + ret i1 %ok +} |