diff options
author | Ayke van Laethem <[email protected]> | 2021-03-15 23:53:05 +0100 |
---|---|---|
committer | Ron Evans <[email protected]> | 2021-03-23 14:32:33 +0100 |
commit | bbb2909283dd9caca03a14a2c39e5f77b18366a7 (patch) | |
tree | 81cfce70199bafdb79010eb432420572041c5fa8 /interp/memory.go | |
parent | aa7c7b7bd9b843a0cba2ebbaef158a48f1570569 (diff) | |
download | tinygo-bbb2909283dd9caca03a14a2c39e5f77b18366a7.tar.gz tinygo-bbb2909283dd9caca03a14a2c39e5f77b18366a7.zip |
compiler: merge runtime.typecodeID and runtime.typeInInterface
This distinction was useful before when reflect wasn't properly
supported. Back then it made sense to only include method sets that were
actually used in an interface. But now that it is possible to get to
other values (for example, by extracting fields from structs) and it is
possible to turn them back into interfaces, it is necessary to preserve
all method sets that can possibly be used in the program in a type
assert, interface assert or interface method call.
In the future, this logic will need to be revisited again when
reflect.New or reflect.Zero gets implemented.
Code size increases a bit in some cases, but usually in a very limited
way (except for one outlier in the drivers smoke tests). The next commit
will improve the situation significantly.
Diffstat (limited to 'interp/memory.go')
-rw-r--r-- | interp/memory.go | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/interp/memory.go b/interp/memory.go index 4c66b5378..4504ba2c3 100644 --- a/interp/memory.go +++ b/interp/memory.go @@ -1048,7 +1048,7 @@ func (v rawValue) rawLLVMValue(mem *memoryView) llvm.Value { // There are some special pointer types that should be used as a // ptrtoint, so that they can be used in certain optimizations. name := elementType.StructName() - if name == "runtime.typeInInterface" || name == "runtime.funcValueWithSignature" { + if name == "runtime.typecodeID" || name == "runtime.funcValueWithSignature" { uintptrType := ctx.IntType(int(mem.r.pointerSize) * 8) field = llvm.ConstPtrToInt(field, uintptrType) } |