Skip to content

Commit adc20e2

Browse files
authored
Merge pull request #50 from ncave/optimize
more targeted replacements
2 parents c965f06 + 1e373c7 commit adc20e2

File tree

1 file changed

+4
-6
lines changed

1 file changed

+4
-6
lines changed

src/fsharp/symbols/Exprs.fs

Lines changed: 4 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -617,12 +617,14 @@ module FSharpExprConvert =
617617
ConvExprPrim cenv env op
618618

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

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

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

757-
| TOp.ILCall(_, _, _, _isNewObj, _valUseFlags, _isProp, _, ilMethRef, _enclTypeArgs, _methTypeArgs, _tys), [], [arg]
758-
when ilMethRef.EnclosingTypeRef.Name = "System.Type" && ilMethRef.Name = "GetTypeFromHandle" ->
759-
ConvExprPrim cenv env arg
760-
761759
| TOp.ILCall(_, _, _, isNewObj, valUseFlags, _isProp, _, ilMethRef, enclTypeArgs, methTypeArgs, _tys), [], callArgs ->
762760
ConvILCall cenv env (isNewObj, valUseFlags, ilMethRef, enclTypeArgs, methTypeArgs, callArgs, m)
763761

0 commit comments

Comments
 (0)