提交 eb333d99 编写于 作者: T TIHan

Removed unrelated code changes to the fix

上级 1fe80512
......@@ -395,7 +395,7 @@ let SetOptimizeOn(tcConfigB: TcConfigBuilder) =
tcConfigB.optSettings <- { tcConfigB.optSettings with jitOptUser = Some true }
tcConfigB.optSettings <- { tcConfigB.optSettings with localOptUser = Some true }
tcConfigB.optSettings <- { tcConfigB.optSettings with crossModuleOptUser = Some true }
tcConfigB.optSettings <- { tcConfigB.optSettings with lambdaInlineThreshold = Optimizer.LambdaInlineThresholdDefault }
tcConfigB.optSettings <- { tcConfigB.optSettings with lambdaInlineThreshold = 6 }
tcConfigB.doDetuple <- true
tcConfigB.doTLR <- true
tcConfigB.doFinalSimplify <- true
......
......@@ -4383,62 +4383,9 @@ and GenGenericParams cenv eenv tps =
and GenGenericArgs m (tyenv: TypeReprEnv) tps =
tps |> DropErasedTypars |> List.map (fun c -> (mkILTyvarTy tyenv.[c, m]))
and GenMethodForLambda cenv mgbuf eenv (entryPointInfo, cloinfo, eenvinner, body, isLocalTypeFunc, m) =
let g = cenv.g
let ilCloBody = CodeGenMethodForExpr cenv mgbuf (SPAlways, entryPointInfo, cloinfo.cloName, eenvinner, 1, body, Return)
let ilCloTypeRef = cloinfo.cloSpec.TypeRef
let cloTypeDefs =
if isLocalTypeFunc then
// Work out the contract type and generate a class with an abstract method for this type
let (ilContractGenericParams, ilContractMethTyargs, ilContractTySpec: ILTypeSpec, ilContractFormalRetTy) = GenNamedLocalTypeFuncContractInfo cenv eenv m cloinfo
let ilContractTypeRef = ilContractTySpec.TypeRef
let ilContractTy = mkILFormalBoxedTy ilContractTypeRef ilContractGenericParams
let ilContractCtor = mkILNonGenericEmptyCtor None g.ilg.typ_Object
let ilContractMeths = [ilContractCtor; mkILGenericVirtualMethod("DirectInvoke", ILMemberAccess.Assembly, ilContractMethTyargs, [], mkILReturn ilContractFormalRetTy, MethodBody.Abstract) ]
let ilContractTypeDef =
ILTypeDef(name = ilContractTypeRef.Name,
layout = ILTypeDefLayout.Auto,
attributes = enum 0,
genericParams = ilContractGenericParams,
customAttrs = mkILCustomAttrs [mkCompilationMappingAttr g (int SourceConstructFlags.Closure) ],
fields = emptyILFields,
events= emptyILEvents,
properties = emptyILProperties,
methods= mkILMethods ilContractMeths,
methodImpls= emptyILMethodImpls,
nestedTypes=emptyILTypeDefs,
implements = [],
extends= Some g.ilg.typ_Object,
securityDecls= emptyILSecurityDecls)
// the contract type is an abstract type and not sealed
let ilContractTypeDef =
ilContractTypeDef
.WithAbstract(true)
.WithAccess(ComputeTypeAccess ilContractTypeRef true)
.WithSerializable(true)
.WithSpecialName(true)
.WithLayout(ILTypeDefLayout.Auto)
.WithInitSemantics(ILTypeInit.BeforeField)
.WithEncoding(ILDefaultPInvokeEncoding.Auto)
mgbuf.AddTypeDef(ilContractTypeRef, ilContractTypeDef, false, false, None)
let ilCtorBody = mkILMethodBody (true, [], 8, nonBranchingInstrsToCode (mkCallBaseConstructor(ilContractTy, [])), None )
let cloMethods = [ mkILGenericVirtualMethod("DirectInvoke", ILMemberAccess.Assembly, cloinfo.localTypeFuncDirectILGenericParams, [], mkILReturn (cloinfo.cloILFormalRetTy), MethodBody.IL ilCloBody) ]
let cloTypeDefs = GenClosureTypeDefs cenv (ilCloTypeRef, cloinfo.cloILGenericParams, [], cloinfo.cloILFreeVars, cloinfo.ilCloLambdas, ilCtorBody, cloMethods, [], ilContractTy, [])
cloTypeDefs
else
GenClosureTypeDefs cenv (ilCloTypeRef, cloinfo.cloILGenericParams, [], cloinfo.cloILFreeVars, cloinfo.ilCloLambdas, ilCloBody, [], [], g.ilg.typ_Object, [])
CountClosure()
for cloTypeDef in cloTypeDefs do
mgbuf.AddTypeDef(ilCloTypeRef, cloTypeDef, false, false, None)
/// Generate the closure class for a function
and GenLambdaClosure cenv (cgbuf: CodeGenBuffer) eenv isLocalTypeFunc selfv expr =
let g = cenv.g
match expr with
| Expr.Lambda (_, _, _, _, _, m, _)
| Expr.TyLambda (_, _, _, m, _) ->
......@@ -4450,7 +4397,57 @@ and GenLambdaClosure cenv (cgbuf: CodeGenBuffer) eenv isLocalTypeFunc selfv expr
| Some v -> [(v, BranchCallClosure (cloinfo.cloArityInfo))]
| _ -> []
GenMethodForLambda cenv cgbuf.mgbuf eenv (entryPointInfo, cloinfo, eenvinner, body, isLocalTypeFunc, m)
let ilCloBody = CodeGenMethodForExpr cenv cgbuf.mgbuf (SPAlways, entryPointInfo, cloinfo.cloName, eenvinner, 1, body, Return)
let ilCloTypeRef = cloinfo.cloSpec.TypeRef
let cloTypeDefs =
if isLocalTypeFunc then
// Work out the contract type and generate a class with an abstract method for this type
let (ilContractGenericParams, ilContractMethTyargs, ilContractTySpec: ILTypeSpec, ilContractFormalRetTy) = GenNamedLocalTypeFuncContractInfo cenv eenv m cloinfo
let ilContractTypeRef = ilContractTySpec.TypeRef
let ilContractTy = mkILFormalBoxedTy ilContractTypeRef ilContractGenericParams
let ilContractCtor = mkILNonGenericEmptyCtor None g.ilg.typ_Object
let ilContractMeths = [ilContractCtor; mkILGenericVirtualMethod("DirectInvoke", ILMemberAccess.Assembly, ilContractMethTyargs, [], mkILReturn ilContractFormalRetTy, MethodBody.Abstract) ]
let ilContractTypeDef =
ILTypeDef(name = ilContractTypeRef.Name,
layout = ILTypeDefLayout.Auto,
attributes = enum 0,
genericParams = ilContractGenericParams,
customAttrs = mkILCustomAttrs [mkCompilationMappingAttr g (int SourceConstructFlags.Closure) ],
fields = emptyILFields,
events= emptyILEvents,
properties = emptyILProperties,
methods= mkILMethods ilContractMeths,
methodImpls= emptyILMethodImpls,
nestedTypes=emptyILTypeDefs,
implements = [],
extends= Some g.ilg.typ_Object,
securityDecls= emptyILSecurityDecls)
// the contract type is an abstract type and not sealed
let ilContractTypeDef =
ilContractTypeDef
.WithAbstract(true)
.WithAccess(ComputeTypeAccess ilContractTypeRef true)
.WithSerializable(true)
.WithSpecialName(true)
.WithLayout(ILTypeDefLayout.Auto)
.WithInitSemantics(ILTypeInit.BeforeField)
.WithEncoding(ILDefaultPInvokeEncoding.Auto)
cgbuf.mgbuf.AddTypeDef(ilContractTypeRef, ilContractTypeDef, false, false, None)
let ilCtorBody = mkILMethodBody (true, [], 8, nonBranchingInstrsToCode (mkCallBaseConstructor(ilContractTy, [])), None )
let cloMethods = [ mkILGenericVirtualMethod("DirectInvoke", ILMemberAccess.Assembly, cloinfo.localTypeFuncDirectILGenericParams, [], mkILReturn (cloinfo.cloILFormalRetTy), MethodBody.IL ilCloBody) ]
let cloTypeDefs = GenClosureTypeDefs cenv (ilCloTypeRef, cloinfo.cloILGenericParams, [], cloinfo.cloILFreeVars, cloinfo.ilCloLambdas, ilCtorBody, cloMethods, [], ilContractTy, [])
cloTypeDefs
else
GenClosureTypeDefs cenv (ilCloTypeRef, cloinfo.cloILGenericParams, [], cloinfo.cloILFreeVars, cloinfo.ilCloLambdas, ilCloBody, [], [], g.ilg.typ_Object, [])
CountClosure()
for cloTypeDef in cloTypeDefs do
cgbuf.mgbuf.AddTypeDef(ilCloTypeRef, cloTypeDef, false, false, None)
cloinfo, m
| _ -> failwith "GenLambda: not a lambda"
......
......@@ -278,8 +278,6 @@ let [<Literal>] localOptDefault = true
let [<Literal>] crossModuleOptDefault = true
let [<Literal>] LambdaInlineThresholdDefault = 6
type OptimizationSettings =
{ abstractBigTargets : bool
......@@ -317,7 +315,7 @@ type OptimizationSettings =
bigTargetSize = 100
veryBigExprSize = 3000
crossModuleOptUser = None
lambdaInlineThreshold = LambdaInlineThresholdDefault
lambdaInlineThreshold = 6
reportingPhase = false
reportNoNeedToTailcall = false
reportFunctionSizes = false
......@@ -1934,7 +1932,7 @@ let rec OptimizeExpr cenv (env: IncrementalOptimizationEnv) expr =
/// Optimize/analyze an object expression
and OptimizeObjectExpr cenv env (ty, baseValOpt, basecall, overrides, iimpls, m) =
let basecallR, basecallinfo = OptimizeExpr cenv env basecall
let overridesR, overrideinfos = OptimizeObjectExprMethods cenv env baseValOpt overrides
let overridesR, overrideinfos = OptimizeMethods cenv env baseValOpt overrides
let iimplsR, iimplsinfos = OptimizeInterfaceImpls cenv env baseValOpt iimpls
let exprR=mkObjExpr(ty, baseValOpt, basecallR, overridesR, iimplsR, m)
exprR, { TotalSize=closureTotalSize + basecallinfo.TotalSize + AddTotalSizes overrideinfos + AddTotalSizes iimplsinfos
......@@ -1944,10 +1942,10 @@ and OptimizeObjectExpr cenv env (ty, baseValOpt, basecall, overrides, iimpls, m)
Info=UnknownValue}
/// Optimize/analyze the methods that make up an object expression
and OptimizeObjectExprMethods cenv env baseValOpt methods =
OptimizeList (OptimizeObjectExprMethod cenv env baseValOpt) methods
and OptimizeMethods cenv env baseValOpt methods =
OptimizeList (OptimizeMethod cenv env baseValOpt) methods
and OptimizeObjectExprMethod cenv env baseValOpt (TObjExprMethod(slotsig, attribs, tps, vs, e, m) as tmethod) =
and OptimizeMethod cenv env baseValOpt (TObjExprMethod(slotsig, attribs, tps, vs, e, m) as tmethod) =
let env = {env with latestBoundId=Some tmethod.Id; functionVal = None}
let env = BindTypeVarsToUnknown tps env
let env = BindInternalValsToUnknown cenv vs env
......@@ -1967,7 +1965,7 @@ and OptimizeInterfaceImpls cenv env baseValOpt iimpls =
/// Optimize/analyze the interface implementations that form part of an object expression
and OptimizeInterfaceImpl cenv env baseValOpt (ty, overrides) =
let overridesR, overridesinfos = OptimizeObjectExprMethods cenv env baseValOpt overrides
let overridesR, overridesinfos = OptimizeMethods cenv env baseValOpt overrides
(ty, overridesR),
{ TotalSize = AddTotalSizes overridesinfos
FunctionSize = 1
......
......@@ -61,8 +61,4 @@ val UnionOptimizationInfos: seq<ImplFileOptimizationInfo> -> CcuOptimizationInfo
/// Check if an expression has an effect
val ExprHasEffect: TcGlobals -> Expr -> bool
val internal u_CcuOptimizationInfo : TastPickle.ReaderState -> CcuOptimizationInfo
// REVIEW: We need to put the literal at the end of a file due to a bug that causes a compiler error when a literal is put in the middle other signature constructs.
[<Literal>]
val LambdaInlineThresholdDefault : int = 6
\ No newline at end of file
val internal u_CcuOptimizationInfo : TastPickle.ReaderState -> CcuOptimizationInfo
\ No newline at end of file
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册