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

Commit7b1d896

Browse files
dsymelatkin
authored andcommitted
fix and tests fordotnet#122 - no .volatile emitted on stfld
fixesdotnet#122closesdotnet#144commitf138b61Author: Don Syme <dsyme@microsoft.com>Date: Thu Jan 29 12:19:37 2015 +0000 enable codegen as smoke testscommit20b1e81Author: Don Syme <dsyme@microsoft.com>Date: Thu Jan 29 12:18:26 2015 +0000 update baselines for testscommitb43c327Merge:4a83340d17d429Author: Don Syme <dsyme@microsoft.com>Date: Thu Jan 29 11:59:17 2015 +0000 Merge branch 'fsharp4' ofhttp://github.com/Microsoft/visualfsharp into fix-122commit4a83340Author: Don Syme <dsyme@microsoft.com>Date: Thu Jan 29 10:17:43 2015 +0000 NOP commit to run appveyorcommit2fb9f57Author: Don Syme <dsyme@microsoft.com>Date: Tue Jan 27 17:44:49 2015 +0000 fix and tests fordotnet#122 - no .volatile emitted on stfld
1 parent22fc2c7 commit7b1d896

File tree

8 files changed

+336
-72
lines changed

8 files changed

+336
-72
lines changed

‎src/fsharp/ilxgen.fs‎

Lines changed: 3 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -2232,14 +2232,11 @@ and GenFieldStore isStatic cenv cgbuf eenv (rfref:RecdFieldRef,tyargs,m) sequel
22322232
if fld.IsMutable&&not(useGenuineField rfref.Tycon fld)then
22332233
letcconv=if isStaticthen ILCallingConv.Staticelse ILCallingConv.Instance
22342234
letmspec= mkILMethSpecInTy(fspec.EnclosingType, cconv,"set_"+ fld.rfield_id.idText,[fspec.FormalType],ILType.Void,[])
2235-
22362235
CG.EmitInstr cgbuf(mk_field_pops isStatic1) Push0(mkNormalCall mspec)
22372236
else
2238-
// Within assemblies we do generate some set-field operations
2239-
// for immutable fields even when resolving recursive bindings.
2240-
// However we do not generate "set" properties for these.
2241-
// Hence we just set the field directly in this case.
2242-
CG.EmitInstr cgbuf(mk_field_pops isStatic1) Push0(if isStaticthen mkNormalStsfld fspecelse mkNormalStfld fspec);
2237+
letvol=if rfref.RecdField.IsVolatilethen Volatileelse Nonvolatile
2238+
letinstr=if isStaticthen I_stsfld(vol, fspec)else I_stfld(ILAlignment.Aligned, vol, fspec)
2239+
CG.EmitInstr cgbuf(mk_field_pops isStatic1) Push0 instr;
22432240
GenUnitThenSequel cenv eenv m eenv.cloc cgbuf sequel
22442241

22452242
//--------------------------------------------------------------------------

‎tests/fsharpqa/Source/CodeGen/EmittedIL/Misc/generictypestaticfield01.il.netfx4.bsl‎

Lines changed: 22 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11

2-
// Microsoft (R) .NET Framework IL Disassembler. Version 4.0.30319.16774
2+
// Microsoft (R) .NET Framework IL Disassembler. Version 4.0.30319.33440
33
// Copyright (c) Microsoft Corporation. All rights reserved.
44

55

@@ -13,7 +13,7 @@
1313
.assembly extern FSharp.Core
1414
{
1515
.publickeytoken= (B0 3F 5F 7F11 D5 0A 3A )// .?_....:
16-
.ver4:0:0:0
16+
.ver4:4:0:9055
1717
}
1818
.assembly GenericTypeStaticField01
1919
{
@@ -29,20 +29,20 @@
2929
}
3030
.mresource public FSharpSignatureData.GenericTypeStaticField01
3131
{
32-
// Offset: 0x00000000 Length:0x0000062C
32+
// Offset: 0x00000000 Length:0x00000608
3333
}
3434
.mresource public FSharpOptimizationData.GenericTypeStaticField01
3535
{
36-
// Offset:0x00000630 Length:0x000001F9
36+
// Offset:0x00000610 Length:0x000001E7
3737
}
3838
.module GenericTypeStaticField01.exe
39-
// MVID: {4DAC0E02-1E75-7E6B-A745-0383020EAC4D}
39+
// MVID: {54CA24D1-1E75-7E6B-A745-0383D124CA54}
4040
.imagebase 0x00400000
4141
.file alignment 0x00000200
4242
.stackreserve 0x00100000
4343
.subsystem 0x0003// WINDOWS_CUI
4444
.corflags 0x00000001// ILONLY
45-
// Image base:0x0000000000550000
45+
// Image base:0x00460000
4646

4747

4848
// =============== CLASS MEMBERS DECLARATION ===================
@@ -63,7 +63,7 @@
6363
// Code size 10 (0xa)
6464
.maxstack8
6565
.language '{AB4F38C9-B6E6-43BA-BE3B-58080B2CCCE3}', '{994B45C4-E6E9-11D2-903F-00C04FA302A1}', '{5A869D0B-6611-11D3-BD2A-0000F80849BD}'
66-
.line2,2 :6,9
66+
.line2,2 :6,9'C:\\GitHub\\dsyme\\visualfsharp\\tests\\fsharpqa\\Source\\CodeGen\\EmittedIL\\Misc\\GenericTypeStaticField01.fs'
6767
IL_0000: ldarg.0
6868
IL_0001: callvirt instance void [mscorlib]System.Object::.ctor()
6969
IL_0006: ldarg.0
@@ -75,24 +75,25 @@
7575
.method private specialname rtspecialname static
7676
void .cctor() cil managed
7777
{
78-
// Code size18 (0x12)
78+
// Code size20 (0x14)
7979
.maxstack8
80-
.line3,3 :10,41
80+
.line3,3 :10,41''
8181
IL_0000: nop
8282
IL_0001: newobj instance void class GenericTypeStaticField01/Foo`1<!a>::.ctor()
8383
IL_0006: stsfld class GenericTypeStaticField01/Foo`1<!0> class GenericTypeStaticField01/Foo`1<!a>::theInstance
8484
IL_000b: ldc.i4.1
85-
IL_000c: stsfld int32 class GenericTypeStaticField01/Foo`1<!a>::init@2
86-
.line2,2 :6,9
87-
IL_0011: ret
85+
IL_000c: volatile.
86+
IL_000e: stsfld int32 class GenericTypeStaticField01/Foo`1<!a>::init@2
87+
.line2,2 :6,9 ''
88+
IL_0013: ret
8889
}// end of method Foo`1::.cctor
8990

9091
.method public specialname static class GenericTypeStaticField01/Foo`1<!a>
9192
get_Instance() cil managed
9293
{
9394
// Code size 27 (0x1b)
9495
.maxstack8
95-
.line4,4 :28,39
96+
.line4,4 :28,39''
9697
IL_0000: volatile.
9798
IL_0002: ldsfld int32 class GenericTypeStaticField01/Foo`1<!a>::init@2
9899
IL_0007: ldc.i4.1
@@ -127,7 +128,7 @@
127128
{
128129
// Code size 10 (0xa)
129130
.maxstack8
130-
.line6,6 :6,9
131+
.line6,6 :6,9''
131132
IL_0000: ldarg.0
132133
IL_0001: callvirt instance void [mscorlib]System.Object::.ctor()
133134
IL_0006: ldarg.0
@@ -139,24 +140,25 @@
139140
.method private specialname rtspecialname static
140141
void .cctor() cil managed
141142
{
142-
// Code size18 (0x12)
143+
// Code size20 (0x14)
143144
.maxstack8
144-
.line7,7 :10,44
145+
.line7,7 :10,44''
145146
IL_0000: nop
146147
IL_0001: newobj instance void class GenericTypeStaticField01/Bar`2<!a,!b>::.ctor()
147148
IL_0006: stsfld class GenericTypeStaticField01/Bar`2<!0,!1> class GenericTypeStaticField01/Bar`2<!a,!b>::theInstance
148149
IL_000b: ldc.i4.1
149-
IL_000c: stsfld int32 class GenericTypeStaticField01/Bar`2<!a,!b>::'init@6-1'
150-
.line6,6 :6,9
151-
IL_0011: ret
150+
IL_000c: volatile.
151+
IL_000e: stsfld int32 class GenericTypeStaticField01/Bar`2<!a,!b>::'init@6-1'
152+
.line6,6 :6,9 ''
153+
IL_0013: ret
152154
}// end of method Bar`2::.cctor
153155

154156
.method public specialname static class GenericTypeStaticField01/Bar`2<!a,!b>
155157
get_Instance() cil managed
156158
{
157159
// Code size 27 (0x1b)
158160
.maxstack8
159-
.line8,8 :28,39
161+
.line8,8 :28,39''
160162
IL_0000: volatile.
161163
IL_0002: ldsfld int32 class GenericTypeStaticField01/Bar`2<!a,!b>::'init@6-1'
162164
IL_0007: ldc.i4.1
Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
// #Regression #NoMono #NoMT #CodeGen #EmittedIL
2+
typeC()=
3+
[<VolatileFieldAttribute>]
4+
let mutablex=1
5+
6+
memberthis.Xwith get()= xandset v= x<- v
7+
8+
9+
typeStaticC()=
10+
[<VolatileFieldAttribute>]
11+
static let mutablex=1
12+
13+
static memberXwith get()= xandset v= x<- v

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp