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

Commitf697a7d

Browse files
AviAvniKevinRansom
authored andcommitted
Reduce memory footprint for Val type (dotnet#4375)
* try reduce val memory size* keep logic order* undo val_member_info* add val_access to ValOptionalData* cosmetics* add val_xmldoc to ValOptionalData* add val_member_info to ValOptionalData* add val_declaring_entity to ValOptionalData* add val_xmldocsig to ValOptionalData* add val_attribs to ValOptionalData* cosmetics* cosmetics* cosmetics
1 parentfa9fa49 commitf697a7d

File tree

5 files changed

+194
-138
lines changed

5 files changed

+194
-138
lines changed

‎src/fsharp/PostInferenceChecks.fs‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1191,7 +1191,7 @@ and CheckBinding cenv env alwaysCheckNoReraise (TBind(v,bindRhs,_) as bind) =
11911191

11921192
// If we've already recorded a definition then skip this
11931193
match v.ReflectedDefinitionwith
1194-
| None-> v.val_defn<- Some bindRhs
1194+
| None-> v.SetValDefn bindRhs
11951195
| Some_->()
11961196
// Run the conversion process over the reflected definition to report any errors in the
11971197
// front end rather than the back end. We currently re-run this during ilxgen.fs but there's

‎src/fsharp/SignatureConformance.fs‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -291,7 +291,7 @@ type Checker(g, amap, denv, remapInfo: SignatureRepackageInfo, checkingSig) =
291291
elifnot(checkValInfo aenv(err denv) implVal sigVal)thenfalse
292292
elifnot(implVal.IsExtensionMember= sigVal.IsExtensionMember)then err denv(FSComp.SR.ValueNotContainedMutabilityExtensionsDiffer)
293293
elifnot(checkMemberDatasConform(err denv)(implVal.Attribs, implVal,implVal.MemberInfo)(sigVal.Attribs,sigVal,sigVal.MemberInfo))thenfalse
294-
else checkAttribs aenv implVal.Attribs sigVal.Attribs(fun attribs-> implVal.val_attribs<- attribs)
294+
else checkAttribs aenv implVal.Attribs sigVal.Attribs(fun attribs-> implVal.SetAttribs attribs)
295295

296296

297297
andcheckExnInfo err aenv implTypeRepr sigTypeRepr=

‎src/fsharp/TastOps.fs‎

Lines changed: 18 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -4632,14 +4632,23 @@ and remapValReprInfo g tmenv (ValReprInfo(tpNames, arginfosl, retInfo)) =
46324632

46334633
andremapValData g tmenv(d:ValData)=
46344634
letty= d.val_type
4635-
lettopValInfo= d.val_repr_info
4636-
letty'= ty|> remapPossibleForallTy g tmenv
4635+
lettopValInfo= d.ValReprInfo
4636+
lettyR= ty|> remapPossibleForallTy g tmenv
4637+
letdeclaringEntityR= d.DeclaringEntity|> remapParentRef tmenv
4638+
letreprInfoR= d.ValReprInfo|> Option.map(remapValReprInfo g tmenv)
4639+
letmemberInfoR= d.MemberInfo|> Option.map(remapMemberInfo g d.val_range topValInfo ty tyR tmenv)
4640+
letattribsR= d.Attribs|> remapAttribs g tmenv
46374641
{ dwith
4638-
val_type= ty';
4639-
val_declaring_entity= d.val_declaring_entity|> remapParentRef tmenv;
4640-
val_repr_info= d.val_repr_info|> Option.map(remapValReprInfo g tmenv);
4641-
val_member_info= d.val_member_info|> Option.map(remapMemberInfo g d.val_range topValInfo ty ty' tmenv);
4642-
val_attribs= d.val_attribs|> remapAttribs g tmenv}
4642+
val_type= tyR
4643+
val_opt_data=
4644+
match d.val_opt_datawith
4645+
| Some dd->
4646+
Some{ ddwith
4647+
val_declaring_entity= declaringEntityR
4648+
val_repr_info= reprInfoR
4649+
val_member_info= memberInfoR
4650+
val_attribs= attribsR}
4651+
| None-> None}
46434652

46444653
andremapParentRef tyenv p=
46454654
match pwith
@@ -6997,8 +7006,8 @@ let etaExpandTypeLambda g m tps (tm, ty) =
69977006
if isNil tpsthen tmelse mkTypeLambda m tps(mkApps g((tm, ty),[(List.map mkTyparTy tps)],[], m), ty)
69987007

69997008
letAdjustValToTopVal(tmp:Val)parent valData=
7000-
tmp.SetValReprInfo(Some valData);
7001-
tmp.val_declaring_entity<-parent;
7009+
tmp.SetValReprInfo(Some valData)
7010+
tmp.SetDeclaringEntityparent
70027011
tmp.SetIsMemberOrModuleBinding()
70037012

70047013
/// For match with only one non-failing target T0, the other targets, T1... failing (say, raise exception).

‎src/fsharp/TastPickle.fs‎

Lines changed: 31 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -1812,20 +1812,20 @@ and p_vrefFlags x st =
18121812

18131813
andp_ValData x st=
18141814
p_string x.val_logical_name st
1815-
p_option p_string x.val_compiled_name st
1815+
p_option p_string x.ValCompiledName st
18161816
// only keep range information on published values, not on optimization data
1817-
p_ranges(if x.val_repr_info.IsSomethen Some(x.val_range, x.DefinitionRange)else None) st
1817+
p_ranges(x.ValReprInfo|> Option.map(fun _->x.val_range, x.DefinitionRange)) st
18181818
p_typ x.val_type st
18191819
p_int64 x.val_flags.PickledBits st
1820-
p_option p_member_info x.val_member_info st
1821-
p_attribs x.val_attribs st
1822-
p_option p_ValReprInfo x.val_repr_info st
1823-
p_string x.val_xmldocsig st
1824-
p_access x.val_access st
1825-
p_parentref x.val_declaring_entity st
1826-
p_option p_const x.val_const st
1820+
p_option p_member_info x.MemberInfo st
1821+
p_attribs x.Attribs st
1822+
p_option p_ValReprInfo x.ValReprInfo st
1823+
p_string x.XmlDocSig st
1824+
p_access x.Accessibility st
1825+
p_parentref x.DeclaringEntity st
1826+
p_option p_const x.LiteralValue st
18271827
if st.oInMemthen
1828-
p_used_space1(p_xmldoc x.val_xmldoc) st
1828+
p_used_space1(p_xmldoc x.XmlDoc) st
18291829
else
18301830
p_space1() st
18311831

@@ -2121,22 +2121,27 @@ and u_ValData st =
21212121
(u_option u_const)
21222122
(u_used_space1 u_xmldoc)
21232123
st
2124-
{ val_logical_name=x1
2125-
val_compiled_name=x1z
2126-
val_range=(match x1awith None-> range0| Some(a,_)-> a)
2127-
val_other_range=(match x1awith None-> None| Some(_,b)-> Some(b,true))
2128-
val_type=x2
2129-
val_stamp=newStamp()
2130-
val_flags=ValFlags(x4)
2131-
val_defn= None
2132-
val_member_info=x8
2133-
val_attribs=x9
2134-
val_repr_info=x10
2135-
val_xmldoc= defaultArg x15 XmlDoc.Empty
2136-
val_xmldocsig=x12
2137-
val_access=x13
2138-
val_declaring_entity=x13b
2139-
val_const=x14
2124+
2125+
{ val_logical_name= x1
2126+
val_range=(match x1awith None-> range0| Some(a,_)-> a)
2127+
val_type= x2
2128+
val_stamp= newStamp()
2129+
val_flags= ValFlags(x4)
2130+
val_opt_data=
2131+
match x1z, x1a, x10, x14, x13, x15, x8, x13b, x12, x9with
2132+
| None, None, None, None, TAccess[], None, None, ParentNone,"",[]-> None
2133+
|_->
2134+
Some{ val_compiled_name= x1z
2135+
val_other_range=(match x1awith None-> None| Some(_,b)-> Some(b,true))
2136+
val_defn= None
2137+
val_repr_info= x10
2138+
val_const= x14
2139+
val_access= x13
2140+
val_xmldoc= defaultArg x15 XmlDoc.Empty
2141+
val_member_info= x8
2142+
val_declaring_entity= x13b
2143+
val_xmldocsig= x12
2144+
val_attribs= x9}
21402145
}
21412146

21422147
andu_Val st= u_osgn_decl st.ivals u_ValData st

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp