Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit331647c

Browse files
committed
Fix codegen for StructValueTuple when aliased (dotnet#5645)
* Fix codegen for StructValueTuple when aliased* Simplify* Add regression test for codegen
1 parentf3181b4 commit331647c

File tree

4 files changed

+96
-3
lines changed

4 files changed

+96
-3
lines changed

‎src/fsharp/TastOps.fs‎

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -805,6 +805,7 @@ let argsOfAppTy g ty = ty |> stripTyEqns g |> (function TType_app(_, tinst) ->
805805
lettryDestTyparTy g ty= ty|> stripTyEqns g|>(function TType_var v-> Some v|_-> None)
806806
lettryDestFunTy g ty= ty|> stripTyEqns g|>(function TType_fun(tyv, tau)-> Some(tyv, tau)|_-> None)
807807
lettryDestAppTy g ty= ty|> stripTyEqns g|>(function TType_app(tcref,_)-> Some tcref|_-> None)
808+
808809
lettryAnyParTy g ty= ty|> stripTyEqns g|>(function TType_var v-> Some v| TType_measure untwhen isUnitParMeasure g unt-> Some(destUnitParMeasure g unt)|_-> None)
809810
let(|AppTy|_|)g ty= ty|> stripTyEqns g|>(function TType_app(tcref, tinst)-> Some(tcref, tinst)|_-> None)
810811
let(|RefTupleTy|_|)g ty= ty|> stripTyEqns g|>(function TType_tuple(tupInfo, tys)whennot(evalTupInfoIsStruct tupInfo)-> Some tys|_-> None)
@@ -1729,7 +1730,7 @@ let isStructTy g ty =
17291730
| Some tcref->
17301731
lettycon= tcref.Deref
17311732
tycon.IsStructRecordOrUnionTycon|| tycon.IsStructOrEnumTycon
1732-
|_->false
1733+
|_->isStructTupleTy g ty
17331734

17341735
letisRefTy g ty=
17351736
not(isStructOrEnumTyconTy g ty)&&
Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
openSystem
2+
typeNode=(struct(int* int))
3+
let_=new Node(2,2)
Lines changed: 88 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,88 @@
1+
2+
// Microsoft (R) .NET Framework IL Disassembler. Version 4.6.1055.0
3+
// Copyright (c) Microsoft Corporation. All rights reserved.
4+
5+
6+
7+
// Metadata version: v4.0.30319
8+
.assembly extern mscorlib
9+
{
10+
.publickeytoken= (B7 7A 5C561934 E089 )// .z\V.4..
11+
.ver4:0:0:0
12+
}
13+
.assembly extern FSharp.Core
14+
{
15+
.publickeytoken= (B0 3F 5F 7F11 D5 0A 3A )// .?_....:
16+
.ver4:5:0:0
17+
}
18+
.assembly extern System.ValueTuple
19+
{
20+
.publickeytoken= (CC 7B13 FF CD 2D DD51 )// .{...-.Q
21+
.ver4:0:1:0
22+
}
23+
.assembly ValueTupleAliasConstructor
24+
{
25+
.custom instance void [FSharp.Core]Microsoft.FSharp.Core.FSharpInterfaceDataVersionAttribute::.ctor(int32,
26+
int32,
27+
int32)= (01000200000000000000000000000000 )
28+
29+
// --- The following custom attribute is added automatically, do not uncomment -------
30+
// .custom instance void [mscorlib]System.Diagnostics.DebuggableAttribute::.ctor(valuetype [mscorlib]System.Diagnostics.DebuggableAttribute/DebuggingModes) = ( 01 00 01 00 00 00 00 00 )
31+
32+
.hash algorithm 0x00008004
33+
.ver0:0:0:0
34+
}
35+
.mresource public FSharpSignatureData.ValueTupleAliasConstructor
36+
{
37+
// Offset: 0x00000000 Length: 0x000001EA
38+
}
39+
.mresource public FSharpOptimizationData.ValueTupleAliasConstructor
40+
{
41+
// Offset: 0x000001F0 Length: 0x00000061
42+
}
43+
.module ValueTupleAliasConstructor.exe
44+
// MVID: {5B9C53DD-A8CF-BB34-A745-0383DD539C5B}
45+
.imagebase 0x00400000
46+
.file alignment 0x00000200
47+
.stackreserve 0x00100000
48+
.subsystem 0x0003// WINDOWS_CUI
49+
.corflags 0x00000001// ILONLY
50+
// Image base: 0x01B00000
51+
52+
53+
// =============== CLASS MEMBERS DECLARATION ===================
54+
55+
.class public abstract auto ansi sealed ValueTupleAliasConstructor
56+
extends [mscorlib]System.Object
57+
{
58+
.custom instance void [FSharp.Core]Microsoft.FSharp.Core.CompilationMappingAttribute::.ctor(valuetype [FSharp.Core]Microsoft.FSharp.Core.SourceConstructFlags)= (0100070000000000 )
59+
}// end of class ValueTupleAliasConstructor
60+
61+
.class private abstract auto ansi sealed '<StartupCode$ValueTupleAliasConstructor>'.$ValueTupleAliasConstructor
62+
extends [mscorlib]System.Object
63+
{
64+
.field static assembly int32 init@
65+
.custom instance void [mscorlib]System.Diagnostics.DebuggerBrowsableAttribute::.ctor(valuetype [mscorlib]System.Diagnostics.DebuggerBrowsableState)= (0100000000000000 )
66+
.custom instance void [mscorlib]System.Runtime.CompilerServices.CompilerGeneratedAttribute::.ctor()= (01000000 )
67+
.custom instance void [mscorlib]System.Diagnostics.DebuggerNonUserCodeAttribute::.ctor()= (01000000 )
68+
.method public static void main@() cil managed
69+
{
70+
.entrypoint
71+
// Code size 9 (0x9)
72+
.maxstack8
73+
.language '{AB4F38C9-B6E6-43BA-BE3B-58080B2CCCE3}', '{994B45C4-E6E9-11D2-903F-00C04FA302A1}', '{5A869D0B-6611-11D3-BD2A-0000F80849BD}'
74+
.line3,3 :9,22 'c:\\kevinransom\\visualfsharp\\tests\\fsharpqa\\Source\\CodeGen\\EmittedIL\\Tuples\\ValueTupleAliasConstructor.fs'
75+
IL_0000: ldc.i4.2
76+
IL_0001: ldc.i4.2
77+
IL_0002: newobj instance void valuetype [System.ValueTuple]System.ValueTuple`2<int32,int32>::.ctor(!0,
78+
!1)
79+
IL_0007: pop
80+
IL_0008: ret
81+
}// end of method $ValueTupleAliasConstructor::main@
82+
83+
}// end of class '<StartupCode$ValueTupleAliasConstructor>'.$ValueTupleAliasConstructor
84+
85+
86+
// =============================================================
87+
88+
// *********** DISASSEMBLY COMPLETE ***********************
Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,14 @@
1-
SOURCE=Tuple01.fs SCFLAGS="-g --test:EmitFeeFeeAs100001 --optimize-" COMPILE_ONLY=1 POSTCMD="..\\CompareIL.cmd Tuple01.exe"# Tuple01.fs
1+
SOURCE=Tuple01.fs SCFLAGS="-g --test:EmitFeeFeeAs100001 --optimize-" COMPILE_ONLY=1 POSTCMD="..\\CompareIL.cmd Tuple01.exe"# Tuple01.fs
22
SOURCE=Tuple02.fs SCFLAGS="-g --test:EmitFeeFeeAs100001 --optimize-" COMPILE_ONLY=1 POSTCMD="..\\CompareIL.cmd Tuple02.exe"# Tuple02.fs -
33
SOURCE=Tuple03.fs SCFLAGS="-g --test:EmitFeeFeeAs100001 --optimize-" COMPILE_ONLY=1 POSTCMD="..\\CompareIL.cmd Tuple03.exe"# Tuple03.fs -
44
SOURCE=Tuple04.fs SCFLAGS="-g --test:EmitFeeFeeAs100001 --optimize-" COMPILE_ONLY=1 POSTCMD="..\\CompareIL.cmd Tuple04.exe"# Tuple04.fs -
55
SOURCE=Tuple05.fs SCFLAGS="-g --test:EmitFeeFeeAs100001 --optimize-" COMPILE_ONLY=1 POSTCMD="..\\CompareIL.cmd Tuple05.exe"# Tuple05.fs -
66
SOURCE=Tuple06.fs SCFLAGS="-g --test:EmitFeeFeeAs100001 --optimize-" COMPILE_ONLY=1 POSTCMD="..\\CompareIL.cmd Tuple06.exe"# Tuple06.fs -
77
SOURCE=Tuple07.fs SCFLAGS="-g --test:EmitFeeFeeAs100001 --optimize-" COMPILE_ONLY=1 POSTCMD="..\\CompareIL.cmd Tuple07.exe"# Tuple07.fs -
8-
98
SOURCE=Tuple08.fs SCFLAGS="-g --test:EmitFeeFeeAs100001 --optimize-" COMPILE_ONLY=1 POSTCMD="..\\CompareIL.cmd Tuple08.exe"# Tuple08.fs -
109

1110
SOURCE=TupleMonster.fs SCFLAGS="-g --test:EmitFeeFeeAs100001 --optimize-" COMPILE_ONLY=1 POSTCMD="..\\CompareIL.cmd TupleMonster.exe"# TupleMonster.fs -
1211

1312
SOURCE=TupleElimination.fs SCFLAGS="-g --test:EmitFeeFeeAs100001 --optimize+" COMPILE_ONLY=1 POSTCMD="..\\CompareIL.cmd TupleElimination.exe"# TupleElimination.fs -
13+
14+
SOURCE=ValueTupleAliasConstructor.fs SCFLAGS="-g --test:EmitFeeFeeAs100001 --optimize+" COMPILE_ONLY=1 POSTCMD="..\\CompareIL.cmd ValueTupleAliasConstructor.exe"# ValueTupleAliasConstructor.fs -

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp