Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

more targeted replacements #50

Merged
merged 1 commit into from
Feb 2, 2018
Merged
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
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