Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 1 addition & 15 deletions src/fsharp/IlxGen.fs
Original file line number Diff line number Diff line change
Expand Up @@ -132,20 +132,6 @@ let CountMethodDef = NewCounter "IL method defintitions corresponding to values"
let CountStaticFieldDef = NewCounter "IL field defintitions corresponding to values"
let CountCallFuncInstructions = NewCounter "callfunc instructions (indirect calls)"

//-------------------------------------------------------------------------
// Part of the last-minute tranformation performed by this file
// is to eliminate variables of static type "unit". These are
// utility functions related to this.
//-------------------------------------------------------------------------

let BindUnitVars g (mvs:Val list, paramInfos, body) =
match mvs,paramInfos with
| [v],[] ->
assert isUnitTy g v.Type
[], mkLet NoSequencePointAtInvisibleBinding v.Range v (mkUnit g v.Range) body
| _ -> mvs,body


/// Non-local information related to internals of code generation within an assembly
type IlxGenIntraAssemblyInfo =
{ /// A table recording the generated name of the static backing fields for each mutable top level value where
Expand All @@ -155,7 +141,6 @@ type IlxGenIntraAssemblyInfo =
/// that come from both the signature and the implementation.
StaticFieldInfo : Dictionary<ILMethodRef, ILFieldSpec> }

//--------------------------------------------------------------------------
//--------------------------------------------------------------------------

/// Indicates how the generated IL code is ultimately emitted
Expand Down Expand Up @@ -4093,6 +4078,7 @@ and GenDelegateExpr cenv cgbuf eenvouter expr (TObjExprMethod((TSlotSig(_,delega
let ilDelegeeParams,ilDelegeeRet = GenActualSlotsig m cenv envForDelegeeUnderTypars slotsig methTyparsOfOverridingMethod

let numthis = 1
let tmvs, body = BindUnitVars cenv.g (tmvs, List.replicate (List.concat slotsig.FormalParams).Length ValReprInfo.unnamedTopArg1, body)
let envForDelegeeMeth = AddStorageForLocalVals cenv.g (List.mapi (fun i v -> (v,Arg (i+numthis))) tmvs) envForDelegeeUnderTypars
let ilMethodBody = CodeGenMethodForExpr cenv cgbuf.mgbuf (SPAlways,[],delegeeMethName,envForDelegeeMeth,1,0,body,(if slotSigHasVoidReturnTy slotsig then discardAndReturnVoid else Return))
let delegeeInvokeMeth =
Expand Down
15 changes: 15 additions & 0 deletions src/fsharp/TastOps.fs
Original file line number Diff line number Diff line change
Expand Up @@ -7993,3 +7993,18 @@ let DetectAndOptimizeForExpression g option expr =

// Used to remove Expr.Link for inner expressions in pattern matches
let (|InnerExprPat|) expr = stripExpr expr

//-------------------------------------------------------------------------
// One of the tranformations performed by the compiler
// is to eliminate variables of static type "unit". These are
// utility functions related to this.
//-------------------------------------------------------------------------

let BindUnitVars g (mvs:Val list, paramInfos:ArgReprInfo list, body) =
match mvs,paramInfos with
| [v],[] ->
assert isUnitTy g v.Type
[], mkLet NoSequencePointAtInvisibleBinding v.Range v (mkUnit g v.Range) body
| _ -> mvs,body


2 changes: 2 additions & 0 deletions src/fsharp/TastOps.fsi
Original file line number Diff line number Diff line change
Expand Up @@ -1432,3 +1432,5 @@ val mkCoerceIfNeeded : TcGlobals -> tgtTy: TType -> srcTy: TType -> Expr -> Expr
val (|InnerExprPat|) : Expr -> Expr

val allValsOfModDef : ModuleOrNamespaceExpr -> seq<Val>

val BindUnitVars : TcGlobals -> (Val list * ArgReprInfo list * Expr) -> Val list * Expr
Original file line number Diff line number Diff line change
Expand Up @@ -38,4 +38,5 @@

SOURCE=E_PrettifyForall.fs SCFLAGS="--test:ErrorRanges --flaterrors" # E_PrettifyForall.fs

SOURCE=IgnoreUnitParameters.fs # IgnoreUnitParameters.fs
SOURCE=IgnoreUnitParameters.fs # IgnoreUnitParameters.fs
SOURCE=IgnoreUnitParameters.fs SCFLAGS="--optimize- -g" # IgnoreUnitParameters2.fs