Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

F# RFC FS-1015 - Support for "fixed" #1270

Merged
merged 18 commits into from Jun 27, 2016
Merged
Show file tree
Hide file tree
Changes from 9 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
84 changes: 7 additions & 77 deletions VisualFSharp.sln
@@ -1,7 +1,7 @@

Microsoft Visual Studio Solution File, Format Version 12.00
# Visual Studio 14
VisualStudioVersion = 14.0.25123.0
VisualStudioVersion = 14.0.24720.0
MinimumVisualStudioVersion = 10.0.40219.1
Project("{F2A71F9B-5D33-465A-A702-920D77279786}") = "FSharp.Compiler", "src\fsharp\FSharp.Compiler\FSharp.Compiler.fsproj", "{2E4D67B4-522D-4CF7-97E4-BA940F0B18F3}"
EndProject
Expand Down Expand Up @@ -120,6 +120,12 @@ Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "XMLFile", "vsintegration\It
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "VisualFSharpVsix", "vsintegration\VisualFSharpVsix\VisualFSharpVsix.csproj", "{E7EC4A3E-9D57-45B8-83F5-EDDFD6CEF090}"
EndProject
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Solution Items", "Solution Items", "{D3244A8B-4C62-4247-8DE9-29A32EBA67FB}"
ProjectSection(SolutionItems) = preProject
Performance2.psess = Performance2.psess
Performance3.psess = Performance3.psess
EndProjectSection
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|Any CPU = Debug|Any CPU
Expand All @@ -130,54 +136,6 @@ Global
Release|x86 = Release|x86
EndGlobalSection
GlobalSection(ProjectConfigurationPlatforms) = postSolution
{4D7BE558-E6BF-44DA-8CE2-46AA6E0DC2E7}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{4D7BE558-E6BF-44DA-8CE2-46AA6E0DC2E7}.Debug|Any CPU.Build.0 = Debug|Any CPU
{4D7BE558-E6BF-44DA-8CE2-46AA6E0DC2E7}.Debug|x86.ActiveCfg = Debug|Any CPU
{4D7BE558-E6BF-44DA-8CE2-46AA6E0DC2E7}.Debug|x86.Build.0 = Debug|Any CPU
{4D7BE558-E6BF-44DA-8CE2-46AA6E0DC2E7}.Proto|Any CPU.ActiveCfg = Proto|Any CPU
{4D7BE558-E6BF-44DA-8CE2-46AA6E0DC2E7}.Proto|Any CPU.Build.0 = Proto|Any CPU
{4D7BE558-E6BF-44DA-8CE2-46AA6E0DC2E7}.Proto|x86.ActiveCfg = Proto|Any CPU
{4D7BE558-E6BF-44DA-8CE2-46AA6E0DC2E7}.Proto|x86.Build.0 = Proto|Any CPU
{4D7BE558-E6BF-44DA-8CE2-46AA6E0DC2E7}.Release|Any CPU.ActiveCfg = Release|Any CPU
{4D7BE558-E6BF-44DA-8CE2-46AA6E0DC2E7}.Release|Any CPU.Build.0 = Release|Any CPU
{4D7BE558-E6BF-44DA-8CE2-46AA6E0DC2E7}.Release|x86.ActiveCfg = Release|Any CPU
{4D7BE558-E6BF-44DA-8CE2-46AA6E0DC2E7}.Release|x86.Build.0 = Release|Any CPU
{493D19F9-35A4-4D0B-9B25-CA948823B709}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{493D19F9-35A4-4D0B-9B25-CA948823B709}.Debug|Any CPU.Build.0 = Debug|Any CPU
{493D19F9-35A4-4D0B-9B25-CA948823B709}.Debug|x86.ActiveCfg = Debug|Any CPU
{493D19F9-35A4-4D0B-9B25-CA948823B709}.Debug|x86.Build.0 = Debug|Any CPU
{493D19F9-35A4-4D0B-9B25-CA948823B709}.Proto|Any CPU.ActiveCfg = Proto|Any CPU
{493D19F9-35A4-4D0B-9B25-CA948823B709}.Proto|Any CPU.Build.0 = Proto|Any CPU
{493D19F9-35A4-4D0B-9B25-CA948823B709}.Proto|x86.ActiveCfg = Proto|Any CPU
{493D19F9-35A4-4D0B-9B25-CA948823B709}.Proto|x86.Build.0 = Proto|Any CPU
{493D19F9-35A4-4D0B-9B25-CA948823B709}.Release|Any CPU.ActiveCfg = Release|Any CPU
{493D19F9-35A4-4D0B-9B25-CA948823B709}.Release|Any CPU.Build.0 = Release|Any CPU
{493D19F9-35A4-4D0B-9B25-CA948823B709}.Release|x86.ActiveCfg = Release|Any CPU
{493D19F9-35A4-4D0B-9B25-CA948823B709}.Release|x86.Build.0 = Release|Any CPU
{530DF8CA-7996-407A-B533-D0C2873257AF}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{530DF8CA-7996-407A-B533-D0C2873257AF}.Debug|Any CPU.Build.0 = Debug|Any CPU
{530DF8CA-7996-407A-B533-D0C2873257AF}.Debug|x86.ActiveCfg = Debug|Any CPU
{530DF8CA-7996-407A-B533-D0C2873257AF}.Debug|x86.Build.0 = Debug|Any CPU
{530DF8CA-7996-407A-B533-D0C2873257AF}.Proto|Any CPU.ActiveCfg = Proto|Any CPU
{530DF8CA-7996-407A-B533-D0C2873257AF}.Proto|Any CPU.Build.0 = Proto|Any CPU
{530DF8CA-7996-407A-B533-D0C2873257AF}.Proto|x86.ActiveCfg = Proto|Any CPU
{530DF8CA-7996-407A-B533-D0C2873257AF}.Proto|x86.Build.0 = Proto|Any CPU
{530DF8CA-7996-407A-B533-D0C2873257AF}.Release|Any CPU.ActiveCfg = Release|Any CPU
{530DF8CA-7996-407A-B533-D0C2873257AF}.Release|Any CPU.Build.0 = Release|Any CPU
{530DF8CA-7996-407A-B533-D0C2873257AF}.Release|x86.ActiveCfg = Release|Any CPU
{530DF8CA-7996-407A-B533-D0C2873257AF}.Release|x86.Build.0 = Release|Any CPU
{98ABDE09-9E08-49C7-B006-FB3CB5365B54}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{98ABDE09-9E08-49C7-B006-FB3CB5365B54}.Debug|Any CPU.Build.0 = Debug|Any CPU
{98ABDE09-9E08-49C7-B006-FB3CB5365B54}.Debug|x86.ActiveCfg = Debug|Any CPU
{98ABDE09-9E08-49C7-B006-FB3CB5365B54}.Debug|x86.Build.0 = Debug|Any CPU
{98ABDE09-9E08-49C7-B006-FB3CB5365B54}.Proto|Any CPU.ActiveCfg = Proto|Any CPU
{98ABDE09-9E08-49C7-B006-FB3CB5365B54}.Proto|Any CPU.Build.0 = Proto|Any CPU
{98ABDE09-9E08-49C7-B006-FB3CB5365B54}.Proto|x86.ActiveCfg = Proto|Any CPU
{98ABDE09-9E08-49C7-B006-FB3CB5365B54}.Proto|x86.Build.0 = Proto|Any CPU
{98ABDE09-9E08-49C7-B006-FB3CB5365B54}.Release|Any CPU.ActiveCfg = Release|Any CPU
{98ABDE09-9E08-49C7-B006-FB3CB5365B54}.Release|Any CPU.Build.0 = Release|Any CPU
{98ABDE09-9E08-49C7-B006-FB3CB5365B54}.Release|x86.ActiveCfg = Release|Any CPU
{98ABDE09-9E08-49C7-B006-FB3CB5365B54}.Release|x86.Build.0 = Release|Any CPU
{2E4D67B4-522D-4CF7-97E4-BA940F0B18F3}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{2E4D67B4-522D-4CF7-97E4-BA940F0B18F3}.Debug|Any CPU.Build.0 = Debug|Any CPU
{2E4D67B4-522D-4CF7-97E4-BA940F0B18F3}.Debug|x86.ActiveCfg = Debug|Any CPU
Expand Down Expand Up @@ -502,18 +460,6 @@ Global
{C94C257C-3C0A-4858-B5D8-D746498D1F08}.Release|Any CPU.Build.0 = Release|Any CPU
{C94C257C-3C0A-4858-B5D8-D746498D1F08}.Release|x86.ActiveCfg = Release|Any CPU
{C94C257C-3C0A-4858-B5D8-D746498D1F08}.Release|x86.Build.0 = Release|Any CPU
{CB7D20C4-6506-406D-9144-5342C3595F03}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{CB7D20C4-6506-406D-9144-5342C3595F03}.Debug|Any CPU.Build.0 = Debug|Any CPU
{CB7D20C4-6506-406D-9144-5342C3595F03}.Debug|x86.ActiveCfg = Debug|Any CPU
{CB7D20C4-6506-406D-9144-5342C3595F03}.Debug|x86.Build.0 = Debug|Any CPU
{CB7D20C4-6506-406D-9144-5342C3595F03}.Proto|Any CPU.ActiveCfg = Proto|Any CPU
{CB7D20C4-6506-406D-9144-5342C3595F03}.Proto|Any CPU.Build.0 = Proto|Any CPU
{CB7D20C4-6506-406D-9144-5342C3595F03}.Proto|x86.ActiveCfg = Proto|Any CPU
{CB7D20C4-6506-406D-9144-5342C3595F03}.Proto|x86.Build.0 = Proto|Any CPU
{CB7D20C4-6506-406D-9144-5342C3595F03}.Release|Any CPU.ActiveCfg = Release|Any CPU
{CB7D20C4-6506-406D-9144-5342C3595F03}.Release|Any CPU.Build.0 = Release|Any CPU
{CB7D20C4-6506-406D-9144-5342C3595F03}.Release|x86.ActiveCfg = Release|Any CPU
{CB7D20C4-6506-406D-9144-5342C3595F03}.Release|x86.Build.0 = Release|Any CPU
{649FA588-F02E-457C-9FCF-87E46407481E}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{649FA588-F02E-457C-9FCF-87E46407481E}.Debug|Any CPU.Build.0 = Debug|Any CPU
{649FA588-F02E-457C-9FCF-87E46407481E}.Debug|x86.ActiveCfg = Debug|Any CPU
Expand Down Expand Up @@ -753,14 +699,6 @@ Global
{1FB1DD07-06AA-45B4-B5AC-20FF5BEE98B6}.Release|Any CPU.Build.0 = Release|Any CPU
{1FB1DD07-06AA-45B4-B5AC-20FF5BEE98B6}.Release|x86.ActiveCfg = Release|Any CPU
{1FB1DD07-06AA-45B4-B5AC-20FF5BEE98B6}.Release|x86.Build.0 = Release|Any CPU
{1FB1DD07-06AA-45B4-B5AC-20FF5BEE98B6}.VSDebug|Any CPU.ActiveCfg = VSDebug|Any CPU
{1FB1DD07-06AA-45B4-B5AC-20FF5BEE98B6}.VSDebug|Any CPU.Build.0 = VSDebug|Any CPU
{1FB1DD07-06AA-45B4-B5AC-20FF5BEE98B6}.VSDebug|x86.ActiveCfg = VSDebug|Any CPU
{1FB1DD07-06AA-45B4-B5AC-20FF5BEE98B6}.VSDebug|x86.Build.0 = VSDebug|Any CPU
{1FB1DD07-06AA-45B4-B5AC-20FF5BEE98B6}.VSRelease|Any CPU.ActiveCfg = VSRelease|Any CPU
{1FB1DD07-06AA-45B4-B5AC-20FF5BEE98B6}.VSRelease|Any CPU.Build.0 = VSRelease|Any CPU
{1FB1DD07-06AA-45B4-B5AC-20FF5BEE98B6}.VSRelease|x86.ActiveCfg = VSRelease|Any CPU
{1FB1DD07-06AA-45B4-B5AC-20FF5BEE98B6}.VSRelease|x86.Build.0 = VSRelease|Any CPU
{E7EC4A3E-9D57-45B8-83F5-EDDFD6CEF090}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{E7EC4A3E-9D57-45B8-83F5-EDDFD6CEF090}.Debug|Any CPU.Build.0 = Debug|Any CPU
{E7EC4A3E-9D57-45B8-83F5-EDDFD6CEF090}.Debug|x86.ActiveCfg = Debug|Any CPU
Expand All @@ -773,14 +711,6 @@ Global
{E7EC4A3E-9D57-45B8-83F5-EDDFD6CEF090}.Release|Any CPU.Build.0 = Release|Any CPU
{E7EC4A3E-9D57-45B8-83F5-EDDFD6CEF090}.Release|x86.ActiveCfg = Release|Any CPU
{E7EC4A3E-9D57-45B8-83F5-EDDFD6CEF090}.Release|x86.Build.0 = Release|Any CPU
{E7EC4A3E-9D57-45B8-83F5-EDDFD6CEF090}.VSDebug|Any CPU.ActiveCfg = VSDebug|Any CPU
{E7EC4A3E-9D57-45B8-83F5-EDDFD6CEF090}.VSDebug|Any CPU.Build.0 = VSDebug|Any CPU
{E7EC4A3E-9D57-45B8-83F5-EDDFD6CEF090}.VSDebug|x86.ActiveCfg = VSDebug|Any CPU
{E7EC4A3E-9D57-45B8-83F5-EDDFD6CEF090}.VSDebug|x86.Build.0 = VSDebug|Any CPU
{E7EC4A3E-9D57-45B8-83F5-EDDFD6CEF090}.VSRelease|Any CPU.ActiveCfg = VSRelease|Any CPU
{E7EC4A3E-9D57-45B8-83F5-EDDFD6CEF090}.VSRelease|Any CPU.Build.0 = VSRelease|Any CPU
{E7EC4A3E-9D57-45B8-83F5-EDDFD6CEF090}.VSRelease|x86.ActiveCfg = VSRelease|Any CPU
{E7EC4A3E-9D57-45B8-83F5-EDDFD6CEF090}.VSRelease|x86.Build.0 = VSRelease|Any CPU
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE
Expand Down
13 changes: 11 additions & 2 deletions src/absil/ilwrite.fs
Expand Up @@ -849,6 +849,12 @@ and GetTypeAsTypeDefOrRef cenv env (ty:ILType) =

and GetTypeAsBytes cenv env ty = emitBytesViaBuffer (fun bb -> EmitType cenv env bb ty)

and GetTypeOfLocalAsBytes cenv env (l: ILLocal) =
emitBytesViaBuffer (fun bb ->
if l.IsPinned then
bb.EmitByte et_PINNED
EmitType cenv env bb l.Type)

and GetTypeAsBlobIdx cenv env (ty:ILType) =
GetBytesAsBlobIdx cenv (GetTypeAsBytes cenv env ty)

Expand Down Expand Up @@ -1494,7 +1500,10 @@ let GetCallsigAsStandAloneSigIdx cenv env info =
let EmitLocalSig cenv env (bb: ByteBuffer) (locals: ILLocals) =
bb.EmitByte e_IMAGE_CEE_CS_CALLCONV_LOCAL_SIG
bb.EmitZ32 locals.Length
locals |> ILList.iter (fun l -> EmitType cenv env bb l.Type)
locals |> ILList.iter (fun l ->
if l.IsPinned then
bb.EmitByte et_PINNED
EmitType cenv env bb l.Type)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can we please remove the duplication for this logic?
How about a new function EmitTypeOfLocal?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

thanks, will do


let GetLocalSigAsBlobHeapIdx cenv env locals =
GetBytesAsBlobIdx cenv (emitBytesViaBuffer (fun bb -> EmitLocalSig cenv env bb locals))
Expand Down Expand Up @@ -2237,7 +2246,7 @@ let GenILMethodBody mname cenv env (il: ILMethodBody) =
// Write a fake entry for the local signature headed by e_IMAGE_CEE_CS_CALLCONV_FIELD. This is referenced by the PDB file
ignore (FindOrAddSharedRow cenv TableNames.StandAloneSig (SharedRow [| Blob (GetFieldDefTypeAsBlobIdx cenv env l.Type) |]))
// Now write the type
GetTypeAsBytes cenv env l.Type)
GetTypeOfLocalAsBytes cenv env l)
else
[| |]

Expand Down
2 changes: 2 additions & 0 deletions src/fsharp/FSComp.txt
Expand Up @@ -1307,3 +1307,5 @@ estApplyStaticArgumentsForMethodNotImplemented,"A type provider implemented GetS
3201,tcModuleAbbrevFirstInMutRec,"In a recursive declaration group, module abbreviations must come after all 'open' declarations and before other declarations"
3202,tcUnsupportedMutRecDecl,"This declaration is not supported in recursive declaration groups"
3203,parsInvalidUseOfRec,"Invalid use of 'rec' keyword"
3204,tcFixedNotAllowed,"Invalid use of 'fixed'. 'fixed' may only be used in a declaration of the form 'use x = fixed expr' where the expression is an array, the address of a field, the address of an array element or a string'"
3205,tcCouldNotFindOffsetToStringData,"Could not find method System.Runtime.CompilerServices.OffsetToStringData in references when building 'fixed' expression."