Repository navigation
Dsyme tuple spike - #6
Conversation
|
|
||
| let mkGetTupleItemN g m n (typ:ILType) isStruct te retty = | ||
| if isStruct then | ||
| mkAsmExpr([mkNormalLdfld (mkILFieldSpecForTupleItem typ n) ],[],[],[retty],m) |
There was a problem hiding this comment.
You're not using te (the expression for the object from which you're loading the field) in the first branch
There was a problem hiding this comment.
te doesn't make a difference.
|
@KevinRansom I left one comment, though I'm not sure that explains the error message above. Run |
|
c:\projects\structtuples>"c:\Program Files (x86)\Microsoft SDKs\Windows\v10.0A\bin\NETFX 4.6 Tools\PEVerify.exe" basictuple.exe Microsoft (R) .NET Framework PE Verifier. Version 4.0.30319.0 [IL]: Error: [c:\projects\structtuples\basictuple.exe : <StartupCode$basictuple>.$Basictuple::main@][offset 0x00000021] Unable to resolve token. c:\projects\structtuples> |
|
Use |
|
This ldfld instruction looks like it is missing a generic instantiation on the ValueTuple type. Looking at the generating code I didn't immediately spot why https://gist.github.com/KevinRansom/014a53b4f2f4426f4ae46f78545d7062#file-basictuple-il-L153 |
|
https://gist.github.com/KevinRansom/014a53b4f2f4426f4ae46f78545d7062 From: Don Syme [mailto:notifications@github.com] Use ILDASM /OUT=out.il and paste the IL in a gist, maybe we'll spot something — |
|
Yes … that was my suspicion too and I can’t figure out the right Voodoo to make it work. From: Don Syme [mailto:notifications@github.com] This ldfld instruction looks like it is missing a generic instantiation on the ValueTuple type. Looking at the generating code I didn't immediately spot why — |
|
It feels like the lack of a type instantiation must be flowing in from somewhere earlier (I checked we can emit references to IL fields in generic IL classes ok). At this stage I'd probably use a debug build with |
|
Okay I will give that a try. Thanks Don From: Don Syme [mailto:notifications@github.com] It feels like the lack of a type instantiation must be flowing in from somewhere earlier (I checked we can emit references to IL fields in generic IL classes ok). At this stage I'd probably use a debug build with devenv /debugexe fsc.exe test.fs and put a breakpoint in the struct cases of the code generation and double check the instantiation is missing. If so, then try to track backwards for where it got lost. — |
|
I think the generic information is there: |
…otnet#8063) * # This is a combination of 9 commits. # This is the 1st commit message: ref -> mutable in more places in the compiler # The commit message #2 will be skipped: # Update dependencies from https://github.com/dotnet/arcade build 20191229.1 # # - Microsoft.DotNet.Arcade.Sdk - 5.0.0-beta.19629.1 # The commit message #3 will be skipped: # Update dependencies from https://github.com/dotnet/arcade build 20191230.1 # # - Microsoft.DotNet.Arcade.Sdk - 5.0.0-beta.19630.1 # The commit message #4 will be skipped: # Update dependencies from https://github.com/dotnet/arcade build 20191231.1 # # - Microsoft.DotNet.Arcade.Sdk - 5.0.0-beta.19631.1 # The commit message #5 will be skipped: # Update dependencies from https://github.com/dotnet/arcade build 20200101.1 # # - Microsoft.DotNet.Arcade.Sdk - 5.0.0-beta.20051.1 # The commit message #6 will be skipped: # Update dependencies from https://github.com/dotnet/arcade build 20191216.5 (dotnet#8079) # # - Microsoft.DotNet.Arcade.Sdk - 1.0.0-beta.19616.5 # The commit message #7 will be skipped: # dispose fsi at the end of a scripting session (dotnet#8084) # # The commit message #8 will be skipped: # Added static link tests and extended CompilerAssert (dotnet#8101) # # * Changed CompilerAssert to static class. Added Compile/Execute methods that take a Compilation description. Added static link tests # # * Hiding compilation description internals # # * Added another test to check for sanity # # * Making a few optional parameters # # * Hiding internals of CompilationReference # The commit message #9 will be skipped: # Parameterize product version (dotnet#8031) # # * Parameterize Product details # # * fcs # # * Repack pkgdef * no ilread
Don,
I tried to emit the right code for reading from a struct tuple field however, it is not correct. Can you take a look and let me know what I did wrong. I think the issue is at tastops.fs around line 7830.
This code:
when compiled generates this error
Note the System.ValueTuple dll exists in the execution directory