Skip to content

Commit

Permalink
Merge pull request dotnet#50 from ncave/optimize
Browse files Browse the repository at this point in the history
more targeted replacements
  • Loading branch information
forki committed Feb 2, 2018
2 parents c965f06 + 1e373c7 commit adc20e2
Showing 1 changed file with 4 additions and 6 deletions.
10 changes: 4 additions & 6 deletions src/fsharp/symbols/Exprs.fs
Original file line number Diff line number Diff line change
Expand Up @@ -617,12 +617,14 @@ module FSharpExprConvert =
ConvExprPrim cenv env op

| TOp.ILAsm ([ I_call (Normalcall, mspec, None) ], _), _, [arg]
when mspec.Name = "GetHashCode" ->
when mspec.MethodRef.EnclosingTypeRef.Name = "System.String" && mspec.Name = "GetHashCode" ->
let ty = tyOfExpr cenv.g arg
let op = mkCallHash cenv.g m ty arg
ConvExprPrim cenv env op

| TOp.ILAsm([ I_ldtoken (ILToken.ILType _ilty) ], _), [ty], _ ->
| TOp.ILCall(_, _, _, _, _, _, _, mref, _, _, _), [],
[Expr.Op(TOp.ILAsm([ I_ldtoken (ILToken.ILType _) ], _), [ty], _, _)]
when mref.EnclosingTypeRef.Name = "System.Type" && mref.Name = "GetTypeFromHandle" ->
let op = mkCallTypeOf cenv.g m ty
ConvExprPrim cenv env op

Expand Down Expand Up @@ -754,10 +756,6 @@ module FSharpExprConvert =
else lim1
E.FastIntegerForLoop(ConvExpr cenv env lim0, ConvExpr cenv env lim1, ConvExpr cenv env body, dir <> FSharpForLoopDown)

| TOp.ILCall(_, _, _, _isNewObj, _valUseFlags, _isProp, _, ilMethRef, _enclTypeArgs, _methTypeArgs, _tys), [], [arg]
when ilMethRef.EnclosingTypeRef.Name = "System.Type" && ilMethRef.Name = "GetTypeFromHandle" ->
ConvExprPrim cenv env arg

| TOp.ILCall(_, _, _, isNewObj, valUseFlags, _isProp, _, ilMethRef, enclTypeArgs, methTypeArgs, _tys), [], callArgs ->
ConvILCall cenv env (isNewObj, valUseFlags, ilMethRef, enclTypeArgs, methTypeArgs, callArgs, m)

Expand Down

0 comments on commit adc20e2

Please sign in to comment.