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

Commitf551344

Browse files
committed
Output symbol info for locals
1 parentd6a0faa commitf551344

File tree

7 files changed

+36
-14
lines changed

7 files changed

+36
-14
lines changed

‎src/absil/il.fs‎

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1185,7 +1185,8 @@ and ILFilterBlock =
11851185
[<NoComparison; NoEquality>]
11861186
typeILLocal=
11871187
{ Type:ILType;
1188-
IsPinned:bool}
1188+
IsPinned:bool;
1189+
DebugInfo:(string* int* int) option}
11891190

11901191
typeILLocals= ILList<ILLocal>
11911192
letemptyILLocals=(ILList.empty: ILLocals)
@@ -3022,9 +3023,10 @@ let mkILReturn ty : ILReturn =
30223023
Type=ty;
30233024
CustomAttrs=emptyILCustomAttrs}
30243025

3025-
letmkILLocal ty=
3026+
letmkILLocal tydbgInfo=
30263027
{ IsPinned=false;
3027-
Type=ty;}
3028+
Type=ty;
3029+
DebugInfo=dbgInfo}
30283030

30293031
typeILFieldSpecwith
30303032
memberfr.ActualType=

‎src/absil/il.fsi‎

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -970,7 +970,8 @@ type ILNativeType =
970970
[<NoComparison; NoEquality>]
971971
typeILLocal=
972972
{ Type:ILType;
973-
IsPinned:bool}
973+
IsPinned:bool;
974+
DebugInfo:(string* int* int) option}
974975

975976

976977
typeILLocals= ILList<ILLocal>
@@ -1955,7 +1956,7 @@ val mkILParam: string option * ILType -> ILParameter
19551956
val mkILParamAnon: ILType-> ILParameter
19561957
val mkILParamNamed: string* ILType-> ILParameter
19571958
val mkILReturn: ILType-> ILReturn
1958-
val mkILLocal: ILType-> ILLocal
1959+
val mkILLocal: ILType->(string* int* int) option->ILLocal
19591960
val mkILLocals: ILLocal list-> ILLocals
19601961
val emptyILLocals: ILLocals
19611962

‎src/absil/ilread.fs‎

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2206,7 +2206,8 @@ and sigptrGetLocal ctxt numtypars bytes sigptr =
22062206
false, sigptr
22072207
lettyp,sigptr= sigptrGetTy ctxt numtypars bytes sigptr
22082208
{ IsPinned= pinned;
2209-
Type= typ}, sigptr
2209+
Type= typ;
2210+
DebugInfo= None}, sigptr
22102211

22112212
andreadBlobHeapAsMethodSig ctxt numtypars blobIdx=
22122213
ctxt.readBlobHeapAsMethodSig(BlobAsMethodSigIdx(numtypars,blobIdx))

‎src/absil/ilreflect.fs‎

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1252,7 +1252,11 @@ let emitCode cenv modB emEnv (ilG:ILGenerator) code =
12521252

12531253
letemitLocal cenv emEnv(ilG:ILGenerator)(local:ILLocal)=
12541254
letty= convType cenv emEnv local.Type
1255-
ilG.DeclareLocalAndLog(ty,local.IsPinned)
1255+
letlocBuilder= ilG.DeclareLocalAndLog(ty, local.IsPinned)
1256+
match local.DebugInfowith
1257+
| Some(nm, start, finish)-> locBuilder.SetLocalSymInfo(nm, start, finish)
1258+
| None->()
1259+
locBuilder
12561260

12571261
letemitILMethodBody cenv modB emEnv(ilG:ILGenerator)ilmbody=
12581262
// XXX - REVIEW:

‎src/fsharp/ilxgen.fs‎

Lines changed: 17 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1534,7 +1534,7 @@ let discardAndReturnVoid = DiscardThen ReturnVoid
15341534
// the bodies of methods in a couple of places
15351535
//-------------------------------------------------------------------------
15361536

1537-
letCodeGenThen mgbuf(zapFirstSeqPointToStart,entryPointInfo,methodName,eenv,alreadyUsedArgs,alreadyUsedLocals,codeGenFunction,m)=
1537+
letCodeGenThencenvmgbuf(zapFirstSeqPointToStart,entryPointInfo,methodName,eenv,alreadyUsedArgs,alreadyUsedLocals,codeGenFunction,m)=
15381538
letcgbuf=new CodeGenBuffer(m,mgbuf,methodName,alreadyUsedArgs,alreadyUsedLocals,zapFirstSeqPointToStart)
15391539
letstart= CG.GenerateMark cgbuf"mstart"
15401540
letinnerVals= entryPointInfo|> List.map(fun(v,kind)->(v,(kind,start)))
@@ -1554,7 +1554,21 @@ let CodeGenThen mgbuf (zapFirstSeqPointToStart,entryPointInfo,methodName,eenv,al
15541554
{ locRange=(start.CodeLabel, finish.CodeLabel);
15551555
locInfos=[{ LocalIndex=i; LocalName=nm}]})
15561556

1557-
(List.map(snd>> mkILLocal) locals,
1557+
letilLocals=
1558+
locals
1559+
|> List.map(fun(infos,ty)->
1560+
// in interactive environment, attach name and range info to locals to improve debug experience
1561+
if cenv.opts.isInteractive&& cenv.opts.generateDebugSymbolsthen
1562+
match infoswith
1563+
|[(nm,(start, finish))]-> mkILLocal ty(Some(nm, start.CodeLabel, finish.CodeLabel))
1564+
// REVIEW: what do these cases represent?
1565+
|_::_
1566+
|[]-> mkILLocal ty None
1567+
// if not interactive, don't bother adding this info
1568+
else
1569+
mkILLocal ty None)
1570+
1571+
(ilLocals,
15581572
maxStack,
15591573
computeCodeLabelToPC,
15601574
code,
@@ -1566,7 +1580,7 @@ let CodeGenMethod cenv mgbuf (zapFirstSeqPointToStart,entryPointInfo,methodName,
15661580
(* Codegen the method. REVIEW: change this to generate the AbsIL code tree directly...*)
15671581

15681582
letlocals,maxStack,computeCodeLabelToPC,instrs,exns,localDebugSpecs,hasSequencePoints=
1569-
CodeGenThen mgbuf(zapFirstSeqPointToStart,entryPointInfo,methodName,eenv,alreadyUsedArgs,alreadyUsedLocals,codeGenFunction,m)
1583+
CodeGenThencenvmgbuf(zapFirstSeqPointToStart,entryPointInfo,methodName,eenv,alreadyUsedArgs,alreadyUsedLocals,codeGenFunction,m)
15701584

15711585
letdump()=
15721586
instrs|> Array.iteri(fun i instr-> dprintf"%s:%d:%A\n" methodName i instr);

‎src/ilx/cu_erase.fs‎

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -377,7 +377,7 @@ let rec convInstr cenv (tmps: ILLocalsAllocator) inplab outlab instr =
377377
InstrMorph[ AI_pop;(AI_ldc(DT_I4, ILConst.I40))]
378378
| RuntimeTypes->
379379
letbaseTy= baseTyOfUnionSpec cuspec
380-
letlocn= tmps.AllocLocal(mkILLocal baseTy)
380+
letlocn= tmps.AllocLocal(mkILLocal baseTy None)
381381

382382
letmkCase last inplab cidx failLab=
383383
letalt= altOfUnionSpec cuspec cidx
@@ -495,7 +495,7 @@ let rec convInstr cenv (tmps: ILLocalsAllocator) inplab outlab instr =
495495

496496
match cuspecRepr.DiscriminationTechnique cuspecwith
497497
| RuntimeTypes->
498-
letlocn= tmps.AllocLocal(mkILLocal baseTy)
498+
letlocn= tmps.AllocLocal(mkILLocal baseTy None)
499499
letmkCase _last inplab(cidx,tg)failLab=
500500
letalt= altOfUnionSpec cuspec cidx
501501
letaltTy= tyForAlt cuspec alt

‎src/ilx/pubclo.fs‎

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -226,7 +226,7 @@ let rec convInstr cenv (tmps: ILLocalsAllocator, thisGenParams: ILGenericParamet
226226
| Apps_app(arg,rest)->
227227
letstorers,loaders= unwind rest
228228
letargStorers,argLoaders=
229-
letlocn= tmps.AllocLocal(mkILLocal arg)
229+
letlocn= tmps.AllocLocal(mkILLocal arg None)
230230
[mkStloc locn],[mkLdloc locn]
231231
argStorers:: storers, argLoaders:: loaders
232232
| Apps_done_->
@@ -348,7 +348,7 @@ let mkILFreeVarForParam (p : ILParameter) =
348348
letnm=(match p.Namewith Some x-> x| None-> failwith"closure parameters must be given names")
349349
mkILFreeVar(nm,false,p.Type)
350350

351-
letmkILLocalForFreeVar(p:IlxClosureFreeVar)= mkILLocal p.fvType
351+
letmkILLocalForFreeVar(p:IlxClosureFreeVar)= mkILLocal p.fvType None
352352

353353
letmkILCloFldSpecs _cenv flds=
354354
flds|> Array.map(fun fv->(fv.fvName,fv.fvType))|> Array.toList

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp